From: Rémi Bernon Subject: [PATCH v3 08/10] ntdll/tests: Factor WoW64 checks and add is_win64 constant Message-Id: <20190618163934.10280-8-rbernon@codeweavers.com> Date: Tue, 18 Jun 2019 18:39:32 +0200 In-Reply-To: <20190618163934.10280-1-rbernon@codeweavers.com> References: <20190618163934.10280-1-rbernon@codeweavers.com> This is in order to use todo_wine_if(is_win64) in next patch. Signed-off-by: Rémi Bernon --- dlls/ntdll/tests/virtual.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 2248a59fb6e..6fe4828095e 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -27,6 +27,7 @@ #include "wine/test.h" static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); +static const BOOL is_win64 = sizeof(void*) > sizeof(int); static HANDLE create_target_process(const char *arg) { @@ -78,6 +79,8 @@ static void test_AllocateVirtualMemory(void) ULONG zero_bits; BOOL is_wow64; + if (!pIsWow64Process || !pIsWow64Process(NtCurrentProcess(), &is_wow64)) is_wow64 = FALSE; + /* simple allocation should success */ size = 0x1000; addr1 = NULL; @@ -175,8 +178,7 @@ static void test_AllocateVirtualMemory(void) status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); - if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || - !pIsWow64Process(NtCurrentProcess(), &is_wow64) || !is_wow64)) + if (!is_win64 && !is_wow64) { ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status); } @@ -222,6 +224,8 @@ static void test_MapViewOfSection(void) LARGE_INTEGER offset; ULONG zero_bits; + if (!pIsWow64Process || !pIsWow64Process(NtCurrentProcess(), &is_wow64)) is_wow64 = FALSE; + file = CreateFileA(testfile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); ok(file != INVALID_HANDLE_VALUE, "Failed to create test file\n"); WriteFile(file, data, sizeof(data), &written, NULL); @@ -314,8 +318,7 @@ static void test_MapViewOfSection(void) offset.QuadPart = 0; status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); - if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || - !pIsWow64Process(NtCurrentProcess(), &is_wow64) || !is_wow64)) + if (!is_win64 && !is_wow64) { ok(status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %08x\n", status); } @@ -378,8 +381,7 @@ static void test_MapViewOfSection(void) status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE); ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status); - if (sizeof(void *) == sizeof(int) && (!pIsWow64Process || - !pIsWow64Process(NtCurrentProcess(), &is_wow64) || !is_wow64)) + if (!is_win64 && !is_wow64) { /* new memory region conflicts with previous mapping */ ptr2 = ptr; -- 2.20.1