Documentation
¶
Overview ¶
Package reg is a thin, WOW64-aware wrapper over the Windows registry for the common sysadmin reads and writes that WinBatch did with RegQueryValue / RegSetValue / RegCreateKey / RegExistValue.
The cross-platform surface (the Hive and View types, the function signatures) compiles everywhere; the actual work is Windows-only.
Index ¶
- Variables
- func Exists(h Hive, path, name string, v View) (bool, error)
- func GetDWord(h Hive, path, name string, v View) (uint32, error)
- func GetString(h Hive, path, name string, v View) (string, error)
- func GetStrings(h Hive, path, name string, v View) ([]string, error)
- func KeyExists(h Hive, path string, v View) (bool, error)
- func SetDWord(h Hive, path, name string, value uint32, v View) error
- func SetString(h Hive, path, name, value string, v View) error
- type Hive
- type View
Constants ¶
This section is empty.
Variables ¶
var ErrNotExist = errors.New("winadmin/reg: key or value does not exist")
ErrNotExist signals a missing key or value.
var ErrUnsupportedPlatform = errors.New("winadmin/reg: only supported on Windows")
ErrUnsupportedPlatform is returned by every function off Windows.
Functions ¶
func GetDWord ¶ added in v0.2.0
GetDWord reads a REG_DWORD value as a uint32. A missing key or value returns ErrNotExist (test with errors.Is).
func GetString ¶
GetString reads a REG_SZ value. It returns ("", nil-wrapped not-exist) you can test with errors.Is(err, ErrNotExist).
func GetStrings ¶ added in v0.2.0
GetStrings reads a REG_MULTI_SZ value as a slice of strings (the RegQueryMulSz equivalent). A missing key or value returns ErrNotExist.
func KeyExists ¶ added in v0.2.0
KeyExists reports whether a key exists (the RegExistKey equivalent) — distinct from Exists, which tests a value. Admin checks like "is a reboot pending?" hinge on whether a marker *key* is present, not a value under it.