#include #include #include #include #include #include #include #include #include #include DWORD processID; // Method to get process ID from an active window if you can get it in another way you can remove it. void GetProcessIDFromWindow(LPCSTR windowName) { HWND hwnd = NULL; while (hwnd == NULL) { hwnd = FindWindowA(NULL, (windowName)); GetWindowThreadProcessId(hwnd, &processID); if(hwnd == NULL){std::cout << "No program found please make sure that the program has started..." << std::endl; std::chrono::seconds delay(2); std::this_thread::sleep_for(delay); } } } //Method to get Module Base Address and the process handle uintptr_t GetModuleBaseAddress(DWORD processId, const char* moduleName) { HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processId); if (processHandle == NULL) { // Failed to open the process return 0; } HMODULE moduleHandle = NULL; MODULEENTRY32 moduleEntry; moduleEntry.dwSize = sizeof(MODULEENTRY32); // Iterate through the loaded modules in the process to find the target module HANDLE moduleSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, processId); if (moduleSnapshot != INVALID_HANDLE_VALUE) { if (Module32First(moduleSnapshot, &moduleEntry)) { do { if (_stricmp(moduleEntry.szModule, moduleName) == 0) //there is an error here you can try to fix it but it doesn't effect this code. note* i hate every function that starts with "_". { moduleHandle = moduleEntry.hModule; break; } } while (Module32Next(moduleSnapshot, &moduleEntry)); } CloseHandle(moduleSnapshot); } if (moduleHandle == NULL) { // Module not found CloseHandle(processHandle); return 0; } uintptr_t baseAddress = reinterpret_cast(moduleHandle); CloseHandle(processHandle); return baseAddress; } int main() { LPCSTR winName = "Program Window Name"; //Put the window name that you want to read from GetProcessIDFromWindow(winName); std::fstream pIDFile; pIDFile.open("pID.txt", std::ios::out); pIDFile << processID; pIDFile.close(); uintptr_t baseAddress = NULL; HANDLE processHandle = NULL; processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); if (processHandle == INVALID_HANDLE_VALUE || processHandle == NULL) { // error handling std::cout << "Failed to open process" << std::endl; return 0; } const char* moduleName = "Program.exe"; // Replace with the name of your module, you can find it with the base address if you use cheat engine baseAddress = GetModuleBaseAddress(processID, moduleName); DWORD gameBaseAddress= baseAddress; DWORD offsetGameToBaseAdress = 0x00000000; std::vector pointsOffsets{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //Place your offsets here you can add single digit numbers with or without an extra zero but make sure that the hex identfier is included "0x" before the number //Get value at gamebase+offset -> store it in baseAddress ReadProcessMemory(processHandle, (LPVOID)(gameBaseAddress+ offsetGameToBaseAdress), &baseAddress, sizeof(baseAddress), NULL); DWORD pointsAddress = baseAddress; //The Adress we need -> change now while going through offsets for (int i = 0; i < pointsOffsets.size() - 1; i++) // -1 because we dont want the value at the last offset { ReadProcessMemory(processHandle, (LPVOID)(pointsAddress + pointsOffsets.at(i)), &pointsAddress, sizeof(pointsAddress), NULL); } pointsAddress += pointsOffsets.at(pointsOffsets.size()-1); //Add Last offset -> done! std::cout<< "0x" << std::hex <