class method
Win32::Registry.open
open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) { |reg| ... }
ext/win32/lib/win32/registry.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/win32/lib/win32/registry.rb, line 438
def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
subkey = subkey.chomp('\\')
newkey = API.OpenKey(hkey.instance_variable_get(:@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
Open the registry key subkey under key. key is Win32::Registry object of parent key. You can use predefined key HKEY_*. desired and opt is access mask and key option.
For detail, see the MSDN.
If block is given, the key reg is yielded and closed automatically after the block exists.