Here is the problem. My application calls CoCreateInstance() to create a COM object implemented in a third-party DLL. This DLL calls set_terminate() to change the terminate() handler and passes the address of its own terminate() handler.
The start address of the terminate() handler is not stored by this library - it doesnβt care and just changes the handler and never restores it. As soon as the DLL is unloaded, its code is no longer in the process memory, therefore, if terminate() is now called, the program starts in undefined behavior.
I want to get and save the address of the initial terminate() handler so that I can recover it. How can i do this?
source share