/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
+#ifndef LIBCAPTIVE
#include <reactos/bugcodes.h>
+#endif /* LIBCAPTIVE */
#include <roscfg.h>
#include <internal/ke.h>
#include <internal/ldr.h>
BOOLEAN SearchFrames)
{
EXCEPTION_DISPOSITION Value;
+#ifndef LIBCAPTIVE
CONTEXT TContext;
+#endif /* LIBCAPTIVE */
DPRINT("KiDispatchException() called\n");
/* PCR->KeExceptionDispatchCount++; */
+#ifndef LIBCAPTIVE
if (Context == NULL)
{
TContext.ContextFlags = CONTEXT_FULL;
Context = &TContext;
}
+#endif /* LIBCAPTIVE */
#if 0
if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT)
#endif
if (PreviousMode == UserMode)
{
+#ifdef LIBCAPTIVE
+ KeBugCheck(0);
+#else /* !LIBCAPTIVE */
if (SearchFrames)
{
PULONG Stack;
/* If that fails then bugcheck */
DbgPrint("Could not terminate thread\n");
KeBugCheck(KMODE_EXCEPTION_NOT_HANDLED);
+#endif /* LIBCAPTIVE */
}
else
{
/* PreviousMode == KernelMode */
+#ifndef LIBCAPTIVE
if (KdDebuggerEnabled && KdDebugState & KD_DEBUG_GDB)
{
Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf);
Action = KdbEnterDebuggerException (ExceptionRecord, Context, Tf);
}
#endif /* KDBG */
+#endif /* LIBCAPTIVE */
if (Action != kdHandleException)
{
Value = RtlpDispatchException (ExceptionRecord, Context);
*/
if (Value != ExceptionContinueExecution)
{
+#ifndef LIBCAPTIVE
KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED);
+#else /* !LIBCAPTIVE */
+ KeBugCheck (0);
+#endif /* LIBCAPTIVE */
}
}
else
{
+#ifndef LIBCAPTIVE
KeContextToTrapFrame (Context, KeGetCurrentThread()->TrapFrame);
+#else /* !LIBCAPTIVE */
+ KeBugCheck(0);
+#endif /* LIBCAPTIVE */
}
}
}
+#ifndef LIBCAPTIVE
+
VOID STDCALL
ExRaiseAccessViolation (VOID)
{
RtlRaiseException(&ExceptionRecord);
}
+#endif /* LIBCAPTIVE */
NTSTATUS STDCALL
NtRaiseException (IN PEXCEPTION_RECORD ExceptionRecord,
KiDispatchException(ExceptionRecord,
Context,
PsGetCurrentThread()->Tcb.TrapFrame,
+#ifndef LIBCAPTIVE
ExGetPreviousMode(),
+#else /* !LIBCAPTIVE */
+ KernelMode,
+#endif /* LIBCAPTIVE */
SearchFrames);
return(STATUS_SUCCESS);
}
VOID STDCALL
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
{
+#ifndef LIBCAPTIVE
ZwRaiseException(ExceptionRecord, NULL, TRUE);
+#else /* !LIBCAPTIVE */
+CONTEXT *LocalContext;
+
+ /* Do not use local variable to benefit from ElectricFence boundary checks */
+ LocalContext=ExAllocatePool(PagedPool,sizeof(LocalContext->ContextFlags));
+ LocalContext->ContextFlags=0;
+
+ NtRaiseException(ExceptionRecord, LocalContext, TRUE);
+
+ ExFreePool(LocalContext);
+#endif /* LIBCAPTIVE */
}
/* EOF */