RpcAsyncAbortCall function (rpcasync.h)

The server calls RpcAsyncAbortCall to abort an asynchronous call.

Syntax

RPC_STATUS RpcAsyncAbortCall(
  PRPC_ASYNC_STATE pAsync,
  unsigned long    ExceptionCode
);

Parameters

pAsync

Pointer to the RPC_ASYNC_STATE structure that contains asynchronous call information.

ExceptionCode

A nonzero application-specific exception code. Can be an application-defined error code, or a standard RPC error code. For more information, see RPC Return Values.

Return value

Value Meaning
RPC_S_OK
Call cancelation successful.
RPC_S_INVALID_ASYNC_HANDLE
Asynchronous handle is invalid.
 
Note  For a list of valid error codes, see RPC Return Values.
 

Remarks

The server calls RpcAsyncAbortCall when circumstances require it to abort an asynchronous call before completion. For example, the caller may not have the necessary permissions to make the request, or the server may be too busy to process the call. Use the ExceptionCode parameter to specify the reason for the abort. The run-time environment propagates the exception code to the client as a fault.

When an asynchronous call is aborted with RpcAsyncAbortCall, no marshaling of the output arguments is performed, and all input arguments are freed by RPC. When RpcAsyncAbortCall is called, a call to the RpcAsyncCompleteCall function is not necessary. The RpcAsyncAbortCall function should be called only once for any asynchronous call; a second call may crash the process or fail in other unexpected ways.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header rpcasync.h (include Rpc.h)
Library Rpcrt4.lib
DLL Rpcrt4.dll

See also

Asynchronous RPC

RPC_ASYNC_STATE

RpcAsyncCancelCall

RpcAsyncCompleteCall

RpcAsyncGetCallHandle

RpcAsyncGetCallStatus

RpcAsyncInitializeHandle

RpcServerTestCancel