Programmatically differentiating between USB Floppy Drive and USB Flash Drive in Windows

前端 未结 4 1318
故里飘歌
故里飘歌 2020-12-19 06:05

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

相关标签:
4条回答
  • 2020-12-19 06:11

    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.

    0 讨论(0)
  • 2020-12-19 06:12

    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.

    0 讨论(0)
  • 2020-12-19 06:22

    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.

    0 讨论(0)
  • 2020-12-19 06:26

    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.

    0 讨论(0)
提交回复
热议问题