Hey there,
I most of the code of my simple driver that I am writing working,
with one exception. In the code below, when I uncomment the DbgPrint
statement that is commented out (the one that says
"DbgPrint("IoBuffer[%d]=%02x\n",i,(ULONG)IoBuffer[i]);" ) and put it
into the for loop, the machine freezes, but when take it out,
everything works fine. Any ideas as to why this is occurring?
Thanks!
Jay
NTSTATUS TDIIoControlInternal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
NTSTATUS NtStatus = STATUS_SUCCESS;
PEXAMPLE_FILTER_EXTENSION pFilterDevContext =
(PEXAMPLE_FILTER_EXTENSION)DeviceObject->DeviceExtension;
PIO_STACK_LOCATION pIoStackIrp = NULL;
PUCHAR IoBuffer;
ULONG InputLength;
ULONG OutputLength;
ULONG i;
UNREFERENCED_PARAMETER(i);
pIoStackIrp = IoGetCurrentIrpStackLocation(Irp);
if(pIoStackIrp)
{
IoBuffer = Irp->AssociatedIrp.SystemBuffer;
InputLength =
pIoStackIrp->Parameters.DeviceIoControl.InputBufferLength;
OutputLength =
pIoStackIrp->Parameters.DeviceIoControl.OutputBufferLength;
if((OutputLength > 0) && (OutputLength < 1000))
{
DbgPrint("OutputLength = %d\n",OutputLength);
for(i = 0;i < OutputLength;i++)
DbgPrint("IoBuffer[%d]\n",i);
// DbgPrint("IoBuffer[%d]=%02x\n",i,(ULONG)IoBuffer[i]);
}
}
IoSkipCurrentIrpStackLocation(Irp);
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
NtStatus = IoCallDriver(pFilterDevContext->pNextDeviceInChain, Irp);
return NtStatus;
}