| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <shlwapi.h> | 5 #include <shlwapi.h> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
| 10 #include "chrome/installer/util/create_reg_key_work_item.h" | 10 #include "chrome/installer/util/create_reg_key_work_item.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 RegKey key; | 49 RegKey key; |
| 50 std::wstring key_path; | 50 std::wstring key_path; |
| 51 | 51 |
| 52 // To create keys, we iterate from back to front. | 52 // To create keys, we iterate from back to front. |
| 53 for (size_t i = key_list_.size(); i > 0; i--) { | 53 for (size_t i = key_list_.size(); i > 0; i--) { |
| 54 DWORD disposition; | 54 DWORD disposition; |
| 55 key_path.assign(key_list_[i - 1]); | 55 key_path.assign(key_list_[i - 1]); |
| 56 | 56 |
| 57 if (key.CreateWithDisposition(predefined_root_, key_path.c_str(), | 57 if (key.CreateWithDisposition(predefined_root_, key_path.c_str(), |
| 58 &disposition, KEY_READ)) { | 58 &disposition, KEY_READ) == ERROR_SUCCESS) { |
| 59 if (disposition == REG_OPENED_EXISTING_KEY) { | 59 if (disposition == REG_OPENED_EXISTING_KEY) { |
| 60 if (key_created_) { | 60 if (key_created_) { |
| 61 // This should not happen. Someone created a subkey under the key | 61 // This should not happen. Someone created a subkey under the key |
| 62 // we just created? | 62 // we just created? |
| 63 LOG(ERROR) << key_path << " exists, this is not expected."; | 63 LOG(ERROR) << key_path << " exists, this is not expected."; |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 VLOG(1) << key_path << " exists"; | 66 VLOG(1) << key_path << " exists"; |
| 67 // Remove the key path from list if it is already present. | 67 // Remove the key path from list if it is already present. |
| 68 key_list_.pop_back(); | 68 key_list_.pop_back(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 do { | 116 do { |
| 117 key_list_.push_back(key_path); | 117 key_list_.push_back(key_path); |
| 118 // This is pure string operation so it does not matter whether the | 118 // This is pure string operation so it does not matter whether the |
| 119 // path is file path or registry path. | 119 // path is file path or registry path. |
| 120 UpOneDirectoryOrEmpty(&key_path); | 120 UpOneDirectoryOrEmpty(&key_path); |
| 121 } while (!key_path.empty()); | 121 } while (!key_path.empty()); |
| 122 | 122 |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| OLD | NEW |