This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does cygwin1.dll use NtCreateFile() instead of CreateFile()

On Sun, 30 Jan 2005, Dan Ch wrote:

> I noticed that cygwin-1.5.12-1/winsup/cygwin/
> 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.

An aside to CGF and Corinna: I have seen (and mostly agree) with the
reasons for keeping the cygwin-developers archives private, but questions
like this may, IMO, occasionally require us to quote messages from there.
I feel that this particular quote was justified, but please let me know if
you don't think it was.
P.S. When someone's subscription request to cygwin-developers is approved,
does the welcome message contain the instructions for accessing the
archives?  If it does -- great.  If not, it should.
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]