IRequestCallbackCancel::OnCancel 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 OnCancel method is called when an application cancels an I/O operation through the Microsoft Win32 CancelIo, CancelIoEx, or CancelSynchronousIo function.

Syntax

void OnCancel(
  [in] IWDFIoRequest *pWdfRequest
);

Parameters

[in] pWdfRequest

A pointer to the IWDFIoRequest interface that represents the framework request object to cancel.

Return value

None

Remarks

The framework calls the OnCancel method to cancel the I/O request that the pWdfRequest parameter identifies. The driver should first determine whether it can cancel the I/O request. If the request can be canceled, the driver should cancel it. For more information about how to cancel a request, see Canceling I/O Requests.

If the driver cancels the request, the driver must also complete the request by calling the IWDFIoRequest::Complete method with the CompletionStatus parameter set to HRESULT_FROM_WIN32(ERROR_OPERATION_ABORTED).

The framework does not call OnCancel to cancel a request unless the driver previously called the IWDFIoRequest::MarkCancelable method to enable cancellation of the request and to register the IRequestCallbackCancel interface.

The User-Mode Driver Framework (UMDF) allows only one OnCancel method per queue. Therefore, when a driver calls IWDFIoRequest::MarkCancelable for requests that are associated with a particular queue to enable the framework to cancel those requests, the driver must pass a pointer to the IRequestCallbackCancel interface for the same request-callback object. Later, to cancel each request, the framework passes a pointer to the IWDFIoRequest interface for the request in a call to this request-callback object's OnCancel method.

Requirements

Requirement Value
Target Platform Windows
Header wudfddi.h (include Wudfddi.h)

See also

IRequestCallbackCancel

IWDFIoRequest

IWDFIoRequest::Complete

IWDFIoRequest::MarkCancelable