mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 19:26:33 +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:
@@ -1048,6 +1048,48 @@ MmFlushVirtualMemory(IN PEPROCESS Process,
|
||||
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
|
||||
NTAPI
|
||||
MiQueryAddressState(IN PVOID Va,
|
||||
@@ -1119,9 +1161,9 @@ MiQueryAddressState(IN PVOID Va,
|
||||
{
|
||||
/* This means it's committed */
|
||||
State = MEM_COMMIT;
|
||||
|
||||
/* For now, we lie about the protection */
|
||||
Protect = PAGE_EXECUTE_READWRITE;
|
||||
|
||||
/* Get protection state of this page */
|
||||
Protect = MiGetPageProtection(PointerPte);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user