diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 16:25:24 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 16:25:24 +0000 |
commit | 2205b65d494a2188d7c480113a0f71fbcca27a67 (patch) | |
tree | fc4f3130c5c1cd258139911d7ce6bdd337a3885e /chrome/installer/util/shell_util.cc | |
parent | 36bbf7a7721021c992757d60a68a73d7751c8509 (diff) | |
download | chromium_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/util/shell_util.cc')
-rw-r--r-- | chrome/installer/util/shell_util.cc | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 2e5e9c5..99fd0a6 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -152,7 +152,8 @@ class RegistryEntry { } } - // Check if the current registry entry exists in HKLM registry. + // Checks if the current registry entry exists in HKLM registry and the value + // is same. bool ExistsInHKLM() { RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str()); bool found = false; @@ -169,6 +170,22 @@ class RegistryEntry { return found; } + // Checks if the current registry entry exists in HKLM registry + // (only the name). + bool NameExistsInHKLM() { + RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str()); + bool found = false; + if (_is_string) { + std::wstring read_value; + found = key.ReadValue(_name.c_str(), &read_value); + } else { + DWORD read_value; + found = key.ReadValueDW(_name.c_str(), &read_value); + } + key.Close(); + return found; + } + private: // Create a object that represent default value of a key RegistryEntry(const std::wstring& key_path, const std::wstring& value) : @@ -413,6 +430,19 @@ ShellUtil::RegisterStatus ShellUtil::AddChromeToSetAccessDefaults( return ShellUtil::FAILURE; } +bool ShellUtil::AdminNeededForRegistryCleanup() { + bool cleanup_needed = false; + std::list<RegistryEntry*> entries = RegistryEntry::GetAllEntries( + installer_util::kChromeExe); + for (std::list<RegistryEntry*>::iterator itr = entries.begin(); + itr != entries.end(); ++itr) { + if (!cleanup_needed && (*itr)->NameExistsInHKLM()) + cleanup_needed = true; + delete (*itr); + } + return cleanup_needed; +} + bool ShellUtil::GetChromeIcon(std::wstring& chrome_icon) { if (chrome_icon.empty()) return false; |