Skip to content

Commit

Permalink
[BUG] In v1.3.3 introduced a issue that always asking for admin, but …
Browse files Browse the repository at this point in the history
…should only ask if shortcut requires run as admin (#499), version 1.3.4.0
  • Loading branch information
Hofknecht committed Aug 28, 2023
1 parent 851c091 commit effaa6a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions UserInterface/AppContextMenu.cs
Expand Up @@ -139,6 +139,7 @@ private static void About()
"#488 DailenG, " +
"#490 TrampiPW, " +
"#497 Aziz, " +
"#499 spitzlbergerj, " +
Environment.NewLine +
Environment.NewLine;
aboutBox.AppMoreInfo += "Sponsors - Thank you!" + Environment.NewLine;
Expand All @@ -157,6 +158,7 @@ private static void About()
"Traditional_Tap3954, " +
"Maximilian H., " +
"Jens B., " +
"spitzlbergerj, " +
Environment.NewLine;
aboutBox.AppDetailsButton = true;
aboutBox.ShowDialog();
Expand Down
15 changes: 14 additions & 1 deletion Utilities/Log.cs
Expand Up @@ -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
{
Expand Down Expand Up @@ -162,7 +164,18 @@ internal static void Close()
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()
Expand Down

0 comments on commit effaa6a

Please sign in to comment.