WDF 驱动 pending 操作

    wdf 似乎没有 IoMarkIrpPending ,不过好像可以用 WdfRequestForwardToIoQueue 代替。

Newbie question about correct handling for pendingrequests

Hi again!

 

After digging through all the documentation and a fewsamples I'm still not sure

if my queue/request handling is correct or

maybe has a flaw that will show up sooner or later...

 

In my KMDF driver I currently have one (sequential) queuefor read and write

requests and one manual

queue for pending read requests. (Writes will alwayssucceed!)

All synchronization and execution levels are left attheir default values.

 

Now my question:

 

In my read event handler I simply forward the request (ifI cannot fulfill it

immediately) like this:

 

status = WdfRequestForwardToIoQueue(Request,pDevContext->PendingReadQueue);

 

In my write handler - after having written to my memoryI'm looping over the

pending request queue like this:

 

    // Check forpending reads... and move them to main queue

    do

    {

        WDFREQUESTrequest;

 

        status =WdfIoQueueRetrieveNextRequest(pDevContext->PendingReadQueue,

&request);

 

        // Found anentry?

        if(NT_SUCCESS(status))

        {

            status= WdfRequestForwardToIoQueue(request,

pDevContext->ReadQueue);

            if(!NT_SUCCESS(status))

            {

               WdfRequestCompleteWithInformation(request, STATUS_UNSUCCESSFUL,

0);

               return;

            }

        }

    }

    while(NT_SUCCESS(status));

 

Now my question: Although this works fine so far I'd liketo ensure that this is

a correct approach or if

someone sees future problems with this code?

 


你可能感兴趣的:(WDF 驱动 pending 操作)