[libbluray-devel] dl_win32: limit dll search path

hpi1 git at videolan.org
Fri Feb 24 11:13:16 CET 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Feb 24 12:12:35 2017 +0200| [6799a4ac7b498575eac8cae1d32c3f703993e947] | committer: hpi1

dl_win32: limit dll search path

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=6799a4ac7b498575eac8cae1d32c3f703993e947
---

 src/file/dl_win32.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/file/dl_win32.c b/src/file/dl_win32.c
index c73859d..c2cbff4 100644
--- a/src/file/dl_win32.c
+++ b/src/file/dl_win32.c
@@ -61,6 +61,7 @@ void *dl_dlopen(const char *path, const char *version)
     char *name;
     void *result;
     int iresult;
+    DWORD flags = 0;
 
     name = str_printf("%s.dll", path);
     if (!name) {
@@ -76,7 +77,15 @@ void *dl_dlopen(const char *path, const char *version)
         return NULL;
     }
 
-    result = LoadLibraryW(wname);
+#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+    if (GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
+                       "SetDefaultDllDirectories") != NULL)
+#endif
+        flags = LOAD_LIBRARY_SEARCH_APPLICATION_DIR |
+                LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
+                LOAD_LIBRARY_SEARCH_SYSTEM32;
+
+    result = LoadLibraryExW(wname, NULL, flags);
 
     if (!result) {
         char buf[128];



More information about the libbluray-devel mailing list