Search code examples
windowssap-guiwindows-error-reporting

Can I disable the unhandled exception handler for a process?


I am performing system tests on a SAP system. From time to time, SAP crashes and I'd like to recover from those crashes by resetting the virtual machine to a previously saved state.

My problem is that I cannot detect such crashes reliably. I have created WER LocalDumps registry entries, but I don't get dumps.

It seems SAP has registered an unhandled exception handler and performs different tasks on different types of exceptions. Sometimes it shows a message box and terminates the application (e.g. in case of compression errors), sometimes it goes with a so-called Short Dump.

I am neither interested in the message box, nor in the short dump, so I am looking for a way to disable the unhandled exception handler of SAP. This should bring up WER, which writes the dump file and I can take actions to restart my system tests.

For performance reasons, I'd not like to restart the VM on every test.

I have tried:

  • I am basically familiar with unhandled exception handlers. I have applied them to my own .NET code successfully.
  • I looked at SetUnhandledExceptionFilter (MSDN) and similar but it applies to the calling process only and I cannot modify the code of SAP.
  • I read about DisableUserModeCallbackFilter but I don't think it is helpful for my case

I wonder whether there is a Registry Setting (e.g. in ImageFileExecutionOptions) or a Shim that I could activate.


Solution

  • According to Hans Passant's comment (which I take as an authorative answer),

    There is no boss override switch built into the operating system to stop it from doing this.

    I finally attached the debugger to SAP GUI at a time where the process was alive. Starting with all exceptions enabled, I narrowed down the conditions so that WinDbg would break when SAP GUI crashed (first chance, then second chance).