USB (bus) filter driver using KMDF

Hello All.

My current project is to implement a USB (bus) filter driver under Windows 7 (x32/x64). Using portions of the various DDK sample code, I have created a USB lower class filter driver using KMDF 1.9 which successfully monitors URBs being sent from function drivers to the USB Hub driver’s PDOs. Next I added PNP monitoring support by invoking the WdfDeviceInitAssignWdmIrpPreprocessCallback function to intercept the PNP IRPs. This function allows me to intercept the IRP_MN_QUERY_DEVICE_RELATIONS IRPs when a new device is added or enumerated. However, my driver does not intercept the IRP_MN_QUERY_ID IRPs, even when I reconfigure the corresponding INF file so that my driver is both an uppler and lower class USB filter driver. So here are my questions:

  1. How do I designate my filter driver as a USB bus filter driver rather than a lower class filter driver?

  2. Can I use a KMDF driver as a USB bus filter driver, or must I use the WDM paradign?

Any advise or suggestions would be greatly appreciated.
Thanks, Bret Needle

If you are truly talking about a bus filter, then you cannot do it with
KMDF, you have to do it with WDM.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@Gmail.com” wrote in message
news:xxxxx@ntdev:

> Hello All.
>
> My current project is to implement a USB (bus) filter driver under Windows 7 (x32/x64). Using portions of the various DDK sample code, I have created a USB lower class filter driver using KMDF 1.9 which successfully monitors URBs being sent from function drivers to the USB Hub driver’s PDOs. Next I added PNP monitoring support by invoking the WdfDeviceInitAssignWdmIrpPreprocessCallback function to intercept the PNP IRPs. This function allows me to intercept the IRP_MN_QUERY_DEVICE_RELATIONS IRPs when a new device is added or enumerated. However, my driver does not intercept the IRP_MN_QUERY_ID IRPs, even when I reconfigure the corresponding INF file so that my driver is both an uppler and lower class USB filter driver. So here are my questions:
>
> 1. How do I designate my filter driver as a USB bus filter driver rather than a lower class filter driver?
>
> 2. Can I use a KMDF driver as a USB bus filter driver, or must I use the WDM paradign?
>
> Any advise or suggestions would be greatly appreciated.
> Thanks, Bret Needle

Kmdf doesn’t support writing bus filters. There is no reg entry to designate a bus filter, it is a behavior in the driver, not a config setting

d

debt from my phone


From: xxxxx@Gmail.com
Sent: 11/21/2011 11:33 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB (bus) filter driver using KMDF

Hello All.

My current project is to implement a USB (bus) filter driver under Windows 7 (x32/x64). Using portions of the various DDK sample code, I have created a USB lower class filter driver using KMDF 1.9 which successfully monitors URBs being sent from function drivers to the USB Hub driver’s PDOs. Next I added PNP monitoring support by invoking the WdfDeviceInitAssignWdmIrpPreprocessCallback function to intercept the PNP IRPs. This function allows me to intercept the IRP_MN_QUERY_DEVICE_RELATIONS IRPs when a new device is added or enumerated. However, my driver does not intercept the IRP_MN_QUERY_ID IRPs, even when I reconfigure the corresponding INF file so that my driver is both an uppler and lower class USB filter driver. So here are my questions:

  1. How do I designate my filter driver as a USB bus filter driver rather than a lower class filter driver?

  2. Can I use a KMDF driver as a USB bus filter driver, or must I use the WDM paradign?

Any advise or suggestions would be greatly appreciated.
Thanks, Bret Needle


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

You have to attach to the PDOs enumerated by the bus driver FDO and
there is no defined way for a KMDF driver to do that, so you are sort
of out of luck, although there is probably some horrid bifurcated
KMDF/WDM mutation that could be written, but why?

If you really need a bus filter driver write it the old fashioned way
using WDM or convince Doron to support it in KMDF. Good luck on the
latter option.

Mark Roddy

On Mon, Nov 21, 2011 at 2:33 PM, wrote:
> Hello All.
>
> My current project is to implement a USB (bus) filter driver under Windows 7 (x32/x64). Using portions of the various DDK sample code, I have created a USB lower class filter driver using KMDF 1.9 which successfully monitors URBs being sent from function drivers to the USB Hub driver’s PDOs. ?Next I added PNP monitoring support by invoking the WdfDeviceInitAssignWdmIrpPreprocessCallback function to intercept the PNP IRPs. ?This function allows me to intercept the IRP_MN_QUERY_DEVICE_RELATIONS IRPs when a new device is added or enumerated. ?However, my driver does not intercept the IRP_MN_QUERY_ID IRPs, even when I reconfigure the corresponding INF file so that my driver is both an uppler and lower class USB filter driver. ?So here are my questions:
>
> 1. How do I designate my filter driver as a USB bus filter driver rather than a lower class filter driver?
>
> 2. Can I use a KMDF driver as a USB bus filter driver, or must I use the WDM paradign?
>
> Any advise or suggestions would be greatly appreciated.
> Thanks, Bret Needle
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>