diff options
Diffstat (limited to 'src/test')
21 files changed, 542 insertions, 107 deletions
diff --git a/src/test/burn/TestData/DependencyTests/BundleD/BundleD.wxs b/src/test/burn/TestData/DependencyTests/BundleD/BundleD.wxs index f371f674..22152da2 100644 --- a/src/test/burn/TestData/DependencyTests/BundleD/BundleD.wxs +++ b/src/test/burn/TestData/DependencyTests/BundleD/BundleD.wxs | |||
@@ -4,7 +4,7 @@ | |||
4 | <Fragment> | 4 | <Fragment> |
5 | <PackageGroup Id="BundlePackages"> | 5 | <PackageGroup Id="BundlePackages"> |
6 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv1.TargetPath)" /> | 6 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv1.TargetPath)" /> |
7 | <ExePackage Id="TestExe" Cache="remove" PerMachine="yes" Permanent="yes" InstallArguments="/ec 1603"> | 7 | <ExePackage Id="TestExe" Cache="remove" PerMachine="yes" Permanent="yes" DetectCondition="" InstallArguments="/ec 1603"> |
8 | <PayloadGroupRef Id="TestExePayloads" /> | 8 | <PayloadGroupRef Id="TestExePayloads" /> |
9 | </ExePackage> | 9 | </ExePackage> |
10 | </PackageGroup> | 10 | </PackageGroup> |
diff --git a/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wixproj b/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wixproj new file mode 100644 index 00000000..bcb447b0 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wixproj | |||
@@ -0,0 +1,17 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <UpgradeCode>{A843CC02-6814-48F5-997D-052073BAE744}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
12 | </ItemGroup> | ||
13 | <ItemGroup> | ||
14 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
15 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
16 | </ItemGroup> | ||
17 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wxs b/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wxs new file mode 100644 index 00000000..709a7c3c --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/BrokenPerUserArpEntryExePackage/BrokenPerUserArpEntryExePackage.wxs | |||
@@ -0,0 +1,18 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | |||
3 | <?define ArpId = {DE9F8594-5856-4454-AB10-3C01ED246D7D}?> | ||
4 | <?define ArpKeyPath = HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.ArpId)?> | ||
5 | <?define ArpVersion = 1.0.0.0?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
8 | <Fragment> | ||
9 | <PackageGroup Id="BundlePackages"> | ||
10 | <ExePackage Id="TestExe" PerMachine="no" | ||
11 | InstallArguments="/regw "$(var.ArpKeyPath),DisplayVersion,String,$(var.ArpVersion)""> | ||
12 | <ArpEntry Id="$(var.ArpId)" Version="$(var.ArpVersion)" Win64="no" /> | ||
13 | |||
14 | <PayloadGroupRef Id="TestExePayloads" /> | ||
15 | </ExePackage> | ||
16 | </PackageGroup> | ||
17 | </Fragment> | ||
18 | </Wix> | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PackageFail/PackageFail.wixproj b/src/test/burn/TestData/ExePackageTests/PackageFail/PackageFail.wixproj new file mode 100644 index 00000000..19c5463d --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PackageFail/PackageFail.wixproj | |||
@@ -0,0 +1,12 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <UpgradeCode>{6C5A2C71-2009-4B52-BC20-C1C6A5C87EA6}</UpgradeCode> | ||
5 | </PropertyGroup> | ||
6 | <ItemGroup> | ||
7 | <Compile Include="..\..\Templates\PackageFail.wxs" Link="PackageFail.wxs" /> | ||
8 | </ItemGroup> | ||
9 | <ItemGroup> | ||
10 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
11 | </ItemGroup> | ||
12 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wixproj b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wixproj new file mode 100644 index 00000000..ed46e6a5 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wixproj | |||
@@ -0,0 +1,19 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <InstallerPlatform>x64</InstallerPlatform> | ||
6 | <BA>TestBA_x64</BA> | ||
7 | <UpgradeCode>{5923A558-091E-4015-A9CC-BA92E7A2405A}</UpgradeCode> | ||
8 | </PropertyGroup> | ||
9 | <ItemGroup> | ||
10 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
11 | </ItemGroup> | ||
12 | <ItemGroup> | ||
13 | <ProjectReference Include="..\..\TestBA\TestBAWixlib_x64\testbawixlib_x64.wixproj" /> | ||
14 | </ItemGroup> | ||
15 | <ItemGroup> | ||
16 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
17 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
18 | </ItemGroup> | ||
19 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wxs b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wxs new file mode 100644 index 00000000..a966283f --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackage/PerMachineArpEntryExePackage.wxs | |||
@@ -0,0 +1,18 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | |||
3 | <?define ArpId = {4D9EC36A-1E63-4244-875C-3ECB0A2CAE30}?> | ||
4 | <?define ArpKeyPath = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.ArpId)?> | ||
5 | <?define ArpVersion = 1.0.0.0?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
8 | <Fragment> | ||
9 | <PackageGroup Id="BundlePackages"> | ||
10 | <ExePackage Id="TestExe" PerMachine="yes" | ||
11 | InstallArguments="/regw "$(var.ArpKeyPath),DisplayVersion,String,$(var.ArpVersion)" /regw "$(var.ArpKeyPath),QuietUninstallString,String,\"[WixBundleExecutePackageCacheFolder]testexe.exe\" /regd \"$(var.ArpKeyPath)\"""> | ||
12 | <ArpEntry Id="$(var.ArpId)" Version="$(var.ArpVersion)" Win64="yes" /> | ||
13 | |||
14 | <PayloadGroupRef Id="TestExePayloads_x64" /> | ||
15 | </ExePackage> | ||
16 | </PackageGroup> | ||
17 | </Fragment> | ||
18 | </Wix> | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wixproj b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wixproj new file mode 100644 index 00000000..e4219565 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wixproj | |||
@@ -0,0 +1,18 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <UpgradeCode>{6436F747-08F7-416F-BE92-DB48F282AFC1}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
12 | <ProjectReference Include="..\PackageFail\PackageFail.wixproj" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
16 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
17 | </ItemGroup> | ||
18 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wxs b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wxs new file mode 100644 index 00000000..945146f0 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerMachineArpEntryExePackageFailure/PerMachineArpEntryExePackageFailure.wxs | |||
@@ -0,0 +1,19 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | |||
3 | <?define ArpId = {80E90929-EEA5-48A7-A680-A0237A1CAD84}?> | ||
4 | <?define ArpKeyPath = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.ArpId)?> | ||
5 | <?define ArpVersion = 1.0.0.0?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
8 | <Fragment> | ||
9 | <PackageGroup Id="BundlePackages"> | ||
10 | <ExePackage Id="TestExe" PerMachine="yes" | ||
11 | InstallArguments="/regw "$(var.ArpKeyPath),DisplayVersion,String,$(var.ArpVersion)" /regw "$(var.ArpKeyPath),QuietUninstallString,String,\"[WixBundleExecutePackageCacheFolder]testexe.exe\" /regd \"$(var.ArpKeyPath)\"""> | ||
12 | <ArpEntry Id="$(var.ArpId)" Version="$(var.ArpVersion)" Win64="no" /> | ||
13 | |||
14 | <PayloadGroupRef Id="TestExePayloads" /> | ||
15 | </ExePackage> | ||
16 | <MsiPackage Id="PackageFail" SourceFile="$(var.PackageFail.TargetPath)" /> | ||
17 | </PackageGroup> | ||
18 | </Fragment> | ||
19 | </Wix> | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wixproj b/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wixproj new file mode 100644 index 00000000..06395843 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wixproj | |||
@@ -0,0 +1,17 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <UpgradeCode>{E4683E88-AF03-40D0-B308-5C084B0E1FA0}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
12 | </ItemGroup> | ||
13 | <ItemGroup> | ||
14 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
15 | <PackageReference Include="WixToolset.NetFx.wixext" /> | ||
16 | </ItemGroup> | ||
17 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wxs b/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wxs new file mode 100644 index 00000000..e2792693 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/PerUserArpEntryExePackage/PerUserArpEntryExePackage.wxs | |||
@@ -0,0 +1,18 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | |||
3 | <?define ArpId = {9B5300C7-9B34-4670-9614-185B02AB87EF}?> | ||
4 | <?define ArpKeyPath = HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.ArpId)?> | ||
5 | <?define ArpVersion = 1.0.0.0?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
8 | <Fragment> | ||
9 | <PackageGroup Id="BundlePackages"> | ||
10 | <ExePackage Id="TestExe" PerMachine="no" | ||
11 | InstallArguments="/regw "$(var.ArpKeyPath),DisplayVersion,String,$(var.ArpVersion)" /regw "$(var.ArpKeyPath),QuietUninstallString,String,\"[WixBundleExecutePackageCacheFolder]testexe.exe\" /regd \"$(var.ArpKeyPath)\"""> | ||
12 | <ArpEntry Id="$(var.ArpId)" Version="$(var.ArpVersion)" Win64="no" /> | ||
13 | |||
14 | <PayloadGroupRef Id="TestExePayloads" /> | ||
15 | </ExePackage> | ||
16 | </PackageGroup> | ||
17 | </Fragment> | ||
18 | </Wix> | ||
diff --git a/src/test/burn/WixTestTools/ArpEntryInstaller.cs b/src/test/burn/WixTestTools/ArpEntryInstaller.cs new file mode 100644 index 00000000..96d9fab9 --- /dev/null +++ b/src/test/burn/WixTestTools/ArpEntryInstaller.cs | |||
@@ -0,0 +1,43 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixTestTools | ||
4 | { | ||
5 | using System; | ||
6 | using Xunit; | ||
7 | |||
8 | public partial class ArpEntryInstaller : IDisposable | ||
9 | { | ||
10 | public ArpEntryInstaller(WixTestContext testContext, string id, bool perMachine = true, bool x64 = false) | ||
11 | { | ||
12 | this.ArpId = id; | ||
13 | this.PerMachine = perMachine; | ||
14 | this.X64 = x64; | ||
15 | this.TestContext = testContext; | ||
16 | } | ||
17 | |||
18 | public string ArpId { get; } | ||
19 | |||
20 | public bool PerMachine { get; } | ||
21 | |||
22 | public bool X64 { get; } | ||
23 | |||
24 | private WixTestContext TestContext { get; } | ||
25 | |||
26 | public void Unregister(bool assertIfMissing = true) | ||
27 | { | ||
28 | if (this.TryGetRegistration(out var registration)) | ||
29 | { | ||
30 | registration.Delete(); | ||
31 | } | ||
32 | else | ||
33 | { | ||
34 | Assert.True(false, "Tried to unregister when not registered."); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | public void Dispose() | ||
39 | { | ||
40 | this.Unregister(false); | ||
41 | } | ||
42 | } | ||
43 | } | ||
diff --git a/src/test/burn/WixTestTools/ArpEntryVerifier.cs b/src/test/burn/WixTestTools/ArpEntryVerifier.cs new file mode 100644 index 00000000..b3c70337 --- /dev/null +++ b/src/test/burn/WixTestTools/ArpEntryVerifier.cs | |||
@@ -0,0 +1,24 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixTestTools | ||
4 | { | ||
5 | using Xunit; | ||
6 | |||
7 | public partial class ArpEntryInstaller | ||
8 | { | ||
9 | public bool TryGetRegistration(out GenericArpRegistration registration) | ||
10 | { | ||
11 | bool success = !this.PerMachine ? GenericArpRegistration.TryGetPerUserRegistrationById(this.ArpId, out registration) | ||
12 | : GenericArpRegistration.TryGetPerMachineRegistrationById(this.ArpId, this.X64, out registration); | ||
13 | |||
14 | return success; | ||
15 | } | ||
16 | |||
17 | public void VerifyRegistered(bool registered) | ||
18 | { | ||
19 | bool success = this.TryGetRegistration(out _); | ||
20 | |||
21 | Assert.Equal(registered, success); | ||
22 | } | ||
23 | } | ||
24 | } | ||
diff --git a/src/test/burn/WixTestTools/BundleRegistration.cs b/src/test/burn/WixTestTools/BundleRegistration.cs index 3541e7ea..524d4616 100644 --- a/src/test/burn/WixTestTools/BundleRegistration.cs +++ b/src/test/burn/WixTestTools/BundleRegistration.cs | |||
@@ -5,108 +5,51 @@ namespace WixTestTools | |||
5 | using System; | 5 | using System; |
6 | using Microsoft.Win32; | 6 | using Microsoft.Win32; |
7 | 7 | ||
8 | public class BundleRegistration | 8 | public class BundleRegistration : GenericArpRegistration |
9 | { | 9 | { |
10 | public const string BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; | ||
11 | public const string BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE = "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; | ||
12 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH = "BundleCachePath"; | ||
13 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE = "BundleAddonCode"; | 10 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE = "BundleAddonCode"; |
11 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH = "BundleCachePath"; | ||
14 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE = "BundleDetectCode"; | 12 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE = "BundleDetectCode"; |
15 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE = "BundlePatchCode"; | 13 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE = "BundlePatchCode"; |
14 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY = "BundleProviderKey"; | ||
15 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_RESUME_COMMAND_LINE = "BundleResumeCommandLine"; | ||
16 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_TAG = "BundleTag"; | ||
16 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE = "BundleUpgradeCode"; | 17 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE = "BundleUpgradeCode"; |
17 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_DISPLAY_NAME = "DisplayName"; | ||
18 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION = "BundleVersion"; | 18 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION = "BundleVersion"; |
19 | public const string BURN_REGISTRATION_REGISTRY_ENGINE_VERSION = "EngineVersion"; | 19 | public const string BURN_REGISTRATION_REGISTRY_ENGINE_VERSION = "EngineVersion"; |
20 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY = "BundleProviderKey"; | ||
21 | public const string BURN_REGISTRATION_REGISTRY_BUNDLE_TAG = "BundleTag"; | ||
22 | public const string REGISTRY_REBOOT_PENDING_FORMAT = "{0}.RebootRequired"; | ||
23 | public const string REGISTRY_BUNDLE_INSTALLED = "Installed"; | ||
24 | public const string REGISTRY_BUNDLE_DISPLAY_ICON = "DisplayIcon"; | ||
25 | public const string REGISTRY_BUNDLE_DISPLAY_VERSION = "DisplayVersion"; | ||
26 | public const string REGISTRY_BUNDLE_ESTIMATED_SIZE = "EstimatedSize"; | ||
27 | public const string REGISTRY_BUNDLE_PUBLISHER = "Publisher"; | ||
28 | public const string REGISTRY_BUNDLE_HELP_LINK = "HelpLink"; | ||
29 | public const string REGISTRY_BUNDLE_HELP_TELEPHONE = "HelpTelephone"; | ||
30 | public const string REGISTRY_BUNDLE_URL_INFO_ABOUT = "URLInfoAbout"; | ||
31 | public const string REGISTRY_BUNDLE_URL_UPDATE_INFO = "URLUpdateInfo"; | ||
32 | public const string REGISTRY_BUNDLE_PARENT_DISPLAY_NAME = "ParentDisplayName"; | ||
33 | public const string REGISTRY_BUNDLE_PARENT_KEY_NAME = "ParentKeyName"; | ||
34 | public const string REGISTRY_BUNDLE_COMMENTS = "Comments"; | ||
35 | public const string REGISTRY_BUNDLE_CONTACT = "Contact"; | ||
36 | public const string REGISTRY_BUNDLE_NO_MODIFY = "NoModify"; | ||
37 | public const string REGISTRY_BUNDLE_MODIFY_PATH = "ModifyPath"; | ||
38 | public const string REGISTRY_BUNDLE_NO_ELEVATE_ON_MODIFY = "NoElevateOnModify"; | ||
39 | public const string REGISTRY_BUNDLE_NO_REMOVE = "NoRemove"; | ||
40 | public const string REGISTRY_BUNDLE_SYSTEM_COMPONENT = "SystemComponent"; | ||
41 | public const string REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING = "QuietUninstallString"; | ||
42 | public const string REGISTRY_BUNDLE_UNINSTALL_STRING = "UninstallString"; | ||
43 | public const string REGISTRY_BUNDLE_RESUME_COMMAND_LINE = "BundleResumeCommandLine"; | ||
44 | public const string REGISTRY_BUNDLE_VERSION_MAJOR = "VersionMajor"; | ||
45 | public const string REGISTRY_BUNDLE_VERSION_MINOR = "VersionMinor"; | ||
46 | 20 | ||
47 | public string[] AddonCodes { get; set; } | 21 | public string[] AddonCodes { get; set; } |
48 | 22 | ||
49 | public string CachePath { get; set; } | 23 | public string BundleVersion { get; set; } |
50 | 24 | ||
51 | public string DisplayName { get; set; } | 25 | public string CachePath { get; set; } |
52 | 26 | ||
53 | public string[] DetectCodes { get; set; } | 27 | public string[] DetectCodes { get; set; } |
54 | 28 | ||
55 | public string EngineVersion { get; set; } | 29 | public string EngineVersion { get; set; } |
56 | 30 | ||
57 | public int? EstimatedSize { get; set; } | ||
58 | |||
59 | public int? Installed { get; set; } | ||
60 | |||
61 | public string ModifyPath { get; set; } | ||
62 | |||
63 | public string[] PatchCodes { get; set; } | 31 | public string[] PatchCodes { get; set; } |
64 | 32 | ||
65 | public string ProviderKey { get; set; } | 33 | public string ProviderKey { get; set; } |
66 | 34 | ||
67 | public string Publisher { get; set; } | ||
68 | |||
69 | public int? SystemComponent { get; set; } | ||
70 | |||
71 | public string QuietUninstallString { get; set; } | ||
72 | |||
73 | public string QuietUninstallCommand { get; set; } | ||
74 | |||
75 | public string QuietUninstallCommandArguments { get; set; } | ||
76 | |||
77 | public string Tag { get; set; } | 35 | public string Tag { get; set; } |
78 | 36 | ||
79 | public string UninstallCommand { get; set; } | ||
80 | |||
81 | public string UninstallCommandArguments { get; set; } | ||
82 | |||
83 | public string UninstallString { get; set; } | ||
84 | |||
85 | public string[] UpgradeCodes { get; set; } | 37 | public string[] UpgradeCodes { get; set; } |
86 | 38 | ||
87 | public string UrlInfoAbout { get; set; } | 39 | public static bool TryGetPerMachineBundleRegistrationById(string id, bool x64, out BundleRegistration registration) |
88 | 40 | { | |
89 | public string UrlUpdateInfo { get; set; } | 41 | return TryGetRegistrationById(id, x64, false, out registration); |
90 | 42 | } | |
91 | public string Version { get; set; } | ||
92 | 43 | ||
93 | public static bool TryGetPerMachineBundleRegistrationById(string bundleId, bool x64, out BundleRegistration registration) | 44 | public static bool TryGetPerUserBundleRegistrationById(string id, out BundleRegistration registration) |
94 | { | 45 | { |
95 | var baseKeyPath = x64 ? BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY : BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE; | 46 | return TryGetRegistrationById(id, true, true, out registration); |
96 | var registrationKeyPath = $"{baseKeyPath}\\{bundleId}"; | ||
97 | using var registrationKey = Registry.LocalMachine.OpenSubKey(registrationKeyPath); | ||
98 | var success = registrationKey != null; | ||
99 | registration = success ? GetBundleRegistration(registrationKey) : null; | ||
100 | return success; | ||
101 | } | 47 | } |
102 | 48 | ||
103 | public static bool TryGetPerUserBundleRegistrationById(string bundleId, out BundleRegistration registration) | 49 | private static bool TryGetRegistrationById(string id, bool x64, bool perUser, out BundleRegistration registration) |
104 | { | 50 | { |
105 | var registrationKeyPath = $"{BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY}\\{bundleId}"; | 51 | registration = GetGenericArpRegistration(id, x64, perUser, key => GetBundleRegistration(key)); |
106 | using var registrationKey = Registry.CurrentUser.OpenSubKey(registrationKeyPath); | 52 | return registration != null; |
107 | var success = registrationKey != null; | ||
108 | registration = success ? GetBundleRegistration(registrationKey) : null; | ||
109 | return success; | ||
110 | } | 53 | } |
111 | 54 | ||
112 | private static BundleRegistration GetBundleRegistration(RegistryKey idKey) | 55 | private static BundleRegistration GetBundleRegistration(RegistryKey idKey) |
@@ -120,38 +63,8 @@ namespace WixTestTools | |||
120 | registration.ProviderKey = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY) as string; | 63 | registration.ProviderKey = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY) as string; |
121 | registration.Tag = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_TAG) as string; | 64 | registration.Tag = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_TAG) as string; |
122 | registration.UpgradeCodes = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE) as string[]; | 65 | registration.UpgradeCodes = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE) as string[]; |
123 | registration.Version = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION) as string; | 66 | registration.BundleVersion = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION) as string; |
124 | registration.DisplayName = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_DISPLAY_NAME) as string; | ||
125 | registration.EngineVersion = idKey.GetValue(BURN_REGISTRATION_REGISTRY_ENGINE_VERSION) as string; | 67 | registration.EngineVersion = idKey.GetValue(BURN_REGISTRATION_REGISTRY_ENGINE_VERSION) as string; |
126 | registration.EstimatedSize = idKey.GetValue(REGISTRY_BUNDLE_ESTIMATED_SIZE) as int?; | ||
127 | registration.Installed = idKey.GetValue(REGISTRY_BUNDLE_INSTALLED) as int?; | ||
128 | registration.ModifyPath = idKey.GetValue(REGISTRY_BUNDLE_MODIFY_PATH) as string; | ||
129 | registration.Publisher = idKey.GetValue(REGISTRY_BUNDLE_PUBLISHER) as string; | ||
130 | registration.SystemComponent = idKey.GetValue(REGISTRY_BUNDLE_SYSTEM_COMPONENT) as int?; | ||
131 | registration.UrlInfoAbout = idKey.GetValue(REGISTRY_BUNDLE_URL_INFO_ABOUT) as string; | ||
132 | registration.UrlUpdateInfo = idKey.GetValue(REGISTRY_BUNDLE_URL_UPDATE_INFO) as string; | ||
133 | |||
134 | registration.QuietUninstallString = idKey.GetValue(REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING) as string; | ||
135 | if (!String.IsNullOrEmpty(registration.QuietUninstallString)) | ||
136 | { | ||
137 | var closeQuote = registration.QuietUninstallString.IndexOf("\"", 1); | ||
138 | if (closeQuote > 0) | ||
139 | { | ||
140 | registration.QuietUninstallCommand = registration.QuietUninstallString.Substring(1, closeQuote - 1).Trim(); | ||
141 | registration.QuietUninstallCommandArguments = registration.QuietUninstallString.Substring(closeQuote + 1).Trim(); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | registration.UninstallString = idKey.GetValue(REGISTRY_BUNDLE_UNINSTALL_STRING) as string; | ||
146 | if (!String.IsNullOrEmpty(registration.UninstallString)) | ||
147 | { | ||
148 | var closeQuote = registration.UninstallString.IndexOf("\"", 1); | ||
149 | if (closeQuote > 0) | ||
150 | { | ||
151 | registration.UninstallCommand = registration.UninstallString.Substring(1, closeQuote - 1).Trim(); | ||
152 | registration.UninstallCommandArguments = registration.UninstallString.Substring(closeQuote + 1).Trim(); | ||
153 | } | ||
154 | } | ||
155 | 68 | ||
156 | return registration; | 69 | return registration; |
157 | } | 70 | } |
diff --git a/src/test/burn/WixTestTools/BundleVerifier.cs b/src/test/burn/WixTestTools/BundleVerifier.cs index 103171cd..ff45a291 100644 --- a/src/test/burn/WixTestTools/BundleVerifier.cs +++ b/src/test/burn/WixTestTools/BundleVerifier.cs | |||
@@ -80,6 +80,29 @@ namespace WixTestTools | |||
80 | File.Delete(expectedCachePath); | 80 | File.Delete(expectedCachePath); |
81 | } | 81 | } |
82 | 82 | ||
83 | public bool TryGetArpEntryExePackageConfiguration(string packageId, out string arpId, out string arpVersion, out bool arpWin64, out bool perMachine) | ||
84 | { | ||
85 | using var wixOutput = WixOutput.Read(this.BundlePdb); | ||
86 | var intermediate = Intermediate.Load(wixOutput); | ||
87 | var section = intermediate.Sections.Single(); | ||
88 | var packageSymbol = section.Symbols.OfType<WixBundlePackageSymbol>().SingleOrDefault(p => p.Id.Id == packageId); | ||
89 | var exePackageSymbol = section.Symbols.OfType<WixBundleExePackageSymbol>().SingleOrDefault(p => p.Id.Id == packageId); | ||
90 | if (packageSymbol == null || exePackageSymbol == null || exePackageSymbol.DetectionType != WixBundleExePackageDetectionType.Arp) | ||
91 | { | ||
92 | arpId = null; | ||
93 | arpVersion = null; | ||
94 | arpWin64 = false; | ||
95 | perMachine = false; | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | arpId = exePackageSymbol.ArpId; | ||
100 | arpVersion = exePackageSymbol.ArpDisplayVersion; | ||
101 | arpWin64 = exePackageSymbol.ArpWin64; | ||
102 | perMachine = packageSymbol.PerMachine == true; | ||
103 | return true; | ||
104 | } | ||
105 | |||
83 | public bool TryGetRegistration(out BundleRegistration registration) | 106 | public bool TryGetRegistration(out BundleRegistration registration) |
84 | { | 107 | { |
85 | var bundleSymbol = this.GetBundleSymbol(); | 108 | var bundleSymbol = this.GetBundleSymbol(); |
diff --git a/src/test/burn/WixTestTools/GenericArpRegistration.cs b/src/test/burn/WixTestTools/GenericArpRegistration.cs new file mode 100644 index 00000000..d87c4feb --- /dev/null +++ b/src/test/burn/WixTestTools/GenericArpRegistration.cs | |||
@@ -0,0 +1,143 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixTestTools | ||
4 | { | ||
5 | using System; | ||
6 | using Microsoft.Win32; | ||
7 | |||
8 | public class GenericArpRegistration | ||
9 | { | ||
10 | public const string UNINSTALL_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; | ||
11 | public const string UNINSTALL_KEY_WOW6432NODE = "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; | ||
12 | |||
13 | public const string REGISTRY_ARP_INSTALLED = "Installed"; | ||
14 | public const string REGISTRY_ARP_DISPLAY_ICON = "DisplayIcon"; | ||
15 | public const string REGISTRY_ARP_DISPLAY_NAME = "DisplayName"; | ||
16 | public const string REGISTRY_ARP_DISPLAY_VERSION = "DisplayVersion"; | ||
17 | public const string REGISTRY_ARP_ESTIMATED_SIZE = "EstimatedSize"; | ||
18 | public const string REGISTRY_ARP_PUBLISHER = "Publisher"; | ||
19 | public const string REGISTRY_ARP_HELP_LINK = "HelpLink"; | ||
20 | public const string REGISTRY_ARP_HELP_TELEPHONE = "HelpTelephone"; | ||
21 | public const string REGISTRY_ARP_URL_INFO_ABOUT = "URLInfoAbout"; | ||
22 | public const string REGISTRY_ARP_URL_UPDATE_INFO = "URLUpdateInfo"; | ||
23 | public const string REGISTRY_ARP_COMMENTS = "Comments"; | ||
24 | public const string REGISTRY_ARP_CONTACT = "Contact"; | ||
25 | public const string REGISTRY_ARP_NO_MODIFY = "NoModify"; | ||
26 | public const string REGISTRY_ARP_MODIFY_PATH = "ModifyPath"; | ||
27 | public const string REGISTRY_ARP_NO_ELEVATE_ON_MODIFY = "NoElevateOnModify"; | ||
28 | public const string REGISTRY_ARP_NO_REMOVE = "NoRemove"; | ||
29 | public const string REGISTRY_ARP_SYSTEM_COMPONENT = "SystemComponent"; | ||
30 | public const string REGISTRY_ARP_QUIET_UNINSTALL_STRING = "QuietUninstallString"; | ||
31 | public const string REGISTRY_ARP_UNINSTALL_STRING = "UninstallString"; | ||
32 | public const string REGISTRY_ARP_VERSION_MAJOR = "VersionMajor"; | ||
33 | public const string REGISTRY_ARP_VERSION_MINOR = "VersionMinor"; | ||
34 | |||
35 | public RegistryKey BaseKey { get; set; } | ||
36 | |||
37 | public string KeyPath { get; set; } | ||
38 | |||
39 | public string DisplayName { get; set; } | ||
40 | |||
41 | public string DisplayVersion { get; set; } | ||
42 | |||
43 | public int? EstimatedSize { get; set; } | ||
44 | |||
45 | public int? Installed { get; set; } | ||
46 | |||
47 | public string ModifyPath { get; set; } | ||
48 | |||
49 | public string Publisher { get; set; } | ||
50 | |||
51 | public int? SystemComponent { get; set; } | ||
52 | |||
53 | public string QuietUninstallString { get; set; } | ||
54 | |||
55 | public string QuietUninstallCommand { get; set; } | ||
56 | |||
57 | public string QuietUninstallCommandArguments { get; set; } | ||
58 | |||
59 | public string UninstallCommand { get; set; } | ||
60 | |||
61 | public string UninstallCommandArguments { get; set; } | ||
62 | |||
63 | public string UninstallString { get; set; } | ||
64 | |||
65 | public string UrlInfoAbout { get; set; } | ||
66 | |||
67 | public string UrlUpdateInfo { get; set; } | ||
68 | |||
69 | public static bool TryGetPerMachineRegistrationById(string id, bool x64, out GenericArpRegistration registration) | ||
70 | { | ||
71 | return TryGetRegistrationById(id, x64, false, out registration); | ||
72 | } | ||
73 | |||
74 | public static bool TryGetPerUserRegistrationById(string id, out GenericArpRegistration registration) | ||
75 | { | ||
76 | return TryGetRegistrationById(id, true, true, out registration); | ||
77 | } | ||
78 | |||
79 | private static bool TryGetRegistrationById(string id, bool x64, bool perUser, out GenericArpRegistration registration) | ||
80 | { | ||
81 | registration = GetGenericArpRegistration(id, x64, perUser, key => new GenericArpRegistration()); | ||
82 | return registration != null; | ||
83 | } | ||
84 | |||
85 | protected static T GetGenericArpRegistration<T>(string id, bool x64, bool perUser, Func<RegistryKey, T> fnCreate) | ||
86 | where T : GenericArpRegistration | ||
87 | { | ||
88 | var baseKey = perUser ? Registry.CurrentUser : Registry.LocalMachine; | ||
89 | var baseKeyPath = x64 ? UNINSTALL_KEY : UNINSTALL_KEY_WOW6432NODE; | ||
90 | var registrationKeyPath = $"{baseKeyPath}\\{id}"; | ||
91 | using var idKey = baseKey.OpenSubKey(registrationKeyPath); | ||
92 | |||
93 | if (idKey == null) | ||
94 | { | ||
95 | return null; | ||
96 | } | ||
97 | |||
98 | var registration = fnCreate(idKey); | ||
99 | |||
100 | registration.BaseKey = baseKey; | ||
101 | registration.KeyPath = registrationKeyPath; | ||
102 | |||
103 | registration.DisplayName = idKey.GetValue(REGISTRY_ARP_DISPLAY_NAME) as string; | ||
104 | registration.DisplayVersion = idKey.GetValue(REGISTRY_ARP_DISPLAY_VERSION) as string; | ||
105 | registration.EstimatedSize = idKey.GetValue(REGISTRY_ARP_ESTIMATED_SIZE) as int?; | ||
106 | registration.Installed = idKey.GetValue(REGISTRY_ARP_INSTALLED) as int?; | ||
107 | registration.ModifyPath = idKey.GetValue(REGISTRY_ARP_MODIFY_PATH) as string; | ||
108 | registration.Publisher = idKey.GetValue(REGISTRY_ARP_PUBLISHER) as string; | ||
109 | registration.SystemComponent = idKey.GetValue(REGISTRY_ARP_SYSTEM_COMPONENT) as int?; | ||
110 | registration.UrlInfoAbout = idKey.GetValue(REGISTRY_ARP_URL_INFO_ABOUT) as string; | ||
111 | registration.UrlUpdateInfo = idKey.GetValue(REGISTRY_ARP_URL_UPDATE_INFO) as string; | ||
112 | |||
113 | registration.QuietUninstallString = idKey.GetValue(REGISTRY_ARP_QUIET_UNINSTALL_STRING) as string; | ||
114 | if (!String.IsNullOrEmpty(registration.QuietUninstallString)) | ||
115 | { | ||
116 | var closeQuote = registration.QuietUninstallString.IndexOf("\"", 1); | ||
117 | if (closeQuote > 0) | ||
118 | { | ||
119 | registration.QuietUninstallCommand = registration.QuietUninstallString.Substring(1, closeQuote - 1).Trim(); | ||
120 | registration.QuietUninstallCommandArguments = registration.QuietUninstallString.Substring(closeQuote + 1).Trim(); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | registration.UninstallString = idKey.GetValue(REGISTRY_ARP_UNINSTALL_STRING) as string; | ||
125 | if (!String.IsNullOrEmpty(registration.UninstallString)) | ||
126 | { | ||
127 | var closeQuote = registration.UninstallString.IndexOf("\"", 1); | ||
128 | if (closeQuote > 0) | ||
129 | { | ||
130 | registration.UninstallCommand = registration.UninstallString.Substring(1, closeQuote - 1).Trim(); | ||
131 | registration.UninstallCommandArguments = registration.UninstallString.Substring(closeQuote + 1).Trim(); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | return registration; | ||
136 | } | ||
137 | |||
138 | public void Delete() | ||
139 | { | ||
140 | this.BaseKey.DeleteSubKeyTree(this.KeyPath); | ||
141 | } | ||
142 | } | ||
143 | } | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BurnE2ETests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BurnE2ETests.cs index 6664b849..5caedacb 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/BurnE2ETests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/BurnE2ETests.cs | |||
@@ -31,6 +31,23 @@ namespace WixToolsetTest.BurnE2E | |||
31 | this.Installers.Push(installer); | 31 | this.Installers.Push(installer); |
32 | } | 32 | } |
33 | 33 | ||
34 | protected ArpEntryInstaller CreateArpEntryInstaller(string id, bool perMachine = true, bool x64 = false) | ||
35 | { | ||
36 | var installer = new ArpEntryInstaller(this.TestContext, id, perMachine, x64); | ||
37 | this.Installers.Push(installer); | ||
38 | return installer; | ||
39 | } | ||
40 | |||
41 | protected ArpEntryInstaller CreateArpEntryInstaller(BundleInstaller bundleInstaller, string packageId) | ||
42 | { | ||
43 | if (!bundleInstaller.TryGetArpEntryExePackageConfiguration(packageId, out var arpId, out _, out var arpWin64, out var perMachine)) | ||
44 | { | ||
45 | return null; | ||
46 | } | ||
47 | |||
48 | return this.CreateArpEntryInstaller(arpId, perMachine, arpWin64); | ||
49 | } | ||
50 | |||
34 | protected BundleInstaller CreateBundleInstaller(string name) | 51 | protected BundleInstaller CreateBundleInstaller(string name) |
35 | { | 52 | { |
36 | var installer = new BundleInstaller(this.TestContext, name); | 53 | var installer = new BundleInstaller(this.TestContext, name); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs index f5a1cda8..e5e3259f 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | |||
@@ -33,12 +33,12 @@ namespace WixToolsetTest.BurnE2E | |||
33 | 33 | ||
34 | if (!File.Exists(targetFilePath)) | 34 | if (!File.Exists(targetFilePath)) |
35 | { | 35 | { |
36 | var testTool = new TestTool(Path.Combine(TestData.Get(), "win-x86", "TestExe.exe")) | 36 | var testExeTool = new TestExeTool |
37 | { | 37 | { |
38 | Arguments = "/lf \"" + targetFilePath + $"|{FiveGB}\"", | 38 | Arguments = "/lf \"" + targetFilePath + $"|{FiveGB}\"", |
39 | ExpectedExitCode = 0, | 39 | ExpectedExitCode = 0, |
40 | }; | 40 | }; |
41 | testTool.Run(true); | 41 | testExeTool.Run(true); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs new file mode 100644 index 00000000..dc6515b5 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs | |||
@@ -0,0 +1,99 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.BurnE2E | ||
4 | { | ||
5 | using WixTestTools; | ||
6 | using Xunit; | ||
7 | using Xunit.Abstractions; | ||
8 | |||
9 | public class ExePackageTests : BurnE2ETests | ||
10 | { | ||
11 | public ExePackageTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
12 | |||
13 | [RuntimeFact] | ||
14 | public void CanInstallAndUninstallPerMachineArpEntryExePackage() | ||
15 | { | ||
16 | const string arpId = "{4D9EC36A-1E63-4244-875C-3ECB0A2CAE30}"; | ||
17 | var perMachineArpEntryExePackageBundle = this.CreateBundleInstaller(@"PerMachineArpEntryExePackage"); | ||
18 | var arpEntryExePackage = this.CreateArpEntryInstaller(perMachineArpEntryExePackageBundle, "TestExe"); | ||
19 | |||
20 | arpEntryExePackage.VerifyRegistered(false); | ||
21 | |||
22 | var installLogPath = perMachineArpEntryExePackageBundle.Install(); | ||
23 | perMachineArpEntryExePackageBundle.VerifyRegisteredAndInPackageCache(); | ||
24 | arpEntryExePackage.VerifyRegistered(true); | ||
25 | |||
26 | LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\""); | ||
27 | |||
28 | var uninstallLogPath = perMachineArpEntryExePackageBundle.Uninstall(); | ||
29 | perMachineArpEntryExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
30 | arpEntryExePackage.VerifyRegistered(false); | ||
31 | |||
32 | LogVerifier.MessageInLogFile(uninstallLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}"); | ||
33 | } | ||
34 | |||
35 | [RuntimeFact] | ||
36 | public void CanUninstallPerMachineArpEntryExePackageOnRollback() | ||
37 | { | ||
38 | const string arpId = "{80E90929-EEA5-48A7-A680-A0237A1CAD84}"; | ||
39 | var perMachineArpEntryExePackageFailureBundle = this.CreateBundleInstaller(@"PerMachineArpEntryExePackageFailure"); | ||
40 | var arpEntryExePackage = this.CreateArpEntryInstaller(perMachineArpEntryExePackageFailureBundle, "TestExe"); | ||
41 | |||
42 | arpEntryExePackage.VerifyRegistered(false); | ||
43 | |||
44 | var installLogPath = perMachineArpEntryExePackageFailureBundle.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); | ||
45 | perMachineArpEntryExePackageFailureBundle.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
46 | arpEntryExePackage.VerifyRegistered(false); | ||
47 | |||
48 | LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\""); | ||
49 | LogVerifier.MessageInLogFile(installLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}"); | ||
50 | } | ||
51 | |||
52 | [RuntimeFact] | ||
53 | public void CanInstallAndUninstallPerUserArpEntryExePackage() | ||
54 | { | ||
55 | const string arpId = "{9B5300C7-9B34-4670-9614-185B02AB87EF}"; | ||
56 | var perUserArpEntryExePackageBundle = this.CreateBundleInstaller(@"PerUserArpEntryExePackage"); | ||
57 | var arpEntryExePackage = this.CreateArpEntryInstaller(perUserArpEntryExePackageBundle, "TestExe"); | ||
58 | |||
59 | arpEntryExePackage.VerifyRegistered(false); | ||
60 | |||
61 | var installLogPath = perUserArpEntryExePackageBundle.Install(); | ||
62 | perUserArpEntryExePackageBundle.VerifyRegisteredAndInPackageCache(); | ||
63 | arpEntryExePackage.VerifyRegistered(true); | ||
64 | |||
65 | LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\" /regw \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},QuietUninstallString,String,\\\""); | ||
66 | |||
67 | var uninstallLogPath = perUserArpEntryExePackageBundle.Uninstall(); | ||
68 | perUserArpEntryExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
69 | arpEntryExePackage.VerifyRegistered(false); | ||
70 | |||
71 | LogVerifier.MessageInLogFile(uninstallLogPath, $"testexe.exe\" /regd HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}"); | ||
72 | } | ||
73 | |||
74 | [RuntimeFact] | ||
75 | public void FailsUninstallWhenPerUserArpEntryExePackageMissingQuietUninstallString() | ||
76 | { | ||
77 | const string arpId = "{DE9F8594-5856-4454-AB10-3C01ED246D7D}"; | ||
78 | var brokenPerUserArpEntryExePackageBundle = this.CreateBundleInstaller(@"BrokenPerUserArpEntryExePackage"); | ||
79 | var arpEntryExePackage = this.CreateArpEntryInstaller(brokenPerUserArpEntryExePackageBundle, "TestExe"); | ||
80 | |||
81 | arpEntryExePackage.VerifyRegistered(false); | ||
82 | brokenPerUserArpEntryExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
83 | |||
84 | var installLogPath = brokenPerUserArpEntryExePackageBundle.Install(); | ||
85 | brokenPerUserArpEntryExePackageBundle.VerifyRegisteredAndInPackageCache(); | ||
86 | arpEntryExePackage.VerifyRegistered(true); | ||
87 | |||
88 | LogVerifier.MessageInLogFile(installLogPath, $"TestExe.exe\" /regw \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId},DisplayVersion,String,1.0.0.0\""); | ||
89 | |||
90 | brokenPerUserArpEntryExePackageBundle.Uninstall((int)MSIExec.MSIExecReturnCode.ERROR_INVALID_PARAMETER); | ||
91 | brokenPerUserArpEntryExePackageBundle.VerifyRegisteredAndInPackageCache(); | ||
92 | |||
93 | arpEntryExePackage.Unregister(); | ||
94 | |||
95 | brokenPerUserArpEntryExePackageBundle.Uninstall(); | ||
96 | brokenPerUserArpEntryExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
97 | } | ||
98 | } | ||
99 | } | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/IWebServer.cs index a4d46d48..a4d46d48 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/IWebServer.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/IWebServer.cs | |||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs index 8e6611a2..8e6611a2 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs | |||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestExeTool.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestExeTool.cs new file mode 100644 index 00000000..a02299d7 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestExeTool.cs | |||
@@ -0,0 +1,17 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixTestTools | ||
4 | { | ||
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | |||
8 | public class TestExeTool : TestTool | ||
9 | { | ||
10 | private static readonly string TestExePath32 = Path.Combine(TestData.Get(), "win-x86", "TestExe.exe"); | ||
11 | |||
12 | public TestExeTool() | ||
13 | : base(TestExePath32) | ||
14 | { | ||
15 | } | ||
16 | } | ||
17 | } | ||