RegistrySecurity 类

定义

表示注册表项的 Windows 访问控制安全性。 此类不能被继承。

public ref class RegistrySecurity sealed : System::Security::AccessControl::NativeObjectSecurity
public sealed class RegistrySecurity : System.Security.AccessControl.NativeObjectSecurity
[System.Security.SecurityCritical]
public sealed class RegistrySecurity : System.Security.AccessControl.NativeObjectSecurity
type RegistrySecurity = class
    inherit NativeObjectSecurity
[<System.Security.SecurityCritical>]
type RegistrySecurity = class
    inherit NativeObjectSecurity
Public NotInheritable Class RegistrySecurity
Inherits NativeObjectSecurity
继承
属性

示例

本部分包含两个代码示例。 第一个示例显示添加和删除时兼容规则如何合并,第二个示例显示继承和传播标志如何影响规则的添加和删除。

示例 1

下面的代码示例演示 方法如何 RemoveAccessRule 从兼容规则中删除权限,以及方法如何将 AddAccessRule 权限与兼容规则合并。

该示例创建 一个 RegistrySecurity 对象并添加一个允许当前用户 RegistryRights.ReadKey 权限的规则。 然后,该示例创建一个规则, RegistryRights.SetValue该规则向用户 授予与第一个规则相同的继承和传播权限,并使用 RemoveAccessRule 方法从 RegistrySecurity 对象中删除此新规则。 SetValue 是 的一部分 ReadKey,因此会将其从兼容规则中删除。 将显示 对象中的 RegistrySecurity 规则,其中显示了 的 ReadKey剩余组成部分。

然后,示例代码调用 AddAccessRule 方法,将右侧合并 SetValue 回 对象中的 RegistrySecurity 规则。

注意

此示例不将安全对象附加到 RegistryKey 对象。 本节中的第二个示例附加了一个安全对象,和 RegistryKey.SetAccessControl中的RegistryKey.GetAccessControl示例也是如此。


using System;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Security;
using Microsoft.Win32;

public class Example
{

    public static void Main()
    {

        string user = Environment.UserDomainName + "\\"
            + Environment.UserName;

        // Create a security object that grants no access.
        RegistrySecurity mSec = new RegistrySecurity();

        // Add a rule that grants the current user ReadKey
        // rights. ReadKey is a combination of four other 
        // rights. The rule is inherited by all 
        // contained subkeys.
        RegistryAccessRule rule = new RegistryAccessRule(user, 
            RegistryRights.ReadKey, 
            InheritanceFlags.ContainerInherit, 
            PropagationFlags.None, 
            AccessControlType.Allow);
        mSec.AddAccessRule(rule);

        // Create a rule that allows the current user only the 
        // right to query the key/value pairs of a key, using  
        // the same inheritance and propagation flags as the
        // first rule. QueryValues is a constituent of 
        // ReadKey, so when this rule is removed, using the 
        // RemoveAccessRule method, ReadKey is broken into
        // its constituent parts.
        rule = new RegistryAccessRule(user, 
            RegistryRights.QueryValues, 
            InheritanceFlags.ContainerInherit, 
            PropagationFlags.None, 
            AccessControlType.Allow);
        mSec.RemoveAccessRule(rule);

        // Display the rules in the security object.
        ShowSecurity(mSec);

        // Add the second rule back. It merges with the 
        // existing rule, so that the rule is now displayed
        // as ReadKey.
        mSec.AddAccessRule(rule);

        // Display the rules in the security object.
        ShowSecurity(mSec);
    }

    private static void ShowSecurity(RegistrySecurity security)
    {
        Console.WriteLine("\r\nCurrent access rules:\r\n");

        foreach( RegistryAccessRule ar in security.GetAccessRules(true, true, typeof(NTAccount)) )
        {
            Console.WriteLine("        User: {0}", ar.IdentityReference);
            Console.WriteLine("        Type: {0}", ar.AccessControlType);
            Console.WriteLine("      Rights: {0}", ar.RegistryRights);
            Console.WriteLine(" Inheritance: {0}", ar.InheritanceFlags);
            Console.WriteLine(" Propagation: {0}", ar.PropagationFlags);
            Console.WriteLine("   Inherited? {0}", ar.IsInherited);
            Console.WriteLine();
        }
    }
}

/* This code example produces output similar to following:

Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: EnumerateSubKeys, Notify, ReadPermissions
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? False


Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: ReadKey
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? False
 */
Option Explicit
Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.Security
Imports Microsoft.Win32

Public Class Example

    Public Shared Sub Main()

        Dim user As String = Environment.UserDomainName _ 
            & "\" & Environment.UserName

        ' Create a security object that grants no access.
        Dim mSec As New RegistrySecurity()

        ' Add a rule that grants the current user ReadKey
        ' rights. ReadKey is a combination of four other 
        ' rights. The rule is inherited by all 
        ' contained subkeys.
        Dim rule As New RegistryAccessRule(user, _
            RegistryRights.ReadKey, _
            InheritanceFlags.ContainerInherit, _
            PropagationFlags.None, _
            AccessControlType.Allow)
        mSec.AddAccessRule(rule)

        ' Create a rule that allows the current user only the 
        ' right to query the key/value pairs of a key, using  
        ' the same inheritance and propagation flags as the
        ' first rule. QueryValues is a constituent of 
        ' ReadKey, so when this rule is removed, using the 
        ' RemoveAccessRule method, ReadKey is broken into
        ' its constituent parts.
        rule = New RegistryAccessRule(user, _
            RegistryRights.QueryValues, _
            InheritanceFlags.ContainerInherit, _
            PropagationFlags.None, _
            AccessControlType.Allow)
        mSec.RemoveAccessRule(rule)

        ' Display the rules in the security object.
        ShowSecurity(mSec)

        ' Add the second rule back. It merges with the 
        ' existing rule, so that the rule is now displayed
        ' as ReadKey.
        mSec.AddAccessRule(rule)

        ' Display the rules in the security object.
        ShowSecurity(mSec)

    End Sub 

    Private Shared Sub ShowSecurity(ByVal security As RegistrySecurity)
        Console.WriteLine(vbCrLf & "Current access rules:" & vbCrLf)

        For Each ar As RegistryAccessRule In _
            security.GetAccessRules(True, True, GetType(NTAccount))

            Console.WriteLine("        User: {0}", ar.IdentityReference)
            Console.WriteLine("        Type: {0}", ar.AccessControlType)
            Console.WriteLine("      Rights: {0}", ar.RegistryRights)
            Console.WriteLine(" Inheritance: {0}", ar.InheritanceFlags)
            Console.WriteLine(" Propagation: {0}", ar.PropagationFlags)
            Console.WriteLine("   Inherited? {0}", ar.IsInherited)
            Console.WriteLine()
        Next

    End Sub
End Class 

'This code example produces output similar to following:
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: EnumerateSubKeys, Notify, ReadPermissions
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? False
'
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: ReadKey
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? False
'

示例 2

下面的代码示例演示具有继承和传播的访问规则。 该示例创建 一个 对象,然后创建并添加两个 RegistrySecurity 具有 ContainerInherit 标志的规则。 第一个规则没有传播标志,而第二个规则具有 NoPropagateInheritInheritOnly

程序显示 对象中的 RegistrySecurity 规则,然后使用 RegistrySecurity 对象创建子项。 程序创建一个子子项和一个孙子项,然后显示每个子项的安全性。 最后,程序删除测试密钥。


using System;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Security;
using Microsoft.Win32;

public class Example
{
    public static void Main()
    {
        const string TestKey = "TestKey3927";
        RegistryKey cu = Registry.CurrentUser;

        string user = Environment.UserDomainName + 
            "\\" + Environment.UserName;

        // Create a security object that grants no access.
        RegistrySecurity mSec = new RegistrySecurity();

        // Add a rule that grants the current user the right
        // to read and enumerate the name/value pairs in a key, 
        // to read its access and audit rules, to enumerate
        // its subkeys, to create subkeys, and to delete the key. 
        // The rule is inherited by all contained subkeys.
        //
        RegistryAccessRule rule = new RegistryAccessRule(user, 
           RegistryRights.ReadKey | RegistryRights.WriteKey 
               | RegistryRights.Delete, 
           InheritanceFlags.ContainerInherit, 
           PropagationFlags.None, 
           AccessControlType.Allow
        );
        mSec.AddAccessRule(rule);

        // Add a rule that allows the current user the right
        // right to set the name/value pairs in a key. 
        // This rule is inherited by contained subkeys, but
        // propagation flags limit it to immediate child 
        // subkeys.
        rule = new RegistryAccessRule(user, 
            RegistryRights.ChangePermissions, 
            InheritanceFlags.ContainerInherit, 
            PropagationFlags.InheritOnly | 
                PropagationFlags.NoPropagateInherit, 
            AccessControlType.Allow);
        mSec.AddAccessRule(rule);

        // Display the rules in the security object.
        ShowSecurity(mSec);

        // Create the test key using the security object.
        //
        RegistryKey rk = cu.CreateSubKey(TestKey, 
            RegistryKeyPermissionCheck.ReadWriteSubTree, mSec);

        // Create a child subkey and a grandchild subkey, 
        // without security.
        RegistryKey rkChild = rk.CreateSubKey("ChildKey", 
            RegistryKeyPermissionCheck.ReadWriteSubTree);
        RegistryKey rkGrandChild = 
            rkChild.CreateSubKey("GrandChildKey", 
                RegistryKeyPermissionCheck.ReadWriteSubTree);

        Show(rk);
        Show(rkChild);
        Show(rkGrandChild);

        rkGrandChild.Close();
        rkChild.Close();
        rk.Close();

        cu.DeleteSubKeyTree(TestKey);
    }

    private static void Show(RegistryKey rk)
    {
        Console.WriteLine(rk.Name);
        ShowSecurity(rk.GetAccessControl());
    }

    private static void ShowSecurity(RegistrySecurity security)
    {
        Console.WriteLine("\r\nCurrent access rules:\r\n");

        foreach( RegistryAccessRule ar in security.GetAccessRules(true, true, typeof(NTAccount)) )
        {

            Console.WriteLine("        User: {0}", ar.IdentityReference);
            Console.WriteLine("        Type: {0}", ar.AccessControlType);
            Console.WriteLine("      Rights: {0}", ar.RegistryRights);
            Console.WriteLine(" Inheritance: {0}", ar.InheritanceFlags);
            Console.WriteLine(" Propagation: {0}", ar.PropagationFlags);
            Console.WriteLine("   Inherited? {0}", ar.IsInherited);
            Console.WriteLine();
        }
    }
}

/* This code example produces output similar to following:

Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: SetValue, CreateSubKey, Delete, ReadKey
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? False

        User: TestDomain\TestUser
        Type: Allow
      Rights: ChangePermissions
 Inheritance: ContainerInherit
 Propagation: NoPropagateInherit, InheritOnly
   Inherited? False

HKEY_CURRENT_USER\TestKey3927

Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: SetValue, CreateSubKey, Delete, ReadKey
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? False

        User: TestDomain\TestUser
        Type: Allow
      Rights: ChangePermissions
 Inheritance: ContainerInherit
 Propagation: NoPropagateInherit, InheritOnly
   Inherited? False

HKEY_CURRENT_USER\TestKey3927\ChildKey

Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: SetValue, CreateSubKey, Delete, ReadKey
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? True

        User: TestDomain\TestUser
        Type: Allow
      Rights: ChangePermissions
 Inheritance: None
 Propagation: None
   Inherited? True

HKEY_CURRENT_USER\TestKey3927\ChildKey\GrandChildKey

Current access rules:

        User: TestDomain\TestUser
        Type: Allow
      Rights: SetValue, CreateSubKey, Delete, ReadKey
 Inheritance: ContainerInherit
 Propagation: None
   Inherited? True
 */
Option Explicit
Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.Security
Imports Microsoft.Win32

Public Class Example

    Public Shared Sub Main()

        Const TestKey As String = "TestKey3927"
        Dim cu As RegistryKey = Registry.CurrentUser

        Dim user As String = Environment.UserDomainName _ 
            & "\" & Environment.UserName

        ' Create a security object that grants no access.
        Dim mSec As New RegistrySecurity()

        ' Add a rule that grants the current user the right
        ' to read and enumerate the name/value pairs in a key, 
        ' to read its access and audit rules, to enumerate
        ' its subkeys, to create subkeys, and to delete the key. 
        ' The rule is inherited by all contained subkeys.
        '
        Dim rule As New RegistryAccessRule(user, _
            RegistryRights.ReadKey Or RegistryRights.WriteKey _
                Or RegistryRights.Delete, _
            InheritanceFlags.ContainerInherit, _
            PropagationFlags.None, _
            AccessControlType.Allow)
        mSec.AddAccessRule(rule)

        ' Add a rule that allows the current user the right
        ' right to set the name/value pairs in a key. 
        ' This rule is inherited by contained subkeys, but
        ' propagation flags limit it to immediate child 
        ' subkeys.
        rule = New RegistryAccessRule(user, _
            RegistryRights.ChangePermissions, _
            InheritanceFlags.ContainerInherit, _
            PropagationFlags.InheritOnly Or PropagationFlags.NoPropagateInherit, _
            AccessControlType.Allow)
        mSec.AddAccessRule(rule)

        ' Display the rules in the security object.
        ShowSecurity(mSec)

        ' Create the test key using the security object.
        '
        Dim rk As RegistryKey = cu.CreateSubKey(TestKey, _
            RegistryKeyPermissionCheck.ReadWriteSubTree, _
            mSec)

        ' Create a child subkey and a grandchild subkey, 
        ' without security.
        Dim rkChild As RegistryKey= rk.CreateSubKey("ChildKey", _
            RegistryKeyPermissionCheck.ReadWriteSubTree)
        Dim rkGrandChild As RegistryKey = _
            rkChild.CreateSubKey("GrandChildKey", _
                RegistryKeyPermissionCheck.ReadWriteSubTree)

        Show(rk)
        Show(rkChild)
        Show(rkGrandChild)

        rkGrandChild.Close()
        rkChild.Close()
        rk.Close()

        cu.DeleteSubKeyTree(TestKey)
    End Sub 

    Private Shared Sub Show(ByVal rk As RegistryKey)
        Console.WriteLine(rk.Name)            
        ShowSecurity(rk.GetAccessControl())
    End Sub

    Private Shared Sub ShowSecurity(ByVal security As RegistrySecurity)
        Console.WriteLine(vbCrLf & "Current access rules:" & vbCrLf)

        For Each ar As RegistryAccessRule In _
            security.GetAccessRules(True, True, GetType(NTAccount))

            Console.WriteLine("        User: {0}", ar.IdentityReference)
            Console.WriteLine("        Type: {0}", ar.AccessControlType)
            Console.WriteLine("      Rights: {0}", ar.RegistryRights)
            Console.WriteLine(" Inheritance: {0}", ar.InheritanceFlags)
            Console.WriteLine(" Propagation: {0}", ar.PropagationFlags)
            Console.WriteLine("   Inherited? {0}", ar.IsInherited)
            Console.WriteLine()
        Next

    End Sub
End Class 

'This code example produces output similar to following:
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: SetValue, CreateSubKey, Delete, ReadKey
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? False
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: ChangePermissions
' Inheritance: ContainerInherit
' Propagation: NoPropagateInherit, InheritOnly
'   Inherited? False
'
'HKEY_CURRENT_USER\TestKey3927
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: SetValue, CreateSubKey, Delete, ReadKey
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? False
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: ChangePermissions
' Inheritance: ContainerInherit
' Propagation: NoPropagateInherit, InheritOnly
'   Inherited? False
'
'HKEY_CURRENT_USER\TestKey3927\ChildKey
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: SetValue, CreateSubKey, Delete, ReadKey
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? True
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: ChangePermissions
' Inheritance: None
' Propagation: None
'   Inherited? True
'
'HKEY_CURRENT_USER\TestKey3927\ChildKey\GrandChildKey
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: SetValue, CreateSubKey, Delete, ReadKey
' Inheritance: ContainerInherit
' Propagation: None
'   Inherited? True

注解

RegistrySecurity对象指定注册表项的访问权限,还指定如何审核访问尝试。 对注册表项的访问权限表示为规则,每个访问规则由 对象 RegistryAccessRule 表示。 每个审核规则都由 一个 RegistryAuditRule 对象表示。

这反映了基础 Windows 安全系统,其中每个安全对象最多具有一个可自由访问控制列表 (DACL) ,用于控制对受保护对象的访问,并且最多有一个系统访问控制列表 (SACL) ,该列表指定要审核的访问尝试。 DACL 和 SACL 是访问控制条目的有序列表, (指定用户和组的访问权限和审核的 ACE) 。 RegistryAccessRuleRegistryAuditRule 对象可能表示多个 ACE。

注意

Windows 访问控制安全性只能应用于注册表项。 它不能应用于存储在键中的单个键/值对。

RegistrySecurityRegistryAccessRuleRegistryAuditRule 类隐藏 ACL 和 ACE 的实现详细信息。 它们允许你忽略 17 种不同的 ACE 类型,以及正确维护访问权限继承和传播的复杂性。 这些对象还旨在防止以下常见访问控制错误:

  • 使用 null DACL 创建安全描述符。 对 DACL 的 Null 引用允许任何用户向对象添加访问规则,从而可能引发拒绝服务攻击。 新 RegistrySecurity 对象始终以空 DACL 开头,这将拒绝所有用户的所有访问。

  • 违反 ACE 的规范顺序。 如果 DACL 中的 ACE 列表未按规范顺序保留,则用户可能会无意中获得对受保护对象的访问权限。 例如,拒绝的访问权限必须始终出现在允许的访问权限之前。 RegistrySecurity 对象在内部保持正确的顺序。

  • 操作安全描述符标志,这些标志应仅在资源管理器控制之下。

  • 创建 ACE 标志的无效组合。

  • 操作继承的 ACE。 继承和传播由资源管理器处理,以响应对访问和审核规则所做的更改。

  • 将无意义的 ACE 插入 ACL。

.NET 安全对象不支持的唯一功能是大多数应用程序开发人员应避免的危险活动,例如:

  • 通常由资源管理器执行的低级别任务。

  • 以不维护规范顺序的方式添加或删除访问控制条目。

若要修改注册表项的 Windows 访问控制安全性,请使用 RegistryKey.GetAccessControl 方法获取 RegistrySecurity 对象。 通过添加和删除规则修改安全对象,然后使用 RegistryKey.SetAccessControl 方法重新附加它。

重要

RegistrySecurity 调用 RegistryKey.SetAccessControl 方法将更改的安全对象分配给注册表项之前,对 对象所做的更改不会影响注册表项的访问级别。

若要将访问控制安全性从一个注册表项复制到另一个注册表项,请使用 RegistryKey.GetAccessControl 方法获取表示第一个 RegistrySecurity 注册表项的访问和审核规则的对象,然后使用 RegistryKey.SetAccessControl 方法将这些规则分配给第二个注册表项。 还可以使用 RegistryKey.OpenSubKey 采用对象参数的 或 RegistryKey.CreateSubKey 方法将规则分配给第二个 RegistrySecurity 注册表项。

投资使用安全描述符定义语言 (SDDL) 的用户可以使用 SetSecurityDescriptorSddlForm 方法为注册表项设置访问规则,并使用 GetSecurityDescriptorSddlForm 方法获取表示 SDDL 格式的访问规则的字符串。 不建议在新的开发中执行此操作。

构造函数

RegistrySecurity()

使用默认值初始化 RegistrySecurity 类的新实例。

属性

AccessRightType

获取 RegistrySecurity 类用于表示访问权限的枚举类型。

AccessRulesModified

获取或设置一个布尔值,该值指定是否已修改与此 ObjectSecurity 对象关联的访问规则。

(继承自 ObjectSecurity)
AccessRuleType

获取 RegistrySecurity 类用于表示访问规则的类型。

AreAccessRulesCanonical

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的访问规则是否处于规范顺序。

(继承自 ObjectSecurity)
AreAccessRulesProtected

获取一个布尔值,用于指定与 ObjectSecurity 对象关联的自定义访问控制列表 (DACL) 是否受到保护。

(继承自 ObjectSecurity)
AreAuditRulesCanonical

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的审核规则是否处于规范顺序。

(继承自 ObjectSecurity)
AreAuditRulesProtected

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的系统访问控制列表 (SACL) 是否受保护。

(继承自 ObjectSecurity)
AuditRulesModified

获取或设置一个布尔值,该值指定是否已修改与此 ObjectSecurity 对象关联的审核规则。

(继承自 ObjectSecurity)
AuditRuleType

获取 RegistrySecurity 类用于表示审核规则的类型。

GroupModified

获取或设置一个布尔值,该值指定是否已修改与安全对象相关联的组。

(继承自 ObjectSecurity)
IsContainer

获取一个指定此 ObjectSecurity 对象是否是容器对象的布尔值。

(继承自 ObjectSecurity)
IsDS

获取一个布尔值,该值指定此 ObjectSecurity 对象是否是目录对象。

(继承自 ObjectSecurity)
OwnerModified

获取或设置一个布尔值,该值指定是否已修改安全对象的所有者。

(继承自 ObjectSecurity)
SecurityDescriptor

获取此实例的安全说明符。

(继承自 ObjectSecurity)

方法

AccessRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType)

使用指定的访问权限、访问控制和标志为指定用户创建新的访问控制规则。

AddAccessRule(AccessRule)

将指定的访问规则添加到与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL)。

(继承自 CommonObjectSecurity)
AddAccessRule(RegistryAccessRule)

搜索匹配的访问控制,新规则将与之进行合并。 如果未找到符合条件的规则,则添加新规则。

AddAuditRule(AuditRule)

将指定的审核规则添加到与该 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL)。

(继承自 CommonObjectSecurity)
AddAuditRule(RegistryAuditRule)

搜索可以将新规则与之合并的审核规则。 如果未找到符合条件的规则,则添加新规则。

AuditRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags)

新建审核规则,指定此规则应用到的用户、要审核的访问权限、规则的继承和传播以及触发此规则的结果。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetAccessRules(Boolean, Boolean, Type)

获取与指定的安全性标识符关联的访问规则的集合。

(继承自 CommonObjectSecurity)
GetAuditRules(Boolean, Boolean, Type)

获取与指定的安全性标识符关联的审核规则的集合。

(继承自 CommonObjectSecurity)
GetGroup(Type)

获取与指定所有者关联的主要组。

(继承自 ObjectSecurity)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetOwner(Type)

获取与指定主要组关联的所有者。

(继承自 ObjectSecurity)
GetSecurityDescriptorBinaryForm()

返回表示此 ObjectSecurity 对象的安全描述符信息的字节值数组。

(继承自 ObjectSecurity)
GetSecurityDescriptorSddlForm(AccessControlSections)

返回与此 ObjectSecurity 对象关联的安全描述符的指定部分的安全描述符定义语言 (SDDL) 表示形式。

(继承自 ObjectSecurity)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ModifyAccess(AccessControlModification, AccessRule, Boolean)

将指定的修改应用到与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中。

(继承自 CommonObjectSecurity)
ModifyAccessRule(AccessControlModification, AccessRule, Boolean)

将指定的修改应用到与此 ObjectSecurity 对象关联的自由访问控制列表 (DACL) 中。

(继承自 ObjectSecurity)
ModifyAudit(AccessControlModification, AuditRule, Boolean)

将指定的修改应用到与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中。

(继承自 CommonObjectSecurity)
ModifyAuditRule(AccessControlModification, AuditRule, Boolean)

将指定的修改应用到与此 ObjectSecurity 对象关联的系统访问控制列表 (SACL) 中。

(继承自 ObjectSecurity)
Persist(Boolean, String, AccessControlSections)

将与此 ObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。

(继承自 ObjectSecurity)
Persist(SafeHandle, AccessControlSections)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。 我们建议保持传递给构造函数和 persist 方法的 includeSections 参数的值完全相同。

(继承自 NativeObjectSecurity)
Persist(SafeHandle, AccessControlSections, Object)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。

(继承自 NativeObjectSecurity)
Persist(String, AccessControlSections)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。

(继承自 NativeObjectSecurity)
Persist(String, AccessControlSections, Object)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。

(继承自 NativeObjectSecurity)
PurgeAccessRules(IdentityReference)

删除与指定 IdentityReference 关联的所有访问规则。

(继承自 ObjectSecurity)
PurgeAuditRules(IdentityReference)

删除与指定 IdentityReference 关联的所有审核规则。

(继承自 ObjectSecurity)
ReadLock()

为读取访问锁定此 ObjectSecurity 对象。

(继承自 ObjectSecurity)
ReadUnlock()

解锁此 ObjectSecurity 对象以进行读取访问。

(继承自 ObjectSecurity)
RemoveAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符和访问掩码的访问规则。

(继承自 CommonObjectSecurity)
RemoveAccessRule(RegistryAccessRule)

搜索如下的访问控制规则:与指定的访问规则具有相同的用户和 AccessControlType(允许或拒绝),并具有兼容的继承和传播标志;如果找到,则从中移除指定访问规则中包含的权限。

RemoveAccessRuleAll(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符的所有访问规则。

(继承自 CommonObjectSecurity)
RemoveAccessRuleAll(RegistryAccessRule)

搜索与指定的规则具有相同用户和 AccessControlType(允许或拒绝)的所有访问控制规则,如果找到则将其移除。

RemoveAccessRuleSpecific(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则完全匹配的所有访问规则。

(继承自 CommonObjectSecurity)
RemoveAccessRuleSpecific(RegistryAccessRule)

搜索与指定的规则完全匹配的访问控制规则,如果找到则将其移除。

RemoveAuditRule(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同安全性标识符和访问掩码的审核规则。

(继承自 CommonObjectSecurity)
RemoveAuditRule(RegistryAuditRule)

搜索以下的审核控制规则:与指定的规则具有相同的用户,并具有兼容的继承和传播标志;如果找到兼容规则,则从中移除指定的规则中包含的权限。

RemoveAuditRuleAll(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同安全性标识符的所有审核规则。

(继承自 CommonObjectSecurity)
RemoveAuditRuleAll(RegistryAuditRule)

搜索所有使用相同用户作为指定规则的审核规则,如果找到符合条件的规则,则移除它们。

RemoveAuditRuleSpecific(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则完全匹配的所有审核规则。

(继承自 CommonObjectSecurity)
RemoveAuditRuleSpecific(RegistryAuditRule)

搜索与指定的规则完全匹配的审核规则;如果找到,则移除这些规则。

ResetAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除所有访问规则,然后添加指定的访问规则。

(继承自 CommonObjectSecurity)
ResetAccessRule(RegistryAccessRule)

不论 AccessControlType 如何,移除与指定的规则具有相同用户的所有访问控制规则,然后添加指定的规则。

SetAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符和限定符的所有访问规则,然后添加指定的访问规则。

(继承自 CommonObjectSecurity)
SetAccessRule(RegistryAccessRule)

移除与指定的规则具有相同用户和 AccessControlType(允许或拒绝)的所有控制规则,然后添加指定的规则。

SetAccessRuleProtection(Boolean, Boolean)

设置或删除与此 ObjectSecurity 对象相关联的访问规则保护。 父级对象不能通过继承来修改受保护的访问规则。

(继承自 ObjectSecurity)
SetAuditRule(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同的安全性标识符和限定符所有审核规则,然后添加指定的审核规则。

(继承自 CommonObjectSecurity)
SetAuditRule(RegistryAuditRule)

不论 AuditFlags 的值如何,移除与指定的规则具有相同用户的所有审核规则,然后添加指定的规则。

SetAuditRuleProtection(Boolean, Boolean)

设置或删除与此 ObjectSecurity 对象相关联的审核规则保护。 不能由通过继承的父级对象修改受保护的审核规则。

(继承自 ObjectSecurity)
SetGroup(IdentityReference)

设置与此 ObjectSecurity 对象关联的安全描述符的主要组。

(继承自 ObjectSecurity)
SetOwner(IdentityReference)

设置与此 ObjectSecurity 对象关联的安全描述符的所有者。

(继承自 ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[])

根据指定的字节值数组设置此 ObjectSecurity 对象的安全描述符。

(继承自 ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections)

根据指定的字节值数组设置此 ObjectSecurity 对象的安全描述符的指定部分。

(继承自 ObjectSecurity)
SetSecurityDescriptorSddlForm(String)

根据指定的安全描述符定义语言 (SDDL) 字符串设置此 ObjectSecurity 对象的安全描述符。

(继承自 ObjectSecurity)
SetSecurityDescriptorSddlForm(String, AccessControlSections)

根据指定的安全描述符定义语言 (SDDL) 字符串设置此 ObjectSecurity 对象的安全描述符的指定部分。

(继承自 ObjectSecurity)
ToString()

返回表示当前对象的字符串。

(继承自 Object)
WriteLock()

锁定此 ObjectSecurity 对象以进行写访问。

(继承自 ObjectSecurity)
WriteUnlock()

解锁此 ObjectSecurity 对象以进行写入访问。

(继承自 ObjectSecurity)

适用于