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, | 32 extern "C" void GetUserDataDirectoryThunk(wchar_t* user_data_dir, |
grt (UTC plus 2)
2017/05/19 08:15:50
this thunk isn't needed any more, is it? can its c
manzagop (departed)
2017/05/19 22:02:07
Done.
| |
33 size_t user_data_dir_length, | 33 size_t user_data_dir_length, |
34 wchar_t* invalid_user_data_dir, | 34 wchar_t* invalid_user_data_dir, |
35 size_t invalid_user_data_dir_length) { | 35 size_t invalid_user_data_dir_length) { |
36 std::wstring user_data_dir_str, invalid_user_data_dir_str; | 36 std::wstring user_data_dir_str, invalid_user_data_dir_str; |
37 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str, | 37 bool ret = install_static::GetUserDataDirectory( |
38 &invalid_user_data_dir_str); | 38 install_static::InstallDetails::Get().mode(), &user_data_dir_str, |
39 &invalid_user_data_dir_str); | |
39 assert(ret); | 40 assert(ret); |
40 install_static::IgnoreUnused(ret); | 41 install_static::IgnoreUnused(ret); |
41 wcsncpy_s(user_data_dir, user_data_dir_length, user_data_dir_str.c_str(), | 42 wcsncpy_s(user_data_dir, user_data_dir_length, user_data_dir_str.c_str(), |
42 _TRUNCATE); | 43 _TRUNCATE); |
43 wcsncpy_s(invalid_user_data_dir, invalid_user_data_dir_length, | 44 wcsncpy_s(invalid_user_data_dir, invalid_user_data_dir_length, |
44 invalid_user_data_dir_str.c_str(), _TRUNCATE); | 45 invalid_user_data_dir_str.c_str(), _TRUNCATE); |
45 } | 46 } |
46 | 47 |
47 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 48 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
48 if (reason == DLL_PROCESS_ATTACH) { | 49 if (reason == DLL_PROCESS_ATTACH) { |
49 install_static::InitializeProductDetailsForPrimaryModule(); | 50 install_static::InitializeProductDetailsForPrimaryModule(); |
50 | 51 |
51 // CRT on initialization installs an exception filter which calls | 52 // CRT on initialization installs an exception filter which calls |
52 // TerminateProcess. We need to hook CRT's attempt to set an exception. | 53 // TerminateProcess. We need to hook CRT's attempt to set an exception. |
53 elf_crash::DisableSetUnhandledExceptionFilter(); | 54 elf_crash::DisableSetUnhandledExceptionFilter(); |
54 | 55 |
55 install_static::InitializeProcessType(); | 56 install_static::InitializeProcessType(); |
56 | 57 |
57 __try { | 58 __try { |
58 blacklist::Initialize(false); // Don't force, abort if beacon is present. | 59 blacklist::Initialize(false); // Don't force, abort if beacon is present. |
59 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { | 60 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { |
60 } | 61 } |
61 } else if (reason == DLL_PROCESS_DETACH) { | 62 } else if (reason == DLL_PROCESS_DETACH) { |
62 elf_crash::ShutdownCrashReporting(); | 63 elf_crash::ShutdownCrashReporting(); |
63 } | 64 } |
64 return TRUE; | 65 return TRUE; |
65 } | 66 } |
OLD | NEW |