update for HEAD-2003091401
[reactos.git] / ntoskrnl / rtl / i386 / exception.c
index f145840..e55d7e9 100755 (executable)
@@ -26,6 +26,9 @@ MsvcrtDebug(ULONG Value)
 }
 #endif
 
+/*
+ * @implemented
+ */
 int
 _abnormal_termination(void)
 {
@@ -35,6 +38,9 @@ _abnormal_termination(void)
 
 struct _CONTEXT;
 
+/*
+ * @implemented
+ */
 EXCEPTION_DISPOSITION
 _except_handler2(
    struct _EXCEPTION_RECORD *ExceptionRecord,
@@ -46,6 +52,9 @@ _except_handler2(
        return (EXCEPTION_DISPOSITION)0;
 }
 
+/*
+ * @implemented
+ */
 void __cdecl
 _global_unwind2(PEXCEPTION_REGISTRATION RegistrationFrame)
 {
@@ -81,7 +90,10 @@ RtlpCaptureContext(PCONTEXT pContext);
        KeTrapFrameToContext(KeGetCurrentThread()->TrapFrame, (Context)); \
 }
 
-/*** Code below this line is shared with lib/ntdll/arch/ia32/exception.c - please keep in sync ***/
+#define SehpContinue(Context, TestAlert) \
+       ZwContinue(Context, TestAlert)
+
+/*** Code below this line is shared with lib/ntdll/rtl/i386/exception.c - please keep in sync ***/
 
 VOID STDCALL
 AsmDebug(ULONG Value)
@@ -152,6 +164,13 @@ RtlpDispatchException(IN PEXCEPTION_RECORD  ExceptionRecord,
  
   DPRINT("RegistrationFrame is 0x%X\n", RegistrationFrame);
 
+  /* Check if there are any exception handlers at all. */
+  if ((ULONG_PTR)RegistrationFrame == (ULONG_PTR)-1)
+    {
+      ExceptionRecord->ExceptionFlags |= EXCEPTION_NONCONTINUABLE;
+      return ExceptionContinueExecution;
+    }
+
   while ((ULONG_PTR)RegistrationFrame != (ULONG_PTR)-1)
   {
     EXCEPTION_RECORD ExceptionRecord2;
@@ -245,7 +264,7 @@ RtlpDispatchException(IN PEXCEPTION_RECORD  ExceptionRecord,
       else
       {
         /* Copy the (possibly changed) context back to the trap frame and return */
-        NtContinue(Context, FALSE);
+        SehpContinue(Context, FALSE);
         return ExceptionContinueExecution;
       }
     }
@@ -261,9 +280,9 @@ RtlpDispatchException(IN PEXCEPTION_RECORD  ExceptionRecord,
 
       ExceptionRecord->ExceptionFlags |= EXCEPTION_EXIT_UNWIND;
       if (DispatcherContext > Temp)
-         {
+       {         
           Temp = DispatcherContext;
-         }
+       }
     }
     else /* if (ReturnValue == ExceptionCollidedUnwind) */
     {
@@ -300,6 +319,9 @@ RtlRaiseStatus(NTSTATUS Status)
   RtlRaiseException (& ExceptionRecord);
 }
 
+/*
+ * @implemented
+ */
 VOID STDCALL
 RtlUnwind(PEXCEPTION_REGISTRATION RegistrationFrame,
   PVOID ReturnAddress,
@@ -373,7 +395,7 @@ RtlUnwind(PEXCEPTION_REGISTRATION RegistrationFrame,
     if (ERHead == RegistrationFrame)
     {
       DPRINT("Continueing execution\n");
-      NtContinue(&Context, FALSE);
+      SehpContinue(&Context, FALSE);
       return;
     }
     else
@@ -468,7 +490,7 @@ RtlUnwind(PEXCEPTION_REGISTRATION RegistrationFrame,
     RegistrationFrame);
 
   if ((ULONG_PTR)RegistrationFrame == (ULONG_PTR)-1)
-    NtContinue(&Context, FALSE);
+    SehpContinue(&Context, FALSE);
   else
     NtRaiseException(pExceptRec, &Context, 0);
 }