Hello all,
I am facing a problem related to buffered io that I
thought someone here would be able to explain.
In my driverentry, I create a deviceobject with
DO_BUFFERED_IO flag set. Later, just to check the
operation, I am using an user mode application to read
something from the device. But inside the read entry
point in driver, I always see that the
AssociatedIrp.SystemBuffer is NULL. But debugging
shows that other read calls (ex, mountmanager
calls)from the IO subsystem have this set to a valid
value. Is there any restriction on doing buffered io
from user mode applications? It sounds silly, but if I
change the IO type to DO_DIRECT_IO, the buffer
pointers seem fine (MDLs have right values).
I create the device the following way in driverentry…
ret = IoCreateDevice(
pDriverObject,
sizeof(DEV_EXTENSION),
&ntString, FILE_DEVICE_DISK,
FILE_READ_ONLY_DEVICE,
FALSE, &pDeviceObject
);
/* no writes permitted */
pDeviceObject->Characteristics |=
FILE_READ_ONLY_DEVICE;
/* io type */
pDeviceObject->Flags |= DO_BUFFERED_IO;
Thanks,
DK
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
Are you developing a Disk Class Driver?
File system drivers are implemented in such way that they don’t support
underlying device which uses BUFFERED_IO.
When processing NON_CACHED read/write requests that can be satisfied in a
single IO request by underlying device file system driver does not create a
separate IRP. Instead it sets MDL in the original IRP (if IRP doesn’t have
one), setup next IRP stack location appropriately and sends the IRP down.
Other components usually create IRP using IoBuildAsynchrounousFsdRequets.
This function sets buffer in the IRP according to flags defined for the
device object.
So you need to handle the case when data for IO is described by MDL
regardless of what type of IO is defined for the device if you expect file
systems to be mounted on your device.
Alexei.
“Dileep Kumar” wrote in message news:xxxxx@ntfsd…
> Hello all,
> I am facing a problem related to buffered io that I
> thought someone here would be able to explain.
> In my driverentry, I create a deviceobject with
> DO_BUFFERED_IO flag set. Later, just to check the
> operation, I am using an user mode application to read
> something from the device. But inside the read entry
> point in driver, I always see that the
> AssociatedIrp.SystemBuffer is NULL. But debugging
> shows that other read calls (ex, mountmanager
> calls)from the IO subsystem have this set to a valid
> value. Is there any restriction on doing buffered io
> from user mode applications? It sounds silly, but if I
> change the IO type to DO_DIRECT_IO, the buffer
> pointers seem fine (MDLs have right values).
>
> I create the device the following way in driverentry…
> ret = IoCreateDevice(
> pDriverObject,
> sizeof(DEV_EXTENSION),
> &ntString, FILE_DEVICE_DISK,
> FILE_READ_ONLY_DEVICE,
> FALSE, &pDeviceObject
> );
> /* no writes permitted /
> pDeviceObject->Characteristics |=
> FILE_READ_ONLY_DEVICE;
>
> / io type */
> pDeviceObject->Flags |= DO_BUFFERED_IO;
>
>
> Thanks,
> DK
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
>