On Windows (XP-7), is there a reliable way of programatically differentiating between USB floppy drives and USB flash drives in C++?
At the moment, I\'m using WMI to
You can use the Size attribute (USB > 1.4MB), it's not like there is any chance of meeting 1.4MB flash drive any time soon.
On the USB level, there is no way to differentiate between a conventional Disk on Key and a USB-Floppy. Which means windows itself, cannot tell reliably what is what.
There are a few hints that you can gather: Floppies should: a. Have mass-storage protocol CBI/CB b. SCSI UFI
BUT, in the world of USB devices, everyone does whatever they want. The only test is: "Does it work on windows". And Windows just checks the size, if its a USB device with removable-media set and with conventional floppy sizes, it will consider it to be a floppy.
Can't say about "real" floppy, but with the USB attached, there is no definite way.
The obvious property to check would be IOCTL_DISK_GET_DRIVE_GEOMETRY
. This gets you (amongst other things) a MEDIA_TYPE
. Anything but RemovableMedia
and FixedMedia
is a floppy.
Did you try Win32_LogicalDisk.MediaType? It has specific enumerations for floppy disks. Make sure you try it when there's no disk in the drive.