- Fix KeRaiseUserException (can't use "return" from SEH_HANDLE).

svn path=/trunk/; revision=23803
This commit is contained in:
Alex Ionescu 2006-08-30 17:01:58 +00:00
parent 5fc996c43e
commit 7ea78797f2

View file

@ -812,27 +812,32 @@ NTSTATUS
NTAPI NTAPI
KeRaiseUserException(IN NTSTATUS ExceptionCode) KeRaiseUserException(IN NTSTATUS ExceptionCode)
{ {
NTSTATUS Status = STATUS_SUCCESS;
ULONG OldEip; ULONG OldEip;
PKTHREAD Thread = KeGetCurrentThread(); PTEB Teb = KeGetCurrentThread()->Teb;
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
/* Make sure we can access the TEB */ /* Make sure we can access the TEB */
_SEH_TRY _SEH_TRY
{ {
Thread->Teb->ExceptionCode = ExceptionCode; /* Set the exception code */
Teb->ExceptionCode = ExceptionCode;
} }
_SEH_HANDLE _SEH_HANDLE
{ {
return(ExceptionCode); /* Save exception code */
Status = ExceptionCode;
} }
_SEH_END; _SEH_END;
if (!NT_SUCCESS(Status)) return Status;
/* Get the old EIP */ /* Get the old EIP */
OldEip = Thread->TrapFrame->Eip; OldEip = TrapFrame->Eip;
/* Change it to the user-mode dispatcher */ /* Change it to the user-mode dispatcher */
Thread->TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher;
/* Return the old EIP */ /* Return the old EIP */
return((NTSTATUS)OldEip); return (NTSTATUS)OldEip;
} }