toolkit/crashreporter/injector/injector.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 }

mercurial