WdfDeviceInitRegisterPowerPolicyStateChangeCallback, fonction (wdfdevice.h)

[S’applique à KMDF uniquement]

Notes

Cette méthode est destinée à un usage interne Microsoft uniquement.

La méthode WdfDeviceInitRegisterPowerPolicyStateChangeCallback enregistre une fonction de rappel d’événement fournie par le pilote que l’infrastructure appelle lorsque la machine à état de la stratégie d’alimentation d’un appareil change d’état.

Syntaxe

NTSTATUS WdfDeviceInitRegisterPowerPolicyStateChangeCallback(
  [in] PWDFDEVICE_INIT                                       DeviceInit,
  [in] WDF_DEVICE_POWER_POLICY_STATE                         PowerPolicyState,
  [in] PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION EvtDevicePowerPolicyStateChange,
  [in] ULONG                                                 CallbackTypes
);

Paramètres

[in] DeviceInit

Pointeur fourni par l’appelant vers une structure WDFDEVICE_INIT .

[in] PowerPolicyState

Énumérateur WDF_DEVICE_POWER_POLICY_STATE qui identifie l’état de la machine de stratégie d’alimentation pour lequel le pilote demande une notification.

[in] EvtDevicePowerPolicyStateChange

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

[in] CallbackTypes

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

Valeur retournée

Si WdfDeviceInitRegisterPowerPolicyStateChangeCallback ne rencontre aucune erreur, il retourne STATUS_SUCCESS. Les valeurs de retour supplémentaires sont les suivantes :

Code de retour 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 WdfDeviceInitRegisterPowerPolicyStateChangeCallback, il doit le faire avant d’appeler WdfDeviceCreate.

Pour plus d’informations sur WdfDeviceInitRegisterPowerPolicyStateChangeCallback, 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 la machine à état de stratégie d’alimentation de l’appareil change d’état.

status = WdfDeviceInitRegisterPowerPolicyStateChangeCallback(
                                 DeviceInit,
                                 WdfDevStatePwrPolCheckPowerPageable,
                                 PciDrvPowerPolicyStateChangeCallback,
                                 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)