* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/exp.c
* PURPOSE: Handling exceptions
- * PROGRAMMER: David Welch (welch@cwcom.net)
+ * PROGRAMMERS: David Welch (welch@cwcom.net)
+ * Skywing (skywing@valhallalegends.com)
* REVISION HISTORY:
* ??/??/??: Created
+ * 09/12/03: KeRaiseUserException added (Skywing).
*/
/* INCLUDES *****************************************************************/
-#include <ddk/ntddk.h>
#include <roscfg.h>
+#include <ddk/ntddk.h>
#include <internal/ntoskrnl.h>
#include <internal/ke.h>
#include <internal/i386/segment.h>
#include <ntdll/ldr.h>
#include <internal/safe.h>
#include <internal/kd.h>
+#include <internal/ldr.h>
#define NDEBUG
#include <internal/debug.h>
Er.NumberParameters = 0;
}
- Er.ExceptionFlags = (STATUS_SINGLE_STEP == (NTSTATUS) Er.ExceptionCode || STATUS_BREAKPOINT == (NTSTATUS) Er.ExceptionCode ?
- 0 : EXCEPTION_NONCONTINUABLE);
+ Er.ExceptionFlags = ((NTSTATUS) STATUS_SINGLE_STEP == (NTSTATUS) Er.ExceptionCode
+ || (NTSTATUS) STATUS_BREAKPOINT == (NTSTATUS) Er.ExceptionCode) ?
+ EXCEPTION_NONCONTINUABLE : 0;
KiDispatchException(&Er, 0, Tf, KernelMode, TRUE);
set_system_call_gate(0x2d,(int)interrupt_handler2d);
set_system_call_gate(0x2e,(int)interrupt_handler2e);
}
+
+/*
+ * @implemented
+ */
+
+VOID STDCALL
+KeRaiseUserException(IN NTSTATUS ExceptionCode)
+{
+ /* FIXME: This needs SEH */
+
+ PKTHREAD Thread = KeGetCurrentThread();
+
+ ProbeForWrite(&Thread->Teb->ExceptionCode, sizeof(NTSTATUS), sizeof(NTSTATUS)); /* NT doesn't check this -- bad? */
+ Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher();
+ Thread->Teb->ExceptionCode = ExceptionCode;
+}