[vlc-commits] win32: hard-code LoadLibrary flags

Rémi Denis-Courmont git at videolan.org
Sun Dec 10 17:04:52 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 10 17:58:20 2017 +0200| [ba108368ccce002d74d1e81fcae1d73806467e59] | committer: Rémi Denis-Courmont

win32: hard-code LoadLibrary flags

This fixes a data race on multiple LibVLC instances.

Note: This patch does NOT fix the many other LoadLibrary() calls.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba108368ccce002d74d1e81fcae1d73806467e59
---

 src/win32/plugin.c   |  4 +---
 src/win32/specific.c | 10 ----------
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/win32/plugin.c b/src/win32/plugin.c
index d4ac661fec..3a3be16d3c 100644
--- a/src/win32/plugin.c
+++ b/src/win32/plugin.c
@@ -33,8 +33,6 @@
 #include <windows.h>
 #include <wchar.h>
 
-extern DWORD LoadLibraryFlags;
-
 static char *GetWindowsError( void )
 {
     wchar_t wmsg[256];
@@ -64,7 +62,7 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
     DWORD mode;
     if (SetThreadErrorMode (SEM_FAILCRITICALERRORS, &mode) != 0)
     {
-        handle = LoadLibraryExW (wfile, NULL, LoadLibraryFlags );
+        handle = LoadLibraryExW(wfile, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
         SetThreadErrorMode (mode, NULL);
     }
 #else
diff --git a/src/win32/specific.c b/src/win32/specific.c
index c38890febc..4ab588a7b7 100644
--- a/src/win32/specific.c
+++ b/src/win32/specific.c
@@ -39,8 +39,6 @@
 typedef UINT MMRESULT;
 #endif
 
-DWORD LoadLibraryFlags = 0;
-
 static int system_InitWSA(int hi, int lo)
 {
     WSADATA data;
@@ -62,14 +60,6 @@ void system_Init(void)
 {
     if (system_InitWSA(2, 2) && system_InitWSA(1, 1))
         fputs("Error: cannot initialize Winsocks\n", stderr);
-
-#if !VLC_WINSTORE_APP
-# if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-    if (GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
-                                       "SetDefaultDllDirectories") != NULL)
-# endif /* FIXME: not reentrant */
-        LoadLibraryFlags = LOAD_LIBRARY_SEARCH_SYSTEM32;
-#endif
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list