Поделиться через


CAccessToken::Impersonate

Call this method to assign an impersonation CAccessToken to a thread.

bool Impersonate( 
   HANDLE hThread = NULL 
) const throw(...);

Parameters

  • hThread
    Handle to the thread to assign the impersonation token to. This handle must have been opened with TOKEN_IMPERSONATE access rights. If hThread is NULL, the method causes the thread to stop using an impersonation token.

Return Value

Returns true on success, false on failure.

Remarks

In debug builds, an assertion error will occur if CAccessToken does not have a valid pointer to a token.

The CAutoRevertImpersonation class can be used to automatically revert impersonated access tokens.

Requirements

Header: atlsecurity.h

See Also

Reference

CAccessToken Class