Starting with the example from the manual, I added definitions for the structures that come into use and an example for detecting the exception code and for repairing the cause.
The structure definitions you might need for handling exceptions in win64 are separated for your use in exceptions.inc
Both files are visually long, so they're added as attachments.
You may find this part weird
section .data align=8
text: db 'Exception handled',0
align 8
caption:db 'Exception!',0
align 8
contextpointer: dq 0
vals: dq 0
align 8
printext: times 128 db 0
align 8
template: db 'Exception %08X triggered at %08X%08X.',10,'Press Yes to handle, No to try again or Cancel to generate dump.',0
align 8
backup: dq vals
I use the align after each, because currently it doesn't work from the section definition for some reason and it's supposedly good practice to have them aligned like that. Something to do with memory access times.