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

Unified Diff: chrome/install_static/install_util.cc

Issue 2408923002: [M54 Merge] NTRegistry - added wow64 redirection support. (Closed)
Patch Set: Created 4 years, 2 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/install_static/BUILD.gn ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/install_static/install_util.cc
diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc
index 3d49274552d945749152275fd1fd80e6f69ed456..da7e336f817ce2aa8ac5ebebcd50b9f08cbc85fa 100644
--- a/chrome/install_static/install_util.cc
+++ b/chrome/install_static/install_util.cc
@@ -250,10 +250,9 @@ std::wstring GetChromeInstallRegistryPath() {
bool GetCollectStatsConsentImpl(const std::wstring& exe_path) {
bool enabled = true;
- bool controlled_by_policy = ReportingIsEnforcedByPolicy(&enabled);
- if (controlled_by_policy && !enabled)
- return false;
+ if (ReportingIsEnforcedByPolicy(&enabled))
+ return enabled;
bool system_install = IsSystemInstall(exe_path.c_str());
std::wstring app_guid;
@@ -271,8 +270,9 @@ bool GetCollectStatsConsentImpl(const std::wstring& exe_path) {
std::wstring full_key_path(kRegPathClientStateMedium);
full_key_path.append(1, L'\\');
full_key_path.append(app_guid);
- if (system_install && nt::QueryRegValueDWORD(nt::HKLM, full_key_path.c_str(),
- kRegValueUsageStats, &out_value))
+ if (system_install &&
+ nt::QueryRegValueDWORD(nt::HKLM, nt::WOW6432, full_key_path.c_str(),
+ kRegValueUsageStats, &out_value))
return (out_value == 1);
// Second, try kRegPathClientState.
@@ -280,8 +280,8 @@ bool GetCollectStatsConsentImpl(const std::wstring& exe_path) {
full_key_path.append(1, L'\\');
full_key_path.append(app_guid);
return (nt::QueryRegValueDWORD((system_install ? nt::HKLM : nt::HKCU),
- full_key_path.c_str(), kRegValueUsageStats,
- &out_value) &&
+ nt::WOW6432, full_key_path.c_str(),
+ kRegValueUsageStats, &out_value) &&
out_value == 1);
}
@@ -411,8 +411,8 @@ bool IsMultiInstall(bool is_system_install) {
full_key_path.append(1, L'\\');
full_key_path.append(kAppGuidGoogleChrome);
if (!nt::QueryRegValueSZ((is_system_install ? nt::HKLM : nt::HKCU),
- full_key_path.c_str(), kUninstallArgumentsField,
- &args))
+ nt::WOW6432, full_key_path.c_str(),
+ kUninstallArgumentsField, &args))
return false;
return (args.find(L"--multi-install") != std::wstring::npos);
@@ -430,7 +430,7 @@ bool GetCollectStatsInSample() {
std::wstring registry_path = GetChromeInstallRegistryPath();
DWORD out_value = 0;
- if (!nt::QueryRegValueDWORD(nt::HKCU, registry_path.c_str(),
+ if (!nt::QueryRegValueDWORD(nt::HKCU, nt::WOW6432, registry_path.c_str(),
kRegValueChromeStatsSample, &out_value)) {
// If reading the value failed, treat it as though sampling isn't in effect,
// implicitly meaning this install is in the sample.
@@ -443,8 +443,8 @@ bool SetCollectStatsInSample(bool in_sample) {
std::wstring registry_path = GetChromeInstallRegistryPath();
HANDLE key_handle = INVALID_HANDLE_VALUE;
- if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(), KEY_SET_VALUE,
- &key_handle)) {
+ if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(),
+ KEY_SET_VALUE | KEY_WOW64_32KEY, &key_handle)) {
nt::CloseRegKey(key_handle);
return false;
}
@@ -457,14 +457,14 @@ bool ReportingIsEnforcedByPolicy(bool* metrics_is_enforced_by_policy) {
DWORD value = 0;
// First, try HKLM.
- if (nt::QueryRegValueDWORD(nt::HKLM, kRegPathChromePolicy,
+ if (nt::QueryRegValueDWORD(nt::HKLM, nt::NONE, kRegPathChromePolicy,
kMetricsReportingEnabled, &value)) {
*metrics_is_enforced_by_policy = (value != 0);
return true;
}
// Second, try HKCU.
- if (nt::QueryRegValueDWORD(nt::HKCU, kRegPathChromePolicy,
+ if (nt::QueryRegValueDWORD(nt::HKCU, nt::NONE, kRegPathChromePolicy,
kMetricsReportingEnabled, &value)) {
*metrics_is_enforced_by_policy = (value != 0);
return true;
@@ -640,16 +640,16 @@ void GetChromeChannelName(bool is_per_user_install,
std::wstring full_key_path(kRegPathClientState);
full_key_path.append(1, L'\\');
full_key_path.append(kAppGuidGoogleBinaries);
- channel_available =
- nt::QueryRegValueSZ(is_per_user_install ? nt::HKCU : nt::HKLM,
- full_key_path.c_str(), kRegApField, &value);
+ channel_available = nt::QueryRegValueSZ(
+ is_per_user_install ? nt::HKCU : nt::HKLM, nt::WOW6432,
+ full_key_path.c_str(), kRegApField, &value);
} else {
std::wstring full_key_path(kRegPathClientState);
full_key_path.append(1, L'\\');
full_key_path.append(kAppGuidGoogleChrome);
- channel_available =
- nt::QueryRegValueSZ(is_per_user_install ? nt::HKCU : nt::HKLM,
- full_key_path.c_str(), kRegApField, &value);
+ channel_available = nt::QueryRegValueSZ(
+ is_per_user_install ? nt::HKCU : nt::HKLM, nt::WOW6432,
+ full_key_path.c_str(), kRegApField, &value);
}
if (channel_available) {
static const wchar_t kChromeChannelBetaPattern[] = L"1?1-*";
@@ -698,7 +698,7 @@ std::string GetGoogleUpdateVersion() {
// Consider whether Chromium should connect to Google update to manage
// updates. Should this be returning an empty string for Chromium builds?.
std::wstring update_version;
- if (nt::QueryRegValueSZ(nt::AUTO, kRegPathGoogleUpdate,
+ if (nt::QueryRegValueSZ(nt::AUTO, nt::WOW6432, kRegPathGoogleUpdate,
kRegGoogleUpdateVersion, &update_version))
return UTF16ToUTF8(update_version);
« no previous file with comments | « chrome/install_static/BUILD.gn ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698