I have one Delphi XE2 project to write something in a registry key. Therefore, I defined the following codes:
procedure TMainForm.BitBtn01Click(Sender: TObject); var RegistryEntry: TRegistry; begin RegistryEntry:= TRegistry.Create(KEY_READ); RegistryEntry.RootKey:= HKEY_LOCAL_MACHINE; if (not RegistryEntry.KeyExists('Software\MyCompanyName\MyName\')) then begin RegistryEntry.Access:= KEY_WRITE; RegistryEntry.OpenKey('Software\MyCompanyName\MyName\',True); end; RegistryEntry.CloseKey(); RegistryEntry.Free; end;
If any addition to the string I defined the following codes:
if (not RegistryEntry.KeyExists('Licenced To')) then begin RegistryEntry.WriteString('Licenced To', 'MySurname MyFirstName'); end;
My requirements:
01. Setting the default value as shown: 
02. In Win64, the node is created under HKEY_LOCAL_MACHINE \ WOWSys64 \ Software, but not under HKEY_LOCAL_MACHINE \ Software.
source share