diff options
author | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-28 01:54:38 +0000 |
---|---|---|
committer | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-28 01:54:38 +0000 |
commit | f7c566f7c49967f6bd468400acf9515766a67c42 (patch) | |
tree | 8ebfc81fb9410b19708817a89fb121f0108c981f /chrome/installer/util/google_update_settings.cc | |
parent | 3adff91954d847094b62d4960a5255418123d251 (diff) | |
download | chromium_src-f7c566f7c49967f6bd468400acf9515766a67c42.zip chromium_src-f7c566f7c49967f6bd468400acf9515766a67c42.tar.gz chromium_src-f7c566f7c49967f6bd468400acf9515766a67c42.tar.bz2 |
Omaha configuration parameters now use Wow6432Node (32-bit registry) on 64-bit installs. GCAPI configuration parameters also use these same accesses since they read/write the same data.
Also, force installation of Win64 into C:\Program Files (x86) until the code is added to support moving the files to the right place during upgrade and downgrade. Uninstall information will remain stored in the 32-bit registry (even on 64-bit) until the installation location is changed.
This fixes system installs on Win64.
BUG=338706
R=grt@chromium.org
Review URL: https://codereview.chromium.org/300593002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273108 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/google_update_settings.cc')
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 9d3a549..1eb46ab 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,9 @@ 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 +139,9 @@ 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 +157,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)) { @@ -433,8 +438,9 @@ void GoogleUpdateSettings::UpdateInstallStatus(bool system_install, std::wstring reg_key(google_update::kRegPathClientState); 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); + LONG result = key.Open(reg_root, + reg_key.c_str(), + KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY); if (result == ERROR_SUCCESS) channel_info.Initialize(key); else if (result != ERROR_FILE_NOT_FOUND) @@ -445,10 +451,12 @@ void GoogleUpdateSettings::UpdateInstallStatus(bool system_install, // We have a modified channel_info value to write. // 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); + result = key.Open(reg_root, + google_update::kRegPathClientState, + 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 +527,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 +561,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,9 +713,9 @@ Version GoogleUpdateSettings::GetGoogleUpdateVersion(bool system_install) { if (key.Open(root_key, google_update::kRegPathGoogleUpdate, - KEY_QUERY_VALUE) == ERROR_SUCCESS && - key.ReadValue(google_update::kRegGoogleUpdateVersion, - &version) == ERROR_SUCCESS) { + KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS && + key.ReadValue(google_update::kRegGoogleUpdateVersion, &version) == + ERROR_SUCCESS) { return Version(base::UTF16ToUTF8(version)); } @@ -717,8 +727,9 @@ base::Time GoogleUpdateSettings::GetGoogleUpdateLastStartedAU( const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey update_key; - if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, - KEY_QUERY_VALUE) == ERROR_SUCCESS) { + if (update_key.Open(root_key, + google_update::kRegPathGoogleUpdate, + KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { DWORD last_start; if (update_key.ReadValueDW(google_update::kRegLastStartedAUField, &last_start) == ERROR_SUCCESS) { @@ -734,8 +745,9 @@ base::Time GoogleUpdateSettings::GetGoogleUpdateLastChecked( const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey update_key; - if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, - KEY_QUERY_VALUE) == ERROR_SUCCESS) { + if (update_key.Open(root_key, + google_update::kRegPathGoogleUpdate, + KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { DWORD last_check; if (update_key.ReadValueDW(google_update::kRegLastCheckedField, &last_check) == ERROR_SUCCESS) { @@ -760,8 +772,9 @@ bool GoogleUpdateSettings::GetUpdateDetailForApp(bool system_install, clientstate_reg_path.append(app_guid); RegKey clientstate; - if (clientstate.Open(root_key, clientstate_reg_path.c_str(), - KEY_QUERY_VALUE) == ERROR_SUCCESS) { + if (clientstate.Open(root_key, + clientstate_reg_path.c_str(), + KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) { base::string16 version; DWORD dword_value; if ((clientstate.ReadValueDW(google_update::kRegLastCheckSuccessField, @@ -824,7 +837,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 +865,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); |