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

Side by Side Diff: chrome/installer/util/copy_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: 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Implementation of a work item that replaces the contents of one registry key 5 // Implementation of a work item that replaces the contents of one registry key
6 // with that of another (i.e., the destination is erased prior to the copy). 6 // with that of another (i.e., the destination is erased prior to the copy).
7 7
8 #include "chrome/installer/util/copy_reg_key_work_item.h" 8 #include "chrome/installer/util/copy_reg_key_work_item.h"
9 9
10 #include <shlwapi.h> 10 #include <shlwapi.h>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/win/registry.h" 13 #include "base/win/registry.h"
14 14
15 using base::win::RegKey; 15 using base::win::RegKey;
16 16
17 CopyRegKeyWorkItem::~CopyRegKeyWorkItem() { 17 CopyRegKeyWorkItem::~CopyRegKeyWorkItem() {
18 } 18 }
19 19
20 CopyRegKeyWorkItem::CopyRegKeyWorkItem(HKEY predefined_root, 20 CopyRegKeyWorkItem::CopyRegKeyWorkItem(HKEY predefined_root,
21 const std::wstring& source_key_path, 21 const std::wstring& source_key_path,
22 const std::wstring& dest_key_path, 22 const std::wstring& dest_key_path,
23 CopyOverWriteOption overwrite_option) 23 CopyOverWriteOption overwrite_option,
24 RegWow64ViewOption reg_wow64_option)
24 : predefined_root_(predefined_root), 25 : predefined_root_(predefined_root),
25 source_key_path_(source_key_path), 26 source_key_path_(source_key_path),
26 dest_key_path_(dest_key_path), 27 dest_key_path_(dest_key_path),
27 overwrite_option_(overwrite_option), 28 overwrite_option_(overwrite_option),
29 reg_wow64_option_(reg_wow64_option),
28 cleared_destination_(false) { 30 cleared_destination_(false) {
29 DCHECK(predefined_root); 31 DCHECK(predefined_root);
30 // It's a safe bet that we don't want to copy or overwrite one of the root 32 // It's a safe bet that we don't want to copy or overwrite one of the root
31 // trees. 33 // trees.
32 DCHECK(!source_key_path.empty()); 34 DCHECK(!source_key_path.empty());
33 DCHECK(!dest_key_path.empty()); 35 DCHECK(!dest_key_path.empty());
34 DCHECK(overwrite_option == ALWAYS || overwrite_option == IF_NOT_PRESENT); 36 DCHECK(overwrite_option == ALWAYS || overwrite_option == IF_NOT_PRESENT);
35 } 37 }
36 38
37 bool CopyRegKeyWorkItem::Do() { 39 bool CopyRegKeyWorkItem::Do() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 LOG(ERROR) << "Failed to delete key at " << dest_key_path_ 111 LOG(ERROR) << "Failed to delete key at " << dest_key_path_
110 << " in rollback, result: " << result; 112 << " in rollback, result: " << result;
111 } 113 }
112 114
113 // Restore the old contents. The restoration takes on its default security 115 // Restore the old contents. The restoration takes on its default security
114 // attributes; any custom attributes are lost. 116 // attributes; any custom attributes are lost.
115 if (!backup_.WriteTo(predefined_root_, dest_key_path_.c_str())) 117 if (!backup_.WriteTo(predefined_root_, dest_key_path_.c_str()))
116 LOG(ERROR) << "Failed to restore key in rollback."; 118 LOG(ERROR) << "Failed to restore key in rollback.";
117 } 119 }
118 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698