When I call WdfUsbTargetDeviceSendControlTransferSynchronously, what is
the point of supplying a WDFREQUEST? I assumed that if I forwarded my
incoming request to this call, that the lower driver would complete it,
and I wouldn’t have to. My experiments on that are inconclusive. If I
still have to complete it, then why should I pass the WDFREQUEST at all?
Looking at the osrusbfx2 samples, they never forward the incoming
request to that API. They always supply NULL, even when they are
reusing the memory buffer from the incoming request.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
If you pass an incoming request, IRP from that request will be sent down (as long as it has enough stack locations for the target).
The lower driver would complete the IRP but you would still need to complete the WDFREQUEST. In WDF, request object is specific to each layer and needs to be completed by each layer (ignoring send_and_forget). This is so that each layer controls the lifetime of its request object regardless of the irp completion.
You can however use WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET flag in request send options to not have to complete the request. In this case semantics become similar to IoCallDriver with no completion routine and the request object gets disposed before the IRP is sent down.
HTH,
Praveen
you can only use WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET for a unformatted request and then only in calls to WdfRequestSend. For the WdfXxxSendSynchronously calls, it is the same semantic as sending a request to a device via IoCallDriver, setting an event in the completion routine and then waiting on the event. Think of how you are supposed to handle a start pnp irp, the same applies to these routines; waiting for completion does not complete it up the stack it just means that you are now responsible to complete the request as it travels back up.
d
From: xxxxx@lists.osr.com on behalf of Praveen Rao
Sent: Fri 9/14/2007 6:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Forwarding Requests in KMDF
If you pass an incoming request, IRP from that request will be sent down (as long as it has enough stack locations for the target).
The lower driver would complete the IRP but you would still need to complete the WDFREQUEST. In WDF, request object is specific to each layer and needs to be completed by each layer (ignoring send_and_forget). This is so that each layer controls the lifetime of its request object regardless of the irp completion.
You can however use WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET flag in request send options to not have to complete the request. In this case semantics become similar to IoCallDriver with no completion routine and the request object gets disposed before the IRP is sent down.
HTH,
Praveen
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