Commit e3fe1b09 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

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: 's avatarAlex Henrie <alexhenrie24@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 07995500
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment