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

Side by Side Diff: components/policy/core/common/registry_dict_win.cc

Issue 616173003: Allow Registry Iterator functions to use a specified WOW64 mode when iterating. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "components/policy/core/common/registry_dict_win.h" 5 #include "components/policy/core/common/registry_dict_win.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void RegistryDict::Swap(RegistryDict* other) { 236 void RegistryDict::Swap(RegistryDict* other) {
237 keys_.swap(other->keys_); 237 keys_.swap(other->keys_);
238 values_.swap(other->values_); 238 values_.swap(other->values_);
239 } 239 }
240 240
241 void RegistryDict::ReadRegistry(HKEY hive, const base::string16& root) { 241 void RegistryDict::ReadRegistry(HKEY hive, const base::string16& root) {
242 ClearKeys(); 242 ClearKeys();
243 ClearValues(); 243 ClearValues();
244 244
245 // First, read all the values of the key. 245 // First, read all the values of the key.
246 for (RegistryValueIterator it(hive, root.c_str()); it.Valid(); ++it) { 246 for (RegistryValueIterator it(hive, root.c_str(), 0); it.Valid(); ++it) {
247 const std::string name = base::UTF16ToUTF8(it.Name()); 247 const std::string name = base::UTF16ToUTF8(it.Name());
248 switch (it.Type()) { 248 switch (it.Type()) {
249 case REG_SZ: 249 case REG_SZ:
250 case REG_EXPAND_SZ: 250 case REG_EXPAND_SZ:
251 SetValue(name, 251 SetValue(name,
252 scoped_ptr<base::Value>( 252 scoped_ptr<base::Value>(
253 new base::StringValue(base::UTF16ToUTF8(it.Value())))); 253 new base::StringValue(base::UTF16ToUTF8(it.Value()))));
254 continue; 254 continue;
255 case REG_DWORD_LITTLE_ENDIAN: 255 case REG_DWORD_LITTLE_ENDIAN:
256 case REG_DWORD_BIG_ENDIAN: 256 case REG_DWORD_BIG_ENDIAN:
(...skipping 18 matching lines...) Expand all
275 // Unsupported type, message gets logged below. 275 // Unsupported type, message gets logged below.
276 break; 276 break;
277 } 277 }
278 278
279 LOG(WARNING) << "Failed to read hive " << hive << " at " 279 LOG(WARNING) << "Failed to read hive " << hive << " at "
280 << root << "\\" << name 280 << root << "\\" << name
281 << " type " << it.Type(); 281 << " type " << it.Type();
282 } 282 }
283 283
284 // Recurse for all subkeys. 284 // Recurse for all subkeys.
285 for (RegistryKeyIterator it(hive, root.c_str()); it.Valid(); ++it) { 285 for (RegistryKeyIterator it(hive, root.c_str(), 0); it.Valid(); ++it) {
286 std::string name(base::UTF16ToUTF8(it.Name())); 286 std::string name(base::UTF16ToUTF8(it.Name()));
287 scoped_ptr<RegistryDict> subdict(new RegistryDict()); 287 scoped_ptr<RegistryDict> subdict(new RegistryDict());
288 subdict->ReadRegistry(hive, root + L"\\" + it.Name()); 288 subdict->ReadRegistry(hive, root + L"\\" + it.Name());
289 SetKey(name, subdict.Pass()); 289 SetKey(name, subdict.Pass());
290 } 290 }
291 } 291 }
292 292
293 scoped_ptr<base::Value> RegistryDict::ConvertToJSON( 293 scoped_ptr<base::Value> RegistryDict::ConvertToJSON(
294 const Schema& schema) const { 294 const Schema& schema) const {
295 base::Value::Type type = 295 base::Value::Type type =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 return result.PassAs<base::Value>(); 341 return result.PassAs<base::Value>();
342 } 342 }
343 default: 343 default:
344 LOG(WARNING) << "Can't convert registry key to schema type " << type; 344 LOG(WARNING) << "Can't convert registry key to schema type " << type;
345 } 345 }
346 346
347 return scoped_ptr<base::Value>(); 347 return scoped_ptr<base::Value>();
348 } 348 }
349 349
350 } // namespace policy 350 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698