| 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 26 matching lines...) Expand all Loading... |
| 37 #include "base/win/scoped_comptr.h" | 37 #include "base/win/scoped_comptr.h" |
| 38 #include "base/win/scoped_handle.h" | 38 #include "base/win/scoped_handle.h" |
| 39 #include "base/win/win_util.h" | 39 #include "base/win/win_util.h" |
| 40 #include "base/win/windows_version.h" | 40 #include "base/win/windows_version.h" |
| 41 #include "chrome/common/chrome_constants.h" | 41 #include "chrome/common/chrome_constants.h" |
| 42 #include "chrome/common/chrome_paths.h" | 42 #include "chrome/common/chrome_paths.h" |
| 43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/installer/setup/archive_patch_helper.h" | 44 #include "chrome/installer/setup/archive_patch_helper.h" |
| 45 #include "chrome/installer/setup/install.h" | 45 #include "chrome/installer/setup/install.h" |
| 46 #include "chrome/installer/setup/install_worker.h" | 46 #include "chrome/installer/setup/install_worker.h" |
| 47 #include "chrome/installer/setup/installer_crash_reporting.h" | 47 #include "chrome/installer/setup/installer_crash_reporter_client.h" |
| 48 #include "chrome/installer/setup/setup_constants.h" | 48 #include "chrome/installer/setup/setup_constants.h" |
| 49 #include "chrome/installer/setup/setup_util.h" | 49 #include "chrome/installer/setup/setup_util.h" |
| 50 #include "chrome/installer/setup/uninstall.h" | 50 #include "chrome/installer/setup/uninstall.h" |
| 51 #include "chrome/installer/util/browser_distribution.h" | 51 #include "chrome/installer/util/browser_distribution.h" |
| 52 #include "chrome/installer/util/delete_after_reboot_helper.h" | 52 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 53 #include "chrome/installer/util/delete_tree_work_item.h" | 53 #include "chrome/installer/util/delete_tree_work_item.h" |
| 54 #include "chrome/installer/util/google_update_constants.h" | 54 #include "chrome/installer/util/google_update_constants.h" |
| 55 #include "chrome/installer/util/google_update_settings.h" | 55 #include "chrome/installer/util/google_update_settings.h" |
| 56 #include "chrome/installer/util/google_update_util.h" | 56 #include "chrome/installer/util/google_update_util.h" |
| 57 #include "chrome/installer/util/helper.h" | 57 #include "chrome/installer/util/helper.h" |
| 58 #include "chrome/installer/util/html_dialog.h" | 58 #include "chrome/installer/util/html_dialog.h" |
| 59 #include "chrome/installer/util/install_util.h" | 59 #include "chrome/installer/util/install_util.h" |
| 60 #include "chrome/installer/util/installation_state.h" | 60 #include "chrome/installer/util/installation_state.h" |
| 61 #include "chrome/installer/util/installation_validator.h" | 61 #include "chrome/installer/util/installation_validator.h" |
| 62 #include "chrome/installer/util/installer_crash_reporting.h" |
| 62 #include "chrome/installer/util/installer_state.h" | 63 #include "chrome/installer/util/installer_state.h" |
| 63 #include "chrome/installer/util/installer_util_strings.h" | 64 #include "chrome/installer/util/installer_util_strings.h" |
| 64 #include "chrome/installer/util/l10n_string_util.h" | 65 #include "chrome/installer/util/l10n_string_util.h" |
| 65 #include "chrome/installer/util/logging_installer.h" | 66 #include "chrome/installer/util/logging_installer.h" |
| 66 #include "chrome/installer/util/lzma_util.h" | 67 #include "chrome/installer/util/lzma_util.h" |
| 67 #include "chrome/installer/util/master_preferences.h" | 68 #include "chrome/installer/util/master_preferences.h" |
| 68 #include "chrome/installer/util/master_preferences_constants.h" | 69 #include "chrome/installer/util/master_preferences_constants.h" |
| 69 #include "chrome/installer/util/self_cleaning_temp_dir.h" | 70 #include "chrome/installer/util/self_cleaning_temp_dir.h" |
| 70 #include "chrome/installer/util/shell_util.h" | 71 #include "chrome/installer/util/shell_util.h" |
| 71 #include "chrome/installer/util/user_experiment.h" | 72 #include "chrome/installer/util/user_experiment.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 installer_state.WriteInstallerResult(*install_status, | 252 installer_state.WriteInstallerResult(*install_status, |
| 252 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, | 253 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, |
| 253 NULL); | 254 NULL); |
| 254 return false; | 255 return false; |
| 255 } | 256 } |
| 256 | 257 |
| 257 // Short-circuit if uncompression produced the uncompressed archive rather | 258 // Short-circuit if uncompression produced the uncompressed archive rather |
| 258 // than a patch file. | 259 // than a patch file. |
| 259 if (base::PathExists(archive_helper->target())) { | 260 if (base::PathExists(archive_helper->target())) { |
| 260 *archive_type = installer::FULL_ARCHIVE_TYPE; | 261 *archive_type = installer::FULL_ARCHIVE_TYPE; |
| 262 installer::SetArchiveTypeCrashKey(*archive_type); |
| 261 return true; | 263 return true; |
| 262 } | 264 } |
| 263 | 265 |
| 264 // Find the installed version's archive to serve as the source for patching. | 266 // Find the installed version's archive to serve as the source for patching. |
| 265 base::FilePath patch_source(installer::FindArchiveToPatch(original_state, | 267 base::FilePath patch_source(installer::FindArchiveToPatch(original_state, |
| 266 installer_state, | 268 installer_state, |
| 267 previous_version)); | 269 previous_version)); |
| 268 if (patch_source.empty()) { | 270 if (patch_source.empty()) { |
| 269 LOG(ERROR) << "Failed to find archive to patch."; | 271 LOG(ERROR) << "Failed to find archive to patch."; |
| 270 *install_status = installer::DIFF_PATCH_SOURCE_MISSING; | 272 *install_status = installer::DIFF_PATCH_SOURCE_MISSING; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 281 installer_state.UpdateStage(installer::BINARY_PATCHING); | 283 installer_state.UpdateStage(installer::BINARY_PATCHING); |
| 282 if (!archive_helper->BinaryPatch()) { | 284 if (!archive_helper->BinaryPatch()) { |
| 283 *install_status = installer::APPLY_DIFF_PATCH_FAILED; | 285 *install_status = installer::APPLY_DIFF_PATCH_FAILED; |
| 284 installer_state.WriteInstallerResult( | 286 installer_state.WriteInstallerResult( |
| 285 *install_status, IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); | 287 *install_status, IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); |
| 286 return false; | 288 return false; |
| 287 } | 289 } |
| 288 } | 290 } |
| 289 | 291 |
| 290 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; | 292 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; |
| 293 installer::SetArchiveTypeCrashKey(*archive_type); |
| 291 return true; | 294 return true; |
| 292 } | 295 } |
| 293 | 296 |
| 294 // In multi-install, adds all products to |installer_state| that are | 297 // In multi-install, adds all products to |installer_state| that are |
| 295 // multi-installed and must be updated along with the products already present | 298 // multi-installed and must be updated along with the products already present |
| 296 // in |installer_state|. | 299 // in |installer_state|. |
| 297 void AddExistingMultiInstalls(const InstallationState& original_state, | 300 void AddExistingMultiInstalls(const InstallationState& original_state, |
| 298 InstallerState* installer_state) { | 301 InstallerState* installer_state) { |
| 299 if (installer_state->is_multi_install()) { | 302 if (installer_state->is_multi_install()) { |
| 300 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { | 303 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 if (*archive_type == UNKNOWN_ARCHIVE_TYPE) { | 1416 if (*archive_type == UNKNOWN_ARCHIVE_TYPE) { |
| 1414 // An archive was not uncompressed or patched above. | 1417 // An archive was not uncompressed or patched above. |
| 1415 if (uncompressed_archive.empty() || | 1418 if (uncompressed_archive.empty() || |
| 1416 !base::PathExists(uncompressed_archive)) { | 1419 !base::PathExists(uncompressed_archive)) { |
| 1417 LOG(ERROR) << "Cannot install Chrome without an uncompressed archive."; | 1420 LOG(ERROR) << "Cannot install Chrome without an uncompressed archive."; |
| 1418 installer_state.WriteInstallerResult( | 1421 installer_state.WriteInstallerResult( |
| 1419 INVALID_ARCHIVE, IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 1422 INVALID_ARCHIVE, IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
| 1420 return INVALID_ARCHIVE; | 1423 return INVALID_ARCHIVE; |
| 1421 } | 1424 } |
| 1422 *archive_type = FULL_ARCHIVE_TYPE; | 1425 *archive_type = FULL_ARCHIVE_TYPE; |
| 1426 installer::SetArchiveTypeCrashKey(*archive_type); |
| 1423 } | 1427 } |
| 1424 | 1428 |
| 1425 // Unpack the uncompressed archive. | 1429 // Unpack the uncompressed archive. |
| 1426 if (LzmaUtil::UnPackArchive(uncompressed_archive.value(), | 1430 if (LzmaUtil::UnPackArchive(uncompressed_archive.value(), |
| 1427 unpack_path.value(), | 1431 unpack_path.value(), |
| 1428 NULL)) { | 1432 NULL)) { |
| 1429 installer_state.WriteInstallerResult( | 1433 installer_state.WriteInstallerResult( |
| 1430 UNPACKING_FAILED, | 1434 UNPACKING_FAILED, |
| 1431 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, | 1435 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, |
| 1432 NULL); | 1436 NULL); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 bool system_install = false; | 1650 bool system_install = false; |
| 1647 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1651 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1648 VLOG(1) << "system install is " << system_install; | 1652 VLOG(1) << "system install is " << system_install; |
| 1649 | 1653 |
| 1650 InstallationState original_state; | 1654 InstallationState original_state; |
| 1651 original_state.Initialize(); | 1655 original_state.Initialize(); |
| 1652 | 1656 |
| 1653 InstallerState installer_state; | 1657 InstallerState installer_state; |
| 1654 installer_state.Initialize(cmd_line, prefs, original_state); | 1658 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1655 | 1659 |
| 1656 installer::ConfigureCrashReporting(installer_state); | 1660 InstallerCrashReporterClient::Configure(installer_state); |
| 1657 installer::SetInitialCrashKeys(installer_state); | 1661 installer::SetInitialCrashKeys(installer_state); |
| 1658 installer::SetCrashKeysFromCommandLine(cmd_line); | 1662 installer::SetCrashKeysFromCommandLine(cmd_line); |
| 1659 | 1663 |
| 1660 // Make sure the process exits cleanly on unexpected errors. | 1664 // Make sure the process exits cleanly on unexpected errors. |
| 1661 base::EnableTerminationOnHeapCorruption(); | 1665 base::EnableTerminationOnHeapCorruption(); |
| 1662 base::EnableTerminationOnOutOfMemory(); | 1666 base::EnableTerminationOnOutOfMemory(); |
| 1663 base::win::RegisterInvalidParamHandler(); | 1667 base::win::RegisterInvalidParamHandler(); |
| 1664 base::win::SetupCRT(cmd_line); | 1668 base::win::SetupCRT(cmd_line); |
| 1665 | 1669 |
| 1666 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); | 1670 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1693 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || | 1697 cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
| 1694 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1698 cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
| 1695 return installer::SXS_OPTION_NOT_SUPPORTED; | 1699 return installer::SXS_OPTION_NOT_SUPPORTED; |
| 1696 } | 1700 } |
| 1697 } | 1701 } |
| 1698 | 1702 |
| 1699 // Some command line options are no longer supported and must error out. | 1703 // Some command line options are no longer supported and must error out. |
| 1700 if (installer::ContainsUnsupportedSwitch(cmd_line)) | 1704 if (installer::ContainsUnsupportedSwitch(cmd_line)) |
| 1701 return installer::UNSUPPORTED_OPTION; | 1705 return installer::UNSUPPORTED_OPTION; |
| 1702 | 1706 |
| 1707 VLOG(1) << "crashing"; |
| 1708 RaiseException(0x0000DEAD,0,0,0); |
| 1709 VLOG(1) << "done crashing"; |
| 1710 |
| 1703 // A variety of installer operations require the path to the current | 1711 // A variety of installer operations require the path to the current |
| 1704 // executable. Get it once here for use throughout these operations. Note that | 1712 // executable. Get it once here for use throughout these operations. Note that |
| 1705 // the path service is the authoritative source for this path. One might think | 1713 // the path service is the authoritative source for this path. One might think |
| 1706 // that CommandLine::GetProgram would suffice, but it won't since | 1714 // that CommandLine::GetProgram would suffice, but it won't since |
| 1707 // CreateProcess may have been called with a command line that is somewhat | 1715 // CreateProcess may have been called with a command line that is somewhat |
| 1708 // ambiguous (e.g., an unquoted path with spaces, or a path lacking the file | 1716 // ambiguous (e.g., an unquoted path with spaces, or a path lacking the file |
| 1709 // extension), in which case CommandLineToArgv will not yield an argv with the | 1717 // extension), in which case CommandLineToArgv will not yield an argv with the |
| 1710 // true path to the program at position 0. | 1718 // true path to the program at position 0. |
| 1711 base::FilePath setup_exe; | 1719 base::FilePath setup_exe; |
| 1712 PathService::Get(base::FILE_EXE, &setup_exe); | 1720 PathService::Get(base::FILE_EXE, &setup_exe); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1783 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1776 // to pass through, since this is only returned on uninstall which is | 1784 // to pass through, since this is only returned on uninstall which is |
| 1777 // never invoked directly by Google Update. | 1785 // never invoked directly by Google Update. |
| 1778 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1786 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1779 } | 1787 } |
| 1780 | 1788 |
| 1781 VLOG(1) << "Installation complete, returning: " << return_code; | 1789 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1782 | 1790 |
| 1783 return return_code; | 1791 return return_code; |
| 1784 } | 1792 } |
| OLD | NEW |