❓ C++ Address read from CoD Ghosts problem
Hello,
I am quite new to C++ programs, and I have a problem. I already have programmed some programs which worked, but I am stuck with CoD Ghosts.
I want to read the Squad Points from the game, the address is the right one (tested it several times with Cheat Engine), but my value always returns 0 instead of the value which should return (e.g. 30). I first tried to declare the variables "SquadPointsAddr" and "SquadPointsDec" with just int, but Visual Basic said I should use __int64, which didn't work too.
Please ask when you need more information. I also ran the project in 32 and 64 bit, but that didn't solve the problem too. Please help wherever you can
CODE:
I am quite new to C++ programs, and I have a problem. I already have programmed some programs which worked, but I am stuck with CoD Ghosts.
I want to read the Squad Points from the game, the address is the right one (tested it several times with Cheat Engine), but my value always returns 0 instead of the value which should return (e.g. 30). I first tried to declare the variables "SquadPointsAddr" and "SquadPointsDec" with just int, but Visual Basic said I should use __int64, which didn't work too.
Please ask when you need more information. I also ran the project in 32 and 64 bit, but that didn't solve the problem too. Please help wherever you can

CODE:
Code:
#include <iostream>
#include <iomanip>
#include <Windows.h>
#include <string>
#include <stdint.h>
using namespace std;
int main()
{
HWND hwnd = FindWindow(0, L"Call of Duty® Ghosts Multiplayer");
DWORD ProcessId;
ProcessId = GetProcessId(hwnd);
GetWindowThreadProcessId(hwnd, &ProcessId);
HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, ProcessId);
if (hwnd){
cout << "WINDOW FOUND" << endl;
}
else {
cout << "WINDOW NOT FOUND" << endl;
cout << hwnd << endl;
}
__int64 SquadPointsAddr = 0x1444C2E40;
__int64 SquadPointsDec;
cout << hex << SquadPointsAddr << ", " << sizeof(SquadPointsAddr) << endl;
cout << "-----------------------------------------------------" << "\n\n\n\n";
if (!hProcess)
{
Beep(100, 100);
}
else {
cout << "-----------------------------------------" << endl;
if (ReadProcessMemory(hProcess, (unsigned __int64 *)SquadPointsAddr, &SquadPointsDec, sizeof(SquadPointsAddr), NULL)){
cout << dec << "ADDRESS: " << SquadPointsDec << endl;
cout << endl;
}
}
CloseHandle(hProcess);
cout << endl;
system("pause");
}
..I think the first call to GetProcessId() is pointless, but the next line should set it correctly. ?

