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


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:

Sending multiple asynchronous read requests from NDIS driver to WDF driver but blocked at first only

Shashi140Shashi140 Member Posts: 6


NDIS Driver need to submit multiple WDFReadrequests to wdfdriver. All these requests need to be submitted in asynchronous IO . First request is being received at wdf bus driver.
Below is the behavior observed
1. Wdfrequestsend is blocked and control is not coming back even though it is submitted asynchronously.
2. A bus driver is able to receive the request but its not completed. It will be completed later.
3. Since the call is not returning on NDIS side , no furthermore requests are submitted to queue.

status = WdfIoTargetOpen(Adapter->UsbTarget,&openParams);
if (!NT_SUCCESS(status))
    DEBUGP(MP_ERROR,"Failed to open SPB target - %!STATUS!",status);
    goto Exit;

// Create two requests - one for read and one for write.
// requestAttributes.ParentObject = Adapter->UsbTarget;
status = WdfRequestCreate(&requestAttributes, Adapter->UsbTarget, &Request);
if (!NT_SUCCESS(status)) {
DEBUGP(MP_ERROR, "%s %d Failed to create Request\n", func, LINE);
goto Exit;

status = WdfMemoryCreatePreallocated(WDF_NO_OBJECT_ATTRIBUTES,pRcb,sizeof(RCB),&InputMem);
if (!NT_SUCCESS(status)) {
DEBUGP(MP_ERROR, "%s %d Failed to create Memory\n", func, LINE);
goto exit_first;

status = WdfIoTargetFormatRequestForRead(Adapter->UsbTarget,Request,InputMem,NULL, NULL); // OutputBufferOffset
if (!NT_SUCCESS(status)) {
KdPrint(("WdfIoTargetFormatRequestForRead failed 0x%x\n", status));
goto exit_first;

if (!WdfRequestSend(Request, Adapter->UsbTarget, &sendOptions)) {
status = WdfRequestGetStatus(Request);
WdfRequestCompleteWithInformation(Request, status, 0);
DEBUGP(MP_ERROR, "%s %d Failed to send Request status:%x\n", func, LINE, status);

Is there anything i am missing ..?


  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,795
    Simplest first step to debug is to break into the debugger and see which function/component is blocking.
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,719

    Just as a side note, your error cleanup is wrong. Never call WdfRequestComplete on a request that you created. After fetching the status, you just do WdfObjectDelete..

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 26 Feb - 1 Mar 2024 Live, Online