RevertSecurityContext

The RevertSecurityContext function allows a service provider 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

hContext
Handle of the 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 service provider 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.

See Also

AcceptSecurityContext, ImpersonateSecurityContext