diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-03-16 10:49:09 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-03-16 11:07:44 -0700 |
| commit | 60f75abcd1fe49052c118a2597ac59a82c372b64 (patch) | |
| tree | 1fd88e6c67846b97e61dbc3bf6f5f440516829a2 /src/WixToolset.Core.WindowsInstaller/Bind | |
| parent | 1c23520ed490b56e292dc1544463af83807745ad (diff) | |
| download | wix-60f75abcd1fe49052c118a2597ac59a82c372b64.tar.gz wix-60f75abcd1fe49052c118a2597ac59a82c372b64.tar.bz2 wix-60f75abcd1fe49052c118a2597ac59a82c372b64.zip | |
Migrate PInvoke out of Core to Core.Native
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind')
11 files changed, 17 insertions, 110 deletions
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 | |||
| 7 | using System.Globalization; | 7 | using System.Globalization; |
| 8 | using System.Linq; | 8 | using System.Linq; |
| 9 | using System.Text.RegularExpressions; | 9 | using System.Text.RegularExpressions; |
| 10 | using WixToolset.Core.WindowsInstaller.Msi; | 10 | using WixToolset.Core.Native.Msi; |
| 11 | using WixToolset.Data; | 11 | using WixToolset.Data; |
| 12 | using WixToolset.Data.Symbols; | 12 | using WixToolset.Data.Symbols; |
| 13 | using WixToolset.Data.WindowsInstaller; | 13 | 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 | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Globalization; | 6 | using System.Globalization; |
| 7 | using System.IO; | 7 | using System.IO; |
| 8 | using WixToolset.Core.WindowsInstaller.Msi; | 8 | using WixToolset.Core.Native.Msi; |
| 9 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Symbols; | 10 | using WixToolset.Data.Symbols; |
| 11 | using WixToolset.Data.WindowsInstaller; | 11 | 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 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Core.WindowsInstaller.Bind | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections; | ||
| 7 | using System.Globalization; | ||
| 8 | using WixToolset.Core.Native; | ||
| 9 | using WixToolset.Core.WindowsInstaller.Msi; | ||
| 10 | |||
| 11 | /// <summary> | ||
| 12 | /// Callback object for configurable merge modules. | ||
| 13 | /// </summary> | ||
| 14 | internal sealed class ConfigurationCallback : IMsmConfigureModule | ||
| 15 | { | ||
| 16 | private const int SOk = 0x0; | ||
| 17 | private const int SFalse = 0x1; | ||
| 18 | private Hashtable configurationData; | ||
| 19 | |||
| 20 | /// <summary> | ||
| 21 | /// Creates a ConfigurationCallback object. | ||
| 22 | /// </summary> | ||
| 23 | /// <param name="configData">String to break up into name/value pairs.</param> | ||
| 24 | public ConfigurationCallback(string configData) | ||
| 25 | { | ||
| 26 | if (String.IsNullOrEmpty(configData)) | ||
| 27 | { | ||
| 28 | throw new ArgumentNullException("configData"); | ||
| 29 | } | ||
| 30 | |||
| 31 | string[] pairs = configData.Split(','); | ||
| 32 | this.configurationData = new Hashtable(pairs.Length); | ||
| 33 | for (int i = 0; i < pairs.Length; ++i) | ||
| 34 | { | ||
| 35 | string[] nameVal = pairs[i].Split('='); | ||
| 36 | string name = nameVal[0]; | ||
| 37 | string value = nameVal[1]; | ||
| 38 | |||
| 39 | name = name.Replace("%2C", ","); | ||
| 40 | name = name.Replace("%3D", "="); | ||
| 41 | name = name.Replace("%25", "%"); | ||
| 42 | |||
| 43 | value = value.Replace("%2C", ","); | ||
| 44 | value = value.Replace("%3D", "="); | ||
| 45 | value = value.Replace("%25", "%"); | ||
| 46 | |||
| 47 | this.configurationData[name] = value; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | /// <summary> | ||
| 52 | /// Returns text data based on name. | ||
| 53 | /// </summary> | ||
| 54 | /// <param name="name">Name of value to return.</param> | ||
| 55 | /// <param name="configData">Out param to put configuration data into.</param> | ||
| 56 | /// <returns>S_OK if value provided, S_FALSE if not.</returns> | ||
| 57 | public int ProvideTextData(string name, out string configData) | ||
| 58 | { | ||
| 59 | if (this.configurationData.Contains(name)) | ||
| 60 | { | ||
| 61 | configData = (string)this.configurationData[name]; | ||
| 62 | return SOk; | ||
| 63 | } | ||
| 64 | else | ||
| 65 | { | ||
| 66 | configData = null; | ||
| 67 | return SFalse; | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | /// <summary> | ||
| 72 | /// Returns integer data based on name. | ||
| 73 | /// </summary> | ||
| 74 | /// <param name="name">Name of value to return.</param> | ||
| 75 | /// <param name="configData">Out param to put configuration data into.</param> | ||
| 76 | /// <returns>S_OK if value provided, S_FALSE if not.</returns> | ||
| 77 | public int ProvideIntegerData(string name, out int configData) | ||
| 78 | { | ||
| 79 | if (this.configurationData.Contains(name)) | ||
| 80 | { | ||
| 81 | string val = (string)this.configurationData[name]; | ||
| 82 | configData = Convert.ToInt32(val, CultureInfo.InvariantCulture); | ||
| 83 | return SOk; | ||
| 84 | } | ||
| 85 | else | ||
| 86 | { | ||
| 87 | configData = 0; | ||
| 88 | return SFalse; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
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 | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Linq; | 7 | using System.Linq; |
| 8 | using WixToolset.Core.WindowsInstaller.Msi; | 8 | using WixToolset.Core.Native.Msi; |
| 9 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Symbols; | 10 | using WixToolset.Data.Symbols; |
| 11 | using WixToolset.Data.WindowsInstaller; | 11 | 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 | |||
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.IO; | 7 | using System.IO; |
| 8 | using System.Linq; | 8 | using System.Linq; |
| 9 | using WixToolset.Core.WindowsInstaller.Msi; | 9 | using WixToolset.Core.Native.Msi; |
| 10 | using WixToolset.Core.WindowsInstaller.Unbind; | 10 | using WixToolset.Core.WindowsInstaller.Unbind; |
| 11 | using WixToolset.Data; | 11 | using WixToolset.Data; |
| 12 | using WixToolset.Data.Symbols; | 12 | 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 | |||
| 9 | using System.IO; | 9 | using System.IO; |
| 10 | using System.Linq; | 10 | using System.Linq; |
| 11 | using System.Runtime.InteropServices; | 11 | using System.Runtime.InteropServices; |
| 12 | using WixToolset.Data; | ||
| 13 | using WixToolset.Core.Native; | 12 | using WixToolset.Core.Native; |
| 13 | using WixToolset.Core.Native.Msi; | ||
| 14 | using WixToolset.Core.Native.Msm; | ||
| 15 | using WixToolset.Data; | ||
| 14 | using WixToolset.Data.Symbols; | 16 | using WixToolset.Data.Symbols; |
| 15 | using WixToolset.Extensibility.Services; | ||
| 16 | using WixToolset.Core.WindowsInstaller.Msi; | ||
| 17 | using WixToolset.Extensibility.Data; | 17 | using WixToolset.Extensibility.Data; |
| 18 | using WixToolset.Extensibility.Services; | ||
| 18 | 19 | ||
| 19 | /// <summary> | 20 | /// <summary> |
| 20 | /// Retrieve files information and extract them from merge modules. | 21 | /// Retrieve files information and extract them from merge modules. |
| @@ -52,8 +53,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 52 | { | 53 | { |
| 53 | var mergeModulesFileFacades = new List<IFileFacade>(); | 54 | var mergeModulesFileFacades = new List<IFileFacade>(); |
| 54 | 55 | ||
| 55 | var interop = new MsmInterop(); | 56 | var merge = MsmInterop.GetMsmMerge(); |
| 56 | var merge = interop.GetMsmMerge(); | ||
| 57 | 57 | ||
| 58 | // Index all of the file rows to be able to detect collisions with files in the Merge Modules. | 58 | // Index all of the file rows to be able to detect collisions with files in the Merge Modules. |
| 59 | // It may seem a bit expensive to build up this index solely for the purpose of checking collisions | 59 | // 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 | |||
| 8 | using System.IO; | 8 | using System.IO; |
| 9 | using System.Linq; | 9 | using System.Linq; |
| 10 | using System.Text; | 10 | using System.Text; |
| 11 | using WixToolset.Core.WindowsInstaller.Msi; | 11 | using WixToolset.Core.Native.Msi; |
| 12 | using WixToolset.Data; | 12 | using WixToolset.Data; |
| 13 | using WixToolset.Data.WindowsInstaller; | 13 | using WixToolset.Data.WindowsInstaller; |
| 14 | using WixToolset.Extensibility.Data; | 14 | using WixToolset.Extensibility.Data; |
| @@ -337,7 +337,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | // check for a stream name that is more than 62 characters long (the maximum allowed length) | 339 | // check for a stream name that is more than 62 characters long (the maximum allowed length) |
| 340 | if (needStream && MsiInterop.MsiMaxStreamNameLength < streamName.Length) | 340 | if (needStream && Database.MsiMaxStreamNameLength < streamName.Length) |
| 341 | { | 341 | { |
| 342 | this.Messaging.Write(ErrorMessages.StreamNameTooLong(row.SourceLineNumbers, table.Name, streamName.ToString(), streamName.Length)); | 342 | this.Messaging.Write(ErrorMessages.StreamNameTooLong(row.SourceLineNumbers, table.Name, streamName.ToString(), streamName.Length)); |
| 343 | } | 343 | } |
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 | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Globalization; | 7 | using System.Globalization; |
| 8 | using WixToolset.Core.WindowsInstaller.Msi; | 8 | using WixToolset.Core.Native.Msi; |
| 9 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 10 | using WixToolset.Data.Symbols; | 10 | using WixToolset.Data.Symbols; |
| 11 | using WixToolset.Data.WindowsInstaller; | 11 | 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 | |||
| 9 | using System.Linq; | 9 | using System.Linq; |
| 10 | using System.Runtime.InteropServices; | 10 | using System.Runtime.InteropServices; |
| 11 | using System.Text; | 11 | using System.Text; |
| 12 | using WixToolset.Core.Native; | 12 | using WixToolset.Core.Native.Msi; |
| 13 | using WixToolset.Core.WindowsInstaller.Msi; | 13 | using WixToolset.Core.Native.Msm; |
| 14 | using WixToolset.Data; | 14 | using WixToolset.Data; |
| 15 | using WixToolset.Data.Symbols; | 15 | using WixToolset.Data.Symbols; |
| 16 | using WixToolset.Data.WindowsInstaller; | 16 | using WixToolset.Data.WindowsInstaller; |
| @@ -60,8 +60,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 60 | 60 | ||
| 61 | try | 61 | try |
| 62 | { | 62 | { |
| 63 | var interop = new MsmInterop(); | 63 | merge = MsmInterop.GetMsmMerge(); |
| 64 | merge = interop.GetMsmMerge(); | ||
| 65 | 64 | ||
| 66 | merge.OpenLog(logPath); | 65 | merge.OpenLog(logPath); |
| 67 | logOpen = true; | 66 | 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 | |||
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.IO; | 7 | using System.IO; |
| 8 | using System.Linq; | 8 | using System.Linq; |
| 9 | using WixToolset.Core.WindowsInstaller.Msi; | 9 | using WixToolset.Core.Native.Msi; |
| 10 | using WixToolset.Data; | 10 | using WixToolset.Data; |
| 11 | using WixToolset.Data.Symbols; | 11 | using WixToolset.Data.Symbols; |
| 12 | using WixToolset.Extensibility.Data; | 12 | 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 | |||
| 8 | using System.Globalization; | 8 | using System.Globalization; |
| 9 | using System.IO; | 9 | using System.IO; |
| 10 | using System.Linq; | 10 | using System.Linq; |
| 11 | using WixToolset.Core.WindowsInstaller.Msi; | 11 | using WixToolset.Core.Native.Msi; |
| 12 | using WixToolset.Data; | 12 | using WixToolset.Data; |
| 13 | using WixToolset.Data.Symbols; | 13 | using WixToolset.Data.Symbols; |
| 14 | using WixToolset.Extensibility.Data; | 14 | using WixToolset.Extensibility.Data; |
