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