WdfDeviceInitRegisterPnpStateChangeCallback, fonction (wdfdevice.h)
[S’applique à KMDF uniquement]
Notes
Cette méthode est destinée à un usage interne Microsoft uniquement.
La méthode WdfDeviceInitRegisterPnpStateChangeCallback enregistre une fonction de rappel d’événement fournie par le pilote que l’infrastructure appelle lorsque la machine à états 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 Plug-and-Play machine 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 retournée
Si l’opération réussit, WdfDeviceInitRegisterPnpStateChangeCallback retourne STATUS_SUCCESS. Les valeurs de retour supplémentaires sont les suivantes :
Code de retour | Description |
---|---|
|
Un paramètre non valide a été détecté. |
|
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 inscrit une fonction de rappel d’événement que l’infrastructure appelle lorsque l’ordinateur d’état Plug-and-Play de l’appareil change d’état.
status = WdfDeviceInitRegisterPnpStateChangeCallback(
DeviceInit,
WdfDevStatePnpEjectFailed,
MyDrvPnPStateChangeCallback,
StateNotificationAllStates
);
Configuration requise
Condition requise | Valeur |
---|---|
Plateforme cible | Universal |
Version KMDF minimale | 1.0 |
En-tête | wdfdevice.h (inclure Wdf.h) |
Bibliothèque | Wdf01000.sys (consultez Gestion des versions de la bibliothèque d’infrastructure).) |
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) |