New Irp Creation using ioallocateirp

hello everybody

I am trying to build an irp to read data at particular byteoffset in my
volume upper filter driver.

But i am getting fatal system error after the execution of
iocalldriver function.

i am enclosing the code in which i am getting the error

NTSTATUS ReadfromVolume( IN PDEVICE_OBJECT DeviceObject,PIRP
pOriginalIrp,LARGE_INTEGER StartingByteOffset,ULONG Length )
{
PIRP pNewIrp;
PDEVICE_EXTENSION deviceExtension;
NTSTATUS status;
PDEVICE_OBJECT pLowerDevice;
PIO_STACK_LOCATION pNextIrpStack;
PIO_STACK_LOCATION pCurrentIrpStack;
PULONG pTempBuffer=NULL;

deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
pLowerDevice=deviceExtension->NextLowerDriver;

pCurrentIrpStack=IoGetCurrentIrpStackLocation(pOriginalIrp);
pNewIrp=IoAllocateIrp((deviceExtension->NextLowerDriver->StackSize)+1,FALSE );
pNextIrpStack=IoGetNextIrpStackLocation(pNewIrp);

pNextIrpStack->MinorFunction=0;
pNextIrpStack->DeviceObject=deviceExtension->Self;
pNextIrpStack->Flags=0;//IRP_BUFFERED_IO|IRP_READ_OPERATION;
pNextIrpStack->Parameters.Read.Key=0;
pNextIrpStack->FileObject=0x00;
pNextIrpStack->MajorFunction=IRP_MJ_READ;
pNextIrpStack->Parameters.Read.ByteOffset.QuadPart=StartingByteOffset.QuadPart;
pNextIrpStack->Parameters.Read.Length=Length;

pNewIrp->AssociatedIrp.SystemBuffer=ExAllocatePool(NonPagedPool,Length);

pNewIrp->Tail.Overlay.Thread=PsGetCurrentThread();//pOriginalIrp->Tail.Overlay.Thread;

IoSetCompletionRoutine(pNewIrp,IoCompletionRead,NULL,TRUE,TRUE,TRUE);
IoCallDriver(deviceExtension->NextLowerDriver,pNewIrp);

return 0;

Thanking in advance

santosh k

Of course it crashes. Neither of the volume managers support buffered
I/O. If you want to send something to a lower driver LOOK and see what
they want first, don’t try to send them something they can’t handle.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of santosh katvate
Sent: Saturday, April 30, 2005 11:06 AM
To: ntfsd redirect
Subject: [ntfsd] New Irp Creation using ioallocateirp

hello everybody

I am trying to build an irp to read data at particular byteoffset in my
volume upper filter driver.

But i am getting fatal system error after the execution of
iocalldriver function.

i am enclosing the code in which i am getting the error

NTSTATUS ReadfromVolume( IN PDEVICE_OBJECT DeviceObject,PIRP
pOriginalIrp,LARGE_INTEGER StartingByteOffset,ULONG Length )
{
PIRP pNewIrp;
PDEVICE_EXTENSION deviceExtension;
NTSTATUS status;
PDEVICE_OBJECT pLowerDevice;
PIO_STACK_LOCATION pNextIrpStack;
PIO_STACK_LOCATION pCurrentIrpStack;
PULONG pTempBuffer=NULL;

deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
pLowerDevice=deviceExtension->NextLowerDriver;

pCurrentIrpStack=IoGetCurrentIrpStackLocation(pOriginalIrp);
pNewIrp=IoAllocateIrp((deviceExtension->NextLowerDriver->StackSize)+1,FA
LSE );
pNextIrpStack=IoGetNextIrpStackLocation(pNewIrp);

pNextIrpStack->MinorFunction=0;
pNextIrpStack->DeviceObject=deviceExtension->Self;
pNextIrpStack->Flags=0;//IRP_BUFFERED_IO|IRP_READ_OPERATION;
pNextIrpStack->Parameters.Read.Key=0;
pNextIrpStack->FileObject=0x00;
pNextIrpStack->MajorFunction=IRP_MJ_READ;
pNextIrpStack->Parameters.Read.ByteOffset.QuadPart=StartingByteOffset.Qu
adPart;
pNextIrpStack->Parameters.Read.Length=Length;

pNewIrp->AssociatedIrp.SystemBuffer=ExAllocatePool(NonPagedPool,Length);

pNewIrp->Tail.Overlay.Thread=PsGetCurrentThread();//pOriginalIrp->Tail.O
verlay.Thread;

IoSetCompletionRoutine(pNewIrp,IoCompletionRead,NULL,TRUE,TRUE,TRUE);
IoCallDriver(deviceExtension->NextLowerDriver,pNewIrp);

return 0;

Thanking in advance

santosh k


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com