You do not need a part rsif you are not trying to assign specific rights to the generated key.
You need:
- Open the key in which you want to create your subsection, and assign it to a variable
RegistryKey. Add a trueBoolean to mark it as writable. - Create your subsection using this variable and assign it back to the same variable.
- Set the value using a variable
RegistryKey.
Example:
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System", true);
key = key.CreateSubKey("MyNewKey");
key.SetValue("kashif", 1, RegistryValueKind.DWord);
, System is, CreateSubKey, . . OpenSubKey.
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System", true);
key.SetValue("kashif", 1, RegistryValueKind.DWord);