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