class GameProcessWatcher public: GameProcessWatcher(); ~GameProcessWatcher();
std::vector<ProcessInfo> GameProcessWatcher::getAllProcesses() const std::vector<ProcessInfo> processes; HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnapshot == INVALID_HANDLE_VALUE) return processes; PROCESSENTRY32 processEntry; processEntry.dwSize = sizeof(PROCESSENTRY32); if (Process32First(hSnapshot, &processEntry)) do ProcessInfo info; info.processId = processEntry.th32ProcessID; info.processName = processEntry.szExeFile; info.threadCount = processEntry.cntThreads; info.parentProcessId = processEntry.th32ParentProcessID; processes.push_back(info); while (Process32Next(hSnapshot, &processEntry)); CloseHandle(hSnapshot); return processes; gameprocesswatcher.cpp
bool GameProcessWatcher::startWatching(int intervalMs) class GameProcessWatcher public: GameProcessWatcher()
// Error handling std::string getLastError() const; GameProcessWatcher::getAllProcesses() const std::vector<
void GameProcessWatcher::stopWatching() m_isWatching = false; if (m_watchThread.joinable()) m_watchThread.join();
bool GameProcessWatcher::setProcessByName(const std::string& processName) std::lock_guard<std::mutex> lock(m_mutex); DWORD pid = findProcessIdByName(processName); if (pid == 0) m_lastError = "Process not found: " + processName; return false; return openProcessById(pid);
// Process information uintptr_t getModuleBaseAddress(const std::string& moduleName) const; std::vector<ProcessInfo> getAllProcesses() const;