Author: fireball
Date: Thu Oct  7 07:56:26 2010
New Revision: 49029

URL: http://svn.reactos.org/svn/reactos?rev=49029&view=rev
Log:
[WIN32K]
- Roel Messiant: Return correct address in the user heap commit routine. Should 
fix boot with the new heap manager.

Modified:
    trunk/reactos/subsystems/win32/win32k/misc/usrheap.c

Modified: trunk/reactos/subsystems/win32/win32k/misc/usrheap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/misc/usrheap.c?rev=49029&r1=49028&r2=49029&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/misc/usrheap.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/misc/usrheap.c [iso-8859-1] Thu Oct  
7 07:56:26 2010
@@ -32,7 +32,8 @@
     PW32HEAP_USER_MAPPING Mapping;
     PVOID UserBase = NULL;
     NTSTATUS Status;
-    SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
+    SIZE_T Delta;
+    PVOID UserCommitAddress;
 
     W32Process = PsGetCurrentProcessWin32Process();
 
@@ -79,18 +80,23 @@
             return Status;
     }
 
-    /* commit! */
-    UserBase = (PVOID)((ULONG_PTR)UserBase + Delta);
-
+    /* Apply the commit address offset to the user base address */
+    Delta = (SIZE_T) ((ULONG_PTR) (*CommitAddress) - (ULONG_PTR) (Base));
+    UserCommitAddress = (PVOID) ((ULONG_PTR) (UserBase) + Delta);
+
+    /* Perform the actual commit */
     Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
-                                     &UserBase,
+                                     &UserCommitAddress,
                                      0,
                                      CommitSize,
                                      MEM_COMMIT,
                                      PAGE_EXECUTE_READ);
+
     if (NT_SUCCESS(Status))
     {
-        *CommitAddress = (PVOID)((ULONG_PTR)UserBase + Delta);
+        /* Determine the address to return */
+        Delta = (SIZE_T) ((ULONG_PTR) (UserCommitAddress) - (ULONG_PTR) 
(UserBase));
+        *CommitAddress = (PVOID) ((ULONG_PTR) (Base) + Delta);
     }
 
     if (W32Process == NULL)


Reply via email to