Win32 Kernel API Functions
This section provides an overview and reference for fundamental Kernel API functions in the Windows operating system. These functions are crucial for managing system resources, processes, threads, and core operating system operations.
Core Concepts
The Win32 Kernel API is the lowest-level API exposed by the Windows operating system for user-mode applications. It provides access to essential system services, including:
- Process and thread creation and management.
- Memory allocation and manipulation.
- File and I/O operations.
- Synchronization primitives.
- System information retrieval.
Key Kernel Functions
Process and Thread Management
CreateProcess
Creates a new process and its primary thread. The new process is represented by a handle to both the process and its primary thread. The function replaces the calling process with the specified application module.
GetCurrentProcessId
Retrieves the process identifier of the calling process.
CreateThread
Creates a thread to execute within the virtual address space of the calling process.
ExitThread
Terminates the calling thread and provides the exit code.
Memory Management
VirtualAlloc
Reserves, commits, or changes the state of a region of pages in the virtual address space of the calling process.
VirtualFree
Releases, decommits, or uncommits a region of pages within the virtual address space of the calling process.
Handle Management
CloseHandle
Closes an open object handle.
DuplicateHandle
Duplicates an existing handle in the system.
Table of Common Kernel Functions
Function Name | Description |
---|---|
CreateProcess |
Creates a new process. |
GetCurrentProcess |
Retrieves a pseudo-handle for the current process. |
GetCurrentProcessId |
Retrieves the identifier of the current process. |
CreateThread |
Creates a new thread. |
ExitProcess |
Terminates the current process. |
ExitThread |
Terminates the calling thread. |
VirtualAlloc |
Allocates memory in the virtual address space. |
VirtualFree |
Frees memory allocated by VirtualAlloc . |
CloseHandle |
Closes an object handle. |
WaitForSingleObject |
Waits until an object becomes signaled. |
Sleep |
Suspends the current thread for a specified interval. |
Exploring the Win32 Kernel API is essential for understanding the low-level operations of Windows and for developing system-level software.