#include "client_comm_shared.h" #include "private_funcion.h" #include "utils.h" #include "client_palpit.h" #include "driver_func.h" HANDLE hMapHandle; PMAPPING_USER_MEMORY pMapping_Memory; namespace client_shared_mapping { auto open_shared_mapping() -> HANDLE { //尝试打开管道建立通信 //Anit-Server进程没有起来就就等死 static int break_byte_count = 0; while (true) { if (break_byte_count > 10) break; auto hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, SHARED_NAME); if (hMap) return hMap; break_byte_count++; Sleep(1000); } return FALSE; } auto mapping_shared_memory(HANDLE hMap) -> PMAPPING_USER_MEMORY { auto pData = (_MAPPING_USER_MEMORY*)MapViewOfFile( hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 ); return pData; } auto StartServerProcess(CONST char* Path, PDWORD status)->BOOL { if (GetFileAttributesA(Path) != INVALID_FILE_ATTRIBUTES) { char buf[256]{ 0 }; sprintf_s(buf, "%s\\ESP Anit-Cheat.exe", Path); if (private_funcion::create_start_process(buf)) { /*hMapHandle = client_shared_mapping::open_shared_mapping(); if (hMapHandle) { pMapping_Memory = client_shared_mapping::mapping_shared_memory(hMapHandle); if (pMapping_Memory) { client_palpit::create_papit_thread(pMapping_Memory); return TRUE; } }*/ //启动成功 *status = 0; return TRUE; } else { //进程启动失败 | 权限不足 *status = 100; } } else { *status = 101; //文件不存在 auto string = "[Anit-Cheat]系统运行发生致命错误,错误代码:" + to_string(GetLastError()); MessageBoxA(NULL, string.c_str(), "您似乎遇到了一些问题", MB_OK); return FALSE; } } //auto anit_cheat_create_process() -> BOOL //{ // BOOL bIsSrc; // CHAR* lastSlash; // CONST char* path = "C:\\Program Files\\AnitCheatFile\\Anit-Seriver.exe"; // if (GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES) // { // DWORD size = 0; // auto filebuff = utils::ReadBinaryFile(path, &size); // if (!filebuff) // return FALSE; // auto pNThander = reinterpret_cast(filebuff + reinterpret_cast(filebuff)->e_lfanew); // auto pFilehander = &pNThander->FileHeader; // if (!pFilehander->TimeDateStamp) // return FALSE; // auto buff_doshander = reinterpret_cast(Anit_Cheat_EXE); // auto buff_nthander = reinterpret_cast((DWORD64)buff_doshander + buff_doshander->e_lfanew); // auto buff_FileHander = &buff_nthander->FileHeader; // if (!buff_FileHander->TimeDateStamp) // return FALSE; // if (buff_FileHander->TimeDateStamp != pFilehander->TimeDateStamp) // goto create; // goto run; // } // else // { // create: // char dirPath[MAX_PATH]; // strcpy_s(dirPath, path); // lastSlash = strrchr(dirPath, '\\'); // if (lastSlash) { // *lastSlash = '\0'; // // 2. 创建目录(如果不存在) // if (!utils::CreateDirectoryRecursive(dirPath)) { // return FALSE; // } // } // bIsSrc = utils::WriteShellcodeToFile(path, Anit_Cheat_EXE, sizeof(Anit_Cheat_EXE)); // if (bIsSrc) // { // run: // bIsSrc = private_funcion::create_start_process(path); // if (bIsSrc) // return TRUE; // } // } // return FALSE; //} }