Funzione UfxFdoInit (ufxclient.h)

Inizializza la struttura WDFDEVICE_INIT che il driver client fornisce successivamente quando chiama WdfDeviceCreate.

Sintassi

NTSTATUS UfxFdoInit(
  [in]      WDFDRIVER              WdfDriver,
  [in, out] PWDFDEVICE_INIT        DeviceInit,
  [in, out] PWDF_OBJECT_ATTRIBUTES FdoAttributes
);

Parametri

[in] WdfDriver

Handle per l'oggetto driver WDF del driver ottenuto da una chiamata precedente a WdfDriverCreate o WdfGetDriver.

[in, out] DeviceInit

Puntatore a una struttura WDFDEVICE_INIT .

[in, out] FdoAttributes

Puntatore a una struttura di WDF_OBJECT_ATTRIBUTES allocata dal chiamante che descrive gli attributi dell'oggetto per l'oggetto

Valore restituito

Se l'operazione ha esito positivo, il metodo restituisce STATUS_SUCCESS o un altro valore di stato per il quale NT_SUCCESS(status) è uguale a TRUE. In caso contrario, restituisce un valore di stato per il quale NT_SUCCESS(status) è uguale a FALSE.

Commenti

Il driver client riceve un puntatore a una struttura di WDFDEVICE_INIT allocata dal framework nella relativa funzione di callback EvtDriverDeviceAdd . Chiama quindi UfxFdoInit con questo puntatore prima di chiamare WdfDeviceCreate per creare l'oggetto WDFDEVICE.

Per impostazione predefinita, per i driver WDF, il driver di funzione del dispositivo è il proprietario dei criteri di alimentazione.

Il frammento di codice seguente mostra come chiamare UfxFdoInit.

NTSTATUS
UfxClientDeviceCreate(
    _In_ WDFDRIVER Driver,
    _In_ PWDFDEVICE_INIT DeviceInit
    )
/*++

Routine Description:

    Worker routine called to create a device and its software resources.

Arguments:

    Driver - WDF driver object

    DeviceInit - Pointer to an opaque init structure. Memory for this
                 structure will be freed by the framework when WdfDeviceCreate
                 succeeds. So don't access the structure after that point.

Return Value:

    Appropriate NTSTATUS value

--*/
{
    WDF_OBJECT_ATTRIBUTES DeviceAttributes;
    WDFDEVICE WdfDevice;

    PAGED_CODE();

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&DeviceAttributes, CONTROLLER_CONTEXT);

    //
    // Do UFX-specific initialization
    //
    Status = UfxFdoInit(Driver, DeviceInit, &DeviceAttributes);

    //
    // Proceed to WdfDeviceCreate
    //
    
    ...

}

Requisiti

Requisito Valore
Client minimo supportato Windows 10
Piattaforma di destinazione Windows
Intestazione ufxclient.h
Libreria ufxstub.lib
IRQL PASSIVE_LEVEL