Partager via


WdfDeviceInitRegisterPowerPolicyStateChangeCallback, fonction (wdfdevice.h)

[S’applique uniquement à KMDF]

Note

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

La méthode WdfDeviceInitRegisterPowerPolicyStateChangeCallback inscrit une fonction de rappel d’événement fournie par le pilote que l’infrastructure appelle lorsque la machine d’état de 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 l’ordinateur 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 de retour

Si WdfDeviceInitRegisterPowerPolicyStateChangeCallback rencontre aucune erreur, elle 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 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 enregistre une fonction de rappel d’événement que l’infrastructure appelle lorsque l’ordinateur d’état de la stratégie d’alimentation de l’appareil change d’état.

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