Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <TlHelp32.h>
- #include <iostream>
- #include <tchar.h>
- #include <vector>
- DWORD GetModuleBaseAddress(TCHAR* lpszModuleName, DWORD pID)
- {
- DWORD ModuleBaseAddress = 0;
- HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID);
- MODULEENTRY32 ModuleEntry32 = { 0 };
- ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
- if (Module32First(hSnapshot, &ModuleEntry32))
- {
- do
- {
- if (_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
- {
- ModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
- break;
- }
- } while (Module32Next(hSnapshot, &ModuleEntry32));
- }
- CloseHandle(hSnapshot);
- return ModuleBaseAddress;
- }
- int main()
- {
- DWORD pID;
- DWORD off1, off2, off3, off4;
- DWORD baseAddress;
- DWORD moneyAddress;
- int newMoney;
- int currentMoney;
- char moduleName[] = "mono.dll";
- HWND hGameWindow;
- HANDLE pHandle;
- hGameWindow = FindWindow(NULL, "PC Building Simulator");
- GetWindowThreadProcessId(hGameWindow, &pID);
- pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
- DWORD clientBase = GetModuleBaseAddress(_T(moduleName), pID);
- ReadProcessMemory(pHandle, (LPCVOID)(clientBase + 0x00265A68), &baseAddress, sizeof(baseAddress), NULL);
- std::cout << "Base Address = " << std::hex << baseAddress << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement