Mail Archives: cygwin-developers/2001/09/16/05:22:27
Hi,
for a long time I'm thinking about giving fixed device names
to the devices which are handled by the fhandler_dev_raw and
subsequent classes. I don't like the solution that these
devices have to have mount table entries and I would like to get
rid of them.
The new device name mapping using fixed names could work as follows
(note that it works on NT systems anyway):
Floppies:
/dev/fd0, /dev/rfd0 -> map to NT internal name "\device\floppy0".
QueryDosDevice("\device\floppy0") returns "A:" -> \\.\A:
CD-ROMs:
/dev/cdrom1 -> map to NT internal name "\device\cdrom1".
QueryDosDevice("\device\cdrom1") returns some "X:" -> \\.\X:
Tapes:
/dev/st2, /dev/nst2 -> map to NT internal name "\device\tape2".
QueryDosDevice("\device\tape2") returns "TAPE2" -> \\.\TAPE2
Disks:
/dev/hdd -> map to NT internal name "\device\harddisk3\partition0"
(NT) or "\device\harddisk3\dr3" (W2K/XP).
QueryDosDevice("\device\harddisk3\...") returns "PhysicalDrive3"
-> \\.\PhysicalDrive3
Partitions:
/dev/hde1 -> thats tricky from W2K on:
Up to NT4 mapped to the NT internal name "\device\harddisk4\partition1".
QueryDosDevice("\device\harddisk4\partition1") returns some "X:" -> \\.\X:
from W2K on:
h = CreateFile("\\.\physicaldrive4");
DeviceIoControl(h, IOCTL_DISK_GET_DRIVE_LAYOUT, ...);
returns structure containing drive signature.
QueryDosDevice() to get list of entries with NT internal
name "\device\harddiskvolumeX". There are at least
three entries per partition. One of these entries
contains the drive signature and an offset. Take
the partition with the matching offset, grab the
matching entry for that volume which contains the
drive letter -> \\.\X: or which contains the
unique ID -> \\?\Volume{GUID}
That could be easier again from XP on since XP adds the useful
IOCTL_DISK_GET_DRIVE_LAYOUT_EX code which returns the partition
list including the GUIDs of the partitions. The QueryDosDevice
call and the messing around with the drive signature could be
dropped then.
What do you think? Would you like that? Do you have a better idea?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin AT cygwin DOT com
Red Hat, Inc.
- Raw text -