I am using SetupDiGetClassDevs(), SetupDiEnumDeviceInterfaces(), and
SetupDiGetDeviceInterfaceDetail() to enumerate system devices and get
their paths. One such path returned by
SetupDiGetDeviceInterfaceDetail() on my system is
“??\usbstor#cdrom&ven_plextor&prod_dvdr___px-708a&rev_1.04#0041001ee2&0#{53f56308-b6bf-11d0-94f2-00a0c91efb8b}”.
However, the mount manager does not recognize this unique id (using
IOCTL_MOUNTMGR_QUERY_POINTS). I happen to know that this device is W:
on my system, so I set up a test query for the “\DosDevices\W:” symbolic
link. The mount manager returns the unique id for this as
“??\USBSTOR#CdRom&Ven_PLEXTOR&Prod_DVDR___PX-708A&Rev_1.04#0041001EE2&0#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}”.
I can then pass this unique id back into a IOCTL_MOUNTMGR_QUERY_POINTS
and the mount manager finds this and returns the associated mount points
as expected. The two paths are close but differ subtly: the
capitalization is different, and one digit of the GUID is different.
(Interestingly though, using either path I can open an equivalent handle
to the device.) I have also determined empirically that
IOCTL_MOUNTMGR_QUERY_POINTS queries are case-sensitive with regard to
the input unique id.
Here are my questions:
-
SetupDiGetDeviceInterfaceDetail() appears to return device paths that
are not suitable for IOCTL_MOUNTMGR_QUERY_POINTS queries to the mount
manager, as (A) mount manager queries are case sensitive, and (B) the
unique id returned by SetupDiGetDeviceInterfaceDetail() does differ by
one digit from the unique id in the mount manager’s database. Is there
a better way to enumerate system devices that facilitates use with
queries to the mount manager? -
Is it in general acceptable to issue IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
to a device, or is this IOCTL to be issued only by the mount manager?
Thank you,
Chuck