I’ve got error message :
Requested registry access is denied
when trying to write into registery keys with turned on UAC :
RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, "")
tawkey.OpenSubKey(x, true).SetValue(X, V, RegistryValueKind.DWord)
Must I run “subinacl /subkeyreg HKEY_LOCAL_MACHINE\PathToMyKeys… /grant=user=f” during My software installation ? Or there is some other way to have access to my registry keys ?
Thank you.
If you wish to write to keys under
HKLM, you need an elevated process. This is achieved by settingrequestedExecutionLeveltorequireAdministratorin the application’s manifest.Making this change means that your application will present a UAC elevation dialog every time it runs. This will no doubt be irritating and so here are some options of avoiding that irritation:
HLKMwhere standard users have write access.HLKMin your install program.HLKMis only needed for occasionally used functionality in your program.Option 3 needs a little elaboration. You can’t elevate a process once it has started. You can only elevate at process start time. So in order to implement option 3, you need that functionality to exist in a separate process or out of process COM server. If you go down this route remember to include the shield icon on any UI element that results in a UAC dialog.