信息
您所需的主题如下所示。但此主题未包含在此库中。

WdfRequestAllocateTimer 方法

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

语法

NTSTATUS WdfRequestAllocateTimer(
  [in]  WDFREQUEST 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:

返回代码说明
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
                              );
options.Timeout = WDF_ABS_TIMEOUT_IN_SEC(TIME_OUT_VALUE);

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

要求

版本

Available in version 1.0 and later versions of KMDF.

标头

Wdfrequest.h (包括Wdf.h)

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

<=DISPATCH_LEVEL

另请参见

WDF_ABS_TIMEOUT_IN_SEC
WDF_REQUEST_SEND_OPTIONS_INIT
WdfRequestSend

 

 

社区附加资源

显示:
© 2014 Microsoft