Hermes/Dyforge is a program written in c++ allows you to inject a dll that can analyze all processes in a program, can be used for mod and reverse engeneering
| 1 | #include "../../include/DyForge.h" |
| 2 | #include <stdexcept> |
| 3 | #include <sstream> |
| 4 | |
| 5 | namespace DyForge { |
| 6 | |
| 7 | // Constructor |
| 8 | ProcessManager::ProcessManager() |
| 9 | : m_processId(0) |
| 10 | , m_processHandle(NULL) { |
| 11 | } |
| 12 | |
| 13 | // Destructor |
| 14 | ProcessManager::~ProcessManager() { |
| 15 | CloseProcess(); |
| 16 | } |
| 17 | |
| 18 | // Process management |
| 19 | bool ProcessManager::OpenProcess(DWORD processId) { |
| 20 | if (IsProcessOpen()) { |
| 21 | CloseProcess(); |
| 22 | } |
| 23 | |
| 24 | // Open process using DyHexInject |
| 25 | DyHexInjectError error = DyHexInject_OpenProcess(processId, &m_processInfo); |
| 26 | if (error != DYHEXINJECT_SUCCESS) { |
| 27 | std::stringstream ss; |
| 28 | ss << "Failed to open process " << processId << ": " |
| 29 | << DyHexInject_GetErrorString(error); |
| 30 | throw std::runtime_error(ss.str()); |
| 31 | } |
| 32 | |
| 33 | m_processId = processId; |
| 34 | m_processHandle = m_processInfo.processHandle; |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | void ProcessManager::CloseProcess() { |
| 39 | if (IsProcessOpen()) { |
| 40 | DyHexInject_CloseProcess(&m_processInfo); |
| 41 | m_processId = 0; |
| 42 | m_processHandle = NULL; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | bool ProcessManager::IsProcessOpen() const { |
| 47 | return m_processHandle != NULL; |
| 48 | } |
| 49 | |
| 50 | DWORD ProcessManager::GetCurrentProcessId() const { |
| 51 | return m_processId; |
| 52 | } |
| 53 | |
| 54 | } // namespace DyForge |