Platform SDK: Logon Authentication

RevertSecurityContext

The RevertSecurityContext function allows a security package to discontinue the impersonation of the caller and restore its own security context.

SECURITY_STATUS RevertSecurityContext(
  PCtxtHandle phContext  // handle of the context being impersonated
);

Parameters

phContext
[in] Handle of the security context being impersonated. This handle must have been obtained in the call to the AcceptSecurityContext function and used in the call to the ImpersonateSecurityContext function.

Return Values

If the function succeeds, the return value is SEC_E_OK.

If the function fails, the return value can be the following error code.

Value Meaning
SEC_E_INVALID_HANDLE The handle passed to the function is invalid.

Remarks

The security package or an application server calls the RevertSecurityContext function when it needs to stop impersonating the caller. The server must have used this handle in the ImpersonateSecurityContext function.

RevertSecurityContext is not available with all security packages on all platforms. Typically, it is implemented only on platforms and with security packages for which a call to the QuerySecurityPackageInfo function indicates impersonation support.

The prototype for this function can be found in Sspi.h.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Sspi.h; include Security.h.
  Library: Use Secur32.lib.

See Also

AcceptSecurityContext, ImpersonateSecurityContext