// wdfrequest.h
NTSTATUS WdfRequestAllocateTimer(
[in] WDFREQUEST Request
);
View the official Windows Driver Kit DDI reference
No description available.
[Applies to KMDF and UMDF]
The WdfRequestAllocateTimer method allocates a timer for a specified I/O request.
Request
[in]A handle to a framework request object.
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.
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.
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
);
}