mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Top level exception handler can't be UnhandledExceptionFilter by default, this leads to an infinite recursion if top level was not overriden.
- Add HardError raising to UnhandledExceptionFilter, by Dmitry Philippov. svn path=/trunk/; revision=31356
This commit is contained in:
parent
55999c83fb
commit
21d4476bfc
1 changed files with 33 additions and 3 deletions
|
@ -15,7 +15,7 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter = UnhandledExceptionFilter;
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter = NULL;
|
||||
|
||||
UINT
|
||||
WINAPI
|
||||
|
@ -213,6 +213,8 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
LONG RetValue;
|
||||
HANDLE DebugPort = NULL;
|
||||
NTSTATUS ErrCode;
|
||||
ULONG ErrorParameters[4];
|
||||
ULONG ErrorResponse;
|
||||
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
|
||||
ExceptionInfo->ExceptionRecord->NumberParameters >= 2)
|
||||
|
@ -227,7 +229,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
if (RetValue == EXCEPTION_CONTINUE_EXECUTION)
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
break;
|
||||
case EXCEPTION_EXECUTE_FAULT:
|
||||
case EXCEPTION_EXECUTE_FAULT:
|
||||
/* FIXME */
|
||||
break;
|
||||
}
|
||||
|
@ -255,7 +257,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
if (ret != EXCEPTION_CONTINUE_SEARCH)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
|
||||
{
|
||||
#ifdef _X86_
|
||||
|
@ -306,6 +308,34 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Save exception code and address */
|
||||
ErrorParameters[0] = (ULONG)ExceptionInfo->ExceptionRecord->ExceptionCode;
|
||||
ErrorParameters[1] = (ULONG)ExceptionInfo->ExceptionRecord->ExceptionAddress;
|
||||
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
|
||||
{
|
||||
/* get the type of operation that caused the access violation */
|
||||
ErrorParameters[2] = ExceptionInfo->ExceptionRecord->ExceptionInformation[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorParameters[2] = ExceptionInfo->ExceptionRecord->ExceptionInformation[2];
|
||||
}
|
||||
|
||||
/* Save faulting address */
|
||||
ErrorParameters[3] = ExceptionInfo->ExceptionRecord->ExceptionInformation[1];
|
||||
|
||||
/* Raise the harderror */
|
||||
ErrCode = NtRaiseHardError(STATUS_UNHANDLED_EXCEPTION | 0x10000000,
|
||||
4, 0, ErrorParameters, OptionOkCancel, &ErrorResponse);
|
||||
|
||||
if (NT_SUCCESS(ErrCode) && (ErrorResponse == ResponseCancel))
|
||||
{
|
||||
/* FIXME: Check the result, if the "Cancel" button was
|
||||
clicked run a debugger */
|
||||
DPRINT1("Debugging is not implemented yet\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Returning EXCEPTION_EXECUTE_HANDLER means that the code in
|
||||
* the __except block will be executed. Normally this will end up in a
|
||||
|
|
Loading…
Reference in a new issue