Class 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 node
      static int _HKEY_CURRENT_USER
      the old handle to the HEKY_CURRENT_USER registry root node
      static int _HKEY_LOCAL_MACHINE
      the old handle to the HKEY_LOCAL_MACHINE registry root node
      static int BINARY_KEY
      If the registry entry is a binary key - use getKeyType(Key key, String valueName)/ to get the type
      static int DELETE
      Security Mask need by openKey - just for delete
      static int DWORD_KEY
      If the registry entry is a dword key - use getKeyType(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 - use getKeyType(Key key, String valueName)/ to get the type
      static Key HKEY_CLASSES_ROOT
      the NEW handle to the HKEY_CLASSES_ROOT registry root node
      static Key HKEY_CURRENT_USER
      the NEW handle to the HEKY_CURRENT_USER registry root node
      static Key HKEY_LOCAL_MACHINE
      the NEW handle to the HKEY_LOCAL_MACHINE registry root node
      static 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 keys
      static int KEY_ENUMERATE_SUB_KEYS
      Security Mask need by openKey - for enum sub keys
      static int KEY_QUERY_VALUE
      Security Mask need by openKey - just for querying values
      static int KEY_READ
      Security Mask need by openKey - for key reading
      static int KEY_SET_VALUE
      Security Mask need by openKey - just for setting values
      static int KEY_WRITE
      Security Mask need by openKey - for writing keys
      static int MAX_KEY_LENGTH  
      static int MAX_VALUE_NAME_LENGTH  
      static int MULTI_KEY
      If the registry entry is a multi string key - use getKeyType(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) - use getKeyType(Key key, String valueName)/ to get the type
      static long serialVersionUID
      version handle to difference between version - introduced with version 4.5 = 450
      static 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.
      use closeKey(Key key) instead of
      int _createKey​(int key, java.lang.String subkey)
      Deprecated.
      use Key createKey(Key key, String subkey) instead of
      int _delKey​(int key, java.lang.String subkey)
      Deprecated.
      use int delKey(Key key, String subkey) instead of
      int _delValue​(int key, java.lang.String valueName)
      Deprecated.
      use int delValue(Key key, String valueName) instead of
      byte[] _enumKeys​(int key, int subkeyIndex, int maxKeyNameLength)
      Deprecated.
      use byte[] enumKeys(Key key, int subkexindex, int maxKeyNameLength) instead of
      byte[] _enumValueName​(int key, int valueNameIndex, int maxValueNameLength)
      Deprecated.
      use byte[] enumValueName(Key key, int valueNameIndex, int maxValueNameLength) instead of
      int _flushKey​(int key)
      Deprecated.
      use int flushKey(Key key) instead of
      int[] _getChildInformation​(int key)
      Deprecated.
      use int[] getChildInformation(Key key) instead of
      java.util.List _listKeys​(int key)
      Deprecated.
      use List listKeys(Key key) instead of
      java.util.List _listKeys​(int key, java.lang.String subkey)
      Deprecated.
      use List listKeys(Key key, String subkey) instead of
      java.util.List _listValueNames​(int key)
      Deprecated.
      use List listValueNames(Key key) instead of
      java.util.List _listValueNames​(int key, java.lang.String subkey)
      Deprecated.
      use List listValueNames(Key key, String subkey) instead of
      int _openKey​(int key, java.lang.String subkey)
      Deprecated.
      use openKey(Key key, String subkey) instead of
      int _openKey​(int key, java.lang.String subkey, int security_mask)
      Deprecated.
      use openKey(Key key, String subkey, int security_mask) instead of
      byte[] _readValue​(int key, java.lang.String valueName)
      Deprecated.
      use byte[] readValue(Key key, String valueName) instead of
      int _setValue​(int key, java.lang.String valueName, java.lang.String value)
      Deprecated.
      use int setValue(Key key, String valueName, String value) instead of
      void cacheKeys​(Key key)
      Method caches a complete key + 1 subkey
      void 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 usage
      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
      Key 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 values
      int 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 registry
      int delValue​(Key key, java.lang.String valueName)
      Deprecated.
      use int deleteEntry(Key key, String valueName) instead of
      byte[] enumKeys​(Key key, int subkeyIndex, int maxKeyNameLength)
      Reading the subkey name out of the registry (to obtain the count and the maxKeyNameLength use getChildInformation method
      byte[] 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 method
      int flushKey​(Key key)
      Flush method - dont know what the method exactly does just implemented because i found it in the java sun source
      java.util.List getCachingKeys()
      Method returns all cached Keys
      int[] 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 + valuename
      boolean 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 key
      java.util.List listKeys​(Key key, java.lang.String subkey)
      Returns all subkeys from the given key and subkey
      java.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 key
      Key openKey​(Key key, java.lang.String subkey, int security_mask)
      Opens a registry key
      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
      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)
      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 determines
      java.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 dll
      java.lang.String readDword​(Key key, java.lang.String valueName)
      Method reads the dword entry from the registry
      java.lang.String readExpand​(Key key, java.lang.String valueName)
      Method reads an expand string entry
      java.lang.String readMulti​(Key key, java.lang.String valueName)
      Method reads a multi string entry from the registry
      byte[] 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 entries
      void saveBinary​(Key key, java.lang.String valueName, java.lang.String hexCommaData)
      Deprecated.
      use savePlainBinary instead of this method
      void saveDword​(Key key, java.lang.String valueName, java.lang.String hexData)
      Method saves a dword entry in the registry
      void saveExpand​(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)
      Deprecated.
      use savePlainExpand instead of
      void saveMulti​(Key key, java.lang.String valueName, java.lang.String hexCommaZeroData)
      Deprecated.
      use savePlainMulti instead of
      void savePlainBinary​(Key key, java.lang.String valueName, java.lang.String plainData)
      Method saves a binary entry for the given key, valuename and data
      void savePlainExpand​(Key key, java.lang.String valueName, java.lang.String plainData)
      Method saves an expand string entry
      void savePlainMulti​(Key key, java.lang.String valueName, java.lang.String plainData)
      Method saves a multi string entry in the registry
      int 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!!!)
      void setCaching​(boolean aValue)
      Enables the caching method for dword, expand, multi and binary for the cacheKeys method and then for reading it
      int setValue​(Key key, java.lang.String valueName, java.lang.String value)
      Deprecated.
      use saveValue instead of - just changed name
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • 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) - use getKeyType(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 - use getKeyType(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 - use getKeyType(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 - use getKeyType(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 - use getKeyType(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 methods
        NotSupportedOSException - 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.
        use savePlainBinary instead of this method
        Method saves a binary entry for the given key, valuename and data
        Parameters:
        key - Key The parent key handle obtained by openKey
        valueName - String the binary value name in the registry
        hexCommaData - String the string converted in hexadecimal signs separated with commas. Use String 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 openKey
        valueName - String the binary value name in the registry
        plainData - 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 registry
        valueName - 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 openKey
        valueName - String the valuename of the dword entry
        hexData - String a hexadecimal String withouth comma or spaces (use Long.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 openKey
        valueName - 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.
        use savePlainMulti instead of
        Method saves a multi string entry in the registry
        Parameters:
        key - Key the parent key handle obtained by openKey
        valueName - String the multi value name
        hexCommaZeroData - String the data to write converted in hex string separated by a comma with trailing zeros Use String 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 openKey
        valueName - String the multi value name
        plainData - 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 openKey
        valueName - 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.
        use savePlainExpand instead of
        Method saves an expand string entry
        Parameters:
        key - Key the parent key handle obtained by openKey
        valueName - String the expand value name
        hexCommaZeroData - String the data to write converted in hex string separated by a comma with trailing zeros Use String 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 openKey
        valueName - String the expand value name
        plainData - 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 openKey
        valueName - 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 openKey
        valueNameIndex - the index of the valueName name - starting from 0 going to the maximum count from the getChildInformation stored in array index 2
        maxValueNameLength - 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 RegistryErrorException
        Deprecated.
        use byte[] enumValueName(Key key, int valueNameIndex, int maxValueNameLength) instead of
        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 openKey
        valueNameIndex - the index of the valueName name - starting from 0 going to the maximum count from the getChildInformation stored in array index 2
        maxValueNameLength - 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 openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use List listValueNames(Key key, String subkey) instead of
        Returns every valueName (not only the String value names)
        Parameters:
        key - either one of the root nodes or a key obtained from openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use List listValueNames(Key key) instead of
        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
      • 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 use getChildInformation method
        Parameters:
        key - the handle to the key obtained by openKey
        subkeyIndex - 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 RegistryErrorException
        Deprecated.
        use byte[] enumKeys(Key key, int subkexindex, int maxKeyNameLength) instead of
        Reading the subkey name out of the registry (to obtain the count and the maxKeyNameLength use getChildInformation method
        Parameters:
        key - the handle to the key obtained by openKey
        subkeyIndex - 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 openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use List listKeys(Key key, String subkey) instead of
        Returns all subkeys from the given key and subkey
        Parameters:
        key - either one of the root nodes or a key obtained from openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use List listKeys(Key key) instead of
        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
      • 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 RegistryErrorException
        Deprecated.
        use int[] getChildInformation(Key key) instead of
        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
      • 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 openKey
        valueName - 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.
        use int deleteEntry(Key key, String valueName) instead of
        Method deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)
        Parameters:
        key - the key obtained by openKey
        valueName - 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 RegistryErrorException
        Deprecated.
        use int delValue(Key key, String valueName) instead of
        Method deletes the specified value (YOU CAN ALSO DELETE BINARY, DWORD, MULTI OR EXPAND ENTRIES!!!)
        Parameters:
        key - the key obtained by openKey
        valueName - 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 openKey
        valueName - the string value name in the registry you want to set
        value - 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.
        use saveValue instead of - just changed name
        Method 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 openKey
        valueName - the string value name in the registry you want to set
        value - 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 RegistryErrorException
        Deprecated.
        use int setValue(Key key, String valueName, String value) instead of
        Method 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 openKey
        valueName - the string value name in the registry you want to set
        value - 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 openKey
        valueName - 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 openKey
        valueName - 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 RegistryErrorException
        Deprecated.
        use byte[] readValue(Key key, String valueName) instead of
        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 openKey
        valueName - 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 - Key
        valueName - 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 handle
        valueName - 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 RegistryErrorException
        Deprecated.
        use int flushKey(Key key) instead of
        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
      • 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 openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use int delKey(Key key, String subkey) instead of
        deletes a key/subkey from the registry
        Parameters:
        key - the parent key obtained by openKey
        subkey - 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 openKey
        subkey - 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 RegistryErrorException
        Deprecated.
        use Key createKey(Key key, String subkey) instead of
        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 openKey
        subkey - 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

        @Deprecated
        public int _closeKey​(int key)
                      throws RegistryErrorException
        Deprecated.
        use closeKey(Key key) instead of
        Close 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_MACHINE
        subkey - 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
        security_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_MACHINE
        subkey - 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 RegistryErrorException
        Deprecated.
        use openKey(Key key, String subkey, int security_mask) instead of
        Opens a registry key
        Parameters:
        key - one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE
        subkey - 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
        security_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 RegistryErrorException
        Deprecated.
        use openKey(Key key, String subkey) instead of
        Opens a registry key
        Parameters:
        key - one of the registry root nodes - either HKEY_CLASSES_ROOT, HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE
        subkey - 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 - String
        deleteNullSigns - 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 - String
        appendNullSigns - 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,
                              int maximumChildren)
                       throws RegistryErrorException
        Method caches a complete key tree (so the key + subchildren)
        Parameters:
        key - Key the registry key which should be cached + subchildren
        maximumChildren - 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
      • deleteCaches

        public void deleteCaches()
        Method deletes all caching values