I write a storage filter driver;
and I want to implement this
function: Give sector5 when get sector0
I use this method:
when(Parameters.Read.ByteOffset==0)
Parameters.Read.ByteOffset=512*5
but I got that winxp auto reboot after
a blue screen
this is my code below:
/////////////////////////////////////////////////////////////////////////
FilterRead(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
PIO_STACK_LOCATION nextIrpStack = IoGetNextIrpStackLocation(Irp);
...
// Copy current stack to next stack.
*nextIrpStack = *currentIrpStack;
if(currentIrpStack->Parameters.Read.ByteOffset.QuadPart == 0)
{
// It's not matter to deleting this line
currentIrpStack->Parameters.Read.ByteOffset.QuadPart = 512*5;
// if add this line,
// blue screen appear and auto reboot when winxp is booting
nextIrpStack->Parameters.Read.ByteOffset.QuadPart = 512*5;
}
IoSetCompletionRoutine(Irp, RmFilterIoCompletion,
DeviceObject, TRUE, TRUE, TRUE);
return IoCallDriver(deviceExtension->TargetDeviceObject, Irp);
}