[AntiCheat] Uninstall lib hooks before writing minidumps

This commit is contained in:
momo5502 2017-07-02 13:41:31 +02:00
parent 71dd5632f4
commit 276ab43351
2 changed files with 11 additions and 3 deletions

View File

@ -38,6 +38,9 @@ namespace Components
static void QuickCodeScanner1();
static void QuickCodeScanner2();
static void UninstallLibHook();
static void InstallLibHook();
private:
enum IntergrityFlag
{
@ -65,9 +68,6 @@ namespace Components
static bool IsPageChangeAllowed(void* callee, void* addr, size_t len);
static void AssertCalleeModule(void* callee);
static void UninstallLibHook();
static void InstallLibHook();
#ifdef DEBUG_LOAD_LIBRARY
static HANDLE LoadLibary(std::wstring library, HANDLE file, DWORD flags, void* callee);
static HANDLE WINAPI LoadLibaryAStub(const char* library);

View File

@ -116,6 +116,10 @@ namespace Components
Utils::IO::CreateDir("minidumps");
PathCombineA(filename, "minidumps\\", Utils::String::VA("%s-" VERSION "-%s.dmp", exeFileName, filenameFriendlyTime));
#ifndef DISABLE_ANTICHEAT
AntiCheat::UninstallLibHook();
#endif
DWORD fileShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
HANDLE hFile = CreateFileA(filename, GENERIC_WRITE | GENERIC_READ, fileShare, nullptr, (fileShare & FILE_SHARE_WRITE) > 0 ? OPEN_ALWAYS : OPEN_EXISTING, NULL, nullptr);
MINIDUMP_EXCEPTION_INFORMATION ex = { GetCurrentThreadId(), ExceptionInfo, FALSE };
@ -127,6 +131,10 @@ namespace Components
TerminateProcess(GetCurrentProcess(), ExceptionInfo->ExceptionRecord->ExceptionCode);
}
#ifndef DISABLE_ANTICHEAT
AntiCheat::InstallLibHook();
#endif
if (ExceptionInfo->ExceptionRecord->ExceptionFlags == EXCEPTION_NONCONTINUABLE)
{
TerminateProcess(GetCurrentProcess(), ExceptionInfo->ExceptionRecord->ExceptionCode);