registry

package
v0.0.0-...-b01ffa0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package registry processes .reg files and generates WiX registry components.

Index

Constants

View Source
const DefaultSDDL = "O:BAG:SYD:(A;CIOI;GA;;;SY)(A;CIOI;GA;;;BU)(A;CIOI;GA;;;AU)(A;CIOI;GA;;;LA)(A;CIOI;GA;;;LS)"

DefaultSDDL is the default security descriptor for registry keys. Grants generic access to System, Built-in Users, Authenticated Users, Local Admin, and Local Service.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	ID        string
	GUID      string
	Permanent bool
	Preserve  bool
	Condition string
	SDDL      string
	Keys      []*RegistryKey
}

Component represents a WiX registry component.

type Processor

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

Processor handles registry file parsing and WiX generation.

func NewProcessor

func NewProcessor(workDir string, upgradeCode string) *Processor

NewProcessor creates a new registry processor. The upgradeCode is used to make component GUIDs product-unique, preventing shared component conflicts between different products.

func (*Processor) BuildAllPreservedIDs

func (p *Processor) BuildAllPreservedIDs(components []*Component) []map[string]int

BuildAllPreservedIDs pre-builds preservation ID maps for all components. Returns a slice parallel to the components slice, where each entry is either nil (non-preserved) or a map of "keyPath+valueName" -> preserve ID. This must be called before GenerateXML and GeneratePreservationXML to ensure both methods use the same IDs.

func (*Processor) GeneratePreservationXML

func (p *Processor) GeneratePreservationXML(components []*Component, allPreservedIDs []map[string]int) string

GeneratePreservationXML generates Property+RegistrySearch elements for preserved registry values. These elements must appear at Package level (before components) so that existing registry values are read before the install writes new ones. If a value already exists, it's preserved; otherwise the default from the .reg file is used.

func (*Processor) GenerateXML

func (p *Processor) GenerateXML(components []*Component, setPermissions bool) string

GenerateXML generates WiX XML for the components.

func (*Processor) GenerateXMLWithPreservedIDs

func (p *Processor) GenerateXMLWithPreservedIDs(components []*Component, setPermissions bool, allPreservedIDs []map[string]int) string

GenerateXMLWithPreservedIDs generates WiX XML for the components, using pre-built preserved IDs.

func (*Processor) Process

func (p *Processor) Process(reg ir.Registry) ([]*Component, error)

Process parses a registry item and returns WiX components.

type RegistryKey

type RegistryKey struct {
	Root       string // HKLM, HKCU, etc.
	Key        string // Path without root
	Values     []*RegistryValue
	SubKeys    []*RegistryKey
	RemoveFlag bool
}

RegistryKey represents a WiX RegistryKey element.

type RegistryValue

type RegistryValue struct {
	ID         string
	Name       string   // Empty for default value
	Type       string   // string, integer, binary, expandable, multiString
	Value      string   // For simple types
	MultiValue []string // For multiString type
	RemoveFlag bool
}

RegistryValue represents a WiX RegistryValue element.

type RemovalEntry

type RemovalEntry struct {
	IsKey bool   // true for key removal, false for value removal
	Root  string // HKLM, HKCU, etc.
	Key   string // Registry key path
	Name  string // Value name (empty for key removal or default value)
}

RemovalEntry represents a registry key or value to be removed.

Jump to

Keyboard shortcuts

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