Link to home
Create AccountLog in
Avatar of Ed Covney
Ed CovneyFlag for United States of America

asked on

safely remove hardware (usb flash drives)

Is there a MS (or 3rd party) api that would allow me to "safely remove hardware" (usb flash drives) in a Delphi app?  I'd like to be able to remove 4 to 10 drives at a time. (Then install a new batch of drives . . . etc.).

If not possible, is there a way to force cache to be written to the flash drive(s) in a manner that when a drive is later used, W7 won't insist on "fixing it".

Thanks - Ed
ASKER CERTIFIED SOLUTION
Avatar of rogerard
rogerard
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Ed Covney

ASKER

I suspect it might work. Examples are hard to come byt though and I have posted a question.
But it still doesn't answer the question, how does W7 know a drive needs "fixing"?
I don't know the answer to the answer of how windows (not just w7) knows that a drive needs fixing except that it does.  I know that it occurs mostly on drives that were formatted using NTFS (FAT32 is more suited for quick eject).  If you download the addon utilities linked from the EjectUSB page (Unlocker, Handle.exe, DevEject, Removedrive, and Sync), you will rarely have a drive a drive that doesn't eject within a few seconds.  I think the addon sync is the key to the cache problem for you.
rogerard:

EjectUSB works great if I limit its work load. I now have 15 batch files (F-Eject.bat .. thru  T-Eject.bat) that I execute per drive as I finish with the one drive. While F-drive is ejecting, I'm formatting and filing G-drive, etc, etc.  EjectUSB is an excellent and very useful tool. Thanks very much for finding it for me.

-Ed