If the previous mode was user, the following steps are taken:
• If frame-based exception-handling is allowed (SearchFrames == TRUE) and if the
process is not being debugged by a user mode debugger (DebugPort == 0), the
kernel debugger is given a first chance to handle the exception; otherwise, a
description of the exception is forwarded to the user mode debugger via the LPC
mechanism.
• If the exception is not handled by a debugger and the user mode stack appears to
be still valid, the user mode context is adjusted so that upon return to user mode,
the function KiUserExceptionDispatcher will be invoked.
• After returning to user mode, KiUserExceptionDispatcher invokes
RtlDispatchException to search for a frame-based exception handler.
• If RtlDispatchException does not find a handler prepared to handle the exception,
the exception is re-signaled, specifying SearchFrames as FALSE.
• KiDispatchException is entered again and, because SearchFrames is FALSE, the
next step is to give a user mode debugger a last chance to handle the exception.
• If the debugger (if any) still does not handle the exception, a description of the
exception is forwarded to the exception port (if any) of the process.
• The recipient (if any) of the message to the exception port can still handle the
exception, but if it does not, ZwTerminateThread is called to terminate the current
thread.
• If ZwTerminateThread fails for any reason, KeBugCheckEx is invoked to shut down
the system with the bugcheck code KMODE_EXCEPTION_NOT_HANDLED.
汗.无法编辑帖子.写这里好了
从上面可以知道.,
1.kernel debugger is given a first chance
2.the function KiUserExceptionDispatcher will be invoked
3.If RtlDispatchException does not find a handler ,
4.KiDispatchException is entered again and the next step is to give a user mode debugger