OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_entry.h" | 5 #include "chrome/installer/util/registry_entry.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
10 #include "chrome/installer/util/work_item.h" | 10 #include "chrome/installer/util/work_item.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (is_string_) { | 51 if (is_string_) { |
52 items->AddSetRegValueWorkItem(root, key_path_, WorkItem::kWow64Default, | 52 items->AddSetRegValueWorkItem(root, key_path_, WorkItem::kWow64Default, |
53 name_, value_, true); | 53 name_, value_, true); |
54 } else { | 54 } else { |
55 items->AddSetRegValueWorkItem(root, key_path_, WorkItem::kWow64Default, | 55 items->AddSetRegValueWorkItem(root, key_path_, WorkItem::kWow64Default, |
56 name_, int_value_, true); | 56 name_, int_value_, true); |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 bool RegistryEntry::ExistsInRegistry(uint32 look_for_in) const { | 61 bool RegistryEntry::ExistsInRegistry(uint32_t look_for_in) const { |
62 DCHECK(look_for_in); | 62 DCHECK(look_for_in); |
63 | 63 |
64 RegistryStatus status = DOES_NOT_EXIST; | 64 RegistryStatus status = DOES_NOT_EXIST; |
65 if (look_for_in & LOOK_IN_HKCU) | 65 if (look_for_in & LOOK_IN_HKCU) |
66 status = StatusInRegistryUnderRoot(HKEY_CURRENT_USER); | 66 status = StatusInRegistryUnderRoot(HKEY_CURRENT_USER); |
67 if (status == DOES_NOT_EXIST && (look_for_in & LOOK_IN_HKLM)) | 67 if (status == DOES_NOT_EXIST && (look_for_in & LOOK_IN_HKLM)) |
68 status = StatusInRegistryUnderRoot(HKEY_LOCAL_MACHINE); | 68 status = StatusInRegistryUnderRoot(HKEY_LOCAL_MACHINE); |
69 return status == SAME_VALUE; | 69 return status == SAME_VALUE; |
70 } | 70 } |
71 | 71 |
72 bool RegistryEntry::KeyExistsInRegistry(uint32 look_for_in) const { | 72 bool RegistryEntry::KeyExistsInRegistry(uint32_t look_for_in) const { |
73 DCHECK(look_for_in); | 73 DCHECK(look_for_in); |
74 | 74 |
75 RegistryStatus status = DOES_NOT_EXIST; | 75 RegistryStatus status = DOES_NOT_EXIST; |
76 if (look_for_in & LOOK_IN_HKCU) | 76 if (look_for_in & LOOK_IN_HKCU) |
77 status = StatusInRegistryUnderRoot(HKEY_CURRENT_USER); | 77 status = StatusInRegistryUnderRoot(HKEY_CURRENT_USER); |
78 if (status == DOES_NOT_EXIST && (look_for_in & LOOK_IN_HKLM)) | 78 if (status == DOES_NOT_EXIST && (look_for_in & LOOK_IN_HKLM)) |
79 status = StatusInRegistryUnderRoot(HKEY_LOCAL_MACHINE); | 79 status = StatusInRegistryUnderRoot(HKEY_LOCAL_MACHINE); |
80 return status != DOES_NOT_EXIST; | 80 return status != DOES_NOT_EXIST; |
81 } | 81 } |
82 | 82 |
(...skipping 15 matching lines...) Expand all Loading... |
98 } | 98 } |
99 } else { | 99 } else { |
100 DWORD read_value; | 100 DWORD read_value; |
101 found = key.ReadValueDW(name_.c_str(), &read_value) == ERROR_SUCCESS; | 101 found = key.ReadValueDW(name_.c_str(), &read_value) == ERROR_SUCCESS; |
102 if (found) | 102 if (found) |
103 correct_value = read_value == int_value_; | 103 correct_value = read_value == int_value_; |
104 } | 104 } |
105 return found ? (correct_value ? SAME_VALUE : DIFFERENT_VALUE) | 105 return found ? (correct_value ? SAME_VALUE : DIFFERENT_VALUE) |
106 : DOES_NOT_EXIST; | 106 : DOES_NOT_EXIST; |
107 } | 107 } |
OLD | NEW |