This commit is contained in:
2026-02-19 10:07:43 +00:00
parent 007438e372
commit 6e637ecf77
1763 changed files with 60820 additions and 279516 deletions

View File

@@ -8,8 +8,10 @@ import (
"fmt"
"log"
"math"
"os"
"os/exec"
"os/user"
"path/filepath"
"reflect"
"runtime"
"strings"
@@ -33,6 +35,10 @@ var ErrNoShell = errors.New("no Shell process is present")
// ErrNoValue is returned when the value doesn't exist in the registry.
var ErrNoValue = registry.ErrNotExist
// ErrBadRegValueFormat is returned when a string value does not match the
// expected format.
var ErrBadRegValueFormat = errors.New("registry value formatted incorrectly")
// GetDesktopPID searches the PID of the process that's running the
// currently active desktop. Returns ErrNoShell if the shell is not present.
// Usually the PID will be for explorer.exe.
@@ -947,3 +953,22 @@ func IsDomainName(name string) (bool, error) {
return isDomainName(name16)
}
// GUIPathFromReg obtains the path to the client GUI executable from the
// registry value that was written during installation.
func GUIPathFromReg() (string, error) {
regPath, err := GetRegString("GUIPath")
if err != nil {
return "", err
}
if !filepath.IsAbs(regPath) {
return "", ErrBadRegValueFormat
}
if _, err := os.Stat(regPath); err != nil {
return "", err
}
return regPath, nil
}