* PROJECT: ReactOS kernel
* PURPOSE: User-mode exception support
* FILE: lib/ntdll/rtl/exception.c
- * PROGRAMER: David Welch <welch@cwcom.net>
+ * PROGRAMERS: David Welch <welch@cwcom.net>
+ * Skywing <skywing@valhallalegends.com>
+ * UPDATES: Skywing, 09/11/2003: Implemented RtlRaiseException and
+ * KiUserRaiseExceptionDispatcher.
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <windows.h>
#include <string.h>
+#include <napi/teb.h>
#define NDEBUG
#include <debug.h>
RtlRaiseException(&NestedExceptionRecord);
}
+/* implemented in except.s */
+VOID
+RtlpCaptureContext(PCONTEXT Context);
+
+/*
+ * @implemented
+ */
VOID STDCALL
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
{
- DPRINT("RtlRaiseException()\n");
+ CONTEXT Context;
+ NTSTATUS Status;
+
+ RtlpCaptureContext(&Context);
+
+ ExceptionRecord->ExceptionAddress = (PVOID)(*(((PULONG)Context.Ebp)+1));
+ Context.ContextFlags = CONTEXT_FULL;
+
+ Status = ZwRaiseException(ExceptionRecord, &Context, TRUE);
+ RtlRaiseException(ExceptionRecord);
+ RtlRaiseStatus(Status); /* If we get to this point, something is seriously wrong... */
+}
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+KiRaiseUserExceptionDispatcher(VOID)
+{
+ EXCEPTION_RECORD ExceptionRecord;
+
+ ExceptionRecord.ExceptionCode = ((PTEB)NtCurrentTeb())->ExceptionCode;
+ ExceptionRecord.ExceptionFlags = 0;
+ ExceptionRecord.ExceptionRecord = NULL;
+ ExceptionRecord.NumberParameters = 0;
+
+ RtlRaiseException(&ExceptionRecord);
}
VOID STDCALL
ExitStatus = (NTSTATUS) (StartAddress)(Parameter);
NtTerminateProcess(NtCurrentProcess(), ExitStatus);
- }
+}
/* EOF */