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?

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值