#ifndef _NTSEAPI_H
/**
* The NtImpersonateAnonymousToken routine causes a thread to impersonate the anonymous token.
*
* @param ThreadHandle Handle to the thread that will impersonate the anonymous token. The handle must have THREAD_DIRECT_IMPERSONATION access.
* @return NTSTATUS Successful or errant status.
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtImpersonateAnonymousToken(
_In_ HANDLE ThreadHandle
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwImpersonateAnonymousToken(
_In_ HANDLE ThreadHandle
);
View code on GitHubImpersonates the anonymous logon token on the specified thread.
ThreadHandle - a handle to the thread. The handle must grant THREAD_IMPERSONATE access.Depending on the EveryoneIncludesAnonymous LSA setting, the anonymous logon token either has untrusted integrity with no group membership or low integrity with Everyone membership.
To reset impersonation, use NtSetInformationThread with ThreadImpersonationToken info class and a NULL token handle.