| OLD | NEW |
| 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 #include "chrome/installer/util/registry_key_backup.h" | 5 #include "chrome/installer/util/registry_key_backup.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 bool RegistryKeyBackup::Initialize(HKEY root, | 278 bool RegistryKeyBackup::Initialize(HKEY root, |
| 279 const wchar_t* key_path, | 279 const wchar_t* key_path, |
| 280 REGSAM wow64_access) { | 280 REGSAM wow64_access) { |
| 281 DCHECK(key_path); | 281 DCHECK(key_path); |
| 282 DCHECK(wow64_access == 0 || | 282 DCHECK(wow64_access == 0 || |
| 283 wow64_access == KEY_WOW64_32KEY || | 283 wow64_access == KEY_WOW64_32KEY || |
| 284 wow64_access == KEY_WOW64_64KEY); | 284 wow64_access == KEY_WOW64_64KEY); |
| 285 | 285 |
| 286 RegKey key; | 286 RegKey key; |
| 287 scoped_ptr<KeyData> key_data; | 287 std::unique_ptr<KeyData> key_data; |
| 288 | 288 |
| 289 // Does the key exist? | 289 // Does the key exist? |
| 290 LONG result = key.Open(root, key_path, kKeyReadNoNotify | wow64_access); | 290 LONG result = key.Open(root, key_path, kKeyReadNoNotify | wow64_access); |
| 291 if (result == ERROR_SUCCESS) { | 291 if (result == ERROR_SUCCESS) { |
| 292 key_data.reset(new KeyData()); | 292 key_data.reset(new KeyData()); |
| 293 if (!key_data->Initialize(key)) { | 293 if (!key_data->Initialize(key)) { |
| 294 LOG(ERROR) << "Failed to backup key at " << key_path; | 294 LOG(ERROR) << "Failed to backup key at " << key_path; |
| 295 return false; | 295 return false; |
| 296 } | 296 } |
| 297 } else if (result != ERROR_FILE_NOT_FOUND) { | 297 } else if (result != ERROR_FILE_NOT_FOUND) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 323 } else { | 323 } else { |
| 324 success = key_data_->WriteTo(&dest_key); | 324 success = key_data_->WriteTo(&dest_key); |
| 325 LOG_IF(ERROR, !success) << "Failed to write key data."; | 325 LOG_IF(ERROR, !success) << "Failed to write key data."; |
| 326 } | 326 } |
| 327 } else { | 327 } else { |
| 328 success = true; | 328 success = true; |
| 329 } | 329 } |
| 330 | 330 |
| 331 return success; | 331 return success; |
| 332 } | 332 } |
| OLD | NEW |