Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef BASE_WIN_REGISTRY_H_ | 5 #ifndef BASE_WIN_REGISTRY_H_ |
| 6 #define BASE_WIN_REGISTRY_H_ | 6 #define BASE_WIN_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // Determine the nth value's name. | 64 // Determine the nth value's name. |
| 65 LONG GetValueNameAt(int index, std::wstring* name) const; | 65 LONG GetValueNameAt(int index, std::wstring* name) const; |
| 66 | 66 |
| 67 // True while the key is valid. | 67 // True while the key is valid. |
| 68 bool Valid() const { return key_ != NULL; } | 68 bool Valid() const { return key_ != NULL; } |
| 69 | 69 |
| 70 // Kill a key and everything that live below it; please be careful when using | 70 // Kill a key and everything that live below it; please be careful when using |
| 71 // it. | 71 // it. |
| 72 LONG DeleteKey(const wchar_t* name); | 72 LONG DeleteKey(const wchar_t* name); |
| 73 | 73 |
| 74 // Delete an empty subkey. If the subkey has subkeys then this will fail. | |
|
grt (UTC plus 2)
2014/05/20 15:28:52
nit: Delete -> Deletes
Will Harris
2014/05/20 17:03:34
Done.
| |
| 75 LONG DeleteEmptyKey(const wchar_t* name); | |
| 76 | |
| 74 // Deletes a single value within the key. | 77 // Deletes a single value within the key. |
| 75 LONG DeleteValue(const wchar_t* name); | 78 LONG DeleteValue(const wchar_t* name); |
| 76 | 79 |
| 77 // Getters: | 80 // Getters: |
| 78 | 81 |
| 79 // Returns an int32 value. If |name| is NULL or empty, returns the default | 82 // Returns an int32 value. If |name| is NULL or empty, returns the default |
| 80 // value, if any. | 83 // value, if any. |
| 81 LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const; | 84 LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const; |
| 82 | 85 |
| 83 // Returns an int64 value. If |name| is NULL or empty, returns the default | 86 // Returns an int64 value. If |name| is NULL or empty, returns the default |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 | 128 |
| 126 // Will automatically be called by destructor if not manually called | 129 // Will automatically be called by destructor if not manually called |
| 127 // beforehand. Returns true if it was watching, false otherwise. | 130 // beforehand. Returns true if it was watching, false otherwise. |
| 128 LONG StopWatching(); | 131 LONG StopWatching(); |
| 129 | 132 |
| 130 inline bool IsWatching() const { return watch_event_ != 0; } | 133 inline bool IsWatching() const { return watch_event_ != 0; } |
| 131 HANDLE watch_event() const { return watch_event_; } | 134 HANDLE watch_event() const { return watch_event_; } |
| 132 HKEY Handle() const { return key_; } | 135 HKEY Handle() const { return key_; } |
| 133 | 136 |
| 134 private: | 137 private: |
| 138 // Calls RegDeleteKeyEx on supported platforms, alternatively falls back to | |
| 139 // RegDeleteKey. | |
| 140 static LONG RegDeleteKeyExWrapper(HKEY hKey, | |
| 141 const wchar_t* lpSubKey, | |
| 142 REGSAM samDesired, | |
| 143 DWORD Reserved); | |
| 144 | |
| 145 // Recursively deletes a key and all of its subkeys. | |
| 146 static LONG RegDelRecurse(HKEY root_key, | |
| 147 const std::wstring& name, | |
| 148 REGSAM access); | |
| 135 HKEY key_; // The registry key being iterated. | 149 HKEY key_; // The registry key being iterated. |
| 136 HANDLE watch_event_; | 150 HANDLE watch_event_; |
| 151 REGSAM wow64access_; | |
| 137 | 152 |
| 138 DISALLOW_COPY_AND_ASSIGN(RegKey); | 153 DISALLOW_COPY_AND_ASSIGN(RegKey); |
| 139 }; | 154 }; |
| 140 | 155 |
| 141 // Iterates the entries found in a particular folder on the registry. | 156 // Iterates the entries found in a particular folder on the registry. |
| 142 class BASE_EXPORT RegistryValueIterator { | 157 class BASE_EXPORT RegistryValueIterator { |
| 143 public: | 158 public: |
| 144 RegistryValueIterator(HKEY root_key, const wchar_t* folder_key); | 159 RegistryValueIterator(HKEY root_key, const wchar_t* folder_key); |
| 145 | 160 |
| 146 ~RegistryValueIterator(); | 161 ~RegistryValueIterator(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 | 225 |
| 211 wchar_t name_[MAX_PATH]; | 226 wchar_t name_[MAX_PATH]; |
| 212 | 227 |
| 213 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 228 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
| 214 }; | 229 }; |
| 215 | 230 |
| 216 } // namespace win | 231 } // namespace win |
| 217 } // namespace base | 232 } // namespace base |
| 218 | 233 |
| 219 #endif // BASE_WIN_REGISTRY_H_ | 234 #endif // BASE_WIN_REGISTRY_H_ |
| OLD | NEW |