How do you programmatically eject(safely remove) an USB mass storage device in Windows (XP)?
+1
A:
You could spawn a process and use a command line tool. This would also work from other languages such as java where calling the Win32 api is harder.
johnstok
2008-10-15 20:21:15
Not quite what I was looking for, but thanks anyway :).Maybe their's license do not forbids disassembly their code...
botismarius
2008-10-15 20:23:57
+1
A:
There is an article about it at CodeProject: http://www.codeproject.com/KB/system/usbeject.aspx
Seems to do the trick.
/johan/
idstam
2008-10-15 20:28:29
+2
A:
In autoit, you have a script which does just that.
It basically comes from this Microsoft article and uses kernel32.dll DeviceIoControl function
Of course, this question appears to be a duplicate of Safe remove USB-Drive using Win32 API?, which gives other solutions
VonC
2008-10-15 20:31:16
botismarius
2008-10-15 20:37:24