Process Management
This section provides information on the Windows API functions used to create, manage, and terminate processes.
Core Concepts
A process is an instance of a running program. It includes the program's code, data, and all the resources it needs to execute. The Windows operating system manages processes to ensure efficient and fair resource allocation.
Key Functions
Here are some of the fundamental functions for process management:
Creating Processes
CreateProcess: Starts a new process and its primary thread. It can also specify the attributes of the new process and its thread.CreateProcessAsUser: Starts a new process as a specified user.CreateProcessInternalW: Internal function used by CreateProcess and other process creation APIs.
Process Information
GetCurrentProcess: Returns a pseudo-handle for the current process.GetCurrentProcessId: Returns the identifier of the current process.GetProcessId: Retrieves the process identifier for the specified process.GetProcessTimes: Retrieves timing information for the specified process.GetExitCodeProcess: Retrieves the exit code of the specified process.
Process Manipulation
TerminateProcess: Terminates the specified process and any threads that it owns.SetPriorityClass: Sets the priority class for the specified process.OpenProcess: Retrieves a handle to a process specified by the process identifier.
Process Structures
Various structures are used to pass information to and from process management functions:
| Structure Name | Description |
|---|---|
STARTUPINFO |
Specifies the window station, show command, and standard handles for a new process. |
PROCESS_INFORMATION |
Contains information about newly created processes and threads. |
SECURITY_ATTRIBUTES |
Defines the security descriptor for an object. |