Funzione WdfRequestAllocateTimer (wdfrequest.h)

[Si applica a KMDF e UMDF]

Il metodo WdfRequestAllocateTimer alloca un timer per una richiesta di I/O specificata.

Sintassi

NTSTATUS WdfRequestAllocateTimer(
  [in] WDFREQUEST Request
);

Parametri

[in] Request

Handle per un oggetto richiesta framework.

Valore restituito

WdfRequestAllocateTimer restituisce STATUS_SUCCESS se l'operazione ha esito positivo. In caso contrario, questo metodo potrebbe restituire uno dei valori seguenti:

Codice restituito Descrizione
STATUS_INVALID_PARAMETER
Un parametro di input non è valido.
STATUS_INSUFFICIENT_RESOURCES
Impossibile allocare un timer.
 

Questo metodo potrebbe restituire anche altri valori NTSTATUS.

Un controllo di bug si verifica se il driver fornisce un handle di oggetti non valido.

Commenti

Se il driver specifica un valore di timeout quando si chiama WdfRequestSend, deve chiamare WdfRequestAllocateTimer prima di chiamare WdfRequestSend. Ciò garantisce che la chiamata a WdfRequestSend non avrà esito negativo se sono presenti risorse di sistema insufficienti per allocare un timer.

Se un timer è già allocato per la richiesta specificata, WdfRequestAllocateTimer restituisce STATUS_SUCCESS.

Esempio

Nell'esempio di codice seguente viene inizializzata una struttura WDF_REQUEST_SEND_OPTIONS , alloca un oggetto timer per la richiesta di I/O e quindi chiama WdfRequestSend.

NTSTATUS  status;
WDF_REQUEST_SEND_OPTIONS  options;
BOOLEAN  requestSend;

WDF_REQUEST_SEND_OPTIONS_INIT(
                              &options,
                              WDF_REQUEST_SEND_OPTION_TIMEOUT
                              );

WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
                                     &options,
                                     WDF_ABS_TIMEOUT_IN_SEC(TIME_OUT_VALUE)
                                     );
status = WdfRequestAllocateTimer(
                                 request
                                 );
if (!NT_SUCCESS(status)){
    return status;
...
    requestSend = WdfRequestSend(
                                 request,
                                 ioTarget,
                                 &options
                                 );
}

Requisiti

Requisito Valore
Piattaforma di destinazione Universale
Versione KMDF minima 1.0
Versione UMDF minima 2,0
Intestazione wdfrequest.h (include Wdf.h)
Libreria Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
Regole di conformità DDI DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

Vedi anche

WDF_ABS_TIMEOUT_IN_SEC

WDF_REQUEST_SEND_OPTIONS_INIT

WdfRequestSend