- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / reactos / ntoskrnl / ke / except.c
index ab34875..b994d07 100644 (file)
@@ -143,24 +143,22 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
         Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
         Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
+    if (!NT_SUCCESS(Status)) return Status;
 
 
-    /* Make sure we didn't crash in SEH */
-    if (NT_SUCCESS(Status))
-    {
-        /* Convert the context record */
-        KeContextToTrapFrame(Context,
-                             ExceptionFrame,
-                             TrapFrame,
-                             Context->ContextFlags,
-                             PreviousMode);
-
-        /* Dispatch the exception */
-        KiDispatchException(ExceptionRecord,
-                            ExceptionFrame,
-                            TrapFrame,
-                            PreviousMode,
-                            SearchFrames);
-    }
+    /* Convert the context record */
+    KeContextToTrapFrame(Context,
+                         ExceptionFrame,
+                         TrapFrame,
+                         Context->ContextFlags,
+                         PreviousMode);
+
+    /* Dispatch the exception */
+    ExceptionRecord->ExceptionCode &= ~KI_EXCEPTION_INTERNAL;
+    KiDispatchException(ExceptionRecord,
+                        ExceptionFrame,
+                        TrapFrame,
+                        PreviousMode,
+                        SearchFrames);
 
     /* Return the status */
     return Status;
 
     /* Return the status */
     return Status;