The IoUnregisterPlugPlayNotificationEx routine cancels the registration of a driver's callback routine for notifications of Plug and Play (PnP) events.
NTSTATUS IoUnregisterPlugPlayNotificationEx( PVOID NotificationEntry );
A pointer to an opaque value that represents the registration to cancel. The caller previously obtained this value by calling the IoRegisterPlugPlayNotification routine.
IoUnregisterPlugPlayNotificationEx returns STATUS_SUCCESS if the NotificationEntry parameter is valid.
A kernel-mode driver calls this routine to remove a registration to receive PnP notifications. That is, an IoUnregisterPlugPlayNotificationEx call cancels the registration of a driver callback routine for one PnP event category. The driver previously obtained this registration by calling the IoRegisterPlugPlayNotification routine.
After an IoUnregisterPlugPlayNotificationEx call returns, the specified registration is canceled and no further callbacks can occur.
The IoUnregisterPlugPlayNotification routine is similar to IoUnregisterPlugPlayNotificationEx, except that it cannot guarantee that no further callbacks can occur after a IoUnregisterPlugPlayNotification call returns.
Frequently, a driver calls IoUnregisterPlugPlayNotificationEx from a notification callback routine. In most cases, the driver can safely delete the registration of the notification callback routine in this way. However, it is unsafe for a notification callback routine to call IoUnregisterPlugPlayNotificationEx to unregister itself if the following are both true:
- The driver sets the PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES flag in the EventCategoryFlags parameter value supplied to the IoRegisterPlugPlayNotification call that registers the notification callback routine.
- The IoRegisterPlugPlayNotification call that registers the notification callback routine has not yet returned.
Drivers should cancel the registration of a notification callback routine first, and then free any context buffer that is associated with the routine.
A driver cannot be unloaded until it removes all of its PnP notification registrations because each active registration holds a counted reference to the driver object that represents the loaded image of the driver.
For more information, see Using PnP Notification.
|Minimum supported client||Available starting with Windows 7.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||PowerIrpDDis, HwStorPortProhibitedDDIs|