From 135dad52ea93d65e9cfe1490f34d12bec510c836 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 14 Nov 2018 20:23:35 -0500 Subject: 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. --- .../Decompile/Decompiler.cs | 13 ++++++++++ .../DecompileFixture.cs | 28 +++++++++++++++++++++ .../DecompileSingleFileCompressed/Expected.wxs | 2 +- .../DecompileSingleFileCompressed64/Expected.wxs | 21 ++++++++++++++++ .../DecompileSingleFileCompressed64/example.cab | Bin 0 -> 137 bytes .../DecompileSingleFileCompressed64/example.msi | Bin 0 -> 32768 bytes .../WixToolsetTest.CoreIntegration.csproj | 3 +++ 7 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/Expected.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 26e1f399..3b193a4a 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs @@ -4663,6 +4663,11 @@ namespace WixToolset.Core.WindowsInstaller { customAction.Win64 = Wix.YesNoType.yes; } + else if (MsiInterop.MsidbCustomActionTypeVBScript == (type & MsiInterop.MsidbCustomActionTypeVBScript) || + MsiInterop.MsidbCustomActionTypeJScript == (type & MsiInterop.MsidbCustomActionTypeJScript)) + { + customAction.Win64 = Wix.YesNoType.no; + } switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits) { @@ -4903,6 +4908,10 @@ namespace WixToolset.Core.WindowsInstaller { component.Win64 = Wix.YesNoType.yes; } + else + { + component.Win64 = Wix.YesNoType.no; + } if (MsiInterop.MsidbComponentAttributesDisableRegistryReflection == (attributes & MsiInterop.MsidbComponentAttributesDisableRegistryReflection)) { @@ -7810,6 +7819,10 @@ namespace WixToolset.Core.WindowsInstaller registrySearch.Win64 = Wix.YesNoType.yes; type &= ~MsiInterop.MsidbLocatorType64bit; } + else + { + registrySearch.Win64 = Wix.YesNoType.no; + } switch (type) { diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 66ce98c0..3a9781df 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs @@ -37,5 +37,33 @@ namespace WixToolsetTest.CoreIntegration Assert.Equal(expected, actualFormatted); } } + + [Fact] + public void CanDecompile64BitSingleFileCompressed() + { + var folder = TestData.Get(@"TestData\DecompileSingleFileCompressed64"); + + using (var fs = new DisposableFileSystem()) + { + var intermediateFolder = fs.GetFolder(); + var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); + + var result = WixRunner.Execute(new[] + { + "decompile", + Path.Combine(folder, "example.msi"), + "-intermediateFolder", intermediateFolder, + "-o", outputPath + }); + + result.AssertSuccess(); + + var actual = File.ReadAllText(outputPath); + var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); + var expected = XDocument.Load(Path.Combine(folder, "Expected.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString(); + + Assert.Equal(expected, actualFormatted); + } + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs index b2bb6050..fd6f81ca 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs @@ -5,7 +5,7 @@ - + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/Expected.wxs new file mode 100644 index 00000000..b7f5ad07 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/Expected.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab new file mode 100644 index 00000000..125eeb2c Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.cab differ diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi new file mode 100644 index 00000000..762b136c Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed64/example.msi differ diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 7f1337e0..9cea0f4c 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -23,6 +23,9 @@ + + + -- cgit v1.2.3-55-g6feb