From ba7bab476501c16e437b0aee71c1be02c3dda176 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 3 May 2021 15:55:48 -0700 Subject: Move Bal.wixext into ext --- src/ext/Bal/Bal.wixext.sln | 319 ++ src/ext/Bal/CSharp.Build.props | 13 + src/ext/Bal/Cpp.Build.props | 94 + src/ext/Bal/Custom.Build.props | 11 + .../Bal/CustomizedNativeRecommendedRules.ruleset | 8 + src/ext/Bal/Directory.Build.props | 29 + src/ext/Bal/Directory.Build.targets | 56 + src/ext/Bal/README.md | 2 + src/ext/Bal/Samples/bafunctions/Readme.txt | 85 + .../Samples/bafunctions/WixSampleBAFunctions.cpp | 95 + src/ext/Bal/Samples/bafunctions/bafunctions.cpp | 46 + src/ext/Bal/Samples/bafunctions/bafunctions.def | 6 + .../Bal/Samples/bafunctions/bafunctions.vcxproj | 81 + src/ext/Bal/Samples/bafunctions/packages.config | 7 + src/ext/Bal/Samples/bafunctions/precomp.h | 52 + src/ext/Bal/Samples/bafunctions/resource.h | 15 + .../BootstrapperApplicationFactory.cs | 89 + .../DnchostAssemblyLoadContext.cs | 58 + src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs | 145 + .../IBootstrapperApplicationFactory.cs | 16 + src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs | 18 + .../WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj | 44 + .../BootstrapperApplicationFactory.cs | 86 + .../BootstrapperSectionGroup.cs | 29 + src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs | 145 + src/ext/Bal/WixToolset.Mba.Host/HostSection.cs | 47 + src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs | 18 + .../SupportedFrameworkElement.cs | 47 + .../SupportedFrameworkElementCollection.cs | 36 + .../WixToolset.Mba.Host/WixToolset.Mba.Host.config | 26 + .../WixToolset.Mba.Host/WixToolset.Mba.Host.csproj | 54 + .../WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec | 23 + src/ext/Bal/appveyor.cmd | 17 + src/ext/Bal/appveyor.yml | 40 + src/ext/Bal/dnchost/coreclrhost.h | 137 + src/ext/Bal/dnchost/dnchost.cpp | 309 ++ src/ext/Bal/dnchost/dnchost.def | 6 + src/ext/Bal/dnchost/dnchost.h | 35 + src/ext/Bal/dnchost/dnchost.vcxproj | 106 + src/ext/Bal/dnchost/dncutil.cpp | 411 ++ src/ext/Bal/dnchost/dncutil.h | 38 + src/ext/Bal/dnchost/packages.config | 13 + src/ext/Bal/dnchost/precomp.cpp | 3 + src/ext/Bal/dnchost/precomp.h | 31 + src/ext/Bal/mbahost/mbahost.cpp | 649 +++ src/ext/Bal/mbahost/mbahost.def | 6 + src/ext/Bal/mbahost/mbahost.vcxproj | 106 + src/ext/Bal/mbahost/packages.config | 10 + src/ext/Bal/mbahost/precomp.cpp | 3 + src/ext/Bal/mbahost/precomp.h | 25 + src/ext/Bal/nuget.config | 19 + .../test/WixToolsetTest.Bal/BalExtensionFixture.cs | 133 + .../WixToolsetTest.Bal/TestData/MBA/Bundle.wxs | 12 + .../TestData/Overridable/Bundle.wxs | 13 + .../TestData/WixStdBa/Bundle.wxs | 12 + .../TestData/WixStdBa/Data/test.msi | Bin 0 -> 32768 bytes .../WixStdBa/DisplayInternalUIConditionBundle.wxs | 12 + .../WixToolsetTest.Bal/WixToolsetTest.Bal.csproj | 43 + .../WixToolsetTest.Bal.v3.ncrunchproject | 5 + .../WixToolsetTest.ManagedHost/DncHostFixture.cs | 209 + .../WixToolsetTest.ManagedHost/MbaHostFixture.cs | 94 + .../Bal/test/WixToolsetTest.ManagedHost/README.md | 5 + .../test/WixToolsetTest.ManagedHost/TestEngine.cs | 74 + .../WixToolsetTest.ManagedHost/TestEngineResult.cs | 12 + .../WixToolsetTest.ManagedHost.csproj | 25 + src/ext/Bal/test/examples/Directory.Build.props | 6 + src/ext/Bal/test/examples/Directory.Build.targets | 6 + .../EarliestCoreBundleFDD.wixproj | 2 + .../FrameworkDependentBundle.wxs | 16 + .../EarliestCoreBundleSCD.wixproj | 10 + .../EarliestCoreBundleSCD/SelfContainedBundle.wxs | 11 + .../test/examples/EarliestCoreBundleSCD/ba.xslt | 20 + .../EarliestCoreBundleTrimmedSCD.wixproj | 10 + .../TrimmedSelfContainedBundle.wxs | 11 + .../examples/EarliestCoreBundleTrimmedSCD/ba.xslt | 20 + .../examples/EarliestCoreMBA/EarliestCoreBA.cs | 34 + .../EarliestCoreMBA/EarliestCoreBAFactory.cs | 22 + .../EarliestCoreMBA/Example.EarliestCoreMBA.csproj | 18 + .../test/examples/FullFramework2Bundle/Bundle.wxs | 14 + .../FullFramework2Bundle.wixproj | 2 + .../Example.FullFramework2MBA.csproj | 20 + .../examples/FullFramework2MBA/FullFramework2BA.cs | 34 + .../FullFramework2MBA/FullFramework2BAFactory.cs | 22 + .../FullFramework2MBA/WixToolset.Mba.Host.config | 20 + .../test/examples/FullFramework4Bundle/Bundle.wxs | 14 + .../FullFramework4Bundle.wixproj | 2 + .../Example.FullFramework4MBA.csproj | 19 + .../examples/FullFramework4MBA/FullFramework4BA.cs | 34 + .../FullFramework4MBA/FullFramework4BAFactory.cs | 22 + .../FullFramework4MBA/WixToolset.Mba.Host.config | 17 + .../FrameworkDependentBundle.wxs | 16 + .../LatestCoreBundleFDD.wixproj | 2 + .../LatestCoreBundleSCD.wixproj | 10 + .../LatestCoreBundleSCD/SelfContainedBundle.wxs | 11 + .../Bal/test/examples/LatestCoreBundleSCD/ba.xslt | 20 + .../LatestCoreBundleTrimmedSCD.wixproj | 10 + .../TrimmedSelfContainedBundle.wxs | 11 + .../examples/LatestCoreBundleTrimmedSCD/ba.xslt | 20 + .../LatestCoreMBA/Example.LatestCoreMBA.csproj | 21 + .../test/examples/LatestCoreMBA/LatestCoreBA.cs | 33 + .../examples/LatestCoreMBA/LatestCoreBAFactory.cs | 22 + .../examples/TestEngine/Example.TestEngine.vcxproj | 83 + .../test/examples/TestEngine/ExampleTestEngine.cpp | 53 + .../Bal/test/examples/TestEngine/ReloadEngine.cpp | 55 + .../Bal/test/examples/TestEngine/ReloadEngine.h | 8 + .../test/examples/TestEngine/ShutdownEngine.cpp | 38 + .../Bal/test/examples/TestEngine/ShutdownEngine.h | 8 + .../Bal/test/examples/TestEngine/TestEngine.cpp | 256 ++ src/ext/Bal/test/examples/TestEngine/TestEngine.h | 80 + .../test/examples/TestEngine/WaitForQuitEngine.cpp | 35 + .../test/examples/TestEngine/WaitForQuitEngine.h | 8 + .../Bal/test/examples/TestEngine/packages.config | 7 + src/ext/Bal/test/examples/TestEngine/precomp.cpp | 3 + src/ext/Bal/test/examples/TestEngine/precomp.h | 20 + .../WPFCoreBundleFDD/FrameworkDependentBundle.wxs | 16 + .../WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj | 2 + .../Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs | 12 + .../examples/WPFCoreMBA/Example.WPFCoreMBA.csproj | 16 + .../Bal/test/examples/WPFCoreMBA/MainWindow.xaml | 16 + .../test/examples/WPFCoreMBA/MainWindow.xaml.cs | 17 + src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs | 42 + .../test/examples/WPFCoreMBA/WPFCoreBAFactory.cs | 22 + src/ext/Bal/test/examples/Wix.Build.props | 10 + src/ext/Bal/test/examples/Wix.Build.targets | 8 + src/ext/Bal/test/examples/examples.proj | 50 + src/ext/Bal/wix.snk | Bin 0 -> 596 bytes src/ext/Bal/wixext/BalBurnBackendExtension.cs | 171 + src/ext/Bal/wixext/BalCompiler.cs | 923 +++++ src/ext/Bal/wixext/BalErrors.cs | 61 + src/ext/Bal/wixext/BalExtensionData.cs | 30 + src/ext/Bal/wixext/BalExtensionFactory.cs | 18 + src/ext/Bal/wixext/BalWarnings.cs | 31 + src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs | 80 + .../Symbols/WixBalBAFactoryAssemblySymbol.cs | 55 + .../Bal/wixext/Symbols/WixBalBAFunctionsSymbol.cs | 47 + .../Bal/wixext/Symbols/WixBalConditionSymbol.cs | 55 + .../Bal/wixext/Symbols/WixBalPackageInfoSymbol.cs | 55 + src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs | 47 + .../Symbols/WixMbaPrereqInformationSymbol.cs | 63 + .../Bal/wixext/Symbols/WixStdbaOptionsSymbol.cs | 79 + .../Symbols/WixStdbaOverridableVariableSymbol.cs | 47 + src/ext/Bal/wixext/WixToolset.Bal.wixext.csproj | 39 + src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec | 26 + src/ext/Bal/wixext/WixToolset.Bal.wixext.targets | 11 + src/ext/Bal/wixlib/BalExtension_arm64.wxs | 7 + src/ext/Bal/wixlib/BalExtension_platform.wxi | 69 + src/ext/Bal/wixlib/BalExtension_x64.wxs | 7 + src/ext/Bal/wixlib/BalExtension_x86.wxs | 7 + src/ext/Bal/wixlib/Dnc.wxs | 20 + src/ext/Bal/wixlib/Mba.wxs | 43 + src/ext/Bal/wixlib/bal.wixproj | 36 + src/ext/Bal/wixlib/caDecor.wxi | 39 + src/ext/Bal/wixlib/wixstdba.wxs | 92 + src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl | 27 + src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl | 33 + src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl | 32 + src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl | 31 + src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl | 27 + src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl | 27 + src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl | 29 + src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl | 29 + src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl | 30 + src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl | 27 + src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl | 29 + src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl | 31 + .../Bal/wixstdba/Resources/HyperlinkLargeTheme.xml | 109 + .../wixstdba/Resources/HyperlinkSidebarTheme.xml | 120 + src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl | 61 + src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml | 106 + .../Bal/wixstdba/Resources/LoremIpsumLicense.rtf | Bin 0 -> 4908 bytes src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml | 108 + src/ext/Bal/wixstdba/Resources/RtfTheme.wxl | 58 + src/ext/Bal/wixstdba/Resources/RtfTheme.xml | 106 + src/ext/Bal/wixstdba/Resources/dncpreq.thm | 47 + src/ext/Bal/wixstdba/Resources/dncpreq.wxl | 29 + src/ext/Bal/wixstdba/Resources/logo.png | Bin 0 -> 852 bytes src/ext/Bal/wixstdba/Resources/logoSide.png | Bin 0 -> 3477 bytes src/ext/Bal/wixstdba/Resources/mbapreq.png | Bin 0 -> 797 bytes src/ext/Bal/wixstdba/Resources/mbapreq.thm | 47 + src/ext/Bal/wixstdba/Resources/mbapreq.wxl | 29 + .../WixStandardBootstrapperApplication.cpp | 4264 ++++++++++++++++++++ src/ext/Bal/wixstdba/packages.config | 10 + src/ext/Bal/wixstdba/precomp.cpp | 3 + src/ext/Bal/wixstdba/precomp.h | 58 + src/ext/Bal/wixstdba/resource.h | 15 + src/ext/Bal/wixstdba/wixstdba.cpp | 144 + src/ext/Bal/wixstdba/wixstdba.def | 10 + src/ext/Bal/wixstdba/wixstdba.mc | 73 + src/ext/Bal/wixstdba/wixstdba.vcxproj | 101 + 200 files changed, 14198 insertions(+) create mode 100644 src/ext/Bal/Bal.wixext.sln create mode 100644 src/ext/Bal/CSharp.Build.props create mode 100644 src/ext/Bal/Cpp.Build.props create mode 100644 src/ext/Bal/Custom.Build.props create mode 100644 src/ext/Bal/CustomizedNativeRecommendedRules.ruleset create mode 100644 src/ext/Bal/Directory.Build.props create mode 100644 src/ext/Bal/Directory.Build.targets create mode 100644 src/ext/Bal/README.md create mode 100644 src/ext/Bal/Samples/bafunctions/Readme.txt create mode 100644 src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp create mode 100644 src/ext/Bal/Samples/bafunctions/bafunctions.cpp create mode 100644 src/ext/Bal/Samples/bafunctions/bafunctions.def create mode 100644 src/ext/Bal/Samples/bafunctions/bafunctions.vcxproj create mode 100644 src/ext/Bal/Samples/bafunctions/packages.config create mode 100644 src/ext/Bal/Samples/bafunctions/precomp.h create mode 100644 src/ext/Bal/Samples/bafunctions/resource.h create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs create mode 100644 src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj create mode 100644 src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/HostSection.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs create mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config create mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj create mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec create mode 100644 src/ext/Bal/appveyor.cmd create mode 100644 src/ext/Bal/appveyor.yml create mode 100644 src/ext/Bal/dnchost/coreclrhost.h create mode 100644 src/ext/Bal/dnchost/dnchost.cpp create mode 100644 src/ext/Bal/dnchost/dnchost.def create mode 100644 src/ext/Bal/dnchost/dnchost.h create mode 100644 src/ext/Bal/dnchost/dnchost.vcxproj create mode 100644 src/ext/Bal/dnchost/dncutil.cpp create mode 100644 src/ext/Bal/dnchost/dncutil.h create mode 100644 src/ext/Bal/dnchost/packages.config create mode 100644 src/ext/Bal/dnchost/precomp.cpp create mode 100644 src/ext/Bal/dnchost/precomp.h create mode 100644 src/ext/Bal/mbahost/mbahost.cpp create mode 100644 src/ext/Bal/mbahost/mbahost.def create mode 100644 src/ext/Bal/mbahost/mbahost.vcxproj create mode 100644 src/ext/Bal/mbahost/packages.config create mode 100644 src/ext/Bal/mbahost/precomp.cpp create mode 100644 src/ext/Bal/mbahost/precomp.h create mode 100644 src/ext/Bal/nuget.config create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs create mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj create mode 100644 src/ext/Bal/test/examples/Directory.Build.props create mode 100644 src/ext/Bal/test/examples/Directory.Build.targets create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs create mode 100644 src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt create mode 100644 src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs create mode 100644 src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs create mode 100644 src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj create mode 100644 src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs create mode 100644 src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config create mode 100644 src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs create mode 100644 src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs create mode 100644 src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt create mode 100644 src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj create mode 100644 src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs create mode 100644 src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs create mode 100644 src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj create mode 100644 src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/ReloadEngine.h create mode 100644 src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h create mode 100644 src/ext/Bal/test/examples/TestEngine/TestEngine.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/TestEngine.h create mode 100644 src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h create mode 100644 src/ext/Bal/test/examples/TestEngine/packages.config create mode 100644 src/ext/Bal/test/examples/TestEngine/precomp.cpp create mode 100644 src/ext/Bal/test/examples/TestEngine/precomp.h create mode 100644 src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs create mode 100644 src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs create mode 100644 src/ext/Bal/test/examples/Wix.Build.props create mode 100644 src/ext/Bal/test/examples/Wix.Build.targets create mode 100644 src/ext/Bal/test/examples/examples.proj create mode 100644 src/ext/Bal/wix.snk create mode 100644 src/ext/Bal/wixext/BalBurnBackendExtension.cs create mode 100644 src/ext/Bal/wixext/BalCompiler.cs create mode 100644 src/ext/Bal/wixext/BalErrors.cs create mode 100644 src/ext/Bal/wixext/BalExtensionData.cs create mode 100644 src/ext/Bal/wixext/BalExtensionFactory.cs create mode 100644 src/ext/Bal/wixext/BalWarnings.cs create mode 100644 src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixBalBAFunctionsSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixBalConditionSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixBalPackageInfoSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixStdbaOptionsSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixStdbaOverridableVariableSymbol.cs create mode 100644 src/ext/Bal/wixext/WixToolset.Bal.wixext.csproj create mode 100644 src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec create mode 100644 src/ext/Bal/wixext/WixToolset.Bal.wixext.targets create mode 100644 src/ext/Bal/wixlib/BalExtension_arm64.wxs create mode 100644 src/ext/Bal/wixlib/BalExtension_platform.wxi create mode 100644 src/ext/Bal/wixlib/BalExtension_x64.wxs create mode 100644 src/ext/Bal/wixlib/BalExtension_x86.wxs create mode 100644 src/ext/Bal/wixlib/Dnc.wxs create mode 100644 src/ext/Bal/wixlib/Mba.wxs create mode 100644 src/ext/Bal/wixlib/bal.wixproj create mode 100644 src/ext/Bal/wixlib/caDecor.wxi create mode 100644 src/ext/Bal/wixlib/wixstdba.wxs create mode 100644 src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml create mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml create mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml create mode 100644 src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf create mode 100644 src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml create mode 100644 src/ext/Bal/wixstdba/Resources/RtfTheme.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/RtfTheme.xml create mode 100644 src/ext/Bal/wixstdba/Resources/dncpreq.thm create mode 100644 src/ext/Bal/wixstdba/Resources/dncpreq.wxl create mode 100644 src/ext/Bal/wixstdba/Resources/logo.png create mode 100644 src/ext/Bal/wixstdba/Resources/logoSide.png create mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.png create mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.thm create mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.wxl create mode 100644 src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp create mode 100644 src/ext/Bal/wixstdba/packages.config create mode 100644 src/ext/Bal/wixstdba/precomp.cpp create mode 100644 src/ext/Bal/wixstdba/precomp.h create mode 100644 src/ext/Bal/wixstdba/resource.h create mode 100644 src/ext/Bal/wixstdba/wixstdba.cpp create mode 100644 src/ext/Bal/wixstdba/wixstdba.def create mode 100644 src/ext/Bal/wixstdba/wixstdba.mc create mode 100644 src/ext/Bal/wixstdba/wixstdba.vcxproj (limited to 'src/ext/Bal') diff --git a/src/ext/Bal/Bal.wixext.sln b/src/ext/Bal/Bal.wixext.sln new file mode 100644 index 00000000..0b4c5afa --- /dev/null +++ b/src/ext/Bal/Bal.wixext.sln @@ -0,0 +1,319 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29503.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{C70E3534-A018-4D0A-A340-916C9777EEF7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bafunctions", "src\Samples\bafunctions\bafunctions.vcxproj", "{EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbahost", "src\mbahost\mbahost.vcxproj", "{12C87C77-3547-44F8-8134-29BC915CB19D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wixstdba", "src\wixstdba\wixstdba.vcxproj", "{41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "bal", "src\wixlib\bal.wixproj", "{3444D952-F21C-496F-AB6B-56435BFD0787}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "src\wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dnc.Host", "src\WixToolset.Dnc.Host\WixToolset.Dnc.Host.csproj", "{0D780900-C2FF-4FA2-8CB5-8A19768724C5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Host", "src\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework2MBA", "src\test\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj", "{CC4236FC-226E-4232-AB50-24CBEC4D314D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example.TestEngine", "src\test\examples\TestEngine\Example.TestEngine.vcxproj", "{3D44B67D-A475-49BA-8310-E39F6C117CC9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.ManagedHost", "src\test\WixToolsetTest.ManagedHost\WixToolsetTest.ManagedHost.csproj", "{FED9D707-E5C3-4867-87B0-FABDB5EB0823}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA", "src\test\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj", "{44297646-706D-4508-8E96-1B35B109694C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Bal", "src\test\WixToolsetTest.Bal\WixToolsetTest.Bal.csproj", "{89D479FC-20DA-44D8-AE38-48F063223498}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.EarliestCoreMBA", "src\test\examples\EarliestCoreMBA\Example.EarliestCoreMBA.csproj", "{1E86D8DF-DABD-4B6E-A812-64CD2040C73A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dnchost", "src\dnchost\dnchost.vcxproj", "{B6F70281-6583-4138-BB7F-AABFEBBB3CA2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.LatestCoreMBA", "src\test\examples\LatestCoreMBA\Example.LatestCoreMBA.csproj", "{A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.WPFCoreMBA", "src\test\examples\WPFCoreMBA\Example.WPFCoreMBA.csproj", "{8E707BF2-FD72-4649-8727-BA5955D48D40}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|Any CPU.Build.0 = Debug|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|ARM64.Build.0 = Debug|ARM64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x64.ActiveCfg = Debug|x64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x64.Build.0 = Debug|x64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x86.ActiveCfg = Debug|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x86.Build.0 = Debug|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|Any CPU.ActiveCfg = Release|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|Any CPU.Build.0 = Release|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|ARM64.ActiveCfg = Release|ARM64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|ARM64.Build.0 = Release|ARM64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x64.ActiveCfg = Release|x64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x64.Build.0 = Release|x64 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x86.ActiveCfg = Release|Win32 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x86.Build.0 = Release|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|Any CPU.Build.0 = Debug|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|ARM64.Build.0 = Debug|ARM64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x64.ActiveCfg = Debug|x64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x64.Build.0 = Debug|x64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x86.ActiveCfg = Debug|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x86.Build.0 = Debug|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|Any CPU.ActiveCfg = Release|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|Any CPU.Build.0 = Release|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|ARM64.ActiveCfg = Release|ARM64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|ARM64.Build.0 = Release|ARM64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x64.ActiveCfg = Release|x64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x64.Build.0 = Release|x64 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x86.ActiveCfg = Release|Win32 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x86.Build.0 = Release|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|Any CPU.Build.0 = Debug|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|ARM64.Build.0 = Debug|ARM64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x64.ActiveCfg = Debug|x64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x64.Build.0 = Debug|x64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x86.ActiveCfg = Debug|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x86.Build.0 = Debug|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|Any CPU.ActiveCfg = Release|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|Any CPU.Build.0 = Release|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|ARM64.ActiveCfg = Release|ARM64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|ARM64.Build.0 = Release|ARM64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x64.ActiveCfg = Release|x64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x64.Build.0 = Release|x64 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x86.ActiveCfg = Release|Win32 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x86.Build.0 = Release|Win32 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|Any CPU.ActiveCfg = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|Any CPU.Build.0 = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|ARM64.ActiveCfg = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x64.ActiveCfg = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x86.ActiveCfg = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x86.Build.0 = Debug|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|Any CPU.ActiveCfg = Release|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|Any CPU.Build.0 = Release|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|ARM64.ActiveCfg = Release|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x64.ActiveCfg = Release|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x86.ActiveCfg = Release|x86 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x86.Build.0 = Release|x86 + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|ARM64.Build.0 = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x64.ActiveCfg = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x64.Build.0 = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x86.ActiveCfg = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x86.Build.0 = Debug|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|Any CPU.Build.0 = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|ARM64.ActiveCfg = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|ARM64.Build.0 = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.ActiveCfg = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|ARM64.Build.0 = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.ActiveCfg = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.Build.0 = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.ActiveCfg = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.Build.0 = Debug|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.Build.0 = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|ARM64.ActiveCfg = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|ARM64.Build.0 = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.ActiveCfg = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.Build.0 = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.ActiveCfg = Release|Any CPU + {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.Build.0 = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|ARM64.Build.0 = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.ActiveCfg = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.Build.0 = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x86.ActiveCfg = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x86.Build.0 = Debug|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|Any CPU.Build.0 = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|ARM64.ActiveCfg = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|ARM64.Build.0 = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x64.ActiveCfg = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x64.Build.0 = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x86.ActiveCfg = Release|Any CPU + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x86.Build.0 = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|ARM64.Build.0 = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x64.ActiveCfg = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x64.Build.0 = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x86.ActiveCfg = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x86.Build.0 = Debug|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|Any CPU.Build.0 = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|ARM64.ActiveCfg = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|ARM64.Build.0 = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x64.ActiveCfg = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x64.Build.0 = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x86.ActiveCfg = Release|Any CPU + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x86.Build.0 = Release|Any CPU + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|Any CPU.Build.0 = Debug|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|ARM64.Build.0 = Debug|ARM64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x64.ActiveCfg = Debug|x64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x64.Build.0 = Debug|x64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x86.ActiveCfg = Debug|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x86.Build.0 = Debug|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|Any CPU.ActiveCfg = Release|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|Any CPU.Build.0 = Release|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|ARM64.ActiveCfg = Release|ARM64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|ARM64.Build.0 = Release|ARM64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.ActiveCfg = Release|x64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.Build.0 = Release|x64 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.ActiveCfg = Release|Win32 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.Build.0 = Release|Win32 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|ARM64.Build.0 = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x64.ActiveCfg = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x64.Build.0 = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x86.ActiveCfg = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x86.Build.0 = Debug|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|Any CPU.Build.0 = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|ARM64.ActiveCfg = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|ARM64.Build.0 = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x64.ActiveCfg = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x64.Build.0 = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x86.ActiveCfg = Release|Any CPU + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x86.Build.0 = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|ARM64.Build.0 = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x64.ActiveCfg = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x64.Build.0 = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x86.ActiveCfg = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x86.Build.0 = Debug|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|Any CPU.Build.0 = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|ARM64.ActiveCfg = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|ARM64.Build.0 = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|x64.ActiveCfg = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|x64.Build.0 = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|x86.ActiveCfg = Release|Any CPU + {44297646-706D-4508-8E96-1B35B109694C}.Release|x86.Build.0 = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|ARM64.Build.0 = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|x64.ActiveCfg = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|x64.Build.0 = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|x86.ActiveCfg = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Debug|x86.Build.0 = Debug|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|Any CPU.Build.0 = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|ARM64.ActiveCfg = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|ARM64.Build.0 = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x64.ActiveCfg = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x64.Build.0 = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.ActiveCfg = Release|Any CPU + {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.Build.0 = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|ARM64.Build.0 = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x64.ActiveCfg = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x64.Build.0 = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x86.ActiveCfg = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x86.Build.0 = Debug|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|Any CPU.Build.0 = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|ARM64.ActiveCfg = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|ARM64.Build.0 = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x64.ActiveCfg = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x64.Build.0 = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x86.ActiveCfg = Release|Any CPU + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x86.Build.0 = Release|Any CPU + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|Any CPU.Build.0 = Debug|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|ARM64.Build.0 = Debug|ARM64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x64.ActiveCfg = Debug|x64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x64.Build.0 = Debug|x64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x86.ActiveCfg = Debug|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x86.Build.0 = Debug|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|Any CPU.ActiveCfg = Release|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|Any CPU.Build.0 = Release|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|ARM64.ActiveCfg = Release|ARM64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|ARM64.Build.0 = Release|ARM64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x64.ActiveCfg = Release|x64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x64.Build.0 = Release|x64 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x86.ActiveCfg = Release|Win32 + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x86.Build.0 = Release|Win32 + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|ARM64.Build.0 = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x64.ActiveCfg = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x64.Build.0 = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x86.ActiveCfg = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x86.Build.0 = Debug|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|Any CPU.Build.0 = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|ARM64.ActiveCfg = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|ARM64.Build.0 = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x64.ActiveCfg = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x64.Build.0 = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x86.ActiveCfg = Release|Any CPU + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x86.Build.0 = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|ARM64.Build.0 = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|x64.ActiveCfg = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|x64.Build.0 = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|x86.ActiveCfg = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Debug|x86.Build.0 = Debug|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|Any CPU.Build.0 = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|ARM64.ActiveCfg = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|ARM64.Build.0 = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|x64.ActiveCfg = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|x64.Build.0 = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|x86.ActiveCfg = Release|Any CPU + {8E707BF2-FD72-4649-8727-BA5955D48D40}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {CC4236FC-226E-4232-AB50-24CBEC4D314D} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + {3D44B67D-A475-49BA-8310-E39F6C117CC9} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + {44297646-706D-4508-8E96-1B35B109694C} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + {1E86D8DF-DABD-4B6E-A812-64CD2040C73A} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + {8E707BF2-FD72-4649-8727-BA5955D48D40} = {C70E3534-A018-4D0A-A340-916C9777EEF7} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {74046961-48BF-467A-A6C2-F886C75CE0BE} + EndGlobalSection +EndGlobal diff --git a/src/ext/Bal/CSharp.Build.props b/src/ext/Bal/CSharp.Build.props new file mode 100644 index 00000000..81d24ad1 --- /dev/null +++ b/src/ext/Bal/CSharp.Build.props @@ -0,0 +1,13 @@ + + + + + true + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + false + + diff --git a/src/ext/Bal/Cpp.Build.props b/src/ext/Bal/Cpp.Build.props new file mode 100644 index 00000000..e7bba117 --- /dev/null +++ b/src/ext/Bal/Cpp.Build.props @@ -0,0 +1,94 @@ + + + + + + Win32 + $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ + $(OutputPath)$(Platform)\ + + + $(Company) + $(Copyright) + + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + + + + $(MSBuildThisFileDirectory)CustomizedNativeRecommendedRules.ruleset + + + + + $(DisableSpecificCompilerWarnings) + Level4 + $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + Use + precomp.h + StdCall + true + false + -YlprecompDefine + /Zc:threadSafeInit- %(AdditionalOptions) + true + + + $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) + $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) + + + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) + + + $(ProjectSubSystem) + $(ProjectModuleDefinitionFile) + $(ResourceOnlyDll) + true + $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) + /IGNORE:4099 %(AdditionalOptions) + + + + + + NoExtensions + + + + + CDecl + + + + + OldStyle + true + true + + + + + Disabled + EnableFastChecks + _DEBUG;DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + MinSpace + NDEBUG;%(PreprocessorDefinitions) + true + true + MultiThreaded + + + true + true + + + diff --git a/src/ext/Bal/Custom.Build.props b/src/ext/Bal/Custom.Build.props new file mode 100644 index 00000000..66e74d81 --- /dev/null +++ b/src/ext/Bal/Custom.Build.props @@ -0,0 +1,11 @@ + + + + + + $(OutputPath)examples\$(ProjectName)\ + + + $(OutDir)examples\$(ProjectName)\ + + diff --git a/src/ext/Bal/CustomizedNativeRecommendedRules.ruleset b/src/ext/Bal/CustomizedNativeRecommendedRules.ruleset new file mode 100644 index 00000000..142b141c --- /dev/null +++ b/src/ext/Bal/CustomizedNativeRecommendedRules.ruleset @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/Directory.Build.props b/src/ext/Bal/Directory.Build.props new file mode 100644 index 00000000..f83cc154 --- /dev/null +++ b/src/ext/Bal/Directory.Build.props @@ -0,0 +1,29 @@ + + + + + + Debug + false + MSB3246 + + $(MSBuildProjectName) + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) + $(BaseOutputPath)obj\$(ProjectName)\ + $(BaseOutputPath)$(Configuration)\ + + WiX Toolset Team + WiX Toolset + Copyright (c) .NET Foundation and contributors. All rights reserved. + MS-RL + WiX Toolset + + + + + + + diff --git a/src/ext/Bal/Directory.Build.targets b/src/ext/Bal/Directory.Build.targets new file mode 100644 index 00000000..cb988931 --- /dev/null +++ b/src/ext/Bal/Directory.Build.targets @@ -0,0 +1,56 @@ + + + + + + + false + $(OutputPath)\$(AssemblyName).xml + + + + true + $(SolutionPath) + $(NCrunchOriginalSolutionPath) + + + + + + + $([System.IO.File]::ReadAllText($(TheSolutionPath))) + $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) + (?<="[PackageName]", ")(.*)(?=", ") + + + + + + %(Identity) + $(SolutionFileContent.Contains('\%(Identity).csproj')) + + + + + $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) + $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) + + + + + + + + + + + + + + diff --git a/src/ext/Bal/README.md b/src/ext/Bal/README.md new file mode 100644 index 00000000..cc5d9b34 --- /dev/null +++ b/src/ext/Bal/README.md @@ -0,0 +1,2 @@ +# Bal.wixext +WixToolset.Bal.wixext - Bootstrapper Application Layer WiX Toolset Extension diff --git a/src/ext/Bal/Samples/bafunctions/Readme.txt b/src/ext/Bal/Samples/bafunctions/Readme.txt new file mode 100644 index 00000000..517d0d4c --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/Readme.txt @@ -0,0 +1,85 @@ + +This is a sample project showing how to create a BA function assembly. + +The four interfaces are in the WixSampleBAFunctions.cpp file. + + +Example code: +~~~~~~~~~~~~~ + + + HRESULT hr = S_OK; + HKEY hkKey = NULL; + LPWSTR sczValue = NULL; + LPWSTR sczFormatedValue = NULL; + + + //--------------------------------------------------------------------------------------------- + // Example of BA function failure + hr = E_NOTIMPL; + BalExitOnFailure(hr, "Test failure."); + //--------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------- + // Example of setting a variables + hr = m_pEngine->SetVariableString(L"Variable1", L"String value"); + BalExitOnFailure(hr, "Failed to set variable."); + hr = m_pEngine->SetVariableNumeric(L"Variable2", 1234); + BalExitOnFailure(hr, "Failed to set variable."); + //--------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------- + // Example of reading burn variable. + BalGetStringVariable(L"WixBundleName", &sczValue); + BalExitOnFailure(hr, "Failed to get variable."); + + hr = m_pEngine->SetVariableString(L"Variable4", sczValue); + BalExitOnFailure(hr, "Failed to set variable."); + //--------------------------------------------------------------------------------------------- + + ReleaseNullStr(sczValue); // Release string so it can be re-used + + //--------------------------------------------------------------------------------------------- + // Examples of reading burn variable and formatting it. + BalGetStringVariable(L"InstallFolder", &sczValue); + BalExitOnFailure(hr, "Failed to get variable."); + + hr = m_pEngine->SetVariableString(L"Variable5", sczValue); + BalExitOnFailure(hr, "Failed to set variable."); + + BalFormatString(sczValue, &sczFormatedValue); + BalExitOnFailure(hr, "Failed to format variable."); + + hr = m_pEngine->SetVariableString(L"Variable6", sczFormatedValue); + BalExitOnFailure(hr, "Failed to set variable."); + //--------------------------------------------------------------------------------------------- + + ReleaseNullStr(sczValue); // Release string so it can be re-used + + //--------------------------------------------------------------------------------------------- + // Example of reading 64 bit registry and setting the InstallFolder variable to the value read. + hr = RegOpen(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5", KEY_READ | KEY_WOW64_64KEY, &hkKey); + BalExitOnFailure(hr, "Failed to open registry key."); + + hr = RegReadString(hkKey, L"InstallPath", &sczValue); + BalExitOnFailure(hr, "Failed to read registry value."); + + // Example of function call + PathBackslashTerminate(&sczValue); + + hr = m_pEngine->SetVariableString(L"InstallFolder", sczValue); + BalExitOnFailure(hr, "Failed to set variable."); + //--------------------------------------------------------------------------------------------- + + ReleaseNullStr(sczValue); // Release string so it can be re-used + + //--------------------------------------------------------------------------------------------- + // Example of calling a function that return HRESULT + hr = GetFileVersion(); + BalExitOnFailure(hr, "Failed to get version."); + //--------------------------------------------------------------------------------------------- + + LExit: + ReleaseRegKey(hkKey); + ReleaseStr(sczValue); + ReleaseStr(sczFormatedValue); diff --git a/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp b/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp new file mode 100644 index 00000000..531b86a3 --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp @@ -0,0 +1,95 @@ +// 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. + +#include "precomp.h" +#include "BalBaseBAFunctions.h" +#include "BalBaseBAFunctionsProc.h" + +class CWixSampleBAFunctions : public CBalBaseBAFunctions +{ +public: // IBootstrapperApplication + virtual STDMETHODIMP OnDetectBegin( + __in BOOL fInstalled, + __in DWORD cPackages, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Running detect begin BA function. fInstalled=%d, cPackages=%u, fCancel=%d", fInstalled, cPackages, *pfCancel); + + //------------------------------------------------------------------------------------------------- + // YOUR CODE GOES HERE + BalExitOnFailure(hr, "Change this message to represent real error handling."); + //------------------------------------------------------------------------------------------------- + + LExit: + return hr; + } + +public: // IBAFunctions + virtual STDMETHODIMP OnPlanBegin( + __in DWORD cPackages, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Running plan begin BA function. cPackages=%u, fCancel=%d", cPackages, *pfCancel); + + //------------------------------------------------------------------------------------------------- + // YOUR CODE GOES HERE + BalExitOnFailure(hr, "Change this message to represent real error handling."); + //------------------------------------------------------------------------------------------------- + + LExit: + return hr; + } + +public: + // + // Constructor - initialize member variables. + // + CWixSampleBAFunctions( + __in HMODULE hModule, + __in IBootstrapperEngine* pEngine, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs + ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) + { + } + + // + // Destructor - release member variables. + // + ~CWixSampleBAFunctions() + { + } +}; + + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + CWixSampleBAFunctions* pBAFunctions = NULL; + IBootstrapperEngine* pEngine = NULL; + + // This is required to enable logging functions. + hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + pBAFunctions = new CWixSampleBAFunctions(hModule, pEngine, pArgs); + ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CWixSampleBAFunctions object."); + + pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; + pResults->pvBAFunctionsProcContext = pBAFunctions; + pBAFunctions = NULL; + +LExit: + ReleaseObject(pBAFunctions); + ReleaseObject(pEngine); + + return hr; +} diff --git a/src/ext/Bal/Samples/bafunctions/bafunctions.cpp b/src/ext/Bal/Samples/bafunctions/bafunctions.cpp new file mode 100644 index 00000000..b20f4230 --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/bafunctions.cpp @@ -0,0 +1,46 @@ +// 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. + +#include "precomp.h" + +static HINSTANCE vhInstance = NULL; + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vhInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vhInstance = NULL; + break; + } + + return TRUE; +} + +extern "C" HRESULT WINAPI BAFunctionsCreate( + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + + hr = CreateBAFunctions(vhInstance, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create BAFunctions interface."); + +LExit: + return hr; +} + +extern "C" void WINAPI BAFunctionsDestroy( + ) +{ + BalUninitialize(); +} diff --git a/src/ext/Bal/Samples/bafunctions/bafunctions.def b/src/ext/Bal/Samples/bafunctions/bafunctions.def new file mode 100644 index 00000000..6e016dad --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/bafunctions.def @@ -0,0 +1,6 @@ +; 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. + + +EXPORTS + BAFunctionsCreate + BAFunctionsDestroy diff --git a/src/ext/Bal/Samples/bafunctions/bafunctions.vcxproj b/src/ext/Bal/Samples/bafunctions/bafunctions.vcxproj new file mode 100644 index 00000000..640c812d --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/bafunctions.vcxproj @@ -0,0 +1,81 @@ + + + + + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02} + DynamicLibrary + v142 + Unicode + BAFunctions + bafunctions.def + + + + + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib + + + + + Create + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + diff --git a/src/ext/Bal/Samples/bafunctions/packages.config b/src/ext/Bal/Samples/bafunctions/packages.config new file mode 100644 index 00000000..548ddb48 --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/Samples/bafunctions/precomp.h b/src/ext/Bal/Samples/bafunctions/precomp.h new file mode 100644 index 00000000..9d2fe726 --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/precomp.h @@ -0,0 +1,52 @@ +#pragma once +// 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. + + +#include + +#pragma warning(push) +#pragma warning(disable:4458) // declaration of 'xxx' hides class member +#include +#pragma warning(pop) + +#include +#include +#include +#include +#include +#include +#include + +// Standard WiX header files, include as required +#include "dutil.h" +//#include "memutil.h" +//#include "dictutil.h" +//#include "dirutil.h" +#include "fileutil.h" +#include "locutil.h" +//#include "logutil.h" +#include "pathutil.h" +//#include "resrutil.h" +//#include "shelutil.h" +#include "strutil.h" +#include "thmutil.h" +//#include "uriutil.h" +//#include "xmlutil.h" +#include "regutil.h" + +//#include "IBootstrapperEngine.h" +//#include "IBootstrapperApplication.h" + +#include "BalBaseBootstrapperApplication.h" +//#include "balinfo.h" +//#include "balcondition.h" +#include "balutil.h" + +#include "BAFunctions.h" +#include "IBAFunctions.h" + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ); diff --git a/src/ext/Bal/Samples/bafunctions/resource.h b/src/ext/Bal/Samples/bafunctions/resource.h new file mode 100644 index 00000000..149a8ff4 --- /dev/null +++ b/src/ext/Bal/Samples/bafunctions/resource.h @@ -0,0 +1,15 @@ +// 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. + +#define IDC_STATIC -1 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs new file mode 100644 index 00000000..d38fd1a9 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs @@ -0,0 +1,89 @@ +// 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. + +namespace WixToolset.Dnc.Host +{ + using System; + using System.Linq; + using System.Reflection; + using System.Runtime.InteropServices; + + delegate IBootstrapperApplicationFactory StaticEntryDelegate([MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyName, [MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyPath); + + /// + /// Entry point for the .NET Core host to create and return the BA to the engine. + /// Reflection is used instead of referencing WixToolset.Mba.Core directly to avoid requiring it in the AssemblyLoadContext. + /// + public sealed class BootstrapperApplicationFactory : IBootstrapperApplicationFactory + { + private string baFactoryAssemblyName; + private string baFactoryAssemblyPath; + + public BootstrapperApplicationFactory(string baFactoryAssemblyName, string baFactoryAssemblyPath) + { + this.baFactoryAssemblyName = baFactoryAssemblyName; + this.baFactoryAssemblyPath = baFactoryAssemblyPath; + } + + /// + /// Loads the bootstrapper application assembly and calls its IBootstrapperApplicationFactory.Create method. + /// + /// Pointer to BOOTSTRAPPER_CREATE_ARGS struct. + /// Pointer to BOOTSTRAPPER_CREATE_RESULTS struct. + /// The bootstrapper application assembly + /// does not define the . + public void Create(IntPtr pArgs, IntPtr pResults) + { + // Load the BA's IBootstrapperApplicationFactory. + var baFactoryType = BootstrapperApplicationFactory.GetBAFactoryTypeFromAssembly(this.baFactoryAssemblyName, this.baFactoryAssemblyPath); + var baFactory = Activator.CreateInstance(baFactoryType); + if (null == baFactory) + { + throw new InvalidBootstrapperApplicationFactoryException(); + } + + var createMethod = baFactoryType.GetMethod(nameof(Create), new[] { typeof(IntPtr), typeof(IntPtr) }); + if (null == createMethod) + { + throw new InvalidBootstrapperApplicationFactoryException(); + } + createMethod.Invoke(baFactory, new object[] { pArgs, pResults }); + } + + /// + /// Locates the and returns the specified type. + /// + /// The assembly that defines the IBootstrapperApplicationFactory implementation. + /// The bootstrapper application factory . + private static Type GetBAFactoryTypeFromAssembly(string assemblyName, string assemblyPath) + { + // The default ALC shouldn't need help loading the assembly, since the host should have provided the deps.json + // when starting the runtime. But it doesn't hurt so keep this in case an isolated ALC is ever needed. + var alc = new DnchostAssemblyLoadContext(assemblyPath, false); + var asm = alc.LoadFromAssemblyName(new AssemblyName(assemblyName)); + + var attr = asm.GetCustomAttributes() + .Where(a => a.GetType().FullName == "WixToolset.Mba.Core.BootstrapperApplicationFactoryAttribute") + .SingleOrDefault(); + + if (null == attr) + { + throw new MissingAttributeException(); + } + + var baFactoryTypeProperty = attr.GetType().GetProperty("BootstrapperApplicationFactoryType", typeof(Type)); + if (baFactoryTypeProperty == null || baFactoryTypeProperty.GetMethod == null) + { + throw new MissingAttributeException(); + } + + var baFactoryType = (Type)baFactoryTypeProperty.GetMethod.Invoke(attr, null); + return baFactoryType; + } + + // Entry point for the DNC host. + public static IBootstrapperApplicationFactory CreateBAFactory([MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyName, [MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyPath) + { + return new BootstrapperApplicationFactory(baFactoryAssemblyName, baFactoryAssemblyPath); + } + } +} diff --git a/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs b/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs new file mode 100644 index 00000000..1a383058 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs @@ -0,0 +1,58 @@ +// 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. + +namespace WixToolset.Dnc.Host +{ + using System; + using System.Reflection; + using System.Runtime.Loader; + + public sealed class DnchostAssemblyLoadContext : AssemblyLoadContext + { + private readonly AssemblyDependencyResolver resolver; + + public DnchostAssemblyLoadContext(string assemblyPath, bool isolateFromDefault) + : base(nameof(DnchostAssemblyLoadContext), isolateFromDefault) + { + this.resolver = new AssemblyDependencyResolver(assemblyPath); + + if (!this.IsCollectible) + { + AssemblyLoadContext.Default.Resolving += this.ResolveAssembly; + AssemblyLoadContext.Default.ResolvingUnmanagedDll += this.ResolveUnmanagedDll; + } + } + + private Assembly ResolveAssembly(AssemblyLoadContext defaultAlc, AssemblyName assemblyName) + { + var path = this.resolver.ResolveAssemblyToPath(assemblyName); + if (path != null) + { + var targetAlc = this.IsCollectible ? this : defaultAlc; + return targetAlc.LoadFromAssemblyPath(path); + } + + return null; + } + + private IntPtr ResolveUnmanagedDll(Assembly assembly, string unmanagedDllName) + { + var path = this.resolver.ResolveUnmanagedDllToPath(unmanagedDllName); + if (path != null) + { + return this.LoadUnmanagedDllFromPath(path); + } + + return IntPtr.Zero; + } + + protected override Assembly Load(AssemblyName assemblyName) + { + return this.ResolveAssembly(AssemblyLoadContext.Default, assemblyName); + } + + protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) + { + return this.ResolveUnmanagedDll(null, unmanagedDllName); + } + } +} diff --git a/src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs b/src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs new file mode 100644 index 00000000..32d4d4c5 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs @@ -0,0 +1,145 @@ +// 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. + +namespace WixToolset.Dnc.Host +{ + using System; + using System.Runtime.Serialization; + + /// + /// Base class for exception returned to the bootstrapper application host. + /// + [Serializable] + public abstract class BootstrapperException : Exception + { + /// + /// Creates an instance of the base class with the given HRESULT. + /// + /// The HRESULT for the exception that is used by the bootstrapper application host. + public BootstrapperException(int hr) + { + this.HResult = hr; + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public BootstrapperException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public BootstrapperException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected BootstrapperException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } + + /// + /// The bootstrapper application assembly loaded by the host does not contain exactly one instance of the + /// class. + /// + /// + [Serializable] + public class MissingAttributeException : BootstrapperException + { + /// + /// Creates a new instance of the class. + /// + public MissingAttributeException() + : base(NativeMethods.E_NOTFOUND) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public MissingAttributeException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public MissingAttributeException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected MissingAttributeException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } + + /// + /// The bootstrapper application factory specified by the + /// does not extend the base class. + /// + /// + /// + [Serializable] + public class InvalidBootstrapperApplicationFactoryException : BootstrapperException + { + /// + /// Creates a new instance of the class. + /// + public InvalidBootstrapperApplicationFactoryException() + : base(NativeMethods.E_UNEXPECTED) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public InvalidBootstrapperApplicationFactoryException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public InvalidBootstrapperApplicationFactoryException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected InvalidBootstrapperApplicationFactoryException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs new file mode 100644 index 00000000..96731192 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs @@ -0,0 +1,16 @@ +// 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. + +namespace WixToolset.Dnc.Host +{ + using System; + using System.Runtime.InteropServices; + + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IBootstrapperApplicationFactory + { + void Create( + IntPtr pArgs, + IntPtr pResults + ); + } +} diff --git a/src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs b/src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs new file mode 100644 index 00000000..6dc393c6 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Dnc.Host +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Contains native constants, functions, and structures for this assembly. + /// + internal static class NativeMethods + { + #region Error Constants + internal const int E_NOTFOUND = unchecked((int)0x80070490); + internal const int E_UNEXPECTED = unchecked((int)0x8000ffff); + #endregion + } +} diff --git a/src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj b/src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj new file mode 100644 index 00000000..f347ca0b --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj @@ -0,0 +1,44 @@ + + + + + + netcoreapp3.1 + WixToolset.Dnc.Host + WiX Toolset .NET Core BA Host + WiX Toolset .NET Core BA Host + embedded + AnyCPU + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs new file mode 100644 index 00000000..78e68bd9 --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs @@ -0,0 +1,86 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Configuration; + using System.Reflection; + using System.Runtime.InteropServices; + using WixToolset.Mba.Core; + + /// + /// Entry point for the managed host to create and return the BA to the engine. + /// + [ClassInterface(ClassInterfaceType.None)] + public sealed class BootstrapperApplicationFactory : MarshalByRefObject, IBootstrapperApplicationFactory + { + /// + /// Creates a new instance of the class. + /// Entry point for the MBA host. + /// + public BootstrapperApplicationFactory() + { + } + + /// + /// Loads the bootstrapper application assembly and calls its IBootstrapperApplicationFactory.Create method. + /// + /// Pointer to BOOTSTRAPPER_CREATE_ARGS struct. + /// Pointer to BOOTSTRAPPER_CREATE_RESULTS struct. + /// The bootstrapper application assembly + /// does not define the . + public void Create(IntPtr pArgs, IntPtr pResults) + { + // Get the wix.boostrapper section group to get the name of the bootstrapper application assembly to host. + var section = ConfigurationManager.GetSection("wix.bootstrapper/host") as HostSection; + if (null == section) + { + throw new MissingAttributeException(); // TODO: throw a more specific exception than this. + } + + // Load the BA's IBootstrapperApplicationFactory. + var baFactoryType = BootstrapperApplicationFactory.GetBAFactoryTypeFromAssembly(section.AssemblyName); + var baFactory = (IBootstrapperApplicationFactory)Activator.CreateInstance(baFactoryType); + if (null == baFactory) + { + throw new InvalidBootstrapperApplicationFactoryException(); + } + + baFactory.Create(pArgs, pResults); + } + + /// + /// Locates the and returns the specified type. + /// + /// The assembly that defines the IBootstrapperApplicationFactory implementation. + /// The bootstrapper application factory . + private static Type GetBAFactoryTypeFromAssembly(string assemblyName) + { + Type baFactoryType = null; + + // Load the requested assembly. + Assembly asm = AppDomain.CurrentDomain.Load(assemblyName); + + // If an assembly was loaded and is not the current assembly, check for the required attribute. + // This is done to avoid using the BootstrapperApplicationFactoryAttribute which we use at build time + // to specify the BootstrapperApplicationFactory assembly in the manifest. + if (!Assembly.GetExecutingAssembly().Equals(asm)) + { + // There must be one and only one BootstrapperApplicationFactoryAttribute. + // The attribute prevents multiple declarations already. + var attrs = (BootstrapperApplicationFactoryAttribute[])asm.GetCustomAttributes(typeof(BootstrapperApplicationFactoryAttribute), false); + if (null != attrs) + { + baFactoryType = attrs[0].BootstrapperApplicationFactoryType; + } + } + + if (null == baFactoryType) + { + throw new MissingAttributeException(); + } + + return baFactoryType; + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs b/src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs new file mode 100644 index 00000000..5cf1bc9c --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs @@ -0,0 +1,29 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Configuration; + + /// + /// Handler for the wix.bootstrapper configuration section group. + /// + public class BootstrapperSectionGroup : ConfigurationSectionGroup + { + /// + /// Creates a new instance of the class. + /// + public BootstrapperSectionGroup() + { + } + + /// + /// Gets the handler for the mba configuration section. + /// + [ConfigurationProperty("host")] + public HostSection Host + { + get { return (HostSection)base.Sections["host"]; } + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs b/src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs new file mode 100644 index 00000000..c68951f0 --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs @@ -0,0 +1,145 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Runtime.Serialization; + + /// + /// Base class for exception returned to the bootstrapper application host. + /// + [Serializable] + public abstract class BootstrapperException : Exception + { + /// + /// Creates an instance of the base class with the given HRESULT. + /// + /// The HRESULT for the exception that is used by the bootstrapper application host. + public BootstrapperException(int hr) + { + this.HResult = hr; + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public BootstrapperException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public BootstrapperException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected BootstrapperException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } + + /// + /// The bootstrapper application assembly loaded by the host does not contain exactly one instance of the + /// class. + /// + /// + [Serializable] + public class MissingAttributeException : BootstrapperException + { + /// + /// Creates a new instance of the class. + /// + public MissingAttributeException() + : base(NativeMethods.E_NOTFOUND) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public MissingAttributeException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public MissingAttributeException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected MissingAttributeException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } + + /// + /// The bootstrapper application factory specified by the + /// does not extend the base class. + /// + /// + /// + [Serializable] + public class InvalidBootstrapperApplicationFactoryException : BootstrapperException + { + /// + /// Creates a new instance of the class. + /// + public InvalidBootstrapperApplicationFactoryException() + : base(NativeMethods.E_UNEXPECTED) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message. + public InvalidBootstrapperApplicationFactoryException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Exception message + /// Inner exception associated with this one + public InvalidBootstrapperApplicationFactoryException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Serialization information for this exception + /// Streaming context to serialize to + protected InvalidBootstrapperApplicationFactoryException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/HostSection.cs b/src/ext/Bal/WixToolset.Mba.Host/HostSection.cs new file mode 100644 index 00000000..632025c7 --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/HostSection.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Configuration; + + /// + /// Handler for the Host configuration section. + /// + public sealed class HostSection : ConfigurationSection + { + private static readonly ConfigurationProperty assemblyNameProperty = new ConfigurationProperty("assemblyName", typeof(string), null, ConfigurationPropertyOptions.IsRequired); + private static readonly ConfigurationProperty supportedFrameworksProperty = new ConfigurationProperty("", typeof(SupportedFrameworkElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); + + /// + /// Creates a new instance of the class. + /// + public HostSection() + { + } + + /// + /// Gets the name of the assembly that contians the child class. + /// + /// + /// The assembly specified by this name must contain the to identify + /// the type of the child class. + /// + [ConfigurationProperty("assemblyName", IsRequired = true)] + public string AssemblyName + { + get { return (string)base[assemblyNameProperty]; } + set { base[assemblyNameProperty] = value; } + } + + /// + /// Gets the of supported frameworks for the host configuration. + /// + [ConfigurationProperty("", IsDefaultCollection = true)] + [ConfigurationCollection(typeof(SupportedFrameworkElement))] + public SupportedFrameworkElementCollection SupportedFrameworks + { + get { return (SupportedFrameworkElementCollection)base[supportedFrameworksProperty]; } + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs b/src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs new file mode 100644 index 00000000..b9fc85a0 --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Contains native constants, functions, and structures for this assembly. + /// + internal static class NativeMethods + { + #region Error Constants + internal const int E_NOTFOUND = unchecked((int)0x80070490); + internal const int E_UNEXPECTED = unchecked((int)0x8000ffff); + #endregion + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs b/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs new file mode 100644 index 00000000..fe7fd2eb --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Configuration; + + /// + /// Handler for the supportedFramework configuration section. + /// + public sealed class SupportedFrameworkElement : ConfigurationElement + { + private static readonly ConfigurationProperty versionProperty = new ConfigurationProperty("version", typeof(string), null, ConfigurationPropertyOptions.IsRequired); + private static readonly ConfigurationProperty runtimeVersionProperty = new ConfigurationProperty("runtimeVersion", typeof(string)); + + /// + /// Creates a new instance of the class. + /// + public SupportedFrameworkElement() + { + } + + /// + /// Gets the version of the supported framework. + /// + /// + /// The assembly specified by this name must contain a value matching the NETFX version registry key under + /// "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP". + /// + [ConfigurationProperty("version", IsRequired = true)] + public string Version + { + get { return (string)base[versionProperty]; } + set { base[versionProperty] = value; } + } + + /// + /// Gets the runtime version required by this supported framework. + /// + [ConfigurationProperty("runtimeVersion", IsRequired = false)] + public string RuntimeVersion + { + get { return (string)base[runtimeVersionProperty]; } + set { base[runtimeVersionProperty] = value; } + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs b/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs new file mode 100644 index 00000000..12c7cf3e --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs @@ -0,0 +1,36 @@ +// 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. + +namespace WixToolset.Mba.Host +{ + using System; + using System.Configuration; + using System.Diagnostics.CodeAnalysis; + + /// + /// Handler for the supportedFramework collection. + /// + [SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")] + [ConfigurationCollection(typeof(SupportedFrameworkElement), AddItemName = "supportedFramework", CollectionType = ConfigurationElementCollectionType.BasicMap)] + public sealed class SupportedFrameworkElementCollection : ConfigurationElementCollection + { + public override ConfigurationElementCollectionType CollectionType + { + get { return ConfigurationElementCollectionType.BasicMap; } + } + + protected override string ElementName + { + get { return "supportedFramework"; } + } + + protected override ConfigurationElement CreateNewElement() + { + return new SupportedFrameworkElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return (element as SupportedFrameworkElement).Version; + } + } +} diff --git a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config new file mode 100644 index 00000000..a19b66f1 --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config @@ -0,0 +1,26 @@ + + + + + + + +
+ + + + + + + + + + + + + + diff --git a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj new file mode 100644 index 00000000..3ee0ad1e --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj @@ -0,0 +1,54 @@ + + + + + + WixToolset.Mba.Host + WixToolset.Mba.Host + net20 + Managed Bootstrapper Application entry point + embedded + $(MSBuildThisFileName).nuspec + AnyCPU + + + + + + + + + + + + + + + + False + + + + + + + + + + + + + + + + + + + + + + $(OutputPath) + Id=$(AssemblyName);Version=$(BuildVersionSimple);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl) + + + \ No newline at end of file diff --git a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec new file mode 100644 index 00000000..00fd21ac --- /dev/null +++ b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec @@ -0,0 +1,23 @@ + + + + $id$ + $version$ + WiX Toolset Team + WiX Toolset Team + MS-RL + https://github.com/wixtoolset/Bal.wixext + false + $description$ + $copyright$ + + + + + + + + + + + diff --git a/src/ext/Bal/appveyor.cmd b/src/ext/Bal/appveyor.cmd new file mode 100644 index 00000000..f4e9c26e --- /dev/null +++ b/src/ext/Bal/appveyor.cmd @@ -0,0 +1,17 @@ +@setlocal +@pushd %~dp0 +@set _C=Release + +nuget restore || exit /b + +msbuild -p:Configuration=%_C% -Restore || exit /b +msbuild -p:Configuration=%_C% src\test\examples\examples.proj || exit /b + +dotnet test -c %_C% --no-build src\test\WixToolsetTest.Bal || exit /b +dotnet test -c %_C% --no-build src\test\WixToolsetTest.ManagedHost || exit /b + +msbuild -p:Configuration=%_C% -p:NoBuild=true -t:Pack src\wixext\WixToolset.Bal.wixext.csproj || exit /b +msbuild -p:Configuration=%_C% -p:NoBuild=true -t:Pack src\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj || exit /b + +@popd +@endlocal diff --git a/src/ext/Bal/appveyor.yml b/src/ext/Bal/appveyor.yml new file mode 100644 index 00000000..7c686b04 --- /dev/null +++ b/src/ext/Bal/appveyor.yml @@ -0,0 +1,40 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml +# then update all of the repos. + +branches: + only: + - master + - develop + +image: Visual Studio 2019 + +version: 0.0.0.{build} +configuration: Release + +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_XMLDOC_MODE: skip + +build_script: + - appveyor.cmd + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +skip_branch_with_pr: true +skip_tags: true + +artifacts: +- path: build\Release\**\*.nupkg + name: nuget + +notifications: +- provider: Slack + incoming_webhook: + secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= diff --git a/src/ext/Bal/dnchost/coreclrhost.h b/src/ext/Bal/dnchost/coreclrhost.h new file mode 100644 index 00000000..07f28735 --- /dev/null +++ b/src/ext/Bal/dnchost/coreclrhost.h @@ -0,0 +1,137 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + + +// ***** ABOUT THIS HEADER ***** +// ************************************************************************************** +// +// This is the version on 2019-12-22 from +// https://github.com/dotnet/runtime/blob/master/src/coreclr/src/coreclr/hosts/inc/coreclrhost.h +// +// ************************************************************************************** +// **************************** + + +// +// APIs for hosting CoreCLR +// + +#ifndef __CORECLR_HOST_H__ +#define __CORECLR_HOST_H__ + +#if defined(_WIN32) && defined(_M_IX86) +#define CORECLR_CALLING_CONVENTION __stdcall +#else +#define CORECLR_CALLING_CONVENTION +#endif + +// For each hosting API, we define a function prototype and a function pointer +// The prototype is useful for implicit linking against the dynamic coreclr +// library and the pointer for explicit dynamic loading (dlopen, LoadLibrary) +#define CORECLR_HOSTING_API(function, ...) \ + extern "C" int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \ + typedef int (CORECLR_CALLING_CONVENTION *function##_ptr)(__VA_ARGS__) + +// +// Initialize the CoreCLR. Creates and starts CoreCLR host and creates an app domain +// +// Parameters: +// exePath - Absolute path of the executable that invoked the ExecuteAssembly (the native host application) +// appDomainFriendlyName - Friendly name of the app domain that will be created to execute the assembly +// propertyCount - Number of properties (elements of the following two arguments) +// propertyKeys - Keys of properties of the app domain +// propertyValues - Values of properties of the app domain +// hostHandle - Output parameter, handle of the created host +// domainId - Output parameter, id of the created app domain +// +// Returns: +// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed +// +CORECLR_HOSTING_API(coreclr_initialize, + const char* exePath, + const char* appDomainFriendlyName, + int propertyCount, + const char** propertyKeys, + const char** propertyValues, + void** hostHandle, + unsigned int* domainId); + +// +// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host. +// +// Parameters: +// hostHandle - Handle of the host +// domainId - Id of the domain +// +// Returns: +// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed +// +CORECLR_HOSTING_API(coreclr_shutdown, + void* hostHandle, + unsigned int domainId); + +// +// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host. +// +// Parameters: +// hostHandle - Handle of the host +// domainId - Id of the domain +// latchedExitCode - Latched exit code after domain unloaded +// +// Returns: +// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed +// +CORECLR_HOSTING_API(coreclr_shutdown_2, + void* hostHandle, + unsigned int domainId, + int* latchedExitCode); + +// +// Create a native callable function pointer for a managed method. +// +// Parameters: +// hostHandle - Handle of the host +// domainId - Id of the domain +// entryPointAssemblyName - Name of the assembly which holds the custom entry point +// entryPointTypeName - Name of the type which holds the custom entry point +// entryPointMethodName - Name of the method which is the custom entry point +// delegate - Output parameter, the function stores a native callable function pointer to the delegate at the specified address +// +// Returns: +// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed +// +CORECLR_HOSTING_API(coreclr_create_delegate, + void* hostHandle, + unsigned int domainId, + const char* entryPointAssemblyName, + const char* entryPointTypeName, + const char* entryPointMethodName, + void** delegate); + +// +// Execute a managed assembly with given arguments +// +// Parameters: +// hostHandle - Handle of the host +// domainId - Id of the domain +// argc - Number of arguments passed to the executed assembly +// argv - Array of arguments passed to the executed assembly +// managedAssemblyPath - Path of the managed assembly to execute (or NULL if using a custom entrypoint). +// exitCode - Exit code returned by the executed assembly +// +// Returns: +// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed +// +CORECLR_HOSTING_API(coreclr_execute_assembly, + void* hostHandle, + unsigned int domainId, + int argc, + const char** argv, + const char* managedAssemblyPath, + unsigned int* exitCode); + +#undef CORECLR_HOSTING_API + +#endif // __CORECLR_HOST_H__ \ No newline at end of file diff --git a/src/ext/Bal/dnchost/dnchost.cpp b/src/ext/Bal/dnchost/dnchost.cpp new file mode 100644 index 00000000..8ca326fc --- /dev/null +++ b/src/ext/Bal/dnchost/dnchost.cpp @@ -0,0 +1,309 @@ +// 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. + +#include "precomp.h" + +static DNCSTATE vstate = { }; + + +// internal function declarations + +static HRESULT LoadModulePaths( + __in DNCSTATE* pState + ); +static HRESULT LoadDncConfiguration( + __in DNCSTATE* pState, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs + ); +static HRESULT LoadRuntime( + __in DNCSTATE* pState + ); +static HRESULT LoadManagedBootstrapperApplicationFactory( + __in DNCSTATE* pState + ); +static HRESULT CreatePrerequisiteBA( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in LPCWSTR wzAppBase, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); + + +// function definitions + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vstate.hInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vstate.hInstance = NULL; + break; + } + + return TRUE; +} + +extern "C" HRESULT WINAPI BootstrapperApplicationCreate( + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + HRESULT hrHostInitialization = S_OK; + IBootstrapperEngine* pEngine = NULL; + + // coreclr.dll doesn't support unloading, so the rest of the .NET Core hosting stack doesn't support it either. + // This means we also can't unload. + pResults->fDisableUnloading = TRUE; + + hr = BalInitializeFromCreateArgs(pArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + if (!vstate.fInitialized) + { + hr = XmlInitialize(); + BalExitOnFailure(hr, "Failed to initialize XML."); + + hr = LoadModulePaths(&vstate); + BalExitOnFailure(hr, "Failed to get the host base path."); + + hr = LoadDncConfiguration(&vstate, pArgs); + BalExitOnFailure(hr, "Failed to get the dnc configuration."); + + vstate.fInitialized = TRUE; + } + + if (!vstate.fInitializedRuntime) + { + hr = LoadRuntime(&vstate); + + vstate.fInitializedRuntime = SUCCEEDED(hr); + } + + if (vstate.fInitializedRuntime) + { + if (!vstate.pAppFactory) + { + hr = LoadManagedBootstrapperApplicationFactory(&vstate); + BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory."); + } + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core %ls bootstrapper application.", DNCHOSTTYPE_FDD == vstate.type ? L"FDD" : L"SCD"); + + hr = vstate.pAppFactory->Create(pArgs, pResults); + BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application."); + } + else // fallback to the prerequisite BA. + { + if (DNCHOSTTYPE_SCD == vstate.type) + { + hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE; + BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); + } + else + { + hrHostInitialization = S_OK; + } + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x%08x.", hr); + + hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, vstate.sczAppBase, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); + } + +LExit: + ReleaseNullObject(pEngine); + + return hr; +} + +extern "C" void WINAPI BootstrapperApplicationDestroy() +{ + if (vstate.hMbapreqModule) + { + PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = reinterpret_cast(::GetProcAddress(vstate.hMbapreqModule, "DncPrereqBootstrapperApplicationDestroy")); + if (pfnDestroy) + { + (*pfnDestroy)(); + } + + ::FreeLibrary(vstate.hMbapreqModule); + vstate.hMbapreqModule = NULL; + } + + BalUninitialize(); +} + +static HRESULT LoadModulePaths( + __in DNCSTATE* pState + ) +{ + HRESULT hr = S_OK; + + hr = PathForCurrentProcess(&pState->sczModuleFullPath, pState->hInstance); + BalExitOnFailure(hr, "Failed to get the full host path."); + + hr = PathGetDirectory(pState->sczModuleFullPath, &pState->sczAppBase); + BalExitOnFailure(hr, "Failed to get the directory of the full process path."); + + hr = PathConcat(pState->sczAppBase, DNC_ASSEMBLY_FILE_NAME, &pState->sczManagedHostPath); + BalExitOnFailure(hr, "Failed to create managed host path."); + +LExit: + return hr; +} + +static HRESULT LoadDncConfiguration( + __in DNCSTATE* pState, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs + ) +{ + HRESULT hr = S_OK; + IXMLDOMDocument* pixdManifest = NULL; + IXMLDOMNode* pixnHost = NULL; + LPWSTR sczPayloadName = NULL; + DWORD dwBool = 0; + + hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); + BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFactoryAssembly", &pixnHost); + BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly element."); + + if (S_FALSE == hr) + { + hr = E_NOTFOUND; + BalExitOnRootFailure(hr, "Failed to find WixBalBAFactoryAssembly element in bootstrapper application config."); + } + + hr = XmlGetAttributeEx(pixnHost, L"FilePath", &sczPayloadName); + BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly/@FilePath."); + + hr = PathConcat(pArgs->pCommand->wzBootstrapperWorkingFolder, sczPayloadName, &pState->sczBaFactoryAssemblyPath); + BalExitOnFailure(hr, "Failed to create BaFactoryAssemblyPath."); + + LPCWSTR wzFileName = PathFile(pState->sczBaFactoryAssemblyPath); + LPCWSTR wzExtension = PathExtension(pState->sczBaFactoryAssemblyPath); + if (!wzExtension) + { + BalExitOnFailure(hr = E_FAIL, "BaFactoryAssemblyPath has no extension."); + } + + hr = StrAllocString(&pState->sczBaFactoryAssemblyName, wzFileName, wzExtension - wzFileName); + BalExitOnFailure(hr, "Failed to copy BAFactoryAssembly payload Name."); + + hr = StrAllocString(&pState->sczBaFactoryDepsJsonPath, pState->sczBaFactoryAssemblyPath, wzExtension - pState->sczBaFactoryAssemblyPath); + BalExitOnFailure(hr, "Failed to initialize deps json path."); + + hr = StrAllocString(&pState->sczBaFactoryRuntimeConfigPath, pState->sczBaFactoryDepsJsonPath, 0); + BalExitOnFailure(hr, "Failed to initialize runtime config path."); + + hr = StrAllocConcat(&pState->sczBaFactoryDepsJsonPath, L".deps.json", 0); + BalExitOnFailure(hr, "Failed to concat extension to deps json path."); + + hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0); + BalExitOnFailure(hr, "Failed to concat extension to runtime config path."); + + pState->type = DNCHOSTTYPE_FDD; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); + if (S_FALSE == hr) + { + ExitFunction1(hr = S_OK); + } + BalExitOnFailure(hr, "Failed to find WixDncOptions element in bootstrapper application config."); + + hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr) && dwBool) + { + pState->type = DNCHOSTTYPE_SCD; + } + BalExitOnFailure(hr, "Failed to get SelfContainedDeployment value."); + +LExit: + ReleaseStr(sczPayloadName); + ReleaseObject(pixnHost); + ReleaseObject(pixdManifest); + + return hr; +} + +static HRESULT LoadRuntime( + __in DNCSTATE* pState + ) +{ + HRESULT hr = S_OK; + + hr = DnchostLoadRuntime( + &pState->hostfxrState, + pState->sczModuleFullPath, + pState->sczManagedHostPath, + pState->sczBaFactoryDepsJsonPath, + pState->sczBaFactoryRuntimeConfigPath); + + return hr; +} + +static HRESULT LoadManagedBootstrapperApplicationFactory( + __in DNCSTATE* pState + ) +{ + HRESULT hr = S_OK; + + hr = DnchostCreateFactory( + &pState->hostfxrState, + pState->sczBaFactoryAssemblyName, + pState->sczBaFactoryAssemblyPath, + &pState->pAppFactory); + + return hr; +} + +static HRESULT CreatePrerequisiteBA( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in LPCWSTR wzAppBase, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + LPWSTR sczDncpreqPath = NULL; + HMODULE hModule = NULL; + + hr = PathConcat(wzAppBase, L"dncpreq.dll", &sczDncpreqPath); + BalExitOnFailure(hr, "Failed to get path to pre-requisite BA."); + + hModule = ::LoadLibraryW(sczDncpreqPath); + BalExitOnNullWithLastError(hModule, hr, "Failed to load pre-requisite BA DLL."); + + PFN_DNCPREQ_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = reinterpret_cast(::GetProcAddress(hModule, "DncPrereqBootstrapperApplicationCreate")); + BalExitOnNullWithLastError(pfnCreate, hr, "Failed to get DncPrereqBootstrapperApplicationCreate entry-point from: %ls", sczDncpreqPath); + + hr = pfnCreate(hrHostInitialization, pEngine, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create prequisite bootstrapper app."); + + vstate.hMbapreqModule = hModule; + hModule = NULL; + +LExit: + if (hModule) + { + ::FreeLibrary(hModule); + } + ReleaseStr(sczDncpreqPath); + + return hr; +} diff --git a/src/ext/Bal/dnchost/dnchost.def b/src/ext/Bal/dnchost/dnchost.def new file mode 100644 index 00000000..4488df94 --- /dev/null +++ b/src/ext/Bal/dnchost/dnchost.def @@ -0,0 +1,6 @@ +; 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. + + +EXPORTS + BootstrapperApplicationCreate + BootstrapperApplicationDestroy diff --git a/src/ext/Bal/dnchost/dnchost.h b/src/ext/Bal/dnchost/dnchost.h new file mode 100644 index 00000000..22fd8f5e --- /dev/null +++ b/src/ext/Bal/dnchost/dnchost.h @@ -0,0 +1,35 @@ +#pragma once +// 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. + + +enum DNCHOSTTYPE +{ + DNCHOSTTYPE_UNKNOWN, + DNCHOSTTYPE_FDD, + DNCHOSTTYPE_SCD, +}; + +extern "C" typedef HRESULT(WINAPI* PFN_DNCPREQ_BOOTSTRAPPER_APPLICATION_CREATE)( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); + +struct DNCSTATE +{ + BOOL fInitialized; + BOOL fInitializedRuntime; + HINSTANCE hInstance; + LPWSTR sczModuleFullPath; + LPWSTR sczAppBase; + LPWSTR sczManagedHostPath; + LPWSTR sczBaFactoryAssemblyName; + LPWSTR sczBaFactoryAssemblyPath; + LPWSTR sczBaFactoryDepsJsonPath; + LPWSTR sczBaFactoryRuntimeConfigPath; + DNCHOSTTYPE type; + HOSTFXR_STATE hostfxrState; + IBootstrapperApplicationFactory* pAppFactory; + HMODULE hMbapreqModule; +}; diff --git a/src/ext/Bal/dnchost/dnchost.vcxproj b/src/ext/Bal/dnchost/dnchost.vcxproj new file mode 100644 index 00000000..bef3f77e --- /dev/null +++ b/src/ext/Bal/dnchost/dnchost.vcxproj @@ -0,0 +1,106 @@ + + + + + + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B6F70281-6583-4138-BB7F-AABFEBBB3CA2} + DynamicLibrary + v142 + Unicode + dnchost + dnchost.def + + + + + $(Platform) + x86 + ..\..\packages\runtime.win-$(NetHostPlatform).Microsoft.NETCore.DotNetAppHost.5.0.0\runtimes\win-$(NetHostPlatform)\native\ + shlwapi.lib;$(NetHostPath)libnethost.lib + + + + + + Create + + + + + + + + + + + + + + + + + $(BaseOutputPath)obj;$(NetHostPath);%(AdditionalIncludeDirectories) + + + /LTCG %(AdditionalOptions) + + + + + {0D780900-C2FF-4FA2-8CB5-8A19768724C5} + false + true + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/dnchost/dncutil.cpp b/src/ext/Bal/dnchost/dncutil.cpp new file mode 100644 index 00000000..34d14911 --- /dev/null +++ b/src/ext/Bal/dnchost/dncutil.cpp @@ -0,0 +1,411 @@ +// 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. + +#include "precomp.h" + +// https://github.com/dotnet/runtime/blob/master/src/installer/corehost/error_codes.h +#define InvalidArgFailure 0x80008081 +#define HostApiBufferTooSmall 0x80008098 +#define HostApiUnsupportedVersion 0x800080a2 + +// internal function declarations + +static HRESULT GetHostfxrPath( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ); +static HRESULT LoadHostfxr( + __in HOSTFXR_STATE* pState + ); +static HRESULT InitializeHostfxr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzManagedHostPath, + __in LPCWSTR wzDepsJsonPath, + __in LPCWSTR wzRuntimeConfigPath + ); +static HRESULT InitializeCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ); +static HRESULT InitializeCoreClrPre5( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ); +static HRESULT LoadCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzCoreClrPath + ); +static HRESULT StartCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath, + __in DWORD cProperties, + __in LPCWSTR* propertyKeys, + __in LPCWSTR* propertyValues + ); + + +// function definitions + +HRESULT DnchostLoadRuntime( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath, + __in LPCWSTR wzManagedHostPath, + __in LPCWSTR wzDepsJsonPath, + __in LPCWSTR wzRuntimeConfigPath + ) +{ + HRESULT hr = S_OK; + + hr = GetHostfxrPath(pState, wzNativeHostPath); + BalExitOnFailure(hr, "Failed to find hostfxr."); + + hr = LoadHostfxr(pState); + BalExitOnFailure(hr, "Failed to load hostfxr."); + + hr = InitializeHostfxr(pState, wzManagedHostPath, wzDepsJsonPath, wzRuntimeConfigPath); + BalExitOnFailure(hr, "Failed to initialize hostfxr."); + + hr = InitializeCoreClr(pState, wzNativeHostPath); + BalExitOnFailure(hr, "Failed to initialize coreclr."); + +LExit: + return hr; +} + +HRESULT DnchostCreateFactory( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzBaFactoryAssemblyName, + __in LPCWSTR wzBaFactoryAssemblyPath, + __out IBootstrapperApplicationFactory** ppAppFactory + ) +{ + HRESULT hr = S_OK; + PFNCREATEBAFACTORY pfnCreateBAFactory = NULL; + + if (pState->pfnGetFunctionPointer) + { + hr = pState->pfnGetFunctionPointer( + DNC_ENTRY_TYPEW, + DNC_STATIC_ENTRY_METHODW, + DNC_STATIC_ENTRY_DELEGATEW, + NULL, + NULL, + reinterpret_cast(&pfnCreateBAFactory)); + BalExitOnFailure(hr, "Failed to create delegate through GetFunctionPointer."); + } + else + { + hr = pState->pfnCoreclrCreateDelegate( + pState->pClrHandle, + pState->dwDomainId, + DNC_ASSEMBLY_FULL_NAME, + DNC_ENTRY_TYPE, + DNC_STATIC_ENTRY_METHOD, + reinterpret_cast(&pfnCreateBAFactory)); + BalExitOnFailure(hr, "Failed to create delegate in app domain."); + } + + *ppAppFactory = pfnCreateBAFactory(wzBaFactoryAssemblyName, wzBaFactoryAssemblyPath); + +LExit: + return hr; +} + +static HRESULT GetHostfxrPath( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ) +{ + HRESULT hr = S_OK; + get_hostfxr_parameters getHostfxrParameters = { }; + int nrc = 0; + size_t cchHostFxrPath = MAX_PATH; + + getHostfxrParameters.size = sizeof(get_hostfxr_parameters); + getHostfxrParameters.assembly_path = wzNativeHostPath; + + // get_hostfxr_path does a full search on every call, so + // minimize the number of calls + // need to loop + for (;;) + { + cchHostFxrPath *= 2; + hr = StrAlloc(&pState->sczHostfxrPath, cchHostFxrPath); + BalExitOnFailure(hr, "Failed to allocate hostFxrPath."); + + nrc = get_hostfxr_path(pState->sczHostfxrPath, &cchHostFxrPath, &getHostfxrParameters); + if (HostApiBufferTooSmall != nrc) + { + break; + } + } + if (0 != nrc) + { + BalExitOnFailure(hr = nrc, "GetHostfxrPath failed"); + } + +LExit: + return hr; +} + +static HRESULT LoadHostfxr( + __in HOSTFXR_STATE* pState + ) +{ + HRESULT hr = S_OK; + HMODULE hHostfxr; + + hHostfxr = ::LoadLibraryExW(pState->sczHostfxrPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + BalExitOnNullWithLastError(hHostfxr, hr, "Failed to load hostfxr from '%ls'.", pState->sczHostfxrPath); + + pState->pfnHostfxrInitializeForApp = reinterpret_cast(::GetProcAddress(hHostfxr, "hostfxr_initialize_for_dotnet_command_line")); + BalExitOnNullWithLastError(pState->pfnHostfxrInitializeForApp, hr, "Failed to get procedure address for hostfxr_initialize_for_dotnet_command_line."); + + pState->pfnHostfxrGetRuntimeProperties = reinterpret_cast(::GetProcAddress(hHostfxr, "hostfxr_get_runtime_properties")); + BalExitOnNullWithLastError(pState->pfnHostfxrGetRuntimeProperties, hr, "Failed to get procedure address for hostfxr_get_runtime_properties."); + + pState->pfnHostfxrSetErrorWriter = reinterpret_cast(::GetProcAddress(hHostfxr, "hostfxr_set_error_writer")); + BalExitOnNullWithLastError(pState->pfnHostfxrSetErrorWriter, hr, "Failed to get procedure address for hostfxr_set_error_writer."); + + pState->pfnHostfxrClose = reinterpret_cast(::GetProcAddress(hHostfxr, "hostfxr_close")); + BalExitOnNullWithLastError(pState->pfnHostfxrClose, hr, "Failed to get procedure address for hostfxr_close."); + + pState->pfnHostfxrGetRuntimeDelegate = reinterpret_cast(::GetProcAddress(hHostfxr, "hostfxr_get_runtime_delegate")); + BalExitOnNullWithLastError(pState->pfnHostfxrGetRuntimeDelegate, hr, "Failed to get procedure address for hostfxr_get_runtime_delegate."); + +LExit: + // Never unload the module since it isn't meant to be unloaded. + + return hr; +} + +static void HOSTFXR_CALLTYPE DnchostErrorWriter( + __in LPCWSTR wzMessage + ) +{ + BOOTSTRAPPER_LOG_LEVEL level = BOOTSTRAPPER_LOG_LEVEL_ERROR; + + if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, 0, wzMessage, -1, L"The requested delegate type is not available in the target framework.", -1)) + { + level = BOOTSTRAPPER_LOG_LEVEL_DEBUG; + } + + BalLog(level, "error from hostfxr: %ls", wzMessage); +} + +static HRESULT InitializeHostfxr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzManagedHostPath, + __in LPCWSTR wzDepsJsonPath, + __in LPCWSTR wzRuntimeConfigPath + ) +{ + HRESULT hr = S_OK; + + pState->pfnHostfxrSetErrorWriter(static_cast(&DnchostErrorWriter)); + + LPCWSTR argv[] = { + L"exec", + L"--depsfile", + wzDepsJsonPath, + L"--runtimeconfig", + wzRuntimeConfigPath, + wzManagedHostPath, + }; + hr = pState->pfnHostfxrInitializeForApp(sizeof(argv)/sizeof(LPWSTR), argv, NULL, &pState->hostContextHandle); + BalExitOnFailure(hr, "HostfxrInitializeForApp failed"); + +LExit: + return hr; +} + +static HRESULT InitializeCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ) +{ + HRESULT hr = S_OK; + + hr = pState->pfnHostfxrGetRuntimeDelegate(pState->hostContextHandle, hdt_get_function_pointer, reinterpret_cast(&pState->pfnGetFunctionPointer)); + if (InvalidArgFailure == hr || // old versions of hostfxr don't allow calling GetRuntimeDelegate from InitializeForApp. + HostApiUnsupportedVersion == hr) // hdt_get_function_pointer was added in .NET 5. + { + hr = InitializeCoreClrPre5(pState, wzNativeHostPath); + } + else + { + ExitOnFailure(hr, "HostfxrGetRuntimeDelegate failed"); + } + +LExit: + return hr; +} + +static HRESULT InitializeCoreClrPre5( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath + ) +{ + HRESULT hr = S_OK; + int32_t rc = 0; + LPCWSTR* rgPropertyKeys = NULL; + LPCWSTR* rgPropertyValues = NULL; + size_t cProperties = 0; + LPWSTR* rgDirectories = NULL; + UINT cDirectories = 0; + LPWSTR sczCoreClrPath = NULL; + + // We are not using hostfxr as it was intended to be used. We need to initialize hostfxr so that it properly initializes hostpolicy - + // there are pieces of the framework such as AssemblyDependencyResolver that won't work without that. We also need hostfxr to find a + // compatible framework for framework-dependent deployed BAs. We had to use hostfxr_initialize_for_dotnet_command_line since + // hostfxr_initialize_for_runtime_config doesn't currently (3.x) support self-contained deployed BAs. That means we're supposed to + // start the runtime through hostfxr_run_app, but that method shuts down the runtime before returning. We actually want to call + // hostfxr_get_runtime_delegate, but that method currently requires hostfxr to be initialized through + // hostfxr_initialize_for_runtime_config. So we're forced to locate coreclr.dll and manually load the runtime ourselves. + + // Unfortunately, that's not the only problem. hostfxr has global state that tracks whether it started the runtime. While we keep our + // hostfxr_handle open, everyone that calls the hostfxr_initialize_* methods will block until we have started the runtime through + // hostfxr or closed our handle. If we close the handle, then hostfxr could potentially try to load a second runtime into the + // process, which is not supported. We're going to just keep our handle open since no one else in the process should be trying to + // start the runtime anyway. + + rc = pState->pfnHostfxrGetRuntimeProperties(pState->hostContextHandle, &cProperties, rgPropertyKeys, rgPropertyValues); + if (HostApiBufferTooSmall != rc) + { + BalExitOnFailure(hr = rc, "HostfxrGetRuntimeProperties failed to return required size."); + } + + rgPropertyKeys = static_cast(MemAlloc(sizeof(LPWSTR) * cProperties, TRUE)); + rgPropertyValues = static_cast(MemAlloc(sizeof(LPWSTR) * cProperties, TRUE)); + if (!rgPropertyKeys || !rgPropertyValues) + { + BalExitOnFailure(hr = E_OUTOFMEMORY, "Failed to allocate buffers for runtime properties."); + } + + hr = pState->pfnHostfxrGetRuntimeProperties(pState->hostContextHandle, &cProperties, rgPropertyKeys, rgPropertyValues); + BalExitOnFailure(hr, "HostfxrGetRuntimeProperties failed."); + + for (DWORD i = 0; i < cProperties; ++i) + { + if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, 0, rgPropertyKeys[i], -1, L"NATIVE_DLL_SEARCH_DIRECTORIES", -1)) + { + hr = StrSplitAllocArray(&rgDirectories, &cDirectories, rgPropertyValues[i], L";"); + BalExitOnFailure(hr, "Failed to split NATIVE_DLL_SEARCH_DIRECTORIES '%ls'", rgPropertyValues[i]); + } + } + + for (DWORD i = 0; i < cDirectories; ++i) + { + hr = PathConcat(rgDirectories[i], L"coreclr.dll", &sczCoreClrPath); + BalExitOnFailure(hr, "Failed to allocate path to coreclr."); + + if (::PathFileExists(sczCoreClrPath)) + { + break; + } + else + { + ReleaseNullStr(sczCoreClrPath); + } + } + + if (!sczCoreClrPath) + { + for (DWORD i = 0; i < cProperties; ++i) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "%ls: %ls", rgPropertyKeys[i], rgPropertyValues[i]); + } + BalExitOnFailure(hr = E_FILENOTFOUND, "Failed to locate coreclr.dll."); + } + + hr = LoadCoreClr(pState, sczCoreClrPath); + BalExitOnFailure(hr, "Failed to load coreclr."); + + hr = StartCoreClr(pState, wzNativeHostPath, (DWORD)cProperties, rgPropertyKeys, rgPropertyValues); + BalExitOnFailure(hr, "Failed to start coreclr."); + +LExit: + MemFree(rgDirectories); + MemFree(rgPropertyValues); + MemFree(rgPropertyKeys); + ReleaseStr(sczCoreClrPath); + + return hr; +} + +static HRESULT LoadCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzCoreClrPath + ) +{ + HRESULT hr = S_OK; + HMODULE hModule = NULL; + + hModule = ::LoadLibraryExW(wzCoreClrPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + BalExitOnNullWithLastError(hModule, hr, "Failed to load coreclr.dll from '%ls'.", wzCoreClrPath); + + pState->pfnCoreclrInitialize = reinterpret_cast(::GetProcAddress(hModule, "coreclr_initialize")); + BalExitOnNullWithLastError(pState->pfnCoreclrInitialize, hr, "Failed to get procedure address for coreclr_initialize."); + + pState->pfnCoreclrCreateDelegate = reinterpret_cast(::GetProcAddress(hModule, "coreclr_create_delegate")); + BalExitOnNullWithLastError(pState->pfnCoreclrCreateDelegate, hr, "Failed to get procedure address for coreclr_create_delegate."); + +LExit: + // Never unload the module since coreclr doesn't support it. + + return hr; +} + +static HRESULT StartCoreClr( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath, + __in DWORD cProperties, + __in LPCWSTR* propertyKeys, + __in LPCWSTR* propertyValues + ) +{ + HRESULT hr = S_OK; + LPSTR szNativeHostPath = NULL; + LPSTR* rgPropertyKeys = NULL; + LPSTR* rgPropertyValues = NULL; + + rgPropertyKeys = static_cast(MemAlloc(sizeof(LPSTR) * cProperties, TRUE)); + rgPropertyValues = static_cast(MemAlloc(sizeof(LPSTR) * cProperties, TRUE)); + if (!rgPropertyKeys || !rgPropertyValues) + { + BalExitOnFailure(hr = E_OUTOFMEMORY, "Failed to allocate buffers for runtime properties."); + } + + hr = StrAnsiAllocString(&szNativeHostPath, wzNativeHostPath, 0, CP_UTF8); + BalExitOnFailure(hr, "Failed to convert module path to UTF8: %ls", wzNativeHostPath); + + for (DWORD i = 0; i < cProperties; ++i) + { + hr = StrAnsiAllocString(&rgPropertyKeys[i], propertyKeys[i], 0, CP_UTF8); + BalExitOnFailure(hr, "Failed to convert property key to UTF8: %ls", propertyKeys[i]); + + hr = StrAnsiAllocString(&rgPropertyValues[i], propertyValues[i], 0, CP_UTF8); + BalExitOnFailure(hr, "Failed to convert property value to UTF8: %ls", propertyValues[i]); + } + + hr = pState->pfnCoreclrInitialize(szNativeHostPath, "MBA", cProperties, (LPCSTR*)rgPropertyKeys, (LPCSTR*)rgPropertyValues, &pState->pClrHandle, &pState->dwDomainId); + BalExitOnFailure(hr, "CoreclrInitialize failed."); + +LExit: + for (DWORD i = 0; i < cProperties; ++i) + { + if (rgPropertyKeys) + { + ReleaseStr(rgPropertyKeys[i]); + } + + if (rgPropertyValues) + { + ReleaseStr(rgPropertyValues[i]); + } + } + ReleaseMem(rgPropertyValues); + ReleaseMem(rgPropertyKeys); + ReleaseStr(szNativeHostPath); + + return hr; +} diff --git a/src/ext/Bal/dnchost/dncutil.h b/src/ext/Bal/dnchost/dncutil.h new file mode 100644 index 00000000..85eda3b2 --- /dev/null +++ b/src/ext/Bal/dnchost/dncutil.h @@ -0,0 +1,38 @@ +#pragma once +// 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. + +typedef IBootstrapperApplicationFactory* (STDMETHODCALLTYPE* PFNCREATEBAFACTORY)( + __in LPCWSTR wzBaFactoryAssemblyName, + __in LPCWSTR wzBaFactoryAssemblyPath + ); + +struct HOSTFXR_STATE +{ + LPWSTR sczHostfxrPath; + hostfxr_handle hostContextHandle; + hostfxr_initialize_for_dotnet_command_line_fn pfnHostfxrInitializeForApp; + hostfxr_get_runtime_properties_fn pfnHostfxrGetRuntimeProperties; + hostfxr_set_error_writer_fn pfnHostfxrSetErrorWriter; + hostfxr_close_fn pfnHostfxrClose; + hostfxr_get_runtime_delegate_fn pfnHostfxrGetRuntimeDelegate; + get_function_pointer_fn pfnGetFunctionPointer; + coreclr_initialize_ptr pfnCoreclrInitialize; + coreclr_create_delegate_ptr pfnCoreclrCreateDelegate; + void* pClrHandle; + UINT dwDomainId; +}; + +HRESULT DnchostLoadRuntime( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzNativeHostPath, + __in LPCWSTR wzManagedHostPath, + __in LPCWSTR wzDepsJsonPath, + __in LPCWSTR wzRuntimeConfigPath + ); + +HRESULT DnchostCreateFactory( + __in HOSTFXR_STATE* pState, + __in LPCWSTR wzBaFactoryAssemblyName, + __in LPCWSTR wzBaFactoryAssemblyPath, + __out IBootstrapperApplicationFactory** ppAppFactory + ); diff --git a/src/ext/Bal/dnchost/packages.config b/src/ext/Bal/dnchost/packages.config new file mode 100644 index 00000000..6c369364 --- /dev/null +++ b/src/ext/Bal/dnchost/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/dnchost/precomp.cpp b/src/ext/Bal/dnchost/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/dnchost/precomp.cpp @@ -0,0 +1,3 @@ +// 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. + +#include "precomp.h" diff --git a/src/ext/Bal/dnchost/precomp.h b/src/ext/Bal/dnchost/precomp.h new file mode 100644 index 00000000..84ff6424 --- /dev/null +++ b/src/ext/Bal/dnchost/precomp.h @@ -0,0 +1,31 @@ +#pragma once +// 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. + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#define NETHOST_USE_AS_STATIC +#include +#include +#include + +#include "coreclrhost.h" +#include "dncutil.h" +#include "dnchost.h" diff --git a/src/ext/Bal/mbahost/mbahost.cpp b/src/ext/Bal/mbahost/mbahost.cpp new file mode 100644 index 00000000..735f9f21 --- /dev/null +++ b/src/ext/Bal/mbahost/mbahost.cpp @@ -0,0 +1,649 @@ +// 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. + +#include "precomp.h" +#include // includes the generated assembly name macros. + +static const DWORD NET452_RELEASE = 379893; + +using namespace mscorlib; + +extern "C" typedef HRESULT (WINAPI *PFN_CORBINDTOCURRENTRUNTIME)( + __in LPCWSTR pwszFileName, + __in REFCLSID rclsid, + __in REFIID riid, + __out LPVOID *ppv + ); + +extern "C" typedef HRESULT(WINAPI *PFN_MBAPREQ_BOOTSTRAPPER_APPLICATION_CREATE)( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); + +static HINSTANCE vhInstance = NULL; +static ICorRuntimeHost *vpCLRHost = NULL; +static _AppDomain *vpAppDomain = NULL; +static HMODULE vhMbapreqModule = NULL; + + +// internal function declarations + +static HRESULT GetAppDomain( + __out _AppDomain** ppAppDomain + ); +static HRESULT GetAppBase( + __out LPWSTR* psczAppBase + ); +static HRESULT CheckSupportedFrameworks( + __in LPCWSTR wzConfigPath + ); +static HRESULT UpdateSupportedRuntime( + __in IXMLDOMDocument* pixdManifest, + __in IXMLDOMNode* pixnSupportedFramework, + __out BOOL* pfUpdatedManifest + ); +static HRESULT GetCLRHost( + __in LPCWSTR wzConfigPath, + __out ICorRuntimeHost** ppCLRHost + ); +static HRESULT CreateManagedBootstrapperApplication( + __in _AppDomain* pAppDomain, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); +static HRESULT CreateManagedBootstrapperApplicationFactory( + __in _AppDomain* pAppDomain, + __out IBootstrapperApplicationFactory** ppAppFactory + ); +static HRESULT CreatePrerequisiteBA( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); +static HRESULT VerifyNET4RuntimeIsSupported( + ); + + +// function definitions + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vhInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vhInstance = NULL; + break; + } + + return TRUE; +} + +// Note: This function assumes that COM was already initialized on the thread. +extern "C" HRESULT WINAPI BootstrapperApplicationCreate( + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + HRESULT hrHostInitialization = S_OK; + IBootstrapperEngine* pEngine = NULL; + + hr = BalInitializeFromCreateArgs(pArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + hr = GetAppDomain(&vpAppDomain); + if (SUCCEEDED(hr)) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading managed bootstrapper application."); + + hr = CreateManagedBootstrapperApplication(vpAppDomain, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create the managed bootstrapper application."); + } + else // fallback to the prerequisite BA. + { + if (E_MBAHOST_NET452_ON_WIN7RTM == hr) + { + BalLogError(hr, "The Burn engine cannot run with an MBA under the .NET 4 CLR on Windows 7 RTM with .NET 4.5.2 (or greater) installed."); + hrHostInitialization = hr; + } + else + { + hrHostInitialization = S_OK; + } + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because managed host could not be loaded, error: 0x%08x.", hr); + + hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); + } + +LExit: + ReleaseNullObject(pEngine); + + return hr; +} + +extern "C" void WINAPI BootstrapperApplicationDestroy() +{ + if (vpAppDomain) + { + HRESULT hr = vpCLRHost->UnloadDomain(vpAppDomain); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to unload app domain."); + } + + vpAppDomain->Release(); + } + + if (vpCLRHost) + { + vpCLRHost->Stop(); + vpCLRHost->Release(); + } + + if (vhMbapreqModule) + { + PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = reinterpret_cast(::GetProcAddress(vhMbapreqModule, "MbaPrereqBootstrapperApplicationDestroy")); + if (pfnDestroy) + { + (*pfnDestroy)(); + } + + ::FreeLibrary(vhMbapreqModule); + vhMbapreqModule = NULL; + } + + BalUninitialize(); +} + +// Gets the custom AppDomain for loading managed BA. +static HRESULT GetAppDomain( + __out _AppDomain **ppAppDomain + ) +{ + HRESULT hr = S_OK; + ICorRuntimeHost *pCLRHost = NULL; + IUnknown *pUnk = NULL; + LPWSTR sczAppBase = NULL; + LPWSTR sczConfigPath = NULL; + IAppDomainSetup *pAppDomainSetup; + BSTR bstrAppBase = NULL; + BSTR bstrConfigPath = NULL; + + hr = GetAppBase(&sczAppBase); + ExitOnFailure(hr, "Failed to get the host base path."); + + hr = PathConcat(sczAppBase, MBA_CONFIG_FILE_NAME, &sczConfigPath); + ExitOnFailure(hr, "Failed to get the full path to the application configuration file."); + + // Check that the supported framework is installed. + hr = CheckSupportedFrameworks(sczConfigPath); + ExitOnFailure(hr, "Failed to find supported framework."); + + // Load the CLR. + hr = GetCLRHost(sczConfigPath, &pCLRHost); + ExitOnFailure(hr, "Failed to create the CLR host."); + + hr = pCLRHost->Start(); + ExitOnRootFailure(hr, "Failed to start the CLR host."); + + // Create the setup information for a new AppDomain to set the app base and config. + hr = pCLRHost->CreateDomainSetup(&pUnk); + ExitOnRootFailure(hr, "Failed to create the AppDomainSetup object."); + + hr = pUnk->QueryInterface(__uuidof(IAppDomainSetup), reinterpret_cast(&pAppDomainSetup)); + ExitOnRootFailure(hr, "Failed to query for the IAppDomainSetup interface."); + ReleaseNullObject(pUnk); + + // Set properties on the AppDomainSetup object. + bstrAppBase = ::SysAllocString(sczAppBase); + ExitOnNull(bstrAppBase, hr, E_OUTOFMEMORY, "Failed to allocate the application base path for the AppDomainSetup."); + + hr = pAppDomainSetup->put_ApplicationBase(bstrAppBase); + ExitOnRootFailure(hr, "Failed to set the application base path for the AppDomainSetup."); + + bstrConfigPath = ::SysAllocString(sczConfigPath); + ExitOnNull(bstrConfigPath, hr, E_OUTOFMEMORY, "Failed to allocate the application configuration file for the AppDomainSetup."); + + hr = pAppDomainSetup->put_ConfigurationFile(bstrConfigPath); + ExitOnRootFailure(hr, "Failed to set the configuration file path for the AppDomainSetup."); + + // Create the AppDomain to load the factory type. + hr = pCLRHost->CreateDomainEx(L"MBA", pAppDomainSetup, NULL, &pUnk); + ExitOnRootFailure(hr, "Failed to create the MBA AppDomain."); + + hr = pUnk->QueryInterface(__uuidof(_AppDomain), reinterpret_cast(ppAppDomain)); + ExitOnRootFailure(hr, "Failed to query for the _AppDomain interface."); + +LExit: + ReleaseBSTR(bstrConfigPath); + ReleaseBSTR(bstrAppBase); + ReleaseStr(sczConfigPath); + ReleaseStr(sczAppBase); + ReleaseNullObject(pUnk); + ReleaseNullObject(pCLRHost); + + return hr; +} + +static HRESULT GetAppBase( + __out LPWSTR *psczAppBase + ) +{ + HRESULT hr = S_OK; + LPWSTR sczFullPath = NULL; + + hr = PathForCurrentProcess(&sczFullPath, vhInstance); + ExitOnFailure(hr, "Failed to get the full host path."); + + hr = PathGetDirectory(sczFullPath, psczAppBase); + ExitOnFailure(hr, "Failed to get the directory of the full process path."); + +LExit: + ReleaseStr(sczFullPath); + + return hr; +} + +// Checks whether at least one of required supported frameworks is installed via the NETFX registry keys. +static HRESULT CheckSupportedFrameworks( + __in LPCWSTR wzConfigPath + ) +{ + HRESULT hr = S_OK; + IXMLDOMDocument* pixdManifest = NULL; + IXMLDOMNodeList* pNodeList = NULL; + IXMLDOMNode* pNode = NULL; + DWORD cSupportedFrameworks = 0; + LPWSTR sczSupportedFrameworkVersion = NULL; + LPWSTR sczFrameworkRegistryKey = NULL; + HKEY hkFramework = NULL; + DWORD dwFrameworkInstalled = 0; + BOOL fUpdatedManifest = FALSE; + + hr = XmlInitialize(); + ExitOnFailure(hr, "Failed to initialize XML."); + + hr = XmlLoadDocumentFromFile(wzConfigPath, &pixdManifest); + ExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", wzConfigPath); + + hr = XmlSelectNodes(pixdManifest, L"/configuration/wix.bootstrapper/host/supportedFramework", &pNodeList); + ExitOnFailure(hr, "Failed to select all supportedFramework elements."); + + hr = pNodeList->get_length(reinterpret_cast(&cSupportedFrameworks)); + ExitOnFailure(hr, "Failed to get the supported framework count."); + + if (cSupportedFrameworks) + { + while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) + { + hr = XmlGetAttributeEx(pNode, L"version", &sczSupportedFrameworkVersion); + ExitOnFailure(hr, "Failed to get supportedFramework/@version."); + + hr = StrAllocFormatted(&sczFrameworkRegistryKey, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\%ls", sczSupportedFrameworkVersion); + ExitOnFailure(hr, "Failed to allocate path to supported framework Install registry key."); + + hr = RegOpen(HKEY_LOCAL_MACHINE, sczFrameworkRegistryKey, KEY_READ, &hkFramework); + if (SUCCEEDED(hr)) + { + hr = RegReadNumber(hkFramework, L"Install", &dwFrameworkInstalled); + if (dwFrameworkInstalled) + { + hr = S_OK; + break; + } + } + + ReleaseNullObject(pNode); + } + + // If we looped through all the supported frameworks but didn't find anything, ensure we return a failure. + if (S_FALSE == hr) + { + hr = E_NOTFOUND; + ExitOnRootFailure(hr, "Failed to find a supported framework."); + } + + hr = UpdateSupportedRuntime(pixdManifest, pNode, &fUpdatedManifest); + ExitOnFailure(hr, "Failed to update supportedRuntime."); + } + // else no supported frameworks specified, so the startup/supportedRuntime must be enough. + + if (fUpdatedManifest) + { + hr = XmlSaveDocument(pixdManifest, wzConfigPath); + ExitOnFailure(hr, "Failed to save updated manifest over config file: %ls", wzConfigPath); + } + +LExit: + ReleaseRegKey(hkFramework); + ReleaseStr(sczFrameworkRegistryKey); + ReleaseStr(sczSupportedFrameworkVersion); + ReleaseObject(pNode); + ReleaseObject(pNodeList); + ReleaseObject(pixdManifest); + + XmlUninitialize(); + + return hr; +} + +// Fixes the supportedRuntime element if necessary. +static HRESULT UpdateSupportedRuntime( + __in IXMLDOMDocument* pixdManifest, + __in IXMLDOMNode* pixnSupportedFramework, + __out BOOL* pfUpdatedManifest + ) +{ + HRESULT hr = S_OK; + LPWSTR sczSupportedRuntimeVersion = NULL; + IXMLDOMNode* pixnStartup = NULL; + IXMLDOMNode* pixnSupportedRuntime = NULL; + + *pfUpdatedManifest = FALSE; + + // If the runtime version attribute is not specified, don't update the manifest. + hr = XmlGetAttributeEx(pixnSupportedFramework, L"runtimeVersion", &sczSupportedRuntimeVersion); + if (E_NOTFOUND == hr) + { + ExitFunction1(hr = S_OK); + } + ExitOnFailure(hr, "Failed to get supportedFramework/@runtimeVersion."); + + // Get the startup element. Fail if we can't find it since it'll be necessary to load the + // correct runtime. + hr = XmlSelectSingleNode(pixdManifest, L"/configuration/startup", &pixnStartup); + ExitOnFailure(hr, "Failed to get startup element."); + + if (S_FALSE == hr) + { + hr = E_NOTFOUND; + ExitOnRootFailure(hr, "Failed to find startup element in bootstrapper application config."); + } + + // Remove any pre-existing supported runtimes because they'll just get in the way and create our new one. + hr = XmlRemoveChildren(pixnStartup, L"supportedRuntime"); + ExitOnFailure(hr, "Failed to remove pre-existing supportedRuntime elements."); + + hr = XmlCreateChild(pixnStartup, L"supportedRuntime", &pixnSupportedRuntime); + ExitOnFailure(hr, "Failed to create supportedRuntime element."); + + hr = XmlSetAttribute(pixnSupportedRuntime, L"version", sczSupportedRuntimeVersion); + ExitOnFailure(hr, "Failed to set supportedRuntime/@version to '%ls'.", sczSupportedRuntimeVersion); + + *pfUpdatedManifest = TRUE; + +LExit: + ReleaseObject(pixnSupportedRuntime); + ReleaseObject(pixnStartup); + ReleaseStr(sczSupportedRuntimeVersion); + + return hr; +} + +// Gets the CLR host and caches it. +static HRESULT GetCLRHost( + __in LPCWSTR wzConfigPath, + __out ICorRuntimeHost **ppCLRHost + ) +{ + HRESULT hr = S_OK; + UINT uiMode = 0; + HMODULE hModule = NULL; + BOOL fFallbackToCorBindToCurrentRuntime = TRUE; + CLRCreateInstanceFnPtr pfnCLRCreateInstance = NULL; + ICLRMetaHostPolicy* pCLRMetaHostPolicy = NULL; + IStream* pCfgStream = NULL; + LPWSTR pwzVersion = NULL; + DWORD cchVersion = 0; + DWORD dwConfigFlags = 0; + ICLRRuntimeInfo* pCLRRuntimeInfo = NULL; + PFN_CORBINDTOCURRENTRUNTIME pfnCorBindToCurrentRuntime = NULL; + + // Always set the error mode because we will always restore it below. + uiMode = ::SetErrorMode(0); + + // Cache the CLR host to be shutdown later. This can occur on a different thread. + if (!vpCLRHost) + { + // Disable message boxes from being displayed on error and blocking execution. + ::SetErrorMode(uiMode | SEM_FAILCRITICALERRORS); + + hr = LoadSystemLibrary(L"mscoree.dll", &hModule); + ExitOnFailure(hr, "Failed to load mscoree.dll"); + + pfnCLRCreateInstance = reinterpret_cast(::GetProcAddress(hModule, "CLRCreateInstance")); + + if (pfnCLRCreateInstance) + { + hr = pfnCLRCreateInstance(CLSID_CLRMetaHostPolicy, IID_ICLRMetaHostPolicy, reinterpret_cast(&pCLRMetaHostPolicy)); + if (E_NOTIMPL != hr) + { + ExitOnRootFailure(hr, "Failed to create instance of ICLRMetaHostPolicy."); + + fFallbackToCorBindToCurrentRuntime = FALSE; + } + } + + if (fFallbackToCorBindToCurrentRuntime) + { + pfnCorBindToCurrentRuntime = reinterpret_cast(::GetProcAddress(hModule, "CorBindToCurrentRuntime")); + ExitOnNullWithLastError(pfnCorBindToCurrentRuntime, hr, "Failed to get procedure address for CorBindToCurrentRuntime."); + + hr = pfnCorBindToCurrentRuntime(wzConfigPath, CLSID_CorRuntimeHost, IID_ICorRuntimeHost, reinterpret_cast(&vpCLRHost)); + ExitOnRootFailure(hr, "Failed to create the CLR host using the application configuration file path."); + } + else + { + + hr = SHCreateStreamOnFileEx(wzConfigPath, STGM_READ | STGM_SHARE_DENY_WRITE, 0, FALSE, NULL, &pCfgStream); + ExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", wzConfigPath); + + hr = pCLRMetaHostPolicy->GetRequestedRuntime(METAHOST_POLICY_HIGHCOMPAT, NULL, pCfgStream, NULL, &cchVersion, NULL, NULL, &dwConfigFlags, IID_ICLRRuntimeInfo, reinterpret_cast(&pCLRRuntimeInfo)); + ExitOnRootFailure(hr, "Failed to get the CLR runtime info using the application configuration file path."); + + // .NET 4 RTM had a bug where it wouldn't set pcchVersion if pwzVersion was NULL. + if (!cchVersion) + { + hr = pCLRRuntimeInfo->GetVersionString(NULL, &cchVersion); + if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) != hr) + { + ExitOnFailure(hr, "Failed to get the length of the CLR version string."); + } + } + + hr = StrAlloc(&pwzVersion, cchVersion); + ExitOnFailure(hr, "Failed to allocate the CLR version string."); + + hr = pCLRRuntimeInfo->GetVersionString(pwzVersion, &cchVersion); + ExitOnFailure(hr, "Failed to get the CLR version string."); + + if (CSTR_EQUAL == CompareString(LOCALE_NEUTRAL, 0, L"v4.0.30319", -1, pwzVersion, cchVersion)) + { + hr = VerifyNET4RuntimeIsSupported(); + ExitOnFailure(hr, "Found unsupported .NET 4 Runtime."); + } + + if (METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_TRUE == (METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_MASK & dwConfigFlags)) + { + hr = pCLRRuntimeInfo->BindAsLegacyV2Runtime(); + ExitOnRootFailure(hr, "Failed to bind as legacy V2 runtime."); + } + + hr = pCLRRuntimeInfo->GetInterface(CLSID_CorRuntimeHost, IID_ICorRuntimeHost, reinterpret_cast(&vpCLRHost)); + ExitOnRootFailure(hr, "Failed to get instance of ICorRuntimeHost."); + + // TODO: use ICLRRuntimeHost instead of ICorRuntimeHost on .NET 4 since the former is faster and the latter is deprecated + //hr = pCLRRuntimeInfo->GetInterface(CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, reinterpret_cast(&pCLRRuntimeHost)); + //ExitOnRootFailure(hr, "Failed to get instance of ICLRRuntimeHost."); + } + } + + vpCLRHost->AddRef(); + *ppCLRHost = vpCLRHost; + +LExit: + ReleaseStr(pwzVersion); + ReleaseNullObject(pCLRRuntimeInfo); + ReleaseNullObject(pCfgStream); + ReleaseNullObject(pCLRMetaHostPolicy); + + // Unload the module so it's not in use when we install .NET. + if (FAILED(hr)) + { + ::FreeLibrary(hModule); + } + + ::SetErrorMode(uiMode); // restore the previous error mode. + + return hr; +} + +// Creates the bootstrapper app and returns it for the engine. +static HRESULT CreateManagedBootstrapperApplication( + __in _AppDomain* pAppDomain, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + IBootstrapperApplicationFactory* pAppFactory = NULL; + + hr = CreateManagedBootstrapperApplicationFactory(pAppDomain, &pAppFactory); + ExitOnFailure(hr, "Failed to create the factory to create the bootstrapper application."); + + hr = pAppFactory->Create(pArgs, pResults); + ExitOnFailure(hr, "Failed to create the bootstrapper application."); + +LExit: + ReleaseNullObject(pAppFactory); + + return hr; +} + +// Creates the app factory to create the managed app in the default AppDomain. +static HRESULT CreateManagedBootstrapperApplicationFactory( + __in _AppDomain* pAppDomain, + __out IBootstrapperApplicationFactory** ppAppFactory + ) +{ + HRESULT hr = S_OK; + BSTR bstrAssemblyName = NULL; + BSTR bstrTypeName = NULL; + _ObjectHandle* pObj = NULL; + VARIANT vtBAFactory; + + ::VariantInit(&vtBAFactory); + + bstrAssemblyName = ::SysAllocString(MBA_ASSEMBLY_FULL_NAME); + ExitOnNull(bstrAssemblyName, hr, E_OUTOFMEMORY, "Failed to allocate the full assembly name for the bootstrapper application factory."); + + bstrTypeName = ::SysAllocString(MBA_ENTRY_TYPE); + ExitOnNull(bstrTypeName, hr, E_OUTOFMEMORY, "Failed to allocate the full type name for the BA factory."); + + hr = pAppDomain->CreateInstance(bstrAssemblyName, bstrTypeName, &pObj); + ExitOnRootFailure(hr, "Failed to create the BA factory object."); + + hr = pObj->Unwrap(&vtBAFactory); + ExitOnRootFailure(hr, "Failed to unwrap the BA factory object into the host domain."); + ExitOnNull(vtBAFactory.punkVal, hr, E_UNEXPECTED, "The variant did not contain the expected IUnknown pointer."); + + hr = vtBAFactory.punkVal->QueryInterface(__uuidof(IBootstrapperApplicationFactory), reinterpret_cast(ppAppFactory)); + ExitOnRootFailure(hr, "Failed to query for the bootstrapper app factory interface."); + +LExit: + ReleaseVariant(vtBAFactory); + ReleaseNullObject(pObj); + ReleaseBSTR(bstrTypeName); + ReleaseBSTR(bstrAssemblyName); + + return hr; +} + +static HRESULT CreatePrerequisiteBA( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + LPWSTR sczMbapreqPath = NULL; + HMODULE hModule = NULL; + + hr = PathRelativeToModule(&sczMbapreqPath, L"mbapreq.dll", vhInstance); + ExitOnFailure(hr, "Failed to get path to pre-requisite BA."); + + hModule = ::LoadLibraryW(sczMbapreqPath); + ExitOnNullWithLastError(hModule, hr, "Failed to load pre-requisite BA DLL."); + + PFN_MBAPREQ_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = reinterpret_cast(::GetProcAddress(hModule, "MbaPrereqBootstrapperApplicationCreate")); + ExitOnNullWithLastError(pfnCreate, hr, "Failed to get MbaPrereqBootstrapperApplicationCreate entry-point from: %ls", sczMbapreqPath); + + hr = pfnCreate(hrHostInitialization, pEngine, pArgs, pResults); + ExitOnFailure(hr, "Failed to create prequisite bootstrapper app."); + + vhMbapreqModule = hModule; + hModule = NULL; + +LExit: + if (hModule) + { + ::FreeLibrary(hModule); + } + ReleaseStr(sczMbapreqPath); + + return hr; +} + +static HRESULT VerifyNET4RuntimeIsSupported( + ) +{ + HRESULT hr = S_OK; + OS_VERSION osv = OS_VERSION_UNKNOWN; + DWORD dwServicePack = 0; + HKEY hKey = NULL; + DWORD er = ERROR_SUCCESS; + DWORD dwRelease = 0; + DWORD cchRelease = sizeof(dwRelease); + + OsGetVersion(&osv, &dwServicePack); + if (OS_VERSION_WIN7 == osv && 0 == dwServicePack) + { + hr = RegOpen(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full", KEY_QUERY_VALUE, &hKey); + if (E_FILENOTFOUND == hr) + { + ExitFunction1(hr = S_OK); + } + ExitOnFailure(hr, "Failed to open registry key for .NET 4."); + + er = ::RegQueryValueExW(hKey, L"Release", NULL, NULL, reinterpret_cast(&dwRelease), &cchRelease); + if (ERROR_FILE_NOT_FOUND == er) + { + ExitFunction1(hr = S_OK); + } + ExitOnWin32Error(er, hr, "Failed to get Release value."); + + if (NET452_RELEASE <= dwRelease) + { + hr = E_MBAHOST_NET452_ON_WIN7RTM; + } + } + +LExit: + ReleaseRegKey(hKey); + + return hr; +} diff --git a/src/ext/Bal/mbahost/mbahost.def b/src/ext/Bal/mbahost/mbahost.def new file mode 100644 index 00000000..4488df94 --- /dev/null +++ b/src/ext/Bal/mbahost/mbahost.def @@ -0,0 +1,6 @@ +; 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. + + +EXPORTS + BootstrapperApplicationCreate + BootstrapperApplicationDestroy diff --git a/src/ext/Bal/mbahost/mbahost.vcxproj b/src/ext/Bal/mbahost/mbahost.vcxproj new file mode 100644 index 00000000..6457b4e0 --- /dev/null +++ b/src/ext/Bal/mbahost/mbahost.vcxproj @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {12C87C77-3547-44F8-8134-29BC915CB19D} + DynamicLibrary + v142 + Unicode + mbahost + mbahost.def + + + + + + + shlwapi.lib + + + + + + Create + + + + + + + + + + + + + + + + $(BaseOutputPath)obj;%(AdditionalIncludeDirectories) + + + + + + {f2ba1935-70fa-4156-b161-fd03850b4faa} + false + true + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/mbahost/packages.config b/src/ext/Bal/mbahost/packages.config new file mode 100644 index 00000000..071284ac --- /dev/null +++ b/src/ext/Bal/mbahost/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/mbahost/precomp.cpp b/src/ext/Bal/mbahost/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/mbahost/precomp.cpp @@ -0,0 +1,3 @@ +// 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. + +#include "precomp.h" diff --git a/src/ext/Bal/mbahost/precomp.h b/src/ext/Bal/mbahost/precomp.h new file mode 100644 index 00000000..d29a23f3 --- /dev/null +++ b/src/ext/Bal/mbahost/precomp.h @@ -0,0 +1,25 @@ +#pragma once +// 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. + + +#include +#include +#include +#include + +#import raw_interfaces_only rename("ReportEvent", "mscorlib_ReportEvent") + +#include +#include +#include +#include +#include +#include + +#include "BootstrapperEngine.h" +#include "BootstrapperApplication.h" +#include "IBootstrapperEngine.h" +#include "IBootstrapperApplication.h" +#include "IBootstrapperApplicationFactory.h" + +#include "balutil.h" diff --git a/src/ext/Bal/nuget.config b/src/ext/Bal/nuget.config new file mode 100644 index 00000000..f3277bc4 --- /dev/null +++ b/src/ext/Bal/nuget.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs new file mode 100644 index 00000000..2ff57c55 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs @@ -0,0 +1,133 @@ +// 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. + +namespace WixToolsetTest.Bal +{ + using System.IO; + using System.Linq; + using System.Xml; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class BalExtensionFixture + { + [Fact] + public void CanBuildUsingDisplayInternalUICondition() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); + var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var compileResult = WixRunner.Execute(new[] + { + "build", + Path.Combine(bundleSourceFolder, "DisplayInternalUIConditionBundle.wxs"), + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), + "-intermediateFolder", intermediateFolder, + "-bindpath", Path.Combine(bundleSourceFolder, "data"), + "-o", bundleFile, + }); + compileResult.AssertSuccess(); + + Assert.True(File.Exists(bundleFile)); + + var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var balPackageInfos = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); + var balPackageInfo = (XmlNode)Assert.Single(balPackageInfos); + Assert.Equal("", balPackageInfo.GetTestXml()); + + Assert.True(File.Exists(Path.Combine(baFolderPath, "thm.wxl"))); + } + } + + [Fact] + public void CanBuildUsingOverridable() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); + var bundleSourceFolder = TestData.Get(@"TestData\Overridable"); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var compileResult = WixRunner.Execute(new[] + { + "build", + Path.Combine(bundleSourceFolder, "Bundle.wxs"), + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), + "-intermediateFolder", intermediateFolder, + "-o", bundleFile, + }); + compileResult.AssertSuccess(); + + Assert.True(File.Exists(bundleFile)); + + var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var balOverridableVariables = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixStdbaOverridableVariable"); + var balOverridableVariable = (XmlNode)Assert.Single(balOverridableVariables); + Assert.Equal("", balOverridableVariable.GetTestXml()); + } + } + + [Fact] + public void CanBuildUsingWixStdBa() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); + var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var compileResult = WixRunner.Execute(new[] + { + "build", + Path.Combine(bundleSourceFolder, "Bundle.wxs"), + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), + "-intermediateFolder", intermediateFolder, + "-o", bundleFile, + }); + compileResult.AssertSuccess(); + + Assert.True(File.Exists(bundleFile)); + } + } + + [Fact] + public void CantBuildUsingMBAWithNoPrereqs() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); + var bundleSourceFolder = TestData.Get(@"TestData\MBA"); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var compileResult = WixRunner.Execute(new[] + { + "build", + Path.Combine(bundleSourceFolder, "Bundle.wxs"), + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), + "-intermediateFolder", intermediateFolder, + "-o", bundleFile, + }); + Assert.Equal(6802, compileResult.ExitCode); + Assert.Equal("There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString()); + + Assert.False(File.Exists(bundleFile)); + Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); + } + } + } +} diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs new file mode 100644 index 00000000..ba1aefba --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs new file mode 100644 index 00000000..91380c69 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs new file mode 100644 index 00000000..c17b53ff --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi new file mode 100644 index 00000000..94aacd1a Binary files /dev/null and b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi differ diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs new file mode 100644 index 00000000..f08cfe6a --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj new file mode 100644 index 00000000..c9ab4219 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj @@ -0,0 +1,43 @@ + + + + + + netcoreapp3.1 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject new file mode 100644 index 00000000..7b5b2139 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + True + + \ No newline at end of file diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs new file mode 100644 index 00000000..af5f2543 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs @@ -0,0 +1,209 @@ +// 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. + +namespace WixToolsetTest.ManagedHost +{ + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class DncHostFixture + { + static readonly string bundleBasePath = TestData.Get("..", "examples"); + + [Fact] + public void CanLoadFDDEarliestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleFDD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("EarliestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanLoadSCDEarliestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("EarliestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanLoadTrimmedSCDEarliestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleTrimmedSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("EarliestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanReloadSCDEarliestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunReloadEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("EarliestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); + Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); + Assert.Equal("EarliestCoreBA", logMessages[7]); + Assert.Equal("Shutdown,Restart,0", logMessages[8]); + } + } + + [Fact] + public void CanLoadFDDLatestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("LatestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanReloadFDDLatestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunReloadEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("LatestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[4]); + Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); + Assert.Equal("LatestCoreBA", logMessages[7]); + Assert.Equal("Shutdown,Restart,0", logMessages[8]); + } + } + + [Fact] + public void CanLoadSCDLatestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("LatestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanLoadTrimmedSCDLatestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleTrimmedSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("LatestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanReloadSCDLatestCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunReloadEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("LatestCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); + Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); + Assert.Equal("LatestCoreBA", logMessages[7]); + Assert.Equal("Shutdown,Restart,0", logMessages[8]); + } + } + + [Fact] + public void CanLoadFDDWPFCoreMBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "WPFCoreBundleFDD.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("WPFCoreBA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + } +} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs new file mode 100644 index 00000000..dd37ee58 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs @@ -0,0 +1,94 @@ +// 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. + +namespace WixToolsetTest.ManagedHost +{ + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class MbaHostFixture + { + static readonly string bundleBasePath = TestData.Get("..", "examples"); + + [Fact] + public void CanLoadFullFramework2MBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("FullFramework2BA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanLoadFullFramework4MBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("FullFramework4BA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + } + } + + [Fact] + public void CanReloadFullFramework2MBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunReloadEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("FullFramework2BA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); + Assert.Equal("FullFramework2BA", logMessages[6]); + Assert.Equal("Shutdown,Restart,0", logMessages[7]); + } + } + + [Fact] + public void CanReloadFullFramework4MBA() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe"); + var testEngine = new TestEngine(); + + var result = testEngine.RunReloadEngine(bundleFile, baseFolder); + var logMessages = result.Output; + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); + Assert.Equal("FullFramework4BA", logMessages[2]); + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); + Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); + Assert.Equal("FullFramework4BA", logMessages[6]); + Assert.Equal("Shutdown,Restart,0", logMessages[7]); + } + } + } +} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md new file mode 100644 index 00000000..d7e73df2 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md @@ -0,0 +1,5 @@ +In order to properly test dnchost and mbahost, +the managed BAs need to be published and a bundle needs to be built for each scenario. +Making this happen on every build for the solution takes too long, +so this project relies on manually running appveyor.cmd to publish everything before the tests can be run. +appveyor.cmd needs to be ran again every time changes are made in other projects. \ No newline at end of file diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs new file mode 100644 index 00000000..44538227 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs @@ -0,0 +1,74 @@ +// 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. + +namespace WixToolsetTest.ManagedHost +{ + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + + public class TestEngine + { + private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe"); + + public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath) + { + return this.RunTestEngine("reload", bundleFilePath, tempFolderPath); + } + + public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath) + { + return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath); + } + + private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath) + { + var baFolderPath = Path.Combine(tempFolderPath, "ba"); + var extractFolderPath = Path.Combine(tempFolderPath, "extract"); + var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var args = new string[] { + engineMode, + '"' + bundleFilePath + '"', + '"' + extractResult.GetBAFilePath(baFolderPath) + '"', + }; + return RunProcessCaptureOutput(TestEngineFile, args); + } + + private static TestEngineResult RunProcessCaptureOutput(string executablePath, string[] arguments = null, string workingFolder = null) + { + var startInfo = new ProcessStartInfo(executablePath) + { + Arguments = string.Join(' ', arguments), + CreateNoWindow = true, + RedirectStandardError = true, + RedirectStandardOutput = true, + UseShellExecute = false, + WorkingDirectory = workingFolder, + }; + + var exitCode = 0; + var output = new List(); + + using (var process = Process.Start(startInfo)) + { + process.OutputDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; + process.ErrorDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; + + process.BeginErrorReadLine(); + process.BeginOutputReadLine(); + + process.WaitForExit(); + exitCode = process.ExitCode; + } + + return new TestEngineResult + { + ExitCode = exitCode, + Output = output, + }; + } + } +} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs new file mode 100644 index 00000000..63f6f7f5 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs @@ -0,0 +1,12 @@ +// 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. + +namespace WixToolsetTest.ManagedHost +{ + using System.Collections.Generic; + + public class TestEngineResult + { + public int ExitCode { get; set; } + public List Output { get; set; } + } +} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj b/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj new file mode 100644 index 00000000..38c8926c --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj @@ -0,0 +1,25 @@ + + + + + + netcoreapp3.1 + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/Directory.Build.props b/src/ext/Bal/test/examples/Directory.Build.props new file mode 100644 index 00000000..3d5870a5 --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ext/Bal/test/examples/Directory.Build.targets b/src/ext/Bal/test/examples/Directory.Build.targets new file mode 100644 index 00000000..6dcf402b --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.targets @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj @@ -0,0 +1,2 @@ + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d146845c --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj new file mode 100644 index 00000000..ebeebff2 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj @@ -0,0 +1,10 @@ + + + + + + publish.Example.EarliestCoreMBA.scd + ba.xslt + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..4d872317 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt @@ -0,0 +1,20 @@ + + + + + + + + + + + + + yes + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..a6b56460 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj @@ -0,0 +1,10 @@ + + + + + + publish.Example.EarliestCoreMBA.trimmedscd + ba.xslt + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..ba7dce25 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt @@ -0,0 +1,20 @@ + + + + + + + + + + + + + yes + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs new file mode 100644 index 00000000..c9291a7f --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs @@ -0,0 +1,34 @@ +// 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. + +namespace Example.EarliestCoreMBA +{ + using WixToolset.Mba.Core; + + public class EarliestCoreBA : BootstrapperApplication + { + public EarliestCoreBA(IEngine engine) + : base(engine) + { + + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(EarliestCoreBA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs new file mode 100644 index 00000000..672e17ee --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.EarliestCoreMBA.EarliestCoreBAFactory))] +namespace Example.EarliestCoreMBA +{ + using WixToolset.Mba.Core; + + public class EarliestCoreBAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new EarliestCoreBA(engine); + } + } +} diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj new file mode 100644 index 00000000..cb66c138 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp3.1 + win-x86;win-x64 + true + Earliest .NET Core MBA + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs new file mode 100644 index 00000000..f0af975c --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj @@ -0,0 +1,2 @@ + + diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj new file mode 100644 index 00000000..21079ed1 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj @@ -0,0 +1,20 @@ + + + + + + net20 + Example.FullFramework2MBA + Example.FullFramework2MBA + embedded + win-x86 + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs new file mode 100644 index 00000000..32cd19c8 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs @@ -0,0 +1,34 @@ +// 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. + +namespace Example.FullFramework2MBA +{ + using WixToolset.Mba.Core; + + public class FullFramework2BA : BootstrapperApplication + { + public FullFramework2BA(IEngine engine) + : base(engine) + { + + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(FullFramework2BA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs new file mode 100644 index 00000000..647c2040 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework2MBA.FullFramework2BAFactory))] +namespace Example.FullFramework2MBA +{ + using WixToolset.Mba.Core; + + public class FullFramework2BAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new FullFramework2BA(engine); + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..be450a4f --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config @@ -0,0 +1,20 @@ + + + + + + + +
+ + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs new file mode 100644 index 00000000..7b7cbf57 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj @@ -0,0 +1,2 @@ + + diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj new file mode 100644 index 00000000..a05e7888 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj @@ -0,0 +1,19 @@ + + + + + + net48 + Full Framework v4 MBA + win-x86 + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs new file mode 100644 index 00000000..8ee3bd19 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs @@ -0,0 +1,34 @@ +// 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. + +namespace Example.FullFramework4MBA +{ + using WixToolset.Mba.Core; + + public class FullFramework4BA : BootstrapperApplication + { + public FullFramework4BA(IEngine engine) + : base(engine) + { + + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(FullFramework4BA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs new file mode 100644 index 00000000..6a571a54 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework4MBA.FullFramework4BAFactory))] +namespace Example.FullFramework4MBA +{ + using WixToolset.Mba.Core; + + public class FullFramework4BAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new FullFramework4BA(engine); + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..96678cda --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config @@ -0,0 +1,17 @@ + + + + + + + +
+ + + + + + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d5b543e8 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj @@ -0,0 +1,2 @@ + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj new file mode 100644 index 00000000..30a860ab --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj @@ -0,0 +1,10 @@ + + + + + + publish.Example.LatestCoreMBA.scd + ba.xslt + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..bedf0326 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt @@ -0,0 +1,20 @@ + + + + + + + + + + + + + yes + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..5ce89b64 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj @@ -0,0 +1,10 @@ + + + + + + publish.Example.LatestCoreMBA.trimmedscd + ba.xslt + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..6059f8c1 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt @@ -0,0 +1,20 @@ + + + + + + + + + + + + + yes + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj new file mode 100644 index 00000000..9f3f02d9 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj @@ -0,0 +1,21 @@ + + + + net5.0 + win-x86;win-x64 + true + Latest .NET Core MBA + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs new file mode 100644 index 00000000..50386a87 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs @@ -0,0 +1,33 @@ +// 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. + +namespace Example.LatestCoreMBA +{ + using WixToolset.Mba.Core; + + public class LatestCoreBA : BootstrapperApplication + { + public LatestCoreBA(IEngine engine) + : base(engine) + { + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(LatestCoreBA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs new file mode 100644 index 00000000..fff3b5c5 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.LatestCoreMBA.LatestCoreBAFactory))] +namespace Example.LatestCoreMBA +{ + using WixToolset.Mba.Core; + + public class LatestCoreBAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new LatestCoreBA(engine); + } + } +} diff --git a/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj new file mode 100644 index 00000000..99eb917e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj @@ -0,0 +1,83 @@ + + + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3D44B67D-A475-49BA-8310-E39F6C117CC9} + Application + Console + Example.TestEngine + v142 + Unicode + 10.0 + + + + + + + + + + + + + + + Create + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp new file mode 100644 index 00000000..fc1938fe --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp @@ -0,0 +1,53 @@ +// 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. + +#include "precomp.h" + +int __cdecl wmain(int argc, LPWSTR argv[]) +{ + HRESULT hr = S_OK; + BOOL fComInitialized = FALSE; + BOOL fShowUsage = FALSE; + + // initialize COM + hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + ExitOnFailure(hr, "Failed to initialize COM."); + fComInitialized = TRUE; + + ConsoleInitialize(); + + if (argc != 4) + { + fShowUsage = TRUE; + } + else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"reload", -1)) + { + hr = RunReloadEngine(argv[2], argv[3]); + } + else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"shutdown", -1)) + { + hr = RunShutdownEngine(argv[2], argv[3]); + } + else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"waitforquit", -1)) + { + hr = RunWaitForQuitEngine(argv[2], argv[3]); + } + else + { + fShowUsage = TRUE; + } + + if (fShowUsage) + { + ConsoleWriteError(hr = E_INVALIDARG, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe {reload|shutdown|waitforquit} Bundle.exe BA.dll"); + } + + ConsoleUninitialize(); + +LExit: + if (fComInitialized) + { + ::CoUninitialize(); + } + + return hr; +} diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp new file mode 100644 index 00000000..46fd9afa --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp @@ -0,0 +1,55 @@ +// 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. + +#include "precomp.h" + +HRESULT RunReloadEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ) +{ + HRESULT hr = S_OK; + TestEngine* pTestEngine = NULL; + + pTestEngine = new TestEngine(); + ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); + + hr = pTestEngine->Initialize(wzBundleFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); + + hr = pTestEngine->LoadBA(wzBAFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); + + hr = pTestEngine->SendStartupEvent(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); + + hr = pTestEngine->SimulateQuit(0); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); + + hr = pTestEngine->RunApplication(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); + + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); + + pTestEngine->UnloadBA(); + + hr = pTestEngine->LoadBA(wzBAFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); + + hr = pTestEngine->SendStartupEvent(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); + + hr = pTestEngine->SimulateQuit(0); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); + + hr = pTestEngine->RunApplication(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); + + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); + + pTestEngine->UnloadBA(); + +LExit: + return hr; +} diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h new file mode 100644 index 00000000..0e8456af --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h @@ -0,0 +1,8 @@ +#pragma once +// 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. + + +HRESULT RunReloadEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ); diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp new file mode 100644 index 00000000..3b876e4e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp @@ -0,0 +1,38 @@ +// 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. + +#include "precomp.h" + +HRESULT RunShutdownEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ) +{ + HRESULT hr = S_OK; + TestEngine* pTestEngine = NULL; + + pTestEngine = new TestEngine(); + ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); + + hr = pTestEngine->Initialize(wzBundleFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); + + hr = pTestEngine->LoadBA(wzBAFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); + + hr = pTestEngine->SendStartupEvent(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); + + hr = pTestEngine->SimulateQuit(0); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); + + hr = pTestEngine->RunApplication(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); + + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); + + pTestEngine->UnloadBA(); + +LExit: + return hr; +} diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h new file mode 100644 index 00000000..0cfa147a --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h @@ -0,0 +1,8 @@ +#pragma once +// 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. + + +HRESULT RunShutdownEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ); diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp new file mode 100644 index 00000000..4c7ec1c3 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp @@ -0,0 +1,256 @@ +// 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. + +#include "precomp.h" + +HRESULT TestEngine::Initialize( + __in LPCWSTR wzBundleFilePath + ) +{ + HRESULT hr = S_OK; + MSG msg = { }; + + LogInitialize(::GetModuleHandleW(NULL)); + + hr = LogOpen(NULL, PathFile(wzBundleFilePath), NULL, L"txt", FALSE, FALSE, NULL); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); + + ::PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); + +LExit: + return hr; +} + +HRESULT TestEngine::LoadBA( + __in LPCWSTR wzBAFilePath + ) +{ + HRESULT hr = S_OK; + BOOTSTRAPPER_COMMAND command = { }; + BOOTSTRAPPER_CREATE_ARGS args = { }; + PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; + + if (m_pCreateResults || m_hBAModule) + { + ExitFunction1(hr = E_INVALIDSTATE); + } + + m_pCreateResults = static_cast(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); + + command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); + + hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperWorkingFolder"); + + hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath"); + + args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); + args.pCommand = &command; + args.pfnBootstrapperEngineProc = TestEngine::EngineProc; + args.pvBootstrapperEngineProcContext = this; + args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1); + + m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); + + m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll."); + + pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(m_hBAModule, "BootstrapperApplicationCreate"); + ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); + + hr = pfnCreate(&args, m_pCreateResults); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); + +LExit: + ReleaseStr(command.wzBootstrapperApplicationDataPath); + ReleaseStr(command.wzBootstrapperWorkingFolder); + + return hr; +} + +HRESULT TestEngine::Log( + __in BOOTSTRAPPER_LOG_LEVEL level, + __in LPCWSTR wzMessage + ) +{ + switch (level) + { + case BOOTSTRAPPER_LOG_LEVEL_NONE: + case BOOTSTRAPPER_LOG_LEVEL_DEBUG: + return S_OK; + default: + LogStringLine(REPORT_STANDARD, "%ls", wzMessage); + return ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzMessage); + } +} + +HRESULT TestEngine::RunApplication() +{ + HRESULT hr = S_OK; + MSG msg = { }; + BOOL fRet = FALSE; + + // Enter the message pump. + while (0 != (fRet = ::GetMessageW(&msg, NULL, 0, 0))) + { + if (-1 == fRet) + { + ConsoleExitOnFailure(hr = E_UNEXPECTED, CONSOLE_COLOR_RED, "Unexpected return value from message pump."); + } + else + { + ProcessBAMessage(&msg); + } + } + +LExit: + return hr; +} + +HRESULT TestEngine::SendShutdownEvent( + __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction + ) +{ + HRESULT hr = S_OK; + BA_ONSHUTDOWN_ARGS shutdownArgs = { }; + BA_ONSHUTDOWN_RESULTS shutdownResults = { }; + shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS); + shutdownResults.action = defaultAction; + shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS); + hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); + return hr; +} + +HRESULT TestEngine::SendStartupEvent() +{ + HRESULT hr = S_OK; + BA_ONSTARTUP_ARGS startupArgs = { }; + BA_ONSTARTUP_RESULTS startupResults = { }; + startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS); + startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS); + hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); + return hr; +} + +HRESULT TestEngine::SimulateQuit( + __in DWORD dwExitCode + ) +{ + BAENGINE_QUIT_ARGS args = { }; + BAENGINE_QUIT_RESULTS results = { }; + + args.cbSize = sizeof(BAENGINE_QUIT_ARGS); + args.dwExitCode = dwExitCode; + + results.cbSize = sizeof(BAENGINE_QUIT_RESULTS); + + return BAEngineQuit(&args, &results); +} + +void TestEngine::UnloadBA() +{ + PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; + BOOL fDisableUnloading = m_pCreateResults && m_pCreateResults->fDisableUnloading; + + ReleaseNullMem(m_pCreateResults); + + pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(m_hBAModule, "BootstrapperApplicationDestroy"); + + if (pfnDestroy) + { + pfnDestroy(); + } + + if (m_hBAModule) + { + if (!fDisableUnloading) + { + ::FreeLibrary(m_hBAModule); + } + + m_hBAModule = NULL; + } +} + +HRESULT TestEngine::BAEngineLog( + __in BAENGINE_LOG_ARGS* pArgs, + __in BAENGINE_LOG_RESULTS* /*pResults*/ + ) +{ + return Log(pArgs->level, pArgs->wzMessage); +} + +HRESULT TestEngine::BAEngineQuit( + __in BAENGINE_QUIT_ARGS* pArgs, + __in BAENGINE_QUIT_RESULTS* /*pResults*/ + ) +{ + HRESULT hr = S_OK; + + if (!::PostThreadMessageW(m_dwThreadId, WM_TESTENG_QUIT, static_cast(pArgs->dwExitCode), 0)) + { + ConsoleExitWithLastError(hr, CONSOLE_COLOR_RED, "Failed to post shutdown message."); + } + +LExit: + return hr; +} + +HRESULT WINAPI TestEngine::EngineProc( + __in BOOTSTRAPPER_ENGINE_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ) +{ + HRESULT hr = S_OK; + TestEngine* pContext = (TestEngine*)pvContext; + + if (!pContext || !pvArgs || !pvResults) + { + ExitFunction1(hr = E_INVALIDARG); + } + + switch (message) + { + case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: + hr = pContext->BAEngineLog(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT: + hr = pContext->BAEngineQuit(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + default: + hr = E_NOTIMPL; + break; + } + +LExit: + return hr; +} + +HRESULT TestEngine::ProcessBAMessage( + __in const MSG* pmsg + ) +{ + HRESULT hr = S_OK; + + switch (pmsg->message) + { + case WM_TESTENG_QUIT: + ::PostQuitMessage(static_cast(pmsg->wParam)); // go bye-bye. + break; + } + + return hr; +} + +TestEngine::TestEngine() +{ + m_hBAModule = NULL; + m_pCreateResults = NULL; + m_dwThreadId = ::GetCurrentThreadId(); +} + +TestEngine::~TestEngine() +{ + ReleaseMem(m_pCreateResults); +} diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.h b/src/ext/Bal/test/examples/TestEngine/TestEngine.h new file mode 100644 index 00000000..44e813bd --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.h @@ -0,0 +1,80 @@ +#pragma once +// 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. + + +enum WM_TESTENG +{ + WM_TESTENG_FIRST = WM_APP + 0xFFF, // this enum value must always be first. + + WM_TESTENG_DETECT, + WM_TESTENG_PLAN, + WM_TESTENG_ELEVATE, + WM_TESTENG_APPLY, + WM_TESTENG_LAUNCH_APPROVED_EXE, + WM_TESTENG_QUIT, + + WM_TESTENG_LAST, // this enum value must always be last. +}; + +class TestEngine +{ +public: + HRESULT Initialize( + __in LPCWSTR wzBundleFilePath + ); + + HRESULT LoadBA( + __in LPCWSTR wzBAFilePath + ); + + HRESULT Log( + __in BOOTSTRAPPER_LOG_LEVEL level, + __in LPCWSTR wzMessage + ); + + HRESULT RunApplication(); + + HRESULT SendShutdownEvent( + __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction + ); + + HRESULT SendStartupEvent(); + + HRESULT SimulateQuit( + __in DWORD dwExitCode + ); + + void UnloadBA(); + +private: + HRESULT BAEngineLog( + __in BAENGINE_LOG_ARGS* pArgs, + __in BAENGINE_LOG_RESULTS* pResults + ); + + HRESULT BAEngineQuit( + __in BAENGINE_QUIT_ARGS* pArgs, + __in BAENGINE_QUIT_RESULTS* pResults + ); + + static HRESULT WINAPI EngineProc( + __in BOOTSTRAPPER_ENGINE_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + + HRESULT ProcessBAMessage( + __in const MSG* pmsg + ); + +public: + TestEngine(); + + ~TestEngine(); + +private: + HMODULE m_hBAModule; + BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; + DWORD m_dwThreadId; +}; \ No newline at end of file diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp new file mode 100644 index 00000000..2f80ba75 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp @@ -0,0 +1,35 @@ +// 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. + +#include "precomp.h" + +HRESULT RunWaitForQuitEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ) +{ + HRESULT hr = S_OK; + TestEngine* pTestEngine = NULL; + + pTestEngine = new TestEngine(); + ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); + + hr = pTestEngine->Initialize(wzBundleFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); + + hr = pTestEngine->LoadBA(wzBAFilePath); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); + + hr = pTestEngine->SendStartupEvent(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); + + hr = pTestEngine->RunApplication(); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); + + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); + + pTestEngine->UnloadBA(); + +LExit: + return hr; +} diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h new file mode 100644 index 00000000..99e3f63c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h @@ -0,0 +1,8 @@ +#pragma once +// 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. + + +HRESULT RunWaitForQuitEngine( + __in LPCWSTR wzBundleFilePath, + __in LPCWSTR wzBAFilePath + ); diff --git a/src/ext/Bal/test/examples/TestEngine/packages.config b/src/ext/Bal/test/examples/TestEngine/packages.config new file mode 100644 index 00000000..548ddb48 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.cpp b/src/ext/Bal/test/examples/TestEngine/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.cpp @@ -0,0 +1,3 @@ +// 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. + +#include "precomp.h" diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.h b/src/ext/Bal/test/examples/TestEngine/precomp.h new file mode 100644 index 00000000..f943f420 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.h @@ -0,0 +1,20 @@ +#pragma once +// 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. + +#include +#include + +#include "dutil.h" +#include "conutil.h" +#include "logutil.h" +#include "memutil.h" +#include "pathutil.h" +#include "strutil.h" + +#include "BootstrapperEngine.h" +#include "BootstrapperApplication.h" + +#include "TestEngine.h" +#include "ReloadEngine.h" +#include "ShutdownEngine.h" +#include "WaitForQuitEngine.h" diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..68d742b0 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj @@ -0,0 +1,2 @@ + + diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs new file mode 100644 index 00000000..03a5c7fa --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// 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. + +using System.Windows; + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj new file mode 100644 index 00000000..296e5be9 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj @@ -0,0 +1,16 @@ + + + + net5.0-windows + win-x86;win-x64 + true + WPF .NET Core MBA + true + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml new file mode 100644 index 00000000..40a27a06 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs new file mode 100644 index 00000000..4f61b807 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs @@ -0,0 +1,17 @@ +// 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. + +namespace Example.WPFCoreMBA +{ + using System.Windows; + + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + this.InitializeComponent(); + } + } +} diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs new file mode 100644 index 00000000..d50be813 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs @@ -0,0 +1,42 @@ +// 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. + +namespace Example.WPFCoreMBA +{ + using System.Windows.Threading; + using WixToolset.Mba.Core; + + public class WPFCoreBA : BootstrapperApplication + { + public WPFCoreBA(IEngine engine) + : base(engine) + { + } + + public Dispatcher BADispatcher { get; private set; } + + protected override void Run() + { + this.BADispatcher = Dispatcher.CurrentDispatcher; + var window = new MainWindow(); + window.Closed += (s, e) => this.BADispatcher.InvokeShutdown(); + //window.Show(); + //Dispatcher.Run(); + //this.engine.Quit(0); + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(WPFCoreBA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs new file mode 100644 index 00000000..a3ccdf9f --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.WPFCoreMBA.WPFCoreBAFactory))] +namespace Example.WPFCoreMBA +{ + using WixToolset.Mba.Core; + + public class WPFCoreBAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new WPFCoreBA(engine); + } + } +} diff --git a/src/ext/Bal/test/examples/Wix.Build.props b/src/ext/Bal/test/examples/Wix.Build.props new file mode 100644 index 00000000..aad94bb6 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.props @@ -0,0 +1,10 @@ + + + + + Bundle + .exe + -generate payloadgroup + $(OutputPath)examples\ + + diff --git a/src/ext/Bal/test/examples/Wix.Build.targets b/src/ext/Bal/test/examples/Wix.Build.targets new file mode 100644 index 00000000..7e6fe9f2 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.targets @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/ext/Bal/test/examples/examples.proj b/src/ext/Bal/test/examples/examples.proj new file mode 100644 index 00000000..08cb7511 --- /dev/null +++ b/src/ext/Bal/test/examples/examples.proj @@ -0,0 +1,50 @@ + + + + + + + + + EarliestCoreMBA\Example.EarliestCoreMBA.csproj + FullFramework2MBA\Example.FullFramework2MBA.csproj + FullFramework4MBA\Example.FullFramework4MBA.csproj + LatestCoreMBA\Example.LatestCoreMBA.csproj + WPFCoreMBA\Example.WPFCoreMBA.csproj + $(OutputPath)examples\publish\ + + + + + $(MBAPublishPath)Example.EarliestCoreMBA + + + $(MBAPublishPath)Example.LatestCoreMBA + + + $(MBAPublishPath)Example.WPFCoreMBA + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/wix.snk b/src/ext/Bal/wix.snk new file mode 100644 index 00000000..3908a66a Binary files /dev/null and b/src/ext/Bal/wix.snk differ diff --git a/src/ext/Bal/wixext/BalBurnBackendExtension.cs b/src/ext/Bal/wixext/BalBurnBackendExtension.cs new file mode 100644 index 00000000..e8dc7a3e --- /dev/null +++ b/src/ext/Bal/wixext/BalBurnBackendExtension.cs @@ -0,0 +1,171 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Bal.Symbols; + using WixToolset.Data; + using WixToolset.Data.Burn; + using WixToolset.Data.Symbols; + using WixToolset.Extensibility; + + public class BalBurnBackendExtension : BaseBurnBackendBinderExtension + { + private static readonly IntermediateSymbolDefinition[] BurnSymbolDefinitions = + { + BalSymbolDefinitions.WixBalBAFactoryAssembly, + BalSymbolDefinitions.WixBalBAFunctions, + BalSymbolDefinitions.WixBalCondition, + BalSymbolDefinitions.WixBalPackageInfo, + BalSymbolDefinitions.WixDncOptions, + BalSymbolDefinitions.WixMbaPrereqInformation, + BalSymbolDefinitions.WixStdbaOptions, + BalSymbolDefinitions.WixStdbaOverridableVariable, + }; + + protected override IReadOnlyCollection SymbolDefinitions => BurnSymbolDefinitions; + + public override void SymbolsFinalized(IntermediateSection section) + { + base.SymbolsFinalized(section); + + var baSymbol = section.Symbols.OfType().SingleOrDefault(); + var baId = baSymbol?.Id?.Id; + if (null == baId) + { + return; + } + + var isStdBA = baId.StartsWith("WixStandardBootstrapperApplication"); + var isMBA = baId.StartsWith("WixManagedBootstrapperApplicationHost"); + var isDNC = baId.StartsWith("WixDotNetCoreBootstrapperApplicationHost"); + var isSCD = isDNC && this.VerifySCD(section); + + if (isDNC) + { + this.FinalizeBAFactorySymbol(section); + } + + if (isStdBA || isMBA || isDNC) + { + this.VerifyBAFunctions(section); + } + + if (isMBA || (isDNC && !isSCD)) + { + this.VerifyPrereqPackages(section, isDNC); + } + } + + private void FinalizeBAFactorySymbol(IntermediateSection section) + { + var factorySymbol = section.Symbols.OfType().SingleOrDefault(); + if (null == factorySymbol) + { + return; + } + + var factoryPayloadSymbol = section.Symbols.OfType() + .Where(p => p.Id.Id == factorySymbol.PayloadId) + .SingleOrDefault(); + if (null == factoryPayloadSymbol) + { + return; + } + + factorySymbol.FilePath = factoryPayloadSymbol.Name; + } + + private void VerifyBAFunctions(IntermediateSection section) + { + WixBalBAFunctionsSymbol baFunctionsSymbol = null; + foreach (var symbol in section.Symbols.OfType()) + { + if (null == baFunctionsSymbol) + { + baFunctionsSymbol = symbol; + } + else + { + this.Messaging.Write(BalErrors.MultipleBAFunctions(symbol.SourceLineNumbers)); + } + } + + var payloadPropertiesSymbols = section.Symbols.OfType().ToList(); + if (null == baFunctionsSymbol) + { + foreach (var payloadPropertiesSymbol in payloadPropertiesSymbols) + { + if (string.Equals(payloadPropertiesSymbol.Name, "bafunctions.dll", StringComparison.OrdinalIgnoreCase) && + BurnConstants.BurnUXContainerName == payloadPropertiesSymbol.ContainerRef) + { + this.Messaging.Write(BalWarnings.UnmarkedBAFunctionsDLL(payloadPropertiesSymbol.SourceLineNumbers)); + } + } + } + else + { + var payloadId = baFunctionsSymbol.Id; + var bundlePayloadSymbol = payloadPropertiesSymbols.Single(x => payloadId == x.Id); + if (BurnConstants.BurnUXContainerName != bundlePayloadSymbol.ContainerRef) + { + this.Messaging.Write(BalErrors.BAFunctionsPayloadRequiredInUXContainer(baFunctionsSymbol.SourceLineNumbers)); + } + } + } + + private void VerifyPrereqPackages(IntermediateSection section, bool isDNC) + { + var prereqInfoSymbols = section.Symbols.OfType().ToList(); + if (prereqInfoSymbols.Count == 0) + { + var message = isDNC ? BalErrors.MissingDNCPrereq() : BalErrors.MissingMBAPrereq(); + this.Messaging.Write(message); + return; + } + + var foundLicenseFile = false; + var foundLicenseUrl = false; + + foreach (var prereqInfoSymbol in prereqInfoSymbols) + { + if (null != prereqInfoSymbol.LicenseFile) + { + if (foundLicenseFile || foundLicenseUrl) + { + this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoSymbol.SourceLineNumbers)); + return; + } + + foundLicenseFile = true; + } + + if (null != prereqInfoSymbol.LicenseUrl) + { + if (foundLicenseFile || foundLicenseUrl) + { + this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoSymbol.SourceLineNumbers)); + return; + } + + foundLicenseUrl = true; + } + } + } + + private bool VerifySCD(IntermediateSection section) + { + var isSCD = false; + + var dncOptions = section.Symbols.OfType().SingleOrDefault(); + if (dncOptions != null) + { + isSCD = dncOptions.SelfContainedDeployment != 0; + } + + return isSCD; + } + } +} diff --git a/src/ext/Bal/wixext/BalCompiler.cs b/src/ext/Bal/wixext/BalCompiler.cs new file mode 100644 index 00000000..267345e7 --- /dev/null +++ b/src/ext/Bal/wixext/BalCompiler.cs @@ -0,0 +1,923 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Bal.Symbols; + using WixToolset.Data; + using WixToolset.Data.Symbols; + using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; + + /// + /// The compiler for the WiX Toolset Bal Extension. + /// + public sealed class BalCompiler : BaseCompilerExtension + { + private readonly Dictionary prereqInfoSymbolsByPackageId; + + private enum WixDotNetCoreBootstrapperApplicationHostTheme + { + Unknown, + None, + Standard, + } + + private enum WixManagedBootstrapperApplicationHostTheme + { + Unknown, + None, + Standard, + } + + private enum WixStandardBootstrapperApplicationTheme + { + Unknown, + HyperlinkLargeLicense, + HyperlinkLicense, + HyperlinkSidebarLicense, + None, + RtfLargeLicense, + RtfLicense, + } + + /// + /// Instantiate a new BalCompiler. + /// + public BalCompiler() + { + this.prereqInfoSymbolsByPackageId = new Dictionary(); + } + + public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/bal"; + + /// + /// Processes an element for the Compiler. + /// + /// + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + switch (parentElement.Name.LocalName) + { + case "Bundle": + case "Fragment": + switch (element.Name.LocalName) + { + case "Condition": + this.ParseConditionElement(intermediate, section, element); + break; + case "ManagedBootstrapperApplicationPrereqInformation": + this.ParseMbaPrereqInfoElement(intermediate, section, element); + break; + default: + this.ParseHelper.UnexpectedElement(parentElement, element); + break; + } + break; + case "BootstrapperApplication": + switch (element.Name.LocalName) + { + case "WixStandardBootstrapperApplication": + this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element); + break; + case "WixManagedBootstrapperApplicationHost": + this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); + break; + case "WixDotNetCoreBootstrapperApplicationHost": + this.ParseWixDotNetCoreBootstrapperApplicationHostElement(intermediate, section, element); + break; + default: + this.ParseHelper.UnexpectedElement(parentElement, element); + break; + } + break; + default: + this.ParseHelper.UnexpectedElement(parentElement, element); + break; + } + } + + /// + /// Processes an attribute for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of element to process. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); + WixMbaPrereqInformationSymbol prereqInfo; + + switch (parentElement.Name.LocalName) + { + case "ExePackage": + case "MsiPackage": + case "MspPackage": + case "MsuPackage": + string packageId; + if (!context.TryGetValue("PackageId", out packageId) || String.IsNullOrEmpty(packageId)) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); + } + else + { + switch (attribute.Name.LocalName) + { + case "DisplayInternalUICondition": + switch (parentElement.Name.LocalName) + { + case "MsiPackage": + case "MspPackage": + var displayInternalUICondition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); + section.AddSymbol(new WixBalPackageInfoSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) + { + PackageId = packageId, + DisplayInternalUICondition = displayInternalUICondition, + }); + break; + default: + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + break; + } + break; + case "PrereqLicenseFile": + + if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo)) + { + // at the time the extension attribute is parsed, the compiler might not yet have + // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. + var prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); + + if (null != prereqPackage && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) + { + prereqInfo = section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) + { + PackageId = packageId, + }); + + this.prereqInfoSymbolsByPackageId.Add(packageId, prereqInfo); + } + else + { + this.Messaging.Write(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile")); + break; + } + } + + if (null != prereqInfo.LicenseUrl) + { + this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile", "PrereqLicenseUrl")); + } + else + { + prereqInfo.LicenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); + } + break; + case "PrereqLicenseUrl": + + if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo)) + { + // at the time the extension attribute is parsed, the compiler might not yet have + // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. + var prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); + + if (null != prereqPackage && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) + { + prereqInfo = section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) + { + PackageId = packageId, + }); + + this.prereqInfoSymbolsByPackageId.Add(packageId, prereqInfo); + } + else + { + this.Messaging.Write(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl")); + break; + } + } + + if (null != prereqInfo.LicenseFile) + { + this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl", "PrereqLicenseFile")); + } + else + { + prereqInfo.LicenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); + } + break; + case "PrereqPackage": + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) + { + if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo)) + { + prereqInfo = section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) + { + PackageId = packageId, + }); + + this.prereqInfoSymbolsByPackageId.Add(packageId, prereqInfo); + } + } + break; + default: + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + break; + } + } + break; + case "Payload": + string payloadId; + if (!context.TryGetValue("Id", out payloadId) || String.IsNullOrEmpty(payloadId)) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); + } + else + { + switch (attribute.Name.LocalName) + { + case "BAFactoryAssembly": + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) + { + // There can only be one. + var id = new Identifier(AccessModifier.Global, "TheBAFactoryAssembly"); + section.AddSymbol(new WixBalBAFactoryAssemblySymbol(sourceLineNumbers, id) + { + PayloadId = payloadId, + }); + } + break; + case "BAFunctions": + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) + { + section.AddSymbol(new WixBalBAFunctionsSymbol(sourceLineNumbers) + { + PayloadId = payloadId, + }); + } + break; + default: + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + break; + } + } + break; + case "Variable": + // at the time the extension attribute is parsed, the compiler might not yet have + // parsed the Name attribute, so we need to get it directly from the parent element. + var variableName = parentElement.Attribute("Name"); + if (null == variableName) + { + this.Messaging.Write(ErrorMessages.ExpectedParentWithAttribute(sourceLineNumbers, "Variable", "Overridable", "Name")); + } + else + { + switch (attribute.Name.LocalName) + { + case "Overridable": + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) + { + section.AddSymbol(new WixStdbaOverridableVariableSymbol(sourceLineNumbers) + { + Name = variableName.Value, + }); + } + break; + default: + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + break; + } + } + break; + } + } + + /// + /// Parses a Condition element for Bundles. + /// + /// The element to parse. + private void ParseConditionElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string condition = null; + string message = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Message": + message = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Condition": + condition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + // Error check the values. + if (String.IsNullOrEmpty(condition)) + { + this.Messaging.Write(ErrorMessages.ConditionExpected(sourceLineNumbers, node.Name.LocalName)); + } + + if (null == message) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); + } + + if (!this.Messaging.EncounteredError) + { + section.AddSymbol(new WixBalConditionSymbol(sourceLineNumbers) + { + Condition = condition, + Message = message, + }); + } + } + + /// + /// Parses a Condition element for Bundles. + /// + /// The element to parse. + private void ParseMbaPrereqInfoElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string packageId = null; + string licenseFile = null; + string licenseUrl = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "LicenseFile": + licenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LicenseUrl": + licenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "PackageId": + packageId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + if (null == packageId) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PackageId")); + } + + if (null == licenseFile && null == licenseUrl || + null != licenseFile && null != licenseUrl) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); + } + + if (!this.Messaging.EncounteredError) + { + section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) + { + PackageId = packageId, + LicenseFile = licenseFile, + LicenseUrl = licenseUrl, + }); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePackage, packageId); + } + } + + /// + /// Parses a WixStandardBootstrapperApplication element for Bundles. + /// + /// The element to parse. + private void ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string launchTarget = null; + string launchTargetElevatedId = null; + string launchArguments = null; + var launchHidden = YesNoType.NotSet; + string launchWorkingDir = null; + string licenseFile = null; + string licenseUrl = null; + string logoFile = null; + string logoSideFile = null; + WixStandardBootstrapperApplicationTheme? theme = null; + string themeFile = null; + string localizationFile = null; + var suppressOptionsUI = YesNoType.NotSet; + var suppressDowngradeFailure = YesNoType.NotSet; + var suppressRepair = YesNoType.NotSet; + var showVersion = YesNoType.NotSet; + var supportCacheOnly = YesNoType.NotSet; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "LaunchTarget": + launchTarget = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LaunchTargetElevatedId": + launchTargetElevatedId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "LaunchArguments": + launchArguments = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LaunchHidden": + launchHidden = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "LaunchWorkingFolder": + launchWorkingDir = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LicenseFile": + licenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LicenseUrl": + licenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); + break; + case "LogoFile": + logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LogoSideFile": + logoSideFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ThemeFile": + themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LocalizationFile": + localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SuppressOptionsUI": + suppressOptionsUI = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "SuppressDowngradeFailure": + suppressDowngradeFailure = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "SuppressRepair": + suppressRepair = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "ShowVersion": + showVersion = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "SupportCacheOnly": + supportCacheOnly = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "hyperlinkLargeLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense; + break; + case "hyperlinkLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkLicense; + break; + case "hyperlinkSidebarLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense; + break; + case "none": + theme = WixStandardBootstrapperApplicationTheme.None; + break; + case "rtfLargeLicense": + theme = WixStandardBootstrapperApplicationTheme.RtfLargeLicense; + break; + case "rtfLicense": + theme = WixStandardBootstrapperApplicationTheme.RtfLicense; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "hyperlinkLargeLicense", "hyperlinkLicense", "hyperlinkSidebarLicense", "none", "rtfLargeLicense", "rtfLicense")); + theme = WixStandardBootstrapperApplicationTheme.Unknown; // set a value to prevent expected attribute error below. + break; + } + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + if (!theme.HasValue) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Theme")); + } + + if (theme != WixStandardBootstrapperApplicationTheme.None && String.IsNullOrEmpty(licenseFile) && null == licenseUrl) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); + } + + if (!this.Messaging.EncounteredError) + { + if (!String.IsNullOrEmpty(launchTarget)) + { + section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "LaunchTarget")) + { + Value = launchTarget, + Type = WixBundleVariableType.Formatted, + }); + } + + if (!String.IsNullOrEmpty(launchTargetElevatedId)) + { + section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "LaunchTargetElevatedId")) + { + Value = launchTargetElevatedId, + Type = WixBundleVariableType.Formatted, + }); + } + + if (!String.IsNullOrEmpty(launchArguments)) + { + section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "LaunchArguments")) + { + Value = launchArguments, + Type = WixBundleVariableType.Formatted, + }); + } + + if (YesNoType.Yes == launchHidden) + { + section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "LaunchHidden")) + { + Value = "yes", + Type = WixBundleVariableType.Formatted, + }); + } + + + if (!String.IsNullOrEmpty(launchWorkingDir)) + { + section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "LaunchWorkingFolder")) + { + Value = launchWorkingDir, + Type = WixBundleVariableType.Formatted, + }); + } + + if (!String.IsNullOrEmpty(licenseFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaLicenseRtf")) + { + Value = licenseFile, + }); + } + + if (null != licenseUrl) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaLicenseUrl")) + { + Value = licenseUrl, + }); + } + + if (!String.IsNullOrEmpty(logoFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaLogo")) + { + Value = logoFile, + }); + } + + if (!String.IsNullOrEmpty(logoSideFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaLogoSide")) + { + Value = logoSideFile, + }); + } + + if (!String.IsNullOrEmpty(themeFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaThemeXml")) + { + Value = themeFile, + }); + } + + if (!String.IsNullOrEmpty(localizationFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixStdbaThemeWxl")) + { + Value = localizationFile, + }); + } + + if (YesNoType.Yes == suppressOptionsUI || YesNoType.Yes == suppressDowngradeFailure || YesNoType.Yes == suppressRepair || YesNoType.Yes == showVersion || YesNoType.Yes == supportCacheOnly) + { + var symbol = section.AddSymbol(new WixStdbaOptionsSymbol(sourceLineNumbers)); + if (YesNoType.Yes == suppressOptionsUI) + { + symbol.SuppressOptionsUI = 1; + } + + if (YesNoType.Yes == suppressDowngradeFailure) + { + symbol.SuppressDowngradeFailure = 1; + } + + if (YesNoType.Yes == suppressRepair) + { + symbol.SuppressRepair = 1; + } + + if (YesNoType.Yes == showVersion) + { + symbol.ShowVersion = 1; + } + + if (YesNoType.Yes == supportCacheOnly) + { + symbol.SupportCacheOnly = 1; + } + } + + var baId = "WixStandardBootstrapperApplication"; + switch (theme) + { + case WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense: + baId = "WixStandardBootstrapperApplication.HyperlinkLargeLicense"; + break; + case WixStandardBootstrapperApplicationTheme.HyperlinkLicense: + baId = "WixStandardBootstrapperApplication.HyperlinkLicense"; + break; + case WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense: + baId = "WixStandardBootstrapperApplication.HyperlinkSidebarLicense"; + break; + case WixStandardBootstrapperApplicationTheme.RtfLargeLicense: + baId = "WixStandardBootstrapperApplication.RtfLargeLicense"; + break; + case WixStandardBootstrapperApplicationTheme.RtfLicense: + baId = "WixStandardBootstrapperApplication.RtfLicense"; + break; + } + + this.CreateBARef(section, sourceLineNumbers, node, baId); + } + } + + /// + /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. + /// + /// The element to parse. + private void ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string logoFile = null; + string themeFile = null; + string localizationFile = null; + WixManagedBootstrapperApplicationHostTheme? theme = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "LogoFile": + logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ThemeFile": + themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LocalizationFile": + localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "none": + theme = WixManagedBootstrapperApplicationHostTheme.None; + break; + case "standard": + theme = WixManagedBootstrapperApplicationHostTheme.Standard; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard")); + theme = WixManagedBootstrapperApplicationHostTheme.Unknown; + break; + } + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + if (!theme.HasValue) + { + theme = WixManagedBootstrapperApplicationHostTheme.Standard; + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + if (!this.Messaging.EncounteredError) + { + if (!String.IsNullOrEmpty(logoFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "PreqbaLogo")) + { + Value = logoFile, + }); + } + + if (!String.IsNullOrEmpty(themeFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "PreqbaThemeXml")) + { + Value = themeFile, + }); + } + + if (!String.IsNullOrEmpty(localizationFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "PreqbaThemeWxl")) + { + Value = localizationFile, + }); + } + + var baId = "WixManagedBootstrapperApplicationHost"; + switch (theme) + { + case WixManagedBootstrapperApplicationHostTheme.Standard: + baId = "WixManagedBootstrapperApplicationHost.Standard"; + break; + } + + this.CreateBARef(section, sourceLineNumbers, node, baId); + } + } + + /// + /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles. + /// + /// The element to parse. + private void ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string logoFile = null; + string themeFile = null; + string localizationFile = null; + var selfContainedDeployment = YesNoType.NotSet; + WixDotNetCoreBootstrapperApplicationHostTheme? theme = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "LogoFile": + logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ThemeFile": + themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LocalizationFile": + localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SelfContainedDeployment": + selfContainedDeployment = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "none": + theme = WixDotNetCoreBootstrapperApplicationHostTheme.None; + break; + case "standard": + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Standard; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard")); + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Unknown; + break; + } + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + if (!theme.HasValue) + { + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Standard; + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + if (!this.Messaging.EncounteredError) + { + if (!String.IsNullOrEmpty(logoFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "DncPreqbaLogo")) + { + Value = logoFile, + }); + } + + if (!String.IsNullOrEmpty(themeFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "DncPreqbaThemeXml")) + { + Value = themeFile, + }); + } + + if (!String.IsNullOrEmpty(localizationFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "DncPreqbaThemeWxl")) + { + Value = localizationFile, + }); + } + + if (YesNoType.Yes == selfContainedDeployment) + { + section.AddSymbol(new WixDncOptionsSymbol(sourceLineNumbers) + { + SelfContainedDeployment = 1, + }); + } + + var baId = "WixDotNetCoreBootstrapperApplicationHost"; + switch (theme) + { + case WixDotNetCoreBootstrapperApplicationHostTheme.Standard: + baId = "WixDotNetCoreBootstrapperApplicationHost.Standard"; + break; + } + + this.CreateBARef(section, sourceLineNumbers, node, baId); + } + } + + private void CreateBARef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string name) + { + var id = this.ParseHelper.CreateIdentifierValueFromPlatform(name, this.Context.Platform, BurnPlatforms.X86 | BurnPlatforms.X64 | BurnPlatforms.ARM64); + if (id == null) + { + this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), node.Name.LocalName)); + } + + if (!this.Messaging.EncounteredError) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBootstrapperApplication, id); + } + } + } +} diff --git a/src/ext/Bal/wixext/BalErrors.cs b/src/ext/Bal/wixext/BalErrors.cs new file mode 100644 index 00000000..bc0186c1 --- /dev/null +++ b/src/ext/Bal/wixext/BalErrors.cs @@ -0,0 +1,61 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using System.Resources; + using WixToolset.Data; + + public static class BalErrors + { + public static Message AttributeRequiresPrereqPackage(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) + { + return Message(sourceLineNumbers, Ids.AttributeRequiresPrereqPackage, "When the {0}/@{1} attribute is specified, the {0}/@PrereqPackage attribute must be set to \"yes\".", elementName, attributeName); + } + + public static Message BAFunctionsPayloadRequiredInUXContainer(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.BAFunctionsPayloadRequiredInUXContainer, "The BAFunctions DLL Payload element must be located inside the BootstrapperApplication container."); + } + + public static Message MissingDNCPrereq() + { + return Message(null, Ids.MissingDNCPrereq, "There must be at least one PrereqPackage when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\"."); + } + + public static Message MissingMBAPrereq() + { + return Message(null, Ids.MissingMBAPrereq, "There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups."); + } + + public static Message MultipleBAFunctions(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.MultipleBAFunctions, "WixStandardBootstrapperApplication doesn't support multiple BAFunctions DLLs."); + } + + public static Message MultiplePrereqLicenses(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.MultiplePrereqLicenses, "There may only be one package in the bundle that has either the PrereqLicenseFile attribute or the PrereqLicenseUrl attribute."); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); + } + + public enum Ids + { + AttributeRequiresPrereqPackage = 6801, + MissingMBAPrereq = 6802, + MultiplePrereqLicenses = 6803, + MultipleBAFunctions = 6804, + BAFunctionsPayloadRequiredInUXContainer = 6805, + MissingDNCPrereq = 6806, + } + } +} diff --git a/src/ext/Bal/wixext/BalExtensionData.cs b/src/ext/Bal/wixext/BalExtensionData.cs new file mode 100644 index 00000000..55daf005 --- /dev/null +++ b/src/ext/Bal/wixext/BalExtensionData.cs @@ -0,0 +1,30 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The WiX Toolset Bal Extension. + /// + public sealed class BalExtensionData : BaseExtensionData + { + /// + /// Gets the default culture. + /// + /// The default culture. + public override string DefaultCulture => "en-US"; + + public override bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) + { + symbolDefinition = BalSymbolDefinitions.ByName(name); + return symbolDefinition != null; + } + + public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) + { + return Intermediate.Load(typeof(BalExtensionData).Assembly, "WixToolset.Bal.bal.wixlib", symbolDefinitions); + } + } +} diff --git a/src/ext/Bal/wixext/BalExtensionFactory.cs b/src/ext/Bal/wixext/BalExtensionFactory.cs new file mode 100644 index 00000000..0bfb6c5f --- /dev/null +++ b/src/ext/Bal/wixext/BalExtensionFactory.cs @@ -0,0 +1,18 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using System.Collections.Generic; + using WixToolset.Extensibility; + + public class BalExtensionFactory : BaseExtensionFactory + { + protected override IReadOnlyCollection ExtensionTypes => new[] + { + typeof(BalCompiler), + typeof(BalExtensionData), + typeof(BalBurnBackendExtension), + }; + } +} diff --git a/src/ext/Bal/wixext/BalWarnings.cs b/src/ext/Bal/wixext/BalWarnings.cs new file mode 100644 index 00000000..18b25062 --- /dev/null +++ b/src/ext/Bal/wixext/BalWarnings.cs @@ -0,0 +1,31 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using System.Resources; + using WixToolset.Data; + + public static class BalWarnings + { + public static Message UnmarkedBAFunctionsDLL(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.UnmarkedBAFunctionsDLL, "WixStandardBootstrapperApplication doesn't automatically load BAFunctions.dll. Use the bal:BAFunctions attribute to indicate that it should be loaded."); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); + } + + public enum Ids + { + UnmarkedBAFunctionsDLL = 6501, + } + } +} diff --git a/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs b/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs new file mode 100644 index 00000000..90865621 --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs @@ -0,0 +1,80 @@ +// 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. + +namespace WixToolset.Bal +{ + using System; + using WixToolset.Data; + using WixToolset.Data.Burn; + + public enum BalSymbolDefinitionType + { + WixBalBAFactoryAssembly, + WixBalBAFunctions, + WixBalCondition, + WixBalPackageInfo, + WixDncOptions, + WixMbaPrereqInformation, + WixStdbaOptions, + WixStdbaOverridableVariable, + } + + public static partial class BalSymbolDefinitions + { + public static readonly Version Version = new Version("4.0.0"); + + public static IntermediateSymbolDefinition ByName(string name) + { + if (!Enum.TryParse(name, out BalSymbolDefinitionType type)) + { + return null; + } + + return ByType(type); + } + + public static IntermediateSymbolDefinition ByType(BalSymbolDefinitionType type) + { + switch (type) + { + case BalSymbolDefinitionType.WixBalBAFactoryAssembly: + return BalSymbolDefinitions.WixBalBAFactoryAssembly; + + case BalSymbolDefinitionType.WixBalBAFunctions: + return BalSymbolDefinitions.WixBalBAFunctions; + + case BalSymbolDefinitionType.WixBalCondition: + return BalSymbolDefinitions.WixBalCondition; + + case BalSymbolDefinitionType.WixBalPackageInfo: + return BalSymbolDefinitions.WixBalPackageInfo; + + case BalSymbolDefinitionType.WixDncOptions: + return BalSymbolDefinitions.WixDncOptions; + + case BalSymbolDefinitionType.WixMbaPrereqInformation: + return BalSymbolDefinitions.WixMbaPrereqInformation; + + case BalSymbolDefinitionType.WixStdbaOptions: + return BalSymbolDefinitions.WixStdbaOptions; + + case BalSymbolDefinitionType.WixStdbaOverridableVariable: + return BalSymbolDefinitions.WixStdbaOverridableVariable; + + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + } + + static BalSymbolDefinitions() + { + WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixBalPackageInfo.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixDncOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + } + } +} diff --git a/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs new file mode 100644 index 00000000..52042e4c --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixBalBAFactoryAssembly = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixBalBAFactoryAssembly.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixBalBAFactorySymbolFields.PayloadId), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBalBAFactorySymbolFields.FilePath), IntermediateFieldType.String), + }, + typeof(WixBalBAFactoryAssemblySymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixBalBAFactorySymbolFields + { + PayloadId, + FilePath, + } + + public class WixBalBAFactoryAssemblySymbol : IntermediateSymbol + { + public WixBalBAFactoryAssemblySymbol() : base(BalSymbolDefinitions.WixBalBAFactoryAssembly, null, null) + { + } + + public WixBalBAFactoryAssemblySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixBalBAFactoryAssembly, sourceLineNumber, id) + { + } + + public IntermediateField this[WixBalBAFactorySymbolFields index] => this.Fields[(int)index]; + + public string PayloadId + { + get => this.Fields[(int)WixBalBAFactorySymbolFields.PayloadId].AsString(); + set => this.Set((int)WixBalBAFactorySymbolFields.PayloadId, value); + } + + public string FilePath + { + get => this.Fields[(int)WixBalBAFactorySymbolFields.FilePath].AsString(); + set => this.Set((int)WixBalBAFactorySymbolFields.FilePath, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixBalBAFunctionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalBAFunctionsSymbol.cs new file mode 100644 index 00000000..19c7602d --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixBalBAFunctionsSymbol.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixBalBAFunctions = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixBalBAFunctions.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixBalBAFunctionsSymbolFields.PayloadId), IntermediateFieldType.String), + }, + typeof(WixBalBAFunctionsSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixBalBAFunctionsSymbolFields + { + PayloadId, + } + + public class WixBalBAFunctionsSymbol : IntermediateSymbol + { + public WixBalBAFunctionsSymbol() : base(BalSymbolDefinitions.WixBalBAFunctions, null, null) + { + } + + public WixBalBAFunctionsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixBalBAFunctions, sourceLineNumber, id) + { + } + + public IntermediateField this[WixBalBAFunctionsSymbolFields index] => this.Fields[(int)index]; + + public string PayloadId + { + get => this.Fields[(int)WixBalBAFunctionsSymbolFields.PayloadId].AsString(); + set => this.Set((int)WixBalBAFunctionsSymbolFields.PayloadId, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixBalConditionSymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalConditionSymbol.cs new file mode 100644 index 00000000..c2527fbc --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixBalConditionSymbol.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixBalCondition = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixBalCondition.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixBalConditionSymbolFields.Condition), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBalConditionSymbolFields.Message), IntermediateFieldType.String), + }, + typeof(WixBalConditionSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixBalConditionSymbolFields + { + Condition, + Message, + } + + public class WixBalConditionSymbol : IntermediateSymbol + { + public WixBalConditionSymbol() : base(BalSymbolDefinitions.WixBalCondition, null, null) + { + } + + public WixBalConditionSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixBalCondition, sourceLineNumber, id) + { + } + + public IntermediateField this[WixBalConditionSymbolFields index] => this.Fields[(int)index]; + + public string Condition + { + get => this.Fields[(int)WixBalConditionSymbolFields.Condition].AsString(); + set => this.Set((int)WixBalConditionSymbolFields.Condition, value); + } + + public string Message + { + get => this.Fields[(int)WixBalConditionSymbolFields.Message].AsString(); + set => this.Set((int)WixBalConditionSymbolFields.Message, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixBalPackageInfoSymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalPackageInfoSymbol.cs new file mode 100644 index 00000000..b09cb191 --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixBalPackageInfoSymbol.cs @@ -0,0 +1,55 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixBalPackageInfo = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixBalPackageInfo.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixBalPackageInfoSymbolFields.PackageId), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBalPackageInfoSymbolFields.DisplayInternalUICondition), IntermediateFieldType.String), + }, + typeof(WixBalPackageInfoSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixBalPackageInfoSymbolFields + { + PackageId, + DisplayInternalUICondition, + } + + public class WixBalPackageInfoSymbol : IntermediateSymbol + { + public WixBalPackageInfoSymbol() : base(BalSymbolDefinitions.WixBalPackageInfo, null, null) + { + } + + public WixBalPackageInfoSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixBalPackageInfo, sourceLineNumber, id) + { + } + + public IntermediateField this[WixBalPackageInfoSymbolFields index] => this.Fields[(int)index]; + + public string PackageId + { + get => this.Fields[(int)WixBalPackageInfoSymbolFields.PackageId].AsString(); + set => this.Set((int)WixBalPackageInfoSymbolFields.PackageId, value); + } + + public string DisplayInternalUICondition + { + get => this.Fields[(int)WixBalPackageInfoSymbolFields.DisplayInternalUICondition].AsString(); + set => this.Set((int)WixBalPackageInfoSymbolFields.DisplayInternalUICondition, value); + } + } +} diff --git a/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs new file mode 100644 index 00000000..b9a41c21 --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixDncOptions = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixDncOptions.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDncOptionsSymbolFields.SelfContainedDeployment), IntermediateFieldType.Number), + }, + typeof(WixDncOptionsSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixDncOptionsSymbolFields + { + SelfContainedDeployment, + } + + public class WixDncOptionsSymbol : IntermediateSymbol + { + public WixDncOptionsSymbol() : base(BalSymbolDefinitions.WixDncOptions, null, null) + { + } + + public WixDncOptionsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixDncOptions, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDncOptionsSymbolFields index] => this.Fields[(int)index]; + + public int SelfContainedDeployment + { + get => this.Fields[(int)WixDncOptionsSymbolFields.SelfContainedDeployment].AsNumber(); + set => this.Set((int)WixDncOptionsSymbolFields.SelfContainedDeployment, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs b/src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs new file mode 100644 index 00000000..e4d78da0 --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs @@ -0,0 +1,63 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixMbaPrereqInformation = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixMbaPrereqInformation.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixMbaPrereqInformationSymbolFields.PackageId), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixMbaPrereqInformationSymbolFields.LicenseFile), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixMbaPrereqInformationSymbolFields.LicenseUrl), IntermediateFieldType.String), + }, + typeof(WixMbaPrereqInformationSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixMbaPrereqInformationSymbolFields + { + PackageId, + LicenseFile, + LicenseUrl, + } + + public class WixMbaPrereqInformationSymbol : IntermediateSymbol + { + public WixMbaPrereqInformationSymbol() : base(BalSymbolDefinitions.WixMbaPrereqInformation, null, null) + { + } + + public WixMbaPrereqInformationSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixMbaPrereqInformation, sourceLineNumber, id) + { + } + + public IntermediateField this[WixMbaPrereqInformationSymbolFields index] => this.Fields[(int)index]; + + public string PackageId + { + get => this.Fields[(int)WixMbaPrereqInformationSymbolFields.PackageId].AsString(); + set => this.Set((int)WixMbaPrereqInformationSymbolFields.PackageId, value); + } + + public string LicenseFile + { + get => this.Fields[(int)WixMbaPrereqInformationSymbolFields.LicenseFile].AsString(); + set => this.Set((int)WixMbaPrereqInformationSymbolFields.LicenseFile, value); + } + + public string LicenseUrl + { + get => this.Fields[(int)WixMbaPrereqInformationSymbolFields.LicenseUrl].AsString(); + set => this.Set((int)WixMbaPrereqInformationSymbolFields.LicenseUrl, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixStdbaOptionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixStdbaOptionsSymbol.cs new file mode 100644 index 00000000..cb2694da --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixStdbaOptionsSymbol.cs @@ -0,0 +1,79 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixStdbaOptions = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixStdbaOptions.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixStdbaOptionsSymbolFields.SuppressOptionsUI), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixStdbaOptionsSymbolFields.SuppressDowngradeFailure), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixStdbaOptionsSymbolFields.SuppressRepair), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixStdbaOptionsSymbolFields.ShowVersion), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixStdbaOptionsSymbolFields.SupportCacheOnly), IntermediateFieldType.Number), + }, + typeof(WixStdbaOptionsSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixStdbaOptionsSymbolFields + { + SuppressOptionsUI, + SuppressDowngradeFailure, + SuppressRepair, + ShowVersion, + SupportCacheOnly, + } + + public class WixStdbaOptionsSymbol : IntermediateSymbol + { + public WixStdbaOptionsSymbol() : base(BalSymbolDefinitions.WixStdbaOptions, null, null) + { + } + + public WixStdbaOptionsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixStdbaOptions, sourceLineNumber, id) + { + } + + public IntermediateField this[WixStdbaOptionsSymbolFields index] => this.Fields[(int)index]; + + public int SuppressOptionsUI + { + get => this.Fields[(int)WixStdbaOptionsSymbolFields.SuppressOptionsUI].AsNumber(); + set => this.Set((int)WixStdbaOptionsSymbolFields.SuppressOptionsUI, value); + } + + public int SuppressDowngradeFailure + { + get => this.Fields[(int)WixStdbaOptionsSymbolFields.SuppressDowngradeFailure].AsNumber(); + set => this.Set((int)WixStdbaOptionsSymbolFields.SuppressDowngradeFailure, value); + } + + public int SuppressRepair + { + get => this.Fields[(int)WixStdbaOptionsSymbolFields.SuppressRepair].AsNumber(); + set => this.Set((int)WixStdbaOptionsSymbolFields.SuppressRepair, value); + } + + public int ShowVersion + { + get => this.Fields[(int)WixStdbaOptionsSymbolFields.ShowVersion].AsNumber(); + set => this.Set((int)WixStdbaOptionsSymbolFields.ShowVersion, value); + } + + public int SupportCacheOnly + { + get => this.Fields[(int)WixStdbaOptionsSymbolFields.SupportCacheOnly].AsNumber(); + set => this.Set((int)WixStdbaOptionsSymbolFields.SupportCacheOnly, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/Symbols/WixStdbaOverridableVariableSymbol.cs b/src/ext/Bal/wixext/Symbols/WixStdbaOverridableVariableSymbol.cs new file mode 100644 index 00000000..1d84d1aa --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixStdbaOverridableVariableSymbol.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolset.Bal +{ + using WixToolset.Data; + using WixToolset.Bal.Symbols; + + public static partial class BalSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixStdbaOverridableVariable = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixStdbaOverridableVariable.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixStdbaOverridableVariableSymbolFields.Name), IntermediateFieldType.String), + }, + typeof(WixStdbaOverridableVariableSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixStdbaOverridableVariableSymbolFields + { + Name, + } + + public class WixStdbaOverridableVariableSymbol : IntermediateSymbol + { + public WixStdbaOverridableVariableSymbol() : base(BalSymbolDefinitions.WixStdbaOverridableVariable, null, null) + { + } + + public WixStdbaOverridableVariableSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixStdbaOverridableVariable, sourceLineNumber, id) + { + } + + public IntermediateField this[WixStdbaOverridableVariableSymbolFields index] => this.Fields[(int)index]; + + public string Name + { + get => this.Fields[(int)WixStdbaOverridableVariableSymbolFields.Name].AsString(); + set => this.Set((int)WixStdbaOverridableVariableSymbolFields.Name, value); + } + } +} \ No newline at end of file diff --git a/src/ext/Bal/wixext/WixToolset.Bal.wixext.csproj b/src/ext/Bal/wixext/WixToolset.Bal.wixext.csproj new file mode 100644 index 00000000..00451403 --- /dev/null +++ b/src/ext/Bal/wixext/WixToolset.Bal.wixext.csproj @@ -0,0 +1,39 @@ + + + + + + netstandard2.0 + WixToolset.Bal + WiX Toolset Bal Extension + WiX Toolset Bal Extension + embedded + $(MSBuildThisFileName).nuspec + true + Id=$(MSBuildThisFileName);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);Title=$(Title) + + + + + + + + + + + + + + + + + + + + + + $(OutputPath)..\ + $(NuspecProperties);Version=$(BuildVersionSimple);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);ProjectFolder=$(MSBuildThisFileDirectory) + + + diff --git a/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec b/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec new file mode 100644 index 00000000..d9e704ae --- /dev/null +++ b/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec @@ -0,0 +1,26 @@ + + + + $id$ + $version$ + $authors$ + $authors$ + MS-RL + https://github.com/wixtoolset/Bal.wixext + false + $title$ + $description$ + $copyright$ + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixext/WixToolset.Bal.wixext.targets b/src/ext/Bal/wixext/WixToolset.Bal.wixext.targets new file mode 100644 index 00000000..70c5a19c --- /dev/null +++ b/src/ext/Bal/wixext/WixToolset.Bal.wixext.targets @@ -0,0 +1,11 @@ + + + + + + $(MSBuildThisFileDirectory)..\tools\WixToolset.Bal.wixext.dll + + + + + diff --git a/src/ext/Bal/wixlib/BalExtension_arm64.wxs b/src/ext/Bal/wixlib/BalExtension_arm64.wxs new file mode 100644 index 00000000..1b9e11d2 --- /dev/null +++ b/src/ext/Bal/wixlib/BalExtension_arm64.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/wixlib/BalExtension_platform.wxi b/src/ext/Bal/wixlib/BalExtension_platform.wxi new file mode 100644 index 00000000..33122fb2 --- /dev/null +++ b/src/ext/Bal/wixlib/BalExtension_platform.wxi @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixlib/BalExtension_x64.wxs b/src/ext/Bal/wixlib/BalExtension_x64.wxs new file mode 100644 index 00000000..69a597ae --- /dev/null +++ b/src/ext/Bal/wixlib/BalExtension_x64.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/wixlib/BalExtension_x86.wxs b/src/ext/Bal/wixlib/BalExtension_x86.wxs new file mode 100644 index 00000000..3cdd4015 --- /dev/null +++ b/src/ext/Bal/wixlib/BalExtension_x86.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/wixlib/Dnc.wxs b/src/ext/Bal/wixlib/Dnc.wxs new file mode 100644 index 00000000..d777c473 --- /dev/null +++ b/src/ext/Bal/wixlib/Dnc.wxs @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixlib/Mba.wxs b/src/ext/Bal/wixlib/Mba.wxs new file mode 100644 index 00000000..2d407c88 --- /dev/null +++ b/src/ext/Bal/wixlib/Mba.wxs @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixlib/bal.wixproj b/src/ext/Bal/wixlib/bal.wixproj new file mode 100644 index 00000000..fdcc7475 --- /dev/null +++ b/src/ext/Bal/wixlib/bal.wixproj @@ -0,0 +1,36 @@ + + + + Library + true + en-us + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/wixlib/caDecor.wxi b/src/ext/Bal/wixlib/caDecor.wxi new file mode 100644 index 00000000..b1711518 --- /dev/null +++ b/src/ext/Bal/wixlib/caDecor.wxi @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixlib/wixstdba.wxs b/src/ext/Bal/wixlib/wixstdba.wxs new file mode 100644 index 00000000..8181b9b4 --- /dev/null +++ b/src/ext/Bal/wixlib/wixstdba.wxs @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl new file mode 100644 index 00000000..abd35ac7 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl @@ -0,0 +1,27 @@ + + + + + + [WixBundleName] 安裝程式 + [WixBundleName] 安裝程式需要 Microsoft .NET Framework + 您確定要取消嗎? + 安裝程式說明 + /passive | /quiet - 顯示最基本的 UI 但不顯示提示,或者不顯示 UI 也 + 不顯示提示。預設會顯示 UI 和所有提示。 + +/norestart - 隱藏任何重新啟動嘗試。根據預設,UI 會在重新啟動之前提示。 +/log log.txt - 記錄至特定檔案。預設會在 %TEMP% 建立記錄檔。 + 關閉(&C) + 請按一下 「接受並安裝」5D; 按鈕,接受 Microsoft .NET Framework <a href="#">授權合約</a>。 + 接受並安裝(&A) + 拒絕(&D) + 安裝進度 + 正在處理: + 取消(&) + 安裝失敗 + 一或多個問題導致安裝失敗。請修正這些問題,然後再重試安裝。如需詳細資訊,請查看<a href="#">記錄檔</a>。 + 必須重新啟動電腦,才能完成軟體的復原。 + 重新啟動(&R) + 關閉(&C) + diff --git a/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl new file mode 100644 index 00000000..e28b4f74 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + Instalace produktu [WixBundleName] + Pro instalaci produktu [WixBundleName] je vyžadováno rozhraní Microsoft .NET Framework. + Opravdu chcete akci zrušit? + Nápověda k instalaci + /passive | /quiet - Zobrazí minimální uživatelské rozhraní bez jakýchkoli + výzev, nebo nezobrazí žádné uživatelské rozhraní ani žádné výzvy. Ve výchozím + nastavení se jak uživatelské rozhraní, tak i všechny výzvy zobrazují. + +/norestart - Potlačí jakékoli pokusy o restartování. Ve výchozím nastavení + se v uživatelském rozhraní před restartováním zobrazí výzva. +/log log.txt - Nastaví, že se má zapisovat do konkrétního souboru protokolu. + Ve výchozím nastavení je soubor protokolu vytvořen v umístění %TEMP%. + &Zavřít + Kliknutím na tlačítko Přijmout a nainstalovat přijmete <a href="#">licenční podmínky</a> rozhraní Microsoft .NET Framework. + &Přijmout a instalovat + &Odmítnout + Průběh instalace + Probíhá zpracování: + &Storno + Instalace se nezdařila + Byly zjištěny problémy, kvůli kterým se instalaci nepodařilo dokončit. Odstraňte tyto problémy a potom instalaci opakujte. Další informace naleznete v <a href="#">souboru protokolu</a>. + Aby bylo možné zrušení instalace softwaru dokončit, je nutné počítač restartovat. + &Restartovat + &Zavřít + diff --git a/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl new file mode 100644 index 00000000..a531467a --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + Installation af [WixBundleName] + Microsoft .NET Framework skal være installeret i forbindelse med Installationen af [WixBundleName] + Er du sikker på, at du vil annullere? + Hjælp til installation + /passive | /quiet - viser en minimal brugergrænseflade uden prompter eller + viser ingen brugergrænseflade og ingen prompter. + Brugergrænsefladen og alle prompter vises som standard. + +/norestart - skjuler forsøg på genstart. Der vises som standard en + forespørgsel i brugergrænsefladen, før der genstartes. +/log log.txt - logfører til en bestemt fil. Der oprettes som standard en + logfil i %TEMP%. + &Luk + Klik på knappen "Acceptér og installér" for at acceptere <a href="#">licensvilkårene</a> for Microsoft .NET Framework. + &Acceptér og installér + &Afvis + Status for installation + Behandler: + &Annuller + Installationen blev ikke gennemført + Installationen blev ikke gennemført på grund af et eller flere problemer. Løs problemerne, og prøv derefter at installere igen. Se <a href="#">logfilen</a> for at få flere oplysninger. + Du skal genstarte computeren for at fuldføre annulleringen af opdateringen af softwaren. + &Genstart + &Luk + diff --git a/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl new file mode 100644 index 00000000..ff8111f9 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl @@ -0,0 +1,33 @@ + + + + + + + + [WixBundleName]-Setup + Für das [WixBundleName]-Setup ist Microsoft .NET Framework erforderlich. + Sind Sie sicher, dass Sie den Vorgang abbrechen möchten? + Setup-Hilfe + /passive | /quiet - zeigt eine minimale Benutzeroberfläche ohne + Eingabeaufforderungen oder keine Benutzeroberfläche und keine + Eingabeaufforderungen an. Standardmäßig werden die Benutzeroberfläche und + alle Eingabeaufforderungen angezeigt. + +/norestart - unterdrückt alle Neustartversuche. Standardmäßig fordert die + Benutzeroberfläche zum Bestätigen eines Neustarts auf. +/log log.txt - erstellt das Protokoll in einer bestimmten Datei. + Standardmäßig wird die Protokolldatei in "%TEMP%" erstellt. + &Schließen + Klicken Sie auf die Schaltfläche "Akzeptieren und installieren", um den Microsoft .NET Framework <a href="#">-Lizenzbedingungen</a> zuzustimmen. + &Akzeptieren und installieren + &Ablehnen + Setup-Status + Verarbeitung: + &Abbrechen + Setup-Fehler + Beim Setup ist aufgrund mindestens eines Problems ein Fehler aufgetreten. Beheben Sie die Probleme, und wiederholen Sie das Setup. Weitere Informationen finden Sie in der <a href="#">Protokolldatei</a>. + Sie müssen den Computer neu starten, um das Zurücksetzen der Software abzuschließen. + &Neu starten + &Schließen + diff --git a/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl new file mode 100644 index 00000000..bc3703a3 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl @@ -0,0 +1,32 @@ + + + + + + Εγκατάσταση του [WixBundleName] + Για την εγκατάσταση του [WixBundleName] απαιτείται το Microsoft .NET Framework + Είστε βέβαιοι ότι θέλετε να γίνει ακύρωση; + Βοήθεια για την εγκατάσταση + /passive | /quiet - εμφανίζει ελάχιστο περιεχόμενο του περιβάλλοντος εργασίας + χρήστη χωρίς μηνύματα ή δεν εμφανίζει περιβάλλον εργασίας χρήστη και + μηνύματα. Από προεπιλογή, εμφανίζονται όλα τα μηνύματα και το περιβάλλον + εργασίας χρήστη. + +/norestart - αποκρύπτει οποιεσδήποτε προσπάθειες για επανεκκίνηση. Από + προεπιλογή, το περιβάλλον εργασίας χρήστη θα εμφανίσει μήνυμα πριν από την + επανεκκίνηση. +/log log.txt - πραγματοποιεί καταγραφή σε ένα συγκεκριμένο αρχείο. Από + προεπιλογή, δημιουργείται ένα αρχείο καταγραφής στο %TEMP%. + &Κλείσιμο + Κάντε κλικ στο κουμπί "Αποδοχή και εγκατάσταση" για να αποδεχτείτε τους <a href="#">όρους της άδειας χρήσης</a> του Microsoft .NET Framework. + &Αποδοχή και εγκατάσταση + &Απόρριψη + Πρόοδος εγκατάστασης + Επεξεργασία: + &Άκυρο + Αποτυχία εγκατάστασης + Ένα ή περισσότερα προβλήματα προκάλεσαν την αποτυχία της εγκατάστασης. Διορθώστε τα προβλήματα και μετά επαναλάβετε την εγκατάσταση. Για περισσότερες πληροφορίες, ανατρέξτε στο <a href="#">αρχείο καταγραφής</a>. + Για να ολοκληρωθεί η επαναφορά του λογισμικού, πρέπει να κάνετε επανεκκίνηση του υπολογιστή. + &Επανεκκίνηση + &Κλείσιμο + diff --git a/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl new file mode 100644 index 00000000..859e5b23 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] -asennus + Microsoft .NET Framework tarvitaan [WixBundleName] -asennusta varten + Haluatko varmasti peruuttaa? + Asennusohjelman ohje + /passive | /quiet - näyttää mahdollisimman vähän käyttöliittymästä; ei + kehotteita tai ei käyttöliittymää ja kehotteita. Oletusarvoisesti + käyttöliittymä ja kaikki kehotteet näytetään. + +/norestart - estää uudelleenkäynnistysyritykset. Oletusarvoisesti + käyttöliittymä kysyy ennen uudelleenkäynnistystä. +/log loki.txt - kirjaa lokitiedot erityiseen tiedostoon. Oletusarvoisesti + lokitiedosto luodaan %TEMP%-kansioon. + &Sulje + Hyväksy Microsoft .NET Framework -ohjelman <a href="#">käyttöoikeusehdot</a> valitsemalla Hyväksy ja asenna. + &Hyväksy ja asenna + &Hylkää + Asennuksen edistyminen + Käsitellään: + &Peruuta + Asennus epäonnistui + Asennus epäonnistui yhdestä tai useammasta syystä. Korjaa ongelmat ja yritä suorittaa asennus sitten uudelleen. Lisätietoja on <a href="#">lokitiedostossa</a>. + Tietokone täytyy käynnistää uudelleen ohjelmiston palautuksen viimeistelemiseksi. + &Käynnistä uudelleen + &Sulje + diff --git a/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl new file mode 100644 index 00000000..f67dfa8e --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + Installation de [WixBundleName] + Microsoft .NET Framework requis pour l'installation de [WixBundleName] + Êtes-vous sûr de vouloir annuler ? + Aide de l'installation + /passive | /quiet - affiche une interface minimale sans invites ou n'affiche + aucune interface ni aucune invite. Par défaut, l'interface et toutes les + invites sont affichées. + +/norestart - annule toute tentative de redémarrage. Par défaut, l'interface + affiche une invite avant de redémarrer. +/log journal.txt - consigne les entrées de journal dans un fichier spécifique. + Par défaut, un fichier journal est créé dans %TEMP%. + &Fermer + Cliquez sur le bouton « Accepter et installer » pour accepter les <a href="#">termes du contrat de licence</a> Microsoft .NET Framework. + &Accepter et installer + &Refuser + Progression de l'installation + Traitement en cours : + &Annuler + L'installation a échoué + L'installation a échoué pour une ou plusieurs raisons. Corrigez les problèmes et recommencez l'installation. Pour plus d'informations, consultez le <a href="#">fichier journal</a>. + Vous devez redémarrer votre ordinateur pour effectuer la restauration du logiciel. + &Redémarrer + &Fermer + diff --git a/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl new file mode 100644 index 00000000..6a4b109d --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] telepítő + A(z) [WixBundleName] telepítéséhez Microsoft .NET-keretrendszer szükséges + Biztosan megszakítja? + A telepítő súgója + /passive | /quiet - Minimális felhasználói felület megjelenítése kérdések + nélkül, illetve felhasználói felület és kérdések megjelenítése nélküli + telepítés. Alapesetben a felhasználói felület és minden kérdés megjelenik. + +/norestart - Az újraindítási kérések elrejtése. Alapesetben a felhasználói + felületen megjelennek az újraindítási kérések. +/log naplo.txt - Naplózás a megadott fájlba. Alapesetben a naplófájl a %TEMP% + könyvtárban jön létre. + &Bezárás + A Microsoft .NET-keretrendszer <a href="#">licencszerződésének</a> elfogadásához kattintson az „Elfogadás és telepítés” gombra. + &Elfogadás és telepítés + &Elutasítás + Telepítési folyamat + Feldolgozás: + &Mégse + A telepítés nem sikerült + Legalább egy olyan hiba lépett fel, amely a telepítés meghiúsulását okozta. Hárítsa el a hibákat, majd futtassa újra a telepítőt. További információt a <a href="#">naplófájlban </a> talál. + A szoftver visszaállításának befejezéséhez újra kell indítania a számítógépet. + &Újraindítás + &Bezárás + diff --git a/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl new file mode 100644 index 00000000..f57d58e5 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl @@ -0,0 +1,31 @@ + + + + + + Installazione di [WixBundleName] + Microsoft .NET Framework necessario per l'installazione di [WixBundleName] + Annullare? + Guida dell'installazione + /passive | /quiet - visualizza l'interfaccia utente minima senza istruzioni + oppure non visualizza né l'interfaccia utente né le istruzioni. Per + impostazione predefinita vengono visualizzate interfaccia utente e + istruzioni. + +/norestart - elimina eventuali tentativi di riavvio. Per impostazione + predefinita l'interfaccia utente chiede istruzioni prima del riavvio. +/log log.txt - registra in un file specifico. Per impostazione predefinita un + file di log viene creato in %TEMP%. + &Chiudi + Fare clic sul pulsante "Accetta e installa" per accettare le <a href="#">condizioni di licenza</a> di Microsoft .NET Framework. + &Accetta e installa + &Rifiuta + Stato installazione + Elaborazione in corso: + &Annulla + Installazione non riuscita + L'installazione non è riuscita a causa di uno o più problemi. Risolvere i problemi e provare di nuovo l'installazione. Per ulteriori informazioni vedere il <a href="#">file di log</a>. + È necessario riavviare il computer per completare il rollback del software. + &Riavvia + &Chiudi + diff --git a/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl new file mode 100644 index 00000000..3fe7b9b3 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl @@ -0,0 +1,27 @@ + + + + + + [WixBundleName] セットアップ + [WixBundleName] セットアップには Microsoft .NET Framework が必要です + 取り消しますか? + セットアップのヘルプ + /passive | /quiet - 最小の UI だけを表示してプロンプトは表示しないか、UI + もプロンプトも表示しません。 既定では、UI とすべてのプロンプトが表示されます。 + +/norestart - 再起動の試みをすべて抑制します。既定では、再起動の前に UI によりプロンプトが表示されます。 +/log log.txt - 特定のファイルにログを記録します。既定では、%TEMP% にログ ファイルが作成されます。 + 閉じる(&C) + Microsoft .NET Framework の<a href="#">ライセンス条項</a>に同意する場合は、[同意してインストール]5D; ボタンをクリックします。 + 同意してインストール(&A) + 同意しない(&) + セットアップの進行状況 + 処理中: + キャンセル(&C) + セットアップに失敗しました + 1 つ以上の問題が原因でセットアップに失敗しました。問題を解決してからセットアップをやり直してください。詳細については、<a href="#">ログ ファイル</a>を参照してください。 + ソフトウェアのロールバックを完了するには、コンピューターを再起動する必要があります。 + 再起動(&R) + 閉じる(&C) + diff --git a/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl new file mode 100644 index 00000000..0f53dcc3 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl @@ -0,0 +1,27 @@ + + + + + + [WixBundleName] 설치 + [WixBundleName] 설치에 필요한 Microsoft .NET Framework + 취소하시겠습니까? + 설치 도움말 + /passive | /quiet - 메시지 없이 최소 UI를 표시하거나 UI와 메시지를 전혀 + 표시하지 않습니다. 기본적으로 UI 및 모든 메시지는 표시됩니다. + +/norestart - 다시 시작하려는 시도를 무시합니다. 기본적으로 UI는 다시 시작하기 전에 메시지를 표시합니다. +/log log.txt - 특정 파일에 기록합니다. 기본적으로 로그 파일이 %TEMP%에 생성됩니다. + 닫기(&C) + Microsoft .NET Framework <a href="#">사용 조건</a>에 동의하려면 "동의 및 설치"를 클릭하십시오. + 동의 및 설치(&A) + 동의 안 함(&D) + 설치 진행률 + 처리 중: + 취소(&C) + 설치 실패 + 하나 이상의 문제로 인해 설치에 실패했습니다. 문제를 수정하고 설치를 다시 시도하십시오. 자세한 내용은 <a href="#">로그 파일</a>을 참조하십시오. + 소프트웨어의 롤백을 완료하려면 컴퓨터를 다시 시작해야 합니다. + 다시 시작(&R) + 닫기(&C) + diff --git a/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl new file mode 100644 index 00000000..f4a2c78c --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] Installatie + Microsoft .NET Framework is vereist voor installatie [WixBundleName] + Weet u zeker dat u de installatie wilt annuleren? + Help bij Setup + /passive | /quiet - geeft een minimale gebruikersinterface weer zonder prompts + of geeft geen gebruikersinterface en geen prompts weer. Gebruikersinterface + en alle prompts worden standaard weergegeven. + +/norestart - pogingen tot opnieuw opstarten onderdrukken. + Gebruikersinterface vraagt standaard alvorens opnieuw op te starten. +/log log.txt - registreert gegevens in een specifiek bestand. Een logbestand + wordt standaard in %TEMP% gemaakt. + &Sluiten + Klik op de knop 'Accepteren en installeren' om de <a href="#">licentievoorwaarden</a> van het Microsoft .NET Framework te accepteren. + &Accepteren en installeren + &Weigeren + Voortgang van de installatie + Verwerken: + &Annuleren + Installatie mislukt + Er zijn een of meer fouten opgetreden waardoor de installatie is mislukt. Corrigeer de problemen en voer Setup opnieuw uit. Raadpleeg het <a href="#">log boekbestand</a> voor meer informatie. + U moet uw computer opnieuw opstarten om het terugdraaien van de software te voltooien. + &Opnieuw opstarten + &Sluiten + diff --git a/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl new file mode 100644 index 00000000..da5c8283 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] Installasjonsprogram + Microsoft .NET Framework kreves for [WixBundleName]-installasjon + Er du sikker på at du vil avbryte? + Installasjonshjelp + /passive | /quiet - viser minimalt brukergrensesnitt uten ledetekster, eller + ikke noe brukergrensesnitt og ingen ledetekster. Som standard vises + brukergrensesnitt og alle ledetekster. + +/norestart - undertrykker alle forsøk på omstart. Som standard spør + brukergrensesnittet før omstart. +/log log.txt - skriver logg til en bestemt fil. Som standard opprettes en + loggfil i %TEMP%. + &Lukk + Klikk Godta og installer for å godta<a href="#">lisensvilkårene</a> for Microsoft .NET Framework. + &Godta og installer + &Avslå + Fremdrift for installasjon + Behandler: + &Avbryt + Installasjon mislyktes + Ett eller flere problemer var årsak til at installasjonen mislyktes. Løs problemene, og installer på nytt. Du finner flere opplysninger i <a href="#">loggfilen</a>. + Du må starte datamaskinen på nytt for å fullføre tilbakerullingen av programvaren. + &Start på nytt + &Lukk + diff --git a/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl new file mode 100644 index 00000000..7aca87c2 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + Instalator programu [WixBundleName] + Do zainstalowania programu [WixBundleName] jest wymagany program Microsoft .NET Framework + Czy na pewno chcesz anulować? + Pomoc instalatora + /passive | /quiet - wyświetla minimalny interfejs użytkownika bez monitów + lub nie wyświetla interfejsu użytkownika ani monitów. Domyślnie jest + wyświetlany interfejs użytkownika i wszystkie monity. + +/norestart - pomija wszelkie próby ponownego uruchomienia. Domyślnie + interfejs użytkownika będzie wyświetlał monit przed ponownym uruchomieniem. +/log log.txt - zapisuje wpisy dziennika do określonego pliku. + Domyślnie plik dziennika jest tworzony w folderze %TEMP%. + &Zamknij + Kliknij przycisk Zaakceptuj i zainstaluj, aby zaakceptować <a href="#">warunki licencji</a> programu Microsoft .NET Framework. + &Zaakceptuj i zainstaluj + &Odrzuć + Postęp instalacji + Trwa przetwarzanie: + &Anuluj + Instalacja nie powiodła się + Co najmniej jeden problem spowodował niepowodzenie instalacji. Usuń problemy, a następnie ponów próbę instalacji. Aby uzyskać więcej informacji można znaleźć w <a href="#">pliku dziennika</a>. + Aby zakończyć wycofywanie oprogramowania, musisz ponownie uruchomić komputer. + &Uruchom ponownie + &Zamknij + diff --git a/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl new file mode 100644 index 00000000..be185502 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl @@ -0,0 +1,29 @@ + + + + + + [WixBundleName] Instalação + Microsoft .NET Framework é necessário para instalação do [WixBundleName] + Tem certeza de que deseja cancelar? + Ajuda da Instalação + /passive | /quiet - exibe UI mínima sem avisos ou exibe sem UI e + sem avisos. Por padrão a UI e todos avisos são exibidos. + +/norestart - suprime qualquer tentativa de reinicialização. Por padrão a UI + irá solicitar antes de reiniciar. +/log log.txt - logs para um arquivo específico. Por padrão um arquivo de log é + criado em %TEMP%. + &Fechar + Clique o botão "Aceitar e Instalar" para aceitar os termos de licença do Microsoft .NET Framework <a href="#"></a>. + &Aceitar e Instalar + &Recusar + Progresso da Instalação + Processando: + &Cancelar + Falha na Instalação + Um ou mais problemas causaram falha na instalação. Corrija os problemas e tente a instalação novamente. Para mais informações consulte o <a href="#">arquivo de log</a>. + Você deve reiniciar o computador para completar a reversão do software. + &Reiniciar + &Fechar + diff --git a/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl new file mode 100644 index 00000000..a1aec7ed --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl @@ -0,0 +1,29 @@ + + + + + + Установка [WixBundleName] + Для установки [WixBundleName] требуется Microsoft .NET Framework + Вы действительно хотите отменить операцию? + Справка по установке + /passive | /quiet - отображение минимального ИП без запросов или работа без ИП + и беззапросов. По умолчанию отображаются ИП и все запросы. + +/norestart - отключение всех попыток перезагрузки. По умолчанию в ИП перед + перезагрузкой отображается запрос. +/log log.txt - запись журнала в указанный файл. По умолчанию файл журнала + создается в папке %TEMP%. + &Закрыть + Нажмите кнопку "Принять и установить", чтобы принять <a href="#">условия лицензии</a> Microsoft .NET Framework. + &Принять и установить + &Отклонить + Выполнение установки + Обработка: + &Отмена + Сбой установки + Не удалось выполнить установку из-за одной или нескольких проблем. Устраните эти проблемы, а затем снова запустите программу установки. Дополнительные сведения см. в <a href="#">файле журнала</a>. + Необходимо перезагрузить компьютер, чтобы завершить откат программного обеспечения. + &Перезагрузить + &Закрыть + diff --git a/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl new file mode 100644 index 00000000..9f0b4711 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] – inštalácia + Na inštaláciu aplikácie [WixBundleName] sa vyžaduje súčasť Microsoft .NET Framework + Naozaj chcete zrušiť operáciu? + Pomocník pre inštaláciu + /passive | /quiet – zobrazí minimálne používateľské rozhranie bez výziev alebo + nezobrazí žiadne používateľské rozhranie ani výzvy. Predvolene sa + zobrazuje používateľské rozhranie aj všetky výzvy. + +/norestart – zruší všetky pokusy o reštart. Používateľské rozhranie + predvolene zobrazí pred reštartom výzvu. +/log log.txt – urobí záznam do určeného súboru. Súbor denníka sa predvolene + vytvorí v priečinku %TEMP%. + &Zavrieť + Kliknutím na tlačidlo Súhlasiť a inštalovať vyjadrite svoj súhlas s <a href="#">licenčnými podmienkami</a> súčasti Microsoft .NET Framework. + &Súhlasiť a inštalovať + &Odmietnuť + Priebeh inštalácie + Spracúva sa: + &Zrušiť + Inštalácia zlyhala + Inštalácia zlyhala pre jednu alebo viac príčin. Odstráňte problémy a skúste znova spustiť inštaláciu. Ďalšie informácie nájdete v <a href="#">súbore denníka</a>. + Dokončenie všetkých zmien softvéru vyžaduje reštart počítača. + &Reštartovať + &Zavrieť + diff --git a/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl new file mode 100644 index 00000000..72961409 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName]-installation + Microsoft .NET Framework krävs för installation av [WixBundleName] + Vill du avbryta? + Installationshjälp + /passive | /quiet - visar ett minimalt användargränssnitt utan prompter, + alternativt inget användargränssnitt och inga prompter. Som standard visas + användargränssnitt och samtliga prompter. + +/norestart - hejdar omstart. Som standard visar användargränssnittet en + prompt före omstart. +/log log.txt - skapar logg till en specifik fil. Som standard skapas loggfilen + i %TEMP%. + &Stäng + Klicka på knappen "Godkänn och installera" för att godkänna <a href="#">licensvillkoren</a> för Microsoft .NET Framework. + &Godkänn och installera + &Avbryt + Installationsförlopp + Bearbetar: + &Avbryt + Installationen misslyckades + Installationen misslyckades på grund av ett eller flera problem. Åtgärda problemen och försök igen. Se <a href="#">loggfilen</a> för mer information. + Starta om datorn för att återställa programmet. + &Starta om + &Stäng + diff --git a/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl new file mode 100644 index 00000000..ee52da98 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] Kurulumu + [WixBundleName] kurulumu için Microsoft .NET Framework gerekir + İptal etmek istediğinizden emin misiniz? + Kurulum Yardımı + /passive | /quiet - komut istemi olmayan olabildiğince küçük bir UI + görüntüler veya komut istemi ve UI görüntülemez. Varsayılan olarak UI + ve tüm komut istemleri görüntülenir. + +/norestart - yeniden başlatma denemelerini engeller. Varsayılan + olarak UI yeniden başlatmadan önce komut isteyecektir. +/log log.txt - belirli bir dosyayı günlük dosyası olarak kullanır. + Varsayılan olarak %TEMP% konumunda bir günlük dosyası oluşturulur. + &Kapat + Microsoft .NET Framework <a href="#">lisans şartlarını</a> kabul etmek için "Kabul Et ve Yükle" düğmesini tıklatın. + &Kabul Et ve Yükle + &Reddet + Kurulum İlerleme Durumu + İşleniyor: + &İptal + Kurulum Başarısız + Bir veya daha fazla sorun kurulumun başarısız olmasına neden oldu. Lütfen sorunları çözün ve kurulumu yeniden deneyin. Daha fazla bilgi için <a href="#">günlük dosyasına</a> bakın. + Yazılım geri alma işlemini tamamlamak için bilgisayarınızı yeniden başlatmanız gerekir. + &Yeniden Başlat + &Kapat + diff --git a/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl new file mode 100644 index 00000000..f3b4bfe5 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl @@ -0,0 +1,30 @@ + + + + + + [WixBundleName] Namestitev + Microsoft .NET Framework, potreben za namestitev paketa [WixBundleName] + Ali ste prepričani, da želite preklicati? + Pomoč za namestitev + /passive | /quiet - prikaže minimalni uporabniški vmesnik brez pozivov ali ne prikaže + uporabniškega vmesnika in pozivov. Privzeto so prikazani uporabniški vmesnik in + vsi pozivi. + +/norestart - skrije vse možnosti za vnovicni zagon. Privzeto uporabniški vmesnik + prikaže poziv pred ponovnim zagonom. +/log log.txt - beleži vnose v dnevnik v doloceno datoteko. Privzeto je datoteko + ustvarjena v mapi %TEMP%. + &Zapri + Kliknite »Sprejmi in namesti« in sprejmite <a href="#">licenčne pogoje</a> za Microsoft .NET Framework. + &Sprejmi in namesti + &Zavrni + Potek namestitve + Obdelovanje: + &Prekliči + Namestitev ni uspela + Namestitev ni uspela zaradi ene ali več težav. Odpravite težave in ponovno zaženite namestitev. Za več informacij glejte <a href="#">dnevniško datoteko</a>. + Za povrnitev prejšnjega stanja programske opreme morate ponovno zagnati računalnik. + &Ponovni zagon + &Zapri + diff --git a/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl new file mode 100644 index 00000000..63cdb418 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl @@ -0,0 +1,27 @@ + + + + + + [WixBundleName] 安装 + [WixBundleName] 安装需要 Microsoft .NET Framework + 是否确实要取消? + 安装程序帮助 + /passive | /quiet - 显示最小的 UI 且无提示,或者不显示 UI 且 + 无提示。默认情况下显示 UI 和所有提示。 + +/norestart - 隐藏任何重启提示。默认情况下 UI 会在重启前提示。 +/log log.txt - 记录到特定文件。默认情况下在 %TEMP% 中创建日志文件。 + 关闭(&C) + 单击“接受并安装”按钮以接受 Microsoft .NET Framework <a href="#">许可证条款</a>。 + 接受并安装(&A) + 拒绝(&D) + 安装进度 + 正在处理: + 取消(&C) + 安装失败 + 一个或多个问题导致安装失败。请解决问题,然后重新尝试安装。有关详情,请查看<a href="#">日志文件</a>。 + 必须重启计算机才能完成软件的回滚。 + 重启(&R) + 关闭(&C) + diff --git a/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl new file mode 100644 index 00000000..6a49ca31 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl @@ -0,0 +1,29 @@ + + + + + + Configuração do [WixBundleName] + O Microsoft .NET Framework é necessário para a configuração do [WixBundleName] + Tem a certeza de que pretende cancelar? + Ajuda da Configuração + /passive | /quiet - apresenta IU mínima sem mensagens ou não apresenta IU nem + mensagens. Por predefinição, são apresentadas a IU e todas as mensagens. + +/norestart - suprimir qualquer tentativa de reinício. Por predefinição, a IU + avisará antes de reiniciar. +/log log.txt - regista num ficheiro específico. Por predefinição, é criado um + ficheiro de registo em %TEMP%. + &Fechar + Clique no botão "Aceitar e Instalar" para aceitar os <a href="#">termos de licenciamento</a> do Microsoft .NET Framework. + &Aceitar e Instalar + &Recusar + Progresso da Configuração + A processar: + &Cancelar + Falha da Configuração + Um ou mais problemas provocaram a falha da configuração. Corrija os problemas e repita a configuração. Para mais informações, consulte o <a href="#">ficheiro de registo</a>. + Tem de reiniciar o computador para concluir a reversão do software. + &Reiniciar + &Fechar + diff --git a/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl new file mode 100644 index 00000000..0290624c --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl @@ -0,0 +1,31 @@ + + + + + + Instalación de [WixBundleName] + La instalación de [WixBundleName] requiere Microsoft .NET Framework + ¿Está seguro de que desea cancelar? + Ayuda del programa de instalación + /passive | /quiet - muestra una interfaz de usuario mínima y no realiza + preguntas, o bien no muestra interfaz de usuario y no realiza preguntas. + De manera predeterminada se muestra la interfaz de usuario completa y se + realizan todas las preguntas necesarias. + +/norestart - suprime cualquier intento de reinicio. De manera predeterminada, + la interfaz de usuario preguntará si se desea reiniciar. +/log log.txt - registra los datos de instalación en un archivo específico. + De manera predeterminada se crea un archivo de registro en %TEMP%. + &Cerrar + Haga clic en el botón "Aceptar e instalar" para aceptar los <a href="#">términos de licencia</a> de Microsoft .NET Framework. + &Aceptar e instalar + &Rechazar + Progreso de la instalación + Procesando: + &Cancelar + Error de la instalación + No se pudo completar la instalación a causa de uno o varios problemas. Corrija los problemas y vuelva a intentar la instalación. Para más información, vea el <a href="#">archivo de registro</a>. + Debe reiniciar el equipo para completar la reversión del software. + &Reiniciar + &Cerrar + diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml b/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml new file mode 100644 index 00000000..39a38ee0 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml @@ -0,0 +1,109 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml b/src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml new file mode 100644 index 00000000..1dff9d7e --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml @@ -0,0 +1,120 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl b/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl new file mode 100644 index 00000000..e6e3f8ab --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl @@ -0,0 +1,61 @@ + + + + + + [WixBundleName] Setup + [WixBundleName] + Welcome + Setup will install [WixBundleName] on your computer. Click install to continue, options to set the install directory or Close to exit. + Version [WixBundleVersion] + Are you sure you want to cancel? + Previous version + Setup Help + /install | /repair | /uninstall | /layout [directory] - installs, repairs, uninstalls or + creates a complete local copy of the bundle in directory. Install is the default. + +/passive | /quiet - displays minimal UI with no prompts or displays no UI and + no prompts. By default UI and all prompts are displayed. + +/norestart - suppress any attempts to restart. By default UI will prompt before restart. +/log log.txt - logs to a specific file. By default a log file is created in %TEMP%. + &Close + [WixBundleName] <a href="#">license terms</a>. + I &agree to the license terms and conditions + &Options + &Install + &Cancel + Setup Options + Install location: + &Browse + &OK + &Cancel + Setup Progress + Processing: + Initializing... + &Cancel + Modify Setup + &Repair + &Uninstall + &Cancel + Setup Successful + Installation Successfully Completed + Layout Successfully Completed + Repair Successfully Completed + Uninstall Successfully Completed + &Launch + You must restart your computer before you can use the software. + You must restart your computer to complete the removal of the software. + &Restart + &Close + Setup Failed + Setup Failed + Layout Failed + Repair Failed + Uninstall Failed + One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>. + You must restart your computer to complete the rollback of the software. + &Restart + &Close + No action was taken as a system reboot is required. + diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml b/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml new file mode 100644 index 00000000..657db34b --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml @@ -0,0 +1,106 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf b/src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf new file mode 100644 index 00000000..1a183236 Binary files /dev/null and b/src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf differ diff --git a/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml b/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml new file mode 100644 index 00000000..3571e13a --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml @@ -0,0 +1,108 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/RtfTheme.wxl b/src/ext/Bal/wixstdba/Resources/RtfTheme.wxl new file mode 100644 index 00000000..f73fb994 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/RtfTheme.wxl @@ -0,0 +1,58 @@ + + + + + + [WixBundleName] Setup + [WixBundleName] + Version [WixBundleVersion] + Are you sure you want to cancel? + Previous version + Setup Help + /install | /repair | /uninstall | /layout [directory] - installs, repairs, uninstalls or + creates a complete local copy of the bundle in directory. Install is the default. + +/passive | /quiet - displays minimal UI with no prompts or displays no UI and + no prompts. By default UI and all prompts are displayed. + +/norestart - suppress any attempts to restart. By default UI will prompt before restart. +/log log.txt - logs to a specific file. By default a log file is created in %TEMP%. + &Close + I &agree to the license terms and conditions + &Options + &Install + &Cancel + Setup Options + Install location: + &Browse + &OK + &Cancel + Setup Progress + Processing: + Initializing... + &Cancel + Modify Setup + &Repair + &Uninstall + &Cancel + Setup Successful + Installation Successfully Completed + Layout Successfully Completed + Repair Successfully Completed + Uninstall Successfully Completed + &Launch + You must restart your computer before you can use the software. + You must restart your computer to complete the removal of the software. + &Restart + &Close + Setup Failed + Setup Failed + Layout Failed + Repair Failed + Uninstall Failed + One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>. + You must restart your computer to complete the rollback of the software. + &Restart + &Close + No action was taken as a system reboot is required. + diff --git a/src/ext/Bal/wixstdba/Resources/RtfTheme.xml b/src/ext/Bal/wixstdba/Resources/RtfTheme.xml new file mode 100644 index 00000000..d6535bac --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/RtfTheme.xml @@ -0,0 +1,106 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/dncpreq.thm b/src/ext/Bal/wixstdba/Resources/dncpreq.thm new file mode 100644 index 00000000..4ae61819 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/dncpreq.thm @@ -0,0 +1,47 @@ + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + #(loc.InstallLicenseTerms) + + + + + + + + + + + + + #(loc.FailureLogLinkText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/dncpreq.wxl b/src/ext/Bal/wixstdba/Resources/dncpreq.wxl new file mode 100644 index 00000000..d6b73b5f --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/dncpreq.wxl @@ -0,0 +1,29 @@ + + + + + + [WixBundleName] Setup + Microsoft .NET Core required for [WixBundleName] setup + Are you sure you want to cancel? + Setup Help + /passive | /quiet - displays minimal UI with no prompts or displays no UI and + no prompts. By default UI and all prompts are displayed. + +/norestart - suppress any attempts to restart. By default UI will prompt before restart. +/log log.txt - logs to a specific file. By default a log file is created in %TEMP%. + &Close + Click the "Accept and Install" button to accept the Microsoft .NET Core <a href="#">license terms</a>. + &Accept and Install + &Decline + Setup Progress + Processing: + &Cancel + Setup Failed + One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>. + You must restart your computer to complete the rollback of the software. + &Restart + &Close + [WixBundleName] cannot run on this machine. Install the latest updates and/or the latest OS to run in a supported environment. + No action was taken as a system reboot is required. + diff --git a/src/ext/Bal/wixstdba/Resources/logo.png b/src/ext/Bal/wixstdba/Resources/logo.png new file mode 100644 index 00000000..7adc6e11 Binary files /dev/null and b/src/ext/Bal/wixstdba/Resources/logo.png differ diff --git a/src/ext/Bal/wixstdba/Resources/logoSide.png b/src/ext/Bal/wixstdba/Resources/logoSide.png new file mode 100644 index 00000000..308841c5 Binary files /dev/null and b/src/ext/Bal/wixstdba/Resources/logoSide.png differ diff --git a/src/ext/Bal/wixstdba/Resources/mbapreq.png b/src/ext/Bal/wixstdba/Resources/mbapreq.png new file mode 100644 index 00000000..c6e9527b Binary files /dev/null and b/src/ext/Bal/wixstdba/Resources/mbapreq.png differ diff --git a/src/ext/Bal/wixstdba/Resources/mbapreq.thm b/src/ext/Bal/wixstdba/Resources/mbapreq.thm new file mode 100644 index 00000000..4ae61819 --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/mbapreq.thm @@ -0,0 +1,47 @@ + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + #(loc.InstallLicenseTerms) + + + + + + + + + + + + + #(loc.FailureLogLinkText) + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/mbapreq.wxl new file mode 100644 index 00000000..95e3a6ae --- /dev/null +++ b/src/ext/Bal/wixstdba/Resources/mbapreq.wxl @@ -0,0 +1,29 @@ + + + + + + [WixBundleName] Setup + Microsoft .NET Framework required for [WixBundleName] setup + Are you sure you want to cancel? + Setup Help + /passive | /quiet - displays minimal UI with no prompts or displays no UI and + no prompts. By default UI and all prompts are displayed. + +/norestart - suppress any attempts to restart. By default UI will prompt before restart. +/log log.txt - logs to a specific file. By default a log file is created in %TEMP%. + &Close + Click the "Accept and Install" button to accept the Microsoft .NET Framework <a href="#">license terms</a>. + &Accept and Install + &Decline + Setup Progress + Processing: + &Cancel + Setup Failed + One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>. + You must restart your computer to complete the rollback of the software. + &Restart + &Close + [WixBundleName] cannot run on Windows 7 RTM with .NET 4.5.2 installed. Install Windows 7 SP1 to run in a supported environment. + No action was taken as a system reboot is required. + diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp new file mode 100644 index 00000000..d4bf7b43 --- /dev/null +++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp @@ -0,0 +1,4264 @@ +// 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. + +#include "precomp.h" +#include "BalBaseBootstrapperApplicationProc.h" +#include "BalBaseBootstrapperApplication.h" + +static const LPCWSTR WIXBUNDLE_VARIABLE_ELEVATED = L"WixBundleElevated"; + +static const LPCWSTR WIXSTDBA_WINDOW_CLASS = L"WixStdBA"; + +static const LPCWSTR WIXSTDBA_VARIABLE_INSTALL_FOLDER = L"InstallFolder"; +static const LPCWSTR WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH = L"LaunchTarget"; +static const LPCWSTR WIXSTDBA_VARIABLE_LAUNCH_TARGET_ELEVATED_ID = L"LaunchTargetElevatedId"; +static const LPCWSTR WIXSTDBA_VARIABLE_LAUNCH_ARGUMENTS = L"LaunchArguments"; +static const LPCWSTR WIXSTDBA_VARIABLE_LAUNCH_HIDDEN = L"LaunchHidden"; +static const LPCWSTR WIXSTDBA_VARIABLE_LAUNCH_WORK_FOLDER = L"LaunchWorkingFolder"; + +static const DWORD WIXSTDBA_ACQUIRE_PERCENTAGE = 30; + +static const LPCWSTR WIXSTDBA_VARIABLE_BUNDLE_FILE_VERSION = L"WixBundleFileVersion"; +static const LPCWSTR WIXSTDBA_VARIABLE_LANGUAGE_ID = L"WixStdBALanguageId"; +static const LPCWSTR WIXSTDBA_VARIABLE_RESTART_REQUIRED = L"WixStdBARestartRequired"; +static const LPCWSTR WIXSTDBA_VARIABLE_SHOW_VERSION = L"WixStdBAShowVersion"; +static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI"; + +enum WIXSTDBA_STATE +{ + WIXSTDBA_STATE_INITIALIZING, + WIXSTDBA_STATE_INITIALIZED, + WIXSTDBA_STATE_HELP, + WIXSTDBA_STATE_DETECTING, + WIXSTDBA_STATE_DETECTED, + WIXSTDBA_STATE_PLANNING, + WIXSTDBA_STATE_PLANNED, + WIXSTDBA_STATE_APPLYING, + WIXSTDBA_STATE_CACHING, + WIXSTDBA_STATE_CACHED, + WIXSTDBA_STATE_EXECUTING, + WIXSTDBA_STATE_EXECUTED, + WIXSTDBA_STATE_APPLIED, + WIXSTDBA_STATE_FAILED, +}; + +enum WM_WIXSTDBA +{ + WM_WIXSTDBA_SHOW_HELP = WM_APP + 100, + WM_WIXSTDBA_DETECT_PACKAGES, + WM_WIXSTDBA_PLAN_PACKAGES, + WM_WIXSTDBA_APPLY_PACKAGES, + WM_WIXSTDBA_CHANGE_STATE, + WM_WIXSTDBA_SHOW_FAILURE, +}; + +// This enum must be kept in the same order as the vrgwzPageNames array. +enum WIXSTDBA_PAGE +{ + WIXSTDBA_PAGE_LOADING, + WIXSTDBA_PAGE_HELP, + WIXSTDBA_PAGE_INSTALL, + WIXSTDBA_PAGE_MODIFY, + WIXSTDBA_PAGE_PROGRESS, + WIXSTDBA_PAGE_PROGRESS_PASSIVE, + WIXSTDBA_PAGE_SUCCESS, + WIXSTDBA_PAGE_FAILURE, + COUNT_WIXSTDBA_PAGE, +}; + +// This array must be kept in the same order as the WIXSTDBA_PAGE enum. +static LPCWSTR vrgwzPageNames[] = { + L"Loading", + L"Help", + L"Install", + L"Modify", + L"Progress", + L"ProgressPassive", + L"Success", + L"Failure", +}; + +enum WIXSTDBA_CONTROL +{ + // Welcome page + WIXSTDBA_CONTROL_INSTALL_BUTTON = THEME_FIRST_ASSIGN_CONTROL_ID, + WIXSTDBA_CONTROL_EULA_RICHEDIT, + WIXSTDBA_CONTROL_EULA_LINK, + WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX, + + // Modify page + WIXSTDBA_CONTROL_REPAIR_BUTTON, + WIXSTDBA_CONTROL_UNINSTALL_BUTTON, + + // Progress page + WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT, + WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR, + WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT, + + WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT, + WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR, + WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT, + WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT, + + WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, + WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR, + WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR, + WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT, + + WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON, + + // Success page + WIXSTDBA_CONTROL_LAUNCH_BUTTON, + WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON, + + // Failure page + WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK, + WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT, + WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON, +}; + +static THEME_ASSIGN_CONTROL_ID vrgInitControls[] = { + { WIXSTDBA_CONTROL_INSTALL_BUTTON, L"InstallButton" }, + { WIXSTDBA_CONTROL_EULA_RICHEDIT, L"EulaRichedit" }, + { WIXSTDBA_CONTROL_EULA_LINK, L"EulaHyperlink" }, + { WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX, L"EulaAcceptCheckbox" }, + + { WIXSTDBA_CONTROL_REPAIR_BUTTON, L"RepairButton" }, + { WIXSTDBA_CONTROL_UNINSTALL_BUTTON, L"UninstallButton" }, + + { WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT, L"CacheProgressPackageText" }, + { WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR, L"CacheProgressbar" }, + { WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT, L"CacheProgressText" }, + { WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT, L"ExecuteProgressPackageText" }, + { WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR, L"ExecuteProgressbar" }, + { WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT, L"ExecuteProgressText" }, + { WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT, L"ExecuteProgressActionDataText"}, + { WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, L"OverallProgressPackageText" }, + { WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR, L"OverallProgressbar" }, + { WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR, L"OverallCalculatedProgressbar" }, + { WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT, L"OverallProgressText" }, + { WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON, L"ProgressCancelButton" }, + + { WIXSTDBA_CONTROL_LAUNCH_BUTTON, L"LaunchButton" }, + { WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON, L"SuccessRestartButton" }, + + { WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK, L"FailureLogFileLink" }, + { WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT, L"FailureMessageText" }, + { WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON, L"FailureRestartButton" }, +}; + +typedef struct _WIXSTDBA_PACKAGE_INFO +{ + LPWSTR sczPackageId; + BOOL fWasAlreadyInstalled; + BOOL fPlannedToBeInstalled; + BOOL fSuccessfullyInstalled; +} WIXSTDBA_PACKAGE_INFO; + + +static HRESULT DAPI EvaluateVariableConditionCallback( + __in_z LPCWSTR wzCondition, + __out BOOL* pf, + __in_opt LPVOID pvContext + ); +static HRESULT DAPI FormatVariableStringCallback( + __in_z LPCWSTR wzFormat, + __inout LPWSTR* psczOut, + __in_opt LPVOID pvContext + ); +static HRESULT DAPI GetVariableNumericCallback( + __in_z LPCWSTR wzVariable, + __out LONGLONG* pllValue, + __in_opt LPVOID pvContext + ); +static HRESULT DAPI SetVariableNumericCallback( + __in_z LPCWSTR wzVariable, + __in LONGLONG llValue, + __in_opt LPVOID pvContext + ); +static HRESULT DAPI GetVariableStringCallback( + __in_z LPCWSTR wzVariable, + __inout LPWSTR* psczValue, + __in_opt LPVOID pvContext + ); +static HRESULT DAPI SetVariableStringCallback( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue, + __in BOOL fFormatted, + __in_opt LPVOID pvContext + ); +static LPCSTR LoggingRequestStateToString( + __in BOOTSTRAPPER_REQUEST_STATE requestState + ); +static LPCSTR LoggingMsiFeatureStateToString( + __in BOOTSTRAPPER_FEATURE_STATE featureState + ); + + +class CWixStandardBootstrapperApplication : public CBalBaseBootstrapperApplication +{ +public: // IBootstrapperApplication + virtual STDMETHODIMP OnStartup() + { + HRESULT hr = S_OK; + DWORD dwUIThreadId = 0; + + // create UI thread + m_hUiThread = ::CreateThread(NULL, 0, UiThreadProc, this, 0, &dwUIThreadId); + if (!m_hUiThread) + { + ExitWithLastError(hr, "Failed to create UI thread."); + } + + LExit: + return hr; + } + + + virtual STDMETHODIMP OnShutdown( + __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction + ) + { + HRESULT hr = S_OK; + + // wait for UI thread to terminate + if (m_hUiThread) + { + ::WaitForSingleObject(m_hUiThread, INFINITE); + ReleaseHandle(m_hUiThread); + } + + // If a restart was required. + if (m_fRestartRequired) + { + if (m_fAllowRestart) + { + *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART; + } + + if (m_fPrereq) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, m_fAllowRestart ? "The prerequisites scheduled a restart. The bootstrapper application will be reloaded after the computer is restarted." + : "A restart is required by the prerequisites but the user delayed it. The bootstrapper application will be reloaded after the computer is restarted."); + } + } + else if (m_fPrereqInstalled) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "The prerequisites were successfully installed. The bootstrapper application will be reloaded."); + *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER; + } + else if (m_fPrereqAlreadyInstalled) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop."); + } + else if (m_fPrereq) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "The prerequisites were not successfully installed, error: 0x%x. The bootstrapper application will be not reloaded.", m_hrFinal); + } + + return hr; + } + + + virtual STDMETHODIMP OnDetectRelatedBundle( + __in LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in LPCWSTR wzBundleTag, + __in BOOL fPerMachine, + __in LPCWSTR wzVersion, + __in BOOTSTRAPPER_RELATED_OPERATION operation, + __in BOOL fMissingFromCache, + __inout BOOL* pfCancel + ) + { + BAL_INFO_PACKAGE* pPackage = NULL; + + if (!fMissingFromCache) + { + if (SUCCEEDED(BalInfoAddRelatedBundleAsPackage(&m_Bundle.packages, wzBundleId, relationType, fPerMachine, &pPackage))) + { + InitializePackageInfoForPackage(pPackage); + } + + // If we're not doing a prerequisite install, remember when our bundle would cause a downgrade. + if (!m_fPrereq && BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE == operation) + { + m_fDowngrading = TRUE; + } + } + + return CBalBaseBootstrapperApplication::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, operation, fMissingFromCache, pfCancel); + } + + + virtual STDMETHODIMP OnDetectPackageComplete( + __in LPCWSTR wzPackageId, + __in HRESULT /*hrStatus*/, + __in BOOTSTRAPPER_PACKAGE_STATE state + ) + { + WIXSTDBA_PACKAGE_INFO* pPackageInfo = NULL; + BAL_INFO_PACKAGE* pPackage = NULL; + + if (BOOTSTRAPPER_PACKAGE_STATE_PRESENT == state && + SUCCEEDED(GetPackageInfo(wzPackageId, &pPackageInfo, &pPackage)) && + pPackageInfo) + { + // If the package is already installed, remember that. + pPackageInfo->fWasAlreadyInstalled = TRUE; + } + + return S_OK; + } + + + virtual STDMETHODIMP OnDetectComplete( + __in HRESULT hrStatus, + __in BOOL /*fEligibleForCleanup*/ + ) + { + HRESULT hr = S_OK; + // If we're not interacting with the user or we're doing a layout or we're resuming just after a force restart + // then automatically start planning. + BOOL fSkipToPlan = SUCCEEDED(hrStatus) && + (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || + BOOTSTRAPPER_ACTION_LAYOUT == m_command.action || + BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_command.resumeType); + // If we're requiring user input (which currently means Install, Repair, or Uninstall) + // or if we're skipping to an action that modifies machine state + // then evaluate conditions. + BOOL fEvaluateConditions = SUCCEEDED(hrStatus) && + (!fSkipToPlan || BOOTSTRAPPER_ACTION_LAYOUT < m_command.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > m_command.action); + + if (fEvaluateConditions) + { + hrStatus = EvaluateConditions(); + } + + if (FAILED(hrStatus)) + { + fSkipToPlan = FALSE; + } + else + { + if (m_fPrereq) + { + m_fPrereqAlreadyInstalled = TRUE; + + // At this point we have to assume that all prerequisite packages need to be installed, so set to false if any of them aren't installed. + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + BAL_INFO_PACKAGE* pPackage = &m_Bundle.packages.rgPackages[i]; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = reinterpret_cast(pPackage->pvCustomData); + if (pPackage->fPrereqPackage && pPackageInfo && !pPackageInfo->fWasAlreadyInstalled) + { + m_fPrereqAlreadyInstalled = FALSE; + break; + } + } + } + } + + SetState(WIXSTDBA_STATE_DETECTED, hrStatus); + + if (fSkipToPlan) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PACKAGES, 0, m_command.action); + } + + return hr; + } + + + virtual STDMETHODIMP OnPlanRelatedBundle( + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_REQUEST_STATE recommendedState, + __inout_z BOOTSTRAPPER_REQUEST_STATE* pRequestedState, + __inout BOOL* pfCancel + ) + { + // If we're only installing prerequisites, do not touch related bundles. + if (m_fPrereq) + { + *pRequestedState = BOOTSTRAPPER_REQUEST_STATE_NONE; + } + + return CBalBaseBootstrapperApplication::OnPlanRelatedBundle(wzBundleId, recommendedState, pRequestedState, pfCancel); + } + + + virtual STDMETHODIMP OnPlanPackageBegin( + __in_z LPCWSTR wzPackageId, + __in BOOTSTRAPPER_PACKAGE_STATE state, + __in BOOL fCached, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + __in BOOTSTRAPPER_REQUEST_STATE recommendedState, + __in BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, + __inout BOOTSTRAPPER_REQUEST_STATE* pRequestState, + __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = NULL; + BAL_INFO_PACKAGE* pPackage = NULL; + + // If we're planning to install prerequisites, install them. The prerequisites need to be installed + // in all cases (even uninstall!) so the BA can load next. + if (m_fPrereq) + { + // Only install prerequisite packages, and check the InstallCondition on them. + BOOL fInstall = FALSE; + hr = GetPackageInfo(wzPackageId, &pPackageInfo, &pPackage); + if (SUCCEEDED(hr) && pPackage->fPrereqPackage && pPackageInfo) + { + pPackageInfo->fPlannedToBeInstalled = fInstall = BOOTSTRAPPER_PACKAGE_CONDITION_FALSE != installCondition; + } + + if (fInstall) + { + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT; + } + else + { + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE; + } + + // Don't force cache packages while installing prerequisites. + if (BOOTSTRAPPER_CACHE_TYPE_FORCE == *pRequestedCacheType) + { + *pRequestedCacheType = BOOTSTRAPPER_CACHE_TYPE_KEEP; + } + } + else if (m_sczAfterForcedRestartPackage) // after force restart, skip packages until after the package that caused the restart. + { + // After restart we need to finish the dependency registration for our package so allow the package + // to go present. + if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzPackageId, -1, m_sczAfterForcedRestartPackage, -1)) + { + // Do not allow a repair because that could put us in a perpetual restart loop. + if (BOOTSTRAPPER_REQUEST_STATE_REPAIR == *pRequestState) + { + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT; + } + + ReleaseNullStr(m_sczAfterForcedRestartPackage); // no more skipping now. + } + else // not the matching package, so skip it. + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Skipping package: %ls, after restart because it was applied before the restart.", wzPackageId); + + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE; + } + } + + return CBalBaseBootstrapperApplication::OnPlanPackageBegin(wzPackageId, state, fCached, installCondition, recommendedState, recommendedCacheType, pRequestState, pRequestedCacheType, pfCancel); + } + + + virtual STDMETHODIMP OnPlanMsiPackage( + __in_z LPCWSTR wzPackageId, + __in BOOL fExecute, + __in BOOTSTRAPPER_ACTION_STATE action, + __inout BOOL* pfCancel, + __inout BURN_MSI_PROPERTY* pActionMsiProperty, + __inout INSTALLUILEVEL* pUiLevel, + __inout BOOL* pfDisableExternalUiHandler + ) + { + HRESULT hr = S_OK; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = NULL; + BAL_INFO_PACKAGE* pPackage = NULL; + BOOL fShowInternalUI = FALSE; + INSTALLUILEVEL uiLevel = INSTALLUILEVEL_NOCHANGE; + + switch (m_command.display) + { + case BOOTSTRAPPER_DISPLAY_FULL: + uiLevel = INSTALLUILEVEL_FULL; + break; + + case BOOTSTRAPPER_DISPLAY_PASSIVE: + uiLevel = INSTALLUILEVEL_REDUCED; + break; + } + + if (INSTALLUILEVEL_NOCHANGE != uiLevel) + { + hr = GetPackageInfo(wzPackageId, &pPackageInfo, &pPackage); + if (SUCCEEDED(hr) && pPackage->sczDisplayInternalUICondition) + { + hr = BalEvaluateCondition(pPackage->sczDisplayInternalUICondition, &fShowInternalUI); + BalExitOnFailure(hr, "Failed to evaluate condition for package '%ls': %ls", wzPackageId, pPackage->sczDisplayInternalUICondition); + + if (fShowInternalUI) + { + *pUiLevel = uiLevel; + } + } + } + + LExit: + return __super::OnPlanMsiPackage(wzPackageId, fExecute, action, pfCancel, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler); + } + + + virtual STDMETHODIMP OnPlanComplete( + __in HRESULT hrStatus + ) + { + HRESULT hr = S_OK; + + if (m_fPrereq) + { + m_fPrereqAlreadyInstalled = TRUE; + + // Now that we've planned the packages, we can focus on the prerequisite packages that are supposed to be installed. + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + BAL_INFO_PACKAGE* pPackage = &m_Bundle.packages.rgPackages[i]; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = reinterpret_cast(pPackage->pvCustomData); + if (pPackage->fPrereqPackage && pPackageInfo && !pPackageInfo->fWasAlreadyInstalled && pPackageInfo->fPlannedToBeInstalled) + { + m_fPrereqAlreadyInstalled = FALSE; + break; + } + } + } + + SetState(WIXSTDBA_STATE_PLANNED, hrStatus); + + if (SUCCEEDED(hrStatus)) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_APPLY_PACKAGES, 0, 0); + } + + m_fStartedExecution = FALSE; + m_dwCalculatedCacheProgress = 0; + m_dwCalculatedExecuteProgress = 0; + + return hr; + } + + + virtual STDMETHODIMP OnPauseAutomaticUpdatesBegin( + ) + { + HRESULT hr = S_OK; + LOC_STRING* pLocString = NULL; + LPWSTR sczFormattedString = NULL; + LPCWSTR wz = NULL; + + hr = __super::OnPauseAutomaticUpdatesBegin(); + + LocGetString(m_pWixLoc, L"#(loc.PauseAutomaticUpdatesMessage)", &pLocString); + + if (pLocString) + { + BalFormatString(pLocString->wzText, &sczFormattedString); + } + + wz = sczFormattedString ? sczFormattedString : L"Pausing Windows automatic updates"; + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, wz); + + ReleaseStr(sczFormattedString); + return hr; + } + + + virtual STDMETHODIMP OnSystemRestorePointBegin( + ) + { + HRESULT hr = S_OK; + LOC_STRING* pLocString = NULL; + LPWSTR sczFormattedString = NULL; + LPCWSTR wz = NULL; + + hr = __super::OnSystemRestorePointBegin(); + + LocGetString(m_pWixLoc, L"#(loc.SystemRestorePointMessage)", &pLocString); + + if (pLocString) + { + BalFormatString(pLocString->wzText, &sczFormattedString); + } + + wz = sczFormattedString ? sczFormattedString : L"Creating system restore point"; + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, wz); + + ReleaseStr(sczFormattedString); + return hr; + } + + + virtual STDMETHODIMP OnCachePackageBegin( + __in_z LPCWSTR wzPackageId, + __in DWORD cCachePayloads, + __in DWORD64 dw64PackageCacheSize, + __inout BOOL* pfCancel + ) + { + if (wzPackageId && *wzPackageId) + { + BAL_INFO_PACKAGE* pPackage = NULL; + HRESULT hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + LPCWSTR wz = (SUCCEEDED(hr) && pPackage->sczDisplayName) ? pPackage->sczDisplayName : wzPackageId; + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT, wz); + + // If something started executing, leave it in the overall progress text. + if (!m_fStartedExecution) + { + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, wz); + } + } + + return __super::OnCachePackageBegin(wzPackageId, cCachePayloads, dw64PackageCacheSize, pfCancel); + } + + + virtual STDMETHODIMP OnCacheAcquireProgress( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __inout BOOL* pfCancel + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnCacheAcquireProgress() - container/package: %ls, payload: %ls, progress: %I64u, total: %I64u, overall progress: %u%%", wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage); +#endif + + UpdateCacheProgress(dwOverallPercentage); + + return __super::OnCacheAcquireProgress(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyProgress( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __inout BOOL* pfCancel + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnCacheContainerOrPayloadVerifyProgress() - container/package: %ls, payload: %ls, progress: %I64u, total: %I64u, overall progress: %u%%", wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage); +#endif + + UpdateCacheProgress(dwOverallPercentage); + + return __super::OnCacheContainerOrPayloadVerifyProgress(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnCachePayloadExtractProgress( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __inout BOOL* pfCancel + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnCachePayloadExtractProgress() - container/package: %ls, payload: %ls, progress: %I64u, total: %I64u, overall progress: %u%%", wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage); +#endif + + UpdateCacheProgress(dwOverallPercentage); + + return __super::OnCachePayloadExtractProgress(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnCacheVerifyProgress( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep, + __inout BOOL* pfCancel + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnCacheVerifyProgress() - container/package: %ls, payload: %ls, progress: %I64u, total: %I64u, overall progress: %u%%, step: %u", wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, verifyStep); +#endif + + UpdateCacheProgress(dwOverallPercentage); + + return __super::OnCacheVerifyProgress(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, verifyStep, pfCancel); + } + + + virtual STDMETHODIMP OnCacheAcquireComplete( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in HRESULT hrStatus, + __in BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, + __inout BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION* pAction + ) + { + SetProgressState(hrStatus); + return __super::OnCacheAcquireComplete(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, pAction); + } + + + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyComplete( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in HRESULT hrStatus + ) + { + SetProgressState(hrStatus); + return __super::OnCacheContainerOrPayloadVerifyComplete(wzPackageOrContainerId, wzPayloadId, hrStatus); + } + + + virtual STDMETHODIMP OnCachePayloadExtractComplete( + __in_z LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in HRESULT hrStatus + ) + { + SetProgressState(hrStatus); + return __super::OnCachePayloadExtractComplete(wzPackageOrContainerId, wzPayloadId, hrStatus); + } + + + virtual STDMETHODIMP OnCacheVerifyComplete( + __in_z LPCWSTR wzPackageId, + __in_z LPCWSTR wzPayloadId, + __in HRESULT hrStatus, + __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, + __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction + ) + { + SetProgressState(hrStatus); + return __super::OnCacheVerifyComplete(wzPackageId, wzPayloadId, hrStatus, recommendation, pAction); + } + + + virtual STDMETHODIMP OnCacheComplete( + __in HRESULT hrStatus + ) + { + UpdateCacheProgress(SUCCEEDED(hrStatus) ? 100 : 0); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT, L""); + SetState(WIXSTDBA_STATE_CACHED, S_OK); // we always return success here and let OnApplyComplete() deal with the error. + return __super::OnCacheComplete(hrStatus); + } + + + virtual STDMETHODIMP OnError( + __in BOOTSTRAPPER_ERROR_TYPE errorType, + __in LPCWSTR wzPackageId, + __in DWORD dwCode, + __in_z LPCWSTR wzError, + __in DWORD dwUIHint, + __in DWORD /*cData*/, + __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/, + __in int /*nRecommendation*/, + __inout int* pResult + ) + { + HRESULT hr = S_OK; + int nResult = *pResult; + LPWSTR sczError = NULL; + + if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_command.display) + { + hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, &nResult); + if (FAILED(hr)) + { + nResult = IDERROR; + } + } + else if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display) + { + // If this is an authentication failure, let the engine try to handle it for us. + if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType) + { + nResult = IDTRYAGAIN; + } + else // show a generic error message box. + { + BalRetryErrorOccurred(wzPackageId, dwCode); + + if (!m_fShowingInternalUiThisPackage) + { + // If no error message was provided, use the error code to try and get an error message. + if (!wzError || !*wzError || BOOTSTRAPPER_ERROR_TYPE_WINDOWS_INSTALLER != errorType) + { + hr = StrAllocFromError(&sczError, dwCode, NULL); + if (FAILED(hr) || !sczError || !*sczError) + { + // special case for ERROR_FAIL_NOACTION_REBOOT: use loc string for Windows XP + if (ERROR_FAIL_NOACTION_REBOOT == dwCode) + { + LOC_STRING* pLocString = NULL; + hr = LocGetString(m_pWixLoc, L"#(loc.ErrorFailNoActionReboot)", &pLocString); + if (SUCCEEDED(hr)) + { + StrAllocString(&sczError, pLocString->wzText, 0); + } + else + { + StrAllocFormatted(&sczError, L"0x%x", dwCode); + } + } + else + { + StrAllocFormatted(&sczError, L"0x%x", dwCode); + } + } + hr = S_OK; + } + + nResult = ::MessageBoxW(m_hWnd, sczError ? sczError : wzError, m_pTheme->sczCaption, dwUIHint); + } + } + + SetProgressState(HRESULT_FROM_WIN32(dwCode)); + } + else // just take note of the error code and let things continue. + { + BalRetryErrorOccurred(wzPackageId, dwCode); + } + + ReleaseStr(sczError); + *pResult = nResult; + return hr; + } + + + virtual STDMETHODIMP OnExecuteMsiMessage( + __in_z LPCWSTR wzPackageId, + __in INSTALLMESSAGE messageType, + __in DWORD dwUIHint, + __in_z LPCWSTR wzMessage, + __in DWORD cData, + __in_ecount_z_opt(cData) LPCWSTR* rgwzData, + __in int nRecommendation, + __inout int* pResult + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnExecuteMsiMessage() - package: %ls, message: %ls", wzPackageId, wzMessage); +#endif + if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display && (INSTALLMESSAGE_WARNING == messageType || INSTALLMESSAGE_USER == messageType)) + { + if (!m_fShowingInternalUiThisPackage) + { + int nResult = ::MessageBoxW(m_hWnd, wzMessage, m_pTheme->sczCaption, dwUIHint); + return nResult; + } + } + + if (INSTALLMESSAGE_ACTIONSTART == messageType) + { + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT, wzMessage); + } + + return __super::OnExecuteMsiMessage(wzPackageId, messageType, dwUIHint, wzMessage, cData, rgwzData, nRecommendation, pResult); + } + + + virtual STDMETHODIMP OnProgress( + __in DWORD dwProgressPercentage, + __in DWORD dwOverallProgressPercentage, + __inout BOOL* pfCancel + ) + { + WCHAR wzProgress[5] = { }; + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnProgress() - progress: %u%%, overall progress: %u%%", dwProgressPercentage, dwOverallProgressPercentage); +#endif + + ::StringCchPrintfW(wzProgress, countof(wzProgress), L"%u%%", dwOverallProgressPercentage); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT, wzProgress); + + ThemeSetProgressControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR, dwOverallProgressPercentage); + SetTaskbarButtonProgress(dwOverallProgressPercentage); + + return __super::OnProgress(dwProgressPercentage, dwOverallProgressPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnExecutePackageBegin( + __in_z LPCWSTR wzPackageId, + __in BOOL fExecute, + __in BOOTSTRAPPER_ACTION_STATE action, + __in INSTALLUILEVEL uiLevel, + __in BOOL fDisableExternalUiHandler, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + LPWSTR sczFormattedString = NULL; + BOOL fShowingInternalUiThisPackage = FALSE; + + m_fStartedExecution = TRUE; + + if (wzPackageId && *wzPackageId) + { + BAL_INFO_PACKAGE* pPackage = NULL; + BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + + LPCWSTR wz = wzPackageId; + if (pPackage) + { + LOC_STRING* pLocString = NULL; + + switch (pPackage->type) + { + case BAL_INFO_PACKAGE_TYPE_BUNDLE_ADDON: + LocGetString(m_pWixLoc, L"#(loc.ExecuteAddonRelatedBundleMessage)", &pLocString); + break; + + case BAL_INFO_PACKAGE_TYPE_BUNDLE_PATCH: + LocGetString(m_pWixLoc, L"#(loc.ExecutePatchRelatedBundleMessage)", &pLocString); + break; + + case BAL_INFO_PACKAGE_TYPE_BUNDLE_UPGRADE: + LocGetString(m_pWixLoc, L"#(loc.ExecuteUpgradeRelatedBundleMessage)", &pLocString); + break; + } + + if (pLocString) + { + // If the wix developer is showing a hidden variable in the UI, then obviously they don't care about keeping it safe + // so don't go down the rabbit hole of making sure that this is securely freed. + BalFormatString(pLocString->wzText, &sczFormattedString); + } + + wz = sczFormattedString ? sczFormattedString : pPackage->sczDisplayName ? pPackage->sczDisplayName : wzPackageId; + } + + fShowingInternalUiThisPackage = INSTALLUILEVEL_NONE != (INSTALLUILEVEL_NONE & uiLevel); + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT, wz); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, wz); + } + + ::EnterCriticalSection(&m_csShowingInternalUiThisPackage); + m_fShowingInternalUiThisPackage = fShowingInternalUiThisPackage; + hr = __super::OnExecutePackageBegin(wzPackageId, fExecute, action, uiLevel, fDisableExternalUiHandler, pfCancel); + ::LeaveCriticalSection(&m_csShowingInternalUiThisPackage); + + ReleaseStr(sczFormattedString); + return hr; + } + + + virtual STDMETHODIMP OnExecuteProgress( + __in_z LPCWSTR wzPackageId, + __in DWORD dwProgressPercentage, + __in DWORD dwOverallProgressPercentage, + __inout BOOL* pfCancel + ) + { + WCHAR wzProgress[5] = { }; + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnExecuteProgress() - package: %ls, progress: %u%%, overall progress: %u%%", wzPackageId, dwProgressPercentage, dwOverallProgressPercentage); +#endif + + ::StringCchPrintfW(wzProgress, countof(wzProgress), L"%u%%", dwOverallProgressPercentage); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT, wzProgress); + + ThemeSetProgressControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR, dwOverallProgressPercentage); + + m_dwCalculatedExecuteProgress = dwOverallProgressPercentage * (100 - WIXSTDBA_ACQUIRE_PERCENTAGE) / 100; + ThemeSetProgressControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR, m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + + SetTaskbarButtonProgress(m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + + return __super::OnExecuteProgress(wzPackageId, dwProgressPercentage, dwOverallProgressPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnExecutePackageComplete( + __in_z LPCWSTR wzPackageId, + __in HRESULT hrStatus, + __in BOOTSTRAPPER_APPLY_RESTART restart, + __in BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, + __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction + ) + { + HRESULT hr = S_OK; + SetProgressState(hrStatus); + + hr = __super::OnExecutePackageComplete(wzPackageId, hrStatus, restart, recommendation, pAction); + + WIXSTDBA_PACKAGE_INFO* pPackageInfo = NULL; + BAL_INFO_PACKAGE* pPackage; + HRESULT hrPrereq = GetPackageInfo(wzPackageId, &pPackageInfo, &pPackage); + if (SUCCEEDED(hrPrereq) && pPackageInfo) + { + pPackageInfo->fSuccessfullyInstalled = SUCCEEDED(hrStatus); + + // If the prerequisite required a restart (any restart) then do an immediate + // restart to ensure that the bundle will get launched again post reboot. + if (m_fPrereq && pPackage->fPrereqPackage && BOOTSTRAPPER_APPLY_RESTART_NONE != restart) + { + *pAction = BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART; + } + } + + return hr; + } + + + virtual STDMETHODIMP OnExecuteComplete( + __in HRESULT hrStatus + ) + { + HRESULT hr = S_OK; + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT, L""); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT, L""); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT, L""); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON, FALSE); // no more cancel. + m_fShowingInternalUiThisPackage = FALSE; + + SetState(WIXSTDBA_STATE_EXECUTED, S_OK); // we always return success here and let OnApplyComplete() deal with the error. + SetProgressState(hrStatus); + + return hr; + } + + + virtual STDMETHODIMP OnCacheAcquireResolving( + __in_z_opt LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in_z LPCWSTR* rgSearchPaths, + __in DWORD /*cSearchPaths*/, + __in BOOL /*fFoundLocal*/, + __in DWORD dwRecommendedSearchPath, + __in_z_opt LPCWSTR /*wzDownloadUrl*/, + __in_z_opt LPCWSTR /*wzPayloadContainerId*/, + __in BOOTSTRAPPER_CACHE_RESOLVE_OPERATION /*recommendation*/, + __inout DWORD* /*pdwChosenSearchPath*/, + __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pAction, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + + if (BOOTSTRAPPER_CACHE_RESOLVE_NONE == *pAction && BOOTSTRAPPER_DISPLAY_FULL == m_command.display) // prompt to change the source location. + { + OPENFILENAMEW ofn = { }; + WCHAR wzFile[MAX_PATH] = { }; + + ::StringCchCopyW(wzFile, countof(wzFile), rgSearchPaths[dwRecommendedSearchPath]); + + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = m_hWnd; + ofn.lpstrFile = wzFile; + ofn.nMaxFile = countof(wzFile); + ofn.lpstrFilter = L"All Files\0*.*\0"; + ofn.nFilterIndex = 1; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + ofn.lpstrTitle = m_pTheme->sczCaption; + + if (::GetOpenFileNameW(&ofn)) + { + hr = m_pEngine->SetLocalSource(wzPackageOrContainerId, wzPayloadId, ofn.lpstrFile); + *pAction = BOOTSTRAPPER_CACHE_RESOLVE_RETRY; + } + else + { + *pfCancel = TRUE; + } + } + // else there's nothing more we can do in non-interactive mode + + *pfCancel |= CheckCanceled(); + return hr; + } + + + virtual STDMETHODIMP OnApplyComplete( + __in HRESULT hrStatus, + __in BOOTSTRAPPER_APPLY_RESTART restart, + __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, + __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction + ) + { + HRESULT hr = S_OK; + + __super::OnApplyComplete(hrStatus, restart, recommendation, pAction); + + m_restartResult = restart; // remember the restart result so we return the correct error code no matter what the user chooses to do in the UI. + + // If a restart was encountered and we are not suppressing restarts, then restart is required. + m_fRestartRequired = (BOOTSTRAPPER_APPLY_RESTART_NONE != restart && BOOTSTRAPPER_RESTART_NEVER < m_command.restart); + BalSetStringVariable(WIXSTDBA_VARIABLE_RESTART_REQUIRED, m_fRestartRequired ? L"1" : NULL, FALSE); + + // If a restart is required and we're not displaying a UI or we are not supposed to prompt for restart then allow the restart. + m_fAllowRestart = m_fRestartRequired && (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || BOOTSTRAPPER_RESTART_PROMPT < m_command.restart); + + if (m_fPrereq) + { + m_fPrereqInstalled = TRUE; + BOOL fInstalledAPackage = FALSE; + + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + BAL_INFO_PACKAGE* pPackage = &m_Bundle.packages.rgPackages[i]; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = reinterpret_cast(pPackage->pvCustomData); + if (pPackage->fPrereqPackage && pPackageInfo && pPackageInfo->fPlannedToBeInstalled && !pPackageInfo->fWasAlreadyInstalled) + { + if (pPackageInfo->fSuccessfullyInstalled) + { + fInstalledAPackage = TRUE; + } + else + { + m_fPrereqInstalled = FALSE; + break; + } + } + } + + m_fPrereqInstalled = m_fPrereqInstalled && fInstalledAPackage; + } + + // If we are showing UI, wait a beat before moving to the final screen. + if (BOOTSTRAPPER_DISPLAY_NONE < m_command.display) + { + ::Sleep(250); + } + + SetState(WIXSTDBA_STATE_APPLIED, hrStatus); + SetTaskbarButtonProgress(100); // show full progress bar, green, yellow, or red + + *pAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; + + return hr; + } + + virtual STDMETHODIMP OnLaunchApprovedExeComplete( + __in HRESULT hrStatus, + __in DWORD /*processId*/ + ) + { + HRESULT hr = S_OK; + + if (HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) == hrStatus) + { + //try with ShelExec next time + OnClickLaunchButton(); + } + else + { + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + + return hr; + } + + virtual STDMETHODIMP_(void) BAProcFallback( + __in BOOTSTRAPPER_APPLICATION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __inout HRESULT* phr, + __in_opt LPVOID /*pvContext*/ + ) + { + if (!m_pfnBAFunctionsProc || FAILED(*phr)) + { + return; + } + + // Always log before and after so we don't get blamed when BAFunctions changes something. + switch (message) + { + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN: + OnDetectBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE: + OnDetectCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN: + OnPlanBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE: + OnPlanCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP: // BAFunctions is loaded during this event on a separate thread so it's not possible to forward it. + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN: + OnShutdownFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN: + OnSystemShutdownFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE: + OnDetectForwardCompatibleBundleFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN: + OnDetectUpdateBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE: + OnDetectUpdateFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE: + OnDetectUpdateCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE: + OnDetectRelatedBundleFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN: + OnDetectPackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE: + OnDetectRelatedMsiPackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET: + OnDetectPatchTargetFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE: + OnDetectMsiFeatureFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE: + OnDetectPackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE: + OnPlanRelatedBundleFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN: + OnPlanPackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET: + OnPlanPatchTargetFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE: + OnPlanMsiFeatureFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE: + OnPlanPackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN: + OnApplyBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN: + OnElevateBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE: + OnElevateCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS: + OnProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR: + OnErrorFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN: + OnRegisterBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE: + OnRegisterCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN: + OnCacheBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN: + OnCachePackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN: + OnCacheAcquireBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS: + OnCacheAcquireProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING: + OnCacheAcquireResolvingFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE: + OnCacheAcquireCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN: + OnCacheVerifyBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE: + OnCacheVerifyCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE: + OnCachePackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE: + OnCacheCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN: + OnExecuteBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN: + OnExecutePackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET: + OnExecutePatchTargetFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS: + OnExecuteProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE: + OnExecuteMsiMessageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE: + OnExecuteFilesInUseFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE: + OnExecutePackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE: + OnExecuteCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN: + OnUnregisterBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE: + OnUnregisterCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE: + OnApplyCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN: + OnLaunchApprovedExeBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE: + OnLaunchApprovedExeCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE: + OnPlanMsiPackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN: + OnBeginMsiTransactionBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE: + OnBeginMsiTransactionCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN: + OnCommitMsiTransactionBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE: + OnCommitMsiTransactionCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN: + OnRollbackMsiTransactionBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE: + OnRollbackMsiTransactionCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN: + OnPauseAutomaticUpdatesBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE: + OnPauseAutomaticUpdatesCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN: + OnSystemRestorePointBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE: + OnSystemRestorePointCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE: + OnPlannedPackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS: + OnCacheVerifyProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN: + OnCacheContainerOrPayloadVerifyBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE: + OnCacheContainerOrPayloadVerifyCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS: + OnCacheContainerOrPayloadVerifyProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN: + OnCachePayloadExtractBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE: + OnCachePayloadExtractCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS: + OnCachePayloadExtractProgressFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + default: +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: Forwarding unknown BA message: %d", message); +#endif + m_pfnBAFunctionsProc((BA_FUNCTIONS_MESSAGE)message, pvArgs, pvResults, m_pvBAFunctionsProcContext); + break; + } + } + + +private: // privates + void OnDetectBeginFallback( + __in BA_ONDETECTBEGIN_ARGS* pArgs, + __inout BA_ONDETECTBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectCompleteFallback( + __in BA_ONDETECTCOMPLETE_ARGS* pArgs, + __inout BA_ONDETECTCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanBeginFallback( + __in BA_ONPLANBEGIN_ARGS* pArgs, + __inout BA_ONPLANBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanCompleteFallback( + __in BA_ONPLANCOMPLETE_ARGS* pArgs, + __inout BA_ONPLANCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnShutdownFallback( + __in BA_ONSHUTDOWN_ARGS* pArgs, + __inout BA_ONSHUTDOWN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSHUTDOWN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnSystemShutdownFallback( + __in BA_ONSYSTEMSHUTDOWN_ARGS* pArgs, + __inout BA_ONSYSTEMSHUTDOWN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSYSTEMSHUTDOWN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectForwardCompatibleBundleFallback( + __in BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs, + __inout BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectUpdateBeginFallback( + __in BA_ONDETECTUPDATEBEGIN_ARGS* pArgs, + __inout BA_ONDETECTUPDATEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectUpdateFallback( + __in BA_ONDETECTUPDATE_ARGS* pArgs, + __inout BA_ONDETECTUPDATE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectUpdateCompleteFallback( + __in BA_ONDETECTUPDATECOMPLETE_ARGS* pArgs, + __inout BA_ONDETECTUPDATECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTUPDATECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectRelatedBundleFallback( + __in BA_ONDETECTRELATEDBUNDLE_ARGS* pArgs, + __inout BA_ONDETECTRELATEDBUNDLE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectPackageBeginFallback( + __in BA_ONDETECTPACKAGEBEGIN_ARGS* pArgs, + __inout BA_ONDETECTPACKAGEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectRelatedMsiPackageFallback( + __in BA_ONDETECTRELATEDMSIPACKAGE_ARGS* pArgs, + __inout BA_ONDETECTRELATEDMSIPACKAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDMSIPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectPatchTargetFallback( + __in BA_ONDETECTPATCHTARGET_ARGS* pArgs, + __inout BA_ONDETECTPATCHTARGET_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTPATCHTARGET, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectMsiFeatureFallback( + __in BA_ONDETECTMSIFEATURE_ARGS* pArgs, + __inout BA_ONDETECTMSIFEATURE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTMSIFEATURE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectPackageCompleteFallback( + __in BA_ONDETECTPACKAGECOMPLETE_ARGS* pArgs, + __inout BA_ONDETECTPACKAGECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanRelatedBundleFallback( + __in BA_ONPLANRELATEDBUNDLE_ARGS* pArgs, + __inout BA_ONPLANRELATEDBUNDLE_RESULTS* pResults + ) + { + BOOTSTRAPPER_REQUEST_STATE requestedState = pResults->requestedState; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE, m_hModule, pArgs->wzBundleId, LoggingRequestStateToString(requestedState), LoggingRequestStateToString(pResults->requestedState)); + } + + void OnPlanPackageBeginFallback( + __in BA_ONPLANPACKAGEBEGIN_ARGS* pArgs, + __inout BA_ONPLANPACKAGEBEGIN_RESULTS* pResults + ) + { + BOOTSTRAPPER_REQUEST_STATE requestedState = pResults->requestedState; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_PACKAGE, m_hModule, pArgs->wzPackageId, LoggingRequestStateToString(requestedState), LoggingRequestStateToString(pResults->requestedState)); + } + + void OnPlanPatchTargetFallback( + __in BA_ONPLANPATCHTARGET_ARGS* pArgs, + __inout BA_ONPLANPATCHTARGET_RESULTS* pResults + ) + { + BOOTSTRAPPER_REQUEST_STATE requestedState = pResults->requestedState; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANPATCHTARGET, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_TARGET_MSI_PACKAGE, m_hModule, pArgs->wzPackageId, pArgs->wzProductCode, LoggingRequestStateToString(requestedState), LoggingRequestStateToString(pResults->requestedState)); + } + + void OnPlanMsiFeatureFallback( + __in BA_ONPLANMSIFEATURE_ARGS* pArgs, + __inout BA_ONPLANMSIFEATURE_RESULTS* pResults + ) + { + BOOTSTRAPPER_FEATURE_STATE requestedState = pResults->requestedState; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANMSIFEATURE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_MSI_FEATURE, m_hModule, pArgs->wzPackageId, pArgs->wzFeatureId, LoggingMsiFeatureStateToString(requestedState), LoggingMsiFeatureStateToString(pResults->requestedState)); + } + + void OnPlanPackageCompleteFallback( + __in BA_ONPLANPACKAGECOMPLETE_ARGS* pArgs, + __inout BA_ONPLANPACKAGECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlannedPackageFallback( + __in BA_ONPLANNEDPACKAGE_ARGS* pArgs, + __inout BA_ONPLANNEDPACKAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnApplyBeginFallback( + __in BA_ONAPPLYBEGIN_ARGS* pArgs, + __inout BA_ONAPPLYBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONAPPLYBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnElevateBeginFallback( + __in BA_ONELEVATEBEGIN_ARGS* pArgs, + __inout BA_ONELEVATEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONELEVATEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnElevateCompleteFallback( + __in BA_ONELEVATECOMPLETE_ARGS* pArgs, + __inout BA_ONELEVATECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONELEVATECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnProgressFallback( + __in BA_ONPROGRESS_ARGS* pArgs, + __inout BA_ONPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnErrorFallback( + __in BA_ONERROR_ARGS* pArgs, + __inout BA_ONERROR_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONERROR, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnRegisterBeginFallback( + __in BA_ONREGISTERBEGIN_ARGS* pArgs, + __inout BA_ONREGISTERBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONREGISTERBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnRegisterCompleteFallback( + __in BA_ONREGISTERCOMPLETE_ARGS* pArgs, + __inout BA_ONREGISTERCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONREGISTERCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheBeginFallback( + __in BA_ONCACHEBEGIN_ARGS* pArgs, + __inout BA_ONCACHEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePackageBeginFallback( + __in BA_ONCACHEPACKAGEBEGIN_ARGS* pArgs, + __inout BA_ONCACHEPACKAGEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheAcquireBeginFallback( + __in BA_ONCACHEACQUIREBEGIN_ARGS* pArgs, + __inout BA_ONCACHEACQUIREBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheAcquireProgressFallback( + __in BA_ONCACHEACQUIREPROGRESS_ARGS* pArgs, + __inout BA_ONCACHEACQUIREPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheAcquireResolvingFallback( + __in BA_ONCACHEACQUIRERESOLVING_ARGS* pArgs, + __inout BA_ONCACHEACQUIRERESOLVING_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRERESOLVING, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheAcquireCompleteFallback( + __in BA_ONCACHEACQUIRECOMPLETE_ARGS* pArgs, + __inout BA_ONCACHEACQUIRECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheVerifyBeginFallback( + __in BA_ONCACHEVERIFYBEGIN_ARGS* pArgs, + __inout BA_ONCACHEVERIFYBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheVerifyCompleteFallback( + __in BA_ONCACHEVERIFYCOMPLETE_ARGS* pArgs, + __inout BA_ONCACHEVERIFYCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePackageCompleteFallback( + __in BA_ONCACHEPACKAGECOMPLETE_ARGS* pArgs, + __inout BA_ONCACHEPACKAGECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheCompleteFallback( + __in BA_ONCACHECOMPLETE_ARGS* pArgs, + __inout BA_ONCACHECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteBeginFallback( + __in BA_ONEXECUTEBEGIN_ARGS* pArgs, + __inout BA_ONEXECUTEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecutePackageBeginFallback( + __in BA_ONEXECUTEPACKAGEBEGIN_ARGS* pArgs, + __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecutePatchTargetFallback( + __in BA_ONEXECUTEPATCHTARGET_ARGS* pArgs, + __inout BA_ONEXECUTEPATCHTARGET_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPATCHTARGET, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteProgressFallback( + __in BA_ONEXECUTEPROGRESS_ARGS* pArgs, + __inout BA_ONEXECUTEPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteMsiMessageFallback( + __in BA_ONEXECUTEMSIMESSAGE_ARGS* pArgs, + __inout BA_ONEXECUTEMSIMESSAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEMSIMESSAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteFilesInUseFallback( + __in BA_ONEXECUTEFILESINUSE_ARGS* pArgs, + __inout BA_ONEXECUTEFILESINUSE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEFILESINUSE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecutePackageCompleteFallback( + __in BA_ONEXECUTEPACKAGECOMPLETE_ARGS* pArgs, + __inout BA_ONEXECUTEPACKAGECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteCompleteFallback( + __in BA_ONEXECUTECOMPLETE_ARGS* pArgs, + __inout BA_ONEXECUTECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnUnregisterBeginFallback( + __in BA_ONUNREGISTERBEGIN_ARGS* pArgs, + __inout BA_ONUNREGISTERBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONUNREGISTERBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnUnregisterCompleteFallback( + __in BA_ONUNREGISTERCOMPLETE_ARGS* pArgs, + __inout BA_ONUNREGISTERCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONUNREGISTERCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnApplyCompleteFallback( + __in BA_ONAPPLYCOMPLETE_ARGS* pArgs, + __inout BA_ONAPPLYCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnLaunchApprovedExeBeginFallback( + __in BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS* pArgs, + __inout BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnLaunchApprovedExeCompleteFallback( + __in BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS* pArgs, + __inout BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanMsiPackageFallback( + __in BA_ONPLANMSIPACKAGE_ARGS* pArgs, + __inout BA_ONPLANMSIPACKAGE_RESULTS* pResults + ) + { + BURN_MSI_PROPERTY actionMsiProperty = pResults->actionMsiProperty; + INSTALLUILEVEL uiLevel = pResults->uiLevel; + BOOL fDisableExternalUiHandler = pResults->fDisableExternalUiHandler; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_MSI_PACKAGE, m_hModule, pArgs->wzPackageId, actionMsiProperty, uiLevel, fDisableExternalUiHandler ? "yes" : "no", pResults->actionMsiProperty, pResults->uiLevel, pResults->fDisableExternalUiHandler ? "yes" : "no"); + } + + void OnBeginMsiTransactionBeginFallback( + __in BA_ONBEGINMSITRANSACTIONBEGIN_ARGS* pArgs, + __inout BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnBeginMsiTransactionCompleteFallback( + __in BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS* pArgs, + __inout BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCommitMsiTransactionBeginFallback( + __in BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS* pArgs, + __inout BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCommitMsiTransactionCompleteFallback( + __in BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS* pArgs, + __inout BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnRollbackMsiTransactionBeginFallback( + __in BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS* pArgs, + __inout BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnRollbackMsiTransactionCompleteFallback( + __in BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS* pArgs, + __inout BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPauseAutomaticUpdatesBeginFallback( + __in BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS* pArgs, + __inout BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPauseAutomaticUpdatesCompleteFallback( + __in BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS* pArgs, + __inout BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnSystemRestorePointBeginFallback( + __in BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS* pArgs, + __inout BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnSystemRestorePointCompleteFallback( + __in BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS* pArgs, + __inout BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanForwardCompatibleBundleFallback( + __in BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs, + __inout BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults + ) + { + BOOL fIgnoreBundle = pResults->fIgnoreBundle; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_FORWARD_COMPATIBLE_BUNDLE, m_hModule, pArgs->wzBundleId, fIgnoreBundle ? "ignore" : "enable", pResults->fIgnoreBundle ? "ignore" : "enable"); + } + + void OnCacheVerifyProgressFallback( + __in BA_ONCACHEVERIFYPROGRESS_ARGS* pArgs, + __inout BA_ONCACHEVERIFYPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheContainerOrPayloadVerifyBeginFallback( + __in BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheContainerOrPayloadVerifyCompleteFallback( + __in BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCacheContainerOrPayloadVerifyProgressFallback( + __in BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePayloadExtractBeginFallback( + __in BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePayloadExtractCompleteFallback( + __in BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePayloadExtractProgressFallback( + __in BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + // + // UiThreadProc - entrypoint for UI thread. + // + static DWORD WINAPI UiThreadProc( + __in LPVOID pvContext + ) + { + HRESULT hr = S_OK; + CWixStandardBootstrapperApplication* pThis = (CWixStandardBootstrapperApplication*)pvContext; + BOOL fComInitialized = FALSE; + BOOL fRet = FALSE; + MSG msg = { }; + + // Initialize COM and theme. + hr = ::CoInitialize(NULL); + BalExitOnFailure(hr, "Failed to initialize COM."); + fComInitialized = TRUE; + + hr = ThemeInitialize(pThis->m_hModule); + BalExitOnFailure(hr, "Failed to initialize theme manager."); + + hr = pThis->InitializeData(); + BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application."); + + // Create main window. + pThis->InitializeTaskbarButton(); + hr = pThis->CreateMainWindow(); + BalExitOnFailure(hr, "Failed to create main window."); + + if (FAILED(pThis->m_hrFinal)) + { + pThis->SetState(WIXSTDBA_STATE_FAILED, hr); + ::PostMessageW(pThis->m_hWnd, WM_WIXSTDBA_SHOW_FAILURE, 0, 0); + } + else + { + // Okay, we're ready for packages now. + pThis->SetState(WIXSTDBA_STATE_INITIALIZED, hr); + ::PostMessageW(pThis->m_hWnd, BOOTSTRAPPER_ACTION_HELP == pThis->m_command.action ? WM_WIXSTDBA_SHOW_HELP : WM_WIXSTDBA_DETECT_PACKAGES, 0, 0); + } + + // message pump + while (0 != (fRet = ::GetMessageW(&msg, NULL, 0, 0))) + { + if (-1 == fRet) + { + hr = E_UNEXPECTED; + BalExitOnFailure(hr, "Unexpected return value from message pump."); + } + else if (!ThemeHandleKeyboardMessage(pThis->m_pTheme, msg.hwnd, &msg)) + { + ::TranslateMessage(&msg); + ::DispatchMessageW(&msg); + } + } + + // Succeeded thus far, check to see if anything went wrong while actually + // executing changes. + if (FAILED(pThis->m_hrFinal)) + { + hr = pThis->m_hrFinal; + } + else if (pThis->CheckCanceled()) + { + hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); + } + + LExit: + // destroy main window + pThis->DestroyMainWindow(); + pThis->UninitializeTaskbarButton(); + + // initiate engine shutdown + DWORD dwQuit = HRESULT_CODE(hr); + if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == pThis->m_restartResult) + { + dwQuit = ERROR_SUCCESS_REBOOT_INITIATED; + } + else if (BOOTSTRAPPER_APPLY_RESTART_REQUIRED == pThis->m_restartResult) + { + dwQuit = ERROR_SUCCESS_REBOOT_REQUIRED; + } + pThis->m_pEngine->Quit(dwQuit); + + ReleaseTheme(pThis->m_pTheme); + ThemeUninitialize(); + + // uninitialize COM + if (fComInitialized) + { + ::CoUninitialize(); + } + + return hr; + } + + + // + // InitializeData - initializes all the package and prerequisite information. + // + HRESULT InitializeData() + { + HRESULT hr = S_OK; + LPWSTR sczModulePath = NULL; + IXMLDOMDocument *pixdManifest = NULL; + + hr = BalManifestLoad(m_hModule, &pixdManifest); + BalExitOnFailure(hr, "Failed to load bootstrapper application manifest."); + + hr = ParseOverridableVariablesFromXml(pixdManifest); + BalExitOnFailure(hr, "Failed to read overridable variables."); + + hr = ProcessCommandLine(&m_sczLanguage); + ExitOnFailure(hr, "Unknown commandline parameters."); + + hr = PathRelativeToModule(&sczModulePath, NULL, m_hModule); + BalExitOnFailure(hr, "Failed to get module path."); + + hr = LoadLocalization(sczModulePath, m_sczLanguage); + ExitOnFailure(hr, "Failed to load localization."); + + hr = LoadTheme(sczModulePath, m_sczLanguage); + ExitOnFailure(hr, "Failed to load theme."); + + hr = BalInfoParseFromXml(&m_Bundle, pixdManifest); + BalExitOnFailure(hr, "Failed to load bundle information."); + + hr = BalConditionsParseFromXml(&m_Conditions, pixdManifest, m_pWixLoc); + BalExitOnFailure(hr, "Failed to load conditions from XML."); + + hr = LoadBAFunctions(pixdManifest); + BalExitOnFailure(hr, "Failed to load bootstrapper functions."); + + GetBundleFileVersion(); + // don't fail if we couldn't get the version info; best-effort only + + hr = InitializePackageInfo(); + BalExitOnFailure(hr, "Failed to initialize wixstdba package information."); + + if (m_fPrereq) + { + hr = InitializePrerequisiteInformation(); + BalExitOnFailure(hr, "Failed to initialize prerequisite information."); + } + else + { + hr = ParseBootstrapperApplicationDataFromXml(pixdManifest); + BalExitOnFailure(hr, "Failed to read bootstrapper application data."); + } + + if (BOOTSTRAPPER_ACTION_CACHE == m_plannedAction) + { + if (m_fSupportCacheOnly) + { + // Doesn't make sense to prompt the user if cache only is requested. + if (BOOTSTRAPPER_DISPLAY_PASSIVE < m_command.display) + { + m_command.display = BOOTSTRAPPER_DISPLAY_PASSIVE; + } + + m_command.action = BOOTSTRAPPER_ACTION_CACHE; + } + else + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to only cache a bundle that does not explicitly support it."); + m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; + } + } + + LExit: + ReleaseObject(pixdManifest); + ReleaseStr(sczModulePath); + + return hr; + } + + + // + // ProcessCommandLine - process the provided command line arguments. + // + HRESULT ProcessCommandLine( + __inout LPWSTR* psczLanguage + ) + { + HRESULT hr = S_OK; + int argc = 0; + LPWSTR* argv = NULL; + LPWSTR sczVariableName = NULL; + LPWSTR sczVariableValue = NULL; + + if (m_command.wzCommandLine && *m_command.wzCommandLine) + { + hr = AppParseCommandLine(m_command.wzCommandLine, &argc, &argv); + ExitOnFailure(hr, "Failed to parse command line."); + + for (int i = 0; i < argc; ++i) + { + if (argv[i][0] == L'-' || argv[i][0] == L'/') + { + if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"lang", -1)) + { + if (i + 1 >= argc) + { + hr = E_INVALIDARG; + BalExitOnFailure(hr, "Must specify a language."); + } + + ++i; + + hr = StrAllocString(psczLanguage, &argv[i][0], 0); + BalExitOnFailure(hr, "Failed to copy language."); + } + } + else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"cache", -1)) + { + m_plannedAction = BOOTSTRAPPER_ACTION_CACHE; + } + else if (m_sdOverridableVariables) + { + const wchar_t* pwc = wcschr(argv[i], L'='); + if (pwc) + { + hr = StrAllocString(&sczVariableName, argv[i], pwc - argv[i]); + BalExitOnFailure(hr, "Failed to copy variable name."); + + hr = DictKeyExists(m_sdOverridableVariables, sczVariableName); + if (E_NOTFOUND == hr) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to set non-overridable variable: '%ls'.", sczVariableName); + hr = S_OK; + continue; + } + ExitOnFailure(hr, "Failed to check the dictionary of overridable variables."); + + hr = StrAllocString(&sczVariableValue, ++pwc, 0); + BalExitOnFailure(hr, "Failed to copy variable value."); + + hr = m_pEngine->SetVariableString(sczVariableName, sczVariableValue, FALSE); + BalExitOnFailure(hr, "Failed to set variable."); + } + else + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Ignoring unknown argument: %ls", argv[i]); + } + } + } + } + + LExit: + if (argv) + { + AppFreeCommandLineArgs(argv); + } + + ReleaseStr(sczVariableName); + ReleaseStr(sczVariableValue); + + return hr; + } + + HRESULT LoadLocalization( + __in_z LPCWSTR wzModulePath, + __in_z_opt LPCWSTR wzLanguage + ) + { + HRESULT hr = S_OK; + LPWSTR sczLocPath = NULL; + LPWSTR sczFormatted = NULL; + LPCWSTR wzLocFileName = m_fPrereq ? L"mbapreq.wxl" : L"thm.wxl"; + + // Find and load .wxl file. + hr = LocProbeForFile(wzModulePath, wzLocFileName, wzLanguage, &sczLocPath); + BalExitOnFailure(hr, "Failed to probe for loc file: %ls in path: %ls", wzLocFileName, wzModulePath); + + hr = LocLoadFromFile(sczLocPath, &m_pWixLoc); + BalExitOnFailure(hr, "Failed to load loc file from path: %ls", sczLocPath); + + // Set WixStdBALanguageId to .wxl language id. + if (WIX_LOCALIZATION_LANGUAGE_NOT_SET != m_pWixLoc->dwLangId) + { + ::SetThreadLocale(m_pWixLoc->dwLangId); + + hr = m_pEngine->SetVariableNumeric(WIXSTDBA_VARIABLE_LANGUAGE_ID, m_pWixLoc->dwLangId); + BalExitOnFailure(hr, "Failed to set WixStdBALanguageId variable."); + } + + // Load ConfirmCancelMessage. + hr = StrAllocString(&m_sczConfirmCloseMessage, L"#(loc.ConfirmCancelMessage)", 0); + ExitOnFailure(hr, "Failed to initialize confirm message loc identifier."); + + hr = LocLocalizeString(m_pWixLoc, &m_sczConfirmCloseMessage); + BalExitOnFailure(hr, "Failed to localize confirm close message: %ls", m_sczConfirmCloseMessage); + + hr = BalFormatString(m_sczConfirmCloseMessage, &sczFormatted); + if (SUCCEEDED(hr)) + { + ReleaseStr(m_sczConfirmCloseMessage); + m_sczConfirmCloseMessage = sczFormatted; + sczFormatted = NULL; + } + + LExit: + ReleaseStr(sczFormatted); + ReleaseStr(sczLocPath); + + return hr; + } + + + HRESULT LoadTheme( + __in_z LPCWSTR wzModulePath, + __in_z_opt LPCWSTR wzLanguage + ) + { + HRESULT hr = S_OK; + LPWSTR sczThemePath = NULL; + LPCWSTR wzThemeFileName = m_fPrereq ? L"mbapreq.thm" : L"thm.xml"; + + hr = LocProbeForFile(wzModulePath, wzThemeFileName, wzLanguage, &sczThemePath); + BalExitOnFailure(hr, "Failed to probe for theme file: %ls in path: %ls", wzThemeFileName, wzModulePath); + + hr = ThemeLoadFromFile(sczThemePath, &m_pTheme); + BalExitOnFailure(hr, "Failed to load theme from path: %ls", sczThemePath); + + hr = ThemeRegisterVariableCallbacks(m_pTheme, EvaluateVariableConditionCallback, FormatVariableStringCallback, GetVariableNumericCallback, SetVariableNumericCallback, GetVariableStringCallback, SetVariableStringCallback, NULL); + BalExitOnFailure(hr, "Failed to register variable theme callbacks."); + + hr = ThemeLocalize(m_pTheme, m_pWixLoc); + BalExitOnFailure(hr, "Failed to localize theme: %ls", sczThemePath); + + LExit: + ReleaseStr(sczThemePath); + + return hr; + } + + + HRESULT ParseOverridableVariablesFromXml( + __in IXMLDOMDocument* pixdManifest + ) + { + HRESULT hr = S_OK; + IXMLDOMNode* pNode = NULL; + IXMLDOMNodeList* pNodes = NULL; + DWORD cNodes = 0; + LPWSTR scz = NULL; + + // Get the list of variables users can override on the command line. + hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOverridableVariable", &pNodes); + if (S_FALSE == hr) + { + ExitFunction1(hr = S_OK); + } + ExitOnFailure(hr, "Failed to select overridable variable nodes."); + + hr = pNodes->get_length((long*)&cNodes); + ExitOnFailure(hr, "Failed to get overridable variable node count."); + + if (cNodes) + { + hr = DictCreateStringList(&m_sdOverridableVariables, 32, DICT_FLAG_NONE); + ExitOnFailure(hr, "Failed to create the string dictionary."); + + for (DWORD i = 0; i < cNodes; ++i) + { + hr = XmlNextElement(pNodes, &pNode, NULL); + ExitOnFailure(hr, "Failed to get next node."); + + // @Name + hr = XmlGetAttributeEx(pNode, L"Name", &scz); + ExitOnFailure(hr, "Failed to get @Name."); + + hr = DictAddKey(m_sdOverridableVariables, scz); + ExitOnFailure(hr, "Failed to add \"%ls\" to the string dictionary.", scz); + + // prepare next iteration + ReleaseNullObject(pNode); + } + } + + LExit: + ReleaseObject(pNode); + ReleaseObject(pNodes); + ReleaseStr(scz); + return hr; + } + + + HRESULT InitializePackageInfo() + { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pPackage = NULL; + + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + pPackage = &m_Bundle.packages.rgPackages[i]; + + hr = InitializePackageInfoForPackage(pPackage); + BalExitOnFailure(hr, "Failed to initialize wixstdba package info for package: %ls.", pPackage->sczId); + } + + LExit: + return hr; + } + + + HRESULT InitializePackageInfoForPackage( + __in BAL_INFO_PACKAGE* pPackage + ) + { + HRESULT hr = S_OK; + + pPackage->pvCustomData = MemAlloc(sizeof(WIXSTDBA_PACKAGE_INFO), TRUE); + BalExitOnNull(pPackage->pvCustomData, hr, E_OUTOFMEMORY, "Failed to allocate memory for wixstdba package info."); + + LExit: + return hr; + } + + + HRESULT InitializePrerequisiteInformation() + { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pPackage = NULL; + + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + pPackage = &m_Bundle.packages.rgPackages[i]; + if (!pPackage->fPrereqPackage) + { + continue; + } + + if (pPackage->sczPrereqLicenseFile) + { + if (m_sczLicenseFile) + { + hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + BalExitOnFailure(hr, "More than one license file specified in prerequisite info."); + } + + hr = StrAllocString(&m_sczLicenseFile, pPackage->sczPrereqLicenseFile, 0); + BalExitOnFailure(hr, "Failed to copy license file location from prereq package."); + } + + if (pPackage->sczPrereqLicenseUrl) + { + if (m_sczLicenseUrl) + { + hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + BalExitOnFailure(hr, "More than one license URL specified in prerequisite info."); + } + + hr = StrAllocString(&m_sczLicenseUrl, pPackage->sczPrereqLicenseUrl, 0); + BalExitOnFailure(hr, "Failed to copy license URL from prereq package."); + } + } + + LExit: + return hr; + } + + + HRESULT ParseBootstrapperApplicationDataFromXml( + __in IXMLDOMDocument* pixdManifest + ) + { + HRESULT hr = S_OK; + IXMLDOMNode* pNode = NULL; + DWORD dwBool = 0; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaInformation", &pNode); + if (S_FALSE == hr) + { + hr = E_INVALIDARG; + } + BalExitOnFailure(hr, "BootstrapperApplication.xml manifest is missing wixstdba information."); + + hr = XmlGetAttributeEx(pNode, L"LicenseFile", &m_sczLicenseFile); + if (E_NOTFOUND == hr) + { + hr = S_OK; + } + BalExitOnFailure(hr, "Failed to get license file."); + + hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &m_sczLicenseUrl); + if (E_NOTFOUND == hr) + { + hr = S_OK; + } + BalExitOnFailure(hr, "Failed to get license URL."); + + ReleaseObject(pNode); + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOptions", &pNode); + if (S_FALSE == hr) + { + ExitFunction1(hr = S_OK); + } + BalExitOnFailure(hr, "Failed to read wixstdba options from BootstrapperApplication.xml manifest."); + + hr = XmlGetAttributeNumber(pNode, L"SuppressOptionsUI", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr) && dwBool) + { + hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI, 1); + BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI); + } + BalExitOnFailure(hr, "Failed to get SuppressOptionsUI value."); + + dwBool = 0; + hr = XmlGetAttributeNumber(pNode, L"SuppressDowngradeFailure", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr)) + { + m_fSuppressDowngradeFailure = 0 < dwBool; + } + BalExitOnFailure(hr, "Failed to get SuppressDowngradeFailure value."); + + dwBool = 0; + hr = XmlGetAttributeNumber(pNode, L"SuppressRepair", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr)) + { + m_fSuppressRepair = 0 < dwBool; + } + BalExitOnFailure(hr, "Failed to get SuppressRepair value."); + + hr = XmlGetAttributeNumber(pNode, L"ShowVersion", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr) && dwBool) + { + hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SHOW_VERSION, 1); + BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SHOW_VERSION); + } + BalExitOnFailure(hr, "Failed to get ShowVersion value."); + + hr = XmlGetAttributeNumber(pNode, L"SupportCacheOnly", &dwBool); + if (S_FALSE == hr) + { + hr = S_OK; + } + else if (SUCCEEDED(hr)) + { + m_fSupportCacheOnly = 0 < dwBool; + } + BalExitOnFailure(hr, "Failed to get SupportCacheOnly value."); + + LExit: + ReleaseObject(pNode); + return hr; + } + + HRESULT GetPackageInfo( + __in_z LPCWSTR wzPackageId, + __out WIXSTDBA_PACKAGE_INFO** ppPackageInfo, + __out BAL_INFO_PACKAGE** ppPackage + ) + { + HRESULT hr = E_NOTFOUND; + WIXSTDBA_PACKAGE_INFO* pPackageInfo = NULL; + BAL_INFO_PACKAGE* pPackage = NULL; + + Assert(wzPackageId && *wzPackageId); + Assert(ppPackage); + Assert(ppPackageInfo); + + hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed trying to find the requested package."); + + pPackageInfo = reinterpret_cast(pPackage->pvCustomData); + } + + *ppPackageInfo = pPackageInfo; + *ppPackage = pPackage; + + LExit: + return hr; + } + + + // + // Get the file version of the bootstrapper and record in bootstrapper log file + // + HRESULT GetBundleFileVersion() + { + HRESULT hr = S_OK; + ULARGE_INTEGER uliVersion = { }; + LPWSTR sczCurrentPath = NULL; + VERUTIL_VERSION* pVersion = NULL; + + hr = PathForCurrentProcess(&sczCurrentPath, NULL); + BalExitOnFailure(hr, "Failed to get bundle path."); + + hr = FileVersion(sczCurrentPath, &uliVersion.HighPart, &uliVersion.LowPart); + BalExitOnFailure(hr, "Failed to get bundle file version."); + + hr = VerVersionFromQword(uliVersion.QuadPart, &pVersion); + BalExitOnFailure(hr, "Failed to create bundle file version."); + + hr = m_pEngine->SetVariableVersion(WIXSTDBA_VARIABLE_BUNDLE_FILE_VERSION, pVersion->sczVersion); + BalExitOnFailure(hr, "Failed to set WixBundleFileVersion variable."); + + LExit: + ReleaseVerutilVersion(pVersion); + ReleaseStr(sczCurrentPath); + + return hr; + } + + + // + // CreateMainWindow - creates the main install window. + // + HRESULT CreateMainWindow() + { + HRESULT hr = S_OK; + HICON hIcon = reinterpret_cast(m_pTheme->hIcon); + WNDCLASSW wc = { }; + DWORD dwWindowStyle = 0; + int x = CW_USEDEFAULT; + int y = CW_USEDEFAULT; + POINT ptCursor = { }; + + // If the theme did not provide an icon, try using the icon from the bundle engine. + if (!hIcon) + { + HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL); + if (hBootstrapperEngine) + { + hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1)); + } + } + + // Register the window class and create the window. + wc.lpfnWndProc = CWixStandardBootstrapperApplication::WndProc; + wc.hInstance = m_hModule; + wc.hIcon = hIcon; + wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); + wc.hbrBackground = m_pTheme->rgFonts[m_pTheme->dwFontId].hBackground; + wc.lpszMenuName = NULL; + wc.lpszClassName = WIXSTDBA_WINDOW_CLASS; + if (!::RegisterClassW(&wc)) + { + ExitWithLastError(hr, "Failed to register window."); + } + + m_fRegistered = TRUE; + + // Calculate the window style based on the theme style and command display value. + dwWindowStyle = m_pTheme->dwStyle; + if (BOOTSTRAPPER_DISPLAY_NONE >= m_command.display) + { + dwWindowStyle &= ~WS_VISIBLE; + } + + // Don't show the window if there is a splash screen (it will be made visible when the splash screen is hidden) + if (::IsWindow(m_command.hwndSplashScreen)) + { + dwWindowStyle &= ~WS_VISIBLE; + } + + // Center the window on the monitor with the mouse. + if (::GetCursorPos(&ptCursor)) + { + x = ptCursor.x; + y = ptCursor.y; + } + + hr = ThemeCreateParentWindow(m_pTheme, 0, wc.lpszClassName, m_pTheme->sczCaption, dwWindowStyle, x, y, HWND_DESKTOP, m_hModule, this, THEME_WINDOW_INITIAL_POSITION_CENTER_MONITOR_FROM_COORDINATES, &m_hWnd); + ExitOnFailure(hr, "Failed to create window."); + + hr = S_OK; + + LExit: + return hr; + } + + + // + // InitializeTaskbarButton - initializes taskbar button for progress. + // + void InitializeTaskbarButton() + { + HRESULT hr = S_OK; + + hr = ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, __uuidof(ITaskbarList3), reinterpret_cast(&m_pTaskbarList)); + if (REGDB_E_CLASSNOTREG == hr) // not supported before Windows 7 + { + ExitFunction1(hr = S_OK); + } + BalExitOnFailure(hr, "Failed to create ITaskbarList3. Continuing."); + + m_uTaskbarButtonCreatedMessage = ::RegisterWindowMessageW(L"TaskbarButtonCreated"); + BalExitOnNullWithLastError(m_uTaskbarButtonCreatedMessage, hr, "Failed to get TaskbarButtonCreated message. Continuing."); + + LExit: + return; + } + + // + // DestroyMainWindow - clean up all the window registration. + // + void DestroyMainWindow() + { + if (::IsWindow(m_hWnd)) + { + ::DestroyWindow(m_hWnd); + m_hWnd = NULL; + m_fTaskbarButtonOK = FALSE; + } + + if (m_fRegistered) + { + ::UnregisterClassW(WIXSTDBA_WINDOW_CLASS, m_hModule); + m_fRegistered = FALSE; + } + } + + + // + // UninitializeTaskbarButton - clean up the taskbar registration. + // + void UninitializeTaskbarButton() + { + m_fTaskbarButtonOK = FALSE; + ReleaseNullObject(m_pTaskbarList); + } + + + static LRESULT CallDefaultWndProc( + __in CWixStandardBootstrapperApplication* pBA, + __in HWND hWnd, + __in UINT uMsg, + __in WPARAM wParam, + __in LPARAM lParam + ) + { + LRESULT lres = NULL; + THEME* pTheme = NULL; + HRESULT hr = S_OK; + BA_FUNCTIONS_WNDPROC_ARGS wndProcArgs = { }; + BA_FUNCTIONS_WNDPROC_RESULTS wndProcResults = { }; + + if (pBA) + { + pTheme = pBA->m_pTheme; + + if (pBA->m_pfnBAFunctionsProc) + { + wndProcArgs.cbSize = sizeof(wndProcArgs); + wndProcArgs.pTheme = pTheme; + wndProcArgs.hWnd = hWnd; + wndProcArgs.uMsg = uMsg; + wndProcArgs.wParam = wParam; + wndProcArgs.lParam = lParam; + wndProcResults.cbSize = sizeof(wndProcResults); + + hr = pBA->m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_WNDPROC, &wndProcArgs, &wndProcResults, pBA->m_pvBAFunctionsProcContext); + if (E_NOTIMPL != hr) + { + lres = wndProcResults.lres; + ExitFunction(); + } + } + } + + lres = ThemeDefWindowProc(pTheme, hWnd, uMsg, wParam, lParam); + + LExit: + return lres; + } + + // + // WndProc - standard windows message handler. + // + static LRESULT CALLBACK WndProc( + __in HWND hWnd, + __in UINT uMsg, + __in WPARAM wParam, + __in LPARAM lParam + ) + { +#pragma warning(suppress:4312) + CWixStandardBootstrapperApplication* pBA = reinterpret_cast(::GetWindowLongPtrW(hWnd, GWLP_USERDATA)); + BOOL fCancel = FALSE; + + switch (uMsg) + { + case WM_NCCREATE: + { + LPCREATESTRUCT lpcs = reinterpret_cast(lParam); + pBA = reinterpret_cast(lpcs->lpCreateParams); +#pragma warning(suppress:4244) + ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, reinterpret_cast(pBA)); + } + break; + + case WM_NCDESTROY: + { + LRESULT lres = CallDefaultWndProc(pBA, hWnd, uMsg, wParam, lParam); + ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, 0); + ::PostQuitMessage(0); + return lres; + } + + case WM_CREATE: + if (!pBA->OnCreate(hWnd)) + { + return -1; + } + break; + + case WM_QUERYENDSESSION: + fCancel = true; + pBA->OnSystemShutdown(static_cast(lParam), &fCancel); + return !fCancel; + + case WM_CLOSE: + // If the user chose not to close, do *not* let the default window proc handle the message. + if (!pBA->OnClose()) + { + return 0; + } + break; + + case WM_WIXSTDBA_SHOW_HELP: + pBA->OnShowHelp(); + return 0; + + case WM_WIXSTDBA_DETECT_PACKAGES: + pBA->OnDetect(); + return 0; + + case WM_WIXSTDBA_PLAN_PACKAGES: + pBA->OnPlan(static_cast(lParam)); + return 0; + + case WM_WIXSTDBA_APPLY_PACKAGES: + pBA->OnApply(); + return 0; + + case WM_WIXSTDBA_CHANGE_STATE: + pBA->OnChangeState(static_cast(lParam)); + return 0; + + case WM_WIXSTDBA_SHOW_FAILURE: + pBA->OnShowFailure(); + return 0; + + case WM_COMMAND: + switch (HIWORD(wParam)) + { + case BN_CLICKED: + switch (LOWORD(wParam)) + { + case WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX: + pBA->OnClickAcceptCheckbox(); + return 0; + + case WIXSTDBA_CONTROL_INSTALL_BUTTON: + pBA->OnClickInstallButton(); + return 0; + + case WIXSTDBA_CONTROL_REPAIR_BUTTON: + pBA->OnClickRepairButton(); + return 0; + + case WIXSTDBA_CONTROL_UNINSTALL_BUTTON: + pBA->OnClickUninstallButton(); + return 0; + + case WIXSTDBA_CONTROL_LAUNCH_BUTTON: + pBA->OnClickLaunchButton(); + return 0; + + case WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON: __fallthrough; + case WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON: + pBA->OnClickRestartButton(); + return 0; + + case WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON: + pBA->OnClickCloseButton(); + return 0; + } + break; + } + break; + + case WM_NOTIFY: + if (lParam) + { + LPNMHDR pnmhdr = reinterpret_cast(lParam); + switch (pnmhdr->code) + { + case NM_CLICK: __fallthrough; + case NM_RETURN: + switch (static_cast(pnmhdr->idFrom)) + { + case WIXSTDBA_CONTROL_EULA_LINK: + pBA->OnClickEulaLink(); + return 1; + case WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK: + pBA->OnClickLogFileLink(); + return 1; + } + } + } + break; + } + + if (pBA && pBA->m_pTaskbarList && uMsg == pBA->m_uTaskbarButtonCreatedMessage) + { + pBA->m_fTaskbarButtonOK = TRUE; + return 0; + } + + return CallDefaultWndProc(pBA, hWnd, uMsg, wParam, lParam); + } + + + // + // OnCreate - finishes loading the theme. + // + BOOL OnCreate( + __in HWND /*hWnd*/ + ) + { + HRESULT hr = S_OK; + LPWSTR sczLicenseFormatted = NULL; + LPWSTR sczLicensePath = NULL; + LPWSTR sczLicenseDirectory = NULL; + LPWSTR sczLicenseFilename = NULL; + BA_FUNCTIONS_ONTHEMELOADED_ARGS themeLoadedArgs = { }; + BA_FUNCTIONS_ONTHEMELOADED_RESULTS themeLoadedResults = { }; + + hr = ThemeLoadControls(m_pTheme, vrgInitControls, countof(vrgInitControls)); + BalExitOnFailure(hr, "Failed to load theme controls."); + + C_ASSERT(COUNT_WIXSTDBA_PAGE == countof(vrgwzPageNames)); + C_ASSERT(countof(m_rgdwPageIds) == countof(vrgwzPageNames)); + + ThemeGetPageIds(m_pTheme, vrgwzPageNames, m_rgdwPageIds, countof(m_rgdwPageIds)); + + // Load the RTF EULA control with text if the control exists. + if (ThemeControlExists(m_pTheme, WIXSTDBA_CONTROL_EULA_RICHEDIT)) + { + hr = (m_sczLicenseFile && *m_sczLicenseFile) ? S_OK : E_INVALIDDATA; + if (SUCCEEDED(hr)) + { + hr = StrAllocString(&sczLicenseFormatted, m_sczLicenseFile, 0); + if (SUCCEEDED(hr)) + { + hr = LocLocalizeString(m_pWixLoc, &sczLicenseFormatted); + if (SUCCEEDED(hr)) + { + // Assume there is no hidden variables to be formatted + // so don't worry about securely freeing it. + hr = BalFormatString(sczLicenseFormatted, &sczLicenseFormatted); + if (SUCCEEDED(hr)) + { + hr = PathRelativeToModule(&sczLicensePath, sczLicenseFormatted, m_hModule); + if (SUCCEEDED(hr)) + { + hr = PathGetDirectory(sczLicensePath, &sczLicenseDirectory); + if (SUCCEEDED(hr)) + { + hr = StrAllocString(&sczLicenseFilename, PathFile(sczLicenseFormatted), 0); + if (SUCCEEDED(hr)) + { + hr = LocProbeForFile(sczLicenseDirectory, sczLicenseFilename, m_sczLanguage, &sczLicensePath); + if (SUCCEEDED(hr)) + { + hr = ThemeLoadRichEditFromFile(m_pTheme, WIXSTDBA_CONTROL_EULA_RICHEDIT, sczLicensePath, m_hModule); + } + } + } + } + } + } + } + } + + if (FAILED(hr)) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to load file into license richedit control from path '%ls' manifest value: %ls", sczLicensePath, m_sczLicenseFile); + hr = S_OK; + } + } + + if (m_pfnBAFunctionsProc) + { + themeLoadedArgs.cbSize = sizeof(themeLoadedArgs); + themeLoadedArgs.pTheme = m_pTheme; + themeLoadedArgs.pWixLoc = m_pWixLoc; + themeLoadedResults.cbSize = sizeof(themeLoadedResults); + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMELOADED, &themeLoadedArgs, &themeLoadedResults, m_pvBAFunctionsProcContext); + BalExitOnFailure(hr, "BAFunctions OnThemeLoaded failed."); + } + + LExit: + ReleaseStr(sczLicenseFilename); + ReleaseStr(sczLicenseDirectory); + ReleaseStr(sczLicensePath); + ReleaseStr(sczLicenseFormatted); + + return SUCCEEDED(hr); + } + + + // + // OnShowFailure - display the failure page. + // + void OnShowFailure() + { + SetState(WIXSTDBA_STATE_FAILED, S_OK); + + // If the UI should be visible, display it now and hide the splash screen + if (BOOTSTRAPPER_DISPLAY_NONE < m_command.display) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + + return; + } + + + // + // OnShowHelp - display the help page. + // + void OnShowHelp() + { + SetState(WIXSTDBA_STATE_HELP, S_OK); + + // If the UI should be visible, display it now and hide the splash screen + if (BOOTSTRAPPER_DISPLAY_NONE < m_command.display) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + + return; + } + + + // + // OnDetect - start the processing of packages. + // + void OnDetect() + { + HRESULT hr = S_OK; + + SetState(WIXSTDBA_STATE_DETECTING, hr); + + // If the UI should be visible, display it now and hide the splash screen + if (BOOTSTRAPPER_DISPLAY_NONE < m_command.display) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + + // Tell the core we're ready for the packages to be processed now. + hr = m_pEngine->Detect(); + BalExitOnFailure(hr, "Failed to start detecting chain."); + + LExit: + if (FAILED(hr)) + { + SetState(WIXSTDBA_STATE_DETECTING, hr); + } + + return; + } + + + // + // OnPlan - plan the detected changes. + // + void OnPlan( + __in BOOTSTRAPPER_ACTION action + ) + { + HRESULT hr = S_OK; + + m_plannedAction = action; + + // If we are going to apply a downgrade, bail. + if (m_fDowngrading && BOOTSTRAPPER_ACTION_UNINSTALL < action) + { + if (m_fSuppressDowngradeFailure) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "A newer version of this product is installed but downgrade failure has been suppressed; continuing..."); + } + else + { + hr = HRESULT_FROM_WIN32(ERROR_PRODUCT_VERSION); + BalExitOnFailure(hr, "Cannot install a product when a newer version is installed."); + } + } + + SetState(WIXSTDBA_STATE_PLANNING, hr); + + hr = m_pEngine->Plan(action); + BalExitOnFailure(hr, "Failed to start planning packages."); + + LExit: + if (FAILED(hr)) + { + SetState(WIXSTDBA_STATE_PLANNING, hr); + } + + return; + } + + + // + // OnApply - apply the packages. + // + void OnApply() + { + HRESULT hr = S_OK; + + SetState(WIXSTDBA_STATE_APPLYING, hr); + SetProgressState(hr); + SetTaskbarButtonProgress(0); + + hr = m_pEngine->Apply(m_hWnd); + BalExitOnFailure(hr, "Failed to start applying packages."); + + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON, TRUE); // ensure the cancel button is enabled before starting. + + LExit: + if (FAILED(hr)) + { + SetState(WIXSTDBA_STATE_APPLYING, hr); + } + + return; + } + + + // + // OnChangeState - change state. + // + void OnChangeState( + __in WIXSTDBA_STATE state + ) + { + WIXSTDBA_STATE stateOld = m_state; + DWORD dwOldPageId = 0; + DWORD dwNewPageId = 0; + LPWSTR sczText = NULL; + LPWSTR sczUnformattedText = NULL; + LPWSTR sczControlState = NULL; + LPWSTR sczControlName = NULL; + + m_state = state; + + // If our install is at the end (success or failure) and we're not showing full UI or + // we successfully installed the prerequisite then exit (prompt for restart if required). + if ((WIXSTDBA_STATE_APPLIED <= m_state && BOOTSTRAPPER_DISPLAY_FULL > m_command.display) || + (WIXSTDBA_STATE_APPLIED == m_state && m_fPrereq)) + { + // If a restart was required but we were not automatically allowed to + // accept the reboot then do the prompt. + if (m_fRestartRequired && !m_fAllowRestart) + { + StrAllocFromError(&sczUnformattedText, HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), NULL); + + int nResult = ::MessageBoxW(m_hWnd, sczUnformattedText ? sczUnformattedText : L"The requested operation is successful. Changes will not be effective until the system is rebooted.", m_pTheme->sczCaption, MB_ICONEXCLAMATION | MB_OKCANCEL); + m_fAllowRestart = (IDOK == nResult); + } + + // Quietly exit. + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + else // try to change the pages. + { + DeterminePageId(stateOld, &dwOldPageId); + DeterminePageId(m_state, &dwNewPageId); + + if (dwOldPageId != dwNewPageId) + { + // Enable disable controls per-page. + if (m_rgdwPageIds[WIXSTDBA_PAGE_INSTALL] == dwNewPageId) // on the "Install" page, ensure the install button is enabled/disabled correctly. + { + LONGLONG llElevated = 0; + if (m_Bundle.fPerMachine) + { + BalGetNumericVariable(WIXBUNDLE_VARIABLE_ELEVATED, &llElevated); + } + ThemeControlElevates(m_pTheme, WIXSTDBA_CONTROL_INSTALL_BUTTON, (m_Bundle.fPerMachine && !llElevated)); + + // If the EULA control exists, show it only if a license URL is provided as well. + if (ThemeControlExists(m_pTheme, WIXSTDBA_CONTROL_EULA_LINK)) + { + BOOL fEulaLink = (m_sczLicenseUrl && *m_sczLicenseUrl); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_EULA_LINK, fEulaLink); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX, fEulaLink); + } + + BOOL fAcceptedLicense = !ThemeControlExists(m_pTheme, WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX) || !ThemeControlEnabled(m_pTheme, WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX) || ThemeIsControlChecked(m_pTheme, WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_INSTALL_BUTTON, fAcceptedLicense); + } + else if (m_rgdwPageIds[WIXSTDBA_PAGE_MODIFY] == dwNewPageId) + { + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_REPAIR_BUTTON, !m_fSuppressRepair); + } + else if (m_rgdwPageIds[WIXSTDBA_PAGE_SUCCESS] == dwNewPageId) // on the "Success" page, check if the restart or launch button should be enabled. + { + BOOL fShowRestartButton = FALSE; + BOOL fLaunchTargetExists = FALSE; + if (m_fRestartRequired) + { + if (BOOTSTRAPPER_RESTART_PROMPT == m_command.restart) + { + fShowRestartButton = TRUE; + } + } + else if (ThemeControlExists(m_pTheme, WIXSTDBA_CONTROL_LAUNCH_BUTTON)) + { + fLaunchTargetExists = BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH); + } + + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_LAUNCH_BUTTON, fLaunchTargetExists && BOOTSTRAPPER_ACTION_UNINSTALL < m_plannedAction); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON, fShowRestartButton); + } + else if (m_rgdwPageIds[WIXSTDBA_PAGE_FAILURE] == dwNewPageId) // on the "Failure" page, show error message and check if the restart button should be enabled. + { + BOOL fShowLogLink = (m_Bundle.sczLogVariable && *m_Bundle.sczLogVariable); // if there is a log file variable then we'll assume the log file exists. + BOOL fShowErrorMessage = FALSE; + BOOL fShowRestartButton = FALSE; + + if (FAILED(m_hrFinal)) + { + // If we know the failure message, use that. + if (m_sczFailedMessage && *m_sczFailedMessage) + { + StrAllocString(&sczUnformattedText, m_sczFailedMessage, 0); + } + else if (E_MBAHOST_NET452_ON_WIN7RTM == m_hrFinal) + { + HRESULT hr = StrAllocString(&sczUnformattedText, L"#(loc.NET452WIN7RTMErrorMessage)", 0); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to initialize NET452WIN7RTMErrorMessage loc identifier."); + } + else + { + hr = LocLocalizeString(m_pWixLoc, &sczUnformattedText); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to localize NET452WIN7RTMErrorMessage: %ls", sczUnformattedText); + ReleaseNullStr(sczUnformattedText); + } + } + } + else if (E_DNCHOST_SCD_RUNTIME_FAILURE == m_hrFinal) + { + HRESULT hr = StrAllocString(&sczUnformattedText, L"#(loc.SCDRUNTIMEFAILUREErrorMessage)", 0); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to initialize SCDRUNTIMEFAILUREErrorMessage loc identifier."); + } + else + { + hr = LocLocalizeString(m_pWixLoc, &sczUnformattedText); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to localize SCDRUNTIMEFAILUREErrorMessage: %ls", sczUnformattedText); + ReleaseNullStr(sczUnformattedText); + } + } + } + else // try to get the error message from the error code. + { + StrAllocFromError(&sczUnformattedText, m_hrFinal, NULL); + if (!sczUnformattedText || !*sczUnformattedText) + { + StrAllocFromError(&sczUnformattedText, E_FAIL, NULL); + } + } + + if (E_WIXSTDBA_CONDITION_FAILED == m_hrFinal) + { + if (sczUnformattedText) + { + StrAllocString(&sczText, sczUnformattedText, 0); + } + } + else if (E_MBAHOST_NET452_ON_WIN7RTM == m_hrFinal) + { + if (sczUnformattedText) + { + BalFormatString(sczUnformattedText, &sczText); + } + } + else if (E_DNCHOST_SCD_RUNTIME_FAILURE == m_hrFinal) + { + if (sczUnformattedText) + { + BalFormatString(sczUnformattedText, &sczText); + } + } + else + { + StrAllocFormatted(&sczText, L"0x%08x - %ls", m_hrFinal, sczUnformattedText); + } + + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT, sczText); + fShowErrorMessage = TRUE; + } + + if (m_fRestartRequired) + { + if (BOOTSTRAPPER_RESTART_PROMPT == m_command.restart) + { + fShowRestartButton = TRUE; + } + } + + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK, fShowLogLink); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT, fShowErrorMessage); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON, fShowRestartButton); + } + + HRESULT hr = ThemeShowPage(m_pTheme, dwOldPageId, SW_HIDE); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to hide page: %u", dwOldPageId); + } + + hr = ThemeShowPage(m_pTheme, dwNewPageId, SW_SHOW); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to show page: %u", dwOldPageId); + } + + // On the install page set the focus to the install button or the next enabled control if install is disabled. + if (m_rgdwPageIds[WIXSTDBA_PAGE_INSTALL] == dwNewPageId) + { + ThemeSetFocus(m_pTheme, WIXSTDBA_CONTROL_INSTALL_BUTTON); + } + } + } + + ReleaseStr(sczText); + ReleaseStr(sczUnformattedText); + ReleaseStr(sczControlState); + ReleaseStr(sczControlName); + } + + + // + // OnClose - called when the window is trying to be closed. + // + BOOL OnClose() + { + BOOL fClose = FALSE; + BOOL fCancel = FALSE; + + // If we've already succeeded or failed or showing the help page, just close (prompts are annoying if the bootstrapper is done). + if (WIXSTDBA_STATE_APPLIED <= m_state || WIXSTDBA_STATE_HELP == m_state) + { + fClose = TRUE; + } + else // prompt the user or force the cancel if there is no UI. + { + ::EnterCriticalSection(&m_csShowingInternalUiThisPackage); + fClose = PromptCancel( + m_hWnd, + BOOTSTRAPPER_DISPLAY_FULL != m_command.display || m_fShowingInternalUiThisPackage, + m_sczConfirmCloseMessage ? m_sczConfirmCloseMessage : L"Are you sure you want to cancel?", + m_pTheme->sczCaption); + ::LeaveCriticalSection(&m_csShowingInternalUiThisPackage); + + fCancel = fClose; + } + + // If we're doing progress then we never close, we just cancel to let rollback occur. + if (WIXSTDBA_STATE_APPLYING <= m_state && WIXSTDBA_STATE_APPLIED > m_state) + { + // If we canceled, disable cancel button since clicking it again is silly. + if (fClose) + { + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON, FALSE); + } + + fClose = FALSE; + } + + if (fClose) + { + DWORD dwCurrentPageId = 0; + DeterminePageId(m_state, &dwCurrentPageId); + + // Hide the current page to let thmutil do its thing with variables. + ThemeShowPageEx(m_pTheme, dwCurrentPageId, SW_HIDE, fCancel ? THEME_SHOW_PAGE_REASON_CANCEL : THEME_SHOW_PAGE_REASON_DEFAULT); + } + + return fClose; + } + + + // + // OnClickAcceptCheckbox - allow the install to continue. + // + void OnClickAcceptCheckbox() + { + BOOL fAcceptedLicense = ThemeIsControlChecked(m_pTheme, WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX); + ThemeControlEnable(m_pTheme, WIXSTDBA_CONTROL_INSTALL_BUTTON, fAcceptedLicense); + } + + + // + // OnClickInstallButton - start the install by planning the packages. + // + void OnClickInstallButton() + { + this->OnPlan(BOOTSTRAPPER_ACTION_INSTALL); + } + + + // + // OnClickRepairButton - start the repair. + // + void OnClickRepairButton() + { + this->OnPlan(BOOTSTRAPPER_ACTION_REPAIR); + } + + + // + // OnClickUninstallButton - start the uninstall. + // + void OnClickUninstallButton() + { + this->OnPlan(BOOTSTRAPPER_ACTION_UNINSTALL); + } + + + // + // OnClickCloseButton - close the application. + // + void OnClickCloseButton() + { + ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + + + // + // OnClickEulaLink - show the end user license agreement. + // + void OnClickEulaLink() + { + HRESULT hr = S_OK; + LPWSTR sczLicenseUrl = NULL; + LPWSTR sczLicensePath = NULL; + LPWSTR sczLicenseDirectory = NULL; + LPWSTR sczLicenseFilename = NULL; + URI_PROTOCOL protocol = URI_PROTOCOL_UNKNOWN; + + hr = StrAllocString(&sczLicenseUrl, m_sczLicenseUrl, 0); + BalExitOnFailure(hr, "Failed to copy license URL: %ls", m_sczLicenseUrl); + + hr = LocLocalizeString(m_pWixLoc, &sczLicenseUrl); + BalExitOnFailure(hr, "Failed to localize license URL: %ls", m_sczLicenseUrl); + + // Assume there is no hidden variables to be formatted + // so don't worry about securely freeing it. + hr = BalFormatString(sczLicenseUrl, &sczLicenseUrl); + BalExitOnFailure(hr, "Failed to get formatted license URL: %ls", m_sczLicenseUrl); + + hr = UriProtocol(sczLicenseUrl, &protocol); + if (FAILED(hr) || URI_PROTOCOL_UNKNOWN == protocol) + { + // Probe for localized license file + hr = PathRelativeToModule(&sczLicensePath, sczLicenseUrl, m_hModule); + if (SUCCEEDED(hr)) + { + hr = PathGetDirectory(sczLicensePath, &sczLicenseDirectory); + if (SUCCEEDED(hr)) + { + hr = LocProbeForFile(sczLicenseDirectory, PathFile(sczLicenseUrl), m_sczLanguage, &sczLicensePath); + } + } + } + + hr = ShelExecUnelevated(sczLicensePath ? sczLicensePath : sczLicenseUrl, NULL, L"open", NULL, SW_SHOWDEFAULT); + BalExitOnFailure(hr, "Failed to launch URL to EULA."); + + LExit: + ReleaseStr(sczLicensePath); + ReleaseStr(sczLicenseUrl); + ReleaseStr(sczLicenseDirectory); + ReleaseStr(sczLicenseFilename); + + return; + } + + + // + // OnClickLaunchButton - launch the app from the success page. + // + void OnClickLaunchButton() + { + HRESULT hr = S_OK; + LPWSTR sczUnformattedLaunchTarget = NULL; + LPWSTR sczLaunchTarget = NULL; + LPWSTR sczLaunchTargetElevatedId = NULL; + LPWSTR sczUnformattedArguments = NULL; + LPWSTR sczArguments = NULL; + LPWSTR sczUnformattedLaunchFolder = NULL; + LPWSTR sczLaunchFolder = NULL; + int nCmdShow = SW_SHOWNORMAL; + + hr = BalGetStringVariable(WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH, &sczUnformattedLaunchTarget); + BalExitOnFailure(hr, "Failed to get launch target variable '%ls'.", WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH); + + hr = BalFormatString(sczUnformattedLaunchTarget, &sczLaunchTarget); + BalExitOnFailure(hr, "Failed to format launch target variable: %ls", sczUnformattedLaunchTarget); + + if (BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_TARGET_ELEVATED_ID)) + { + hr = BalGetStringVariable(WIXSTDBA_VARIABLE_LAUNCH_TARGET_ELEVATED_ID, &sczLaunchTargetElevatedId); + BalExitOnFailure(hr, "Failed to get launch target elevated id '%ls'.", WIXSTDBA_VARIABLE_LAUNCH_TARGET_ELEVATED_ID); + } + + if (BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_ARGUMENTS)) + { + hr = BalGetStringVariable(WIXSTDBA_VARIABLE_LAUNCH_ARGUMENTS, &sczUnformattedArguments); + BalExitOnFailure(hr, "Failed to get launch arguments '%ls'.", WIXSTDBA_VARIABLE_LAUNCH_ARGUMENTS); + } + + if (BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_HIDDEN)) + { + nCmdShow = SW_HIDE; + } + + if (BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_WORK_FOLDER)) + { + hr = BalGetStringVariable(WIXSTDBA_VARIABLE_LAUNCH_WORK_FOLDER, &sczUnformattedLaunchFolder); + BalExitOnFailure(hr, "Failed to get launch working directory variable '%ls'.", WIXSTDBA_VARIABLE_LAUNCH_WORK_FOLDER); + } + + if (sczLaunchTargetElevatedId && !m_fTriedToLaunchElevated) + { + m_fTriedToLaunchElevated = TRUE; + hr = m_pEngine->LaunchApprovedExe(m_hWnd, sczLaunchTargetElevatedId, sczUnformattedArguments, 0); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to launch elevated target: %ls", sczLaunchTargetElevatedId); + + //try with ShelExec next time + OnClickLaunchButton(); + } + } + else + { + if (sczUnformattedArguments) + { + hr = BalFormatString(sczUnformattedArguments, &sczArguments); + BalExitOnFailure(hr, "Failed to format launch arguments variable: %ls", sczUnformattedArguments); + } + + if (sczUnformattedLaunchFolder) + { + hr = BalFormatString(sczUnformattedLaunchFolder, &sczLaunchFolder); + BalExitOnFailure(hr, "Failed to format launch working directory variable: %ls", sczUnformattedLaunchFolder); + } + + hr = ShelExec(sczLaunchTarget, sczArguments, L"open", sczLaunchFolder, nCmdShow, m_hWnd, NULL); + BalExitOnFailure(hr, "Failed to launch target: %ls", sczLaunchTarget); + + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + + LExit: + StrSecureZeroFreeString(sczLaunchFolder); + ReleaseStr(sczUnformattedLaunchFolder); + StrSecureZeroFreeString(sczArguments); + ReleaseStr(sczUnformattedArguments); + ReleaseStr(sczLaunchTargetElevatedId); + StrSecureZeroFreeString(sczLaunchTarget); + ReleaseStr(sczUnformattedLaunchTarget); + + return; + } + + + // + // OnClickRestartButton - allows the restart and closes the app. + // + void OnClickRestartButton() + { + AssertSz(m_fRestartRequired, "Restart must be requested to be able to click on the restart button."); + + m_fAllowRestart = TRUE; + ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); + + return; + } + + + // + // OnClickLogFileLink - show the log file. + // + void OnClickLogFileLink() + { + HRESULT hr = S_OK; + LPWSTR sczLogFile = NULL; + + hr = BalGetStringVariable(m_Bundle.sczLogVariable, &sczLogFile); + BalExitOnFailure(hr, "Failed to get log file variable '%ls'.", m_Bundle.sczLogVariable); + + hr = ShelExecUnelevated(L"notepad.exe", sczLogFile, L"open", NULL, SW_SHOWDEFAULT); + BalExitOnFailure(hr, "Failed to open log file target: %ls", sczLogFile); + + LExit: + ReleaseStr(sczLogFile); + + return; + } + + + // + // SetState + // + void SetState( + __in WIXSTDBA_STATE state, + __in HRESULT hrStatus + ) + { + if (FAILED(hrStatus)) + { + m_hrFinal = hrStatus; + } + + if (FAILED(m_hrFinal)) + { + state = WIXSTDBA_STATE_FAILED; + } + + if (m_state < state) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_CHANGE_STATE, 0, state); + } + } + + + void DeterminePageId( + __in WIXSTDBA_STATE state, + __out DWORD* pdwPageId + ) + { + if (BOOTSTRAPPER_DISPLAY_PASSIVE == m_command.display) + { + switch (state) + { + case WIXSTDBA_STATE_INITIALIZED: + *pdwPageId = BOOTSTRAPPER_ACTION_HELP == m_command.action ? m_rgdwPageIds[WIXSTDBA_PAGE_HELP] : m_rgdwPageIds[WIXSTDBA_PAGE_LOADING]; + break; + + case WIXSTDBA_STATE_HELP: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_HELP]; + break; + + case WIXSTDBA_STATE_DETECTING: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_LOADING] ? m_rgdwPageIds[WIXSTDBA_PAGE_LOADING] : m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS_PASSIVE] ? m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS_PASSIVE] : m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS]; + break; + + case WIXSTDBA_STATE_DETECTED: __fallthrough; + case WIXSTDBA_STATE_PLANNING: __fallthrough; + case WIXSTDBA_STATE_PLANNED: __fallthrough; + case WIXSTDBA_STATE_APPLYING: __fallthrough; + case WIXSTDBA_STATE_CACHING: __fallthrough; + case WIXSTDBA_STATE_CACHED: __fallthrough; + case WIXSTDBA_STATE_EXECUTING: __fallthrough; + case WIXSTDBA_STATE_EXECUTED: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS_PASSIVE] ? m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS_PASSIVE] : m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS]; + break; + + default: + *pdwPageId = 0; + break; + } + } + else if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display) + { + switch (state) + { + case WIXSTDBA_STATE_INITIALIZING: + *pdwPageId = 0; + break; + + case WIXSTDBA_STATE_INITIALIZED: + *pdwPageId = BOOTSTRAPPER_ACTION_HELP == m_command.action ? m_rgdwPageIds[WIXSTDBA_PAGE_HELP] : m_rgdwPageIds[WIXSTDBA_PAGE_LOADING]; + break; + + case WIXSTDBA_STATE_HELP: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_HELP]; + break; + + case WIXSTDBA_STATE_DETECTING: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_LOADING]; + break; + + case WIXSTDBA_STATE_DETECTED: + switch (m_command.action) + { + case BOOTSTRAPPER_ACTION_INSTALL: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_INSTALL]; + break; + + case BOOTSTRAPPER_ACTION_MODIFY: __fallthrough; + case BOOTSTRAPPER_ACTION_REPAIR: __fallthrough; + case BOOTSTRAPPER_ACTION_UNINSTALL: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_MODIFY]; + break; + } + break; + + case WIXSTDBA_STATE_PLANNING: __fallthrough; + case WIXSTDBA_STATE_PLANNED: __fallthrough; + case WIXSTDBA_STATE_APPLYING: __fallthrough; + case WIXSTDBA_STATE_CACHING: __fallthrough; + case WIXSTDBA_STATE_CACHED: __fallthrough; + case WIXSTDBA_STATE_EXECUTING: __fallthrough; + case WIXSTDBA_STATE_EXECUTED: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_PROGRESS]; + break; + + case WIXSTDBA_STATE_APPLIED: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_SUCCESS]; + break; + + case WIXSTDBA_STATE_FAILED: + *pdwPageId = m_rgdwPageIds[WIXSTDBA_PAGE_FAILURE]; + break; + } + } + } + + + HRESULT EvaluateConditions() + { + HRESULT hr = S_OK; + BOOL fResult = FALSE; + + for (DWORD i = 0; i < m_Conditions.cConditions; ++i) + { + BAL_CONDITION* pCondition = m_Conditions.rgConditions + i; + + hr = BalConditionEvaluate(pCondition, m_pEngine, &fResult, &m_sczFailedMessage); + BalExitOnFailure(hr, "Failed to evaluate condition."); + + if (!fResult) + { + hr = E_WIXSTDBA_CONDITION_FAILED; + BalExitOnFailure(hr, "%ls", m_sczFailedMessage); + } + } + + ReleaseNullStrSecure(m_sczFailedMessage); + + LExit: + return hr; + } + + void UpdateCacheProgress( + __in DWORD dwOverallPercentage + ) + { + WCHAR wzProgress[5] = { }; + + ::StringCchPrintfW(wzProgress, countof(wzProgress), L"%u%%", dwOverallPercentage); + ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT, wzProgress); + + ThemeSetProgressControl(m_pTheme, WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR, dwOverallPercentage); + + m_dwCalculatedCacheProgress = dwOverallPercentage * WIXSTDBA_ACQUIRE_PERCENTAGE / 100; + ThemeSetProgressControl(m_pTheme, WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR, m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + + SetTaskbarButtonProgress(m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + } + + + void SetTaskbarButtonProgress( + __in DWORD dwOverallPercentage + ) + { + HRESULT hr = S_OK; + + if (m_fTaskbarButtonOK) + { + hr = m_pTaskbarList->SetProgressValue(m_hWnd, dwOverallPercentage, 100UL); + BalExitOnFailure(hr, "Failed to set taskbar button progress to: %d%%.", dwOverallPercentage); + } + + LExit: + return; + } + + + void SetTaskbarButtonState( + __in TBPFLAG tbpFlags + ) + { + HRESULT hr = S_OK; + + if (m_fTaskbarButtonOK) + { + hr = m_pTaskbarList->SetProgressState(m_hWnd, tbpFlags); + BalExitOnFailure(hr, "Failed to set taskbar button state.", tbpFlags); + } + + LExit: + return; + } + + + void SetProgressState( + __in HRESULT hrStatus + ) + { + TBPFLAG flag = TBPF_NORMAL; + + if (IsCanceled() || HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) == hrStatus) + { + flag = TBPF_PAUSED; + } + else if (IsRollingBack() || FAILED(hrStatus)) + { + flag = TBPF_ERROR; + } + + SetTaskbarButtonState(flag); + } + + + HRESULT LoadBAFunctions( + __in IXMLDOMDocument* pixdManifest + ) + { + HRESULT hr = S_OK; + IXMLDOMNode* pBAFunctionsNode = NULL; + IXMLDOMNode* pPayloadNode = NULL; + LPWSTR sczPayloadId = NULL; + LPWSTR sczPayloadXPath = NULL; + LPWSTR sczBafName = NULL; + LPWSTR sczBafPath = NULL; + BA_FUNCTIONS_CREATE_ARGS bafCreateArgs = { }; + BA_FUNCTIONS_CREATE_RESULTS bafCreateResults = { }; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFunctions", &pBAFunctionsNode); + BalExitOnFailure(hr, "Failed to read WixBalBAFunctions node from BootstrapperApplicationData.xml."); + + if (S_FALSE == hr) + { + ExitFunction(); + } + + hr = XmlGetAttributeEx(pBAFunctionsNode, L"PayloadId", &sczPayloadId); + BalExitOnFailure(hr, "Failed to get BAFunctions PayloadId."); + + hr = StrAllocFormatted(&sczPayloadXPath, L"/BootstrapperApplicationData/WixPayloadProperties[@Payload='%ls']", sczPayloadId); + BalExitOnFailure(hr, "Failed to format BAFunctions payload XPath."); + + hr = XmlSelectSingleNode(pixdManifest, sczPayloadXPath, &pPayloadNode); + if (S_FALSE == hr) + { + hr = E_NOTFOUND; + } + BalExitOnFailure(hr, "Failed to find WixPayloadProperties node for BAFunctions PayloadId: %ls.", sczPayloadId); + + hr = XmlGetAttributeEx(pPayloadNode, L"Name", &sczBafName); + BalExitOnFailure(hr, "Failed to get BAFunctions Name."); + + hr = PathRelativeToModule(&sczBafPath, sczBafName, m_hModule); + BalExitOnFailure(hr, "Failed to get path to BAFunctions DLL."); + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: LoadBAFunctions() - BAFunctions DLL %ls", sczBafPath); + + m_hBAFModule = ::LoadLibraryExW(sczBafPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + BalExitOnNullWithLastError(m_hBAFModule, hr, "WIXSTDBA: LoadBAFunctions() - Failed to load DLL %ls", sczBafPath); + + PFN_BA_FUNCTIONS_CREATE pfnBAFunctionsCreate = reinterpret_cast(::GetProcAddress(m_hBAFModule, "BAFunctionsCreate")); + BalExitOnNullWithLastError(pfnBAFunctionsCreate, hr, "Failed to get BAFunctionsCreate entry-point from: %ls", sczBafPath); + + bafCreateArgs.cbSize = sizeof(bafCreateArgs); + bafCreateArgs.qwBAFunctionsAPIVersion = MAKEQWORDVERSION(0, 0, 0, 2); // TODO: need to decide whether to keep this, and if so when to update it. + bafCreateArgs.pBootstrapperCreateArgs = &m_createArgs; + + bafCreateResults.cbSize = sizeof(bafCreateResults); + + hr = pfnBAFunctionsCreate(&bafCreateArgs, &bafCreateResults); + BalExitOnFailure(hr, "Failed to create BAFunctions."); + + m_pfnBAFunctionsProc = bafCreateResults.pfnBAFunctionsProc; + m_pvBAFunctionsProcContext = bafCreateResults.pvBAFunctionsProcContext; + + LExit: + if (m_hBAFModule && !m_pfnBAFunctionsProc) + { + ::FreeLibrary(m_hBAFModule); + m_hBAFModule = NULL; + } + ReleaseStr(sczBafPath); + ReleaseStr(sczBafName); + ReleaseStr(sczPayloadXPath); + ReleaseStr(sczPayloadId); + ReleaseObject(pBAFunctionsNode); + ReleaseObject(pPayloadNode); + + return hr; + } + + +public: + // + // Constructor - initialize member variables. + // + CWixStandardBootstrapperApplication( + __in HMODULE hModule, + __in BOOL fPrereq, + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs + ) : CBalBaseBootstrapperApplication(pEngine, pArgs, 3, 3000) + { + m_hModule = hModule; + memcpy_s(&m_command, sizeof(m_command), pArgs->pCommand, sizeof(BOOTSTRAPPER_COMMAND)); + memcpy_s(&m_createArgs, sizeof(m_createArgs), pArgs, sizeof(BOOTSTRAPPER_CREATE_ARGS)); + m_createArgs.pCommand = &m_command; + + if (fPrereq) + { + // Pre-req BA should only show help or do an install (to launch the Managed BA which can then do the right action). + if (BOOTSTRAPPER_ACTION_HELP != m_command.action) + { + m_command.action = BOOTSTRAPPER_ACTION_INSTALL; + } + } + else // maybe modify the action state if the bundle is or is not already installed. + { + LONGLONG llInstalled = 0; + HRESULT hr = BalGetNumericVariable(L"WixBundleInstalled", &llInstalled); + if (SUCCEEDED(hr) && BOOTSTRAPPER_RESUME_TYPE_REBOOT != m_command.resumeType && 0 < llInstalled && BOOTSTRAPPER_ACTION_INSTALL == m_command.action) + { + m_command.action = BOOTSTRAPPER_ACTION_MODIFY; + } + else if (0 == llInstalled && (BOOTSTRAPPER_ACTION_MODIFY == m_command.action || BOOTSTRAPPER_ACTION_REPAIR == m_command.action)) + { + m_command.action = BOOTSTRAPPER_ACTION_INSTALL; + } + } + + m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; + + // When resuming from restart doing some install-like operation, try to find the package that forced the + // restart. We'll use this information during planning. + m_sczAfterForcedRestartPackage = NULL; + + if (BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_command.resumeType && BOOTSTRAPPER_ACTION_UNINSTALL < m_command.action) + { + // Ensure the forced restart package variable is null when it is an empty string. + HRESULT hr = BalGetStringVariable(L"WixBundleForcedRestartPackage", &m_sczAfterForcedRestartPackage); + if (FAILED(hr) || !m_sczAfterForcedRestartPackage || !*m_sczAfterForcedRestartPackage) + { + ReleaseNullStr(m_sczAfterForcedRestartPackage); + } + } + + m_pWixLoc = NULL; + memset(&m_Bundle, 0, sizeof(m_Bundle)); + memset(&m_Conditions, 0, sizeof(m_Conditions)); + m_sczConfirmCloseMessage = NULL; + m_sczFailedMessage = NULL; + + m_sczLanguage = NULL; + m_pTheme = NULL; + memset(m_rgdwPageIds, 0, sizeof(m_rgdwPageIds)); + m_hUiThread = NULL; + m_fRegistered = FALSE; + m_hWnd = NULL; + + m_state = WIXSTDBA_STATE_INITIALIZING; + m_hrFinal = hrHostInitialization; + + m_fDowngrading = FALSE; + m_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE; + m_fRestartRequired = FALSE; + m_fAllowRestart = FALSE; + + m_sczLicenseFile = NULL; + m_sczLicenseUrl = NULL; + m_fSuppressDowngradeFailure = FALSE; + m_fSuppressRepair = FALSE; + m_fSupportCacheOnly = FALSE; + + m_sdOverridableVariables = NULL; + m_pTaskbarList = NULL; + m_uTaskbarButtonCreatedMessage = UINT_MAX; + m_fTaskbarButtonOK = FALSE; + ::InitializeCriticalSection(&m_csShowingInternalUiThisPackage); + m_fShowingInternalUiThisPackage = FALSE; + m_fTriedToLaunchElevated = FALSE; + + m_fPrereq = fPrereq; + m_fPrereqInstalled = FALSE; + m_fPrereqAlreadyInstalled = FALSE; + + pEngine->AddRef(); + m_pEngine = pEngine; + + m_hBAFModule = NULL; + m_pfnBAFunctionsProc = NULL; + m_pvBAFunctionsProcContext = NULL; + } + + + // + // Destructor - release member variables. + // + ~CWixStandardBootstrapperApplication() + { + AssertSz(!::IsWindow(m_hWnd), "Window should have been destroyed before destructor."); + AssertSz(!m_pTaskbarList, "Taskbar should have been released before destructor."); + AssertSz(!m_pTheme, "Theme should have been released before destructor."); + + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + ReleaseMem(m_Bundle.packages.rgPackages[i].pvCustomData); + } + + ::DeleteCriticalSection(&m_csShowingInternalUiThisPackage); + ReleaseDict(m_sdOverridableVariables); + ReleaseStr(m_sczFailedMessage); + ReleaseStr(m_sczConfirmCloseMessage); + BalConditionsUninitialize(&m_Conditions); + BalInfoUninitialize(&m_Bundle); + LocFree(m_pWixLoc); + + ReleaseStr(m_sczLanguage); + ReleaseStr(m_sczLicenseFile); + ReleaseStr(m_sczLicenseUrl); + ReleaseStr(m_sczAfterForcedRestartPackage); + ReleaseNullObject(m_pEngine); + + if (m_hBAFModule) + { + PFN_BA_FUNCTIONS_DESTROY pfnBAFunctionsDestroy = reinterpret_cast(::GetProcAddress(m_hBAFModule, "BAFunctionsDestroy")); + if (pfnBAFunctionsDestroy) + { + pfnBAFunctionsDestroy(); + } + + ::FreeLibrary(m_hBAFModule); + m_hBAFModule = NULL; + } + } + +private: + HMODULE m_hModule; + BOOTSTRAPPER_CREATE_ARGS m_createArgs; + BOOTSTRAPPER_COMMAND m_command; + IBootstrapperEngine* m_pEngine; + BOOTSTRAPPER_ACTION m_plannedAction; + + LPWSTR m_sczAfterForcedRestartPackage; + + WIX_LOCALIZATION* m_pWixLoc; + BAL_INFO_BUNDLE m_Bundle; + BAL_CONDITIONS m_Conditions; + LPWSTR m_sczFailedMessage; + LPWSTR m_sczConfirmCloseMessage; + + LPWSTR m_sczLanguage; + THEME* m_pTheme; + DWORD m_rgdwPageIds[countof(vrgwzPageNames)]; + HANDLE m_hUiThread; + BOOL m_fRegistered; + HWND m_hWnd; + + WIXSTDBA_STATE m_state; + HRESULT m_hrFinal; + + BOOL m_fStartedExecution; + DWORD m_dwCalculatedCacheProgress; + DWORD m_dwCalculatedExecuteProgress; + + BOOL m_fDowngrading; + BOOTSTRAPPER_APPLY_RESTART m_restartResult; + BOOL m_fRestartRequired; + BOOL m_fAllowRestart; + + LPWSTR m_sczLicenseFile; + LPWSTR m_sczLicenseUrl; + BOOL m_fSuppressDowngradeFailure; + BOOL m_fSuppressRepair; + BOOL m_fSupportCacheOnly; + + STRINGDICT_HANDLE m_sdOverridableVariables; + + BOOL m_fPrereq; + BOOL m_fPrereqInstalled; + BOOL m_fPrereqAlreadyInstalled; + + ITaskbarList3* m_pTaskbarList; + UINT m_uTaskbarButtonCreatedMessage; + BOOL m_fTaskbarButtonOK; + CRITICAL_SECTION m_csShowingInternalUiThisPackage; + BOOL m_fShowingInternalUiThisPackage; + BOOL m_fTriedToLaunchElevated; + + HMODULE m_hBAFModule; + PFN_BA_FUNCTIONS_PROC m_pfnBAFunctionsProc; + LPVOID m_pvBAFunctionsProcContext; +}; + + +// +// CreateBootstrapperApplication - creates a new IBootstrapperApplication object. +// +HRESULT CreateBootstrapperApplication( + __in HMODULE hModule, + __in BOOL fPrereq, + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, + __out IBootstrapperApplication** ppApplication + ) +{ + HRESULT hr = S_OK; + CWixStandardBootstrapperApplication* pApplication = NULL; + + if (BOOTSTRAPPER_DISPLAY_UNKNOWN == pArgs->pCommand->display) + { + BalExitOnFailure(hr = E_INVALIDARG, "Engine requested Unknown display type."); + } + + pApplication = new CWixStandardBootstrapperApplication(hModule, fPrereq, hrHostInitialization, pEngine, pArgs); + ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new standard bootstrapper application object."); + + pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; + pResults->pvBootstrapperApplicationProcContext = pApplication; + *ppApplication = pApplication; + pApplication = NULL; + +LExit: + ReleaseObject(pApplication); + return hr; +} + + +static HRESULT DAPI EvaluateVariableConditionCallback( + __in_z LPCWSTR wzCondition, + __out BOOL* pf, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalEvaluateCondition(wzCondition, pf); +} + + +static HRESULT DAPI FormatVariableStringCallback( + __in_z LPCWSTR wzFormat, + __inout LPWSTR* psczOut, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalFormatString(wzFormat, psczOut); +} + + +static HRESULT DAPI GetVariableNumericCallback( + __in_z LPCWSTR wzVariable, + __out LONGLONG* pllValue, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalGetNumericVariable(wzVariable, pllValue); +} + + +static HRESULT DAPI SetVariableNumericCallback( + __in_z LPCWSTR wzVariable, + __in LONGLONG llValue, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalSetNumericVariable(wzVariable, llValue); +} + + +static HRESULT DAPI GetVariableStringCallback( + __in_z LPCWSTR wzVariable, + __inout LPWSTR* psczValue, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalGetStringVariable(wzVariable, psczValue); +} + + +static HRESULT DAPI SetVariableStringCallback( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue, + __in BOOL fFormatted, + __in_opt LPVOID /*pvContext*/ + ) +{ + return BalSetStringVariable(wzVariable, wzValue, fFormatted); +} + +static LPCSTR LoggingRequestStateToString( + __in BOOTSTRAPPER_REQUEST_STATE requestState + ) +{ + switch (requestState) + { + case BOOTSTRAPPER_REQUEST_STATE_NONE: + return "None"; + case BOOTSTRAPPER_REQUEST_STATE_FORCE_ABSENT: + return "ForceAbsent"; + case BOOTSTRAPPER_REQUEST_STATE_ABSENT: + return "Absent"; + case BOOTSTRAPPER_REQUEST_STATE_CACHE: + return "Cache"; + case BOOTSTRAPPER_REQUEST_STATE_PRESENT: + return "Present"; + case BOOTSTRAPPER_REQUEST_STATE_REPAIR: + return "Repair"; + default: + return "Invalid"; + } +} + +static LPCSTR LoggingMsiFeatureStateToString( + __in BOOTSTRAPPER_FEATURE_STATE featureState + ) +{ + switch (featureState) + { + case BOOTSTRAPPER_FEATURE_STATE_UNKNOWN: + return "Unknown"; + case BOOTSTRAPPER_FEATURE_STATE_ABSENT: + return "Absent"; + case BOOTSTRAPPER_FEATURE_STATE_ADVERTISED: + return "Advertised"; + case BOOTSTRAPPER_FEATURE_STATE_LOCAL: + return "Local"; + case BOOTSTRAPPER_FEATURE_STATE_SOURCE: + return "Source"; + default: + return "Invalid"; + } +} diff --git a/src/ext/Bal/wixstdba/packages.config b/src/ext/Bal/wixstdba/packages.config new file mode 100644 index 00000000..071284ac --- /dev/null +++ b/src/ext/Bal/wixstdba/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Bal/wixstdba/precomp.cpp b/src/ext/Bal/wixstdba/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/wixstdba/precomp.cpp @@ -0,0 +1,3 @@ +// 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. + +#include "precomp.h" diff --git a/src/ext/Bal/wixstdba/precomp.h b/src/ext/Bal/wixstdba/precomp.h new file mode 100644 index 00000000..547183bd --- /dev/null +++ b/src/ext/Bal/wixstdba/precomp.h @@ -0,0 +1,58 @@ +#pragma once +// 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. + + +#include + +#pragma warning(push) +#pragma warning(disable:4458) // declaration of 'xxx' hides class member +#include +#pragma warning(pop) + +#include +#include +#include +#include +#include +#include +#include + +#include "dutil.h" +#include "apputil.h" +#include "memutil.h" +#include "dictutil.h" +#include "dirutil.h" +#include "fileutil.h" +#include "locutil.h" +#include "logutil.h" +#include "pathutil.h" +#include "resrutil.h" +#include "shelutil.h" +#include "strutil.h" +#include "thmutil.h" +#include "verutil.h" +#include "uriutil.h" +#include "xmlutil.h" + +#include "BootstrapperEngine.h" +#include "BootstrapperApplication.h" +#include "IBootstrapperEngine.h" +#include "IBootstrapperApplication.h" + +#include "balutil.h" +#include "balinfo.h" +#include "balcondition.h" + +#include "BAFunctions.h" + +#include "wixstdba.messages.h" + +HRESULT CreateBootstrapperApplication( + __in HMODULE hModule, + __in BOOL fPrereq, + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, + __out IBootstrapperApplication** ppApplication + ); diff --git a/src/ext/Bal/wixstdba/resource.h b/src/ext/Bal/wixstdba/resource.h new file mode 100644 index 00000000..149a8ff4 --- /dev/null +++ b/src/ext/Bal/wixstdba/resource.h @@ -0,0 +1,15 @@ +// 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. + +#define IDC_STATIC -1 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/ext/Bal/wixstdba/wixstdba.cpp b/src/ext/Bal/wixstdba/wixstdba.cpp new file mode 100644 index 00000000..a96f1738 --- /dev/null +++ b/src/ext/Bal/wixstdba/wixstdba.cpp @@ -0,0 +1,144 @@ +// 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. + +#include "precomp.h" + +static HINSTANCE vhInstance = NULL; +static IBootstrapperApplication* vpApplication = NULL; + +static void CALLBACK WixstdbaTraceError( + __in_z LPCSTR szFile, + __in int iLine, + __in REPORT_LEVEL rl, + __in UINT source, + __in HRESULT hrError, + __in_z __format_string LPCSTR szFormat, + __in va_list args + ); + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vhInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vhInstance = NULL; + break; + } + + return TRUE; +} + + +extern "C" HRESULT WINAPI BootstrapperApplicationCreate( + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + IBootstrapperEngine* pEngine = NULL; + + DutilInitialize(&WixstdbaTraceError); + + hr = BalInitializeFromCreateArgs(pArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + hr = CreateBootstrapperApplication(vhInstance, FALSE, S_OK, pEngine, pArgs, pResults, &vpApplication); + BalExitOnFailure(hr, "Failed to create bootstrapper application interface."); + +LExit: + ReleaseObject(pEngine); + + return hr; +} + + +extern "C" void WINAPI BootstrapperApplicationDestroy() +{ + ReleaseNullObject(vpApplication); + BalUninitialize(); + DutilUninitialize(); +} + + +extern "C" HRESULT WINAPI DncPrereqBootstrapperApplicationCreate( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + + DutilInitialize(&WixstdbaTraceError); + + BalInitialize(pEngine); + + hr = CreateBootstrapperApplication(vhInstance, TRUE, hrHostInitialization, pEngine, pArgs, pResults, &vpApplication); + BalExitOnFailure(hr, "Failed to create .NET Core prerequisite bootstrapper application interface."); + +LExit: + return hr; +} + + +extern "C" void WINAPI DncPrereqBootstrapperApplicationDestroy() +{ + ReleaseNullObject(vpApplication); + BalUninitialize(); + DutilUninitialize(); +} + + +extern "C" HRESULT WINAPI MbaPrereqBootstrapperApplicationCreate( + __in HRESULT hrHostInitialization, + __in IBootstrapperEngine* pEngine, + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + + DutilInitialize(&WixstdbaTraceError); + + BalInitialize(pEngine); + + hr = CreateBootstrapperApplication(vhInstance, TRUE, hrHostInitialization, pEngine, pArgs, pResults, &vpApplication); + BalExitOnFailure(hr, "Failed to create managed prerequisite bootstrapper application interface."); + +LExit: + return hr; +} + + +extern "C" void WINAPI MbaPrereqBootstrapperApplicationDestroy() +{ + ReleaseNullObject(vpApplication); + BalUninitialize(); + DutilUninitialize(); +} + +static void CALLBACK WixstdbaTraceError( + __in_z LPCSTR /*szFile*/, + __in int /*iLine*/, + __in REPORT_LEVEL /*rl*/, + __in UINT source, + __in HRESULT hrError, + __in_z __format_string LPCSTR szFormat, + __in va_list args + ) +{ + // BalLogError currently uses the Exit... macros, + // so if expanding the scope need to ensure this doesn't get called recursively. + if (DUTIL_SOURCE_THMUTIL == source) + { + BalLogErrorArgs(hrError, szFormat, args); + } +} diff --git a/src/ext/Bal/wixstdba/wixstdba.def b/src/ext/Bal/wixstdba/wixstdba.def new file mode 100644 index 00000000..ba9980d3 --- /dev/null +++ b/src/ext/Bal/wixstdba/wixstdba.def @@ -0,0 +1,10 @@ +; 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. + + +EXPORTS + BootstrapperApplicationCreate + BootstrapperApplicationDestroy + DncPrereqBootstrapperApplicationCreate + DncPrereqBootstrapperApplicationDestroy + MbaPrereqBootstrapperApplicationCreate + MbaPrereqBootstrapperApplicationDestroy diff --git a/src/ext/Bal/wixstdba/wixstdba.mc b/src/ext/Bal/wixstdba/wixstdba.mc new file mode 100644 index 00000000..688b1da1 --- /dev/null +++ b/src/ext/Bal/wixstdba/wixstdba.mc @@ -0,0 +1,73 @@ +; // 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. + + +MessageIdTypedef=DWORD + +LanguageNames=(English=0x409:MSG00409) + + +; // message definitions + +; // MessageId=# +; // Severity=Success +; // SymbolicName=MSG_SUCCESS +; // Language=English +; // Success %1. +; // . +; +; // MessageId=# +; // Severity=Warning +; // SymbolicName=MSG_WARNING +; // Language=English +; // Warning %1. +; // . +; +; // MessageId=# +; // Severity=Error +; // SymbolicName=MSG_ERROR +; // Language=English +; // Error %1. +; // . + +MessageId=1 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_FORWARD_COMPATIBLE_BUNDLE +Language=English +WIXSTDBA: Planned forward compatible bundle: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! +. + +MessageId=2 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_PACKAGE +Language=English +WIXSTDBA: Planned package: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! +. + +MessageId=3 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE +Language=English +WIXSTDBA: Planned related bundle: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! +. + +MessageId=5 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_TARGET_MSI_PACKAGE +Language=English +WIXSTDBA: Planned target MSI package: %1!ls!, productCode: %2!ls!, wixstdba requested: %3!hs!, bafunctions requested: %4!hs! +. + +MessageId=6 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_MSI_FEATURE +Language=English +WIXSTDBA: Planned MSI feature: %2!ls! for %1!ls!, wixstdba requested: %3!hs!, bafunctions requested: %4!hs! +. + +MessageId=7 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_MSI_PACKAGE +Language=English +WIXSTDBA: Planned MSI package: %1!ls!, wixstdba requested: actionMsiProperty=%2!d!;uiLevel=%3!d!;disableExternalUiHandler=%4!hs!, bafunctions requested: actionMsiProperty=%5!d!;uiLevel=%6!d!;disableExternalUiHandler=%7!hs! +. + diff --git a/src/ext/Bal/wixstdba/wixstdba.vcxproj b/src/ext/Bal/wixstdba/wixstdba.vcxproj new file mode 100644 index 00000000..06b1c8d8 --- /dev/null +++ b/src/ext/Bal/wixstdba/wixstdba.vcxproj @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA} + DynamicLibrary + v142 + Unicode + WixStdBA + wixstdba.def + + + + + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;wixstdba.res + + + + + Create + + + + + + + + + + + + + + + + + Compiling message file... + mc.exe -h "$(IntDir)." -r "$(IntDir)." -A -c -z wixstdba.messages "$(InputDir)wixstdba.mc" +rc.exe -fo "$(OutDir)wixstdba.res" "$(IntDir)wixstdba.messages.rc" + $(IntDir)wixstdba.messages.h;$(IntDir)wixstdba.messages.rc + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3-55-g6feb