]> git.sesse.net Git - vlc/commitdiff
Win32: Activate DEP on XP SP3. DEP is useless without ASLR, but people using an 10...
authorGeoffroy Couprie <geal@videolan.org>
Thu, 1 Jul 2010 20:17:38 +0000 (22:17 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 1 Jul 2010 20:36:52 +0000 (22:36 +0200)
bin/winvlc.c

index 90ed7ce4de1cbea559207622261811dcb451d16d..b91cea1a791b845ab38f4853a35f2341a36465fe 100644 (file)
@@ -121,6 +121,20 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     int argc;
 #ifndef UNDER_CE
     HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
+
+    HINSTANCE h_Kernel32 = LoadLibraryW(L"kernel32.dll");
+    if(h_Kernel32)
+    {
+        BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
+# define PROCESS_DEP_ENABLE 1
+
+        mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD))
+                            GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
+        if(mySetProcessDEPPolicy)
+            mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
+        FreeLibrary(h_Kernel32);
+    }
+
     wchar_t **wargv = CommandLineToArgvW (GetCommandLine (), &argc);
     if (wargv == NULL)
         return 1;