Tech Support > Microsoft Windows > Development Resources > USB Mass Storage and CM_Request_Device_Eject
USB Mass Storage and CM_Request_Device_Eject
Posted by dforster on September 12th, 2003


I have searched the groups and have not really found a complete answer
to this question.

Basically what I am trying to do is relate a USB mass storage device
to a drive letter. The primary reason for wanting to do this is to
be able to eject the device by drive letter using CM_Request_Device_Eject.

I can retrieve the USB device that looks something like:
"USB\VID_XXXX&PID_XXXX\..."
using SetupDiGetClassDevs and SetupDiEnumDeviceInfo. I can use the
associated device instance to eject the device. However if I have
several of these devices plugged in I would like to be able to do it
by drive letter.

One suggestion that I saw posted was to use SetupDiGetClassDevs with
GUID_DEVINTERFACE_VOLUME to retrieve devices that support the volume
interface. This can be used to retrieve the volume guid and compared
to the volume guid retrieved through the drive letter. The problem with
this approach is that CM_Request_Device_Eject does not seem to
work with the device retrieved this way. The device looks something like:
"STORAGE\VOLUME\..."

Does anyone know how can I relate the USB device to the storage device?
The Child of the USB device is USBSTOR which must somehow be tying into
the filesystem but I can't figure the relationship.

Any help would be greatly appreciated.

Danielle


Similar Posts