Expand Minimize

WdfRequestReuse method

[Applies to KMDF and UMDF]

The WdfRequestReuse method reinitializes a framework request object so that it can be reused.

Syntax


NTSTATUS WdfRequestReuse(
  [in]  WDFREQUEST Request,
  [in]  PWDF_REQUEST_REUSE_PARAMS ReuseParams
);

Parameters

Request [in]

A handle to a framework request object.

ReuseParams [in]

A pointer to a caller-allocated WDF_REQUEST_REUSE_PARAMS structure.

Return value

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

Return codeDescription
STATUS_INVALID_PARAMETER

An input parameter is invalid.

STATUS_WDF_REQUEST_INVALID_STATE

The driver supplied an IRP in the WDF_REQUEST_REUSE_PARAMS structure, but the specified request object was not obtained from WdfRequestCreateFromIrp.

 

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

Remarks

A framework-based driver can reuse framework request objects that it created by previous calls to WdfRequestCreate or WdfRequestCreateFromIrp. Drivers can also reuse request objects that they have received from the framework, but they cannot set the WDF_REQUEST_REUSE_SET_NEW_IRP flag for those request objects.

A driver can reuse a request object after the original request has been completed. After a driver has called WdfRequestReuse, the request's contents must be reinitialized. The driver can specify some request parameters in the WDF_REQUEST_REUSE_PARAMS structure.

If you want the reused request to have a CompletionRoutine callback function, the driver must call WdfRequestSetCompletionRoutine after calling WdfRequestReuse.

For more information about WdfRequestReuse, see Reusing Framework Request Objects.

Examples

The following code example is part of a CompletionRoutine callback function that calls WdfRequestReuse so that the driver can reuse a driver-allocated request.


VOID
MyRequestCompletionRoutine(
    IN WDFREQUEST  Request,
    IN WDFIOTARGET  Target,
    PWDF_REQUEST_COMPLETION_PARAMS  CompletionParams,
    IN WDFCONTEXT  Context
    )
{
    WDF_REQUEST_REUSE_PARAMS  params;
    NTSTATUS  status;
...
    WDF_REQUEST_REUSE_PARAMS_INIT(
                                  &params,
                                  WDF_REQUEST_REUSE_NO_FLAGS,
                                  STATUS_SUCCESS
                                  );

    status = WdfRequestReuse(
                             Request,
                             &params
                             );
    ASSERT(NT_SUCCESS(status));
...
}

Requirements

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, InvalidReqAccess, InvalidReqAccessLocal, KmdfIrql, KmdfIrql2, ReqSendFail

See also

WdfRequestCreate
WdfRequestCreateFromIrp
WdfRequestSetCompletionRoutine
WDF_REQUEST_REUSE_PARAMS
WDF_REQUEST_REUSE_PARAMS_INIT
CompletionRoutine

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.