- Fix a typo causing a potentially fatal bug in user-mode exceptions. Might fix hpous...
[reactos.git] / reactos / lib / ntdll / main / i386 / dispatch.S
index 92acfb5..ab51235 100644 (file)
@@ -9,13 +9,12 @@
 /* INCLUDES ******************************************************************/\r
 \r
 #include <ndk/asm.h>\r
-#include <ndk/i386/segment.h>\r
 .intel_syntax noprefix\r
 \r
 #define EXCEPTION_NONCONTINUABLE    1\r
 #define EXCEPTION_UNWINDING         2\r
 #define EXCEPTION_EXIT_UNWIND       4\r
-#define EXCEPTION_UNWIND            (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND)\r
+#define EXCEPTION_UNWIND            (EXCEPTION_UNWINDING + EXCEPTION_EXIT_UNWIND)\r
 \r
 #define STATUS_CALLBACK_POP_STACK   0xC0000423\r
 \r
@@ -117,7 +116,7 @@ _KiRaiseUserExceptionDispatcher@0:
     sub esp, SIZEOF_EXCEPTION_RECORD\r
 \r
     /* Fill out the record */\r
-    mov eax, [fs:TEB_SELECTOR]\r
+    mov eax, [fs:KPCR_TEB]\r
     mov eax, [eax+TEB_EXCEPTION_CODE]\r
     mov [esp+EXCEPTION_RECORD_EXCEPTION_CODE], eax\r
     mov dword ptr [esp+EXCEPTION_RECORD_EXCEPTION_FLAGS], 0\r
@@ -141,15 +140,24 @@ _KiUserExceptionDispatcher@8:
     mov ecx, [esp+4]\r
     mov ebx, [esp]\r
 \r
-    /* Dispatch the exception */\r
+    /* Call the vectored exception handler */\r
     push ecx\r
     push ebx\r
+    call _RtlpExecuteVectoredExceptionHandlers@8\r
+\r
+    /* Check for success */\r
+    or al, al\r
+    jnz ContinueExecution\r
+\r
+    /* Dispatch the exception */\r
+    sub esp, 8\r
     call _RtlDispatchException@8\r
 \r
     /* Check for success */\r
     or al, al\r
     jz RaiseException\r
 \r
+ContinueExecution:\r
     /* Pop off the records */\r
     pop ebx\r
     pop ecx\r