From 7ea78797f2bc9a8af358e3cbcb5267bd1d20f673 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Wed, 30 Aug 2006 17:01:58 +0000 Subject: [PATCH] - Fix KeRaiseUserException (can't use "return" from SEH_HANDLE). svn path=/trunk/; revision=23803 --- reactos/ntoskrnl/ke/i386/exp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index c209f7d9db2..29bf6808fdb 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -812,27 +812,32 @@ NTSTATUS NTAPI KeRaiseUserException(IN NTSTATUS ExceptionCode) { + NTSTATUS Status = STATUS_SUCCESS; ULONG OldEip; - PKTHREAD Thread = KeGetCurrentThread(); + PTEB Teb = KeGetCurrentThread()->Teb; + PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame; /* Make sure we can access the TEB */ _SEH_TRY { - Thread->Teb->ExceptionCode = ExceptionCode; + /* Set the exception code */ + Teb->ExceptionCode = ExceptionCode; } _SEH_HANDLE { - return(ExceptionCode); + /* Save exception code */ + Status = ExceptionCode; } _SEH_END; + if (!NT_SUCCESS(Status)) return Status; /* Get the old EIP */ - OldEip = Thread->TrapFrame->Eip; + OldEip = TrapFrame->Eip; /* Change it to the user-mode dispatcher */ - Thread->TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; + TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; /* Return the old EIP */ - return((NTSTATUS)OldEip); + return (NTSTATUS)OldEip; }