Bewerken

Delen via


IWDFIoRequest2::GetStatus method (wudfddi.h)

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

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

Syntax

HRESULT GetStatus();

Return value

GetStatus returns an HRESULT-typed status value, This value indicates the current status of the I/O request that the IWDFIoRequest2 interface represents.

Remarks

A driver can call GetStatus after it has called IWDFIoRequest::Send to send an I/O request to an I/O target.

  • If a driver's call to Send succeeds, GetStatus returns the status value that is set by the driver that completes the specified request.

    If the driver specifies WDF_REQUEST_SEND_OPTION_SYNCHRONOUS for a request when it calls Send, the driver can call GetStatus (or IWDFIoRequest::GetCompletionParams) immediately after calling Send.

    If the driver does not specify WDF_REQUEST_SEND_OPTION_SYNCHRONOUS when it calls Send, the driver typically calls GetStatus (or IWDFIoRequest::GetCompletionParams) from within an IRequestCallbackRequestCompletion::OnCompletion callback function.

  • If a driver's call to Send fails, Send returns a status value that the framework has set to describe the failure. The driver can call GetStatus (but notIWDFIoRequest::GetCompletionParams) to obtain the current status of the request, but in this case GetStatus returns the same failure code that Send returned.
For more information about request completion, see Completing I/O Requests.

Examples

The following code example sends an I/O request to an I/O target. If the call to Send succeeds, the example obtains the IWDFIoRequest2 interface, calls GetStatus to obtain the request's status value, and then calls IWDFIoRequest::CompleteWithInformation to complete the I/O request.

HRESULT hrSend = S_OK;
...
hrSend = fxRequest->Send(m_pIoTarget,
                         WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
                         0);
if (SUCCEEDED(hrSend))
{
    //
    // If send succeeded, complete the request and specify 
    // the current status value.
    //
    CComQIPtr<IWDFIoRequest2> fxRequest2 = fxRequest;
    hrSend = fxRequest2->GetStatus();
    fxRequest->CompleteWithInformation(hrSend, 0);
}
...

Requirements

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.9
Header wudfddi.h (include Wudfddi.h)
DLL WUDFx.dll

See also

IRequestCallbackRequestCompletion::OnCompletion

IWDFIoRequest2

IWDFIoRequest::CompleteWithInformation

IWDFIoRequest::GetCompletionParams

IWDFIoRequest::Send