1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsCrashOnException.h"
9 #include "nsICrashReporter.h"
10 #include "nsServiceManagerUtils.h"
14 static int ReportException(EXCEPTION_POINTERS
* aExceptionInfo
) {
15 nsCOMPtr
<nsICrashReporter
> cr
=
16 do_GetService("@mozilla.org/toolkit/crash-reporter;1");
18 cr
->WriteMinidumpForException(aExceptionInfo
);
21 return EXCEPTION_EXECUTE_HANDLER
;
25 CallWindowProcCrashProtected(WNDPROC aWndProc
, HWND aHWnd
, UINT aMsg
,
26 WPARAM aWParam
, LPARAM aLParam
) {
27 MOZ_SEH_TRY
{ return aWndProc(aHWnd
, aMsg
, aWParam
, aLParam
); }
28 MOZ_SEH_EXCEPT(ReportException(GetExceptionInformation())) {
29 ::TerminateProcess(::GetCurrentProcess(), 253);
31 return 0; // not reached
34 } // namespace mozilla