From 733425a79b695dba536be0cfcf122aea3aa68a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20G=C3=BCnther?= Date: Wed, 10 Mar 2021 00:10:17 +0100 Subject: [PATCH] fix fixes #2 Display a warning when running in administrator mode. Drag & Drop from user into processes with elevated privileges is not possible in windows. --- cmd/arcdps-log-uploader/main.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/arcdps-log-uploader/main.go b/cmd/arcdps-log-uploader/main.go index 629724f..8b50df3 100644 --- a/cmd/arcdps-log-uploader/main.go +++ b/cmd/arcdps-log-uploader/main.go @@ -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 }