Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4841)

Unified Diff: chrome/installer/util/product.cc

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/package_unittest.cc ('k') | chrome/installer/util/product_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/product.cc
===================================================================
--- chrome/installer/util/product.cc (revision 71761)
+++ chrome/installer/util/product.cc (working copy)
@@ -126,12 +126,11 @@
// We didn't find it in the preferences, try looking in the registry.
HKEY reg_root = system_level() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey key;
- if (key.Open(reg_root, distribution_->GetStateKey().c_str(), KEY_READ)) {
- DWORD msi_value;
- if (key.ReadValueDW(google_update::kRegMSIField, &msi_value) &&
- msi_value != 0) {
- msi_ = true;
- }
+ if (key.Open(reg_root, distribution_->GetStateKey().c_str(),
+ KEY_READ) == ERROR_SUCCESS) {
+ DWORD msi_value = 0;
+ key.ReadValueDW(google_update::kRegMSIField, &msi_value);
+ msi_ = msi_value != 0;
}
} else {
msi_ = true;
@@ -143,22 +142,19 @@
}
bool Product::SetMsiMarker(bool set) const {
- bool success = false;
HKEY reg_root = system_level() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey client_state_key;
- if (client_state_key.Open(reg_root, distribution_->GetStateKey().c_str(),
- KEY_READ | KEY_WRITE)) {
- DWORD msi_value = set ? 1 : 0;
- if (client_state_key.WriteValue(google_update::kRegMSIField, msi_value)) {
- success = true;
- } else {
- LOG(ERROR) << "Could not write MSI value to client state key.";
- }
- } else {
- LOG(ERROR) << "SetMsiMarker: Could not open client state key!";
+ LONG result = client_state_key.Open(reg_root,
+ distribution_->GetStateKey().c_str(), KEY_READ | KEY_WRITE);
+ if (result == ERROR_SUCCESS) {
+ result = client_state_key.WriteValue(google_update::kRegMSIField,
+ set ? 1 : 0);
}
- return success;
+ LOG_IF(ERROR, result != ERROR_SUCCESS) << "Failed to Open or Write MSI value"
+ "to client state key. error: " << result;
+
+ return (result == ERROR_SUCCESS);
}
bool Product::ShouldCreateUninstallEntry() const {
« no previous file with comments | « chrome/installer/util/package_unittest.cc ('k') | chrome/installer/util/product_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698