Win32: do not load DLL from cwd
[vlc/vlc-1.1.git] / bin / winvlc.c
index 2d09cba..ac9b97c 100644 (file)
@@ -131,12 +131,19 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     if(h_Kernel32)
     {
         BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
+        BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
 # define PROCESS_DEP_ENABLE 1
 
         mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD))
                             GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
         if(mySetProcessDEPPolicy)
             mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
+
+        /* Do NOT load any library from cwd. */
+        mySetDllDirectoryA = (BOOL WINAPI (*)(const char*)) GetProcAddress(h_Kernel32, "SetDllDirectoryA");
+        if(mySetDllDirectoryA)
+            mySetDllDirectoryA("");
+
         FreeLibrary(h_Kernel32);
     }