0

I'm trying to read (and eventually write) memory of another process. I have the address (found using cheat engine) and I want to read it's value from my program, but I don't get the expected value. The address is 274A88A1630, but when I convert it to LPCVOID (which is required by ReadProcessMemory) I only get A88A1630 (which doesn't point to the memory I want)

I've tried converting using (LPCVOID) and (void*), both give the same result

int val = 0;
ReadProcessMemory(handle, (void*)0x274A88A1630, &val, sizeof(val), 0);
cout << val <<endl;
πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
LoipesMas
  • 3
  • 1

1 Answers1

1

That happens because you have compiled your app as an x86 (32 bit/Win32) binary. Pointers (void* in this case) are 32 bits on x86. Pointers on x64 (64 bit/Win64) are 64 bits. 0x274A88A1630 is a 64 bit value, so you will therefore not encounter this problem if you compile your app for x64 (64 bit/Win64).

TLDR; A pointer value over 32 bits gets truncated to 32 bits when compiled for x86.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
bootloop
  • 26
  • 3