RpcImpersonateClient

A server thread that is processing client remote procedure calls can call the RpcImpersonateClient function to impersonate the active client.

This function is supported only by Windows NT.

#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcImpersonateClient( 
  RPC_BINDING_HANDLE  CallHandle  
);
 

Parameters

CallHandle
Specifies a binding handle on the server that represents a binding to a client. The server impersonates the client indicated by this handle. If a value of zero is specified, the server impersonates the client that is being served by this server thread.

Return Values

Value Meaning
RPC_S_OK Success.
RPC_S_NO_CALL_ACTIVE No client is active on this server thread.
RPC_S_CANNOT_SUPPORT The function is not supported for either the operating system, the transport, or this security subsystem.
RPC_S_INVALID_BINDING Invalid binding handle.
RPC_S_WRONG_KIND_OF_BINDING Wrong kind of binding for operation.
RPC_S_NO_CONTEXT_AVAILABLE The server does not have permission to impersonate the client.

Remarks

In a multithreaded application, if the call to RpcImpersonateClient is with a handle to another client thread, you must call RpcRevertToSelfEx with the handle to that thread to end impersonation.

QuickInfo

  Windows NT: Yes
  Windows CE: Unsupported.
  Header: Declared in rpc.h.
  Import Library: Link with rpcrt4.lib.

See Also

RpcRevertToSelf, Impersonation