From: Sebastian Lackner Subject: [6/6] kernel32: Implement GetProcessDEPPolicy. Message-Id: <5445FE49.5030600@fds-team.de> Date: Tue, 21 Oct 2014 08:33:45 +0200 --- dlls/kernel32/process.c | 28 +++++++++++++++++++++++++--- dlls/kernel32/tests/virtual.c | 3 --- 2 files changed, 25 insertions(+), 6 deletions(-) From 8aa5565be0de947f3a080b666e40bc6a616dde5d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 21 Oct 2014 07:46:10 +0200 Subject: 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 ); } -- 2.1.2