Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › C++ Address read from CoD Ghosts problem

QuestionC++ Address read from CoD Ghosts problem

Posts 1–5 of 5 · Page 1 of 1
DB
dban0001
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:

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");
}
#1 · 12y ago
abuckau907
abuckau907
if (ReadProcessMemory(hProcess, (unsigned __int64 *)SquadPointsAddr, &SquadPointsDec, sizeof(SquadPointsAddr), NULL))
ReadProcessMemory(handle, source_addr, dest_addr, size_of_dest, bytes_read)

size_of_dest = sizeof(SquadPointsDec), not sizeOf(SquadPointsAddr) -- but in this example they're both 64 bits.

Is squad points actually stored as Int64, or something smaller?



Also, GetProcessId()
GetProcessId function (Windows)

It expects a process HANDLE, not a window HANDLE. Probably a different windows function for you to use...

guick google: https://www.google.com/search?q=GetP...+window+handle

result: Get process id from window handle

GetWindowThreadProcessId(hwnd, out processId);
edit: looks like you call the correct one right after ..I think the first call to GetProcessId() is pointless, but the next line should set it correctly. ?
ProcessId = GetProcessId(hwnd);
GetWindowThreadProcessId(hwnd, &ProcessId);
Which part is giving you trouble? What works / doesn't work?

1. is the window found?
2. is the process ID found?
3. does OpenProcess() return a valid handle?

I re-structured the code a little bit (the IF statements). Your way kind-of worked, but for example you use 'hwnd' before making sure it's valid. I changed the cout's because it's helpful to know which functions/values you're getting messages for.

 
codefromimage

Code:
#include <Windows.h>
#include <iostream>
using namespace std;

int main()
{
	HWND hwnd;			//window handle returned by FindWindow()
	DWORD ProcessId;	//processID returned by GetWindowThreadProcessId()
	HANDLE hProcess;	//handle returned from OpenProcess()

	hwnd = FindWindow(0, "Calculator"); 
	if (hwnd){
		cout << "WINDOW FOUND: " << hwnd << endl;
		GetWindowThreadProcessId(hwnd, &ProcessId);
		cout << "ProcessId: " << ProcessId << endl;
		HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, ProcessId);
		if (hProcess)
		{
		cout << "OpenProcess() Success : Handle returned: " << hProcess << endl;
		/*Do Reading and whatnot here...*/
		CloseHandle(hProcess);
		}
		else
		{
		cout <<"OpenProcess() FAILED : Handle returned: " << hProcess << endl;
		}
	}
	else {
		cout << "WINDOW NOT FOUND." << endl << "Window Handle (invalid): " << hwnd << endl;
	}
	

	cout << "\n\nLeaving program...\n\n" << endl;
	system("pause");
	return 0;
}
Once this part is working 100%, move on to calling ReadProcessMemory().
#2 · edited 12y ago · 12y ago
_PuRe.LucK*
_PuRe.LucK*
Just use Dll Injection:

Code:
#include <windows.h>

#define Addy1 0x1444C2E40


BOOL WINAPI DllMain(HMODULE hDll, DWORD reason, LPVOID reserved)
{
      if(reason == 1)
      {
             DWORD dwAddy1 = *(DWORD*)(Addy1);
             *(DWORD*)(dwAddy1)=100000;
      }
      return TRUE;
}
#3 · 12y ago
abuckau907
abuckau907
Quote Originally Posted by Nik0815 View Post
Just use Dll Injection:

Code:
#include <windows.h>

#define Addy1 0x1444C2E40


BOOL WINAPI DllMain(HMODULE hDll, DWORD reason, LPVOID reserved)
{
      if(reason == 1)
      {
             DWORD dwAddy1 = *(DWORD*)(Addy1);
             *(DWORD*)(dwAddy1)=100000;
      }
      return TRUE;
}
#define Addy1 0x1444C2E40
14 44 C2 E4 0

9 digits(ie. too big for DWORD) - typo, or ?
#4 · 12y ago
_PuRe.LucK*
_PuRe.LucK*
Quote Originally Posted by abuckau907 View Post
#define Addy1 0x1444C2E40
14 44 C2 E4 0

9 digits(ie. too big for DWORD) - typo, or ?
No matters... It's only an example
#5 · 12y ago
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

  • Reading from a memory addressBy isaacboy in Visual Basic Programming
    0Last post 17y ago
  • IP Address Banned from Warrock Read This!By Ariez in WarRock - International Hacks
    19Last post 17y ago
  • [Request] Reading From WebPageBy CoderNever in C++/C Programming
    4Last post 16y ago
  • Reading from an INI fileBy Credzis in C++/C Programming
    0Last post 18y ago
  • [Tutorial] Reading from the CMD lineBy shercipher in C++/C Programming
    7Last post 20y ago

Tags for this Thread

#address#c++#cod#ghosts#memory#read