A quick way to read all registry values

I am writing a utility that should create a list of all registry values ​​in HKCR. I do this with a recursive function:

var list = new Dictionary<string, string>(); Read(Registry.ClassesRoot, list); static void Read(RegistryKey root, IDictionary<string, string> values) { foreach (var child in root.GetSubKeyNames()) { using (var childKey = root.OpenSubKey(child)) { Read(childKey, values); } } foreach (var value in root.GetValueNames()) { values.Add(string.Format("{0}\\{1}", root, value), (root.GetValue(value) ?? "").ToString()); } } 

This works fine, but it takes a good chunk of time (20 seconds on my PC). Is there a faster way to do this, or is it as good as it gets?

+6
source share
1 answer

There is a lot of information in the registry and, as others have noted here, it can be a problem. If you want the list of registry settings to be displayed in a tree view for the user to view, the best solution would be to first scan the top-level entries and then when the user moves through the tree, so you look at these child values ​​/ settings as the node tree opens .

I suspect this is working Microsoft regedit.

+1
source

All Articles