Untitled
unknown
plain_text
a month ago
5.0 kB
5
Indexable
Never
// dllmain.cpp : DLL uygulamasının giriş noktasını tanımlar. #include "pch.h" #include <TlHelp32.h> #include <iostream> #include <Windows.h> #include <psapi.h> #include <thread> #include <string> #include "MinHook.h" #pragma comment(lib, "MinHook.x86.lib") MODULEINFO GetModuleInfo(const char* szModule) { MODULEINFO modinfo = { 0 }; HMODULE hModule = GetModuleHandleA(szModule); if (!hModule) { MessageBox(NULL, "COULDNT FIND HANDLE!", "ERROR", MB_ICONERROR); return modinfo; } if (hModule == 0) return modinfo; GetModuleInformation(GetCurrentProcess(), hModule, &modinfo, sizeof(MODULEINFO)); return modinfo; } DWORD FindPattern(const char* module, const char* pattern, const char* mask) { MODULEINFO mInfo = GetModuleInfo(module); DWORD base = (DWORD)mInfo.lpBaseOfDll; DWORD size = (DWORD)mInfo.SizeOfImage; DWORD patternLength = (DWORD)strlen(mask); for (DWORD i = 0; i < size - patternLength; i++) { bool found = true; for (DWORD j = 0; j < patternLength; j++) { found &= mask[j] == '?' || pattern[j] == *(char*)(base + i + j); } if (found) { return base + i; } } MessageBox(NULL, "COULDNT FIND PATTERN", "ERROR", MB_ICONERROR); return NULL; } void* g_ffsAntiCheatPtr = nullptr; void* g_ptrCResourceManager = nullptr; typedef void* (__thiscall* CResourceAdd_t)(void* ecx, unsigned short usNetID, const char* szResourceName, void* pResourceEntity, void* pResourceDynamicEntity, const std::string& strMinServerReq, const std::string& strMinClientReq, bool bEnableOOP); CResourceAdd_t oCResourceAdd = nullptr; void* __fastcall CResourceAdd(void* ecx, void* edx, unsigned short usNetID, const char* szResourceName, void* pResourceEntity, void* pResourceDynamicEntity, const std::string& strMinServerReq, const std::string& strMinClientReq, bool bEnableOOP) { g_ptrCResourceManager = ecx; return oCResourceAdd(ecx, usNetID, szResourceName, pResourceEntity, pResourceDynamicEntity, strMinServerReq, strMinClientReq, bEnableOOP); } typedef void* (__thiscall* CResourceConstructor_t)(void* ECX, unsigned short usNetID, const char* szResourceName, void* pResourceEntity, void* pResourceDynamicEntity, const std::string& strMinServerReq, const std::string& strMinClientReq, bool bEnableOOP); CResourceConstructor_t oCResourceConstructor = nullptr; void* __fastcall CResourceConstructor(void* ECX, void* EDX, unsigned short usNetID, const char* szResourceName, void* pResourceEntity, void* pResourceDynamicEntity, const std::string& strMinServerReq, const std::string& strMinClientReq, bool bEnableOOP) { if (szResourceName == "ffs_anticheat") { g_ffsAntiCheatPtr = ECX; } return oCResourceConstructor(ECX, usNetID, szResourceName, pResourceEntity, pResourceDynamicEntity, strMinServerReq, strMinClientReq, bEnableOOP); } typedef void(__thiscall* StopResource_t)(void* resourcemanager, void* resource); StopResource_t oStopResource = nullptr; void Load() { oStopResource = (StopResource_t)FindPattern("client.dll", "\x55\x8B\xEC\x83\xEC\x00\x53\x56\x57\x8B\xF9\x8B\x4D\x00\x89\x7D", "xxxxx?xxxxxxx?xx"); oCResourceAdd = (CResourceAdd_t)FindPattern("client.dll", "\x55\x8B\xEC\x6A\x00\x68\x00\x00\x00\x00\x64\xA1\x00\x00\x00\x00\x50\x83\xEC\x00\x53\x56\x57\xA1\x00\x00\x00\x00\x33\xC5\x50\x8D\x45\x00\x64\xA3\x00\x00\x00\x00\x8B\xF1\x68\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\xC4\x00\x89\x45\x00\xC7\x45\x00\x00\x00\x00\x00\x85\xC0\x74\x00\xFF\x75\x00\x8B\xC8\xFF\x75\x00\xFF\x75\x00\xFF\x75\x00\xFF\x75\x00\xFF\x75\x00\xFF\x75", "xxxx?x????xx????xxx?xxxx????xxxxx?xx????xxx????x????xx?xx?xx?????xxx?xx?xxxx?xx?xx?xx?xx?xx"); oCResourceConstructor = (CResourceConstructor_t)FindPattern("client.dll", "\x55\x8B\xEC\x6A\x00\x68\x00\x00\x00\x00\x64\xA1\x00\x00\x00\x00\x50\x83\xEC\x00\xA1\x00\x00\x00\x00\x33\xC5\x89\x45\x00\x56\x57\x50\x8D\x45\x00\x64\xA3\x00\x00\x00\x00\x89\x4D\x00\x89\x4D\x00\x8B\x45\x00\x0F\x57\xC0\x8B\x55", "xxxx?x????xx????xxx?x????xxxx?xxxxx?xx????xx?xx?xx?xxxxx"); if (MH_CreateHook(oCResourceAdd, &CResourceAdd, reinterpret_cast<LPVOID*>(&oCResourceAdd)) != MH_OK) { MessageBox(NULL, "Failed to create hook for CResourceAdd", "Error", MB_OK | MB_ICONERROR); return; } if (MH_CreateHook(oCResourceConstructor, &CResourceConstructor, reinterpret_cast<LPVOID*>(&oCResourceConstructor)) != MH_OK) { MessageBox(NULL, "Failed to create hook for CResourceConstructor", "Error", MB_OK | MB_ICONERROR); return; } while (true) { if (GetAsyncKeyState(VK_NEXT) & 0x8000) { oStopResource(g_ptrCResourceManager, g_ffsAntiCheatPtr); } Sleep(750); } } BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) { if (reason == 1) { CloseHandle(CreateThread(NULL, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(Load), NULL, NULL, NULL)); } return 1; }
Leave a Comment