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

Dan Ch force296-cygwin@yahoo.com
Mon Jan 31 07:53:00 GMT 2005


On Sun, 30 Jan 2005, Reini Urban wrote:
> Dan Ch schrieb:
> > 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().
>
> Special filenames in subdirs like con,prn,aux,nul,lpt1 et al do not work
> with CreateFile(), but do work as plain files with NtCreateFile().

Thank you for your answer and sample program.  I think being able to
use reserved names like con and prn for ordinary files is a negative
instead of a positive.  Files with these names can not be deleted or
renamed with rm or Windows Explorer unless you know the "secret"
prefix that was mentioned on this list several months ago.  Note that
the current version (1.5.12-1) of Cygwin checks for these names
before deciding whether to use NtCreateFile() or CreateFile() which
prevents these names from being used for ordinary files.

I am still interested if old (pre NtCreateFile()) versions of Cygwin
had "buggy" behavior other than not being able to use reserved file
names that required switching to NtCreateFile() to solve.


--
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/



More information about the Cygwin mailing list