| 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_details.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str, | 26 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str, |
| 27 &invalid_user_data_dir_str); | 27 &invalid_user_data_dir_str); |
| 28 assert(ret); | 28 assert(ret); |
| 29 install_static::IgnoreUnused(ret); | 29 install_static::IgnoreUnused(ret); |
| 30 wcsncpy_s(user_data_dir, user_data_dir_length, user_data_dir_str.c_str(), | 30 wcsncpy_s(user_data_dir, user_data_dir_length, user_data_dir_str.c_str(), |
| 31 _TRUNCATE); | 31 _TRUNCATE); |
| 32 wcsncpy_s(invalid_user_data_dir, invalid_user_data_dir_length, | 32 wcsncpy_s(invalid_user_data_dir, invalid_user_data_dir_length, |
| 33 invalid_user_data_dir_str.c_str(), _TRUNCATE); | 33 invalid_user_data_dir_str.c_str(), _TRUNCATE); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Returns the payload for the ELF's InstallDetails instance. For use by | |
| 37 // install_static::InstallDetails::InitializeFromPrimaryModule. | |
| 38 extern "C" const install_static::InstallDetails::Payload* | |
| 39 GetInstallDetailsPayload() { | |
| 40 return install_static::InstallDetails::Get().GetPayload(); | |
| 41 } | |
| 42 | |
| 43 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 36 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
| 44 if (reason == DLL_PROCESS_ATTACH) { | 37 if (reason == DLL_PROCESS_ATTACH) { |
| 45 install_static::InitializeProductDetailsForPrimaryModule(); | 38 install_static::InitializeProductDetailsForPrimaryModule(); |
| 46 | 39 |
| 47 if (!elf_crash::InitializeCrashReporting()) { | 40 if (!elf_crash::InitializeCrashReporting()) { |
| 48 assert(false); | 41 assert(false); |
| 49 } | 42 } |
| 50 | 43 |
| 51 // CRT on initialization installs an exception filter which calls | 44 // CRT on initialization installs an exception filter which calls |
| 52 // TerminateProcess. We need to hook CRT's attempt to set an exception. | 45 // TerminateProcess. We need to hook CRT's attempt to set an exception. |
| 53 elf_crash::DisableSetUnhandledExceptionFilter(); | 46 elf_crash::DisableSetUnhandledExceptionFilter(); |
| 54 | 47 |
| 55 install_static::InitializeProcessType(); | 48 install_static::InitializeProcessType(); |
| 56 | 49 |
| 57 __try { | 50 __try { |
| 58 blacklist::Initialize(false); // Don't force, abort if beacon is present. | 51 blacklist::Initialize(false); // Don't force, abort if beacon is present. |
| 59 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { | 52 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { |
| 60 } | 53 } |
| 61 } else if (reason == DLL_PROCESS_DETACH) { | 54 } else if (reason == DLL_PROCESS_DETACH) { |
| 62 elf_crash::ShutdownCrashReporting(); | 55 elf_crash::ShutdownCrashReporting(); |
| 63 } | 56 } |
| 64 return TRUE; | 57 return TRUE; |
| 65 } | 58 } |
| OLD | NEW |