Message-Id: <200001102302.SAA16860@delorie.com> Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com From: "Parker, Ron" To: DJ Delorie , cygwin-developers AT sourceware DOT cygnus DOT com Subject: RE: device names tidbit Date: Mon, 10 Jan 2000 16:59:23 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01BF5BBE.FA3E1630" This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01BF5BBE.FA3E1630 Content-Type: text/plain; charset="iso-8859-1" Their is another version of this syntax uses a '?' inplace of the '.'. For example: DEL \\?\c:\somedir\aux I seem to recall that this only works on NT. I may be wrong, but I vaguely recall working on a winsup patch that used this under NT. (It was not a complete solution, so I never submitted it.) It is the same mechanism that allows us to use "\\.\a:" for raw floppy access in CYGWIN under NT. For those that care here is what is going on and why this works. Forgive me if you have seen it before, but I believe it provides a little more background than the MS documentation that I was able to find when I was working on my local patch a couple years ago. Most of the obscure and limited documentation about this is in the Win32 DDK. The rest is what I have managed to determine by experimentation and my own research. If you download and run the SysInternals' WinObj program it may make the following explanation a little clearer. This program lets you take a look at the Object Manager Namespace in NT. It is available for download at http://www.sysinternals.com/winobj.htm. If you look in the "??" folder in WinObj you will find a number of symbolic links that have been registered with the Object Manager. These are used by the Win32 subsystem and NTVDM to map DOS style device names to their corresponding NT devices. Additionally they use it to reject certain filenames, like "aux", before they are passed to the Object Manager for handling. Using one of the "\\.\" and "\\?\" prefixs causes the filename to be passed to the Object Manager in NT without this filename check occuring. The nominal Posix subsystem in NT always passes its filenames to the Object Manager without doing this "device name check". I don't remember whether or not the prefix is stripped before going into the Object manager. But when the Object Manager gets the filename, it checks the beginning of the filename against the list of device names in its symbolic link table. On my machine C: maps to \Device\Harddisk0\Partition1. WinObj shows this as a \Device\Harddisk0 folder with a Partition1 device in it. So using DJ's example of "\\.\c:\somedir\aux" the filename "somedir\aux" is passed on to the device that is registered as \Device\Harddisk0\Partition1 for further processing. That is how the filename eventually reaches the driver. Just to put filename processing in graphical terms here are two examples of how a filename is processed in NT. Filename Route taken through the OS -------- ------------------------------------------------------------ \\.\C:\dir\file App->(NTVDM)->Win32 subsystem->Object Manager->Device Driver C:\dir\file App->(NTVDM)->Win32 subsystem-> Win32 filename check->Object Manager->Device Driver | +--> Possibly rejected at this point. -----Original Message----- From: DJ Delorie [mailto:dj AT delorie DOT com] Sent: Friday, January 07, 2000 3:29 PM To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: device names tidbit I just ran across this in MSDN. I wonder if we should use this trick to be able to create/delete otherwise "reserved" names? -- Another option is to use a syntax that bypasses the normal reserve-word checks altogether. For example, you can possibly delete any file with a command such as: DEL \\.\:\\ For example: DEL \\.\c:\somedir\aux ------_=_NextPart_000_01BF5BBE.FA3E1630 Content-Type: application/ms-tnef Content-Transfer-Encoding: base64 eJ8+IgEXAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy b3NvZnQgTWFpbC5Ob3RlADEIAQSAAQAYAAAAUkU6IGRldmljZSBuYW1lcyB0aWRiaXQANQgBCYAB ACEAAABCMEVDQzhBOEEzQzdEMzExQTdCQTAwMTA1QTFENTlGRgBWBwEggAMADgAAANAHAQAKABEA AwA6AAEAMQEBBYADAA4AAADQBwEACgAQADsAFwABAEUBAQ2ABAACAAAAAgACAAEDkAYA0A0AAC4A AAALAAIAAQAAAAMALgAAAAAAQAA5AJBYSla+W78BHgBwAAEAAAAUAAAAZGV2aWNlIG5hbWVzIHRp ZGJpdAACAXEAAQAAABsAAAABv1lVmHVSnnNtxSAR05FDAIBf1C0yAJdwTSAAAgEJEAEAAACjCAAA nwgAAHgPAABMWkZ1Aznp3QMACgByY3BnM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