[NTOSKRNL]
authorPierre Schweitzer <pierre@reactos.org>
Thu, 26 May 2016 11:50:42 +0000 (11:50 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 26 May 2016 11:50:42 +0000 (11:50 +0000)
On CcInitializeCacheMap() call, keep track of the PinAccess value so that we can later check it on pinning.
It shouldn't be set to FALSE when the user attempts to perform pinning

CORE-11310

svn path=/trunk/; revision=71404

reactos/ntoskrnl/cc/fs.c
reactos/ntoskrnl/cc/pin.c
reactos/ntoskrnl/cc/view.c
reactos/ntoskrnl/include/internal/cc.h

index 5fb3ca4..4feb125 100644 (file)
@@ -103,6 +103,7 @@ CcInitializeCacheMap (
     /* Call old ROS cache init function */
     Status = CcRosInitializeFileCache(FileObject,
                                       FileSizes,
+                                      PinAccess,
                                       CallBacks,
                                       LazyWriterContext);
     if (!NT_SUCCESS(Status))
index 0c8b672..74e7634 100644 (file)
@@ -133,9 +133,19 @@ CcPinMappedData (
     IN ULONG Flags,
     OUT        PVOID * Bcb)
 {
+    PROS_SHARED_CACHE_MAP SharedCacheMap;
+
     CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
         FileObject, FileOffset, Length, Flags);
 
+    ASSERT(FileObject);
+    ASSERT(FileObject->SectionObjectPointer);
+    ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
+
+    SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
+    ASSERT(SharedCacheMap);
+    ASSERT(SharedCacheMap->PinAccess);
+
     /* no-op for current implementation. */
     return TRUE;
 }
index 70fb7ce..9a43485 100644 (file)
@@ -1141,6 +1141,7 @@ NTAPI
 CcRosInitializeFileCache (
     PFILE_OBJECT FileObject,
     PCC_FILE_SIZES FileSizes,
+    BOOLEAN PinAccess,
     PCACHE_MANAGER_CALLBACKS CallBacks,
     PVOID LazyWriterContext)
 /*
@@ -1172,6 +1173,7 @@ CcRosInitializeFileCache (
         SharedCacheMap->LazyWriteContext = LazyWriterContext;
         SharedCacheMap->SectionSize = FileSizes->AllocationSize;
         SharedCacheMap->FileSize = FileSizes->FileSize;
+        SharedCacheMap->PinAccess = PinAccess;
         KeInitializeSpinLock(&SharedCacheMap->CacheMapLock);
         InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
         FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;
index f0e28c0..98fad41 100644 (file)
@@ -149,6 +149,7 @@ typedef struct _ROS_SHARED_CACHE_MAP
     PFILE_OBJECT FileObject;
     LARGE_INTEGER SectionSize;
     LARGE_INTEGER FileSize;
+    BOOLEAN PinAccess;
     PCACHE_MANAGER_CALLBACKS Callbacks;
     PVOID LazyWriteContext;
     KSPIN_LOCK CacheMapLock;
@@ -320,6 +321,7 @@ NTAPI
 CcRosInitializeFileCache(
     PFILE_OBJECT FileObject,
     PCC_FILE_SIZES FileSizes,
+    BOOLEAN PinAccess,
     PCACHE_MANAGER_CALLBACKS CallBacks,
     PVOID LazyWriterContext
 );