Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

USB (bus) filter driver using KMDF

Bret_NeedleBret_Needle Member Posts: 9
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

Comments

  • Don_BurnDon_Burn Member - All Emails Posts: 1,730
    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




    "[email protected]" <[email protected]> wrote in message
    news:[email protected]:

    > 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
  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,596
    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: [email protected]
    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
    d
  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,436
    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, <[email protected]> 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
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online