GetCurrentThreadToken function (processthreadsapi.h)

Retrieves a pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.

Syntax

HANDLE GetCurrentThreadToken();

Return value

A pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.

Remarks

A pseudo-handle is a special constant that can function as the impersonation token for the current thread. The calling thread can use a pseudo-handle to specify the impersonation token for that thread whenever a token handle is required. Child processes do not inherit pseudo-handles.

Starting in Windows 8, this pseudo-handle has only TOKEN_QUERY and TOKEN_QUERY_SOURCE access rights.

The pseudo-handle cannot be duplicated by the DuplicateHandle function or the DuplicateToken function.

You do not need to close the pseudo-handle when you no longer need it. If you call the CloseHandle function with a pseudo-handle, the function has no effect.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps UWP apps]
Minimum supported server Windows Server 2012 [desktop apps UWP apps]
Target Platform Windows
Header processthreadsapi.h

See also

Access Rights for Access-Token Objects

OpenThreadToken

SetThreadToken