This commit is contained in:
partisan 2025-03-01 17:59:26 +01:00
parent 66f4191c5f
commit 44d20eb983
10 changed files with 319 additions and 72 deletions

View file

@ -10,7 +10,7 @@ import (
"golang.org/x/sys/windows/registry"
)
// RegisterApp writes the necessary registry keys, making it appear as offically installed app
// RegisterApp writes the necessary registry keys, making it appear as officially installed app
func RegisterApp() error {
exePath, err := GetInstallDir()
if err != nil {
@ -133,3 +133,15 @@ func deleteRegistryTree(root registry.Key, path string) error {
// Finally, delete the (now empty) key.
return registry.DeleteKey(root, path)
}
// IsRegistered returns true if the application is registered (installed) in the registry.
func IsRegistered() bool {
// Try to open the uninstall key with read-only access.
key, err := registry.OpenKey(registry.LOCAL_MACHINE, `Software\Microsoft\Windows\CurrentVersion\Uninstall\SpitfireBrowser`, registry.READ)
if err != nil {
// If the key cannot be opened, assume the app is not registered.
return false
}
defer key.Close()
return true
}