Sebastian Lackner : kernel32/tests: Ensure VirtualAlloc tests do not depend on previous memory allocations.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 15 09:41:49 CST 2016


Module: wine
Branch: master
Commit: 1e624c5aaa7d66438d297965576e2046b6e71b78
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e624c5aaa7d66438d297965576e2046b6e71b78

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sat Feb 13 22:25:48 2016 +0100

kernel32/tests: Ensure VirtualAlloc tests do not depend on previous memory allocations.

Following tests try to allocate memory at (char *)addr1 + 0x1000.
We expect that no memory is mapped at this location.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index f47a54c..c35f4db 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -383,9 +383,13 @@ static void test_VirtualAlloc(void)
 
     ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
 
-    addr1 = VirtualAlloc(0, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    /* memory returned by VirtualAlloc should be aligned to 64k */
+    addr1 = VirtualAlloc(0, 0x2000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
     ok(addr1 != NULL, "VirtualAlloc failed\n");
     ok(!((ULONG_PTR)addr1 & 0xffff), "returned memory %p is not aligned to 64k\n", addr1);
+    ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
+    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;




More information about the wine-cvs mailing list