title: Can I decode a C++ exception from a Windows SEH exception? (And if so, how?)
body: <p>In the event of an unhandled C++ exception I want to print:</p>
  
  <ol>
  <li>The message (<code>what()</code>) of the C++ exception</li>
  <li>A stack trace.</li>
  </ol>
  
  <p>In order to get the stack trace, I'm using <code>SetUnhandledExceptionFilter</code> in combination with the <a href="http://www.codeproject.com/Articles/11132/Walking-the-callstack" rel="noreferrer">StackWalker</a> library:</p>
  
  <pre><code>struct FooStackWalker : StackWalker
  {
      virtual void OnCallstackEntry(CallstackEntryType, CallstackEntry &amp;entry) override
      {
          std::cerr &lt;&lt; entry.lineFileName &lt;&lt; " (" &lt;&lt; entry.lineNumber &lt;&lt; "): " &lt;&lt; entry.undFullName &lt;&lt; std::endl;
      }
  };
  
  LONG WINAPI UnhandledExceptionHandler(LPEXCEPTION_POINTERS pointers)
  {
      FooStackWalker walker;
      walker.ShowCallstack(::GetCurrentThread(), pointers-&gt;ContextRecord);
      ::TerminateProcess(::GetCurrentProcess(), 1);
  }
  
  
  int main()
  {
      ::SetUnhandledExceptionFilter(UnhandledExceptionHandler);
  }
  </code></pre>
  
  <p>I've gotten the stack trace to print just fine, but now getting <code>what</code> is difficult.</p>
  
  <p>Is there some way I can decode the SEH exception as a C++ exception in order to call this member function before termination?</p>