The present invention extends to mechanisms for detecting termination and
providing information related to termination of a computer system
process. A computer system loads a termination function (e.g., an abort,
exit, or terminate function) into system memory. The termination function
includes termination instructions that, when executed, cause a calling
process to terminate without providing information related to a
termination event that caused the calling process to terminate. In
memory, the functionality of the memory resident termination function is
redirected to a memory resident invalid instruction that, when executed,
causes an exception providing termination information related to a
termination event (e.g., the exception is propagated to an operating
system code layer). A memory resident process detects a termination event
and the memory resident program calls the termination function. The
computer system redirects the call from the memory resident termination
function to the memory resident detour function.