Nikolay Sivov : ntdll/tests: Add a basic test for MEM_RESERVE_PLACEHOLDER.

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:47 CDT 2022


Module: wine
Branch: master
Commit: 811a0e0b068cc3ea8ed1104e100d1e08724e7191
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=811a0e0b068cc3ea8ed1104e100d1e08724e7191

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri May 20 13:20:19 2022 +0300

ntdll/tests: Add a basic test for MEM_RESERVE_PLACEHOLDER.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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




More information about the wine-cvs mailing list