I'm relatively new to asm and wanted to code a programm using SEH. But it was very hard to find some SEH-examples for Nasm :(
Finaly I found a nice example for Tasm and translated it to nasm. If anyone is interested: Here it is


EXTERN MessageBoxA
EXTERN ExitProcess

SECTION DATA USE32 CLASS=DATA
msg db "*!Error!*",0

SECTION CODE USE32 CLASS=CODE
..start:

mov eax, EXCEPTIONHANDLER
push eax
push dword
mov , esp
;===================

sub eax, eax ;preparing for error
mov dword , 'ZMEP' ;ERROR => now we jump to EXCEPTIONHANDLER

;===================
jmp RESTORESEH ;if there was no Error we jump to RESTORESEH


EXCEPTIONHANDLER:
mov esp,
;===================
push dword 0 ;this code is executed if there was an error
push dword msg
push dword msg
push dword 0
call MessageBoxA
;===================

RESTORESEH:
pop dword
add ESP, 4

ende:
push dword 0
call ExitProcess
Posted on 2002-12-30 07:59:44 by bugtrap
Great work! I am sure it will be useful to majority of NASM users here (I am sure there are some...).
Posted on 2002-12-30 11:30:54 by comrade