Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Mon, 31 Jan 2005 09:05:13 -0600
From: Brian Ford <ford@vss.fsi.com>
Reply-To: cygwin@cygwin.com
To: Dan Ch <force296-cygwin@yahoo.com>
cc: cygwin@cygwin.com
Subject: Re: Why does cygwin1.dll use NtCreateFile() instead of CreateFile()
In-Reply-To: <20050130182916.55154.qmail@web80109.mail.yahoo.com>
Message-ID: <Pine.CYG.4.58.0501310901040.2732@fordpc.vss.fsi.com>
References: <20050130182916.55154.qmail@web80109.mail.yahoo.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-OriginalArrivalTime: 31 Jan 2005 15:04:57.0420 (UTC) FILETIME=[3A4FC8C0:01C507A6]
X-IsSubscribed: yes

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().
>

IIRC, NtCreateFile is significantly cheaper if you already have a file
handle, especially on network drives where the name to handle translation
and open are fairly expensive.  The original reason was purely
performance (since I believe my company paid for some of this
optimization).

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

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

