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
);
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. |
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.
Windows NT: Yes
Windows CE: Unsupported.
Header: Declared in rpc.h.
Import Library: Link with rpcrt4.lib.
RpcRevertToSelf, Impersonation