[PATCH v2 8/8] ntdll/tests: Use MEM_TOP_DOWN parameter to consistently fail zero_bits tests

Rémi Bernon rbernon at codeweavers.com
Fri Jun 14 08:11:17 CDT 2019


The todo_wine_if made the tests not really test anything, and one test
was succeeding when it shouldn't. Now we can actually remove the todo
when 1 zero_bits handling is implemented.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntdll/tests/virtual.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
index a338bf1db09..f7fde7c6550 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.c
@@ -74,12 +74,14 @@ static void test_AllocateVirtualMemory(void)
     addr2 = NULL;
     zero_bits = 1;
     status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                     MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                     MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                     PAGE_READWRITE);
     ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
        broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */,
        "NtAllocateVirtualMemory returned %08x\n", status);
     if (status == STATUS_SUCCESS)
     {
+        todo_wine_if(is_win64)
         ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
            "NtAllocateVirtualMemory returned address: %p\n", addr2);
 
@@ -93,13 +95,14 @@ static void test_AllocateVirtualMemory(void)
         size = 0x1000;
         addr2 = NULL;
         status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                         MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                         MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                         PAGE_READWRITE);
         ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
            broken(zero_bits == 20 && status == STATUS_CONFLICTING_ADDRESSES) /* w1064v1809 */,
            "NtAllocateVirtualMemory with %d zero_bits returned %08x\n", zero_bits, status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)addr2 >> (32 - zero_bits))
+            todo_wine
             ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
                "NtAllocateVirtualMemory with %d zero_bits returned address %p\n", zero_bits, addr2);
 
@@ -139,7 +142,8 @@ static void test_AllocateVirtualMemory(void)
     addr2 = NULL;
     zero_bits = 0x1fffffff;
     status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                      MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                      MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                      PAGE_READWRITE);
 
     if (!is_win64 && !is_wow64)
     {
@@ -151,7 +155,7 @@ static void test_AllocateVirtualMemory(void)
            "NtAllocateVirtualMemory returned %08x\n", status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)addr2 & ~zero_bits)
+            todo_wine
             ok(((UINT_PTR)addr2 & ~zero_bits) == 0,
                "NtAllocateVirtualMemory returned address %p\n", addr2);
 
@@ -206,12 +210,12 @@ static void test_MapViewOfSection(void)
     size = 0;
     zero_bits = 1;
     offset.QuadPart = 0;
-    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
     ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
        "NtMapViewOfSection returned %08x\n", status);
     if (status == STATUS_SUCCESS)
     {
-        todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits))
+        todo_wine_if(is_win64)
         ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
            "NtMapViewOfSection returned address: %p\n", ptr2);
 
@@ -224,12 +228,12 @@ static void test_MapViewOfSection(void)
         ptr2 = NULL;
         size = 0;
         offset.QuadPart = 0;
-        status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+        status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
         ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
            "NtMapViewOfSection with %d zero_bits returned %08x\n", zero_bits, status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits))
+            todo_wine
             ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
                "NtMapViewOfSection with %d zero_bits returned address %p\n", zero_bits, ptr2);
 
@@ -267,7 +271,7 @@ static void test_MapViewOfSection(void)
     size = 0;
     zero_bits = 0x1fffffff;
     offset.QuadPart = 0;
-    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
 
     if (!is_win64 && !is_wow64)
     {
@@ -279,7 +283,7 @@ static void test_MapViewOfSection(void)
            "NtMapViewOfSection returned %08x\n", status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)ptr2 & ~zero_bits)
+            todo_wine
             ok(((UINT_PTR)ptr2 & ~zero_bits) == 0,
                "NtMapViewOfSection returned address %p\n", ptr2);
 
-- 
2.20.1




More information about the wine-devel mailing list