首页
社区
课程
招聘
[旧帖] 异步IRP的完成例程没有目前的堆堆单元是什么意思?...... 0.00雪花
发表于: 2013-6-15 18:37 2756

[旧帖] 异步IRP的完成例程没有目前的堆堆单元是什么意思?...... 0.00雪花

2013-6-15 18:37
2756
我是菜鸟,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会修改一段任意的内存空间".这句该怎么理解

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//