Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: base/win/registry.h

Issue 275103012: Add WOW64 support and DeleteEmptyKey to base::win::registry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add DeleteEmptyKey Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/win/registry.cc » ('j') | base/win/registry.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | base/win/registry.cc » ('j') | base/win/registry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698