From dc9171f13694f653964d9121aecca4701c2b1372 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 30 Jan 2017 18:57:26 +0100 Subject: [PATCH] [AntiCheat] Allow process synchronization --- src/Components/Modules/AntiCheat.cpp | 2 +- src/Worker/Runner.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Components/Modules/AntiCheat.cpp b/src/Components/Modules/AntiCheat.cpp index 0d4c7bb9..d8d5a173 100644 --- a/src/Components/Modules/AntiCheat.cpp +++ b/src/Components/Modules/AntiCheat.cpp @@ -427,7 +427,7 @@ namespace Components if (!AddAccessDeniedAce(pDacl, ACL_REVISION, dwPoison, psidArray[0])) return GetLastError(); // Standard and specific rights not explicitly denied - static const DWORD dwAllowed = ~dwPoison & 0x1FFF; + static const DWORD dwAllowed = (~dwPoison & 0x1FFF) | SYNCHRONIZE; if (!AddAccessAllowedAce(pDacl, ACL_REVISION, dwAllowed, psidArray[1])) return GetLastError(); // Because of ACE ordering, System will effectively have dwAllowed even diff --git a/src/Worker/Runner.cpp b/src/Worker/Runner.cpp index 6cda2a68..1403fee5 100644 --- a/src/Worker/Runner.cpp +++ b/src/Worker/Runner.cpp @@ -19,10 +19,15 @@ namespace Worker printf("Attaching to parent process %d...\n", this->processId); HANDLE processHandle = OpenProcess(SYNCHRONIZE, FALSE, this->processId); - if ((!processHandle || processHandle == INVALID_HANDLE_VALUE) && !Runner::isProcessAlive()) + if ((!processHandle || processHandle == INVALID_HANDLE_VALUE)) { - printf("Unable to attach to parent process\n"); - return; + printf("Passive attach failed, trying actively...\n"); + + if (!Runner::isProcessAlive()) + { + printf("Unable to attach to parent process\n"); + return; + } } printf("Successfully attached to parent process\n");