aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-14 15:04:34 -0500
committerDavid Robillard <d@drobilla.net>2023-01-14 16:17:38 -0500
commite8dc1d219f4b461f29e11ad8fe0e463c6dfdb08b (patch)
treee5725f6dff986a8b3d2871dd74fe785737687814 /src
parente9bbaf95fbe57d730bfb1ab40a41428ed4ee2ff6 (diff)
downloadpugl-e8dc1d219f4b461f29e11ad8fe0e463c6dfdb08b.tar.gz
pugl-e8dc1d219f4b461f29e11ad8fe0e463c6dfdb08b.tar.bz2
pugl-e8dc1d219f4b461f29e11ad8fe0e463c6dfdb08b.zip
Windows: Fix potentially insecure library loading
Diffstat (limited to 'src')
-rw-r--r--src/win.c6
-rw-r--r--src/win_vulkan.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/win.c b/src/win.c
index e9c621e..33b37b6 100644
--- a/src/win.c
+++ b/src/win.c
@@ -167,7 +167,8 @@ puglWinGetMonitor(const PuglView* const view)
static double
puglWinGetViewScaleFactor(const PuglView* const view)
{
- const HMODULE shcore = LoadLibrary("Shcore.dll");
+ const HMODULE shcore =
+ LoadLibraryEx("Shcore.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!shcore) {
return 1.0;
}
@@ -201,7 +202,8 @@ puglInitWorldInternals(PuglWorldType type, PuglWorldFlags PUGL_UNUSED(flags))
}
if (type == PUGL_PROGRAM) {
- HMODULE user32 = LoadLibrary("user32.dll");
+ HMODULE user32 =
+ LoadLibraryEx("user32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (user32) {
PFN_SetProcessDPIAware SetProcessDPIAware =
(PFN_SetProcessDPIAware)GetProcAddress(user32, "SetProcessDPIAware");
diff --git a/src/win_vulkan.c b/src/win_vulkan.c
index fa686ed..ddd3fbe 100644
--- a/src/win_vulkan.c
+++ b/src/win_vulkan.c
@@ -29,7 +29,8 @@ puglNewVulkanLoader(PuglWorld* PUGL_UNUSED(world))
return NULL;
}
- if (!(loader->libvulkan = LoadLibrary("vulkan-1.dll"))) {
+ const DWORD flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
+ if (!(loader->libvulkan = LoadLibraryEx("vulkan-1.dll", NULL, flags))) {
free(loader);
return NULL;
}