阅读:1820回复:0
IoCompletion中有点搞不懂的逻辑本无(951285841) 11:47:35 if ( (NT_SUCCESS( Irp->IoStatus.Status ) && stackPointer->Control & SL_INVOKE_ON_SUCCESS) || (!NT_SUCCESS( Irp->IoStatus.Status ) && stackPointer->Control & SL_INVOKE_ON_ERROR) || (Irp->Cancel && stackPointer->Control & SL_INVOKE_ON_CANCEL) ) { // // This driver has specified a completion routine. Invoke the // routine passing it a pointer to its device object and the // IRP that is being completed. // ZeroIrpStackLocation( stackPointer ); if (Irp->CurrentLocation == (CCHAR) (Irp->StackCount + 1)) { deviceObject = NULL; } else { deviceObject = IoGetCurrentIrpStackLocation( Irp )->DeviceObject; } status = stackPointer->CompletionRoutine( deviceObject, Irp, stackPointer->Context ); if (status == STATUS_MORE_PROCESSING_REQUIRED) { // // Note: Notice that if the driver has returned the above // status value, it may have already DEALLOCATED the // packet! Therefore, do NOT touch any part of the // IRP in the following code. // return; } } else { if (Irp->PendingReturned && Irp->CurrentLocation <= Irp->StackCount) { IoMarkIrpPending( Irp ); } ZeroIrpStackLocation( stackPointer ); } 这段代码有点奇怪啊, 照这个逻辑, 如果一个过滤驱动这样编码: SetIoCompletion(...); return IoCallDriver(...);那么因为其设置了完成例程, 因此不会调用上面代码的else块, 而如果下一层驱动返回STATUS_PENDING, 则岂不是上层驱动很可能不会得到这个信息从而不进行DPC么 |
|