Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname, access) do |reg|
reg['Password'] = '7a,2f,07,fd,36,74,7c,52'
end
-------------------
The key has a BINARY value that is already set to another value. When I
run the .rb file from an administrative command prompt it seems to run
with no errors, but the value never changes.
Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname, access) do |reg|
reg['Password'] = '7a,2f,07,fd,36,74,7c,52'
end
-------------------
The key has a BINARY value that is already set to another value. When I
run the .rb file from an administrative command prompt it seems to run
with no errors, but the value never changes.
If this is a 64 bit OS, you're probably accessing the 32 bit registry by default under the wow32 node. Take a look in there, find some specific registry keys that are there and not in the 64 bit and you should be able to verify.
Jams
···
On Jun 1, 2012, at 10:11 AM, Jason Burgett <lists@ruby-forum.com> wrote:
Ok, this is weird. If I use
-----------------
require 'win32/registry'
Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\7-Zip') do |reg|
value = reg['Path'] # read a value
puts value
end
--------------------
I get "C:\Program Files\7-Zip\" returned to the console which is
correct. However, if I try other keys to test, for example:
---------------------
require 'win32/registry'
Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\RegisteredApplications')
do |reg|
value = reg['Paint'] # read a value
puts value
end
---------------------
I get:
"C:/Ruby193/lib/ruby/1.9.1/win32/registry.rb:385:in `open': The system
cannot find the file specified. (Win32::Registry::Error)"
The permissions appear to be set the same on both keys too.