summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 16:25:24 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 16:25:24 +0000
commit2205b65d494a2188d7c480113a0f71fbcca27a67 (patch)
treefc4f3130c5c1cd258139911d7ce6bdd337a3885e /chrome/installer/setup
parent36bbf7a7721021c992757d60a68a73d7751c8509 (diff)
downloadchromium_src-2205b65d494a2188d7c480113a0f71fbcca27a67.zip
chromium_src-2205b65d494a2188d7c480113a0f71fbcca27a67.tar.gz
chromium_src-2205b65d494a2188d7c480113a0f71fbcca27a67.tar.bz2
During uninstall on Vista try to elevate if registry entries from HKLM need to be deleted.
BUG=7178 Review URL: http://codereview.chromium.org/82003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/main.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 98b2191..4731b2f 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -454,6 +454,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
}
installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
+ const wchar_t* cmd_params,
const installer::Version* version,
bool system_install) {
LOG(INFO) << "Uninstalling Chome";
@@ -468,6 +469,26 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
bool remove_all = !cmd_line.HasSwitch(
installer_util::switches::kDoNotRemoveSharedItems);
bool force = cmd_line.HasSwitch(installer_util::switches::kForceUninstall);
+
+ // Check if we need admin rights to cleanup HKLM. Try to elevate - if it works
+ // exit from this process, if not just continue uninstalling in the current
+ // process itself.
+ if (remove_all &&
+ ShellUtil::AdminNeededForRegistryCleanup() &&
+ !IsUserAnAdmin() &&
+ (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) &&
+ !cmd_line.HasSwitch(installer_util::switches::kRunAsAdmin)) {
+ std::wstring exe = cmd_line.program();
+ std::wstring params(cmd_params);
+ // Append --run-as-admin flag to let the new instance of setup.exe know
+ // that we already tried to launch ourselves as admin.
+ params.append(L" --");
+ params.append(installer_util::switches::kRunAsAdmin);
+ DWORD exit_code = installer_util::UNKNOWN_STATUS;
+ if (InstallUtil::ExecuteExeAsAdmin(exe, params, &exit_code))
+ return static_cast<installer_util::InstallStatus>(exit_code);
+ }
+
return installer_setup::UninstallChrome(cmd_line.program(), system_install,
*version, remove_all, force);
}
@@ -595,6 +616,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// If --uninstall option is given, uninstall chrome
if (parsed_command_line.HasSwitch(installer_util::switches::kUninstall)) {
install_status = UninstallChrome(parsed_command_line,
+ command_line,
installed_version.get(),
system_install);
// If --uninstall option is not specified, we assume it is install case.