Funzione WdfDeviceInitRegisterPnpStateChangeCallback (wdfdevice.h)

[Si applica solo a KMDF]

Nota

Questo metodo è destinato solo all'uso interno di Microsoft.

Il metodo WdfDeviceInitRegisterPnpStateChangeCallback registra una funzione di callback di eventi fornita dal driver che il framework chiama quando il computer a stati Plug and Play di un dispositivo cambia stato.

Sintassi

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

Parametri

[in] DeviceInit

Puntatore fornito dal chiamante a una struttura WDFDEVICE_INIT .

[in] PnpState

Enumeratore WDF_DEVICE_PNP_STATE che identifica lo stato della macchina Plug and Play per cui il driver richiede la notifica.

[in] EvtDevicePnpStateChange

Puntatore fornito dal chiamante alla funzione di callback dell'evento EvtDevicePnpStateChange del driver.

[in] CallbackTypes

Combinazione ORed di enumeratori tipizzato di WDF_STATE_NOTIFICATION_TYPE.

Valore restituito

Se l'operazione ha esito positivo, WdfDeviceInitRegisterPnpStateChangeCallback restituisce STATUS_SUCCESS. I valori restituiti aggiuntivi includono:

Codice restituito Descrizione
STATUS_INVALID_PARAMETER
È stato rilevato un parametro non valido.
STATUS_INSUFFICIENT_RESOURCES
Memoria insufficiente per completare l'operazione.

Commenti

Se il driver chiama WdfDeviceInitRegisterPnpStateChangeCallback, deve farlo prima di chiamare WdfDeviceCreate.

Per altre informazioni su WdfDeviceInitRegisterPnpStateChangeCallback, vedere State Machines in the Framework.For more information about WdfDeviceInitRegisterPnpStateChangeCallback, see State Machines in the Framework.

Esempio

L'esempio di codice seguente registra una funzione di callback di eventi che il framework chiamerà quando il dispositivo Plug and Play macchina a stati cambia stato.

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

Requisiti

Requisito Valore
Piattaforma di destinazione Universale
Versione KMDF minima 1,0
Intestazione wdfdevice.h (include Wdf.h)
Libreria Wdf01000.sys (vedere Controllo delle versioni della libreria framework).
IRQL PASSIVE_LEVEL
Regole di 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)

Vedi anche

EvtDevicePnpStateChange

WDFDEVICE_INIT

WDF_DEVICE_PNP_STATE

WDF_STATE_NOTIFICATION_TYPE