IoUnregisterPlugPlayNotificationEx 例程取消驱动程序回调例程的注册,以便通知即插即用(PnP)事件。
语法
NTSTATUS IoUnregisterPlugPlayNotificationEx(
[in] PVOID NotificationEntry
);
参数
[in] NotificationEntry
指向表示要取消的注册的不透明值的指针。 调用方之前通过调用 IoRegisterPlugPlayNotification 例程获取此值。
返回值
如果 NotificationEntry 参数有效,则 IoUnregisterPlugPlayNotificationEx 返回STATUS_SUCCESS。
言论
内核模式驱动程序调用此例程以删除注册以接收 PnP 通知。 也就是说,IoUnregisterPlugPlayNotificationEx 调用取消一个 PnP 事件类别的驱动程序回调例程的注册。 驱动程序以前通过调用 IoRegisterPlugPlayNotification 例程来获取此注册。
IoUnregisterPlugPlayNotificationEx 调用返回后,将取消指定的注册,并且不会再发生回调。
IoUnregisterPlugPlayNotification 例程类似于 IoUnregisterPlugPlayNotificationEx,但无法保证在 IoUnregisterPlugPlayNotification 调用返回后,不会再发生任何回调。
驱动程序经常从通知回调例程调用 IoUnregisterPlugPlayNotificationEx。 在大多数情况下,驱动程序可以通过这种方式安全地删除通知回调例程的注册。 但是,如果通知回调例程均为 true,则通知回调例程调用 IoUnregisterPlugPlayNotificationEx 来注销自身是不安全的:
驱动程序在 EventCategoryFlags 中设置PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES标志, 提供给注册通知回调例程的 IoRegisterPlugPlayNotification 调用的参数值。
IoRegisterPlugPlayNotification 调用,用于注册通知回调例程尚未返回。
回调例程不得调用任何可能阻止运行回调例程的线程执行的例程。 例如,如果设计不佳的回调例程将调用 IoUnregisterPlugPlayNotificationEx 的工作项置于工作项队列中,然后等待工作线程完成工作项,则会导致作系统死锁。
驱动程序应首先取消通知回调例程的注册,然后释放与例程关联的任何上下文缓冲区。
在删除所有 PnP 通知注册之前,无法卸载驱动程序,因为每个活动注册都保留对 驱动程序对象的计数引用,该对象表示驱动程序的已加载映像。
有关详细信息,请参阅 使用 PnP 通知。
要求
| 要求 | 价值 |
|---|---|
| 最低支持的客户端 | 从 Windows 7 开始可用。 |
| 目标平台 | 普遍 |
| 标头 | wdm.h (包括 Wdm.h、Ntddk.h、Ntifs.h) |
| 库 | NtosKrnl.lib |
| DLL | NtosKrnl.exe |
| IRQL | PASSIVE_LEVEL |
| DDI 符合性规则 | HwStorPortProhibitedDIS(storport),PowerIrpDDis(wdm) |