#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <Psapi.h>
#pragma comment(lib, "Psapi.lib")
DWORD clientBase;
DWORD GetLocalPlayer() {
DWORD local;
ReadProcessMemory(GetCurrentProcess(), (LPCVOID)(clientBase + 0x1A29B8), &local, 4, NULL);
return local;
}
DWORD WINAPI MainThread(LPVOID lpParam) {
// Ждём загрузки игры
while (!FindWindowA(NULL, "Counter-Strike")) Sleep(100);
// Находим базу hw.dll
HMODULE mods[1024];
DWORD needed;
EnumProcessModules(GetCurrentProcess(), mods, sizeof(mods), &needed);
for (unsigned i = 0; i < needed / sizeof(HMODULE); i++) {
char name[256];
GetModuleBaseNameA(GetCurrentProcess(), mods[i], name, sizeof(name));
if (strcmp(name, "hw.dll") == 0) clientBase = (DWORD)mods[i];
}
// Тест: читаем здоровье
while (true) {
DWORD local = GetLocalPlayer();
if (local) {
int health;
ReadProcessMemory(GetCurrentProcess(), (LPCVOID)(local + 0xF8), &health, 4, NULL);
if (health > 0 && health < 100) {
MessageBoxA(0, "Вы получили урон!", "Чит", MB_OK);
}
}
Sleep(100);
}
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
CreateThread(NULL, 0, MainThread, NULL, 0, NULL);
}
return TRUE;
}