End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Win32::Registry.open
open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) { |obj| ... }
ext/win32/lib/win32/registry.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/ext/win32/lib/win32/registry.rb, line 429
def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
subkey = subkey.chomp('\\')
newkey = API.OpenKey(hkey.hkey, subkey, opt, desired)
obj = new(newkey, hkey, subkey, REG_OPENED_EXISTING_KEY)
if block_given?
begin
yield obj
ensure
obj.close
end
else
obj
end
end
— Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
— Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) { |reg| … }
Open the registry key subkey under key. key is Win32::Registry object of parent key. You can use predefined key HKEY_* (see Constants) desired and opt is access mask and key option. For detail, see the MSDN. If block is given, the key is closed automatically.