[ros-diffs] [arty] 35751: Make CcPinRead and CcPreparePinWrite the same for now.

arty at svn.reactos.org arty at svn.reactos.org
Fri Aug 29 12:56:00 CEST 2008


Author: arty
Date: Fri Aug 29 05:55:59 2008
New Revision: 35751

URL: http://svn.reactos.org/svn/reactos?rev=35751&view=rev
Log:
Make CcPinRead and CcPreparePinWrite the same for now.

Modified:
    branches/arty-newcc/ntoskrnl/cache/pinsup.c

Modified: branches/arty-newcc/ntoskrnl/cache/pinsup.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/pinsup.c?rev=35751&r1=35750&r2=35751&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] Fri Aug 29 05:55:59 2008
@@ -670,23 +670,11 @@
                   OUT PVOID *Bcb,
                   OUT PVOID *Buffer)
 {
-    BOOLEAN GotIt = CcPinMappedData
-	(FileObject,
-	 FileOffset,
-	 Length,
-	 Flags,
-	 Bcb);
-
-    PNOCC_BCB TheBcb = (PNOCC_BCB)*Bcb;
-    ULONG Start = TheBcb - CcCacheSections;
-	
-    DPRINT("CcPreparePinWrite(#%x)\n", Start);
-	
-    if (GotIt)
-    {
-	CcCacheSections[Start].Dirty = TRUE;
-	*Buffer = (PVOID)((PCHAR)TheBcb->BaseAddress + (FileOffset->QuadPart - TheBcb->FileOffset.QuadPart));
-	DPRINT("Returning Buffer: %x\n", *Buffer);
+    BOOLEAN Result = CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer);
+
+    if (Result)
+    {
+	PNOCC_BCB TheBcb = (PNOCC_BCB)*Bcb;
 	if (!TheBcb->Pinned)
 	{
 	    TheBcb->Pinned = IoAllocateMdl
@@ -695,12 +683,21 @@
 		 FALSE,
 		 FALSE,
 		 NULL);
-	    MmProbeAndLockPages(TheBcb->Pinned, KernelMode, IoReadAccess);
-	}
-    }
-
-    DPRINT("Done\n");
-    return GotIt;
+	    _SEH_TRY
+	    {
+		MmProbeAndLockPages(TheBcb->Pinned, KernelMode, IoReadAccess);
+	    }
+	    _SEH_HANDLE
+	    {
+		IoFreeMdl(TheBcb->Pinned);
+		TheBcb->Pinned = NULL;
+		Result = FALSE;
+	    }
+	    _SEH_END;
+	}
+    }
+
+    return Result;
 }
 
 VOID



More information about the Ros-diffs mailing list