#ifndef _NTPSAPI_H
//
// Processes
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
// Windows 8 and above
#define NtCurrentProcessToken() ((HANDLE)(LONG_PTR)-4) // NtOpenProcessToken(NtCurrentProcess())
View code on GitHub
This macro defines a pseudo-handle that allows querying information about the primary token of the calling process without explicitly opening it.
Note that as opposed to NtCurrentProcess
and NtCurrentThread
, the system does not accept token pseudo-handles outside of the token-querying function.
This macro was introduced in Windows 8.