This site is a B2B information site for professional use - we do not sell or distribute any products.
Gameprocesswatcher.cpp
When a game closes, this component captures the "exit code." If a game crashes, you may see an error in your launcher logs like ERROR GameProcessWatcher.cpp (224) or Child process abnormal exit , which indicates the watcher detected an unexpected shutdown.
#include <string> #include <thread> #include <mutex> #include <functional> #include <vector> #include <windows.h>
bool GameProcessWatcher::readMemory(uintptr_t address, void* buffer, size_t size) const if (m_hProcess == nullptr) return false;
In a modern gaming ecosystem, the launcher acts as a "parent" process that spawns the game as a "child" process. The logic contained within gameprocesswatcher.cpp is responsible for:
if (waitResult == WAIT_OBJECT_0) // Game exited. Check exit code for crash vs normal DWORD exitCode; GetExitCodeProcess(hProcess, &exitCode); if (exitCode != 0 && exitCode != STATUS_CONTROL_C_EXIT) if (onCrashCallback) onCrashCallback(targetPid); else if (onExitCallback) onExitCallback(targetPid);
At its core, a GameProcessWatcher is a specialized wrapper around operating system process management APIs. Its primary responsibility is lifecycle management. It answers three fundamental questions for the host application:
In more sophisticated architectures, gameprocesswatcher.cpp does far more than check
When a game closes, this component captures the "exit code." If a game crashes, you may see an error in your launcher logs like ERROR GameProcessWatcher.cpp (224) or Child process abnormal exit , which indicates the watcher detected an unexpected shutdown.
#include <string> #include <thread> #include <mutex> #include <functional> #include <vector> #include <windows.h>
bool GameProcessWatcher::readMemory(uintptr_t address, void* buffer, size_t size) const if (m_hProcess == nullptr) return false;
In a modern gaming ecosystem, the launcher acts as a "parent" process that spawns the game as a "child" process. The logic contained within gameprocesswatcher.cpp is responsible for:
if (waitResult == WAIT_OBJECT_0) // Game exited. Check exit code for crash vs normal DWORD exitCode; GetExitCodeProcess(hProcess, &exitCode); if (exitCode != 0 && exitCode != STATUS_CONTROL_C_EXIT) if (onCrashCallback) onCrashCallback(targetPid); else if (onExitCallback) onExitCallback(targetPid);
At its core, a GameProcessWatcher is a specialized wrapper around operating system process management APIs. Its primary responsibility is lifecycle management. It answers three fundamental questions for the host application:
In more sophisticated architectures, gameprocesswatcher.cpp does far more than check