-
-
[求助]异常处理:fs:[0]指向的结构改为静态内存,为什么不正确?(附代码)
-
发表于: 2008-3-14 16:05 4103
-
.586p
.model flat, stdcall
option casemap :none ; case sensitive
Include windows.inc
Include user32.inc
Include kernel32.inc
IncludeLib user32.lib
IncludeLib kernel32.lib
;;============================
.data
szCap db "biaoti",0
szMsgOK db "hwbnet",0
szMsgERR1 db "xiu fu",0
errjg dd 0,offset perThread_Handler
jcq db 200 dup(?)
.code
kaishi:
ASSUME FS:NOTHING;否则Masm编译报错
comment ~
fs:[0]->
EXCEPTION_REGISTRATION struc
prev dd ? ;前一个_EXCEPTION_REGISTRATION结构
handler dd ? ;异常处理例程入口....呵呵,现在明白该怎么作了吧
EXCEPTION_REGISTRATION ends
~
push offset perThread_Handler
push fs:[0]
mov fs:[0],esp
comment ~
fs:[0]指向的结构改为静态内存,为什么不正确?
mov DWORD ptr errjg+4,offset perThread_Handler
mov eax,DWORD ptr fs:[0]
mov DWORD ptr errjg,eax
mov DWORD ptr fs:[0],offset errjg
~
xor ecx,ecx
mov eax,200
cdq
div ecx
invoke MessageBox,0,addr szMsgERR1,addr szCap,10h+1000h
pop fs:[0] ;清除seh链表
add esp,4
invoke ExitProcess,0
perThread_Handler:
invoke MessageBox,NULL,addr szMsgOK,addr szCap, 40h+1000h
mov eax,1
; mov eax,-1;
ret
end kaishi
.model flat, stdcall
option casemap :none ; case sensitive
Include windows.inc
Include user32.inc
Include kernel32.inc
IncludeLib user32.lib
IncludeLib kernel32.lib
;;============================
.data
szCap db "biaoti",0
szMsgOK db "hwbnet",0
szMsgERR1 db "xiu fu",0
errjg dd 0,offset perThread_Handler
jcq db 200 dup(?)
.code
kaishi:
ASSUME FS:NOTHING;否则Masm编译报错
comment ~
fs:[0]->
EXCEPTION_REGISTRATION struc
prev dd ? ;前一个_EXCEPTION_REGISTRATION结构
handler dd ? ;异常处理例程入口....呵呵,现在明白该怎么作了吧
EXCEPTION_REGISTRATION ends
~
push offset perThread_Handler
push fs:[0]
mov fs:[0],esp
comment ~
fs:[0]指向的结构改为静态内存,为什么不正确?
mov DWORD ptr errjg+4,offset perThread_Handler
mov eax,DWORD ptr fs:[0]
mov DWORD ptr errjg,eax
mov DWORD ptr fs:[0],offset errjg
~
xor ecx,ecx
mov eax,200
cdq
div ecx
invoke MessageBox,0,addr szMsgERR1,addr szCap,10h+1000h
pop fs:[0] ;清除seh链表
add esp,4
invoke ExitProcess,0
perThread_Handler:
invoke MessageBox,NULL,addr szMsgOK,addr szCap, 40h+1000h
mov eax,1
; mov eax,-1;
ret
end kaishi
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
赞赏
雪币:
留言: