Index: chrome/installer/util/install_util.cc |
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc |
index 5f4e2386282c85d44c43f4c0940a950a4e99d4b7..63bba526b72f35532185190f3279bac0594969ac 100644 |
--- a/chrome/installer/util/install_util.cc |
+++ b/chrome/installer/util/install_util.cc |
@@ -360,8 +360,8 @@ bool InstallUtil::HasDelegateExecuteHandler(BrowserDistribution* dist, |
} |
// This method tries to delete a registry key and logs an error message |
-// in case of failure. It returns true if deletion is successful, |
-// otherwise false. |
+// in case of failure. It returns true if deletion is successful (or the key did |
+// not exist), otherwise false. |
bool InstallUtil::DeleteRegistryKey(HKEY root_key, |
const std::wstring& key_path) { |
VLOG(1) << "Deleting registry key " << key_path; |
@@ -375,11 +375,18 @@ bool InstallUtil::DeleteRegistryKey(HKEY root_key, |
} |
// This method tries to delete a registry value and logs an error message |
-// in case of failure. It returns true if deletion is successful, |
-// otherwise false. |
+// in case of failure. It returns true if deletion is successful (or the key did |
+// not exist), otherwise false. |
bool InstallUtil::DeleteRegistryValue(HKEY reg_root, |
const std::wstring& key_path, |
const std::wstring& value_name) { |
+ // Return true immediately if the key doesn't exist (otherwise, creating a key |
+ // with KEY_ALL_ACCESS in the next step creates the key and all its parents if |
+ // they don't exist, in which case new parents are left behind post-deletion). |
+ RegKey key_read_only(reg_root, key_path.c_str(), KEY_QUERY_VALUE); |
+ if (!key_read_only.Valid()) |
+ return true; |
+ |
RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS); |
gab
2012/05/30 20:08:39
This step was causing RemoveBadWindows8Registratio
grt (UTC plus 2)
2012/05/30 20:37:40
Please use something along the lines of:
RegKey k
gab
2012/06/01 00:16:01
Done.
|
VLOG(1) << "Deleting registry value " << value_name; |
if (key.HasValue(value_name.c_str())) { |