Alex Henrie : ntdll/tests: Handle case where process doesn' t have its own DEP policy.
Module: wine Branch: master Commit: e3fe1b09468efc9d6faf8ec05a91e3972458b293 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e3fe1b09468efc9d6faf8ec05... Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Sep 12 00:31:54 2018 -0600 ntdll/tests: Handle case where process doesn't have its own DEP policy. If neither MEM_EXECUTE_OPTION_ENABLE nor MEM_EXECUTE_OPTION_DISABLE is set in the ProcessExecuteFlags, the process is using the system DEP setting. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/info.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 2ab12e4..e7b07e5 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -38,6 +38,7 @@ static NTSTATUS (WINAPI * pNtClose)(HANDLE); static ULONG (WINAPI * pNtGetCurrentProcessorNumber)(void); static BOOL (WINAPI * pIsWow64Process)(HANDLE, PBOOL); static BOOL (WINAPI * pGetLogicalProcessorInformationEx)(LOGICAL_PROCESSOR_RELATIONSHIP,SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*,DWORD*); +static DEP_SYSTEM_POLICY_TYPE (WINAPI * pGetSystemDEPPolicy)(void); static BOOL is_wow64; @@ -96,6 +97,8 @@ static BOOL InitFunctionPtrs(void) pIsWow64Process = (void *)GetProcAddress(hkernel32, "IsWow64Process"); if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; + pGetSystemDEPPolicy = (void *)GetProcAddress(hkernel32, "GetSystemDEPPolicy"); + /* starting with Win7 */ pNtQuerySystemInformationEx = (void *) GetProcAddress(hntdll, "NtQuerySystemInformationEx"); if (!pNtQuerySystemInformationEx) @@ -1851,7 +1854,7 @@ static void test_mapprotection(void) ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status ); trace("Process execute flags %08x\n", oldflags); - if (oldflags & MEM_EXECUTE_OPTION_DISABLE) + if (!(oldflags & MEM_EXECUTE_OPTION_ENABLE)) { if (oldflags & MEM_EXECUTE_OPTION_PERMANENT) { @@ -1859,6 +1862,12 @@ static void test_mapprotection(void) return; } + if (pGetSystemDEPPolicy && pGetSystemDEPPolicy() == AlwaysOn) + { + skip("System policy requires noexec\n"); + return; + } + status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) ); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status ); reset_flags = TRUE;
participants (1)
-
Alexandre Julliard