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
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/util/windows/registry.rb
puppet-3.2.0.rc1 lib/puppet/util/windows/registry.rb
puppet-3.1.1 lib/puppet/util/windows/registry.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/util/windows/registry.rb
puppet-3.1.0 lib/puppet/util/windows/registry.rb
puppet-3.1.0.rc2 lib/puppet/util/windows/registry.rb
puppet-3.1.0.rc1 lib/puppet/util/windows/registry.rb
puppet-3.0.2 lib/puppet/util/windows/registry.rb
puppet-3.0.2.rc3 lib/puppet/util/windows/registry.rb
puppet-3.0.2.rc2 lib/puppet/util/windows/registry.rb
puppet-3.0.2.rc1 lib/puppet/util/windows/registry.rb
puppet-3.0.1 lib/puppet/util/windows/registry.rb
puppet-3.0.1.rc1 lib/puppet/util/windows/registry.rb
puppet-3.0.0 lib/puppet/util/windows/registry.rb
puppet-3.0.0.rc8 lib/puppet/util/windows/registry.rb
puppet-3.0.0.rc7 lib/puppet/util/windows/registry.rb
puppet-3.0.0.rc5 lib/puppet/util/windows/registry.rb
puppet-3.0.0.rc4 lib/puppet/util/windows/registry.rb