Documentation
¶
Overview ¶
The wine package helps manage a Wineprefix and run Wine.
Index ¶
- Constants
- Variables
- func Escape(src string, quote bool, raw bool) string
- func Unescape(src string) string
- type BinaryString
- type Cmd
- type DwordBE
- type DwordLE
- type ExpandableString
- type Filetime
- type InternalBytes
- type Link
- type Prefix
- func (p *Prefix) AppDataDir() (string, error)
- func (p *Prefix) Boot(args ...string) *Cmd
- func (p *Prefix) Command(name string, arg ...string) *Cmd
- func (p *Prefix) Dir() string
- func (p *Prefix) Exists() bool
- func (p *Prefix) Init() error
- func (p *Prefix) IsProton() bool
- func (p *Prefix) Kill() error
- func (p *Prefix) LibDir() string
- func (p *Prefix) NeedsUpdate() (bool, error)
- func (p *Prefix) Prepare() error
- func (p *Prefix) Registry() (*Registry, error)
- func (p *Prefix) RegistryAdd(key string, value string, data RegistryData) error
- func (p *Prefix) RegistryDelete(key, value string) error
- func (p *Prefix) RegistryImportFile(name string) error
- func (p *Prefix) RegistryImportKey(key *RegistryKey) error
- func (p *Prefix) RegistryQuery(path string) (*RegistryKey, error)
- func (p *Prefix) Running() bool
- func (p *Prefix) Server(args ...string) error
- func (p *Prefix) Start() error
- func (p Prefix) String() string
- func (p *Prefix) Update() error
- func (p *Prefix) Version() string
- func (p *Prefix) Wine(exe string, arg ...string) *Cmd
- type Registry
- type RegistryData
- type RegistryKey
- func (k *RegistryKey) Add(path string) *RegistryKey
- func (k *RegistryKey) AddKey(a *RegistryKey) *RegistryKey
- func (k *RegistryKey) Delete(path string) bool
- func (k *RegistryKey) DeleteValue(name string) bool
- func (k *RegistryKey) Equal(b *RegistryKey) bool
- func (k *RegistryKey) Export(w io.Writer) error
- func (k *RegistryKey) GetValue(name string) *RegistryValue
- func (k *RegistryKey) Import(r io.Reader) error
- func (k *RegistryKey) Parent() *RegistryKey
- func (k *RegistryKey) Path() string
- func (k *RegistryKey) Query(path string) *RegistryKey
- func (k *RegistryKey) Root() (parent *RegistryKey)
- func (k *RegistryKey) SetValue(name string, data RegistryData) (ret *RegistryValue)
- type RegistryValue
Constants ¶
const ( ServerDebug = "--debug" ServerForeground = "--foreground" ServerKill = "--kill" ServerPersistent = "--persistent" ServerWait = "--wait" )
const ( BootEndSession = "--end-session" BootForceExit = "--force" BootInit = "--init" BootKill = "--kill" BootRestart = "--restart" BootShutdown = "--shutdown" BootUpdate = "--update" )
Variables ¶
var ErrPrefixNotAbs = errors.New("prefix directory is not an absolute path")
Functions ¶
Types ¶
type BinaryString ¶
type BinaryString []byte // hex(1): REG_SZ
hex(8,a,0) are removed, as they are exclusive to Windows and unused by Wine.
hex(3) removed as it is unnecessary and does not appear in any real world registry data.
Wine internally stores REG_EXPAND_SZ and REG_MULTI_SZ as str(2) and str(7) and exports them as their hex(2) and hex(7) pairs respectively.
type Cmd ¶
Cmd is is a struct wrapper that overrides methods to better interact with a Wineprefix.
It is not reccomended to call any of the exec.Cmd's methods related to reading output such as StderrPipe, StdoutPipe, Output, among others. This is unfortunately due to a Wine bug that doesn't allow for easy interaction of Wine's output. If a method is unimplemented, it should use Cmd's method overrides.
For further information, refer to exec.Cmd.
func (*Cmd) CombinedOutput ¶
Output runs the command and returns its standard output & error.
func (*Cmd) Output ¶
Output runs the command and returns its standard output. No error handling is performed on stderr.
type ExpandableString ¶
type ExpandableString string // hex(2): REG_EXPAND_SZ
type Filetime ¶
type Filetime int64
Filetime is a representation of Wine's FILETIME.
Routines are added and taken from golang.org/x/sys/windows package.
type InternalBytes ¶
InternalBytes represents a custom registry value type hex(i) where i is the Identifier. This is found in DEVPROP_TYPE_DEVPROPTYPE.
type Prefix ¶
type Prefix struct {
// Path to a Wine or Proton installation.
Root string
// Stdout and Stderr specify the descendant Prefix's Command
// Stdout and Stderr. This is mostly reserved for logging purposes.
// By default, they will be set to their os counterparts.
Stderr io.Writer
Stdout io.Writer
// Specifies additional environment variables for all
// descendant Prefix commands. os.Environ()
// will be appended when Env is used.
Env []string
// contains filtered or unexported fields
}
Prefix is a representation of a Wineprefix, which is where Wine stores its data and is equivalent to a C:\ drive.
func New ¶
New returns a new Wineprefix.
The given directory, an optional path to the Wineprefix, must be owned by the current user, and must be an absolute path, otherwise running Wine will fail.
func (*Prefix) AppDataDir ¶
AppDataDir returns the current user's AppData within the Prefix.
func (*Prefix) Command ¶
Command returns the Cmd struct to execute the named program with the given arguments within the Wineprefix. It is reccomended to use Prefix.Wine to run wine as opposed to Command.
For further information, refer to exec.Command.
func (*Prefix) Init ¶
Init returns a Cmd for initializating the Wineprefix.
This procedure is done automatically as necessary by invoking any Wine application or using Prefix.Start.
func (*Prefix) NeedsUpdate ¶
NeedsUpdate reports whether the Wineprefix requires a full re-initialization, determined by the Wine installation.
Errors that can occur include failure to lookup installation and existence of the wineprefix directory.
func (*Prefix) Prepare ¶
Prepare ensures the Wineprefix is up to date with the given wine root / installation and prepares it for running wine applications.
Wine applications automatically update the Prefix, but show a dialog window. Prepare hides it for the user and prints a log entry instead.
func (*Prefix) Registry ¶
Registry parses and returns the registry for the given Wineprefix.
See the commment on Registry for more information.
func (*Prefix) RegistryAdd ¶
func (p *Prefix) RegistryAdd(key string, value string, data RegistryData) error
RegistryAdd adds a new registry key to the Wineprefix with the named key, value, type, and data. The value parameter can be empty, to modify the (Default) value.
See RegistryData for more details about the type of data.
func (*Prefix) RegistryDelete ¶
RegistryDelete deletes a registry key of the named key and value to be removed from the Wineprefix. The value parameter can be empty, if wanting to retrieving delete the entire key.
func (*Prefix) RegistryImportFile ¶
RegistryImport imports keys, values and data from a given registry file data into the Wineprefix's registry.
func (*Prefix) RegistryImportKey ¶
func (p *Prefix) RegistryImportKey(key *RegistryKey) error
RegistryKeyImport imports the given key to the Wineprefix. If the root key is not a toplevel registry key, an error will be shown to the user as a GUI.
func (*Prefix) RegistryQuery ¶
func (p *Prefix) RegistryQuery(path string) (*RegistryKey, error)
RegistryQuery finds the registry key located at path. If the named registry key is not found, nil will be returned.
func (*Prefix) Running ¶
Running reports whether the Wineserver is already running for this Wineprefix on the host system.
func (*Prefix) Start ¶
Start ensures the Wineprefix's server is running and is prepared to run any Wine application. The persistence is automatically set to 32. If the Wineserver is already running, this will return nil.
Wine applications will do this by default, but will have a few seconds to run as to prepare the environment, which Start could fulfill prior to running applications.
func (Prefix) String ¶
String implements the Stringer interface, returning the directory of the Wineprefix.
func (*Prefix) Update ¶
Update fully re-initalizes the Wineprefix data using Wineboot.
This procedure is done automatically as necessary by invoking any Wine application or using Prefix.Start.
type Registry ¶
type Registry struct {
CurrentUser *RegistryKey
Machine *RegistryKey
// contains filtered or unexported fields
}
Registry represents the Wineprefix's root registry keys at the state it was retrieved. It is not equal to the Wineprefix's actual registry files unless it was exported.
To export a registry to a Wineprefix, the Registry must have come from [Registry()], which requires an initialized wineprefix, and the Wineserver must be killed as to not conflict with Wineserver's internal registry.
To write a RegistryKey to a Wineprefix, you can use either Prefix.RegistryAdd or Prefix.RegistryImportKey.
Only HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE are supported and queryable.
func (*Registry) Query ¶
func (r *Registry) Query(path string) *RegistryKey
Query finds the given registry key path in r. nil will be returned if no such key was found. The path must be prefixed with only HKLM or HKCU (and their full counterparts), as they are the only root keys available in Registry.
type RegistryData ¶
type RegistryData any
RegistryData represents a RegistryValue's data.
Setting the data to nil will effectively delete the data during exporting, but will not delete the registry key.
Known registry types and their Go types:
- REG_SZ = string
- REG_MULTI_SZ aka hex(7) = []string
- REG_DWORD = uint32
- REG_QWORD aka hex(b) = uint64
- REG_BINARY aka hex = []byte
- REG_NONE = []byte length 0
- REG_LINK = Link
- REG_EXPAND_SZ aka hex(2)= ExpandableString
- REG_DWORD_LITTLE_ENDIAN aka hex(4) = DwordLE
- REG_DWORD_BIG_ENDIAN aka hex(5) = DwordBE
- DEVPROP_TYPE_DEVPROPTYPE aka hex(ffff????) = [InternalByte]
type RegistryKey ¶
type RegistryKey struct {
Name string
Values []RegistryValue
Subkeys []*RegistryKey
// contains filtered or unexported fields
}
RegistryKey represents a relative, offline Wine registry key with its known values and subkeys.
It is not reccomended to iterate over the Subkeys field to modify it, use RegistryKey.Add and RegistryKey.Delete.
Symlinked registry keys are unsupported. They always contain a subkey with the name SymbolicLinkValue and an absolute registry path such as '\Registry\Machine\Software\Classes\AppsId' encoded in UTF16LE.
func NewRegistryKey ¶
func NewRegistryKey(path string) *RegistryKey
NewRegistryKey creates a registry key and its parents based on the absolute registry path. The path must contain a backslash, even if it is the root key.
func ParseRegistryFile ¶
func ParseRegistryFile(name string) (*RegistryKey, error)
ParseRegistryFile is a helper for ParseRegistry to parse from a registry file.
func (*RegistryKey) Add ¶
func (k *RegistryKey) Add(path string) *RegistryKey
Add will find the registry key located at path, relative to k, and creates any parent key if necesary.
func (*RegistryKey) AddKey ¶
func (k *RegistryKey) AddKey(a *RegistryKey) *RegistryKey
AddKey will resolve the key a to k, adding its full path and parent path, including all of the subkeys.
func (*RegistryKey) Delete ¶
func (k *RegistryKey) Delete(path string) bool
Delete removes the named registry key path relative to k. If deletion was successful and the key was found in k, true will be returned, otherwise false will be returned.
func (*RegistryKey) DeleteValue ¶
func (k *RegistryKey) DeleteValue(name string) bool
DeleteValue deletes the named value from k and reports whether the value was found and successfully deleted.
func (*RegistryKey) Equal ¶
func (k *RegistryKey) Equal(b *RegistryKey) bool
This is preferred over reflect.DeepEqual as there are private pointer properties.
func (*RegistryKey) Export ¶
func (k *RegistryKey) Export(w io.Writer) error
Export writes the regedit export of k to w. Any error regarding formatting a type will not be returned if k's origin was serialized from ParseRegistry.
If there are any registry keys with no values and subkeys, it will be marked as deleted.
Registry keys that are links to other keys will not be exported here.
func (*RegistryKey) GetValue ¶
func (k *RegistryKey) GetValue(name string) *RegistryValue
GetValue finds the a registry value with the given name in k. If it is not found, nil will be returned.
func (*RegistryKey) Import ¶
func (k *RegistryKey) Import(r io.Reader) error
Import parses the registry file from r and serializes it into a k. If parsing from Wine's internal .reg files, the root registry will be named, but if parsing from a exported .reg file, the root registry key will have no name.
func (*RegistryKey) Parent ¶
func (k *RegistryKey) Parent() *RegistryKey
Parent returns k's parent registry key. The parent can be null if k is a root registry key such as HKEY_CURRENT_USER.
func (*RegistryKey) Path ¶
func (k *RegistryKey) Path() string
Path returns the path to itself up to the root registry key.
func (*RegistryKey) Query ¶
func (k *RegistryKey) Query(path string) *RegistryKey
Query finds the given registry key path relative to k. nil will be returned if no key was found.
func (*RegistryKey) Root ¶
func (k *RegistryKey) Root() (parent *RegistryKey)
Parent returns k's root registry key (greatest parent).
func (*RegistryKey) SetValue ¶
func (k *RegistryKey) SetValue(name string, data RegistryData) (ret *RegistryValue)
SetValue sets a named value in k with the specified data. The name may be an empty string to specify the (Default) key. See RegistryData for more information.
If the named value already exists in k, only the data will be set, otherwise a new value will be added to k with the given name and data.
type RegistryValue ¶
type RegistryValue struct {
Name string
Data RegistryData
}
RegistryValue represents a known registry key's value pairs.
The (Default) key will have the name as empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
dxvk
command
|
|
|
Package dxvk manages DXVK for a Wineprefix.
|
Package dxvk manages DXVK for a Wineprefix. |
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
Package webview abstracts Edge WebView 2 updates for a Wineprefix.
|
Package webview abstracts Edge WebView 2 updates for a Wineprefix. |