delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/30/18:38:03

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <20050130233747.5199.qmail@web80101.mail.yahoo.com>
Date: Sun, 30 Jan 2005 15:37:47 -0800 (PST)
From: Dan Ch <force296-cygwin AT yahoo DOT com>
Reply-To: force296-cygwin AT yahoo DOT com
Subject: Re: Why does cygwin1.dll use NtCreateFile() instead of CreateFile()
To: cygwin AT cygwin DOT com
In-Reply-To: <Pine.GSO.4.61.0501301341580.23053@slinky.cs.nyu.edu>
MIME-Version: 1.0
X-IsSubscribed: yes

On Sun, 30 Jan 2005, Igor Pechtchanski wrote:
> On Sun, 30 Jan 2005, Dan Ch wrote:
> > I noticed that cygwin-1.5.12-1/winsup/cygwin/fhandler.cc
> > uses NtCreateFile() instead of CreateFile() on Windows NT based
> > operating systems (NT, 2000, 2003, XP) for opening files.  Why?  I
> > checked the archives for this mailing list and noted some activity
> > that discuses some side affects caused by using NtCreateFile()
> > instead of CreateFile() such as being able to use file names that are
> > off limits to normal Windows applications.  But I could not find
> > anything that explains the benefits of using NtCreateFile() instead
> > of CreateFile().
>
> This is a reasonable question, with the answer buried in the (private)
> archives of cygwin-developers.  I'm taking the liberty of quoting the
> answer here:
>
> On Fri, 16 Apr 2004, Corinna Vinschen wrote on cygwin-developers:
> > I've changed fhandler_base::open to use NtCreateFile now.  After some
> > head scratching and searching with google, I read that the Win32
> > CreateFile call adds some access bits at its own will, namely the
> > FILE_READ_ATTRIBUTES and SYNCHRONIZE bits.  The latter is a problem
> > when a user has no FILE_READ_DATA permission on a file since that
> > apparently seem to disallow requesting SYNCHRONIZE.

Thank you for providing some information.  But I do not understand
what types of objects require read permission in order to successfully
open with SYNCHRONIZE access.  On Windows XP Professional SP2, using
CreateFile(...,GENERIC_WRITE | SYNCHRONIZE, ...) to open an ordinary
file on a local drive that has write-only permissions does not seem
to be a problem.  I am primarily interested in the "buggy behavior"
that a user would experience if CreateFile() was used instead
of NtCreateFile().


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019