I am trying to read a value of an address but i can't really seem to do it. I'm trying to get : client.dll + 0xA9C0DC + 0x00FC . I'm just trying to read the health of the player from a game. This is my code :
#include <iostream>
#include <Windows.h>
#include <string>
DWORD pid;
DWORD Address = 0xA9C0DC;
int cHealth;
int main()
{
HWND hWnd = FindWindowA(0, ("Counter-Strike: Global Offensive"));
GetWindowThreadProcessId(hWnd, &pid);
HANDLE pHandle = OpenProcess(PROCESS_VM_READ, FALSE, pid);
while(true)
{
ReadProcessMemory(pHandle, (LPVOID)(Address + 0x00FC), &cHealth,
sizeof(cHealth), 0);
std::cout << cHealth <<std::endl;
Sleep(200);
}
return 0;
}
Instead of (Address + 0x00FC)
i've tried DWORD Address = 0xA9C0DC + 0x00FC;
or
DWORD Address1 = 0xA9C0DC;
DWORD offset = 0x00FC;
DWORD Address = Address1 + offset; //or DWORD Address = (DWORD)(Address1 + offset)
Nothing seems to work. Can i get some help ?