mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[RTL] Simplify RtlRaiseException
This commit is contained in:
parent
3ec1ca9b46
commit
e6af7d9dfe
1 changed files with 22 additions and 42 deletions
|
@ -19,38 +19,19 @@ RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord)
|
|||
{
|
||||
CONTEXT Context;
|
||||
NTSTATUS Status = STATUS_INVALID_DISPOSITION;
|
||||
ULONG64 ImageBase;
|
||||
PRUNTIME_FUNCTION FunctionEntry;
|
||||
PVOID HandlerData;
|
||||
ULONG64 EstablisherFrame;
|
||||
|
||||
/* Capture the context */
|
||||
/* Capture the current context */
|
||||
RtlCaptureContext(&Context);
|
||||
|
||||
/* Get the function entry for this function */
|
||||
FunctionEntry = RtlLookupFunctionEntry(Context.Rip,
|
||||
&ImageBase,
|
||||
NULL);
|
||||
/* Fix up Context.Rip for the caller */
|
||||
Context.Rip = (ULONG64)_ReturnAddress();
|
||||
|
||||
/* Check if we found it */
|
||||
if (FunctionEntry)
|
||||
{
|
||||
/* Unwind to the caller of this function */
|
||||
RtlVirtualUnwind(UNW_FLAG_NHANDLER,
|
||||
ImageBase,
|
||||
Context.Rip,
|
||||
FunctionEntry,
|
||||
&Context,
|
||||
&HandlerData,
|
||||
&EstablisherFrame,
|
||||
NULL);
|
||||
/* Fix up Context.Rsp for the caller */
|
||||
Context.Rsp = (ULONG64)_AddressOfReturnAddress() + 8;
|
||||
|
||||
/* Save the exception address */
|
||||
ExceptionRecord->ExceptionAddress = (PVOID)Context.Rip;
|
||||
|
||||
/* Write the context flag */
|
||||
Context.ContextFlags = CONTEXT_FULL;
|
||||
|
||||
/* Check if user mode debugger is active */
|
||||
if (RtlpCheckForActiveDebugger())
|
||||
{
|
||||
|
@ -71,7 +52,6 @@ RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord)
|
|||
Status = ZwContinue(&Context, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we returned, raise a status */
|
||||
RtlRaiseStatus(Status);
|
||||
|
|
Loading…
Reference in a new issue