RegistryPermission 构造函数

定义

初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class.

重载

RegistryPermission(PermissionState)

根据指定,使用完全受限制或不受限制的权限初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with either fully restricted or unrestricted permission as specified.

RegistryPermission(RegistryPermissionAccess, String)

通过对指定注册表变量的指定访问权限初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables.

RegistryPermission(RegistryPermissionAccess, AccessControlActions, String)

使用对指定注册表变量的指定访问权限和对注册表控制信息的指定访问权限,初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables and the specified access rights to registry control information.

RegistryPermission(PermissionState)

根据指定,使用完全受限制或不受限制的权限初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with either fully restricted or unrestricted permission as specified.

public:
 RegistryPermission(System::Security::Permissions::PermissionState state);
public RegistryPermission (System.Security.Permissions.PermissionState state);
new System.Security.Permissions.RegistryPermission : System.Security.Permissions.PermissionState -> System.Security.Permissions.RegistryPermission
Public Sub New (state As PermissionState)

参数

state
PermissionState

PermissionState 值之一。One of the PermissionState values.

例外

state 参数不是 PermissionState 的有效值。The state parameter is not a valid value of PermissionState.

示例

下面的代码示例演示如何使用 RegistryPermission(PermissionState) 构造函数。The following code example shows the use of the RegistryPermission(PermissionState) constructor.

readPerm2 = new RegistryPermission(PermissionState.None);
readPerm2.FromXml(readPerm1.ToXml());
Console.WriteLine("Result of ToFromXml = " + readPerm2.ToString() + "\n");
readPerm2 = New RegistryPermission(PermissionState.None)
readPerm2.FromXml(readPerm1.ToXml())
Console.WriteLine("Result of ToFromXml = " + readPerm2.ToString() + vbLf)

注解

创建完全受限制的 (None) 或对 Unrestricted 注册表变量的访问权限。Creates either fully restricted (None) or Unrestricted access to registry variables.

适用于

产品 Introduced

RegistryPermission(RegistryPermissionAccess, String)

通过对指定注册表变量的指定访问权限初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables.

public:
 RegistryPermission(System::Security::Permissions::RegistryPermissionAccess access, System::String ^ pathList);
public RegistryPermission (System.Security.Permissions.RegistryPermissionAccess access, string pathList);
new System.Security.Permissions.RegistryPermission : System.Security.Permissions.RegistryPermissionAccess * string -> System.Security.Permissions.RegistryPermission
Public Sub New (access As RegistryPermissionAccess, pathList As String)

参数

pathList
String

向其授予了访问权限的注册表变量的列表(以分号分隔)。A list of registry variables (semicolon-separated) to which access is granted.

例外

access 参数不是 RegistryPermissionAccess 的有效值。The access parameter is not a valid value of RegistryPermissionAccess.

- 或 --or- pathList 参数不是有效的字符串。The pathList parameter is not a valid string.

示例

下面的代码示例演示如何使用 RegistryPermission(RegistryPermissionAccess, String) 构造函数。The following code example shows the use of the RegistryPermission(RegistryPermissionAccess, String) constructor.

RegistryPermission readPerm1;
Console.WriteLine("Creating RegistryPermission with AllAccess rights for 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0'");
readPerm1 = new RegistryPermission(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
Dim readPerm1 As RegistryPermission
Console.WriteLine("Creating RegistryPermission with AllAccess rights for 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
readPerm1 = New RegistryPermission(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")

注解

此构造函数只允许指定其中一个 RegistryPermissionAccess 值。This constructor allows only one of the RegistryPermissionAccess values to be specified. 此访问权限适用于所有列出的注册表变量。This access applies to all listed registry variables. 用于 AddPathList 定义更复杂的权限。Use AddPathList to define more complicated permissions.

适用于

产品 Introduced

RegistryPermission(RegistryPermissionAccess, AccessControlActions, String)

使用对指定注册表变量的指定访问权限和对注册表控制信息的指定访问权限,初始化 RegistryPermission 类的新实例。Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables and the specified access rights to registry control information.

public:
 RegistryPermission(System::Security::Permissions::RegistryPermissionAccess access, System::Security::AccessControl::AccessControlActions control, System::String ^ pathList);
public RegistryPermission (System.Security.Permissions.RegistryPermissionAccess access, System.Security.AccessControl.AccessControlActions control, string pathList);
new System.Security.Permissions.RegistryPermission : System.Security.Permissions.RegistryPermissionAccess * System.Security.AccessControl.AccessControlActions * string -> System.Security.Permissions.RegistryPermission
Public Sub New (access As RegistryPermissionAccess, control As AccessControlActions, pathList As String)

参数

control
AccessControlActions

AccessControlActions 值的按位组合。A bitwise combination of the AccessControlActions values.

pathList
String

向其授予了访问权限的注册表变量的列表(以分号分隔)。A list of registry variables (semicolon-separated) to which access is granted.

例外

access 参数不是 RegistryPermissionAccess 的有效值。The access parameter is not a valid value of RegistryPermissionAccess.

- 或 --or- pathList 参数不是有效的字符串。The pathList parameter is not a valid string.

注解

此构造函数只允许指定其中一个 RegistryPermissionAccess 值。This constructor allows only one of the RegistryPermissionAccess values to be specified. 此访问权限适用于所有列出的注册表变量。This access applies to all listed registry variables. 用于 AddPathList 定义更复杂的权限。Use AddPathList to define more complicated permissions.

control参数指定是否 pathList 可以更改、查看或不能访问为指定的注册表项 (ACL) 的访问控制列表。The control parameter specifies whether the access control list (ACL) for the registry keys specified by pathList can be changed, viewed, or cannot be accessed.

重要

(ACL) 的访问控制列表描述对指定注册表项执行特定操作的权限或无权执行的个人或组。An access control list (ACL) describes individuals or groups who have, or do not have, rights to specific actions on the specified registry keys. 更改或查看 ACL 的功能是一个重要的权限,应小心授予。The ability to change or view an ACL is an important permission and should be granted with caution.

适用于

产品 Introduced