Closed GoogleCodeExporter closed 9 years ago
Well as it works for most other users, could you make an reproduceable
test/example?
And what is KKLM?
Original comment by bEha...@gmail.com
on 16 Jun 2014 at 1:33
Hello excuse me I made a mistake. I'am talking about HKLM (HKEY_LOCAL_MACHINE).
When I try to read/write a key/value in HKLM, Regor returns to me the value
"null".
The openKey function returns always null when I try to open a subkey in HKLM.
So it works pretty well in HKEY_CURRENT_USER.
Original comment by jonathan...@gmail.com
on 16 Jun 2014 at 2:35
Found the "bug", but i would call it a problem ;-)
It is due security reasons.. So if your program would run as Adminstrator, it
should work, but the workaround is to open the reg-key only in read mode!!
Example:
System.out.println(System.getProperty("java.version") + "_" + System.getProperty("java.vm.version") + "_" + System.getProperty("java.vm.vendor"));
Regor reg = new Regor();
Key key = reg.openKey(Regor.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Windows", Regor.KEY_READ);
System.out.println("KEY ITSELF: >> " + key);
System.out.println("VALUE: >> " + reg.readExpand(key, "SystemDirectory"));
reg.closeKey(key);
You see, i use the openKey method with 3 parameters, where the 3rd parameter is
the mode in which the reg-key-handle will be opened. So use: Regor.KEY_READ!
If you just use the method without 3rd parameter, it will use
Regor.KEY_ALL_ACCESS which will not work and therefore you get "null" as
returned key.
And if you want to modify the registry, you have to be in Admin-Mode (if I have
time this summer, I will add these feature in the WinRegistry - so you can run
it as admin - hopefully it will work in a library, because I use that method in
some other java-GUI-programs).
Plase report back, if this is what you needed!
Original comment by bEha...@gmail.com
on 16 Jun 2014 at 2:46
Ok, so weird.
I have supposed that the problem came from admin rights and I tested with the
3rd parameter KEY_READ and it didn't work.
Maybe I was making something wrong because It works now.
Thank you for your reply.
Original comment by jonathan...@gmail.com
on 16 Jun 2014 at 2:59
Well, at least it works for you now ;-)
Original comment by bEha...@gmail.com
on 16 Jun 2014 at 3:46
Original issue reported on code.google.com by
jonathan...@gmail.com
on 10 Jun 2014 at 8:36