delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/30/19:23:41

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <41FD7A5F.2040407@x-ray.at>
Date: Mon, 31 Jan 2005 01:22:55 +0100
From: Reini Urban <rurban AT x-ray DOT at>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7) Gecko/20040616
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Why does cygwin1.dll use NtCreateFile() instead of CreateFile()
References: <20050130233747 DOT 5199 DOT qmail AT web80101 DOT mail DOT yahoo DOT com>
In-Reply-To: <20050130233747.5199.qmail@web80101.mail.yahoo.com>
X-IsSubscribed: yes

--------------030007000501030602010703
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

See attached test.
-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

--------------030007000501030602010703
Content-Type: application/x-CleverContent20;
 name="testcreate.cc"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="testcreate.cc"

Ly8gYysrIC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lCiAgbnRfY3JlYXRlIChMImNvbiIpOwog
IG50X2NyZWF0ZSAoTCJudWwiKTsKICBudF9jcmVhdGUgKEwiYXV4Iik7CiAg
bnRfY3JlYXRlIChMInBybiIpOwogIG50X2NyZWF0ZSAoTCJscHQxIik7CiAg
bnRfY3JlYXRlIChMIi4uLnR4dCIpOwojZW5kaWYKICByZXR1cm4oMCk7Cn0K


--------------030007000501030602010703
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019