Dear all,

I am confused about which buffer is of interest in read/write dispatch
routines (and their completion routines). I understand the differences
between direct, buffered and neither buffers. So far, I've concluded that:

1. If Irp->MdlAdress exists, use that.
2. If the lower device object Flags specify DO_BUFFERED_IO then use
Irp->SystemAddress.Buffered.
3. If none of the above hold true, then use Irp->UserBuffer.

Quite frankly, the above rules makes me nervous because I made them up as I
went along! What are the exact rules I should follow?

Many thanks in advance!

Carl

Re: IRP_MJ_READ/IRP_MJ_WRITE Buffer Confusion. by Don

Don
Fri Feb 01 12:39:12 CST 2008

Since you are talking about a lower driver, I assume this is a filter. If
it is a filter you need to reflect the I/O type of the lower device in your
device, and then follow that model. The good news is that for a given class
of device model is normally the same, so for instance a disk device is
DO_DIRECT_IO. Your determination of the buffering is totally dependant on
the I/O model, not the IRP.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply


"Carl" <pleasedo@notemail.me> wrote in message
news:ImJoj.75$zg.20@newsfe5-win.ntli.net...
> Dear all,
>
> I am confused about which buffer is of interest in read/write dispatch
> routines (and their completion routines). I understand the differences
> between direct, buffered and neither buffers. So far, I've concluded that:
>
> 1. If Irp->MdlAdress exists, use that.
> 2. If the lower device object Flags specify DO_BUFFERED_IO then use
> Irp->SystemAddress.Buffered.
> 3. If none of the above hold true, then use Irp->UserBuffer.
>
> Quite frankly, the above rules makes me nervous because I made them up as
> I went along! What are the exact rules I should follow?
>
> Many thanks in advance!
>
> Carl



Re: IRP_MJ_READ/IRP_MJ_WRITE Buffer Confusion. by Doron

Doron
Mon Feb 04 14:45:12 CST 2008

to add to what don said. if you are a function driver and defining your own
meaning for read/write, you can decide what type of buffering to use by
setting the appropriate flag in your device object. if you are filtering a
device or exist in a stack which has already defined what buffering
reads/writes use, then you must follow the convention of the stack you are
in.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Don Burn" <burn@stopspam.windrvr.com> wrote in message
news:utCWDHQZIHA.5784@TK2MSFTNGP03.phx.gbl...
> Since you are talking about a lower driver, I assume this is a filter.
> If it is a filter you need to reflect the I/O type of the lower device in
> your device, and then follow that model. The good news is that for a
> given class of device model is normally the same, so for instance a disk
> device is DO_DIRECT_IO. Your determination of the buffering is totally
> dependant on the I/O model, not the IRP.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
> "Carl" <pleasedo@notemail.me> wrote in message
> news:ImJoj.75$zg.20@newsfe5-win.ntli.net...
>> Dear all,
>>
>> I am confused about which buffer is of interest in read/write dispatch
>> routines (and their completion routines). I understand the differences
>> between direct, buffered and neither buffers. So far, I've concluded
>> that:
>>
>> 1. If Irp->MdlAdress exists, use that.
>> 2. If the lower device object Flags specify DO_BUFFERED_IO then use
>> Irp->SystemAddress.Buffered.
>> 3. If none of the above hold true, then use Irp->UserBuffer.
>>
>> Quite frankly, the above rules makes me nervous because I made them up as
>> I went along! What are the exact rules I should follow?
>>
>> Many thanks in advance!
>>
>> Carl
>
>