From 06ca24e8e2b663842fee7daabac4a2652da5a834 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 21 Jan 2014 09:18:12 -0800 Subject: More work on Windows service, cleanup. --- ext/bin/devcon/devcon32.exe | Bin 78336 -> 0 bytes ext/bin/devcon/devcon64.exe | Bin 82432 -> 0 bytes ext/bin/devcon/devcon_x64.exe | Bin 0 -> 82432 bytes ext/bin/devcon/devcon_x86.exe | Bin 0 -> 78336 bytes windows/ZeroTierOneService/Service.cs | 36 ++++++++++++++++++++++++++++++---- 5 files changed, 32 insertions(+), 4 deletions(-) delete mode 100644 ext/bin/devcon/devcon32.exe delete mode 100644 ext/bin/devcon/devcon64.exe create mode 100644 ext/bin/devcon/devcon_x64.exe create mode 100644 ext/bin/devcon/devcon_x86.exe diff --git a/ext/bin/devcon/devcon32.exe b/ext/bin/devcon/devcon32.exe deleted file mode 100644 index 2d909d6e..00000000 Binary files a/ext/bin/devcon/devcon32.exe and /dev/null differ diff --git a/ext/bin/devcon/devcon64.exe b/ext/bin/devcon/devcon64.exe deleted file mode 100644 index 239b2dec..00000000 Binary files a/ext/bin/devcon/devcon64.exe and /dev/null differ diff --git a/ext/bin/devcon/devcon_x64.exe b/ext/bin/devcon/devcon_x64.exe new file mode 100644 index 00000000..239b2dec Binary files /dev/null and b/ext/bin/devcon/devcon_x64.exe differ diff --git a/ext/bin/devcon/devcon_x86.exe b/ext/bin/devcon/devcon_x86.exe new file mode 100644 index 00000000..2d909d6e Binary files /dev/null and b/ext/bin/devcon/devcon_x86.exe differ diff --git a/windows/ZeroTierOneService/Service.cs b/windows/ZeroTierOneService/Service.cs index 4cfde803..f706802a 100644 --- a/windows/ZeroTierOneService/Service.cs +++ b/windows/ZeroTierOneService/Service.cs @@ -1,12 +1,9 @@ using System; +using System.IO; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Diagnostics; -using System.Linq; using System.ServiceProcess; -using System.Text; -using System.Threading.Tasks; namespace ZeroTierOneService { @@ -15,14 +12,45 @@ namespace ZeroTierOneService public Service() { InitializeComponent(); + + this.ztHome = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + "ZeroTier" + Path.DirectorySeparatorChar + "One"; + this.ztUpdatesFolder = this.ztHome + Path.DirectorySeparatorChar + "updates.d"; + this.ztBinary = this.ztHome + Path.DirectorySeparatorChar + (Environment.Is64BitOperatingSystem ? "zerotier-one_x64.exe" : "zerotier-one_x86.exe"); + + this.ztService = null; } protected override void OnStart(string[] args) { + startZeroTierService(); } protected override void OnStop() { + stopZeroTierService(); } + + private void startZeroTierService() + { + } + + private void stopZeroTierService() + { + if (ztService != null) + { + ztService.Kill(); + ztService = null; + } + } + + private void ztService_Exited(object sender, System.EventArgs e) + { + } + + private string ztHome; + private string ztUpdatesFolder; + private string ztBinary; + + private Process ztService; } } -- cgit v1.2.3