Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 30 Jan 2005 13:50:04 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Dan Ch cc: cygwin AT cygwin DOT com Subject: Re: Why does cygwin1.dll use NtCreateFile() instead of CreateFile() In-Reply-To: <20050130182916.55154.qmail@web80109.mail.yahoo.com> Message-ID: References: <20050130182916 DOT 55154 DOT qmail AT web80109 DOT mail DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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. 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. Igor 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. -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,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: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/