[Wine-patches] ntoskrnl.exe: Change used memory mask and size, fix second argument of VirtualFree (eterbug #2887).

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Ср Дек 3 17:52:19 MSK 2008


----------- следующая часть -----------
From 192476c58b831db8d38de51a7f199b26bc515e41 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Wed, 3 Dec 2008 17:42:50 +0300
Subject: [PATCH] ntoskrnl.exe: Change used memory mask and size, fix second argument of VirtualFree (eterbug #2887).

---
 dlls/ntoskrnl.exe/ntoskrnl.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 1fd950b..cf48a81 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -84,8 +84,8 @@ struct MemoryRegion
 };
 
 #ifdef __i386__
-#define page_mask 0xfff
-#define page_size 0x1000
+#define mem_mask 0xffff
+#define mem_size 0x10000
 #endif
 
 static DWORD pid; /* ID of the process which calls IOCTL */
@@ -166,12 +166,12 @@ static int map_memory( void *addr )
     mr = ExAllocatePool( NonPagedPool, sizeof(struct MemoryRegion) );
     if (mr == NULL)
         return 1;
-    addr = (void *)((unsigned int)addr & ~page_mask);
-    mr->ptr = VirtualAlloc( addr, page_size, MEM_COMMIT | MEM_RESERVE,
+    addr = (void *)((unsigned int)addr & ~mem_mask);
+    mr->ptr = VirtualAlloc( addr, mem_size, MEM_COMMIT | MEM_RESERVE,
             PAGE_EXECUTE_READWRITE );
     if (mr->ptr == NULL)
     {
-        mr->ptr = VirtualAlloc( addr, page_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
+        mr->ptr = VirtualAlloc( addr, mem_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
         if (mr->ptr == NULL)
         {
             ExFreePool( mr );
@@ -184,11 +184,11 @@ static int map_memory( void *addr )
     process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pid );
     if (process == NULL)
     {
-        VirtualFree( mr->ptr, page_size, mr->release ? MEM_RELEASE : MEM_DECOMMIT );
+        VirtualFree( mr->ptr, mem_size, mr->release ? MEM_RELEASE : MEM_DECOMMIT );
         ExFreePool( mr );
         return 1;
     }
-    NtReadVirtualMemory( process, mr->ptr, mr->ptr, page_size, NULL );
+    NtReadVirtualMemory( process, mr->ptr, mr->ptr, mem_size, NULL );
     CloseHandle( process );
     list_add_tail( &MemoryList, &mr->entry );
     return 0;
@@ -204,10 +204,10 @@ static void unmap_memory(void)
         process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pid );
         if (process != NULL)
         {
-            NtWriteVirtualMemory( process, mr->ptr, mr->ptr, page_size, NULL );
+            NtWriteVirtualMemory( process, mr->ptr, mr->ptr, mem_size, NULL );
             CloseHandle( process );
         }
-        VirtualFree( mr->ptr, page_size, mr->release ? MEM_RELEASE : MEM_DECOMMIT );
+        VirtualFree( mr->ptr, 0, mr->release ? MEM_RELEASE : MEM_DECOMMIT );
         list_remove( &mr->entry );
         ExFreePool( mr );
     }
-- 
1.6.0.2.GIT



Подробная информация о списке рассылки Wine-patches