private void LoadValues(RegistryKey key) { toolStripStatusLabel1.Text = key.Name; lstValues.Items.Clear(); List <RegValue> values = RegExplorer.GetValues(key); if (values != null) { if (values.Count == 0) { AddValueToList(key, CreateDefaultValue()); } else { lstValues.SuspendLayout(); RegValue defaultValue = CreateDefaultValue(); if (values.SingleOrDefault((val) => val.Name == defaultValue.Name) == null) { AddValueToList(key, defaultValue); } foreach (RegValue value in values) { AddValueToList(key, value); } lstValues.ResumeLayout(); } } }
public static string GetConfig(string KeyName) { Backend.Background.WriteNUTLog("[CONFIG] Checking for registry key: " + KeyName); RegistryKey RegKey = Registry.CurrentUser.OpenSubKey("Software\\NUTty UPS Client", false); object RegValue; try { RegValue = RegKey.GetValue(KeyName); Backend.Background.WriteNUTLog("[CONFIG] Got: " + RegValue.ToString()); switch (RegKey.GetValueKind(KeyName)) { case RegistryValueKind.String: return(RegValue.ToString()); case RegistryValueKind.ExpandString: Backend.Background.WriteNUTLog("[CONFIG] Got: " + RegValue); break; case RegistryValueKind.Binary: foreach (byte b in (byte[])RegValue) { Console.Write("{0:x2} ", b); } break; case RegistryValueKind.DWord: Backend.Background.WriteNUTLog("[CONFIG] Got: " + Convert.ToString((int)RegValue)); break; case RegistryValueKind.QWord: Backend.Background.WriteNUTLog("[CONFIG] Got: " + Convert.ToString((long)RegValue)); break; case RegistryValueKind.MultiString: foreach (string s in (string[])RegValue) { Console.Write("[{0:s}], ", s); } break; default: Backend.Background.WriteNUTLog("[CONFIG] Got: Unknown"); break; } } catch (NullReferenceException) { Backend.Background.WriteNUTLog("[CONFIG] Registry key does not exist: " + KeyName); return(null); } catch (Exception e) { Backend.Background.WriteNUTLog("[CONFIG] Failed to read registry key: " + e); return(null); } return(RegValue.ToString()); }
public override void WriteValue(string name, RegistryValueKind kind, object data) { xmlWriter.WriteStartElement("value"); xmlWriter.WriteAttributeString("name", name); xmlWriter.WriteAttributeString("type", kind.ToDataType()); xmlWriter.WriteAttributeString("data", RegValue.ToString(kind, data)); xmlWriter.WriteEndElement(); }
public override void WriteValue(string name, RegistryValueKind kind, object data) { Writer.WriteLine("Value {0}", counter++); Writer.WriteLine(" Name:\t{0}", name); Writer.WriteLine(" Type:\t{0}", kind.ToDataType()); Writer.WriteLine(" Data:\t{0}", RegValue.ToString(kind, data)); Writer.WriteLine(); }
private void populateRegKeyValues(caCommandMessages.RegKey respKey, RegistryKey sysKey) { String[] valNames = sysKey.GetValueNames(); if (valNames.Length > 0) { RegValue[] values = new RegValue[valNames.Length]; for (int i = 0; i < valNames.Length; i++) { RegistryValueKind valKind = sysKey.GetValueKind(valNames[i]); RegValue val = null; switch (valKind) { case RegistryValueKind.String: val = new RegStringValue(valNames[i], (String)sysKey.GetValue(valNames[i])); break; case RegistryValueKind.Binary: val = new RegBinaryValue(valNames[i], (byte[])sysKey.GetValue(valNames[i])); break; case RegistryValueKind.DWord: val = new RegDWORDValue(valNames[i], (int)sysKey.GetValue(valNames[i])); break; case RegistryValueKind.ExpandString: val = new RegExpandStringValue(valNames[i], (String)sysKey.GetValue(valNames[i], null, RegistryValueOptions.DoNotExpandEnvironmentNames), (String)sysKey.GetValue(valNames[i])); break; case RegistryValueKind.MultiString: val = new RegMultiStringValue(valNames[i], (String[])sysKey.GetValue(valNames[i])); break; case RegistryValueKind.QWord: val = new RegQWORDValue(valNames[i], (long)sysKey.GetValue(valNames[i])); break; case RegistryValueKind.Unknown: val = null; // Can't handle Unknown Type break; case RegistryValueKind.None: val = null; // Can't handle None Type break; } // Save the value values[i] = (RegValue)val; } respKey.values = values; } }
private void MatchData(Microsoft.Win32.RegistryKey key, string valueName) { string valueData; valueData = RegValue.ToString(key.GetValue(valueName, string.Empty)); if (comparer.IsMatch(valueData)) { AddMatch(key.Name, valueName, valueData); } }
/// <summary> /// /// </summary> /// <param name="bootKey"></param> /// <returns></returns> private byte[] GenerateHashedBootKey(List <byte> bootKey) { try { RegParser regParser = new RegParser(_samFile); RegKey rootKey = regParser.RootKey; RegKey regKey = rootKey.Key(@"SAM\Domains\Account"); if (regKey == null) { this.OnError("Unable to locate the following registry key: SAM\\SAM\\Domains\\Account"); return(null); } RegValue regValue = regKey.Value("F"); if (regValue == null) { this.OnError("Unable to locate the following registry key: SAM\\SAM\\Domains\\Account\\F"); return(null); } byte[] hashedBootKey = new byte[16]; Buffer.BlockCopy((byte[])regValue.Data, 112, hashedBootKey, 0, 16); //this.PrintHex("Hashed bootkey", hashedBootKey.ToArray()); List <byte> data = new List <byte>(); data.AddRange(hashedBootKey.ToArray()); data.AddRange(Encoding.ASCII.GetBytes(_aqwerty)); data.AddRange(bootKey.ToArray()); data.AddRange(Encoding.ASCII.GetBytes(_anum)); byte[] md5 = MD5.Create().ComputeHash(data.ToArray()); byte[] encData = new byte[32]; byte[] encOutput = new byte[32]; Buffer.BlockCopy((byte[])regValue.Data, 128, encData, 0, 32); RC4Engine rc4Engine = new RC4Engine(); rc4Engine.Init(true, new KeyParameter(md5)); rc4Engine.ProcessBytes(encData, 0, 32, encOutput, 0); return(encOutput); } catch (Exception ex) { this.OnError("An error occured whilst generating the hashed boot key"); Misc.WriteToEventLog(Application.ProductName, ex.Message, EventLogEntryType.Error); return(null); } }
private ListViewItem AddValueToList(RegistryKey key, RegValue value) { ListViewItem item = lstValues.Items.Add(value.Name); item.ImageKey = GetValueTypeIcon(value.Kind); item.Name = value.Name; item.Tag = key; item.SubItems.Add(value.Kind.ToDataType()); ListViewItem.ListViewSubItem subItem = item.SubItems.Add(value.ToString()); subItem.Tag = value; return(item); }
public DWordEditor(RegValue value) : base(value) { InitializeComponent(); string data; if (value.Kind == Microsoft.Win32.RegistryValueKind.DWord) { data = ((int)value.Data).ToString("x"); } else { data = ((long)value.Data).ToString("x"); } }
// /// <summary> /// /// </summary> /// <param name="key"></param> /// <returns></returns> public static List <RegValue> GetRegValues(RegistryKey key) { List <RegValue> response = new List <RegValue>(); foreach (var keyValueName in key.GetValueNames()) { RegValue regValue = new RegValue() { Path = key.Name, Name = keyValueName, Data = key.GetValue(keyValueName), Type = key.GetValueKind(keyValueName).ToString() }; response.Add(regValue); } return(response); }
private void OnValueEditAction() { if (lstValues.SelectedItems.Count == 1) { RegValue value = (RegValue)lstValues.SelectedItems[0].SubItems[2].Tag; if (value.ParentKey != null) { ValueEditor editor = null; switch (value.Kind) { case RegistryValueKind.Binary: editor = new BinaryEditor(value); break; case RegistryValueKind.MultiString: editor = new MultiStringEditor(value); break; case RegistryValueKind.DWord: case RegistryValueKind.QWord: editor = new DWordEditor(value); break; case RegistryValueKind.String: case RegistryValueKind.ExpandString: editor = new StringEditor(value); break; case RegistryValueKind.Unknown: default: break; } if (editor != null) { if (editor.ShowDialog(this) == DialogResult.OK) { RefreshValues(); } } } } }
public RegFile(string fileName, bool X64, string CIName, bool MachinePolicy) { x64 = X64; _filename = fileName; POL oPol = new POL(fileName, MachinePolicy); //generate XML Body InitXML(CIName); string SettingName = CIName; String Description = "Reg2CI (c) 2018 by Roger Zander"; RegKeys = new List <RegKey>(); RegValues = new List <RegValue>(); int iPos = 0; bool bHKLM = MachinePolicy; bool bHKCU = !MachinePolicy; foreach (POLPolicy oPolicy in oPol.Policies) { RegKey rKey = new RegKey(oPolicy.Key, iPos); RegKeys.Add(rKey); RegValue oValue = new RegValue(oPolicy.Value, oPolicy.Data, oPolicy.Type, iPos); RegValues.Add(oValue); iPos++; } if (bPSScript) { if (bHKLM) { CreatePSXMLAll(SettingName, Description, "HKLM:"); } if (bHKCU) { CreatePSXMLAll(SettingName, Description, "HKCU:"); } } }
private void lstValues_AfterLabelEdit(object sender, LabelEditEventArgs e) { lstValues.LabelEdit = false; ListViewItem item = lstValues.Items[e.Item]; string valName = e.Label == null ? item.Text : e.Label; try { RegistryKey readOnlyKey = (RegistryKey)item.Tag; RegistryKey key = RegKey.Parse(readOnlyKey.Name, true).Key; RegValue value = (RegValue)item.SubItems[2].Tag; key.SetValue(valName, value.Data, value.Kind); item.Name = valName; item.SubItems[2].Tag = new RegValue(readOnlyKey, valName); } catch { item.Remove(); UIUtility.DisplayError(this, Properties.Resources.Error_CreateValueFail); } }
public StringEditor(RegValue value) : base(value) { InitializeComponent(); txtData.Text = value.Data.ToString(); }
public BinaryEditor(RegValue value) : base(value) { InitializeComponent(); byteProvider = new DynamicByteProvider((byte[])value.Data); txtData.ByteProvider = byteProvider; }
public ValueEditor(RegValue value) : this() { Value = value; txtName.Text = value.Name; txtName.Modified = false; }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <returns></returns> private List <UserGroup> ExtractGroups() { RegParser regParser = new RegParser(_samFile); RegKey rootKey = regParser.RootKey; RegKey regKey = rootKey.Key("SAM\\Domains\\Builtin\\Aliases"); if (regKey == null) { Console.WriteLine("Unable to locate the following registry key: SAM\\Domains\\Builtin\\Aliases"); return(null); } List <UserGroup> userGroups = new List <UserGroup>(); List <RegKey> regKeys = regKey.SubKeys; for (int indexKeys = 0; indexKeys < regKeys.Count; indexKeys++) { //Console.WriteLine(regKeys[indexKeys].Name); RegValue regValue = regKeys[indexKeys].Value("C"); if (regValue == null) { continue; } byte[] data = (byte[])regValue.Data; int offset = BitConverter.ToInt32((byte[])data, 16); int length = BitConverter.ToInt32((byte[])data, 20); offset += 52; byte[] extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); // Group Name //Console.WriteLine("Group Name: " + Functions.ConvertUnicodeToAscii(Functions.ByteArray2String(extract, false, false))); string groupName = Text.ConvertUnicodeToAscii(Text.ByteArray2String(extract, false, false)); offset = BitConverter.ToInt32((byte[])data, 28); length = BitConverter.ToInt32((byte[])data, 32); offset += 52; extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); // Comment //Console.WriteLine("Comment: " + Functions.ConvertUnicodeToAscii(Functions.ByteArray2String(extract, false, false))); int users = BitConverter.ToInt32((byte[])data, 48); // No. Users //Console.WriteLine("No. Users: " + users); offset = BitConverter.ToInt32((byte[])data, 40); length = BitConverter.ToInt32((byte[])data, 44); if (users > 0) { int count = 0; for (int indexUsers = 1; indexUsers <= users; indexUsers++) { int dataOffset = offset + 52 + count; int sidType = BitConverter.ToInt32((byte[])data, dataOffset); UserGroup userGroup = new UserGroup(); if (sidType == 257) { extract = new byte[12]; Buffer.BlockCopy(data, dataOffset, extract, 0, 12); int rev = extract[0]; int dashes = BitConverter.ToInt32((byte[])extract, 1); byte[] ntauthData = new byte[8]; Buffer.BlockCopy(extract, 2, ntauthData, 2, 6); string ntauth = Text.ConvertByteArrayToHexString(ntauthData); ntauth = Regex.Replace(ntauth, "^0+", string.Empty); byte[] ntnonunique = new byte[4]; Buffer.BlockCopy(extract, 8, ntnonunique, 0, 4); uint intntnonunique = BitConverter.ToUInt32((byte[])ntnonunique, 0); //Console.WriteLine("S-" + rev + "-" + ntauth + "-" + intntnonunique); userGroup.Group = groupName; userGroup.Rid = "S-" + rev + "-" + ntauth + "-" + intntnonunique; userGroups.Add(userGroup); count += 12; } else if (sidType == 1281) { extract = new byte[26]; Buffer.BlockCopy(data, dataOffset, extract, 0, 26); int rev = extract[0]; int dashes = BitConverter.ToInt32((byte[])extract, 1); byte[] ntauthData = new byte[8]; Buffer.BlockCopy(extract, 2, ntauthData, 2, 6); string ntauth = Text.ConvertByteArrayToHexString(ntauthData); ntauth = Regex.Replace(ntauth, "^0+", string.Empty); byte[] ntnonunique = new byte[4]; Buffer.BlockCopy(extract, 8, ntnonunique, 0, 4); uint intntnonunique = BitConverter.ToUInt32((byte[])ntnonunique, 0); byte[] part1 = new byte[4]; Buffer.BlockCopy(extract, 12, part1, 0, 4); uint intpart1 = BitConverter.ToUInt32((byte[])part1, 0); byte[] part2 = new byte[4]; Buffer.BlockCopy(extract, 16, part2, 0, 4); uint intpart2 = BitConverter.ToUInt32((byte[])part2, 0); byte[] part3 = new byte[4]; Buffer.BlockCopy(extract, 20, part3, 0, 4); uint intpart3 = BitConverter.ToUInt32((byte[])part3, 0); byte[] rid = new byte[4]; Buffer.BlockCopy(extract, 24, rid, 0, 2); int intrid = BitConverter.ToInt32((byte[])rid, 0); //Console.WriteLine("S-" + rev + "-" + ntauth + "-" + intntnonunique + "-" + intpart1 + "-" + intpart2 + "-" + intpart3 + "-" + intrid); userGroup.Group = groupName; userGroup.Rid = "S-" + rev + "-" + ntauth + "-" + intntnonunique + "-" + intpart1 + "-" + intpart2 + "-" + intpart3 + "-" + intrid; userGroups.Add(userGroup); count += 28; } } } } return(userGroups); }
/// <summary> /// /// </summary> /// <param name="hashedBootKey"></param> /// <returns></returns> private bool EnumerateUsers(byte[] hashedBootKey) { try { RegParser regParser = new RegParser(_samFile); RegKey rootKey = regParser.RootKey; RegKey regkey = rootKey.Key("SAM\\Domains\\Account\\Users"); if (regkey == null) { this.OnError("Unable to locate the following registry key: SAM\\Domains\\Account\\Users"); return(false); } List <RegKey> regKeys = regkey.SubKeys; for (int indexKeys = 0; indexKeys < regKeys.Count; indexKeys++) { RegValue regValue = regKeys[indexKeys].Value("V"); if (regValue == null) { continue; } UserAccount userAccount = new UserAccount(); string hexRid = Helper.RemoveHivePrefix(regKeys[indexKeys].Name).Replace("SAM\\Domains\\Account\\Users\\", string.Empty); hexRid = Helper.RemoveHivePrefix(hexRid).Replace("SAM\\", string.Empty); hexRid = Helper.RemoveHivePrefix(hexRid).Replace("ROOT\\", string.Empty); byte[] data = (byte[])regValue.Data; int offset = BitConverter.ToInt32((byte[])data, 12); int length = BitConverter.ToInt32((byte[])data, 16); offset += 204; byte[] extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); userAccount.LoginName = Helper.ReplaceNulls(Text.ConvertUnicodeToAscii(Text.ByteArray2String(extract, false, false))); offset = BitConverter.ToInt32((byte[])data, 24); length = BitConverter.ToInt32((byte[])data, 28); offset += 204; extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); // Name userAccount.Name = Helper.ReplaceNulls(Text.ConvertUnicodeToAscii(Text.ByteArray2String(extract, false, false))); offset = BitConverter.ToInt32((byte[])data, 36); length = BitConverter.ToInt32((byte[])data, 40); offset += 204; extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); // Description if (length > 0) { userAccount.Description = Helper.ReplaceNulls(Text.ConvertUnicodeToAscii(Text.ByteArray2String(extract, false, false))); } offset = BitConverter.ToInt32((byte[])data, 48); length = BitConverter.ToInt32((byte[])data, 52); offset += 204; extract = new byte[length]; Buffer.BlockCopy(data, offset, extract, 0, length); // User Comment if (length > 0) { userAccount.UserComment = Helper.ReplaceNulls(Text.ConvertUnicodeToAscii(Text.ByteArray2String(extract, false, false))); } // LM Hash offset = BitConverter.ToInt32((byte[])data, 156); length = BitConverter.ToInt32((byte[])data, 160); offset += 204; userAccount.EncLmHash = new byte[length]; Buffer.BlockCopy(data, offset, userAccount.EncLmHash, 0, length); // NT Hash offset = BitConverter.ToInt32((byte[])data, 168); length = BitConverter.ToInt32((byte[])data, 172); offset += 204; userAccount.EncNtHash = new byte[length]; Buffer.BlockCopy(data, offset, userAccount.EncNtHash, 0, length); if (userAccount.EncLmHash.Length == 20) { byte[] tempLmHash = new byte[16]; Buffer.BlockCopy(userAccount.EncLmHash, 4, tempLmHash, 0, 16); userAccount.EncLmHash = tempLmHash; this.DecryptHash(hexRid, hashedBootKey, _lmpassword, true, userAccount); } else { userAccount.Rid = Int32.Parse(hexRid, System.Globalization.NumberStyles.HexNumber); Debug.WriteLine("**LMLEN**: " + userAccount.EncLmHash.Length); } if (userAccount.EncNtHash.Length == 20) { byte[] tempNtHash = new byte[16]; Buffer.BlockCopy(userAccount.EncNtHash, 4, tempNtHash, 0, 16); userAccount.EncNtHash = tempNtHash; this.DecryptHash(hexRid, hashedBootKey, _ntpassword, false, userAccount); } else { userAccount.Rid = Int32.Parse(hexRid, System.Globalization.NumberStyles.HexNumber); Debug.WriteLine("**NTLEN**: " + userAccount.EncNtHash.Length); } // F regValue = regKeys[indexKeys].Value("F"); data = (byte[])regValue.Data; extract = new byte[8]; Buffer.BlockCopy(data, 8, extract, 0, 8); long i = BitConverter.ToInt64((byte[])extract, 0); DateTime dateTime = DateTime.FromFileTimeUtc(i); userAccount.LastLoginDate = dateTime.ToShortTimeString() + " " + dateTime.ToShortDateString(); extract = new byte[8]; Buffer.BlockCopy(data, 24, extract, 0, 8); i = BitConverter.ToInt64((byte[])extract, 0); dateTime = DateTime.FromFileTimeUtc(i); userAccount.PasswordResetDate = dateTime.ToShortTimeString() + " " + dateTime.ToShortDateString(); extract = new byte[8]; Buffer.BlockCopy(data, 32, extract, 0, 8); i = BitConverter.ToInt64((byte[])extract, 0); if (i == 0 | i == 9223372036854775807) { userAccount.AccountExpiryDate = string.Empty; } else { dateTime = DateTime.FromFileTimeUtc(i); userAccount.AccountExpiryDate = dateTime.ToShortTimeString() + " " + dateTime.ToShortDateString(); } extract = new byte[8]; Buffer.BlockCopy(data, 40, extract, 0, 8); i = BitConverter.ToInt64((byte[])extract, 0); dateTime = DateTime.FromFileTimeUtc(i); userAccount.LoginFailedDate = dateTime.ToShortTimeString() + " " + dateTime.ToShortDateString(); //extract = new byte[4]; //Buffer.BlockCopy(data, 48, extract, 0, 4); //i = BitConverter.ToInt32((byte[])extract, 0); //output.AppendLine("RID: " + i); extract = new byte[2]; Buffer.BlockCopy(data, 56, extract, 0, 2); i = BitConverter.ToInt16((byte[])extract, 0); if ((i & (int)0x0001) == 0x0001) { userAccount.IsDisabled = true; } //foreach (DictionaryEntry de in _acbs) //{ // if ((i & (int)de.Key) == (int)de.Key) // { // output.AppendLine(de.Value.ToString()); // } //} extract = new byte[2]; Buffer.BlockCopy(data, 64, extract, 0, 2); i = BitConverter.ToInt16((byte[])extract, 0); userAccount.FailedLogins = i; extract = new byte[2]; Buffer.BlockCopy(data, 66, extract, 0, 2); i = BitConverter.ToInt16((byte[])extract, 0); userAccount.LoginCount = i; _userAccounts.Add(userAccount); } return(true); } catch (Exception ex) { this.OnError("An error occured whilst enumerating users"); Misc.WriteToEventLog(Application.ProductName, "An error occured whilst enumerating users: " + ex.Message, EventLogEntryType.Error); return(false); } }
static void Main(string[] args) { var projectName = $"KL² Server v{ToCompactVersionString(Version.Parse(API_VersionToBuild))}"; /////////////// KL² API MSI /////////////// var API_projectName = $"{API_appName} v{ToCompactVersionString(Version.Parse(API_VersionToBuild))}"; Dir API_scannAppDir = ScanFiles("API", System.IO.Path.GetFullPath(@"..\KL2-Core\KProcess.KL2.API\bin\Release"), (file) => file.EndsWith(".pdb") || (file.EndsWith(".xml") && !file.EndsWith("PublicKey.xml")) || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest")); Dir API_appDir = new Dir(@"C:", new Dir("K-process", new Dir("KL² Suite", API_scannAppDir))); RegValue API_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, API_regKey, "InstallLocation", "[INSTALLDIR]"); UrlReservation API_urlAcl = new UrlReservation("http://*:8081/", "*S-1-1-0", UrlReservationRights.all); FirewallException API_firewall = new FirewallException("KL2-API") { Scope = FirewallExceptionScope.any, IgnoreFailure = true, Port = "8081" }; ManagedAction API_editConfig = new ManagedAction(CustomActions.API_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed); ElevatedManagedAction API_uninstallService = new ElevatedManagedAction(CustomActions.API_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled); var API_project = new ManagedProject(API_projectName, API_appDir, API_installReg, API_urlAcl, API_firewall, API_editConfig, API_uninstallService) { GUID = Versions.API_List.Single(_ => _.Key.ToString() == API_VersionToBuild).Value, Version = Version.Parse(API_VersionToBuild), UpgradeCode = API_UpgradeCode, AttributesDefinition = $"Id={Versions.API_List.Single(_ => _.Key.ToString() == API_VersionToBuild).Value};Manufacturer={manufacturer}", Description = $"{API_projectName},{manufacturer}", InstallScope = InstallScope.perMachine, Properties = new[] { new Property("DATASOURCE", @"(LocalDb)\KL2"), new Property("APPLICATION_URL", "http://*:8081"), new Property("FILESERVER_LOCATION", "http://*****:*****@"..\..\Assets\kl2_Suite.ico"; API_project.MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = true, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; API_project.Include(WixExtension.Util) .Include(WixExtension.Http); API_project.WixVariables.Add("WixUILicenseRtf", "License.rtf"); API_project.BeforeInstall += API_Project_BeforeInstall; API_project.AfterInstall += API_Project_AfterInstall; // Save the list of files to check integrity void LogFiles(System.IO.StreamWriter writer, int rootCount, Dir root) { foreach (var file in root.Files) { if (file.Name.EndsWith("WebServer.log")) { continue; } var splittedFileName = file.Name.Split('\\').ToList(); for (var i = 0; i < rootCount; i++) { splittedFileName.RemoveAt(0); } writer.WriteLine(string.Join("\\", splittedFileName.ToArray())); } foreach (var dir in root.Dirs) { LogFiles(writer, rootCount, dir); } } using (var writer = System.IO.File.CreateText("API_FileList.txt")) { var rootCount = API_scannAppDir.Files.First().Name.Split('\\').Length - 1; LogFiles(writer, rootCount, API_scannAppDir); } API_project.BuildWxs(Compiler.OutputType.MSI, "KL2API_project.wxs"); string API_productMsi = API_project.BuildMsi("KL²API.msi"); /////////////// KL² FileServer MSI /////////////// var FileServer_projectName = $"{FileServer_appName} v{ToCompactVersionString(Version.Parse(FileServer_VersionToBuild))}"; Dir FileServer_scannAppDir = ScanFiles("FileServer", System.IO.Path.GetFullPath(@"..\KL2-Core\Kprocess.KL2.FileServer\bin\Release"), (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest")); Dir FileServer_appDir = new Dir(@"C:", new Dir("K-process", new Dir("KL² Suite", FileServer_scannAppDir))); RegValue FileServer_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, FileServer_regKey, "InstallLocation", "[INSTALLDIR]"); UrlReservation FileServer_urlAcl = new UrlReservation("http://*:8082/", "*S-1-1-0", UrlReservationRights.all); FirewallException FileServer_firewall = new FirewallException("KL2-FilesServer") { Scope = FirewallExceptionScope.any, IgnoreFailure = true, Port = "8082" }; ManagedAction FileServer_editConfig = new ManagedAction(CustomActions.FileServer_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed); ElevatedManagedAction FileServer_uninstallService = new ElevatedManagedAction(CustomActions.FileServer_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled); var FileServer_project = new ManagedProject(FileServer_projectName, FileServer_appDir, FileServer_installReg, FileServer_urlAcl, FileServer_firewall, FileServer_editConfig, FileServer_uninstallService) { GUID = Versions.FileServer_List.Single(_ => _.Key.ToString() == FileServer_VersionToBuild).Value, Version = Version.Parse(FileServer_VersionToBuild), UpgradeCode = FileServer_UpgradeCode, AttributesDefinition = $"Id={Versions.FileServer_List.Single(_ => _.Key.ToString() == FileServer_VersionToBuild).Value};Manufacturer={manufacturer}", Description = $"{FileServer_projectName},{manufacturer}", InstallScope = InstallScope.perMachine, Properties = new[] { new Property("DATASOURCE", @"(LocalDb)\KL2"), new Property("APPLICATION_URL", "http://*:8082"), new Property("FILE_PROVIDER", "SFtp"), new Property("SERVER", "127.0.0.1"), new Property("PORT", "22"), new Property("USER", "kl2"), new Property("PASSWORD", "kl2"), new Property("PUBLISHED_DIR", "/PublishedFiles"), new Property("UPLOADED_DIR", "/UploadedFiles"), new Property("BUNDLE_ID", "[BUNDLE_ID]") } }; FileServer_project.Package.AttributesDefinition = $"Id=*;InstallerVersion=500;Comments={FileServer_projectName};Keywords={FileServer_projectName},{manufacturer}"; FileServer_project.SetNetFxPrerequisite(new WixSharp.Condition(" (NETFRAMEWORK45 >= '#461308') "), "Please install .Net Framework 4.7.1 first."); FileServer_project.ControlPanelInfo.ProductIcon = @"..\..\Assets\kl2_Suite.ico"; FileServer_project.MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = true, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; FileServer_project.Include(WixExtension.Util) .Include(WixExtension.Http); FileServer_project.WixVariables.Add("WixUILicenseRtf", "License.rtf"); FileServer_project.BeforeInstall += FileServer_Project_BeforeInstall; FileServer_project.AfterInstall += FileServer_Project_AfterInstall; // Save the list of files to check integrity using (var writer = System.IO.File.CreateText("FileServer_FileList.txt")) { var rootCount = FileServer_scannAppDir.Files.First().Name.Split('\\').Length - 1; LogFiles(writer, rootCount, FileServer_scannAppDir); } FileServer_project.BuildWxs(Compiler.OutputType.MSI, "KL2FileServer_project.wxs"); string FileServer_productMsi = FileServer_project.BuildMsi("KL²FileServer.msi"); /////////////// KL² Notification MSI /////////////// var Notification_projectName = $"{Notification_appName} v{ToCompactVersionString(Version.Parse(Notification_VersionToBuild))}"; Dir Notification_scannAppDir = ScanFiles("Notification", System.IO.Path.GetFullPath(@"..\KProcess.KL2.Notification\bin\Release"), (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest")); Dir Notification_appDir = new Dir(@"C:", new Dir("K-process", new Dir("KL² Suite", Notification_scannAppDir))); RegValue Notification_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, Notification_regKey, "InstallLocation", "[INSTALLDIR]"); ManagedAction Notification_editConfig = new ManagedAction(CustomActions.Notification_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed); ElevatedManagedAction Notification_uninstallService = new ElevatedManagedAction(CustomActions.Notification_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled); var Notification_project = new ManagedProject(Notification_projectName, Notification_appDir, Notification_installReg, Notification_editConfig, Notification_uninstallService) { GUID = Versions.Notification_List.Single(_ => _.Key.ToString() == Notification_VersionToBuild).Value, Version = Version.Parse(Notification_VersionToBuild), UpgradeCode = Notification_UpgradeCode, AttributesDefinition = $"Id={Versions.Notification_List.Single(_ => _.Key.ToString() == Notification_VersionToBuild).Value};Manufacturer={manufacturer}", Description = $"{Notification_projectName},{manufacturer}", InstallScope = InstallScope.perMachine, Properties = new[] { new Property("DATASOURCE", @"(LocalDb)\KL2"), new Property("FILESERVER_LOCATION", "http://*****:*****@"..\..\Assets\kl2_Suite.ico"; Notification_project.MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = true, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; Notification_project.WixVariables.Add("WixUILicenseRtf", "License.rtf"); Notification_project.BeforeInstall += Notification_Project_BeforeInstall; Notification_project.AfterInstall += Notification_Project_AfterInstall; // Save the list of files to check integrity using (var writer = System.IO.File.CreateText("Notification_FileList.txt")) { var rootCount = Notification_scannAppDir.Files.First().Name.Split('\\').Length - 1; LogFiles(writer, rootCount, Notification_scannAppDir); } Notification_project.BuildWxs(Compiler.OutputType.MSI, "KL2Notification_project.wxs"); string Notification_productMsi = Notification_project.BuildMsi("KL²Notification.msi"); /////////////// KL² WebAdmin MSI /////////////// var WebAdmin_projectName = $"{WebAdmin_appName} v{ToCompactVersionString(Version.Parse(WebAdmin_VersionToBuild))}"; Dir WebAdmin_scannAppDir = ScanWebFiles("KL2 Web Services", System.IO.Path.GetFullPath(@"..\KProcess.KL2.WebAdmin\bin\Release\PublishOutput"), new IISVirtualDir { Name = "KL2 Web Services", AppName = "KL2 Web Services", WebSite = new WebSite("KL2 Web Services", "*:8080") { InstallWebSite = true }, WebAppPool = new WebAppPool("KL2AppPoolName", "Identity=applicationPoolIdentity") }); Dir WebAdmin_appDir = new Dir(@"C:", new Dir("inetpub", WebAdmin_scannAppDir) ); ElevatedManagedAction WebAdmin_editConfig = new ElevatedManagedAction(CustomActions.WebAdmin_EditConfig, Return.check, When.Before, Step.InstallFinalize, WixSharp.Condition.NOT_Installed) { UsesProperties = "D_INSTALLDIR=[INSTALLDIR];D_DATASOURCE=[DATASOURCE];D_API_LOCATION=[API_LOCATION];D_FILESERVER_LOCATION=[FILESERVER_LOCATION]" }; UrlReservation WebAdmin_urlAcl = new UrlReservation("http://*:8080/", "*S-1-1-0", UrlReservationRights.all); FirewallException WebAdmin_firewall = new FirewallException("KL2-WebServices") { Scope = FirewallExceptionScope.any, IgnoreFailure = true, Port = "8080" }; var WebAdmin_project = new ManagedProject(WebAdmin_projectName, WebAdmin_appDir, WebAdmin_editConfig, WebAdmin_urlAcl, WebAdmin_firewall) { GUID = Versions.WebAdmin_List.Single(_ => _.Key.ToString() == WebAdmin_VersionToBuild).Value, Version = Version.Parse(WebAdmin_VersionToBuild), UpgradeCode = WebAdmin_UpgradeCode, AttributesDefinition = $"Id={Versions.WebAdmin_List.Single(_ => _.Key.ToString() == WebAdmin_VersionToBuild).Value};Manufacturer={manufacturer}", Description = $"{WebAdmin_projectName},{manufacturer}", InstallScope = InstallScope.perMachine, Properties = new[] { new Property("DATASOURCE", @"(LocalDb)\KL2"), new Property("API_LOCATION", "http://*****:*****@"..\..\Assets\kl2_WebServices.ico"; WebAdmin_project.MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = true, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; WebAdmin_project.WixVariables.Add("WixUILicenseRtf", "License.rtf"); WebAdmin_project.DefaultDeferredProperties += "DATASOURCE=[DATASOURCE];API_LOCATION=[API_LOCATION];FILESERVER_LOCATION=[FILESERVER_LOCATION];"; WebAdmin_project.BeforeInstall += WebAdmin_Project_BeforeInstall; // Save the list of files to check integrity using (var writer = System.IO.File.CreateText("WebAdmin_FileList.txt")) { var rootCount = WebAdmin_scannAppDir.Files.First().Name.Split('\\').Length - 1; LogFiles(writer, rootCount, WebAdmin_scannAppDir); } WebAdmin_project.BuildWxs(Compiler.OutputType.MSI, "KL2WebAdmin_project.wxs"); string WebAdmin_productMsi = WebAdmin_project.BuildMsi("KL²WebServices.msi"); /////////////// BOOTSTRAPPER /////////////// var bootstrapper = new Bundle(projectName, new PackageGroupRef("NetFx471Redist"), new MsiPackage(API_productMsi) { Id = "KL2_API_MSI", MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILESERVER_LOCATION=[FILESERVER_LOCATION];" }, new MsiPackage(FileServer_productMsi) { Id = "KL2_FILESERVER_MSI", MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILE_PROVIDER=[FILE_PROVIDER]; SERVER=[SERVER]; PORT=[PORT]; USER=[USER]; PASSWORD=[PASSWORD]; PUBLISHED_DIR=[PUBLISHED_DIR]; UPLOADED_DIR=[UPLOADED_DIR];" }, new MsiPackage(Notification_productMsi) { Id = "KL2_NOTIFICATION_MSI", MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILESERVER_LOCATION=[FILESERVER_LOCATION]; INTERVAL=[INTERVAL];" }, new MsiPackage(WebAdmin_productMsi) { Id = "KL2_WEBSERVICES_MSI", MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; API_LOCATION=[API_LOCATION]; FILESERVER_LOCATION=[FILESERVER_LOCATION];" }) { Version = API_project.Version, Manufacturer = manufacturer, UpgradeCode = BootstrapperUpgradeCode, AboutUrl = @"http://www.k-process.com/", IconFile = @"..\..\Assets\kl2_Suite.ico", SuppressWixMbaPrereqVars = true, DisableModify = "yes", Application = new ManagedBootstrapperApplication(@"..\KProcess.KL2.Server.SetupUI\bin\Release\KProcess.KL2.Server.SetupUI.dll") { Payloads = new[] { @"..\KProcess.KL2.Server.SetupUI\BootstrapperCore.config".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\BootstrapperCore.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\Microsoft.Deployment.WindowsInstaller.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\System.Windows.Interactivity.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\ControlzEx.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\MahApps.Metro.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\MahApps.Metro.IconPacks.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\Ookii.Dialogs.Wpf.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\Renci.SshNet.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\KProcess.KL2.ConnectionSecurity.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\FreshDeskLib.dll".ToPayload(), @"..\KProcess.KL2.Server.SetupUI\bin\Release\Newtonsoft.Json.dll".ToPayload() }, PrimaryPackageId = "KL2_API_MSI" } }; bootstrapper.Variables = new[] { new Variable("DATASOURCE", @"(LocalDb)\KL2"), new Variable("API_LOCATION", "http://*****:*****@"C:\PublishedFiles"), new Variable("UPLOADED_DIR", @"C:\UploadedFiles") }; bootstrapper.PreserveTempFiles = true; bootstrapper.WixSourceGenerated += document => { document.Root.Select("Bundle").Add(XDocument.Load("NET_Framework_Payload.wxs").Root.Elements()); document.Root.Add(XDocument.Load("NET_Framework_Fragments.wxs").Root.Elements()); }; bootstrapper.Include(WixExtension.Util) .Include(WixExtension.Http); bootstrapper.Build(setupName); }
/// <summary> /// /// </summary> /// <returns></returns> private List <byte> ExtractBootKey() { try { RegParser regParser = new RegParser(_systemFile); RegKey rootKey = regParser.RootKey; StringBuilder output = new StringBuilder(); RegKey regKey = rootKey.Key(@"Select"); if (regKey == null) { this.OnError("Unable to locate the following registry key: Select"); return(null); } List <byte> bootKeyTemp = new List <byte>(); RegValue regValueCcs = regKey.Value("Current"); if (regValueCcs == null) { this.OnError("Unable to locate the following registry key: Current"); return(null); } regKey = rootKey.Key(@"ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\JD"); if (regKey == null) { this.OnError("Unable to locate the following registry key: ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\JD"); return(null); } string temp = regKey.ClassName; for (int i = 0; i < temp.Length / 2; i++) { bootKeyTemp.Add(Convert.ToByte(temp.Substring(i * 2, 2), 16)); } regKey = rootKey.Key(@"ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\Skew1"); if (regKey == null) { this.OnError("Unable to locate the following registry key: ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\Skew1"); return(null); } temp = regKey.ClassName; for (int i = 0; i < temp.Length / 2; i++) { bootKeyTemp.Add(Convert.ToByte(temp.Substring(i * 2, 2), 16)); } regKey = rootKey.Key(@"ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\GBG"); if (regKey == null) { this.OnError("Unable to locate the following registry key: ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\GBG"); return(null); } temp = regKey.ClassName; for (int i = 0; i < temp.Length / 2; i++) { bootKeyTemp.Add(Convert.ToByte(temp.Substring(i * 2, 2), 16)); } regKey = rootKey.Key(@"ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\Data"); if (regKey == null) { this.OnError("Unable to locate the following registry key: ControlSet00" + regValueCcs.Data + "\\Control\\LSA\\Data"); return(null); } temp = regKey.ClassName; for (int i = 0; i < temp.Length / 2; i++) { bootKeyTemp.Add(Convert.ToByte(temp.Substring(i * 2, 2), 16)); } List <byte> bootKey = new List <byte>(); for (int index = 0; index < bootKeyTemp.Count; index++) { bootKey.Add(bootKeyTemp[_permutationMatrix[index]]); } //this.PrintHex("Bootkey", bootKey.ToArray()); return(bootKey); } catch (Exception ex) { this.OnError("An error occured whilst extracting the boot key"); Misc.WriteToEventLog(Application.ProductName, ex.Message, EventLogEntryType.Error); return(null); } }
static void Main(string[] args) { var projectName = $"{appName} v{ToCompactVersionString(Version.Parse(VersionToBuild))}"; //WriteLicenseRtf(); Compiler.LightOptions = "-sice:ICE57"; /////////////// KL² MSI /////////////// ExeFileShortcut desktopShortcut = new ExeFileShortcut(appName, @"[INSTALLDIR]KL².exe", "") { Condition = "INSTALLDESKTOPSHORTCUT=\"yes\"" }; ExeFileShortcut startMenuLaunchShortcut = new ExeFileShortcut(appName, @"[INSTALLDIR]KL².exe", "") { Condition = "INSTALLSTARTMENUSHORTCUT=\"yes\"" }; ExeFileShortcut startMenuUninstallShortcut = new ExeFileShortcut($"Uninstall {appName}", $@"[AppDataFolder]\Package Cache\[BUNDLE_ID]\{setupName}", "/uninstall") { WorkingDirectory = "AppDataFolder", Condition = "INSTALLSTARTMENUSHORTCUT =\"yes\" AND BUNDLE_ID <> \"[BUNDLE_ID]\"" }; Dir scanAppDir = ScanFiles("KL2VideoAnalyst", System.IO.Path.GetFullPath(@"..\KL2-Core\KProcess.Ksmed.Presentation.Shell\bin\Release"), (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest")); //scannAppDir.AddDir(new Dir("Extensions")); /*scannAppDir.AddDir(new Dir("ExportBuffer", * new Dir("SQL") * { * Permissions = new DirPermission[] * { * new DirPermission("Users", GenericPermission.All), * new DirPermission("NetworkService", GenericPermission.All) * } * }));*/ Dir desktopDir = new Dir("%DesktopFolder%", desktopShortcut); Dir startMenuDir = new Dir($@"%ProgramMenuFolder%\{manufacturer}", startMenuLaunchShortcut, startMenuUninstallShortcut); RegValue installReg = new RegValue(RegistryHive.LocalMachine, regKey, "InstallLocation", "[INSTALLDIR]"); RegValue desktopShortcutReg = new RegValue(RegistryHive.LocalMachine, regKey, "DesktopShortcut", "[INSTALLDESKTOPSHORTCUT]"); RegValue startMenuShortcutReg = new RegValue(RegistryHive.LocalMachine, regKey, "StartMenuShortcut", "[INSTALLSTARTMENUSHORTCUT]"); ManagedAction editConfig = new ManagedAction(CustomActions.EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed); var project = new ManagedProject(projectName, scanAppDir, desktopDir, startMenuDir, installReg, desktopShortcutReg, startMenuShortcutReg, editConfig) { GUID = Versions.List.Single(_ => _.Key.ToString() == VersionToBuild).Value, Version = Version.Parse(VersionToBuild), UpgradeCode = UpgradeCode, AttributesDefinition = $"Id={Versions.List.Single(_ => _.Key.ToString() == VersionToBuild).Value};Manufacturer={manufacturer}", Description = $"{projectName},{manufacturer}", InstallScope = InstallScope.perMachine, Properties = new[] { new Property("LANGUAGE", "en-US"), new Property("INSTALLDESKTOPSHORTCUT", "yes"), new Property("INSTALLSTARTMENUSHORTCUT", "yes"), new Property("API_LOCATION", ""), new Property("FILESERVER_LOCATION", ""), new Property("SYNCPATH", "[INSTALLDIR]\\SyncFiles"), new Property("SENDREPORT", "yes"), new Property("MUTE", "no"), new Property("BUNDLE_ID", "[BUNDLE_ID]") } }; project.Package.AttributesDefinition = $"Id=*;InstallerVersion=500;Comments={projectName};Keywords={projectName},{manufacturer}"; project.SetNetFxPrerequisite(new WixSharp.Condition(" (NETFRAMEWORK45 >= '#461308') "), "Please install .Net Framework 4.7.1 first."); project.ControlPanelInfo.ProductIcon = @"..\..\Assets\kl2_VideoAnalyst.ico"; project.MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = true, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; project.WixVariables.Add("WixUILicenseRtf", "License.rtf"); project.BeforeInstall += Project_BeforeInstall; // Save the list of files to check integrity void LogFiles(System.IO.StreamWriter writer, int rootCount, Dir root) { foreach (var file in root.Files) { var splittedFileName = file.Name.Split('\\').ToList(); for (var i = 0; i < rootCount; i++) { splittedFileName.RemoveAt(0); } writer.WriteLine(string.Join("\\", splittedFileName.ToArray())); } foreach (var dir in root.Dirs) { LogFiles(writer, rootCount, dir); } } using (var writer = System.IO.File.CreateText("VideoAnalyst_FileList.txt")) { var rootCount = scanAppDir.Files.First().Name.Split('\\').Length - 1; LogFiles(writer, rootCount, scanAppDir); } project.BuildWxs(Compiler.OutputType.MSI, "KL2_project.wxs"); string productMsi = project.BuildMsi("KL²VideoAnalyst.msi"); /////////////// BOOTSTRAPPER /////////////// var bootstrapper = new Bundle(projectName, new PackageGroupRef("NetFx471Redist"), new MsiPackage(productMsi) { Id = "KL2VIDEOANALYST_MSI", MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; INSTALLDIR=[INSTALLDIR]; LANGUAGE=[LANGUAGE]; INSTALLDESKTOPSHORTCUT=[INSTALLDESKTOPSHORTCUT]; INSTALLSTARTMENUSHORTCUT=[INSTALLSTARTMENUSHORTCUT]; API_LOCATION=[API_LOCATION]; FILESERVER_LOCATION=[FILESERVER_LOCATION]; SYNCPATH=[SYNCPATH]; SENDREPORT=[SENDREPORT]; MUTE=[MUTE];" }) { Version = project.Version, Manufacturer = manufacturer, UpgradeCode = BootstrapperUpgradeCode, AboutUrl = @"http://www.k-process.com/", IconFile = @"..\..\Assets\kl2_VideoAnalyst.ico", SuppressWixMbaPrereqVars = true, DisableModify = "yes", Application = new ManagedBootstrapperApplication(@"..\KProcess.KL2.SetupUI\bin\Release\KProcess.KL2.SetupUI.dll") { Payloads = new[] { @"..\KProcess.KL2.SetupUI\BootstrapperCore.config".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\BootstrapperCore.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\Microsoft.Deployment.WindowsInstaller.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\System.Windows.Interactivity.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\ControlzEx.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\MahApps.Metro.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\MahApps.Metro.IconPacks.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\WPF.Dialogs.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\KProcess.KL2.ConnectionSecurity.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\FreshDeskLib.dll".ToPayload(), @"..\KProcess.KL2.SetupUI\bin\Release\Newtonsoft.Json.dll".ToPayload() }, PrimaryPackageId = "KL2VIDEOANALYST_MSI" } }; bootstrapper.Variables = new[] { new Variable("MSIINSTALLPERUSER", "0"), new Variable("INSTALLDIR", "dummy"), new Variable("INSTALLDESKTOPSHORTCUT", "yes"), new Variable("INSTALLSTARTMENUSHORTCUT", "yes"), new Variable("API_LOCATION", "http://*****:*****@".\SyncFiles"), new Variable("SENDREPORT", "yes"), new Variable("MUTE", "no"), new Variable("LANGUAGE", "en-US") }; bootstrapper.PreserveTempFiles = true; bootstrapper.WixSourceGenerated += document => { document.Root.Select("Bundle").Add(XDocument.Load("NET_Framework_Payload.wxs").Root.Elements()); document.Root.Add(XDocument.Load("NET_Framework_Fragments.wxs").Root.Elements()); }; bootstrapper.Include(WixExtension.Util); bootstrapper.Build(setupName); }
public MultiStringEditor(RegValue value) : base(value) { InitializeComponent(); txtData.Text = String.Join("\r\n", ((string[])value.Data)); }
public RegFile(string fileName, bool X64, string CIName) { x64 = X64; _filename = fileName; //generate XML Body InitXML(CIName); string SettingName = CIName; string sAllLines = fileName; if (File.Exists(fileName)) { sAllLines = File.ReadAllText(fileName, Encoding.ASCII); } sAllLines = sAllLines.Replace("\\" + Environment.NewLine, ""); lines = sAllLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); RegKeys = new List <RegKey>(); RegValues = new List <RegValue>(); int iPos = 0; int iLastDescription = -1; int iLastKey = -1; bool bHKLM = false; bool bHKCU = false; foreach (string sLine in lines) { try { string Line = sLine.TrimStart(); //Detect Comments if (Line.StartsWith(";")) { iLastDescription = iPos; } //Detect Keys if (Line.StartsWith("[")) { iLastKey = iPos; RegKey oKey = new RegKey(sLine, iPos); //Get Description if (iLastDescription == iPos - 1 & iLastDescription > -1) { oKey.Description = lines[iLastDescription].TrimStart().Substring(1); } //RegKey rKey = new RegKey(sLine, iPos); if (oKey.PSHive == "HKLM:") { bHKLM = true; } if (oKey.PSHive == "HKCU:") { bHKCU = true; } if (oKey.PSHive == @"Registry::\HKEY_USERS") { bHKLM = true; } RegKeys.Add(oKey); } //Detect Values if (Line.StartsWith("@") || Line.StartsWith("\"")) { RegValue oValue = new RegValue(Line, iLastKey); //Get Description if (iLastDescription == iPos - 1 & iLastDescription > -1) { oValue.Description = lines[iLastDescription].TrimStart().Substring(1); } RegValues.Add(oValue); } } catch (Exception ex) { ex.Message.ToString(); } iPos++; } if (bPSScript) { if (bHKLM) { CreatePSXMLAll(SettingName, Description, "HKLM:"); } if (bHKCU) { CreatePSXMLAll(SettingName, Description, "HKCU:"); } } }