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 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| 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
Send comments about this topic to Microsoft
Build date: 9/11/2009