[vlc-commits] vlc: set default DLL directories
Rémi Denis-Courmont
git at videolan.org
Wed Mar 8 23:43:50 CET 2017
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 18 20:07:58 2016 +0200| [5fdafd9ce56ef76fca6df11e5a60692a139c524f] | committer: Jean-Baptiste Kempf
vlc: set default DLL directories
(cherry picked from commit 5d9004a6441410e39f3dc229253c5073654a129c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5fdafd9ce56ef76fca6df11e5a60692a139c524f
---
bin/winvlc.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/bin/winvlc.c b/bin/winvlc.c
index 52b6aee..0fe050b 100644
--- a/bin/winvlc.c
+++ b/bin/winvlc.c
@@ -61,6 +61,25 @@ static char *FromWide (const wchar_t *wide)
return out;
}
+#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+static BOOL SetDefaultDllDirectories_(DWORD flags)
+{
+ HMODULE h = GetModuleHandle(TEXT("kernel32.dll"));
+ if (h == NULL)
+ return FALSE;
+
+ BOOL WINAPI (*SetDefaultDllDirectoriesReal)(DWORD);
+
+ SetDefaultDllDirectoriesReal = GetProcAddress(h,
+ "SetDefaultDllDirectories");
+ if (SetDefaultDllDirectoriesReal == NULL)
+ return FALSE;
+
+ return SetDefaultDllDirectoriesReal(flags);
+}
+# define SetDefaultDllDirectories SetDefaultDllDirectories_
+#endif
+
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
@@ -104,6 +123,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
FreeLibrary(h_Kernel32);
}
+ SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);
+
/* Args */
wchar_t **wargv = CommandLineToArgvW (GetCommandLine (), &argc);
if (wargv == NULL)
More information about the vlc-commits
mailing list