diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-31 03:43:51 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-31 03:43:51 +0000 |
commit | 798f6fbfd9259318e1d2c20765b1be07674b5328 (patch) | |
tree | 0fa35dae9071379f84b6f6cc010dee3b7dace26a /chrome | |
parent | bd5f65e735218ced8db0c9658850de9516c4f1e2 (diff) | |
download | chromium_src-798f6fbfd9259318e1d2c20765b1be07674b5328.zip chromium_src-798f6fbfd9259318e1d2c20765b1be07674b5328.tar.gz chromium_src-798f6fbfd9259318e1d2c20765b1be07674b5328.tar.bz2 |
Handling a case in DeleteRegValueWorkItem where it would report a failure if a key holding the value doesn't exist.
TEST=Fixes an issue with installing chrome frame that came up when the ready-mode support was checked in.
BUG=none
Review URL: http://codereview.chromium.org/6013008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/installer/util/delete_reg_value_work_item.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/installer/util/delete_reg_value_work_item.cc b/chrome/installer/util/delete_reg_value_work_item.cc index e663eef..5b0496d 100644 --- a/chrome/installer/util/delete_reg_value_work_item.cc +++ b/chrome/installer/util/delete_reg_value_work_item.cc @@ -32,8 +32,25 @@ bool DeleteRegValueWorkItem::Do() { return false; } - RegKey key; status_ = VALUE_UNCHANGED; + + // A big flaw in the RegKey implementation is that all error information + // (besides success/failure) is lost in the translation from LSTATUS to bool. + // So, we resort to direct API calls here. :-/ + HKEY raw_key = NULL; + LSTATUS err = RegOpenKeyEx(predefined_root_, key_path_.c_str(), 0, + KEY_READ, &raw_key); + if (err != ERROR_SUCCESS) { + if (err == ERROR_FILE_NOT_FOUND) { + LOG(INFO) << "(delete value) can not open " << key_path_; + status_ = VALUE_NOT_FOUND; + return true; + } + } else { + ::RegCloseKey(raw_key); + } + + RegKey key; bool result = false; if (!key.Open(predefined_root_, key_path_.c_str(), KEY_READ | KEY_WRITE)) { LOG(ERROR) << "can not open " << key_path_; @@ -52,7 +69,6 @@ bool DeleteRegValueWorkItem::Do() { LOG(ERROR) << "failed to read/delete value " << value_name_; } - key.Close(); return result; } |