private void FillValues(RegistryKeySnapshot snapshot, RegistryKey key) { if (key.ValueCount != 0) { RegistryValueSnapshotCollection children; string[] names; children = new RegistryValueSnapshotCollection(snapshot); try { names = key.GetValueNames(); } catch (IOException) { // system error, saw this in latest Windows 10 // when trying to scan HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\CreativeEventCache\SubscribedContent-314559 names = _emptyArray; } for (int i = 0; i < names.Length; i++) { string name; string value; RegistryValueKind type; object rawValue; name = names[i]; type = key.GetValueKind(name); rawValue = this.GetValue(key, type, name); value = this.TransformRawValue(type, rawValue); children.Add(new RegistryValueSnapshot(name, value, type)); } snapshot.Values = children; } }
private void FillValues(RegistryKeySnapshot snapshot, RegistryKey key) { if (key.ValueCount != 0) { RegistryValueSnapshotCollection children; children = new RegistryValueSnapshotCollection(snapshot); foreach (string name in key.GetValueNames()) { string value; RegistryValueKind type; object rawValue; type = key.GetValueKind(name); rawValue = this.GetValue(key, type, name); value = this.TransformRawValue(type, rawValue); children.Add(new RegistryValueSnapshot(name, value, type)); } snapshot.Values = children; } }