Added placeholder routine to purge old HidGuardian whitelist entries.

Have not decided whether this is truly needed so it is not used
This commit is contained in:
Travis Nickles 2018-07-16 00:21:34 -05:00
parent f44cc21688
commit bf9f476be3
3 changed files with 31 additions and 4 deletions

View File

@ -7,7 +7,8 @@ using System.Media;
using System.Threading.Tasks;
using static DS4Windows.Global;
using System.Threading;
using Registry = Microsoft.Win32.Registry;
using System.Diagnostics;
using Microsoft.Win32;
namespace DS4Windows
{
@ -83,7 +84,32 @@ namespace DS4Windows
}
}
public void createHidGuardKey()
public void ScanPurgeHidGuard()
{
RegistryKey tempkey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
string[] subkeys = tempkey.GetSubKeyNames();
bool processExists = false;
for (int ind = 0, arlen = subkeys.Length; ind < arlen; ind++)
{
processExists = true;
try
{
Process.GetProcessById(Convert.ToInt32(subkeys[ind]));
}
catch { processExists = false; }
if (!processExists)
{
try
{
Registry.LocalMachine.DeleteSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist\" + subkeys[ind]);
}
catch { }
}
}
}
public void CreateHidGuardKey()
{
try
{

View File

@ -2463,7 +2463,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
{
Registry.LocalMachine.DeleteSubKeyTree(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
Log.LogToGui("Cleared HidGuardian Whitelist", false);
Program.rootHub.createHidGuardKey();
Program.rootHub.CreateHidGuardKey();
}
catch { }
}

View File

@ -103,7 +103,8 @@ namespace DS4Windows
//if (mutex.WaitOne(TimeSpan.Zero, true))
//{
createControlService();
rootHub.createHidGuardKey();
//rootHub.ScanPurgeHidGuard();
rootHub.CreateHidGuardKey();
//rootHub = new ControlService();
Application.EnableVisualStyles();
Application.Run(new DS4Form(args));