mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Bug fixes
Started work on exception handling svn path=/trunk/; revision=1706
This commit is contained in:
parent
58fc2c8cf8
commit
1a0448a35b
4 changed files with 108 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.37 2001/03/16 18:11:21 dwelch Exp $
|
||||
/* $Id: create.c,v 1.38 2001/03/17 11:11:10 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -572,7 +572,8 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
|||
DPRINT("Creating thread for process\n");
|
||||
hThread = KlCreateFirstThread(hProcess,
|
||||
lpThreadAttributes,
|
||||
Sii.StackReserve,
|
||||
//Sii.StackReserve,
|
||||
0x200000,
|
||||
lpStartAddress,
|
||||
dwCreationFlags,
|
||||
&lpProcessInformation->dwThreadId);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: exception.c,v 1.3 2000/12/29 13:48:30 ekohl Exp $
|
||||
/* $Id: exception.c,v 1.4 2001/03/17 11:11:11 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -10,25 +10,46 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID STDCALL
|
||||
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
||||
{
|
||||
}
|
||||
|
||||
ULONG
|
||||
RtlDispatchException(PEXCEPTION_RECORD ExceptionRecord,
|
||||
PCONTEXT Context)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord,
|
||||
PCONTEXT Context)
|
||||
{
|
||||
|
||||
EXCEPTION_RECORD NestedExceptionRecord;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (RtlDispatchException(ExceptionRecord, Context) == 1)
|
||||
{
|
||||
Status = ZwContinue(Context, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = ZwRaiseException(ExceptionRecord, Context, FALSE);
|
||||
}
|
||||
|
||||
NestedExceptionRecord.ExceptionCode = Status;
|
||||
NestedExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
NestedExceptionRecord.ExceptionRecord = ExceptionRecord;
|
||||
|
||||
RtlRaiseException(&NestedExceptionRecord);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
RtlRaiseStatus(NTSTATUS Status)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,8 @@ PVOID
|
|||
LdrpGetSystemDllEntryPoint (VOID);
|
||||
PVOID
|
||||
LdrpGetSystemDllApcDispatcher(VOID);
|
||||
PVOID
|
||||
LdrpGetSystemDllExceptionDispatcher(VOID);
|
||||
NTSTATUS
|
||||
LdrpMapImage (
|
||||
HANDLE ProcessHandle,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: catch.c,v 1.11 2001/03/16 23:04:59 dwelch Exp $
|
||||
/* $Id: catch.c,v 1.12 2001/03/17 11:11:11 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/catch.c
|
||||
|
@ -27,11 +27,82 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ke.h>
|
||||
#include <internal/ldr.h>
|
||||
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
VOID
|
||||
KiDispatchException(PEXCEPTION_RECORD Er,
|
||||
ULONG Reserved,
|
||||
PKTRAP_FRAME Tf,
|
||||
KPROCESSOR_MODE PreviousMode,
|
||||
BOOLEAN SearchFrames)
|
||||
{
|
||||
CONTEXT Context;
|
||||
|
||||
Context.ContextFlags = CONTEXT_FULL;
|
||||
if (PreviousMode == UserMode)
|
||||
{
|
||||
Context.ContextFlags = Context.ContextFlags | CONTEXT_DEBUGGER;
|
||||
}
|
||||
|
||||
/* PCR->KeExceptionDispatchCount++; */
|
||||
|
||||
// KeContextFromKframes(Tf, Reserved, &Context);
|
||||
|
||||
if (Er->ExceptionCode == STATUS_BREAKPOINT)
|
||||
{
|
||||
Context.Eip--;
|
||||
}
|
||||
|
||||
if (PreviousMode == UserMode)
|
||||
{
|
||||
if (SearchFrames)
|
||||
{
|
||||
PULONG Stack;
|
||||
ULONG CDest;
|
||||
|
||||
/* FIXME: Give the kernel debugger a chance */
|
||||
|
||||
/* FIXME: Forward exception to user mode debugger */
|
||||
|
||||
/* FIXME: Check user mode stack for enough space */
|
||||
|
||||
|
||||
/*
|
||||
* Let usermode try and handle the exception
|
||||
*/
|
||||
Tf->Esp = Tf->Esp -
|
||||
(12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT));
|
||||
Stack = (PULONG)Tf->Esp;
|
||||
CDest = 3 + (ROUND_UP(sizeof(EXCEPTION_RECORD), 4) / 4);
|
||||
/* Return address */
|
||||
Stack[0] = 0;
|
||||
/* Pointer to EXCEPTION_RECORD structure */
|
||||
Stack[1] = (ULONG)&Stack[3];
|
||||
/* Pointer to CONTEXT structure */
|
||||
Stack[2] = (ULONG)&Stack[CDest];
|
||||
memcpy(&Stack[3], Er, sizeof(EXCEPTION_RECORD));
|
||||
memcpy(&Stack[CDest], &Context, sizeof(CONTEXT));
|
||||
|
||||
Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher();
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME: Forward the exception to the debugger */
|
||||
|
||||
/* FIXME: Forward the exception to the debugger */
|
||||
|
||||
ZwTerminateThread(NtCurrentThread(), Er->ExceptionCode);
|
||||
|
||||
KeBugCheck(KMODE_EXCEPTION_NOT_HANDLED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
ExRaiseAccessViolation (VOID)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue