Microsoft SDK for Java

RegistryPermission Class

The RegistryPermission Class of the com.ms.security.permissions package represents a permission that controls the ability to access the registry. The StandardSecurityManager checks for this permission type when performing the checkRegistry operation.

public class RegistryPermission implements IPermission,
            IEncodablePermission
{
  // Fields
  public static final int CREATE;
  public static final int DELETE;
  public static final int OPEN;
  public static final int READ;
  public static final int WRITE;

  // Constructors
  public RegistryPermission();

  // Methods
  public void check(Object param);
  public IPermission combine(IPermission source2);
  public int compareSet(Object target);
  public IPermission copy();
  public boolean decode(String tag, InputStream data);
  public boolean encode(String tag, OutputStream out);
  public void excludeRule(int access, String pattern);
  public WildcardExpression getExcludedRules(int accessType);
  public WildcardExpression getIncludedRules(int accessType);
  public void includeRule(int access, String pattern);
  public String mapFormat(String format);
  public void reset();
  public String[] supportedFormats();
  public String toString();
}

The registry permission distinguishes between five different types of access to registry keys or values, shown in the following list:

OPEN

Keys can be opened (does not apply to values).

READ

Information about a key or value can be read.

WRITE

A key or value can be modified.

DELETE

A key or value can be deleted.

CREATE

A key or value can be created.

The specific key or value allowed for each operation is defined by a pair of include/exclude patterns. Keys are specified by a trailing backslash (\). Absolute registry paths must start with a root key specifier, which is one of the following strings:

"HKCR"

HKEY_CLASSES_ROOT

"HKLM"

HKEY_LOCAL_MACHINE

"HKCU"

HKEY_CURRENT_USER

"HKUR"

HKEY_USERS

For example, "HKCU\\dog\\" specifies a key named "dog" under HKEY_CURRENT_USER. But "HKCU\\dog\\Fido" specifies the value named "Fido" within the key HKEY_CURRENT_USER\dog.

Note   In source code, you must type two backslashes to represent the single backslash necessary for specifying a key.

See Also

com.ms.security.permissions.RegistryRequest

© 1999 Microsoft Corporation. All rights reserved. Terms of use.