I'm currently trying to create a C ++ compiler that generates machine code at runtime. However, I'm currently trying to enable safe exception handling (compilation with / SAFESEH). My custom exception handler works in debug mode, but when I run the same code in release mode, my process just ends.
I am pretty sure that the problem is that I cannot register my own exception handler as such, because when I compile my code with / SAFESEH: NO, everything works fine even in release mode.
My custom exception handler is written in my other C ++ code, and I tried to register it as an exception handler by adding the project .asm file to the project:
.386
.model flat
_MyExceptionHandler@16 proto
.safeseh _MyExceptionHandler@16
end
as described here . Then the asm file was compiled with the / safeseh option (among others).
The function of my handler currently has the following declaration:
extern "C" EXCEPTION_DISPOSITION __stdcall MyExceptionHandler(struct
_EXCEPTION_RECORD *ExceptionRecord, void * EstablisherFrame, struct
_CONTEXT *ContextRecord, void * DispatcherContext);
What would be the proper way to register this function as an exception handler?
Thanks for any suggestions!
Filip source
share