From 69e750b3e6cc6e91e2a24075e19d644143c852f9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 3 Feb 2022 16:41:21 -0800 Subject: Fix MSI validation --- src/wix/WixToolset.Core.Native/Msi/Installer.cs | 3 ++- .../WindowsInstallerValidator.cs | 15 +++++++++++---- src/wix/WixToolset.Core.Native/cubes/darice.cub | Bin 684032 -> 694784 bytes src/wix/WixToolset.Core.Native/cubes/mergemod.cub | Bin 483328 -> 501248 bytes 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/wix/WixToolset.Core.Native/Msi/Installer.cs b/src/wix/WixToolset.Core.Native/Msi/Installer.cs index 8a45aaa8..b2c2c630 100644 --- a/src/wix/WixToolset.Core.Native/Msi/Installer.cs +++ b/src/wix/WixToolset.Core.Native/Msi/Installer.cs @@ -4,6 +4,7 @@ namespace WixToolset.Core.Native.Msi { using System; using System.Diagnostics; + using System.Runtime.InteropServices; using System.Text; /// @@ -15,7 +16,7 @@ namespace WixToolset.Core.Native.Msi /// one message box icon type, one default button, and one installation message type. /// Specifies the message text. /// -1 for an error, 0 if no action was taken, 1 if OK, 3 to abort. - public delegate int InstallUIHandler(IntPtr context, uint messageType, string message); + public delegate int InstallUIHandler(IntPtr context, uint messageType, [MarshalAs(UnmanagedType.LPWStr)] string message); /// /// Represents the Windows Installer, provides wrappers to diff --git a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs index 9f4b26a3..8f2adf54 100644 --- a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs +++ b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs @@ -166,7 +166,7 @@ namespace WixToolset.Core.Native { var action = record.GetString(1); - if (!this.SuppressedIces.Contains(action) && this.Ices.Contains(action)) + if (!this.SuppressedIces.Contains(action) && (this.Ices.Count == 0 || this.Ices.Contains(action))) { actions.Add(action); } @@ -281,11 +281,18 @@ namespace WixToolset.Core.Native // If we're getting messges during the validation session, log them. // Otherwise, ignore the messages. - if (!this.ValidationSessionInProgress) + if (this.ValidationSessionInProgress) { - var parsedMessage = ParseValidationMessage(message, this.CurrentIce); + try + { + var parsedMessage = ParseValidationMessage(message, this.CurrentIce); - continueValidation = this.Callback.ValidationMessage(parsedMessage); + continueValidation = this.Callback.ValidationMessage(parsedMessage); + } + catch + { + return - 1; + } } return continueValidation ? 1 : 3; diff --git a/src/wix/WixToolset.Core.Native/cubes/darice.cub b/src/wix/WixToolset.Core.Native/cubes/darice.cub index 4292fede..dab45677 100644 Binary files a/src/wix/WixToolset.Core.Native/cubes/darice.cub and b/src/wix/WixToolset.Core.Native/cubes/darice.cub differ diff --git a/src/wix/WixToolset.Core.Native/cubes/mergemod.cub b/src/wix/WixToolset.Core.Native/cubes/mergemod.cub index def6dd1a..2042a99e 100644 Binary files a/src/wix/WixToolset.Core.Native/cubes/mergemod.cub and b/src/wix/WixToolset.Core.Native/cubes/mergemod.cub differ -- cgit v1.2.3-55-g6feb