diff --git a/Windows/Windows Service Readme.txt b/Windows/Windows Service Readme.txt new file mode 100644 index 0000000..5feeb53 --- /dev/null +++ b/Windows/Windows Service Readme.txt @@ -0,0 +1,36 @@ +----------------------------------- +Windows noVNC Websockify Service +----------------------------------- + +The "noVNC Websocket Service.exe" file is a windows service wrapper created with Visual Studio 2010 to create a windows service to start stop the noVNC Websocket Server. All files used to create the wrapper can be found in 'noVNC Websocket Service Project' folder. + +--------------------------- +Installation +--------------------------- + +1. This service requires websockify.exe be in the same directory. Instructions on how to compile websockify python script as a windows executable can be found here: +https://github.com/kanaka/noVNC/wiki/Compiling-Websockify-to-Windows-Executable + +2.To add this service to a Windows PC you need to run the commandline as administrator and then run this line: + +sc create "noVNC Websocket Server" binPath= "PATH TO noVNC eg C:\noVNC\utils\Windows\Websocket Service.exe" DisplayName= "noVNC Websocket Server" + +3 .Once this is run you will be able to access the service via Control Panel > Admin Tools > Services. In here you can specify whether you want the service to run automatically and start at stop the service. + +--------------------------- +Configuration +--------------------------- +The file noVNCConfig.ini must be in the same directory as "noVNC Websocket Service.exe". + +This file contains a single line which is the websockify.exe statup arguements. An example is: +192.168.0.1:5901 192.168.0.1:5900 + +All websockify supported arguements will work if added here. + +--------------------------- +Deletion +--------------------------- + +You can delete the service at any time by running the commandline as admin and using this command: +sc delete "noVNC Websocket Server". + diff --git a/Windows/noVNC Websocket Service Project/Program.cs b/Windows/noVNC Websocket Service Project/Program.cs new file mode 100644 index 0000000..2d07c33 --- /dev/null +++ b/Windows/noVNC Websocket Service Project/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceProcess; +using System.Text; + +namespace MELT_Command_Websocket +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main() + { + ServiceBase[] ServicesToRun; + ServicesToRun = new ServiceBase[] + { + new Service1() + }; + ServiceBase.Run(ServicesToRun); + } + } +} diff --git a/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs b/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs new file mode 100644 index 0000000..3dab5bb --- /dev/null +++ b/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs @@ -0,0 +1,61 @@ +namespace MELT_Command_Websocket +{ + partial class ProjectInstaller + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); + this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); + // + // serviceProcessInstaller1 + // + this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.NetworkService; + this.serviceProcessInstaller1.Installers.AddRange(new System.Configuration.Install.Installer[] { + this.serviceInstaller1}); + this.serviceProcessInstaller1.Password = null; + this.serviceProcessInstaller1.Username = null; + // + // serviceInstaller1 + // + this.serviceInstaller1.Description = "noVNC Websocket Service"; + this.serviceInstaller1.DisplayName = "noVNC Websocket Service"; + this.serviceInstaller1.ServiceName = "noVNC Websocket Service"; + this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; + // + // ProjectInstaller + // + this.Installers.AddRange(new System.Configuration.Install.Installer[] { + this.serviceProcessInstaller1}); + + } + + #endregion + + private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; + private System.ServiceProcess.ServiceInstaller serviceInstaller1; + } +} \ No newline at end of file diff --git a/Windows/noVNC Websocket Service Project/ProjectInstaller.cs b/Windows/noVNC Websocket Service Project/ProjectInstaller.cs new file mode 100644 index 0000000..783bb15 --- /dev/null +++ b/Windows/noVNC Websocket Service Project/ProjectInstaller.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration.Install; +using System.Linq; + + +namespace MELT_Command_Websocket +{ + [RunInstaller(true)] + public partial class ProjectInstaller : System.Configuration.Install.Installer + { + public ProjectInstaller() + { + InitializeComponent(); + } + } +} diff --git a/Windows/noVNC Websocket Service Project/ProjectInstaller.resx b/Windows/noVNC Websocket Service Project/ProjectInstaller.resx new file mode 100644 index 0000000..fbda1ae --- /dev/null +++ b/Windows/noVNC Websocket Service Project/ProjectInstaller.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 56 + + + 196, 17 + + + False + + \ No newline at end of file diff --git a/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs b/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..832319e --- /dev/null +++ b/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MELT Command Websocket")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("MELT Command Websocket")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5ab831cb-6852-4ce1-849c-b26725b0e10b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Windows/noVNC Websocket Service Project/Service1.Designer.cs b/Windows/noVNC Websocket Service Project/Service1.Designer.cs new file mode 100644 index 0000000..c569eca --- /dev/null +++ b/Windows/noVNC Websocket Service Project/Service1.Designer.cs @@ -0,0 +1,37 @@ +namespace MELT_Command_Websocket +{ + partial class Service1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.ServiceName = "Service1"; + } + + #endregion + } +} diff --git a/Windows/noVNC Websocket Service Project/Service1.cs b/Windows/noVNC Websocket Service Project/Service1.cs new file mode 100644 index 0000000..ce94bf6 --- /dev/null +++ b/Windows/noVNC Websocket Service Project/Service1.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Linq; +using System.ServiceProcess; +using System.Text; +using System.IO; + +namespace MELT_Command_Websocket +{ + public partial class Service1 : ServiceBase + { + Process websockify; + public Service1() + { + InitializeComponent(); + } + + protected override void OnStart(string[] args) + { + + string configpath = AppDomain.CurrentDomain.BaseDirectory + "\\noVNCConfig.ini"; + string sockifypath = AppDomain.CurrentDomain.BaseDirectory + "\\websockify.exe"; + //Load commandline arguements from config file. + StreamReader streamReader = new StreamReader(configpath); + string arguements = streamReader.ReadLine(); + streamReader.Close(); + + //Start websockify. + websockify = System.Diagnostics.Process.Start(sockifypath, arguements); + } + + protected override void OnStop() + { + //Service stopped. Close websockify. + websockify.Kill(); + } + } +} diff --git a/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj b/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj new file mode 100644 index 0000000..368d183 --- /dev/null +++ b/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj @@ -0,0 +1,75 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {6B86AE7B-6BBD-4E74-8802-5995E8B6D27D} + WinExe + Properties + noVNC_Websocket_Service + noVNC Websocket Service + v3.5 + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + Component + + + ProjectInstaller.cs + + + Component + + + Service1.cs + + + + + + + ProjectInstaller.cs + + + + + \ No newline at end of file diff --git a/Windows/noVNC Websocket Service Project/noVNC Websocket.sln b/Windows/noVNC Websocket Service Project/noVNC Websocket.sln new file mode 100644 index 0000000..140de1b --- /dev/null +++ b/Windows/noVNC Websocket Service Project/noVNC Websocket.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "noVNC Websocket", "noVNC Websocket.csproj", "{6B86AE7B-6BBD-4E74-8802-5995E8B6D27D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6B86AE7B-6BBD-4E74-8802-5995E8B6D27D}.Debug|x86.ActiveCfg = Debug|x86 + {6B86AE7B-6BBD-4E74-8802-5995E8B6D27D}.Debug|x86.Build.0 = Debug|x86 + {6B86AE7B-6BBD-4E74-8802-5995E8B6D27D}.Release|x86.ActiveCfg = Release|x86 + {6B86AE7B-6BBD-4E74-8802-5995E8B6D27D}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Windows/noVNC Websocket Service Project/noVNC Websocket.suo b/Windows/noVNC Websocket Service Project/noVNC Websocket.suo new file mode 100644 index 0000000..b41b424 Binary files /dev/null and b/Windows/noVNC Websocket Service Project/noVNC Websocket.suo differ diff --git a/Windows/noVNC Websocket Service Project/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Windows/noVNC Websocket Service Project/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..10b8985 Binary files /dev/null and b/Windows/noVNC Websocket Service Project/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT Command Websocket.csproj.FileListAbsolute.txt b/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT Command Websocket.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ba42705 --- /dev/null +++ b/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT Command Websocket.csproj.FileListAbsolute.txt @@ -0,0 +1,8 @@ +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\bin\Debug\MELT Command Websocket.exe +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\bin\Debug\MELT Command Websocket.pdb +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\ResolveAssemblyReference.cache +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\MELT_Command_Websocket.ProjectInstaller.resources +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\ResGen.read.1.tlog +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\ResGen.write.1.tlog +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\MELT Command Websocket.exe +c:\users\gordoncj\documents\visual studio 2010\Projects\MELT Command Websocket\MELT Command Websocket\obj\x86\Debug\MELT Command Websocket.pdb diff --git a/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT_Command_Websocket.ProjectInstaller.resources b/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT_Command_Websocket.ProjectInstaller.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/Windows/noVNC Websocket Service Project/obj/x86/Debug/MELT_Command_Websocket.ProjectInstaller.resources differ diff --git a/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.read.1.tlog b/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.read.1.tlog new file mode 100644 index 0000000..d017eb8 Binary files /dev/null and b/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.read.1.tlog differ diff --git a/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.write.1.tlog b/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.write.1.tlog new file mode 100644 index 0000000..7affad4 Binary files /dev/null and b/Windows/noVNC Websocket Service Project/obj/x86/Debug/ResGen.write.1.tlog differ