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

info
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

info() Instance Public methods Returns key information as Array of: :num_keys

2025-01-10 15:47:30
class
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry/Win32::Registry::PredefinedKey

class() Instance Public methods Fake

2025-01-10 15:47:30
EnumValue
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry/Win32::Registry::API

EnumValue(hkey, index) Instance Public methods

2025-01-10 15:47:30
_dump
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

_dump(depth) Instance Public methods marshalling is not allowed

2025-01-10 15:47:30
write_s
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

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

2025-01-10 15:47:30
inspect
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

inspect() Instance Public methods

2025-01-10 15:47:30
read_s_expand
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

read_s_expand(name) Instance Public methods Read a REG_SZ or REG_EXPAND_SZ registry

2025-01-10 15:47:30
open 2
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry

open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED, &blk) Instance Public methods

2025-01-10 15:47:30
CloseKey
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry/Win32::Registry::API

CloseKey(hkey) Instance Public methods

2025-01-10 15:47:30
close
  • References/Ruby on Rails/Ruby/Classes/Win32/Win32::Registry/Win32::Registry::PredefinedKey

close() Instance Public methods Predefined keys cannot be closed

2025-01-10 15:47:30