From 40b8e6eeead809a62c708cb48fdd9f8f2eab3f15 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 16 Jul 2024 14:52:07 -0700 Subject: [PATCH] Only search system32 for gdi32.dll 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/loader_windows.c b/loader/loader_windows.c index 7bc66cdf..db493c56 100644 --- a/loader/loader_windows.c +++ b/loader/loader_windows.c @@ -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); -- 2.34.1