From 811a0e0b068cc3ea8ed1104e100d1e08724e7191 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 20 May 2022 13:20:19 +0300 Subject: [PATCH] ntdll/tests: Add a basic test for MEM_RESERVE_PLACEHOLDER. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/virtual.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 74e3facca13..f8bb3e97c86 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -264,6 +264,12 @@ static void test_NtAllocateVirtualMemory(void) ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %lx\n", status); ok( size == 0x10000, "wrong size %Ix\n", size ); ok( addr2 == addr1, "wrong addr %p\n", addr2 ); + + /* Placeholder functionality */ + size = 0x10000; + addr1 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS); + ok(!!status, "Unexpected status %08lx.\n", status); } static void test_NtAllocateVirtualMemoryEx(void) @@ -298,6 +304,24 @@ static void test_NtAllocateVirtualMemoryEx(void) addr1 = NULL; status = pNtAllocateVirtualMemoryEx(NULL, &addr1, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE, NULL, 0); ok(status == STATUS_INVALID_HANDLE, "Unexpected status %08lx.\n", status); + + /* Placeholder functionality */ + size = 0x10000; + addr1 = NULL; + status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS); + ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %08lx.\n", status); + + status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, + PAGE_NOACCESS, NULL, 0); + todo_wine + ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status); + + if (addr1) + { + size = 0; + status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status); + } } struct test_stack_size_thread_args