NtQueryInformationProcess
Retrieves a class of information about a process — the universal back-end of GetProcessInformation and the workhorse of anti-debug checks.
Prototype
NTSTATUS NtQueryInformationProcess( HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| ProcessHandle | HANDLE | in | Handle to the target process. Required access depends on the class (often PROCESS_QUERY_LIMITED_INFORMATION). |
| ProcessInformationClass | PROCESSINFOCLASS | in | Enum selecting the information class. Notable: ProcessBasicInformation=0, ProcessDebugPort=7, ProcessWow64Information=26, ProcessImageFileName=27, ProcessDebugObjectHandle=30, ProcessDebugFlags=31, ProcessProtectionInformation=61. |
| ProcessInformation | PVOID | out | Caller-supplied buffer that receives the requested class data. Layout varies per class. |
| ProcessInformationLength | ULONG | in | Size in bytes of the ProcessInformation buffer. |
| ReturnLength | PULONG | out | Optional pointer that receives the number of bytes written (or required, on STATUS_INFO_LENGTH_MISMATCH). |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0x19 | win10-1507 |
| Win10 1607 | 0x19 | win10-1607 |
| Win10 1703 | 0x19 | win10-1703 |
| Win10 1709 | 0x19 | win10-1709 |
| Win10 1803 | 0x19 | win10-1803 |
| Win10 1809 | 0x19 | win10-1809 |
| Win10 1903 | 0x19 | win10-1903 |
| Win10 1909 | 0x19 | win10-1909 |
| Win10 2004 | 0x19 | win10-2004 |
| Win10 20H2 | 0x19 | win10-20h2 |
| Win10 21H1 | 0x19 | win10-21h1 |
| Win10 21H2 | 0x19 | win10-21h2 |
| Win10 22H2 | 0x19 | win10-22h2 |
| Win11 21H2 | 0x19 | win11-21h2 |
| Win11 22H2 | 0x19 | win11-22h2 |
| Win11 23H2 | 0x19 | win11-23h2 |
| Win11 24H2 | 0x19 | win11-24h2 |
| Server 2016 | 0x19 | winserver-2016 |
| Server 2019 | 0x19 | winserver-2019 |
| Server 2022 | 0x19 | winserver-2022 |
| Server 2025 | 0x19 | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 19 00 00 00 mov eax, 0x19 F6 04 25 08 03 FE 7F 01 test byte ptr [0x7FFE0308], 1 75 03 jne short +3 0F 05 syscall C3 ret CD 2E int 2Eh C3 ret
Undocumented notes
NtQueryInformationProcess is one of the most overloaded syscalls in Windows: more than 100 PROCESSINFOCLASS values are defined across modern builds, ranging from harmless (ProcessTimes=4, ProcessHandleCount=20) to deeply security-relevant (ProcessDebugPort=7, ProcessDebugObjectHandle=30, ProcessDebugFlags=31, ProcessMitigationPolicy=52, ProcessProtectionInformation=61, ProcessImageFileName=27). The SSN itself is rock-stable at 0x19 since Windows 10 1507 — Microsoft has carefully held this slot because so much in-tree and third-party code calls it. The class number space, however, churns frequently; values added in 24H2 are not present in 1809 and will return STATUS_INVALID_INFO_CLASS on older kernels.
Common malware usage
The single most-called anti-debug primitive on Windows. ProcessDebugPort (7) returns a non-zero handle when a usermode debugger is attached — used by IsDebuggerPresent's NTDLL-based replacements and most commercial protectors (VMProtect, Themida, Enigma). ProcessDebugObjectHandle (30) returns the DebugObject directly — required because experienced analysts NULL out the legacy DebugPort. ProcessDebugFlags (31) returns the inverse of NoDebugInherit; reading 0 means a debugger has been attached at some point. Combined: a pattern of three back-to-back NtQueryInformationProcess calls with classes 7, 30, 31 against NtCurrentProcess() is an almost certain anti-debug fingerprint. Loaders also use ProcessBasicInformation (0) to obtain PEB and walk loaded modules without touching the obvious LdrEnumerateLoadedModules; ProcessImageFileName (27) is used for sandbox/emulator name checks.
Detection opportunities
Volume is huge — this syscall fires constantly in normal operation, so raw counts are useless. Differentiation comes from (a) the class used, (b) the target handle (self vs. remote), and (c) call sequencing. ETW Microsoft-Windows-Kernel-Audit-API-Calls does *not* surface class — you need a user-mode shim (ntdll inline hook, ETW provider per-class) or a kernel callback. Detection rule of thumb: any process that calls classes 7, 30, 31 in close succession against itself is performing anti-debug. EDRs that care about this generally instrument the dispatch via instrumentation callbacks (PsSetLoadImageNotifyRoutine + NtSetInformationProcess(ProcessInstrumentationCallback)) or via TI-ETW EtwTiLogReadWriteVm-style hooks on adjacent operations.
Direct syscall examples
cTriple-class anti-debug check
// The canonical anti-debug fingerprint: classes 7, 30, 31 against self.
HANDLE hProc = NtCurrentProcess();
DWORD_PTR debugPort = 0;
HANDLE debugObj = NULL;
ULONG debugFlags = 0;
ULONG ret;
NtQueryInformationProcess(hProc, ProcessDebugPort, &debugPort, sizeof(debugPort), &ret);
NtQueryInformationProcess(hProc, ProcessDebugObjectHandle, &debugObj, sizeof(debugObj), &ret);
NtQueryInformationProcess(hProc, ProcessDebugFlags, &debugFlags, sizeof(debugFlags), &ret);
if (debugPort != 0 || debugObj != NULL || debugFlags == 0) {
// Debugger present (or has been). Bail.
NtTerminateProcess(hProc, 0);
}cPEB walk via ProcessBasicInformation
PROCESS_BASIC_INFORMATION pbi = { 0 };
ULONG ret;
NtQueryInformationProcess(NtCurrentProcess(),
ProcessBasicInformation,
&pbi, sizeof(pbi), &ret);
PPEB peb = pbi.PebBaseAddress;
// Now walk peb->Ldr->InMemoryOrderModuleList to enumerate modules
// without calling LdrEnumerateLoadedModules / EnumProcessModules.asmx64 stub (stable across builds)
; SSN 0x19 — stable Win10 1507 .. Win11 24H2.
NtQueryInformationProcess PROC
mov r10, rcx
mov eax, 19h
syscall
ret
NtQueryInformationProcess ENDPMITRE ATT&CK mappings
Last verified: 2026-05-20