Hi,
I know this has been discussed before, but I have still not found a
satisfactory answer. I am hoping that someone out there has.
Suppose you find all of the physical disks in the system using
SetupDiGetClassDevs. Now you have all of them in GUID form. What I want to
do is translate from the GUID form to PhysicalDiskX form. My reason for
doing this is that I want to identify which Volumes (partitions) are on
which disks. I can use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
to find out which PhysicalDisk each volume is on. But I still need to
somehow associate the PhysicalDiskNumbers with the GUIDs.
I looked in the registry under
HKLM\SYSTEM\CurrentControlSet\Services\Disk\Enum and found a sort of
enumeration of the GUIDs, but I was not sure if this would always match
the PhysicalDiskX.
What I am really trying to do here is duplicate the information that the
Disk Manager application presents, what disks exist, what volumes are on
those disks, and what file systems are on the volumes.
I am about ready to enumerate from PhysicalDisk0 to some large number, say
PhysicalDisk1000 and just ignore any holes that are there. It seemed like
there ought to be a better way though.
I would sure appreciate any ideas.
Thanks,
Don