Hi,
I am developing NDIS driver for Windows7.
I am facing some problem with IoCancelIrp API.
Some times Even though IRP is cancel bit is set, the IoCompletionRoutine set is not called, and I end up in waiting infinetley for the IRP cancel indication.
I directly send my IRP to USB class driver.
The same code works fine in 32 bit processor.
The same driver also works well with AMD64 bit processor, IBM machine.
Here is the code sniplet.
//completion routine…
NTSTATUS USBD_CompletionRoutine(PDEVCIE_OBJECt pd, PIRP pIrp, PVOID pEvent)
{
KeSetEvent((PKEVENT)pEvent, IO_NO_INCREMENT, FALSE);
return STATUS_MORE_PROCESSING_REQUIRED;
}
…
…
…
IoSetCompletionRoutine(irp, USBD_CompletionRoutine, (PVOID)&event, TRUE, TRUE,TRUE);
ntStatus = IoCallDriver(pDev->StackDevObj, irp);
if(ntStatus == STATUS_PENDING)
{
delay.QuadPart = -(15*1000*1000);
ntStatus = KeWaitForSingleObject(&event, Executive,KernelMode, FALSE, &delayValue);
if(ntStatus == STATUS_TIMEOUT)
{
IoCancelIrp(irp);
//Do not include any time out for the cancel IRP, as uncancelled presence of IRP in lower level driver might cause a big problem
KeWaitForSingleObject(&event, Executive,KernelMode, FALSE, NULL);
}
}
…
…
I am unable to find the reason for this behaviour.
Please help me to analyse…