mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:03:02 +00:00
[KERNEL32]
- Whitespace fixes (dosdev.c, except.c, loader.c) - except.c: Remove some unneeded casts; NtQueryInformationProcess for 'ProcessDebugPort' is implemented and therefore it will never return STATUS_NOT_IMPLEMENTED. svn path=/trunk/; revision=71703
This commit is contained in:
parent
b92e83d7b9
commit
876a3b2681
3 changed files with 91 additions and 82 deletions
|
@ -85,7 +85,7 @@ PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
DbgPrint("Unhandled exception\n");
|
||||
DbgPrint("ExceptionCode: %8x\n", ExceptionRecord->ExceptionCode);
|
||||
|
||||
if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
|
||||
if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
|
||||
ExceptionRecord->NumberParameters == 2)
|
||||
{
|
||||
DbgPrint("Faulting Address: %8x\n", ExceptionRecord->ExceptionInformation[1]);
|
||||
|
@ -209,7 +209,7 @@ GetErrorMode(VOID)
|
|||
/* Query the current setting */
|
||||
Status = NtQueryInformationProcess(NtCurrentProcess(),
|
||||
ProcessDefaultHardErrorMode,
|
||||
(PVOID)&ErrMode,
|
||||
&ErrMode,
|
||||
sizeof(ErrMode),
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -238,18 +238,19 @@ GetErrorMode(VOID)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
LONG WINAPI
|
||||
UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||
LONG
|
||||
WINAPI
|
||||
UnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
LONG RetValue;
|
||||
HANDLE DebugPort = NULL;
|
||||
NTSTATUS ErrCode;
|
||||
ULONG_PTR ErrorParameters[4];
|
||||
ULONG ErrorResponse;
|
||||
PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER RealFilter;
|
||||
|
||||
if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
|
||||
if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
|
||||
ExceptionRecord->NumberParameters >= 2)
|
||||
{
|
||||
switch(ExceptionRecord->ExceptionInformation[0])
|
||||
|
@ -262,6 +263,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
if (RetValue == EXCEPTION_CONTINUE_EXECUTION)
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
break;
|
||||
|
||||
case EXCEPTION_EXECUTE_FAULT:
|
||||
/* FIXME */
|
||||
break;
|
||||
|
@ -269,11 +271,14 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
}
|
||||
|
||||
/* Is there a debugger running? */
|
||||
ErrCode = NtQueryInformationProcess(NtCurrentProcess(), ProcessDebugPort,
|
||||
&DebugPort, sizeof(HANDLE), NULL);
|
||||
if (!NT_SUCCESS(ErrCode) && ErrCode != STATUS_NOT_IMPLEMENTED)
|
||||
Status = NtQueryInformationProcess(NtCurrentProcess(),
|
||||
ProcessDebugPort,
|
||||
&DebugPort,
|
||||
sizeof(DebugPort),
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
BaseSetLastNTError(ErrCode);
|
||||
BaseSetLastNTError(Status);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
|
@ -298,7 +303,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
ErrorParameters[0] = (ULONG)ExceptionRecord->ExceptionCode;
|
||||
ErrorParameters[1] = (ULONG_PTR)ExceptionRecord->ExceptionAddress;
|
||||
|
||||
if ((NTSTATUS)ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
|
||||
if (ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION)
|
||||
{
|
||||
/* get the type of operation that caused the access violation */
|
||||
ErrorParameters[2] = ExceptionRecord->ExceptionInformation[0];
|
||||
|
@ -312,10 +317,14 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
ErrorParameters[3] = ExceptionRecord->ExceptionInformation[1];
|
||||
|
||||
/* Raise the harderror */
|
||||
ErrCode = NtRaiseHardError(STATUS_UNHANDLED_EXCEPTION,
|
||||
4, 0, ErrorParameters, OptionOkCancel, &ErrorResponse);
|
||||
Status = NtRaiseHardError(STATUS_UNHANDLED_EXCEPTION,
|
||||
4,
|
||||
0,
|
||||
ErrorParameters,
|
||||
OptionOkCancel,
|
||||
&ErrorResponse);
|
||||
|
||||
if (NT_SUCCESS(ErrCode) && (ErrorResponse == ResponseCancel))
|
||||
if (NT_SUCCESS(Status) && (ErrorResponse == ResponseCancel))
|
||||
{
|
||||
/* FIXME: Check the result, if the "Cancel" button was
|
||||
clicked run a debugger */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue