News:

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

Exception handling

Started by tofu-sensei, June 05, 2007, 01:14:10 PM

Previous topic - Next topic

tofu-sensei

If you've been reading this subforum you're probably aware of the changed exception model in x64 versions of Windows.
Unfortunately there seems to be virtually no information on how to use it with MASM.
Any pointers to more information or even working examples would be greatly appreciated :)

MazeGen

Hi tofu-sensei, I already saw your "amd64" macros and you really seem to know something about it. Or they don't work? ;)

tofu-sensei

As far as I can tell they're working fine :wink
Unfortunately I have no idea how to implement, say, the equivalent of a try-catch-block or a stack-unwinding mechanism.

feryno

I'm not sure whether this helps you or not

see the directory
IgnoreExceptions
http://fdbg.x86asm.net/fdbg0015_samples.zip
it has some ideas how to debug exception handler

and the executable in
http://beatrix2004.free.fr/BeaBA/BeaBA.rar
seems to have Exception Directory of a PE32+

and some reading
http://66.102.9.104/search?q=cache:ycabCQnoeFoJ:www.osronline.com/article.cfm%3Farticle%3D469+exception+directory&hl=cs&ct=clnk&cd=7&gl=cz

tofu-sensei

The sample programs seem to deal with vectored exception handling - not quite what I was looking for.
I also found the article you linked to, unfortunately it lacks any non-C examples.
The structures containing the unwind information are pretty well documented on MSDN. The only "example" on exception handling I found (here) was this
The following sample shows how to specify an unwind/exception handler:
; ml64 ex3.asm /link /entry:Example1  /SUBSYSTEM:Console
text SEGMENT
PUBLIC Example3
PUBLIC Example3_UW
Example3_UW PROC NEAR
   ; exception/unwind handler body

   ret 0

Example3_UW ENDP

Example3 PROC FRAME : Example3_UW

   sub rsp, 16
.allocstack 16

.endprolog

   ; function body
    add rsp, 16
   ret 0

Example3 ENDP
text ENDS
END

which is not that helpful.

Biterider

Hi
Attached you can find the SEH file I used for the ObjAsm32 project. There you can find how to use it, if you can not figure it out how to use it.
VEH adds more functionality to SEH and supersedes it using the proper APIs. Unfortunately, it is not available for older OSs.

Regards,

Biterider


[attachment deleted by admin]

tofu-sensei

No offence, but this thread is about 64-bit exception handling :wink

tofu-sensei

Hooray, I got some rudimentary exception handling to work :P
Will post some example code soon.