registry

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package registry provides an interface to abstract the Windows registry libraries away. This allows providing more functionalities to registry libraries and also provide a better means of testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key interface {
	// Name returns the name of the key.
	Name() string

	// Close closes the key.
	Close() error

	// ClassName returns the name of the class for the key.
	ClassName() ([]byte, error)

	// Subkeys returns the opened subkeys of the key.
	Subkeys() ([]Key, error)

	// SubkeyNames returns the names of the subkeys of the key.
	SubkeyNames() ([]string, error)

	// Values returns the different values of the key.
	Values() ([]Value, error)
}

Key represents a specific registry key.

type OfflineKey

type OfflineKey struct {
	// contains filtered or unexported fields
}

OfflineKey wraps a regparser.CM_KEY_NODE to provide an implementation of the registry.Key interface.

func (*OfflineKey) ClassName

func (o *OfflineKey) ClassName() ([]byte, error)

ClassName returns the class name of the key.

func (*OfflineKey) Close added in v0.1.5

func (o *OfflineKey) Close() error

Close closes the key. For offline keys, this is a no-op.

func (*OfflineKey) Name

func (o *OfflineKey) Name() string

Name returns the name of the key.

func (*OfflineKey) SubkeyNames added in v0.1.5

func (o *OfflineKey) SubkeyNames() ([]string, error)

SubkeyNames returns the names of the subkeys of the key.

func (*OfflineKey) Subkeys

func (o *OfflineKey) Subkeys() ([]Key, error)

Subkeys returns the subkeys of the key.

func (*OfflineKey) Values

func (o *OfflineKey) Values() ([]Value, error)

Values returns the different values contained in the key.

type OfflineRegistry

type OfflineRegistry struct {
	// contains filtered or unexported fields
}

OfflineRegistry wraps the regparser library to provide offline (from file) parsing of the Windows registry.

func NewFromFile

func NewFromFile(path string) (*OfflineRegistry, error)

NewFromFile creates a new offline registry abstraction from a file.

func (*OfflineRegistry) Close

func (o *OfflineRegistry) Close() error

Close closes the underlying reader.

func (*OfflineRegistry) OpenKey

func (o *OfflineRegistry) OpenKey(path string) (Key, error)

OpenKey open the requested registry key.

type OfflineValue

type OfflineValue struct {
	// contains filtered or unexported fields
}

OfflineValue wraps a regparser.CM_KEY_VALUE to provide an implementation of the registry.Value interface.

func (*OfflineValue) Data

func (o *OfflineValue) Data() ([]byte, error)

Data returns the data contained in the value.

func (*OfflineValue) Name

func (o *OfflineValue) Name() string

Name returns the name of the value.

type Registry

type Registry interface {
	// OpenKey returns a Key for the given path.
	OpenKey(path string) (Key, error)

	// Close closes the registry hive.
	Close() error
}

Registry represents an open registry hive.

type Value

type Value interface {
	// Name returns the name of the value.
	Name() string

	// Data returns the data of the value.
	Data() ([]byte, error)
}

Value represents a value inside a specific key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL