About the RegistrySecurity

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yxq

    #1

    About the RegistrySecurity

    Hello,
    Using the codes below, i can deny to write to the key(Test) in Registry, but
    how to restore the write privilege to the key(Test)? thank you.

    /////////////////////////////////////////////////////////////////////////////////////////////////
    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    Dim user As String = Environment.Use rDomainName & "\" &
    Environment.Use rName
    Dim rs As New Security.Access Control.Registr ySecurity()

    rs.AddAccessRul e(New Security.Access Control.Registr yAccessRule(use r,
    _
    RegistryRights. WriteKey, _
    InheritanceFlag s.None, _
    PropagationFlag s.None, _
    AccessControlTy pe.Deny))

    Registry.Curren tUser.OpenSubKe y("Test", True).SetAccess Control(rs)
    MessageBox.Show ("done")
    End Sub


Working...