Add alt admin check - currently removed by tree shaking, but left for reference.

This commit is contained in:
coreybutler
2021-12-10 12:19:01 -06:00
parent 324eb6a356
commit a0cdde9971

View File

@@ -848,7 +848,7 @@ func runElevated(command string, forceUAC ...bool) (bool, error) {
}
if uac {
log.Print(command)
// Alternative elevation option at stackoverflow.com/questions/31558066/how-to-ask-for-administer-privileges-on-windows-with-go
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), command)
var output bytes.Buffer
var _stderr bytes.Buffer
@@ -971,3 +971,13 @@ func setup() {
return
}
}
func isAdmin() bool {
fs, err := os.Open("\\\\.\\PHYSICALDRIVE0")
if err == nil {
fs.Close()
return true
}
return false
}