共用方式為


RpcDiagnoseError

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

RPC_STATUS RPC_ENTRY RpcDiagnoseError(
  RPC_BINDING_HANDLE BindingHandle,
  RPC_IF_HANDLE IfSpec,
  RPC_STATUS RpcStatus,
  RPC_ERROR_ENUM_HANDLE* EnumHandle,
  ULONG Options,
  HWND ParentWindow
);

Parameters

  • 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.

    Value Meaning
    RPC_DE_USE_CURRENT_EEINFO 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.

Remarks

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.

Requirements

Client Requires Windows Vista.
Server Requires Windows Server "Longhorn".
Header

Declared in Rpcasync.h; include Rpc.h.

Library

Use Rpcdiag.lib.

DLL Requires Rpcdiag.dll.

See Also

RpcErrorLoadErrorInfo
RpcErrorSaveErrorInfo
RPC Functions