Quantcast
Channel: 看雪安全论坛
Viewing all articles
Browse latest Browse all 9556

异步IRP的完成例程没有目前的堆堆单元是什么意思?......

$
0
0
我是菜鸟,walter Oney的驱动书,第5章.完成例程这一节.

A variation on this idea occurs when you create an asynchronous IRP of some kind. You’re supposed to provide a completion routine to free the IRP, and you’ll necessarily return STATUS_MORE_PROCESSING_REQUIRED from that completion routine to prevent IoCompleteRequest from attempting to do any more work on an IRP that has disappeared:

SOMETYPE SomeFunction()
{
PIRP Irp = IoBuildAsynchronousFsdRequest(...);
IoSetCompletionRoutine(Irp, MyCompletionRoutine, ...);
IoCallDriver(...);
}

NTSTATUS MyCompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp,
PVOID context)
{
if (Irp->PendingReturned)
IoMarkIrpPending(Irp); // <== oops!
IoFreeIrp(Irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
The problem here is that there is no current stack location inside this completion routine! Consequently,

"问题在于完成例程没有目前的堆栈单元,因此,IoMarkIRPPending会修改一段任意的内存空间".这句该怎么理解

Viewing all articles
Browse latest Browse all 9556

Trending Articles