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

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: nits. fix call to DeleteRegistryKey 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..9f482311037ffe99013136d97d75e2a730913278 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,17 +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());
- if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
- LOG(ERROR) << "Failed to delete key at " << path_ << ", result: "
- << result;
+ if (!InstallUtil::DeleteRegistryKey(
+ predefined_root_, path_.c_str(), wow64_access_)) {
return ignore_failure_;
}
@@ -57,14 +61,12 @@ 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());
- if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
- LOG(ERROR) << "Failed to delete key at " << path_ << " in rollback, "
- "result: " << result;
- }
+ InstallUtil::DeleteRegistryKey(predefined_root_,
+ path_.c_str(),
+ wow64_access_);
// 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.";
}
« no previous file with comments | « chrome/installer/util/delete_reg_key_work_item.h ('k') | chrome/installer/util/delete_reg_key_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698