首页
社区
课程
招聘
[求助]为什么在winxp系统中,驱动程序中的__try{} __except{}无效?
发表于: 2008-6-17 20:44 5888

[求助]为什么在winxp系统中,驱动程序中的__try{} __except{}无效?

2008-6-17 20:44
5888
网上有一段关于隐藏服务的代码,主要是在驱动中附加(Attach)到services.exe进程中,然后在services.exe进程的0x300000到0x5000000地址空间中搜索相应的字符串;在该段代码中使用到了
__try {
......

}
__except() {

.......
}
进行内存搜索,在win2000和win2003系统上__try{} __except{}好像有效果,当访问到无效的地址时就进入__except{};但是在XP系统上则没有效果,当访问一个无效的地址时,系统蓝屏,没有进__except{}。。。。
这是为什么呀??

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (7)
雪    币: 70
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
因为
__try {}
__except() {}
的实现是基于 ring3 下的。
2008-6-17 21:26
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
不是的,__try {}__except{}在win2000/2003的驱动中也可以的,我通过windbg的内核调试跟踪到了,

请大侠解释一下为什么__try {}__except{}在win xp的驱动中不能使用???
2008-6-17 21:52
0
雪    币: 242
活跃值: (14)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
4
屁基于用户态,不懂別乱说
2008-6-18 00:38
0
雪    币: 242
活跃值: (14)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
5
有些错误是没法用SEH处理的.
关键代码和DUMP贴出来,你只这么问鬼知道什么问题
2008-6-18 00:43
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
NTSTATUS status;
        PEPROCESS eProcess = NULL;
        ULONG i;
       
        eProcess = GetProcEprocess();
        if(eProcess != NULL) {
                KeAttachProcess( eProcess );
                for (i = 0x300000; i < 0x5000000; i+=4) {
                        __try{
                                if (!wcscmp((const wchar_t *)i, servicesName)) {
                                        DeleteServicesFromServiceRecordList(i , serDisplayName);
                                }
                        }
                        __except(EXCEPTION_EXECUTE_HANDLER ) {
                                i-=4;
                                i += 0x1000;
                        }
                }
       
                KeDetachProcess();
        }

请各位大侠帮帮忙!!!
2008-6-18 08:50
0
雪    币: 4593
活跃值: (3572)
能力值: ( LV12,RANK:230 )
在线值:
发帖
回帖
粉丝
7
Which Exceptions Can Be Trapped

Gary Nebbett researched the question of which exceptions can be trapped
with the structured exception mechanism and reported his results in a
newsgroup post several years ago. In summary, the following exceptions
will be caught when they occur at IRQL less than or equal to
DISPATCH_LEVEL (note that some of these are specific to the Intel x86
processor):

a. Anything signaled by ExRaiseStatus and related functions
b. Attempt to dereference invalid pointer to user-mode memory
c. Debug or breakpoint exception
d. Integer overflow (INTO instruction)
e. Invalid opcode

Note that a reference to an invalid kernel-mode pointer leads directly to
a bug check and can’t be trapped. Likewise, a divide-by-zero exception or
a BOUND instruction exception leads to a bug check.
2008-6-18 09:52
0
雪    币: 178
活跃值: (144)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
8
看你的样子,是读用户态内存,ProbeForRead试试,mmisaddressvalid也试试,seh无法捕捉内核态的严重错误~~,内核认为这个错误很严重的话,直接BSOD
2008-8-26 07:16
0
游客
登录 | 注册 方可回帖
返回
//