is there some way to run code on termination, no matter what kind termination (abnormal,normal,uncaught exception etc.)? I know its actually possible in Java, but is it even possible in C++? Im assuming a windows environment.
No -- if somebody invokes TerminateProcess
, your process will be destroyed without further adieu, and (in particular) without any chance to run any more code in the process of shutting down.