[NTOSKRNL]

Small impovement to NtFreeVirtualMemory to make things clearer

svn path=/trunk/; revision=64585
This commit is contained in:
Timo Kreuzer 2014-10-08 00:30:37 +00:00
parent 27b5c44ea3
commit ca00c95ea5

View file

@ -5134,7 +5134,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
PMEMORY_AREA MemoryArea; PMEMORY_AREA MemoryArea;
SIZE_T PRegionSize; SIZE_T PRegionSize;
PVOID PBaseAddress; PVOID PBaseAddress;
LONG_PTR CommitReduction = 0; LONG_PTR AlreadyDecommitted, CommitReduction = 0;
ULONG_PTR StartingAddress, EndingAddress; ULONG_PTR StartingAddress, EndingAddress;
PMMVAD Vad; PMMVAD Vad;
NTSTATUS Status; NTSTATUS Status;
@ -5530,13 +5530,15 @@ FinalPath:
// Decommit the PTEs for the range plus the actual backing pages for the // Decommit the PTEs for the range plus the actual backing pages for the
// range, then reduce that amount from the commit charge in the VAD // range, then reduce that amount from the commit charge in the VAD
// //
AlreadyDecommitted = MiDecommitPages((PVOID)StartingAddress,
MiAddressToPte(EndingAddress),
Process,
Vad);
CommitReduction = MiAddressToPte(EndingAddress) - CommitReduction = MiAddressToPte(EndingAddress) -
MiAddressToPte(StartingAddress) + MiAddressToPte(StartingAddress) +
1 - 1 -
MiDecommitPages((PVOID)StartingAddress, AlreadyDecommitted;
MiAddressToPte(EndingAddress),
Process,
Vad);
ASSERT(CommitReduction >= 0); ASSERT(CommitReduction >= 0);
Vad->u.VadFlags.CommitCharge -= CommitReduction; Vad->u.VadFlags.CommitCharge -= CommitReduction;
ASSERT(Vad->u.VadFlags.CommitCharge >= 0); ASSERT(Vad->u.VadFlags.CommitCharge >= 0);