阅读:1149回复:3
奇怪,sfilter 中内容 和 ddk doc内容?
sfilter.c 中 SfCreateCompletion 完成历程:
if (NULL != event) { KeSetEvent(event, IO_NO_INCREMENT, FALSE); } if (Irp->PendingReturned) { IoMarkIrpPending( Irp ); } 而在ifs kit 2003文档中: Using IRP Completion Routines →→Constraints on Completion Routines下: Unless the completion routine signals an event, it must check the Irp->PendingReturned flag. If this flag is set, the completion routine must call IoMarkIrpPending to mark the IRP as pending. If a completion routine signals an event, it should not call IoMarkIrpPending 请高人解惑! |
|
沙发#
发布于:2005-01-27 09:31
说的很清楚啊,除非你要signal event,否则的话你就要检查PendingReturned,并且根据PendingReturned调用IoMarkIrpPending,
因为通常signal event是用来通知某个线程该irp已经被下层驱动完成了,然后该线程继续对该irp处理。所以在完成例程中,取消irp的回溯过程,将irp的处理交给等待事件的线程处理。 所以完成例程中的代码如下: CompletionRoutine() { // 通知等待线程,你可以继续处理该irp了 // 然后该irp需要等待线程来完成。调用iocompleterequest or iofreeirp KeSetEvent(...) // 取消irp的回溯过程,因为等待线程需要继续处理该irp return STATUS_MORE_PROCESSING_REQUIRED; } |
|
板凳#
发布于:2005-01-27 15:59
是这样,多谢tooflat!
But: If a completion routine signals an event, it should not call 如果完成历程 signal event,就不应该call IoMarkIrpPending 怎磨在 CompletionRoutine() 先signal event 后又 IoMarkIrpPending( Irp ); 我的理解有问题吗? :D |
|
地板#
发布于:2005-01-28 09:28
你的理解没问题,不知道你的sfilter是哪个版本,我的和你不一样
|
|