Access denied when trying to write to win32 registry

I am to this:

Win32::Registry::HKEY_CURRENT_USER.open('Software\Microsoft\SomeSoftware') do | reg |
  reg.write_s('SomeKeyName', 'my new value')
end

But it gives me an error saying that access is denied. I can successfully read the key. Using regedit, I can change the value of the key. Is there some flag I need to set when I open the entry?

I can't seem to find docs in rdoc.

~S

I had that problem before, took me a long time to find out, try this:

Win32::Registry::HKEY_CURRENT_USER.open('Software\Microsoft\SomeSoftware', Win32::Registry::KEY_WRITE) do | reg |
     reg.write_s('SomeKeyName', 'my new value')
end

Robo

Shea Martin wrote:

···

I am to this:

Win32::Registry::HKEY_CURRENT_USER.open('Software\Microsoft\SomeSoftware') do | reg |
    reg.write_s('SomeKeyName', 'my new value')
end

But it gives me an error saying that access is denied. I can successfully read the key. Using regedit, I can change the value of the key. Is there some flag I need to set when I open the entry?

I can't seem to find docs in rdoc.

~S

Robo wrote:

I had that problem before, took me a long time to find out, try this:

Win32::Registry::HKEY_CURRENT_USER.open('Software\Microsoft\SomeSoftware', Win32::Registry::KEY_WRITE) do | reg |
    reg.write_s('SomeKeyName', 'my new value')
end

Robo

That was it. Thanks.
~S