From 60f75abcd1fe49052c118a2597ac59a82c372b64 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 16 Mar 2021 10:49:09 -0700 Subject: Migrate PInvoke out of Core to Core.Native --- .../Bind/AttachPatchTransformsCommand.cs | 2 +- .../Bind/BindTransformCommand.cs | 2 +- .../Bind/ConfigurationCallback.cs | 92 ---------------------- .../Bind/CreateInstanceTransformsCommand.cs | 2 +- .../Bind/CreatePatchTransformsCommand.cs | 2 +- .../Bind/ExtractMergeModuleFilesCommand.cs | 10 +-- .../Bind/GenerateDatabaseCommand.cs | 4 +- .../Bind/GenerateTransformCommand.cs | 2 +- .../Bind/MergeModulesCommand.cs | 7 +- .../Bind/ProcessUncompressedFilesCommand.cs | 2 +- .../Bind/UpdateFileFacadesCommand.cs | 2 +- 11 files changed, 17 insertions(+), 110 deletions(-) delete mode 100644 src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs (limited to 'src/WixToolset.Core.WindowsInstaller/Bind') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs index b2052b90..6d802d98 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.Globalization; using System.Linq; using System.Text.RegularExpressions; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs index 28e1d9ee..3a9bd545 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs @@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System; using System.Globalization; using System.IO; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs deleted file mode 100644 index 9a609463..00000000 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolset.Core.WindowsInstaller.Bind -{ - using System; - using System.Collections; - using System.Globalization; - using WixToolset.Core.Native; - using WixToolset.Core.WindowsInstaller.Msi; - - /// - /// Callback object for configurable merge modules. - /// - internal sealed class ConfigurationCallback : IMsmConfigureModule - { - private const int SOk = 0x0; - private const int SFalse = 0x1; - private Hashtable configurationData; - - /// - /// Creates a ConfigurationCallback object. - /// - /// String to break up into name/value pairs. - public ConfigurationCallback(string configData) - { - if (String.IsNullOrEmpty(configData)) - { - throw new ArgumentNullException("configData"); - } - - string[] pairs = configData.Split(','); - this.configurationData = new Hashtable(pairs.Length); - for (int i = 0; i < pairs.Length; ++i) - { - string[] nameVal = pairs[i].Split('='); - string name = nameVal[0]; - string value = nameVal[1]; - - name = name.Replace("%2C", ","); - name = name.Replace("%3D", "="); - name = name.Replace("%25", "%"); - - value = value.Replace("%2C", ","); - value = value.Replace("%3D", "="); - value = value.Replace("%25", "%"); - - this.configurationData[name] = value; - } - } - - /// - /// Returns text data based on name. - /// - /// Name of value to return. - /// Out param to put configuration data into. - /// S_OK if value provided, S_FALSE if not. - public int ProvideTextData(string name, out string configData) - { - if (this.configurationData.Contains(name)) - { - configData = (string)this.configurationData[name]; - return SOk; - } - else - { - configData = null; - return SFalse; - } - } - - /// - /// Returns integer data based on name. - /// - /// Name of value to return. - /// Out param to put configuration data into. - /// S_OK if value provided, S_FALSE if not. - public int ProvideIntegerData(string name, out int configData) - { - if (this.configurationData.Contains(name)) - { - string val = (string)this.configurationData[name]; - configData = Convert.ToInt32(val, CultureInfo.InvariantCulture); - return SOk; - } - else - { - configData = 0; - return SFalse; - } - } - } -} diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateInstanceTransformsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateInstanceTransformsCommand.cs index 9a631754..d0e25571 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateInstanceTransformsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateInstanceTransformsCommand.cs @@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System; using System.Collections.Generic; using System.Linq; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreatePatchTransformsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreatePatchTransformsCommand.cs index 7bc1a8bd..5c993f63 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreatePatchTransformsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreatePatchTransformsCommand.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.Collections.Generic; using System.IO; using System.Linq; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Core.WindowsInstaller.Unbind; using WixToolset.Data; using WixToolset.Data.Symbols; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs index d4de2dd3..7c1e085c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs @@ -9,12 +9,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.IO; using System.Linq; using System.Runtime.InteropServices; - using WixToolset.Data; using WixToolset.Core.Native; + using WixToolset.Core.Native.Msi; + using WixToolset.Core.Native.Msm; + using WixToolset.Data; using WixToolset.Data.Symbols; - using WixToolset.Extensibility.Services; - using WixToolset.Core.WindowsInstaller.Msi; using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; /// /// Retrieve files information and extract them from merge modules. @@ -52,8 +53,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind { var mergeModulesFileFacades = new List(); - var interop = new MsmInterop(); - var merge = interop.GetMsmMerge(); + var merge = MsmInterop.GetMsmMerge(); // Index all of the file rows to be able to detect collisions with files in the Merge Modules. // It may seem a bit expensive to build up this index solely for the purpose of checking collisions diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs index d3c65b6a..06fbf072 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs @@ -8,7 +8,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.IO; using System.Linq; using System.Text; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility.Data; @@ -337,7 +337,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind } // check for a stream name that is more than 62 characters long (the maximum allowed length) - if (needStream && MsiInterop.MsiMaxStreamNameLength < streamName.Length) + if (needStream && Database.MsiMaxStreamNameLength < streamName.Length) { this.Messaging.Write(ErrorMessages.StreamNameTooLong(row.SourceLineNumbers, table.Name, streamName.ToString(), streamName.Length)); } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs index 6dcb1096..ef141795 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs @@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller using System; using System.Collections.Generic; using System.Globalization; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs index f8a1efd6..6446692e 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs @@ -9,8 +9,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.Linq; using System.Runtime.InteropServices; using System.Text; - using WixToolset.Core.Native; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; + using WixToolset.Core.Native.Msm; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Data.WindowsInstaller; @@ -60,8 +60,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind try { - var interop = new MsmInterop(); - merge = interop.GetMsmMerge(); + merge = MsmInterop.GetMsmMerge(); merge.OpenLog(logPath); logOpen = true; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs index 8c66a9e1..039ba495 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.Collections.Generic; using System.IO; using System.Linq; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Extensibility.Data; diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs index 9cd14cfa..0f77abfc 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs @@ -8,7 +8,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind using System.Globalization; using System.IO; using System.Linq; - using WixToolset.Core.WindowsInstaller.Msi; + using WixToolset.Core.Native.Msi; using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Extensibility.Data; -- cgit v1.2.3-55-g6feb