METHOD_DIRECT for copying data in IOCTLs

If a driver writes a small amount of data but reads a large amount (greater than a page size), then what is the transfer type to specify in the IOCTL code?. (METHOD_OUT_DIRECT | METHOD_IN_DIRECT) ?

Thanks

-Johnny

From: “Maxim S. Shatskih”

>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Re: About TDI and connection acceptance.
>Date: Mon, 15 Apr 2002 23:21:22 +0400
>
> > If I specify the precreated connection object directly as a parameter to
> > TDIBuildAccept, I get an error
> > STATUS_CONNECTION_INVALID.
>
>Preallocate the connection file object early by ZwCreateFile and then “associate address”. Put it to some list.
>Then, the ClientEventConnect will take it from the list and pass to TdiBuildAccept.
>
> Max
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to %%email.unsub%%


Chat with friends online, try MSN Messenger: Click Here

So, your Input buffer is functioning as a control buffer … assumed … and your Output buffer then is where your data is taken or stored … correct? Do you mean that when you execute your DeviceIoControl that your driver will first take an itty bitty data buffer pointed to by Output buffer and write it to the device? The device will then do its magic and cause a humungous buffer to be written back to the itty bitty buffer pointed to by the Output buffer? Unless the buffer pointed to by the itty bitty buffer pointer in Output buffer, is larger enough to contain the humongous write by the device, the answer is simple — DON’T DO THAT!!!

That of course can be overcome by allocating your buffer size based on largest usage. However, you will most likely have problems in the allocation of DMA resources (again, assuming DMA is involved here) since all of the DMA allocation/de-allocation functions I am aware of include a BOOLEAN parameter designating direction (write==TRUE). If you are NOT using DMA on this data buffer then most likely you will be ok. An example of such would be using it to store a control string to be sent to a modem, pending the IRP, storing any data the modem may reply into the buffer, and then completing the IRP when modem input has been completed. A bit complex, but doable.


Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net

“Johnny D” wrote in message news:xxxxx@ntdev…
If a driver writes a small amount of data but reads a large amount (greater than a page size), then what is the transfer type to specify in the IOCTL code?. (METHOD_OUT_DIRECT | METHOD_IN_DIRECT) ?

Thanks

-Johnny
>From: “Maxim S. Shatskih”
>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Re: About TDI and connection acceptance.
>Date: Mon, 15 Apr 2002 23:21:22 +0400
>
> > If I specify the precreated connection object directly as a parameter to
> > TDIBuildAccept, I get an error
> > STATUS_CONNECTION_INVALID.
>
>Preallocate the connection file object early by ZwCreateFile and then “associate address”. Put it to some list.
>Then, the ClientEventConnect will take it from the list and pass to TdiBuildAccept.
>
> Max
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to %%email.unsub%%

------------------------------------------------------------------------------
Chat with friends online, try MSN Messenger: Click Here

“Johnny D” wrote in message news:xxxxx@ntdev…
>If a driver writes a small amount of data but reads a large amount (greater
than a page >size), then what is the transfer type to specify in the IOCTL
code?.
>(METHOD_OUT_DIRECT | METHOD_IN_DIRECT) ?
>

METHOD_OUT_DIRECT.

The input data is supplied via the InBuffer – This uses buffered I/O.

The output data is returned via the OutBuffer, this uses Direct I/O.

This is precisley how IOCTLs were envisioned to be used when they were
designed: Small data for input (parameters, control information, etc), large
data for output.

Peter
OSR