为什么我的SEH处理函数执行了两次?
.386
.model flat,stdcall
option casemap:none
include d:\masm32\include\windows.inc
include d:\masm32\include\kernel32.inc
include d:\masm32\include\user32.inc
includelib d:\masm32\lib\kernel32.lib
includelib d:\masm32\lib\user32.lib
.data
szCaption db 'Win32汇编例子',0
szText db 'Win32汇编,Simple and powerful!',0
szSEHCaption db 'SEH Handler',0
szSEHText db 'Win32 Asm SEH Handler',0
.code
start:
assume fs:nothing
push offset Error_Handler
push fs:[0]
mov fs:[0],esp
invoke MessageBox,NULL,addr szText,addr szCaption,MB_OK
xor eax,eax
mov [eax],eax
pop fs:[0]
pop eax
invoke ExitProcess,NULL
Error_Handler proc uses ecx lpExceptRecord:DWORD,
lpFrame:DWORD,
lpContext:DWORD,
lpDispatch:DWORD
invoke MessageBox,NULL,addr szSEHText,addr szSEHCaption,MB_OK
ret
Error_Handler endp
end start
请问fs:[0]存放的是SEH处理函数指针还是指向上个SEH处理函数指针呢?
为什么我执行xor eax,eax mov [eax],eax激发异常时,执行了我的SEH函数两次呢?
还有,如果写正确的SEH呢?执行完自己的SEH后如果回复原来的SEH呢?