#ifndef _NTPSAPI_H
// Processes
#if (PHNT_MODE != PHNT_MODE_KERNEL)
#define NtCurrentThread() ((HANDLE)(LONG_PTR)-2)
View code on GitHub#ifndef _NTPSAPI_H
// Processes
#if (PHNT_MODE != PHNT_MODE_KERNEL)
#define ZwCurrentThread() NtCurrentThread()
View code on GitHubThis 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.
This pseudo-handle can be used with all functions that accept thread handles.