Files
EGameTools/DL2GameOverhaulScript/source/dllmain.cpp
EricPlayZ 9c705ef652 - Major code refactor! This means easier option additions and easier code navigation/readability!
- Now using precompiled headers for extremely fast compilation times :D
2024-02-11 06:11:25 +02:00

36 lines
839 B
C++

#include <pch.h>
namespace Core {
extern void DisableConsole();
extern DWORD64 WINAPI MainThread(HMODULE hModule);
extern void Cleanup();
}
static HANDLE hMainThread{};
BOOL APIENTRY DllMain(HMODULE hModule, DWORD64 ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: {
DisableThreadLibraryCalls(hModule);
hMainThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)Core::MainThread, hModule, 0, nullptr);
if (!hMainThread)
return FALSE;
break;
}
case DLL_PROCESS_DETACH:
Core::Cleanup();
Core::DisableConsole();
if (hMainThread)
CloseHandle(hMainThread);
FreeLibraryAndExitThread(hModule, 0);
break;
default:
return FALSE;
}
return TRUE;
}