Mail Archives: cygwin/2005/01/30/18:38:03
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 -