Sebastian Lackner : kernel32: Implement GetProcessDEPPolicy.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 21 09:49:44 CDT 2014


Module: wine
Branch: master
Commit: d74c9e3ec20dc886ab83f924cd3f5444a52a4c7e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d74c9e3ec20dc886ab83f924cd3f5444a52a4c7e

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Tue Oct 21 07:46:10 2014 +0200

kernel32: Implement GetProcessDEPPolicy.

---

 dlls/kernel32/process.c       | 28 +++++++++++++++++++++++++---
 dlls/kernel32/tests/virtual.c |  3 ---
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 301c64a..138273b 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -3942,9 +3942,31 @@ BOOL WINAPI GetNumaAvailableMemoryNode(UCHAR node, PULONGLONG available_bytes)
  */
 BOOL WINAPI GetProcessDEPPolicy(HANDLE process, LPDWORD flags, PBOOL permanent)
 {
-    FIXME("(%p %p %p): stub\n", process, flags, permanent);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+    NTSTATUS status;
+    ULONG dep_flags;
+
+    TRACE("(%p %p %p)\n", process, flags, permanent);
+
+    status = NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
+                                        &dep_flags, sizeof(dep_flags), NULL );
+    if (!status)
+    {
+
+        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 (permanent)
+            *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
+
+    }
+    if (status) SetLastError( RtlNtStatusToDosError(status) );
+    return !status;
 }
 
 /**********************************************************************
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 40f45ef..98ef703 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -1995,7 +1995,6 @@ static void test_atl_thunk_emulation( ULONG dep_flags )
         ok( success, "VirtualProtect failed %u\n", GetLastError() );
 
         success = get_dep_policy( GetCurrentProcess(), &policy_flags, &policy_permanent );
-        todo_wine
         ok( success, "GetProcessDEPPolicy failed %u\n", GetLastError() );
 
         ret = 0;
@@ -2004,9 +2003,7 @@ static void test_atl_thunk_emulation( ULONG dep_flags )
         if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
             ret |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
 
-        todo_wine
         ok( policy_flags == ret, "expected policy flags %d, got %d\n", ret, policy_flags );
-        todo_wine
         ok( !policy_permanent || broken(policy_permanent == 0x44),
             "expected policy permanent FALSE, got %d\n", policy_permanent );
     }




More information about the wine-cvs mailing list