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