I need to get a file handle to only the USB storage drives on my system.
So, I know I need to do a Createfile("\\\\.\\PhysicalDriveX"... but, how do
I determine that PhysicalDriveX is of type USBSTOR\DISK.
I've browsed through the SetupDi functions and the devcon.exe source code,
but I don't see how I can tie the two together.
Any suggestions?
Thanks in advance...
-Brett

Re: Get file handle to all USB storage devices by Uwe

Uwe
Thu May 18 02:14:26 CDT 2006


Brett wrote:
> I need to get a file handle to only the USB storage drives on my system.
> So, I know I need to do a Createfile("\\\\.\\PhysicalDriveX"... but, how do
> I determine that PhysicalDriveX is of type USBSTOR\DISK.
> I've browsed through the SetupDi functions and the devcon.exe source code,
> but I don't see how I can tie the two together.
> Any suggestions?


Get the BusType using DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY.


Uwe




Re: Get file handle to all USB storage devices by Maxim

Maxim
Thu May 18 08:52:02 CDT 2006

Enum all USB-attached devices using SetupDi APIs, skip all for which the
enumerator name is not "USBSTOR".

For the remaining non-skipped devices, call
SetupDiGetDeviceInterfaceDetail, which will give you the name for CreateFile.
Do this CreateFile, and then IOCTL_STORAGE_GET_DEVICE_NUMBER, it returns
exactly the same number which is in \\.\PhysicalDrive%d.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Brett" <elderdodds@yahoo.notnet> wrote in message
news:E0D14ED9-9263-4E28-B7D1-E8B344B3BE7F@microsoft.com...
> I need to get a file handle to only the USB storage drives on my system.
> So, I know I need to do a Createfile("\\\\.\\PhysicalDriveX"... but, how do
> I determine that PhysicalDriveX is of type USBSTOR\DISK.
> I've browsed through the SetupDi functions and the devcon.exe source code,
> but I don't see how I can tie the two together.
> Any suggestions?
> Thanks in advance...
> -Brett