After calling RpcImpersonateClient and completing any tasks that require client impersonation, the server calls RpcRevertToSelfEx to end impersonation and to reestablish its own security identity.
This function is supported only by Windows NT.
#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcRevertToSelf Ex(
RPC_BINDING_HANDLE CallHandle
);
Value | Meaning |
---|---|
RPC_S_OK | Success. |
RPC_S_NO_CALL_ACTIVE | Server does not have a client to impersonate. |
RPC_S_INVALID_BINDING | Invalid binding handle. |
RPC_S_WRONG_KIND_OF_BINDING | Wrong kind of binding for operation. |
RPC_S_CANNOT_SUPPORT | Not supported for this operating system, this transport, or this security subsystem. |
RpcRevertToSelfEx allows a server to impersonate a client and then revert in a multithreaded operation where the call to impersonate a client can come from a thread other than the thread originally dispatched from the RPC. For example, consider a primary thread, called thread1, which is dispatched from a remote client and which wakes up a worker thread, called thread2. If thread2 requires that the server impersonate the client, the server calls RpcImpersonateClient(thread1_call_handle), performs the required task, calls RpcRevertToSelfEx(thread1_call_handle) to end the impersonation, and then wakes up thread1.
Windows NT: Yes
Windows CE: Unsupported.
Header: Declared in rpc.h.
Import Library: Link with rpcrt4.lib.
RpcImpersonateClient, RpcRevertToSelf, Impersonation