Export (0) Print
Expand All
Expand Minimize

RevertToSelf function

The RevertToSelf function terminates the impersonation of a client application.

Syntax


BOOL WINAPI RevertToSelf(void);

Parameters

This function has no parameters.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

A process should call the RevertToSelf function after finishing any impersonation begun by using the DdeImpersonateClient, ImpersonateDdeClientWindow, ImpersonateLoggedOnUser, ImpersonateNamedPipeClient, ImpersonateSelf, ImpersonateAnonymousToken or SetThreadToken function.

An RPC server that used the RpcImpersonateClient function to impersonate a client must call the RpcRevertToSelf or RpcRevertToSelfEx to end the impersonation.

If RevertToSelf fails, your application continues to run in the context of the client, which is not appropriate. You should shut down the process if RevertToSelf fails.

Examples

For an example that uses this function, see Verifying Client Access with ACLs.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winbase.h (include Windows.h)

Library

Advapi32.lib

DLL

Advapi32.dll

See also

Client/Server Access Control Overview
Client/Server Access Control Functions
DdeImpersonateClient
ImpersonateAnonymousToken
ImpersonateDdeClientWindow
ImpersonateLoggedOnUser
ImpersonateNamedPipeClient
ImpersonateSelf
RpcImpersonateClient
RpcRevertToSelf
RpcRevertToSelfEx
SetThreadToken

 

 

Community Additions

ADD
Show:
© 2014 Microsoft