diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index 9a7f716..9b409b7 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -1429,6 +1429,20 @@ CcRosInitializeFileCache (
         OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
         InsertTailList(&CcCleanSharedCacheMapList, &SharedCacheMap->SharedCacheMapLinks);
         KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
+
+        /* If the file was already mapped in a Mm section, add us an extra
+         * reference so that we don't attempt to free segments while
+         * Mm still uses them. Mm will take care of dereferencing us.
+         */
+        if (FileObject->SectionObjectPointer->DataSectionObject != NULL ||
+            FileObject->SectionObjectPointer->ImageSectionObject != NULL)
+        {
+            DPRINT("%wZ is already mapped!\n", &FileObject->FileName);
+            /* Equivalent to CcRosReferenceCache, but we already
+             * own ViewLock
+             */
+            SharedCacheMap->OpenCount++;
+        }
     }
     if (FileObject->PrivateCacheMap == NULL)
     {
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index e79ff5f..feb9803 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -819,6 +819,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject)
             {
                 DPRINT1("Image segment %lu still referenced (was %lu)\n", i,
                         SectionSegments[i].ReferenceCount);
+                DPRINT1("File was: %wZ\n", &FileObject->FileName);
                 KeBugCheck(MEMORY_MANAGEMENT);
             }
             MmFreePageTablesSectionSegment(&SectionSegments[i], NULL);
@@ -908,7 +909,6 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
         SWAPENTRY SavedSwapEntry;
         PFN_NUMBER Page;
 #ifndef NEWCC
-        PROS_SHARED_CACHE_MAP SharedCacheMap;
         BOOLEAN IsImageSection;
         LARGE_INTEGER FileOffset;
 
@@ -927,17 +927,17 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
                     (Offset->QuadPart + PAGE_SIZE <= Segment->RawLength.QuadPart || !IsImageSection))
             {
                 NTSTATUS Status;
-                SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
-                IsDirectMapped = TRUE;
-#ifndef NEWCC
-                Status = CcRosUnmapVacb(SharedCacheMap, FileOffset.QuadPart, Dirty);
-#else
-                Status = STATUS_SUCCESS;
-#endif
-                if (!NT_SUCCESS(Status))
+
+                if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
                 {
-                    DPRINT1("CcRosUnmapVacb failed, status = %x\n", Status);
-                    KeBugCheck(MEMORY_MANAGEMENT);
+                    IsDirectMapped = TRUE;
+
+                    Status = CcRosUnmapVacb(FileObject->SectionObjectPointer->SharedCacheMap, FileOffset.QuadPart, Dirty);
+                    if (!NT_SUCCESS(Status))
+                    {
+                        DPRINT1("CcRosUnmapVacb failed, status = %x\n", Status);
+                        KeBugCheck(MEMORY_MANAGEMENT);
+                    }
                 }
             }
 #endif
@@ -1091,121 +1091,124 @@ MiReadPage(PMEMORY_AREA MemoryArea,
     FileOffset = SegOffset + MemoryArea->Data.SectionData.Segment->Image.FileOffset;
     IsImageSection = MemoryArea->Data.SectionData.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE;
 
-    ASSERT(SharedCacheMap);
-
     DPRINT("%S %I64x\n", FileObject->FileName.Buffer, FileOffset);
 
-    /*
-     * If the file system is letting us go directly to the cache and the
-     * memory area was mapped at an offset in the file which is page aligned
-     * then get the related VACB.
-     */
-    if (((FileOffset % PAGE_SIZE) == 0) &&
-            ((SegOffset + PAGE_SIZE <= RawLength) || !IsImageSection) &&
-            !(MemoryArea->Data.SectionData.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED))
+    /* Two cases: the file is cached, or it isn't */
+    if (SharedCacheMap == NULL)
     {
+        KEVENT Event;
+        IO_STATUS_BLOCK IoStatus;
+        PMDL Mdl;
 
         /*
-         * Get the related VACB; we use a lower level interface than
-         * filesystems do because it is safe for us to use an offset with an
-         * alignment less than the file system block size.
+         * Allocate a page, this is rather complicated by the possibility
+         * we might have to move other things out of memory
          */
-        Status = CcRosGetVacb(SharedCacheMap,
-                              FileOffset,
-                              &BaseOffset,
-                              &BaseAddress,
-                              &UptoDate,
-                              &Vacb);
+        MI_SET_USAGE(MI_USAGE_SECTION);
+        MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
+        Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
         if (!NT_SUCCESS(Status))
         {
             return(Status);
         }
-        if (!UptoDate)
+
+        Mdl = IoAllocateMdl(NULL, PAGE_SIZE, FALSE, FALSE, NULL);
+        if (Mdl == NULL)
         {
-            /*
-             * If the VACB isn't up to date then call the file
-             * system to read in the data.
-             */
-            Status = CcReadVirtualAddress(Vacb);
-            if (!NT_SUCCESS(Status))
-            {
-                CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
-                return Status;
-            }
+            return STATUS_INSUFFICIENT_RESOURCES;
         }
 
-        /* Probe the page, since it's PDE might not be synced */
-        (void)*((volatile char*)BaseAddress + FileOffset - BaseOffset);
+        MmBuildMdlFromPages(Mdl, Page);
+        Mdl->MdlFlags |= MDL_PAGES_LOCKED;
 
-        /*
-         * Retrieve the page from the view that we actually want.
-         */
-        (*Page) = MmGetPhysicalAddress((char*)BaseAddress +
-                                       FileOffset - BaseOffset).LowPart >> PAGE_SHIFT;
+        KeInitializeEvent(&Event, NotificationEvent, FALSE);
+        Status = IoPageRead(FileObject, Mdl, (PLARGE_INTEGER)&FileOffset, &Event, &IoStatus);
+        if (Status == STATUS_PENDING)
+        {
+            KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
+            Status = IoStatus.Status;
+        }
+        if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA)
+        {
+            MmUnmapLockedPages (Mdl->MappedSystemVa, Mdl);
+        }
 
-        CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, TRUE);
+        IoFreeMdl(Mdl);
     }
     else
     {
-        PEPROCESS Process;
-        KIRQL Irql;
-        PVOID PageAddr;
-        LONGLONG VacbOffset;
-
         /*
-         * Allocate a page, this is rather complicated by the possibility
-         * we might have to move other things out of memory
+         * If the file system is letting us go directly to the cache and the
+         * memory area was mapped at an offset in the file which is page aligned
+         * then get the related VACB.
          */
-        MI_SET_USAGE(MI_USAGE_SECTION);
-        MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
-        Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
-        if (!NT_SUCCESS(Status))
-        {
-            return(Status);
-        }
-        Status = CcRosGetVacb(SharedCacheMap,
-                              FileOffset,
-                              &BaseOffset,
-                              &BaseAddress,
-                              &UptoDate,
-                              &Vacb);
-        if (!NT_SUCCESS(Status))
-        {
-            return(Status);
-        }
-        if (!UptoDate)
+        if (((FileOffset % PAGE_SIZE) == 0) &&
+                ((SegOffset + PAGE_SIZE <= RawLength) || !IsImageSection) &&
+                !(MemoryArea->Data.SectionData.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED))
         {
+
             /*
-             * If the VACB isn't up to date then call the file
-             * system to read in the data.
+             * Get the related VACB; we use a lower level interface than
+             * filesystems do because it is safe for us to use an offset with an
+             * alignment less than the file system block size.
              */
-            Status = CcReadVirtualAddress(Vacb);
+            Status = CcRosGetVacb(SharedCacheMap,
+                                  FileOffset,
+                                  &BaseOffset,
+                                  &BaseAddress,
+                                  &UptoDate,
+                                  &Vacb);
             if (!NT_SUCCESS(Status))
             {
-                CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
-                return Status;
+                return(Status);
+            }
+            if (!UptoDate)
+            {
+                /*
+                 * If the VACB isn't up to date then call the file
+                 * system to read in the data.
+                 */
+                Status = CcReadVirtualAddress(Vacb);
+                if (!NT_SUCCESS(Status))
+                {
+                    CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
+                    return Status;
+                }
             }
-        }
 
-        Process = PsGetCurrentProcess();
-        PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
-        VacbOffset = BaseOffset + VACB_MAPPING_GRANULARITY - FileOffset;
-        Length = RawLength - SegOffset;
-        if (Length <= VacbOffset && Length <= PAGE_SIZE)
-        {
-            memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, Length);
-        }
-        else if (VacbOffset >= PAGE_SIZE)
-        {
-            memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, PAGE_SIZE);
+            /* Probe the page, since it's PDE might not be synced */
+            (void)*((volatile char*)BaseAddress + FileOffset - BaseOffset);
+
+            /*
+             * Retrieve the page from the view that we actually want.
+             */
+            (*Page) = MmGetPhysicalAddress((char*)BaseAddress +
+                                           FileOffset - BaseOffset).LowPart >> PAGE_SHIFT;
+
+            CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, TRUE);
+
+            Status = STATUS_SUCCESS;
         }
         else
         {
-            memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, VacbOffset);
-            MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
-            CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
+            PEPROCESS Process;
+            KIRQL Irql;
+            PVOID PageAddr;
+            LONGLONG VacbOffset;
+
+            /*
+             * Allocate a page, this is rather complicated by the possibility
+             * we might have to move other things out of memory
+             */
+            MI_SET_USAGE(MI_USAGE_SECTION);
+            MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
+            Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
+            if (!NT_SUCCESS(Status))
+            {
+                return(Status);
+            }
             Status = CcRosGetVacb(SharedCacheMap,
-                                  FileOffset + VacbOffset,
+                                  FileOffset,
                                   &BaseOffset,
                                   &BaseAddress,
                                   &UptoDate,
@@ -1227,20 +1230,65 @@ MiReadPage(PMEMORY_AREA MemoryArea,
                     return Status;
                 }
             }
+
+            Process = PsGetCurrentProcess();
             PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
-            if (Length < PAGE_SIZE)
+            VacbOffset = BaseOffset + VACB_MAPPING_GRANULARITY - FileOffset;
+            Length = RawLength - SegOffset;
+            if (Length <= VacbOffset && Length <= PAGE_SIZE)
+            {
+                memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, Length);
+            }
+            else if (VacbOffset >= PAGE_SIZE)
             {
-                memcpy((char*)PageAddr + VacbOffset, BaseAddress, Length - VacbOffset);
+                memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, PAGE_SIZE);
             }
             else
             {
-                memcpy((char*)PageAddr + VacbOffset, BaseAddress, PAGE_SIZE - VacbOffset);
+                memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, VacbOffset);
+                MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
+                CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
+                Status = CcRosGetVacb(SharedCacheMap,
+                                      FileOffset + VacbOffset,
+                                      &BaseOffset,
+                                      &BaseAddress,
+                                      &UptoDate,
+                                      &Vacb);
+                if (!NT_SUCCESS(Status))
+                {
+                    return(Status);
+                }
+                if (!UptoDate)
+                {
+                    /*
+                     * If the VACB isn't up to date then call the file
+                     * system to read in the data.
+                     */
+                    Status = CcReadVirtualAddress(Vacb);
+                    if (!NT_SUCCESS(Status))
+                    {
+                        CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
+                        return Status;
+                    }
+                }
+                PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
+                if (Length < PAGE_SIZE)
+                {
+                    memcpy((char*)PageAddr + VacbOffset, BaseAddress, Length - VacbOffset);
+                }
+                else
+                {
+                    memcpy((char*)PageAddr + VacbOffset, BaseAddress, PAGE_SIZE - VacbOffset);
+                }
             }
+            MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
+            CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
+
+            Status = STATUS_SUCCESS;
         }
-        MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
-        CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
     }
-    return(STATUS_SUCCESS);
+
+    return Status;
 }
 #else
 NTSTATUS
@@ -2712,7 +2760,10 @@ MmpDeleteSection(PVOID ObjectBody)
     if (Section->FileObject != NULL)
     {
 #ifndef NEWCC
-        CcRosDereferenceCache(Section->FileObject);
+        if (Section->FileObject->SectionObjectPointer->SharedCacheMap != NULL)
+        {
+            CcRosDereferenceCache(Section->FileObject);
+        }
 #endif
         ObDereferenceObject(Section->FileObject);
         Section->FileObject = NULL;
@@ -2986,8 +3037,7 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
         }
     }
 
-    if (FileObject->SectionObjectPointer == NULL ||
-            FileObject->SectionObjectPointer->SharedCacheMap == NULL)
+    if (FileObject->SectionObjectPointer == NULL)
     {
         ObDereferenceObject(Section);
         ObDereferenceObject(FileObject);
@@ -3060,6 +3110,8 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
         (void)InterlockedIncrementUL(&Segment->ReferenceCount);
         MmLockSectionSegment(Segment);
 
+        DPRINT("%wZ is already mapped\n", &FileObject->FileName);
+
         if (MaximumSize.QuadPart > Segment->RawLength.QuadPart &&
                 !(AllocationAttributes & SEC_RESERVE))
         {
@@ -3071,7 +3123,10 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
     Section->FileObject = FileObject;
     Section->MaximumSize = MaximumSize;
 #ifndef NEWCC
-    CcRosReferenceCache(FileObject);
+    if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
+    {
+        CcRosReferenceCache(FileObject);
+    }
 #endif
     //KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
     *SectionObject = Section;
@@ -3721,14 +3776,6 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
     if (FileObject == NULL)
         return STATUS_INVALID_FILE_FOR_SECTION;
 
-#ifndef NEWCC
-    if (FileObject->SectionObjectPointer->SharedCacheMap == NULL)
-    {
-        DPRINT1("Denying section creation due to missing cache initialization\n");
-        return STATUS_INVALID_FILE_FOR_SECTION;
-    }
-#endif
-
     /*
      * Create the section
      */
@@ -3845,6 +3892,8 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
         Section->ImageSection = ImageSectionObject;
         SectionSegments = ImageSectionObject->Segments;
 
+        DPRINT("%wZ is already mapped\n", &FileObject->FileName);
+
         /*
          * Otherwise just reference all the section segments
          */
@@ -3857,7 +3906,10 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
     }
     Section->FileObject = FileObject;
 #ifndef NEWCC
-    CcRosReferenceCache(FileObject);
+    if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
+    {
+        CcRosReferenceCache(FileObject);
+    }
 #endif
     //KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
     *SectionObject = Section;
@@ -3994,7 +4046,10 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
 #ifndef NEWCC
             FileObject = MemoryArea->Data.SectionData.Section->FileObject;
             SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
-            CcRosMarkDirtyFile(SharedCacheMap, Offset.QuadPart + Segment->Image.FileOffset);
+            if (SharedCacheMap != NULL)
+            {
+                CcRosMarkDirtyFile(SharedCacheMap, Offset.QuadPart + Segment->Image.FileOffset);
+            }
 #endif
             ASSERT(SwapEntry == 0);
         }
@@ -5027,63 +5082,6 @@ MmCreateSection (OUT PVOID  * Section,
         if (AllocationAttributes & SEC_IMAGE) return STATUS_INVALID_FILE_FOR_SECTION;
     }
 
-#ifndef NEWCC // A hack for initializing caching.
-    // This is needed only in the old case.
-    if (FileHandle)
-    {
-        IO_STATUS_BLOCK Iosb;
-        NTSTATUS Status;
-        CHAR Buffer;
-        LARGE_INTEGER ByteOffset;
-        ByteOffset.QuadPart = 0;
-        Status = ZwReadFile(FileHandle,
-                            NULL,
-                            NULL,
-                            NULL,
-                            &Iosb,
-                            &Buffer,
-                            sizeof(Buffer),
-                            &ByteOffset,
-                            NULL);
-        if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
-        {
-            DPRINT1("CC failure: %lx\n", Status);
-            if (FileObject)
-                ObDereferenceObject(FileObject);
-            return Status;
-        }
-        // Caching is initialized...
-
-        // Hack of the hack: actually, it might not be initialized if FSD init on effective right and if file is null-size
-        // In such case, force cache by initiating a write IRP
-        if (Status == STATUS_END_OF_FILE && !(AllocationAttributes & SEC_IMAGE) && FileObject != NULL &&
-            (FileObject->SectionObjectPointer == NULL || FileObject->SectionObjectPointer->SharedCacheMap == NULL))
-        {
-            Buffer = 0xdb;
-            Status = ZwWriteFile(FileHandle,
-                                 NULL,
-                                 NULL,
-                                 NULL,
-                                 &Iosb,
-                                 &Buffer,
-                                 sizeof(Buffer),
-                                 &ByteOffset,
-                                 NULL);
-            if (NT_SUCCESS(Status))
-            {
-                LARGE_INTEGER Zero;
-                Zero.QuadPart = 0LL;
-
-                Status = IoSetInformation(FileObject,
-                                          FileEndOfFileInformation,
-                                          sizeof(LARGE_INTEGER),
-                                          &Zero);
-                ASSERT(NT_SUCCESS(Status));
-            }
-        }
-    }
-#endif
-
     if (AllocationAttributes & SEC_IMAGE)
     {
         Status = MmCreateImageSection(SectionObject,
