# module Puppet::Util::Windows::Registry

### Constants

KEY32
KEY64

  msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx

KEY_ALL_ACCESS
KEY_READ
KEY_WRITE

### Public Instance Methods

open(name, path, mode = KEY_READ | KEY64) { |subkey| ... } click to toggle source

    # File lib/puppet/util/windows/registry.rb, line 19
    def open(name, path, mode = KEY_READ | KEY64, &block)
      hkey = root(name)
      begin
        hkey.open(path, mode) do |subkey|
          return yield subkey
        end
      rescue Win32::Registry::Error => error
        raise Puppet::Util::Windows::Error.new("Failed to open registry key '#{hkey.keyname}\\#{path}'", error.code)
      end
    end

root(name) click to toggle source

    # File lib/puppet/util/windows/registry.rb, line 13
    def root(name)
      Win32::Registry.const_get(name)
    rescue NameError
      raise Puppet::Error, "Invalid registry key '#{name}'"
    end

values(subkey) click to toggle source

    # File lib/puppet/util/windows/registry.rb, line 30
    def values(subkey)
      values = {}
      subkey.each_value { |name, type, data| values[name] = data }
      values
    end