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