-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsource.cpp
More file actions
32 lines (25 loc) · 934 Bytes
/
source.cpp
File metadata and controls
32 lines (25 loc) · 934 Bytes
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
#include "setup/setup.hpp"
#include <cheats/game/globals.hpp>
BOOL APIENTRY DllMainEntry(CONST HMODULE instance, CONST ULONG reason, CONST PVOID reserved)
{
if (!_CRT_INIT(instance, reason, reserved))
return FALSE;
if (reason == DLL_PROCESS_ATTACH)
{
globals::instance = instance;
if (!setup::init(instance))
return FALSE;
if (auto looperThread = CreateThread(nullptr, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(setup::looper), instance, NULL, nullptr))
CloseHandle(looperThread);
return TRUE;
}
else if (DLL_PROCESS_DETACH)
{
if (!globals::isShutdown) // then panic key forced shutdown
{
if (auto shutdownThread = CreateThread(nullptr, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(setup::shutdown), instance, NULL, nullptr))
CloseHandle(shutdownThread);
}
}
return TRUE;
}