├── src ├── branding │ ├── branding.cs │ ├── msidiff.js │ └── WiSubStg.vbs ├── bitmaps │ ├── New.ico │ ├── Up.ico │ ├── xen.ico │ ├── DlgBmp.bmp │ ├── info.ico │ ├── BannrBmp.bmp │ ├── exclamic.ico │ ├── citrixsha1.cer │ ├── citrixsha256.cer │ └── EULA_DRIVERS.rtf ├── setup │ ├── Setup.ico │ ├── Setup.rc │ ├── Setup.h │ ├── targetver.h │ ├── Resource.h │ └── Setup.vcxproj ├── InstallAgent │ ├── PVDevice │ │ ├── XenNet.cs │ │ ├── XenVbd.cs │ │ └── XenIface.cs │ ├── ProjectInstaller.cs │ ├── InstallAgent.exe.config │ ├── InstallAgent.Designer.cs │ ├── TimeDateTraceListener.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Program.cs │ ├── ProjectInstaller.Designer.cs │ └── InstallAgent.csproj ├── qnetsettings │ ├── qnetsettings.rc │ ├── stdafx.h │ ├── qnetsettings.h │ ├── stdafx.cpp │ ├── targetver.h │ └── qnetsettings.cpp ├── xenprep │ ├── Properties │ │ ├── xen.ico │ │ └── xenprep.manifest │ ├── Xenprep.exe.config │ ├── Progress.cs │ ├── AssemblyInfo.cs │ ├── Progress.Designer.cs │ └── Xenprep.csproj ├── ManagementAgentCA │ ├── ManagementAgentCA.def │ ├── stdafx.cpp │ ├── DllMain.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── ManagementAgentCA.filters │ └── SetInitiatorSidProperty.cpp ├── installwizard │ ├── InstallGui │ │ ├── xen.ico │ │ ├── DlgBmp.bmp │ │ ├── InstallGui.exe.config │ │ └── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.resx │ ├── InstallWizard │ │ ├── xen.ico │ │ ├── InstallWizard.exe.3.5.config │ │ ├── InstallWizard.exe.4.config │ │ ├── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ └── AssemblyInfo.cs │ │ ├── InstallService.Designer.cs │ │ ├── InstallWizard.sln │ │ └── Program.cs │ └── UIEvent │ │ ├── UIEvent.exe.3.5.config │ │ ├── UIEvent.exe.4.config │ │ ├── Program.cs │ │ ├── app.manifest │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── UIEvent.csproj ├── vmcleaner │ ├── vmcleaner.exe.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Program.cs │ └── vmcleaner.csproj ├── Uninstall │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ └── Resources.Designer.cs │ ├── Program.cs │ └── Uninstall.csproj ├── uninstall │ └── Uninstall.exe.config ├── PInvokeWrap │ ├── Winbase.cs │ ├── WinError.cs │ ├── User32.cs │ ├── Kernel32.cs │ ├── NewDev.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Msi.cs │ ├── DIFxAPI.cs │ ├── Win32ErrorMessage.cs │ ├── PInvokeWrap.csproj │ ├── WinVersion.cs │ └── WtsApi32.cs ├── diagnostics │ └── CHANGELOG.txt ├── BrandSupport │ ├── BrandSupport.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── BrandSupport.csproj ├── HardwareDevice │ ├── Properties │ │ └── AssemblyInfo.cs │ └── HardwareDevice.csproj ├── HelperFunctions │ ├── Properties │ │ └── AssemblyInfo.cs │ └── HelperFunctions.csproj ├── PVDriversRemoval │ ├── Properties │ │ └── AssemblyInfo.cs │ └── PVDriversRemoval.csproj ├── netsetlib │ ├── restore.h │ ├── Save.h │ ├── log.h │ └── save.cpp ├── pescripts │ ├── AIK1.bat │ ├── AIK2.bat │ └── ADK8.bat ├── netsettings │ └── netsettings.cpp └── vss │ └── citrixvss.wxs ├── CHANGELOG ├── proj ├── qnetsettings │ ├── small.ico │ ├── resource.h │ └── qnetsettings.ico ├── msbuild.bat └── XenPrep.sln ├── INSTALL.md ├── LICENSE ├── MAINTAINERS ├── README.md ├── manifestspecific.py ├── manifestlatest.py ├── manifestspecific-inspur.py └── include └── brandcontrol.h /src/branding/branding.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | 6.2.50 (2013-06-19): 2 | * Initial public release 3 | -------------------------------------------------------------------------------- /src/bitmaps/New.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/New.ico -------------------------------------------------------------------------------- /src/bitmaps/Up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/Up.ico -------------------------------------------------------------------------------- /src/bitmaps/xen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/xen.ico -------------------------------------------------------------------------------- /src/setup/Setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/setup/Setup.ico -------------------------------------------------------------------------------- /src/setup/Setup.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/setup/Setup.rc -------------------------------------------------------------------------------- /src/bitmaps/DlgBmp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/DlgBmp.bmp -------------------------------------------------------------------------------- /src/bitmaps/info.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/info.ico -------------------------------------------------------------------------------- /src/bitmaps/BannrBmp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/BannrBmp.bmp -------------------------------------------------------------------------------- /src/bitmaps/exclamic.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/exclamic.ico -------------------------------------------------------------------------------- /proj/qnetsettings/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/proj/qnetsettings/small.ico -------------------------------------------------------------------------------- /src/bitmaps/citrixsha1.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/citrixsha1.cer -------------------------------------------------------------------------------- /proj/qnetsettings/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/proj/qnetsettings/resource.h -------------------------------------------------------------------------------- /src/InstallAgent/PVDevice/XenNet.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace PVDevice 3 | { 4 | class XenNet 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/bitmaps/citrixsha256.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/bitmaps/citrixsha256.cer -------------------------------------------------------------------------------- /src/qnetsettings/qnetsettings.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/qnetsettings/qnetsettings.rc -------------------------------------------------------------------------------- /src/xenprep/Properties/xen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/xenprep/Properties/xen.ico -------------------------------------------------------------------------------- /proj/qnetsettings/qnetsettings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/proj/qnetsettings/qnetsettings.ico -------------------------------------------------------------------------------- /src/ManagementAgentCA/ManagementAgentCA.def: -------------------------------------------------------------------------------- 1 | LIBRARY "ManagementAgentCA" 2 | 3 | EXPORTS 4 | 5 | SetInitiatorSidProperty 6 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/xen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/installwizard/InstallGui/xen.ico -------------------------------------------------------------------------------- /src/installwizard/InstallGui/DlgBmp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/installwizard/InstallGui/DlgBmp.bmp -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/xen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xenserver/win-installer/HEAD/src/installwizard/InstallWizard/xen.ico -------------------------------------------------------------------------------- /proj/msbuild.bat: -------------------------------------------------------------------------------- 1 | call "%VS%\VC\vcvarsall.bat" x86 2 | msbuild.exe /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %SOLUTION%.sln 3 | 4 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/UIEvent.exe.3.5.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/InstallWizard.exe.3.5.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/xenprep/Xenprep.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/InstallGui.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/vmcleaner/vmcleaner.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/InstallWizard.exe.4.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Uninstall/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/UIEvent.exe.4.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ManagementAgentCA.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /src/InstallAgent/ProjectInstaller.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace InstallAgent 4 | { 5 | [RunInstaller(true)] 6 | public partial class ProjectInstaller : System.Configuration.Install.Installer 7 | { 8 | public ProjectInstaller() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/uninstall/Uninstall.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/InstallAgent/InstallAgent.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/PInvokeWrap/Winbase.cs: -------------------------------------------------------------------------------- 1 | namespace PInvokeWrap 2 | { 3 | public static class Winbase 4 | { 5 | public const uint INFINITE = 0xFFFFFFFF; 6 | 7 | // CMP_WaitNoPendingInstallEvents() return values 8 | // Originally: WAIT_OBJECT_0 ... 9 | public enum WAIT : uint 10 | { 11 | OBJECT_0 = 0, 12 | TIMEOUT = 0x00000102, 13 | FAILED = 0xFFFFFFFF 14 | }; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/DllMain.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | // DllMain - Initialize and cleanup WiX custom action utils. 4 | extern "C" BOOL WINAPI DllMain( 5 | __in HINSTANCE hInst, 6 | __in ULONG ulReason, 7 | __in LPVOID 8 | ) 9 | { 10 | switch(ulReason) 11 | { 12 | case DLL_PROCESS_ATTACH: 13 | WcaGlobalInitialize(hInst); 14 | break; 15 | 16 | case DLL_PROCESS_DETACH: 17 | WcaGlobalFinalize(); 18 | break; 19 | } 20 | 21 | return TRUE; 22 | } 23 | -------------------------------------------------------------------------------- /src/qnetsettings/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | // C RunTime Header Files 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | // TODO: reference additional headers your program requires here 22 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | To install the XenServer Windows Tools Installer Packages on a Windows Guest VM 2 | 3 | * Ensure .net 3.5 or higher is installed 4 | 5 | * copy the following files to the guest VM: 6 | 7 | * * citrixguestagentx64.msi 8 | * * citrixguestagentx86.msi 9 | * * citrixvssx64.msi 10 | * * citrixvssx86.msi 11 | * * citrixxendriversx64.msi 12 | * * citrixxendriversx86.msi 13 | * * installwizard.msi 14 | 15 | * create an empty file entitled xenlegacy.exe 16 | 17 | * run installwizard.msi 18 | 19 | 20 | (Note that each of the msi files my be installed manually rather than using 21 | the installwizard if wished) 22 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | // WiX Header Files: 20 | #include 21 | 22 | 23 | // TODO: reference additional headers your program requires here 24 | -------------------------------------------------------------------------------- /src/PInvokeWrap/WinError.cs: -------------------------------------------------------------------------------- 1 | namespace PInvokeWrap 2 | { 3 | public static class WinError 4 | // The purpose of this class is to provide the system 5 | // error codes that programs explicitly need to check 6 | // for. 7 | { 8 | public const int ERROR_SUCCESS = 0; 9 | public const int ERROR_INSUFFICIENT_BUFFER = 122; 10 | public const int ERROR_NO_MORE_ITEMS = 259; 11 | public const int ERROR_SUCCESS_REBOOT_INITIATED = 1641; 12 | public const int ERROR_SUCCESS_REBOOT_REQUIRED = 3010; 13 | public const int ERROR_KEY_DOES_NOT_EXIST = -536870396; //0xe0000204 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/PInvokeWrap/User32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class User32 7 | { 8 | [Flags] 9 | public enum ExitFlags : int 10 | { 11 | EWX_LOGOFF = 0x00000000, 12 | EWX_SHUTDOWN = 0x00000001, 13 | EWX_REBOOT = 0x00000002, 14 | EWX_FORCE = 0x00000004, 15 | EWX_POWEROFF = 0x00000008, 16 | EWX_FORCEIFHUNG = 0x00000010, 17 | EWX_RESTARTAPPS = 0x00000040 18 | } 19 | 20 | [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] 21 | public static extern bool ExitWindowsEx(ExitFlags flags, int rea); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/InstallAgent/PVDevice/XenVbd.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using HelperFunctions; 3 | namespace PVDevice 4 | { 5 | class XenVbd 6 | { 7 | public static bool IsFunctioning(out bool bNeedReinstall) 8 | { 9 | bNeedReinstall = false; 10 | if (!Helpers.IsServiceRunning("xenvbd")) 11 | { 12 | bNeedReinstall = true; 13 | return false; 14 | } 15 | 16 | if (PVDevice.NeedsReboot("xenvbd")) 17 | { 18 | Trace.WriteLine("VBD: needs reboot"); 19 | return false; 20 | } 21 | 22 | Trace.WriteLine("VBD: device installed"); 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/diagnostics/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | 14 August 2015 - Added Windows Server 2012 to version list 2 | 17 August 2015 - Bugfix to correct copy of programfiles and programdata into ZIP 3 | 20 August 2015 - Added Registry collection, modified log file copy to include installer directory and 32-bit and 64-bit directories 4 | 27 August 2015 - Added Windows Server 2008 and modified copy command for programdata folder 5 | 11 September 2015 - Added manifest.xml for Citrix Insight Services 6 | integration. Added and modified time stamping to avoid localization issues and support the manifest.xml addition 7 | 9 November 2015 - Improved ZIP creation process. Improved clean up process. Added ISO of the BAT file to make it easier to distribute to multiple VM's 8 | 7 December 2015 - v1.6 Added Windows 10 support 9 | 25 January 2016 - v1.7 Added License to script 10 | -------------------------------------------------------------------------------- /src/PInvokeWrap/Kernel32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class Kernel32 7 | { 8 | [DllImport("kernel32.dll")] 9 | public static extern IntPtr GetCurrentProcess(); 10 | 11 | [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] 12 | public static extern IntPtr GetProcAddress( 13 | IntPtr hModule, 14 | [MarshalAs(UnmanagedType.LPStr)]string procName 15 | ); 16 | 17 | [DllImport("kernel32.dll", CharSet = CharSet.Auto)] 18 | public static extern IntPtr GetModuleHandle(string moduleName); 19 | 20 | [DllImport("kernel32.dll", SetLastError = true)] 21 | public static extern bool CloseHandle(IntPtr hObject); 22 | 23 | [DllImport("kernel32.dll")] 24 | public static extern IntPtr LocalFree(IntPtr hMem); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /proj/XenPrep.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xenprep", "..\src\xenprep\Xenprep.csproj", "{17BDA712-F12F-4EF9-85E2-C20B25BD86AC}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {17BDA712-F12F-4EF9-85E2-C20B25BD86AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {17BDA712-F12F-4EF9-85E2-C20B25BD86AC}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {17BDA712-F12F-4EF9-85E2-C20B25BD86AC}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {17BDA712-F12F-4EF9-85E2-C20B25BD86AC}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/branding/msidiff.js: -------------------------------------------------------------------------------- 1 | WScript.echo("HELLO"); 2 | if (WScript.Arguments.Length != 3) { 3 | WScript.echo("// MsiDiff.js"); 4 | WScript.echo("// Usage: MsiDiff.js base.msi target.msi diff.mst"); 5 | WScript.quit(0); 6 | } 7 | try { 8 | var installerObj = new ActiveXObject("WindowsInstaller.Installer"); 9 | var baseDatabase = installerObj.OpenDatabase(WScript.Arguments.Item(0), 0); 10 | var targetDatabase = installerObj.OpenDatabase(WScript.Arguments.Item(1), 0); 11 | 12 | WScript.echo("HELLO 2"); 13 | e = targetDatabase.GenerateTransform(baseDatabase, WScript.Arguments.Item(2)); 14 | WScript.echo("e is "+e); 15 | e = targetDatabase.CreateTransformSummaryInfo(baseDatabase, WScript.Arguments.Item(2), 0, 0); 16 | WScript.echo("new e is "+e); 17 | } catch (ex) { 18 | try { // for cscript.exe only; not for wscript.exe 19 | WScript.StdErr.WriteLine("Error : " + ex.number + " : " + ex.description); 20 | } catch (ex2) { /* exception on wscript.exe; keep quiet to avoid pop up error dialogs */ } 21 | } 22 | -------------------------------------------------------------------------------- /src/xenprep/Progress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Runtime.InteropServices; 10 | 11 | namespace Xenprep 12 | { 13 | public partial class Progress : Form 14 | { 15 | public Progress() 16 | { 17 | InitializeComponent(); 18 | progressBar.Maximum = 100; 19 | progressBar.Minimum = 0; 20 | progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 21 | } 22 | 23 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 24 | static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr w, IntPtr l); 25 | public void SetRed() 26 | { 27 | progressBar.Invoke((MethodInvoker)(() => 28 | { 29 | SendMessage(progressBar.Handle, 1040, (IntPtr)2, IntPtr.Zero); 30 | progressBar.Value = 100; 31 | })); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/BrandSupport/BrandSupport.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Reflection; 6 | using System.Resources; 7 | using System.Diagnostics; 8 | 9 | namespace BrandSupport 10 | { 11 | public class BrandingControl 12 | { 13 | private ResourceManager resources; 14 | 15 | public BrandingControl(string path) 16 | { 17 | Assembly sat = Assembly.LoadFile(path); 18 | resources = new ResourceManager("textstrings", sat); 19 | Trace.WriteLine("Resource manager created"); 20 | } 21 | 22 | public string getString(string key) 23 | { 24 | try 25 | { 26 | string res = this.resources.GetString(key); 27 | Trace.WriteLine(key + ":" + res); 28 | return res; 29 | } 30 | catch (Exception e) 31 | { 32 | Trace.WriteLine("Unknown Branding : " + key); 33 | Trace.WriteLine(e.ToString()); 34 | return "Unknown Branding " + key; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17020 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace InstallWizard.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17020 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace InstallGui.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Uninstall/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Uninstall.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/PInvokeWrap/NewDev.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class NewDev 7 | { 8 | // Originally: INSTALLFLAG_FORCE, ... 9 | public enum INSTALLFLAG 10 | { 11 | FORCE = 0x00000001, 12 | READONLY = 0x00000002, 13 | NONINTERACTIVE = 0x00000004, 14 | BITS = 0x00000007 15 | } 16 | 17 | [Flags] 18 | public enum DIIRFLAG 19 | { 20 | ZERO = 0x00000000, 21 | FORCE_INF = 0x00000002 22 | } 23 | 24 | [DllImport("newdev.dll", SetLastError = true)] 25 | public static extern bool UpdateDriverForPlugAndPlayDevices( 26 | IntPtr hWndParent, 27 | string hardwareId, 28 | string fullInfPath, 29 | INSTALLFLAG installFlags, 30 | out bool rebootRequired 31 | ); 32 | 33 | [DllImport("newdev.dll", SetLastError = true)] 34 | public static extern bool DiInstallDriver( 35 | IntPtr hwndParent, 36 | string FullInfPath, 37 | DIIRFLAG Flags, // either ZERO or FORCE_INF 38 | out bool NeedReboot 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/InstallAgent/InstallAgent.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace InstallAgent 2 | { 3 | partial class InstallAgent 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | components = new System.ComponentModel.Container(); 32 | this.ServiceName = "InstallAgent"; 33 | } 34 | 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/InstallAgent/TimeDateTraceListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Windows.Forms; 5 | 6 | namespace InstallAgent 7 | { 8 | class TimeDateTraceListener : TextWriterTraceListener 9 | { 10 | public TimeDateTraceListener(string file, string name) 11 | : base(file, name) 12 | { } 13 | 14 | public override void WriteLine(object o) 15 | { 16 | base.WriteLine(DateTime.Now.ToString() + ": " + o.ToString()); 17 | } 18 | public override void WriteLine(string message) 19 | { 20 | base.WriteLine(DateTime.Now.ToString() + ": " + message); 21 | } 22 | 23 | public static void Initialize(string name) 24 | // Creates a new instance of the class 25 | // and adds it to 'Trace.Listeners' 26 | { 27 | Directory.CreateDirectory(Application.CommonAppDataPath); 28 | 29 | TextWriterTraceListener tlog = new TimeDateTraceListener( 30 | Path.Combine( 31 | Application.CommonAppDataPath, 32 | name + ".log"), 33 | name + "Log" 34 | ); 35 | Trace.Listeners.Add(tlog); 36 | Trace.AutoFlush = true; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/xenprep/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Xenprep")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Citrix")] 12 | [assembly: AssemblyProduct("Xenprep")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2099bd6d-465f-4d87-976c-420a56fde5a6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | [assembly: AssemblyVersion("1.0.*")] 33 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/InstallService.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace InstallWizard 2 | { 3 | 4 | partial class InstallService 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Component Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | // 33 | // InstallService 34 | // 35 | this.CanHandlePowerEvent = true; 36 | this.CanShutdown = true; 37 | this.ServiceName = "XenInstall"; 38 | 39 | } 40 | 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Citrix Systems Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, 5 | with or without modification, are permitted provided 6 | that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above 9 | copyright notice, this list of conditions and the 10 | following disclaimer. 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the 13 | following disclaimer in the documentation and/or other 14 | materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | SUCH DAMAGE. 30 | 31 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // The following macros define the minimum required platform. The minimum required platform 4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 5 | // your application. The macros work by enabling all features available on platform versions up to and 6 | // including the version specified. 7 | 8 | // Modify the following defines if you have to target a platform prior to the ones specified below. 9 | // Refer to MSDN for the latest info on corresponding values for different platforms. 10 | #ifndef WINVER // Specifies that the minimum required platform is Windows 2000. 11 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. 12 | #endif 13 | 14 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows 2000. 15 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. 16 | #endif 17 | 18 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 5.0. 19 | #define _WIN32_IE 0x0500 // Change this to the appropriate value to target other versions of IE. 20 | #endif 21 | 22 | #ifndef _WIN32_MSI // Specifies that the minimum required MSI version is MSI 3.1 23 | #define _WIN32_MSI 310 // Change this to the appropriate value to target other versions of MSI. 24 | #endif 25 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/ManagementAgentCA.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | 34 | 35 | Source Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/PInvokeWrap/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PInvokeWrap")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("PInvokeWrap")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightPInvokeWrap)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("02593033-e3c1-47d9-99d9-f36cd4e6975f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/HardwareDevice/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HardwareDevice")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("HardwareDevice")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightHardwareDevice)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("31410889-50ce-4e33-b291-70140af0569f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/HelperFunctions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HelperFunctions")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("HelperFunctions")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightHelperFunctions)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2a1fed90-d96b-41e3-94b0-c51f666ee5a4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/PVDriversRemoval/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PVDriversRemoval")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("PVDriversRemoval")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightPVDriversRemoval)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("28a124c7-c8d3-4c39-8680-c0decd0271a8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/Uninstall/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Uninstall")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("Uninstall")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightUninstall)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("755dde47-2491-476a-aa51-25354b4043b0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/vmcleaner/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("vmcleaner")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("vmcleaner")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("73344786-d956-462e-8067-ce8670167796")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/BrandSupport/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BrandSupport")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct("BrandSupport")] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightBrandSupport)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("77c41c1a-1c62-4c67-951f-e908a8aef0f2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/qnetsettings/qnetsettings.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #pragma once 33 | 34 | //#include "resource.h" 35 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | List of maintainers and how to submit changes 2 | ============================================= 3 | 4 | This is an early public release of the XenServer Windows Tools Installer. 5 | 6 | At the moment we are working hard on improving this early release, to make 7 | it easier to build and install and test on your own systems. As such things 8 | are in a state of flux, and we may well find it difficult to take submissions. 9 | 10 | We hope things will have improved by January 2014 11 | 12 | If you do wish to submit code, we recommend reaching out to the maintainers 13 | first, who will attempt to steer you in the right direction. 14 | 15 | We also request you follow these guidelines: 16 | 17 | 1. All submissions must be made under the terms of the "Developer's Certificate 18 | of Origin" (DC) and should include a Signed-off-by: line. 19 | 20 | 2. All Submissions should use Unix line endings for consitency with the rest of 21 | the XenServer project 22 | 23 | 3. Each patch should include a descriptive commit comment that helps understand 24 | why the patch is necessary and why it works. This will be used both for 25 | initial review and for new people to understand how the code works later 26 | 27 | 4. Make sure you have the right to submit any changes you make. If you do 28 | changes at work you may find your employer owns the patches instead of 29 | you. 30 | 31 | 32 | Maintainers List 33 | ---------------- 34 | 35 | * Ben Chalmers 36 | 37 | * Owen Smith 38 | 39 | * Paul Durrant 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/InstallAgent/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle(XenVersions.BRANDING_installAgentShort)] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(XenVersions.BRANDING_manufacturer)] 12 | [assembly: AssemblyProduct(XenVersions.BRANDING_installAgentShort)] 13 | [assembly: AssemblyCopyright(XenVersions.BRANDING_copyrightInstallAgent)] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("eb5d9cac-3ffd-4e92-adc4-78cbadebc5d1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.*")] 36 | -------------------------------------------------------------------------------- /src/netsetlib/restore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef _RESTORE_H 33 | #define _RESTORE_H 34 | 35 | extern HRESULT 36 | RestoreCmd( 37 | void 38 | ); 39 | 40 | #endif -------------------------------------------------------------------------------- /src/qnetsettings/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #include "stdafx.h" 33 | 34 | // TODO: reference any additional headers you need in STDAFX.H 35 | // and not in this file 36 | -------------------------------------------------------------------------------- /src/netsetlib/Save.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef _SAVE_H 33 | #define _SAVE_H 34 | 35 | #include 36 | 37 | extern HRESULT 38 | SaveCmd( 39 | void 40 | ); 41 | 42 | #endif -------------------------------------------------------------------------------- /src/PInvokeWrap/Msi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | 5 | namespace PInvokeWrap 6 | { 7 | public static class Msi 8 | { 9 | // **** Msi- functions, enums and constants **** 10 | 11 | // Maybe this should be a resource? 12 | public static class INSTALLPROPERTY 13 | { 14 | public const string INSTALLEDPRODUCTNAME = "InstalledProductName"; 15 | public const string VERSIONSTRING = "VersionString"; 16 | public const string HELPLINK = "HelpLink"; 17 | public const string HELPTELEPHONE = "HelpTelephone"; 18 | public const string INSTALLLOCATION = "InstallLocation"; 19 | public const string INSTALLSOURCE = "InstallSource"; 20 | public const string INSTALLDATE = "InstallDate"; 21 | public const string PUBLISHER = "Publisher"; 22 | public const string LOCALPACKAGE = "LocalPackage"; 23 | public const string URLINFOABOUT = "URLInfoAbout"; 24 | public const string URLUPDATEINFO = "URLUpdateInfo"; 25 | public const string VERSIONMINOR = "VersionMinor"; 26 | public const string VERSIONMAJOR = "VersionMajor"; 27 | } 28 | 29 | [DllImport("msi.dll", SetLastError = true)] 30 | public static extern int MsiEnumProducts( 31 | int iProductIndex, 32 | StringBuilder lpProductBuf 33 | ); 34 | 35 | [DllImport("msi.dll", CharSet = CharSet.Unicode)] 36 | public static extern int MsiGetProductInfo( 37 | string product, 38 | string property, 39 | [Out] StringBuilder valueBuf, 40 | ref Int32 len 41 | ); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/pescripts/AIK1.bat: -------------------------------------------------------------------------------- 1 | rem Sample script for installing XenServer PV Drivers to a Windows PE Image 2 | rem Using the Microsoft Windows Vist / 2008 AIK 3 | rem 4 | rem usage: AIK1.bat [x86|x64] 5 | rem 6 | rem this presupposes you have a WIM file generated, perhaps using 7 | rem copype.cmd, but not mounted 8 | 9 | echo "Wim File: %1" 10 | echo "Drivers: %2" 11 | echo "Arch: %3" 12 | 13 | rem Create a folder to mount the wim file to, then mount it 14 | mkdir mountpe 15 | imagex /mountrw %1 1 mountpe 16 | 17 | rem Add the driver files 18 | 19 | peimg /inf="%2\xenbus\x86\xenbus.inf" mountpe 20 | peimg /inf="%2\xenvbd\x86\xenvbd.inf" mountpe 21 | peimg /inf="%2\xennet\x86\xennet.inf" mountpe 22 | peimg /inf="%2\xenvif\x86\xenvif.inf" mountpe 23 | 24 | rem Make the registry changes needed to set up filters and unplug 25 | rem the emulated devices 26 | 27 | reg load HKLM\pemount mountpe\Windows\System32\config\SYSTEM 28 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt /v WindowsPEMode /t REG_DWORD /d 1 29 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v DISKS /t REG_MULTI_SZ /d xenvbd 30 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v NICS /t REG_MULTI_SZ /d xenvif\0xennet 31 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E96A-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 32 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E97D-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 33 | reg unload HKLM\pemount 34 | 35 | rem Unmount the wim file, and commit the changes 36 | 37 | imagex /unmount /commit mountpe 38 | 39 | rem To generate a CD image 40 | rem copy /Y winpe.wim ISO\sources\boot.wim 41 | rem oscdimg -n -betfsboot.com ISO c:\work\testpe.iso 42 | -------------------------------------------------------------------------------- /src/pescripts/AIK2.bat: -------------------------------------------------------------------------------- 1 | rem Sample script for installing XenServer PV Drivers to a Windows PE Image 2 | rem Using the Microsoft Windows 7 AIK 3 | rem 4 | rem usage: AIK2.bat [x86|x64] 5 | rem 6 | rem this presupposes you have a WIM file generated, perhaps using 7 | rem copype.cmd, but not mounted 8 | 9 | echo "Wim File: %1" 10 | echo "Drivers: %2" 11 | echo "Arch: %3" 12 | 13 | rem Create a folder to mount the wim file to, then mount it 14 | mkdir mountpe 15 | imagex /mountrw %1 1 mountpe 16 | 17 | rem Add the driver files 18 | 19 | dism /add-driver /image:"mountpe" /Driver:"%2\xenbus\%3\xenbus.inf" 20 | dism /add-driver /image:"mountpe" /Driver:"%2\xenvbd\%3\xenvbd.inf" 21 | dism /add-driver /image:"mountpe" /Driver:"%2\xennet\%3\xennet.inf" 22 | dism /add-driver /image:"mountpe" /Driver:"%2\xenvif\%3\xenvif.inf" 23 | 24 | rem Make the registry changes needed to set up filters and unplug 25 | rem the emulated devices 26 | 27 | reg load HKLM\pemount mountpe\Windows\System32\config\SYSTEM 28 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt /v WindowsPEMode /t REG_DWORD /d 1 29 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v DISKS /t REG_MULTI_SZ /d xenvbd 30 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v NICS /t REG_MULTI_SZ /d xenvif\0xennet 31 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E96A-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 32 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E97D-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 33 | reg unload HKLM\pemount 34 | rem Unmount the wim file, and commit the changes 35 | 36 | imagex /unmount /commit mountpe 37 | 38 | rem To generate a CD image 39 | rem copy /Y winpe.wim ISO\sources\boot.wim 40 | rem oscdimg -n -betfsboot.com ISO c:\work\testpe.iso 41 | -------------------------------------------------------------------------------- /src/pescripts/ADK8.bat: -------------------------------------------------------------------------------- 1 | rem Sample script for installing XenServer PV Drivers to a Windows PE Image 2 | rem Using the Microsoft Windows 8 ADK 3 | rem 4 | rem usage: ADK8.bat [x86|x64] 5 | rem 6 | rem this presupposes you have a WIM file generated, perhaps using 7 | rem copype.cmd, but not mounted 8 | 9 | echo "Wim File: %1" 10 | echo "Drivers: %2" 11 | echo "Arch: %3" 12 | 13 | rem Create a folder to mount the wim file to, then mount it 14 | mkdir mountpe 15 | dism /Mount-Image /ImageFile:"%1" /index:1 /MountDir:"mountpe" 16 | 17 | rem Add the driver files 18 | 19 | dism /add-driver /image:"mountpe" /Driver:"%2\xenbus\%3\xenbus.inf" 20 | dism /add-driver /image:"mountpe" /Driver:"%2\xenvbd\%3\xenvbd.inf" 21 | dism /add-driver /image:"mountpe" /Driver:"%2\xennet\%3\xennet.inf" 22 | dism /add-driver /image:"mountpe" /Driver:"%2\xenvif\%3\xenvif.inf" 23 | 24 | rem Make the registry changes needed to set up filters and unplug 25 | rem the emulated devices 26 | 27 | reg load HKLM\pemount mountpe\Windows\System32\config\SYSTEM 28 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt /v WindowsPEMode /t REG_DWORD /d 1 29 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v DISKS /t REG_MULTI_SZ /d xenvbd 30 | reg ADD HKLM\pemount\ControlSet001\Services\xenfilt\UNPLUG /v NICS /t REG_MULTI_SZ /d xenvif\0xennet 31 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E96A-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 32 | reg ADD HKLM\pemount\ControlSet001\Control\class\{4D36E97D-E325-11CE-BFC1-08002BE10318} /v UpperFilters /t REG_MULTI_SZ /d XENFILT 33 | reg unload HKLM\pemount 34 | 35 | rem Unmount the wim file, and commit the changes 36 | 37 | dism /unmount-image /mountdir:mountpe /commit 38 | 39 | rem To generate a CD Image 40 | rem makewinpemedia /ISO . c:\work\pe8.iso 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/qnetsettings/targetver.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #pragma once 33 | 34 | // Including SDKDDKVer.h defines the highest available Windows platform. 35 | 36 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 37 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 38 | 39 | #include 40 | -------------------------------------------------------------------------------- /src/netsetlib/log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef _LOG_H 33 | #define _LOG_H 34 | 35 | #include 36 | 37 | extern FILE* logptr; 38 | 39 | #define Log(str, ...) fprintf(logptr, str "\n", __VA_ARGS__) 40 | 41 | #define Warning(str, ...) fprintf(logptr, "WARNING: " str "\n",__VA_ARGS__) 42 | 43 | #define Fail(code) fprintf(logptr, "FAIL:" __FUNCTION__ "(%d)\n", code) 44 | 45 | #endif -------------------------------------------------------------------------------- /src/setup/Setup.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | #pragma once 32 | 33 | #include "resource.h" 34 | 35 | #include "targetver.h" 36 | 37 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 38 | // Windows Header Files: 39 | #include 40 | 41 | // C RunTime Header Files 42 | #include 43 | #include 44 | #include 45 | #include -------------------------------------------------------------------------------- /src/vmcleaner/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PVDriversRemoval; 6 | 7 | namespace vmcleaner 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | try 14 | { 15 | Console.Out.WriteLine("Preparing to clean VM"); 16 | Console.Out.WriteLine(" > Remove PV Drivers From Filters"); 17 | PVDriversPurge.RemovePVDriversFromFilters(); 18 | Console.Out.WriteLine(" > Don't Boot Start PV Drivers"); 19 | PVDriversPurge.DontBootStartPVDrivers(); 20 | Console.Out.WriteLine(" > Uninstall MSI Files"); 21 | PVDriversPurge.UninstallMSIs(); 22 | Console.Out.WriteLine(" > Uninstall Drivers and Devices"); 23 | PVDriversPurge.UninstallDriversAndDevices(); 24 | Console.Out.WriteLine(" > Clean up after ourselves"); 25 | Console.Out.WriteLine(" > Legacy"); 26 | PVDriversPurge.CleanUpXenLegacy(); 27 | Console.Out.WriteLine(" > Services"); 28 | PVDriversPurge.CleanUpServices(); 29 | Console.Out.WriteLine(" > Driver Files"); 30 | PVDriversPurge.CleanUpDriverFiles(); 31 | Console.Out.WriteLine("Done"); 32 | Console.Out.WriteLine(""); 33 | Console.Out.WriteLine(""); 34 | Console.Out.WriteLine("Please reboot the VM before continuing"); 35 | } 36 | catch (Exception e) 37 | { 38 | Console.Out.WriteLine("Failed. Please report the following message to your support engineer:"); 39 | Console.Out.WriteLine("VMCleaner Failure : " + e.ToString()); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/setup/targetver.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | #pragma once 32 | 33 | // Including SDKDDKVer.h defines the highest available Windows platform. 34 | 35 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 36 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 37 | #include 38 | 39 | #define WINVER 0x0501 40 | #define _WIN32_WINNT 0x0501 41 | 42 | #include 43 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/InstallWizard.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallWizard", "InstallWizard.csproj", "{A0A7D646-7F21-4708-B78C-08CCB7016269}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestCode", "..\TestCode\TestCode.csproj", "{7F2FD7CA-FEDA-4911-A949-A076CF00F041}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallGui", "..\InstallGui\InstallGui.csproj", "{C918D479-F11C-4180-8791-4765D3AA54D4}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7F2FD7CA-FEDA-4911-A949-A076CF00F041}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7F2FD7CA-FEDA-4911-A949-A076CF00F041}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7F2FD7CA-FEDA-4911-A949-A076CF00F041}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7F2FD7CA-FEDA-4911-A949-A076CF00F041}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {A0A7D646-7F21-4708-B78C-08CCB7016269}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {A0A7D646-7F21-4708-B78C-08CCB7016269}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {A0A7D646-7F21-4708-B78C-08CCB7016269}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {A0A7D646-7F21-4708-B78C-08CCB7016269}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {C918D479-F11C-4180-8791-4765D3AA54D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {C918D479-F11C-4180-8791-4765D3AA54D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {C918D479-F11C-4180-8791-4765D3AA54D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {C918D479-F11C-4180-8791-4765D3AA54D4}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /src/PInvokeWrap/DIFxAPI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class DIFxAPI 7 | { 8 | public enum DRIVER_PACKAGE 9 | { 10 | REPAIR = 0x00000001, 11 | SILENT = 0x00000002, 12 | FORCE = 0x00000004, 13 | ONLY_IF_DEVICE_PRESENT = 0x00000008, 14 | LEGACY_MODE = 0x00000010, 15 | DELETE_FILES = 0x00000020, 16 | } 17 | 18 | [DllImport("DIFxAPI64.dll", 19 | CharSet = CharSet.Auto, 20 | EntryPoint = "DriverPackageUninstall")] 21 | private extern static int DriverPackageUninstall_64( 22 | [MarshalAs(UnmanagedType.LPTStr)] string driverPackageInfPath, 23 | int flags, 24 | IntPtr pInstallerInfo, 25 | out bool pNeedReboot 26 | ); 27 | 28 | [DllImport("DIFxAPI32.dll", 29 | CharSet = CharSet.Auto, 30 | EntryPoint = "DriverPackageUninstall")] 31 | private extern static int DriverPackageUninstall_32( 32 | [MarshalAs(UnmanagedType.LPTStr)] string driverPackageInfPath, 33 | int flags, 34 | IntPtr pInstallerInfo, 35 | out bool pNeedReboot 36 | ); 37 | 38 | public static int DriverPackageUninstall( 39 | [MarshalAs(UnmanagedType.LPTStr)] string driverPackageInfPath, 40 | int flags, 41 | IntPtr pInstallerInfo, 42 | out bool pNeedReboot) 43 | { 44 | if (WinVersion.Is64BitOS()) 45 | { 46 | return DriverPackageUninstall_64( 47 | driverPackageInfPath, 48 | flags, 49 | pInstallerInfo, 50 | out pNeedReboot 51 | ); 52 | } 53 | 54 | return DriverPackageUninstall_32( 55 | driverPackageInfPath, 56 | flags, 57 | pInstallerInfo, 58 | out pNeedReboot 59 | ); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/InstallAgent/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.ServiceProcess; 4 | 5 | namespace InstallAgent 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | static void Main(string[] args) 13 | { 14 | try 15 | { 16 | TimeDateTraceListener.Initialize("InstallAgent"); 17 | 18 | if (args.Length == 0) // run as service 19 | { 20 | // rebootOption is populated in the constructor 21 | ServiceBase[] ServicesToRun; 22 | ServicesToRun = new ServiceBase[] 23 | { 24 | new InstallAgent() 25 | }; 26 | ServiceBase.Run(ServicesToRun); 27 | } 28 | else if (args.Length == 1) // run from command line 29 | { 30 | InstallAgent.RebootType rebootOpt; 31 | 32 | try 33 | { 34 | rebootOpt = (InstallAgent.RebootType)Enum.Parse( 35 | typeof(InstallAgent.RebootType), args[0], true 36 | ); 37 | } 38 | catch 39 | { 40 | Usage(); 41 | return; 42 | } 43 | 44 | InstallAgent ias = new InstallAgent(rebootOpt); 45 | ias.InstallThreadHandler(); 46 | } 47 | else 48 | { 49 | Usage(); 50 | } 51 | } 52 | catch (Exception e) 53 | { 54 | Trace.WriteLine(e.ToString()); 55 | throw; 56 | } 57 | } 58 | 59 | static void Usage() 60 | { 61 | Console.WriteLine( 62 | "Usage: InstallAgent.exe {NOREBOOT | AUTOREBOOT | DEFAULT}" 63 | ); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/Program.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | 33 | using System; 34 | using System.Collections.Generic; 35 | using System.Linq; 36 | using System.ServiceProcess; 37 | using System.Text; 38 | 39 | 40 | namespace InstallWizard 41 | { 42 | static class Program 43 | { 44 | /// 45 | /// The main entry point for the application. 46 | /// 47 | static void Main() 48 | { 49 | ServiceBase[] ServicesToRun; 50 | ServicesToRun = new ServiceBase[] 51 | { 52 | new InstallService() 53 | }; 54 | ServiceBase.Run(ServicesToRun); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/PInvokeWrap/Win32ErrorMessage.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class Win32Error 7 | { 8 | private static string message; 9 | private static int error; 10 | 11 | public static string GetFullErrMsg() 12 | { 13 | return message; 14 | } 15 | 16 | public static int GetErrorNo() 17 | { 18 | return error; 19 | } 20 | 21 | public static void Set(string win32FuncName, int err = -1) 22 | { 23 | error = (err == -1) ? Marshal.GetLastWin32Error() : err; 24 | 25 | message = 26 | win32FuncName + "() - Error [" + error + 27 | "]: " + new Win32Exception(error).Message; 28 | } 29 | 30 | public static void Set(int err = -1) 31 | { 32 | error = (err == -1) ? Marshal.GetLastWin32Error() : err; 33 | 34 | message = 35 | "Error [" + error + "]: " + 36 | new Win32Exception(error).Message; 37 | } 38 | 39 | public static void SetCR(string cmFuncName, CfgMgr32.CR configRet) 40 | // Tries to map CfgMgr32 error codes to Win32 error codes 41 | // before setting 'error' and 'message'. Both error codes 42 | // and messages are written. 43 | { 44 | // We return ERROR_SUCCESS if the 45 | // error code cannot be mapped 46 | int win32Err = CfgMgr32.CM_MapCrToWin32Err( 47 | configRet, 48 | WinError.ERROR_SUCCESS 49 | ); 50 | 51 | message = 52 | cmFuncName + "() - CR_Error [" + (int)configRet + "]: " + 53 | configRet + " => Win32_Error ["; 54 | 55 | if (win32Err == WinError.ERROR_SUCCESS) 56 | { 57 | message += "-]: No equivalent Win32 error code exists"; 58 | error = (int)configRet; 59 | } 60 | else 61 | { 62 | message += 63 | win32Err + "]: " + new Win32Exception(win32Err).Message; 64 | error = win32Err; 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/InstallAgent/ProjectInstaller.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace InstallAgent 2 | { 3 | partial class ProjectInstaller 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); 32 | this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); 33 | // 34 | // serviceProcessInstaller1 35 | // 36 | this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; 37 | this.serviceProcessInstaller1.Password = null; 38 | this.serviceProcessInstaller1.Username = null; 39 | // 40 | // serviceInstaller1 41 | // 42 | this.serviceInstaller1.ServiceName = "InstallAgent"; 43 | this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; 44 | // 45 | // ProjectInstaller 46 | // 47 | this.Installers.AddRange(new System.Configuration.Install.Installer[] { 48 | this.serviceProcessInstaller1, 49 | this.serviceInstaller1}); 50 | 51 | } 52 | 53 | #endregion 54 | 55 | private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; 56 | private System.ServiceProcess.ServiceInstaller serviceInstaller1; 57 | } 58 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The XenServer Windows Installer Packages 2 | ========================================== 3 | 4 | The XenServer windows installer packages consists of 5 | 6 | 6 MSIs for installing 32 bit and 64 bit versions of 7 | 8 | * The XenServer Windows Guest Agent 9 | * The XenServer Windows Paravirtualized Drivers 10 | * The XenServer Windows Volume Shadow Copy Service Provider 11 | 12 | An installwizard service for handling automated updates and installations of the tools 13 | (which internally used the correct MSIs from the list above) 14 | 15 | A 32 bit MSI for installing and starting the installwizard service 16 | 17 | Quick Start 18 | =========== 19 | 20 | Prerequisites to build 21 | ---------------------- 22 | 23 | * Visual Studio 2012 or later 24 | * Python 3 or later 25 | * WIX (Windows Installer XML) Version 3.5 26 | 27 | Environment variables used in building the installer 28 | ---------------------------------------------------- 29 | 30 | BUILD\_NUMBER Build number 31 | 32 | WIX location of the WIX binaries 33 | 34 | VS location of visual studio 35 | 36 | Commands to build 37 | ----------------- 38 | 39 | To build the installer, first construct a package output directory containing a 40 | subdirectory for each of the other windows tools projects. The subdirectories should be 41 | named 42 | 43 | * xenbus 44 | * xenguestagent 45 | * xeniface 46 | * xenvif 47 | * xennet 48 | * xenvbd 49 | * xenvss 50 | 51 | Each subdirectory should have the relevent build output of it's associated component 52 | copied inside 53 | 54 | Then use the following commands 55 | 56 | git clone http://github.com/xenserver/win-installer 57 | cd win-installer 58 | .\build.py --local 59 | 60 | To sign the drivers with a certificate installed on the build machine, the 61 | following additional arguments can be placed after the build output directory 62 | in the .\build.py command 63 | 64 | --sign 65 | Sign with the best certificate matching 66 | 67 | --addcert 68 | Add an aditional to the signature block 69 | 70 | Alternatively a user specified commandline (to which the name of the file 71 | to be signed is appended) can be specifed as follows 72 | 73 | --signcmd 74 | 75 | -------------------------------------------------------------------------------- /src/setup/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Setup.rc 4 | // 5 | 6 | /* Copyright (c) Citrix Systems Inc. 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, 10 | * with or without modification, are permitted provided 11 | * that the following conditions are met: 12 | * 13 | * * Redistributions of source code must retain the above 14 | * copyright notice, this list of conditions and the 15 | * following disclaimer. 16 | * * Redistributions in binary form must reproduce the above 17 | * copyright notice, this list of conditions and the 18 | * following disclaimer in the documentation and/or other 19 | * materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | * SUCH DAMAGE. 35 | */ 36 | 37 | 38 | #define IDS_APP_TITLE 103 39 | 40 | #define IDR_MAINFRAME 128 41 | #define IDD_SETUP_DIALOG 102 42 | #define IDD_ABOUTBOX 103 43 | #define IDM_ABOUT 104 44 | #define IDM_EXIT 105 45 | #define IDI_SETUP 107 46 | #define IDI_SMALL 108 47 | #define IDC_SETUP 109 48 | #define IDC_MYICON 2 49 | #ifndef IDC_STATIC 50 | #define IDC_STATIC -1 51 | #endif 52 | // Next default values for new objects 53 | // 54 | #ifdef APSTUDIO_INVOKED 55 | #ifndef APSTUDIO_READONLY_SYMBOLS 56 | 57 | #define _APS_NO_MFC 130 58 | #define _APS_NEXT_RESOURCE_VALUE 129 59 | #define _APS_NEXT_COMMAND_VALUE 32771 60 | #define _APS_NEXT_CONTROL_VALUE 1000 61 | #define _APS_NEXT_SYMED_VALUE 110 62 | #endif 63 | #endif 64 | -------------------------------------------------------------------------------- /src/ManagementAgentCA/SetInitiatorSidProperty.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | UINT __stdcall SetInitiatorSidProperty(MSIHANDLE hInstall) 4 | { 5 | HANDLE processHandle = GetCurrentProcess(); 6 | HANDLE tokenHandle = NULL; 7 | DWORD tokenInfLen = 0; 8 | PTOKEN_USER pTokenUser = NULL; 9 | LPTSTR strSid = NULL; 10 | DWORD error = ERROR_SUCCESS; 11 | HRESULT hr = S_OK; 12 | 13 | hr = WcaInitialize(hInstall, "SetInitiatorSidProperty"); 14 | ExitOnFailure(hr, "Failed to initialize"); 15 | 16 | WcaLog(LOGMSG_STANDARD, "Initialized."); 17 | 18 | if (!OpenProcessToken(processHandle, TOKEN_QUERY, &tokenHandle)) { 19 | hr = HRESULT_FROM_WIN32(GetLastError()); 20 | ExitOnFailure(hr, "OpenProcessToken() failed"); 21 | } 22 | 23 | /* Get buffer length */ 24 | GetTokenInformation( 25 | tokenHandle, 26 | TokenUser, 27 | NULL, 28 | 0, 29 | &tokenInfLen 30 | ); 31 | 32 | if ((error = GetLastError()) != ERROR_INSUFFICIENT_BUFFER) { 33 | hr = HRESULT_FROM_WIN32(error); 34 | ExitOnFailure(hr, "GetTokenInformation() failed"); 35 | } 36 | 37 | if ((pTokenUser = (PTOKEN_USER)malloc(tokenInfLen)) == NULL) { 38 | hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); 39 | ExitOnFailure(hr, "malloc() failed"); 40 | } 41 | 42 | if (!GetTokenInformation( 43 | tokenHandle, 44 | TokenUser, 45 | (LPVOID)pTokenUser, 46 | tokenInfLen, 47 | &tokenInfLen)) { 48 | hr = HRESULT_FROM_WIN32(GetLastError()); 49 | ExitOnFailure(hr, "GetTokenInformation() failed"); 50 | } 51 | 52 | if (!ConvertSidToStringSid(pTokenUser->User.Sid, &strSid)) { 53 | hr = HRESULT_FROM_WIN32(GetLastError()); 54 | ExitOnFailure(hr, "ConvertSidToStringSid() failed"); 55 | } 56 | 57 | hr = WcaSetProperty(_T("INITIATORSID"), strSid); 58 | ExitOnFailure(hr, "WcaSetProperty() failed"); 59 | 60 | LExit: 61 | if (strSid) { 62 | LocalFree(strSid); 63 | } 64 | 65 | if (pTokenUser) { 66 | free(pTokenUser); 67 | pTokenUser = NULL; 68 | } 69 | 70 | if (tokenHandle) { 71 | CloseHandle(tokenHandle); 72 | } 73 | 74 | error = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; 75 | return WcaFinalize(error); 76 | } 77 | -------------------------------------------------------------------------------- /manifestspecific.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Citrix Systems Inc. 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, 5 | # with or without modification, are permitted provided 6 | # that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above 9 | # copyright notice, this list of conditions and the 10 | # following disclaimer. 11 | # * Redistributions in binary form must reproduce the above 12 | # copyright notice, this list of conditions and the 13 | # following disclaimer in the documentation and/or other 14 | # materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | # SUCH DAMAGE. 30 | 31 | artifactory='https://repo.citrite.net:443/xs-local-build/' 32 | 33 | build_tar_source_files = { 34 | "xenguestagent" : r'win-xenguestagent/master/win-xenguestagent-261/xenguestagent.tar', 35 | "xenbus" : r'win-xenbus/patchq-8.2/win-xenbus-117/xenbus.tar', 36 | "xenvif" : r'win-xenvif/patchq/win-xenvif-155/xenvif.tar', 37 | "xennet" : r'win-xennet/patchq/win-xennet-102/xennet.tar', 38 | "xeniface" : r'win-xeniface/8.2/win-xeniface-103/xeniface.tar', 39 | "xenvbd" : r'win-xenvbd/patchq/win-xenvbd-203/xenvbd.tar', 40 | "xenvss" : r'win-xenvss/master/win-xenvss-18/xenvss.tar', 41 | } 42 | 43 | signed_drivers = { 44 | "xenbus" : r'win-xenbus/patchq/win-xenbus-117/xenbus.signed.tar', 45 | "xenvif" : r'win-xenvif/patchq/win-xenvif-152/xenvif.signed.tar', 46 | "xennet" : r'win-xennet/patchq/win-xennet-64/xennet.signed.tar', 47 | "xeniface" : r'win-xeniface/patchq/win-xeniface-102/xeniface.signed.tar', 48 | "xenvbd" : r'win-xenvbd/patchq/win-xenvbd-203/xenvbd.signed.tar', 49 | } 50 | -------------------------------------------------------------------------------- /manifestlatest.py: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) Citrix Systems Inc. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, 6 | # with or without modification, are permitted provided 7 | # that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above 10 | # copyright notice, this list of conditions and the 11 | # following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the 14 | # following disclaimer in the documentation and/or other 15 | # materials provided with the distribution. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 | # SUCH DAMAGE. 31 | 32 | 33 | 34 | latest_tar_source_files = { 35 | "xenbus" : "http://xenbus-build.uk.xensource.com:8080/job/XENBUS-upstream.git/lastSuccessfulBuild/artifact/xenbus.tar", 36 | "xenvif" : "http://xenvif-build.uk.xensource.com:8080/job/XENVIF-upstream.git/lastSuccessfulBuild/artifact/xenvif.tar", 37 | "xennet" : "http://xennet-build.uk.xensource.com:8080/job/XENNET-upstream.git/lastSuccessfulBuild/artifact/xennet.tar", 38 | "xeniface" : "http://xeniface-build.uk.xensource.com:8080/job/XENIFACE-upstream.git/lastSuccessfulBuild/artifact/xeniface.tar", 39 | "xenvbd" : "http://xenvbd-build.uk.xensource.com:8080/job/XENVBD-upstream.git/lastSuccessfulBuild/artifact/xenvbd.tar", 40 | "xenguestagent" : "http://xeniface-build.uk.xensource.com:8080/job/GUEST%20AGENT-upstream.git/lastSuccessfulBuild/artifact/xenguestagent.tar", 41 | "xenvss" : "http://xenvbd-build.uk.xensource.com:8080/job/XENVSS.git/lastSuccessfulBuild/artifact/xenvss.tar", 42 | } 43 | 44 | all_drivers_signed = False 45 | 46 | -------------------------------------------------------------------------------- /manifestspecific-inspur.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Citrix Systems Inc. 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, 5 | # with or without modification, are permitted provided 6 | # that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above 9 | # copyright notice, this list of conditions and the 10 | # following disclaimer. 11 | # * Redistributions in binary form must reproduce the above 12 | # copyright notice, this list of conditions and the 13 | # following disclaimer in the documentation and/or other 14 | # materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | # SUCH DAMAGE. 30 | 31 | artifactory='https://repo.citrite.net:443/xs-local-build/' 32 | 33 | build_tar_source_files = { 34 | "xenguestagent" : r'win-xenguestagent/master/win-xenguestagent-261/xenguestagent.tar', 35 | "xenbus": r"win-xenbus/patchq-8.2/win-xenbus-113/xenbus.inspur.signed.tar", 36 | "xenvif": r"win-xenvif/patchq/win-xenvif-155/xenvif.tar", 37 | "xennet": r"win-xennet/patchq/win-xennet-64/xennet.inspur.signed.tar", 38 | "xeniface": r"win-xeniface/patchq/win-xeniface-102/xeniface.inspur.signed.tar", 39 | "xenvbd": r"win-xenvbd/patchq/win-xenvbd-203/xenvbd.signed.tar", 40 | "xenvss" : r'win-xenvss/master/win-xenvss-18/xenvss.tar', 41 | } 42 | 43 | signed_drivers = { 44 | "xenbus": r"win-xenbus/patchq-8.2/win-xenbus-113/xenbus.inspur.signed.tar", 45 | "xennet": r"win-xennet/patchq/win-xennet-64/xennet.inspur.signed.tar", 46 | "xeniface": r"win-xeniface/patchq/win-xeniface-102/xeniface.inspur.signed.tar", 47 | "xenvbd": r"win-xenvbd/patchq/win-xenvbd-203/xenvbd.inspur.signed.tar", 48 | } 49 | -------------------------------------------------------------------------------- /src/BrandSupport/BrandSupport.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3C46D5F0-E82E-41B1-849B-D7B0FE335212} 8 | Library 9 | Properties 10 | BrandSupport 11 | BrandSupport 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\BrandSupport 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\BrandSupport 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | 54 | -------------------------------------------------------------------------------- /src/HelperFunctions/HelperFunctions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6FFF20B4-142B-43B9-83B3-89DDD118E216} 8 | Library 9 | Properties 10 | HelperFunctions 11 | HelperFunctions 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\Libraries\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\Libraries\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | {ce6ce4a7-c693-4102-bebf-20777ac32d06} 44 | PInvokeWrap 45 | 46 | 47 | 48 | 55 | 56 | -------------------------------------------------------------------------------- /include/brandcontrol.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #pragma once 33 | #include 34 | typedef struct { 35 | const uint8_t lang; 36 | const uint8_t sublang; 37 | const TCHAR ** list; 38 | } dict; 39 | 40 | #include "setupbranding.h" 41 | 42 | const TCHAR *getBrandingString(int brandindex) 43 | { 44 | static bool brandinit=0; 45 | static const dict *uidict = loc_def; 46 | if (!brandinit) { 47 | int i; 48 | LANGID id = GetUserDefaultUILanguage(); 49 | for (i=0; i<=(sizeof(dicts)/sizeof(dict)); i++) { 50 | uint8_t sublang = (id&0xFF00)>>8; 51 | uint8_t lang = (id&0xFF); 52 | if (lang == dicts[i]->lang) { 53 | if (uidict->lang != lang){ 54 | uidict = dicts[i]; 55 | continue; 56 | } 57 | if (sublang == dicts[i]->sublang) { 58 | uidict = dicts[i]; 59 | break; 60 | } 61 | } 62 | } 63 | brandinit = 1; 64 | } 65 | return uidict->list[brandindex]; 66 | } 67 | -------------------------------------------------------------------------------- /src/HardwareDevice/HardwareDevice.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {277A3C3D-C32D-41CD-89DE-407C97CE29FF} 8 | Library 9 | Properties 10 | HardwareDevice 11 | HardwareDevice 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\Libraries\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\Libraries\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | {6fff20b4-142b-43b9-83b3-89ddd118e216} 43 | HelperFunctions 44 | 45 | 46 | {ce6ce4a7-c693-4102-bebf-20777ac32d06} 47 | PInvokeWrap 48 | 49 | 50 | 51 | 58 | 59 | -------------------------------------------------------------------------------- /src/xenprep/Progress.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Xenprep 2 | { 3 | partial class Progress 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.progressBar = new System.Windows.Forms.ProgressBar(); 32 | this.Caption = new System.Windows.Forms.Label(); 33 | this.SuspendLayout(); 34 | // 35 | // progressBar 36 | // 37 | this.progressBar.Location = new System.Drawing.Point(12, 72); 38 | this.progressBar.Name = "progressBar"; 39 | this.progressBar.Size = new System.Drawing.Size(260, 23); 40 | this.progressBar.TabIndex = 0; 41 | // 42 | // Caption 43 | // 44 | this.Caption.Location = new System.Drawing.Point(12, 9); 45 | this.Caption.Name = "Caption"; 46 | this.Caption.Size = new System.Drawing.Size(260, 49); 47 | this.Caption.TabIndex = 1; 48 | // 49 | // Progress 50 | // 51 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 52 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 53 | this.ClientSize = new System.Drawing.Size(284, 107); 54 | this.Controls.Add(this.Caption); 55 | this.Controls.Add(this.progressBar); 56 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 57 | this.MaximizeBox = false; 58 | this.MinimizeBox = false; 59 | this.Name = "Progress"; 60 | this.Text = "XenPrep Progress"; 61 | this.ResumeLayout(false); 62 | 63 | } 64 | 65 | #endregion 66 | 67 | public System.Windows.Forms.ProgressBar progressBar; 68 | public System.Windows.Forms.Label Caption; 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/Program.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | 33 | using System; 34 | using System.Collections.Generic; 35 | using System.Linq; 36 | using System.Windows.Forms; 37 | using System.Management; 38 | using System.Management.Instrumentation; 39 | 40 | [assembly: Instrumented(@"root\citrix\xenserver\agent")] 41 | namespace UIEvent 42 | { 43 | static class Program 44 | { 45 | /// 46 | /// The main entry point for the application. 47 | /// 48 | [STAThread] 49 | static void Main() 50 | { 51 | Application.EnableVisualStyles(); 52 | Application.SetCompatibleTextRenderingDefault(false); 53 | string[] args = Environment.GetCommandLineArgs(); 54 | if (args.Length != 2) 55 | { 56 | MessageBox.Show("Bad number of arguments"); 57 | Environment.Exit(2); 58 | } 59 | CitrixXenServerInstallEvent evt = new CitrixXenServerInstallEvent(args[1]); 60 | evt.Fire(); 61 | } 62 | } 63 | public class CitrixXenServerInstallEvent : BaseEvent 64 | { 65 | public string status; 66 | public CitrixXenServerInstallEvent(string status) 67 | { 68 | this.status = status; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/PInvokeWrap/PInvokeWrap.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CE6CE4A7-C693-4102-BEBF-20777AC32D06} 8 | Library 9 | Properties 10 | PInvokeWrap 11 | PInvokeWrap 12 | v3.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\Libraries\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\..\Libraries\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /src/xenprep/Properties/xenprep.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/Uninstall/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.IO; 5 | using System.Windows.Forms; 6 | using HelperFunctions; 7 | using PVDriversRemoval; 8 | using Microsoft.Win32; 9 | using BrandSupport; 10 | using System.Diagnostics; 11 | 12 | namespace Uninstall 13 | { 14 | static class Program 15 | { 16 | /// 17 | /// The main entry point for the application. 18 | /// 19 | /// 20 | 21 | static bool installerInstalledDrivers() 22 | { 23 | Trace.WriteLine("Branded :" + Branding.GetString("BRANDING_installAgentRegKey")); 24 | using (RegistryKey rk = 25 | Registry.LocalMachine.OpenSubKey(Branding.GetString("BRANDING_installAgentRegKey"))) 26 | { 27 | string installDrivers = (string)rk.GetValue("InstallDrivers", "YES"); 28 | if (installDrivers.Equals("YES")) 29 | { 30 | Trace.WriteLine("We installed drivers"); 31 | return true; 32 | } 33 | Trace.WriteLine("We did not install drivers"); 34 | return false; 35 | } 36 | } 37 | 38 | [STAThread] 39 | static void Main() 40 | { 41 | try 42 | { 43 | Trace.WriteLine("unplug"); 44 | if (installerInstalledDrivers()) 45 | { 46 | Trace.WriteLine("disable xenbus"); 47 | Helpers.ChangeServiceStartMode( 48 | "xenbus", 49 | Helpers.ExpandedServiceStartMode.Disabled 50 | ); 51 | Trace.WriteLine("disable xenagent"); 52 | Helpers.ChangeServiceStartMode( 53 | "xenagent", 54 | Helpers.ExpandedServiceStartMode.Disabled 55 | ); 56 | Trace.WriteLine("remove filters"); 57 | PVDriversPurge.RemovePVDriversFromFilters(); 58 | } 59 | } 60 | catch (Exception e) 61 | { 62 | Trace.WriteLine(e.ToString()); 63 | } 64 | } 65 | 66 | } 67 | 68 | public static class Branding 69 | { 70 | private static BrandingControl handle; 71 | 72 | static Branding() 73 | { 74 | string brandSatPath = Path.Combine( 75 | new DirectoryInfo( 76 | System.Reflection.Assembly.GetExecutingAssembly().Location 77 | ).Parent.FullName , "Branding\\brandsat.dll" 78 | ); 79 | handle = new BrandingControl(brandSatPath); 80 | } 81 | 82 | public static string GetString(string key) 83 | { 84 | return handle.getString(key); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | 33 | using System.Reflection; 34 | using System.Runtime.CompilerServices; 35 | using System.Runtime.InteropServices; 36 | 37 | // General Information about an assembly is controlled through the following 38 | // set of attributes. Change these attribute values to modify the information 39 | // associated with an assembly. 40 | [assembly: AssemblyTitle("UIEvent")] 41 | [assembly: AssemblyDescription("")] 42 | [assembly: AssemblyConfiguration("")] 43 | [assembly: AssemblyCompany("")] 44 | [assembly: AssemblyProduct("UIEvent")] 45 | [assembly: AssemblyCopyright("Copyright © 2012")] 46 | [assembly: AssemblyTrademark("")] 47 | [assembly: AssemblyCulture("")] 48 | 49 | // Setting ComVisible to false makes the types in this assembly not visible 50 | // to COM components. If you need to access a type in this assembly from 51 | // COM, set the ComVisible attribute to true on that type. 52 | [assembly: ComVisible(false)] 53 | 54 | // The following GUID is for the ID of the typelib if this project is exposed to COM 55 | [assembly: Guid("7e005ff0-e0fd-4e84-aef5-f88211426122")] 56 | 57 | // Version information for an assembly consists of the following four values: 58 | // 59 | // Major Version 60 | // Minor Version 61 | // Build Number 62 | // Revision 63 | // 64 | // You can specify all the values or you can default the Build and Revision Numbers 65 | // by using the '*' as shown below: 66 | // [assembly: AssemblyVersion("1.0.*")] 67 | [assembly: AssemblyVersion("1.0.*")] 68 | -------------------------------------------------------------------------------- /src/installwizard/InstallWizard/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | 33 | using System.Reflection; 34 | using System.Runtime.CompilerServices; 35 | using System.Runtime.InteropServices; 36 | 37 | // General Information about an assembly is controlled through the following 38 | // set of attributes. Change these attribute values to modify the information 39 | // associated with an assembly. 40 | [assembly: AssemblyTitle("InstallWizard")] 41 | [assembly: AssemblyDescription("")] 42 | [assembly: AssemblyConfiguration("")] 43 | [assembly: AssemblyCompany("Citrix")] 44 | [assembly: AssemblyProduct("InstallWizard")] 45 | [assembly: AssemblyCopyright("Copyright © 2012")] 46 | [assembly: AssemblyTrademark("")] 47 | [assembly: AssemblyCulture("")] 48 | 49 | // Setting ComVisible to false makes the types in this assembly not visible 50 | // to COM components. If you need to access a type in this assembly from 51 | // COM, set the ComVisible attribute to true on that type. 52 | [assembly: ComVisible(false)] 53 | 54 | // The following GUID is for the ID of the typelib if this project is exposed to COM 55 | [assembly: Guid("0eb97352-3a68-456c-ab6b-29656b22451b")] 56 | 57 | // Version information for an assembly consists of the following four values: 58 | // 59 | // Major Version 60 | // Minor Version 61 | // Build Number 62 | // Revision 63 | // 64 | // You can specify all the values or you can default the Build and Revision Numbers 65 | // by using the '*' as shown below: 66 | // [assembly: AssemblyVersion("1.0.*")] 67 | [assembly: AssemblyVersion("1.0.*")] 68 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17020 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace InstallGui.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InstallGui.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | 33 | using System.Reflection; 34 | using System.Runtime.CompilerServices; 35 | using System.Runtime.InteropServices; 36 | 37 | // General Information about an assembly is controlled through the following 38 | // set of attributes. Change these attribute values to modify the information 39 | // associated with an assembly. 40 | [assembly: AssemblyTitle("InstallGui")] 41 | [assembly: AssemblyDescription("XenServer PV Tool Install Wizard GUI")] 42 | [assembly: AssemblyConfiguration("")] 43 | [assembly: AssemblyCompany("Citrix")] 44 | [assembly: AssemblyProduct("InstallGui")] 45 | [assembly: AssemblyCopyright("Copyright © 2012")] 46 | [assembly: AssemblyTrademark("")] 47 | [assembly: AssemblyCulture("")] 48 | 49 | // Setting ComVisible to false makes the types in this assembly not visible 50 | // to COM components. If you need to access a type in this assembly from 51 | // COM, set the ComVisible attribute to true on that type. 52 | [assembly: ComVisible(false)] 53 | 54 | // The following GUID is for the ID of the typelib if this project is exposed to COM 55 | [assembly: Guid("2b162d2d-d6dc-468c-94c0-742afb3d2bef")] 56 | 57 | // Version information for an assembly consists of the following four values: 58 | // 59 | // Major Version 60 | // Minor Version 61 | // Build Number 62 | // Revision 63 | // 64 | // You can specify all the values or you can default the Build and Revision Numbers 65 | // by using the '*' as shown below: 66 | // [assembly: AssemblyVersion("1.0.*")] 67 | [assembly: AssemblyVersion("1.0.*")] 68 | -------------------------------------------------------------------------------- /src/vmcleaner/vmcleaner.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E7DBF899-E0BC-4085-ABB5-9CD33E815E21} 8 | Exe 9 | Properties 10 | vmcleaner 11 | vmcleaner 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | ..\..\vmcleaner\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | ..\..\vmcleaner 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Always 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {b75c4d13-ef07-48fc-b028-5ed1ab7146cd} 55 | PVDriversRemoval 56 | 57 | 58 | 59 | 66 | 67 | -------------------------------------------------------------------------------- /src/Uninstall/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Uninstall.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Uninstall.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/PVDriversRemoval/PVDriversRemoval.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B75C4D13-EF07-48FC-B028-5ED1AB7146CD} 8 | Library 9 | Properties 10 | PVDriversRemoval 11 | PVDriversRemoval 12 | v3.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | ..\..\Libraries 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | ..\..\Libraries 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\..\BrandSupport\BrandSupport.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {277a3c3d-c32d-41cd-89de-407c97ce29ff} 46 | HardwareDevice 47 | 48 | 49 | {6fff20b4-142b-43b9-83b3-89ddd118e216} 50 | HelperFunctions 51 | 52 | 53 | {ce6ce4a7-c693-4102-bebf-20777ac32d06} 54 | PInvokeWrap 55 | 56 | 57 | 58 | 65 | 66 | -------------------------------------------------------------------------------- /src/bitmaps/EULA_DRIVERS.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi{\fonttbl\f0\fmodern Courier;}\f0\fs10\pard 2 | Windows Para-Virtualized Drivers License Terms 3 | \par 4 | 5 | \par 6 | 7 | \par 8 | This package contains device drivers for use, 9 | \par 10 | copying and distribution with Xen-based virtual 11 | \par 12 | machines. Your installation, use, copying 13 | \par 14 | and/or distribution of these drivers constitutes 15 | \par 16 | your acceptance of these license terms. Should 17 | \par 18 | you distribute these drivers you must distribute 19 | \par 20 | these drivers under terms substantially 21 | \par 22 | identical to these and you must indemnify, 23 | \par 24 | defend, and hold Citrix Systems, Inc. 25 | \par 26 | ("CITRIX"), harmless from any damages, costs, 27 | \par 28 | liabilities, expenses (including attorneys' 29 | \par 30 | fees) and settlement amounts incurred in 31 | \par 32 | connection with your failure to include such 33 | \par 34 | terms. 35 | \par 36 | 37 | \par 38 | Notwithstanding anything set forth in these 39 | \par 40 | license terms, use of open source components 41 | \par 42 | shall in all ways be governed by any open source 43 | \par 44 | license(s)indicated as applicable to the drivers 45 | \par 46 | at http://www.citrix.com/buy/licensing/open-source.html. 47 | \par 48 | 49 | \par 50 | You may not remove any proprietary notices, 51 | \par 52 | labels, or marks on the drivers. 53 | \par 54 | 55 | \par 56 | TO THE EXTENT PERMITTED BY APPLICABLE LAW, 57 | \par 58 | CITRIX ANDITS SUPPLIERS MAKE AND YOU RECEIVE NO 59 | \par 60 | WARRANTIES OR CONDITIONS, EXPRESS, IMPLIED, 61 | \par 62 | STATUTORY, OR OTHERWISE, AND CITRIX AND ITS 63 | \par 64 | SUPPLIERS SPECIFICALLY DISCLAIM WITH RESPECT TO 65 | \par 66 | THE DRIVERS ANY CONDITIONS OF QUALITY, 67 | \par 68 | AVAILABILITY, RELIABILITY, SECURITY, LACK OF 69 | \par 70 | VIRUSES, BUGS OR ERRORS, OR SUPPORT AND ANY 71 | \par 72 | IMPLIED WARRANTIES, INCLUDING, WITHOUT 73 | \par 74 | LIMITATION, ANY WARRANTY OF TITLE, QUIET 75 | \par 76 | ENJOYMENT, QUIET POSSESSION, MERCHANTABILITY, 77 | \par 78 | NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR 79 | \par 80 | PURPOSE. TO THE EXTENT PERMITTED BY APPLICABLE 81 | \par 82 | LAW, NEITHER CITRIX, ITS SUPPLIERS SHALL BE 83 | \par 84 | LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, 85 | \par 86 | CONSEQUENTIAL, INCIDENTAL, MULTIPLE, PUNITIVE 87 | \par 88 | OR OTHER DAMAGES (INCLUDING, WITHOUT LIMITATION, 89 | \par 90 | DAMAGES FOR LOSS OF DATA, LOSS OF INCOME, LOSS 91 | \par 92 | OF OPPORTUNITY, LOST PROFITS, COSTS OF RECOVERY 93 | \par 94 | OR ANY OTHER DAMAGES), HOWEVER CAUSED AND ON ANY 95 | \par 96 | THEORY OF LIABILITY, AND WHETHER OR NOT FOR 97 | \par 98 | BREACH OF CONTRACT, NEGLIGENCE OR OTHERWISE, AND 99 | \par 100 | WHETHER OR NOT CITRIX, ITS SUPPLIERS, OR 101 | \par 102 | LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY 103 | \par 104 | OF SUCH DAMAGES. 105 | \par 106 | } 107 | -------------------------------------------------------------------------------- /src/installwizard/UIEvent/UIEvent.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E6BD6518-DC82-4C19-ACC5-E1BC32B8D59B} 8 | WinExe 9 | Properties 10 | UIEvent 11 | UIEvent 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | ..\..\..\proj\UIEvent\bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | ..\..\..\proj\UIEvent\bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | app.manifest 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Designer 55 | 56 | 57 | Always 58 | 59 | 60 | Always 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /src/PInvokeWrap/WinVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class WinVersion 7 | { 8 | private static OSVERSIONINFOEX osvi; 9 | private static bool is64BitOS; 10 | private static bool isWOW64; 11 | 12 | private enum ProductType : uint 13 | { 14 | NT_WORKSTATION = 1, 15 | NT_DOMAIN_CONTROLLER = 2, 16 | NT_SERVER = 3 17 | } 18 | 19 | private struct OSVERSIONINFOEX 20 | { 21 | public uint dwOSVersionInfoSize; 22 | public uint dwMajorVersion; 23 | public uint dwMinorVersion; 24 | public uint dwBuildNumber; 25 | public uint dwPlatformId; 26 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 27 | public string szCSDVersion; 28 | public Int16 wServicePackMajor; 29 | public Int16 wServicePackMinor; 30 | public Int16 wSuiteMask; 31 | public Byte wProductType; 32 | public Byte wReserved; 33 | } 34 | 35 | #region Public Interface 36 | public static bool IsWOW64() { return isWOW64; } 37 | public static bool Is64BitOS() { return is64BitOS; } 38 | public static uint GetPlatformId() { return osvi.dwPlatformId; } 39 | public static uint GetServicePackMajor() { return (uint)osvi.wServicePackMajor; } 40 | public static uint GetServicePackMinor() { return (uint)osvi.wServicePackMinor; } 41 | public static uint GetSuite() { return (uint)osvi.wSuiteMask; } 42 | public static uint GetProductType() { return osvi.wProductType; } 43 | public static uint GetMajorVersion() { return osvi.dwMajorVersion; } 44 | public static uint GetMinorVersion() { return osvi.dwMinorVersion; } 45 | 46 | public static bool IsServerSKU() 47 | { 48 | return 49 | (ProductType) GetProductType() != ProductType.NT_WORKSTATION; 50 | } 51 | #endregion 52 | 53 | // Static Constructor 54 | static WinVersion() 55 | { 56 | osvi = new OSVERSIONINFOEX(); 57 | osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf( 58 | typeof(OSVERSIONINFOEX) 59 | ); 60 | 61 | GetVersionEx(ref osvi); 62 | _IsWOW64(); 63 | _Is64BitOS(); 64 | } 65 | 66 | private static void _IsWOW64() 67 | { 68 | bool tmpWOW64; 69 | IntPtr modHandle = Kernel32.GetModuleHandle("kernel32.dll"); 70 | 71 | if (modHandle == IntPtr.Zero) 72 | { 73 | isWOW64 = false; 74 | } 75 | else if (Kernel32.GetProcAddress( 76 | modHandle, "IsWow64Process" 77 | ) == IntPtr.Zero) 78 | { 79 | isWOW64 = false; 80 | } 81 | else if (IsWow64Process( 82 | Kernel32.GetCurrentProcess(), 83 | out tmpWOW64)) 84 | { 85 | isWOW64 = tmpWOW64; 86 | } 87 | else 88 | { 89 | isWOW64 = false; 90 | } 91 | } 92 | 93 | private static void _Is64BitOS() 94 | { 95 | is64BitOS = IntPtr.Size == 8 ? true : isWOW64; 96 | } 97 | 98 | // These 2 functions inherently belong here 99 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] 100 | [return: MarshalAs(UnmanagedType.Bool)] 101 | private static extern bool IsWow64Process( 102 | IntPtr hProcess, 103 | out bool wow64Process 104 | ); 105 | 106 | // GetVersionEx() is deprecated 107 | // TODO: replace 108 | [DllImport("kernel32")] 109 | private static extern bool GetVersionEx( 110 | ref OSVERSIONINFOEX osvi 111 | ); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/Uninstall/Uninstall.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5D3269EC-D352-47C1-B696-0E62129E6511} 8 | WinExe 9 | Properties 10 | Uninstall 11 | Uninstall 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | ..\..\Uninstall 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | ..\..\Uninstall\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\..\BrandSupport\BrandSupport.dll 37 | 38 | 39 | ..\..\Libraries\HelperFunctions.dll 40 | 41 | 42 | ..\..\Libraries\PVDriversRemoval.dll 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | ResXFileCodeGenerator 60 | Resources.Designer.cs 61 | Designer 62 | 63 | 64 | True 65 | Resources.resx 66 | 67 | 68 | SettingsSingleFileGenerator 69 | Settings.Designer.cs 70 | 71 | 72 | True 73 | Settings.settings 74 | True 75 | 76 | 77 | 78 | 79 | Always 80 | 81 | 82 | 83 | 90 | 91 | -------------------------------------------------------------------------------- /src/netsettings/netsettings.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #include "save.h" 33 | #include "restore.h" 34 | #include "log.h" 35 | #include 36 | #include 37 | #include "shlobj.h" 38 | #include 39 | #include 40 | 41 | #define SAVEARG _T("/save") 42 | #define RESTOREARG _T("/restore") 43 | #define HELPARG _T("/help") 44 | 45 | #define LOGARG _T("/log") 46 | 47 | #define InitCmd helpCmd 48 | 49 | FILE *logptr = stderr; 50 | 51 | int helpCmd(void) { 52 | Log(_T("netsettings.exe [ " LOGARG "] < ") SAVEARG _T(" | ") RESTOREARG _T(" | ") HELPARG _T(" >\n")); 53 | return 1; 54 | } 55 | 56 | BOOLEAN matchcmd(_TCHAR* varlength, _TCHAR* fixedlength) 57 | { 58 | if (_tcscmp(varlength, fixedlength) == 0) { 59 | return TRUE; 60 | } 61 | 62 | return FALSE; 63 | } 64 | 65 | 66 | int _tmain(int argc, _TCHAR* argv[]) 67 | { 68 | DWORD i = 1; 69 | HRESULT err=0; 70 | 71 | while (i < argc) 72 | { 73 | if ( matchcmd(argv[i], SAVEARG) ) 74 | { 75 | err = SaveCmd(); 76 | i++; 77 | } 78 | else if ( matchcmd(argv[i], RESTOREARG) ) 79 | { 80 | err = RestoreCmd(); 81 | i++; 82 | } 83 | else if ( matchcmd(argv[i], LOGARG) ) 84 | { 85 | i++; 86 | TCHAR Buffer[MAX_PATH]; 87 | TCHAR PathName[MAX_PATH]; 88 | TCHAR LogName[MAX_PATH]; 89 | FILE * outlog; 90 | 91 | err = SHGetFolderPath(NULL,CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, Buffer); 92 | if (err != ERROR_SUCCESS) { 93 | Warning("Unabale to find log folder"); 94 | continue; 95 | } 96 | 97 | err = sprintf_s(PathName, MAX_PATH, "%s\\Citrix", Buffer); 98 | if (err <= 0 && errno != EEXIST) { 99 | Warning("Unable to generate log path name"); 100 | continue; 101 | } 102 | 103 | err = _mkdir(PathName); 104 | if ((err != 0) && (errno != EEXIST)) { 105 | Warning("Unable to open logfile"); 106 | continue; 107 | } 108 | 109 | err = sprintf_s(PathName, MAX_PATH, "%s\\Citrix\\XSNetSettings", Buffer); 110 | if (err <= 0 ) { 111 | Warning("Unable to generate log path name"); 112 | continue; 113 | } 114 | 115 | err = _mkdir(PathName); 116 | if ((err != 0) && (errno != EEXIST)) { 117 | Warning("Unable to open logfile"); 118 | continue; 119 | } 120 | 121 | err = sprintf_s(LogName, MAX_PATH, "%s\\NetSettings.log", PathName); 122 | if (err <= 0 ) { 123 | Warning("Unable to generate log name"); 124 | continue; 125 | } 126 | 127 | err = fopen_s(&outlog, LogName,"w+"); 128 | if (err != 0) { 129 | Warning("FOpen failed %s %d",argv[i], err); 130 | continue; 131 | } 132 | fclose(logptr); 133 | logptr = outlog; 134 | 135 | } 136 | else 137 | { 138 | err = helpCmd(); 139 | break; 140 | } 141 | 142 | if (err > 0) 143 | break; 144 | } 145 | 146 | if (err == 0) { 147 | Log("Network Settings Handled Successfully"); 148 | } 149 | 150 | return err; 151 | } 152 | 153 | -------------------------------------------------------------------------------- /src/PInvokeWrap/WtsApi32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace PInvokeWrap 5 | { 6 | public static class WtsApi32 7 | { 8 | [StructLayout(LayoutKind.Sequential)] 9 | public struct WTS_SESSION_INFO 10 | { 11 | public uint SessionID; 12 | [MarshalAs(UnmanagedType.LPStr, SizeConst = 256)] 13 | public string pWinStationName; 14 | public WTS_CONNECTSTATE_CLASS State; 15 | } 16 | 17 | public enum WTS_CONNECTSTATE_CLASS 18 | { 19 | WTSActive, 20 | WTSConnected, 21 | WTSConnectQuery, 22 | WTSShadow, 23 | WTSDisconnected, 24 | WTSIdle, 25 | WTSListen, 26 | WTSReset, 27 | WTSDown, 28 | WTSInit 29 | } 30 | 31 | public enum ID : uint 32 | { 33 | OK = 1, 34 | CANCEL = 2, 35 | ABORT = 3, 36 | RETRY = 4, 37 | IGNORE = 5, 38 | YES = 6, 39 | NO = 7, 40 | TRYAGAIN = 10, 41 | CONTINUE = 11, 42 | TIMEOUT = 32000, 43 | ASYNC = 32001, 44 | } 45 | 46 | [Flags] 47 | public enum MB : uint 48 | // MessageBox style flags; Can pick 1 from 49 | // each group (apart from the last one) 50 | { 51 | // Buttons 52 | OK = 0x00000000, 53 | OKCANCEL = 0x00000001, 54 | ABORTRETRYIGNORE = 0x00000002, 55 | YESNOCANCEL = 0x00000003, 56 | YESNO = 0x00000004, 57 | RETRYCANCEL = 0x00000005, 58 | CANCELTRYCONTINUE = 0x00000006, 59 | HELP = 0x00004000, 60 | // Display Icons 61 | ICONSTOP = 0x00000010, 62 | ICONERROR = 0x00000010, 63 | ICONHAND = 0x00000010, 64 | ICONQUESTION = 0x00000020, 65 | ICONEXCLAMATION = 0x00000030, 66 | ICONWARNING = 0x00000030, 67 | ICONINFORMATION = 0x00000040, 68 | ICONASTERISK = 0x00000040, 69 | // Default Button 70 | DEFBUTTON1 = 0x00000000, 71 | DEFBUTTON2 = 0x00000100, 72 | DEFBUTTON3 = 0x00000200, 73 | DEFBUTTON4 = 0x00000300, 74 | // Modality 75 | APPLMODAL = 0x00000000, 76 | SYSTEMMODAL = 0x00001000, 77 | TASKMODAL = 0x00002000, 78 | // Other options; can use more than 1 79 | SETFOREGROUND = 0x00010000, 80 | DEFAULT_DESKTOP_ONLY = 0x00020000, 81 | TOPMOST = 0x00040000, 82 | RIGHT = 0x00080000, 83 | RTLREADING = 0x00100000, 84 | SERVICE_NOTIFICATION = 0x00200000, 85 | } 86 | 87 | public static readonly IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; 88 | public static readonly uint WTS_CURRENT_SESSION = 0xFFFFFFFF; 89 | // ((DWORD) - 1) 90 | 91 | [DllImport( 92 | "wtsapi32.dll", 93 | CharSet = CharSet.Auto, 94 | SetLastError = true)] 95 | public static extern bool WTSSendMessage( 96 | IntPtr hServer, 97 | uint SessionId, 98 | string pTitle, 99 | uint TitleLength, 100 | string pMessage, 101 | uint MessageLength, 102 | MB Style, 103 | uint Timeout, 104 | out ID pResponse, 105 | bool bWait 106 | ); 107 | 108 | [DllImport( 109 | "wtsapi32.dll", 110 | CharSet = CharSet.Auto, 111 | SetLastError = true)] 112 | public static extern bool WTSEnumerateSessions( 113 | IntPtr hServer, 114 | uint Reserved, // always 0 115 | uint Version, // always 1 116 | out IntPtr ppSessionInfo, // WTS_SESSION_INFO[] 117 | out uint pCount 118 | ); 119 | 120 | [DllImport("wtsapi32.dll")] 121 | public static extern void WTSFreeMemory(IntPtr pMemory); 122 | 123 | [DllImport("wtsapi32.dll", SetLastError = true)] 124 | public static extern bool WTSQueryUserToken( 125 | UInt32 SessionId, 126 | out IntPtr phToken 127 | ); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/InstallAgent/PVDevice/XenIface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Management; 4 | using HelperFunctions; 5 | 6 | namespace PVDevice 7 | { 8 | static class XenIface 9 | { 10 | // Only 1 session can be active at any time 11 | private static ManagementObject _session; 12 | private static Boolean functioning = false; 13 | 14 | static XenIface() 15 | { 16 | _session = null; 17 | } 18 | 19 | public static bool IsFunctioning(out bool bReinstall) 20 | { 21 | bReinstall = false; 22 | if (!Helpers.IsServiceRunning("xeniface")) 23 | { 24 | bReinstall = true; 25 | return false; 26 | } 27 | 28 | if (!functioning) 29 | { 30 | if (!Helpers.IsServiceRunning("xenagent")) 31 | { 32 | Helpers.ChangeServiceStartMode("xenagent", Helpers.ExpandedServiceStartMode.Automatic); 33 | } 34 | Trace.WriteLine("Restart xeniface agent service"); 35 | Helpers.ServiceRestart("xenagent"); 36 | //For backwards compatability 37 | Helpers.ServiceRestart("xenlite"); 38 | 39 | functioning = true; 40 | } 41 | Trace.WriteLine("IFACE: device installed"); 42 | return true; 43 | } 44 | 45 | public static void CreateSession() 46 | { 47 | ManagementClass mc = new ManagementClass( 48 | @"root\wmi", 49 | "CitrixXenStoreBase", 50 | null 51 | ); 52 | 53 | ManagementObject bse = null; 54 | 55 | foreach (ManagementObject obj in mc.GetInstances()) 56 | { 57 | bse = obj; 58 | break; 59 | } 60 | 61 | ManagementBaseObject inparam = bse.GetMethodParameters("AddSession"); 62 | inparam["ID"] = "Citrix Xen Install Wizard"; 63 | ManagementBaseObject outparam = bse.InvokeMethod( 64 | "AddSession", 65 | inparam, 66 | null 67 | ); 68 | 69 | UInt32 sessionid = (UInt32)outparam["SessionId"]; 70 | ManagementObjectSearcher objects = new ManagementObjectSearcher( 71 | @"root\wmi", 72 | "SELECT * From CitrixXenStoreSession WHERE SessionId=" + 73 | sessionid.ToString() 74 | ); 75 | 76 | foreach (ManagementObject obj in objects.Get()) 77 | { 78 | _session = obj; 79 | break; 80 | } 81 | } 82 | 83 | public static void DestroySession() 84 | { 85 | try 86 | { 87 | _session.InvokeMethod("EndSession", null, null); 88 | } 89 | catch { } 90 | 91 | _session = null; 92 | } 93 | 94 | public static int GetNoChildNodes() 95 | { 96 | int noChildNodes = 0; 97 | 98 | try 99 | { 100 | ManagementBaseObject inparam = 101 | _session.GetMethodParameters("GetChildren"); 102 | 103 | inparam["Pathname"] = @"device/vif"; 104 | 105 | ManagementBaseObject outparam = 106 | _session.InvokeMethod("GetChildren", inparam, null); 107 | 108 | noChildNodes = 109 | (int)((ManagementBaseObject)(outparam["children"]))["NoOfChildNodes"]; 110 | } 111 | catch 112 | { } 113 | 114 | return noChildNodes; 115 | } 116 | 117 | public static string Read(string path) 118 | { 119 | ManagementBaseObject inparam = 120 | _session.GetMethodParameters("GetValue"); 121 | 122 | inparam["Pathname"] = path; 123 | 124 | ManagementBaseObject outparam = _session.InvokeMethod( 125 | "GetValue", 126 | inparam, 127 | null 128 | ); 129 | 130 | return (string)outparam["value"]; 131 | } 132 | 133 | public static void Write(string path, string value) 134 | { 135 | ManagementBaseObject inparam = 136 | _session.GetMethodParameters("SetValue"); 137 | 138 | inparam["Pathname"] = path; 139 | 140 | inparam["value"] = value; 141 | 142 | _session.InvokeMethod("SetValue", inparam, null); 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/xenprep/Xenprep.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {17BDA712-F12F-4EF9-85E2-C20B25BD86AC} 8 | WinExe 9 | Properties 10 | Xenprep 11 | Xenprep 12 | v3.5 13 | 512 14 | 0 15 | 1.0.0.%2a 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | ..\..\proj\xenprep\bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | ..\..\proj\xenprep\bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | Properties\xen.ico 38 | 39 | 40 | Properties\xenprep.manifest 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Form 57 | 58 | 59 | Progress.cs 60 | 61 | 62 | Code 63 | 64 | 65 | Code 66 | 67 | 68 | Progress.cs 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Xenprep._64.qnetsettings.exe 79 | 80 | 81 | 82 | 83 | Xenprep._32.qnetsettings.exe 84 | 85 | 86 | 87 | 88 | 89 | Always 90 | Designer 91 | 92 | 93 | 94 | 95 | 96 | 97 | 104 | -------------------------------------------------------------------------------- /src/netsetlib/save.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #include "registry.h" 33 | 34 | HRESULT 35 | saveStaticNetworkConfiguration( 36 | HKEY SourceKey, 37 | PTCHAR statickey, 38 | PTCHAR installerkey 39 | ) 40 | { 41 | STORE_IF_MATCHING_NET_LUID matchdata; 42 | HKEY CheckKey; 43 | HRESULT Error; 44 | Error = RegistryGetNetLuid(SourceKey, &matchdata.NetLuid); 45 | if (Error != ERROR_SUCCESS) { 46 | Log("Can't find NetLuid"); 47 | goto done1; 48 | } 49 | 50 | matchdata.StoreKeyName = RegistryGetStorageKeyName(SourceKey, installerkey); 51 | 52 | if (matchdata.StoreKeyName == NULL) 53 | goto done2; 54 | 55 | Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, statickey, 0, KEY_READ, &CheckKey); 56 | if (Error == ERROR_SUCCESS) { 57 | RegCloseKey(CheckKey); 58 | Error = RegistryIterateOverKeyValues(statickey, RegistryStoreIfMatchingNetLuid, &matchdata); 59 | if (Error != ERROR_SUCCESS) 60 | goto fail1; 61 | } 62 | 63 | done2: 64 | free(matchdata.StoreKeyName); 65 | done1: 66 | return ERROR_SUCCESS; 67 | 68 | fail1: 69 | free(matchdata.StoreKeyName); 70 | Fail(Error); 71 | return Error; 72 | } 73 | 74 | HRESULT 75 | saveDevice( 76 | SUBKEY_ITERATOR_CALLBACK_DATA *cbargs, 77 | void *data 78 | ) 79 | { 80 | int err = -1; 81 | 82 | PTCHAR DestinationName; 83 | PTCHAR SourceName; 84 | BOOLEAN Success; 85 | HRESULT Error; 86 | 87 | STORE_IF_MATCHING_NET_LUID matchdata; 88 | 89 | SourceName = RegistryGetInterfaceName(cbargs->Key); 90 | if (SourceName == NULL) { 91 | Log("Can't find data source for device index %d"); 92 | goto done1; 93 | } 94 | 95 | DestinationName = RegistryGetStorageKeyName(cbargs->Key, INSTALLER_KEY_MAC); 96 | if (DestinationName == NULL) { 97 | Log("Can't find data destination"); 98 | goto done2; 99 | } 100 | 101 | Success &= RegistryStoreParameters(DestinationName, 102 | "NetBT", 103 | PARAMETERS_KEY(NetBT) "\\Interfaces\\Tcpip_", 104 | SourceName); 105 | Success &= RegistryStoreParameters(DestinationName, 106 | "Tcpip", 107 | PARAMETERS_KEY(Tcpip) "\\Interfaces\\", 108 | SourceName); 109 | Success &= RegistryStoreParameters(DestinationName, 110 | "Tcpip6", 111 | PARAMETERS_KEY(Tcpip6) "\\Interfaces\\", 112 | SourceName); 113 | 114 | Error = saveStaticNetworkConfiguration(cbargs->Key, STATIC_IPV4_KEY, INSTALLER_KEY_IPV4); 115 | if (Error != ERROR_SUCCESS) 116 | goto fail1; 117 | 118 | Error = saveStaticNetworkConfiguration(cbargs->Key, STATIC_IPV6_KEY, INSTALLER_KEY_IPV6); 119 | if (Error != ERROR_SUCCESS) 120 | goto fail2; 121 | 122 | free(DestinationName); 123 | done2: 124 | free(SourceName); 125 | 126 | done1: 127 | return ERROR_SUCCESS; 128 | 129 | fail2: 130 | fail1: 131 | 132 | free(SourceName); 133 | Fail(err); 134 | return err; 135 | } 136 | 137 | HRESULT 138 | SaveCmd( 139 | void 140 | ) 141 | { 142 | HRESULT err = 0; 143 | RegistryStopGuestAgentCopy(); 144 | err = RegistryIterateOverKeySubKeys(NETWORK_ADAPTER_CLASS_KEY, saveDevice, NULL); 145 | 146 | return err; 147 | } -------------------------------------------------------------------------------- /src/branding/WiSubStg.vbs: -------------------------------------------------------------------------------- 1 | ' Windows Installer utility to add a transform or nested database as a substorage 2 | ' For use with Windows Scripting Host, CScript.exe or WScript.exe 3 | ' Copyright (c) Microsoft Corporation. All rights reserved. 4 | ' Demonstrates the use of the database _Storages table 5 | ' 6 | Option Explicit 7 | 8 | Const msiOpenDatabaseModeReadOnly = 0 9 | Const msiOpenDatabaseModeTransact = 1 10 | Const msiOpenDatabaseModeCreate = 3 11 | 12 | Const msiViewModifyInsert = 1 13 | Const msiViewModifyUpdate = 2 14 | Const msiViewModifyAssign = 3 15 | Const msiViewModifyReplace = 4 16 | Const msiViewModifyDelete = 6 17 | 18 | Const ForAppending = 8 19 | Const ForReading = 1 20 | Const ForWriting = 2 21 | Const TristateTrue = -1 22 | 23 | ' Check arg count, and display help if argument not present or contains ? 24 | Dim argCount:argCount = Wscript.Arguments.Count 25 | If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0 26 | If (argCount = 0) Then 27 | Wscript.Echo "Windows Installer database substorage managment utility" &_ 28 | vbNewLine & " 1st argument is the path to MSI database (installer package)" &_ 29 | vbNewLine & " 2nd argument is the path to a transform or database to import" &_ 30 | vbNewLine & " If the 2nd argument is missing, substorages will be listed" &_ 31 | vbNewLine & " 3rd argument is optional, the name used for the substorage" &_ 32 | vbNewLine & " If the 3rd arugment is missing, the file name is used" &_ 33 | vbNewLine & " To remove a substorage, use /D or -D as the 2nd argument" &_ 34 | vbNewLine & " followed by the name of the substorage to remove" &_ 35 | vbNewLine &_ 36 | vbNewLine & "Copyright (C) Microsoft Corporation. All rights reserved." 37 | Wscript.Quit 1 38 | End If 39 | 40 | ' Connect to Windows Installer object 41 | On Error Resume Next 42 | Dim installer : Set installer = Nothing 43 | Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError 44 | 45 | ' Evaluate command-line arguments and set open and update modes 46 | Dim databasePath:databasePath = Wscript.Arguments(0) 47 | Dim openMode : If argCount = 1 Then openMode = msiOpenDatabaseModeReadOnly Else openMode = msiOpenDatabaseModeTransact 48 | Dim updateMode : If argCount > 1 Then updateMode = msiViewModifyAssign 'Either insert or replace existing row 49 | Dim importPath : If argCount > 1 Then importPath = Wscript.Arguments(1) 50 | Dim storageName : If argCount > 2 Then storageName = Wscript.Arguments(2) 51 | If storageName = Empty And importPath <> Empty Then storageName = Right(importPath, Len(importPath) - InStrRev(importPath, "\",-1,vbTextCompare)) 52 | If UCase(importPath) = "/D" Or UCase(importPath) = "-D" Then updateMode = msiViewModifyDelete : importPath = Empty 'substorage will be deleted if no input data 53 | 54 | ' Open database and create a view on the _Storages table 55 | Dim sqlQuery : Select Case updateMode 56 | Case msiOpenDatabaseModeReadOnly: sqlQuery = "SELECT `Name` FROM _Storages" 57 | Case msiViewModifyAssign: sqlQuery = "SELECT `Name`,`Data` FROM _Storages" 58 | Case msiViewModifyDelete: sqlQuery = "SELECT `Name` FROM _Storages WHERE `Name` = ?" 59 | End Select 60 | Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError 61 | Dim view : Set view = database.OpenView(sqlQuery) 62 | Dim record 63 | 64 | If openMode = msiOpenDatabaseModeReadOnly Then 'If listing storages, simply fetch all records 65 | Dim message, name 66 | view.Execute : CheckError 67 | Do 68 | Set record = view.Fetch 69 | If record Is Nothing Then Exit Do 70 | name = record.StringData(1) 71 | If message = Empty Then message = name Else message = message & vbNewLine & name 72 | Loop 73 | Wscript.Echo message 74 | Else 'If adding a storage, insert a row, else if removing a storage, delete the row 75 | Set record = installer.CreateRecord(2) 76 | record.StringData(1) = storageName 77 | view.Execute record : CheckError 78 | If importPath <> Empty Then 'Insert storage - copy data into stream 79 | record.SetStream 2, importPath : CheckError 80 | Else 'Delete storage, fetch first to provide better error message if missing 81 | Set record = view.Fetch 82 | If record Is Nothing Then Wscript.Echo "Storage not present:", storageName : Wscript.Quit 2 83 | End If 84 | view.Modify updateMode, record : CheckError 85 | database.Commit : CheckError 86 | Set view = Nothing 87 | Set database = Nothing 88 | CheckError 89 | End If 90 | 91 | Sub CheckError 92 | Dim message, errRec 93 | If Err = 0 Then Exit Sub 94 | message = Err.Source & " " & Hex(Err) & ": " & Err.Description 95 | If Not installer Is Nothing Then 96 | Set errRec = installer.LastErrorRecord 97 | If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText 98 | End If 99 | Wscript.Echo message 100 | Wscript.Quit 2 101 | End Sub 102 | -------------------------------------------------------------------------------- /src/InstallAgent/InstallAgent.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8D2F6A94-6F1D-4A53-8468-9CE77D28724A} 8 | WinExe 9 | Properties 10 | InstallAgent 11 | InstallAgent 12 | v3.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | ..\..\InstallAgent\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | ..\..\InstallAgent\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | InstallAgent.Program 36 | 37 | 38 | 39 | ..\..\BrandSupport\BrandSupport.dll 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Component 50 | 51 | 52 | InstallAgent.cs 53 | 54 | 55 | 56 | 57 | Component 58 | 59 | 60 | ProjectInstaller.cs 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | ProjectInstaller.cs 76 | 77 | 78 | 79 | 80 | Always 81 | 82 | 83 | 84 | 85 | {277a3c3d-c32d-41cd-89de-407c97ce29ff} 86 | HardwareDevice 87 | 88 | 89 | {6fff20b4-142b-43b9-83b3-89ddd118e216} 90 | HelperFunctions 91 | 92 | 93 | {ce6ce4a7-c693-4102-bebf-20777ac32d06} 94 | PInvokeWrap 95 | 96 | 97 | {b75c4d13-ef07-48fc-b028-5ed1ab7146cd} 98 | PVDriversRemoval 99 | 100 | 101 | 102 | 109 | 110 | -------------------------------------------------------------------------------- /src/vss/citrixvss.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 51 | 57 | 58 | 63 | 64 | 65 | 66 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/qnetsettings/qnetsettings.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Citrix Systems Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * * Redistributions in binary form must reproduce the above 12 | * copyright notice, this list of conditions and the 13 | * following disclaimer in the documentation and/or other 14 | * materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #include "stdafx.h" 33 | #include "qnetsettings.h" 34 | #include 35 | #include "Log.h" 36 | #include "save.h" 37 | #include "restore.h" 38 | #include "shlobj.h" 39 | #include 40 | #include 41 | #include "brandcontrol.h" 42 | 43 | #define SAVEARG _T("/save") 44 | #define RESTOREARG _T("/restore") 45 | #define INITARG _T("/init") 46 | #define HELPARG _T("/help") 47 | 48 | #define LOGARG _T("/log") 49 | 50 | #define InitCmd helpCmd 51 | 52 | FILE *logptr = stderr; 53 | 54 | int helpCmd(void) { 55 | Log(_T("qnetsettings.exe [ " LOGARG "] < ") SAVEARG _T(" | ") RESTOREARG _T(" | ") HELPARG _T(" >\n")); 56 | return 1; 57 | } 58 | 59 | BOOLEAN matchcmd(_TCHAR* varlength, _TCHAR* fixedlength) 60 | { 61 | Log("%s %s", varlength, fixedlength); 62 | 63 | if (_tcscmp(varlength, fixedlength) == 0) { 64 | return TRUE; 65 | } 66 | 67 | return FALSE; 68 | } 69 | 70 | int APIENTRY 71 | _tWinMain( 72 | _In_ HINSTANCE hInstance, 73 | _In_opt_ HINSTANCE hPrevInstance, 74 | _In_ LPTSTR lpCmdLine, 75 | _In_ int nCmdShow) 76 | { 77 | UNREFERENCED_PARAMETER(hPrevInstance); 78 | UNREFERENCED_PARAMETER(lpCmdLine); 79 | 80 | DWORD i = 1; 81 | HRESULT err=0; 82 | 83 | while (i < __argc) 84 | { 85 | if ( matchcmd(__argv[i], SAVEARG) ) 86 | { 87 | err = SaveCmd(); 88 | i++; 89 | } 90 | else if ( matchcmd(__argv[i], RESTOREARG) ) 91 | { 92 | err = RestoreCmd(); 93 | i++; 94 | } 95 | else if ( matchcmd(__argv[i], INITARG) ) 96 | { 97 | err = InitCmd(); 98 | i++; 99 | } 100 | else if ( matchcmd(__argv[i], LOGARG) ) 101 | { 102 | i++; 103 | TCHAR Buffer[MAX_PATH]; 104 | TCHAR PathName[MAX_PATH]; 105 | TCHAR LogName[MAX_PATH]; 106 | FILE *outlog; 107 | 108 | err = SHGetFolderPath(NULL,CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, Buffer); 109 | if (err != ERROR_SUCCESS) { 110 | Warning("Unable to find log folder"); 111 | continue; 112 | } 113 | 114 | err = sprintf_s(PathName, MAX_PATH, "%s\\%s", Buffer,getBrandingString(BRANDING_manufacturer)); 115 | if (err <= 0 && errno != EEXIST) { 116 | Warning("Unable to generate log path name"); 117 | continue; 118 | } 119 | 120 | err = _mkdir(PathName); 121 | if ((err != 0) && (errno != EEXIST)) { 122 | Warning("Unable to open %s programdata folder",getBrandingString(BRANDING_manufacturer)); 123 | continue; 124 | } 125 | 126 | err = sprintf_s(PathName, MAX_PATH, "%s\\%s\\%sNetSettings", Buffer,getBrandingString(BRANDING_manufacturer),getBrandingString(BRANDING_twoCharBrand)); 127 | if (err <= 0 ) { 128 | Warning("Unable to generate log path name"); 129 | continue; 130 | } 131 | 132 | err = _mkdir(PathName); 133 | if ((err != 0) && (errno != EEXIST)) { 134 | Warning("Unable to open %s %sNetSettings ProgramData folder", getBrandingString(BRANDING_manufacturer), getBrandingString(BRANDING_twoCharBrand)); 135 | continue; 136 | } 137 | 138 | err = sprintf_s(LogName, MAX_PATH, "%s\\NetSettings.log", PathName); 139 | if (err <= 0 ) { 140 | Warning("Unable to generate log name"); 141 | continue; 142 | } 143 | 144 | err = fopen_s(&outlog, LogName,"a+"); 145 | if (err != 0) { 146 | Warning("FOpen failed %s %d",__argv[i], err); 147 | continue; 148 | } 149 | 150 | fclose(logptr); 151 | Log("------------------------------------------------------------------------------"); 152 | Log(" New session"); 153 | Log("------------------------------------------------------------------------------"); 154 | logptr = outlog; 155 | 156 | } 157 | else 158 | { 159 | err = helpCmd(); 160 | break; 161 | } 162 | 163 | if (err > 0) 164 | break; 165 | } 166 | 167 | if (err == 0) { 168 | Log("Network Settings Handled Successfully"); 169 | } 170 | 171 | return err; 172 | } 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /src/setup/Setup.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {C7C87326-BDA6-46FC-9011-ECA10470342D} 15 | Win32Proj 16 | Setup 17 | 18 | 19 | 20 | Application 21 | true 22 | v110 23 | Unicode 24 | 25 | 26 | Application 27 | false 28 | v110_xp 29 | true 30 | Unicode 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | $(SolutionDir)..\setup\ 45 | 46 | 47 | false 48 | $(SolutionDir)..\setup\ 49 | 50 | 51 | 52 | NotUsing 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 56 | true 57 | MultiThreadedDebug 58 | ..\..\include 59 | 60 | 61 | Windows 62 | true 63 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;setupapi.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) 64 | RequireAdministrator 65 | 66 | 67 | 68 | 69 | Level3 70 | NotUsing 71 | MaxSpeed 72 | true 73 | true 74 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 75 | true 76 | MultiThreaded 77 | ..\..\include 78 | 79 | 80 | Windows 81 | true 82 | true 83 | true 84 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;setupapi.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/installwizard/InstallGui/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | --------------------------------------------------------------------------------