From: Chris Telting [telting-ml@mindspring.com] Sent: Thursday, October 26, 2000 9:47 AM To: NT Developers Interest List Subject: [ntdev] Re: Can any one tell me what's wrong with this filter code? > Hi Chris, I notice that you don't make allowances for a completion > routine that could be present in the IRP when you intercept it and > store your own completion routine. Maybe you should look at the > completion routines that are there already. That's not what I'm already doing? I have traced it through the debugger and the completion routines for my filter and the hidusb minidriver completion are both being processed. Hidusb gets completed when I call IoCompleteRequest. I've have intentionally not called the IoCompleteRequest before to check that out and then it really doesn't completine the request and after a couple read iocontrols it doesn't send any more so the computer doesn't crash. Also prevents the driver from unloading as a consequence of the outstanding IRP's. I have noticed that the symbols for hidusb have all the functions prefixed with underscores yet my module doesn't have that. It makes me wonder since it does seem like a stack overflow but I have traced info the relevent functions and all parameters are being poped off the stack according to the ret instructions. The maddening part is that it's not crashing in my code yet it is still my fault. I also have trouble with IoCompletion on a regular mini driver which is why I created this driver, so that I could check parameters of the irp's and urb's to compare between the ms driver and mine. I also wanted to use filter driver to check out the flow of irp's. It all works so long as I don't do any IO Completion. > > case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: > > { > > KIRQL Irql ; > > KEVENT event ; > > > > DbgPrint("URB Function: URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n") ; > > > > Irql = KeGetCurrentIrql() ; > > if (Irql == PASSIVE_LEVEL) > > DbgPrint("IRQL: PASSIVE_LEVEL (%u)\n", Irql) ; > > else if (Irql == APC_LEVEL) > > DbgPrint("IRQL: APC_LEVEL (%u)\n", Irql) ; > > else if (Irql == DISPATCH_LEVEL) > > DbgPrint("IRQL: DISPATCH_LEVEL (%u)\n", Irql) ; > > else DbgPrint("IRQL: %u\n", Irql) ; > > > > KeInitializeEvent(&event, NotificationEvent, FALSE) ; > > IoCopyCurrentIrpStackLocationToNext(Irp) ; > > IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE)InterruptTransferComplete, &event, TRUE, TRUE, TRUE) ; > > status = IoCallDriver(devExt->NextDevice, Irp) ; > > KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL) ; > > DbgPrint("Continue and Complete\n") ; > > > > IoCompleteRequest(Irp, IO_NO_INCREMENT) ; > > > > return status ; > > } ; > > NTSTATUS InterruptTransferComplete(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Data) > > { > > PKEVENT event ; > > > > DbgPrint("InterruptTrandferComplete\n") ; > > > > // Shouldn't matter because we are signaling an event to continue in > > // the dispatch function. > > // > > // if (Irp->PendingReturned) > > // { > > // DbgPrint("IoMarkIrpPending\n") ; > > // IoMarkIrpPending(Irp) ; > > // } ; > > > > event = (PKEVENT)Data ; > > > > KeSetEvent(event, 0, FALSE) ; > > > > if (NT_SUCCESS(Irp->IoStatus.Status)) > > DbgPrint("Transfer Success\n") ; > > else DbgPrint("Transfer Error\n") ; > > > > return STATUS_MORE_PROCESSING_REQUIRED ; > > } ; --- You are currently subscribed to ntdev as: GlennEverhart@FirstUSA.com To unsubscribe send a blank email to leave-ntdev-247T@lists.osr.com