https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b2fcd27aaa234dd205b201113486c18f9cdaf9f6

commit b2fcd27aaa234dd205b201113486c18f9cdaf9f6
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun Jan 22 10:26:13 2023 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Fri Apr 14 11:56:08 2023 +0300

    [NTOS/CC] Fix calls to CcRosEnsureVacbResident
    
    The function returns BOOLEAN, not NTSTATUS! Also wrap it in SEH, because it 
can throw an exception on failure.
---
 ntoskrnl/cc/copy.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index 09af125540c..7b43ab51e60 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -139,6 +139,7 @@ CcPerformReadAhead(
     ULONG Length;
     PPRIVATE_CACHE_MAP PrivateCacheMap;
     BOOLEAN Locked;
+    BOOLEAN Success;
 
     SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
 
@@ -206,9 +207,18 @@ CcPerformReadAhead(
             goto Clear;
         }
 
-        Status = CcRosEnsureVacbResident(Vacb, TRUE, FALSE,
-                CurrentOffset % VACB_MAPPING_GRANULARITY, PartialLength);
-        if (!NT_SUCCESS(Status))
+        _SEH2_TRY
+        {
+            Success = CcRosEnsureVacbResident(Vacb, TRUE, FALSE,
+                    CurrentOffset % VACB_MAPPING_GRANULARITY, PartialLength);
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            Success = FALSE;
+        }
+        _SEH2_END
+
+        if (!Success)
         {
             CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
             DPRINT1("Failed to read data: %lx!\n", Status);
@@ -234,8 +244,17 @@ CcPerformReadAhead(
             goto Clear;
         }
 
-        Status = CcRosEnsureVacbResident(Vacb, TRUE, FALSE, 0, PartialLength);
-        if (!NT_SUCCESS(Status))
+        _SEH2_TRY
+        {
+            Success = CcRosEnsureVacbResident(Vacb, TRUE, FALSE, 0, 
PartialLength);
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            Success = FALSE;
+        }
+        _SEH2_END
+
+        if (!Success)
         {
             CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
             DPRINT1("Failed to read data: %lx!\n", Status);

Reply via email to