Type:
Class

Win32 Registry

win32/registry is registry accessor library for Win32 platform. It uses dl/import to call Win32 Registry APIs.

example

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| ... }        # Enumerate values
  reg.each_key { |key, wtime| ... }                # Enumerate subkeys

  reg.delete_value(name)                         # Delete a value
  reg.delete_key(name)                           # Delete a subkey
  reg.delete_key(name, true)                     # Delete a subkey recursively
end

Reference

Win32::Registry class

Win32 Registry

win32/registry is registry accessor library for Win32 platform. It uses fiddle/import to call Win32 Registry APIs.

example

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| ... }        # Enumerate values
  reg.each_key { |key, wtime| ... }                # Enumerate subkeys

  reg.delete_value(name)                         # Delete a value
  reg.delete_key(name)                           # Delete a subkey
  reg.delete_key(name, true)                     # Delete a subkey recursively
end

Reference

Win32::Registry class

create 2

create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED, &blk) Instance Public methods

2015-06-12 11:53:25
delete_value

delete_value(name) Instance Public methods Delete a registry value named name

2015-06-12 12:13:07
close

close() Instance Public methods Close key. After

2015-06-12 11:51:48
read_s

read_s(name) Instance Public methods Read a REG_SZ(read_s), REG_DWORD(read_i)

2015-06-12 13:14:20
flush

flush() Instance Public methods Write all the attributes into the registry file

2015-06-12 12:32:51
keys

keys() Instance Public methods return keys as an array

2015-06-12 12:46:01
[]

[](name, *rtype) Instance Public methods Read a registry value named name and

2015-06-12 11:41:11
name

name() Instance Public methods Full path of key such as 'HKEY_CURRENT_USERSOFTWAREfoobar'

2015-06-12 12:49:02
write_bin

write_bin(name, value) Instance Public methods Write value to a registry value

2015-06-12 13:25:58
write

write(name, type, data) Instance Public methods Write data to a registry value

2015-06-12 13:21:08