Fix vidrestart bug

This commit is contained in:
momo5502 2016-03-07 22:52:53 +01:00
parent 020488e58f
commit 3cc705df27
3 changed files with 32 additions and 8 deletions

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 9242d9b7f431e40d119faef8b583d945362ef04c Subproject commit 6a8815bef9696e3cdd7365e103c30f38dd7ce940

View File

@ -4,6 +4,7 @@ namespace Components
{ {
int AntiCheat::LastCheck; int AntiCheat::LastCheck;
std::string AntiCheat::Hash; std::string AntiCheat::Hash;
Utils::Hook AntiCheat::LoadLibHook[4];
// This function does nothing, it only adds the two passed variables and returns the value // This function does nothing, it only adds the two passed variables and returns the value
// The only important thing it does is to clean the first parameter, and then return // The only important thing it does is to clean the first parameter, and then return
@ -90,6 +91,17 @@ namespace Components
AntiCheat::Hash.clear(); AntiCheat::Hash.clear();
} }
void AntiCheat::InitLoadLibHook()
{
static uint8_t loadLibStub[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // xor eax, eax; retn 04h
static uint8_t loadLibExStub[] = { 0x33, 0xC0, 0xC2, 0x0C, 0x00 }; // xor eax, eax; retn 0Ch
AntiCheat::LoadLibHook[0].Initialize(LoadLibraryA, loadLibStub, HOOK_JUMP);
AntiCheat::LoadLibHook[1].Initialize(LoadLibraryW, loadLibStub, HOOK_JUMP);
AntiCheat::LoadLibHook[2].Initialize(LoadLibraryExA, loadLibExStub, HOOK_JUMP);
AntiCheat::LoadLibHook[3].Initialize(LoadLibraryExW, loadLibExStub, HOOK_JUMP);
}
void AntiCheat::PerformCheck() void AntiCheat::PerformCheck()
{ {
// Hash .text segment // Hash .text segment
@ -121,13 +133,18 @@ namespace Components
void AntiCheat::PatchWinAPI() void AntiCheat::PatchWinAPI()
{ {
static uint8_t loadLibStub[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // xor eax, eax; retn 04h AntiCheat::LoadLibHook[0].Uninstall();
static uint8_t loadLibExStub[] = { 0x33, 0xC0, 0xC2, 0x0C, 0x00 }; // xor eax, eax; retn 0Ch AntiCheat::LoadLibHook[1].Uninstall();
AntiCheat::LoadLibHook[2].Uninstall();
AntiCheat::LoadLibHook[3].Uninstall();
Utils::Hook(LoadLibraryA, loadLibStub, HOOK_JUMP).Install()->Quick(); // Initialize directx :P
Utils::Hook(LoadLibraryW, loadLibStub, HOOK_JUMP).Install()->Quick(); Utils::Hook::Call<void()>(0x5078C0)();
Utils::Hook(LoadLibraryExA, loadLibExStub, HOOK_JUMP).Install()->Quick();
Utils::Hook(LoadLibraryExW, loadLibExStub, HOOK_JUMP).Install()->Quick(); AntiCheat::LoadLibHook[0].Install();
AntiCheat::LoadLibHook[1].Install();
AntiCheat::LoadLibHook[2].Install();
AntiCheat::LoadLibHook[3].Install();
} }
AntiCheat::AntiCheat() AntiCheat::AntiCheat()
@ -141,7 +158,10 @@ namespace Components
}); });
#else #else
QuickPatch::OnFrame(AntiCheat::Frame); QuickPatch::OnFrame(AntiCheat::Frame);
QuickPatch::Once(AntiCheat::PatchWinAPI); Utils::Hook(0x507BD5, AntiCheat::PatchWinAPI, HOOK_CALL).Install()->Quick();
// TODO: Probably move that :P
AntiCheat::InitLoadLibHook();
#endif #endif
} }

View File

@ -10,6 +10,8 @@ namespace Components
static void CrashClient(); static void CrashClient();
static void EmptyHash(); static void EmptyHash();
static void InitLoadLibHook();
private: private:
static int LastCheck; static int LastCheck;
static std::string Hash; static std::string Hash;
@ -19,5 +21,7 @@ namespace Components
static void PatchWinAPI(); static void PatchWinAPI();
static void NullSub(); static void NullSub();
static Utils::Hook LoadLibHook[4];
}; };
} }