You will have to read the pointer first, add the offset to the value you have read and then read from there to get health.
Hello yall,
I am having trouble binding the pointer and the offset in c++
The game I am trying to hack is Assault Cube
What am I doing wrong???
Regards,Code:// MemoryEditing.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include<Windows.h> #include<string> using namespace std; int main() { DWORD localplayer = 0x00509b74; DWORD health = 0xF8; SetConsoleTitle(_T("AssaultCube Exploit")); //int readTest = 0; HWND hwnd = FindWindowA(NULL, "AssaultCube"); if (hwnd == NULL) { cout << "Cannot find Window." << endl; Sleep(3000); exit(-1); } else { DWORD procID; GetWindowThreadProcessId(hwnd, &procID); HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID); if (procID = NULL) { cout << "Cannot find Process." << endl; Sleep(3000); exit(-1); } else { int CurrentAdress = 0; ReadProcessMemory(handle, (PBYTE)(localplayer) + health, &CurrentAdress, sizeof(CurrentAdress), 0); //cout << "The view value was set to "; cout << CurrentAdress << endl; system("pause"); cout << CurrentAdress << endl; } } return 0; }
You will have to read the pointer first, add the offset to the value you have read and then read from there to get health.
Ah we-a blaze the fyah, make it bun dem!
this is the function i made to find the pointers, this ones for ammo. uses a for loop, reads the base address/ammoAddr, then takes what it read and adds the first position of the ammoOff array which is 374 and reads it again, then adds the second element of the array which is 14, reads again and then adds 0 and its done. ammoAddr now has the address needed for the array
Code:void getPointers(HANDLE hHandle, DWORD& ammoAddress) { DWORD ammoAddr = 0X00509B74; DWORD ammoOff[3] = { 0x374, 0x14, 0x0 }; int ammoArrySize = sizeof(ammoOff) / sizeof(ammoOff[0]); for (int i = 0; i < ammoArrySize; i++) { ReadProcessMemory(hHandle, (LPCVOID)ammoAddr, &ammoAddr, sizeof(ammoAddr), NULL); ammoAddr += ammoOff[i]; } ammoAddress = ammoAddr; }
Last edited by gogogokitty; 02-25-2018 at 04:01 PM.
LEEEEEEROY JEEEEENKINS
Hell_Demon (02-26-2018)
With using Pointer AND Offset you have to go deep, the most are doing Pointer + Offset but thats false because that would cause changing the pointer itself and would NOT work there will be no error but it doesnt work.
This is really working its my code for a game it took me some time when i did this first time
Last edited by Archx64; 04-22-2018 at 02:38 AM.
You need to read game + localplayer offset to get localplayer.Code:// MemoryEditing.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include<Windows.h> #include<string> using namespace std; int main() { DWORD localplayer = 0x00509b74; DWORD health = 0xF8; SetConsoleTitle(_T("AssaultCube Exploit")); //int readTest = 0; HWND hwnd = FindWindowA(NULL, "AssaultCube"); if (hwnd == NULL) { cout << "Cannot find Window." << endl; Sleep(3000); exit(-1); } else { DWORD procID; GetWindowThreadProcessId(hwnd, &procID); HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID); if (procID = NULL) { cout << "Cannot find Process." << endl; Sleep(3000); exit(-1); } else { int CurrentAdress = 0; uintptr_t local_player = nullptr; ReadProcessMemory(handle, (PBYTE)(localplayer), &local_player, sizeof(CurrentAdress), 0); ReadProcessMemory(handle, (PBYTE)(local_player + health), &CurrentAdress, sizeof(CurrentAdress), 0); //cout << "The view value was set to "; cout << CurrentAdress << endl; system("pause"); cout << CurrentAdress << endl; } } return 0; }
Always PM me when trading, I've been hacked on my Skype previously
[img]https://**********.com/addskype/affe2626.png[/img]