From: Geoffroy Couprie Date: Thu, 1 Jul 2010 20:17:38 +0000 (+0200) Subject: Win32: Activate DEP on XP SP3. DEP is useless without ASLR, but people using an 10... X-Git-Tag: 1.2.0-pre1~5983 X-Git-Url: https://git.sesse.net/?p=vlc;a=commitdiff_plain;h=89486ccb0bcebd2e047cdcf2d2c51a59ec4a0adf Win32: Activate DEP on XP SP3. DEP is useless without ASLR, but people using an 10 year old OS don't have the right to complain --- diff --git a/bin/winvlc.c b/bin/winvlc.c index 90ed7ce4de..b91cea1a79 100644 --- a/bin/winvlc.c +++ b/bin/winvlc.c @@ -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;