Documentation
¶
Index ¶
- Constants
- Variables
- func CenterWindow(mw *walk.FormBase)
- func CreateShortcut(settings ShortcutSettings) error
- func CreateUninstallRegistryEntry(cli cl.CLI, user *UserProfile, installDir string, version string) error
- func DesktopUserCanWrite(dir string) (bool, error)
- func GetModuleFileName(hprocess syscall.Handle) (string, error)
- func GetRegistryInstallDir(cli cl.CLI, user *UserProfile) (string, error)
- func GetShortcutTarget(shortcutFilePath string) (string, error)
- func IsElevated() bool
- func KillAll(pathsToKill []string) error
- func ListProcessModulePaths() ([]setup.RunningProcess, error)
- func LoadImage(filePath string) walk.Image
- func RectangleFromRECT(r win.RECT) walk.Rectangle
- func RegisterURLProtocols(cli cl.CLI, user *UserProfile, launcherPath string) error
- func RelaunchElevated(args []string) error
- func RemoveUninstallerRegistryKey(cli cl.CLI, user *UserProfile) error
- func SetInstallerImage(cli cl.CLI, imageView *walk.ImageView)
- func StartProcessAsDesktopUser(exe string, args []string, dir string) error
- func URLProtocols(appName string) []string
- type DWORDValue
- type Folders
- type ShortcutSettings
- type StringValue
- type UserProfile
Constants ¶
const RegDateFormat = "20060102"
RegDateFormat is the format in which installed time should be stored in the registry, as a format string suitable for time.Format()
Variables ¶
var ErrElevationCancelled = fmt.Errorf("elevation cancelled by user")
Functions ¶
func CenterWindow ¶
func CreateShortcut ¶
func CreateShortcut(settings ShortcutSettings) error
CreateShortcut creates a windows shortcut with the given settings
func CreateUninstallRegistryEntry ¶
func CreateUninstallRegistryEntry(cli cl.CLI, user *UserProfile, installDir string, version string) error
CreateUninstallRegistryEntry creates all registry entries required to have the app show up in Add or Remove software and be uninstalled by the user
func DesktopUserCanWrite ¶ added in v1.31.0
DesktopUserCanWrite reports whether the ordinary interactive user can create files in dir. It only means something when we run elevated: an elevated installer can write anywhere, but later updates run as the plain user.
func GetRegistryInstallDir ¶
func GetRegistryInstallDir(cli cl.CLI, user *UserProfile) (string, error)
func GetShortcutTarget ¶ added in v1.31.0
GetShortcutTarget reads the target path of an existing .lnk file. Returns an empty string (and no error) if the link stores no target.
func IsElevated ¶ added in v1.31.0
func IsElevated() bool
IsElevated returns true if this process runs with a full administrator token (UAC-elevated, or UAC disabled for an admin account).
func ListProcessModulePaths ¶ added in v1.31.0
func ListProcessModulePaths() ([]setup.RunningProcess, error)
ListProcessModulePaths enumerates all processes along with the paths of their executable and loaded modules. Processes we can't inspect (access denied, exited mid-enumeration) are skipped or reported with whatever paths could be determined.
func RegisterURLProtocols ¶ added in v1.31.0
func RegisterURLProtocols(cli cl.CLI, user *UserProfile, launcherPath string) error
RegisterURLProtocols registers the app's URL schemes (per-user) to open through the stable launcher rather than a versioned app-X.Y.Z executable, which would go stale on the next self-update.
func RelaunchElevated ¶ added in v1.31.0
RelaunchElevated starts this executable again through UAC with the given arguments and returns without waiting for it. The user declining the prompt is reported as ErrElevationCancelled.
func RemoveUninstallerRegistryKey ¶
func RemoveUninstallerRegistryKey(cli cl.CLI, user *UserProfile) error
func StartProcessAsDesktopUser ¶ added in v1.31.0
StartProcessAsDesktopUser launches exe as the ordinary interactive user, for when we run elevated and must not hand our administrator token down to the app.
func URLProtocols ¶ added in v1.31.0
URLProtocols returns the URL schemes an app handles.
Types ¶
type DWORDValue ¶
type Folders ¶
func GetFolders ¶
type ShortcutSettings ¶
type StringValue ¶
type UserProfile ¶ added in v1.31.0
type UserProfile struct {
// contains filtered or unexported fields
}
UserProfile is the account that per-user integration (folders, shortcuts, HKCU keys) belongs to. Normally that's whoever we run as. When we run elevated on the desktop user's behalf it's still them: a standard user entering an administrator's credentials at the UAC prompt gets a child running under that administrator's profile.
func CurrentUserProfile ¶ added in v1.31.0
func CurrentUserProfile() *UserProfile
CurrentUserProfile uses the profile of the current process.
func DesktopUserProfile ¶ added in v1.31.0
func DesktopUserProfile() (*UserProfile, error)
DesktopUserProfile uses the profile of the interactive user of our session, for when we run elevated.
func (*UserProfile) Close ¶ added in v1.31.0
func (u *UserProfile) Close()
func (*UserProfile) Folders ¶ added in v1.31.0
func (u *UserProfile) Folders() (Folders, error)
Folders returns the profile's well-known folders, creating any that are missing.
func (*UserProfile) String ¶ added in v1.31.0
func (u *UserProfile) String() string