From: nki00 on
There's a good sample here:
http://www.codeproject.com/KB/system/RemoveDriveByLetter.aspx
explaining how to programmatically stop a USB Flash drive, but very often
something gets corrupted in the system or in one of the programs that uses
that device and no matter what you do it won't be ejected,
CM_Request_Device_Eject will return CR_REMOVE_VETOED.

I'm curious, is there any way to forcefully remove a USB Flash Drive (well,
aside from physically yanking it out of the slot), via some kernel API call?
Maybe some undocumented one? And if no, is there any way to know what
process is holding a reference to this device that it preventing it from
being ejected?