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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 282363003: Add WOW64 support to the installer registry work items (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: 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 unified diff | Download patch
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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 30 matching lines...) Expand all
41 #include "base/win/win_util.h" 41 #include "base/win/win_util.h"
42 #include "base/win/windows_version.h" 42 #include "base/win/windows_version.h"
43 #include "chrome/common/chrome_constants.h" 43 #include "chrome/common/chrome_constants.h"
44 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
45 #include "chrome/installer/util/browser_distribution.h" 45 #include "chrome/installer/util/browser_distribution.h"
46 #include "chrome/installer/util/install_util.h" 46 #include "chrome/installer/util/install_util.h"
47 #include "chrome/installer/util/l10n_string_util.h" 47 #include "chrome/installer/util/l10n_string_util.h"
48 #include "chrome/installer/util/master_preferences.h" 48 #include "chrome/installer/util/master_preferences.h"
49 #include "chrome/installer/util/master_preferences_constants.h" 49 #include "chrome/installer/util/master_preferences_constants.h"
50 #include "chrome/installer/util/util_constants.h" 50 #include "chrome/installer/util/util_constants.h"
51 #include "chrome/installer/util/work_item.h"
51 52
52 #include "installer_util_strings.h" // NOLINT 53 #include "installer_util_strings.h" // NOLINT
53 54
54 using base::win::RegKey; 55 using base::win::RegKey;
55 56
56 namespace { 57 namespace {
57 58
58 // An enum used to tell QuickIsChromeRegistered() which level of registration 59 // An enum used to tell QuickIsChromeRegistered() which level of registration
59 // the caller wants to confirm. 60 // the caller wants to confirm.
60 enum RegistrationConfirmationLevel { 61 enum RegistrationConfirmationLevel {
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 525
525 // start->Internet shortcut. 526 // start->Internet shortcut.
526 base::string16 start_menu(ShellUtil::kRegStartMenuInternet); 527 base::string16 start_menu(ShellUtil::kRegStartMenuInternet);
527 base::string16 app_name = dist->GetBaseAppName() + suffix; 528 base::string16 app_name = dist->GetBaseAppName() + suffix;
528 entries->push_back(new RegistryEntry(start_menu, app_name)); 529 entries->push_back(new RegistryEntry(start_menu, app_name));
529 } 530 }
530 531
531 // Generate work_item tasks required to create current registry entry and 532 // Generate work_item tasks required to create current registry entry and
532 // add them to the given work item list. 533 // add them to the given work item list.
533 void AddToWorkItemList(HKEY root, WorkItemList *items) const { 534 void AddToWorkItemList(HKEY root, WorkItemList *items) const {
534 items->AddCreateRegKeyWorkItem(root, key_path_); 535 items->AddCreateRegKeyWorkItem(root, key_path_, reg_wow64_option_);
535 if (is_string_) { 536 if (is_string_) {
536 items->AddSetRegValueWorkItem(root, key_path_, name_, value_, true); 537 items->AddSetRegValueWorkItem(root, key_path_, name_,
538 value_, true, reg_wow64_option_);
537 } else { 539 } else {
538 items->AddSetRegValueWorkItem(root, key_path_, name_, int_value_, true); 540 items->AddSetRegValueWorkItem(root, key_path_, name_,
541 int_value_, true, reg_wow64_option_);
539 } 542 }
540 } 543 }
541 544
542 // Checks if the current registry entry exists in HKCU\|key_path_|\|name_| 545 // Checks if the current registry entry exists in HKCU\|key_path_|\|name_|
543 // and value is |value_|. If the key does NOT exist in HKCU, checks for 546 // and value is |value_|. If the key does NOT exist in HKCU, checks for
544 // the correct name and value in HKLM. 547 // the correct name and value in HKLM.
545 // |look_for_in| specifies roots (HKCU and/or HKLM) in which to look for the 548 // |look_for_in| specifies roots (HKCU and/or HKLM) in which to look for the
546 // key, unspecified roots are not looked into (i.e. the the key is assumed not 549 // key, unspecified roots are not looked into (i.e. the the key is assumed not
547 // to exist in them). 550 // to exist in them).
548 // |look_for_in| must at least specify one root to look into. 551 // |look_for_in| must at least specify one root to look into.
(...skipping 18 matching lines...) Expand all
567 enum RegistryStatus { 570 enum RegistryStatus {
568 // |name_| does not exist in the registry 571 // |name_| does not exist in the registry
569 DOES_NOT_EXIST, 572 DOES_NOT_EXIST,
570 // |name_| exists, but its value != |value_| 573 // |name_| exists, but its value != |value_|
571 DIFFERENT_VALUE, 574 DIFFERENT_VALUE,
572 // |name_| exists and its value is |value_| 575 // |name_| exists and its value is |value_|
573 SAME_VALUE, 576 SAME_VALUE,
574 }; 577 };
575 578
576 // Create a object that represent default value of a key 579 // Create a object that represent default value of a key
577 RegistryEntry(const base::string16& key_path, const base::string16& value) 580 RegistryEntry(const base::string16& key_path,
581 const base::string16& value)
578 : key_path_(key_path), name_(), 582 : key_path_(key_path), name_(),
583 reg_wow64_option_(WorkItem::WOW64_DEFAULT),
579 is_string_(true), value_(value), int_value_(0) { 584 is_string_(true), value_(value), int_value_(0) {
580 } 585 }
581 586
582 // Create a object that represent a key of type REG_SZ 587 // Create a object that represent a key of type REG_SZ
583 RegistryEntry(const base::string16& key_path, const base::string16& name, 588 RegistryEntry(const base::string16& key_path, const base::string16& name,
584 const base::string16& value) 589 const base::string16& value)
585 : key_path_(key_path), name_(name), 590 : key_path_(key_path), name_(name),
591 reg_wow64_option_(WorkItem::WOW64_DEFAULT),
586 is_string_(true), value_(value), int_value_(0) { 592 is_string_(true), value_(value), int_value_(0) {
587 } 593 }
588 594
589 // Create a object that represent a key of integer type 595 // Create a object that represent a key of integer type
590 RegistryEntry(const base::string16& key_path, const base::string16& name, 596 RegistryEntry(const base::string16& key_path, const base::string16& name,
591 DWORD value) 597 DWORD value)
592 : key_path_(key_path), name_(name), 598 : key_path_(key_path), name_(name),
599 reg_wow64_option_(WorkItem::WOW64_DEFAULT),
593 is_string_(false), value_(), int_value_(value) { 600 is_string_(false), value_(), int_value_(value) {
594 } 601 }
595 602
596 base::string16 key_path_; // key path for the registry entry 603 base::string16 key_path_; // key path for the registry entry
597 base::string16 name_; // name of the registry entry 604 base::string16 name_; // name of the registry entry
605 // Which view of the registry to use.
606 WorkItem::RegWow64ViewOption reg_wow64_option_;
598 bool is_string_; // true if current registry entry is of type REG_SZ 607 bool is_string_; // true if current registry entry is of type REG_SZ
599 base::string16 value_; // string value (useful if is_string_ = true) 608 base::string16 value_; // string value (useful if is_string_ = true)
600 DWORD int_value_; // integer value (useful if is_string_ = false) 609 DWORD int_value_; // integer value (useful if is_string_ = false)
601 610
602 // Helper function for ExistsInRegistry(). 611 // Helper function for ExistsInRegistry().
603 // Returns the RegistryStatus of the current registry entry in 612 // Returns the RegistryStatus of the current registry entry in
604 // |root|\|key_path_|\|name_|. 613 // |root|\|key_path_|\|name_|.
605 RegistryStatus StatusInRegistryUnderRoot(HKEY root) const { 614 RegistryStatus StatusInRegistryUnderRoot(HKEY root) const {
606 RegKey key(root, key_path_.c_str(), KEY_QUERY_VALUE); 615 RegKey key(root, key_path_.c_str(), KEY_QUERY_VALUE);
607 bool found = false; 616 bool found = false;
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 // are any left...). 2273 // are any left...).
2265 if (free_bits >= 8 && next_byte_index < size) { 2274 if (free_bits >= 8 && next_byte_index < size) {
2266 free_bits -= 8; 2275 free_bits -= 8;
2267 bit_stream += bytes[next_byte_index++] << free_bits; 2276 bit_stream += bytes[next_byte_index++] << free_bits;
2268 } 2277 }
2269 } 2278 }
2270 2279
2271 DCHECK_EQ(ret.length(), encoded_length); 2280 DCHECK_EQ(ret.length(), encoded_length);
2272 return ret; 2281 return ret;
2273 } 2282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698