RegistrySecurity 類別

定義

表示登錄機碼的 Windows 存取控制 (Access Control) 安全性。 此類別無法獲得繼承。

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 存取控制安全性只能套用至登錄機碼。 它無法套用至儲存在索引鍵中的個別索引鍵/值組。

RegistrySecurityRegistryAccessRule 和 類別會隱藏 ACL 和 RegistryAuditRule ACE 的實作詳細資料。 它們可讓您忽略十七個不同的 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 方法來取得代表第一個登錄機碼存取和稽核規則的物件,然後使用 RegistryKey.SetAccessControl 方法將這些規則指派給第二個 RegistrySecurity 登錄機碼。 您也可以使用 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 物件相關聯的 Discretionary 存取控制清單 (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 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。

(繼承來源 ObjectSecurity)
Persist(SafeHandle, AccessControlSections)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。 建議您保留傳遞到建構函式的 includeSections 參數值,並維持方法相同。

(繼承來源 NativeObjectSecurity)
Persist(SafeHandle, AccessControlSections, Object)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。

(繼承來源 NativeObjectSecurity)
Persist(String, AccessControlSections)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。

(繼承來源 NativeObjectSecurity)
Persist(String, AccessControlSections, Object)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。

(繼承來源 NativeObjectSecurity)
PurgeAccessRules(IdentityReference)

移除與指定之 IdentityReference 相關聯的所有存取規則。

(繼承來源 ObjectSecurity)
PurgeAuditRules(IdentityReference)

移除與指定之 IdentityReference 相關聯的所有稽核規則。

(繼承來源 ObjectSecurity)
ReadLock()

鎖定這個 ObjectSecurity 物件的讀取權限。

(繼承來源 ObjectSecurity)
ReadUnlock()

解除鎖定這個 ObjectSecurity 物件的讀取權限。

(繼承來源 ObjectSecurity)
RemoveAccessRule(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (DACL),移除包含與指定存取規則相同安全識別項和存取遮罩的存取規則。

(繼承來源 CommonObjectSecurity)
RemoveAccessRule(RegistryAccessRule)

搜尋具有與指定之存取規則相同的使用者和 AccessControlType (允許或拒絕) 以及具有相容的繼承和傳用旗標的存取控制規則。如果找到這樣的規則,則會移除指定之存取規則中所包含的權限。

RemoveAccessRuleAll(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (DACL),移除包含與指定存取規則相同安全識別項的所有存取規則。

(繼承來源 CommonObjectSecurity)
RemoveAccessRuleAll(RegistryAccessRule)

搜尋與指定規則具有相同使用者和 AccessControlType (允許或拒絕) 的所有存取控制規則,如果找到的話,便加以移除。

RemoveAccessRuleSpecific(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (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 物件相關聯之 Discretionary 存取控制清單 (DACL) 中的所有存取規則,然後加入指定的存取規則。

(繼承來源 CommonObjectSecurity)
ResetAccessRule(RegistryAccessRule)

移除與指定規則具有相同使用者的所有存取控制規則 (不論 AccessControlType 為何),然後加入指定規則。

SetAccessRule(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯之 Discretionary 存取控制清單 (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)

適用於