Solved Help Reading memory correctly

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Tseno95

Newbie
Full Member
Jun 9, 2014
26
188
0
C++:
#include <iostream>
#include <windows.h>

using namespace std;

LPCSTR Game_Name = "StarCraft II"; // name of window
LPCSTR Console_Name = "SCII"; // console name
DWORD address = 0x6154B44; // the in game timer address
DWORD g_address = 0x00620000; // SC2.exe address
DWORD offset_1 = 0x4; // some offset ???
int G_TIMER = 0; // The in game timer
DWORD programID; // the id
HWND hWindow; // window handle
HANDLE hproc; // process handle
const static unsigned int SECONDS_IN_AN_HOUR = 3600; // timer related
const static unsigned int SECONDS_IN_A_MINUTE = 60; // timer related
int Desktop_ScreenX = 0; // x of pc screen
int Desktop_ScreenY = 0; // y of pc screen

void print_with_formatting(const unsigned int value)
{
	if (value == 0)
	{
		cout << "00";
	}
	else if (value < 10)
	{
		cout << "0" << value;
	}
	else
	{
		cout << value - 1;
	}
} 
void PC_MOUSE_POS()
{
	POINT Mouse_Position;
	GetCursorPos(&Mouse_Position);

	cout << "Mouse Position (X): " << "<" << Mouse_Position.x << ">" << endl;
	cout << "Mouse Position (Y): " << "<" << Mouse_Position.y << ">" << endl;
} 
void GetDesktopResolution(int& horizontal, int& vertical)
{
	RECT desktop;
	const HWND hDesktop = GetDesktopWindow();
	GetWindowRect(hDesktop, &desktop);
	horizontal = desktop.right;
	vertical = desktop.bottom;
}
void hWindow_Strings0()
{
	cout << "Game Window Not Found!" << endl;
	cout << "Start Starcraft First!" << endl;
	cout << "Program will exit!" << endl;
}
void hWindow_Strings1()
{
	cout << "ERROR::Starcraft Process Not Opened!" << endl;
	cout << "Program will exit!" << endl;
}

int main()
{
	SetConsoleTitle(Console_Name); // set console name before loop
	GetDesktopResolution(Desktop_ScreenX, Desktop_ScreenY); // PC Screen Resolution

	while (true)
	{
		hWindow = FindWindow(0,Game_Name);
		if (!hWindow)
		{
			hWindow_Strings0(); // call strings
			Sleep(3000);
			exit(0);
		}
		else
		{
			GetWindowThreadProcessId(hWindow, &programID);
			hproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, programID);
			if (!hproc)
			{
				hWindow_Strings0(); // call strings
				exit(0);
			}
			else
			{
				cout << programID << endl; // display program id
				PC_MOUSE_POS(); // Mouse Position
				cout << "PC:: Screen Resolution: ";
				cout << "<" << Desktop_ScreenX << ">" << "X" << "<" << Desktop_ScreenY << ">" << endl;
				ReadProcessMemory(hproc, (void*)address, &G_TIMER, sizeof(G_TIMER), 0);
				cout << "Game Timer::Seconds Only: " << G_TIMER << " (SOMETIMES NOT) Accurate"<< endl;
				if (G_TIMER > 0)
				{
					cout << "Game Timer: ";
					print_with_formatting((unsigned int)(G_TIMER / SECONDS_IN_AN_HOUR));
					cout << ":";
					print_with_formatting((unsigned int)(G_TIMER % SECONDS_IN_AN_HOUR) / SECONDS_IN_A_MINUTE);
					cout << ":";
					print_with_formatting((unsigned int)(G_TIMER % SECONDS_IN_AN_HOUR) % SECONDS_IN_A_MINUTE);
				}
			}
		}
		system("cls");
		if (G_TIMER > 60)
		{
			cout << "Scout for cannon rush until 2:30" << endl;
		}
	}
	return 0;
}
Can anyone simply tell me how to do this ReadProcessMemory(hproc, (void*)address, &G_TIMER, sizeof(G_TIMER), 0); with dynamic memory addresses ? I tried some stuff but didn't quite work.
Some code examples will be very useful.
I CE I have sc2.exe + offset or something like that so how do I add the stuff together or whatever I have to do to get it so it doesn't change on every restart.
And please no nether lib references.
 

Tseno95

Newbie
Full Member
Jun 9, 2014
26
188
0
Is this for injection ? what is the client.dll ?I just want to do it externally, sorry for my confusion.
 

Tseno95

Newbie
Full Member
Jun 9, 2014
26
188
0
Ok I will try something and will let you know after a few days.
Thank you!
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods