mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Add convenience methods for managing HidGuardian whitelist key
Currently commented out to the public. Using for my local copy
This commit is contained in:
parent
30131ded30
commit
9d6aa5413e
@ -2,11 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Process = System.Diagnostics.Process;
|
||||
|
||||
using System.Media;
|
||||
using System.Threading.Tasks;
|
||||
using static DS4Windows.Global;
|
||||
using System.Threading;
|
||||
using Registry = Microsoft.Win32.Registry;
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
@ -76,6 +78,24 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
public void createHidGuardKey()
|
||||
{
|
||||
try
|
||||
{
|
||||
Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist\" + Process.GetCurrentProcess().Id);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void removeHidGuardKey()
|
||||
{
|
||||
try
|
||||
{
|
||||
Registry.LocalMachine.DeleteSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist\" + Process.GetCurrentProcess().Id);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public bool Start(object tempui, bool showlog = true)
|
||||
{
|
||||
if (x360Bus.Open() && x360Bus.Start())
|
||||
@ -376,7 +396,7 @@ namespace DS4Windows
|
||||
string programPath = LaunchProgram[ind];
|
||||
if (programPath != string.Empty)
|
||||
{
|
||||
System.Diagnostics.Process[] localAll = System.Diagnostics.Process.GetProcesses();
|
||||
Process[] localAll = Process.GetProcesses();
|
||||
bool procFound = false;
|
||||
for (int procInd = 0, procsLen = localAll.Length; !procFound && procInd < procsLen; procInd++)
|
||||
{
|
||||
@ -397,7 +417,7 @@ namespace DS4Windows
|
||||
{
|
||||
Task processTask = new Task(() =>
|
||||
{
|
||||
System.Diagnostics.Process tempProcess = new System.Diagnostics.Process();
|
||||
Process tempProcess = new Process();
|
||||
tempProcess.StartInfo.FileName = programPath;
|
||||
tempProcess.StartInfo.WorkingDirectory = new FileInfo(programPath).Directory.ToString();
|
||||
//tempProcess.StartInfo.UseShellExecute = false;
|
||||
|
@ -104,10 +104,12 @@ namespace DS4Windows
|
||||
//if (mutex.WaitOne(TimeSpan.Zero, true))
|
||||
//{
|
||||
createControlService();
|
||||
//rootHub.createHidGuardKey();
|
||||
//rootHub = new ControlService();
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DS4Form(args));
|
||||
//rootHub.removeHidGuardKey();
|
||||
//mutex.ReleaseMutex();
|
||||
//}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user