One of the problems with USB is how screwed up the standard is, IMO. I had
to use it to iterate through a device that took 8 serial ports into a single
USB. It may be easier for drives. There are some Windows calls you can
PInvoke for drives. I am not sure how much info you can get.
Win32_LogicalDiskToPartition and Win32_DiskDrive are a couple that might be
useful. Sometime you end up having to search the registry for more
information; I did with the Serial device.
I am not sure about flash drives and USB floppies, but I did find the serial
port devices were rather specific in how they were set up in the Registry.
Unfortunately, I had to know a bit too much about the device and alter my
config files for each one. I would assume USB drives are easier, but I
cannot guarantee it. Good luck on this one.
Peace and Grace,
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
********************************************************
| Think outside the box! |
********************************************************
"Kjetil Viggen" <(E-Mail Removed)> wrote in message
news:5ED1D574-89A9-4F5B-93BE-(E-Mail Removed)...
> I am currently using the System.IO.DriveInfo class to go through the
> available drives on the system:
>
> var drives = System.IO.DriveInfo.GetDrives();
> foreach (System.IO.DriveInfo drive in drives)
> {
> System.IO.DriveType type = drive.DriveType;
> ...
> }
>
> My problem is that I want to skip any floppy drives in this enumeration
> (Yes
> - there are still systems with floppy drives out there...). However
> DriveType
> does not help me do this. From the documentation on the DriveType
> enumeration:
>
> " Removable:
> The drive is a removable storage device, such as a floppy disk drive or a
> USB flash drive."
>
> WMI probably has some options to do differentiate between different
> removable drive types, but my previous experience with WMI has shown
> severe
> problems there when running as non-administrator users. So I am reluctant
> to
> try this...
>
> Another possible option is to just skip if drive letter is A: or B:, as
> these are reserved for floppies. But the Windows Knowledge Base says:
>
> "Drive letters A and B are reserved for floppy disk drives. However, if
> your
> computer does not have a floppy disk drive, you can assign these letters
> to
> removable drives."
>
> So that is not exactly waterproof either...
>
> How can I easily check if a given drive is a floppy drive or not?
>
> Kjetil.
>