#ifndef _NTPSAPI_H
// Processes
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* Retrieves information about the specified process.
*
* @param ProcessHandle A handle to the process.
* @param ProcessInformationClass The type of process information to be retrieved.
* @param ProcessInformation A pointer to a buffer that receives the process information.
* @param ProcessInformationLength The size of the buffer pointed to by the ProcessInformation parameter.
* @param ReturnLength An optional pointer to a variable that receives the size of the data returned.
* @return NTSTATUS Successful or errant status.
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtQueryInformationProcess(
_In_ HANDLE ProcessHandle,
_In_ PROCESSINFOCLASS ProcessInformationClass,
_Out_writes_bytes_(ProcessInformationLength) PVOID ProcessInformation,
_In_ ULONG ProcessInformationLength,
_Out_opt_ PULONG ReturnLength
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwQueryInformationProcess(
_In_ HANDLE ProcessHandle,
_In_ PROCESSINFOCLASS ProcessInformationClass,
_Out_writes_bytes_(ProcessInformationLength) PVOID ProcessInformation,
_In_ ULONG ProcessInformationLength,
_Out_opt_ PULONG ReturnLength
);
View code on GitHub
Queries various information about the specified process. This function is partially documented in Windows SDK.
ProcessHandle
- a handle to the process or the NtCurrentProcess
pseudo-handle. For most information classes, the handle must grant either PROCESS_QUERY_INFORMATION
or PROCESS_QUERY_LIMITED_INFORMATION
access.ProcessInformationClass
- the type of information to retrieve.ProcessInformation
- a pointer to a user-allocated buffer that receives the requested information.ProcessInformationLength
- the size of the provided buffer in bytes.ReturnLength
- an optional pointer to a variable that receives the number of bytes written when the function succeeds or the number of bytes requires when the buffer is too small.For the list of supported info classes and required process access, see PROCESSINFOCLASS
.
STATUS_BUFFER_TOO_SMALL
and STATUS_INFO_LENGTH_MISMATCH
indicate that the requested information does not fit into the provided buffer.GetExitCodeProcess
GetProcessId
GetProcessInformation
GetProcessMitigationPolicy
IsWow64Process
IsProcessCritical
ProcessIdToSessionId
QueryProcessCycleTime
QueryProcessAffinityUpdateMode
GetProcessWorkingSetSizeEx
GetProcessTimes
GetErrorMode
GetProcessHandleCount
GetProcessPriorityBoost
GetProcessVersion
GetProcessGroupAffinity
GetPriorityClass