RegistryPermission.AddPathList Méthode

Définition

Ajoute, pour les variables du Registre spécifiées, l’accès à l’état existant de l’autorisation.

Surcharges

AddPathList(RegistryPermissionAccess, String)

Ajoute, pour les variables du Registre spécifiées, l’accès à l’état existant de l’autorisation.

AddPathList(RegistryPermissionAccess, AccessControlActions, String)

Ajoute, pour les variables du Registre spécifiées, l’accès à l’état existant de l’autorisation, en spécifiant les actions d’accès aux autorisations du Registre et de contrôle d’accès.

Remarques

Utilisez cette méthode pour modifier l’accès aux variables de Registre en ajoutant le jeu de leurs chemins à l’état de l’objet d’autorisation actuel.

AddPathList(RegistryPermissionAccess, String)

Ajoute, pour les variables du Registre spécifiées, l’accès à l’état existant de l’autorisation.

public:
 void AddPathList(System::Security::Permissions::RegistryPermissionAccess access, System::String ^ pathList);
public void AddPathList (System.Security.Permissions.RegistryPermissionAccess access, string pathList);
member this.AddPathList : System.Security.Permissions.RegistryPermissionAccess * string -> unit
Public Sub AddPathList (access As RegistryPermissionAccess, pathList As String)

Paramètres

access
RegistryPermissionAccess

Une des valeurs de l'objet RegistryPermissionAccess.

pathList
String

Liste de variables du Registre (séparées par des points-virgules).

Exceptions

Le paramètre access n’est pas une valeur valide de RegistryPermissionAccess.

  • ou - Le paramètre pathList n’est pas une chaîne valide.

Exemples

L’exemple de code suivant montre l’utilisation de la AddPathList(RegistryPermissionAccess, String) méthode.

// AddPathList adds access for the specified registry variables to the existing state of the permission.
// SetPathList sets new access for the specified registry variable names to the existing state of the permission.
// GetPathList gets paths for all registry variables with the specified RegistryPermissionAccess.
private static bool SetGetPathListDemo()
{
    try
    {
        Console.WriteLine("********************************************************\n");
        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");
        Console.WriteLine("Adding 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION' to the write access list, "
            + "and \n 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0' "
            + "to the read access list.");
        readPerm1.AddPathList(RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION");
        readPerm1.AddPathList(RegistryPermissionAccess.Read,
            "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0");
        Console.WriteLine("Read access list before SetPathList = " +
            readPerm1.GetPathList(RegistryPermissionAccess.Read));
        Console.WriteLine("Setting read access rights to \n'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0'");
        readPerm1.SetPathList(RegistryPermissionAccess.Read,
            "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
        Console.WriteLine("Read access list after SetPathList = \n" +
            readPerm1.GetPathList(RegistryPermissionAccess.Read));
        Console.WriteLine("Write access = \n" +
            readPerm1.GetPathList(RegistryPermissionAccess.Write));
        Console.WriteLine("Write access Registry variables = \n" +
            readPerm1.GetPathList(RegistryPermissionAccess.AllAccess));
    }
    catch (ArgumentException e)
    {
        // RegistryPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
        Console.WriteLine("An ArgumentException occurred as a result of using AllAccess. "
            + "AllAccess cannot be used as a parameter in GetPathList because it represents more than one "
            + "type of registry variable access : \n" + e);
    }

    return true;
}
' AddPathList adds access for the specified registry variables to the existing state of the permission.
' SetPathList sets new access for the specified registry variable names to the existing state of the permission.
' GetPathList gets paths for all registry variables with the specified RegistryPermissionAccess.
Private Shared Function SetGetPathListDemo() As Boolean
    Try
        Console.WriteLine("********************************************************" + vbLf)
        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")
        Console.WriteLine("Adding 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION' to the write access list, " + "and " + vbLf + " 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0' " + "to the read access list.")
        readPerm1.AddPathList(RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION")
        readPerm1.AddPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
        Console.WriteLine("Read access list before SetPathList = " + readPerm1.GetPathList(RegistryPermissionAccess.Read))
        Console.WriteLine("Setting read access rights to " + vbLf + "'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
        readPerm1.SetPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
        Console.WriteLine("Read access list after SetPathList = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read))
        Console.WriteLine("Write access = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Write))
        Console.WriteLine("Write access Registry variables = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.AllAccess))
    Catch e As ArgumentException
        ' RegistryPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
        Console.WriteLine("An ArgumentException occurred as a result of using AllAccess. " + _
        "AllAccess cannot be used as a parameter in GetPathList because it represents more than one " + _
        "type of registry variable access : " + vbLf + e.Message)
    End Try

    Return True

End Function 'SetGetPathListDemo

Remarques

Utilisez cette méthode pour modifier l’accès aux variables de Registre en ajoutant à l’état de l’objet d’autorisation actuel.

S’applique à

AddPathList(RegistryPermissionAccess, AccessControlActions, String)

Ajoute, pour les variables du Registre spécifiées, l’accès à l’état existant de l’autorisation, en spécifiant les actions d’accès aux autorisations du Registre et de contrôle d’accès.

public:
 void AddPathList(System::Security::Permissions::RegistryPermissionAccess access, System::Security::AccessControl::AccessControlActions actions, System::String ^ pathList);
public:
 void AddPathList(System::Security::Permissions::RegistryPermissionAccess access, System::Security::AccessControl::AccessControlActions control, System::String ^ pathList);
public void AddPathList (System.Security.Permissions.RegistryPermissionAccess access, System.Security.AccessControl.AccessControlActions actions, string pathList);
public void AddPathList (System.Security.Permissions.RegistryPermissionAccess access, System.Security.AccessControl.AccessControlActions control, string pathList);
member this.AddPathList : System.Security.Permissions.RegistryPermissionAccess * System.Security.AccessControl.AccessControlActions * string -> unit
member this.AddPathList : System.Security.Permissions.RegistryPermissionAccess * System.Security.AccessControl.AccessControlActions * string -> unit
Public Sub AddPathList (access As RegistryPermissionAccess, actions As AccessControlActions, pathList As String)
Public Sub AddPathList (access As RegistryPermissionAccess, control As AccessControlActions, pathList As String)

Paramètres

access
RegistryPermissionAccess

Une des valeurs de l'objet RegistryPermissionAccess.

actionscontrol
AccessControlActions

Une des valeurs de l'objet AccessControlActions.

pathList
String

Liste des variables du Registre (séparées par des points-virgules).

Exceptions

Le paramètre access n’est pas une valeur valide de RegistryPermissionAccess.

  • ou - Le paramètre pathList n’est pas une chaîne valide.

Remarques

Utilisez cette méthode pour modifier l’accès aux variables de Registre en ajoutant le jeu de leurs chemins à l’état de l’objet d’autorisation actuel. Cette surcharge vous permet de spécifier l’action de contrôle d’accès comme l’accès aux autorisations de Registre.

Le control paramètre spécifie si la liste de contrôle d’accès (ACL) pour les clés de Registre spécifiées par pathList peut être modifiée, consultée ou inaccessible.

Important

Une liste de contrôle d’accès (ACL) décrit des personnes ou des groupes qui ont, ou n’ont pas, des droits sur des actions spécifiques sur les clés de Registre spécifiées. La possibilité de modifier ou d’afficher une liste de contrôle d’accès est une autorisation importante et doit être accordée avec précaution.

S’applique à