[NTOSKRNL]
[reactos.git] / ntoskrnl / mm / marea.c
index 92aacb8..e2a8243 100644 (file)
@@ -356,6 +356,12 @@ NTAPI
 MiInsertVad(IN PMMVAD Vad,
 IN PEPROCESS Process);
 
+ULONG
+NTAPI
+MiMakeProtectionMask(
+    IN ULONG Protect
+);
+
 static VOID
 MmInsertMemoryArea(
    PMMSUPPORT AddressSpace,
@@ -368,8 +374,9 @@ MmInsertMemoryArea(
    /* Build a lame VAD if this is a user-space allocation */
    if ((marea->EndingAddress < MmSystemRangeStart) && (marea->Type != MEMORY_AREA_OWNED_BY_ARM3))
    {
-       ASSERT(marea->Type == MEMORY_AREA_VIRTUAL_MEMORY || marea->Type == MEMORY_AREA_SECTION_VIEW);
        PMMVAD Vad;
+
+       ASSERT(marea->Type == MEMORY_AREA_VIRTUAL_MEMORY || marea->Type == MEMORY_AREA_SECTION_VIEW);
        Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), 'Fake');
        ASSERT(Vad);
        RtlZeroMemory(Vad, sizeof(MMVAD));
@@ -389,6 +396,7 @@ MmInsertMemoryArea(
         }
        Vad->u.VadFlags.Spare = 1;
        Vad->u.VadFlags.PrivateMemory = 1;
+       Vad->u.VadFlags.Protection = MiMakeProtectionMask(marea->Protect);
        MiInsertVad(Vad, MmGetAddressSpaceOwner(AddressSpace));
        marea->Vad = Vad;
    }