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

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

Issue 300593002: Make omaha, gcapi and uninstall registry accesses use Wow6432Node on 64-bit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move the uninstall registry access to 32-bit Created 6 years, 7 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
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 9d3a549afea288c7db2aca781965ee367d818c90..6d7c32039206a0bb6e18d214e667809fc8222924 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -55,9 +55,10 @@ namespace {
bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
std::wstring reg_path = dist->GetStateKey();
- RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
+ RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
if (key.ReadValue(name, value) != ERROR_SUCCESS) {
- RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
+ RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(),
+ KEY_READ | KEY_WOW64_32KEY);
return (hklm_key.ReadValue(name, value) == ERROR_SUCCESS);
}
return true;
@@ -126,7 +127,8 @@ bool WriteGoogleUpdateStrKeyMultiInstall(BrowserDistribution* dist,
bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
std::wstring reg_path = dist->GetStateKey();
- RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
+ RegKey key(HKEY_CURRENT_USER, reg_path.c_str(),
+ KEY_READ | KEY_WRITE | KEY_WOW64_32KEY);
std::wstring value;
if (key.ReadValue(name, &value) != ERROR_SUCCESS)
return false;
@@ -136,7 +138,8 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
bool RemoveGoogleUpdateStrKey(const wchar_t* const name) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
std::wstring reg_path = dist->GetStateKey();
- RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
+ RegKey key(HKEY_CURRENT_USER, reg_path.c_str(),
+ KEY_READ | KEY_WRITE | KEY_WOW64_32KEY);
if (!key.HasValue(name))
return true;
return (key.DeleteValue(name) == ERROR_SUCCESS);
@@ -152,7 +155,7 @@ bool GetChromeChannelInternal(bool system_install,
HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
base::string16 reg_path = dist->GetStateKey();
- RegKey key(root_key, reg_path.c_str(), KEY_READ);
+ RegKey key(root_key, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
installer::ChannelInfo channel_info;
if (!channel_info.Initialize(key)) {
@@ -434,7 +437,7 @@ void GoogleUpdateSettings::UpdateInstallStatus(bool system_install,
reg_key.append(L"\\");
reg_key.append(product_guid);
LONG result = key.Open(reg_root, reg_key.c_str(),
- KEY_QUERY_VALUE | KEY_SET_VALUE);
+ KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY);
if (result == ERROR_SUCCESS)
channel_info.Initialize(key);
else if (result != ERROR_FILE_NOT_FOUND)
@@ -446,9 +449,10 @@ void GoogleUpdateSettings::UpdateInstallStatus(bool system_install,
// Create the app's ClientState key if it doesn't already exist.
if (!key.Valid()) {
result = key.Open(reg_root, google_update::kRegPathClientState,
- KEY_CREATE_SUB_KEY);
+ KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY);
if (result == ERROR_SUCCESS)
- result = key.CreateKey(product_guid.c_str(), KEY_SET_VALUE);
+ result = key.CreateKey(product_guid.c_str(),
+ KEY_SET_VALUE | KEY_WOW64_32KEY);
if (result != ERROR_SUCCESS) {
LOG(ERROR) << "Failed to create " << reg_key << "; Error: " << result;
@@ -519,7 +523,8 @@ int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() {
std::wstring reg_path = dist->GetStateKey();
// Minimum access needed is to be able to write to this key.
- RegKey reg_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE);
+ RegKey reg_key(HKEY_LOCAL_MACHINE, reg_path.c_str(),
+ KEY_SET_VALUE | KEY_WOW64_32KEY);
if (!reg_key.Valid())
return 0;
@@ -552,6 +557,7 @@ GoogleUpdateSettings::UpdatePolicy GoogleUpdateSettings::GetAppUpdatePolicy(
RegKey policy_key;
// Google Update Group Policy settings are always in HKLM.
+ // TODO(wfh): Check if policies should go into Wow6432Node or not.
if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) ==
ERROR_SUCCESS) {
DWORD value = 0;
@@ -703,7 +709,7 @@ Version GoogleUpdateSettings::GetGoogleUpdateVersion(bool system_install) {
if (key.Open(root_key,
google_update::kRegPathGoogleUpdate,
- KEY_QUERY_VALUE) == ERROR_SUCCESS &&
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.ReadValue(google_update::kRegGoogleUpdateVersion,
&version) == ERROR_SUCCESS) {
return Version(base::UTF16ToUTF8(version));
@@ -718,7 +724,7 @@ base::Time GoogleUpdateSettings::GetGoogleUpdateLastStartedAU(
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) {
DWORD last_start;
if (update_key.ReadValueDW(google_update::kRegLastStartedAUField,
&last_start) == ERROR_SUCCESS) {
@@ -735,7 +741,7 @@ base::Time GoogleUpdateSettings::GetGoogleUpdateLastChecked(
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) {
DWORD last_check;
if (update_key.ReadValueDW(google_update::kRegLastCheckedField,
&last_check) == ERROR_SUCCESS) {
@@ -761,7 +767,7 @@ bool GoogleUpdateSettings::GetUpdateDetailForApp(bool system_install,
RegKey clientstate;
if (clientstate.Open(root_key, clientstate_reg_path.c_str(),
- KEY_QUERY_VALUE) == ERROR_SUCCESS) {
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
base::string16 version;
DWORD dword_value;
if ((clientstate.ReadValueDW(google_update::kRegLastCheckSuccessField,
@@ -824,7 +830,7 @@ bool GoogleUpdateSettings::SetExperimentLabels(
base::string16 client_state_path(
system_install ? dist->GetStateMediumKey() : dist->GetStateKey());
RegKey client_state(
- reg_root, client_state_path.c_str(), KEY_SET_VALUE);
+ reg_root, client_state_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
if (experiment_labels.empty()) {
success = client_state.DeleteValue(google_update::kExperimentLabels)
== ERROR_SUCCESS;
@@ -852,8 +858,8 @@ bool GoogleUpdateSettings::ReadExperimentLabels(
system_install ? dist->GetStateMediumKey() : dist->GetStateKey());
RegKey client_state;
- LONG result =
- client_state.Open(reg_root, client_state_path.c_str(), KEY_QUERY_VALUE);
+ LONG result = client_state.Open(reg_root, client_state_path.c_str(),
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY);
if (result == ERROR_SUCCESS) {
result = client_state.ReadValue(google_update::kExperimentLabels,
experiment_labels);

Powered by Google App Engine
This is Rietveld 408576698