Imports #
"syscall"
"errors"
"syscall"
"unicode/utf16"
"unsafe"
"internal/syscall/windows/sysdll"
"syscall"
"unsafe"
"runtime"
"syscall"
"syscall"
"errors"
"syscall"
"unicode/utf16"
"unsafe"
"internal/syscall/windows/sysdll"
"syscall"
"unsafe"
"runtime"
"syscall"
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
const BINARY = 3
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
const CREATE_LINK = 0x00020
const CREATE_SUB_KEY = 0x00004
const CURRENT_CONFIG = *ast.CallExpr
const CURRENT_USER = *ast.CallExpr
const DWORD = 4
const DWORD_BIG_ENDIAN = 5
const ENUMERATE_SUB_KEYS = 0x00008
const EXECUTE = 0x20019
const EXPAND_SZ = 2
ErrNotExist is returned when a registry key or value does not exist.
var ErrNotExist = syscall.ERROR_FILE_NOT_FOUND
ErrShortBuffer is returned when the buffer was too short for the operation.
var ErrShortBuffer = syscall.ERROR_MORE_DATA
ErrUnexpectedType is returned by Get*Value when the value's type was unexpected.
var ErrUnexpectedType = *ast.CallExpr
const FULL_RESOURCE_DESCRIPTOR = 9
const LINK = 6
const LOCAL_MACHINE = *ast.CallExpr
const MULTI_SZ = 7
Registry value types.
const NONE = 0
const NOTIFY = 0x00010
const QUERY_VALUE = 0x00001
const QWORD = 11
const READ = 0x20019
const RESOURCE_LIST = 8
const RESOURCE_REQUIREMENTS_LIST = 10
const SET_VALUE = 0x00002
const SZ = 1
const USERS = *ast.CallExpr
const WOW64_32KEY = 0x00200
const WOW64_64KEY = 0x00100
const WRITE = 0x20006
var _ unsafe.Pointer
const _ERROR_NO_MORE_ITEMS syscall.Errno = 259
const _REG_CREATED_NEW_KEY = 1
const _REG_OPENED_EXISTING_KEY = 2
const _REG_OPTION_NON_VOLATILE = 0
var errERROR_EINVAL error = syscall.EINVAL
var errERROR_IO_PENDING error = *ast.CallExpr
Do the interface allocations only once for common Errno values.
const errnoERROR_IO_PENDING = 997
var modadvapi32 = *ast.CallExpr
var modkernel32 = *ast.CallExpr
var procExpandEnvironmentStringsW = *ast.CallExpr
var procRegCreateKeyExW = *ast.CallExpr
var procRegDeleteKeyW = *ast.CallExpr
var procRegDeleteValueW = *ast.CallExpr
var procRegEnumValueW = *ast.CallExpr
var procRegLoadMUIStringW = *ast.CallExpr
var procRegSetValueExW = *ast.CallExpr
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
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
}
Close closes open key k.
func (k Key) Close() error
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 deletes the subkey path of key k and its values.
func DeleteKey(k Key, path string) error
DeleteValue removes a named value from the key k.
func (k Key) DeleteValue(name string) error
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 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 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 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 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 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 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 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 returns the names of subkeys of key k.
func (k Key) ReadSubKeyNames() ([]string, error)
ReadValueNames returns the value names of key k.
func (k Key) ReadValueNames() ([]string, error)
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 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 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 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 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 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 retrieves information about the open key k.
func (k Key) Stat() (*KeyInfo, error)
errnoErr returns common boxed Errno values, to prevent allocations at runtime.
func errnoErr(e syscall.Errno) error
func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error)
func (k Key) getValue(name string, buf []byte) (date []byte, valtype uint32, err error)
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)
func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error)
func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error)
func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error)
func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error)
func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error)
func (k Key) setStringValue(name string, valtype uint32, value string) error
func (k Key) setValue(name string, valtype uint32, data []byte) error
Generated with Arrow