Nikolay Sivov : kernel32/tests: Extend VirtualAllocEx() tests.

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


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri May 20 09:36:51 2022 +0300

kernel32/tests: Extend VirtualAllocEx() tests.

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

---

 dlls/kernel32/tests/virtual.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 365194b9065..6d4d34e2e81 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -78,11 +78,21 @@ static void test_VirtualAllocEx(void)
     char *src, *dst;
     SIZE_T bytes_written = 0, bytes_read = 0, i;
     void *addr1, *addr2;
-    BOOL b;
+    BOOL b, ret;
     DWORD old_prot;
     MEMORY_BASIC_INFORMATION info;
     HANDLE hProcess;
 
+    /* Same process */
+    addr1 = VirtualAllocEx(GetCurrentProcess(), NULL, alloc_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    ok(!!addr1, "Failed to allocated, error %lu.\n", GetLastError());
+    ret = VirtualFreeEx(NULL, addr1, 0, MEM_RELEASE);
+    ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "Unexpected value %d, error %lu.\n", ret, GetLastError());
+    addr2 = VirtualAllocEx(NULL, NULL, alloc_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    ok(!addr2 && GetLastError() == ERROR_INVALID_HANDLE, "Unexpected value %p, error %lu.\n", addr2, GetLastError());
+    ret = VirtualFreeEx(GetCurrentProcess(), addr1, 0, MEM_RELEASE);
+    ok(ret, "Unexpected value %d, error %lu.\n", ret, GetLastError());
+
     hProcess = create_target_process("sleep");
     ok(hProcess != NULL, "Can't start process\n");
 




More information about the wine-cvs mailing list