XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.x
    • Component/s: Format
    • Labels:
      None

      Description

      This is a RFE to implement a configuration backed by the windows registry.

      It can be implemented using an external library such as the ICE JNI Registry :
      http://www.trustice.com/java/jnireg

      It could also be implemented by hacking around the private WindowsPreferences class from the JDK (with no guarantee it will work on later versions, on other VMs, or on environments with a SecurityManager). Here is an example using this approach and displaying the user's data directory :

      Preferences winPrefs = Preferences.userRoot();
      Class cls = winPrefs.getClass();
      
      Method openKey = cls.getDeclaredMethod("openKey", byte[].class, int.class, int.class);
      openKey.setAccessible(true);
      Method closeKey = cls.getDeclaredMethod("closeKey", int.class);
      closeKey.setAccessible(true);
      Method winRegQueryValue = cls.getDeclaredMethod("WindowsRegQueryValueEx", int.class, byte[].class);
      winRegQueryValue.setAccessible(true);
      Method winRegEnumValue = cls.getDeclaredMethod("WindowsRegEnumValue1", int.class, int.class, int.class);
      winRegEnumValue.setAccessible(true);
      Method winRegQueryInfo = cls.getDeclaredMethod("WindowsRegQueryInfoKey1", int.class);
      winRegQueryInfo.setAccessible(true);
      
      Integer keyHandle = (Integer) openKey.invoke(winPrefs, toByteArray("Volatile Environment"), KEY_READ, KEY_READ);
      
      byte[] array = (byte[]) winRegQueryValue.invoke(winPrefs, keyHandle, toByteArray("APPDATA"));
      closeKey.invoke(winPrefs, keyHandle);
      
      System.out.println(new String(array));
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ebourg Emmanuel Bourg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: