Skip to content

Commit

Permalink
fix fixes #2 Display a warning when running in administrator mode.
Browse files Browse the repository at this point in the history
Drag & Drop from user into processes with elevated privileges is not possible in windows.
  • Loading branch information
Xyaren committed Mar 9, 2021
1 parent 5195c6e commit 733425a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cmd/arcdps-log-uploader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@
package main

import (
"github.com/lxn/walk"
log "github.com/sirupsen/logrus"
"os"
)

func main() {
setupLogging()
log.Info("Starting")

err := startUi()
if runningWithAdminPrivileges() {
walk.MsgBox(nil, "Administrator mode is not supported", "Due to windows security constraints, drag & drop is not supported for applications running in administrative mode.", walk.MsgBoxOK|walk.MsgBoxIconWarning|walk.MsgBoxTaskModal)
} else {
start()
}
log.Info("Bye")
}

func start() {
var err = startUi()
if err != nil {
panic(err)
}
log.Info("Bye")
}

func runningWithAdminPrivileges() bool {
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
if err != nil {
return false
}
return true
}

0 comments on commit 733425a

Please sign in to comment.