Microsoft SDK for Java

RegistryRequest Class

The RegistryRequest Class of the com.ms.security.permissions package represents a request for access to a registry key.

public class RegistryRequest implements ISecurityRequest
{
  // 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 RegistryRequest(int access, String value);

  // Methods
  public PermissionID getPermissionID();
  public String toString();
}

It should be used as the security request object for a parameterized security check involving registry permissions. The RegistryPermission.check method expects a RegistryRequest object as its parameter.

Example

The following example shows how to use a RegistryRequest object to perform a security check to see if a specific registry key can be accessed:

// Create a ReqistryRequest object that indicates that you want
// to read the registry key "HKLM\Software\stuff".

RegistryRequest sreq = 
   new RegistryRequest(RegistryRequest.READ,"HKLM\Software\stuff");

// Check to see that all of your callers have the rights to
// read that registry key.

PolicyEngine.checkPermission(sreq);
...

For more information about checking registry permissions, see the com.ms.security.PolicyEngine class and the RegistryPermission class.

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