Add Store MSIX packaging and dark/light theme for 2.9.0.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
//go:build windows
|
||||
|
||||
package update
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
const (
|
||||
appModelErrorNoPackage = 15700 // APPMODEL_ERROR_NO_PACKAGE
|
||||
errorInsufficientBuffer = 122 // ERROR_INSUFFICIENT_BUFFER
|
||||
)
|
||||
|
||||
var (
|
||||
storeOnce sync.Once
|
||||
storePackaged bool
|
||||
)
|
||||
|
||||
// IsStorePackaged reports whether this process has an MSIX / Store package identity.
|
||||
// Store builds must not self-update (Store owns updates).
|
||||
func IsStorePackaged() bool {
|
||||
storeOnce.Do(func() {
|
||||
storePackaged = detectStorePackage()
|
||||
})
|
||||
return storePackaged
|
||||
}
|
||||
|
||||
func detectStorePackage() bool {
|
||||
mod := windows.NewLazySystemDLL("kernel32.dll")
|
||||
proc := mod.NewProc("GetCurrentPackageFullName")
|
||||
if err := proc.Find(); err != nil {
|
||||
return false
|
||||
}
|
||||
var n uint32
|
||||
r, _, _ := proc.Call(uintptr(unsafe.Pointer(&n)), 0)
|
||||
switch r {
|
||||
case appModelErrorNoPackage:
|
||||
return false
|
||||
case errorInsufficientBuffer:
|
||||
return true
|
||||
case 0:
|
||||
return n > 0
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user