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

Unified Diff: chrome/installer/util/set_reg_value_work_item.cc

Issue 282363003: Add WOW64 support to the installer registry work items (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: add wow64 logic to installer_util. mini_installer tests. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/set_reg_value_work_item.cc
diff --git a/chrome/installer/util/set_reg_value_work_item.cc b/chrome/installer/util/set_reg_value_work_item.cc
index b805a5d0af995071c30be984c291ac6576f22a6d..7d869db2d0d211e78fc343920ea781c77696c6b8 100644
--- a/chrome/installer/util/set_reg_value_work_item.cc
+++ b/chrome/installer/util/set_reg_value_work_item.cc
@@ -16,14 +16,19 @@ SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root,
const std::wstring& key_path,
const std::wstring& value_name,
const std::wstring& value_data,
- bool overwrite)
+ bool overwrite,
+ REGSAM wow64_access)
: predefined_root_(predefined_root),
key_path_(key_path),
value_name_(value_name),
overwrite_(overwrite),
+ wow64_access_(wow64_access),
status_(SET_VALUE),
type_(REG_SZ),
previous_type_(0) {
+ DCHECK(wow64_access == 0 ||
+ wow64_access == KEY_WOW64_32KEY ||
+ wow64_access == KEY_WOW64_64KEY);
const uint8* data = reinterpret_cast<const uint8*>(value_data.c_str());
value_.assign(data, data + (value_data.length() + 1) * sizeof(wchar_t));
}
@@ -32,14 +37,19 @@ SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root,
const std::wstring& key_path,
const std::wstring& value_name,
DWORD value_data,
- bool overwrite)
+ bool overwrite,
+ REGSAM wow64_access)
: predefined_root_(predefined_root),
key_path_(key_path),
value_name_(value_name),
overwrite_(overwrite),
+ wow64_access_(wow64_access),
status_(SET_VALUE),
type_(REG_DWORD),
previous_type_(0) {
+ DCHECK(wow64_access == 0 ||
+ wow64_access == KEY_WOW64_32KEY ||
+ wow64_access == KEY_WOW64_64KEY);
const uint8* data = reinterpret_cast<const uint8*>(&value_data);
value_.assign(data, data + sizeof(value_data));
}
@@ -48,14 +58,19 @@ SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root,
const std::wstring& key_path,
const std::wstring& value_name,
int64 value_data,
- bool overwrite)
+ bool overwrite,
+ REGSAM wow64_access)
: predefined_root_(predefined_root),
key_path_(key_path),
value_name_(value_name),
overwrite_(overwrite),
+ wow64_access_(wow64_access),
status_(SET_VALUE),
type_(REG_QWORD),
previous_type_(0) {
+ DCHECK(wow64_access == 0 ||
+ wow64_access == KEY_WOW64_32KEY ||
+ wow64_access == KEY_WOW64_64KEY);
const uint8* data = reinterpret_cast<const uint8*>(&value_data);
value_.assign(data, data + sizeof(value_data));
}
@@ -71,8 +86,9 @@ bool SetRegValueWorkItem::Do() {
}
status_ = VALUE_UNCHANGED;
- result = key.Open(predefined_root_, key_path_.c_str(),
- KEY_READ | KEY_SET_VALUE);
+ result = key.Open(predefined_root_,
+ key_path_.c_str(),
+ KEY_READ | KEY_SET_VALUE | wow64_access_);
if (result != ERROR_SUCCESS) {
VLOG(1) << "can not open " << key_path_ << " error: " << result;
return ignore_failure_;
@@ -127,7 +143,8 @@ void SetRegValueWorkItem::Rollback() {
}
base::win::RegKey key;
- LONG result = key.Open(predefined_root_, key_path_.c_str(), KEY_SET_VALUE);
+ LONG result = key.Open(
+ predefined_root_, key_path_.c_str(), KEY_SET_VALUE | wow64_access_);
if (result != ERROR_SUCCESS) {
VLOG(1) << "rollback: can not open " << key_path_ << " error: " << result;
return;

Powered by Google App Engine
This is Rietveld 408576698