Fonction IoUnregisterPlugPlayNotificationEx (wdm.h)

La routine IoUnregisterPlugPlayNotificationEx annule l’inscription d’une routine de rappel d’un pilote pour les notifications d’événements Plug-and-Play (PnP).

Syntaxe

NTSTATUS IoUnregisterPlugPlayNotificationEx(
  [in] PVOID NotificationEntry
);

Paramètres

[in] NotificationEntry

Pointeur vers une valeur opaque qui représente l’inscription à annuler. L’appelant a précédemment obtenu cette valeur en appelant la routine IoRegisterPlugPlayNotification .

Valeur retournée

IoUnregisterPlugPlayNotificationEx retourne STATUS_SUCCESS si le paramètre NotificationEntry est valide.

Remarques

Un pilote en mode noyau appelle cette routine pour supprimer une inscription afin de recevoir des notifications PnP. Autrement dit, un appel IoUnregisterPlugPlayNotificationEx annule l’inscription d’une routine de rappel de pilote pour une catégorie d’événements PnP. Le pilote a précédemment obtenu cette inscription en appelant la routine IoRegisterPlugPlayNotification .

Une fois qu’un appel IoUnregisterPlugPlayNotificationEx est retourné, l’inscription spécifiée est annulée et aucun rappel supplémentaire ne peut se produire.

La routine IoUnregisterPlugPlayNotification est similaire à IoUnregisterPlugPlayNotificationEx, sauf qu’elle ne peut pas garantir qu’aucun rappel supplémentaire ne peut se produire après le retour d’un appel IoUnregisterPlugPlayNotification .

Souvent, un pilote appelle IoUnregisterPlugPlayNotificationEx à partir d’une routine de rappel de notification. Dans la plupart des cas, le pilote peut supprimer en toute sécurité l’inscription de la routine de rappel de notification de cette façon. Toutefois, il est dangereux pour une routine de rappel de notification d’appeler IoUnregisterPlugPlayNotificationEx pour se désinscrire si les éléments suivants sont tous deux vrais :

  • Le pilote définit l’indicateur PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES dans la valeur du paramètre EventCategoryFlags fournie à l’appel IoRegisterPlugPlayNotification qui inscrit la routine de rappel de notification.

  • L’appel IoRegisterPlugPlayNotification qui inscrit la routine de rappel de notification n’a pas encore été retourné.

La routine de rappel ne doit pas appeler une routine susceptible de bloquer l’exécution du thread sur lequel la routine de rappel s’exécute. Par exemple, si une routine de rappel mal conçue place un élément de travail qui appelle IoUnregisterPlugPlayNotificationEx dans la file d’attente d’éléments de travail, puis attend qu’un thread de travail termine l’élément de travail, cela entraînerait un blocage du système d’exploitation.

Les pilotes doivent d’abord annuler l’inscription d’une routine de rappel de notification, puis libérer toute mémoire tampon de contexte associée à la routine.

Un pilote ne peut pas être déchargé tant qu’il n’a pas supprimé toutes ses inscriptions de notification PnP, car chaque inscription active contient une référence comptabilisée à l’objet pilote qui représente l’image chargée du pilote.

Pour plus d’informations, consultez Utilisation de la notification PnP.

Configuration requise

Condition requise Valeur
Client minimal pris en charge Disponible à partir de Windows 7.
Plateforme cible Universal
En-tête wdm.h (inclure Wdm.h, Ntddk.h, Ntifs.h)
Bibliothèque NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
Règles de conformité DDI HwStorPortProhibitedDDIs(storport),PowerIrpDDis(wdm)

Voir aussi

IoRegisterPlugPlayNotification

IoUnregisterPlugPlayNotification