WSARevertImpersonation function (ws2tcpip.h)

The WSARevertImpersonation function terminates the impersonation of a socket peer. This must be called after calling WSAImpersonateSocketPeer and finishing any access checks.

Syntax

INT WSAAPI WSARevertImpersonation();

Return value

If the function succeeds, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.

Some possible error codes are listed below.

Error code Meaning
WSASYSCALLFAILURE
A system call that should never fail has failed.

Remarks

The WSARevertImpersonation function causes the calling thread to discontinue the impersonation of a socket peer. If the thread is not currently impersonating a socket peer, no action is taken.

The WSARevertImpersonation function should be called after calling WSAImpersonateSocketPeer and all access checks are finished.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header ws2tcpip.h
Library Fwpuclnt.lib
DLL Fwpuclnt.dll

See also

Using Secure Socket Extensions

WSADeleteSocketPeerTargetName

WSAImpersonateSocketPeer

WSAQuerySocketSecurity

WSASetSocketPeerTargetName

WSASetSocketSecurity

Windows Filtering Platform

Windows Filtering Platform API Functions

Winsock Secure Socket Extensions