Прагматично пытаюсь добавить пользователю разрешение на чтение, не получаю ошибку, но не добавлен в реестр
Dim Keyss = Microsoft.Win32.Registry.Users
try
For Each a In Keyss.GetSubKeyNames
Dim key = Keyss.OpenSubKey(a)
Next
' key = Keyss.OpenSubKey("S-1-5-20")
Catch ex As SecurityException
'Dim rs = Keyss.GetAccessControl()
Dim rs As New RegistrySecurity()
'Dim currentUserStr = Environment.UserDomainName + "\" + Environment.UserName
Dim currentUserStr = Environment.UserName
Try
rs.AddAccessRule(New RegistryAccessRule(currentUserStr, RegistryRights.ReadKey, AccessControlType.Allow))
Catch exw As Exception
MsgBox(exw.ToString)
End Try
End Try