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... ============================================================================== --- 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