From 87cbad5c844c53f64b892043fb324f17a5c41b0f Mon Sep 17 00:00:00 2001
From: adam <1312adam@gmail.com>
Date: Mon, 12 Oct 2026 00:33:09 +0200
Subject: [PATCH 1/3] Include fetching information from Advanced tab in network
adapter options
---
client/data/Methods/Network.cs | 81 ++++++++++++++++++++++++++++++++--
client/data/Structs.cs | 10 +++++
2 files changed, 87 insertions(+), 4 deletions(-)
diff --git a/client/data/Methods/Network.cs b/client/data/Methods/Network.cs
index 396afea..3a5bfdb 100644
--- a/client/data/Methods/Network.cs
+++ b/client/data/Methods/Network.cs
@@ -4,10 +4,7 @@
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using System.Text;
using System.Threading.Tasks;
namespace specify_client.data;
@@ -58,6 +55,7 @@ public static async Task MakeNetworkData()
// This statement will avoid errors if the WMI value is not valid.
ReceiveSideScaling = rcvSideScaling is not null && rcvSideScaling != 0;
+ await GetNetworkAdapterAdvancedConfig();
AutoTuningLevelLocal = GetAutoTuningLevels();
if (!Settings.RedactNetworking)
@@ -343,6 +341,81 @@ public static string GetHostsFileHash()
// If this catch happens, the error has already been reported in GetHostsFile() and does not need to be reported again.
return "";
}
-
+
+ }
+
+ private const string RegKeyNetworkAdapterAdvancedConfig = "SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e972-e325-11ce-bfc1-08002be10318}";
+
+ ///
+ /// Retrive network adapters configuration, set in "Advanced" tab in adapter's options.
+ ///
+ ///
+ public static async Task GetNetworkAdapterAdvancedConfig()
+ {
+ using RegistryKey subkey = Registry.LocalMachine.OpenSubKey(RegKeyNetworkAdapterAdvancedConfig);
+ foreach (var adapter in NetAdapters)
+ {
+ Dictionary netAdapterConfig = new();
+ try
+ {
+ using RegistryKey adapterKey = subkey.OpenSubKey(((uint)adapter["InterfaceIndex"]).ToString("0000"));
+ if (adapterKey == null)
+ {
+ DebugLog.LogEvent($"Could not find advanced configuration for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
+ continue;
+ }
+
+ using RegistryKey adapterParamsKey = adapterKey.OpenSubKey("NDI\\Params");
+ if (adapterParamsKey == null)
+ {
+ //No advanced configuration options are available for the interface.
+ continue;
+ }
+
+ var parameterNames = adapterParamsKey.GetSubKeyNames();
+
+ foreach (string parameterName in parameterNames)
+ {
+ NetAdapterAdvancedParameter netAdapterParameter = new NetAdapterAdvancedParameter();
+ netAdapterParameter.CurrentValue = adapterKey.GetValue(parameterName)?.ToString();
+
+ using RegistryKey parameterKey = adapterParamsKey.OpenSubKey($"{parameterName}");
+
+ if (parameterKey == null)
+ {
+ DebugLog.LogEvent($"Missing parameter definitions for {parameterName} for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
+ continue;
+ }
+
+ netAdapterParameter.Description = parameterKey.GetValue("ParamDesc")?.ToString();
+ netAdapterParameter.DefaultValue = parameterKey.GetValue("default")?.ToString();
+ netAdapterParameter.Type = parameterKey.GetValue("Type").ToString();
+
+ if (netAdapterParameter.Type.Equals("enum", StringComparison.OrdinalIgnoreCase))
+ {
+ using RegistryKey parameterEnumsKey = parameterKey.OpenSubKey("Enum");
+
+ if (parameterEnumsKey == null)
+ {
+ DebugLog.LogEvent($"Missing enum definitions for {parameterName} for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
+ continue;
+ }
+
+ netAdapterParameter.PossibleEnumValues = parameterEnumsKey.GetValueNames()
+ .ToDictionary(x => x, x => parameterEnumsKey.GetValue(x)?.ToString());
+ netAdapterParameter.CurrentValueName = netAdapterParameter.PossibleEnumValues[netAdapterParameter.CurrentValue];
+
+ }
+ netAdapterConfig.Add(parameterName, netAdapterParameter);
+ }
+
+ adapter.Add("AdvancedConfiguration", netAdapterConfig);
+ }
+ catch (Exception e)
+ {
+ DebugLog.LogEvent($"Failed to read advanced configuration for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
+ DebugLog.LogEvent($"{e}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/client/data/Structs.cs b/client/data/Structs.cs
index 88d894a..b4d636a 100644
--- a/client/data/Structs.cs
+++ b/client/data/Structs.cs
@@ -18,6 +18,16 @@ public class NetworkRoute
public List PacketLoss = new List();
}
+public class NetAdapterAdvancedParameter
+{
+ public string Description { get; set; }
+ public string Type { get; set; }
+ public string DefaultValue { get; set; }
+ public string CurrentValue { get; set; }
+ public string CurrentValueName { get; set; }
+ public Dictionary PossibleEnumValues { get; set; }
+}
+
public class InstalledApp
{
public string Name;
From 02f18f6145309e7cbe3e9920f19c80777cff4ca3 Mon Sep 17 00:00:00 2001
From: adam <1312adam@gmail.com>
Date: Sun, 18 Oct 2026 02:19:43 +0200
Subject: [PATCH 2/3] Get netwotk adapter index from WMI, use it for getting
network adapter advanced configuration
---
client/data/Methods/Network.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/data/Methods/Network.cs b/client/data/Methods/Network.cs
index 3a5bfdb..b2a10e5 100644
--- a/client/data/Methods/Network.cs
+++ b/client/data/Methods/Network.cs
@@ -34,7 +34,7 @@ public static async Task MakeNetworkData()
NetAdapters = Utils.GetWmi("Win32_NetworkAdapterConfiguration",
"Description, DHCPEnabled, DHCPServer, DNSDomain, DNSDomainSuffixSearchOrder, DNSHostName, "
+ "DNSServerSearchOrder, IPEnabled, IPAddress, IPSubnet, DHCPLeaseObtained, DHCPLeaseExpires, "
- + "DefaultIPGateway, MACAddress, InterfaceIndex");
+ + "DefaultIPGateway, MACAddress, InterfaceIndex, Index");
NetAdapters2 = Utils.GetWmi("MSFT_NetAdapter",
"*",
@@ -358,7 +358,7 @@ public static async Task GetNetworkAdapterAdvancedConfig()
Dictionary netAdapterConfig = new();
try
{
- using RegistryKey adapterKey = subkey.OpenSubKey(((uint)adapter["InterfaceIndex"]).ToString("0000"));
+ using RegistryKey adapterKey = subkey.OpenSubKey(((uint)adapter["Index"]).ToString("0000"));
if (adapterKey == null)
{
DebugLog.LogEvent($"Could not find advanced configuration for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
From 21e85892eb28fcee8f47030a9e50b962ac9eadb2 Mon Sep 17 00:00:00 2001
From: adam <1312adam@gmail.com>
Date: Sun, 18 Oct 2026 02:21:29 +0200
Subject: [PATCH 3/3] Add extra check in case main registry key is missing,
update log descriptions
---
client/data/Methods/Network.cs | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/client/data/Methods/Network.cs b/client/data/Methods/Network.cs
index b2a10e5..1b8bad0 100644
--- a/client/data/Methods/Network.cs
+++ b/client/data/Methods/Network.cs
@@ -353,6 +353,11 @@ public static string GetHostsFileHash()
public static async Task GetNetworkAdapterAdvancedConfig()
{
using RegistryKey subkey = Registry.LocalMachine.OpenSubKey(RegKeyNetworkAdapterAdvancedConfig);
+ if (subkey == null)
+ {
+ DebugLog.LogEvent($"Registry key for storing network adapters advanced configuration is missing!", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
+ return;
+ }
foreach (var adapter in NetAdapters)
{
Dictionary netAdapterConfig = new();
@@ -368,7 +373,7 @@ public static async Task GetNetworkAdapterAdvancedConfig()
using RegistryKey adapterParamsKey = adapterKey.OpenSubKey("NDI\\Params");
if (adapterParamsKey == null)
{
- //No advanced configuration options are available for the interface.
+ //No advanced configuration options are available for the adapter.
continue;
}
@@ -383,7 +388,7 @@ public static async Task GetNetworkAdapterAdvancedConfig()
if (parameterKey == null)
{
- DebugLog.LogEvent($"Missing parameter definitions for {parameterName} for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
+ DebugLog.LogEvent($"Missing parameter definitions for {parameterName} for network adapter: {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
continue;
}
@@ -397,7 +402,7 @@ public static async Task GetNetworkAdapterAdvancedConfig()
if (parameterEnumsKey == null)
{
- DebugLog.LogEvent($"Missing enum definitions for {parameterName} for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
+ DebugLog.LogEvent($"Missing enum definitions for {parameterName} for network adapter: {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.WARNING);
continue;
}
@@ -413,7 +418,7 @@ public static async Task GetNetworkAdapterAdvancedConfig()
}
catch (Exception e)
{
- DebugLog.LogEvent($"Failed to read advanced configuration for {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
+ DebugLog.LogEvent($"Failed to read advanced configuration for network adapter: {adapter["Description"]}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
DebugLog.LogEvent($"{e}", DebugLog.Region.Networking, DebugLog.EventType.ERROR);
}
}