diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/ShellLinkHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/ShellLinkHelper.cs index 49977393a5..6d829d741c 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/ShellLinkHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/ShellLinkHelper.cs @@ -102,6 +102,8 @@ namespace Microsoft.Plugin.Program.Programs // To initialize the app description public String description = String.Empty; + // Sets to true if the program takes in arguments + public bool hasArguments = false; // Retrieve the target path using Shell Link public string retrieveTargetPath(string path) @@ -125,6 +127,15 @@ namespace Microsoft.Plugin.Program.Programs buffer = new StringBuilder(MAX_PATH); ((IShellLinkW)link).GetDescription(buffer, MAX_PATH); description = buffer.ToString(); + + StringBuilder argumentBuffer = new StringBuilder(MAX_PATH); + ((IShellLinkW)link).GetArguments(argumentBuffer, argumentBuffer.Capacity); + + // Set variable to true if the program takes in any arguments + if (argumentBuffer.Length != 0) + { + hasArguments = true; + } } return target; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs index b957cff9cf..57d3204bf7 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32.cs @@ -30,6 +30,7 @@ namespace Microsoft.Plugin.Program.Programs public string Description { get; set; } public bool Valid { get; set; } public bool Enabled { get; set; } + public bool hasArguments { get; set; } = false; public string Location => ParentDirectory; private const string ShortcutExtension = "lnk"; @@ -54,6 +55,12 @@ namespace Microsoft.Plugin.Program.Programs return null; } + if(!hasArguments) + { + var noArgumentScoreModifier = 5; + score += noArgumentScoreModifier; + } + var result = new Result { SubTitle = "Win32 application", @@ -191,6 +198,7 @@ namespace Microsoft.Plugin.Program.Programs program.LnkResolvedPath = program.FullPath; program.FullPath = Path.GetFullPath(target).ToLower(); program.ExecutableName = Path.GetFileName(target); + program.hasArguments = _helper.hasArguments; var description = _helper.description; if (!string.IsNullOrEmpty(description))