0

I'm busy creating a program that will read parts of the registry to find out what USB devices have been connected to a windows system etc... I've managed to create a piece of software what will display the values, however each person's registry will hold different information.

I've tried looking everywhere to find help/guidence with code to be able to scan a registry folder and display the subfolders within it. I know there is plenty of code for reading ordinary file locations however none will work with attempting to read the registry.

The folder location I am trying to read is:

"\"HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\

I've managed to create a program which will read the values from the above location however I have to manualy specify each subfolder into the code.

I hope i've explained what i need, sorry if it's confusing

Thanks in advance

khr055
  • 28,690
  • 16
  • 36
  • 48
  • possible duplicate of [read/write to Windows Registry using Java](http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java) – Greg Hewgill Feb 22 '12 at 21:56

1 Answers1

0

I've used jRegistryKey.dll jRegistryKey.jar Here you go ftp://ftp.heanet.ie/mirrors/sourceforge/j/project/jr/jregistrykey/manual/original/jreg_key.pdf

e.g. code:

import ca.beq.util.win32.registry.RegistryKey;
import ca.beq.util.win32.registry.RegistryValue;
import ca.beq.util.win32.registry.RootKey;

enumeration from example ---

RegistryKey r = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Software");
if(r.hasSubkeys()) {
   Iterator i = r.subkeys();
   while(i.hasNext()) {
      RegistryKey x = (RegistryKey)i.next();
      System.out.println(x.toString());
   } // while
} // if

         RegistryKey r = new RegistryKey(RootKey.HKEY_LOCAL_MACHINE, "Software\\app\\update\\Date");
          if (r.hasValue("LastSuccessfulUpdate")) {
            RegistryValue v = r.getValue("LastSuccessfulUpdate");
            updateDate = v.getStringValue();
            Date now = new Date(Long.parseLong(updateDate.trim() + "000"));

................ }

Sergey Benner
  • 4,421
  • 2
  • 22
  • 29