-
Автор темы
- #1
C++:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
uintptr_t clientDLL;
uintptr_t engineDLL;
int main() {
DWORD processID;
HWND hwnd = FindWindow(NULL, "Counter-Strike 2");
GetWindowThreadProcessId(hwnd, &processID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID);
MODULEENTRY32 moduleEntry;
moduleEntry.dwSize = sizeof(MODULEENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, processID);
if (Module32First(hSnapshot, &moduleEntry)) {
do {
if (strcmp(moduleEntry.szModule, "client.dll") == 0) {
clientDLL = (uintptr_t)moduleEntry.modBaseAddr;
}
else if (strcmp(moduleEntry.szModule, "engine2.dll") == 0) {
engineDLL = (uintptr_t)moduleEntry.modBaseAddr;
}
} while (Module32Next(hSnapshot, &moduleEntry));
}
CloseHandle(hSnapshot);
while (true) {
Sleep(400);
system("CLS");
std::cout << "client.dll:\t\t" << std::hex << clientDLL << std::endl;
std::cout << "engine2.dll:\t\t" << std::hex << engineDLL << std::endl;
std::cout << std::endl;
uintptr_t value;
uintptr_t dwLocalPlayerPawn = 0x1823A08;
uintptr_t m_iHealth = 0x1823A08;
ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(clientDLL + dwLocalPlayerPawn + m_iHealth), &value, sizeof(value), NULL);
std::cout << "value:\t\t\t" << value << std::endl;
}
CloseHandle(hProcess);
}
client.dll: 7ff807150000
engine2.dll: 7ff830f20000
value: cccccccccccccccc