The Launching System is responsible for bootstrapping the game process within the isolated Workspace. It handles the complexity of environment setup, argument injection, and platform integration (Steam/EA App).
Architecture
The system distinguishes between Standard Launches (direct process creation) and Platform Launches (Steam/EA).
The "Proxy Dance" (Steam Integration)
To launch a modded game through Steam (tracking hours, overlay, status) while keeping the files isolated in a Workspace, GenHub employs a "Proxy Dance" technique.
The Problem
Steam will only launch the executable defined in its manifest (e.g., Command and Conquer Generals Zero Hour\generals.exe). It does not allow launching an arbitrary .exe in a separate AppData folder.
The Solution
Backup: Rename the real
generals.exetogenerals.exe.ghbak.Deploy Proxy: Copy
GenHub.ProxyLauncher.exetogenerals.exe.Configure: Write a
proxy_config.jsonfile next to it:json{ "TargetExecutable": "C:\\Users\\User\\.genhub\\workspaces\\profile_123\\generals.exe", "WorkingDirectory": "C:\\Users\\User\\.genhub\\workspaces\\profile_123\\" }Inject Dependencies: Copy
steam_api.dllandsteam_appid.txtto the Workspace so the game can initialize the Steam API.Launch: GenHub tells Steam to "Play Game".
Execution Chain:
- Steam runs
generals.exe(Our Proxy). - Proxy reads config.
- Proxy launches the actual game in the Workspace.
- Steam runs
Cleanup: When the game closes, GenHub restores the original
generals.exe.
Process Monitoring
The GameProcessManager tracks the lifecycle of the game.
Security & Isolation
- Path Validation: The launcher strictly validates that the executable being launched resides within the authorized Workspace boundary. This prevents "Workspace Escape" attacks.
- Argument Sanitization: Command-line arguments are sanitized to block injection attacks (e.g., preventing
; rm -rf /style chains).
Lifecycle
- Pre-Launch:
LaunchRegistryreserves a "Launch Slot" to prevent double-launching the same profile. - Monitoring: The PID is tracked.
- Termination:
- Graceful: Sends
CloseMainWindowsignal. - Force: If process hangs >5s, calls
Process.Kill().
- Graceful: Sends
