fcl-registry is an FCL unit that provides access to the Windows registry.
RootKey: registry hive where you want to start accessing the registry. Examples: HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
Key: the path to the "directory" that contains individual data. This is a bit counter-intuitive but a holdover from compatibility with earlier versions of the registry.
Name/value: the actual name/value pairs in the Key "directory". Each key can have a default value, whose name is (an empty string.
Example that tries to get a value:
uses ... registry... var CompileCommand: string=''; Registry: TRegistry; begin Registry := TRegistry.Create; try // Navigate to proper "directory": Registry.RootKey := HKEY_LOCAL_MACHINE; if Registry.OpenKeyReadOnly('\SOFTWARE\Classes\InnoSetupScriptFile\shell\Compile\Command') then CompileCommand:=Registry.ReadString(''); //read the value of the default name finally Registry.Free; end; end;
Accessing 64 bit and 32 bit registry views
If you have 64 bit Windows, the registry is split up into a 64 bit and 32 bit (compatibility) part. By default, if you run a 32 bit process, you see the 32 bit part; if you run a 64 bit application, you see the 64 bit part.
You can also access the 32 bit part from 64 bit applications and vice versa. From MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129%28v=vs.85%29.aspx
- KEY_WOW64_64KEY (value $0100): Access a 64-bit key from either a 32-bit or 64-bit application.
- KEY_WOW64_32KEY (value $0200): Access a 32-bit key from either a 32-bit or 64-bit application.