Solved 64 bit game gives me weird values ReadProcessMemory

Hexui Undetected CSGO Cheats PUBG Accounts

SICGames88

Newbie
Full Member
Nobleman
Sep 6, 2015
70
768
0
I got the static address for Doom 4. It's a 64 bit installation. I'm using C++ mixed with CLI for form.

C++:
private: System::Void gameCheckTimer1_Tick(System::Object^  sender, System::EventArgs^  e) {
	htk.setRunDebugPrivelege();
	if (!gameFound) {
		
		gameFound = htk.findProcessName("DOOMx64.exe", &htk.__gameProcess);
		
	}
	
	gameReadyLabel1->Text = gameFound ? "Game is running..." : "Game not running...";
	

	if (gameFound) {
		
		if ((GetAsyncKeyState(VK_INSERT) & 1))
			trainerActiva = !trainerActiva; // true;
	
		if (trainerActiva) {

			htk.getThreadByProcess(htk.__gameProcess.th32ProcessID);
			htk.__HandleProcess = OpenProcess(PROCESS_ALL_ACCESS, false, htk.__gameProcess.th32ProcessID);
			doomBaseAddr = htk.getModuleNamePointer("DOOMx64.exe", htk.__gameProcess.th32ProcessID); Sleep(22); //-- gives way off base value for module Doomx64.exe.
			htk.__HWND = FindWindow(NULL, "DOOMx64");
			DWORD ptr = (doomBaseAddr + 0x0337EAB0);
			ptr += 0x0 + 0x18 + 0x6C;
			ReadProcessMemory(htk.__HandleProcess, (LPVOID)ptr, &playerHealth, sizeof(playerHealth), 0); // playerhealth becomes 0.0 where I have 200 in health.
			
                        //ReadProcessMemory(htk.__HandleProcess, (PBYTE *)(PtrAddr + 0x0), &PtrAddr, 4, 0);
			//ReadProcessMemory(htk.__HandleProcess, (PBYTE *)(PtrAddr + 0x18), &PtrAddr, 4, 0);
			//ReadProcessMemory(htk.__HandleProcess, (PBYTE *)(PtrAddr + 0x6C), &playerHealth, sizeof(playerHealth), 0);

			TrainerActivatedLabel1->Text = "" + playerHealth;
		}
		TrainerActivatedLabel1->ForeColor = trainerActiva ? System::Drawing::Color::Red : System::Drawing::Color::White;


	}
}
I tried using this program with Assault Cube and read the health just fine. Do I need to go a different approach or did I do something wrong?
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,314
37,938
271
1. Why do you randomly sleep for 22 ms?

2. You probably want to dereference after all those adds here
C++:
  ptr += 0x0 + 0x18 + 0x6C;
by using RPM.

3. Make sure your player health variable is the proper type.

4. why do you get the game window if you never use it?

5. Unless Activatedlabel->Text is a std::string, you cant concat strings via +

edit: do this tutorial
 
Last edited by a moderator:

SICGames88

Newbie
Full Member
Nobleman
Sep 6, 2015
70
768
0
yeah I don't know why I'm going to take that out - it was from old code from Fleep. there's no need for that in a timer. Just haven't got around it it. Also the data types are very important as I posted in chat. One can't expect to get a 64-bit variable when using a 32-bit variable. There'll be data lost. So inside the libary I'm creating I have a prepressor directive detecting if the library is compiled under 64 or 32 bit and if so then change the libary's variable to that specific target based variable. DWORD 32-bit DWORDLONG 64-bit. I had to make sure the lib's functions were happy with the change too.
 
Community Mods