Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > usb storage - how to eject/remove from explorer

Reply
Thread Tools Display Modes

usb storage - how to eject/remove from explorer

 
 
unclepauly
Guest
Posts: n/a

 
      05-28-2010
hello,

i have created an UpperFilter driver for the DiskDrive class. the purpose is
to enable/disable usb sticks. i have created a control device object and
created a couple of IOCTRLs, so that my user app can do the
enabling/disabling. to disable, in AddDevice, i do IoGetDeviceProperty on
the DeviceObject's DevicePropertyHardwareID. if it begins with USBSTOR then i
set a 'isUsb' flag on the DeviceExtension. then, in the IRP_MJ_CREATE
handler, i get this flag back, and if set, i just do IoCompleteRequest and
return success. this works just fine - when i insert a usb stick, nothing
happens, ie it does not even appear in explorer (and DbgView shows the filter
driver doing the above).

however, this does not affect already inserted usb sticks. they still stay
in explorer. i have sort of got round this by again checking for the isUsb
flag in the IRP_MJ_READ/WRITE handlers, and again just doing IoComplete. this
does prevent read/write access to the stick, but you are still able to see it
in explorer.

so what i really need is, when my filter driver receives the 'disable'
IOCTRL, to sort of send an 'eject' or 'remove' message to already inserted
sticks. now i *think* the answer is for my filter driver to create an
IRP_MJ_REMOVE and send this down the stack to all the inserted devices...but
then i will have to know the DeviceObjects for all inserted sticks. i guess i
could do this by having a global array of the DeviceObjects that i get in
AddDevice ?

i guess im looking for someone to tell me if this logic sounds right or
whether theres a better way.

thank you.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I also have an error 646 in Windows update. Please help. Jose Windows Update 12 01-09-2010 01:00 PM
Re: How To Get FTP Shortcut to Open Windows Explorer NOT Internet Explorer PA Bear [MS MVP] Internet Explorer 0 12-04-2009 05:59 AM
Using Storage Folders Instead of Default Folders Peter Dryton Windows Live Mail 9 10-26-2009 12:21 PM
IE7 forcing itself on me? Adela Internet Explorer 5 10-24-2009 01:10 PM
Explorer Lost the Ability to Move or Copy Files Raivo Windows Vista File Management 10 04-01-2007 11:46 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59