Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernel32/tests/virtual.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 474955630fd..d797df26f6c 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -456,12 +456,13 @@ static void test_VirtualAlloc(void) ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
- /* 21 zero bits is valid */ + /* 21 zero bits never succeeds */ size = 0x1000; addr2 = NULL; status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 21, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, + todo_wine + ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemory returned %08x\n", status); if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
@@ -470,7 +471,8 @@ static void test_VirtualAlloc(void) addr2 = NULL; status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 22, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status); + ok(status == STATUS_INVALID_PARAMETER_3 || status == STATUS_INVALID_PARAMETER, + "NtAllocateVirtualMemory returned %08x\n", status); if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
/* AT_ROUND_TO_PAGE flag is not supported for VirtualAlloc */ @@ -484,8 +486,8 @@ static void test_VirtualAlloc(void) addr2 = (char *)addr1 + 0x1000; status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 0, &size, MEM_RESERVE | MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE); - todo_wine - ok(status == STATUS_INVALID_PARAMETER_5, "NtAllocateVirtualMemory returned %08x\n", status); + ok(status == STATUS_INVALID_PARAMETER_5 || status == STATUS_INVALID_PARAMETER, + "NtAllocateVirtualMemory returned %08x\n", status);
ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n"); }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernel32/tests/virtual.c | 49 ------------------ dlls/ntdll/tests/Makefile.in | 3 +- dlls/ntdll/tests/virtual.c | 98 +++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 50 deletions(-) create mode 100644 dlls/ntdll/tests/virtual.c
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index d797df26f6c..0b718606d0e 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -52,8 +52,6 @@ static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID); static BOOL (WINAPI *pGetProcessDEPPolicy)(HANDLE, LPDWORD, PBOOL); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static NTSTATUS (WINAPI *pNtProtectVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG, ULONG *); -static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG, SIZE_T *, ULONG, ULONG); -static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG);
/* ############################### */
@@ -230,8 +228,6 @@ static void test_VirtualAlloc(void) void *addr1, *addr2; DWORD old_prot; MEMORY_BASIC_INFORMATION info; - NTSTATUS status; - SIZE_T size;
SetLastError(0xdeadbeef); addr1 = VirtualAlloc(0, 0, MEM_RESERVE, PAGE_NOACCESS); @@ -440,55 +436,12 @@ static void test_VirtualAlloc(void) addr2 = VirtualAlloc(addr1, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); ok(addr2 == addr1, "VirtualAlloc returned %p, expected %p\n", addr2, addr1);
- /* allocation conflicts because of 64k align */ - size = 0x1000; - addr2 = (char *)addr1 + 0x1000; - status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 0, &size, - MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); - - /* it should conflict, even when zero_bits is explicitly set */ - size = 0x1000; - addr2 = (char *)addr1 + 0x1000; - status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 12, &size, - MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - todo_wine - ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); - - /* 21 zero bits never succeeds */ - size = 0x1000; - addr2 = NULL; - status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 21, &size, - MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - todo_wine - ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER, - "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); - - /* 22 zero bits is invalid */ - size = 0x1000; - addr2 = NULL; - status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 22, &size, - MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - ok(status == STATUS_INVALID_PARAMETER_3 || status == STATUS_INVALID_PARAMETER, - "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); - /* AT_ROUND_TO_PAGE flag is not supported for VirtualAlloc */ SetLastError(0xdeadbeef); addr2 = VirtualAlloc(addr1, 0x1000, MEM_RESERVE | MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE); ok(!addr2, "VirtualAlloc unexpectedly succeeded\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
- /* AT_ROUND_TO_PAGE flag is not supported for NtAllocateVirtualMemory */ - size = 0x1000; - addr2 = (char *)addr1 + 0x1000; - status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 0, &size, MEM_RESERVE | - MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE); - ok(status == STATUS_INVALID_PARAMETER_5 || status == STATUS_INVALID_PARAMETER, - "NtAllocateVirtualMemory returned %08x\n", status); - ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n"); }
@@ -4438,8 +4391,6 @@ START_TEST(virtual) pRtlAddVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlAddVectoredExceptionHandler" ); pRtlRemoveVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlRemoveVectoredExceptionHandler" ); pNtProtectVirtualMemory = (void *)GetProcAddress( hntdll, "NtProtectVirtualMemory" ); - pNtAllocateVirtualMemory = (void *)GetProcAddress( hntdll, "NtAllocateVirtualMemory" ); - pNtFreeVirtualMemory = (void *)GetProcAddress( hntdll, "NtFreeVirtualMemory" );
GetSystemInfo(&si); trace("system page size %#x\n", si.dwPageSize); diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in index 5c70f3f01a0..ed15c51339f 100644 --- a/dlls/ntdll/tests/Makefile.in +++ b/dlls/ntdll/tests/Makefile.in @@ -22,4 +22,5 @@ C_SRCS = \ rtlstr.c \ string.c \ threadpool.c \ - time.c + time.c \ + virtual.c diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c new file mode 100644 index 00000000000..0434c29af31 --- /dev/null +++ b/dlls/ntdll/tests/virtual.c @@ -0,0 +1,98 @@ +#include <stdio.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winnt.h" +#include "winternl.h" +#include "winerror.h" +#include "winuser.h" +#include "excpt.h" +#include "wine/test.h" + +static void test_AllocateVirtualMemory(void) +{ + void *addr1, *addr2; + NTSTATUS status; + SIZE_T size; + + /* simple allocation should success */ + size = 0x1000; + addr1 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemory returned %08x\n", status); + + /* allocation conflicts because of 64k align */ + size = 0x1000; + addr2 = (char *)addr1 + 0x1000; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 0, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); + + /* it should conflict, even when zero_bits is explicitly set */ + size = 0x1000; + addr2 = (char *)addr1 + 0x1000; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 12, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + todo_wine + ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + + /* 21 zero bits never succeeds */ + size = 0x1000; + addr2 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 21, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + todo_wine + ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER, + "NtAllocateVirtualMemory returned %08x\n", status); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + + /* 22 zero bits is invalid */ + size = 0x1000; + addr2 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 22, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + ok(status == STATUS_INVALID_PARAMETER_3 || status == STATUS_INVALID_PARAMETER, + "NtAllocateVirtualMemory returned %08x\n", status); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + + /* AT_ROUND_TO_PAGE flag is not supported for NtAllocateVirtualMemory */ + size = 0x1000; + addr2 = (char *)addr1 + 0x1000; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 0, &size, MEM_RESERVE | + MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE); + ok(status == STATUS_INVALID_PARAMETER_5 || status == STATUS_INVALID_PARAMETER, + "NtAllocateVirtualMemory returned %08x\n", status); + + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed\n"); +} + +START_TEST(virtual) +{ + SYSTEM_BASIC_INFORMATION sbi; + + NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL); + trace("system page size %#x\n", sbi.PageSize); + + test_AllocateVirtualMemory(); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53130
Your paranoid android.
=== wvistau64 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_zh_CN (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_fr (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_he (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w2008s64 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w7u (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w7pro64 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w8 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w8adm (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w864 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w1064v1507 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
=== w1064v1809 (32 bit report) ===
kernel32: virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 0, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2850: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2864: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2989: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3007: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3088: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3112: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2794: Test failed: expected policy flags 1, got 3 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:2893: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2908: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2956: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2971: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3152: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3177: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2756: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2795: Test failed: expected policy permanent FALSE, got 1 virtual.c:3214: Test failed: NtSetInformationProcess failed with status c0000022
On Fri, May 31, 2019 at 12:01:59PM +0200, Rémi Bernon wrote:
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c new file mode 100644 index 00000000000..0434c29af31 --- /dev/null +++ b/dlls/ntdll/tests/virtual.c @@ -0,0 +1,98 @@
You need the file's licence and copyright header. Copy it from kernel32/tests/virtual.c
+#include <stdio.h>
+#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winnt.h" +#include "winternl.h" +#include "winerror.h" +#include "winuser.h" +#include "excpt.h" +#include "wine/test.h"
Some of these includes; winbase.h, winerror.h, winuser.h and excpt.h should go.
Huw.
The zero_bits parameter doesn't behave as expected, and some 64bit code use it to allocate memory in the lower 32bit address space.
The expected full behaviour is:
* zero_bits == 0: no constraint on address range * 0 < zero_bits <= 15: returned address should have as many upper bits set to 0, starting at bit 31. In 64bit mode, upper 32bits should all be 0 as well. * 15 < zero_bits <= 31: unsure, but probably same as zero_bits == 15. * zero_bits > 31: (64bit/WoW64 only) zero_bits behaves as a bitmask, as if it was set to the number of leading 0 in the bitmask, works in the whole 64bit range.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntdll/tests/virtual.c | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 0434c29af31..25cd36bd028 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -11,11 +11,15 @@ #include "excpt.h" #include "wine/test.h"
+static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); + static void test_AllocateVirtualMemory(void) { void *addr1, *addr2; NTSTATUS status; SIZE_T size; + ULONG zero_bits; + BOOL is_wow64;
/* simple allocation should success */ size = 0x1000; @@ -45,6 +49,40 @@ static void test_AllocateVirtualMemory(void) ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); }
+ /* 1 zero bits should zero 63-31 upper bits */ + size = 0x1000; + addr2 = NULL; + zero_bits = 1; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 1, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) || + broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */, + "NtAllocateVirtualMemory returned %08x, addr2: %p\n", status, addr2); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + + for (zero_bits = 2; zero_bits <= 20; zero_bits++) + { + size = 0x1000; + addr2 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + todo_wine_if(zero_bits >= 12 || ((UINT_PTR)addr2 >> (32 - zero_bits))) + ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) || + broken(zero_bits == 20 && status == STATUS_CONFLICTING_ADDRESSES) /* w1064v1809 */, + "NtAllocateVirtualMemory with %d zero_bits returned %08x, addr2: %p\n", zero_bits, status, addr2); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + } + /* 21 zero bits never succeeds */ size = 0x1000; addr2 = NULL; @@ -74,6 +112,31 @@ static void test_AllocateVirtualMemory(void) ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); }
+ /* zero bits > 31 should be considered as bitmask on 64bit and WoW64 */ + size = 0x1000; + addr2 = NULL; + zero_bits = 0x1fffffff; + 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)) + { + ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status); + } + else + { + todo_wine + ok((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 & ~zero_bits) == 0, + "NtAllocateVirtualMemory returned %08x, addr2: %p\n", status, addr2); + if (status == STATUS_SUCCESS) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + } + } + /* AT_ROUND_TO_PAGE flag is not supported for NtAllocateVirtualMemory */ size = 0x1000; addr2 = (char *)addr1 + 0x1000; @@ -90,6 +153,10 @@ static void test_AllocateVirtualMemory(void) START_TEST(virtual) { SYSTEM_BASIC_INFORMATION sbi; + HMODULE hkernel32; + + hkernel32 = GetModuleHandleA("kernel32.dll"); + pIsWow64Process = (void *)GetProcAddress(hkernel32, "IsWow64Process");
NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL); trace("system page size %#x\n", sbi.PageSize);
On Fri, May 31, 2019 at 12:02:00PM +0200, Rémi Bernon wrote:
The zero_bits parameter doesn't behave as expected, and some 64bit code use it to allocate memory in the lower 32bit address space.
The expected full behaviour is:
- zero_bits == 0: no constraint on address range
- 0 < zero_bits <= 15: returned address should have as many upper bits set to 0, starting at bit 31. In 64bit mode, upper 32bits should all be 0 as well.
- 15 < zero_bits <= 31: unsure, but probably same as zero_bits == 15.
- zero_bits > 31: (64bit/WoW64 only) zero_bits behaves as a bitmask, as if it was set to the number of leading 0 in the bitmask, works in the whole 64bit range.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/ntdll/tests/virtual.c | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 0434c29af31..25cd36bd028 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -11,11 +11,15 @@ #include "excpt.h" #include "wine/test.h"
+static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static void test_AllocateVirtualMemory(void) { void *addr1, *addr2; NTSTATUS status; SIZE_T size;
ULONG zero_bits;
BOOL is_wow64;
/* simple allocation should success */ size = 0x1000;
@@ -45,6 +49,40 @@ static void test_AllocateVirtualMemory(void) ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); }
- /* 1 zero bits should zero 63-31 upper bits */
- size = 0x1000;
- addr2 = NULL;
- zero_bits = 1;
- status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 1, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
- ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) ||
broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */,
"NtAllocateVirtualMemory returned %08x, addr2: %p\n", status, addr2);
It would be clearer to move the addr2 >> (32 - zero_bits) == 0 test to a separate ok(), probably inside the if block below. This also applies to several other places further down. The point being that the main purpose of these tests is to test the form of address returned and that test is currently hidden inside a complicated expression which looks to have more to do with the precise value of the returned status.
- if (status == STATUS_SUCCESS)
- {
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2);
- }
NtAllocateVirtualMemory was called for its zero_bits parameter, used as an alignment value. But it is not, so call VirtualAlloc instead.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/commdlg.dll16/filedlg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/commdlg.dll16/filedlg.c b/dlls/commdlg.dll16/filedlg.c index 5b72bfab100..050cddb0dd5 100644 --- a/dlls/commdlg.dll16/filedlg.c +++ b/dlls/commdlg.dll16/filedlg.c @@ -509,8 +509,7 @@ static LPOFNHOOKPROC alloc_hook( LPOFNHOOKPROC16 hook16 ) SIZE_T size = 0x1000; unsigned int i;
- if (!hooks && NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&hooks, 12, &size, - MEM_COMMIT, PAGE_EXECUTE_READWRITE )) + if (!hooks && !(hooks = VirtualAlloc( NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE ))) return NULL;
for (i = 0; i < count; i++)
Signed-off-by: Huw Davies huw@codeweavers.com
This parameter was misinterpreted as an alignment parameter for the lower bits of the allocated memory region, although it is a constraint on the higher bits.
Add a new internal ntdll virtual_alloc_aligned function that has a separate alignment parameter which is now used instead of the zero_bits parameter.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntdll/directory.c | 4 ++-- dlls/ntdll/heap.c | 5 ++--- dlls/ntdll/ntdll_misc.h | 2 ++ dlls/ntdll/signal_arm.c | 12 ++++++------ dlls/ntdll/signal_arm64.c | 16 ++++++++-------- dlls/ntdll/signal_i386.c | 16 ++++++++-------- dlls/ntdll/signal_powerpc.c | 12 ++++++------ dlls/ntdll/signal_x86_64.c | 16 ++++++++-------- dlls/ntdll/tests/virtual.c | 3 ++- dlls/ntdll/thread.c | 3 +-- dlls/ntdll/virtual.c | 33 ++++++++++++++++++++++++++------- 11 files changed, 71 insertions(+), 51 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index bbdbbe9781f..6605999b824 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -1603,14 +1603,14 @@ static KERNEL_DIRENT *start_vfat_ioctl( int fd ) SIZE_T size = 2 * sizeof(*de) + page_size; void *addr = NULL;
- if (NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 1, &size, MEM_RESERVE, PAGE_READWRITE )) + if (virtual_alloc_aligned( &addr, 0, &size, MEM_RESERVE, PAGE_READWRITE, 1 )) return NULL; /* commit only the size needed for the dir entries */ /* this leaves an extra unaccessible page, which should make the kernel */ /* fail with -EFAULT before it stomps all over our memory */ de = addr; size = 2 * sizeof(*de); - NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 1, &size, MEM_COMMIT, PAGE_READWRITE ); + virtual_alloc_aligned( &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE, 1 ); }
/* set d_reclen to 65535 to work around an AFS kernel bug */ diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index cccaaee1d45..2d2caf551e3 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -726,8 +726,7 @@ static void *allocate_large_block( HEAP *heap, DWORD flags, SIZE_T size ) LPVOID address = NULL;
if (block_size < size) return NULL; /* overflow */ - if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 5, - &block_size, MEM_COMMIT, get_protection_type( flags ) )) + if (virtual_alloc_aligned( &address, 0, &block_size, MEM_COMMIT, get_protection_type( flags ), 5 )) { WARN("Could not allocate block for %08lx bytes\n", size ); return NULL; @@ -1521,7 +1520,7 @@ void heap_set_debug_flags( HANDLE handle ) void *ptr = NULL; SIZE_T size = MAX_FREE_PENDING * sizeof(*heap->pending_free);
- if (!NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 4, &size, MEM_COMMIT, PAGE_READWRITE )) + if (!virtual_alloc_aligned( &ptr, 0, &size, MEM_COMMIT, PAGE_READWRITE, 4 )) { heap->pending_free = ptr; heap->pending_pos = 0; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 2d83f541bd5..ae0e6b5742c 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -168,6 +168,8 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S UINT disposition ) DECLSPEC_HIDDEN;
/* virtual memory */ +extern NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, + ULONG type, ULONG protect, ULONG alignment ); extern NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, SIZE_T commit_size, const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index e01c8ce2193..cf7f2d13160 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c @@ -967,22 +967,22 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) */ NTSTATUS signal_alloc_thread( TEB **teb ) { - static size_t sigstack_zero_bits; + static size_t sigstack_alignment; SIZE_T size; NTSTATUS status;
- if (!sigstack_zero_bits) + if (!sigstack_alignment) { size_t min_size = page_size; /* find the first power of two not smaller than min_size */ - while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++; + while ((1u << sigstack_alignment) < min_size) sigstack_alignment++; assert( sizeof(TEB) <= min_size ); }
- size = 1 << sigstack_zero_bits; + size = 1 << sigstack_alignment; *teb = NULL; - if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)teb, sigstack_zero_bits, - &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ))) + if (!(status = virtual_alloc_aligned( (void **)teb, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, + PAGE_READWRITE, sigstack_alignment ))) { (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 94520c95ced..d2d43b34bc1 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -871,24 +871,24 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) */ NTSTATUS signal_alloc_thread( TEB **teb ) { - static size_t sigstack_zero_bits; + static size_t sigstack_alignment; SIZE_T size; NTSTATUS status;
- if (!sigstack_zero_bits) + if (!sigstack_alignment) { size_t min_size = teb_size + max( MINSIGSTKSZ, 8192 ); /* find the first power of two not smaller than min_size */ - sigstack_zero_bits = 12; - while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++; - signal_stack_size = (1 << sigstack_zero_bits) - teb_size; + sigstack_alignment = 12; + while ((1u << sigstack_alignment) < min_size) sigstack_alignment++; + signal_stack_size = (1 << sigstack_alignment) - teb_size; assert( sizeof(TEB) <= teb_size ); }
- size = 1 << sigstack_zero_bits; + size = 1 << sigstack_alignment; *teb = NULL; - if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)teb, sigstack_zero_bits, - &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ))) + if (!(status = virtual_alloc_aligned( (void **)teb, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, + PAGE_READWRITE, sigstack_alignment ))) { (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index b4e88d125f1..b2925062bf7 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -2312,25 +2312,25 @@ static void ldt_unlock(void) */ NTSTATUS signal_alloc_thread( TEB **teb ) { - static size_t sigstack_zero_bits; + static size_t sigstack_alignment; struct x86_thread_data *thread_data; SIZE_T size; void *addr = NULL; NTSTATUS status;
- if (!sigstack_zero_bits) + if (!sigstack_alignment) { size_t min_size = teb_size + max( MINSIGSTKSZ, 8192 ); /* find the first power of two not smaller than min_size */ - sigstack_zero_bits = 12; - while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++; - signal_stack_mask = (1 << sigstack_zero_bits) - 1; - signal_stack_size = (1 << sigstack_zero_bits) - teb_size; + sigstack_alignment = 12; + while ((1u << sigstack_alignment) < min_size) sigstack_alignment++; + signal_stack_mask = (1 << sigstack_alignment) - 1; + signal_stack_size = (1 << sigstack_alignment) - teb_size; }
size = signal_stack_mask + 1; - if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, sigstack_zero_bits, - &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ))) + if (!(status = virtual_alloc_aligned( &addr, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, + PAGE_READWRITE, sigstack_alignment ))) { *teb = addr; (*teb)->Tib.Self = &(*teb)->Tib; diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c index 86398d8f54f..f23265445df 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c @@ -1018,22 +1018,22 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) */ NTSTATUS signal_alloc_thread( TEB **teb ) { - static size_t sigstack_zero_bits; + static size_t sigstack_alignment; SIZE_T size; NTSTATUS status;
- if (!sigstack_zero_bits) + if (!sigstack_alignment) { size_t min_size = page_size; /* this is just for the TEB, we don't use a signal stack yet */ /* find the first power of two not smaller than min_size */ - while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++; + while ((1u << sigstack_alignment) < min_size) sigstack_alignment++; assert( sizeof(TEB) <= min_size ); }
- size = 1 << sigstack_zero_bits; + size = 1 << sigstack_alignment; *teb = NULL; - if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)teb, sigstack_zero_bits, - &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ))) + if (!(status = virtual_alloc_aligned( (void **)teb, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, + PAGE_READWRITE, sigstack_alignment ))) { (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index c2151f78c63..e56534068ff 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -3263,24 +3263,24 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) */ NTSTATUS signal_alloc_thread( TEB **teb ) { - static size_t sigstack_zero_bits; + static size_t sigstack_alignment; SIZE_T size; NTSTATUS status;
- if (!sigstack_zero_bits) + if (!sigstack_alignment) { size_t min_size = teb_size + max( MINSIGSTKSZ, 8192 ); /* find the first power of two not smaller than min_size */ - sigstack_zero_bits = 12; - while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++; - signal_stack_size = (1 << sigstack_zero_bits) - teb_size; + sigstack_alignment = 12; + while ((1u << sigstack_alignment) < min_size) sigstack_alignment++; + signal_stack_size = (1 << sigstack_alignment) - teb_size; assert( sizeof(TEB) <= teb_size ); }
- size = 1 << sigstack_zero_bits; + size = 1 << sigstack_alignment; *teb = NULL; - if (!(status = NtAllocateVirtualMemory( NtCurrentProcess(), (void **)teb, sigstack_zero_bits, - &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ))) + if (!(status = virtual_alloc_aligned( (void **)teb, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, + PAGE_READWRITE, sigstack_alignment ))) { (*teb)->Tib.Self = &(*teb)->Tib; (*teb)->Tib.ExceptionList = (void *)~0UL; diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 25cd36bd028..e294688f1b3 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -55,6 +55,7 @@ static void test_AllocateVirtualMemory(void) zero_bits = 1; status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 1, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + todo_wine ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) || broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */, "NtAllocateVirtualMemory returned %08x, addr2: %p\n", status, addr2); @@ -71,7 +72,7 @@ static void test_AllocateVirtualMemory(void) addr2 = NULL; status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); - todo_wine_if(zero_bits >= 12 || ((UINT_PTR)addr2 >> (32 - zero_bits))) + todo_wine ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) || broken(zero_bits == 20 && status == STATUS_CONFLICTING_ADDRESSES) /* w1064v1809 */, "NtAllocateVirtualMemory with %d zero_bits returned %08x, addr2: %p\n", zero_bits, status, addr2); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 46de839400d..96aa6be7f2c 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -184,8 +184,7 @@ void thread_init(void)
addr = NULL; size = sizeof(*peb); - NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 1, &size, - MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ); + virtual_alloc_aligned( &addr, 0, &size, MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE, 1 ); peb = addr;
peb->FastPebLock = &peb_lock; diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 78973a8cda4..a3ed96ff77f 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -2461,19 +2461,17 @@ void virtual_set_large_address_space(void) NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, ULONG type, ULONG protect ) { - void *base; - unsigned int vprot; SIZE_T size = *size_ptr; - SIZE_T mask = get_mask( zero_bits ); NTSTATUS status = STATUS_SUCCESS; - BOOL is_dos_memory = FALSE; - struct file_view *view; - sigset_t sigset;
TRACE("%p %p %08lx %x %08x\n", process, *ret, size, type, protect );
if (!size) return STATUS_INVALID_PARAMETER; - if (!mask) return STATUS_INVALID_PARAMETER_3; + if (zero_bits) + { + FIXME("Unimplemented zero_bits handling\n"); + return STATUS_INVALID_PARAMETER_3; + }
if (process != NtCurrentProcess()) { @@ -2499,6 +2497,27 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_ return result.virtual_alloc.status; }
+ return virtual_alloc_aligned( ret, zero_bits, size_ptr, type, protect, 0 ); +} + + +/*********************************************************************** + * virtual_alloc_aligned (NTDLL.@) + * + * Same as NtAllocateVirtualMemory but with an alignment parameter + */ +NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr, + ULONG type, ULONG protect, ULONG alignment ) +{ + void *base; + unsigned int vprot; + SIZE_T size = *size_ptr; + SIZE_T mask = get_mask( alignment ); + NTSTATUS status = STATUS_SUCCESS; + BOOL is_dos_memory = FALSE; + struct file_view *view; + sigset_t sigset; + /* Round parameters to a page boundary */
if (is_beyond_limit( 0, size, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE;
Implement the correct zero_bits behavior for this single case: * Limit the search in reserved areas to the lower 2G range, * Pass the MAP_32BIT flag to mmap as a fallback.
LuaJIT <= v2.0.5 for example, when running in 64bit, allocates its memory in the lower 2GB memory region by using the zero_bits parameter.
This will fix this particular scenario, while trying to minimize the changes on all the other cases.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntdll/tests/virtual.c | 1 - dlls/ntdll/virtual.c | 35 +++++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index e294688f1b3..3f140dc8313 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -55,7 +55,6 @@ static void test_AllocateVirtualMemory(void) zero_bits = 1; status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 1, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); - todo_wine ok(((status == STATUS_SUCCESS || status == STATUS_NO_MEMORY) && ((UINT_PTR)addr2 >> (32 - zero_bits)) == 0) || broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */, "NtAllocateVirtualMemory returned %08x, addr2: %p\n", status, addr2); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index a3ed96ff77f..84c9ec97ed3 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1083,7 +1083,7 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot ) * The csVirtual section must be held by caller. */ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, size_t mask, - int top_down, unsigned int vprot ) + int top_down, unsigned int vprot, size_t zero_bits ) { void *ptr; NTSTATUS status; @@ -1100,11 +1100,26 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, { size_t view_size = size + mask + 1; struct alloc_area alloc; + int flags = 0;
alloc.size = size; alloc.mask = mask; alloc.top_down = top_down; alloc.limit = user_space_limit; + +#if defined(__x86_64__) && defined(MAP_32BIT) + /* HACK: only works for zero_bits == 1, this is a simple workaround + * for some 64bit code that tries to allocate memory in the lower + * 2GB segment using zero_bits parameter. + */ + assert(zero_bits <= 1); + if (zero_bits == 1) + { + alloc.limit = (void*)(((~(UINT_PTR)0) >> (32 + zero_bits)) & ~0xffff); + flags = MAP_32BIT; + } +#endif + if (wine_mmap_enum_reserved_areas( alloc_reserved_area_callback, &alloc, top_down )) { ptr = alloc.result; @@ -1116,7 +1131,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
for (;;) { - if ((ptr = wine_anon_mmap( NULL, view_size, VIRTUAL_GetUnixProt(vprot), 0 )) == (void *)-1) + if ((ptr = wine_anon_mmap( NULL, view_size, VIRTUAL_GetUnixProt(vprot), flags )) == (void *)-1) { if (errno == ENOMEM) return STATUS_NO_MEMORY; return STATUS_INVALID_PARAMETER; @@ -1284,7 +1299,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot if (addr != low_64k) { if (addr != (void *)-1) munmap( addr, dosmem_size - 0x10000 ); - return map_view( view, NULL, dosmem_size, 0xffff, 0, vprot ); + return map_view( view, NULL, dosmem_size, 0xffff, 0, vprot, 0 ); } }
@@ -1388,11 +1403,11 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T m
if (base >= (char *)address_space_start) /* make sure the DOS area remains free */ status = map_view( &view, base, total_size, mask, FALSE, SEC_IMAGE | SEC_FILE | - VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY ); + VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, 0 );
if (status != STATUS_SUCCESS) status = map_view( &view, NULL, total_size, mask, FALSE, SEC_IMAGE | SEC_FILE | - VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY ); + VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY, 0 );
if (status != STATUS_SUCCESS) goto error;
@@ -1713,7 +1728,7 @@ NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG zero_bits, S get_vprot_flags( protect, &vprot, sec_flags & SEC_IMAGE ); vprot |= sec_flags; if (!(sec_flags & SEC_RESERVE)) vprot |= VPROT_COMMITTED; - res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot ); + res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot, 0 ); if (res) { server_leave_uninterrupted_section( &csVirtual, &sigset ); @@ -1946,7 +1961,7 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi server_enter_uninterrupted_section( &csVirtual, &sigset );
if ((status = map_view( &view, NULL, size + extra_size, 0xffff, 0, - VPROT_READ | VPROT_WRITE | VPROT_COMMITTED )) != STATUS_SUCCESS) + VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, 0 )) != STATUS_SUCCESS) goto done;
#ifdef VALGRIND_STACK_REGISTER @@ -2467,7 +2482,11 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_ TRACE("%p %p %08lx %x %08x\n", process, *ret, size, type, protect );
if (!size) return STATUS_INVALID_PARAMETER; +#if defined(__x86_64__) && !defined(MAP_32BIT) if (zero_bits) +#else + if (zero_bits > 1) +#endif { FIXME("Unimplemented zero_bits handling\n"); return STATUS_INVALID_PARAMETER_3; @@ -2569,7 +2588,7 @@ NTSTATUS virtual_alloc_aligned( PVOID *ret, ULONG zero_bits, SIZE_T *size_ptr,
if (vprot & VPROT_WRITECOPY) status = STATUS_INVALID_PAGE_PROTECTION; else if (is_dos_memory) status = allocate_dos_memory( &view, vprot ); - else status = map_view( &view, base, size, mask, type & MEM_TOP_DOWN, vprot ); + else status = map_view( &view, base, size, mask, type & MEM_TOP_DOWN, vprot, zero_bits );
if (status == STATUS_SUCCESS) base = view->base; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53128
Your paranoid android.
=== wvistau64 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_zh_CN (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_fr (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== wvistau64_he (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w2008s64 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w7u (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w7pro64 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w8 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w8adm (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w864 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w1064v1507 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022
=== w1064v1809 (32 bit report) ===
kernel32: virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 0, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2897: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2911: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3036: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3054: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3135: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3159: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2841: Test failed: expected policy flags 1, got 3 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:2940: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:2955: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3003: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3018: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3199: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3224: Test failed: expected no STATUS_ACCESS_VIOLATION exception, got 1 exceptions virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2803: Test failed: NtSetInformationProcess failed with status c0000022 virtual.c:2842: Test failed: expected policy permanent FALSE, got 1 virtual.c:3261: Test failed: NtSetInformationProcess failed with status c0000022