Only search system32 for gdi32.dll
authorCharles Giessen <charles@lunarg.com>
Tue, 16 Jul 2024 21:52:07 +0000 (14:52 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Tue, 16 Jul 2024 20:23:18 +0000 (15:23 -0500)
LoadLibraryEx allows specifying where to search for dll's, including
system only paths which is useful for guaranteeing the authenticity
of a loaded dll, which is gdi32.dll in our case.

loader/loader_windows.c

index 7bc66cdf7f1feadc1ab61680accf72da9f2a615d..db493c56442021cdab901d57f2d5da09a0bac74f 100644 (file)
@@ -79,7 +79,7 @@ void windows_initialization(void) {
 
     // This is needed to ensure that newer APIs are available right away
     // and not after the first call that has been statically linked
-    LoadLibrary("gdi32.dll");
+    LoadLibraryEx("gdi32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
 
     wchar_t systemPath[MAX_PATH] = L"";
     GetSystemDirectoryW(systemPath, MAX_PATH);