How to hide a USB device?

Hello all,

I write a storage class lower filter driver to hide device which I want.
Referenced some threads of this form, I set NoDisplayInUI in
IRP_MN_QUERY_CAPABILITIES and PNP_DEVICE_DONT_DISPLAY_IN_UI in
IRP_MN_QUERY_PNP_DEVICE_STATE. The driver works very well on SATA device.
The SATA device can not display in ‘device manager’ and there is no volume
lettle in ‘my computer’. But when I plug a USB device to system, there is a
volume display in ‘my computer’. This does not what I want. The USB device
also can not display in ‘device manager’. I can OPEN the USB device, but
there is nothing in it and I make sure there some files in the USB device.

What’s wrong wiht it? How can I hide the volume which represents the USB
device?

Thanks.

Today I find a way to resolve the problem.
I traced all the IRP my filter driver has received. I found that OS send a
lot of IRP_MJ_CREATE and IRP_MJ_CLOSE to the USB device which I want to
hide. So, I my opinion, when OS konws that a USB device has pluged into OS,
she try to open it. So OS send lots of IRP_MJ_CREATE and IRP_MJ_CLOSE to
open and close the USB device. In this case, I fail the IRP with
STATUS_UNSUCCESSFUL which try to open the USB device which I want to hide.
Wow! It is done. The volume which represents the USB device was
disapperence.

So, my question is. Is it correct to fail the IRP which try to open the USB
device I want to hide. Is it can pass DTM test?

“WayneGong” дÈëÏûÏ¢ÐÂÎÅ:xxxxx@ntdev…
> Hello all,
>
> I write a storage class lower filter driver to hide device which I want.
> Referenced some threads of this form, I set NoDisplayInUI in
> IRP_MN_QUERY_CAPABILITIES and PNP_DEVICE_DONT_DISPLAY_IN_UI in
> IRP_MN_QUERY_PNP_DEVICE_STATE. The driver works very well on SATA device.
> The SATA device can not display in ‘device manager’ and there is no volume
> lettle in ‘my computer’. But when I plug a USB device to system, there is
> a volume display in ‘my computer’. This does not what I want. The USB
> device also can not display in ‘device manager’. I can OPEN the USB
> device, but there is nothing in it and I make sure there some files in the
> USB device.
>
> What’s wrong wiht it? How can I hide the volume which represents the USB
> device?
>
> Thanks.
>
>