I am trying to figure out the device type for a particular drive. I’d like to know how to do it on Mac OS X and Linux as well, but for now if that’s too much a Windows solution would suffice.
so, let’s say I have a drive H. I can determine if the device is a removable drive through the Win32 API function GetDriveType(). I can find that out on Mac OS X as well.
But what I can’t seem to find, in a reliable way, is the device type. Like, is it a USB Flash Drive, portable hard drive (PHD) etc.
Digging through the registries in Windows, I can’t seem to find much info as well. Although I’d prefer to use some API for that if possible, I’ll use the registry if required.
For now, what I’m interested in is.. is the drive a flash drive (so I can show a Usb flash drive icon in my program) or a portable hard drive (so, a PHD icon will be displayed).
Is the device class what you want? If so you can try libusb (available for win32). Use
libusb_get_device_descriptorfunction.