mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:25:44 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -572,7 +572,8 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
DPRINT("Creating thread for process\n");
|
DPRINT("Creating thread for process\n");
|
||||||
hThread = KlCreateFirstThread(hProcess,
|
hThread = KlCreateFirstThread(hProcess,
|
||||||
lpThreadAttributes,
|
lpThreadAttributes,
|
||||||
Sii.StackReserve,
|
//Sii.StackReserve,
|
||||||
|
0x200000,
|
||||||
lpStartAddress,
|
lpStartAddress,
|
||||||
dwCreationFlags,
|
dwCreationFlags,
|
||||||
&lpProcessInformation->dwThreadId);
|
&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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -10,24 +10,45 @@
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <windows.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
VOID STDCALL
|
||||||
|
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
RtlDispatchException(PEXCEPTION_RECORD ExceptionRecord,
|
||||||
|
PCONTEXT Context)
|
||||||
|
{
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord,
|
KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord,
|
||||||
PCONTEXT Context)
|
PCONTEXT Context)
|
||||||
{
|
{
|
||||||
|
EXCEPTION_RECORD NestedExceptionRecord;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
}
|
if (RtlDispatchException(ExceptionRecord, Context) == 1)
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
|
||||||
RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
|
||||||
{
|
{
|
||||||
|
Status = ZwContinue(Context, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = ZwRaiseException(ExceptionRecord, Context, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NestedExceptionRecord.ExceptionCode = Status;
|
||||||
|
NestedExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||||
|
NestedExceptionRecord.ExceptionRecord = ExceptionRecord;
|
||||||
|
|
||||||
|
RtlRaiseException(&NestedExceptionRecord);
|
||||||
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
RtlRaiseStatus(NTSTATUS Status)
|
RtlRaiseStatus(NTSTATUS Status)
|
||||||
|
|
|
@ -40,6 +40,8 @@ PVOID
|
||||||
LdrpGetSystemDllEntryPoint (VOID);
|
LdrpGetSystemDllEntryPoint (VOID);
|
||||||
PVOID
|
PVOID
|
||||||
LdrpGetSystemDllApcDispatcher(VOID);
|
LdrpGetSystemDllApcDispatcher(VOID);
|
||||||
|
PVOID
|
||||||
|
LdrpGetSystemDllExceptionDispatcher(VOID);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LdrpMapImage (
|
LdrpMapImage (
|
||||||
HANDLE ProcessHandle,
|
HANDLE ProcessHandle,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/catch.c
|
* FILE: ntoskrnl/ke/catch.c
|
||||||
|
@ -27,11 +27,82 @@
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <internal/ke.h>
|
||||||
|
#include <internal/ldr.h>
|
||||||
|
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* 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
|
VOID STDCALL
|
||||||
ExRaiseAccessViolation (VOID)
|
ExRaiseAccessViolation (VOID)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue