AC_Player How do I cheat? Reputation: 0
Joined: 06 Jun 2018 Posts: 2
|
Posted: Wed Jun 06, 2018 4:21 am Post subject: SOLVED: Able to read string in CE, cannot read with program |
|
|
OMFG! I finally got it!!!
Code: |
#include <Windows.h>
#include <iostream>
#include <string>
#define _PLAYER_NICKNAME 0x125
int main()
{
HANDLE gameProcess;
LPCSTR gameName = "AssaultCube";
DWORD gamePID;
LPDWORD pGamePID = &gamePID;
HWND gameWindow = FindWindow(NULL, gameName);
GetWindowThreadProcessId(gameWindow, pGamePID);
gameProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, gamePID);
uintptr_t localplayeraddr = 0x509B74;
uintptr_t playerInCH = 0x0501C38;
uintptr_t playeraddr = 0;
int health = 0;
std::string playerInCrosshairs = "aaaaaaaaaaaaaaa";
SIZE_T bytesread;
char myString[16] = { 0 };
if (!gameProcess)
{
std::cout << "OpenProcess Failed." << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(localplayeraddr), &playeraddr, sizeof(uintptr_t), &bytesread))
{
std::cout << "Player Address Read " << std::uppercase << std::hex << playeraddr << std::endl;
}
else
{
std::cout << "Couldn`t read address" << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(playeraddr + 0xF8), &health, sizeof(int), &bytesread))
{
std::cout << "Player Health Read " << std::dec << health << std::endl;
}
else
{
std::cout << "Couldn`t read health" << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(playerInCH), &myString, 15, &bytesread))
{
std::string temp = myString;
std::cout << "Player In Crosshairs " << temp << std::endl;
}
else
{
std::cout << "Couldn`t read player in crosshairs" << std::endl;
}
system("pause");
CloseHandle(gameProcess);
return 0;
}
|
Original Post:
I don't understand this. I am able to find the string I want using CE. It's a static address, so every time I open/close/open the game the string is still readable/editable by CE but when I tried to read it from my program using READPROCESSMEMORY I can't.
I am able to read and write to other values in the game with the same program. I am just unable to read this one. 0x0501C38
I am also getting an exception when trying to use this code trying to read the string into cout.
Code: |
#include <Windows.h>
#include <iostream>
#include <string>
int main()
{
HANDLE gameProcess;
LPCSTR gameName = "AssaultCube";
DWORD gamePID;
LPDWORD pGamePID = &gamePID;
HWND gameWindow = FindWindow(NULL, gameName);
GetWindowThreadProcessId(gameWindow, pGamePID);
gameProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, gamePID);
uintptr_t localplayeraddr = 0x509B74;
uintptr_t playerInCH = 0x0501C38;
uintptr_t playeraddr = 0;
int health = 0;
std::string playerInCrosshairs = "";
SIZE_T bytesread;
if (!gameProcess)
{
std::cout << "OpenProcess Failed." << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(localplayeraddr), &playeraddr, sizeof(uintptr_t), &bytesread))
{
std::cout << "Player Address Read " << std::uppercase << std::hex << playeraddr << std::endl;
}
else
{
std::cout << "Couldn`t read address" << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(playeraddr + 0xF8), &health, sizeof(int), &bytesread))
{
std::cout << "Player Health Read " << std::dec << health << std::endl;
}
else
{
std::cout << "Couldn`t read health" << std::endl;
}
if (ReadProcessMemory(gameProcess, (LPCVOID)(playerInCH), &playerInCrosshairs, sizeof(std::string), &bytesread))
{
std::cout << "Player In Crosshairs " << playerInCrosshairs << std::endl;
}
else
{
std::cout << "Couldn`t read player in crosshairs" << std::endl;
}
system("pause");
CloseHandle(gameProcess);
return 0;
}
|
Last edited by AC_Player on Wed Jun 06, 2018 5:33 am; edited 1 time in total |
|