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


CAccessToken::Impersonate

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

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

Параметры

  • hThread
    Handle to the impersonation token to assign to the thread. 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.

Возвращаемое значение

Returns true on success, false on failure.

Заметки

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.

Требования

Header: atlsecurity.h

См. также

Основные понятия

CAccessToken Class

CAccessToken Members