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 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1647 for (Products::const_iterator it = products.begin(); it < products.end(); | 1647 for (Products::const_iterator it = products.begin(); it < products.end(); |
1648 ++it) { | 1648 ++it) { |
1649 const Product& product = **it; | 1649 const Product& product = **it; |
1650 product.LaunchUserExperiment(setup_path, install_status, system_install); | 1650 product.LaunchUserExperiment(setup_path, install_status, system_install); |
1651 } | 1651 } |
1652 } | 1652 } |
1653 | 1653 |
1654 // If the installation completed successfully... | 1654 // If the installation completed successfully... |
1655 if (InstallUtil::GetInstallReturnCode(install_status) == 0) { | 1655 if (InstallUtil::GetInstallReturnCode(install_status) == 0) { |
1656 // Update the DisplayVersion created by an MSI-based install. | 1656 // Update the DisplayVersion created by an MSI-based install. |
1657 base::FilePath master_preferences_file( | |
1658 installer_state.target_path().AppendASCII( | |
1659 installer::kDefaultMasterPrefs)); | |
1657 std::string install_id; | 1660 std::string install_id; |
1658 if (prefs.GetString(installer::master_preferences::kMsiProductId, | 1661 if (prefs.GetString(installer::master_preferences::kMsiProductId, |
1659 &install_id)) { | 1662 &install_id)) { |
1663 // A currently active MSI install will have specified the master- | |
1664 // preferences file on the command-line that includes the product-id. | |
1665 // We must delay the setting of the DisplayVersion until after the | |
1666 // grandparent "msiexec" process has exited. | |
1660 base::FilePath new_setup = | 1667 base::FilePath new_setup = |
1661 installer_state.GetInstallerDirectory(*installer_version) | 1668 installer_state.GetInstallerDirectory(*installer_version) |
1662 .Append(kSetupExe); | 1669 .Append(kSetupExe); |
1663 DelayedOverwriteDisplayVersions( | 1670 DelayedOverwriteDisplayVersions( |
1664 new_setup, install_id, *installer_version); | 1671 new_setup, install_id, *installer_version); |
1672 } else if (base::PathExists(master_preferences_file)) { | |
grt (UTC plus 2)
2015/09/25 15:01:27
I don't think it's safe to rely on the value being
robertshield
2015/09/25 15:19:20
I tend to agree, relying on master_preferences to
bcwhite
2015/10/01 13:11:53
I'll look into the ClientState key. Is it okay to
grt (UTC plus 2)
2015/10/01 14:37:58
My inclination is to only check the one authoritat
| |
1673 // In the case of an original MSI install, the master-preferences file | |
1674 // exists but was not passed on the command-line. We load it explicitly | |
1675 // to get the product-id and then, because there is no "msiexec" process | |
1676 // to out-wait, we set the DisplayVersion immediately. | |
1677 const MasterPreferences mp(master_preferences_file); | |
1678 if (mp.GetString(installer::master_preferences::kMsiProductId, | |
1679 &install_id)) { | |
1680 OverwriteDisplayVersions(base::UTF8ToUTF16(install_id), | |
1681 base::UTF8ToUTF16( | |
1682 installer_version->GetString())); | |
1683 } | |
1665 } | 1684 } |
1666 // Return the path to the directory containing the newly installed | 1685 // Return the path to the directory containing the newly installed |
1667 // setup.exe and uncompressed archive if the caller requested it. | 1686 // setup.exe and uncompressed archive if the caller requested it. |
1668 if (installer_directory) { | 1687 if (installer_directory) { |
1669 *installer_directory = | 1688 *installer_directory = |
1670 installer_state.GetInstallerDirectory(*installer_version); | 1689 installer_state.GetInstallerDirectory(*installer_version); |
1671 } | 1690 } |
1672 } | 1691 } |
1673 | 1692 |
1674 // temp_path's dtor will take care of deleting or scheduling itself for | 1693 // temp_path's dtor will take care of deleting or scheduling itself for |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1826 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1845 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1827 // to pass through, since this is only returned on uninstall which is | 1846 // to pass through, since this is only returned on uninstall which is |
1828 // never invoked directly by Google Update. | 1847 // never invoked directly by Google Update. |
1829 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1848 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1830 } | 1849 } |
1831 | 1850 |
1832 VLOG(1) << "Installation complete, returning: " << return_code; | 1851 VLOG(1) << "Installation complete, returning: " << return_code; |
1833 | 1852 |
1834 return return_code; | 1853 return return_code; |
1835 } | 1854 } |
OLD | NEW |