[misc] switch to using LoadLibraryEx everywhere

* This allows us to further mitigate DLL side loading by enforcing
  LOAD_LIBRARY_SEARCH_SYSTEM32 / LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR.
This commit is contained in:
Pete Batard 2021-04-09 11:31:52 +01:00
parent c9e71de898
commit 2a3e82fa96
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
8 changed files with 25 additions and 12 deletions

View file

@ -3148,7 +3148,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// nail... Also, no, Coverity, we never need to care about freeing kernel32 as a library.
// coverity[leaked_storage]
pfSetDefaultDllDirectories = (SetDefaultDllDirectories_t)
GetProcAddress(LoadLibraryW(kernel32_path), "SetDefaultDllDirectories");
GetProcAddress(LoadLibraryExW(kernel32_path, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32),
"SetDefaultDllDirectories");
if (pfSetDefaultDllDirectories != NULL)
pfSetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);