Bewerken

Delen via


WdfRequestGetStatus function (wdfrequest.h)

[Applies to KMDF and UMDF]

The WdfRequestGetStatus method returns the status of an I/O request.

Syntax

NTSTATUS WdfRequestGetStatus(
  [in] WDFREQUEST Request
);

Parameters

[in] Request

A handle to a framework request object.

Return value

WdfRequestGetStatus returns an NTSTATUS value. For more information about what value can be returned, see the following Remarks section.

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

Remarks

The WdfRequestGetStatus method returns one of the following:

  • If a driver's call to WdfRequestSend succeeds, WdfRequestGetStatus returns the status value that is set by the driver that calls WdfRequestComplete to complete the specified request. The driver typically calls WdfRequestGetStatus from within a CompletionRoutine callback function.
  • If a driver's call to WdfRequestSend fails, WdfRequestGetStatus returns a status value that the framework has set to describe the failure. The driver can call WdfRequestGetStatus immediately after calling WdfRequestSend.
If the driver sets the WDF_REQUEST_SEND_OPTION_SYNCHRONOUS flag for a request when calling WdfRequestSend, the driver can call WdfRequestGetStatus immediately after calling WdfRequestSend, whether the call to WdfRequestSend succeeds or fails.

For more information about request completion, see Completing I/O Requests.

Examples

The following code example is from the KbFiltr sample driver. This example sends an I/O request to an I/O target. If WdfRequestSend fails, the example uses the WdfRequestGetStatus return value as input to WdfRequestComplete.

VOID
KbFilter_ForwardRequest(
    IN WDFREQUEST Request,
    IN WDFIOTARGET Target
    )
{
    WDF_REQUEST_SEND_OPTIONS options;
    BOOLEAN ret;
    NTSTATUS status;

    WDF_REQUEST_SEND_OPTIONS_INIT(
                                  &options,
                                  WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET
                                  );

    ret = WdfRequestSend(
                         Request,
                         Target,
                         &options
                         );

    if (ret == FALSE) {
        status = WdfRequestGetStatus (Request);
        DebugPrint(("WdfRequestSend failed: 0x%x\n", status));
        WdfRequestComplete(
                           Request,
                           status
                           );
    }
    return;
}

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), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), RequestGetStatusValid(kmdf)

See also

CompletionRoutine

WdfRequestComplete

WdfRequestSend