MCPcopy Create free account
hub / github.com/PenguLoader/PenguLoader / GetFunction

Function GetFunction

core/src/dllproxy.cc:13–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11};
12
13static FARPROC GetFunction(Module index, const char *name)
14{
15 static HMODULE modules[MODULE_MAX]{};
16 static LPCWSTR module_dlls[MODULE_MAX]
17 {
18 L"d3d9.dll",
19 L"dwrite.dll",
20 L"version.dll",
21 };
22
23 if (modules[index] == nullptr)
24 {
25 BOOL wow64 = FALSE;
26 WCHAR path[MAX_PATH];
27
28 if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64)
29 GetSystemWow64DirectoryW(path, MAX_PATH);
30 else
31 GetSystemDirectoryW(path, MAX_PATH);
32
33 lstrcatW(path, L"\\");
34 lstrcatW(path, module_dlls[index]);
35 modules[index] = LoadLibraryW(path);
36 }
37
38 return GetProcAddress(modules[index], name);
39}
40
41template<typename T>
42static T _Forward(Module index, const char* funcName, T)

Callers 1

_ForwardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected