Note that there are some explanatory texts on larger screens.

plurals
  1. POProgrammatically differentiating between USB Floppy Drive and USB Flash Drive in Windows
    text
    copied!<p>On Windows (XP-7), is there a reliable way of programatically differentiating between USB floppy drives and USB flash drives in C++?</p> <p>At the moment, I'm using WMI to get updates when new <a href="http://msdn.microsoft.com/en-us/library/aa394173%28VS.85%29.aspx" rel="nofollow noreferrer"><code>Win32_LogicalDisk</code></a> instances are detected, and then using the DriveType attribute of the LogicalDisk object to figure out a basic type. This works quite well, except that floppy drives and USB flash drives are both of DriveType <code>DRIVE_REMOVABLE</code>, so to differentiate between those (floppy vs. flash), I'm using the <a href="http://msdn.microsoft.com/en-us/library/aa510113.aspx" rel="nofollow noreferrer"><code>IOCTL_STORAGE_GET_HOTPLUG_INFO</code></a> interface to figure out if the device is hotpluggable, and was working on the principal that that meant it was a flash drive and not a floppy. Again, I think this works quite well (if a little inefficient, using both the WDK API and WMI to get info ) in the case of internal floppy drives, but unfortunately USB Floppy drives are also hotpluggable a lot of the time, so there is no clear way to differentiate between flash and USB floppy drives, that I can see. I know there are properties that <em>may</em> work, like checking if its mapped to the reserved drives A: or B (edit: only relevant if the machine definitely has a floppy drive - see <a href="http://support.microsoft.com/kb/307844" rel="nofollow noreferrer">MS-KB: How to change drive letter assignments in Windows XP</a>), or looking at the description, but I'd really like something a bit more reliable.</p> <p>Sorry about the long explanation, but just wanted to be clear! Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload