forked from Jadis0x/il2cpp-reverse-engineering-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdllmain.cpp
More file actions
33 lines (29 loc) · 803 Bytes
/
dllmain.cpp
File metadata and controls
33 lines (29 loc) · 803 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
33
// dllmain.cpp
#include "pch-il2cpp.h"
#include <windows.h>
#include "main.h"
#ifdef _VERSION
#include "version.h"
#endif
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
// If _VERSION is defined, call the Proxy Load function
#ifdef _VERSION
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Load, hModule, NULL, NULL);
#else
// If not defined, directly call our own Run function (Injector Mode)
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Run, hModule, NULL, NULL);
#endif
break;
case DLL_PROCESS_DETACH:
#ifdef _VERSION
FreeVersionLibrary(); // Clean
#endif
break;
}
return TRUE;
}