[vlc-commits] vlc: set default DLL directories
Rémi Denis-Courmont
git at videolan.org
Fri Nov 18 19:15:21 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 18 20:07:58 2016 +0200| [5d9004a6441410e39f3dc229253c5073654a129c] | committer: Rémi Denis-Courmont
vlc: set default DLL directories
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d9004a6441410e39f3dc229253c5073654a129c
---
bin/winvlc.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/bin/winvlc.c b/bin/winvlc.c
index 1d1eec6..327ae07 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