registry

Imports

Imports #

"syscall"
"errors"
"syscall"
"unicode/utf16"
"unsafe"
"internal/syscall/windows/sysdll"
"syscall"
"unsafe"
"runtime"
"syscall"

Constants & Variables

ALL_ACCESS const #

Registry key security and access rights. See https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights for details.

const ALL_ACCESS = 0xf003f

BINARY const #

const BINARY = 3

CLASSES_ROOT const #

Windows defines some predefined root keys that are always open. An application can use these keys as entry points to the registry. Normally these keys are used in OpenKey to open new keys, but they can also be used anywhere a Key is required.

const CLASSES_ROOT = *ast.CallExpr

CREATE_SUB_KEY const #

const CREATE_SUB_KEY = 0x00004

CURRENT_CONFIG const #

const CURRENT_CONFIG = *ast.CallExpr

CURRENT_USER const #

const CURRENT_USER = *ast.CallExpr

DWORD const #

const DWORD = 4

DWORD_BIG_ENDIAN const #

const DWORD_BIG_ENDIAN = 5

ENUMERATE_SUB_KEYS const #

const ENUMERATE_SUB_KEYS = 0x00008

EXECUTE const #

const EXECUTE = 0x20019

EXPAND_SZ const #

const EXPAND_SZ = 2

ErrNotExist var #

ErrNotExist is returned when a registry key or value does not exist.

var ErrNotExist = syscall.ERROR_FILE_NOT_FOUND

ErrShortBuffer var #

ErrShortBuffer is returned when the buffer was too short for the operation.

var ErrShortBuffer = syscall.ERROR_MORE_DATA

ErrUnexpectedType var #

ErrUnexpectedType is returned by Get*Value when the value's type was unexpected.

var ErrUnexpectedType = *ast.CallExpr

FULL_RESOURCE_DESCRIPTOR const #

const FULL_RESOURCE_DESCRIPTOR = 9

LOCAL_MACHINE const #

const LOCAL_MACHINE = *ast.CallExpr

MULTI_SZ const #

const MULTI_SZ = 7

NONE const #

Registry value types.

const NONE = 0

NOTIFY const #

const NOTIFY = 0x00010

QUERY_VALUE const #

const QUERY_VALUE = 0x00001

QWORD const #

const QWORD = 11

READ const #

const READ = 0x20019

RESOURCE_LIST const #

const RESOURCE_LIST = 8

RESOURCE_REQUIREMENTS_LIST const #

const RESOURCE_REQUIREMENTS_LIST = 10

SET_VALUE const #

const SET_VALUE = 0x00002

SZ const #

const SZ = 1

USERS const #

const USERS = *ast.CallExpr

WOW64_32KEY const #

const WOW64_32KEY = 0x00200

WOW64_64KEY const #

const WOW64_64KEY = 0x00100

WRITE const #

const WRITE = 0x20006

_ var #

var _ unsafe.Pointer

_ERROR_NO_MORE_ITEMS const #

const _ERROR_NO_MORE_ITEMS syscall.Errno = 259

_REG_CREATED_NEW_KEY const #

const _REG_CREATED_NEW_KEY = 1

_REG_OPENED_EXISTING_KEY const #

const _REG_OPENED_EXISTING_KEY = 2

_REG_OPTION_NON_VOLATILE const #

const _REG_OPTION_NON_VOLATILE = 0

errERROR_EINVAL var #

var errERROR_EINVAL error = syscall.EINVAL

errERROR_IO_PENDING var #

var errERROR_IO_PENDING error = *ast.CallExpr

errnoERROR_IO_PENDING const #

Do the interface allocations only once for common Errno values.

const errnoERROR_IO_PENDING = 997

modadvapi32 var #

var modadvapi32 = *ast.CallExpr

modkernel32 var #

var modkernel32 = *ast.CallExpr

procExpandEnvironmentStringsW var #

var procExpandEnvironmentStringsW = *ast.CallExpr

procRegCreateKeyExW var #

var procRegCreateKeyExW = *ast.CallExpr

procRegDeleteKeyW var #

var procRegDeleteKeyW = *ast.CallExpr

procRegDeleteValueW var #

var procRegDeleteValueW = *ast.CallExpr

procRegEnumValueW var #

var procRegEnumValueW = *ast.CallExpr

procRegLoadMUIStringW var #

var procRegLoadMUIStringW = *ast.CallExpr

procRegSetValueExW var #

var procRegSetValueExW = *ast.CallExpr

Type Aliases

Key type #

Key is a handle to an open Windows registry key. Keys can be obtained by calling OpenKey; there are also some predefined root keys such as CURRENT_USER. Keys can be used directly in the Windows API.

type Key syscall.Handle

Structs

KeyInfo struct #

A KeyInfo describes the statistics of a key. It is returned by Stat.

type KeyInfo struct {
SubKeyCount uint32
MaxSubKeyLen uint32
ValueCount uint32
MaxValueNameLen uint32
MaxValueLen uint32
lastWriteTime syscall.Filetime
}

Functions

Close method #

Close closes open key k.

func (k Key) Close() error

CreateKey function #

CreateKey creates a key named path under open key k. CreateKey returns the new key and a boolean flag that reports whether the key already existed. The access parameter specifies the access rights for the key to be created.

func CreateKey(k Key, path string, access uint32) (newk Key, openedExisting bool, err error)

DeleteKey function #

DeleteKey deletes the subkey path of key k and its values.

func DeleteKey(k Key, path string) error

DeleteValue method #

DeleteValue removes a named value from the key k.

func (k Key) DeleteValue(name string) error

ExpandString function #

ExpandString expands environment-variable strings and replaces them with the values defined for the current user. Use ExpandString to expand EXPAND_SZ strings.

func ExpandString(value string) (string, error)

GetBinaryValue method #

GetBinaryValue retrieves the binary value for the specified value name associated with an open key k. It also returns the value's type. If value does not exist, GetBinaryValue returns ErrNotExist. If value is not BINARY, it will return the correct value type and ErrUnexpectedType.

func (k Key) GetBinaryValue(name string) (val []byte, valtype uint32, err error)

GetIntegerValue method #

GetIntegerValue retrieves the integer value for the specified value name associated with an open key k. It also returns the value's type. If value does not exist, GetIntegerValue returns ErrNotExist. If value is not DWORD or QWORD, it will return the correct value type and ErrUnexpectedType.

func (k Key) GetIntegerValue(name string) (val uint64, valtype uint32, err error)

GetMUIStringValue method #

GetMUIStringValue retrieves the localized string value for the specified value name associated with an open key k. If the value name doesn't exist or the localized string value can't be resolved, GetMUIStringValue returns ErrNotExist.

func (k Key) GetMUIStringValue(name string) (string, error)

GetStringValue method #

GetStringValue retrieves the string value for the specified value name associated with an open key k. It also returns the value's type. If value does not exist, GetStringValue returns ErrNotExist. If value is not SZ or EXPAND_SZ, it will return the correct value type and ErrUnexpectedType.

func (k Key) GetStringValue(name string) (val string, valtype uint32, err error)

GetStringsValue method #

GetStringsValue retrieves the []string value for the specified value name associated with an open key k. It also returns the value's type. If value does not exist, GetStringsValue returns ErrNotExist. If value is not MULTI_SZ, it will return the correct value type and ErrUnexpectedType.

func (k Key) GetStringsValue(name string) (val []string, valtype uint32, err error)

GetValue method #

GetValue retrieves the type and data for the specified value associated with an open key k. It fills up buffer buf and returns the retrieved byte count n. If buf is too small to fit the stored value it returns ErrShortBuffer error along with the required buffer size n. If no buffer is provided, it returns true and actual buffer size n. If no buffer is provided, GetValue returns the value's type only. If the value does not exist, the error returned is ErrNotExist. GetValue is a low level function. If value's type is known, use the appropriate Get*Value function instead.

func (k Key) GetValue(name string, buf []byte) (n int, valtype uint32, err error)

OpenKey function #

OpenKey opens a new key with path name relative to key k. It accepts any open key, including CURRENT_USER and others, and returns the new key and an error. The access parameter specifies desired access rights to the key to be opened.

func OpenKey(k Key, path string, access uint32) (Key, error)

ReadSubKeyNames method #

ReadSubKeyNames returns the names of subkeys of key k.

func (k Key) ReadSubKeyNames() ([]string, error)

ReadValueNames method #

ReadValueNames returns the value names of key k.

func (k Key) ReadValueNames() ([]string, error)

SetBinaryValue method #

SetBinaryValue sets the data and type of a name value under key k to value and BINARY.

func (k Key) SetBinaryValue(name string, value []byte) error

SetDWordValue method #

SetDWordValue sets the data and type of a name value under key k to value and DWORD.

func (k Key) SetDWordValue(name string, value uint32) error

SetExpandStringValue method #

SetExpandStringValue sets the data and type of a name value under key k to value and EXPAND_SZ. The value must not contain a zero byte.

func (k Key) SetExpandStringValue(name string, value string) error

SetQWordValue method #

SetQWordValue sets the data and type of a name value under key k to value and QWORD.

func (k Key) SetQWordValue(name string, value uint64) error

SetStringValue method #

SetStringValue sets the data and type of a name value under key k to value and SZ. The value must not contain a zero byte.

func (k Key) SetStringValue(name string, value string) error

SetStringsValue method #

SetStringsValue sets the data and type of a name value under key k to value and MULTI_SZ. The value strings must not contain a zero byte.

func (k Key) SetStringsValue(name string, value []string) error

Stat method #

Stat retrieves information about the open key k.

func (k Key) Stat() (*KeyInfo, error)

errnoErr function #

errnoErr returns common boxed Errno values, to prevent allocations at runtime.

func errnoErr(e syscall.Errno) error

expandEnvironmentStrings function #

func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error)

getValue method #

func (k Key) getValue(name string, buf []byte) (date []byte, valtype uint32, err error)

regCreateKeyEx function #

func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error)

regDeleteKey function #

func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error)

regDeleteValue function #

func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error)

regEnumValue function #

func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error)

regLoadMUIString function #

func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error)

regSetValueEx function #

func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error)

setStringValue method #

func (k Key) setStringValue(name string, valtype uint32, value string) error

setValue method #

func (k Key) setValue(name string, valtype uint32, data []byte) error

Generated with Arrow