From 8db15d6951a8c16224dd43935fb83fb78bfab953 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 18 Dec 2022 12:21:43 +1000 Subject: [PATCH] Show warning dialog when running as Superuser/Administrator --- src/BizHawk.Client.EmuHawk/Program.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.EmuHawk/Program.cs b/src/BizHawk.Client.EmuHawk/Program.cs index 0f1cf9074a..094016714d 100644 --- a/src/BizHawk.Client.EmuHawk/Program.cs +++ b/src/BizHawk.Client.EmuHawk/Program.cs @@ -242,7 +242,19 @@ namespace BizHawk.Client.EmuHawk _ = SetDllDirectory(dllDir); } - Util.DebugWriteLine(EmuHawkUtil.CLRHostHasElevatedPrivileges ? "running as Superuser/Administrator" : "running as unprivileged user"); + if (EmuHawkUtil.CLRHostHasElevatedPrivileges) + { + using MsgBox dialog = new( + title: "This EmuHawk is privileged", + message: $"EmuHawk detected it {(OSTC.IsUnixHost ? "is running as root (Superuser)" : "has Administrator privileges")}.\n" + + "This is a bad idea.", + boxIcon: MessageBoxIcon.Warning); + dialog.ShowDialog(); + } + else + { + Util.DebugWriteLine("running as unprivileged user"); + } var exitCode = 0; try