Made AV detection method return a bool instead of a program name

Changed relevant log message
This commit is contained in:
Emma Alyx Wunder 2024-06-27 23:28:17 +02:00
parent 1f1811b9ac
commit 619d5cc6d6
3 changed files with 8 additions and 10 deletions

View file

@ -6,11 +6,11 @@ namespace Ryujinx.Common.Utilities
{ {
public static class AVUtils public static class AVUtils
{ {
public static string GetAVName() public static bool IsRunningThirdPartyAV()
{ {
if (!OperatingSystem.IsWindows()) if (!OperatingSystem.IsWindows())
{ {
return null; return false;
} }
ManagementObjectSearcher wmiData = new ManagementObjectSearcher(@"root\SecurityCenter2", "SELECT * FROM AntiVirusProduct"); ManagementObjectSearcher wmiData = new ManagementObjectSearcher(@"root\SecurityCenter2", "SELECT * FROM AntiVirusProduct");
@ -23,7 +23,7 @@ namespace Ryujinx.Common.Utilities
string displayName = (string)dataObj["displayName"]; string displayName = (string)dataObj["displayName"];
if (displayName != "Windows Defender") if (displayName != "Windows Defender")
{ {
return displayName; return true;
} }
} }
catch (ManagementException) catch (ManagementException)
@ -32,7 +32,7 @@ namespace Ryujinx.Common.Utilities
} }
} }
return null; return false;
} }
} }
} }

View file

@ -342,10 +342,9 @@ namespace Ryujinx
Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}"); Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}");
SystemInfo.Gather().Print(); SystemInfo.Gather().Print();
string avName = AVUtils.GetAVName(); if (AVUtils.IsRunningThirdPartyAV())
if (avName != null)
{ {
Logger.Notice.Print(LogClass.Application, $"Detected AV: {avName}"); Logger.Notice.Print(LogClass.Application, $"Third-Party AV active");
} }
var enabledLogs = Logger.GetEnabledLevels(); var enabledLogs = Logger.GetEnabledLevels();

View file

@ -215,10 +215,9 @@ namespace Ryujinx.Ava
Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}"); Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}");
SystemInfo.Gather().Print(); SystemInfo.Gather().Print();
string avName = AVUtils.GetAVName(); if (AVUtils.IsRunningThirdPartyAV())
if (avName != null)
{ {
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 ? "<None>" : string.Join(", ", Logger.GetEnabledLevels()))}"); Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(Logger.GetEnabledLevels().Count == 0 ? "<None>" : string.Join(", ", Logger.GetEnabledLevels()))}");