mirror of
https://github.com/DrEm-s/wireguard-windows-portable.git
synced 2021-10-28 23:07:29 +03:00
embeddable-dll-service: give dacl example for config directory
It's probably best to encourage people start out in the right direction. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -12,12 +12,13 @@ using System.Threading;
|
||||
using System.IO.Pipes;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace DemoUI
|
||||
{
|
||||
public partial class MainWindow : Form
|
||||
{
|
||||
private static readonly string userDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
||||
private static readonly string userDirectory = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "Config"); //TODO: put in Program Files in real code.
|
||||
private static readonly string configFile = Path.Combine(userDirectory, "demobox.conf");
|
||||
private static readonly string logFile = Path.Combine(userDirectory, "log.bin");
|
||||
|
||||
@@ -28,15 +29,22 @@ namespace DemoUI
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
makeConfigDirectory();
|
||||
InitializeComponent();
|
||||
Application.ApplicationExit += Application_ApplicationExit;
|
||||
|
||||
try { File.Delete(logFile); } catch { }
|
||||
log = new Tunnel.Ringlogger(logFile, "GUI");
|
||||
logPrintingThread = new Thread(new ThreadStart(tailLog));
|
||||
transferUpdateThread = new Thread(new ThreadStart(tailTransfer));
|
||||
}
|
||||
|
||||
private void makeConfigDirectory()
|
||||
{
|
||||
var ds = new DirectorySecurity();
|
||||
ds.SetSecurityDescriptorSddlForm("O:BAG:BAD:PAI(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)");
|
||||
FileSystemAclExtensions.CreateDirectory(ds, userDirectory);
|
||||
}
|
||||
|
||||
private void tailLog()
|
||||
{
|
||||
var cursor = Tunnel.Ringlogger.CursorAll;
|
||||
|
||||
Reference in New Issue
Block a user