registry.rb problem?

P

Phil Tomson

I just found out about registry.rb in the Win32 distribution of Ruby (it's
for accessing the Windows registry).

However, when I tried the sample script:



require 'win32/registry.rb'

Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|

value = reg['foo'] # read a value

value = reg['foo', Win32::Registry::REG_SZ] # read a value with
type

type, value = reg.read('foo') # read a value

#reg['foo'] = 'bar' # write a value

#reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value
with type

#reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value



reg.each_value { |name, type, data|

puts "name is: #{name}, type is: #{type}, data is: #{data}"

} # Enumerate values


end



I got:

c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in `initialize':
uninitializ

ed constant Win32::Registry::Error::Errno (NameError)

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in
`initialize'



from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
`exception'

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
`raise'

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:395:in
`check'

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:417:in
`OpenKey'

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:525:in
`open'

from c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:605:in
`open'

from registry.rb:2





Any ideas?

Phil
 
D

daz

Phil said:
I just found out about registry.rb in the Win32 distribution of Ruby (it's
for accessing the Windows registry).


I got:

c:/programs/ruby/lib/ruby/1.8/win32/registry.rb:340:in `initialize':
uninitialized constant Win32::Registry::Error::Errno (NameError)

<snips>


Any ideas?

Phil


There were slight changes in Rev 1.2, yours is Rev 1.1

---------------------------
? Quick fix:

Replace line 333:
class Error < ::SystemCallError
with:
class Error < ::StandardError

---------------------------

Or d/l from CVSweb
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/Win32API/lib/win32/registry.rb

# Next to "Revision 1.2", right-click on (download) and "Save target as ..."
(depending on your browser)


I think Usa is the [author/]maintainer (U.Nakamura <[email protected]>)



daz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top