| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/installer/setup/setup_main.h" | 5 #include "chrome/installer/setup/setup_main.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <msi.h> | 8 #include <msi.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "chrome/installer/util/master_preferences.h" | 75 #include "chrome/installer/util/master_preferences.h" |
| 76 #include "chrome/installer/util/master_preferences_constants.h" | 76 #include "chrome/installer/util/master_preferences_constants.h" |
| 77 #include "chrome/installer/util/self_cleaning_temp_dir.h" | 77 #include "chrome/installer/util/self_cleaning_temp_dir.h" |
| 78 #include "chrome/installer/util/shell_util.h" | 78 #include "chrome/installer/util/shell_util.h" |
| 79 #include "chrome/installer/util/user_experiment.h" | 79 #include "chrome/installer/util/user_experiment.h" |
| 80 #include "chrome/installer/util/util_constants.h" | 80 #include "chrome/installer/util/util_constants.h" |
| 81 #include "components/crash/content/app/crash_switches.h" | 81 #include "components/crash/content/app/crash_switches.h" |
| 82 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 82 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
| 83 #include "content/public/common/content_switches.h" | 83 #include "content/public/common/content_switches.h" |
| 84 | 84 |
| 85 #if defined(SYZYASAN) |
| 86 #include "base/debug/asan_invalid_access.h" |
| 87 #endif |
| 88 |
| 85 using installer::InstallerState; | 89 using installer::InstallerState; |
| 86 using installer::InstallationState; | 90 using installer::InstallationState; |
| 87 using installer::MasterPreferences; | 91 using installer::MasterPreferences; |
| 88 using installer::Product; | 92 using installer::Product; |
| 89 using installer::ProductState; | 93 using installer::ProductState; |
| 90 | 94 |
| 91 namespace { | 95 namespace { |
| 92 | 96 |
| 93 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; | 97 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; |
| 94 const wchar_t kDisplayVersion[] = L"DisplayVersion"; | 98 const wchar_t kDisplayVersion[] = L"DisplayVersion"; |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 installer::REENABLE_UPDATES_FAILED; | 1039 installer::REENABLE_UPDATES_FAILED; |
| 1036 } else if (cmd_line.HasSwitch( | 1040 } else if (cmd_line.HasSwitch( |
| 1037 installer::switches::kSetDisplayVersionProduct)) { | 1041 installer::switches::kSetDisplayVersionProduct)) { |
| 1038 const base::string16 registry_product( | 1042 const base::string16 registry_product( |
| 1039 cmd_line.GetSwitchValueNative( | 1043 cmd_line.GetSwitchValueNative( |
| 1040 installer::switches::kSetDisplayVersionProduct)); | 1044 installer::switches::kSetDisplayVersionProduct)); |
| 1041 const base::string16 registry_value( | 1045 const base::string16 registry_value( |
| 1042 cmd_line.GetSwitchValueNative( | 1046 cmd_line.GetSwitchValueNative( |
| 1043 installer::switches::kSetDisplayVersionValue)); | 1047 installer::switches::kSetDisplayVersionValue)); |
| 1044 *exit_code = OverwriteDisplayVersions(registry_product, registry_value); | 1048 *exit_code = OverwriteDisplayVersions(registry_product, registry_value); |
| 1049 #if defined(SYZYASAN) |
| 1050 } else if (cmd_line.HasSwitch(installer::switches::kInduceAsanCrash)) { |
| 1051 std::string crash_type = |
| 1052 cmd_line.GetSwitchValueASCII(installer::switches::kInduceAsanCrash); |
| 1053 if (crash_type == installer::switches::kAsanUseAfterFree) { |
| 1054 base::debug::AsanHeapUseAfterFree(); |
| 1055 } else if (crash_type == installer::switches::kAsanHeapOverflow) { |
| 1056 base::debug::AsanHeapOverflow(); |
| 1057 } else if (crash_type == installer::switches::kAsanHeapUnderflow) { |
| 1058 base::debug::AsanHeapUnderflow(); |
| 1059 } else { |
| 1060 LOG(ERROR) << "Invalid Asan error type: " << crash_type; |
| 1061 handled = false; |
| 1062 } |
| 1063 #endif |
| 1045 } else { | 1064 } else { |
| 1046 handled = false; | 1065 handled = false; |
| 1047 } | 1066 } |
| 1048 | 1067 |
| 1049 return handled; | 1068 return handled; |
| 1050 } | 1069 } |
| 1051 | 1070 |
| 1071 #if defined(SYZYASAN) |
| 1072 // Initialize the SyzyAsan crash reporter. This should only be called once the |
| 1073 // crash reporter has been initialized. There should be only one call to this |
| 1074 // function. |
| 1075 void SetupSyzyAsan() { |
| 1076 using SyzyAsanInitializeCrashReporterFn = VOID(WINAPI*)(); |
| 1077 HMODULE syzyasan_handle = ::GetModuleHandle(L"syzyasan_rtl.dll"); |
| 1078 if (!syzyasan_handle) |
| 1079 return; |
| 1080 |
| 1081 SyzyAsanInitializeCrashReporterFn syzyasan_init_crash_reporter = |
| 1082 reinterpret_cast<SyzyAsanInitializeCrashReporterFn>( |
| 1083 ::GetProcAddress(syzyasan_handle, "asan_InitializeCrashReporter")); |
| 1084 if (syzyasan_init_crash_reporter) |
| 1085 syzyasan_init_crash_reporter(); |
| 1086 } |
| 1087 #endif |
| 1088 |
| 1052 } // namespace | 1089 } // namespace |
| 1053 | 1090 |
| 1054 namespace installer { | 1091 namespace installer { |
| 1055 | 1092 |
| 1056 InstallStatus InstallProductsHelper(const InstallationState& original_state, | 1093 InstallStatus InstallProductsHelper(const InstallationState& original_state, |
| 1057 const base::FilePath& setup_exe, | 1094 const base::FilePath& setup_exe, |
| 1058 const base::CommandLine& cmd_line, | 1095 const base::CommandLine& cmd_line, |
| 1059 const MasterPreferences& prefs, | 1096 const MasterPreferences& prefs, |
| 1060 const InstallerState& installer_state, | 1097 const InstallerState& installer_state, |
| 1061 base::FilePath* installer_directory, | 1098 base::FilePath* installer_directory, |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 << installer_state.is_migrating_to_single(); | 1394 << installer_state.is_migrating_to_single(); |
| 1358 | 1395 |
| 1359 persistent_histogram_storage.set_storage_dir( | 1396 persistent_histogram_storage.set_storage_dir( |
| 1360 installer::PersistentHistogramStorage::GetReportedStorageDir( | 1397 installer::PersistentHistogramStorage::GetReportedStorageDir( |
| 1361 installer_state.target_path())); | 1398 installer_state.target_path())); |
| 1362 | 1399 |
| 1363 installer::ConfigureCrashReporting(installer_state); | 1400 installer::ConfigureCrashReporting(installer_state); |
| 1364 installer::SetInitialCrashKeys(installer_state); | 1401 installer::SetInitialCrashKeys(installer_state); |
| 1365 installer::SetCrashKeysFromCommandLine(cmd_line); | 1402 installer::SetCrashKeysFromCommandLine(cmd_line); |
| 1366 | 1403 |
| 1404 #if defined(SYZYASAN) |
| 1405 SetupSyzyAsan(); |
| 1406 #endif |
| 1407 |
| 1367 // Make sure the process exits cleanly on unexpected errors. | 1408 // Make sure the process exits cleanly on unexpected errors. |
| 1368 base::EnableTerminationOnHeapCorruption(); | 1409 base::EnableTerminationOnHeapCorruption(); |
| 1369 base::EnableTerminationOnOutOfMemory(); | 1410 base::EnableTerminationOnOutOfMemory(); |
| 1370 base::win::RegisterInvalidParamHandler(); | 1411 base::win::RegisterInvalidParamHandler(); |
| 1371 base::win::SetupCRT(cmd_line); | 1412 base::win::SetupCRT(cmd_line); |
| 1372 | 1413 |
| 1373 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); | 1414 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); |
| 1374 | 1415 |
| 1375 // Check to make sure current system is Win7 or later. If not, log | 1416 // Check to make sure current system is Win7 or later. If not, log |
| 1376 // error message and get out. | 1417 // error message and get out. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1541 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1501 // to pass through, since this is only returned on uninstall which is | 1542 // to pass through, since this is only returned on uninstall which is |
| 1502 // never invoked directly by Google Update. | 1543 // never invoked directly by Google Update. |
| 1503 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1544 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1504 } | 1545 } |
| 1505 | 1546 |
| 1506 VLOG(1) << "Installation complete, returning: " << return_code; | 1547 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1507 | 1548 |
| 1508 return return_code; | 1549 return return_code; |
| 1509 } | 1550 } |
| OLD | NEW |