WdfRequestAllocateTimer function (wdfrequest.h)

[Applies to KMDF and UMDF]

The WdfRequestAllocateTimer method allocates a timer for a specified I/O request.

Syntax

NTSTATUS WdfRequestAllocateTimer(
  [in] WDFREQUEST Request
);

Parameters

[in] Request

A handle to a framework request object.

Return value

WdfRequestAllocateTimer returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INVALID_PARAMETER
An input parameter is invalid.
STATUS_INSUFFICIENT_RESOURCES
A timer could not be allocated.
 

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

If your driver specifies a time-out value when calling WdfRequestSend, it should call WdfRequestAllocateTimer before calling WdfRequestSend. This ensures that the call to WdfRequestSend will not fail if there are insufficient system resources to allocate a timer.

If a timer is already allocated for the specified request, WdfRequestAllocateTimer returns STATUS_SUCCESS.

Examples

The following code example initializes a WDF_REQUEST_SEND_OPTIONS structure, allocates a timer object for the I/O request, and then calls 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
                                 );
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfrequest.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WDF_ABS_TIMEOUT_IN_SEC

WDF_REQUEST_SEND_OPTIONS_INIT

WdfRequestSend