- Do not align the size of a memory area to the allocation granularity, but to PAGE_SIZE. Fixes OllyDbg regression from r61108. CORE-8168 #resolve
- Clarify the size calculation in MmCreateMemoryArea
- Silence a few DPRINTs
svn path=/trunk/; revision=63405
/* Check if this process is the owner, and that the thread owns the WS */
if (PsGetCurrentThread()->OwnsProcessWorkingSetExclusive == 0)
{
- DPRINT1("Thread: %p is not an owner\n", PsGetCurrentThread());
+ DPRINT("Thread: %p is not an owner\n", PsGetCurrentThread());
}
if (KeGetCurrentThread()->ApcState.Process != &Process->Pcb)
{
- DPRINT1("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process);
+ DPRINT("Current thread %p is attached to another process %p\n", PsGetCurrentThread(), Process);
}
return ((KeGetCurrentThread()->ApcState.Process == &Process->Pcb) &&
((PsGetCurrentThread()->OwnsProcessWorkingSetExclusive) ||
}
/* This is software PTE */
- DPRINT1("Prototype PTE: %lx %p\n", TempPte.u.Hard.PageFrameNumber, Pfn);
- DPRINT1("VA: %p\n", MiPteToAddress(&TempPte));
- DPRINT1("Mask: %lx\n", TempPte.u.Soft.Protection);
- DPRINT1("Mask2: %lx\n", Pfn->OriginalPte.u.Soft.Protection);
+ DPRINT("Prototype PTE: %lx %p\n", TempPte.u.Hard.PageFrameNumber, Pfn);
+ DPRINT("VA: %p\n", MiPteToAddress(&TempPte));
+ DPRINT("Mask: %lx\n", TempPte.u.Soft.Protection);
+ DPRINT("Mask2: %lx\n", Pfn->OriginalPte.u.Soft.Protection);
return MmProtectToValue[TempPte.u.Soft.Protection];
}
{
ULONG_PTR tmpLength;
PMEMORY_AREA MemoryArea;
+ ULONG_PTR EndingAddress;
DPRINT("MmCreateMemoryArea(Type 0x%lx, BaseAddress %p, "
"*BaseAddress %p, Length %p, AllocationFlags %x, "
if ((*BaseAddress) == 0 && !FixedAddress)
{
- tmpLength = (ULONG_PTR)MM_ROUND_UP(Length, Granularity);
+ tmpLength = (ULONG_PTR)MM_ROUND_UP(Length, PAGE_SIZE);
*BaseAddress = MmFindGap(AddressSpace,
tmpLength,
Granularity,
}
else
{
- tmpLength = Length + ((ULONG_PTR) *BaseAddress
- - (ULONG_PTR) MM_ROUND_DOWN(*BaseAddress, Granularity));
- tmpLength = (ULONG_PTR)MM_ROUND_UP(tmpLength, Granularity);
- *BaseAddress = MM_ROUND_DOWN(*BaseAddress, Granularity);
+ EndingAddress = ((ULONG_PTR)*BaseAddress + Length - 1) | (PAGE_SIZE - 1);
+ *BaseAddress = ALIGN_DOWN_POINTER_BY(*BaseAddress, Granularity);
+ tmpLength = EndingAddress + 1 - (ULONG_PTR)*BaseAddress;
if (!MmGetAddressSpaceOwner(AddressSpace) && *BaseAddress < MmSystemRangeStart)
{