Added log message for third-party AVs

This commit is contained in:
Emma Alyx Wunder 2024-06-13 03:18:48 +02:00
parent c0f2491eae
commit 1f1811b9ac
3 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,38 @@
using System;
using System.Linq;
using System.Management;
namespace Ryujinx.Common.Utilities
{
public static class AVUtils
{
public static string GetAVName()
{
if (!OperatingSystem.IsWindows())
{
return null;
}
ManagementObjectSearcher wmiData = new ManagementObjectSearcher(@"root\SecurityCenter2", "SELECT * FROM AntiVirusProduct");
ManagementObjectCollection data = wmiData.Get();
foreach (ManagementObject dataObj in data.Cast<ManagementObject>())
{
try
{
string displayName = (string)dataObj["displayName"];
if (displayName != "Windows Defender")
{
return displayName;
}
}
catch (ManagementException)
{
continue;
}
}
return null;
}
}
}

View file

@ -4,6 +4,7 @@ using Ryujinx.Common.Configuration;
using Ryujinx.Common.GraphicsDriver;
using Ryujinx.Common.Logging;
using Ryujinx.Common.SystemInterop;
using Ryujinx.Common.Utilities;
using Ryujinx.Modules;
using Ryujinx.SDL2.Common;
using Ryujinx.UI;
@ -341,6 +342,12 @@ namespace Ryujinx
Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}");
SystemInfo.Gather().Print();
string avName = AVUtils.GetAVName();
if (avName != null)
{
Logger.Notice.Print(LogClass.Application, $"Detected AV: {avName}");
}
var enabledLogs = Logger.GetEnabledLevels();
Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(enabledLogs.Count == 0 ? "<None>" : string.Join(", ", enabledLogs))}");

View file

@ -7,6 +7,7 @@ using Ryujinx.Common.Configuration;
using Ryujinx.Common.GraphicsDriver;
using Ryujinx.Common.Logging;
using Ryujinx.Common.SystemInterop;
using Ryujinx.Common.Utilities;
using Ryujinx.Modules;
using Ryujinx.SDL2.Common;
using Ryujinx.UI.Common;
@ -214,6 +215,12 @@ namespace Ryujinx.Ava
Logger.Notice.Print(LogClass.Application, $"Ryujinx Version: {Version}");
SystemInfo.Gather().Print();
string avName = AVUtils.GetAVName();
if (avName != null)
{
Logger.Notice.Print(LogClass.Application, $"Detected AV: {avName}");
}
Logger.Notice.Print(LogClass.Application, $"Logs Enabled: {(Logger.GetEnabledLevels().Count == 0 ? "<None>" : string.Join(", ", Logger.GetEnabledLevels()))}");
if (AppDataManager.Mode == AppDataManager.LaunchMode.Custom)