Collapse the table of content
Expand the table of content

RpcDiagnoseError function

The RpcDiagnoseError function diagnoses the nature of an RPC status error returned by a previously unsuccessful RPC call.


  _In_     RPC_BINDING_HANDLE    BindingHandle,
  _In_     RPC_IF_HANDLE         IfSpec,
  _In_     RPC_STATUS            RpcStatus,
  _In_opt_ RPC_ERROR_ENUM_HANDLE *EnumHandle,
  _In_     ULONG                 Options,
  _In_opt_ HWND                  ParentWindow


BindingHandle [in]

The binding handle for the previously unsuccessful RPC call. Generic binding handles cannot be used with this API.

IfSpec [in]

Handle to the RPC interface on which the previously unsuccessful RPC call was made. This handle is obtained from the MIDL-generated stub and is identical to the type of handle that would be provided in a call to RpcEpResolveBinding.

RpcStatus [in]

RPC_STATUS structure that contains the error previously returned by the RPC stub. The diagnosis will be performed on this error.

EnumHandle [in, optional]

Optional pointer to the handle of an enumerated list of errors returned by RpcErrorStartEnumeration.

Options [in]

Flags used to set specific diagnostic behaviors.


Indicates that the diagnosis should performed using EEInfo from the current thread. This flag can only be set if EnumHandle is set to null.


ParentWindow [in, optional]

Optional handle to the parent UI window that will handle the error diagnosis results.

Return value

The function returns RPC_S_OK if it was able to invoke the diagnostic infrastructure and perform the error diagnosis. The caller should assume that UI containing the results of the diagnosis was raised for the application by the infrastructure.

Note  For a list of valid error codes, see RPC Return Values.


This function is intended for use within the Network Diagnostic Framework (NDF) to assist in the diagnosis of RPC errors.

In order to ensure accurate diagnosis, it is strongly recommended that this function is called immediately after the RPC stub returns an error and before any subsequent RPC API calls are made. Likewise, the identity should not be changed for the current thread after receiving the error and before calling this function.

If the caller must call additional APIs before calling this function, they should use the RpcErrorSaveErrorInfo and RpcErrorLoadErrorInfo to save and restore the error in order to process it at a more opportune time. RpcDiagnoseError can block for extended periods of time and must not be called on a GUI thread or while the loader lock is held. Both the BindingHandle and EnumHandle parameters must be available for the lifetime of the API call.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]


Rpcasync.h (include Rpc.h)





See also

RPC Functions



Community Additions

© 2015 Microsoft