[ Team LiB ] Previous Section Next Section

RegistryPermissionserializable

System.Security.Permissions (mscorlib.dll)sealed class
public sealed class RegistryPermission : System.Security.CodeAccessPermission : IUnrestrictedPermission, 
   IBuiltInPermission {
// Public Constructors
   public RegistryPermission(PermissionState state);
   public RegistryPermission(RegistryPermissionAccess access, string pathList);
// Public Instance Methods
   public void AddPathList(RegistryPermissionAccess access, string pathList);
   public override IPermission Copy(  );        
// overrides CodeAccessPermission
   public override void FromXml(System.Security.SecurityElement esd);
 // overrides CodeAccessPermission
   public string GetPathList(RegistryPermissionAccess access);
   public override IPermission Intersect(System.Security.IPermission target);
 // overrides CodeAccessPermission
   public override bool IsSubsetOf(System.Security.IPermission target);
 // overrides CodeAccessPermission
   public bool IsUnrestricted(  );     
// implements IUnrestrictedPermission
   public void SetPathList(RegistryPermissionAccess access, string pathList);
   public override SecurityElement ToXml(  );   
// overrides CodeAccessPermission
   public override IPermission Union(System.Security.IPermission other);
 // overrides CodeAccessPermission
}

The RegistryPermission class represents the ability of code to access and manipulate the contents of the Windows registry. More specifically, RegistryPermission controls access to secured members of the Microsoft.Win32.RegistryKey class. RegistryPermission maintains separate lists of registry key names to which different levels of access have been granted, and therefore a single RegistryPermission object can represent different types of access to an arbitrary number of registry keys.

To create a RegistryPermission object, pass a System.String containing a semicolon-separated list of registry key names, along with a value from the RegistryPermissionAccess enumeration to the RegistryPermission constructor. The RegistryPermissionAccess enumeration contains values that represent the type of access granted to a registry key, such as permission to read, write, or create.

To create a RegistryPermission object that represents a more complex permission set, use the AddPathList( ) and SetPathList( ) methods. Both methods take a System.String containing a semicolon-separated list of registry key names and a value from the RegistryPermissionAccess enumeration, which specifies the level of access to assign to the specified registry keys. The AddPathList( ) method adds the newly specified key names to the list of already configured keys. The SetPathList( ) method replaces its existing list of keys with the newly specified set.

The GetPathList( ) method returns a System.String containing a semicolon-separated list of registry keys to which access of the specified level is granted. The RegistryPermissionAccess.AllAccess and RegistryPermissionAccess.NoAccess values are invalid in calls to GetPathList( ), and will cause a System.ArgumentException to be thrown.

Hierarchy

System.Object System.Security.CodeAccessPermission(System.Security.IPermission, System.Security.ISecurityEncodable, System.Security.IStackWalk) RegistryPermission(IUnrestrictedPermission, IBuiltInPermission)

    [ Team LiB ] Previous Section Next Section