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 28, 2018
1 parent 30d4447 commit 9ec53d3
Show file tree
Hide file tree
Showing 39 changed files with 686 additions and 317 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### ToDo's
- prevent starting of multiple instances
- add option to block/unblock internet access from tray
- add tweak restore mechanism
- make overvioew page usefull


## [0.1d] - 2018-12-28

### Added
- save last open page and open it on restart
- all setings can now enabled when running not as dmin, wne a admin only seting is to be chaged the cleint prompts fo a restart
- finish localizations upport

### Fixed
- fixed issue in retriving service by PID
- UAC bypass messing with -autorun argument

### Changed
- improved emabling and disabling of execution as service


## [0.1c] - 2018-12-27

### Added
- buttons in the firewallwindow get enabled/disabled based on list selection
- rule validation for the rule window
Expand Down
2 changes: 1 addition & 1 deletion PrivateWin10/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static void Main(string[] args)
if (!AdminFunc.IsAdministrator())
{
Console.WriteLine("Trying to obtain Administrative proivilegs...");
if (AdminFunc.SkipUacRun(mName))
if (AdminFunc.SkipUacRun(mName, App.args))
return;

Console.WriteLine("Trying to start with 'runas'...");
Expand Down
2 changes: 1 addition & 1 deletion PrivateWin10/Common/FileOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static public bool TestWrite(string filePath)
public static string SID_Local = "S-1-2-0"; // Local
public static string SID_Console = "S-1-2-1"; // Console Logon
public static string SID_OwnerID = "S-1-3-0"; // Creator Owner ID
public static string SID_GroupeID = "S-1-3-1"; // Creator Group ID
public static string SID_GroupID = "S-1-3-1"; // Creator Group ID
public static string SID_OwnerSvr = "S-1-3-2"; // Creator Owner Server
public static string SID_CreatorSvr = "S-1-3-3"; // Creator Group Server
public static string SID_OwnerRights = "S-1-3-4"; // Owner Rights
Expand Down
12 changes: 9 additions & 3 deletions PrivateWin10/Common/ServiceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,15 @@ public static List<ServiceInfo> GetServicesByPID(int pid)
long RawKernelTime;
long RawUserTime;

IntPtr processHandle = System.Diagnostics.Process.GetProcessById(pid).Handle;
GetProcessTimes(processHandle, out RawCreationTime, out RawExitTime, out RawKernelTime, out RawUserTime);

try
{
IntPtr processHandle = System.Diagnostics.Process.GetProcessById(pid).Handle;
GetProcessTimes(processHandle, out RawCreationTime, out RawExitTime, out RawKernelTime, out RawUserTime);
}
catch
{
return null;
}
ServiceCacheLock.EnterReadLock();
doUpdate = ServiceCacheTime < DateTime.FromFileTimeUtc(RawCreationTime);
ServiceCacheLock.ExitReadLock();
Expand Down
99 changes: 0 additions & 99 deletions PrivateWin10/Common/TrayIcon.cs

This file was deleted.

4 changes: 4 additions & 0 deletions PrivateWin10/Controls/AddressControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public AddressControl()
{
InitializeComponent();

radAny.Content = Translate.fmt("lbl_any_ip");
radCustom.Content = Translate.fmt("lbl_selected_ip");
btnOk.Content = Translate.fmt("lbl_ok");

viewModel = new AddressViewModel();
DataContext = viewModel;
}
Expand Down
2 changes: 1 addition & 1 deletion PrivateWin10/Controls/ProgramControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Label Grid.Column="0" x:Name="info" Content="Label" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center"/>
<Label Grid.Column="0" x:Name="info" Content="" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center"/>

<WrapPanel Grid.Column="1" Orientation="Horizontal" Margin="0,0,0,0" HorizontalAlignment="Right" Background="Transparent" VerticalAlignment="Center">
<CheckBox x:Name="chkNotify" Content="Notify" Margin="2,0,2,0" VerticalAlignment="Center" IsThreeState="True" Click="chkNotify_Click"/>
Expand Down
12 changes: 10 additions & 2 deletions PrivateWin10/Controls/ProgramControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public ProgramControl(Program prog, CategoryModel Categories)
{
InitializeComponent();

chkNotify.Content = Translate.fmt("lbl_notify");
btnAdd.Content = Translate.fmt("lbl_add");
btnSplit.Content = Translate.fmt("lbl_split");
btnRemove.Content = Translate.fmt("lbl_remove");

progGrid.Columns[1].Header = Translate.fmt("lbl_name");
progGrid.Columns[2].Header = Translate.fmt("lbl_progam");

SuspendChange++;

progArea.Visibility = Visibility.Collapsed;
Expand Down Expand Up @@ -190,7 +198,7 @@ private void category_SelectionChanged(object sender, SelectionChangedEventArgs
string Value;
if (cat.SpecialCat == CategoryModel.Category.Special.AddNew)
{
InputWnd wnd = new InputWnd(Translate.fmt("msg_cat_name"), "Some Category", App.mName);
InputWnd wnd = new InputWnd(Translate.fmt("msg_cat_name"), Translate.fmt("msg_cat_some"), App.mName);
if (wnd.ShowDialog() != true || wnd.Value.Length == 0)
return;

Expand All @@ -206,7 +214,7 @@ private void category_SelectionChanged(object sender, SelectionChangedEventArgs
}
if (!found)
{
CatModel.Categorys.Insert(0, new CategoryModel.Category() { Content = Value, Groupe = Translate.fmt("cat_cats") });
CatModel.Categorys.Insert(0, new CategoryModel.Category() { Content = Value, Group = Translate.fmt("cat_cats") });
category.SelectedIndex = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion PrivateWin10/Controls/TweakControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Grid x:Name="grid">
<Rectangle x:Name="rect" Fill="#00000000" HorizontalAlignment="Stretch" Height="100" VerticalAlignment="Top"/>
<Wpf:ToggleSwitch x:Name="toggle" Content="" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Top" Width="78"/>
<Label x:Name="label" Content="Label" HorizontalAlignment="Left" Margin="10,0,78,0" VerticalAlignment="Top"/>
<Label x:Name="label" Content="" HorizontalAlignment="Left" Margin="10,0,78,0" VerticalAlignment="Top"/>
<TextBox x:Name="info" HorizontalAlignment="Stretch" Margin="2,28,2,2" TextWrapping="Wrap" Text="" VerticalAlignment="Stretch" IsReadOnly="True"/>
</Grid>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl xmlns:Wpf="clr-namespace:CSharpControls.Wpf" x:Class="PrivateWin10.TweakGroupe"
<UserControl xmlns:Wpf="clr-namespace:CSharpControls.Wpf" x:Class="PrivateWin10.TweakGroup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -10,7 +10,7 @@
<Grid x:Name="grid">
<Rectangle x:Name="rect" Fill="#00000000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<Wpf:ToggleSwitch x:Name="toggle" Content="" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Top" Width="78" IndeterminateText="( ! )"/>
<Label x:Name="label" Content="Label" HorizontalAlignment="Left" Margin="0,0,70,0" VerticalAlignment="Top" FontWeight="Bold"/>
<Label x:Name="label" Content="" HorizontalAlignment="Left" Margin="0,0,70,0" VerticalAlignment="Top" FontWeight="Bold"/>
<Grid x:Name="checks" Margin="0, 30, 0, 0">
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
namespace PrivateWin10
{
/// <summary>
/// Interaction logic for TweakGroupe.xaml
/// Interaction logic for TweakGroup.xaml
/// </summary>
public partial class TweakGroupe : UserControl
public partial class TweakGroup : UserControl
{
public event RoutedEventHandler Click;
public event RoutedEventHandler ReqSU;
Expand All @@ -30,19 +30,19 @@ internal class TweakStat
public int enabled = 0;
}

Groupe myGroupe;
Group myGroup;

Dictionary<TweakType, ContentControl> boxes = new Dictionary<TweakType, ContentControl>();

public TweakGroupe(Groupe groupe)
public TweakGroup(Group group)
{
myGroupe = groupe;
myGroup = group;

InitializeComponent();

Dictionary<TweakType, TweakStat> tweaks = new Dictionary<TweakType, TweakStat>();

foreach (Tweak tweak in groupe.Tweaks)
foreach (Tweak tweak in group.Tweaks)
{
if (!tweak.IsAvailable())
continue;
Expand Down Expand Up @@ -128,7 +128,7 @@ private void toggle_Checked(object sender, RoutedEventArgs e)

bool state = (bool)(sender as ToggleSwitch).IsChecked;

foreach (Tweak tweak in myGroupe.Tweaks)
foreach (Tweak tweak in myGroup.Tweaks)
{
if (!tweak.IsAvailable())
continue;
Expand All @@ -145,7 +145,7 @@ private void toggle_Checked(object sender, RoutedEventArgs e)
TweakType type = (TweakType)(sender as CheckBox).Tag;
bool state = (bool)(sender as CheckBox).IsChecked;
foreach (Tweak tweak in myGroupe.Tweaks)
foreach (Tweak tweak in myGroup.Tweaks)
{
if (!tweak.IsAvailable())
continue;
Expand All @@ -166,7 +166,7 @@ void OnStatusChanged(object sender, EventArgs arg)

int active = 0;
int selected = 0;
foreach (Tweak tweak in myGroupe.Tweaks)
foreach (Tweak tweak in myGroup.Tweaks)
{
if (!tweak.IsAvailable())
continue;
Expand Down
10 changes: 9 additions & 1 deletion PrivateWin10/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace PrivateWin10
{
public class Engine : IPCInterface
public class Engine : IPCInterface//, IDisposable
{
public ProgramList programs;
public Firewall firewall;
Expand Down Expand Up @@ -47,6 +47,10 @@ public void Stop()
//mFinished.WaitOne();
}

/*public void Dispose()
{
}*/

public void Run()
{
Expand Down Expand Up @@ -88,6 +92,10 @@ public void Run()

Dispatcher.Run();

mTimer.Stop();

firewall.WatchConnections(false);

Console.WriteLine("Saving program list...");
programs.StoreList();

Expand Down
10 changes: 5 additions & 5 deletions PrivateWin10/FirewallRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static bool SaveRule(FirewallRule rule, INetFwRule2 entry)
}


public const string RuleGroupe = "PrivateWin10";
public const string RuleGroup = "PrivateWin10";
public const string RulePrefix = "priv10";
public const string TempRulePrefix = "priv10temp";
public const string AllowAllName = "Allow All Network";
Expand All @@ -368,7 +368,7 @@ public static FirewallRule MakeAllowRule(ProgramList.ID id, Firewall.Directions
{
FirewallRule rule = new FirewallRule(id);
rule.Name = MakeRuleName(AllowAllName, expiration != 0);
rule.Grouping = RuleGroupe;
rule.Grouping = RuleGroup;
rule.Action = Firewall.Actions.Allow;
rule.Direction = direction;
rule.Enabled = true;
Expand All @@ -380,7 +380,7 @@ public static FirewallRule MakeAllowLanRule(ProgramList.ID id, Firewall.Directio
{
FirewallRule rule = new FirewallRule(id);
rule.Name = MakeRuleName(AllowLan, expiration != 0);
rule.Grouping = RuleGroupe;
rule.Grouping = RuleGroup;
rule.Action = Firewall.Actions.Allow;
rule.Direction = direction;
rule.Enabled = true;
Expand All @@ -393,7 +393,7 @@ public static FirewallRule MakeBlockInetRule(ProgramList.ID id, Firewall.Directi
{
FirewallRule rule = new FirewallRule(id);
rule.Name = MakeRuleName(BlockInet, expiration != 0);
rule.Grouping = RuleGroupe;
rule.Grouping = RuleGroup;
rule.Action = Firewall.Actions.Block;
rule.Direction = direction;
rule.Enabled = true;
Expand All @@ -406,7 +406,7 @@ public static FirewallRule MakeBlockRule(ProgramList.ID id, Firewall.Directions
{
FirewallRule rule = new FirewallRule(id);
rule.Name = MakeRuleName(BlockAllName, expiration != 0);
rule.Grouping = RuleGroupe;
rule.Grouping = RuleGroup;
rule.Action = Firewall.Actions.Block;
rule.Direction = direction;
rule.Enabled = true;
Expand Down
Loading

0 comments on commit 9ec53d3

Please sign in to comment.