forked from ldebug/BetaShield
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInitCheck.cpp
More file actions
86 lines (70 loc) · 2.64 KB
/
Copy pathInitCheck.cpp
File metadata and controls
86 lines (70 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "ProjectMain.h"
#include "WatchDog.h"
#include "DynamicWinapi.h"
#include "Functions.h"
#include "XOR.h"
#include "CLog.h"
#include "AntiDebug.h"
BOOL bProcessed = FALSE;
VOID CALLBACK TimerProc(HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime)
{
KARMA_MACRO_1
if (LPData->GetGameCode() == TEST_CONSOLE) {
#ifdef _DEBUG
LPLog->AddLog(0, "Watchdog init check skipped on test console!");
#endif
goto skip;
}
KARMA_MACRO_2
CHAR __warn[] = { 'P', 'r', 'o', 'c', 'e', 's', 's', ' ', 'w', 'a', 't', 'c', 'h', 'e', 'r', ' ', 'c', 'a', 'n', ' ', 'n', 'o', 't', ' ', 'i', 'n', 'i', 't', 'i', 'a', 'l', 'i', 'z', 'e', 'd', '!', 0x0 }; // Process watcher can not initialized!
if (LPWatchdog->GetWatchdogCount() < 1)
LPFunctions->CloseProcess(__warn, false, "");
skip:
#ifdef _DEBUG
LPLog->AddLog(0, "Watchdog init check processed! Adjusted watchdog count: %d", LPWatchdog->GetWatchdogCount());
#endif
KARMA_MACRO_1
if (LPAntiDebug->GetManipulationType() == 1)
{
CHAR __warn[] = { 'E', 'm', 'u', 'l', 'a', 't', 'o', 'r', ' ', 'd', 'e', 't', 'e', 'c', 't', 'e', 'd', '!', ' ', 'E', 'r', 'r', 'o', 'r', ' ', 'c', 'o', 'd', 'e', ':', ' ', '4', 0x0 }; // Emulator detected! Error code: 4
LPFunctions->CloseProcess(__warn, false, "");
}
else if (LPAntiDebug->GetManipulationType() == 2)
{
CHAR __warn[] = { 'E', 'm', 'u', 'l', 'a', 't', 'o', 'r', ' ', 'd', 'e', 't', 'e', 'c', 't', 'e', 'd', '!', ' ', 'E', 'r', 'r', 'o', 'r', ' ', 'c', 'o', 'd', 'e', ':', ' ', '5', 0x0 }; // Emulator detected! Error code: 5
LPFunctions->CloseProcess(__warn, false, "");
}
else if (LPAntiDebug->GetManipulationType() != 99)
{
CHAR __warn[] = { 'E', 'm', 'u', 'l', 'a', 't', 'o', 'r', ' ', 'd', 'e', 't', 'e', 'c', 't', 'e', 'd', '!', ' ', 'E', 'r', 'r', 'o', 'r', ' ', 'c', 'o', 'd', 'e', ':', ' ', '6', 0x0 }; // Emulator detected! Error code: 6
LPFunctions->CloseProcess(__warn, false, "");
}
KARMA_MACRO_1
bProcessed = TRUE;
KARMA_MACRO_2
}
void InitCheckThread(LPVOID lpArgs)
{
MSG Msg;
UINT_PTR iTimerID;
iTimerID = BetaFunctionTable->SetTimer(NULL, 0, 15000, TimerProc);
while (BetaFunctionTable->GetMessageA(&Msg, NULL, 0, 0) & !bProcessed)
{
BetaFunctionTable->TranslateMessage(&Msg);
BetaFunctionTable->DispatchMessageA(&Msg);
}
BetaFunctionTable->KillTimer(NULL, iTimerID);
#ifdef _DEBUG
LPLog->AddLog(0, "Watchdog init check event completed!");
#endif
}
VOID CWatchdog::SetInitCheckTimer()
{
#ifdef _DEBUG
LPLog->AddLog(0, "Watchdog Init Check event thread initilization has been started!");
#endif
_beginthread(InitCheckThread, 0, nullptr);
#ifdef _DEBUG
LPLog->AddLog(0, "Watchdog Init Check event thread initilization completed!");
#endif
}