Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Dec 20, 2019
1 parent d3a4b6c commit 9fa32f1
Show file tree
Hide file tree
Showing 30 changed files with 642 additions and 176 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.73] - 2019-12-19

### Added
- dns proxy blockist is now saved every 15 minutes
- added greatly improved search edit box, focus with ctrl+f
- added "del" keyboard short key to remove selected item

### Changed
- reworked GPO handling to avoid write lock conflicts on slower machines

### Fixed
- fixed an issue when clicking the tray icon before the main window was fully loaded
- fixed access color not changing in program list view
- fixed crash bug on start as on admin
- fixed crash bug with app package name resolution
- fixed issue when upon a change the ribbon controls were not updated acordingly


## [0.72] - 2019-12-17

Expand Down
4 changes: 2 additions & 2 deletions PrivateWin10/API/AppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public AppManager()
[DllImport("advapi32", CharSet = CharSet.Unicode)]
public static extern bool ConvertSidToStringSid(IntPtr pSID, [In, Out, MarshalAs(UnmanagedType.LPWStr)] ref string pStringSid);

public string SidToAppPackage(string sid)
static public string SidToAppPackage(string sid)
{
string packageID = "";

Expand All @@ -57,7 +57,7 @@ public string SidToAppPackage(string sid)
return packageID;
}

public string AppPackageToSid(string packageID)
static public string AppPackageToSid(string packageID)
{
string strSID = "";

Expand Down
10 changes: 9 additions & 1 deletion PrivateWin10/API/UwpFunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

using System.Windows.Input;
using PrivateWin10.Controls;

public class UwpFunc
{
Expand Down Expand Up @@ -85,4 +86,11 @@ public class AppInfo
public string ID;
public string SID;
}

internal static void AddBinding(System.Windows.Controls.Control ctrl, KeyGesture keyGesture, ExecutedRoutedEventHandler executed)
{
RoutedCommand cmd = new RoutedCommand();
cmd.InputGestures.Add(keyGesture);
ctrl.CommandBindings.Add(new CommandBinding(cmd, executed));
}
}
6 changes: 5 additions & 1 deletion PrivateWin10/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public static void Main(string[] args)

if (!Directory.Exists(dataPath))
Directory.CreateDirectory(dataPath);
FileOps.SetAnyDirSec(dataPath);
if(AdminFunc.IsAdministrator())
FileOps.SetAnyDirSec(dataPath);

App.LogInfo("PrivateWin10 Process Started, Mode {0}.", startMode.ToString());

Expand Down Expand Up @@ -593,6 +594,9 @@ static bool ExecuteCommands()

static void TrayAction(object sender, TrayIcon.TrayEventArgs args)
{
if (MainWnd == null || !MainWnd.FullyLoaded)
return;

switch (args.Action)
{
case TrayIcon.Actions.ToggleWindow:
Expand Down
6 changes: 4 additions & 2 deletions PrivateWin10/Controls/DnsLogList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PrivateWin10.Controls"
xmlns:l="clr-namespace:PrivateWin10"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
Expand All @@ -18,10 +19,11 @@
</Grid.RowDefinitions>

<ToolBar Grid.Row="0">
<WrapPanel>
<!--WrapPanel>
<Label Content="Filter:"/>
<TextBox Name="txtDnsFilter" MinWidth="150" Margin="0,2" HorizontalAlignment="Stretch" Text="" TextChanged="txtDnsFilter_TextChanged"/>
</WrapPanel>
</-->
<l:SearchTextBox x:Name="txtDnsFilter" LabelText="Text Filter... (CTRL+F)" MinWidth="250" SearchMode="Instant" Margin="1,2" SearchEventTimeDelay="00:00:01" Search="TxtRuleFilter_Search"/>
<!--Separator />
<Button Name="btnClear">
<StackPanel Orientation="Horizontal">
Expand Down
33 changes: 7 additions & 26 deletions PrivateWin10/Controls/DnsLogList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public DnsLogList()
{
InitializeComponent();

this.txtDnsFilter.LabelText = Translate.fmt("lbl_text_filter");

this.dnsGrid.Columns[1].Header = Translate.fmt("lbl_name");
this.dnsGrid.Columns[2].Header = Translate.fmt("lbl_host_name");
this.dnsGrid.Columns[3].Header = Translate.fmt("lbl_last_seen");
Expand All @@ -54,6 +56,8 @@ public DnsLogList()
textFilter = App.GetConfig("GUI", "DnsFilter", "");
txtDnsFilter.Text = textFilter;

UwpFunc.AddBinding(dnsGrid, new KeyGesture(Key.F, ModifierKeys.Control), (s, e) => { this.txtDnsFilter.Focus(); });

CheckLogEntries();
}

Expand Down Expand Up @@ -122,36 +126,13 @@ private void DnsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e
CheckLogEntries();
}

static int VALIDATION_DELAY = 1000;
System.Threading.Timer timer = null;

private void txtDnsFilter_TextChanged(object sender, TextChangedEventArgs e)
private void TxtRuleFilter_Search(object sender, RoutedEventArgs e)
{
textFilter = txtDnsFilter.Text;
App.SetConfig("GUI", "DnsFilter", textFilter);
//UpdateDnsLog(true);

DisposeTimer();
timer = new System.Threading.Timer(TimerElapsed, null, VALIDATION_DELAY, VALIDATION_DELAY);
//UpdateRules(true);

}

private void TimerElapsed(Object obj)
{
this.Dispatcher.Invoke(new Action(() => {
dnsGrid.Items.Filter = new Predicate<object>(item => LogFilter(item));
}));

DisposeTimer();
}

private void DisposeTimer()
{
if (timer != null)
{
timer.Dispose();
timer = null;
}
dnsGrid.Items.Filter = new Predicate<object>(item => LogFilter(item));
}

private bool LogFilter(object obj)
Expand Down
6 changes: 4 additions & 2 deletions PrivateWin10/Controls/FirewallLogList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PrivateWin10.Controls"
xmlns:l="clr-namespace:PrivateWin10"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
Expand All @@ -24,10 +25,11 @@
</ComboBox>
</Grid>
<Separator />
<WrapPanel>
<!--WrapPanel>
<Label Name="lblFilter" Content="Filter:"/>
<TextBox Name="txtConFilter" MinWidth="150" Margin="0,2" HorizontalAlignment="Stretch" Text="" TextChanged="txtConFilter_TextChanged"/>
</WrapPanel>
</-->
<l:SearchTextBox x:Name="txtConFilter" LabelText="Text Filter... (CTRL+F)" MinWidth="250" SearchMode="Instant" Margin="1,2" SearchEventTimeDelay="00:00:01" Search="TxtRuleFilter_Search"/>

<Separator />

Expand Down
33 changes: 6 additions & 27 deletions PrivateWin10/Controls/FirewallLogList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public FirewallLogList()
this.chkNoLAN.Content = Translate.fmt("chk_hide_lan");
this.lblFilterCons.Content = Translate.fmt("lbl_filter_cons");*/

this.lblFilter.Content = Translate.fmt("lbl_filter");
this.txtConFilter.LabelText = Translate.fmt("lbl_text_filter");
this.cmbAll.Content = Translate.fmt("str_all_events");
this.cmbAllow.Content = Translate.fmt("str_allowed");
this.cmbBlock.Content = Translate.fmt("str_blocked");
Expand All @@ -76,6 +76,9 @@ public FirewallLogList()
logGridExt = new DataGridExt(logGrid);
logGridExt.Restore(App.GetConfig("FwLog", "Columns", ""));


UwpFunc.AddBinding(logGrid, new KeyGesture(Key.F, ModifierKeys.Control), (s, e) => { this.txtConFilter.Focus(); });

try
{
textFilter = App.GetConfig("FwLog", "Filter", "");
Expand Down Expand Up @@ -209,37 +212,13 @@ private void LogTypeFilters_Click(object sender, RoutedEventArgs e)
logGrid.Items.Filter = new Predicate<object>(item => LogFilter(item));
}

static int VALIDATION_DELAY = 1000;
System.Threading.Timer timer = null;


private void txtConFilter_TextChanged(object sender, TextChangedEventArgs e)
private void TxtRuleFilter_Search(object sender, RoutedEventArgs e)
{
textFilter = txtConFilter.Text;
App.SetConfig("FwLog", "Filter", textFilter);
//UpdateConnections(true);

DisposeTimer();
timer = new System.Threading.Timer(TimerElapsed, null, VALIDATION_DELAY, VALIDATION_DELAY);

}

private void TimerElapsed(Object obj)
{
this.Dispatcher.Invoke(new Action(() => {
logGrid.Items.Filter = new Predicate<object>(item => LogFilter(item));
}));

DisposeTimer();
}

private void DisposeTimer()
{
if (timer != null)
{
timer.Dispose();
timer = null;
}
logGrid.Items.Filter = new Predicate<object>(item => LogFilter(item));
}

private bool LogFilter(object obj)
Expand Down
6 changes: 4 additions & 2 deletions PrivateWin10/Controls/FirewallRuleList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PrivateWin10.Controls"
xmlns:l="clr-namespace:PrivateWin10"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
Expand Down Expand Up @@ -41,10 +42,11 @@
</ComboBox>
</Grid>
<Separator />
<WrapPanel>
<!--WrapPanel>
<Label Name="lblFilter" Content="Filter:"/>
<TextBox Name="txtRuleFilter" MinWidth="150" Margin="0,2" HorizontalAlignment="Stretch" Text="" TextChanged="txtRuleFilter_TextChanged"/>
</WrapPanel>
</WrapPanel-->
<l:SearchTextBox x:Name="txtRuleFilter" LabelText="Text Filter... (CTRL+F)" MinWidth="250" SearchMode="Instant" Margin="1,2" SearchEventTimeDelay="00:00:01" Search="TxtRuleFilter_Search"/>
<Separator />
<ToggleButton Name="chkNoDisabled" ToolTip="Hide Disabled Rules" Click="chkNoDisabled_Click">
<Image Width="16" Height="16">
Expand Down
38 changes: 12 additions & 26 deletions PrivateWin10/Controls/FirewallRuleList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public FirewallRuleList()
//this.chkNoDisabled.Content = Translate.fmt("chk_hide_disabled");
//this.lblFilterRules.Content = Translate.fmt("lbl_filter_rules");

this.lblFilter.Content = Translate.fmt("lbl_filter");
//this.lblFilter.Content = Translate.fmt("lbl_filter");
this.txtRuleFilter.LabelText = Translate.fmt("lbl_text_filter");
this.cmbAll.Content = Translate.fmt("str_all_actions");
this.cmbAllow.Content = Translate.fmt("str_allow");
this.cmbBlock.Content = Translate.fmt("str_block");
Expand Down Expand Up @@ -121,6 +122,9 @@ public FirewallRuleList()
rulesGridExt = new DataGridExt(rulesGrid);
rulesGridExt.Restore(App.GetConfig("GUI", "rulesGrid_Columns", ""));

UwpFunc.AddBinding(rulesGrid, new KeyGesture(Key.F, ModifierKeys.Control), (s,e)=> { this.txtRuleFilter.Focus(); });
UwpFunc.AddBinding(rulesGrid, new KeyGesture(Key.Delete), btnRemoveRule_Click);

try
{
textFilter = App.GetConfig("FwRules", "Filter", "");
Expand Down Expand Up @@ -185,6 +189,7 @@ public void SetPage(FirewallPage page)

CheckRules();
}


public void UpdateRules(bool clear = false)
{
Expand Down Expand Up @@ -226,6 +231,8 @@ public void UpdateRules(bool clear = false)

// update existing cels
rulesGrid.Items.Refresh();

CheckRules();
}

private void btnCreateRule_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -369,38 +376,16 @@ private void chkNoDisabled_Click(object sender, RoutedEventArgs e)
rulesGrid.Items.Filter = new Predicate<object>(item => RuleFilter(item));
}

static int VALIDATION_DELAY = 1000;
System.Threading.Timer timer = null;

private void txtRuleFilter_TextChanged(object sender, TextChangedEventArgs e)
private void TxtRuleFilter_Search(object sender, RoutedEventArgs e)
{
textFilter = txtRuleFilter.Text;
App.SetConfig("FwRules", "Filter", textFilter);
//UpdateRules(true);

DisposeTimer();
timer = new System.Threading.Timer(TimerElapsed, null, VALIDATION_DELAY, VALIDATION_DELAY);

}

private void TimerElapsed(Object obj)
{
this.Dispatcher.Invoke(new Action(() => {
rulesGrid.Items.Filter = new Predicate<object>(item => RuleFilter(item));
}));

DisposeTimer();
}

private void DisposeTimer()
{
if (timer != null)
{
timer.Dispose();
timer = null;
}
rulesGrid.Items.Filter = new Predicate<object>(item => RuleFilter(item));
}

private void CmbDirection_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
directionFilter = (FirewallRule.Directions)cmbDirection.SelectedIndex;
Expand Down Expand Up @@ -689,5 +674,6 @@ private void NotifyPropertyChanged(string propertyName)

#endregion
}

}
}
6 changes: 4 additions & 2 deletions PrivateWin10/Controls/NetworkSocketList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PrivateWin10.Controls"
xmlns:l="clr-namespace:PrivateWin10"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
Expand All @@ -24,10 +25,11 @@
</ComboBox>
</Grid>
<Separator/>
<WrapPanel>
<!--WrapPanel>
<Label Name="lblFilter" Content="Filter:"/>
<TextBox Name="txtSockFilter" MinWidth="150" Margin="0,2" HorizontalAlignment="Stretch" Text="" TextChanged="txtSockFilter_TextChanged"/>
</WrapPanel>
</-->
<l:SearchTextBox x:Name="txtSockFilter" LabelText="Text Filter... (CTRL+F)" MinWidth="250" SearchMode="Instant" Margin="1,2" SearchEventTimeDelay="00:00:01" Search="TxtRuleFilter_Search"/>
<Separator/>
<ToggleButton Name="chkNoINet" Click="SocketTypeFilters_Click" ToolTip="Hide Internet (WWW) Traffic">
<Image Width="16" Height="16">
Expand Down
Loading

0 comments on commit 9fa32f1

Please sign in to comment.