Partager via


WdfDeviceInitRegisterPnpStateChangeCallback, fonction (wdfdevice.h)

[S’applique uniquement à KMDF]

Note

Cette méthode est destinée uniquement à l’utilisation interne de Microsoft.

La méthode WdfDeviceInitRegisterPnpStateChangeCallback inscrit une fonction de rappel d’événements fournie par le pilote que l’infrastructure appelle quand la machine d’état Plug-and-Play d’un appareil change d’état.

Syntaxe

NTSTATUS WdfDeviceInitRegisterPnpStateChangeCallback(
  [in] PWDFDEVICE_INIT                              DeviceInit,
  [in] WDF_DEVICE_PNP_STATE                         PnpState,
  [in] PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION EvtDevicePnpStateChange,
  [in] ULONG                                        CallbackTypes
);

Paramètres

[in] DeviceInit

Pointeur fourni par l’appelant vers une structure WDFDEVICE_INIT.

[in] PnpState

Énumérateur WDF_DEVICE_PNP_STATE qui identifie l’état de l’ordinateur Plug-and-Play pour lequel le pilote demande une notification.

[in] EvtDevicePnpStateChange

Pointeur fourni par l’appelant vers la fonction de rappel d’événement evtDevicePnpStateChange du pilote.

[in] CallbackTypes

Combinaison ORed d’énumérateurs WDF_STATE_NOTIFICATION_TYPE-typés.

Valeur de retour

Si l’opération réussit, WdfDeviceInitRegisterPnpStateChangeCallback retourne STATUS_SUCCESS. Les valeurs de retour supplémentaires sont les suivantes :

Retourner le code Description
STATUS_INVALID_PARAMETER
Un paramètre non valide a été détecté.
STATUS_INSUFFICIENT_RESOURCES
La mémoire est insuffisante pour terminer l’opération.

Remarques

Si votre pilote appelle WdfDeviceInitRegisterPnpStateChangeCallback, il doit le faire avant d’appeler WdfDeviceCreate.

Pour plus d’informations sur WdfDeviceInitRegisterPnpStateChangeCallback, consultez State Machines in the Framework.

Exemples

L’exemple de code suivant enregistre une fonction de rappel d’événement que l’infrastructure appelle lorsque la machine d’état Plug-and-Play de l’appareil change d’état.

status = WdfDeviceInitRegisterPnpStateChangeCallback(
                                                     DeviceInit,
                                                     WdfDevStatePnpEjectFailed,
                                                     MyDrvPnPStateChangeCallback,
                                                     StateNotificationAllStates
                                                     );

Exigences

Exigence Valeur
plateforme cible Universel
version minimale de KMDF 1.0
d’en-tête wdfdevice.h (include Wdf.h)
bibliothèque Wdf01000.sys (voir Versioning de la bibliothèque Framework.)
IRQL PASSIVE_LEVEL
règles de conformité DDI childDeviceInitAPI(kmdf), DeviceInitAPI(kmdf), DriverCreate(kmdf), InitFreeDeviceCallback(kmdf), InitFreeDeviceCreate(kmdf), InitFreeNull(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf), PdoInitFreeDeviceCallback(kmdf), PdoInitFreeDeviceCreate(kmdf)

Voir aussi

EvtDevicePnpStateChange

WDFDEVICE_INIT

WDF_DEVICE_PNP_STATE

WDF_STATE_NOTIFICATION_TYPE