“Kommuri, Chakradhar” wrote:
Anyway, my point is, when I tried to free the IRP built in
‘Asynchronous’ build, it crashed. So, it is either you cannot free the
IRP or there is something wrong I am doing.
A typical pattern for an asynch IRP would be this:
VOID SomeFunction(…)
{
PIRP Irp = IoAllocateIrp(…);
PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp);
stack->MajorFunction = …
IoSetCompletionRoutine(Irp, CompletionRoutine, NULL, TRUE, TRUE,
TRUE);
IoCallDriver(…, Irp); // note: no use made of return code, Irp never
touched past this point
}
NTSTATUS CompletionRoutine(PDEVICE_OBJECT junk, PVOID context, PIRP Irp)
{
IoFreeIrp(Irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
–
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Now teaming with John Hyde for USB Device Engineering Seminars
Check out our schedule at http://www.oneysoft.com