News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Share my SEH(structured exception handling) macros.

Started by hoverlees, February 05, 2010, 06:17:12 AM

Previous topic - Next topic

hoverlees

Hope these macors will help you.
Use these SEH macros,you can use C++ like syntax to catch and handling the exceptions.The syntax like this:


__try exceptionid
;code snippet which may cause exceptions
__catch exceptionid
;code snippet will execute when the exception is caught
__finally exceptionid
;end the exception caught


the exceptionid is programmer defined string and a __try-__catch-__finally block must use the same exceptionid.
The macros will use the exceptionid to define global labels,so different __try-__catch__finally block must use different exception ids.
The __try-__catch-__finally block can be nested like this:


__try e1
;your code
__catch e1
__try e2
;your code
__catch e2
;your code
__finally e2
__finally e1


if you want to throw an exception,the easiest way is read or write null pointer  :toothy

TNick