From 0f360eef35f2e17cb68d3300683b5b38cbf418cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Mon, 6 Sep 2010 17:39:28 +0200 Subject: [PATCH] win32: Don't load DLL from CWD --- src/Main/winvlmc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Main/winvlmc.cpp b/src/Main/winvlmc.cpp index 665b1681f..9f914bdef 100644 --- a/src/Main/winvlmc.cpp +++ b/src/Main/winvlmc.cpp @@ -38,5 +38,15 @@ LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo) int main( int argc, char **argv ) { + HINSTANCE h_Kernel32 = LoadLibraryW( L"kernel32.dll" ); + if( h_Kernel32 ) + { + BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName); + /* Do NOT load any library from cwd. */ + mySetDllDirectoryA = (BOOL WINAPI (*)(const char*)) GetProcAddress( h_Kernel32, "SetDllDirectoryA" ); + if ( mySetDllDirectoryA ) + mySetDllDirectoryA( "" ); + FreeLibrary( h_kernel32 ); + } return VLMCmain( argc, argv ); } -- GitLab