summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorwfh <wfh@chromium.org>2014-10-08 21:31:38 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-09 04:31:57 +0000
commit9353beb978ce832381ad4869dc4eb9822c9dc11c (patch)
tree1051b0ae021dfab7ef95f49934cdad73cdee98c1 /chrome/installer
parentb36d59fae70e9fbd489059b228751053ad39b048 (diff)
downloadchromium_src-9353beb978ce832381ad4869dc4eb9822c9dc11c.zip
chromium_src-9353beb978ce832381ad4869dc4eb9822c9dc11c.tar.gz
chromium_src-9353beb978ce832381ad4869dc4eb9822c9dc11c.tar.bz2
Allow Registry Iterator functions to use a specified WOW64 mode when iterating.
Also fix up any callers to access the correct hive (32 or 64) depending on where the data is, or whether the hive is Redirected, Shared, or Reflected as specified in MSDN http://msdn.microsoft.com/en-us/library/windows/desktop/aa384253.aspx BUG=338706,408018 TEST=Follow steps in 408018 and make sure extension gets added on 64-bit Chrome TEST=base_unittests --gtest_filter=Registry* Review URL: https://codereview.chromium.org/616173003 Cr-Commit-Position: refs/heads/master@{#298758}
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/app_commands.cc14
-rw-r--r--chrome/installer/util/app_commands.h4
-rw-r--r--chrome/installer/util/installation_state.cc2
3 files changed, 15 insertions, 5 deletions
diff --git a/chrome/installer/util/app_commands.cc b/chrome/installer/util/app_commands.cc
index de7dcc2..cb6f617 100644
--- a/chrome/installer/util/app_commands.cc
+++ b/chrome/installer/util/app_commands.cc
@@ -19,12 +19,18 @@ AppCommands::AppCommands() {
AppCommands::~AppCommands() {
}
-bool AppCommands::Initialize(const base::win::RegKey& key) {
+bool AppCommands::Initialize(const base::win::RegKey& key, REGSAM wow64access) {
if (!key.Valid()) {
LOG(DFATAL) << "Cannot initialize AppCommands from an invalid key.";
return false;
}
+ if (wow64access != 0 && wow64access != KEY_WOW64_32KEY &&
+ wow64access != KEY_WOW64_64KEY) {
+ LOG(DFATAL) << "Invalid wow64access supplied to AppCommands.";
+ return false;
+ }
+
using base::win::RegistryKeyIterator;
static const wchar_t kEmptyString[] = L"";
@@ -33,8 +39,10 @@ bool AppCommands::Initialize(const base::win::RegKey& key) {
RegKey cmd_key;
LONG result;
AppCommand command;
- for (RegistryKeyIterator key_iterator(key.Handle(), kEmptyString);
- key_iterator.Valid(); ++key_iterator) {
+ for (RegistryKeyIterator key_iterator(
+ key.Handle(), kEmptyString, wow64access);
+ key_iterator.Valid();
+ ++key_iterator) {
const wchar_t* name = key_iterator.Name();
result = cmd_key.Open(key.Handle(), name, KEY_QUERY_VALUE);
if (result != ERROR_SUCCESS) {
diff --git a/chrome/installer/util/app_commands.h b/chrome/installer/util/app_commands.h
index f67093d..61ea14e 100644
--- a/chrome/installer/util/app_commands.h
+++ b/chrome/installer/util/app_commands.h
@@ -36,7 +36,9 @@ class AppCommands {
// (typically the "Commands" subkey of a BrowserDistribution's "version key").
// |key| must have been opened with at least
// KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE access rights.
- bool Initialize(const base::win::RegKey& key);
+ // |wow64access| must be one of 0, KEY_WOW64_32KEY or KEY_WOW64_64KEY and
+ // must match the original WOW64 access used to open |key| previously.
+ bool Initialize(const base::win::RegKey& key, REGSAM wow64access);
// Replaces the contents of this object with that of |other|.
AppCommands& CopyFrom(const AppCommands& other);
diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc
index 718e44a..0173581 100644
--- a/chrome/installer/util/installation_state.cc
+++ b/chrome/installer/util/installation_state.cc
@@ -42,7 +42,7 @@ bool ProductState::InitializeCommands(const base::win::RegKey& version_key,
if (commands_key.Open(version_key.Handle(), google_update::kRegCommandsKey,
kAccess) == ERROR_SUCCESS)
- return commands->Initialize(commands_key);
+ return commands->Initialize(commands_key, KEY_WOW64_32KEY);
return false;
}