org.jinterop.winreg
Interface IJIWinReg

All Known Implementing Classes:
JIWinRegStub

public interface IJIWinReg

Perform C-R-U-D on the Windows Registry.

This interface uses "Windows Remote Registry" and "Server" services and these must be running on target workstation.

Since:
1.0

Nested Class Summary
static class IJIWinReg.closeKey
           
static class IJIWinReg.createKey
           
static class IJIWinReg.deleteValueOrKey
           
static class IJIWinReg.enumKey
           
static class IJIWinReg.enumValue
           
static class IJIWinReg.openHKCR
           
static class IJIWinReg.openHKCU
           
static class IJIWinReg.openHKLM
           
static class IJIWinReg.openHKU
           
static class IJIWinReg.openKey
           
static class IJIWinReg.queryValue
           
static class IJIWinReg.saveFile
           
static class IJIWinReg.setValue
           
 
Field Summary
static int KEY_ALL_ACCESS
           
static int KEY_CREATE_LINK
           
static int KEY_CREATE_SUB_KEY
           
static int KEY_ENUMERATE_SUB_KEYS
           
static int KEY_EXECUTE
           
static int KEY_NOTIFY
           
static int KEY_QUERY_VALUE
           
static int KEY_READ
           
static int KEY_SET_VALUE
           
static int KEY_WRITE
           
static int REG_BINARY
          Type specifying Binary
static int REG_DWORD
          Type specifying DWORD
static int REG_EXPAND_SZ
          Type specifying environment string
static int REG_MULTI_SZ
          Type specifying mutliple strings (array)
static int REG_NONE
          Type specifying empty type
static int REG_OPTION_NON_VOLATILE
           
static int REG_OPTION_VOLATILE
           
static int REG_SZ
          Type specifying String
 
Method Summary
 void closeConnection()
          Closes this connection, but a word of caution, it does not close any OPEN Key.
 void winreg_CloseKey(JIPolicyHandle handle)
          Closes the key.
 JIPolicyHandle winreg_CreateKey(JIPolicyHandle handle, java.lang.String subKey, int options, int accessMask)
          Creates a new key by name subKey under the handle.
 void winreg_DeleteKeyOrValue(JIPolicyHandle handle, java.lang.String valueName, boolean isKey)
          Deletes a key or value specified by valueName.
 java.lang.String[] winreg_EnumKey(JIPolicyHandle handle, int index)
          Returns name and class (in that order) for the key identified by index under parent handle.
 java.lang.Object[] winreg_EnumValue(JIPolicyHandle handle, int index)
          Returns name and type (in that order) for the value identified by index under parent handle.
 JIPolicyHandle winreg_OpenHKCR()
          Opens the HKEY_CLASSES_ROOT key
 JIPolicyHandle winreg_OpenHKCU()
          Opens the HKEY_CURRENT_USER key
 JIPolicyHandle winreg_OpenHKLM()
          Opens the HKEY_LOCAL_MACHINE key
 JIPolicyHandle winreg_OpenHKU()
          Opens the HKEY_USERS key
 JIPolicyHandle winreg_OpenKey(JIPolicyHandle handle, java.lang.String key, int accessMask)
          Opens the subkey of key specified by handle.
 byte[] winreg_QueryValue(JIPolicyHandle handle, int bufferSize)
          Query the key for it's name.
 java.lang.Object[] winreg_QueryValue(JIPolicyHandle handle, java.lang.String valueName, int bufferSize)
          Query the key-value for it's value.Please put buffer size more than the estimated expected value.
 void winreg_SaveFile(JIPolicyHandle handle, java.lang.String fileName)
          Saves registry entries from handle location to local fileName.
 void winreg_SetValue(JIPolicyHandle handle, java.lang.String valueName)
          Sets an empty name-value for a REG_NONE type.
 void winreg_SetValue(JIPolicyHandle handle, java.lang.String valueName, byte[][] data)
          Sets name-value for a REG_MULTI_SZ type.
 void winreg_SetValue(JIPolicyHandle handle, java.lang.String valueName, byte[] data, boolean binary, boolean expand_sz)
          Sets name-value for a REG_SZ\REG_EXPAND_SZ\REG_BINARY type.
 void winreg_SetValue(JIPolicyHandle handle, java.lang.String valueName, int data)
          Sets name-value for a REG_DWORD type.
 

Field Detail

KEY_ALL_ACCESS

static final int KEY_ALL_ACCESS
See Also:
Constant Field Values

KEY_CREATE_LINK

static final int KEY_CREATE_LINK
See Also:
Constant Field Values

KEY_CREATE_SUB_KEY

static final int KEY_CREATE_SUB_KEY
See Also:
Constant Field Values

KEY_ENUMERATE_SUB_KEYS

static final int KEY_ENUMERATE_SUB_KEYS
See Also:
Constant Field Values

KEY_EXECUTE

static final int KEY_EXECUTE
See Also:
Constant Field Values

KEY_NOTIFY

static final int KEY_NOTIFY
See Also:
Constant Field Values

KEY_QUERY_VALUE

static final int KEY_QUERY_VALUE
See Also:
Constant Field Values

KEY_READ

static final int KEY_READ
See Also:
Constant Field Values

KEY_SET_VALUE

static final int KEY_SET_VALUE
See Also:
Constant Field Values

KEY_WRITE

static final int KEY_WRITE
See Also:
Constant Field Values

REG_SZ

static final int REG_SZ
Type specifying String

See Also:
Constant Field Values

REG_BINARY

static final int REG_BINARY
Type specifying Binary

See Also:
Constant Field Values

REG_DWORD

static final int REG_DWORD
Type specifying DWORD

See Also:
Constant Field Values

REG_EXPAND_SZ

static final int REG_EXPAND_SZ
Type specifying environment string

See Also:
Constant Field Values

REG_MULTI_SZ

static final int REG_MULTI_SZ
Type specifying mutliple strings (array)

See Also:
Constant Field Values

REG_NONE

static final int REG_NONE
Type specifying empty type

See Also:
Constant Field Values

REG_OPTION_NON_VOLATILE

static final int REG_OPTION_NON_VOLATILE
See Also:
Constant Field Values

REG_OPTION_VOLATILE

static final int REG_OPTION_VOLATILE
See Also:
Constant Field Values
Method Detail

winreg_OpenHKCR

JIPolicyHandle winreg_OpenHKCR()
                               throws JIException
Opens the HKEY_CLASSES_ROOT key

Returns:
handle representing the opened key
Throws:
JIException

winreg_OpenHKCU

JIPolicyHandle winreg_OpenHKCU()
                               throws JIException
Opens the HKEY_CURRENT_USER key

Returns:
handle representing the opened key
Throws:
JIException

winreg_OpenHKU

JIPolicyHandle winreg_OpenHKU()
                              throws JIException
Opens the HKEY_USERS key

Returns:
handle representing the opened key
Throws:
JIException

winreg_OpenHKLM

JIPolicyHandle winreg_OpenHKLM()
                               throws JIException
Opens the HKEY_LOCAL_MACHINE key

Returns:
handle representing the opened key
Throws:
JIException

winreg_OpenKey

JIPolicyHandle winreg_OpenKey(JIPolicyHandle handle,
                              java.lang.String key,
                              int accessMask)
                              throws JIException
Opens the subkey of key specified by handle.

Parameters:
handle -
key -
accessMask - type of access required.
Returns:
Throws:
JIException

winreg_CloseKey

void winreg_CloseKey(JIPolicyHandle handle)
                     throws JIException
Closes the key.

Parameters:
handle -
Throws:
JIException

winreg_QueryValue

byte[] winreg_QueryValue(JIPolicyHandle handle,
                         int bufferSize)
                         throws JIException
Query the key for it's name. Please put buffer size more than the estimated expected value. In this case 1024 would do.

Parameters:
handle -
bufferSize -
Returns:
Throws:
JIException

winreg_QueryValue

java.lang.Object[] winreg_QueryValue(JIPolicyHandle handle,
                                     java.lang.String valueName,
                                     int bufferSize)
                                     throws JIException
Query the key-value for it's value.Please put buffer size more than the estimated expected value.

Parameters:
handle -
bufferSize -
valueName -
Returns:
first param contains the class type as an Integer, second param contains the value as a 1 dimensional byte array,if any. In case of REG_MULTI_SZ you will get a 2 dimensional byte array as the second param.
Throws:
JIException

winreg_CreateKey

JIPolicyHandle winreg_CreateKey(JIPolicyHandle handle,
                                java.lang.String subKey,
                                int options,
                                int accessMask)
                                throws JIException
Creates a new key by name subKey under the handle. If REG_OPTION_NON_VOLATILE option is used then the key is preserved in the registry when the machine shutsdown, otherwise it is stored only in memory.

Parameters:
handle -
subKey -
options -
accessMask -
Returns:
Throws:
JIException

winreg_SetValue

void winreg_SetValue(JIPolicyHandle handle,
                     java.lang.String valueName,
                     byte[][] data)
                     throws JIException
Sets name-value for a REG_MULTI_SZ type. data is a 2 dimensional array, each primary dimension representing one string. Please make sure that the encoding is correct while doing String.getBytes(...).

Parameters:
handle -
valueName -
data -
Throws:
JIException

winreg_SetValue

void winreg_SetValue(JIPolicyHandle handle,
                     java.lang.String valueName)
                     throws JIException
Sets an empty name-value for a REG_NONE type.

Parameters:
handle -
valueName -
Throws:
JIException

winreg_SetValue

void winreg_SetValue(JIPolicyHandle handle,
                     java.lang.String valueName,
                     byte[] data,
                     boolean binary,
                     boolean expand_sz)
                     throws JIException
Sets name-value for a REG_SZ\REG_EXPAND_SZ\REG_BINARY type. The data will be considered as String if the binary flag is not set to true. In case of non binary data, please make sure that the encoding is correct while doing String.getBytes(...). Set expand_sz to true if the String contains environment variables. When both binary and expand_sz are set , binary will take precedence.

Parameters:
handle -
valueName -
data -
binary -
expand_sz -
Throws:
JIException

winreg_SetValue

void winreg_SetValue(JIPolicyHandle handle,
                     java.lang.String valueName,
                     int data)
                     throws JIException
Sets name-value for a REG_DWORD type.

Parameters:
handle -
valueName -
data -
Throws:
JIException

winreg_DeleteKeyOrValue

void winreg_DeleteKeyOrValue(JIPolicyHandle handle,
                             java.lang.String valueName,
                             boolean isKey)
                             throws JIException
Deletes a key or value specified by valueName.

Parameters:
handle -
valueName -
isKey -
Throws:
JIException

winreg_SaveFile

void winreg_SaveFile(JIPolicyHandle handle,
                     java.lang.String fileName)
                     throws JIException
Saves registry entries from handle location to local fileName. This path is local to the target machine.

Parameters:
handle -
fileName -
Throws:
JIException

winreg_EnumKey

java.lang.String[] winreg_EnumKey(JIPolicyHandle handle,
                                  int index)
                                  throws JIException
Returns name and class (in that order) for the key identified by index under parent handle.

Parameters:
handle -
index -
Returns:
Throws:
JIException

winreg_EnumValue

java.lang.Object[] winreg_EnumValue(JIPolicyHandle handle,
                                    int index)
                                    throws JIException
Returns name and type (in that order) for the value identified by index under parent handle.

Parameters:
handle -
index -
Returns:
First is a String (valueName) and second param is an Integer (type)
Throws:
JIException

closeConnection

void closeConnection()
                     throws JIException
Closes this connection, but a word of caution, it does not close any OPEN Key. Just releases the NP resources it is holding.

Throws:
JIException