The next release of salflibc64.dll includes an extenion to TRAP_EXCEPTION@ for x64. Here is some sample code that illustrates the extension.
integer(7) function Handler()
include <EXCEPTN.INS>
print*,'Processing Handler'
Handler = CONTINUE_EXECUTION
end function
integer(7) function Handler0()
include <EXCEPTN.INS>
print*,'Processing Handler0'
Handler = NONCONTINUABLE_EXCEPTION
end function
program test
integer,parameter::INT_DIVIDEBY_ZERO=14
integer(7),external::Handler,Handler0
integer(7) prevHandler,TRAP_EXCEPTION@
!Note: TRAP_EXCEPTION@ returns integer(7).
prevHandler = TRAP_EXCEPTION@(INT_DIVIDEBY_ZERO, Handler0)
prevHandler = TRAP_EXCEPTION@(Z'80010012', Handler)
i = 0
k = 10/i
end program test
The extension allows the exception number Z'80010012' to be used as the first argument.
If recovery after exception Z'80010012' is possible then CONTINUE_EXECUTION can be used in the handler.
If recovery is not possible (as in divide by zero) then NONCONTINUABLE_EXCEPTION must be used.
This will allow you to test if the exception is literally an error or something that will be absorbed later within the relevant Windows API call.
p.s. I am assuming that it is an internal Microsoft error that hopefully they will fix in due course.