This is a cheap Try-Catch macros(d/l .inc file below).
Sample Code:
I forgot: remove align 32 if an error occurs during the assembling stage.
Sample Code:
[size=9]
Euclid PROC STDCALL m:DWORD, n:DWORD
@@STEP1:
TRY<EXCEPTION>
mov ecx, n
mov eax, m
[color=#3366FF];or ecx, ecx
;jz @@PREMATURESTEP4[/color]
xor edx, edx
div ecx
CATCH<EXCEPTION>
xor eax, eax
or edx, edx
jz @@STEP4
mov m, ecx
mov n, edx
jmp @@STEP1
@@STEP4:
mov eax, ecx
ret
@@PREMATURESTEP4:
CLEANUP
ret
Euclid ENDP[/size]
Note: Uncomment the comments above to get the correct answer. The comment was just there to force a probability of division by zero exception. I know, I know, that there are better SEH includes out there but if anyone who just wants a simple Try-Catch exception handling, go for it. :)
I forgot: remove align 32 if an error occurs during the assembling stage.