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_ROOTthe old handle to the HKEY_CLASSES_ROOT registry root nodestatic int_HKEY_CURRENT_USERthe old handle to the HEKY_CURRENT_USER registry root nodestatic int_HKEY_LOCAL_MACHINEthe old handle to the HKEY_LOCAL_MACHINE registry root nodestatic intBINARY_KEYIf the registry entry is a binary key - usegetKeyType(Key key, String valueName)/to get the typestatic intDELETESecurity Mask need by openKey - just for deletestatic intDWORD_KEYIf the registry entry is a dword key - usegetKeyType(Key key, String valueName)/to get the typestatic intERROR_ACCESS_DENIEDstatic intERROR_CODEstatic intERROR_FILE_NOT_FOUNDstatic intERROR_SUCCESSstatic intEXPAND_KEYIf the registry entry is a expand string key - usegetKeyType(Key key, String valueName)/to get the typestatic KeyHKEY_CLASSES_ROOTthe NEW handle to the HKEY_CLASSES_ROOT registry root nodestatic KeyHKEY_CURRENT_USERthe NEW handle to the HEKY_CURRENT_USER registry root nodestatic KeyHKEY_LOCAL_MACHINEthe NEW handle to the HKEY_LOCAL_MACHINE registry root nodestatic intKEY_ALL_ACCESSSecurity Mask need by openKey - highest access to do everything (default access by openkey without security mask)static intKEY_CREATE_SUB_KEYSecurity Mask need by openKey - for creating sub keysstatic intKEY_ENUMERATE_SUB_KEYSSecurity Mask need by openKey - for enum sub keysstatic intKEY_QUERY_VALUESecurity Mask need by openKey - just for querying valuesstatic intKEY_READSecurity Mask need by openKey - for key readingstatic intKEY_SET_VALUESecurity Mask need by openKey - just for setting valuesstatic intKEY_WRITESecurity Mask need by openKey - for writing keysstatic intMAX_KEY_LENGTHstatic intMAX_VALUE_NAME_LENGTHstatic intMULTI_KEYIf the registry entry is a multi string key - usegetKeyType(Key key, String valueName)/to get the typestatic intNATIVE_HANDLEstatic intPLAIN_KEYIf the registry entry is a normal string key (plain key) - usegetKeyType(Key key, String valueName)/to get the typestatic longserialVersionUIDversion handle to difference between version - introduced with version 4.5 = 450static intSUBKEYS_NUMBERstatic intVALUES_NUMBERstatic intWAIT_FOR_FILETime (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 ofvoidcacheKeys(Key key)Method caches a complete key + 1 subkeyvoidcacheKeys(Key key, int maximumChildren)Method caches a complete key tree (so the key + subchildren)intcloseKey(Key key)Close an obtained key for right usagestatic java.lang.StringconvertStringToHexComma(java.lang.String plain, boolean appendNullSigns)Method converts a plain String into a hex comma separated String with 0´s betweenKeycreateKey(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)voiddeleteCaches()Method deletes all caching valuesintdeleteEntry(Key key, java.lang.String valueName)Method deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)intdelKey(Key key, java.lang.String subkey)deletes a key/subkey from the registryintdelValue(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 usegetChildInformationmethodbyte[]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 methodintflushKey(Key key)Flush method - dont know what the method exactly does just implemented because i found it in the java sun sourcejava.util.ListgetCachingKeys()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)intgetKeyType(Key key, java.lang.String valueName)Method returns the type of the key + valuenamebooleanisCachingActive()Returns if the caching for dword, expand, multi and binary is enabled (you have to use cacheKeys method)java.util.ListlistKeys(Key key)Returns all subkeys from the given keyjava.util.ListlistKeys(Key key, java.lang.String subkey)Returns all subkeys from the given key and subkeyjava.util.ListlistValueNames(Key key)Returns every valueName (not only the String value names)java.util.ListlistValueNames(Key key, java.lang.String subkey)Returns every valueName (not only the String value names)KeyopenKey(Key key, java.lang.String subkey)Opens a registry keyKeyopenKey(Key key, java.lang.String subkey, int security_mask)Opens a registry keystatic java.lang.StringparseHexString(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.StringparseValue(byte[] buf)Method removes the trailing \0 which is returned from the java.dll (just if the last sign is a \0)java.lang.StringreadAnyValueString(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.StringreadBinary(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.StringreadDword(Key key, java.lang.String valueName)Method reads the dword entry from the registryjava.lang.StringreadExpand(Key key, java.lang.String valueName)Method reads an expand string entryjava.lang.StringreadMulti(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.StringreadValueAsString(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!!!)voidrefreshCaches()Method refreshes the cached entriesvoidsaveBinary(Key key, java.lang.String valueName, java.lang.String hexCommaData)Deprecated.usesavePlainBinaryinstead of this methodvoidsaveDword(Key key, java.lang.String valueName, java.lang.String hexData)Method saves a dword entry in the registryvoidsaveExpand(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)Deprecated.usesavePlainExpandinstead ofvoidsaveMulti(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)Deprecated.usesavePlainMultiinstead ofvoidsavePlainBinary(Key key, java.lang.String valueName, java.lang.String plainData)Method saves a binary entry for the given key, valuename and datavoidsavePlainExpand(Key key, java.lang.String valueName, java.lang.String plainData)Method saves an expand string entryvoidsavePlainMulti(Key key, java.lang.String valueName, java.lang.String plainData)Method saves a multi string entry in the registryintsaveValue(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!!!)voidsetCaching(boolean aValue)Enables the caching method for dword, expand, multi and binary for the cacheKeys method and then for reading itintsetValue(Key key, java.lang.String valueName, java.lang.String value)Deprecated.usesaveValueinstead 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 RegistryErrorExceptionConstructor 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
@Deprecated public void saveBinary(Key key, java.lang.String valueName, java.lang.String hexCommaData) throws RegistryErrorException
Deprecated.usesavePlainBinaryinstead 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
@Deprecated public void saveMulti(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData) throws RegistryErrorException
Deprecated.usesavePlainMultiinstead 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
@Deprecated public void saveExpand(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData) throws RegistryErrorException
Deprecated.usesavePlainExpandinstead 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
@Deprecated public byte[] _enumValueName(int key, int valueNameIndex, int maxValueNameLength) throws RegistryErrorExceptionDeprecated.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
@Deprecated public java.util.List _listValueNames(int key, java.lang.String subkey) throws RegistryErrorExceptionDeprecated.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
@Deprecated public java.util.List _listValueNames(int key) throws RegistryErrorExceptionDeprecated.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 usegetChildInformationmethod- 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
@Deprecated public byte[] _enumKeys(int key, int subkeyIndex, int maxKeyNameLength) throws RegistryErrorExceptionDeprecated.usebyte[] enumKeys(Key key, int subkexindex, int maxKeyNameLength)instead ofReading the subkey name out of the registry (to obtain the count and the maxKeyNameLength usegetChildInformationmethod- 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
@Deprecated public java.util.List _listKeys(int key, java.lang.String subkey) throws RegistryErrorExceptionDeprecated.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
@Deprecated public java.util.List _listKeys(int key) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int[] _getChildInformation(int key) throws RegistryErrorExceptionDeprecated.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
@Deprecated 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
@Deprecated public int _delValue(int key, java.lang.String valueName) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int setValue(Key key, java.lang.String valueName, java.lang.String value) throws RegistryErrorException
Deprecated.usesaveValueinstead 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
@Deprecated public int _setValue(int key, java.lang.String valueName, java.lang.String value) throws RegistryErrorExceptionDeprecated.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
@Deprecated public byte[] _readValue(int key, java.lang.String valueName) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int _flushKey(int key) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int _delKey(int key, java.lang.String subkey) throws RegistryErrorExceptionDeprecated.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, otherwise it will be null
- Throws:
RegistryErrorException
-
_createKey
@Deprecated public int _createKey(int key, java.lang.String subkey) throws RegistryErrorExceptionDeprecated.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, otherwise 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
@Deprecated public int _closeKey(int key) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int _openKey(int key, java.lang.String subkey, int security_mask) throws RegistryErrorExceptionDeprecated.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
@Deprecated public int _openKey(int key, java.lang.String subkey) throws RegistryErrorExceptionDeprecated.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 RegistryErrorExceptionMethod refreshes the cached entries- Throws:
RegistryErrorException
-
deleteCaches
public void deleteCaches()
Method deletes all caching values
-
-