| 30 | } |
| 31 | |
| 32 | void 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 | |
| 46 | int APIENTRY wWinMain(_In_ HINSTANCE hInstance, |
| 47 | _In_opt_ HINSTANCE hPrevInstance, |
no test coverage detected