I injected a DLL to an exe. Now I need to read data from a specific offset. My code from the DLL:
DWORD ExeBaseAddress = (DWORD)GetModuleHandleA(0);
// HANDLE baseAddr = GetModuleHandleA(0)
uint16_t value = ExeBaseAddress + 0x7198BC + 0x70e;
cout << value << endl;
Problem is it doesn't give me the value I expect which is 1000
. It also doesn't give me the right address.
Using a memory reading software I can get the CORRECT value. See:
But I am still getting the wrong value from the code even though I'm using the exact same offset from the memory reading app. So what am I missing?
I tried this but its still giving me the wrong value.
HANDLE ExeBaseAddress = GetModuleHandleA(0);
uintptr_t p = (uintptr_t)ExeBaseAddress + 0x7198BC + 0x70e;
int value = *reinterpret_cast<int *>(p);
cout << ExeBaseAddress << " - " << value << endl;