MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / MitigateDllHijacking

Function MitigateDllHijacking

src/Setup/winmain.cpp:32–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void MitigateDllHijacking()
33{
34 // Set the default DLL lookup directory to System32 for ourselves and kernel32.dll
35 SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);
36
37 HMODULE hKernel32 = LoadLibrary(L"kernel32.dll");
38 ATLASSERT(hKernel32 != NULL);
39
40 SetDefaultDllDirectoriesFunction pfn = (SetDefaultDllDirectoriesFunction)GetProcAddress(hKernel32, "SetDefaultDllDirectories");
41 if (pfn) { (*pfn)(LOAD_LIBRARY_SEARCH_SYSTEM32); }
42
43 PreloadLibs();
44}
45
46int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
47 _In_opt_ HINSTANCE hPrevInstance,

Callers 1

wWinMainFunction · 0.85

Calls 1

PreloadLibsFunction · 0.85

Tested by

no test coverage detected