I’ve added an example in the MSDN Samples repository which explains how to read values from the Windows Registry.
Description:
The example is a simple Console-application that shows you how to select the correct RegistryHive, and afterwards navigate to the correct key and read the value. Keep in mind that reading from the Windows registry always returns an object of type 'object' so you'll need to cast this value to something that makes more sense. This means that you'll be expected to know what you're going to read (integer, binary, string,...). And last but not least, don't forget to add the Microsoft.Win32 using statement!
The available RegistryHives you can read from (and their corresponding names in the Registry Editor (Start => Run => regedit.exe):
- - ClassesRoot (in RegEdit: HKEY_CLASSES_ROOT)
- - CurrentConfig (in RegEdit:HKEY_CURRENT_CONFIG)
- - CurrentUser (in RegEdit:HKEY_CURRENT_USER)
- - DynData (Windows' own hive with dynamic data. Some configuration information in Windows must be stored in RAM because it requires fast modification and retrieval that cannot wait for the registry to send it to the hard disk. You can find all this data in the HKEY_DYN_DATA registry key. The information in this key is newly created every time Windows starts. Not visible in RegEdit)
- - LocalMachine (in RegEdit:HKEY_LOCAL_MACHINE)
- - PerformanceData (Is used to access performance counters but is not visible in Regedit)
- - Users (in RegEdit:HKEY_USERS)
You can find the example here.
8648cfe2-a143-440d-8fb2-eacdca191811|0|.0