0

I am trying to read values from a game with ReadProcessMemory() but it seems like i can only use that with short addresses. I was successful reading values with exact same code but a game that has shorter addresses. Like this 0x5CD38994 However when i try to do same thing with a different game that has longer addresses like 0x2840C6C68D8 i just get 0. I think it's about ReadProcessMemory() What should i do?

ReadProcessMemory(pHandle,(LPVOID)0x2840C6C68D8, &my_value, sizeof(my_value),0);
Entire Code:
#include <iostream>
#include <Windows.h>
#include <string>
#include <cstdint>

DWORD pid;
int my_value;

int main(){

    HWND hWnd = FindWindowA(0, ("game"));

    GetWindowThreadProcessId(hWnd, &pid);
    std::cout << pid << std::endl;
    HANDLE pHandle = OpenProcess(PROCESS_VM_READ, FALSE, pid);
    while(1){
        ReadProcessMemory(pHandle, (LPVOID)0x2840C6C68D8, &my_value, sizeof(my_value),0);
        std::cout << my_value << std::endl;
    }
}
Okilata
  • 1
  • 1

1 Answers1

1

You must compile for x64 by using `gcc -m64', otherwise you cannot use ReadProcessMemory() to read 64bit addresses.

GuidedHacking
  • 3,628
  • 1
  • 9
  • 59