-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdllmain.cpp
More file actions
42 lines (39 loc) · 1.1 KB
/
dllmain.cpp
File metadata and controls
42 lines (39 loc) · 1.1 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
#include "engine.h"
#include "hooks.h"
#include "Conini.h"
#define DLL_QUERY_HMODULE 6
extern HINSTANCE g_hModule = nullptr;
void MainThread() {
AllocConsole();
freopen("CONOUT$", "w", stdout);
Config::CreateConfig("Cofig1.ini");
Engine::initialize();
Hooks::initialize(kiero::RenderType::Auto);
cout << "init successfully!" << endl;
cout << "GitHub Link: https://github.com/DkoBot/UnityTools" << endl;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_QUERY_HMODULE:
if (lpReserved != NULL)
*(HMODULE*)lpReserved = g_hModule;
case DLL_PROCESS_ATTACH:
{
g_hModule = hModule; // 保存模块句柄
HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MainThread, NULL, 0, NULL);
if (hThread) {
CloseHandle(hThread);
}
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}