Re: [WIN] GetLogicalDrives returns drives NOT present
- Posted by Dan Moyer <danielmoyer at pr?digy.ne?> Jan 28, 2008
- 1160 views
Bernie Ryan wrote: > > Dan Moyer wrote: > > > > > > When I wrap the function GetLogicalDrives, it works, except that it > > returns drive numbers for drives that aren't actually there yet, exactly as > > "My Computer" does, ie, usb drives that aren't currently plugged in. And > > then > > if I use "dir" to see if a drive is "ready", I get a non-fatal error > > message. > > > > > > What I was trying to do was find out what drives are on the system, and then > > if they were removable or not. But I don't want to check drives that aren't > > actually there. > > > > Any suggestions?? > > Dan: > > Be sure that you unmount the USB drives before you remove them. > > Windows when it loads assigns the drive numbers when it boots > > and when you remove a USB drive it's drive number does not go > > away. > > You did't say what operating system you are using which may make a > > difference. > > Here is a link that might help: > > <a > href="http://www.uwe-sieber.de/usbstick_e.html">http://www.uwe-sieber.de/usbstick_e.html</a> > > Bernie Thanks for the observation & link Bernie. I'm using WinXP, and 4 different "removable drives" have shown up as present, as far as I remember, from first time I turned on the system, before ever mounting any usb flashdrives. Those are the drives that show up from GetLogicalDrives. Any time I mount a usb drive, I unmount it via the "safely remove hardware" icon in systray, which is currently showing those same 4 not actually present drives; when I do mount a usb flash drive, it shows up also, and then dissappears from the "safely remove hardware" list after I click there to unmount it. So my problem *seems* (?) to be, how to discern if a drive that is asserted by the system to be "there" is actually "ready" or not. I thought to use "dir" to test that, but it brought up non-fatal errors which required user clicks in a message box to continue, which is not desireable. Dan