OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... | |
26 public: | 26 public: |
27 RegKey(); | 27 RegKey(); |
28 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access); | 28 RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access); |
29 ~RegKey(); | 29 ~RegKey(); |
30 | 30 |
31 LONG Create(HKEY rootkey, const wchar_t* subkey, REGSAM access); | 31 LONG Create(HKEY rootkey, const wchar_t* subkey, REGSAM access); |
32 | 32 |
33 LONG CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, | 33 LONG CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, |
34 DWORD* disposition, REGSAM access); | 34 DWORD* disposition, REGSAM access); |
35 | 35 |
36 LONG Open(HKEY rootkey, const wchar_t* subkey, REGSAM access); | |
37 | |
38 // Creates a subkey or open it if it already exists. | 36 // Creates a subkey or open it if it already exists. |
39 LONG CreateKey(const wchar_t* name, REGSAM access); | 37 LONG CreateKey(const wchar_t* name, REGSAM access); |
40 | 38 |
41 // Opens a subkey | 39 // Opens an existing reg key. |
42 LONG OpenKey(const wchar_t* name, REGSAM access); | 40 LONG Open(HKEY rootkey, const wchar_t* subkey, REGSAM access); |
43 | 41 |
42 // Opens an existing reg key, given the full key name. | |
43 LONG OpenKey(const wchar_t* full_key_name, REGSAM access); | |
44 | |
45 // Close this reg key. | |
M-A Ruel
2011/10/18 03:28:06
Closes
tfarina
2011/10/18 03:45:07
Done.
| |
44 void Close(); | 46 void Close(); |
45 | 47 |
46 DWORD ValueCount() const; | 48 // Returns true if this key has the specified value. |
49 bool HasValue(const wchar_t* value_name) const; | |
50 | |
51 // Returns the number of values for this key. | |
52 DWORD GetValueCount() const; | |
47 | 53 |
48 // Determine the nth value's name. | 54 // Determine the nth value's name. |
49 LONG ReadName(int index, std::wstring* name) const; | 55 LONG GetValueNameAt(int index, std::wstring* name) const; |
50 | 56 |
51 // True while the key is valid. | 57 // True while the key is valid. |
52 bool Valid() const { return key_ != NULL; } | 58 bool Valid() const { return key_ != NULL; } |
53 | 59 |
54 // Kill a key and everything that live below it; please be careful when using | 60 // Kill a key and everything that live below it; please be careful when using |
55 // it. | 61 // it. |
56 LONG DeleteKey(const wchar_t* name); | 62 LONG DeleteKey(const wchar_t* name); |
57 | 63 |
58 // Deletes a single value within the key. | 64 // Deletes a single value within the key. |
59 LONG DeleteValue(const wchar_t* name); | 65 LONG DeleteValue(const wchar_t* name); |
60 | 66 |
61 bool ValueExists(const wchar_t* name) const; | |
62 | |
63 LONG ReadValue(const wchar_t* name, void* data, DWORD* dsize, | 67 LONG ReadValue(const wchar_t* name, void* data, DWORD* dsize, |
64 DWORD* dtype) const; | 68 DWORD* dtype) const; |
65 LONG ReadValue(const wchar_t* name, std::wstring* value) const; | 69 LONG ReadValue(const wchar_t* name, std::wstring* value) const; |
66 LONG ReadValueDW(const wchar_t* name, DWORD* value) const; | 70 LONG ReadValueDW(const wchar_t* name, DWORD* value) const; |
67 LONG ReadInt64(const wchar_t* name, int64* value) const; | 71 LONG ReadInt64(const wchar_t* name, int64* value) const; |
68 | 72 |
69 LONG WriteValue(const wchar_t* name, const void* data, DWORD dsize, | 73 LONG WriteValue(const wchar_t* name, const void* data, DWORD dsize, |
70 DWORD dtype); | 74 DWORD dtype); |
71 LONG WriteValue(const wchar_t* name, const wchar_t* value); | 75 LONG WriteValue(const wchar_t* name, const wchar_t* value); |
72 LONG WriteValue(const wchar_t* name, DWORD value); | 76 LONG WriteValue(const wchar_t* name, DWORD value); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 | 173 |
170 wchar_t name_[MAX_PATH]; | 174 wchar_t name_[MAX_PATH]; |
171 | 175 |
172 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); | 176 DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator); |
173 }; | 177 }; |
174 | 178 |
175 } // namespace win | 179 } // namespace win |
176 } // namespace base | 180 } // namespace base |
177 | 181 |
178 #endif // BASE_WIN_REGISTRY_H_ | 182 #endif // BASE_WIN_REGISTRY_H_ |
OLD | NEW |