Fix inscript CA bit handling
Rob Mensching committed
May 12, 2019 at 14:41 UTC
c9c347bfb659878ce43c60daadac490e230ee17a
7 files changed
+88
-3
src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs
+7
-3
@@ -250,10 +250,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
250
private void AddCustomActionTuple(CustomActionTuple tuple, Output output)
251
{
252
var type = tuple.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0;
253
- type |= tuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0;
254
- type |= tuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate;
253
type |= tuple.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0;
256
- type |= tuple.Hidden ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeHideTarget;
254
+ type |= tuple.Hidden ? WindowsInstallerConstants.MsidbCustomActionTypeHideTarget : 0;
255
type |= tuple.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0;
256
type |= CustomActionExecutionType.FirstSequence == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0;
257
type |= CustomActionExecutionType.OncePerProcess == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0;
@@ -270,6 +268,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
268
type |= CustomActionTargetType.JScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0;
269
type |= CustomActionTargetType.VBScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0;
270
271
+ if (WindowsInstallerConstants.MsidbCustomActionTypeInScript == (type & WindowsInstallerConstants.MsidbCustomActionTypeInScript))
272
+ {
273
+ type |= tuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate;
274
+ type |= tuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0;
275
+ }
276
+
277
var table = output.EnsureTable(this.TableDefinitions["CustomAction"]);
278
var row = table.CreateRow(tuple.SourceLineNumbers);
279
row[0] = tuple.Id.Id;
src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
+32
@@ -539,6 +539,38 @@ namespace WixToolsetTest.CoreIntegration
539
}
540
}
541
542
+ [Fact]
543
+ public void CanBuildSetProperty()
544
+ {
545
+ var folder = TestData.Get(@"TestData\SetProperty");
546
+
547
+ using (var fs = new DisposableFileSystem())
548
+ {
549
+ var baseFolder = fs.GetFolder();
550
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
551
+
552
+ var result = WixRunner.Execute(new[]
553
+ {
554
+ "build",
555
+ Path.Combine(folder, "Package.wxs"),
556
+ Path.Combine(folder, "PackageComponents.wxs"),
557
+ "-loc", Path.Combine(folder, "Package.en-us.wxl"),
558
+ "-bindpath", Path.Combine(folder, "data"),
559
+ "-intermediateFolder", intermediateFolder,
560
+ "-o", Path.Combine(baseFolder, @"bin\test.msi")
561
+ });
562
+
563
+ result.AssertSuccess();
564
+
565
+ var pdb = Pdb.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"), false);
566
+ var caRows = pdb.Output.Tables["CustomAction"].Rows.Single();
567
+ Assert.Equal("SetINSTALLLOCATION", caRows.FieldAsString(0));
568
+ Assert.Equal("51", caRows.FieldAsString(1));
569
+ Assert.Equal("INSTALLLOCATION", caRows.FieldAsString(2));
570
+ Assert.Equal("[INSTALLFOLDER]", caRows.FieldAsString(3));
571
+ }
572
+ }
573
+
574
[Fact(Skip = "Test demonstrates failure")]
575
public void CanBuildVersionIndependentProgId()
576
{
src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.en-us.wxl
new
+11
@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<!--
4
+This file contains the declaration of all the localizable strings.
5
+-->
6
+<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
+
8
+ <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9
+ <String Id="FeatureTitle">MsiPackage</String>
10
+
11
+</WixLocalization>
src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/Package.wxs
new
+23
@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Product Id="*" Name="MsiPackage" Codepage="1252" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4
+ <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5
+
6
+ <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7
+ <MediaTemplate />
8
+
9
+ <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
10
+ <ComponentGroupRef Id="ProductComponents" />
11
+ </Feature>
12
+
13
+ <SetProperty Id="INSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
14
+ </Product>
15
+
16
+ <Fragment>
17
+ <Directory Id="TARGETDIR" Name="SourceDir">
18
+ <Directory Id="ProgramFilesFolder">
19
+ <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
20
+ </Directory>
21
+ </Directory>
22
+ </Fragment>
23
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/PackageComponents.wxs
new
+10
@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Fragment>
4
+ <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5
+ <Component>
6
+ <File Source="test.txt" />
7
+ </Component>
8
+ </ComponentGroup>
9
+ </Fragment>
10
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/data/test.txt
new
+1
@@ -0,0 +1 @@
1
+This is test.txt.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+4
@@ -48,6 +48,10 @@
48
<Content Include="TestData\ComplexExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
49
<Content Include="TestData\ComplexExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
50
<Content Include="TestData\ComplexExampleExtension\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
51
+ <Content Include="TestData\SetProperty\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
52
+ <Content Include="TestData\SetProperty\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
53
+ <Content Include="TestData\SetProperty\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
54
+ <Content Include="TestData\SetProperty\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
55
<Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
56
<Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
57
<Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" />