Documentation ¶
Overview ¶
Package regedit is a helper package that allows easy access to the Windows registry on Windows systems and allows non-Windows systems to read data generated from registry entries.
Index ¶
- func Delete(_, _ string) error
- func DeleteEx(_, _ string, _ bool) error
- func DeleteKey(_ string, _ bool) error
- func MakeKey(_ string) error
- func Set(_, _ string, _ uint32, _ []byte) error
- func SetBytes(_, _ string, _ []byte) error
- func SetDword(_, _ string, _ uint32) error
- func SetExpandString(_, _, _ string) error
- func SetFromString(_, _ string, _ uint32, _ string) error
- func SetQword(_, _ string, _ uint64) error
- func SetString(_, _, _ string) error
- func SetStrings(_, _ string, _ []string) error
- type Entry
- func (e Entry) IsKey() bool
- func (e Entry) IsZero() bool
- func (e Entry) MarshalStream(w data.Writer) error
- func (e Entry) String() string
- func (e Entry) ToBinary() ([]byte, error)
- func (e Entry) ToInteger() (uint64, error)
- func (e Entry) ToString() (string, error)
- func (e Entry) ToStringList() ([]string, error)
- func (e Entry) TypeName() string
- func (e *Entry) UnmarshalStream(r data.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
Delete will attempt to delete the specified key or value name specified.
The value will be probed for a type and if it is a key, it will delete the key ONLY if it is empty. (Use 'DeleteEx' for recursive deletion).
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors deleting the key or value will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func DeleteEx ¶
DeleteEx will attempt to delete the specified key or value name specified.
The value will be probed for a type and if it is a key, it will delete the key ONLY if it is empty or force is true (which will recursively delete the key)
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors deleting the key or value will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func DeleteKey ¶
DeleteKey will attempt to delete the specified subkey name specified.
If force is specified, this will recursively delete a subkey and will delete non-empty subkeys. Otherwise, if force is false, non-empty subkeys will NOT be deleted.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors creating the key will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func MakeKey ¶
MakeKey will attempt to create an empty key for the supplied path.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors creating the key will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func Set ¶
Set will attempt to set the data of the value in the supplied key path to the supplied value type indicated with the type flag and will use the provided raw bytes for the value data.
This function is a "lower-level" function but allows more control of HOW the data is used.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetBytes ¶
SetBytes will attempt to set the data of the value in the supplied key path to the supplied byte array as a REG_BINARY value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetDword ¶
SetDword will attempt to set the data of the value in the supplied key path to the supplied uint32 integer as a REG_DWORD value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetExpandString ¶
SetExpandString will attempt to set the data of the value in the supplied key path to the supplied string as a REG_EXPAND_SZ value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetFromString ¶
SetFromString will attempt to set the data of the value in the supplied key path to the supplied value type indicated with the type flag and will interpret the supplied string using the type value to properly set the value data.
- Dword or Qword values will attempt to parse the string as a base10 integer that may be negative. - String and ExpandString values will be interrupted as is. - Binary will attempt to decode the value using the StdEncoding base64 decoder. - StringLists will be split using the NEWLINE ("\n") character into an array to be used.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetQword ¶
SetQword will attempt to set the data of the value in the supplied key path to the supplied uint64 integer as a REG_QWORD value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetString ¶
SetString will attempt to set the data of the value in the supplied key path to the supplied string as a REG_SZ value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
func SetStrings ¶
SetStrings will attempt to set the data of the value in the supplied key path to the supplied string list as a REG_MULTI_SZ value type.
This will create the key/value if it does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Any errors writing the data will be returned.
Returns device.ErrNoWindows on non-Windows devices.
Types ¶
type Entry ¶
Entry represents a Windows registry entry.
This may represent a Key or a Value. Values will also include their data in the 'Data' byte array and can be translated using any of the 'To*' functions to get the data represented in its proper type cast.
func Dir ¶
Dir returns a list of registry entries for the supplied key or an error if the path does not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Returns device.ErrNoWindows on non-Windows devices.
func Get ¶
Get returns a single registry entry for the supplied value name under the key path specified or an error if any of the paths do not exist.
The key path can either be a "reg" style path (ex: HKLM\System or HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
Returns device.ErrNoWindows on non-Windows devices.
func (Entry) MarshalStream ¶
MarshalStream writes the data for this Entry to the supplied Writer.
func (Entry) String ¶
String returns the string representation of the data held in the Data buffer. Invalid values of keys return an empty string.
func (Entry) ToBinary ¶
ToBinary will attempt to return the data in the Data buffer as a binary array.
This function returns an error if conversion fails or the specified type is not a BINARY type.
func (Entry) ToInteger ¶
ToInteger will attempt to return the data in the Data buffer as an unsigned integer.
This function returns an error if conversion fails or the specified type is not a DWORD or QWORD type.
func (Entry) ToString ¶
ToString will attempt to return the data in the Data buffer as a string.
This function returns an error if conversion fails or the specified type is not a STRING or EXPAND_STRING type.
func (Entry) ToStringList ¶
ToStringList will attempt to return the data in the Data buffer as a string array.
This function returns an error if conversion fails or the specified type is not a MULTI_STRING type.