In Windows, does “The exception unknown software e

2020-03-02 04:54发布

问题:

At shutdown (initiated by an UPS) my application crashes and a messagebox appears.

The text in the messagebox is "The exception unknown software exception (0x40000015) occurred in the application".

I browsed ntstatus.h and found STATUS_FATAL_APP_EXIT? If it were right, why the message box say "unknown software exception"?

回答1:

Yes, 0x40000015 means STATUS_FATAL_APP_EXIT. Your app causes an unhandled runtime exception during shutdown. Some runtime exceptions are actually handled if you don't handle them yourself, and some of these default handlers call abort(). By default, abort calls:

_call_reportfault(_CRT_DEBUGGER_ABORT, STATUS_FATAL_APP_EXIT, EXCEPTION_NONCONTINUABLE);

abort is a generic termination - it doesn't know what specific exception prompted it to be called, hence the generic 'unknown software exception' message.

One path to abort is via the _purecall exception - calling an unimplemented pure virtual call.

Gleaned from purevirt.c and abort.c in the Visual Studio\VC\crt\src directory.


MSDN has documentation on overriding the default pure call exception handler.

Here are some related questions:

  • Capturing R6025 pure virtual call
  • Where do "pure virtual function call" crashes come from?
  • Shutdown exception handling for Win32/C++