Y
YXQ
How to detect programmatically if current user has the deleting permission
to delete a Registry key in VS 2005? thank you very much!
to delete a Registry key in VS 2005? thank you very much!
vbnetdev said:Public Function GetAccessControl As RegistrySecurity
Dim instance As RegistryKey
Dim returnValue As RegistrySecurity
returnValue = instance.GetAccessControl
vbnetdev said:This will bomb as not accetpable. If you change it to currentuser if you
have admin success it shoudl proceed without problem.
Sub Test3()
Dim regKey As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.LocalMachine
Try
regKey.OpenSubKey("console",
Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree,
System.Security.AccessControl.RegistryRights.Delete).ToString()
Catch ex As Exception
MessageBox.Show("The specified access to the key was not
possible")
End Try
End Sub