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

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

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/


WdfIoQueueReadyNotify and recursion

James_HarperJames_Harper Member Posts: 1,615
My bus driver is managing requests from two queues. One queue consists of inverted calls from usermode. The other consists of requests from the child driver. When there is a usermode request and a child request, the child request data is copied to the usermode request and the usermode request is completed.

Both queues are set to manual, and I'm using WdfIoQueueReadyNotify on both queues to call a common function that removes requests from both queues and does the magic. If one of the requests is invalid though, I need to requeue the request back onto its queue, but that is causing a recursive situation if the queue now goes from empty to non-empty.

Does stopping the queue prevent the call to the QueueReadyNotify routine, or do I need to stop the queue and then clear the QueueReadyNotify callback?

Any other suggestions as to how I could manage two queues like this would be appreciated too!

Thanks

James

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,855
    You create 4 queues: Two Sequential and Two Manual.

    How about having two Sequential Queues at your top edge. When you receive a Request from user-mode, you attempt to remove a Request from a manual Queue of pending Requests from the Child. If you're successful, you complete both Requests. If you're NOT successful, you put the user-mode Request on a manual queue of pending User-mode Requests.

    Similarly, when you receive a Request from your Child, you attempt to remove a Request your Queues of pending User-Mode Requests. If you're successful, you complete both Requests. If you're NOT successful, you put the child Request on a manual queue of pending child Requests.

    That's the most common design pattern for "I need to satisfy A with B, as soon as both A and B are available" -- Might that work for your situation?

    Peter
    OSR

    Peter Viscarola
    OSR
    @OSRDrivers

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!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA