From e767812106e178f19608d1e81d6ae9b6d92e52a4 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Tue, 8 Mar 2022 17:41:17 +0000 Subject: [PATCH] [PTRun][WindowWalker]Fix analyzer errors --- .../Components/ContextMenuHelper.cs | 4 ++-- .../Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs | 2 +- .../Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs index e007245a4630..6cb53d78e017 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs @@ -53,7 +53,7 @@ internal static List GetContextMenuResults(in Result result) // Hide menu if Explorer.exe is the shell process or the process name is ApplicationFrameHost.exe // In the first case we would crash the windows ui and in the second case we would kill the generic process for uwp apps. - if (!windowData.Process.IsShellProcess && !(windowData.Process.IsUwpApp & windowData.Process.Name.ToLower() == "applicationframehost.exe") + if (!windowData.Process.IsShellProcess && !(windowData.Process.IsUwpApp & windowData.Process.Name.ToLower(System.Globalization.CultureInfo.InvariantCulture) == "applicationframehost.exe") && !(windowData.Process.IsFullAccessDenied & WindowWalkerSettings.Instance.HideKillProcessOnElevatedProcesses)) { contextMenu.Add(new ContextMenuResult @@ -78,7 +78,7 @@ internal static List GetContextMenuResults(in Result result) private static bool KillProcessCommand(Window window) { // Validate process - if (!window.IsWindow || !window.Process.DoesExist || !window.Process.Name.Equals(WindowProcess.GetProcessNameFromProcessID(window.Process.ProcessID)) ) + if (!window.IsWindow || !window.Process.DoesExist || !window.Process.Name.Equals(WindowProcess.GetProcessNameFromProcessID(window.Process.ProcessID), StringComparison.Ordinal) ) { Log.Debug($"Can not kill process '{window.Process.Name}' ({window.Process.ProcessID}) of the window '{window.Title}' ({window.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); return false; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs index adb8a46b839a..82baf17254c0 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ResultHelper.cs @@ -26,7 +26,7 @@ internal static List GetResultList(List searchControllerRe foreach (SearchResult x in searchControllerResults) { - if (x.Result.Process.Name.ToLower() == "explorer.exe" && x.Result.Process.IsShellProcess) + if (x.Result.Process.Name.ToLower(System.Globalization.CultureInfo.InvariantCulture) == "explorer.exe" && x.Result.Process.IsShellProcess) { addExplorerInfo = true; } diff --git a/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs b/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs index fb2aa4cc8b2d..06040902be66 100644 --- a/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs +++ b/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs @@ -241,9 +241,9 @@ public string GetDesktopName(Guid desktop) } // If the desktop name was not changed by the user, it isn't saved to the registry. Then we need the default name for the desktop. - var defaultName = string.Format(Resources.VirtualDesktopHelper_Desktop, GetDesktopNumber(desktop)); + var defaultName = string.Format(System.Globalization.CultureInfo.InvariantCulture, Resources.VirtualDesktopHelper_Desktop, GetDesktopNumber(desktop)); - string registryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops\\Desktops\\{" + desktop.ToString().ToUpper() + "}"; + string registryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops\\Desktops\\{" + desktop.ToString().ToUpper(System.Globalization.CultureInfo.InvariantCulture) + "}"; RegistryKey deskSubKey = Registry.CurrentUser.OpenSubKey(registryPath, false); var desktopName = deskSubKey?.GetValue("Name");