Skip to content

Commit

Permalink
Interception only filters subscribed devices
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Oct 28, 2017
1 parent 8033715 commit 5c183c2
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Core Providers/Core_Interception/Core_Interception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,36 @@ protected virtual void Dispose(bool disposing)
Log("Provider {0} was Disposed", ProviderName);
}

/// <summary>
/// Turns on / off filtering of devices
/// Any filtered device will be blocked if the provider crashes
/// Also controls which devices are filtered when filtering is on
/// </summary>
/// <param name="state">Set to true to turn filtering on</param>
private void SetFilterState(bool state)
{
if (state && !filterState)
{
SetFilter(deviceContext, IsKeyboard, Filter.All);
SetFilter(deviceContext, IsMouse, Filter.All);
SetFilter(deviceContext, IsMonitoredKeyboard, Filter.All);
SetFilter(deviceContext, IsMonitoredMouse, Filter.All);
}
else if (!state && filterState)
{
SetFilter(deviceContext, IsKeyboard, Filter.None);
SetFilter(deviceContext, IsMouse, Filter.None);
SetFilter(deviceContext, IsMonitoredKeyboard, Filter.None);
SetFilter(deviceContext, IsMonitoredMouse, Filter.None);
}
}

private int IsMonitoredKeyboard(int device)
{
return Convert.ToInt32(MonitoredKeyboards.ContainsKey(device));
}

private int IsMonitoredMouse(int device)
{
return Convert.ToInt32(MonitoredMice.ContainsKey(device));
}

private void SetPollThreadState(bool state)
{
if (state && !pollThreadRunning)
Expand Down

0 comments on commit 5c183c2

Please sign in to comment.