#include <Windows.h>
#include <Psapi.h>
#include <stdio.h>
#pragma comment(lib, "Psapi.lib")
int main() {
HWND gameWnd = FindWindowA(NULL, "Counter-Strike");
if (!gameWnd) {
MessageBoxA(0, "Окно Counter-Strike не найдено!", "Тест", 0);
return 1;
}
DWORD pid;
GetWindowThreadProcessId(gameWnd, &pid);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
HMODULE mods[1024];
DWORD needed;
EnumProcessModules(hProcess, mods, sizeof(mods), &needed);
DWORD clientBase = 0;
for (unsigned i = 0; i < needed / sizeof(HMODULE); i++) {
char name[256];
GetModuleBaseNameA(hProcess, mods[i], name, sizeof(name));
if (strcmp(name, "hw.dll") == 0) clientBase = (DWORD)mods[i];
}
if (!clientBase) {
MessageBoxA(0, "hw.dll не найден!", "Тест", 0);
return 1;
}
DWORD localPlayer;
ReadProcessMemory(hProcess, (LPCVOID)(clientBase + 0x1A29B8), &localPlayer, 4, NULL);
if (!localPlayer) {
MessageBoxA(0, "LocalPlayer = 0! Возможно, вы не в катке.", "Тест", 0);
return 1;
}
int health;
ReadProcessMemory(hProcess, (LPCVOID)(localPlayer + 0xF8), &health, 4, NULL);
char msg[256];
sprintf(msg, "hw.dll base: %p\nLocalPlayer: %p\nHealth: %d", (void*)clientBase, (void*)localPlayer, health);
MessageBoxA(0, msg, "Тест пройден!", 0);
return 0;
}