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

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

Issue 316753003: Always read and write Google Update registry values from the 32-bit hive, even on 64-bit systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review changes Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/google_update_settings.cc
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index feac280afb50d454c4e4530bb0af129b95af1f52..71684120983b992cce9c753d10196d57b36fb210 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -75,6 +75,7 @@ bool WriteGoogleUpdateStrKeyInternal(const AppRegistrationData& app_reg_data,
// presubmit: allow wstring
const std::wstring& value,
const wchar_t* const aggregate) {
+ const REGSAM kAccess = KEY_SET_VALUE | KEY_WOW64_32KEY;
if (system_install) {
DCHECK(aggregate);
// Machine installs require each OS user to write a unique key under a
@@ -89,13 +90,12 @@ bool WriteGoogleUpdateStrKeyInternal(const AppRegistrationData& app_reg_data,
base::string16 reg_path(app_reg_data.GetStateMediumKey());
reg_path.append(L"\\");
reg_path.append(name);
- RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE);
+ RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), kAccess);
key.WriteValue(google_update::kRegAggregateMethod, aggregate);
return (key.WriteValue(uniquename.c_str(), value.c_str()) == ERROR_SUCCESS);
} else {
// User installs are easy: just write the values to HKCU tree.
- RegKey key(HKEY_CURRENT_USER, app_reg_data.GetStateKey().c_str(),
- KEY_SET_VALUE);
+ RegKey key(HKEY_CURRENT_USER, app_reg_data.GetStateKey().c_str(), kAccess);
return (key.WriteValue(name, value.c_str()) == ERROR_SUCCESS);
}
}
@@ -226,12 +226,13 @@ bool GoogleUpdateSettings::GetCollectStatsConsentAtLevel(bool system_install) {
RegKey key;
DWORD value = 0;
bool have_value = false;
+ const REGSAM kAccess = KEY_QUERY_VALUE | KEY_WOW64_32KEY;
// For system-level installs, try ClientStateMedium first.
have_value =
system_install &&
key.Open(HKEY_LOCAL_MACHINE, dist->GetStateMediumKey().c_str(),
- KEY_QUERY_VALUE) == ERROR_SUCCESS &&
+ kAccess) == ERROR_SUCCESS &&
key.ReadValueDW(google_update::kRegUsageStatsField,
&value) == ERROR_SUCCESS;
@@ -240,7 +241,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsentAtLevel(bool system_install) {
have_value =
key.Open(system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
dist->GetStateKey().c_str(),
- KEY_QUERY_VALUE) == ERROR_SUCCESS &&
+ kAccess) == ERROR_SUCCESS &&
key.ReadValueDW(google_update::kRegUsageStatsField,
&value) == ERROR_SUCCESS;
}
@@ -271,7 +272,8 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install,
std::wstring reg_path =
system_install ? dist->GetStateMediumKey() : dist->GetStateKey();
RegKey key;
- LONG result = key.Create(root_key, reg_path.c_str(), KEY_SET_VALUE);
+ LONG result = key.Create(
+ root_key, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
if (result != ERROR_SUCCESS) {
LOG(ERROR) << "Failed opening key " << reg_path << " to set "
<< google_update::kRegUsageStatsField << "; result: " << result;
@@ -303,13 +305,14 @@ bool GoogleUpdateSettings::SetEULAConsent(
bool consented) {
DCHECK(dist);
const DWORD eula_accepted = consented ? 1 : 0;
+ const REGSAM kAccess = KEY_SET_VALUE | KEY_WOW64_32KEY;
std::wstring reg_path = dist->GetStateMediumKey();
bool succeeded = true;
RegKey key;
// Write the consent value into the product's ClientStateMedium key.
if (key.Create(HKEY_LOCAL_MACHINE, reg_path.c_str(),
- KEY_SET_VALUE) != ERROR_SUCCESS ||
+ kAccess) != ERROR_SUCCESS ||
key.WriteValue(google_update::kRegEULAAceptedField,
eula_accepted) != ERROR_SUCCESS) {
succeeded = false;
@@ -325,7 +328,7 @@ bool GoogleUpdateSettings::SetEULAConsent(
BrowserDistribution::CHROME_BINARIES);
reg_path = dist->GetStateMediumKey();
if (key.Create(HKEY_LOCAL_MACHINE, reg_path.c_str(),
- KEY_SET_VALUE) != ERROR_SUCCESS ||
+ kAccess) != ERROR_SUCCESS ||
key.WriteValue(google_update::kRegEULAAceptedField,
eula_accepted) != ERROR_SUCCESS) {
succeeded = false;
@@ -697,7 +700,7 @@ base::string16 GoogleUpdateSettings::GetUninstallCommandLine(
RegKey update_key;
if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate,
- KEY_QUERY_VALUE) == ERROR_SUCCESS) {
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
update_key.ReadValue(google_update::kRegUninstallCmdLine, &cmd_line);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698