[vlmc-devel] commit: win32: Don't load DLL from CWD ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Mon Sep 6 17:40:07 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Sep  6 17:39:28 2010 +0200| [0f360eef35f2e17cb68d3300683b5b38cbf418cd] | committer: Hugo Beauzée-Luyssen 

win32: Don't load DLL from CWD

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=0f360eef35f2e17cb68d3300683b5b38cbf418cd
---

 src/Main/winvlmc.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/Main/winvlmc.cpp b/src/Main/winvlmc.cpp
index 665b168..9f914bd 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 );
 }



More information about the Vlmc-devel mailing list