Package com.microstrategy.utils.proxy
Class WinRegistryFullOperation
- java.lang.Object
-
- com.microstrategy.utils.proxy.WinRegistryFullOperation
-
public final class WinRegistryFullOperation extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
_HKEY_CLASSES_ROOT
the old handle to the HKEY_CLASSES_ROOT registry root nodestatic int
_HKEY_CURRENT_USER
the old handle to the HEKY_CURRENT_USER registry root nodestatic int
_HKEY_LOCAL_MACHINE
the old handle to the HKEY_LOCAL_MACHINE registry root nodestatic int
BINARY_KEY
If the registry entry is a binary key - usegetKeyType(Key key, String valueName)/
to get the type
static int
DELETE
Security Mask need by openKey - just for deletestatic int
DWORD_KEY
If the registry entry is a dword key - usegetKeyType(Key key, String valueName)/
to get the type
static int
ERROR_ACCESS_DENIED
static int
ERROR_CODE
static int
ERROR_FILE_NOT_FOUND
static int
ERROR_SUCCESS
static int
EXPAND_KEY
If the registry entry is a expand string key - usegetKeyType(Key key, String valueName)/
to get the type
static Key
HKEY_CLASSES_ROOT
the NEW handle to the HKEY_CLASSES_ROOT registry root nodestatic Key
HKEY_CURRENT_USER
the NEW handle to the HEKY_CURRENT_USER registry root nodestatic Key
HKEY_LOCAL_MACHINE
the NEW handle to the HKEY_LOCAL_MACHINE registry root nodestatic int
KEY_ALL_ACCESS
Security Mask need by openKey - highest access to do everything (default access by openkey without security mask)static int
KEY_CREATE_SUB_KEY
Security Mask need by openKey - for creating sub keysstatic int
KEY_ENUMERATE_SUB_KEYS
Security Mask need by openKey - for enum sub keysstatic int
KEY_QUERY_VALUE
Security Mask need by openKey - just for querying valuesstatic int
KEY_READ
Security Mask need by openKey - for key readingstatic int
KEY_SET_VALUE
Security Mask need by openKey - just for setting valuesstatic int
KEY_WRITE
Security Mask need by openKey - for writing keysstatic int
MAX_KEY_LENGTH
static int
MAX_VALUE_NAME_LENGTH
static int
MULTI_KEY
If the registry entry is a multi string key - usegetKeyType(Key key, String valueName)/
to get the type
static int
NATIVE_HANDLE
static int
PLAIN_KEY
If the registry entry is a normal string key (plain key) - usegetKeyType(Key key, String valueName)/
to get the type
static long
serialVersionUID
version handle to difference between version - introduced with version 4.5 = 450static int
SUBKEYS_NUMBER
static int
VALUES_NUMBER
static int
WAIT_FOR_FILE
Time (milliseconds) for waiting for a file to grow (needed for caching and reading dword, binary, multi and expand values)
-
Constructor Summary
Constructors Constructor Description WinRegistryFullOperation()
Constructor to handle with windows registry
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
_closeKey(int key)
Deprecated.usecloseKey(Key key)
instead ofint
_createKey(int key, java.lang.String subkey)
Deprecated.useKey createKey(Key key, String subkey)
instead ofint
_delKey(int key, java.lang.String subkey)
Deprecated.useint delKey(Key key, String subkey)
instead ofint
_delValue(int key, java.lang.String valueName)
Deprecated.useint delValue(Key key, String valueName)
instead ofbyte[]
_enumKeys(int key, int subkeyIndex, int maxKeyNameLength)
Deprecated.usebyte[] enumKeys(Key key, int subkexindex, int maxKeyNameLength)
instead ofbyte[]
_enumValueName(int key, int valueNameIndex, int maxValueNameLength)
Deprecated.usebyte[] enumValueName(Key key, int valueNameIndex, int maxValueNameLength)
instead ofint
_flushKey(int key)
Deprecated.useint flushKey(Key key)
instead ofint[]
_getChildInformation(int key)
Deprecated.useint[] getChildInformation(Key key)
instead ofjava.util.List
_listKeys(int key)
Deprecated.useList listKeys(Key key)
instead ofjava.util.List
_listKeys(int key, java.lang.String subkey)
Deprecated.useList listKeys(Key key, String subkey)
instead ofjava.util.List
_listValueNames(int key)
Deprecated.useList listValueNames(Key key)
instead ofjava.util.List
_listValueNames(int key, java.lang.String subkey)
Deprecated.useList listValueNames(Key key, String subkey)
instead ofint
_openKey(int key, java.lang.String subkey)
Deprecated.useopenKey(Key key, String subkey)
instead ofint
_openKey(int key, java.lang.String subkey, int security_mask)
Deprecated.useopenKey(Key key, String subkey, int security_mask)
instead ofbyte[]
_readValue(int key, java.lang.String valueName)
Deprecated.usebyte[] readValue(Key key, String valueName)
instead ofint
_setValue(int key, java.lang.String valueName, java.lang.String value)
Deprecated.useint setValue(Key key, String valueName, String value)
instead ofvoid
cacheKeys(Key key)
Method caches a complete key + 1 subkeyvoid
cacheKeys(Key key, int maximumChildren)
Method caches a complete key tree (so the key + subchildren)int
closeKey(Key key)
Close an obtained key for right usagestatic java.lang.String
convertStringToHexComma(java.lang.String plain, boolean appendNullSigns)
Method converts a plain String into a hex comma separated String with 0´s betweenKey
createKey(Key key, java.lang.String subkey)
Create new key/subkey in the registry with the specified name Attentition: if the key is successfully returned, you should close and open the key again, because the obtained key doesnt have a high access level (so maybe creating or deleting a key/value wouldn´t be successful)void
deleteCaches()
Method deletes all caching valuesint
deleteEntry(Key key, java.lang.String valueName)
Method deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)int
delKey(Key key, java.lang.String subkey)
deletes a key/subkey from the registryint
delValue(Key key, java.lang.String valueName)
Deprecated.useint deleteEntry(Key key, String valueName)
instead ofbyte[]
enumKeys(Key key, int subkeyIndex, int maxKeyNameLength)
Reading the subkey name out of the registry (to obtain the count and the maxKeyNameLength usegetChildInformation
methodbyte[]
enumValueName(Key key, int valueNameIndex, int maxValueNameLength)
Reading every valueName (not only the string value) out of the registry handle (for maximum value index and maxValueNameLength use the getChildInformation methodint
flushKey(Key key)
Flush method - dont know what the method exactly does just implemented because i found it in the java sun sourcejava.util.List
getCachingKeys()
Method returns all cached Keysint[]
getChildInformation(Key key)
Reads information about the current opened key (use it when you want to enumKey or enumValueName to determine the maximum key length and the count of keys)int
getKeyType(Key key, java.lang.String valueName)
Method returns the type of the key + valuenameboolean
isCachingActive()
Returns if the caching for dword, expand, multi and binary is enabled (you have to use cacheKeys method)java.util.List
listKeys(Key key)
Returns all subkeys from the given keyjava.util.List
listKeys(Key key, java.lang.String subkey)
Returns all subkeys from the given key and subkeyjava.util.List
listValueNames(Key key)
Returns every valueName (not only the String value names)java.util.List
listValueNames(Key key, java.lang.String subkey)
Returns every valueName (not only the String value names)Key
openKey(Key key, java.lang.String subkey)
Opens a registry keyKey
openKey(Key key, java.lang.String subkey, int security_mask)
Opens a registry keystatic java.lang.String
parseHexString(java.lang.String hexCommaString, boolean deleteNullSigns)
Method converts a hex given String (separated by comma) into a string For Multi entries, every entry ends with HEX 0 so you can split the linesstatic java.lang.String
parseValue(byte[] buf)
Method removes the trailing \0 which is returned from the java.dll (just if the last sign is a \0)java.lang.String
readAnyValueString(Key key, java.lang.String valueName)
Method reads any value and give it back as a string result - this method can be time consuming, since it determinesjava.lang.String
readBinary(Key key, java.lang.String valueName)
Method reads from the registry a BINARY value - this is made via Runtime.getRuntime().exec(regedit) and is not one of the best methods, but at least it doesnt need a dlljava.lang.String
readDword(Key key, java.lang.String valueName)
Method reads the dword entry from the registryjava.lang.String
readExpand(Key key, java.lang.String valueName)
Method reads an expand string entryjava.lang.String
readMulti(Key key, java.lang.String valueName)
Method reads a multi string entry from the registrybyte[]
readValue(Key key, java.lang.String valueName)
Reads the value of a string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!)java.lang.String
readValueAsString(Key key, java.lang.String valueName)
Reads the value of a string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!)void
refreshCaches()
Method refreshes the cached entriesvoid
saveBinary(Key key, java.lang.String valueName, java.lang.String hexCommaData)
Deprecated.usesavePlainBinary
instead of this methodvoid
saveDword(Key key, java.lang.String valueName, java.lang.String hexData)
Method saves a dword entry in the registryvoid
saveExpand(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)
Deprecated.usesavePlainExpand
instead ofvoid
saveMulti(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)
Deprecated.usesavePlainMulti
instead ofvoid
savePlainBinary(Key key, java.lang.String valueName, java.lang.String plainData)
Method saves a binary entry for the given key, valuename and datavoid
savePlainExpand(Key key, java.lang.String valueName, java.lang.String plainData)
Method saves an expand string entryvoid
savePlainMulti(Key key, java.lang.String valueName, java.lang.String plainData)
Method saves a multi string entry in the registryint
saveValue(Key key, java.lang.String valueName, java.lang.String value)
Method saves the specified string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!) Method saves or create a simple character sequence (REG_SZ) If you want to change the default Value the valueName has to be null or nothingvoid
setCaching(boolean aValue)
Enables the caching method for dword, expand, multi and binary for the cacheKeys method and then for reading itint
setValue(Key key, java.lang.String valueName, java.lang.String value)
Deprecated.usesaveValue
instead of - just changed name
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
version handle to difference between version - introduced with version 4.5 = 450- See Also:
- Constant Field Values
-
_HKEY_CLASSES_ROOT
public static final int _HKEY_CLASSES_ROOT
the old handle to the HKEY_CLASSES_ROOT registry root node- See Also:
- Constant Field Values
-
_HKEY_CURRENT_USER
public static final int _HKEY_CURRENT_USER
the old handle to the HEKY_CURRENT_USER registry root node- See Also:
- Constant Field Values
-
_HKEY_LOCAL_MACHINE
public static final int _HKEY_LOCAL_MACHINE
the old handle to the HKEY_LOCAL_MACHINE registry root node- See Also:
- Constant Field Values
-
HKEY_CLASSES_ROOT
public static final Key HKEY_CLASSES_ROOT
the NEW handle to the HKEY_CLASSES_ROOT registry root node
-
HKEY_CURRENT_USER
public static final Key HKEY_CURRENT_USER
the NEW handle to the HEKY_CURRENT_USER registry root node
-
HKEY_LOCAL_MACHINE
public static final Key HKEY_LOCAL_MACHINE
the NEW handle to the HKEY_LOCAL_MACHINE registry root node
-
ERROR_SUCCESS
public static final int ERROR_SUCCESS
- See Also:
- Constant Field Values
-
ERROR_FILE_NOT_FOUND
public static final int ERROR_FILE_NOT_FOUND
- See Also:
- Constant Field Values
-
ERROR_ACCESS_DENIED
public static final int ERROR_ACCESS_DENIED
- See Also:
- Constant Field Values
-
NATIVE_HANDLE
public static final int NATIVE_HANDLE
- See Also:
- Constant Field Values
-
ERROR_CODE
public static final int ERROR_CODE
- See Also:
- Constant Field Values
-
SUBKEYS_NUMBER
public static final int SUBKEYS_NUMBER
- See Also:
- Constant Field Values
-
VALUES_NUMBER
public static final int VALUES_NUMBER
- See Also:
- Constant Field Values
-
MAX_KEY_LENGTH
public static final int MAX_KEY_LENGTH
- See Also:
- Constant Field Values
-
MAX_VALUE_NAME_LENGTH
public static final int MAX_VALUE_NAME_LENGTH
- See Also:
- Constant Field Values
-
DELETE
public static final int DELETE
Security Mask need by openKey - just for delete- See Also:
- Constant Field Values
-
KEY_QUERY_VALUE
public static final int KEY_QUERY_VALUE
Security Mask need by openKey - just for querying values- See Also:
- Constant Field Values
-
KEY_SET_VALUE
public static final int KEY_SET_VALUE
Security Mask need by openKey - just for setting values- See Also:
- Constant Field Values
-
KEY_CREATE_SUB_KEY
public static final int KEY_CREATE_SUB_KEY
Security Mask need by openKey - for creating sub keys- See Also:
- Constant Field Values
-
KEY_ENUMERATE_SUB_KEYS
public static final int KEY_ENUMERATE_SUB_KEYS
Security Mask need by openKey - for enum sub keys- See Also:
- Constant Field Values
-
KEY_READ
public static final int KEY_READ
Security Mask need by openKey - for key reading- See Also:
- Constant Field Values
-
KEY_WRITE
public static final int KEY_WRITE
Security Mask need by openKey - for writing keys- See Also:
- Constant Field Values
-
KEY_ALL_ACCESS
public static final int KEY_ALL_ACCESS
Security Mask need by openKey - highest access to do everything (default access by openkey without security mask)- See Also:
- Constant Field Values
-
WAIT_FOR_FILE
public static int WAIT_FOR_FILE
Time (milliseconds) for waiting for a file to grow (needed for caching and reading dword, binary, multi and expand values)
-
PLAIN_KEY
public static final int PLAIN_KEY
If the registry entry is a normal string key (plain key) - usegetKeyType(Key key, String valueName)/
to get the type
- See Also:
- Constant Field Values
-
BINARY_KEY
public static final int BINARY_KEY
If the registry entry is a binary key - usegetKeyType(Key key, String valueName)/
to get the type
- See Also:
- Constant Field Values
-
DWORD_KEY
public static final int DWORD_KEY
If the registry entry is a dword key - usegetKeyType(Key key, String valueName)/
to get the type
- See Also:
- Constant Field Values
-
MULTI_KEY
public static final int MULTI_KEY
If the registry entry is a multi string key - usegetKeyType(Key key, String valueName)/
to get the type
- See Also:
- Constant Field Values
-
EXPAND_KEY
public static final int EXPAND_KEY
If the registry entry is a expand string key - usegetKeyType(Key key, String valueName)/
to get the type
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WinRegistryFullOperation
public WinRegistryFullOperation() throws RegistryErrorException
Constructor to handle with windows registry- Throws:
RegistryErrorException
- throws an registryerrorException when its not able to get a handle to the registry methodsNotSupportedOSException
- throws an notSupportedOSException if the registry is not used in windows
-
-
Method Detail
-
saveBinary
public void saveBinary(Key key, java.lang.String valueName, java.lang.String hexCommaData) throws RegistryErrorException
Deprecated.usesavePlainBinary
instead of this methodMethod saves a binary entry for the given key, valuename and data- Parameters:
key
- Key The parent key handle obtained by openKeyvalueName
- String the binary value name in the registryhexCommaData
- String the string converted in hexadecimal signs separated with commas. UseString convertStringToHexComma(String plainString, false)
to get the hex comma separated data- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008)
- See Also:
saveAnyValue
- method could have a deadlock
-
savePlainBinary
public void savePlainBinary(Key key, java.lang.String valueName, java.lang.String plainData) throws RegistryErrorException
Method saves a binary entry for the given key, valuename and data- Parameters:
key
- Key The parent key handle obtained by openKeyvalueName
- String the binary value name in the registryplainData
- String like you would see in the registry (without any spaces, etc..)- Throws:
RegistryErrorException
- Since:
- version 4 (27.03.2009)
- See Also:
extractAnyValue
- method could have a deadlock
-
readBinary
public java.lang.String readBinary(Key key, java.lang.String valueName) throws RegistryErrorException
Method reads from the registry a BINARY value - this is made via Runtime.getRuntime().exec(regedit) and is not one of the best methods, but at least it doesnt need a dll- Parameters:
key
- Key the obtained key from the registryvalueName
- String the valueName of the binary entry which you want to read- Returns:
- String null or the binary data separated by comma
- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008 - guess who has birthday ;))
- See Also:
extractAnyValue
- method could have a deadlock
-
saveDword
public void saveDword(Key key, java.lang.String valueName, java.lang.String hexData) throws RegistryErrorException
Method saves a dword entry in the registry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the valuename of the dword entryhexData
- String a hexadecimal String withouth comma or spaces (useLong.toHexString(long)
to get a hex string)- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008)
- See Also:
saveAnyValue
- method could have a deadlock
-
readDword
public java.lang.String readDword(Key key, java.lang.String valueName) throws RegistryErrorException
Method reads the dword entry from the registry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the dword value- Returns:
- String the dword entry in a hex string
- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008 - dont know who has birthday?)
- See Also:
extractAnyValue
- method could have a deadlock
-
saveMulti
public void saveMulti(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData) throws RegistryErrorException
Deprecated.usesavePlainMulti
instead ofMethod saves a multi string entry in the registry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the multi value namehexCommaZeroData
- String the data to write converted in hex string separated by a comma with trailing zeros UseString convertStringToHexComma(String plainString, true)
to get the hex comma separated data with 0 signs between- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008)
- See Also:
saveAnyValue
- method could have a deadlock
-
savePlainMulti
public void savePlainMulti(Key key, java.lang.String valueName, java.lang.String plainData) throws RegistryErrorException
Method saves a multi string entry in the registry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the multi value nameplainData
- String- Throws:
RegistryErrorException
- Since:
- version 4 (27.03.2009)
- See Also:
saveAnyValue
- method could have a deadlock
-
readMulti
public java.lang.String readMulti(Key key, java.lang.String valueName) throws RegistryErrorException
Method reads a multi string entry from the registry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the multi value name- Returns:
- String the HEXADECIMAL values separated by comma (use
String parseHexString(String)
to convert it the line seperator is also a hex null! You have to parse it out - Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008 - my dad has birthday ;))
- See Also:
extractAnyValue
- method could have a deadlock
-
saveExpand
public void saveExpand(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData) throws RegistryErrorException
Deprecated.usesavePlainExpand
instead ofMethod saves an expand string entry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the expand value namehexCommaZeroData
- String the data to write converted in hex string separated by a comma with trailing zeros UseString convertStringToHexComma(String plainString, true)
to get the hex comma separated data with 0 signs between- Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008)
- See Also:
saveAnyValue
- method could have a deadlock
-
savePlainExpand
public void savePlainExpand(Key key, java.lang.String valueName, java.lang.String plainData) throws RegistryErrorException
Method saves an expand string entry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the expand value nameplainData
- String- Throws:
RegistryErrorException
- Since:
- version 4 (27.03.2009)
- See Also:
saveAnyValue
- method could have a deadlock
-
readExpand
public java.lang.String readExpand(Key key, java.lang.String valueName) throws RegistryErrorException
Method reads an expand string entry- Parameters:
key
- Key the parent key handle obtained by openKeyvalueName
- String the expand value name- Returns:
- String the HEXADECIMAL values separated by comma (use
String parseHexString(String)
to convert it - Throws:
RegistryErrorException
- Since:
- version 3 (03.06.2008)
- See Also:
extractAnyValue
- method could have a deadlock
-
enumValueName
public byte[] enumValueName(Key key, int valueNameIndex, int maxValueNameLength) throws RegistryErrorException
Reading every valueName (not only the string value) out of the registry handle (for maximum value index and maxValueNameLength use the getChildInformation method- Parameters:
key
- the handle to the parent key obtained from openKeyvalueNameIndex
- the index of the valueName name - starting from 0 going to the maximum count from the getChildInformation stored in array index 2maxValueNameLength
- maximum length of valueName name (used because for memory allocating in the java.dll - if you obtain the size from getChildInformation increase the [4] int array by 1)- Returns:
- byte[] either the name of the valueName or null if not found or an error occurs or if the maxValueNameLength is to short
- Throws:
RegistryErrorException
-
_enumValueName
public byte[] _enumValueName(int key, int valueNameIndex, int maxValueNameLength) throws RegistryErrorException
Deprecated.usebyte[] enumValueName(Key key, int valueNameIndex, int maxValueNameLength)
instead ofReading every valueName (not only the string value) out of the registry handle (for maximum value index and maxValueNameLength use the getChildInformation method- Parameters:
key
- the handle to the parent key obtained from openKeyvalueNameIndex
- the index of the valueName name - starting from 0 going to the maximum count from the getChildInformation stored in array index 2maxValueNameLength
- maximum length of valueName name (used because for memory allocating in the java.dll - if you obtain the size from getChildInformation increase the [4] int array by 1)- Returns:
- byte[] either the name of the valueName or null if not found or an error occurs or if the maxValueNameLength is to short
- Throws:
RegistryErrorException
-
listValueNames
public java.util.List listValueNames(Key key, java.lang.String subkey) throws RegistryErrorException
Returns every valueName (not only the String value names)- Parameters:
key
- either one of the root nodes or a key obtained from openKeysubkey
- a string to a subkey - if the subkey is empty or null the information will be obtained from the given key- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
listValueNames
public java.util.List listValueNames(Key key) throws RegistryErrorException
Returns every valueName (not only the String value names)- Parameters:
key
- either one of the root nodes or a key obtained from openKey- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
_listValueNames
public java.util.List _listValueNames(int key, java.lang.String subkey) throws RegistryErrorException
Deprecated.useList listValueNames(Key key, String subkey)
instead ofReturns every valueName (not only the String value names)- Parameters:
key
- either one of the root nodes or a key obtained from openKeysubkey
- a string to a subkey - if the subkey is empty or null the information will be obtained from the given key- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
_listValueNames
public java.util.List _listValueNames(int key) throws RegistryErrorException
Deprecated.useList listValueNames(Key key)
instead ofReturns every valueName (not only the String value names)- Parameters:
key
- either one of the root nodes or a key obtained from openKey- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
enumKeys
public byte[] enumKeys(Key key, int subkeyIndex, int maxKeyNameLength) throws RegistryErrorException
Reading the subkey name out of the registry (to obtain the count and the maxKeyNameLength usegetChildInformation
method- Parameters:
key
- the handle to the key obtained by openKeysubkeyIndex
- index from the subkey from which you want to obtain the name (start with 0 - the maximum count you get from getChildInformation method in array [0])maxKeyNameLength
- the maximum length of a subkey name (used because for memory allocating in the java.dll - if you obtain the size from getChildInformation increase the [3] int array by 1 )- Returns:
- byte[] on error or not found or the maxKeyNameLength is to short it will returns null, on success the name of the subkey
- Throws:
RegistryErrorException
-
_enumKeys
public byte[] _enumKeys(int key, int subkeyIndex, int maxKeyNameLength) throws RegistryErrorException
Deprecated.usebyte[] enumKeys(Key key, int subkexindex, int maxKeyNameLength)
instead ofReading the subkey name out of the registry (to obtain the count and the maxKeyNameLength usegetChildInformation
method- Parameters:
key
- the handle to the key obtained by openKeysubkeyIndex
- index from the subkey from which you want to obtain the name (start with 0 - the maximum count you get from getChildInformation method in array [0])maxKeyNameLength
- the maximum length of a subkey name (used because for memory allocating in the java.dll - if you obtain the size from getChildInformation increase the [3] int array by 1 )- Returns:
- byte[] on error or not found or the maxKeyNameLength is to short it will returns null, on success the name of the subkey
- Throws:
RegistryErrorException
-
listKeys
public java.util.List listKeys(Key key, java.lang.String subkey) throws RegistryErrorException
Returns all subkeys from the given key and subkey- Parameters:
key
- either one of the root nodes or a key obtained from openKeysubkey
- a string to a subkey - if the subkey is empty or null the information will be obtained from the given key- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
listKeys
public java.util.List listKeys(Key key) throws RegistryErrorException
Returns all subkeys from the given key- Parameters:
key
- either one of the root nodes or a key obtained from openKey- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
_listKeys
public java.util.List _listKeys(int key, java.lang.String subkey) throws RegistryErrorException
Deprecated.useList listKeys(Key key, String subkey)
instead ofReturns all subkeys from the given key and subkey- Parameters:
key
- either one of the root nodes or a key obtained from openKeysubkey
- a string to a subkey - if the subkey is empty or null the information will be obtained from the given key- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
_listKeys
public java.util.List _listKeys(int key) throws RegistryErrorException
Deprecated.useList listKeys(Key key)
instead ofReturns all subkeys from the given key- Parameters:
key
- either one of the root nodes or a key obtained from openKey- Returns:
- List on success and found a filled list with strings will be returned - on error or nothing found null will be returned
- Throws:
RegistryErrorException
-
getChildInformation
public int[] getChildInformation(Key key) throws RegistryErrorException
Reads information about the current opened key (use it when you want to enumKey or enumValueName to determine the maximum key length and the count of keys)- Parameters:
key
- the key which you obtained from openKey- Returns:
- int[0] the count of the subkeys,[2] count of valuenames, [3] the maximum length of a subkey! the maximum length of valuename is stored in[4] (for other operations you should increase the [3] or [4] value by 1 because of the terminating \0 in C - because you handle with the java.dll) if nothing found or illegal key, the values are -1 of the array (at index 1 the value would be 6 the other -1)
- Throws:
RegistryErrorException
-
_getChildInformation
public int[] _getChildInformation(int key) throws RegistryErrorException
Deprecated.useint[] getChildInformation(Key key)
instead ofReads information about the current opened key (use it when you want to enumKey or enumValueName to determine the maximum key length and the count of keys)- Parameters:
key
- the key which you obtained from openKey- Returns:
- int[0] the count of the subkeys,[2] count of valuenames, [3] the maximum length of a subkey! the maximum length of valuename is stored in[4] (for other operations you should increase the [3] or [4] value by 1 because of the terminating \0 in C - because you handle with the java.dll) if nothing found or illegal key, the values are -1 of the array (at index 1 the value would be 6 the other -1)
- Throws:
RegistryErrorException
-
deleteEntry
public int deleteEntry(Key key, java.lang.String valueName) throws RegistryErrorException
Method deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)- Parameters:
key
- the key obtained by openKeyvalueName
- name of String value you want to delete (if the string is empty or null the default entry will be cleared)- Returns:
- int
- Throws:
RegistryErrorException
- Since:
- version 4: 14.04.2009
-
delValue
public int delValue(Key key, java.lang.String valueName) throws RegistryErrorException
Deprecated.useint deleteEntry(Key key, String valueName)
instead ofMethod deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)- Parameters:
key
- the key obtained by openKeyvalueName
- name of String value you want to delete (if the string is empty or null the default entry will be deleted)- Returns:
- int
- Throws:
RegistryErrorException
-
_delValue
public int _delValue(int key, java.lang.String valueName) throws RegistryErrorException
Deprecated.useint delValue(Key key, String valueName)
instead ofMethod deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)- Parameters:
key
- the key obtained by openKeyvalueName
- name of String value you want to delete (if the string is empty or null the default entry will be cleared)- Returns:
- int
- Throws:
RegistryErrorException
-
saveValue
public int saveValue(Key key, java.lang.String valueName, java.lang.String value) throws RegistryErrorException
Method saves the specified string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!) Method saves or create a simple character sequence (REG_SZ) If you want to change the default Value the valueName has to be null or nothing- Parameters:
key
- obtained by openKeyvalueName
- the string value name in the registry you want to setvalue
- the new value you want to set- Returns:
- on success, return is ERROR_SUCCESS if not -1 or sth else will be returned
- Throws:
RegistryErrorException
- Since:
- version 4: 14.04.2009
-
setValue
public int setValue(Key key, java.lang.String valueName, java.lang.String value) throws RegistryErrorException
Deprecated.usesaveValue
instead of - just changed nameMethod set the specified string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!) Methode setzt (oder erstellt) einen Wert auf eine Zeichenfolge Will man den defaulteintrag ändern, so muss man valueName "" übergeben- Parameters:
key
- obtained by openKeyvalueName
- the string value name in the registry you want to setvalue
- the new value you want to set- Returns:
- on success, return is ERROR_SUCCESS if not -1 or sth else will be returned
- Throws:
RegistryErrorException
-
_setValue
public int _setValue(int key, java.lang.String valueName, java.lang.String value) throws RegistryErrorException
Deprecated.useint setValue(Key key, String valueName, String value)
instead ofMethod set the specified string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!) Methode setzt (oder erstellt) einen Wert auf eine Zeichenfolge Will man den defaulteintrag ändern, so muss man valueName "" übergeben- Parameters:
key
- obtained by openKeyvalueName
- the string value name in the registry you want to setvalue
- the new value you want to set- Returns:
- on success, return is ERROR_SUCCESS if not -1 or sth else will be returned
- Throws:
RegistryErrorException
-
readValueAsString
public java.lang.String readValueAsString(Key key, java.lang.String valueName) throws RegistryErrorException
Reads the value of a string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!)- Parameters:
key
- obtained from openKeyvalueName
- the string value which you want to read (if you want to obtain the default entry the valueName should be empty or NULL)- Returns:
- byte[] if found the data in the string value will be returned (to get a string use the class method parseValue(byte[])) on error NULL will be returned
- Throws:
RegistryErrorException
-
readValue
public byte[] readValue(Key key, java.lang.String valueName) throws RegistryErrorException
Reads the value of a string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!)- Parameters:
key
- obtained from openKeyvalueName
- the string value which you want to read (if you want to obtain the default entry the valueName should be empty or NULL)- Returns:
- byte[] if found the data in the string value will be returned (to get a string use the class method parseValue(byte[])) on error NULL will be returned
- Throws:
RegistryErrorException
-
_readValue
public byte[] _readValue(int key, java.lang.String valueName) throws RegistryErrorException
Deprecated.usebyte[] readValue(Key key, String valueName)
instead ofReads the value of a string value (DO NOT USE THIS METHOD FOR READING BINARY, DWORD, MULTI OR EXPAND ENTRIES - JUST FOR SZ - STRING ENTRIES!!!)- Parameters:
key
- obtained from openKeyvalueName
- the string value which you want to read (if you want to obtain the default entry the valueName should be empty or NULL)- Returns:
- byte[] if found the data in the string value will be returned (to get a string use the class method parseValue(byte[])) on error NULL will be returned
- Throws:
RegistryErrorException
-
readAnyValueString
public java.lang.String readAnyValueString(Key key, java.lang.String valueName) throws RegistryErrorException
Method reads any value and give it back as a string result - this method can be time consuming, since it determines- Parameters:
key
- KeyvalueName
- String- Returns:
- String
- Throws:
RegistryErrorException
-
getKeyType
public int getKeyType(Key key, java.lang.String valueName) throws RegistryErrorException
Method returns the type of the key + valuename- Parameters:
key
- Key the key handlevalueName
- String when valueName is empty or null plain key will be returned, because only plain keys can have empty names- Returns:
- int 0 = invalid key or cannot determine keytype, 1 = plain, 2 = binary, 3 = dword, 4 = multi, 5 = expand key - use the definied types *_KEY
- Throws:
RegistryErrorException
-
flushKey
public int flushKey(Key key) throws RegistryErrorException
Flush method - dont know what the method exactly does just implemented because i found it in the java sun source- Parameters:
key
- obtained the key from openKey- Returns:
- on success, ERROR_SUCESS will be returned! on error -1 or sth else
- Throws:
RegistryErrorException
-
_flushKey
public int _flushKey(int key) throws RegistryErrorException
Deprecated.useint flushKey(Key key)
instead ofFlush method - dont know what the method exactly does just implemented because i found it in the java sun source- Parameters:
key
- obtained the key from openKey- Returns:
- on success, ERROR_SUCESS will be returned! on error -1 or sth else
- Throws:
RegistryErrorException
-
delKey
public int delKey(Key key, java.lang.String subkey) throws RegistryErrorException
deletes a key/subkey from the registry- Parameters:
key
- the parent key obtained by openKeysubkey
- the key name you want to delete- Returns:
- int ERROR_SUCCESS wenn erfolgreich
- Throws:
RegistryErrorException
- if subkey is empty or null or any other exception occurs
-
_delKey
public int _delKey(int key, java.lang.String subkey) throws RegistryErrorException
Deprecated.useint delKey(Key key, String subkey)
instead ofdeletes a key/subkey from the registry- Parameters:
key
- the parent key obtained by openKeysubkey
- the key name you want to delete- Returns:
- int ERROR_SUCCESS wenn erfolgreich
- Throws:
RegistryErrorException
- if subkey is empty or null or any other exception occurs
-
createKey
public Key createKey(Key key, java.lang.String subkey) throws RegistryErrorException
Create new key/subkey in the registry with the specified name Attentition: if the key is successfully returned, you should close and open the key again, because the obtained key doesnt have a high access level (so maybe creating or deleting a key/value wouldn´t be successful)- Parameters:
key
- handle to parent key obtained from openKeysubkey
- name of the key/subkey you want to create- Returns:
- on success the handle to the new key will be returned, otherwhise it will be null
- Throws:
RegistryErrorException
-
_createKey
public int _createKey(int key, java.lang.String subkey) throws RegistryErrorException
Deprecated.useKey createKey(Key key, String subkey)
instead ofCreate new key/subkey in the registry with the specified name Attentition: if the key is successfully returned, you should close and open the key again, because the obtained key doesnt have a high access level (so maybe creating or deleting a key/value wouldn´t be successful)- Parameters:
key
- handle to parent key obtained from openKeysubkey
- name of the key/subkey you want to create- Returns:
- on success the handle to the new key will be returned, otherwhise it will be -1
- Throws:
RegistryErrorException
-
closeKey
public int closeKey(Key key) throws RegistryErrorException
Close an obtained key for right usage- Parameters:
key
- the key handle- Returns:
- int on error it will be -1
- Throws:
RegistryErrorException
-
_closeKey
public int _closeKey(int key) throws RegistryErrorException
Deprecated.usecloseKey(Key key)
instead ofClose an obtained key for right usage- Parameters:
key
- the key handle- Returns:
- int on error it will be -1
- Throws:
RegistryErrorException
-
openKey
public Key openKey(Key key, java.lang.String subkey, int security_mask) throws RegistryErrorException
Opens a registry key- Parameters:
key
- one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey
- the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT if subkey name is "" or null it returns the handle to the root nodesecurity_mask
- the security mask to handle with the opened key (see security mask doc at the begin for detailed information)- Returns:
- Key on NULL (when not found or not allowed) otherwhise the handle to the obtained key (in the Key Object)
- Throws:
RegistryErrorException
-
openKey
public Key openKey(Key key, java.lang.String subkey) throws RegistryErrorException
Opens a registry key- Parameters:
key
- one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey
- the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT if subkey name is "" or null it returns the handle to the root node- Returns:
- Key null if not found or not allowed (attention here this methods allways uses the KEY_ALL_ACCESS security mask) on success the handle to key will be returned
- Throws:
RegistryErrorException
-
_openKey
public int _openKey(int key, java.lang.String subkey, int security_mask) throws RegistryErrorException
Deprecated.useopenKey(Key key, String subkey, int security_mask)
instead ofOpens a registry key- Parameters:
key
- one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey
- the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT if subkey name is "" or null it returns the handle to the root nodesecurity_mask
- the security mask to handle with the opened key (see security mask doc at the begin for detailed information)- Returns:
- int on error -1 (when not found or not allowed) otherwhise the handle to the obtained key
- Throws:
RegistryErrorException
-
_openKey
public int _openKey(int key, java.lang.String subkey) throws RegistryErrorException
Deprecated.useopenKey(Key key, String subkey)
instead ofOpens a registry key- Parameters:
key
- one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINEsubkey
- the name of the key/subkey like SOFTWARE or HARDWARE - for subkeys use the \\ as delimiter f.e. : SOFTWARE\\MICROSOFT if subkey name is "" or null it returns the handle to the root node- Returns:
- int -1 if not found or not allowed (attention here this methods allways uses the KEY_ALL_ACCESS security mask) on success the handle to key will be returned
- Throws:
RegistryErrorException
-
parseValue
public static java.lang.String parseValue(byte[] buf)
Method removes the trailing \0 which is returned from the java.dll (just if the last sign is a \0)- Parameters:
buf
- the byte[] buffer which every read method returns- Returns:
- String a parsed string without the trailing \0
-
parseHexString
public static java.lang.String parseHexString(java.lang.String hexCommaString, boolean deleteNullSigns)
Method converts a hex given String (separated by comma) into a string For Multi entries, every entry ends with HEX 0 so you can split the lines- Parameters:
hexCommaString
- StringdeleteNullSigns
- boolean if you want to remove every 0 sign (delete null signs is needed for multi and expand entries, but not for binary- Returns:
- String
-
convertStringToHexComma
public static java.lang.String convertStringToHexComma(java.lang.String plain, boolean appendNullSigns)
Method converts a plain String into a hex comma separated String with 0´s between- Parameters:
plain
- StringappendNullSigns
- boolean if you want to add null signs (needed for multi and expand entries, but not for binary entry)- Returns:
- String the converted string
-
cacheKeys
public void cacheKeys(Key key) throws RegistryErrorException
Method caches a complete key + 1 subkey- Parameters:
key
- Key the registry key which should be cached + subchildren- Throws:
RegistryErrorException
-
cacheKeys
public void cacheKeys(Key key, int maximumChildren) throws RegistryErrorException
Method caches a complete key tree (so the key + subchildren)- Parameters:
key
- Key the registry key which should be cached + subchildrenmaximumChildren
- int amount of the subchildren which should be cached (attention, this may create a java.lang.OutofMemory Error if you have not enoguth memory use -Xmx512M or sth)- Throws:
RegistryErrorException
-
setCaching
public void setCaching(boolean aValue)
Enables the caching method for dword, expand, multi and binary for the cacheKeys method and then for reading it- Parameters:
aValue
- boolean true or false
-
isCachingActive
public boolean isCachingActive()
Returns if the caching for dword, expand, multi and binary is enabled (you have to use cacheKeys method)- Returns:
- boolean true or false (default = false)
-
getCachingKeys
public java.util.List getCachingKeys()
Method returns all cached Keys- Returns:
- List a list of string of the cached key names
-
refreshCaches
public void refreshCaches() throws RegistryErrorException
Method refreshes the cached entries- Throws:
RegistryErrorException
-
deleteCaches
public void deleteCaches()
Method deletes all caching values
-
-