1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-16 16:02:54 +02:00

winvlc: call SetProcessDEPPolicy directly

We build for Win7+, the function is always there.

And no need to define PROCESS_DEP_ENABLE. It's available in mingw-w64 since 4.0.
This commit is contained in:
Steve Lhomme 2023-07-04 15:07:14 +02:00
parent 7a198cd386
commit 0767bc491c

View File

@ -141,21 +141,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
/* SetProcessDEPPolicy, SetDllDirectory, & Co. */
HINSTANCE h_Kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (h_Kernel32 != NULL)
{
/* Enable DEP */
#ifndef PROCESS_DEP_ENABLE
# define PROCESS_DEP_ENABLE 1
#endif /* PROCESS_DEP_ENABLE */
BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
mySetProcessDEPPolicy = (BOOL (WINAPI *)(DWORD))
GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
if(mySetProcessDEPPolicy)
mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
}
/* Enable DEP */
SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
/* Do NOT load any library from cwd. */
SetDllDirectory(TEXT(""));