[ros-diffs] [fireball] 40268: - Pass correct allocation flags to ZwAllocateVirtualMemory. - Don't provide region size when freeing virtual memory (spotted by Evgeniy Boltik, confirmed by MSDN).

fireball at svn.reactos.org fireball at svn.reactos.org
Sat Mar 28 17:53:52 CET 2009


Author: fireball
Date: Sat Mar 28 19:53:51 2009
New Revision: 40268

URL: http://svn.reactos.org/svn/reactos?rev=40268&view=rev
Log:
- Pass correct allocation flags to ZwAllocateVirtualMemory.
- Don't provide region size when freeing virtual memory (spotted by Evgeniy Boltik, confirmed by MSDN).

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/mem.c

Modified: trunk/reactos/subsystems/win32/win32k/eng/mem.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/mem.c?rev=40268&r1=40267&r2=40268&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] Sat Mar 28 19:53:51 2009
@@ -79,7 +79,7 @@
   SIZE_T MemSize = sizeof(USERMEMHEADER) + cj;
   PUSERMEMHEADER Header;
 
-  Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize, MEM_COMMIT, PAGE_READWRITE);
+  Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
 
   if (! NT_SUCCESS(Status))
     {
@@ -100,7 +100,7 @@
 EngFreeUserMem(PVOID pv)
 {
   PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
-  SIZE_T MemSize = sizeof(USERMEMHEADER) + Header->MemSize;
+  SIZE_T MemSize = 0;
 
   ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize, MEM_RELEASE);
 }



More information about the Ros-diffs mailing list