therau2000 wrote:
>
> In my case, it is always a one-to-one match; all USB devices have only
> one partition formatted as FAT32.

Today, maybe.  Will your software never be used on other systems?


> What is the API solution you were referring to? I might have to use
> ioctls for another purpose...

You run through each allocated drive letter, and use
IOCTL_STORAGE_GET_DEVICE_NUMBER to get a STORAGE_DEVICE_NUMBER for the
device.  Then, you use the SetupDi APIs to enumerate through all of the
disk devices, fetch the hardware ID from each, find the one that matches
your device, use IOCTL_STORAGE_GET_DEVICE_NUMBER on that, and match that
to the list you got from the drive letters.  It's a pain.

   
http://forums.codeguru.com/showthread.php?499595-RESOLVED-Need-to-get-name-of-a-USB-flash-drive-device

It's also possible to extract this information from the registry, but
that's even worse.  In
    HKLM\System\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
there will be one subkey for each unique device, by serial number.  If
that key has a subkey called "Control", then it is mounted.  Then, under:
    HKLM\System\CurrentControlSet\Enum\USBSTORE
you'll find a subkey with the same name as the subkey above.  In that
key, there will be a ParentIdPrefix that identifies the device.  Then,
in the list of mounted devices in
    HKLM\System\MountedDevices
you'll see the list of mounted drive letters as
    \DosDevices\A:
    \DosDevices\B:
One of those values will contain the ParentIdPrefix from USBSTORE.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to