Redigera

Dela via


RegistryPermission Constructors

Definition

Initializes a new instance of the RegistryPermission class.

Overloads

RegistryPermission(PermissionState)

Initializes a new instance of the RegistryPermission class with either fully restricted or unrestricted permission as specified.

RegistryPermission(RegistryPermissionAccess, String)

Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables.

RegistryPermission(RegistryPermissionAccess, AccessControlActions, String)

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)

Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs

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)

Parameters

state
PermissionState

One of the PermissionState values.

Exceptions

The state parameter is not a valid value of PermissionState.

Examples

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)

Remarks

Creates either fully restricted (None) or Unrestricted access to registry variables.

Applies to

RegistryPermission(RegistryPermissionAccess, String)

Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs

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)

Parameters

pathList
String

A list of registry variables (semicolon-separated) to which access is granted.

Exceptions

The access parameter is not a valid value of RegistryPermissionAccess.

-or-

The pathList parameter is not a valid string.

Examples

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")

Remarks

This constructor allows only one of the RegistryPermissionAccess values to be specified. This access applies to all listed registry variables. Use AddPathList to define more complicated permissions.

Applies to

RegistryPermission(RegistryPermissionAccess, AccessControlActions, String)

Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs
Source:
RegistryPermission.cs

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)

Parameters

control
AccessControlActions

A bitwise combination of the AccessControlActions values.

pathList
String

A list of registry variables (semicolon-separated) to which access is granted.

Exceptions

The access parameter is not a valid value of RegistryPermissionAccess.

-or-

The pathList parameter is not a valid string.

Remarks

This constructor allows only one of the RegistryPermissionAccess values to be specified. This access applies to all listed registry variables. Use AddPathList to define more complicated permissions.

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.

Important

An access control list (ACL) describes individuals or groups who have, or do not have, rights to specific actions on the specified registry keys. The ability to change or view an ACL is an important permission and should be granted with caution.

Applies to