[BUG] In v1.3.3 introduced a issue that always asking for admin, but should only ask if shortcut requires run as admin (#499), version 1.3.4.0

This commit is contained in:
Markus Hofknecht 2023-08-28 14:06:55 +02:00
parent 851c0917ec
commit effaa6a79e
3 changed files with 19 additions and 2 deletions

View file

@ -294,7 +294,9 @@ Thanks for ideas, reporting issues and contributing!
#466 [Dean-Corso](https://github.com/Dean-Corso),
#488 [DailenG](https://github.com/DailenG),
#490 [TrampiPW](https://github.com/TrampiPW),
#497 Aziz
#497 Aziz,
#499 [spitzlbergerj](https://github.com/spitzlbergerj),
Donations

View file

@ -139,6 +139,7 @@ namespace SystemTrayMenu.Helper
"#488 DailenG, " +
"#490 TrampiPW, " +
"#497 Aziz, " +
"#499 spitzlbergerj, " +
Environment.NewLine +
Environment.NewLine;
aboutBox.AppMoreInfo += "Sponsors - Thank you!" + Environment.NewLine;
@ -157,6 +158,7 @@ namespace SystemTrayMenu.Helper
"Traditional_Tap3954, " +
"Maximilian H., " +
"Jens B., " +
"spitzlbergerj, " +
Environment.NewLine;
aboutBox.AppDetailsButton = true;
aboutBox.ShowDialog();

View file

@ -13,6 +13,8 @@ namespace SystemTrayMenu.Utilities
using System.Threading;
using System.Windows.Forms;
using Clearcove.Logging;
using IWshRuntimeLibrary;
using File = System.IO.File;
internal static class Log
{
@ -162,7 +164,18 @@ namespace SystemTrayMenu.Utilities
string verb = string.Empty;
if (!PrivilegeChecker.IsCurrentUserInAdminGroup)
{
verb = "runas";
bool isLink = Path.GetExtension(fileName)
.Equals(".lnk", StringComparison.InvariantCultureIgnoreCase);
if (isLink)
{
WshShell shell = new();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(fileName);
bool startAsAdmin = shortcut.WindowStyle == 3;
if (startAsAdmin)
{
verb = "runas";
}
}
}
using Process p = new()