Author: fireball
Date: Tue Sep 23 07:41:02 2008
New Revision: 36427
URL:
http://svn.reactos.org/svn/reactos?rev=36427&view=rev
Log:
- In success cases of NtAllocateVirtualMemory, return the real (page rounded!) base
address and region size, not the possibly unaligned pointer and length which were passed
to the function. These cases were hit when a region of memory was previously reserved,
then a commit request came with unaligned base address and length, which match that
previously reserved region after aligning.
Modified:
trunk/reactos/ntoskrnl/mm/anonmem.c
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/anonmem.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] Tue Sep 23 07:41:02 2008
@@ -727,6 +727,15 @@
MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process);
DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
+
+ /* Give the caller rounded BaseAddress and area length */
+ if (NT_SUCCESS(Status))
+ {
+ *UBaseAddress = BaseAddress;
+ *URegionSize = RegionSize;
+ DPRINT("*UBaseAddress %x *URegionSize %x\n", BaseAddress,
RegionSize);
+ }
+
return(Status);
}
else if (MemoryAreaLength >= RegionSize)
@@ -749,6 +758,15 @@
MmUnlockAddressSpace(AddressSpace);
ObDereferenceObject(Process);
DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
+
+ /* Give the caller rounded BaseAddress and area length */
+ if (NT_SUCCESS(Status))
+ {
+ *UBaseAddress = BaseAddress;
+ *URegionSize = RegionSize;
+ DPRINT("*UBaseAddress %x *URegionSize %x\n", BaseAddress,
RegionSize);
+ }
+
return(Status);
}
else