Hi Guys,
I have several question about How to attach prevent USB PNP Devices(WDM)
I have to write wdm driver for handling PNP Event to prevent usb Mass storage device attach(no need read or write protection filter driver before this i writed this minifilter driver).
In my driver DriverEntry i used IoRegisterPlugPlayNotification routine with GUID_CLASS_USB_DEVICE and handle my CALLBACK fuction is PnpNotifyInterfaceChange(PVOID pNotifyContext, PVOID pContext)
and recived attach and detach event in my callback
Now my questions is:
1.how to remove device(deattach device) in for security reason in PnpNotifyInterfaceChange
- how to get USB_INTERFACE_DESCRIPTOR ? (i think must use UsbBuildGetDescriptorRequest routine, if this is correct how to use this routine?)
3.how to get in particular usb device type(USB DVD WRITER, USB THUMB DRIVE,)? (i know in PDEVICE_INTERFACE_CHANGE_NOTIFICATION is more information about device(VID&PID&SERIAL&etc) but not enough absolutely Because not detrmined usb devices type and also in USB_INTERFACE_DESCRIPTOR->bInterfaceClass get interface class E.G. 0x3 euqual to “HID Interface Class” and 0x08 equal to “Mass Storage USB Device Interface Class” but this is same for three device “USB DVD WRITER” , “USB thumb drive” drive and “Ramreader device”, i try to filter this with DEVICE_OBJECT->Characteristics and this is same for this devices )
class Ref:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff538820(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426(v=vs.85).aspx
Thank you all.