removing old splash, adding new XCP-ng splash from Cocoon (Thanks!)

(cherry picked from commit 445d838c71)
This commit is contained in:
Alexander Schulz 2019-05-11 17:32:10 +02:00
parent 5b81c8d027
commit edab306139
38 changed files with 947 additions and 1182 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 451 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -32,7 +32,7 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "installer-xcp-ng", "install
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xe", "xe\Xe.csproj", "{727E885D-14BE-40F0-9D0B-3853D44D3984}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "splash-xcp-ng", "..\xcpng.splash\splash-xcp-ng\splash-xcp-ng.csproj", "{CD563857-6159-4415-B7B2-A21991F572E3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "splash-xcp-ng", "splash-xcp-ng\splash-xcp-ng.csproj", "{CD563857-6159-4415-B7B2-A21991F572E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -43,7 +43,7 @@
<Content Include="license.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\xcpng.splash\splash-xcp-ng\splash-xcp-ng.csproj">
<ProjectReference Include="..\splash-xcp-ng\splash-xcp-ng.csproj">
<Name>splash-xcp-ng</Name>
<Project>{cd563857-6159-4415-b7b2-a21991f572e3}</Project>
<Private>True</Private>
@ -51,6 +51,14 @@
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\xe\Xe.csproj">
<Name>Xe</Name>
<Project>{727e885d-14be-40f0-9d0b-3853d44d3984}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />

6
splash-xcp-ng/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

69
splash-xcp-ng/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,69 @@
namespace splash_xcp_ng
{
partial class Form1
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelVersion = new System.Windows.Forms.Label();
this.panelMain = new System.Windows.Forms.Panel();
this.panelMain.SuspendLayout();
this.SuspendLayout();
//
// labelVersion
//
this.labelVersion.AutoSize = true;
this.labelVersion.BackColor = System.Drawing.Color.Transparent;
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Bottom;
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelVersion.Location = new System.Drawing.Point(10, 531);
this.labelVersion.Margin = new System.Windows.Forms.Padding(0);
this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(0, 13);
this.labelVersion.TabIndex = 0;
//
// panelMain
//
this.panelMain.AutoSize = true;
this.panelMain.BackColor = System.Drawing.Color.Transparent;
this.panelMain.Controls.Add(this.labelVersion);
this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelMain.Location = new System.Drawing.Point(0, 0);
this.panelMain.Margin = new System.Windows.Forms.Padding(0);
this.panelMain.Name = "panelMain";
this.panelMain.Padding = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.panelMain.Size = new System.Drawing.Size(800, 554);
this.panelMain.TabIndex = 1;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 554);
this.Controls.Add(this.panelMain);
this.Font = new System.Drawing.Font("Arial Narrow", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "Form1";
this.Text = "XCP-ng Center Launcher";
this.Shown += new System.EventHandler(this.Form1_Shown);
this.panelMain.ResumeLayout(false);
this.panelMain.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Panel panelMain;
}
}

101
splash-xcp-ng/Form1.cs Normal file
View File

@ -0,0 +1,101 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace splash_xcp_ng
{
public partial class Form1 : Form
{
private System.IO.Stream stream;
private System.Reflection.Assembly assembly;
const string exe = "XenCenterMain.exe";
Version AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string ProductVersion = System.Windows.Forms.Application.ProductVersion;
private BackgroundWorker bworker = new BackgroundWorker();
private ProcessStartInfo startInfo = new ProcessStartInfo();
private Process proc;
public Form1()
{
InitializeComponent();
Style();
}
private void Form1_Shown(object sender, EventArgs e)
{
Application.DoEvents();
Launch();
}
private void Style()
{
labelVersion.Text = ProductVersion + " (" + AssemblyVersion + ")";
Image bitmap;
assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath);
stream = assembly.GetManifestResourceStream("splash_xcp_ng.Resources.splash.bmp");
bitmap = Image.FromStream(stream);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
this.BackgroundImage = bitmap;
this.BackgroundImageLayout = ImageLayout.Stretch;
this.Width = bitmap.Width;
this.Height = bitmap.Height;
this.CenterToScreen();
}
private void Launch()
{
if (!File.Exists(exe))
{
MessageBox.Show("[ERROR] Application not found: " + exe);
Exit();
return;
}
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = exe;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = String.Empty;
bworker.WorkerSupportsCancellation = true;
bworker.DoWork += new DoWorkEventHandler(Start);
bworker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bworkerCompleted);
bworker.RunWorkerAsync();
//FixMe: Add some safty counter to exit if something goes wrong
while (proc == null || string.IsNullOrEmpty(proc.MainWindowTitle))
{
System.Threading.Thread.Sleep(100);
if(proc != null) proc.Refresh();
}
Exit();
}
private void Start(object sender, DoWorkEventArgs e)
{
proc = Process.Start(startInfo);
}
private void bworkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
}
private void Exit()
{
if (bworker != null && bworker.WorkerSupportsCancellation) bworker.CancelAsync();
System.Environment.Exit(1);
}
}
}

120
splash-xcp-ng/Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

16
splash-xcp-ng/Program.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Windows.Forms;
namespace splash_xcp_ng
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SplashForm());
}
}
}

View File

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
//FixMe: insert Branding
[assembly: AssemblyTitle("[XenCenter] Splash")]
[assembly: AssemblyDescription("XCP-ng Center Launcher")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("[Citrix]")]
[assembly: AssemblyProduct("[XenCenter]")]
[assembly: AssemblyCopyright("[BRANDING_COPYRIGHT]")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("cd563857-6159-4415-b7b2-a21991f572e3")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0000")]
[assembly: AssemblyInformationalVersion("[BRANDING_PRODUCT_VERSION]")]

View File

@ -0,0 +1,37 @@
namespace splash_xcp_ng.Properties {
using System;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("splash_xcp_ng.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,18 @@
namespace splash_xcp_ng.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

69
splash-xcp-ng/SplashForm.Designer.cs generated Normal file
View File

@ -0,0 +1,69 @@
namespace splash_xcp_ng
{
partial class SplashForm
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelVersion = new System.Windows.Forms.Label();
this.panelMain = new System.Windows.Forms.Panel();
this.panelMain.SuspendLayout();
this.SuspendLayout();
//
// labelVersion
//
this.labelVersion.AutoSize = true;
this.labelVersion.BackColor = System.Drawing.Color.Transparent;
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Bottom;
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelVersion.Location = new System.Drawing.Point(10, 531);
this.labelVersion.Margin = new System.Windows.Forms.Padding(0);
this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(0, 13);
this.labelVersion.TabIndex = 0;
//
// panelMain
//
this.panelMain.AutoSize = true;
this.panelMain.BackColor = System.Drawing.Color.Transparent;
this.panelMain.Controls.Add(this.labelVersion);
this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelMain.Location = new System.Drawing.Point(0, 0);
this.panelMain.Margin = new System.Windows.Forms.Padding(0);
this.panelMain.Name = "panelMain";
this.panelMain.Padding = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.panelMain.Size = new System.Drawing.Size(800, 554);
this.panelMain.TabIndex = 1;
//
// SplashForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 554);
this.Controls.Add(this.panelMain);
this.Font = new System.Drawing.Font("Arial Narrow", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "SplashForm";
this.Text = "XCP-ng Center Launcher";
this.Shown += new System.EventHandler(this.Form1_Shown);
this.panelMain.ResumeLayout(false);
this.panelMain.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Panel panelMain;
}
}

137
splash-xcp-ng/SplashForm.cs Normal file
View File

@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace splash_xcp_ng
{
public partial class SplashForm : Form
{
private System.IO.Stream stream;
private System.Reflection.Assembly assembly;
const string exe = "XenCenterMain.exe";
private string exeFullPath = string.Empty;
private string appdir = string.Empty;
Version AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string ProductVersion = System.Windows.Forms.Application.ProductVersion;
private BackgroundWorker bworker = new BackgroundWorker();
private ProcessStartInfo startInfo = new ProcessStartInfo();
private Process proc;
public SplashForm()
{
InitializeComponent();
Style();
}
private void Form1_Shown(object sender, EventArgs e)
{
Application.DoEvents();
Launch();
}
private void Style()
{
labelVersion.Text = ProductVersion + " (" + AssemblyVersion + ")";
Image bitmap;
assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath);
stream = assembly.GetManifestResourceStream("splash_xcp_ng.Resources.splash.bmp");
bitmap = Image.FromStream(stream);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
this.BackgroundImage = bitmap;
this.BackgroundImageLayout = ImageLayout.Stretch;
this.Width = bitmap.Width;
this.Height = bitmap.Height;
this.CenterToScreen();
}
private void Launch()
{
appdir = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
exeFullPath = Path.Combine(appdir, exe);
if (!File.Exists(exeFullPath))
{
MessageBox.Show("[ERROR] Application not found: " + Environment.NewLine + exeFullPath);
Exit();
return;
}
#region Arguments
// test for agruments: "XCP-ng Center.exe" messageboxtest
string arguments = String.Empty;
string[] args = Environment.GetCommandLineArgs();
if (args != null && args.Length > 0)
{
//remove first argument that always is the current
List<string> temp = new List<string>(args);
temp.RemoveAt(0);
string[] argsonly = temp.ToArray();
arguments = string.Join(" ", argsonly);
}
#endregion
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = exeFullPath;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = arguments;
startInfo.WorkingDirectory = appdir;
bworker.WorkerSupportsCancellation = true;
bworker.DoWork += new DoWorkEventHandler(Start);
bworker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bworkerCompleted);
bworker.RunWorkerAsync();
//safty counter to exit if something goes wrong
int timeoutSeconds = 60;
int sleepMilliseconds = 100;
int max = timeoutSeconds * 1000;
int counter = 0;
while (proc == null || string.IsNullOrEmpty(proc.MainWindowTitle))
{
System.Threading.Thread.Sleep(sleepMilliseconds);
if(proc != null) proc.Refresh();
counter++;
if ((counter * sleepMilliseconds) >= max) break;
}
Exit();
}
private void Start(object sender, DoWorkEventArgs e)
{
proc = Process.Start(startInfo);
}
private void bworkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
}
private void Exit()
{
if (bworker != null && bworker.WorkerSupportsCancellation) bworker.CancelAsync();
System.Environment.Exit(1);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CD563857-6159-4415-B7B2-A21991F572E3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>splash_xcp_ng</RootNamespace>
<AssemblyName>XCP-ng Center</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\AppIcon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SplashForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SplashForm.Designer.cs">
<DependentUpon>SplashForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="SplashForm.resx">
<DependentUpon>SplashForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\splash.bmp" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AppIcon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XenAdmin\XenAdmin.csproj">
<Project>{70bda4bc-f062-4302-8acd-a15d8bf31d65}</Project>
<Name>XenAdmin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,473 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* main.cpp
*
* Loads a splash screen bitmap from the resources built into the
* executable. Writes the current XenCenter version numbers onto
* the bitmap, and displays it on screen. Waits for a message
* from XenCenter, and then quits. Also monitors the XenCenter
* process, and quits if it dies (in case XenCenter crashes
* before sending the message).
*
* Parts of code taken from msdn.
*/
// Disable deprecation warnings in the CRT
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <iostream>
#include <sstream>
#include <Tchar.h>
#include <strsafe.h>
#include <vector>
#include <Lmcons.h>
#include <fstream>
#include <ctime>
#include "resource.h"
#include "util.h"
using namespace std;
// Our own made-up IDs for timers
const int ShortTimerId = 1;
const int LongTimerId = 2;
const int ShortTimerInterval = 100;
// How long to wait for XenCenterMain to start
const int LongTimerInterval = 30000;
const int PipeTimeout = 60 * 1000;
// How long the splash should try to acquire the splashscreen lock for
const int SplashLockMaxWait = 60000;
// How many ms the splash screen should wait between attempts
const int SplashLockSleepInterval = 250;
// Size of the splash bitmap
const int ImageSizeX = 415;
const int ImageSizeY = 217;
const TCHAR SplashClassName[] = TEXT("XenCenterSplash0001");
const TCHAR PipeStub[] = TEXT("\\\\.\\pipe\\XenCenter-");
const TCHAR SplashPipeStub[] = TEXT("\\\\.\\pipe\\XenCenterSplash-");
// The path to the main C# XenCenter exe, relative to the location of the splash exe.
const TCHAR XenCenterPath[] = TEXT("XenCenterMain.exe");
const size_t PathLen = 17;
#ifdef _DEBUG
const TCHAR ProductVersion[] = TEXT("0.0");
const TCHAR ProductBuild[] = TEXT("0000");
#else
const TCHAR ProductVersion[] = TEXT("[BRANDING_PRODUCT_VERSION]");
const TCHAR ProductBuild[] = TEXT("@BUILD_NUMBER@");
#endif
// The in-memory Device Context
HDC memdc;
PROCESS_INFORMATION pi;
static wstring PipeName(const TCHAR * stub, wstring mainExePath)
{
// Replace '\' with '-' in mainExePath
wstring sanitizedMainExePath(mainExePath);
{
size_t index = sanitizedMainExePath.npos;
while ((index = sanitizedMainExePath.find('\\', 0)) != sanitizedMainExePath.npos)
{
sanitizedMainExePath.replace(index, 1, 1, '-');
}
}
DWORD tmp = UNLEN + 1;
TCHAR UserName[UNLEN + 1];
GetUserName(UserName, &tmp);
DWORD pid = GetCurrentProcessId();
DWORD sid = 0;
if (0 == ProcessIdToSessionId(pid, &sid))
{
// Ignore error and force sid to 0.
sid = 0;
}
wostringstream SplashPipePath;
SplashPipePath << stub << sid << '-' << UserName << '-' << sanitizedMainExePath;
wstring s = SplashPipePath.str();
// Max length of named pipe name string is 256 chars
if (s.length() > 256)
{
s.resize(256);
}
return s;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
// Hide the window - will happen anyway if we exit, but not until
// after XenCenterMain exits if --wait was specified.
ShowWindow(hwnd, SW_HIDE);
// Line below sends a WM_QUIT message to this thread
PostQuitMessage(0);
break;
case WM_LBUTTONDOWN:
ShowWindow(hwnd, SW_HIDE);
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC screendc = BeginPaint(hwnd, &ps);
BitBlt(screendc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom,
memdc, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
EndPaint(hwnd, &ps);
}
break;
case WM_TIMER:
{
switch (wParam)
{
case ShortTimerId:
if (WaitForSingleObject(pi.hProcess, 0) != WAIT_TIMEOUT)
{
// XenCenter has closed (e.g. crashed) without killing the splash screen: exit.
KillTimer(hwnd, ShortTimerId);
DestroyWindow(hwnd);
}
else
{
// Poll again later
SetTimer(hwnd, ShortTimerId, ShortTimerInterval, NULL);
}
break;
case LongTimerId:
// We've been open too long: close even though we haven't heard from XenCenter
DestroyWindow(hwnd);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
// Record if an error that doesn't prevent us launching XenCenterMain has occurred.
// If set to true, we write the splash log to file and launch XenCenterMain, even
// if the splash screen locking or named pipe argument passing have failed.
bool nonCriticalError = false;
// Open logging output stream. The accumulated contents of this stream are written
// to a log file only in the event of an ErrorExit.
wostringstream logStream;
time_t rawtime = time(NULL);
if (rawtime > -1)
{
logStream << TEXT("splash .exe started at ") << ctime(&rawtime) << endl;
}
else
{
logStream << TEXT("WARNING: time() returned -1") << endl;
}
// Get the full path to the splash exe
const size_t pathBufSize = 128 * 1024;
wchar_t splashExePath[pathBufSize];
DWORD pathLen = GetModuleFileName(NULL, splashExePath, pathBufSize);
if (pathLen == 0 || pathLen == pathBufSize)
{
ErrorExit(logStream, TEXT("GetModuleFileName"), true);
}
logStream << TEXT("splashExePath: ") << splashExePath << endl;
// Now work out the path to the main exe
wstring mainExePath(splashExePath);
{
size_t index = mainExePath.find_last_of('\\', pathLen);
if (index != mainExePath.npos)
{
mainExePath.resize(index);
mainExePath.push_back('\\');
}
mainExePath.append(XenCenterPath);
}
logStream << TEXT("mainExePath: ") << mainExePath << endl;
// Acquire splash screen lock
HANDLE splashPipeHandle = INVALID_HANDLE_VALUE;
{
wstring s = PipeName(SplashPipeStub, mainExePath);
logStream << "Attempting to acquire splash screen lock: " << s.c_str() << endl;
for (int numTries = 0; numTries * SplashLockSleepInterval < SplashLockMaxWait; numTries++)
{
splashPipeHandle = CreateNamedPipe(s.c_str(),
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 0, 0, 0, NULL);
if (splashPipeHandle == INVALID_HANDLE_VALUE)
{
DWORD lastError = GetLastError();
if (lastError == ERROR_ACCESS_DENIED)
{
// Pipe in use. Sleep and retry.
Sleep(SplashLockSleepInterval);
}
else
{
// Unexpected error code
logStream << "WARNING: CreateNamedPipe failed with unexpected error. Error code: " << GetLastError() << endl;
nonCriticalError = true;
}
}
else
{
// We have acquired the lock
logStream << "Acquired splash screen lock" << endl;
break;
}
}
if (splashPipeHandle == INVALID_HANDLE_VALUE)
{
// Maximum attempts reached without success. Exit.
logStream << "WARNING: Couldn't acquire splash screen lock before timeout." << endl;
nonCriticalError = true;
}
}
// First try to pass the cmd line arguments into the named pipe
{
wstring s = PipeName(PipeStub, mainExePath);
logStream << TEXT("Pipe path 's': ") << s << endl;
// Allocate a buffer for data sent to us through the pipe.
// (Should never actually be any, but the command needs a buffer param anyway)
const int dataOutLength = 64 * 1024;
LPVOID dataOut = malloc(dataOutLength);
if (dataOut == NULL)
{
logStream << TEXT("WARNING: malloc dataOut failed. Error code: ") << GetLastError() << endl;
nonCriticalError = true;
}
DWORD bytesRead;
if (!CallNamedPipe(s.c_str(), lpCmdLine, (DWORD)_tcslen(lpCmdLine) * sizeof(TCHAR), dataOut, dataOutLength, &bytesRead, PipeTimeout))
{
DWORD lastError = GetLastError();
if (lastError == ERROR_FILE_NOT_FOUND)
{
logStream << TEXT("CallNamedPipe gave ERROR_FILE_NOT_FOUND: proceeding to launch XenCenter") << endl;
}
else if (lastError == ERROR_BROKEN_PIPE)
{
logStream << TEXT("CallNamedPipe gave ERROR_BROKEN_PIPE: proceeding to launch XenCenter") << endl;
}
else
{
logStream << "WARNING: CallNamedPipe failed with unexpected error. Error code: " << GetLastError() << endl;
nonCriticalError = true;
}
}
else
{
// Success: we passed the args into the pipe. Exit.
logStream << "Success: command line arguments were passed into pipe. Exiting." << endl;
exit(0);
}
free(dataOut);
}
// If we get here, sending into the pipe failed. Start XenCenter.
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
logStream << TEXT("Running CreateProcess with GetCommandLine(): ") << GetCommandLine() << endl;
if (!CreateProcess(mainExePath.c_str(), // module name
GetCommandLine(), // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
NORMAL_PRIORITY_CLASS,
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi) // Pointer to PROCESS_INFORMATION structure
)
{
ErrorExit(logStream, TEXT("CreateProcess"), true);
}
CloseHandle(pi.hThread);
if (nonCriticalError)
{
// At least we managed to launch XenCenterMain.
// Probably not appropriate to show the splash screen. Exit now.
ErrorExit(logStream, TEXT("nonCriticalError"), false);
}
// Show the splash screen. First register the window class.
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = SplashClassName;
wc.hIconSm = NULL;
if (RegisterClassEx(&wc) == NULL)
{
ErrorExit(logStream, TEXT("RegisterClassEx"), false);
}
// Get the screen (desktop) DC
HDC screendc = CreateIC(TEXT("DISPLAY"), NULL, NULL, NULL);
if (screendc == NULL)
{
ErrorExit(logStream, TEXT("CreateIC"), false);
}
// Get the primary monitor desktop size
const int screenwidth = GetSystemMetrics(SM_CXSCREEN);
const int screenheight = GetSystemMetrics(SM_CYSCREEN);
logStream << TEXT("Creating splash window") << endl;
// Create the splash window
int x = (screenwidth-ImageSizeX)/2;
int y = (screenheight-ImageSizeY)/2;
HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, SplashClassName, NULL, WS_POPUP, x, y, ImageSizeX, ImageSizeY, NULL, NULL, hInstance, NULL);
if (hwnd == NULL)
{
ErrorExit(logStream, TEXT("CreateWindowEx"), false);
}
// Load the splash bitmap from the embedded resource file
HBITMAP image = (HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
if (image == NULL)
{
ErrorExit(logStream, TEXT("LoadImage"), false);
}
// Create the in-memory Device Context
memdc = CreateCompatibleDC(screendc);
if (memdc == NULL)
{
ErrorExit(logStream, TEXT("CreateCompatibleDC(screendc)"), false);
}
// Create a DC for the splash image
HDC filedc = CreateCompatibleDC(screendc);
if (filedc == NULL)
{
ErrorExit(logStream, TEXT("CreateCompatibleDC(filedc)"), false);
}
// Blit the splash image into the memory DC
SelectObject(filedc, image);
HBITMAP bmp = CreateCompatibleBitmap(screendc, ImageSizeX, ImageSizeY);
ReleaseDC(hwnd, screendc);
SelectObject(memdc, bmp);
BitBlt(memdc, 0, 0, ImageSizeX, ImageSizeY, filedc, 0, 0, SRCCOPY);
DeleteObject(image);
DeleteDC(filedc);
logStream << TEXT("Showing splash window") << endl;
// Show the splash window
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
// Start timer to poll for XenCenter having started
SetTimer(hwnd, ShortTimerId, ShortTimerInterval, NULL);
// Start timeout timer after which splash window closes anyway
SetTimer(hwnd, LongTimerId, LongTimerInterval, NULL);
MSG msg;
// Start message loop
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (!DisconnectNamedPipe(splashPipeHandle))
{
// Irritating but non-fatal
logStream << "DisconnectNamedPipe failed with error " << GetLastError() << endl;
}
if (!CloseHandle(splashPipeHandle))
{
// Likewise
logStream << "CloseHandle failed with error " << GetLastError() << endl;
}
// Check to see if args contain '--wait': if so, wait for XenCenterMain process to exit
{
wstring args(lpCmdLine);
logStream << TEXT("args: ") << args.c_str() << endl;
if (args.find(TEXT("--wait"), 0) != args.npos)
{
logStream << TEXT("--wait detected: waiting for main XenCenter process to exit") << endl;
WaitForSingleObject(pi.hProcess, INFINITE);
logStream << TEXT("XenCenter process exited") << endl;
}
else
{
CloseHandle(pi.hProcess);
}
}
logStream << TEXT("Exiting normally") << endl;
return (int)msg.wParam;
}

View File

@ -1,48 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by splash.rc
//
#define IDB_BITMAP1 101
#define IDI_ICON1 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
uiAccess="false"
level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -1,130 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""windows.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP1 BITMAP "../Branding/Images/splash.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "../Branding/Images/AppIcon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "CompanyName", "[Citrix]"
VALUE "FileDescription", "[XenCenter]"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "[XenCenter]"
VALUE "LegalCopyright", "[BRANDING_COPYRIGHT_2]"
VALUE "OriginalFilename", "[XenCenter].exe"
VALUE "ProductName", "[Citrix] [XenCenter]"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,227 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Splash"
ProjectGUID="{AFB19C9D-DD63-478B-A4A3-8452CBD0B9AB}"
RootNamespace="test"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)XenAdmin\bin\Debug"
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\[XenCenter].exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="$(InputDir)\splash.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)XenAdmin\bin\Release"
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4995"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\[XenCenter].exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="$(InputDir)\splash.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\util.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\util.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\splash.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AFB19C9D-DD63-478B-A4A3-8452CBD0B9AB}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)XenAdmin\bin\Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)XenAdmin\bin\Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>~~XenCenter~~</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>XCP-ng Center</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\splash.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4995;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\splash.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="util.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
<CustomBuildStep Include="util.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="splash.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XenAdmin\XenAdmin.csproj">
<Project>{70bda4bc-f062-4302-8acd-a15d8bf31d65}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="splash.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<CustomBuildStep Include="util.h">
<Filter>Header Files</Filter>
</CustomBuildStep>
</ItemGroup>
</Project>

View File

@ -1,79 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <windows.h>
#include <strsafe.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <shlobj.h>
#include "util.h"
using namespace std;
void ErrorExit(wostringstream& logStream, const LPTSTR lpszFunction, bool showDialog)
{
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
// Display the error message and exit the process
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 100) * sizeof(TCHAR));
StringCchPrintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR),
TEXT("%s failed with error %d: %s Please contact your support representative."), lpszFunction, dw, lpMsgBuf);
logStream << TEXT("ErrorExit called: ") << (LPTSTR)lpDisplayBuf << endl;
// Now write logStream to file
TCHAR destBuf[MAX_PATH];
wostringstream DebugFilePath;
// Get %APPDATA% path
if (SHGetSpecialFolderPath(NULL, destBuf, CSIDL_APPDATA, 1) == TRUE)
{
DebugFilePath << destBuf << "\\[Citrix]\\[XenCenter]\\logs\\splash.log";
wofstream fileStream(DebugFilePath.str().c_str(), ios_base::out | ios_base::trunc);
fileStream << logStream.str() << endl;
}
if (showDialog)
{
// Show error to user
MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
}
LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
ExitProcess(dw);
}

View File

@ -1,42 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef UTIL_H
#define UTIL_H
#include <iostream>
#include <sstream>
using namespace std;
void ErrorExit(wostringstream& logStream, const LPTSTR lpszFunction, bool showDialog);
#endif