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 b270637 commit 7858b3d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ FAQ

SystemTrayMenu is portable, so it does not need to be installed. After downloading e.g. SystemTrayMenu-1.2.6.0.zip, **unzip the folder**, then **start SystemTrayMenu.exe**. If you prefer an installation there is the possibility to install SystemTrayMenu via the [Microsoft Store](https://www.microsoft.com/store/apps/9N24F8ZBJMT1).

If not already installed, download and install .Net 6 [https://dotnet.microsoft.com](https://dotnet.microsoft.com/download/dotnet/6.0) (e.g. dotnet-sdk-6.0.100-win-x64.exe).

1. Step: After starting the application the first time you have to **choose the root directory**.
In this directory you should put shortcuts, files and folders (App, Game, Script, URL, Network),
which you are often using and especially when you can not find them over the windows start menu search.
Expand Down Expand Up @@ -294,7 +292,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 Expand Up @@ -353,3 +353,4 @@ PayPal/GitHub Sponsors - Thank you!
* [Traditional_Tap3954](https://www.reddit.com/user/Traditional_Tap3954/)
* Maximilian H.
* Jens B.
* [spitzlbergerj](https://github.com/spitzlbergerj)
2 changes: 2 additions & 0 deletions UserInterface/AppContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private static void About()
"#488 DailenG, " +
"#490 TrampiPW, " +
"#497 Aziz, " +
"#499 spitzlbergerj, " +
Environment.NewLine +
Environment.NewLine;
moreInfo += "Sponsors - Thank you!" + Environment.NewLine;
Expand All @@ -167,6 +168,7 @@ private static void About()
"Traditional_Tap3954, " +
"Maximilian H., " +
"Jens B., " +
"spitzlbergerj, " +
Environment.NewLine;
AboutBox aboutBox = new()
{
Expand Down
15 changes: 14 additions & 1 deletion Utilities/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace SystemTrayMenu.Utilities
using System.Threading;
using System.Windows;
using Clearcove.Logging;
using IWshRuntimeLibrary;
using File = System.IO.File;

internal static class Log
{
Expand Down Expand Up @@ -163,7 +165,18 @@ internal static void ProcessStart(
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 7858b3d

Please sign in to comment.