mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
Moved common SEH code to Rtl
svn path=/trunk/; revision=9862
This commit is contained in:
parent
4e65adddb3
commit
730275c800
1 changed files with 68 additions and 0 deletions
68
reactos/lib/rtl/exception.c
Normal file
68
reactos/lib/rtl/exception.c
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/* $Id: exception.c,v 1.1 2004/06/24 19:30:21 hyperion Exp $
|
||||||
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: User-mode exception support
|
||||||
|
* FILE: lib/ntdll/rtl/exception.c
|
||||||
|
* PROGRAMERS: David Welch <welch@cwcom.net>
|
||||||
|
* Skywing <skywing@valhallalegends.com>
|
||||||
|
* KJK::Hyperion <noog@libero.it>
|
||||||
|
* UPDATES: Skywing, 09/11/2003: Implemented RtlRaiseException and
|
||||||
|
* KiUserRaiseExceptionDispatcher.
|
||||||
|
* KJK::Hyperion, 22/06/2004: Moved the common parts here,
|
||||||
|
* left the user-mode code in ntdll
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <napi/teb.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
/* implemented in except.s */
|
||||||
|
VOID
|
||||||
|
RtlpCaptureContext(PCONTEXT Context);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID STDCALL
|
||||||
|
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
RtlRaiseStatus(NTSTATUS Status)
|
||||||
|
{
|
||||||
|
EXCEPTION_RECORD ExceptionRecord;
|
||||||
|
|
||||||
|
DPRINT("RtlRaiseStatus(Status 0x%.08x)\n", Status);
|
||||||
|
|
||||||
|
ExceptionRecord.ExceptionCode = Status;
|
||||||
|
ExceptionRecord.ExceptionRecord = NULL;
|
||||||
|
ExceptionRecord.NumberParameters = 0;
|
||||||
|
ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||||
|
RtlRaiseException (& ExceptionRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue