From 47bfb48ebbcf41bee8c6a084b17262aacb05bf33 Mon Sep 17 00:00:00 2001 From: Dibyamartanda Samanta Date: Wed, 7 Aug 2024 15:28:55 +0200 Subject: [PATCH] Update NTOSKRNL/CC/ccpinsupport.cpp Loop was prematurely terminating due to wrong condition of if(BeyondLastByte.QuadPart < LocalFileOffset.QuadPart + RemainingLength) we are mapping across the length, itroduced some guard checks if(localbcb != nullptr) { CcSetDirtyPinnedData(localbcb, nullptr); *Bcb = localbcb; } to fix some test case where it was failing --- NTOSKRNL/CC/ccpinsupport.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NTOSKRNL/CC/ccpinsupport.cpp b/NTOSKRNL/CC/ccpinsupport.cpp index 1173f42..da6aea3 100644 --- a/NTOSKRNL/CC/ccpinsupport.cpp +++ b/NTOSKRNL/CC/ccpinsupport.cpp @@ -795,7 +795,7 @@ CcPreparePinWrite( } return false; } - if(BeyondLastByte.QuadPart < LocalFileOffset.QuadPart + RemainingLength) + if(BeyondLastByte.QuadPart > LocalFileOffset.QuadPart + RemainingLength) break; } @@ -810,8 +810,11 @@ CcPreparePinWrite( RtlZeroMemory(*Buffer, Length); } + if(localbcb != nullptr) + { CcSetDirtyPinnedData(localbcb, nullptr); *Bcb = localbcb; + } return true; }