>For removable media the volume & partition PDOs are the same object.
I would like to add to the Peter’s message.
PRE-VISTA ONLY:
Yes, since the volume managers - and even PartMgr - are not employed for the
removable media.
Disk/ClassPnP creates an 1 partition PDO for the removable media, and this very
PDO is the “mounted device”, the target of MountDev IOCTLs and thus the target
of the drive letter symlinks.
For a fixed disk, the MountDev is created in the volume manager (FtDisk for a
simple partition which is not a software RAID), has the name like
\Device\HarddiskVolume%d, and its relation to the partition PDO is kept only as
some internal stuff within FtDisk.
This makes the task of associating the drive letter to the physical disk in
user mode rather hard, the usual way is to employ
IOCTL_STORAGE_GET_DEVICE_NUMBER on a drive letter, since FSD will pass it down
to FtDisk, and FtDisk will pass it down to the partition PDO using its internal
association.
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS can also be used, fully handled in FtDisk,
and provides the same disk number as IOCTL_STORAGE_GET_DEVICE_NUMBER.
Then you substitute this number to \.\PhysicalDrive%d, or - if you need the
CM_xxx/SetupDi handles for a disk - enumerate all disks, ask each for the
device number, and match.
I hope all is better in Vista. I would very much like to see the SetupDi-only
way of associating the drive letter to its physical disk. Anyway each volume is
a PnP devnode, though hidden.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com