Reading a sector in AddDevice

Hi,

I am writing a disk filter driver. I want to read a sector from hard
disk using this code in AddDevice function. Is this possible?

read_Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
deviceExtension->TargetDeviceObject,
pBuffer,
BufferSize,
&ByteOffset,
&event,
&iosb
);

if ( NULL == read_Irp )
{
DbgBreakPoint();
return STATUS_INSUFFICIENT_RESOURCES;
}

// send the irp down the device stack
status = IoCallDriver( deviceExtension->TargetDeviceObject, read_Irp);

> I am writing a disk filter driver. I want to read a sector from hard

disk using this code in AddDevice function. Is this possible?

No.

Post-MN_START_DEVICE is the first place where you can submit read IRPs.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

AddDevice is too early. The OS is just building up the stack for this
device and you cannot send non pnp requests before IRP_MN_START_DEVICE.
Read/write is even later.
Regards
Else

|---------±-------------------------------->
| | Lucian Pinzariu |
| | | | ntric.com> |
| | Sent by: |
| | bounce-312020-18867@li|
| | sts.osr.com |
| | |
| | |
| | 01/18/2008 03:55 PM |
| | Please respond to |
| | “Windows File Systems |
| | Devs Interest List” |
|---------±-------------------------------->
>-----------------------------------------------------------------------------------------------------------|
| |
| To: “Windows File Systems Devs Interest List” |
| cc: |
| Subject: [ntfsd] Reading a sector in AddDevice |
>-----------------------------------------------------------------------------------------------------------|

Hi,

I am writing a disk filter driver. I want to read a sector from hard
disk using this code in AddDevice function. Is this possible?

read_Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
deviceExtension->TargetDeviceObject,
pBuffer,
BufferSize,
&ByteOffset,
&event,
&iosb
);

if ( NULL == read_Irp )
{
DbgBreakPoint();
return STATUS_INSUFFICIENT_RESOURCES;
}

// send the irp down the device stack
status = IoCallDriver( deviceExtension->TargetDeviceObject, read_Irp);


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

You are currently subscribed to ntfsd as: xxxxx@utimaco.de
To unsubscribe send a blank email to xxxxx@lists.osr.com

ok, thank’s