diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index fe2b1549..0f4feda5 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -719,10 +719,9 @@ public class Utils return Guid.TryParse(strSrc, out _); } - public static Dictionary GetSystemHosts() + private static Dictionary GetSystemHosts(string hostFile) { var systemHosts = new Dictionary(); - var hostFile = @"C:\Windows\System32\drivers\etc\hosts"; try { if (File.Exists(hostFile)) @@ -755,6 +754,19 @@ public class Utils return systemHosts; } + public static Dictionary GetSystemHosts() + { + var hosts = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts"); + var hostsIcs = GetSystemHosts(@"C:\Windows\System32\drivers\etc\hosts.ics"); + + foreach (var (key, value) in hostsIcs) + { + hosts[key] = value; + } + + return hosts; + } + public static async Task GetCliWrapOutput(string filePath, string? arg) { return await GetCliWrapOutput(filePath, arg != null ? new List() { arg } : null);