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 | |
11 #include <string> | 10 #include <string> |
12 | 11 |
13 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
14 | 13 |
15 // TODO(tfarina): Get rid of all the default arguments used in this file. | |
16 // They are not allowed by our style guide. | |
17 | |
18 // Utility class to read, write and manipulate the Windows Registry. | 14 // Utility class to read, write and manipulate the Windows Registry. |
19 // Registry vocabulary primer: a "key" is like a folder, in which there | 15 // 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. | 16 // are "values", which are <name, data> pairs, with an associated data type. |
21 class RegKey { | 17 class RegKey { |
22 public: | 18 public: |
23 RegKey(); | 19 RegKey(); |
24 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access); | 20 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access); |
25 ~RegKey(); | 21 ~RegKey(); |
26 | 22 |
27 bool Create(HKEY rootkey, const wchar_t* subkey, REGSAM access); | 23 bool Create(HKEY rootkey, const wchar_t* subkey, REGSAM access); |
(...skipping 21 matching lines...) Expand all Loading... |
49 | 45 |
50 // Kill a key and everything that live below it; please be careful when using | 46 // Kill a key and everything that live below it; please be careful when using |
51 // it. | 47 // it. |
52 bool DeleteKey(const wchar_t* name); | 48 bool DeleteKey(const wchar_t* name); |
53 | 49 |
54 // Deletes a single value within the key. | 50 // Deletes a single value within the key. |
55 bool DeleteValue(const wchar_t* name); | 51 bool DeleteValue(const wchar_t* name); |
56 | 52 |
57 bool ValueExists(const wchar_t* name); | 53 bool ValueExists(const wchar_t* name); |
58 | 54 |
59 bool ReadValue(const wchar_t* name, void* data, DWORD* dsize, | 55 bool ReadValue(const wchar_t* name, void* data, DWORD* dsize, DWORD* dtype); |
60 DWORD* dtype = NULL); | |
61 bool ReadValue(const wchar_t* name, std::wstring* value); | 56 bool ReadValue(const wchar_t* name, std::wstring* value); |
62 bool ReadValueDW(const wchar_t* name, DWORD* value); | 57 bool ReadValueDW(const wchar_t* name, DWORD* value); |
63 | 58 |
64 bool WriteValue(const wchar_t* name, const void* data, DWORD dsize, | 59 bool WriteValue(const wchar_t* name, const void* data, DWORD dsize, |
65 DWORD dtype); | 60 DWORD dtype); |
66 bool WriteValue(const wchar_t* name, const wchar_t* value); | 61 bool WriteValue(const wchar_t* name, const wchar_t* value); |
67 bool WriteValue(const wchar_t* name, DWORD value); | 62 bool WriteValue(const wchar_t* name, DWORD value); |
68 | 63 |
69 // Starts watching the key to see if any of its values have changed. | 64 // Starts watching the key to see if any of its values have changed. |
70 // The key must have been opened with the KEY_NOTIFY access privelege. | 65 // The key must have been opened with the KEY_NOTIFY access privelege. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 156 |
162 // Current index of the iteration. | 157 // Current index of the iteration. |
163 int index_; | 158 int index_; |
164 | 159 |
165 wchar_t name_[MAX_PATH]; | 160 wchar_t name_[MAX_PATH]; |
166 | 161 |
167 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 162 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
168 }; | 163 }; |
169 | 164 |
170 #endif // BASE_REGISTRY_H_ | 165 #endif // BASE_REGISTRY_H_ |
OLD | NEW |