Alexandre Julliard : ntdll: Report memory areas in DOS memory to be free even when not reserved.

Alexandre Julliard julliard at winehq.org
Thu Nov 4 12:52:53 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Nov  4 17:32:42 2010 +0100

ntdll: Report memory areas in DOS memory to be free even when not reserved.

---

 dlls/ntdll/virtual.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index b97bdd2..1674a3e 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -137,6 +137,7 @@ static void *address_space_limit;
 static void *user_space_limit;
 static void *working_set_limit;
 #endif  /* __i386__ */
+static void * const address_space_start = (void *)0x110000;
 
 #define ROUND_ADDR(addr,mask) \
    ((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask)))
@@ -726,7 +727,6 @@ struct alloc_area
  */
 static int alloc_reserved_area_callback( void *start, size_t size, void *arg )
 {
-    static void * const address_space_start = (void *)0x110000;
     struct alloc_area *alloc = arg;
     void *end = (char *)start + size;
 
@@ -2072,7 +2072,7 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg )
         return 0;
     }
 
-    if (info->BaseAddress >= start)
+    if (info->BaseAddress >= start || start <= address_space_start)
     {
         /* it's a real free area */
         info->State             = MEM_FREE;
@@ -2203,17 +2203,22 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
         {
             /* not in a reserved area at all, pretend it's allocated */
 #ifdef __i386__
-            info->State             = MEM_RESERVE;
-            info->Protect           = PAGE_NOACCESS;
-            info->AllocationProtect = PAGE_NOACCESS;
-            info->Type              = MEM_PRIVATE;
-#else
-            info->State             = MEM_FREE;
-            info->Protect           = PAGE_NOACCESS;
-            info->AllocationBase    = 0;
-            info->AllocationProtect = 0;
-            info->Type              = 0;
+            if (base >= (char *)address_space_start)
+            {
+                info->State             = MEM_RESERVE;
+                info->Protect           = PAGE_NOACCESS;
+                info->AllocationProtect = PAGE_NOACCESS;
+                info->Type              = MEM_PRIVATE;
+            }
+            else
 #endif
+            {
+                info->State             = MEM_FREE;
+                info->Protect           = PAGE_NOACCESS;
+                info->AllocationBase    = 0;
+                info->AllocationProtect = 0;
+                info->Type              = 0;
+            }
         }
     }
     else




More information about the wine-cvs mailing list