mix up between the different names used to represent the various elements of the registry

I used to think that i understand registry well and know what is a registry key,sub key and values . But seems that I have wrong notion about sub keys and values. I learnt that today.

Till yesterday I was thinking that all data are stored in a format similar to the key-value pair model, which means that you will have some sub key (something like a variable) and an associated value for it. For example[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0]:

Key: "DefaultDoc"
Value: "Default.aspx"

implies that we have a sub key DefaultDoc, whose value is Default.aspx. But i was wrong. Instead of key-value pair, registry makes use of value-data pair; hence in this example, DefaultDoc is the value for which the data is Default.aspx.

The RegistryKey class is used to represent any key in the registry. The Registry class, on the other hand, is used to represent only the root keys in the registry. Effectively there is nothing called sub key in the registry. The whole of registry help does not mention the word sub key on NT machine.

CreateSubKey Method of Microsoft.Win32.RegistryKey creates a a new key under the current key that belongs to the registry hive

This code project article provides detailed explanation of what is the naming convention for registry and also provides a nice diagram, to explain the same.

Advertisements