@joebigelow / wix-1 / commits / 135dad52

Explicitly mark bitness of entities that support 64-bit attribute.

This ensures that you can build a 64-bit package with 32-bit entities and not lose the "forced" 32-bit-ness in the decompiled output.

Bob Arnson committed Nov 14, 2018 at 20:23 UTC 135dad52ea93d65e9cfe1490f34d12bec510c836
7 files changed +66 -1
src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+13
@@ -4663,6 +4663,11 @@ namespace WixToolset.Core.WindowsInstaller
4663 {
4664 customAction.Win64 = Wix.YesNoType.yes;
4665 }
4666 + else if (MsiInterop.MsidbCustomActionTypeVBScript == (type & MsiInterop.MsidbCustomActionTypeVBScript) ||
4667 + MsiInterop.MsidbCustomActionTypeJScript == (type & MsiInterop.MsidbCustomActionTypeJScript))
4668 + {
4669 + customAction.Win64 = Wix.YesNoType.no;
4670 + }
4671
4672 switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits)
4673 {
@@ -4903,6 +4908,10 @@ namespace WixToolset.Core.WindowsInstaller
4908 {
4909 component.Win64 = Wix.YesNoType.yes;
4910 }
4911 + else
4912 + {
4913 + component.Win64 = Wix.YesNoType.no;
4914 + }
4915
4916 if (MsiInterop.MsidbComponentAttributesDisableRegistryReflection == (attributes & MsiInterop.MsidbComponentAttributesDisableRegistryReflection))
4917 {
@@ -7810,6 +7819,10 @@ namespace WixToolset.Core.WindowsInstaller
7819 registrySearch.Win64 = Wix.YesNoType.yes;
7820 type &= ~MsiInterop.MsidbLocatorType64bit;
7821 }
7822 + else
7823 + {
7824 + registrySearch.Win64 = Wix.YesNoType.no;
7825 + }
7826
7827 switch (type)
7828 {
src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+28
@@ -37,5 +37,33 @@ namespace WixToolsetTest.CoreIntegration
37 Assert.Equal(expected, actualFormatted);
38 }
39 }
40 +
41 + [Fact]
42 + public void CanDecompile64BitSingleFileCompressed()
43 + {
44 + var folder = TestData.Get(@"TestData\DecompileSingleFileCompressed64");
45 +
46 + using (var fs = new DisposableFileSystem())
47 + {
48 + var intermediateFolder = fs.GetFolder();
49 + var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
50 +
51 + var result = WixRunner.Execute(new[]
52 + {
53 + "decompile",
54 + Path.Combine(folder, "example.msi"),
55 + "-intermediateFolder", intermediateFolder,
56 + "-o", outputPath
57 + });
58 +
59 + result.AssertSuccess();
60 +
61 + var actual = File.ReadAllText(outputPath);
62 + var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
63 + var expected = XDocument.Load(Path.Combine(folder, "Expected.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
64 +
65 + Assert.Equal(expected, actualFormatted);
66 + }
67 + }
68 }
69 }
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs
+1 -1
@@ -5,7 +5,7 @@
5 <Directory Id="TARGETDIR" Name="SourceDir">
6 <Directory Id="ProgramFilesFolder">
7 <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="oekcr5lq">
8 - <Component Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}">
8 + <Component Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}" Win64="no">
9 <File Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Name="test.txt" KeyPath="yes" Source="SourceDir\File\filcV1yrx0x8wJWj4qMzcH21jwkPko" />
10 </Component>
11 </Directory>
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/Expected.wxs new
+21
@@ -0,0 +1,21 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="{C51B773A-B3BE-4F29-A8A9-549AAF7FF6EC}" Codepage="65001" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{047730A5-30FE-4A62-A520-DA9381B8226A}" Version="1.0.0.0">
4 + <Package Compressed="yes" Description="MsiPackage" InstallerVersion="500" Languages="1033" Manufacturer="Example Corporation" Platform="x64" />
5 + <Directory Id="TARGETDIR" Name="SourceDir">
6 + <Directory Id="ProgramFiles64Folder">
7 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="oekcr5lq">
8 + <Component Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}" Win64="yes">
9 + <File Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Name="test.txt" KeyPath="yes" Source="SourceDir\File\filcV1yrx0x8wJWj4qMzcH21jwkPko" />
10 + </Component>
11 + </Directory>
12 + </Directory>
13 + </Directory>
14 + <Feature Id="ProductFeature" Level="1" Title="MsiPackage">
15 + <ComponentRef Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" />
16 + </Feature>
17 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
18 + <Media Id="1" Cabinet="example.cab" />
19 + <Property Id="ALLUSERS" Value="1" />
20 + </Product>
21 +</Wix>
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab differ
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi differ
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+3
@@ -23,6 +23,9 @@
23 <Content Include="TestData\DecompileSingleFileCompressed\example.cab" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\DecompileSingleFileCompressed\example.msi" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\DecompileSingleFileCompressed\Expected.wxs" CopyToOutputDirectory="PreserveNewest" />
26 + <Content Include="TestData\DecompileSingleFileCompressed64\example.cab" CopyToOutputDirectory="PreserveNewest" />
27 + <Content Include="TestData\DecompileSingleFileCompressed64\example.msi" CopyToOutputDirectory="PreserveNewest" />
28 + <Content Include="TestData\DecompileSingleFileCompressed64\Expected.wxs" CopyToOutputDirectory="PreserveNewest" />
29 <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" />
30 <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
31 <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" />