Processes and threads

Provides information about a newly created process and its primary thread.

You need these headers:

Enumerations

 
MACHINE_ATTRIBUTES

Specifies the ways in which an architecture of code can run on a host operating system. More than one bit may be set.
PROCESS_INFORMATION_CLASS

Indicates a specific class of process information.
PROCESS_MEMORY_EXHAUSTION_TYPE

Represents the different memory exhaustion types.
QUEUE_USER_APC_FLAGS

The QUEUE_USER_APC_FLAGS enumeration (processthreadsapi.h) specifies the modifier flags for user-mode asynchronous procedure call (APC) objects.
THREAD_INFORMATION_CLASS

The THREAD_INFORMATION_CLASS enumeration (processthreadsapi.h) specifies the collection of supported thread types.

Functions

 
CreateProcessA

Creates a new process and its primary thread. The new process runs in the security context of the calling process. (ANSI)
CreateProcessAsUserA

Creates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token. (ANSI)
CreateProcessAsUserW

Creates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token. (Unicode)
CreateProcessW

Creates a new process and its primary thread. The new process runs in the security context of the calling process. (Unicode)
CreateRemoteThread

Creates a thread that runs in the virtual address space of another process.
CreateRemoteThreadEx

Creates a thread that runs in the virtual address space of another process and optionally specifies extended attributes such as processor group affinity.
CreateThread

Creates a thread to execute within the virtual address space of the calling process.
DeleteProcThreadAttributeList

Deletes the specified list of attributes for process and thread creation.
ExitProcess

Ends the calling process and all its threads.
ExitThread

Ends the calling thread.
FlushInstructionCache

Flushes the instruction cache for the specified process.
FlushProcessWriteBuffers

Flushes the write queue of each processor that is running a thread of the current process.
GetCurrentProcess

Retrieves a pseudo handle for the current process.
GetCurrentProcessId

Retrieves the process identifier of the calling process.
GetCurrentProcessorNumber

Retrieves the number of the processor the current thread was running on during the call to this function.
GetCurrentProcessorNumberEx

Retrieves the processor group and number of the logical processor in which the calling thread is running.
GetCurrentProcessToken

Retrieves a pseudo-handle that you can use as a shorthand way to refer to the access token associated with a process.
GetCurrentThread

Retrieves a pseudo handle for the calling thread.
GetCurrentThreadEffectiveToken

Retrieves a pseudo-handle that you can use as a shorthand way to refer to the token that is currently in effect for the thread, which is the thread token if one exists and the process token otherwise.
GetCurrentThreadId

Retrieves the thread identifier of the calling thread.
GetCurrentThreadStackLimits

Retrieves the boundaries of the stack that was allocated by the system for the current thread.
GetCurrentThreadToken

Retrieves a pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.
GetExitCodeProcess

Retrieves the termination status of the specified process.
GetExitCodeThread

Retrieves the termination status of the specified thread.
GetMachineTypeAttributes

Queries if the specified architecture is supported on the current system, either natively or by any form of compatibility or emulation layer.
GetPriorityClass

Retrieves the priority class for the specified process. This value, together with the priority value of each thread of the process, determines each thread's base priority level.
GetProcessDefaultCpuSetMasks

Retrieves the list of CPU Sets in the process default set that was set by SetProcessDefaultCpuSetMasks or SetProcessDefaultCpuSets.
GetProcessDefaultCpuSets

Retrieves the list of CPU Sets in the process default set that was set by SetProcessDefaultCpuSets.
GetProcessHandleCount

Retrieves the number of open handles that belong to the specified process.
GetProcessId

Retrieves the process identifier of the specified process.
GetProcessIdOfThread

Retrieves the process identifier of the process associated with the specified thread.
GetProcessInformation

Retrieves information about the specified process. (GetProcessInformation)
GetProcessMitigationPolicy

Retrieves mitigation policy settings for the calling process.
GetProcessPriorityBoost

Retrieves the priority boost control state of the specified process.
GetProcessShutdownParameters

Retrieves the shutdown parameters for the currently calling process.
GetProcessTimes

Retrieves timing information for the specified process.
GetProcessVersion

Retrieves the major and minor version numbers of the system on which the specified process expects to run.
GetStartupInfoW

Retrieves the contents of the STARTUPINFO structure that was specified when the calling process was created.
GetSystemCpuSetInformation

Allows an application to query the available CPU Sets on the system, and their current state.
GetSystemTimes

Retrieves system timing information. On a multiprocessor system, the values returned are the sum of the designated times across all processors.
GetThreadContext

Retrieves the context of the specified thread.
GetThreadDescription

Retrieves the description that was assigned to a thread by calling SetThreadDescription.
GetThreadId

Retrieves the thread identifier of the specified thread.
GetThreadIdealProcessorEx

Retrieves the processor number of the ideal processor for the specified thread.
GetThreadInformation

Retrieves information about the specified thread. (GetThreadInformation)
GetThreadIOPendingFlag

Determines whether a specified thread has any I/O requests pending.
GetThreadPriority

Retrieves the priority value for the specified thread. This value, together with the priority class of the thread's process, determines the thread's base-priority level.
GetThreadPriorityBoost

Retrieves the priority boost control state of the specified thread.
GetThreadSelectedCpuSetMasks

Returns the explicit CPU Set assignment of the specified thread, if any assignment was set using SetThreadSelectedCpuSetMasks or SetThreadSelectedCpuSets.
GetThreadSelectedCpuSets

Returns the explicit CPU Set assignment of the specified thread, if any assignment was set using the SetThreadSelectedCpuSets API.
GetThreadTimes

Retrieves timing information for the specified thread.
InitializeProcThreadAttributeList

Initializes the specified list of attributes for process and thread creation.
IsProcessCritical

Determines whether the specified process is considered critical.
IsProcessorFeaturePresent

Determines whether the specified processor feature is supported by the current computer.
OpenProcess

Opens an existing local process object.
OpenProcessToken

Opens the access token associated with a process.
OpenThread

Opens an existing thread object.
OpenThreadToken

Opens the access token associated with a thread.
ProcessIdToSessionId

Retrieves the Remote Desktop Services session associated with a specified process.
QueryProcessAffinityUpdateMode

Retrieves the affinity update mode of the specified process.
QueryProtectedPolicy

Queries the value associated with a protected policy.
QueueUserAPC

Adds a user-mode asynchronous procedure call (APC) object to the APC queue of the specified thread. (QueueUserAPC)
QueueUserAPC2

Adds a user-mode asynchronous procedure call (APC) object to the APC queue of the specified thread. (QueueUserAPC2)
ResumeThread

Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.
SetPriorityClass

Sets the priority class for the specified process. This value together with the priority value of each thread of the process determines each thread's base priority level.
SetProcessAffinityUpdateMode

Sets the affinity update mode of the specified process.
SetProcessDefaultCpuSetMasks

The SetProcessDefaultCpuSetMasks function (processthreadsapi.h) sets the default CPU Sets assignment for threads in the specified process.
SetProcessDefaultCpuSets

The SetProcessDefaultCpuSets function (processthreadsapi.h) sets the default CPU Sets assignment for threads in the specified process.
SetProcessDynamicEnforcedCetCompatibleRanges

Sets dynamic enforced CETCOMPAT ranges for the specified process.
SetProcessInformation

Sets information for the specified process.
SetProcessMitigationPolicy

Sets a mitigation policy for the calling process. Mitigation policies enable a process to harden itself against various types of attacks.
SetProcessPriorityBoost

Disables or enables the ability of the system to temporarily boost the priority of the threads of the specified process.
SetProcessShutdownParameters

Sets shutdown parameters for the currently calling process. This function sets a shutdown order for a process relative to the other processes in the system.
SetProtectedPolicy

Sets a protected policy.
SetThreadContext

Sets the context for the specified thread.
SetThreadDescription

Assigns a description to a thread.
SetThreadIdealProcessor

Sets a preferred processor for a thread. The system schedules threads on their preferred processors whenever possible.
SetThreadIdealProcessorEx

Sets the ideal processor for the specified thread and optionally retrieves the previous ideal processor.
SetThreadInformation

Sets information for the specified thread.
SetThreadPriority

Sets the priority value for the specified thread. This value, together with the priority class of the thread's process, determines the thread's base priority level.
SetThreadPriorityBoost

Disables or enables the ability of the system to temporarily boost the priority of a thread.
SetThreadSelectedCpuSetMasks

Sets the selected CPU Sets assignment for the specified thread. This assignment overrides the process default assignment, if one is set. (SetThreadSelectedCpuSetMasks)
SetThreadSelectedCpuSets

Sets the selected CPU Sets assignment for the specified thread. This assignment overrides the process default assignment, if one is set. (SetThreadSelectedCpuSets)
SetThreadStackGuarantee

Sets the minimum size of the stack associated with the calling thread or fiber that will be available during any stack overflow exceptions.
SuspendThread

Suspends the specified thread.
SwitchToThread

Causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the next thread to be executed.
TerminateProcess

Terminates the specified process and all of its threads.
TerminateThread

Terminates a thread.
TlsAlloc

Allocates a thread local storage (TLS) index. Any thread of the process can subsequently use this index to store and retrieve values that are local to the thread, because each thread receives its own slot for the index.
TlsFree

Releases a thread local storage (TLS) index, making it available for reuse.
TlsGetValue

Retrieves the value in the calling thread's thread local storage (TLS) slot for the specified TLS index. Each thread of a process has its own slot for each TLS index.
TlsSetValue

Stores a value in the calling thread's thread local storage (TLS) slot for the specified TLS index. Each thread of a process has its own slot for each TLS index.
UpdateProcThreadAttribute

Updates the specified attribute in a list of attributes for process and thread creation.

Structures

 
APP_MEMORY_INFORMATION

Represents app memory usage at a single point in time. This structure is used by the PROCESS_INFORMATION_CLASS class.
MEMORY_PRIORITY_INFORMATION

Specifies the memory priority for a thread or process.
OVERRIDE_PREFETCH_PARAMETER

PROCESS_INFORMATION

Contains information about a newly created process and its primary thread. It is used with the CreateProcess, CreateProcessAsUser, CreateProcessWithLogonW, or CreateProcessWithTokenW function.
PROCESS_LEAP_SECOND_INFO

Specifies how the system handles positive leap seconds.
PROCESS_MEMORY_EXHAUSTION_INFO

Allows applications to configure a process to terminate if an allocation fails to commit memory. This structure is used by the PROCESS_INFORMATION_CLASS class.
PROCESS_POWER_THROTTLING_STATE

Specifies the throttling policies and how to apply them to a target process when that process is subject to power management.
PROCESS_PROTECTION_LEVEL_INFORMATION

Specifies whether Protected Process Light (PPL) is enabled.
STARTUPINFOA

Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time. (ANSI)
STARTUPINFOW

Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time. (Unicode)
THREAD_POWER_THROTTLING_STATE

Specifies the throttling policies and how to apply them to a target thread when that thread is subject to power management.