IoSkipCurrentIrpStackLocation macro
IoSkipCurrentIrpStackLocation 宏修改系统的 IO_STACK_LOCATION 数组指针,当本层驱动程序调用下一层的驱动程序时,下层驱动程序能够收到与本层驱动程序收到一样的 IO_STACK_LOCATION 结构。
Syntax
VOID IoSkipCurrentIrpStackLocation(
[in, out] PIRP Irp
);
Parameters
Irp [in, out]
A pointer to the IRP.
Return value
None
Remarks
当你的驱动程序发送一个IRP给低层的驱动程序时,可以调用IoSkipCurrentIrpStackLocation 如果你不想提供一个IoCompletion 例程 (地址存放在驱动程序的 IO_STACK_LOCATION 结构体中)。如果你在调用IoCallDriver之前调用了IoSkipCurrentIrpStackLocation ,下一层驱动程序将收到与本层驱动程序收到的一模一样的IO_STACK_LOCATION 。
如果你试图为这个IRP提供一个 IoCompletion 例程。驱动程序应该使用 IoCopyCurrentIrpStackLocationToNext 代替IoSkipCurrentIrpStackLocation. 如果一个错误编写的驱动程序犯了这个调用IoSkipCurrentIrpStackLocation 的错误而设置了一个完成例程。这个驱动程序可能覆盖了底层驱动设置的完成例程。
如果驱动阻塞了一个IRP。驱动程序不应当在它传递IRP给下一层驱动之前调用IoSkipCurrentIrpStackLocation。如果驱动程序在一个阻塞的IRP被传递给下一层驱动程序之前,在这个IRP上调用IoSkipCurrentIrpStackLocation ,为下一层的服务的the I/O stack location的 Control 将仍被设置为 SL_PENDING_RETURNED 。因为下一层驱动程序拥有那个stack location 并且修改它,它可能清除这个“阻塞中”的标志。在这个情况下可能导致操作系统发布一个bug check 或者是这个IRP将永不能完成。作为替代,会阻塞一个IRP的驱动程序在调用IoCallDriver前应当使用 IoCopyCurrentIrpStackLocationToNext 以为下层驱动程序设置一个新的stack location.
如果您的驱动程序调用了IoSkipCurrentIrpStackLocation, 小心一些不要修改了O_STACK_LOCATION结构。(Be careful not to modify the IO_STACK_LOCATION structure in a way that could unintentionally affect the lower
driver or the system's behavior with respect to that driver. )例如修改了 IO_STACK_LOCATION 的Parameters 联合体参数或者调用了IoMarkIrpPending.
Requirements
Target platform | Desktop |
Version | Available starting with Windows 2000. |
Header | Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h) |
IRQL | Any level |
See also
IoCopyCurrentIrpStackLocationToNext