NtCurrentThread - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTPSAPI_H
// Processes
#if (PHNT_MODE != PHNT_MODE_KERNEL)

#define NtCurrentThread() ((HANDLE)(LONG_PTR)-2)

#endif
#endif

View code on GitHub
#ifndef _NTPSAPI_H
// Processes
#if (PHNT_MODE != PHNT_MODE_KERNEL)

#define ZwCurrentThread() NtCurrentThread()

#endif
#endif

View code on GitHub

This macro is documented in Windows Driver Kit. It is a native equivalent of the GetCurrentThread function and returns a pseudo-handle that grants THREAD_ALL_ACCESS to the current thread. You do not need to call NtClose on the returned handle.

Applicable to

This pseudo-handle can be used with all functions that accept thread handles.

See also