[NTOSKRNL/MM]

- The initial region does not necessarily begins with the asked address, calculate remaining space acccordingly.

svn path=/trunk/; revision=52616
This commit is contained in:
Jérôme Gardou
2011-07-10 19:24:49 +00:00
parent a149b1c33b
commit c34fe70bfe
+9 -5
View File
@@ -135,16 +135,20 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress,
{
return(STATUS_NO_MEMORY);
}
if(NewRegion->Length < Length)
RemainingLength = Length - NewRegion->Length;
else
RemainingLength = 0;
}
else
{
NewRegion = InitialRegion;
if(((ULONG_PTR)InitialBaseAddress + NewRegion->Length) <
((ULONG_PTR)StartAddress + Length))
RemainingLength = ((ULONG_PTR)StartAddress + Length) - ((ULONG_PTR)InitialBaseAddress + NewRegion->Length);
else
RemainingLength = 0;
}
if(NewRegion->Length < Length)
RemainingLength = Length - NewRegion->Length;
else
RemainingLength = 0;
/*
* Free any complete regions that are containing in the range of addresses