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

Side by Side 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: rebase 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/google_chrome_distribution.cc ('k') | chrome/installer/util/helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/util/google_update_settings.h" 5 #include "chrome/installer/util/google_update_settings.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 GoogleUpdateSettings::AUTOMATIC_UPDATES; 48 GoogleUpdateSettings::AUTOMATIC_UPDATES;
49 #else 49 #else
50 GoogleUpdateSettings::UPDATES_DISABLED; 50 GoogleUpdateSettings::UPDATES_DISABLED;
51 #endif 51 #endif
52 52
53 namespace { 53 namespace {
54 54
55 bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { 55 bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
56 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 56 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
57 std::wstring reg_path = dist->GetStateKey(); 57 std::wstring reg_path = dist->GetStateKey();
58 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); 58 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
59 if (key.ReadValue(name, value) != ERROR_SUCCESS) { 59 if (key.ReadValue(name, value) != ERROR_SUCCESS) {
60 RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); 60 RegKey hklm_key(
61 HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
61 return (hklm_key.ReadValue(name, value) == ERROR_SUCCESS); 62 return (hklm_key.ReadValue(name, value) == ERROR_SUCCESS);
62 } 63 }
63 return true; 64 return true;
64 } 65 }
65 66
66 // Update a state registry key |name| to be |value| for the given browser 67 // Update a state registry key |name| to be |value| for the given browser
67 // |dist|. If this is a |system_install|, then update the value under 68 // |dist|. If this is a |system_install|, then update the value under
68 // HKLM (istead of HKCU for user-installs) using a group of keys (one 69 // HKLM (istead of HKCU for user-installs) using a group of keys (one
69 // for each OS user) and also include the method to |aggregate| these 70 // for each OS user) and also include the method to |aggregate| these
70 // values when reporting. 71 // values when reporting.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 BrowserDistribution::GetSpecificDistribution( 120 BrowserDistribution::GetSpecificDistribution(
120 BrowserDistribution::CHROME_BINARIES); 121 BrowserDistribution::CHROME_BINARIES);
121 return 122 return
122 WriteGoogleUpdateStrKeyInternal(multi_dist, false, name, value, NULL) && 123 WriteGoogleUpdateStrKeyInternal(multi_dist, false, name, value, NULL) &&
123 result; 124 result;
124 } 125 }
125 126
126 bool ClearGoogleUpdateStrKey(const wchar_t* const name) { 127 bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
127 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 128 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
128 std::wstring reg_path = dist->GetStateKey(); 129 std::wstring reg_path = dist->GetStateKey();
129 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); 130 RegKey key(HKEY_CURRENT_USER,
131 reg_path.c_str(),
132 KEY_READ | KEY_WRITE | KEY_WOW64_32KEY);
130 std::wstring value; 133 std::wstring value;
131 if (key.ReadValue(name, &value) != ERROR_SUCCESS) 134 if (key.ReadValue(name, &value) != ERROR_SUCCESS)
132 return false; 135 return false;
133 return (key.WriteValue(name, L"") == ERROR_SUCCESS); 136 return (key.WriteValue(name, L"") == ERROR_SUCCESS);
134 } 137 }
135 138
136 bool RemoveGoogleUpdateStrKey(const wchar_t* const name) { 139 bool RemoveGoogleUpdateStrKey(const wchar_t* const name) {
137 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 140 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
138 std::wstring reg_path = dist->GetStateKey(); 141 std::wstring reg_path = dist->GetStateKey();
139 RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); 142 RegKey key(HKEY_CURRENT_USER,
143 reg_path.c_str(),
144 KEY_READ | KEY_WRITE | KEY_WOW64_32KEY);
140 if (!key.HasValue(name)) 145 if (!key.HasValue(name))
141 return true; 146 return true;
142 return (key.DeleteValue(name) == ERROR_SUCCESS); 147 return (key.DeleteValue(name) == ERROR_SUCCESS);
143 } 148 }
144 149
145 bool GetChromeChannelInternal(bool system_install, 150 bool GetChromeChannelInternal(bool system_install,
146 bool add_multi_modifier, 151 bool add_multi_modifier,
147 base::string16* channel) { 152 base::string16* channel) {
148 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 153 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
149 if (dist->GetChromeChannel(channel)) { 154 if (dist->GetChromeChannel(channel)) {
150 return true; 155 return true;
151 } 156 }
152 157
153 HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 158 HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
154 base::string16 reg_path = dist->GetStateKey(); 159 base::string16 reg_path = dist->GetStateKey();
155 RegKey key(root_key, reg_path.c_str(), KEY_READ); 160 RegKey key(root_key, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY);
156 161
157 installer::ChannelInfo channel_info; 162 installer::ChannelInfo channel_info;
158 if (!channel_info.Initialize(key)) { 163 if (!channel_info.Initialize(key)) {
159 channel->assign(installer::kChromeChannelUnknown); 164 channel->assign(installer::kChromeChannelUnknown);
160 return false; 165 return false;
161 } 166 }
162 167
163 if (!channel_info.GetChannelName(channel)) { 168 if (!channel_info.GetChannelName(channel)) {
164 channel->assign(installer::kChromeChannelUnknown); 169 channel->assign(installer::kChromeChannelUnknown);
165 } 170 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 const std::wstring& product_guid) { 431 const std::wstring& product_guid) {
427 DCHECK(archive_type != installer::UNKNOWN_ARCHIVE_TYPE || 432 DCHECK(archive_type != installer::UNKNOWN_ARCHIVE_TYPE ||
428 install_return_code != 0); 433 install_return_code != 0);
429 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 434 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
430 435
431 RegKey key; 436 RegKey key;
432 installer::ChannelInfo channel_info; 437 installer::ChannelInfo channel_info;
433 std::wstring reg_key(google_update::kRegPathClientState); 438 std::wstring reg_key(google_update::kRegPathClientState);
434 reg_key.append(L"\\"); 439 reg_key.append(L"\\");
435 reg_key.append(product_guid); 440 reg_key.append(product_guid);
436 LONG result = key.Open(reg_root, reg_key.c_str(), 441 LONG result = key.Open(reg_root,
437 KEY_QUERY_VALUE | KEY_SET_VALUE); 442 reg_key.c_str(),
443 KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY);
438 if (result == ERROR_SUCCESS) 444 if (result == ERROR_SUCCESS)
439 channel_info.Initialize(key); 445 channel_info.Initialize(key);
440 else if (result != ERROR_FILE_NOT_FOUND) 446 else if (result != ERROR_FILE_NOT_FOUND)
441 LOG(ERROR) << "Failed to open " << reg_key << "; Error: " << result; 447 LOG(ERROR) << "Failed to open " << reg_key << "; Error: " << result;
442 448
443 if (UpdateGoogleUpdateApKey(archive_type, install_return_code, 449 if (UpdateGoogleUpdateApKey(archive_type, install_return_code,
444 &channel_info)) { 450 &channel_info)) {
445 // We have a modified channel_info value to write. 451 // We have a modified channel_info value to write.
446 // Create the app's ClientState key if it doesn't already exist. 452 // Create the app's ClientState key if it doesn't already exist.
447 if (!key.Valid()) { 453 if (!key.Valid()) {
448 result = key.Open(reg_root, google_update::kRegPathClientState, 454 result = key.Open(reg_root,
449 KEY_CREATE_SUB_KEY); 455 google_update::kRegPathClientState,
456 KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY);
450 if (result == ERROR_SUCCESS) 457 if (result == ERROR_SUCCESS)
451 result = key.CreateKey(product_guid.c_str(), KEY_SET_VALUE); 458 result = key.CreateKey(product_guid.c_str(),
459 KEY_SET_VALUE | KEY_WOW64_32KEY);
452 460
453 if (result != ERROR_SUCCESS) { 461 if (result != ERROR_SUCCESS) {
454 LOG(ERROR) << "Failed to create " << reg_key << "; Error: " << result; 462 LOG(ERROR) << "Failed to create " << reg_key << "; Error: " << result;
455 return; 463 return;
456 } 464 }
457 } 465 }
458 if (!channel_info.Write(&key)) { 466 if (!channel_info.Write(&key)) {
459 LOG(ERROR) << "Failed to write to application's ClientState key " 467 LOG(ERROR) << "Failed to write to application's ClientState key "
460 << google_update::kRegApField << " = " << channel_info.value(); 468 << google_update::kRegApField << " = " << channel_info.value();
461 } 469 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 google_update::kRegProfilesSignedIn, 520 google_update::kRegProfilesSignedIn,
513 base::Int64ToString16(profiles_signedin), 521 base::Int64ToString16(profiles_signedin),
514 L"sum()"); 522 L"sum()");
515 } 523 }
516 524
517 int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() { 525 int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() {
518 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 526 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
519 std::wstring reg_path = dist->GetStateKey(); 527 std::wstring reg_path = dist->GetStateKey();
520 528
521 // Minimum access needed is to be able to write to this key. 529 // Minimum access needed is to be able to write to this key.
522 RegKey reg_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE); 530 RegKey reg_key(
531 HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
523 if (!reg_key.Valid()) 532 if (!reg_key.Valid())
524 return 0; 533 return 0;
525 534
526 HANDLE target_handle = 0; 535 HANDLE target_handle = 0;
527 if (!DuplicateHandle(GetCurrentProcess(), reg_key.Handle(), 536 if (!DuplicateHandle(GetCurrentProcess(), reg_key.Handle(),
528 GetCurrentProcess(), &target_handle, KEY_SET_VALUE, 537 GetCurrentProcess(), &target_handle, KEY_SET_VALUE,
529 TRUE, DUPLICATE_SAME_ACCESS)) { 538 TRUE, DUPLICATE_SAME_ACCESS)) {
530 return 0; 539 return 0;
531 } 540 }
532 return reinterpret_cast<int>(target_handle); 541 return reinterpret_cast<int>(target_handle);
(...skipping 12 matching lines...) Expand all
545 const std::wstring& app_guid, 554 const std::wstring& app_guid,
546 bool* is_overridden) { 555 bool* is_overridden) {
547 bool found_override = false; 556 bool found_override = false;
548 UpdatePolicy update_policy = kDefaultUpdatePolicy; 557 UpdatePolicy update_policy = kDefaultUpdatePolicy;
549 558
550 #if defined(GOOGLE_CHROME_BUILD) 559 #if defined(GOOGLE_CHROME_BUILD)
551 DCHECK(!app_guid.empty()); 560 DCHECK(!app_guid.empty());
552 RegKey policy_key; 561 RegKey policy_key;
553 562
554 // Google Update Group Policy settings are always in HKLM. 563 // Google Update Group Policy settings are always in HKLM.
564 // TODO(wfh): Check if policies should go into Wow6432Node or not.
555 if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) == 565 if (policy_key.Open(HKEY_LOCAL_MACHINE, kPoliciesKey, KEY_QUERY_VALUE) ==
556 ERROR_SUCCESS) { 566 ERROR_SUCCESS) {
557 DWORD value = 0; 567 DWORD value = 0;
558 base::string16 app_update_override(kUpdateOverrideValuePrefix); 568 base::string16 app_update_override(kUpdateOverrideValuePrefix);
559 app_update_override.append(app_guid); 569 app_update_override.append(app_guid);
560 // First try to read and comprehend the app-specific override. 570 // First try to read and comprehend the app-specific override.
561 found_override = (policy_key.ReadValueDW(app_update_override.c_str(), 571 found_override = (policy_key.ReadValueDW(app_update_override.c_str(),
562 &value) == ERROR_SUCCESS && 572 &value) == ERROR_SUCCESS &&
563 GetUpdatePolicyFromDword(value, &update_policy)); 573 GetUpdatePolicyFromDword(value, &update_policy));
564 574
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 return cmd_line; 706 return cmd_line;
697 } 707 }
698 708
699 Version GoogleUpdateSettings::GetGoogleUpdateVersion(bool system_install) { 709 Version GoogleUpdateSettings::GetGoogleUpdateVersion(bool system_install) {
700 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 710 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
701 base::string16 version; 711 base::string16 version;
702 RegKey key; 712 RegKey key;
703 713
704 if (key.Open(root_key, 714 if (key.Open(root_key,
705 google_update::kRegPathGoogleUpdate, 715 google_update::kRegPathGoogleUpdate,
706 KEY_QUERY_VALUE) == ERROR_SUCCESS && 716 KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
707 key.ReadValue(google_update::kRegGoogleUpdateVersion, 717 key.ReadValue(google_update::kRegGoogleUpdateVersion, &version) ==
708 &version) == ERROR_SUCCESS) { 718 ERROR_SUCCESS) {
709 return Version(base::UTF16ToUTF8(version)); 719 return Version(base::UTF16ToUTF8(version));
710 } 720 }
711 721
712 return Version(); 722 return Version();
713 } 723 }
714 724
715 base::Time GoogleUpdateSettings::GetGoogleUpdateLastStartedAU( 725 base::Time GoogleUpdateSettings::GetGoogleUpdateLastStartedAU(
716 bool system_install) { 726 bool system_install) {
717 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 727 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
718 RegKey update_key; 728 RegKey update_key;
719 729
720 if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, 730 if (update_key.Open(root_key,
721 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 731 google_update::kRegPathGoogleUpdate,
732 KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
722 DWORD last_start; 733 DWORD last_start;
723 if (update_key.ReadValueDW(google_update::kRegLastStartedAUField, 734 if (update_key.ReadValueDW(google_update::kRegLastStartedAUField,
724 &last_start) == ERROR_SUCCESS) { 735 &last_start) == ERROR_SUCCESS) {
725 return base::Time::FromTimeT(last_start); 736 return base::Time::FromTimeT(last_start);
726 } 737 }
727 } 738 }
728 739
729 return base::Time(); 740 return base::Time();
730 } 741 }
731 742
732 base::Time GoogleUpdateSettings::GetGoogleUpdateLastChecked( 743 base::Time GoogleUpdateSettings::GetGoogleUpdateLastChecked(
733 bool system_install) { 744 bool system_install) {
734 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 745 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
735 RegKey update_key; 746 RegKey update_key;
736 747
737 if (update_key.Open(root_key, google_update::kRegPathGoogleUpdate, 748 if (update_key.Open(root_key,
738 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 749 google_update::kRegPathGoogleUpdate,
750 KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
739 DWORD last_check; 751 DWORD last_check;
740 if (update_key.ReadValueDW(google_update::kRegLastCheckedField, 752 if (update_key.ReadValueDW(google_update::kRegLastCheckedField,
741 &last_check) == ERROR_SUCCESS) { 753 &last_check) == ERROR_SUCCESS) {
742 return base::Time::FromTimeT(last_check); 754 return base::Time::FromTimeT(last_check);
743 } 755 }
744 } 756 }
745 757
746 return base::Time(); 758 return base::Time();
747 } 759 }
748 760
749 bool GoogleUpdateSettings::GetUpdateDetailForApp(bool system_install, 761 bool GoogleUpdateSettings::GetUpdateDetailForApp(bool system_install,
750 const wchar_t* app_guid, 762 const wchar_t* app_guid,
751 ProductData* data) { 763 ProductData* data) {
752 DCHECK(app_guid); 764 DCHECK(app_guid);
753 DCHECK(data); 765 DCHECK(data);
754 766
755 bool product_found = false; 767 bool product_found = false;
756 768
757 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 769 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
758 base::string16 clientstate_reg_path(google_update::kRegPathClientState); 770 base::string16 clientstate_reg_path(google_update::kRegPathClientState);
759 clientstate_reg_path.append(L"\\"); 771 clientstate_reg_path.append(L"\\");
760 clientstate_reg_path.append(app_guid); 772 clientstate_reg_path.append(app_guid);
761 773
762 RegKey clientstate; 774 RegKey clientstate;
763 if (clientstate.Open(root_key, clientstate_reg_path.c_str(), 775 if (clientstate.Open(root_key,
764 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 776 clientstate_reg_path.c_str(),
777 KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
765 base::string16 version; 778 base::string16 version;
766 DWORD dword_value; 779 DWORD dword_value;
767 if ((clientstate.ReadValueDW(google_update::kRegLastCheckSuccessField, 780 if ((clientstate.ReadValueDW(google_update::kRegLastCheckSuccessField,
768 &dword_value) == ERROR_SUCCESS) && 781 &dword_value) == ERROR_SUCCESS) &&
769 (clientstate.ReadValue(google_update::kRegVersionField, 782 (clientstate.ReadValue(google_update::kRegVersionField,
770 &version) == ERROR_SUCCESS)) { 783 &version) == ERROR_SUCCESS)) {
771 product_found = true; 784 product_found = true;
772 data->version = base::UTF16ToASCII(version); 785 data->version = base::UTF16ToASCII(version);
773 data->last_success = base::Time::FromTimeT(dword_value); 786 data->last_success = base::Time::FromTimeT(dword_value);
774 data->last_result = 0; 787 data->last_result = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 830 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
818 831
819 // Use the browser distribution and install level to write to the correct 832 // Use the browser distribution and install level to write to the correct
820 // client state/app guid key. 833 // client state/app guid key.
821 bool success = false; 834 bool success = false;
822 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 835 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
823 if (dist->ShouldSetExperimentLabels()) { 836 if (dist->ShouldSetExperimentLabels()) {
824 base::string16 client_state_path( 837 base::string16 client_state_path(
825 system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); 838 system_install ? dist->GetStateMediumKey() : dist->GetStateKey());
826 RegKey client_state( 839 RegKey client_state(
827 reg_root, client_state_path.c_str(), KEY_SET_VALUE); 840 reg_root, client_state_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
828 if (experiment_labels.empty()) { 841 if (experiment_labels.empty()) {
829 success = client_state.DeleteValue(google_update::kExperimentLabels) 842 success = client_state.DeleteValue(google_update::kExperimentLabels)
830 == ERROR_SUCCESS; 843 == ERROR_SUCCESS;
831 } else { 844 } else {
832 success = client_state.WriteValue(google_update::kExperimentLabels, 845 success = client_state.WriteValue(google_update::kExperimentLabels,
833 experiment_labels.c_str()) == ERROR_SUCCESS; 846 experiment_labels.c_str()) == ERROR_SUCCESS;
834 } 847 }
835 } 848 }
836 849
837 return success; 850 return success;
838 } 851 }
839 852
840 bool GoogleUpdateSettings::ReadExperimentLabels( 853 bool GoogleUpdateSettings::ReadExperimentLabels(
841 bool system_install, 854 bool system_install,
842 base::string16* experiment_labels) { 855 base::string16* experiment_labels) {
843 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 856 HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
844 857
845 // If this distribution does not set the experiment labels, don't bother 858 // If this distribution does not set the experiment labels, don't bother
846 // reading. 859 // reading.
847 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 860 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
848 if (!dist->ShouldSetExperimentLabels()) 861 if (!dist->ShouldSetExperimentLabels())
849 return false; 862 return false;
850 863
851 base::string16 client_state_path( 864 base::string16 client_state_path(
852 system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); 865 system_install ? dist->GetStateMediumKey() : dist->GetStateKey());
853 866
854 RegKey client_state; 867 RegKey client_state;
855 LONG result = 868 LONG result = client_state.Open(
856 client_state.Open(reg_root, client_state_path.c_str(), KEY_QUERY_VALUE); 869 reg_root, client_state_path.c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY);
857 if (result == ERROR_SUCCESS) { 870 if (result == ERROR_SUCCESS) {
858 result = client_state.ReadValue(google_update::kExperimentLabels, 871 result = client_state.ReadValue(google_update::kExperimentLabels,
859 experiment_labels); 872 experiment_labels);
860 } 873 }
861 874
862 // If the key or value was not present, return the empty string. 875 // If the key or value was not present, return the empty string.
863 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { 876 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) {
864 experiment_labels->clear(); 877 experiment_labels->clear();
865 return true; 878 return true;
866 } 879 }
867 880
868 return result == ERROR_SUCCESS; 881 return result == ERROR_SUCCESS;
869 } 882 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_distribution.cc ('k') | chrome/installer/util/helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698