diff options
-rw-r--r-- | chrome/installer/setup/install_worker.cc | 15 | ||||
-rw-r--r-- | chrome/installer/util/installer_state.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/installer_state.h | 3 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.cc | 10 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 1 |
5 files changed, 31 insertions, 2 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 245abc4..7d774e2 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -168,6 +168,15 @@ void AddInstallerCopyTasks(const InstallerState& installer_state, temp_path.value(), WorkItem::ALWAYS); } + if (installer_state.RequiresActiveSetup()) { + // Make a copy of setup.exe with a different name so that Active Setup + // doesn't require an admin on XP thanks to Application Compatibility. + FilePath active_setup_exe(installer_dir.Append(kActiveSetupExe)); + install_list->AddCopyTreeWorkItem( + setup_path.value(), active_setup_exe.value(), temp_path.value(), + WorkItem::ALWAYS); + } + // If only the App Host (not even the Chrome Binaries) is being installed, // this must be a user-level App Host piggybacking on system-level Chrome // Binaries. Only setup.exe is required, and only for uninstall. @@ -1400,6 +1409,7 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, << "-level " << distribution->GetAppShortCutName(); return; } + DCHECK(installer_state.RequiresActiveSetup()); const HKEY root = HKEY_LOCAL_MACHINE; const string16 active_setup_path( @@ -1410,8 +1420,9 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, list->AddSetRegValueWorkItem(root, active_setup_path, L"", distribution->GetAppShortCutName(), true); - CommandLine cmd(installer_state.GetInstallerDirectory(new_version). - Append(setup_path.BaseName())); + FilePath active_setup_exe(installer_state.GetInstallerDirectory(new_version) + .Append(kActiveSetupExe)); + CommandLine cmd(active_setup_exe); cmd.AppendSwitch(installer::switches::kConfigureUserSettings); cmd.AppendSwitch(installer::switches::kVerboseLogging); cmd.AppendSwitch(installer::switches::kSystemLevel); diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index c30a602..a720137 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -790,4 +790,8 @@ void InstallerState::WriteInstallerResult( LOG(ERROR) << "Failed to record installer error information in registry."; } +bool InstallerState::RequiresActiveSetup() const { + return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); +} + } // namespace installer diff --git a/chrome/installer/util/installer_state.h b/chrome/installer/util/installer_state.h index 2fb0c0d..b6ddb15 100644 --- a/chrome/installer/util/installer_state.h +++ b/chrome/installer/util/installer_state.h @@ -205,6 +205,9 @@ class InstallerState { int string_resource_id, const std::wstring* launch_cmd) const; + // Returns true if this install needs to register an Active Setup command. + bool RequiresActiveSetup() const; + protected: // Returns true if |file| exists and cannot be opened for exclusive write // access. diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 47c3605..ef2b076 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -193,6 +193,16 @@ const char kToastResultsKey[] = "toast-results-key"; } // namespace switches +// The Active Setup executable will be an identical copy of setup.exe; this is +// necessary because Windows' installer detection heuristics (which include +// things like process name being "setup.exe") will otherwise force elevation +// for non-admin users when setup.exe is launched. This is mitigated by adding +// requestedExecutionLevel="asInvoker" to setup.exe's manifest on Vista+, but +// there is no such manifest entry on Windows XP (which results in +// crbug.com/166473). +// TODO(gab): Rename setup.exe itself altogether and use the same binary for +// Active Setup. +const wchar_t kActiveSetupExe[] = L"chrmstp.exe"; const wchar_t kChromeAppHostExe[] = L"app_host.exe"; const wchar_t kChromeDll[] = L"chrome.dll"; const wchar_t kChromeExe[] = L"chrome.exe"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index f06cc36..da07084 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -178,6 +178,7 @@ extern const char kExperimentGroup[]; extern const char kToastResultsKey[]; } // namespace switches +extern const wchar_t kActiveSetupExe[]; extern const wchar_t kChromeAppHostExe[]; extern const wchar_t kChromeDll[]; extern const wchar_t kChromeExe[]; |