Hi All,
This is regarding KMDF drivers.
I used toaster example to build a Bus driver(KMDF) which is a FDO for my hardware. I have a KMDF function driver which has to alter the read request which it gets and should pass it to parent FDO (bus driver). From there i have to format it and send it to my device.
How can i do that ?
I see “WdfRequestCopyCurrentStackLocationToNext” function is not available now, which i found in one of the Microsoft presentationm which i think might have helped me to pass it down the stack.
Corret me if i am wrong,
PDO is the bottom of device stack so i have to pass this request to PDO first and from there i should pass it to parent FDO.
I couldn’t find any example in DDK which does this.
Regards,
Supreet
To send an IRP, modified, down the stack:
WdfDeviceGetIoTarget - to get the I/O target of the PDO for a FDO.
WdfIoTargetFormatRequestFor* - to format the IRP.
WdfRequestSend - to send the IRP to the PDO.
Also see in the WDK KMDF docs:
Handling I/O Requests in Framework-based Drivers -> Framework Request Objects -> Processing I/O Requests -> Forwarding I/O Requests
Using I/O Targets -> General I/O Targets
Regarding sending the IRP from the PDO to the bus driver’s FDO: are you sure this is necessary? Remember that the bus driver’s FDO and the end device’s PDO are in the same driver, even though they are in different device stacks. I think forwarding IRPs to the bus driver’s FDO is generally unncessary, since you can just synchronize and access the hardware directly from the PDO.
But if you really want to:
Use the PDO’s context to store a handle to the bus driver’s FDO.
WdfDeviceWdmGetDeviceObject, WdfIoTargetCreate, WDF_IO_TARGET_OPEN_PARAMS_INIT_EXISTING_DEVICE, WdfIoTargetOpen - to get the I/O target for the bus driver’s FDO from one of its PDOs.
WdfIoTargetFormatRequestFor* - to format the IRP.
WdfRequestSend - to send the IRP to the bus driver FDO.
Remember you have to either have to register for a completion routine or use the “send and forget” flag.
-Stephen Cleary
The DDI was renamed to WdfRequestFormatRequestUsingCurrentType- I believe this was to stress a WDF model of “formatting” requests for a purpose as opposed to a WDM concept of “stack locations”.
There is a discussion of request forwarding in the WDK (probably even more in the book).
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@indiatimes.com
Sent: Friday, June 15, 2007 4:57 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] forwarding read request from Function driver to Bus driver
Hi All,
This is regarding KMDF drivers.
I used toaster example to build a Bus driver(KMDF) which is a FDO for my hardware. I have a KMDF function driver which has to alter the read request which it gets and should pass it to parent FDO (bus driver). From there i have to format it and send it to my device.
How can i do that ?
I see “WdfRequestCopyCurrentStackLocationToNext” function is not available now, which i found in one of the Microsoft presentationm which i think might have helped me to pass it down the stack.
Corret me if i am wrong,
PDO is the bottom of device stack so i have to pass this request to PDO first and from there i should pass it to parent FDO.
I couldn’t find any example in DDK which does this.
Regards,
Supreet
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hi Stephen and Bob,
Thanks for the quick response, I did the same thing as Stephen has explained,how to pass IRP down the stack, and i was expecting it to come to my Bus driver FDO, Guess the problem was i was trying to do this on Friday evening in office ;-), Now i know how it works Thanks Bob for clarifying about the DDI, I will let you guys know how things went on. Thanks again guys.
Regards,
Sup
Well just forwarding it down your stack is going to send it to your bus
driver PDO, not your bus driver FDO. Your bus driver FDO is in a separate
stack.
wrote in message news:xxxxx@ntdev…
> Hi Stephen and Bob,
>
> Thanks for the quick response, I did the same thing as Stephen has
> explained,how to pass IRP down the stack, and i was expecting it to come
> to my Bus driver FDO, Guess the problem was i was trying to do this on
> Friday evening in office ;-), Now i know how it works Thanks Bob for
> clarifying about the DDI, I will let you guys know how things went on.
> Thanks again guys.
>
> Regards,
> Sup
>
>