Authorization Functions


RevertToSelf Function

The RevertToSelf function terminates the impersonation of a client application.

Syntax

C++
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 clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.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

Tags :


Page view tracker