Sha256: c4d82d6c0e1f5a0216a795a32421666bb6426588e7d4e52b4ffc3775279e0543

Contents?: true

Size: 933 Bytes

Versions: 38

Compression:

Stored size: 933 Bytes

Contents

require 'puppet/util/windows'

module Puppet::Util::Windows
  module Registry
    # http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx
    KEY64 = 0x100
    KEY32 = 0x200

    KEY_READ       = 0x20019
    KEY_WRITE      = 0x20006
    KEY_ALL_ACCESS = 0x2003f

    def root(name)
      Win32::Registry.const_get(name)
    rescue NameError
      raise Puppet::Error, "Invalid registry key '#{name}'"
    end

    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

    def values(subkey)
      values = {}
      subkey.each_value { |name, type, data| values[name] = data }
      values
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
puppet-3.4.2 lib/puppet/util/windows/registry.rb
puppet-3.4.1 lib/puppet/util/windows/registry.rb
puppet-3.4.0 lib/puppet/util/windows/registry.rb
puppet-3.4.0.rc2 lib/puppet/util/windows/registry.rb
puppet-3.4.0.rc1 lib/puppet/util/windows/registry.rb
puppet-3.3.2 lib/puppet/util/windows/registry.rb
puppet-3.3.1 lib/puppet/util/windows/registry.rb
puppet-3.3.1.rc3 lib/puppet/util/windows/registry.rb
puppet-3.3.1.rc2 lib/puppet/util/windows/registry.rb
puppet-3.3.1.rc1 lib/puppet/util/windows/registry.rb
puppet-3.3.0 lib/puppet/util/windows/registry.rb
puppet-3.3.0.rc3 lib/puppet/util/windows/registry.rb
puppet-3.3.0.rc2 lib/puppet/util/windows/registry.rb
puppet-3.2.4 lib/puppet/util/windows/registry.rb
puppet-3.2.3 lib/puppet/util/windows/registry.rb
puppet-3.2.3.rc1 lib/puppet/util/windows/registry.rb
puppet-3.2.2 lib/puppet/util/windows/registry.rb
puppet-3.2.1 lib/puppet/util/windows/registry.rb
puppet-3.2.1.rc1 lib/puppet/util/windows/registry.rb
puppet-3.2.0.rc2 lib/puppet/util/windows/registry.rb