From 22c7de15e6b0bb6cd9be8697ec9f9a8afde4cd1b Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 23 Sep 2008 12:41:02 +0000 Subject: [PATCH] - 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. svn path=/trunk/; revision=36427 --- reactos/ntoskrnl/mm/anonmem.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/reactos/ntoskrnl/mm/anonmem.c b/reactos/ntoskrnl/mm/anonmem.c index e7e68b48841..967e749b74a 100644 --- a/reactos/ntoskrnl/mm/anonmem.c +++ b/reactos/ntoskrnl/mm/anonmem.c @@ -727,6 +727,15 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle, 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 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle, 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