RasieException是SEH API,SEH != 进内核,RasieException并不必然导致用户态内核态切换。事实上这个API被调用以后会首 

先尝试在用户态进行处理,如果没有任何处理者可用,则直接调用ExitProcess退出进程,这个调用倒是要进内核。 





Raising an exception causes the exception dispatcher to go through the following search for an exception handler: 





 1.The system first attempts to notify the process's debugger, if any. 





 2.If the process is not being debugged, or if the associated debugger does not handle the exception, the system attempts to locate a frame-based exception handler by searching the stack frames of the thread in which the exception occurred. The system searches
the current stack frame first, then proceeds backward through preceding stack frames. 





 3.If no frame-based handler can be found, or no frame-based handler handles the exception, the system makes a second attempt to notify the process's debugger. 





 4.If the process is not being debugged, or if the associated debugger does not handle the exception, the system provides default handling based on the exception type. For most exceptions, the default action is to call the ExitProcess function.

。 





软件异常登记 





软件异常是通过直接或者间接调用内核服务NtRaiseException而产生的。而用户态中可以通过RaiseException API,或者Try-catch等高级语言来调用这个内核服务,而通过RaiseException来登记软件异常的过程可以简单表述如下: 





RaiseException在初始化一个EXCEPTION_RECORD结构体之后,开始调用NTDLL中的RtlRaiseException; RtlRaiseException在初始化CONTEXT结构体之后,开始调用内核中NtRaiseException, NtRaiseException再调用另外一个内核函数KiRaiseException。接下来KiRaiseException会调用KiDispatchException开始异常的分发。 





如果是由 KiDispatchException 进行那4步处理的话,显然 Ki 前缀已经进内核态了。

RasieException的更多相关文章

  1. SEH结构

    首先有几点问题 1.在后文中看到的PE的节中的配置信息表Load configuration是对SEH回调函数的注册,那么Exception Table是加载的什么信息. 2.什么时候走进系统异常,什 ...

随机推荐

  1. de4Dot用法 解决 .net程序 reflecter反编译 “索引超出了数组界限”问题

    de4Dot 反混淆工具.当你反编译 .net写的dll 或exe时出现:索引超出了数组界限 问题时 可以去网上下这个工具,通过cmd命令 打开de4dot的exe 空格 dll的全路径. 这样 :D ...

  2. Jmeter---参数化之用户参数

    总结: 参数化几次就要设置几个线程,执行的时候,是按顺序执行,下面的请求也会跟着请求

  3. Ubantu18.04安装WPS

    1.去WPS官网选在合适的版本下载安装包2.在官网下载字体包3.分别右键点击安装包,选择第一项“用软件安装打开”,进行安装即可.4.此时启动应用,应该会提示系统缺失字体.5.解决字体缺失(转)    

  4. vim编码方式设置

    建议vim的_vimrc文件里设置如下的编码方式: set encoding=utf-8 set fileencodings=ucs-bom,utf-8,cp936 set fileencoding= ...

  5. Go语言简介以及安装

    http://www.runoob.com/go/go-tutorial.html Go 是一个开源的编程语言,它能让构造简单.可靠且高效的软件变得容易. Go是从2007年末由Robert Grie ...

  6. C++——类的多继承

    多继承概念 一个类有多个直接基类的继承关系称为多继承 多继承声明语法 class  派生类名 : 访问控制  基类名1 ,  访问控制  基类名2 ,  … , 访问控制  基类名n { 数据成员和成 ...

  7. 模式识别原理(Pattern Recognition)、概念、系统、特征选择和特征

    §1.1 模式识别的基本概念 一.广义定义 1.模式:一个客观事物的描述,一个可用来仿效的完善的例子. 2.模式识别:按哲学的定义是一个“外部信息到达感觉器官,并被转换成有意义的感觉经验”的过程. 例 ...

  8. P2528 [SHOI2001]排序工作量之新任务

    P2528 [SHOI2001]排序工作量之新任务 题目描述 假设我们将序列中第i件物品的参数定义为Ai,那么排序就是指将A1,…,An从小到大排序.若i<j且Ai>Aj,则<i ...

  9. exit与return的区别

    ===========================PHP的解释=========================================================== return ...

  10. C# .net async await 学习

    async/await简单介绍 在处理比较耗时的操作(如图片处理.数据压缩.http请求等)传统的异步方法是直接使用Thread或者Task进行操作,在复杂的应用编写中可能会出现回调的问题,因此C#目 ...