| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome_elf/chrome_elf_main.h" | 5 #include "chrome_elf/chrome_elf_main.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "chrome/install_static/install_details.h" |
| 10 #include "chrome/install_static/install_util.h" | 11 #include "chrome/install_static/install_util.h" |
| 12 #include "chrome/install_static/product_install_details.h" |
| 11 #include "chrome_elf/blacklist/blacklist.h" | 13 #include "chrome_elf/blacklist/blacklist.h" |
| 12 #include "chrome_elf/crash/crash_helper.h" | 14 #include "chrome_elf/crash/crash_helper.h" |
| 13 | 15 |
| 14 void SignalChromeElf() { | 16 void SignalChromeElf() { |
| 15 blacklist::ResetBeacon(); | 17 blacklist::ResetBeacon(); |
| 16 } | 18 } |
| 17 | 19 |
| 20 extern "C" intptr_t GetInstallDetailsPayload() { |
| 21 return install_static::InstallDetails::Get().GetPayload(); |
| 22 } |
| 23 |
| 18 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 24 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
| 19 if (reason == DLL_PROCESS_ATTACH) { | 25 if (reason == DLL_PROCESS_ATTACH) { |
| 26 install_static::InitializeModuleProductDetails(); |
| 27 |
| 20 if (!elf_crash::InitializeCrashReporting()) { | 28 if (!elf_crash::InitializeCrashReporting()) { |
| 21 #ifdef _DEBUG | 29 #ifdef _DEBUG |
| 22 assert(false); | 30 assert(false); |
| 23 #endif // _DEBUG | 31 #endif // _DEBUG |
| 24 } | 32 } |
| 25 // CRT on initialization installs an exception filter which calls | 33 // CRT on initialization installs an exception filter which calls |
| 26 // TerminateProcess. We need to hook CRT's attempt to set an exception. | 34 // TerminateProcess. We need to hook CRT's attempt to set an exception. |
| 27 // NOTE: Do not hook if ASan is present, or ASan will fail to install | 35 // NOTE: Do not hook if ASan is present, or ASan will fail to install |
| 28 // its own unhandled exception filter. | 36 // its own unhandled exception filter. |
| 29 #if !defined(ADDRESS_SANITIZER) | 37 #if !defined(ADDRESS_SANITIZER) |
| 30 elf_crash::DisableSetUnhandledExceptionFilter(); | 38 elf_crash::DisableSetUnhandledExceptionFilter(); |
| 31 #endif // !defined (ADDRESS_SANITIZER) | 39 #endif // !defined (ADDRESS_SANITIZER) |
| 32 | 40 |
| 33 install_static::InitializeProcessType(); | 41 install_static::InitializeProcessType(); |
| 34 | 42 |
| 35 __try { | 43 __try { |
| 36 blacklist::Initialize(false); // Don't force, abort if beacon is present. | 44 blacklist::Initialize(false); // Don't force, abort if beacon is present. |
| 37 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { | 45 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { |
| 38 } | 46 } |
| 39 } else if (reason == DLL_PROCESS_DETACH) { | 47 } else if (reason == DLL_PROCESS_DETACH) { |
| 40 elf_crash::ShutdownCrashReporting(); | 48 elf_crash::ShutdownCrashReporting(); |
| 41 } | 49 } |
| 42 return TRUE; | 50 return TRUE; |
| 43 } | 51 } |
| OLD | NEW |