Yuriy Sidorov <jura@cp-lab.com>

- Always call ZwRaiseException in user mode and RtlDispatchException in kernel mode.
- If RtlDispatchException failed call ZwRaiseException in kernel mode. Otherwise unhandled RtlRaiseException() call in kernel mode simply ignored (do nothing)!
- Call RtlRaiseStatus in RtlRaiseException, if something went wrong.
See issue #3434 for more details.

svn path=/trunk/; revision=34377
This commit is contained in:
Aleksey Bragin 2008-07-08 21:17:47 +00:00
parent 2c16b9c687
commit be356d11cd

View file

@ -41,8 +41,8 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
/* Write the context flag */
Context.ContextFlags = CONTEXT_FULL;
/* Check if we're being debugged (user-mode only) */
if (!RtlpCheckForActiveDebugger(TRUE))
/* Check mode */
if (RtlpGetMode() == UserMode)
{
/* Raise an exception immediately */
Status = ZwRaiseException(ExceptionRecord, &Context, TRUE);
@ -50,7 +50,7 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
else
{
/* Dispatch the exception and check if we should continue */
if (RtlDispatchException(ExceptionRecord, &Context))
if (!RtlDispatchException(ExceptionRecord, &Context))
{
/* Raise the exception */
Status = ZwRaiseException(ExceptionRecord, &Context, FALSE);
@ -62,8 +62,8 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
}
}
/* We should never return */
while (TRUE);
/* If we returned, raise a status */
RtlRaiseStatus(Status);
}
/*
@ -94,8 +94,8 @@ RtlRaiseStatus(NTSTATUS Status)
/* Write the context flag */
Context.ContextFlags = CONTEXT_FULL;
/* Check if we're being debugged (user-mode only) */
if (!RtlpCheckForActiveDebugger(TRUE))
/* Check mode */
if (RtlpGetMode() == UserMode)
{
/* Raise an exception immediately */
ZwRaiseException(&ExceptionRecord, &Context, TRUE);