Hello all,
This is the text of a old post from John Hawkins send in October 2002.
Does anybody have any ideas or sample code which does this?
Thanks
Remi
I know this question has been asked before, but I couldn't find a
complete answer anywhere so I thought I would ask it again.
Using SetupDiGetClassDevs and SetupDiEnumDeviceInfo I can get a list
of all devices attached to the system. Then using
SetupDiGetDeviceRegistryProperty to retrieve SPDRP_DEVICEDESC I can
see that some of these devices are listed as "Generic Volume", one for
each drive (hard drive, floppy drive, removable disk and so on) I have
attached to my system. So, given a SP_DEVINFO_DATA structure, and
knowing I'm dealing with a generic volume, how can I find out which
drive letter a given generic volume is mapped to?
Does it perhaps have something to do with SetupDiEnumDeviceInterfaces
and SetupDiGetDeviceInterfaceDetail? I did try this briefly, but
couldn't work out which GUID to pass in to
SetupDiEnumDeviceInterfaces.
Basically, I'd like to be able to generate the same tree the "Unplug
and Eject Hardware" window in Windows 2000 generates, which links a
drive letter, through a generic volume, to the original device which
provides it (for example, a USB mass storage device or a USB digital
camera). I know I can use CM_Get_Child and CM_Get_Parent to find out
for any given device which devices its parents and children are, but I
can't seem to find out which drive letter any given generic volume
represents.