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 11 matching lines...) Expand all Loading... |
22 #ifdef _DEBUG | 22 #ifdef _DEBUG |
23 assert(false); | 23 assert(false); |
24 #endif // _DEBUG | 24 #endif // _DEBUG |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 void SignalChromeElf() { | 28 void SignalChromeElf() { |
29 blacklist::ResetBeacon(); | 29 blacklist::ResetBeacon(); |
30 } | 30 } |
31 | 31 |
32 extern "C" void GetUserDataDirectoryThunk(wchar_t* user_data_dir, | |
33 size_t user_data_dir_length, | |
34 wchar_t* invalid_user_data_dir, | |
35 size_t invalid_user_data_dir_length) { | |
36 std::wstring user_data_dir_str, invalid_user_data_dir_str; | |
37 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str, | |
38 &invalid_user_data_dir_str); | |
39 assert(ret); | |
40 install_static::IgnoreUnused(ret); | |
41 wcsncpy_s(user_data_dir, user_data_dir_length, user_data_dir_str.c_str(), | |
42 _TRUNCATE); | |
43 wcsncpy_s(invalid_user_data_dir, invalid_user_data_dir_length, | |
44 invalid_user_data_dir_str.c_str(), _TRUNCATE); | |
45 } | |
46 | |
47 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 32 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
48 if (reason == DLL_PROCESS_ATTACH) { | 33 if (reason == DLL_PROCESS_ATTACH) { |
49 install_static::InitializeProductDetailsForPrimaryModule(); | 34 install_static::InitializeProductDetailsForPrimaryModule(); |
50 | 35 |
51 // CRT on initialization installs an exception filter which calls | 36 // CRT on initialization installs an exception filter which calls |
52 // TerminateProcess. We need to hook CRT's attempt to set an exception. | 37 // TerminateProcess. We need to hook CRT's attempt to set an exception. |
53 elf_crash::DisableSetUnhandledExceptionFilter(); | 38 elf_crash::DisableSetUnhandledExceptionFilter(); |
54 | 39 |
55 install_static::InitializeProcessType(); | |
56 | |
57 __try { | 40 __try { |
58 blacklist::Initialize(false); // Don't force, abort if beacon is present. | 41 blacklist::Initialize(false); // Don't force, abort if beacon is present. |
59 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { | 42 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { |
60 } | 43 } |
61 } else if (reason == DLL_PROCESS_DETACH) { | 44 } else if (reason == DLL_PROCESS_DETACH) { |
62 elf_crash::ShutdownCrashReporting(); | 45 elf_crash::ShutdownCrashReporting(); |
63 } | 46 } |
64 return TRUE; | 47 return TRUE; |
65 } | 48 } |
OLD | NEW |