MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / DllMain

Function DllMain

FontLoadInterceptor/dllmain.cpp:15–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13DWORD attachThreadId = 0;
14
15BOOL APIENTRY DllMain(HMODULE hModule,
16 DWORD ul_reason_for_call,
17 LPVOID lpReserved
18)
19{
20 try
21 {
22 switch (ul_reason_for_call)
23 {
24 case DLL_PROCESS_ATTACH:
25 if (sfh::IsDetourNeeded())
26 {
27 wil::unique_handle hThread(CreateThread(
28 nullptr,
29 0,
30 DelayedAttach,
31 nullptr,
32 0,
33 nullptr));
34 if (!hThread.is_valid())
35 return FALSE;
36 }
37 break;
38 case DLL_THREAD_ATTACH:
39 if (attachThreadId == GetCurrentThreadId())
40 {
41 if (!sfh::AttachDetour())
42 return FALSE;
43 sfh::EventLog::GetInstance().LogDllAttach(GetCurrentProcessId());
44 }
45 break;
46 case DLL_THREAD_DETACH:
47 break;
48 case DLL_PROCESS_DETACH:
49 if (sfh::IsDetourNeeded())
50 {
51 sfh::DetachDetour();
52 }
53 break;
54 }
55 return TRUE;
56 }
57 catch (...)
58 {
59 return FALSE;
60 }
61}
62
63DWORD WINAPI DummyThread(LPVOID lpThreadParameter)
64{

Callers

nothing calls this directly

Calls 1

LogDllAttachMethod · 0.45

Tested by

no test coverage detected