wine-staging/patches/kernel32-SetProcessDEPPolicy/0003-kernel32-Make-system-DEP-policy-affect-GetProcessDEP.patch
2019-10-02 10:11:40 +10:00

45 lines
1.5 KiB
Diff

From 54e9832efd935277864c1faa0cb070676d2079a9 Mon Sep 17 00:00:00 2001
From: "Olivier F. R. Dierick" <o.dierick@piezo-forte.be>
Date: Tue, 19 Apr 2016 07:36:41 +0200
Subject: [PATCH] kernel32: Make system DEP policy affect
GetProcessDEPPolicy().
---
dlls/kernel32/process.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 958b437cea..d7a444a314 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -3904,13 +3904,21 @@ BOOL WINAPI GetProcessDEPPolicy(HANDLE process, LPDWORD flags, PBOOL permanent)
if (flags)
{
*flags = 0;
- if (dep_flags & MEM_EXECUTE_OPTION_DISABLE)
- *flags |= PROCESS_DEP_ENABLE;
- if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
- *flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
+ if (system_DEP_policy != AlwaysOff)
+ {
+ if (dep_flags & MEM_EXECUTE_OPTION_DISABLE || system_DEP_policy == AlwaysOn)
+ *flags |= PROCESS_DEP_ENABLE;
+ if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
+ *flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
+ }
}
- if (permanent) *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
+ if (permanent)
+ {
+ *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
+ if (system_DEP_policy == AlwaysOn || system_DEP_policy == AlwaysOff)
+ *permanent = TRUE;
+ }
return TRUE;
}
--
2.23.0