TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/momo5502/sogen/llms.txt
Use this file to discover all available pages before exploring further.
process_context class maintains the complete state of an emulated Windows process, including threads, handles, memory structures, and Windows-specific objects.
Overview
This class serves as the central hub for process-level resources in the Windows emulator. It manages:- Process Environment Block (PEB) and process parameters
- Thread lifecycle and synchronization
- Handle tables for kernel objects (files, events, sections, etc.)
- User-mode objects (windows, desktops)
- Atoms and window classes
- WOW64 support for 32-bit applications
Constructor
Reference to the CPU emulator instance
Reference to the memory manager for allocations
System clock for time-related operations
Callback functions for thread lifecycle events
Methods
setup
Initializes the process context with all necessary Windows structures.CPU emulator instance
Memory manager for virtual address space
Windows registry emulation
Virtual file system for path translation
Windows version information provider
Application-specific configuration
The main executable module
The ntdll.dll module
API set schema container for module redirection
Optional 32-bit ntdll for WOW64 processes
create_thread
Creates a new emulated thread in the process.Memory manager for thread stack allocation
Entry point address for the thread
Parameter passed to the thread function
Size of the thread stack in bytes
Thread creation flags (e.g., CREATE_SUSPENDED)
Whether this is the process’s initial thread
Atom Management
Atoms are globally unique string identifiers used by Windows for window classes and other purposes.find_atom
The atom name to search for
std::nullopt otherwise.
add_or_find_atom
The atom name to add or find
delete_atom
The atom name to delete (first overload)
The atom ID to delete (second overload)
true if the atom was deleted, false otherwise.
get_atom_name
The atom ID to look up
nullptr if not found.
KnownDLLs Management
KnownDLLs are preloaded system DLLs cached as section objects.build_knowndlls_section_table
Registry manager to read KnownDLLs list
File system for resolving DLL paths
API set schema for module redirection
Windows system directory path
Whether to build 32-bit or 64-bit KnownDLLs table
get_knowndll_section_by_name
DLL name (e.g., “kernel32.dll”)
Whether to search in 32-bit or 64-bit table
add_knowndll_section
has_knowndll_section
get_handle_store
The handle to look up
nullptr if not found.
get_live_thread_count
Serialization
Public Members
WOW64 Support
Flag indicating if this is a 32-bit process running under WOW64
Process State
Process exit status code (set when process terminates)
Memory Structures
64-bit Process Environment Block
64-bit process parameters (command line, environment, etc.)
32-bit PEB for WOW64 processes
32-bit process parameters for WOW64
Critical Addresses
Base address of ntdll.dll
Address of LdrInitializeThunk (thread entry point)
Address of RtlUserThreadStart
Address of KiUserApcDispatcher
Address of KiUserExceptionDispatcher
Handle Stores
Event object handle store
File handle store
Section object handle store
Device handle store
Semaphore handle store
Thread handle store
Window handle store (user-mode handles)
Desktop handle store
Thread Management
Pointer to the currently executing thread
Total number of threads created
Usage Example
See Also
- module_manager - Module and DLL management
- syscall_dispatcher - System call handling
- file_system - Virtual file system