| 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 #ifndef BASE_REGISTRY_H_ | 5 #ifndef BASE_REGISTRY_H_ |
| 6 #define BASE_REGISTRY_H_ | 6 #define BASE_REGISTRY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 | 14 |
| 15 // TODO(tfarina): Get rid of all the default arguments used in this file. | 15 // TODO(tfarina): Get rid of all the default arguments used in this file. |
| 16 // They are not allowed by our style guide. | 16 // They are not allowed by our style guide. |
| 17 | 17 |
| 18 // Utility class to read, write and manipulate the Windows Registry. | 18 // Utility class to read, write and manipulate the Windows Registry. |
| 19 // Registry vocabulary primer: a "key" is like a folder, in which there | 19 // Registry vocabulary primer: a "key" is like a folder, in which there |
| 20 // are "values", which are <name, data> pairs, with an associated data type. | 20 // are "values", which are <name, data> pairs, with an associated data type. |
| 21 class RegKey { | 21 class RegKey { |
| 22 public: | 22 public: |
| 23 RegKey(HKEY rootkey = NULL, const wchar_t* subkey = NULL, | 23 RegKey(HKEY rootkey = NULL, const wchar_t* subkey = NULL, |
| 24 REGSAM access = KEY_READ); | 24 REGSAM access = KEY_READ); |
| 25 ~RegKey() { Close(); } | 25 ~RegKey(); |
| 26 | 26 |
| 27 bool Create(HKEY rootkey, const wchar_t* subkey, REGSAM access = KEY_READ); | 27 bool Create(HKEY rootkey, const wchar_t* subkey, REGSAM access = KEY_READ); |
| 28 | 28 |
| 29 bool CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, | 29 bool CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, |
| 30 DWORD* disposition, REGSAM access = KEY_READ); | 30 DWORD* disposition, REGSAM access); |
| 31 | 31 |
| 32 bool Open(HKEY rootkey, const wchar_t* subkey, REGSAM access = KEY_READ); | 32 bool Open(HKEY rootkey, const wchar_t* subkey, REGSAM access = KEY_READ); |
| 33 | 33 |
| 34 // Creates a subkey or open it if it already exists. | 34 // Creates a subkey or open it if it already exists. |
| 35 bool CreateKey(const wchar_t* name, REGSAM access); | 35 bool CreateKey(const wchar_t* name, REGSAM access); |
| 36 | 36 |
| 37 // Opens a subkey | 37 // Opens a subkey |
| 38 bool OpenKey(const wchar_t* name, REGSAM access); | 38 bool OpenKey(const wchar_t* name, REGSAM access); |
| 39 | 39 |
| 40 void Close(); | 40 void Close(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // Current index of the iteration. | 162 // Current index of the iteration. |
| 163 int index_; | 163 int index_; |
| 164 | 164 |
| 165 wchar_t name_[MAX_PATH]; | 165 wchar_t name_[MAX_PATH]; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 167 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 #endif // BASE_REGISTRY_H_ | 170 #endif // BASE_REGISTRY_H_ |
| OLD | NEW |