From 814c815bc1d3214406f37b2672529c4230d4c918 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Wed, 23 Jun 2004 19:42:14 +0000 Subject: [PATCH] Fixed KeRaiseUserException to return old EIP. svn path=/trunk/; revision=9834 --- reactos/ntoskrnl/include/internal/ke.h | 2 +- reactos/ntoskrnl/ke/i386/exp.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index 0069df63d02..67a8cd61faf 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -79,7 +79,7 @@ KiDeliverNormalApc(VOID); BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc); PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue); -VOID STDCALL +NTSTATUS STDCALL KeRaiseUserException(NTSTATUS ExceptionCode); diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index f034a19a918..58e237b20e7 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -746,14 +746,16 @@ KeInitExceptions(VOID) * @implemented */ -VOID STDCALL +NTSTATUS STDCALL KeRaiseUserException(IN NTSTATUS ExceptionCode) { /* FIXME: This needs SEH */ + ULONG OldEip; + PKTHREAD Thread = KeGetCurrentThread(); - PKTHREAD Thread = KeGetCurrentThread(); - - ProbeForWrite(&Thread->Teb->ExceptionCode, sizeof(NTSTATUS), sizeof(NTSTATUS)); /* NT doesn't check this -- bad? */ - Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher(); - Thread->Teb->ExceptionCode = ExceptionCode; + ProbeForWrite(&Thread->Teb->ExceptionCode, sizeof(NTSTATUS), sizeof(NTSTATUS)); /* NT doesn't check this -- bad? */ + OldEip = Thread->TrapFrame->Eip; + Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher(); + Thread->Teb->ExceptionCode = ExceptionCode; + return((NTSTATUS)OldEip); }