mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[NTOS/MM]
- Don't lie about page protection in MiQueryAddressState. Fixes PDFCreator-alike bugs. See issue #5627 for more details. svn path=/trunk/; revision=49296
This commit is contained in:
parent
4434b6bf69
commit
07cd3fc8d0
1 changed files with 45 additions and 3 deletions
|
@ -1048,6 +1048,48 @@ MmFlushVirtualMemory(IN PEPROCESS Process,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
MiGetPageProtection(IN PMMPTE PointerPte)
|
||||||
|
{
|
||||||
|
MMPTE TempPte;
|
||||||
|
PMMPFN Pfn;
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
/* Copy this PTE's contents */
|
||||||
|
TempPte = *PointerPte;
|
||||||
|
|
||||||
|
/* Assure it's not totally zero */
|
||||||
|
ASSERT(TempPte.u.Long);
|
||||||
|
|
||||||
|
/* Check for a special prototype format */
|
||||||
|
if (TempPte.u.Soft.Valid == 0 &&
|
||||||
|
TempPte.u.Soft.Prototype == 1)
|
||||||
|
{
|
||||||
|
/* Unsupported now */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
ASSERT(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In the easy case of transition or demand zero PTE just return its protection */
|
||||||
|
if (!TempPte.u.Hard.Valid) return MmProtectToValue[TempPte.u.Soft.Protection];
|
||||||
|
|
||||||
|
/* If we get here, the PTE is valid, so look up the page in PFN database */
|
||||||
|
Pfn = &MmPfnDatabase[TempPte.u.Hard.PageFrameNumber];
|
||||||
|
|
||||||
|
if (!Pfn->u3.e1.PrototypePte)
|
||||||
|
{
|
||||||
|
/* Return protection of the original pte */
|
||||||
|
return MmProtectToValue[Pfn->OriginalPte.u.Soft.Protection];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is hardware PTE */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
ASSERT(FALSE);
|
||||||
|
|
||||||
|
return PAGE_NOACCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
MiQueryAddressState(IN PVOID Va,
|
MiQueryAddressState(IN PVOID Va,
|
||||||
|
@ -1120,8 +1162,8 @@ MiQueryAddressState(IN PVOID Va,
|
||||||
/* This means it's committed */
|
/* This means it's committed */
|
||||||
State = MEM_COMMIT;
|
State = MEM_COMMIT;
|
||||||
|
|
||||||
/* For now, we lie about the protection */
|
/* Get protection state of this page */
|
||||||
Protect = PAGE_EXECUTE_READWRITE;
|
Protect = MiGetPageProtection(PointerPte);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue