Skip to content

Commit 384478d

Browse files
committed
fix misc issues
1 parent 7379e8b commit 384478d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

DragonFruit.OnionFruit.Core.Windows/WindowsNetworkAdapterManager.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class WindowsNetworkAdapterManager : IDisposable, INetworkAdapterManager
1717
{
1818
private const string WmiNamespace = @"root\cimv2";
1919
private const string WmiNetworkAdapterQuery = "SELECT Description,SettingID FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'";
20-
private const string WmiNetworkAdapterEventQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_NetworkAdapterConfiguration' AND TargetInstance.IPEnabled = TRUE";
20+
private const string WmiNetworkAdapterEventQuery = "SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA 'Win32_NetworkAdapterConfiguration' AND TargetInstance.IPEnabled = TRUE";
2121

2222
private const string DnsRegistryPath = @"SYSTEM\CurrentControlSet\Services\Tcpip{0}\Parameters\Interfaces";
2323
private const string ProxySettingsPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
@@ -40,6 +40,7 @@ public void Init()
4040
{
4141
try
4242
{
43+
_proxyRegistry?.Dispose();
4344
_proxyRegistry = Registry.CurrentUser.OpenSubKey(ProxySettingsPath, RegistryKeyPermissionCheck.ReadWriteSubTree, RequiredRegistryAccess);
4445
}
4546
catch (SecurityException)
@@ -48,13 +49,18 @@ public void Init()
4849

4950
try
5051
{
52+
_tcpipConfigRegistry?.Dispose();
53+
_tcpip6ConfigRegistry?.Dispose();
54+
5155
_tcpipConfigRegistry = Registry.LocalMachine.OpenSubKey(string.Format(DnsRegistryPath, string.Empty), RegistryKeyPermissionCheck.ReadWriteSubTree, RequiredRegistryAccess);
5256
_tcpip6ConfigRegistry = Registry.LocalMachine.OpenSubKey(string.Format(DnsRegistryPath, "6"), RegistryKeyPermissionCheck.ReadWriteSubTree, RequiredRegistryAccess);
5357
}
5458
catch (SecurityException)
5559
{
5660
}
5761

62+
_wmiEventWatcher?.Dispose();
63+
5864
_wmiEventWatcher = new ManagementEventWatcher(WmiNamespace, WmiNetworkAdapterEventQuery);
5965
_wmiEventWatcher.EventArrived += WmiEventHandler;
6066
_wmiEventWatcher.Start();

DragonFruit.OnionFruit.Windows/WindowsAppInstanceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public bool RelaunchProcess(bool elevated)
3737

3838
var startInfo = new ProcessStartInfo(file)
3939
{
40-
Arguments = string.Concat(' ', Environment.GetCommandLineArgs()),
40+
Arguments = string.Join(' ', Environment.GetCommandLineArgs()),
4141
WorkingDirectory = Environment.CurrentDirectory,
4242
UseShellExecute = true,
4343
Verb = elevated ? "runas" : null

0 commit comments

Comments
 (0)