Делал по видео Дарвина "спидхак на амонгас", но на игру Assault Cube. Выдает ошибку 998 (access denied).
Оффсеты в читенжине:
"ac_client.exe"+0018B0B8
0x408, 0x0
Оффсеты в читенжине:
"ac_client.exe"+0018B0B8
0x408, 0x0
C++:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <vector>
#include <conio.h>
using namespace std;
HWND hwnd;
DWORD procID;
HANDLE hProcess;
uintptr_t ModuleBase;
uintptr_t PlayerBase;
int h = 50;
uintptr_t GetModuleBaseAddress(const char* modName) {
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procID);
if (hSnap != INVALID_HANDLE_VALUE) {
MODULEENTRY32 modEntry;
modEntry.dwSize = sizeof(modEntry);
if (Module32First(hSnap, &modEntry)) {
do {
if (!strcmp(modEntry.szModule, modName)) {
CloseHandle(hSnap);
return (uintptr_t)modEntry.modBaseAddr;
}
} while (Module32Next(hSnap, &modEntry));
}
}
}
uintptr_t FindDMAAddy(HANDLE hProc, uintptr_t ptr, std::vector<unsigned int> offsets)
{
uintptr_t addr = ptr;
for (unsigned int i = 0; i < offsets.size(); ++i)
{
ReadProcessMemory(hProc, (BYTE*)addr, &addr, sizeof(addr), 0);
addr += offsets[i];
}
return addr;
}
void SpeedHack() {
uintptr_t healthAddr = ModuleBase + 0x018B0B8;
std::vector<unsigned int> healthOffset = { 0x408, 0x0 };
uintptr_t healthBaseAddr = FindDMAAddy(hProcess, healthAddr, healthOffset);
int hh;
if (!WriteProcessMemory(hProcess, (LPVOID)healthBaseAddr, &h, sizeof(h), 0)) {
std::cout << "Failed: " << GetLastError() << "\n";
}
}
int main() {
hwnd = FindWindow(0, "AssaultCube");
if (hwnd == NULL) {
cout << "[-] Please Open the Assault Cube" << endl;
Sleep(1000);
return 0;
}
procID = 0;
GetWindowThreadProcessId(hwnd, &procID);
if (procID == 0) {
cout << "\n\n [-] Process ID not Found" << endl;
return 0;
}
ModuleBase = GetModuleBaseAddress("ac_client.exe");
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
while (true) {
SpeedHack();
}
}