according to the cout its finding everything that doesn't depend on the baseaddress correctly, I copy and pasted most of the stuff because I am a noob but if anyone wants to help me get it working I would appreciate it
Code:
#include <string>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include <TlHelp32.h>
using namespace std;
__int64 GetModuleBaseAddress(LPCSTR szProcessName, LPCSTR szModuleName)
{
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe32;
if (hSnap == INVALID_HANDLE_VALUE)
{
return 0;
}
pe32.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hSnap, &pe32) == 0)
{
CloseHandle(hSnap);
return 0;
}
do
{
if (lstrcmp(pe32.szExeFile, szProcessName) == 0)
{
int PID;
PID = pe32.th32ProcessID;
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, PID);
MODULEENTRY32 xModule;
if (hSnap == INVALID_HANDLE_VALUE)
{
return 0;
}
xModule.dwSize = sizeof(MODULEENTRY32);
if (Module32First(hSnap, &xModule) == 0)
{
CloseHandle(hSnap);
return 0;
}
do
{
if (lstrcmp(xModule.szModule, szModuleName) == 0)
{
CloseHandle(hSnap);
return (__int64)xModule.modBaseAddr;
}
} while (Module32Next(hSnap, &xModule));
CloseHandle(hSnap);
return 0;
}
} while (Process32Next(hSnap, &pe32));
CloseHandle(hSnap);
return 0;
}
LPCSTR windowName;
LPCSTR gameTitle;
HWND WindowHandle;
__int64 BaseAddress;
DWORD PID;
HANDLE phandle;
void loadSettings()
{
windowName = "Grand Theft Auto V";
gameTitle = "GTA5.exe";
WindowHandle = FindWindow(NULL, windowName);
GetWindowThreadProcessId(WindowHandle, &PID);
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, PID);
BaseAddress = GetModuleBaseAddress(gameTitle, gameTitle);
}
byte EnableGod = 9;
byte DisableGod = 0;
DWORD GodOffset = 0x189;
DWORD PlayerOffset = 0x8;
DWORD PLAYER_PED_POINTER_SC = 0x23DE120;
DWORD PLAYER_PED_POINTER_STEAM = 0x23E2130;
__int64 GodAddress;
__int64 pPedAddress;
__int64 PedAddress;
int main() {
loadSettings();
ReadProcessMemory(phandle, (void*)(BaseAddress + PLAYER_PED_POINTER_STEAM), &pPedAddress, sizeof(pPedAddress), NULL);
ReadProcessMemory(phandle, (void*)(pPedAddress + PlayerOffset), &PedAddress, sizeof(PedAddress), NULL);
GodAddress = (PedAddress + GodOffset);
WriteProcessMemory(phandle, (void*)GodAddress, &EnableGod, sizeof(EnableGod), NULL);
cout << phandle << endl;
cout << BaseAddress << endl;
cout << PLAYER_PED_POINTER_STEAM << endl;
cout << pPedAddress << endl;
cout << PedAddress << endl;
cout << GodAddress << endl;
cout << GodOffset << endl;
Sleep(INFINITE);
return 0;
}
- - - Updated - - -
Solved! had to compile in x64