From c9c347bfb659878ce43c60daadac490e230ee17a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 12 May 2019 14:41:26 -0700 Subject: Fix inscript CA bit handling --- .../Bind/CreateOutputFromIRCommand.cs | 10 +++++-- .../WixToolsetTest.CoreIntegration/MsiFixture.cs | 32 ++++++++++++++++++++++ .../TestData/SetProperty/Package.en-us.wxl | 11 ++++++++ .../TestData/SetProperty/Package.wxs | 23 ++++++++++++++++ .../TestData/SetProperty/PackageComponents.wxs | 10 +++++++ .../TestData/SetProperty/data/test.txt | 1 + .../WixToolsetTest.CoreIntegration.csproj | 4 +++ 7 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/data/test.txt diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs index 1b29fc9c..4b02b3aa 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs @@ -250,10 +250,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind private void AddCustomActionTuple(CustomActionTuple tuple, Output output) { var type = tuple.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0; - type |= tuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0; - type |= tuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate; type |= tuple.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0; - type |= tuple.Hidden ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeHideTarget; + type |= tuple.Hidden ? WindowsInstallerConstants.MsidbCustomActionTypeHideTarget : 0; type |= tuple.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0; type |= CustomActionExecutionType.FirstSequence == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0; type |= CustomActionExecutionType.OncePerProcess == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0; @@ -270,6 +268,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind type |= CustomActionTargetType.JScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0; type |= CustomActionTargetType.VBScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0; + if (WindowsInstallerConstants.MsidbCustomActionTypeInScript == (type & WindowsInstallerConstants.MsidbCustomActionTypeInScript)) + { + type |= tuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate; + type |= tuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0; + } + var table = output.EnsureTable(this.TableDefinitions["CustomAction"]); var row = table.CreateRow(tuple.SourceLineNumbers); row[0] = tuple.Id.Id; diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index f8f9180f..3e66ad0a 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs @@ -539,6 +539,38 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildSetProperty() + { + var folder = TestData.Get(@"TestData\SetProperty"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Package.wxs"), + Path.Combine(folder, "PackageComponents.wxs"), + "-loc", Path.Combine(folder, "Package.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(baseFolder, @"bin\test.msi") + }); + + result.AssertSuccess(); + + var pdb = Pdb.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false); + var caRows = pdb.Output.Tables["CustomAction"].Rows.Single(); + Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0)); + Assert.Equal("51", caRows.FieldAsString(1)); + Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2)); + Assert.Equal("[INSTALLFOLDER]", caRows.FieldAsString(3)); + } + } + [Fact(Skip = "Test demonstrates failure")] public void CanBuildVersionIndependentProgId() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.wxs new file mode 100644 index 00000000..eb907569 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.wxs @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/PackageComponents.wxs new file mode 100644 index 00000000..e26c4509 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/PackageComponents.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 4ea650f9..03f67b19 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -48,6 +48,10 @@ + + + + -- cgit v1.2.3-55-g6feb