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

Unified Diff: chrome/installer/util/delete_reg_key_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/delete_reg_key_work_item.cc
diff --git a/chrome/installer/util/delete_reg_key_work_item.cc b/chrome/installer/util/delete_reg_key_work_item.cc
index 462698f44bc91ec6b84f446121d60668f291b33b..1f0e62726aeb34e9f429c574cae0fd5e0551d0da 100644
--- a/chrome/installer/util/delete_reg_key_work_item.cc
+++ b/chrome/installer/util/delete_reg_key_work_item.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/win/registry.h"
+#include "chrome/installer/util/install_util.h"
using base::win::RegKey;
@@ -15,12 +16,17 @@ DeleteRegKeyWorkItem::~DeleteRegKeyWorkItem() {
}
DeleteRegKeyWorkItem::DeleteRegKeyWorkItem(HKEY predefined_root,
- const std::wstring& path)
+ const std::wstring& path,
+ REGSAM wow64_access)
: predefined_root_(predefined_root),
- path_(path) {
+ path_(path),
+ wow64_access_(wow64_access) {
DCHECK(predefined_root);
// It's a safe bet that we don't want to delete one of the root trees.
DCHECK(!path.empty());
+ DCHECK(wow64_access == 0 ||
+ wow64_access == KEY_WOW64_32KEY ||
+ wow64_access == KEY_WOW64_64KEY);
}
bool DeleteRegKeyWorkItem::Do() {
@@ -31,14 +37,15 @@ bool DeleteRegKeyWorkItem::Do() {
// Only try to make a backup if we're not configured to ignore failures.
if (!ignore_failure_) {
- if (!backup.Initialize(predefined_root_, path_.c_str())) {
+ if (!backup.Initialize(predefined_root_, path_.c_str(), wow64_access_)) {
LOG(ERROR) << "Failed to backup destination for registry key copy.";
return false;
}
}
// Delete the key.
- LONG result = SHDeleteKey(predefined_root_, path_.c_str());
+ LONG result = InstallUtil::DeleteRegistryKey(
+ predefined_root_, path_.c_str(), wow64_access_);
if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
LOG(ERROR) << "Failed to delete key at " << path_ << ", result: "
<< result;
@@ -57,7 +64,8 @@ void DeleteRegKeyWorkItem::Rollback() {
// Delete anything in the key before restoring the backup in case someone else
// put new data in the key after Do().
- LONG result = SHDeleteKey(predefined_root_, path_.c_str());
+ LONG result = InstallUtil::DeleteRegistryKey(
+ predefined_root_, path_.c_str(), wow64_access_);
if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
LOG(ERROR) << "Failed to delete key at " << path_ << " in rollback, "
"result: " << result;
@@ -65,6 +73,6 @@ void DeleteRegKeyWorkItem::Rollback() {
// Restore the old contents. The restoration takes on its default security
// attributes; any custom attributes are lost.
- if (!backup_.WriteTo(predefined_root_, path_.c_str()))
+ if (!backup_.WriteTo(predefined_root_, path_.c_str(), wow64_access_))
LOG(ERROR) << "Failed to restore key in rollback.";
}

Powered by Google App Engine
This is Rietveld 408576698