Could I uninstall a function device from filter driver

As I could uninstall a device from Device Manager via right click the device item on device list. then it will remove and uninstall the device instance. I am wondering if I could do the same thing in the device filter driver I write a filter driver for usb class, the driver could then filter a usb function device, I return a failure status when IRP_MN_start_device . After a while, PNP Manager issue a IRP_MN_REMOVE_DEVICE. However, the function device is only disabled(start failed with a exclamation mark), my question is that possible to make it disappeared from Device Manager via the filter driver code? (maybe remove the device node? send IRP?)

You have to filter the bus driver to control the presentation of physical device objects on a ā€˜busā€™. For USB that means filtering the USB controllers.

There are two kinds of disappear. As mark describes you can filter the bus and prevent the device from ever being enumerated (no small task). The second is you can mark the device as hidden/donā€™t show in UI and it is only shown in device manager when the user selects show hidden devices. For donā€™t show in UI the device must be successfully started though, which your filter is preventing.

:slight_smile: Thanks for commentsļ¼it is helpful. To make my understanding correctly.: it is not a good/graceful way to remove a physical device from function filter driver. it is better to remove it from bus/bus filter driver. the fuction filter driver may failed the device start.so, mark it as hidden device may not taking effect. I will look into the both cases. thanks again

What bigger problem are you trying to solve?

The device !'ed out in device manager is not a problem. It is a power tool that few users use. It is the simplest solution. Writing a bus filter is no small task and KMDF will provide little help.

not a big task :smiley: ,I had wrote the bus driver at this moment,and Adding a little more code to filter my devices will finish my target