=?UTF-8?Q?R=C3=A9mi=20Bernon=20?=: ntdll/tests: Factor WoW64 checks and add is_win64 constant.
Alexandre Julliard
julliard at winehq.org
Tue Aug 13 14:54:33 CDT 2019
Module: wine
Branch: master
Commit: 3cdb5072e8794daaaa302611ab5f9cd999cf798a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3cdb5072e8794daaaa302611ab5f9cd999cf798a
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Thu Aug 1 10:07:41 2019 +0200
ntdll/tests: Factor WoW64 checks and add is_win64 constant.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 5c3a0b3..d45df72 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.c
@@ -31,6 +31,7 @@ static unsigned int page_size;
static NTSTATUS (WINAPI *pRtlCreateUserStack)(SIZE_T, SIZE_T, ULONG, SIZE_T, SIZE_T, INITIAL_TEB *);
static NTSTATUS (WINAPI *pRtlFreeUserStack)(void *);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
+static const BOOL is_win64 = sizeof(void*) != sizeof(int);
static HANDLE create_target_process(const char *arg)
{
@@ -72,6 +73,8 @@ static void test_NtAllocateVirtualMemory(void)
ULONG_PTR zero_bits;
BOOL is_wow64;
+ if (!pIsWow64Process || !pIsWow64Process(NtCurrentProcess(), &is_wow64)) is_wow64 = FALSE;
+
/* simple allocation should success */
size = 0x1000;
addr1 = NULL;
@@ -163,8 +166,7 @@ static void test_NtAllocateVirtualMemory(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);
}
@@ -273,6 +275,8 @@ static void test_NtMapViewOfSection(void)
LARGE_INTEGER offset;
ULONG_PTR 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);
@@ -360,8 +364,7 @@ static void test_NtMapViewOfSection(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);
}
@@ -424,8 +427,7 @@ static void test_NtMapViewOfSection(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;
More information about the wine-cvs
mailing list