From 619d5cc6d6b0150c2b9496c64cb286ffeb8b5933 Mon Sep 17 00:00:00 2001 From: Emma Alyx Wunder Date: Thu, 27 Jun 2024 23:28:17 +0200 Subject: [PATCH] Made AV detection method return a bool instead of a program name Changed relevant log message --- src/Ryujinx.Common/Utilities/AVUtils.cs | 8 ++++---- src/Ryujinx.Gtk3/Program.cs | 5 ++--- src/Ryujinx/Program.cs | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Ryujinx.Common/Utilities/AVUtils.cs b/src/Ryujinx.Common/Utilities/AVUtils.cs index 246d0740b..3238d0cfe 100644 --- a/src/Ryujinx.Common/Utilities/AVUtils.cs +++ b/src/Ryujinx.Common/Utilities/AVUtils.cs @@ -6,11 +6,11 @@ namespace Ryujinx.Common.Utilities { public static class AVUtils { - public static string GetAVName() + public static bool IsRunningThirdPartyAV() { if (!OperatingSystem.IsWindows()) { - return null; + return false; } ManagementObjectSearcher wmiData = new ManagementObjectSearcher(@"root\SecurityCenter2", "SELECT * FROM AntiVirusProduct"); @@ -23,7 +23,7 @@ namespace Ryujinx.Common.Utilities string displayName = (string)dataObj["displayName"]; if (displayName != "Windows Defender") { - return displayName; + return true; } } catch (ManagementException) @@ -32,7 +32,7 @@ namespace Ryujinx.Common.Utilities } } - return null; + return false; } } } diff --git a/src/Ryujinx.Gtk3/Program.cs b/src/Ryujinx.Gtk3/Program.cs index 73f2b9f48..d2d3b6033 100644 --- a/src/Ryujinx.Gtk3/Program.cs +++ b/src/Ryujinx.Gtk3/Program.cs @@ -342,10 +342,9 @@ namespace Ryujinx Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}"); SystemInfo.Gather().Print(); - string avName = AVUtils.GetAVName(); - if (avName != null) + if (AVUtils.IsRunningThirdPartyAV()) { - Logger.Notice.Print(LogClass.Application, $"Detected AV: {avName}"); + Logger.Notice.Print(LogClass.Application, $"Third-Party AV active"); } var enabledLogs = Logger.GetEnabledLevels(); diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 2b86987dd..03bfc6365 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -215,10 +215,9 @@ namespace Ryujinx.Ava Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}"); SystemInfo.Gather().Print(); - string avName = AVUtils.GetAVName(); - if (avName != null) + if (AVUtils.IsRunningThirdPartyAV()) { - Logger.Notice.Print(LogClass.Application, $"Detected AV: {avName}"); + Logger.Notice.Print(LogClass.Application, $"Third-Party AV active"); } Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(Logger.GetEnabledLevels().Count == 0 ? "" : string.Join(", ", Logger.GetEnabledLevels()))}");