From 116c718a53069ace02ebaa9574af7ab6f558af66 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 20 May 2022 09:36:51 +0300 Subject: [PATCH] kernel32/tests: Extend VirtualAllocEx() tests. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- 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");