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 <stdint.h> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/base_export.h" | 13 #include "base/base_export.h" |
13 #include "base/basictypes.h" | 14 #include "base/macros.h" |
14 #include "base/win/object_watcher.h" | 15 #include "base/win/object_watcher.h" |
15 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 namespace win { | 19 namespace win { |
19 | 20 |
20 // Utility class to read, write and manipulate the Windows Registry. | 21 // Utility class to read, write and manipulate the Windows Registry. |
21 // Registry vocabulary primer: a "key" is like a folder, in which there | 22 // Registry vocabulary primer: a "key" is like a folder, in which there |
22 // are "values", which are <name, data> pairs, with an associated data type. | 23 // are "values", which are <name, data> pairs, with an associated data type. |
23 // | 24 // |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 // Deletes an empty subkey. If the subkey has subkeys or values then this | 79 // Deletes an empty subkey. If the subkey has subkeys or values then this |
79 // will fail. | 80 // will fail. |
80 LONG DeleteEmptyKey(const wchar_t* name); | 81 LONG DeleteEmptyKey(const wchar_t* name); |
81 | 82 |
82 // Deletes a single value within the key. | 83 // Deletes a single value within the key. |
83 LONG DeleteValue(const wchar_t* name); | 84 LONG DeleteValue(const wchar_t* name); |
84 | 85 |
85 // Getters: | 86 // Getters: |
86 | 87 |
87 // Returns an int32 value. If |name| is NULL or empty, returns the default | 88 // Returns an int32_t value. If |name| is NULL or empty, returns the default |
88 // value, if any. | 89 // value, if any. |
89 LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const; | 90 LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const; |
90 | 91 |
91 // Returns an int64 value. If |name| is NULL or empty, returns the default | 92 // Returns an int64_t value. If |name| is NULL or empty, returns the default |
92 // value, if any. | 93 // value, if any. |
93 LONG ReadInt64(const wchar_t* name, int64* out_value) const; | 94 LONG ReadInt64(const wchar_t* name, int64_t* out_value) const; |
94 | 95 |
95 // Returns a string value. If |name| is NULL or empty, returns the default | 96 // Returns a string value. If |name| is NULL or empty, returns the default |
96 // value, if any. | 97 // value, if any. |
97 LONG ReadValue(const wchar_t* name, std::wstring* out_value) const; | 98 LONG ReadValue(const wchar_t* name, std::wstring* out_value) const; |
98 | 99 |
99 // Reads a REG_MULTI_SZ registry field into a vector of strings. Clears | 100 // Reads a REG_MULTI_SZ registry field into a vector of strings. Clears |
100 // |values| initially and adds further strings to the list. Returns | 101 // |values| initially and adds further strings to the list. Returns |
101 // ERROR_CANTREAD if type is not REG_MULTI_SZ. | 102 // ERROR_CANTREAD if type is not REG_MULTI_SZ. |
102 LONG ReadValues(const wchar_t* name, std::vector<std::wstring>* values); | 103 LONG ReadValues(const wchar_t* name, std::vector<std::wstring>* values); |
103 | 104 |
104 // Returns raw data. If |name| is NULL or empty, returns the default | 105 // Returns raw data. If |name| is NULL or empty, returns the default |
105 // value, if any. | 106 // value, if any. |
106 LONG ReadValue(const wchar_t* name, | 107 LONG ReadValue(const wchar_t* name, |
107 void* data, | 108 void* data, |
108 DWORD* dsize, | 109 DWORD* dsize, |
109 DWORD* dtype) const; | 110 DWORD* dtype) const; |
110 | 111 |
111 // Setters: | 112 // Setters: |
112 | 113 |
113 // Sets an int32 value. | 114 // Sets an int32_t value. |
114 LONG WriteValue(const wchar_t* name, DWORD in_value); | 115 LONG WriteValue(const wchar_t* name, DWORD in_value); |
115 | 116 |
116 // Sets a string value. | 117 // Sets a string value. |
117 LONG WriteValue(const wchar_t* name, const wchar_t* in_value); | 118 LONG WriteValue(const wchar_t* name, const wchar_t* in_value); |
118 | 119 |
119 // Sets raw data, including type. | 120 // Sets raw data, including type. |
120 LONG WriteValue(const wchar_t* name, | 121 LONG WriteValue(const wchar_t* name, |
121 const void* data, | 122 const void* data, |
122 DWORD dsize, | 123 DWORD dsize, |
123 DWORD dtype); | 124 DWORD dtype); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 250 |
250 wchar_t name_[MAX_PATH]; | 251 wchar_t name_[MAX_PATH]; |
251 | 252 |
252 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 253 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
253 }; | 254 }; |
254 | 255 |
255 } // namespace win | 256 } // namespace win |
256 } // namespace base | 257 } // namespace base |
257 | 258 |
258 #endif // BASE_WIN_REGISTRY_H_ | 259 #endif // BASE_WIN_REGISTRY_H_ |
OLD | NEW |