Skip to content

Commit

Permalink
Added remaining API calls to HidHideAPIDevice class
Browse files Browse the repository at this point in the history
Not needed now. Prefer to have users use the official
HidHide Configuration Client app to edit those
settings
  • Loading branch information
Ryochan7 committed Apr 27, 2021
1 parent 7d1984d commit c366867
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions DS4Windows/DS4Control/HidHideAPIDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ public bool GetActiveState()
return result;
}

public bool SetActiveState(bool state)
{
bool result = false;

unsafe
{
int bytesReturned = 0;
NativeMethods.DeviceIoControl(hidHideHandle.DangerousGetHandle(),
HidHideAPIDevice.IOCTL_SET_ACTIVE,
new IntPtr(&state),
1,
IntPtr.Zero,
0,
ref bytesReturned,
IntPtr.Zero);

//int error = Marshal.GetLastWin32Error();
}

return result;
}

public List<string> GetBlacklist()
{
List<string> instances = new List<string>();
Expand Down Expand Up @@ -94,6 +116,29 @@ public List<string> GetBlacklist()
return instances;
}

public bool SetBlacklist(List<string> instances)
{
bool result = false;
int bytesReturned = 0;
IntPtr inBuffer =
StringListToMultiSzPointer(instances, out int inBufferLength);

result = NativeMethods.DeviceIoControl(hidHideHandle.DangerousGetHandle(),
IOCTL_SET_BLACKLIST,
inBuffer,
inBufferLength,
IntPtr.Zero,
0,
ref bytesReturned,
IntPtr.Zero);

//int error = Marshal.GetLastWin32Error();
// Free buffer returned from StringListToMultiSzPointer
Marshal.FreeHGlobal(inBuffer);

return result;
}

public List<string> GetWhitelist()
{
List<string> instances = new List<string>();
Expand Down Expand Up @@ -153,6 +198,7 @@ public bool SetWhitelist(List<string> instances)
IntPtr.Zero);

//int error = Marshal.GetLastWin32Error();
// Free buffer returned from StringListToMultiSzPointer
Marshal.FreeHGlobal(inBuffer);

return result;
Expand Down

0 comments on commit c366867

Please sign in to comment.