How to create a IWDFIOTarget object

Hi ,

I have a driver in KMDF and i am writing a function driver on top of the KMDF driver in UMDF framework.

I wanted to know how can i create a IWDFIOtarget which is specific to the kMDF driver .

There is a function in UMDF called IWDFFileHandleTargetFactory::CreateFileHandleTarget, do i need to use this to create a file IO Target…

how to i do this…

I am assuming that your UMDF driver is layered on top of the KMDF driver
in the same pnp stack, e.g. the pnp stack looks like this

[UMDF driver]
|
[KMDF driver]
|
[PDO]

If so and you just want to send i/o to the KMDF driver, you can get the
default IO target by calling IWdfDevice::GetDefaultIoTarget and then
using the returned IWdfIoTarget* to send i/o to the lower layers of the
stack.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Tuesday, June 26, 2007 6:52 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to create a IWDFIOTarget object

Hi ,

I have a driver in KMDF and i am writing a function driver on top of the
KMDF driver in UMDF framework.

I wanted to know how can i create a IWDFIOtarget which is specific to
the kMDF driver .

There is a function in UMDF called
IWDFFileHandleTargetFactory::CreateFileHandleTarget, do i need to use
this to create a file IO Target…

how to i do this…


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 ,

Thanks for the reply , but i think my question was not very clear i guess. I
will put the question in the way u have drawn the stack

Consider a example as below in case we have KDMF driver rather then UMDF
driver.Our stack looks as show n below,

[KMDF driver]
|
[KMDF Driver created PDO] …[this is created by the KMDF
Multifuntion BUS driver ]
|
[KMDF Multifuntion BUS driver]
|
[USB PDO]

In such case what we are doing is , In the PDO extension[KMDF Driver
created PDO] the WDFIOtarget object of the KMDF Multifuntion BUS driver is
placed.
So when we are creating a request,we use the WDFIOtarget of the KMDF
Multifuntion BUS driver which is a part of the PDO device extension.
The KMDF driver creates a request using this WDFIOTARGET and sends the
request to KMDF Driver created PDO, so that the KMDF Multifuntion BUS driver
can get the request and then forward the request to the lower driver [usb
driver].

Similarly thing i want to do in UMDF , the stack looks as shown the figure
below.

[UMDF driver]
|
[KMDF Driver created PDO] …[this is created by the KMDF
Multifuntion BUS driver ]
|
[KMDF Multifuntion BUS driver]
|
[USB PDO]

This is how my stack looks like…If i use the method you have suggested ,
it works fine to one level, i.e when we use default IO target and then then
send the request, the request will land in the PDO created by the KMDF
Multifuntion Bus driver.
But how can this be routed to the [KMDF Multifuntion BUS driver], so that it
can pass the request coming from the UMDF driver to the lower driver[lower
usb driver].

Thanks.
Jagadish

On 6/26/07, Doron Holan wrote:
>
> I am assuming that your UMDF driver is layered on top of the KMDF driver
> in the same pnp stack, e.g. the pnp stack looks like this
>
> [UMDF driver]
> |
> [KMDF driver]
> |
> [PDO]
>
> If so and you just want to send i/o to the KMDF driver, you can get the
> default IO target by calling IWdfDevice::GetDefaultIoTarget and then
> using the returned IWdfIoTarget* to send i/o to the lower layers of the
> stack.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@gmail.com
> Sent: Tuesday, June 26, 2007 6:52 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to create a IWDFIOTarget object
>
> Hi ,
>
> I have a driver in KMDF and i am writing a function driver on top of the
> KMDF driver in UMDF framework.
>
> I wanted to know how can i create a IWDFIOtarget which is specific to
> the kMDF driver .
>
> There is a function in UMDF called
> IWDFFileHandleTargetFactory::CreateFileHandleTarget, do i need to use
> this to create a file IO Target…
>
> how to i do this…
>
> —
> 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
>
> —
> 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
>

Having an FDO reach into the PDO’s device extension directly is not a good design. Furthermore, you are sharing a KMDF object between 2 different drivers (the bus driver and the FDO KMDF driver loaded on the PDO), which is also not supported and could break in the future (WDF objects are only guaranteed to work within the same driver, not across the entire system).

So, really what you need to do is create a WDFIOQUEUE in your static PDO and then when requests get presented to the PDO’s WDFIOQUEUE, you send them to the WDFIOTARGET that the PDO has for the parent FDO within the PDO code. If you do this, both the KMDF and UMDF client driver now work exactly the same. They just send i/o to the PDO and then the PDO fwds the I/O down to the parent stack.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jagadish Hadimani
Sent: Tuesday, June 26, 2007 10:11 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to create a IWDFIOTarget object

Hi ,

Thanks for the reply , but i think my question was not very clear i guess. I will put the question in the way u have drawn the stack

Consider a example as below in case we have KDMF driver rather then UMDF driver.Our stack looks as show n below,

[KMDF driver]
??? |
[KMDF Driver created PDO] …[this is created by the KMDF Multifuntion BUS driver]
??? |
[KMDF Multifuntion BUS driver]
??? |
?[USB PDO]

In such case what we are doing is , In the? PDO extension[KMDF Driver created PDO] the WDFIOtarget object of the KMDF Multifuntion BUS driver is placed.
So when we are creating a? request,we use the WDFIOtarget of the KMDF Multifuntion BUS driver which is a part of the PDO device extension.
The KMDF driver creates a request using this WDFIOTARGET and sends the? request to KMDF Driver created PDO, so that the KMDF Multifuntion BUS driver can get the request and then forward the request to the lower driver [usb driver].

Similarly thing i want to do in UMDF , the stack looks as shown the figure below.

[UMDF driver]
??? |
[KMDF Driver created PDO] …[this is created by the KMDF Multifuntion BUS driver]
??? |
[KMDF Multifuntion BUS driver]
??? |
?[USB PDO]

This is how my stack looks like…If i use the method you have suggested , it works fine to one level, i.e when we use default IO target and then then send the request, the request will land in the PDO created by the KMDF Multifuntion Bus driver.
But how can this be routed to the [KMDF Multifuntion BUS driver], so that it can pass the request coming from the UMDF driver to the lower driver[lower usb driver].

Thanks.
Jagadish

On 6/26/07, Doron Holan wrote:
I am assuming that your UMDF driver is layered on top of the KMDF driver
in the same pnp stack, e.g. the pnp stack looks like this

[UMDF driver]
??? |
[KMDF driver]
??? |
?? [PDO]

If so and you just want to send i/o to the KMDF driver, you can get the
default IO target by calling IWdfDevice::GetDefaultIoTarget and then
using the returned IWdfIoTarget* to send i/o to the lower layers of the
stack.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Tuesday, June 26, 2007 6:52 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to create a IWDFIOTarget object

Hi ,

I have a driver in KMDF and i am writing a function driver on top of the
KMDF driver in UMDF framework.

I wanted to know how can i create a IWDFIOtarget which is specific to
the kMDF driver .

There is a function in UMDF called
IWDFFileHandleTargetFactory::CreateFileHandleTarget, do i need to use
this to create a file IO Target…

how to i do this…


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


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

— 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