Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include <windows.h>
7 #include "client/windows/handler/exception_handler.h"
9 using google_breakpad::ExceptionHandler;
10 using std::wstring;
12 extern "C" BOOL WINAPI DummyEntryPoint(HINSTANCE instance,
13 DWORD reason,
14 void* reserved)
15 {
16 __debugbreak();
18 return FALSE; // We're being loaded remotely, this shouldn't happen!
19 }
21 // support.microsoft.com/kb/94248
22 extern "C" BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved);
24 extern "C"
25 __declspec(dllexport) DWORD Start(void* context)
26 {
27 // Because the remote DLL injector does not call DllMain, we have to
28 // initialize the CRT manually
29 _CRT_INIT(nullptr, DLL_PROCESS_ATTACH, nullptr);
31 HANDLE hCrashPipe = reinterpret_cast<HANDLE>(context);
33 ExceptionHandler* e = new (std::nothrow)
34 ExceptionHandler(wstring(), nullptr, nullptr, nullptr,
35 ExceptionHandler::HANDLER_ALL,
36 MiniDumpNormal, hCrashPipe, nullptr);
37 if (e)
38 e->set_handle_debug_exceptions(true);
39 return 1;
40 }