Advertisement
Guest User

not working shit

a guest
Feb 18th, 2020
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <TlHelp32.h>
  3. #include <iostream>
  4. #include <tchar.h>
  5. #include <vector>
  6.  
  7. DWORD GetModuleBaseAddress(TCHAR* lpszModuleName, DWORD pID)
  8. {
  9. DWORD ModuleBaseAddress = 0;
  10. HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID);
  11. MODULEENTRY32 ModuleEntry32 = { 0 };
  12. ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
  13. if (Module32First(hSnapshot, &ModuleEntry32))
  14. {
  15. do
  16. {
  17. if (_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
  18. {
  19. ModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
  20. break;
  21. }
  22. } while (Module32Next(hSnapshot, &ModuleEntry32));
  23. }
  24. CloseHandle(hSnapshot);
  25. return ModuleBaseAddress;
  26. }
  27.  
  28. int main()
  29. {
  30. DWORD pID;
  31. DWORD off1, off2, off3, off4;
  32. DWORD baseAddress;
  33. DWORD moneyAddress;
  34. int newMoney;
  35. int currentMoney;
  36. char moduleName[] = "mono.dll";
  37. HWND hGameWindow;
  38. HANDLE pHandle;
  39.  
  40. hGameWindow = FindWindow(NULL, "PC Building Simulator");
  41. GetWindowThreadProcessId(hGameWindow, &pID);
  42. pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
  43.  
  44. DWORD clientBase = GetModuleBaseAddress(_T(moduleName), pID);
  45. ReadProcessMemory(pHandle, (LPCVOID)(clientBase + 0x00265A68), &baseAddress, sizeof(baseAddress), NULL);
  46. std::cout << "Base Address = " << std::hex << baseAddress << std::endl;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement