I have a doubt about IoCallDriver for TDI lower driver in the TDI filter
driver.
The TDI filter dirver shut down the system when I try to connect the other
local networked computer.
But not shut down the system when I use Internet-Explore or other Internet
application using TCP/IP.
Sometime show me "NO_MORE_IRP_STACK_LOCATION:… " in blue screen.
Why? and How can I fix them???
How check whether I/O stack space of IRP is insufficient… and make new
IRP for next low driver?
//////////////////////////////////
NTSTATUS
TdimonHookRoutine(PDEVICE_OBJECT HookDevice, IN PIRP Irp)
{
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
PIO_STACK_LOCATION nextIrpStack = IoGetNextIrpStackLocation(Irp);
// hook and process dispatch routine for monitoring
if (Irp->CurrentLocation <= 1) // If no more stack
location…allocate new IRP for next low driver…
{
PIRP newIrp;
PIO_STACK_LOCATION newNextIrpStack;
KEVENT event;
NTSTATUS ntRet;
//
// Initialize the event
//
KeInitializeEvent(&event, SynchronizationEvent, FALSE);
newIrp = IoAllocateIrp((CCHAR)(hookExt->FileSystem->StackSize + 1),
FALSE);
if (!newIrp)
{
DbgPrint((“!!! Error : IoAllocateIrp !!!\n”));
return STATUS_INSUFFICIENT_RESOURCES;
}
//
// Build the IRP’s main body
//
newIrp->AssociatedIrp.SystemBuffer =
Irp->AssociatedIrp.SystemBuffer;
newIrp->UserEvent = &event;
newIrp->UserIosb = Irp->UserIosb;
newIrp->Tail.Overlay.Thread = PsGetCurrentThread();
newIrp->Tail.Overlay.OriginalFileObject = FileObject;
newIrp->RequestorMode = KernelMode;
newIrp->Flags = Irp->Flags;
newIrp->MdlAddress = Irp->MdlAddress;
//
// Set up the I/O stack location.
//
newNextIrpStack = IoGetNextIrpStackLocation(newIrp);
*newNextIrpStack = *currentIrpStack;
IoSetNextIrpStackLocation( newIrp );
newNextIrpStack->MajorFunction = currentIrpStack->MajorFunction;
newNextIrpStack->MinorFunction = currentIrpStack->MinorFunction;
newNextIrpStack->Flags = currentIrpStack->Flags;
newNextIrpStack->Control = currentIrpStack->Control;
newNextIrpStack->DeviceObject = hookExt->FileSystem;
newNextIrpStack->FileObject = FileObject;
memcpy( &(newNextIrpStack->Parameters),
&(currentIrpStack->Parameters), sizeof(ULONG) * 4 );
IoSetCompletionRoutine( newIrp, TDIMonNewHookComplete, 0, TRUE,
TRUE, TRUE);
ntRet = IoCallDriver( hookExt->FileSystem, newIrp );
KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0);
return ntRet;
}
return IoCallDriver( hookExt->FileSystem, Irp );
}
//////////////////////////////////
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com