IoRegisterLastChanceShutdownNotification 函数 (wdm.h)
IoRegisterLastChanceShutdownNotification 例程注册驱动程序,以在系统关闭后(刷新所有文件系统后)接收IRP_MJ_SHUTDOWN IRP。
语法
NTSTATUS IoRegisterLastChanceShutdownNotification(
[in] PDEVICE_OBJECT DeviceObject
);
参数
[in] DeviceObject
指向驱动程序请求关闭通知的设备的设备对象的指针。 系统将此指针传递给驱动程序的 DispatchShutdown 例程。
返回值
IoRegisterLastChanceShutdownNotification 在成功时返回STATUS_SUCCESS,或在失败时返回相应的 NTSTATUS 错误代码。
注解
IoRegisterLastChanceShutdownNotification 例程注册驱动程序,以便在系统关闭时接收指定设备的IRP_MJ_SHUTDOWN IRP。 驱动程序会为其注册接收通知的每个设备接收一个此类 IRP。 驱动程序在其 DispatchShutdown 例程中处理IRP_MJ_SHUTDOWN IRP。
对于注册到此例程的任何设备,系统会在刷新所有文件系统后发送 IRP_MJ_SHUTDOWN IRP。 设备堆栈中只有一个驱动程序应通过调用 IoRegisterShutdownNotification 或 IoRegisterLastChanceShutdownNotification 来注册以接收关闭通知。
如果驱动程序不再需要该设备的关闭通知,请使用 IoUnregisterShutdownNotification 从关闭通知队列中删除驱动程序。
调用 IoRegisterLastChanceShutdownNotification 的驱动程序必须满足其 DispatchShutdown 例程中的以下限制:
- DispatchShutdown 例程不得调用任何可分页例程。
- DispatchShutdown 例程不得访问可分页内存。
- DispatchShutdown 例程不得执行任何文件 I/O 操作。
在电源管理器发送 PowerSystemShutdown的IRP_MN_SET_POWER 请求之前,将调用已注册的 DispatchShutdown 例程。 对于转换到任何其他电源状态,不调用 DispatchShutdown 例程。
要求
要求 | 值 |
---|---|
最低受支持的客户端 | 在 Windows 2000 和更高版本的 Windows 中可用。 在 Microsoft Windows 98/Me 中不可用。 |
目标平台 | 通用 |
标头 | wdm.h(包括 Wdm.h、Ntddk.h、Ntifs.h) |
Library | NtosKrnl.lib |
DLL | NtosKrnl.exe |
IRQL | PASSIVE_LEVEL |
DDI 符合性规则 | HwStorPortProhibitedDDI (storport) , PowerIrpDDis (wdm) |