From 0d3d54992104288e9ee0c834d0b96e8502fd2d42 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 11 Jan 2024 18:26:20 -0800 Subject: Move the BootstrapperApplication out of proc --- src/ext/Bal/Bal.wixext.sln | 280 +- .../Samples/bafunctions/WixSampleBAFunctions.cpp | 16 +- src/ext/Bal/Samples/bafunctions/bafunctions.cpp | 6 +- .../DncHostGenerator.cs | 127 - .../WixToolset.Dnc.HostGenerator.csproj | 27 - .../WixToolset.Dnc.HostGenerator.nuspec | 25 - .../build/WixToolset.Dnc.HostGenerator.props | 10 - .../build/WixToolset.Dnc.HostGenerator.targets | 11 - .../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 | 25 - .../WixToolset.Mba.Host/WixToolset.Mba.Host.csproj | 48 - .../WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec | 25 - src/ext/Bal/bal.cmd | 17 +- src/ext/Bal/dnchost/dnchost.cpp | 328 -- src/ext/Bal/dnchost/dnchost.def | 6 - src/ext/Bal/dnchost/dnchost.h | 28 - src/ext/Bal/dnchost/dnchost.vcxproj | 89 - src/ext/Bal/dnchost/dncutil.cpp | 216 - src/ext/Bal/dnchost/dncutil.h | 29 - src/ext/Bal/dnchost/packages.config | 6 - src/ext/Bal/dnchost/precomp.cpp | 3 - src/ext/Bal/dnchost/precomp.h | 31 - src/ext/Bal/mbahost/mbahost.cpp | 693 --- src/ext/Bal/mbahost/mbahost.def | 6 - src/ext/Bal/mbahost/mbahost.h | 17 - src/ext/Bal/mbahost/mbahost.vcxproj | 77 - src/ext/Bal/mbahost/precomp.cpp | 3 - src/ext/Bal/mbahost/precomp.h | 30 - src/ext/Bal/stdbas/Resources/1028/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1029/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1030/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1031/wixpreq.wxl | 31 + src/ext/Bal/stdbas/Resources/1032/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1035/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1036/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1038/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1040/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1041/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1042/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1043/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1044/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1045/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1046/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1049/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1051/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1053/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1055/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/1060/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/2052/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/2070/wixpreq.wxl | 29 + src/ext/Bal/stdbas/Resources/3082/wixpreq.wxl | 29 + .../Bal/stdbas/Resources/HyperlinkLargeTheme.xml | 117 + .../Bal/stdbas/Resources/HyperlinkSidebarTheme.xml | 134 + src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl | 69 + src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml | 117 + src/ext/Bal/stdbas/Resources/LoremIpsumLicense.rtf | Bin 0 -> 4908 bytes src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml | 119 + src/ext/Bal/stdbas/Resources/RtfTheme.wxl | 65 + src/ext/Bal/stdbas/Resources/RtfTheme.xml | 117 + src/ext/Bal/stdbas/Resources/dncpreq.wxl | 35 + src/ext/Bal/stdbas/Resources/iuipreq.thm | 67 + src/ext/Bal/stdbas/Resources/logo.png | Bin 0 -> 852 bytes src/ext/Bal/stdbas/Resources/logoSide.png | Bin 0 -> 3477 bytes src/ext/Bal/stdbas/Resources/wixpreq.png | Bin 0 -> 797 bytes src/ext/Bal/stdbas/Resources/wixpreq.thm | 60 + src/ext/Bal/stdbas/Resources/wixpreq.wxl | 38 + .../WixInternalUIBootstrapperApplication.cpp | 885 ++++ .../stdbas/WixStandardBootstrapperApplication.cpp | 5373 ++++++++++++++++++++ .../inc/WixInternalUIBootstrapperApplication.h | 7 + .../inc/WixStandardBootstrapperApplication.h | 12 + src/ext/Bal/stdbas/precomp.cpp | 3 + src/ext/Bal/stdbas/precomp.h | 49 + src/ext/Bal/stdbas/stdbas.manifest | 19 + src/ext/Bal/stdbas/stdbas.mc | 101 + src/ext/Bal/stdbas/stdbas.vcxproj | 79 + .../test/WixToolsetTest.Bal/BalExtensionFixture.cs | 100 +- .../test/WixToolsetTest.Bal/InternalUIBAFixture.cs | 28 +- .../WixToolsetTest.Bal/TestData/.Data/fake.exe | 1 + .../WixToolsetTest.Bal/TestData/MBA/Bundle.wxs | 2 +- .../CSharpSourceGeneratorVerifier.cs | 45 - .../DncHostGeneratorTests.cs | 91 - .../WixToolsetTest.Dnc.HostGenerator.csproj | 23 - .../WixToolsetTest.ManagedHost/DncHostFixture.cs | 285 -- .../WixToolsetTest.ManagedHost/MbaHostFixture.cs | 100 - .../Bal/test/WixToolsetTest.ManagedHost/README.md | 5 - .../test/WixToolsetTest.ManagedHost/TestEngine.cs | 76 - .../WixToolsetTest.ManagedHost/TestEngineResult.cs | 12 - .../WixToolsetTest.ManagedHost.csproj | 19 - src/ext/Bal/test/examples/Directory.Build.props | 1 - src/ext/Bal/test/examples/Directory.Build.targets | 1 - src/ext/Bal/test/examples/Directory.csproj.props | 5 - src/ext/Bal/test/examples/DncBA.targets | 19 - .../FrameworkDependentBundle.wxs | 6 +- .../FrameworkDependentBundle.wxs | 6 +- .../EarliestCoreBundleSCD/SelfContainedBundle.wxs | 4 +- .../test/examples/EarliestCoreBundleSCD/ba.xslt | 7 +- .../TrimmedSelfContainedBundle.wxs | 4 +- .../examples/EarliestCoreBundleTrimmedSCD/ba.xslt | 7 +- .../examples/EarliestCoreMBA/EarliestCoreBA.cs | 7 +- .../EarliestCoreMBA/EarliestCoreBAFactory.cs | 22 - .../EarliestCoreMBA/Example.EarliestCoreMBA.csproj | 7 +- .../Bal/test/examples/EarliestCoreMBA/Program.cs | 18 + .../test/examples/FullFramework2Bundle/Bundle.wxs | 7 +- .../FullFramework2Bundle.wixproj | 6 +- .../Bal/test/examples/FullFramework2MBA/App.config | 7 + .../Example.FullFramework2MBA.csproj | 5 +- .../examples/FullFramework2MBA/FullFramework2BA.cs | 7 +- .../FullFramework2MBA/FullFramework2BAFactory.cs | 22 - .../Bal/test/examples/FullFramework2MBA/Program.cs | 18 + .../FullFramework2MBA/WixToolset.Mba.Host.config | 20 - .../test/examples/FullFramework4Bundle/Bundle.wxs | 8 +- .../FullFramework4Bundle.wixproj | 7 +- .../Bal/test/examples/FullFramework4MBA/App.config | 7 + .../Example.FullFramework4MBA.csproj | 6 +- .../examples/FullFramework4MBA/FullFramework4BA.cs | 7 +- .../FullFramework4MBA/FullFramework4BAFactory.cs | 22 - .../Bal/test/examples/FullFramework4MBA/Program.cs | 18 + .../FullFramework4MBA/WixToolset.Mba.Host.config | 17 - .../FrameworkDependentBundle.wxs | 6 +- .../FrameworkDependentBundle.wxs | 6 +- .../LatestCoreBundleSCD/SelfContainedBundle.wxs | 4 +- .../Bal/test/examples/LatestCoreBundleSCD/ba.xslt | 7 +- .../TrimmedSelfContainedBundle.wxs | 4 +- .../examples/LatestCoreBundleTrimmedSCD/ba.xslt | 7 +- .../LatestCoreMBA/Example.LatestCoreMBA.csproj | 7 +- .../test/examples/LatestCoreMBA/LatestCoreBA.cs | 6 +- .../examples/LatestCoreMBA/LatestCoreBAFactory.cs | 22 - src/ext/Bal/test/examples/LatestCoreMBA/Program.cs | 18 + .../Bal/test/examples/TestEngine/TestEngine.cpp | 24 +- src/ext/Bal/test/examples/TestEngine/TestEngine.h | 1 - src/ext/Bal/test/examples/TestEngine/precomp.h | 4 +- .../WPFCoreBundleFDD/FrameworkDependentBundle.wxs | 6 +- .../examples/WPFCoreMBA/Example.WPFCoreMBA.csproj | 6 +- src/ext/Bal/test/examples/WPFCoreMBA/Program.cs | 19 + src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs | 7 +- .../test/examples/WPFCoreMBA/WPFCoreBAFactory.cs | 22 - src/ext/Bal/test/examples/examples.proj | 7 +- src/ext/Bal/wixext/BalBurnBackendExtension.cs | 74 +- src/ext/Bal/wixext/BalCompiler.cs | 289 +- src/ext/Bal/wixext/BalErrors.cs | 12 +- src/ext/Bal/wixext/BalWarnings.cs | 6 + src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs | 24 +- .../Symbols/WixBalBAFactoryAssemblySymbol.cs | 7 +- .../Symbols/WixBalBootstrapperApplicationSymbol.cs | 4 + src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs | 47 - .../Symbols/WixMbaPrereqInformationSymbol.cs | 63 - .../wixext/Symbols/WixMbaPrereqOptionsSymbol.cs | 47 - .../wixext/Symbols/WixPrereqInformationSymbol.cs | 63 + .../Bal/wixext/Symbols/WixPrereqOptionsSymbol.cs | 63 + .../WixInternalUIBootstrapperApplication.cpp | 918 ---- .../WixInternalUIBootstrapperApplication.h | 18 - src/ext/Bal/wixiuiba/precomp.h | 8 +- src/ext/Bal/wixiuiba/wixiuiba.cpp | 186 +- src/ext/Bal/wixiuiba/wixiuiba.def | 6 - src/ext/Bal/wixiuiba/wixiuiba.h | 13 - src/ext/Bal/wixiuiba/wixiuiba.rc | 1 + src/ext/Bal/wixiuiba/wixiuiba.vcxproj | 43 +- src/ext/Bal/wixlib/BalExtension_arm64.wxs | 7 - src/ext/Bal/wixlib/BalExtension_platform.wxi | 75 - src/ext/Bal/wixlib/BalExtension_x64.wxs | 8 - src/ext/Bal/wixlib/BalExtension_x86.wxs | 8 - src/ext/Bal/wixlib/Dnc.wxs | 15 - src/ext/Bal/wixlib/Mba.wxs | 43 - src/ext/Bal/wixlib/Mbahost_platform.wxi | 21 - src/ext/Bal/wixlib/bal.wixproj | 5 +- src/ext/Bal/wixlib/bal_arm64.wxs | 6 + src/ext/Bal/wixlib/bal_platform.wxi | 34 + src/ext/Bal/wixlib/bal_x64.wxs | 7 + src/ext/Bal/wixlib/bal_x86.wxs | 7 + src/ext/Bal/wixlib/wixiuiba.wxs | 6 +- src/ext/Bal/wixlib/wixprqba.wxs | 36 + src/ext/Bal/wixprqba/precomp.cpp | 3 + src/ext/Bal/wixprqba/precomp.h | 47 + src/ext/Bal/wixprqba/wixprqba.cpp | 25 + src/ext/Bal/wixprqba/wixprqba.rc | 1 + src/ext/Bal/wixprqba/wixprqba.vcxproj | 90 + src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl | 31 - src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl | 29 - 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 | 29 - src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl | 29 - src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl | 29 - .../Bal/wixstdba/Resources/HyperlinkLargeTheme.xml | 117 - .../wixstdba/Resources/HyperlinkSidebarTheme.xml | 134 - src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl | 69 - src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml | 117 - .../Bal/wixstdba/Resources/LoremIpsumLicense.rtf | Bin 4908 -> 0 bytes src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml | 119 - src/ext/Bal/wixstdba/Resources/RtfTheme.wxl | 65 - src/ext/Bal/wixstdba/Resources/RtfTheme.xml | 117 - src/ext/Bal/wixstdba/Resources/dncpreq.thm | 60 - src/ext/Bal/wixstdba/Resources/dncpreq.wxl | 36 - src/ext/Bal/wixstdba/Resources/iuipreq.thm | 67 - src/ext/Bal/wixstdba/Resources/iuipreq.wxl | 37 - src/ext/Bal/wixstdba/Resources/logo.png | Bin 852 -> 0 bytes src/ext/Bal/wixstdba/Resources/logoSide.png | Bin 3477 -> 0 bytes src/ext/Bal/wixstdba/Resources/mbapreq.png | Bin 797 -> 0 bytes src/ext/Bal/wixstdba/Resources/mbapreq.thm | 60 - src/ext/Bal/wixstdba/Resources/mbapreq.wxl | 36 - .../WixStandardBootstrapperApplication.cpp | 5372 ------------------- src/ext/Bal/wixstdba/inc/preqba.h | 19 - src/ext/Bal/wixstdba/precomp.h | 20 +- src/ext/Bal/wixstdba/resource.h | 15 - src/ext/Bal/wixstdba/wixstdba.cpp | 93 +- src/ext/Bal/wixstdba/wixstdba.def | 8 - src/ext/Bal/wixstdba/wixstdba.mc | 101 - src/ext/Bal/wixstdba/wixstdba.rc | 1 + src/ext/Bal/wixstdba/wixstdba.vcxproj | 53 +- src/ext/Dependency/ca/wixdepca.cpp | 4 +- .../UsingDotNetCorePackages/NetCore3_Platform.wxi | 8 +- src/ext/NetFx/wixlib/NetFx462.wxs | 4 +- src/ext/NetFx/wixlib/NetFx472.wxs | 4 +- src/ext/NetFx/wixlib/NetFx48.wxs | 4 +- src/ext/NetFx/wixlib/NetFx481.wxs | 44 +- src/ext/Util/ca/test.cpp | 2 +- .../TestData/BundleWithSearches/Bundle.wxs | 4 +- .../BundleUsingBuiltinVariableNames.wxs | 4 +- src/ext/Util/wixext/UtilCompiler.cs | 2 +- 241 files changed, 9231 insertions(+), 12560 deletions(-) delete mode 100644 src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs delete mode 100644 src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj delete mode 100644 src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec delete mode 100644 src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props delete mode 100644 src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/HostSection.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj delete mode 100644 src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec delete mode 100644 src/ext/Bal/dnchost/dnchost.cpp delete mode 100644 src/ext/Bal/dnchost/dnchost.def delete mode 100644 src/ext/Bal/dnchost/dnchost.h delete mode 100644 src/ext/Bal/dnchost/dnchost.vcxproj delete mode 100644 src/ext/Bal/dnchost/dncutil.cpp delete mode 100644 src/ext/Bal/dnchost/dncutil.h delete mode 100644 src/ext/Bal/dnchost/packages.config delete mode 100644 src/ext/Bal/dnchost/precomp.cpp delete mode 100644 src/ext/Bal/dnchost/precomp.h delete mode 100644 src/ext/Bal/mbahost/mbahost.cpp delete mode 100644 src/ext/Bal/mbahost/mbahost.def delete mode 100644 src/ext/Bal/mbahost/mbahost.h delete mode 100644 src/ext/Bal/mbahost/mbahost.vcxproj delete mode 100644 src/ext/Bal/mbahost/precomp.cpp delete mode 100644 src/ext/Bal/mbahost/precomp.h create mode 100644 src/ext/Bal/stdbas/Resources/1028/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1029/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1030/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1031/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1032/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1035/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1036/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1038/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1040/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1041/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1042/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1043/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1044/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1045/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1046/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1049/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1051/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1053/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1055/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/1060/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/2052/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/2070/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/3082/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml create mode 100644 src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml create mode 100644 src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl create mode 100644 src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml create mode 100644 src/ext/Bal/stdbas/Resources/LoremIpsumLicense.rtf create mode 100644 src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml create mode 100644 src/ext/Bal/stdbas/Resources/RtfTheme.wxl create mode 100644 src/ext/Bal/stdbas/Resources/RtfTheme.xml create mode 100644 src/ext/Bal/stdbas/Resources/dncpreq.wxl create mode 100644 src/ext/Bal/stdbas/Resources/iuipreq.thm create mode 100644 src/ext/Bal/stdbas/Resources/logo.png create mode 100644 src/ext/Bal/stdbas/Resources/logoSide.png create mode 100644 src/ext/Bal/stdbas/Resources/wixpreq.png create mode 100644 src/ext/Bal/stdbas/Resources/wixpreq.thm create mode 100644 src/ext/Bal/stdbas/Resources/wixpreq.wxl create mode 100644 src/ext/Bal/stdbas/WixInternalUIBootstrapperApplication.cpp create mode 100644 src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp create mode 100644 src/ext/Bal/stdbas/inc/WixInternalUIBootstrapperApplication.h create mode 100644 src/ext/Bal/stdbas/inc/WixStandardBootstrapperApplication.h create mode 100644 src/ext/Bal/stdbas/precomp.cpp create mode 100644 src/ext/Bal/stdbas/precomp.h create mode 100644 src/ext/Bal/stdbas/stdbas.manifest create mode 100644 src/ext/Bal/stdbas/stdbas.mc create mode 100644 src/ext/Bal/stdbas/stdbas.vcxproj create mode 100644 src/ext/Bal/test/WixToolsetTest.Bal/TestData/.Data/fake.exe delete mode 100644 src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs delete mode 100644 src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj delete mode 100644 src/ext/Bal/test/examples/Directory.csproj.props delete mode 100644 src/ext/Bal/test/examples/DncBA.targets delete mode 100644 src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs create mode 100644 src/ext/Bal/test/examples/EarliestCoreMBA/Program.cs create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/App.config delete mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs create mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/Program.cs delete mode 100644 src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/App.config delete mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs create mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/Program.cs delete mode 100644 src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config delete mode 100644 src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs create mode 100644 src/ext/Bal/test/examples/LatestCoreMBA/Program.cs create mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/Program.cs delete mode 100644 src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs delete mode 100644 src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs delete mode 100644 src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs delete mode 100644 src/ext/Bal/wixext/Symbols/WixMbaPrereqOptionsSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixPrereqInformationSymbol.cs create mode 100644 src/ext/Bal/wixext/Symbols/WixPrereqOptionsSymbol.cs delete mode 100644 src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.cpp delete mode 100644 src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.h delete mode 100644 src/ext/Bal/wixiuiba/wixiuiba.def delete mode 100644 src/ext/Bal/wixiuiba/wixiuiba.h create mode 100644 src/ext/Bal/wixiuiba/wixiuiba.rc delete mode 100644 src/ext/Bal/wixlib/BalExtension_arm64.wxs delete mode 100644 src/ext/Bal/wixlib/BalExtension_platform.wxi delete mode 100644 src/ext/Bal/wixlib/BalExtension_x64.wxs delete mode 100644 src/ext/Bal/wixlib/BalExtension_x86.wxs delete mode 100644 src/ext/Bal/wixlib/Dnc.wxs delete mode 100644 src/ext/Bal/wixlib/Mba.wxs delete mode 100644 src/ext/Bal/wixlib/Mbahost_platform.wxi create mode 100644 src/ext/Bal/wixlib/bal_arm64.wxs create mode 100644 src/ext/Bal/wixlib/bal_platform.wxi create mode 100644 src/ext/Bal/wixlib/bal_x64.wxs create mode 100644 src/ext/Bal/wixlib/bal_x86.wxs create mode 100644 src/ext/Bal/wixlib/wixprqba.wxs create mode 100644 src/ext/Bal/wixprqba/precomp.cpp create mode 100644 src/ext/Bal/wixprqba/precomp.h create mode 100644 src/ext/Bal/wixprqba/wixprqba.cpp create mode 100644 src/ext/Bal/wixprqba/wixprqba.rc create mode 100644 src/ext/Bal/wixprqba/wixprqba.vcxproj delete mode 100644 src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml delete mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml delete mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml delete mode 100644 src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf delete mode 100644 src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml delete mode 100644 src/ext/Bal/wixstdba/Resources/RtfTheme.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/RtfTheme.xml delete mode 100644 src/ext/Bal/wixstdba/Resources/dncpreq.thm delete mode 100644 src/ext/Bal/wixstdba/Resources/dncpreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/iuipreq.thm delete mode 100644 src/ext/Bal/wixstdba/Resources/iuipreq.wxl delete mode 100644 src/ext/Bal/wixstdba/Resources/logo.png delete mode 100644 src/ext/Bal/wixstdba/Resources/logoSide.png delete mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.png delete mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.thm delete mode 100644 src/ext/Bal/wixstdba/Resources/mbapreq.wxl delete mode 100644 src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp delete mode 100644 src/ext/Bal/wixstdba/inc/preqba.h delete mode 100644 src/ext/Bal/wixstdba/resource.h delete mode 100644 src/ext/Bal/wixstdba/wixstdba.def delete mode 100644 src/ext/Bal/wixstdba/wixstdba.mc create mode 100644 src/ext/Bal/wixstdba/wixstdba.rc (limited to 'src/ext') diff --git a/src/ext/Bal/Bal.wixext.sln b/src/ext/Bal/Bal.wixext.sln index be7149f4..f341a7be 100644 --- a/src/ext/Bal/Bal.wixext.sln +++ b/src/ext/Bal/Bal.wixext.sln @@ -1,45 +1,21 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29503.13 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34408.163 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", "Samples\bafunctions\bafunctions.vcxproj", "{EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbahost", "mbahost\mbahost.vcxproj", "{12C87C77-3547-44F8-8134-29BC915CB19D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wixiuiba", "wixiuiba\wixiuiba.vcxproj", "{0F73E566-925C-448D-99CB-3A7F5DF399C8}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wixstdba", "wixstdba\wixstdba.vcxproj", "{41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}" EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "bal", "wixlib\bal.wixproj", "{3444D952-F21C-496F-AB6B-56435BFD0787}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dnc.HostGenerator", "WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj", "{D6A58B36-D47E-4020-A130-58B0CEAF01A2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Mba.Host", "WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework2MBA", "test\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj", "{CC4236FC-226E-4232-AB50-24CBEC4D314D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example.TestEngine", "test\examples\TestEngine\Example.TestEngine.vcxproj", "{3D44B67D-A475-49BA-8310-E39F6C117CC9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Dnc.HostGenerator", "test\WixToolsetTest.Dnc.HostGenerator\WixToolsetTest.Dnc.HostGenerator.csproj", "{38D80FC7-EBD4-4902-A114-C93AA75CFCA0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.ManagedHost", "test\WixToolsetTest.ManagedHost\WixToolsetTest.ManagedHost.csproj", "{FED9D707-E5C3-4867-87B0-FABDB5EB0823}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA", "test\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj", "{44297646-706D-4508-8E96-1B35B109694C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Bal", "test\WixToolsetTest.Bal\WixToolsetTest.Bal.csproj", "{89D479FC-20DA-44D8-AE38-48F063223498}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.EarliestCoreMBA", "test\examples\EarliestCoreMBA\Example.EarliestCoreMBA.csproj", "{1E86D8DF-DABD-4B6E-A812-64CD2040C73A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dnchost", "dnchost\dnchost.vcxproj", "{B6F70281-6583-4138-BB7F-AABFEBBB3CA2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.LatestCoreMBA", "test\examples\LatestCoreMBA\Example.LatestCoreMBA.csproj", "{A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wixiuiba", "wixiuiba\wixiuiba.vcxproj", "{0F73E566-925C-448D-99CB-3A7F5DF399C8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.WPFCoreMBA", "test\examples\WPFCoreMBA\Example.WPFCoreMBA.csproj", "{8E707BF2-FD72-4649-8727-BA5955D48D40}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stdbas", "stdbas\stdbas.vcxproj", "{DBBF5F32-BAEA-46A8-99A0-17277A906456}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -69,38 +45,6 @@ Global {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 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|Any CPU.Build.0 = Debug|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|ARM64.Build.0 = Debug|ARM64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x64.ActiveCfg = Debug|x64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x64.Build.0 = Debug|x64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x86.ActiveCfg = Debug|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x86.Build.0 = Debug|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|Any CPU.ActiveCfg = Release|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|Any CPU.Build.0 = Release|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|ARM64.ActiveCfg = Release|ARM64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|ARM64.Build.0 = Release|ARM64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x64.ActiveCfg = Release|x64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x64.Build.0 = Release|x64 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x86.ActiveCfg = Release|Win32 - {0F73E566-925C-448D-99CB-3A7F5DF399C8}.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 @@ -145,118 +89,6 @@ Global {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 - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|ARM64.ActiveCfg = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|ARM64.Build.0 = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x64.ActiveCfg = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x64.Build.0 = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x86.ActiveCfg = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x86.Build.0 = Debug|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|Any CPU.Build.0 = Release|Any CPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|ARM64.ActiveCfg = Release|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|ARM64.Build.0 = Release|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x64.ActiveCfg = Release|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x64.Build.0 = Release|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x86.ActiveCfg = Release|AnyCPU - {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x86.Build.0 = Release|AnyCPU - {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|x64 - {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|Any CPU.Build.0 = Debug|x64 - {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|x64 - {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|Any CPU.Build.0 = Release|x64 - {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 - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|ARM64.Build.0 = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x64.ActiveCfg = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x64.Build.0 = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x86.ActiveCfg = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x86.Build.0 = Debug|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|Any CPU.Build.0 = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|ARM64.ActiveCfg = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|ARM64.Build.0 = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x64.ActiveCfg = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x64.Build.0 = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x86.ActiveCfg = Release|Any CPU - {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x86.Build.0 = Release|Any CPU - {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 @@ -273,82 +105,42 @@ Global {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 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|Any CPU.ActiveCfg = Debug|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|Any CPU.Build.0 = Debug|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|ARM64.Build.0 = Debug|ARM64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x64.ActiveCfg = Debug|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x64.Build.0 = Debug|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x86.ActiveCfg = Debug|Win32 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Debug|x86.Build.0 = Debug|Win32 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|Any CPU.ActiveCfg = Release|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|Any CPU.Build.0 = Release|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|ARM64.ActiveCfg = Release|ARM64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|ARM64.Build.0 = Release|ARM64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x64.ActiveCfg = Release|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x64.Build.0 = Release|x64 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x86.ActiveCfg = Release|Win32 + {0F73E566-925C-448D-99CB-3A7F5DF399C8}.Release|x86.Build.0 = Release|Win32 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|Any CPU.ActiveCfg = Debug|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|Any CPU.Build.0 = Debug|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|ARM64.Build.0 = Debug|ARM64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|x64.ActiveCfg = Debug|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|x64.Build.0 = Debug|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|x86.ActiveCfg = Debug|Win32 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Debug|x86.Build.0 = Debug|Win32 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|Any CPU.ActiveCfg = Release|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|Any CPU.Build.0 = Release|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|ARM64.ActiveCfg = Release|ARM64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|ARM64.Build.0 = Release|ARM64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|x64.ActiveCfg = Release|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|x64.Build.0 = Release|x64 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|x86.ActiveCfg = Release|Win32 + {DBBF5F32-BAEA-46A8-99A0-17277A906456}.Release|x86.Build.0 = Release|Win32 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 diff --git a/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp b/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp index 5383efbf..14a898e8 100644 --- a/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp +++ b/src/ext/Bal/Samples/bafunctions/WixSampleBAFunctions.cpp @@ -51,10 +51,8 @@ public: // Constructor - initialize member variables. // CWixSampleBAFunctions( - __in HMODULE hModule, - __in IBootstrapperEngine* pEngine, - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs - ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) + __in HMODULE hModule + ) : CBalBaseBAFunctions(hModule) { } @@ -75,22 +73,22 @@ HRESULT WINAPI CreateBAFunctions( { 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."); + BalInitialize(pArgs->pEngine); - pBAFunctions = new CWixSampleBAFunctions(hModule, pEngine, pArgs); + pBAFunctions = new CWixSampleBAFunctions(hModule); ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CWixSampleBAFunctions object."); + hr = pBAFunctions->OnCreate(pArgs->pEngine, pArgs->pCommand); + ExitOnFailure(hr, "Failed to call OnCreate CPrereqBaf."); + 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 index fc9d1177..d26e7cce 100644 --- a/src/ext/Bal/Samples/bafunctions/bafunctions.cpp +++ b/src/ext/Bal/Samples/bafunctions/bafunctions.cpp @@ -26,13 +26,13 @@ extern "C" BOOL WINAPI DllMain( } extern "C" HRESULT WINAPI BAFunctionsCreate( - __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, - __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + __in const BA_FUNCTIONS_CREATE_ARGS* /*pArgs*/, + __inout BA_FUNCTIONS_CREATE_RESULTS* /*pResults*/ ) { HRESULT hr = S_OK; - hr = CreateBAFunctions(vhInstance, pArgs, pResults); + //hr = CreateBAFunctions(vhInstance, pArgs, pResults); BalExitOnFailure(hr, "Failed to create BAFunctions interface."); LExit: diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs b/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs deleted file mode 100644 index 088b2b49..00000000 --- a/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs +++ /dev/null @@ -1,127 +0,0 @@ -// 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.HostGenerator -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Text; - using Microsoft.CodeAnalysis; - using Microsoft.CodeAnalysis.Text; - - [Generator] - public sealed class DncHostGenerator : ISourceGenerator - { - public static readonly string Version = String.Format($"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}{ThisAssembly.Git.SemVer.DashLabel}+{ThisAssembly.Git.Sha}"); - public static readonly string TargetAttributeFullName = "WixToolset.Mba.Core.BootstrapperApplicationFactoryAttribute"; - - [SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking", Justification = "Tracking not needed")] - public static readonly DiagnosticDescriptor MissingFactoryAttributeDescriptor = new DiagnosticDescriptor( - "WIXBAL001", - $"Missing assembly level attribute {TargetAttributeFullName}.", - $"Add [assembly: {TargetAttributeFullName}(typeof()].", - "WixToolset.Bal.wixext", - DiagnosticSeverity.Error, - true - ); - - public void Initialize(GeneratorInitializationContext context) - { - } - - public void Execute(GeneratorExecutionContext context) - { - var symbolDisplayFormat = new SymbolDisplayFormat(typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces); - - string baFactoryClassName = null; - foreach (var assemblyAttribute in context.Compilation.Assembly.GetAttributes()) - { - var fullAssemblyTypeName = assemblyAttribute.AttributeClass.ToDisplayString(symbolDisplayFormat); - - if (fullAssemblyTypeName == TargetAttributeFullName && - assemblyAttribute.ConstructorArguments.Length == 1) - { - var arg = assemblyAttribute.ConstructorArguments[0]; - if (arg.Value is INamedTypeSymbol argValue) - { - baFactoryClassName = argValue.ToDisplayString(symbolDisplayFormat); - break; - } - } - } - - if (baFactoryClassName == null) - { - context.ReportDiagnostic(Diagnostic.Create(MissingFactoryAttributeDescriptor, null)); - } - else - { - var source = String.Format(Template, Version, baFactoryClassName); - context.AddSource("WixToolset.Dnc.Host.g.cs", SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256)); - } - } - - public const string Template = @" -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WixToolset.Dnc.Host -{{ - using System; - using System.CodeDom.Compiler; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - using System.Reflection; - using System.Runtime.CompilerServices; - using System.Runtime.InteropServices; - using WixToolset.Mba.Core; - - [GeneratedCode(""WixToolset.Dnc.HostGenerator.DncHostGenerator"", ""{0}"")] - [CompilerGenerated] - delegate IBootstrapperApplicationFactory StaticEntryDelegate(); - - /// - /// Entry point for the .NET Core host to create and return the BA to the engine. - /// - [GeneratedCode(""WixToolset.Dnc.HostGenerator.DncHostGenerator"", ""{0}"")] - [CompilerGenerated] - public sealed class BootstrapperApplicationFactory : IBootstrapperApplicationFactory - {{ - /// - /// Creates the bootstrapper application factory and calls its IBootstrapperApplicationFactory.Create method. - /// - /// Pointer to BOOTSTRAPPER_CREATE_ARGS struct. - /// Pointer to BOOTSTRAPPER_CREATE_RESULTS struct. - public void Create(IntPtr pArgs, IntPtr pResults) - {{ - var baFactory = new {1}(); - baFactory.Create(pArgs, pResults); - }} - - // Entry point for the DNC host. - public static IBootstrapperApplicationFactory CreateBAFactory() - {{ - return new BootstrapperApplicationFactory(); - }} - -#if NET5_0_OR_GREATER - [ModuleInitializer] - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BootstrapperApplicationFactory))] -#if NET5_0 - [DynamicDependency(""GetFunctionPointer(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr)"", ""Internal.Runtime.InteropServices.ComponentActivator"", ""System.Private.CoreLib"")] -#endif - /// - /// Empty method to attach above attributes to support linker trimming. - /// - public static void ModuleInitialize() {{ }} -#endif - }} -}} -"; - } -} diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj deleted file mode 100644 index 750db40e..00000000 --- a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - netstandard2.0 - WixToolset.Dnc.HostGenerator - WiX Toolset .NET Core BA Host Generator - WiX Toolset .NET Core BA Host Generator - embedded - AnyCPU - true - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec deleted file mode 100644 index 8f4de5e8..00000000 --- a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - $id$ - $version$ - $title$ - $description$ - $authors$ - wix.png - MS-RL - false - $copyright$ - $projectUrl$ - - - - - - - - - - - - diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props deleted file mode 100644 index f9306af7..00000000 --- a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - true - true - <_EnableConsumingManagedCodeFromNativeHosting>true - - diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets deleted file mode 100644 index d536ef5f..00000000 --- a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs deleted file mode 100644 index 78e68bd9..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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 deleted file mode 100644 index 5cf1bc9c..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/BootstrapperSectionGroup.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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 deleted file mode 100644 index c68951f0..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/Exceptions.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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 deleted file mode 100644 index 632025c7..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/HostSection.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 deleted file mode 100644 index b9fc85a0..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/NativeMethods.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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 deleted file mode 100644 index fe7fd2eb..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElement.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 deleted file mode 100644 index 12c7cf3e..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/SupportedFrameworkElementCollection.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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 deleted file mode 100644 index 91280739..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - -
- - - - - - - - - - - - - diff --git a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj deleted file mode 100644 index 242c4d14..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - WixToolset.Mba.Host - WixToolset.Mba.Host - net462 - Managed Bootstrapper Application entry point - embedded - $(MSBuildThisFileName).nuspec - AnyCPU - - - - - - - - - - - - - - - - - False - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec b/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec deleted file mode 100644 index b1f00ebd..00000000 --- a/src/ext/Bal/WixToolset.Mba.Host/WixToolset.Mba.Host.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - $id$ - $version$ - $title$ - $description$ - $authors$ - wix.png - MS-RL - false - $copyright$ - $projectUrl$ - - - - - - - - - - - - diff --git a/src/ext/Bal/bal.cmd b/src/ext/Bal/bal.cmd index 2759d499..23a53a91 100644 --- a/src/ext/Bal/bal.cmd +++ b/src/ext/Bal/bal.cmd @@ -20,37 +20,28 @@ @echo Building ext\Bal %_C% using %_N% :: Restore -nuget restore dnchost\packages.config || exit /b :: Build -msbuild -Restore -p:Configuration=%_C% -tl -nologo -warnaserror -bl:%_L%\ext_bal_build.binlog || exit /b +msbuild -Restore -p:Configuration=%_C% -tl -nologo -m -warnaserror test\WixToolsetTest.Bal\WixToolsetTest.Bal.csproj -bl:%_L%\ext_bal_build.binlog || exit /b -msbuild -Restore -p:Configuration=%_C% -tl -nologo -m -warnaserror test\examples\examples.proj -m -bl:%_L%\bal_examples_build.binlog || exit /b +msbuild -Restore -p:Configuration=%_C% -tl -nologo -m -warnaserror test\examples\examples.proj -bl:%_L%\bal_examples_build.binlog || exit /b :: Test dotnet test ^ - %_B%\net6.0\WixToolsetTest.Dnc.HostGenerator.dll ^ - %_B%\net6.0\WixToolsetTest.Bal.dll ^ - %_B%\net6.0\WixToolsetTest.ManagedHost.dll ^ - --nologo -l "trx;LogFileName=%_L%\TestResults\bal.wixext.trx" || exit /b + %_B%\net6.0\WixToolsetTest.Bal.dll ^ + --nologo -l "trx;LogFileName=%_L%\TestResults\bal.wixext.trx" || exit /b :: Pack msbuild -t:Pack -p:Configuration=%_C% -tl -nologo -warnaserror -p:NoBuild=true wixext\WixToolset.Bal.wixext.csproj || exit /b -msbuild -t:Pack -p:Configuration=%_C% -tl -nologo -warnaserror -p:NoBuild=true WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj || exit /b -msbuild -t:Pack -p:Configuration=%_C% -tl -nologo -warnaserror -p:NoBuild=true WixToolset.Mba.Host\WixToolset.Mba.Host.csproj || exit /b @goto :end :clean @rd /s/q "..\..\..\build\Bal.wixext" 2> nul @del "..\..\..\build\artifacts\WixToolset.Bal.wixext.*.nupkg" 2> nul -@del "..\..\..\build\artifacts\WixToolset.Dnc.HostGenerator.*.nupkg" 2> nul -@del "..\..\..\build\artifacts\WixToolset.Mba.Host.*.nupkg" 2> nul @del "%_L%\ext_bal_build.binlog" 2> nul @del "%_L%\TestResults\bal.wixext.trx" 2> nul @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.bal.wixext" 2> nul -@rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.dnc.hostgenerator" 2> nul -@rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.mba.host" 2> nul @exit /b :end diff --git a/src/ext/Bal/dnchost/dnchost.cpp b/src/ext/Bal/dnchost/dnchost.cpp deleted file mode 100644 index 1868e3f8..00000000 --- a/src/ext/Bal/dnchost/dnchost.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// 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 DNCSTATE* pState, - __in IBootstrapperEngine* pEngine, - __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; - IBootstrapperEngine* pEngine = NULL; - - 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.prereqData.fAlwaysInstallPrereqs && !vstate.prereqData.fCompleted) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application since it's configured to always run before loading the runtime."); - - hr = CreatePrerequisiteBA(&vstate, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); - - ExitFunction(); - } - - 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) - { - vstate.prereqData.hrFatalError = E_DNCHOST_SCD_RUNTIME_FAILURE; - BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error."); - } - else if (vstate.prereqData.fCompleted) - { - hr = E_PREREQBA_INFINITE_LOOP; - BalLogError(hr, "The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop."); - vstate.prereqData.hrFatalError = hr; - } - else - { - vstate.prereqData.hrFatalError = 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(&vstate, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); - } - -LExit: - ReleaseNullObject(pEngine); - - return hr; -} - -extern "C" void WINAPI BootstrapperApplicationDestroy( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - BOOTSTRAPPER_DESTROY_RESULTS childResults = { }; - - childResults.cbSize = sizeof(BOOTSTRAPPER_DESTROY_RESULTS); - - if (vstate.hMbapreqModule) - { - PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = reinterpret_cast(::GetProcAddress(vstate.hMbapreqModule, "PrereqBootstrapperApplicationDestroy")); - if (pfnDestroy) - { - (*pfnDestroy)(pArgs, &childResults); - } - - ::FreeLibrary(vstate.hMbapreqModule); - vstate.hMbapreqModule = NULL; - } - - BalUninitialize(); - - // Need to keep track of state between reloads. - pResults->fDisableUnloading = TRUE; -} - -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."); - -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; - BOOL fXmlFound = FALSE; - - hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); - BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFactoryAssembly", &pixnHost); - BalExitOnRequiredXmlQueryFailure(hr, "Failed to get WixBalBAFactoryAssembly element."); - - hr = XmlGetAttributeEx(pixnHost, L"FilePath", &sczPayloadName); - BalExitOnRequiredXmlQueryFailure(hr, "Failed to get WixBalBAFactoryAssembly/@FilePath."); - - hr = PathConcatRelativeToBase(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."); - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixMbaPrereqOptions", &pixnHost); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find WixMbaPrereqOptions element in bootstrapper application config."); - - if (fXmlFound) - { - hr = XmlGetAttributeNumber(pixnHost, L"AlwaysInstallPrereqs", reinterpret_cast(&pState->prereqData.fAlwaysInstallPrereqs)); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get AlwaysInstallPrereqs value."); - } - - pState->prereqData.fPerformHelp = !pState->prereqData.fAlwaysInstallPrereqs; - - pState->type = DNCHOSTTYPE_FDD; - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find WixDncOptions element in bootstrapper application config."); - - if (!fXmlFound) - { - ExitFunction(); - } - - hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SelfContainedDeployment value."); - - if (fXmlFound && dwBool) - { - pState->type = DNCHOSTTYPE_SCD; - } - -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->sczBaFactoryAssemblyPath, - pState->sczBaFactoryDepsJsonPath, - pState->sczBaFactoryRuntimeConfigPath); - - return hr; -} - -static HRESULT LoadManagedBootstrapperApplicationFactory( - __in DNCSTATE* pState - ) -{ - HRESULT hr = S_OK; - - hr = DnchostCreateFactory( - &pState->hostfxrState, - pState->sczBaFactoryAssemblyName, - &pState->pAppFactory); - - return hr; -} - -static HRESULT CreatePrerequisiteBA( - __in DNCSTATE* pState, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults - ) -{ - HRESULT hr = S_OK; - LPWSTR sczDncpreqPath = NULL; - HMODULE hModule = NULL; - - hr = PathConcat(pState->sczAppBase, L"dncpreq.dll", &sczDncpreqPath); - BalExitOnFailure(hr, "Failed to get path to pre-requisite BA."); - - hModule = ::LoadLibraryExW(sczDncpreqPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - BalExitOnNullWithLastError(hModule, hr, "Failed to load pre-requisite BA DLL."); - - PFN_PREQ_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = reinterpret_cast(::GetProcAddress(hModule, "PrereqBootstrapperApplicationCreate")); - BalExitOnNullWithLastError(pfnCreate, hr, "Failed to get PrereqBootstrapperApplicationCreate entry-point from: %ls", sczDncpreqPath); - - hr = pfnCreate(&pState->prereqData, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create prequisite bootstrapper app."); - - pState->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 deleted file mode 100644 index 4488df94..00000000 --- a/src/ext/Bal/dnchost/dnchost.def +++ /dev/null @@ -1,6 +0,0 @@ -; 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 deleted file mode 100644 index 000cf43d..00000000 --- a/src/ext/Bal/dnchost/dnchost.h +++ /dev/null @@ -1,28 +0,0 @@ -#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, -}; - -struct DNCSTATE -{ - BOOL fInitialized; - BOOL fInitializedRuntime; - HINSTANCE hInstance; - LPWSTR sczModuleFullPath; - LPWSTR sczAppBase; - LPWSTR sczBaFactoryAssemblyName; - LPWSTR sczBaFactoryAssemblyPath; - LPWSTR sczBaFactoryDepsJsonPath; - LPWSTR sczBaFactoryRuntimeConfigPath; - DNCHOSTTYPE type; - HOSTFXR_STATE hostfxrState; - IBootstrapperApplicationFactory* pAppFactory; - HMODULE hMbapreqModule; - PREQBA_DATA prereqData; -}; diff --git a/src/ext/Bal/dnchost/dnchost.vcxproj b/src/ext/Bal/dnchost/dnchost.vcxproj deleted file mode 100644 index 5860e968..00000000 --- a/src/ext/Bal/dnchost/dnchost.vcxproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {B6F70281-6583-4138-BB7F-AABFEBBB3CA2} - DynamicLibrary - Unicode - dnchost - dnchost.def - - - - - - - - - MultiThreaded - - - - - $(Platform) - x86 - ..\..\..\..\packages\runtime.win-$(NetHostPlatform).Microsoft.NETCore.DotNetAppHost.6.0.4\runtimes\win-$(NetHostPlatform)\native\ - $(BaseOutputPath)obj;$(NetHostPath);..\wixstdba\inc - shlwapi.lib;$(NetHostPath)libnethost.lib - - - - - - - Create - - - - - - - - - - - - - - - - - /LTCG %(AdditionalOptions) - - - - - - - - - - - diff --git a/src/ext/Bal/dnchost/dncutil.cpp b/src/ext/Bal/dnchost/dncutil.cpp deleted file mode 100644 index d00b0ce6..00000000 --- a/src/ext/Bal/dnchost/dncutil.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// 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" - -#define DNC_ENTRY_TYPEW L"WixToolset.Dnc.Host.BootstrapperApplicationFactory" -#define DNC_STATIC_ENTRY_METHODW L"CreateBAFactory" -#define DNC_STATIC_ENTRY_DELEGATEW L"WixToolset.Dnc.Host.StaticEntryDelegate" - -// 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 - ); - - -// 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); - BalExitOnFailure(hr, "Failed to initialize coreclr."); - -LExit: - return hr; -} - -HRESULT DnchostCreateFactory( - __in HOSTFXR_STATE* pState, - __in LPCWSTR wzBaFactoryAssemblyName, - __out IBootstrapperApplicationFactory** ppAppFactory - ) -{ - HRESULT hr = S_OK; - PFNCREATEBAFACTORY pfnCreateBAFactory = NULL; - LPWSTR sczEntryType = NULL; - LPWSTR sczEntryDelegate = NULL; - LPSTR sczBaFactoryAssemblyName = NULL; - - hr = StrAllocFormatted(&sczEntryType, L"%ls,%ls", DNC_ENTRY_TYPEW, wzBaFactoryAssemblyName); - BalExitOnFailure(hr, "Failed to format entry type."); - - hr = StrAllocFormatted(&sczEntryDelegate, L"%ls,%ls", DNC_STATIC_ENTRY_DELEGATEW, wzBaFactoryAssemblyName); - BalExitOnFailure(hr, "Failed to format entry delegate."); - - hr = pState->pfnGetFunctionPointer( - sczEntryType, - DNC_STATIC_ENTRY_METHODW, - sczEntryDelegate, - NULL, - NULL, - reinterpret_cast(&pfnCreateBAFactory)); - BalExitOnFailure(hr, "Failed to create delegate through GetFunctionPointer."); - - *ppAppFactory = pfnCreateBAFactory(); - -LExit: - ReleaseStr(sczEntryType); - ReleaseStr(sczEntryDelegate); - ReleaseStr(sczBaFactoryAssemblyName); - - 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->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 - ) -{ - BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "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 - ) -{ - 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. - { - BalExitOnFailure(hr, "HostfxrGetRuntimeDelegate failed, most likely because the target framework is older than .NET 5."); - } - else - { - BalExitOnFailure(hr, "HostfxrGetRuntimeDelegate failed"); - } - -LExit: - return hr; -} diff --git a/src/ext/Bal/dnchost/dncutil.h b/src/ext/Bal/dnchost/dncutil.h deleted file mode 100644 index 3fa81364..00000000 --- a/src/ext/Bal/dnchost/dncutil.h +++ /dev/null @@ -1,29 +0,0 @@ -#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)(); - -struct HOSTFXR_STATE -{ - LPWSTR sczHostfxrPath; - hostfxr_handle hostContextHandle; - hostfxr_initialize_for_dotnet_command_line_fn pfnHostfxrInitializeForApp; - hostfxr_set_error_writer_fn pfnHostfxrSetErrorWriter; - hostfxr_close_fn pfnHostfxrClose; - hostfxr_get_runtime_delegate_fn pfnHostfxrGetRuntimeDelegate; - get_function_pointer_fn pfnGetFunctionPointer; -}; - -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, - __out IBootstrapperApplicationFactory** ppAppFactory - ); diff --git a/src/ext/Bal/dnchost/packages.config b/src/ext/Bal/dnchost/packages.config deleted file mode 100644 index 1c7505e7..00000000 --- a/src/ext/Bal/dnchost/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/ext/Bal/dnchost/precomp.cpp b/src/ext/Bal/dnchost/precomp.cpp deleted file mode 100644 index 37664a1c..00000000 --- a/src/ext/Bal/dnchost/precomp.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index 2166a23d..00000000 --- a/src/ext/Bal/dnchost/precomp.h +++ /dev/null @@ -1,31 +0,0 @@ -#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 - -#define NETHOST_USE_AS_STATIC -#include -#include -#include - -#include - -#include "dncutil.h" -#include "dnchost.h" diff --git a/src/ext/Bal/mbahost/mbahost.cpp b/src/ext/Bal/mbahost/mbahost.cpp deleted file mode 100644 index 9d8acc8a..00000000 --- a/src/ext/Bal/mbahost/mbahost.cpp +++ /dev/null @@ -1,693 +0,0 @@ -// 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 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 - ); - -static MBASTATE vstate = { }; - - -// internal function declarations - -static HRESULT GetAppDomain( - __in MBASTATE* pState - ); -static HRESULT LoadModulePaths( - __in MBASTATE* pState - ); -static HRESULT LoadMbaConfiguration( - __in MBASTATE* pState, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs - ); -static HRESULT CheckSupportedFrameworks( - __in LPCWSTR wzConfigPath - ); -static HRESULT UpdateSupportedRuntime( - __in IXMLDOMDocument* pixdManifest, - __in IXMLDOMNode* pixnSupportedFramework, - __out BOOL* pfUpdatedManifest - ); -static HRESULT LoadRuntime( - __in MBASTATE* pState - ); -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 MBASTATE* pState, - __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); - vstate.hInstance = hInstance; - break; - - case DLL_PROCESS_DETACH: - vstate.hInstance = 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; - IBootstrapperEngine* pEngine = NULL; - - if (vstate.fStoppedRuntime) - { - BalExitWithRootFailure(hr, E_INVALIDSTATE, "Reloaded mbahost after stopping .NET runtime."); - } - - 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 load the module paths."); - - hr = LoadMbaConfiguration(&vstate, pArgs); - BalExitOnFailure(hr, "Failed to get the mba configuration."); - - vstate.fInitialized = TRUE; - } - - if (vstate.prereqData.fAlwaysInstallPrereqs && !vstate.prereqData.fCompleted) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application since it's configured to always run before loading the runtime."); - - hr = CreatePrerequisiteBA(&vstate, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); - - ExitFunction(); - } - - if (!vstate.fInitializedRuntime) - { - hr = LoadRuntime(&vstate); - - vstate.fInitializedRuntime = SUCCEEDED(hr); - } - - if (vstate.fInitializedRuntime) - { - hr = GetAppDomain(&vstate); - BalExitOnFailure(hr, "Failed to create the AppDomain for the managed bootstrapper application."); - - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading managed bootstrapper application."); - - hr = CreateManagedBootstrapperApplication(vstate.pAppDomain, 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."); - vstate.prereqData.hrFatalError = hr; - } - else if (vstate.prereqData.fCompleted) - { - hr = E_PREREQBA_INFINITE_LOOP; - BalLogError(hr, "The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop."); - vstate.prereqData.hrFatalError = hr; - } - else - { - vstate.prereqData.hrFatalError = S_OK; - } - - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because managed host could not be loaded, error: 0x%08x.", hr); - - hr = CreatePrerequisiteBA(&vstate, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); - } - -LExit: - ReleaseNullObject(pEngine); - - return hr; -} - -extern "C" void WINAPI BootstrapperApplicationDestroy( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - BOOTSTRAPPER_DESTROY_RESULTS childResults = { }; - - if (vstate.pAppDomain) - { - HRESULT hr = vstate.pCLRHost->UnloadDomain(vstate.pAppDomain); - if (FAILED(hr)) - { - BalLogError(hr, "Failed to unload app domain."); - } - - vstate.pAppDomain->Release(); - vstate.pAppDomain = NULL; - } - - // pCLRHost can only be stopped once per process. - if (vstate.pCLRHost && !pArgs->fReload) - { - vstate.pCLRHost->Stop(); - vstate.pCLRHost->Release(); - vstate.pCLRHost = NULL; - vstate.fStoppedRuntime = TRUE; - } - - if (vstate.hMbapreqModule) - { - PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = reinterpret_cast(::GetProcAddress(vstate.hMbapreqModule, "PrereqBootstrapperApplicationDestroy")); - if (pfnDestroy) - { - (*pfnDestroy)(pArgs, &childResults); - } - - ::FreeLibrary(vstate.hMbapreqModule); - vstate.hMbapreqModule = NULL; - } - - BalUninitialize(); - - // Need to keep track of state between reloads. - pResults->fDisableUnloading = TRUE; -} - -// Gets the custom AppDomain for loading managed BA. -static HRESULT GetAppDomain( - __in MBASTATE* pState - ) -{ - HRESULT hr = S_OK; - IUnknown *pUnk = NULL; - IAppDomainSetup* pAppDomainSetup = NULL; - BSTR bstrAppBase = NULL; - BSTR bstrConfigPath = NULL; - - // Create the setup information for a new AppDomain to set the app base and config. - hr = pState->pCLRHost->CreateDomainSetup(&pUnk); - BalExitOnRootFailure(hr, "Failed to create the AppDomainSetup object."); - - hr = pUnk->QueryInterface(__uuidof(IAppDomainSetup), reinterpret_cast(&pAppDomainSetup)); - BalExitOnRootFailure(hr, "Failed to query for the IAppDomainSetup interface."); - ReleaseNullObject(pUnk); - - // Set properties on the AppDomainSetup object. - bstrAppBase = ::SysAllocString(pState->sczAppBase); - BalExitOnNull(bstrAppBase, hr, E_OUTOFMEMORY, "Failed to allocate the application base path for the AppDomainSetup."); - - hr = pAppDomainSetup->put_ApplicationBase(bstrAppBase); - BalExitOnRootFailure(hr, "Failed to set the application base path for the AppDomainSetup."); - - bstrConfigPath = ::SysAllocString(pState->sczConfigPath); - BalExitOnNull(bstrConfigPath, hr, E_OUTOFMEMORY, "Failed to allocate the application configuration file for the AppDomainSetup."); - - hr = pAppDomainSetup->put_ConfigurationFile(bstrConfigPath); - BalExitOnRootFailure(hr, "Failed to set the configuration file path for the AppDomainSetup."); - - // Create the AppDomain to load the factory type. - hr = pState->pCLRHost->CreateDomainEx(L"MBA", pAppDomainSetup, NULL, &pUnk); - BalExitOnRootFailure(hr, "Failed to create the MBA AppDomain."); - - hr = pUnk->QueryInterface(__uuidof(_AppDomain), reinterpret_cast(&pState->pAppDomain)); - BalExitOnRootFailure(hr, "Failed to query for the _AppDomain interface."); - -LExit: - ReleaseBSTR(bstrConfigPath); - ReleaseBSTR(bstrAppBase); - ReleaseNullObject(pUnk); - - return hr; -} - -static HRESULT LoadModulePaths( - __in MBASTATE* pState - ) -{ - HRESULT hr = S_OK; - LPWSTR sczFullPath = NULL; - - hr = PathForCurrentProcess(&sczFullPath, pState->hInstance); - BalExitOnFailure(hr, "Failed to get the full host path."); - - hr = PathGetDirectory(sczFullPath, &pState->sczAppBase); - BalExitOnFailure(hr, "Failed to get the directory of the full process path."); - - hr = PathConcat(pState->sczAppBase, MBA_CONFIG_FILE_NAME, &pState->sczConfigPath); - BalExitOnFailure(hr, "Failed to get the full path to the application configuration file."); - -LExit: - ReleaseStr(sczFullPath); - - return hr; -} - -static HRESULT LoadMbaConfiguration( - __in MBASTATE* pState, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs - ) -{ - HRESULT hr = S_OK; - IXMLDOMDocument* pixdManifest = NULL; - IXMLDOMNode* pixnHost = NULL; - BOOL fXmlFound = FALSE; - - hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest); - BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath); - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixMbaPrereqOptions", &pixnHost); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find WixMbaPrereqOptions element in bootstrapper application config."); - - if (fXmlFound) - { - hr = XmlGetAttributeNumber(pixnHost, L"AlwaysInstallPrereqs", reinterpret_cast(&pState->prereqData.fAlwaysInstallPrereqs)); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get AlwaysInstallPrereqs value."); - } - - pState->prereqData.fPerformHelp = !pState->prereqData.fAlwaysInstallPrereqs; - -LExit: - ReleaseObject(pixnHost); - ReleaseObject(pixdManifest); - - 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 = XmlLoadDocumentFromFile(wzConfigPath, &pixdManifest); - BalExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", wzConfigPath); - - hr = XmlSelectNodes(pixdManifest, L"/configuration/wix.bootstrapper/host/supportedFramework", &pNodeList); - BalExitOnFailure(hr, "Failed to select all supportedFramework elements."); - - hr = pNodeList->get_length(reinterpret_cast(&cSupportedFrameworks)); - BalExitOnFailure(hr, "Failed to get the supported framework count."); - - if (cSupportedFrameworks) - { - while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) - { - hr = XmlGetAttributeEx(pNode, L"version", &sczSupportedFrameworkVersion); - BalExitOnRequiredXmlQueryFailure(hr, "Failed to get supportedFramework/@version."); - - hr = StrAllocFormatted(&sczFrameworkRegistryKey, L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\%ls", sczSupportedFrameworkVersion); - BalExitOnFailure(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) - { - BalExitWithRootFailure(hr, E_NOTFOUND, "Failed to find a supported framework."); - } - - hr = UpdateSupportedRuntime(pixdManifest, pNode, &fUpdatedManifest); - BalExitOnFailure(hr, "Failed to update supportedRuntime."); - } - // else no supported frameworks specified, so the startup/supportedRuntime must be enough. - - if (fUpdatedManifest) - { - hr = XmlSaveDocument(pixdManifest, wzConfigPath); - BalExitOnFailure(hr, "Failed to save updated manifest over config file: %ls", wzConfigPath); - } - -LExit: - ReleaseRegKey(hkFramework); - ReleaseStr(sczFrameworkRegistryKey); - ReleaseStr(sczSupportedFrameworkVersion); - ReleaseObject(pNode); - ReleaseObject(pNodeList); - ReleaseObject(pixdManifest); - - 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; - BOOL fXmlFound = FALSE; - - *pfUpdatedManifest = FALSE; - - // If the runtime version attribute is not specified, don't update the manifest. - hr = XmlGetAttributeEx(pixnSupportedFramework, L"runtimeVersion", &sczSupportedRuntimeVersion); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get supportedFramework/@runtimeVersion."); - - if (!fXmlFound) - { - ExitFunction(); - } - - // 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); - BalExitOnRequiredXmlQueryFailure(hr, "Failed to get startup element."); - - // Remove any pre-existing supported runtimes because they'll just get in the way and create our new one. - hr = XmlRemoveChildren(pixnStartup, L"supportedRuntime"); - BalExitOnFailure(hr, "Failed to remove pre-existing supportedRuntime elements."); - - hr = XmlCreateChild(pixnStartup, L"supportedRuntime", &pixnSupportedRuntime); - BalExitOnFailure(hr, "Failed to create supportedRuntime element."); - - hr = XmlSetAttribute(pixnSupportedRuntime, L"version", sczSupportedRuntimeVersion); - BalExitOnFailure(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 LoadRuntime( - __in MBASTATE* pState - ) -{ - 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); - - // Check that the supported framework is installed. - hr = CheckSupportedFrameworks(pState->sczConfigPath); - BalExitOnFailure(hr, "Failed to find supported framework."); - - // Cache the CLR host to be shutdown later. This can occur on a different thread. - // Disable message boxes from being displayed on error and blocking execution. - ::SetErrorMode(uiMode | SEM_FAILCRITICALERRORS); - - hr = LoadSystemLibrary(L"mscoree.dll", &hModule); - BalExitOnFailure(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) - { - BalExitOnRootFailure(hr, "Failed to create instance of ICLRMetaHostPolicy."); - - fFallbackToCorBindToCurrentRuntime = FALSE; - } - } - - if (fFallbackToCorBindToCurrentRuntime) - { - pfnCorBindToCurrentRuntime = reinterpret_cast(::GetProcAddress(hModule, "CorBindToCurrentRuntime")); - BalExitOnNullWithLastError(pfnCorBindToCurrentRuntime, hr, "Failed to get procedure address for CorBindToCurrentRuntime."); - - hr = pfnCorBindToCurrentRuntime(pState->sczConfigPath, CLSID_CorRuntimeHost, IID_ICorRuntimeHost, reinterpret_cast(&pState->pCLRHost)); - BalExitOnRootFailure(hr, "Failed to create the CLR host using the application configuration file path."); - } - else - { - - hr = SHCreateStreamOnFileEx(pState->sczConfigPath, STGM_READ | STGM_SHARE_DENY_WRITE, 0, FALSE, NULL, &pCfgStream); - BalExitOnFailure(hr, "Failed to load bootstrapper config file from path: %ls", pState->sczConfigPath); - - hr = pCLRMetaHostPolicy->GetRequestedRuntime(METAHOST_POLICY_HIGHCOMPAT, NULL, pCfgStream, NULL, &cchVersion, NULL, NULL, &dwConfigFlags, IID_ICLRRuntimeInfo, reinterpret_cast(&pCLRRuntimeInfo)); - BalExitOnRootFailure(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) - { - BalExitOnFailure(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(); - BalExitOnFailure(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(); - BalExitOnRootFailure(hr, "Failed to bind as legacy V2 runtime."); - } - - hr = pCLRRuntimeInfo->GetInterface(CLSID_CorRuntimeHost, IID_ICorRuntimeHost, reinterpret_cast(&pState->pCLRHost)); - BalExitOnRootFailure(hr, "Failed to get instance of ICorRuntimeHost."); - } - - hr = pState->pCLRHost->Start(); - BalExitOnRootFailure(hr, "Failed to start the CLR host."); - -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); - BalExitOnFailure(hr, "Failed to create the factory to create the bootstrapper application."); - - hr = pAppFactory->Create(pArgs, pResults); - BalExitOnFailure(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); - BalExitOnNull(bstrAssemblyName, hr, E_OUTOFMEMORY, "Failed to allocate the full assembly name for the bootstrapper application factory."); - - bstrTypeName = ::SysAllocString(MBA_ENTRY_TYPE); - BalExitOnNull(bstrTypeName, hr, E_OUTOFMEMORY, "Failed to allocate the full type name for the BA factory."); - - hr = pAppDomain->CreateInstance(bstrAssemblyName, bstrTypeName, &pObj); - BalExitOnRootFailure(hr, "Failed to create the BA factory object."); - - hr = pObj->Unwrap(&vtBAFactory); - BalExitOnRootFailure(hr, "Failed to unwrap the BA factory object into the host domain."); - BalExitOnNull(vtBAFactory.punkVal, hr, E_UNEXPECTED, "The variant did not contain the expected IUnknown pointer."); - - hr = vtBAFactory.punkVal->QueryInterface(__uuidof(IBootstrapperApplicationFactory), reinterpret_cast(ppAppFactory)); - BalExitOnRootFailure(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 MBASTATE* pState, - __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 = PathConcat(pState->sczAppBase, L"mbapreq.dll", &sczMbapreqPath); - BalExitOnFailure(hr, "Failed to get path to pre-requisite BA."); - - hModule = ::LoadLibraryExW(sczMbapreqPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - BalExitOnNullWithLastError(hModule, hr, "Failed to load pre-requisite BA DLL."); - - PFN_PREQ_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = reinterpret_cast(::GetProcAddress(hModule, "PrereqBootstrapperApplicationCreate")); - BalExitOnNullWithLastError(pfnCreate, hr, "Failed to get PrereqBootstrapperApplicationCreate entry-point from: %ls", sczMbapreqPath); - - hr = pfnCreate(&pState->prereqData, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create prequisite bootstrapper app."); - - pState->hMbapreqModule = 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); - } - BalExitOnFailure(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); - } - BalExitOnWin32Error(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 deleted file mode 100644 index 4488df94..00000000 --- a/src/ext/Bal/mbahost/mbahost.def +++ /dev/null @@ -1,6 +0,0 @@ -; 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.h b/src/ext/Bal/mbahost/mbahost.h deleted file mode 100644 index 19cf8311..00000000 --- a/src/ext/Bal/mbahost/mbahost.h +++ /dev/null @@ -1,17 +0,0 @@ -#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. - - -struct MBASTATE -{ - BOOL fInitialized; - BOOL fInitializedRuntime; - BOOL fStoppedRuntime; - HINSTANCE hInstance; - LPWSTR sczAppBase; - LPWSTR sczConfigPath; - mscorlib::_AppDomain* pAppDomain; - ICorRuntimeHost* pCLRHost; - HMODULE hMbapreqModule; - PREQBA_DATA prereqData; -}; diff --git a/src/ext/Bal/mbahost/mbahost.vcxproj b/src/ext/Bal/mbahost/mbahost.vcxproj deleted file mode 100644 index 7764e4d4..00000000 --- a/src/ext/Bal/mbahost/mbahost.vcxproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {12C87C77-3547-44F8-8134-29BC915CB19D} - DynamicLibrary - Unicode - mbahost - mbahost.def - - - - - - - $(BaseOutputPath)obj;..\wixstdba\inc - shlwapi.lib - - - - - - Create - - - - - - - - - - - - - {f2ba1935-70fa-4156-b161-fd03850b4faa} - false - true - - - - - - - - - - - diff --git a/src/ext/Bal/mbahost/precomp.cpp b/src/ext/Bal/mbahost/precomp.cpp deleted file mode 100644 index 37664a1c..00000000 --- a/src/ext/Bal/mbahost/precomp.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index a07f2fc0..00000000 --- a/src/ext/Bal/mbahost/precomp.h +++ /dev/null @@ -1,30 +0,0 @@ -#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 -#include -#include -#include -#include - -#include - -#include -#include // includes the generated assembly name macros. - -#include "mbahost.h" diff --git a/src/ext/Bal/stdbas/Resources/1028/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1028/wixpreq.wxl new file mode 100644 index 00000000..1ab287e4 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1028/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1029/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1029/wixpreq.wxl new file mode 100644 index 00000000..e60c92cb --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1029/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1030/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1030/wixpreq.wxl new file mode 100644 index 00000000..b895bb76 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1030/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1031/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1031/wixpreq.wxl new file mode 100644 index 00000000..760b1ceb --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1031/wixpreq.wxl @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1032/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1032/wixpreq.wxl new file mode 100644 index 00000000..a9cd7a5b --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1032/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1035/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1035/wixpreq.wxl new file mode 100644 index 00000000..b54476bd --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1035/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1036/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1036/wixpreq.wxl new file mode 100644 index 00000000..cd17ae34 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1036/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1038/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1038/wixpreq.wxl new file mode 100644 index 00000000..6cbb1d34 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1038/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1040/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1040/wixpreq.wxl new file mode 100644 index 00000000..66940e85 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1040/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1041/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1041/wixpreq.wxl new file mode 100644 index 00000000..c830072e --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1041/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1042/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1042/wixpreq.wxl new file mode 100644 index 00000000..df6e9b31 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1042/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1043/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1043/wixpreq.wxl new file mode 100644 index 00000000..c9d7b8e4 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1043/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1044/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1044/wixpreq.wxl new file mode 100644 index 00000000..9a5f8ea1 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1044/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1045/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1045/wixpreq.wxl new file mode 100644 index 00000000..f7d0de6a --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1045/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1046/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1046/wixpreq.wxl new file mode 100644 index 00000000..dc8d22d1 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1046/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1049/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1049/wixpreq.wxl new file mode 100644 index 00000000..0614da9e --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1049/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1051/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1051/wixpreq.wxl new file mode 100644 index 00000000..0dd75159 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1051/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1053/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1053/wixpreq.wxl new file mode 100644 index 00000000..068f5519 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1053/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1055/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1055/wixpreq.wxl new file mode 100644 index 00000000..f4d98354 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1055/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/1060/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/1060/wixpreq.wxl new file mode 100644 index 00000000..d24231db --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/1060/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/2052/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/2052/wixpreq.wxl new file mode 100644 index 00000000..43ed19fe --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/2052/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/2070/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/2070/wixpreq.wxl new file mode 100644 index 00000000..1e57ec2f --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/2070/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/3082/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/3082/wixpreq.wxl new file mode 100644 index 00000000..cd835913 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/3082/wixpreq.wxl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml new file mode 100644 index 00000000..6e7b69ee --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/HyperlinkLargeTheme.xml @@ -0,0 +1,117 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml new file mode 100644 index 00000000..59a03ad0 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/HyperlinkSidebarTheme.xml @@ -0,0 +1,134 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl new file mode 100644 index 00000000..24e7b728 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.wxl @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml new file mode 100644 index 00000000..c82e1b9f --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/HyperlinkTheme.xml @@ -0,0 +1,117 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/LoremIpsumLicense.rtf b/src/ext/Bal/stdbas/Resources/LoremIpsumLicense.rtf new file mode 100644 index 00000000..1a183236 Binary files /dev/null and b/src/ext/Bal/stdbas/Resources/LoremIpsumLicense.rtf differ diff --git a/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml b/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml new file mode 100644 index 00000000..b30fe3cd --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml @@ -0,0 +1,119 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/RtfTheme.wxl b/src/ext/Bal/stdbas/Resources/RtfTheme.wxl new file mode 100644 index 00000000..a827d1a9 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/RtfTheme.wxl @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/RtfTheme.xml b/src/ext/Bal/stdbas/Resources/RtfTheme.xml new file mode 100644 index 00000000..e1a486c8 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/RtfTheme.xml @@ -0,0 +1,117 @@ + + + + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + + + + #(loc.InstallAcceptCheckbox) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/dncpreq.wxl b/src/ext/Bal/stdbas/Resources/dncpreq.wxl new file mode 100644 index 00000000..a1f63d43 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/dncpreq.wxl @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/iuipreq.thm b/src/ext/Bal/stdbas/Resources/iuipreq.thm new file mode 100644 index 00000000..83425841 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/iuipreq.thm @@ -0,0 +1,67 @@ + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + #(loc.InstallLicenseTerms) + + + + + + + + + + + + + + + + + + + #(loc.FailureLogLinkText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/logo.png b/src/ext/Bal/stdbas/Resources/logo.png new file mode 100644 index 00000000..7adc6e11 Binary files /dev/null and b/src/ext/Bal/stdbas/Resources/logo.png differ diff --git a/src/ext/Bal/stdbas/Resources/logoSide.png b/src/ext/Bal/stdbas/Resources/logoSide.png new file mode 100644 index 00000000..308841c5 Binary files /dev/null and b/src/ext/Bal/stdbas/Resources/logoSide.png differ diff --git a/src/ext/Bal/stdbas/Resources/wixpreq.png b/src/ext/Bal/stdbas/Resources/wixpreq.png new file mode 100644 index 00000000..c6e9527b Binary files /dev/null and b/src/ext/Bal/stdbas/Resources/wixpreq.png differ diff --git a/src/ext/Bal/stdbas/Resources/wixpreq.thm b/src/ext/Bal/stdbas/Resources/wixpreq.thm new file mode 100644 index 00000000..a49c3ee7 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/wixpreq.thm @@ -0,0 +1,60 @@ + + + Segoe UI + Segoe UI + Segoe UI + Segoe UI + + + + + + + + + + + + #(loc.InstallLicenseTerms) + + + + + + + + + + + + + + + + + + + #(loc.FailureLogLinkText) + + + + + + + diff --git a/src/ext/Bal/stdbas/Resources/wixpreq.wxl b/src/ext/Bal/stdbas/Resources/wixpreq.wxl new file mode 100644 index 00000000..f4725121 --- /dev/null +++ b/src/ext/Bal/stdbas/Resources/wixpreq.wxl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/stdbas/WixInternalUIBootstrapperApplication.cpp b/src/ext/Bal/stdbas/WixInternalUIBootstrapperApplication.cpp new file mode 100644 index 00000000..a8967a31 --- /dev/null +++ b/src/ext/Bal/stdbas/WixInternalUIBootstrapperApplication.cpp @@ -0,0 +1,885 @@ +// 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 "BalBaseBootstrapperApplication.h" + +static const LPCWSTR WIXIUIBA_WINDOW_CLASS = L"WixInternalUIBA"; + +enum WM_WIXIUIBA +{ + WM_WIXIUIBA_DETECT_PACKAGES = WM_APP + 100, + WM_WIXIUIBA_PLAN_PACKAGES, + WM_WIXIUIBA_APPLY_PACKAGES, + WM_WIXIUIBA_DETECT_FOR_CLEANUP, + WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP, +}; + + +class CWixInternalUIBootstrapperApplication : public CBalBaseBootstrapperApplication +{ +public: // IBootstrapperApplication + STDMETHODIMP OnCreate( + __in IBootstrapperEngine* pEngine, + __in BOOTSTRAPPER_COMMAND* pCommand + ) + { + HRESULT hr = S_OK; + + hr = __super::OnCreate(pEngine, pCommand); + BalExitOnFailure(hr, "CBalBaseBootstrapperApplication initialization failed."); + + m_commandAction = pCommand->action; + m_commandDisplay = pCommand->display; + + hr = InitializeData(); + BalExitOnFailure(hr, "Failed to initialize data in internal UI bootstrapper application."); + + LExit: + return hr; + } + + 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) + { + BalExitWithLastError(hr, "Failed to create UI thread."); + } + + LExit: + return hr; + } + + + virtual STDMETHODIMP OnShutdown( + __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction + ) + { + // wait for UI thread to terminate + if (m_hUiThread) + { + ::WaitForSingleObject(m_hUiThread, INFINITE); + ReleaseHandle(m_hUiThread); + } + + if (m_fFailedToLoadPackage) + { + Assert(FAILED(m_hrFinal)); + // TODO: Should we really do what this error message says? Going back to the prereq BA + // to show the error dialog is pretty overkill vs. showing an error dialog in this BA. + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to load primary package as the BA. The bootstrapper application will be reloaded to show the error."); + *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER; + } + + return S_OK; + } + + + virtual STDMETHODIMP OnDetectPackageComplete( + __in_z LPCWSTR wzPackageId, + __in HRESULT hrStatus, + __in BOOTSTRAPPER_PACKAGE_STATE state, + __in BOOL fCached + ) + { + BAL_INFO_PACKAGE* pPackage = NULL; + + if (SUCCEEDED(hrStatus) && SUCCEEDED(BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage)) && + BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT == pPackage->primaryPackageType) + { + BOOL fInstalled = BOOTSTRAPPER_PACKAGE_STATE_ABSENT < state; + + // Maybe modify the action state if the primary package is or is not already installed. + if (fInstalled && BOOTSTRAPPER_ACTION_INSTALL == m_commandAction) + { + m_commandAction = BOOTSTRAPPER_ACTION_MODIFY; + } + else if (!fInstalled && (BOOTSTRAPPER_ACTION_MODIFY == m_commandAction || BOOTSTRAPPER_ACTION_REPAIR == m_commandAction)) + { + m_commandAction = BOOTSTRAPPER_ACTION_INSTALL; + } + + if (m_fApplied && !fInstalled && fCached) + { + m_fAutomaticRemoval = TRUE; + } + } + + return __super::OnDetectPackageComplete(wzPackageId, hrStatus, state, fCached); + } + + + virtual STDMETHODIMP OnDetectComplete( + __in HRESULT hrStatus, + __in BOOL fEligibleForCleanup + ) + { + if (m_fAutomaticRemoval && SUCCEEDED(hrStatus)) + { + ::PostMessageW(m_hWnd, WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP, 0, BOOTSTRAPPER_ACTION_UNINSTALL); + ExitFunction(); + } + else if (m_fApplied) + { + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + ExitFunction(); + } + + // If we're performing an action that modifies machine state then evaluate conditions. + BOOL fEvaluateConditions = SUCCEEDED(hrStatus) && + (BOOTSTRAPPER_ACTION_LAYOUT < m_commandAction && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > m_commandAction); + + if (fEvaluateConditions) + { + hrStatus = EvaluateConditions(); + } + + if (SUCCEEDED(hrStatus)) + { + ::PostMessageW(m_hWnd, WM_WIXIUIBA_PLAN_PACKAGES, 0, m_commandAction); + } + else + { + SetLoadPackageFailure(hrStatus); + } + + LExit: + return __super::OnDetectComplete(hrStatus, fEligibleForCleanup); + } + + + virtual STDMETHODIMP OnPlanPackageBegin( + __in_z LPCWSTR wzPackageId, + __in BOOTSTRAPPER_PACKAGE_STATE state, + __in BOOL fCached, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, + __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; + BAL_INFO_PACKAGE* pPackage = NULL; + + hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + if (FAILED(hr)) + { + // Non-chain package, keep default. + } + else if (BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT != pPackage->primaryPackageType) + { + // Only the primary package should be cached or executed. + if (BOOTSTRAPPER_CACHE_TYPE_FORCE == *pRequestedCacheType) + { + *pRequestedCacheType = BOOTSTRAPPER_CACHE_TYPE_KEEP; + } + + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE; + } + else if (BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay && !m_fAutomaticRemoval) + { + // Make sure the MSI UI is shown regardless of the current state of the package. + *pRequestState = BOOTSTRAPPER_REQUEST_STATE_FORCE_PRESENT; + } + + return __super::OnPlanPackageBegin(wzPackageId, state, fCached, installCondition, repairCondition, recommendedState, recommendedCacheType, pRequestState, pRequestedCacheType, pfCancel); + } + + + virtual STDMETHODIMP OnPlanMsiPackage( + __in_z LPCWSTR wzPackageId, + __in BOOL fExecute, + __in BOOTSTRAPPER_ACTION_STATE action, + __in BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, + __inout BOOL* pfCancel, + __inout BURN_MSI_PROPERTY* pActionMsiProperty, + __inout INSTALLUILEVEL* pUiLevel, + __inout BOOL* pfDisableExternalUiHandler, + __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning + ) + { + INSTALLUILEVEL uiLevel = INSTALLUILEVEL_NOCHANGE; + + if (m_fAutomaticRemoval) + { + ExitFunction(); + } + + switch (m_commandDisplay) + { + case BOOTSTRAPPER_DISPLAY_FULL: + uiLevel = INSTALLUILEVEL_FULL; + break; + + case BOOTSTRAPPER_DISPLAY_PASSIVE: + uiLevel = INSTALLUILEVEL_REDUCED; + break; + } + + if (INSTALLUILEVEL_NOCHANGE != uiLevel) + { + *pUiLevel = uiLevel; + } + + *pActionMsiProperty = BURN_MSI_PROPERTY_NONE; + *pfDisableExternalUiHandler = TRUE; + + LExit: + return __super::OnPlanMsiPackage(wzPackageId, fExecute, action, recommendedFileVersioning, pfCancel, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); + } + + + virtual STDMETHODIMP OnPlanComplete( + __in HRESULT hrStatus + ) + { + if (SUCCEEDED(hrStatus)) + { + ::PostMessageW(m_hWnd, WM_WIXIUIBA_APPLY_PACKAGES, 0, 0); + } + else if (m_fAutomaticRemoval) + { + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + else + { + SetLoadPackageFailure(hrStatus); + } + + return __super::OnPlanComplete(hrStatus); + } + + + virtual STDMETHODIMP OnApplyBegin( + __in DWORD dwPhaseCount, + __inout BOOL* pfCancel + ) + { + m_fApplying = TRUE; + return __super::OnApplyBegin(dwPhaseCount, pfCancel); + } + + + virtual STDMETHODIMP OnCacheComplete( + __in HRESULT hrStatus + ) + { + if (FAILED(hrStatus) && !m_fAutomaticRemoval) + { + SetLoadPackageFailure(hrStatus); + } + + return __super::OnCacheComplete(hrStatus); + } + + + virtual STDMETHODIMP OnExecuteBegin( + __in DWORD cExecutingPackages, + __in BOOL* pfCancel + ) + { + m_pEngine->CloseSplashScreen(); + + return __super::OnExecuteBegin(cExecutingPackages, pfCancel); + } + + + virtual STDMETHODIMP OnApplyComplete( + __in HRESULT hrStatus, + __in BOOTSTRAPPER_APPLY_RESTART restart, + __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, + __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction + ) + { + HRESULT hr = __super::OnApplyComplete(hrStatus, restart, recommendation, pAction); + + *pAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; + m_fApplying = FALSE; + + if (m_fAutomaticRemoval) + { + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + else + { + m_restartResult = restart; // remember the restart result so we return the correct error code. + m_fApplied = TRUE; + + if (FAILED(hrStatus)) + { + m_hrFinal = hrStatus; + } + + ::PostMessageW(m_hWnd, WM_WIXIUIBA_DETECT_FOR_CLEANUP, 0, 0); + } + + return hr; + } + + +private: + // + // UiThreadProc - entrypoint for UI thread. + // + static DWORD WINAPI UiThreadProc( + __in LPVOID pvContext + ) + { + HRESULT hr = S_OK; + CWixInternalUIBootstrapperApplication* pThis = (CWixInternalUIBootstrapperApplication*)pvContext; + BOOL fComInitialized = FALSE; + BOOL fRet = FALSE; + MSG msg = { }; + DWORD dwQuit = 0; + + // Initialize COM. + hr = ::CoInitialize(NULL); + BalExitOnFailure(hr, "Failed to initialize COM."); + fComInitialized = TRUE; + + // Create main window. + hr = pThis->CreateMainWindow(); + BalExitOnFailure(hr, "Failed to create internal UI bootstrapper application main window."); + + ::PostMessageW(pThis->m_hWnd, WM_WIXIUIBA_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 (!::IsDialogMessageW(pThis->m_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(); + + if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == pThis->m_restartResult) + { + dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_INITIATED : ERROR_FAIL_REBOOT_INITIATED; + } + else if (BOOTSTRAPPER_APPLY_RESTART_REQUIRED == pThis->m_restartResult) + { + dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_REQUIRED : ERROR_FAIL_REBOOT_REQUIRED; + } + else if (SEVERITY_ERROR == HRESULT_SEVERITY(hr) && FACILITY_WIN32 == HRESULT_FACILITY(hr)) + { + // Convert Win32 HRESULTs back to the error code. + dwQuit = HRESULT_CODE(hr); + } + else + { + dwQuit = hr; + } + + // initiate engine shutdown + pThis->m_pEngine->Quit(dwQuit); + + // uninitialize COM + if (fComInitialized) + { + ::CoUninitialize(); + } + + return hr; + } + + + // + // InitializeData - initializes all the package and prerequisite information. + // + HRESULT InitializeData() + { + HRESULT hr = S_OK; + IXMLDOMDocument* pixdManifest = NULL; + + hr = XmlInitialize(); + BalExitOnFailure(hr, "Failed to initialize XML."); + + hr = BalManifestLoad(m_hModule, &pixdManifest); + BalExitOnFailure(hr, "Failed to load bootstrapper application manifest."); + + hr = BalInfoParseFromXml(&m_Bundle, pixdManifest); + BalExitOnFailure(hr, "Failed to load bundle information."); + + hr = EnsureSinglePrimaryPackage(); + BalExitOnFailure(hr, "Failed to ensure single primary package."); + + hr = ProcessCommandLine(); + ExitOnFailure(hr, "Unknown commandline parameters."); + + hr = BalConditionsParseFromXml(&m_Conditions, pixdManifest, NULL); + BalExitOnFailure(hr, "Failed to load conditions from XML."); + + LExit: + ReleaseObject(pixdManifest); + + return hr; + } + + + // + // ProcessCommandLine - process the provided command line arguments. + // + HRESULT ProcessCommandLine() + { + HRESULT hr = S_OK; + int argc = 0; + LPWSTR* argv = NULL; + + argc = m_BalInfoCommand.cUnknownArgs; + argv = m_BalInfoCommand.rgUnknownArgs; + + for (int i = 0; i < argc; ++i) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Ignoring unknown argument: %ls", argv[i]); + } + + hr = BalSetOverridableVariablesFromEngine(&m_Bundle.overridableVariables, &m_BalInfoCommand, m_pEngine); + BalExitOnFailure(hr, "Failed to set overridable variables from the command line."); + + LExit: + return hr; + } + + HRESULT EnsureSinglePrimaryPackage() + { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pDefaultPackage = NULL; + BOOL fPrimaryArchSpecific = FALSE; + USHORT usNativeMachine = 0; + BAL_INFO_PRIMARY_PACKAGE_TYPE nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE; + + hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); + BalExitOnFailure(hr, "Failed to get native machine value."); + + if (S_FALSE != hr) + { + switch (usNativeMachine) + { + case IMAGE_FILE_MACHINE_I386: + nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X86; + break; + case IMAGE_FILE_MACHINE_AMD64: + nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X64; + break; + case IMAGE_FILE_MACHINE_ARM64: + nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_ARM64; + break; + } + } + else + { +#if !defined(_WIN64) + BOOL fIsWow64 = FALSE; + + ProcWow64(::GetCurrentProcess(), &fIsWow64); + if (!fIsWow64) + { + nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X86; + } + else +#endif + { + nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X64; + } + } + + for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) + { + BAL_INFO_PACKAGE* pPackage = m_Bundle.packages.rgPackages + i; + + if (BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE == pPackage->primaryPackageType) + { + // Skip. + } + else if (nativeType == pPackage->primaryPackageType) + { + if (fPrimaryArchSpecific) + { + BalExitWithRootFailure(hr, E_INVALIDDATA, "Bundle contains multiple primary packages for same architecture: %u.", nativeType); + } + + pPackage->primaryPackageType = BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT; + fPrimaryArchSpecific = TRUE; + } + else if (BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT == pPackage->primaryPackageType) + { + if (pDefaultPackage) + { + BalExitWithRootFailure(hr, E_INVALIDDATA, "Bundle contains multiple default primary packages."); + } + + pDefaultPackage = pPackage; + } + } + + BalExitOnNull(pDefaultPackage, hr, E_INVALIDSTATE, "Bundle did not contain default primary package."); + + if (fPrimaryArchSpecific) + { + pDefaultPackage->primaryPackageType = BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE; + } + + LExit: + return hr; + } + + + // + // CreateMainWindow - creates the main install window. + // + HRESULT CreateMainWindow() + { + HRESULT hr = S_OK; + WNDCLASSW wc = { }; + DWORD dwWindowStyle = WS_POPUP; + + wc.lpfnWndProc = CWixInternalUIBootstrapperApplication::WndProc; + wc.hInstance = m_hModule; + wc.lpszClassName = WIXIUIBA_WINDOW_CLASS; + + if (!::RegisterClassW(&wc)) + { + ExitWithLastError(hr, "Failed to register window."); + } + + m_fRegistered = TRUE; + + // If the UI should be visible, allow it to be visible and activated so we are the foreground window. + // This allows the UAC prompt and MSI UI to automatically be activated. + if (BOOTSTRAPPER_DISPLAY_NONE < m_commandDisplay) + { + dwWindowStyle |= WS_VISIBLE; + } + + m_hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, dwWindowStyle, 0, 0, 0, 0, HWND_DESKTOP, NULL, m_hModule, this); + ExitOnNullWithLastError(m_hWnd, hr, "Failed to create internal UI main window."); + + LExit: + return hr; + } + + // + // DestroyMainWindow - clean up all the window registration. + // + void DestroyMainWindow() + { + if (::IsWindow(m_hWnd)) + { + ::DestroyWindow(m_hWnd); + m_hWnd = NULL; + } + + if (m_fRegistered) + { + ::UnregisterClassW(WIXIUIBA_WINDOW_CLASS, m_hModule); + m_fRegistered = FALSE; + } + } + + // + // 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) + CWixInternalUIBootstrapperApplication* pBA = reinterpret_cast(::GetWindowLongPtrW(hWnd, GWLP_USERDATA)); + + 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 = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); + ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, 0); + ::PostQuitMessage(0); + return lres; + } + + 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_WIXIUIBA_DETECT_PACKAGES: __fallthrough; + case WM_WIXIUIBA_DETECT_FOR_CLEANUP: + pBA->OnDetect(); + return 0; + + case WM_WIXIUIBA_PLAN_PACKAGES: + case WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP: + pBA->OnPlan(static_cast(lParam)); + return 0; + + case WM_WIXIUIBA_APPLY_PACKAGES: + pBA->OnApply(); + return 0; + } + + return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); + } + + + // + // OnDetect - start the processing of packages. + // + void OnDetect() + { + HRESULT hr = S_OK; + + hr = m_pEngine->Detect(); + BalExitOnFailure(hr, "Failed to start detecting chain."); + + LExit: + if (FAILED(hr)) + { + SetLoadPackageFailure(hr); + } + } + + + // + // OnPlan - plan the detected changes. + // + void OnPlan( + __in BOOTSTRAPPER_ACTION action + ) + { + HRESULT hr = S_OK; + + m_plannedAction = action; + + hr = m_pEngine->Plan(action); + BalExitOnFailure(hr, "Failed to start planning packages."); + + LExit: + if (FAILED(hr)) + { + SetLoadPackageFailure(hr); + } + } + + + // + // OnApply - apply the packages. + // + void OnApply() + { + HRESULT hr = S_OK; + + hr = m_pEngine->Apply(m_hWnd); + BalExitOnFailure(hr, "Failed to start applying packages."); + + LExit: + if (FAILED(hr)) + { + SetLoadPackageFailure(hr); + } + } + + + // + // OnClose - called when the window is trying to be closed. + // + BOOL OnClose() + { + BOOL fClose = FALSE; + + // If we've already applied, just close. + if (m_fApplied) + { + fClose = TRUE; + } + else + { + PromptCancel(m_hWnd, TRUE, NULL, NULL); + + // If we're inside Apply then we never close, we just cancel to let rollback occur. + fClose = !m_fApplying; + } + + return fClose; + } + + + 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 SetLoadPackageFailure( + __in HRESULT hrStatus + ) + { + Assert(FAILED(hrStatus)); + + if (!m_fApplied) + { + m_hrFinal = hrStatus; + m_fFailedToLoadPackage = TRUE; + } + + // Quietly exit. + ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + + +public: + // + // Constructor - initialize member variables. + // + CWixInternalUIBootstrapperApplication( + __in HMODULE hModule + ) : CBalBaseBootstrapperApplication(3, 3000) + { + m_hModule = hModule; + m_commandAction = BOOTSTRAPPER_ACTION_UNKNOWN; + m_commandDisplay = BOOTSTRAPPER_DISPLAY_UNKNOWN; + + m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; + + m_Bundle = { }; + m_Conditions = { }; + m_sczConfirmCloseMessage = NULL; + m_sczFailedMessage = NULL; + + m_hUiThread = NULL; + m_fRegistered = FALSE; + m_hWnd = NULL; + + m_hrFinal = S_OK; + + m_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE; + + m_fApplying = FALSE; + m_fApplied = FALSE; + m_fAutomaticRemoval = FALSE; + m_fFailedToLoadPackage = FALSE; + } + + + // + // Destructor - release member variables. + // + ~CWixInternalUIBootstrapperApplication() + { + ReleaseStr(m_sczFailedMessage); + ReleaseStr(m_sczConfirmCloseMessage); + BalConditionsUninitialize(&m_Conditions); + BalInfoUninitialize(&m_Bundle); + + ReleaseNullObject(m_pEngine); + } + +private: + HMODULE m_hModule; + BOOTSTRAPPER_ACTION m_commandAction; + BOOTSTRAPPER_DISPLAY m_commandDisplay; + + BOOTSTRAPPER_ACTION m_plannedAction; + + BAL_INFO_BUNDLE m_Bundle; + BAL_CONDITIONS m_Conditions; + LPWSTR m_sczFailedMessage; + LPWSTR m_sczConfirmCloseMessage; + + HANDLE m_hUiThread; + BOOL m_fRegistered; + HWND m_hWnd; + + HRESULT m_hrFinal; + + BOOTSTRAPPER_APPLY_RESTART m_restartResult; + + BOOL m_fApplying; + BOOL m_fApplied; + BOOL m_fAutomaticRemoval; + BOOL m_fFailedToLoadPackage; +}; + + +// +// CreateBootstrapperApplication - creates a new IBootstrapperApplication object. +// +EXTERN_C HRESULT CreateWixInternalUIBootstrapperApplication( + __in HMODULE hInstance, + __out IBootstrapperApplication** ppApplication +) +{ + HRESULT hr = S_OK; + + CWixInternalUIBootstrapperApplication* pApplication = new CWixInternalUIBootstrapperApplication(hInstance); + ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new internal UI bootstrapper application."); + + hr = pApplication->QueryInterface(IID_PPV_ARGS(ppApplication)); + ExitOnRootFailure(hr, "Failed to query for IBootstrapperApplication."); + +LExit: + ReleaseObject(pApplication); + + return hr; +} diff --git a/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp new file mode 100644 index 00000000..233cabbc --- /dev/null +++ b/src/ext/Bal/stdbas/WixStandardBootstrapperApplication.cpp @@ -0,0 +1,5373 @@ +// 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 "BalBaseBootstrapperApplication.h" + +static const LPCWSTR WIXBUNDLE_VARIABLE_CANRESTART = L"WixCanRestart"; +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"; +static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable"; + +enum WIXSTDBA_STATE +{ + WIXSTDBA_STATE_INITIALIZING, + WIXSTDBA_STATE_INITIALIZED, + WIXSTDBA_STATE_HELP, + WIXSTDBA_STATE_DETECTING, + WIXSTDBA_STATE_DETECTED, + WIXSTDBA_STATE_PLANNING_PREREQS, + WIXSTDBA_STATE_PLANNED_PREREQS, + 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, + WM_WIXSTDBA_PLAN_PREREQS, +}; + +// 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", +}; + +// The range [0, 100) is unused to avoid collisions with system ids, +// the range [100, 0x4000) is unused to avoid collisions with thmutil, +// the range [0x4000, 0x8000) is unused to avoid collisions with BAFunctions. +const WORD WIXSTDBA_FIRST_ASSIGN_CONTROL_ID = 0x8000; + +enum WIXSTDBA_CONTROL +{ + // Welcome page + WIXSTDBA_CONTROL_INSTALL_BUTTON = WIXSTDBA_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, + + // Updates + WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL, + WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON, + WIXSTDBA_CONTROL_MODIFY_UPDATE_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, + + LAST_WIXSTDBA_CONTROL, +}; + + +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 LoggingBoolToString( + __in BOOL f + ); +static LPCSTR LoggingRequestStateToString( + __in BOOTSTRAPPER_REQUEST_STATE requestState + ); +static LPCSTR LoggingPlanRelationTypeToString( + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE type + ); +static LPCSTR LoggingMsiFeatureStateToString( + __in BOOTSTRAPPER_FEATURE_STATE featureState + ); + + +class CWixStandardBootstrapperApplication : public CBalBaseBootstrapperApplication +{ +public: // IBootstrapperApplication + STDMETHODIMP OnCreate( + __in IBootstrapperEngine* pEngine, + __in BOOTSTRAPPER_COMMAND* pCommand + ) + { + HRESULT hr = S_OK; + + hr = __super::OnCreate(pEngine, pCommand); + BalExitOnFailure(hr, "CBalBaseBootstrapperApplication initialization failed."); + + m_commandAction = pCommand->action; + m_commandDisplay = pCommand->display; + m_commandResumeType = pCommand->resumeType; + m_commandRelationType = pCommand->relationType; + m_hwndSplashScreen = pCommand->hwndSplashScreen; + + hr = BalGetStringVariable(L"WixBundleVersion", &m_sczBundleVersion); + BalExitOnFailure(hr, "CWixStandardBootstrapperApplication initialization failed."); + + hr = InitializeData(pCommand); + BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application."); + + LExit: + return hr; + } + + STDMETHODIMP OnDestroy( + __in BOOL fReload + ) + { + if (m_hBAFModule) + { + BA_FUNCTIONS_DESTROY_ARGS args = { }; + BA_FUNCTIONS_DESTROY_RESULTS results = { }; + + args.cbSize = sizeof(BA_FUNCTIONS_DESTROY_ARGS); + args.fReload = fReload; + + results.cbSize = sizeof(BA_FUNCTIONS_DESTROY_RESULTS); + + PFN_BA_FUNCTIONS_DESTROY pfnBAFunctionsDestroy = reinterpret_cast(::GetProcAddress(m_hBAFModule, "BAFunctionsDestroy")); + if (pfnBAFunctionsDestroy) + { + pfnBAFunctionsDestroy(&args, &results); + } + + if (!results.fDisableUnloading) + { + m_pfnBAFunctionsProc = NULL; + m_pvBAFunctionsProcContext = NULL; + + ::FreeLibrary(m_hBAFModule); + m_hBAFModule = NULL; + } + } + + return __super::OnDestroy(fReload); + } + + STDMETHODIMP OnStartup() + { + HRESULT hr = S_OK; + DWORD dwUIThreadId = 0; + + // create UI thread + m_hUiThread = ::CreateThread(NULL, 0, UiThreadProc, this, 0, &dwUIThreadId); + if (!m_hUiThread) + { + BalExitWithLastError(hr, "Failed to create UI thread."); + } + + LExit: + return hr; + } + + + 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_fShouldRestart && m_fAllowRestart) + { + *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART; + } + + if (m_fPrereq) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART == *pAction + ? "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 || m_fPrereqSkipped) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, m_fPrereqInstalled + ? "The prerequisites were successfully installed. The bootstrapper application will be reloaded." + : "The prerequisites were already installed. The bootstrapper application will be reloaded."); + *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER; + } + 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 OnDetectBegin( + __in BOOL fCached, + __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, + __in DWORD cPackages, + __inout BOOL* pfCancel + ) + { + HRESULT hr = S_OK; + BOOL fInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == registrationType; + + if (m_fPrereq) + { + // Pre-requisite command action is set during initialization. + } + else if (BOOTSTRAPPER_DISPLAY_FULL <= m_commandDisplay) // only modify the action state if showing full UI. + { + // Maybe modify the action state if the bundle is or is not already installed. + if (fInstalled && BOOTSTRAPPER_RESUME_TYPE_REBOOT != m_commandResumeType && BOOTSTRAPPER_ACTION_INSTALL == m_commandAction) + { + m_commandAction = BOOTSTRAPPER_ACTION_MODIFY; + } + else if (!fInstalled && (BOOTSTRAPPER_ACTION_MODIFY == m_commandAction || BOOTSTRAPPER_ACTION_REPAIR == m_commandAction)) + { + m_commandAction = BOOTSTRAPPER_ACTION_INSTALL; + } + } + + // 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. + if (BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_commandResumeType && BOOTSTRAPPER_ACTION_UNINSTALL < m_commandAction) + { + // Ensure the forced restart package variable is null when it is an empty string. + hr = BalGetStringVariable(L"WixBundleForcedRestartPackage", &m_sczAfterForcedRestartPackage); + if (FAILED(hr) || !m_sczAfterForcedRestartPackage || !*m_sczAfterForcedRestartPackage) + { + ReleaseNullStr(m_sczAfterForcedRestartPackage); + } + + hr = S_OK; + } + + if (!m_fPreplanPrereqs) + { + // If the UI should be visible, display it now and hide the splash screen + if (BOOTSTRAPPER_DISPLAY_NONE < m_commandDisplay) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + } + + return __super::OnDetectBegin(fCached, registrationType, cPackages, pfCancel); + } + + virtual STDMETHODIMP OnDetectRelatedBundle( + __in LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in LPCWSTR wzBundleTag, + __in BOOL fPerMachine, + __in LPCWSTR wzVersion, + __in BOOL fMissingFromCache, + __inout BOOL* pfCancel + ) + { + BAL_INFO_PACKAGE* pPackage = NULL; + + if (!fMissingFromCache) + { + BalInfoAddRelatedBundleAsPackage(&m_Bundle.packages, wzBundleId, relationType, fPerMachine, &pPackage); + // Best effort + } + + if (BOOTSTRAPPER_ACTION_INSTALL == m_commandAction && BOOTSTRAPPER_RELATION_UPGRADE != m_commandRelationType && BOOTSTRAPPER_RELATION_UPGRADE == relationType) + { + int nResult = 0; + HRESULT hr = VerCompareStringVersions(m_sczBundleVersion, wzVersion, TRUE/*fStrict*/, &nResult); + BalExitOnFailure(hr, "Failed to compare bundle version: %ls to related bundle version: %ls.", m_sczBundleVersion, wzVersion); + + if (0 > nResult) + { + m_fDowngrading = TRUE; + + BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Related bundle version: %ls is a downgrade for bundle version: %ls.", wzVersion, m_sczBundleVersion); + } + } + + LExit: + return CBalBaseBootstrapperApplication::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); + } + + + virtual STDMETHODIMP OnDetectUpdateBegin( + __in_z LPCWSTR wzUpdateLocation, + __inout BOOL* pfCancel, + __inout BOOL* pfSkip + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnDetectUpdateBegin() - update location: %ls", wzUpdateLocation); +#endif + + // Try update detection only if we have a potential update source and are in full UI mode. + *pfSkip = !wzUpdateLocation + || !*wzUpdateLocation + || BOOTSTRAPPER_DISPLAY_FULL != m_commandDisplay; + + ThemeShowControl(m_pControlCheckingForUpdatesLabel, *pfSkip ? SW_HIDE : SW_SHOW); + + return __super::OnDetectUpdateBegin(wzUpdateLocation, pfCancel, pfSkip); + } + + + virtual STDMETHODIMP OnDetectUpdate( + __in_z LPCWSTR wzUpdateLocation, + __in DWORD64 dw64Size, + __in_z_opt LPCWSTR wzHash, + __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, + __in LPCWSTR wzUpdateVersion, + __in_z LPCWSTR wzTitle, + __in_z LPCWSTR wzSummary, + __in_z LPCWSTR wzContentType, + __in_z LPCWSTR wzContent, + __inout BOOL* pfCancel, + __inout BOOL* pfStopProcessingUpdates + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnDetectUpdate() - update location: %ls, version: %ls", wzUpdateLocation, wzUpdateVersion); +#endif + + HRESULT hr = S_OK; + int nResult = 0; + UUID guid = { }; + WCHAR wzUpdatePackageId[39]; + RPC_STATUS rs = RPC_S_OK; + + hr = VerCompareStringVersions(m_sczBundleVersion, wzUpdateVersion, TRUE/*fStrict*/, &nResult); + BalExitOnFailure(hr, "Failed to compare bundle version: %ls to update version: %ls.", m_sczBundleVersion, wzUpdateVersion); + + // Burn sends the feed in descending version order so we need only the first one. + *pfStopProcessingUpdates = TRUE; + + if (0 <= nResult) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "WIXSTDBA: Update version: %ls is a match or downgrade for bundle version: %ls.", wzUpdateVersion, m_sczBundleVersion); + } + else + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: Update v%ls for bundle v%ls available from: %ls.", wzUpdateVersion, m_sczBundleVersion, wzUpdateLocation); + + rs = ::UuidCreate(&guid); + hr = HRESULT_FROM_RPC(rs); + ExitOnFailure(hr, "Failed to generate bundle update package id."); + + if (!::StringFromGUID2(guid, wzUpdatePackageId, countof(wzUpdatePackageId))) + { + hr = E_OUTOFMEMORY; + ExitOnRootFailure(hr, "Failed to create string from bundle update package id."); + } + + hr = BalSetVersionVariable(WIXSTDBA_VARIABLE_UPDATE_AVAILABLE, wzUpdateVersion); + BalExitOnFailure(hr, "Failed to set WixStdBAUpdateAvailable value: %ls.", wzUpdateVersion); + + hr = m_pEngine->SetUpdate(NULL, wzUpdateLocation, dw64Size, hashAlgorithm, wzHash, wzUpdatePackageId); + BalExitOnFailure(hr, "Failed to set update location: %ls.", wzUpdateLocation); + + BalInfoAddUpdateBundleAsPackage(&m_Bundle.packages, wzUpdatePackageId, NULL); + } + + LExit: + return __super::OnDetectUpdate(wzUpdateLocation, dw64Size, wzHash, hashAlgorithm, wzUpdateVersion, wzTitle, wzSummary, wzContentType, wzContent, pfCancel, pfStopProcessingUpdates); + } + + + virtual STDMETHODIMP OnDetectUpdateComplete( + __in HRESULT /*hrStatus*/, + __inout BOOL* pfIgnoreError + ) + { + // A failed update is very sad indeed, but shouldn't be fatal. + *pfIgnoreError = TRUE; + + return S_OK; + } + + virtual STDMETHODIMP OnDetectComplete( + __in HRESULT hrStatus, + __in BOOL /*fEligibleForCleanup*/ + ) + { + HRESULT hr = S_OK; + + if (m_fSuppressDowngradeFailure && m_fDowngrading) + { + SetState(WIXSTDBA_STATE_APPLIED, hrStatus); + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Bundle downgrade was attempted but downgrade failure has been suppressed."); + + ExitFunction(); + } + + // 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_commandDisplay || + BOOTSTRAPPER_ACTION_LAYOUT == m_commandAction || + BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_commandResumeType); + + // 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_commandAction && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > m_commandAction); + + if (fEvaluateConditions) + { + hrStatus = EvaluateConditions(); + } + + SetState(WIXSTDBA_STATE_DETECTED, hrStatus); + + if (SUCCEEDED(hrStatus)) + { + if (m_fPreplanPrereqs) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PREREQS, 0, BOOTSTRAPPER_ACTION_INSTALL); + } + else if (fSkipToPlan) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PACKAGES, 0, m_commandAction); + } + } + + LExit: + return hr; + } + + + virtual STDMETHODIMP OnPlanBegin( + __in DWORD cPackages, + __in BOOL* pfCancel + ) + { + m_fPrereqPackagePlanned = FALSE; + + return __super::OnPlanBegin(cPackages, pfCancel); + } + + + virtual STDMETHODIMP OnPlanRelatedBundleType( + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE recommendedType, + __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType, + __inout BOOL* pfCancel + ) + { + // If we're only installing prerequisites, do not touch related bundles. + if (m_fPrereq) + { + *pRequestedType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE; + } + + return CBalBaseBootstrapperApplication::OnPlanRelatedBundleType(wzBundleId, recommendedType, pRequestedType, pfCancel); + } + + + virtual STDMETHODIMP OnPlanPackageBegin( + __in_z LPCWSTR wzPackageId, + __in BOOTSTRAPPER_PACKAGE_STATE state, + __in BOOL fCached, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, + __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; + 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 = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + if (SUCCEEDED(hr) && pPackage->fPrereqPackage) + { + 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, repairCondition, recommendedState, recommendedCacheType, pRequestState, pRequestedCacheType, pfCancel); + } + + + virtual STDMETHODIMP OnPlanMsiPackage( + __in_z LPCWSTR wzPackageId, + __in BOOL fExecute, + __in BOOTSTRAPPER_ACTION_STATE action, + __in BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, + __inout BOOL* pfCancel, + __inout BURN_MSI_PROPERTY* pActionMsiProperty, + __inout INSTALLUILEVEL* pUiLevel, + __inout BOOL* pfDisableExternalUiHandler, + __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning + ) + { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pPackage = NULL; + BOOL fShowInternalUI = FALSE; + INSTALLUILEVEL uiLevel = INSTALLUILEVEL_NOCHANGE; + + switch (m_commandDisplay) + { + case BOOTSTRAPPER_DISPLAY_FULL: + uiLevel = INSTALLUILEVEL_FULL; + break; + + case BOOTSTRAPPER_DISPLAY_PASSIVE: + uiLevel = INSTALLUILEVEL_REDUCED; + break; + } + + if (INSTALLUILEVEL_NOCHANGE != uiLevel) + { + hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &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, recommendedFileVersioning, pfCancel, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); + } + + + virtual STDMETHODIMP OnPlannedPackage( + __in_z LPCWSTR wzPackageId, + __in BOOTSTRAPPER_ACTION_STATE execute, + __in BOOTSTRAPPER_ACTION_STATE rollback, + __in BOOL fPlannedCache, + __in BOOL fPlannedUncache + ) + { + if (m_fPrereq && BOOTSTRAPPER_ACTION_STATE_NONE != execute) + { + m_fPrereqPackagePlanned = TRUE; + } + + return __super::OnPlannedPackage(wzPackageId, execute, rollback, fPlannedCache, fPlannedUncache); + } + + + virtual STDMETHODIMP OnPlanComplete( + __in HRESULT hrStatus + ) + { + HRESULT hr = S_OK; + BOOL fPreplannedPrereqs = WIXSTDBA_STATE_PLANNING_PREREQS == m_state; + WIXSTDBA_STATE completedState = WIXSTDBA_STATE_PLANNED; + BOOL fApply = TRUE; + + if (fPreplannedPrereqs) + { + if (SUCCEEDED(hrStatus) && !m_fPrereqPackagePlanned) + { + // Nothing to do, so close and let the parent BA take over. + m_fPrereqSkipped = TRUE; + SetState(WIXSTDBA_STATE_APPLIED, S_OK); + ExitFunction(); + } + else if (BOOTSTRAPPER_ACTION_HELP == m_commandAction) + { + // If prereq packages were planned then the managed BA probably can't be loaded, so show the help from this BA. + + // Need to force the state change since normally moving backwards is prevented. + ::PostMessageW(m_hWnd, WM_WIXSTDBA_CHANGE_STATE, 0, WIXSTDBA_STATE_HELP); + + ::PostMessageW(m_hWnd, WM_WIXSTDBA_SHOW_HELP, 0, 0); + + ExitFunction(); + } + + completedState = WIXSTDBA_STATE_PLANNED_PREREQS; + } + + SetState(completedState, hrStatus); + + if (FAILED(hrStatus)) + { + ExitFunction(); + } + + if (fPreplannedPrereqs) + { + // If the UI should be visible, display it now and hide the splash screen + if (BOOTSTRAPPER_DISPLAY_NONE < m_commandDisplay) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + + fApply = BOOTSTRAPPER_DISPLAY_FULL > m_commandDisplay || + BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_commandResumeType; + } + + if (fApply) + { + ::PostMessageW(m_hWnd, WM_WIXSTDBA_APPLY_PACKAGES, 0, 0); + } + + LExit: + return hr; + } + + + virtual STDMETHODIMP OnApplyBegin( + __in DWORD dwPhaseCount, + __in BOOL* pfCancel + ) + { + m_fStartedExecution = FALSE; + m_dwCalculatedCacheProgress = 0; + m_dwCalculatedExecuteProgress = 0; + m_nLastMsiFilesInUseResult = IDNOACTION; + m_nLastNetfxFilesInUseResult = IDNOACTION; + + return __super::OnApplyBegin(dwPhaseCount, pfCancel); + } + + + 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_pControlOverallProgressPackageText, 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_pControlOverallProgressPackageText, wz); + + ReleaseStr(sczFormattedString); + return hr; + } + + + virtual STDMETHODIMP OnCachePackageBegin( + __in_z LPCWSTR wzPackageId, + __in DWORD cCachePayloads, + __in DWORD64 dw64PackageCacheSize, + __in BOOL fVital, + __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_pControlCacheProgressPackageText, wz); + + // If something started executing, leave it in the overall progress text. + if (!m_fStartedExecution) + { + ThemeSetTextControl(m_pControlOverallProgressPackageText, wz); + } + } + + return __super::OnCachePackageBegin(wzPackageId, cCachePayloads, dw64PackageCacheSize, fVital, 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_pControlCacheProgressPackageText, 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 + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, code: %d, ui hint: %d, message: %ls", wzPackageId, dwCode, dwUIHint, wzError); +#endif + + HRESULT hr = S_OK; + int nResult = *pResult; + LPWSTR sczError = NULL; + + if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay) + { + hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, &nResult); + if (FAILED(hr)) + { + nResult = IDERROR; + } + } + else if (BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay) + { + // 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) + { + 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; + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, hr: 0x%0x, result: %d", wzPackageId, hr, nResult); +#endif + + return FAILED(hr) ? hr : __super::OnError(errorType, wzPackageId, dwCode, wzError, dwUIHint, cData, rgwzData, nRecommendation, pResult); + } + + + 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_commandDisplay && (INSTALLMESSAGE_WARNING == messageType || INSTALLMESSAGE_USER == messageType)) + { + if (!m_fShowingInternalUiThisPackage) + { + int nResult = ::MessageBoxW(m_hWnd, wzMessage, m_pTheme->sczCaption, dwUIHint); + + *pResult = nResult; + + return __super::OnExecuteMsiMessage(wzPackageId, messageType, dwUIHint, wzMessage, cData, rgwzData, nRecommendation, pResult); + } + } + + if (INSTALLMESSAGE_ACTIONSTART == messageType) + { + ThemeSetTextControl(m_pControlExecuteProgressActionDataText, 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_pControlOverallProgressText, wzProgress); + + ThemeSetProgressControl(m_pControlOverallProgressbar, 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_pControlExecuteProgressPackageText, wz); + ThemeSetTextControl(m_pControlOverallProgressPackageText, 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_pControlExecuteProgressText, wzProgress); + + ThemeSetProgressControl(m_pControlExecuteProgressbar, dwOverallProgressPercentage); + + m_dwCalculatedExecuteProgress = dwOverallProgressPercentage * (100 - WIXSTDBA_ACQUIRE_PERCENTAGE) / 100; + ThemeSetProgressControl(m_pControlOverallCalculatedProgressbar, m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + + SetTaskbarButtonProgress(m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); + + return __super::OnExecuteProgress(wzPackageId, dwProgressPercentage, dwOverallProgressPercentage, pfCancel); + } + + + virtual STDMETHODIMP OnExecuteFilesInUse( + __in_z LPCWSTR wzPackageId, + __in DWORD cFiles, + __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, + __in int nRecommendation, + __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, + __inout int* pResult + ) + { + + if (!m_fShowingInternalUiThisPackage && wzPackageId && *wzPackageId) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Package %ls has %d applications holding files in use.", wzPackageId, cFiles); + + switch (source) + { + case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI: + if (m_fShowStandardFilesInUse) + { + return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); + } + break; + case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM: + if (m_fShowRMFilesInUse) + { + return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); + } + break; + case BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX: + if (m_fShowNetfxFilesInUse) + { + return ShowNetfxFilesInUse(cFiles, rgwzFiles, pResult); + } + break; + } + } + + return __super::OnExecuteFilesInUse(wzPackageId, cFiles, rgwzFiles, nRecommendation, source, pResult); + } + + + 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); + + if (m_fPrereq && BOOTSTRAPPER_APPLY_RESTART_NONE != restart) + { + BAL_INFO_PACKAGE* pPackage = NULL; + HRESULT hrPrereq = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); + + // 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 (SUCCEEDED(hrPrereq) && pPackage->fPrereqPackage) + { + *pAction = BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART; + } + } + + return hr; + } + + + virtual STDMETHODIMP OnExecuteComplete( + __in HRESULT hrStatus + ) + { + HRESULT hr = S_OK; + + ThemeSetTextControl(m_pControlExecuteProgressPackageText, L""); + ThemeSetTextControl(m_pControlExecuteProgressActionDataText, L""); + ThemeSetTextControl(m_pControlOverallProgressPackageText, L""); + ThemeControlEnable(m_pControlProgressCancelButton, 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; + LPWSTR sczPath = NULL; + + if (BOOTSTRAPPER_CACHE_RESOLVE_NONE == *pAction && BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay) // prompt to change the source location. + { + static COMDLG_FILTERSPEC vrgFilters[] = + { + { L"All Files", L"*.*" }, + }; + + hr = WnduShowOpenFileDialog(m_hWnd, TRUE, TRUE, m_pTheme->sczCaption, vrgFilters, countof(vrgFilters), 1, rgSearchPaths[dwRecommendedSearchPath], &sczPath); + if (SUCCEEDED(hr)) + { + hr = m_pEngine->SetLocalSource(wzPackageOrContainerId, wzPayloadId, sczPath); + *pAction = BOOTSTRAPPER_CACHE_RESOLVE_RETRY; + } + else + { + *pfCancel = TRUE; + } + } + // else there's nothing more we can do in non-interactive mode + + *pfCancel |= CheckCanceled(); + + ReleaseStr(sczPath); + + 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. + m_fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_NONE != restart; + BalSetStringVariable(WIXSTDBA_VARIABLE_RESTART_REQUIRED, m_fRestartRequired ? L"1" : NULL, FALSE); + + m_fShouldRestart = m_fRestartRequired && BAL_INFO_RESTART_NEVER < m_BalInfoCommand.restart; + + // Automatically restart if we're not displaying a UI or the command line said to always allow restarts. + m_fAllowRestart = m_fShouldRestart && (BOOTSTRAPPER_DISPLAY_FULL > m_commandDisplay || BAL_INFO_RESTART_PROMPT < m_BalInfoCommand.restart); + + if (m_fPrereq) + { + m_fPrereqInstalled = SUCCEEDED(hrStatus); + } + + // If we are showing UI, wait a beat before moving to the final screen. + if (BOOTSTRAPPER_DISPLAY_NONE < m_commandDisplay) + { + ::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 OnElevateComplete( + __in HRESULT hrStatus + ) + { + if (m_fElevatingForRestart) + { + m_fElevatingForRestart = FALSE; + + if (SUCCEEDED(hrStatus)) + { + m_fAllowRestart = TRUE; + + ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + // else if failed then OnError showed the user an error message box + } + + return __super::OnElevateComplete(hrStatus); + } + + + virtual STDMETHODIMP_(void) BAProcFallback( + __in BOOTSTRAPPER_APPLICATION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __inout HRESULT* phr + ) + { + 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_ONCREATE: + // Functions do not get ONCREATE, they get these parameters when created directly. + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDESTROY: + OnDestroyFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP: + OnStartupFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN: + OnShutdownFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + 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_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; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY: + OnPlanRollbackBoundaryFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE: + OnDetectCompatibleMsiPackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN: + OnPlanCompatibleMsiPackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE: + OnPlanCompatibleMsiPackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: + OnPlannedCompatiblePackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE: + OnPlanRestoreRelatedBundleFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE: + OnPlanRelatedBundleTypeFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE: + OnApplyDowngradeFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE: + OnDetectRelatedBundlePackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE: + OnCachePackageNonVitalValidationFailureFallback(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 OnDestroyFallback( + __in BA_ONDESTROY_ARGS* pArgs, + __inout BA_ONDESTROY_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDESTROY, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnStartupFallback( + __in BA_ONSTARTUP_ARGS* pArgs, + __inout BA_ONSTARTUP_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSTARTUP, 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 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 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 OnPlanRelatedBundleTypeFallback( + __in BA_ONPLANRELATEDBUNDLETYPE_ARGS* pArgs, + __inout BA_ONPLANRELATEDBUNDLETYPE_RESULTS* pResults + ) + { + BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE requestedType = pResults->requestedType; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE_TYPE, m_hModule, pArgs->wzBundleId, LoggingPlanRelationTypeToString(requestedType), LoggingPlanRelationTypeToString(pResults->requestedType)); + } + + 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 OnPlannedCompatiblePackageFallback( + __in BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS* pArgs, + __inout BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, 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); + } + + void OnPlanRollbackBoundaryFallback( + __in BA_ONPLANROLLBACKBOUNDARY_ARGS* pArgs, + __inout BA_ONPLANROLLBACKBOUNDARY_RESULTS* pResults + ) + { + BOOL fTransaction = pResults->fTransaction; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_ROLLBACK_BOUNDARY, m_hModule, pArgs->wzRollbackBoundaryId, LoggingBoolToString(fTransaction), LoggingBoolToString(pResults->fTransaction)); + } + + void OnDetectCompatibleMsiPackageFallback( + __in BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS* pArgs, + __inout BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanCompatibleMsiPackageBeginFallback( + __in BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS* pArgs, + __inout BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS* pResults + ) + { + BOOL fRequestRemove = pResults->fRequestRemove; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_COMPATIBLE_MSI_PACKAGE, m_hModule, pArgs->wzPackageId, pArgs->wzCompatiblePackageId, LoggingBoolToString(fRequestRemove), LoggingBoolToString(pResults->fRequestRemove)); + } + + void OnPlanCompatibleMsiPackageCompleteFallback( + __in BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS* pArgs, + __inout BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnPlanRestoreRelatedBundleFallback( + __in BA_ONPLANRESTORERELATEDBUNDLE_ARGS* pArgs, + __inout BA_ONPLANRESTORERELATEDBUNDLE_RESULTS* pResults + ) + { + BOOTSTRAPPER_REQUEST_STATE requestedState = pResults->requestedState; + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); + BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_RESTORE_RELATED_BUNDLE, m_hModule, pArgs->wzBundleId, LoggingRequestStateToString(requestedState), LoggingRequestStateToString(pResults->requestedState)); + } + + void OnApplyDowngradeFallback( + __in BA_ONAPPLYDOWNGRADE_ARGS* pArgs, + __inout BA_ONAPPLYDOWNGRADE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnExecuteProcessCancelFallback( + __in BA_ONEXECUTEPROCESSCANCEL_ARGS* pArgs, + __inout BA_ONEXECUTEPROCESSCANCEL_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPROCESSCANCEL, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnDetectRelatedBundlePackageFallback( + __in BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS* pArgs, + __inout BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + void OnCachePackageNonVitalValidationFailureFallback( + __in BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS* pArgs, + __inout BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS* pResults + ) + { + m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, pArgs, pResults, m_pvBAFunctionsProcContext); + } + + + HRESULT ShowMsiFilesInUse( + __in DWORD cFiles, + __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, + __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, + __inout int* pResult + ) + { + HRESULT hr = S_OK; + LPWSTR sczFilesInUse = NULL; + DWORD_PTR cchLen = 0; + int nResult = IDERROR; + + // If the user has chosen to ignore on a previously displayed "files in use" page, + // we will return the same result for other cases. No need to display the page again. + if (IDIGNORE == m_nLastMsiFilesInUseResult) + { + nResult = m_nLastMsiFilesInUseResult; + } + else if (BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay) // Only show files in use when using full display mode. + { + // See https://docs.microsoft.com/en-us/windows/win32/msi/sending-messages-to-windows-installer-using-msiprocessmessage for details. + for (DWORD i = 1; i < cFiles; i += 2) + { + hr = ::StringCchLengthW(rgwzFiles[i], STRSAFE_MAX_CCH, reinterpret_cast(&cchLen)); + BalExitOnFailure(hr, "Failed to calculate length of string."); + + if (cchLen) + { + hr = StrAllocConcatFormatted(&sczFilesInUse, L"%ls\r\n", rgwzFiles[i]); + BalExitOnFailure(hr, "Failed to concat files in use."); + } + } + + // Show applications using the files. + if (BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM == source) + { + hr = ShowRestartManagerMsiFilesInUseDialog(sczFilesInUse, &nResult); + ExitOnFailure(hr, "Failed to show RM files-in-use dialog."); + } + else + { + hr = ShowStandardMsiFilesInUseDialog(sczFilesInUse, &nResult); + ExitOnFailure(hr, "Failed to show files-in-use dialog."); + } + } + else + { + // Silent UI level installations always shut down applications and services, + // and on Windows Vista and later, use Restart Manager unless disabled. + nResult = IDOK; + } + + LExit: + ReleaseStr(sczFilesInUse); + + // Remember the answer from the user. + m_nLastMsiFilesInUseResult = FAILED(hr) ? IDERROR : nResult; + *pResult = m_nLastMsiFilesInUseResult; + + return hr; + } + + + int ShowRestartManagerMsiFilesInUseDialog( + __in_z_opt LPCWSTR sczFilesInUse, + __out int* pnResult + ) + { + HRESULT hr = S_OK; + TASKDIALOGCONFIG config = { }; + LPWSTR sczTitle = NULL; + LPWSTR sczLabel = NULL; + LPWSTR sczCloseRadioButton = NULL; + LPWSTR sczDontCloseRadioButton = NULL; + int nButton = 0; + int nRadioButton = 0; + + hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); + BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); + + hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); + BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); + + hr = BalFormatString(m_pFilesInUseCloseRadioButtonLoc->wzText, &sczCloseRadioButton); + BalExitOnFailure(hr, "Failed to format FilesInUseCloseRadioButton loc string."); + + hr = BalFormatString(m_pFilesInUseDontCloseRadioButtonLoc->wzText, &sczDontCloseRadioButton); + BalExitOnFailure(hr, "Failed to format FilesInUseDontCloseRadioButton loc string."); + + const TASKDIALOG_BUTTON rgRadioButtons[] = { + { IDOK, sczCloseRadioButton }, + { IDIGNORE, sczDontCloseRadioButton }, + }; + + config.cbSize = sizeof(config); + config.hwndParent = m_hWnd; + config.hInstance = m_hModule; + config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; + config.dwCommonButtons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON; + config.pszWindowTitle = sczTitle; + config.pszMainInstruction = sczLabel; + config.pszContent = sczFilesInUse ? sczFilesInUse : L""; + config.nDefaultButton = IDOK; + config.pRadioButtons = rgRadioButtons; + config.cRadioButtons = countof(rgRadioButtons); + config.nDefaultRadioButton = IDOK; + + hr = ::TaskDialogIndirect(&config, &nButton, &nRadioButton, NULL); + BalExitOnFailure(hr, "Failed to show RM files-in-use task dialog."); + + *pnResult = IDOK == nButton ? nRadioButton : nButton; + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: RMFilesInUse task dialog result: button - %d, radio button - %d, result - %d", nButton, nRadioButton, *pnResult); +#endif + + LExit: + ReleaseStr(sczTitle); + ReleaseStr(sczLabel); + ReleaseStr(sczCloseRadioButton); + ReleaseStr(sczDontCloseRadioButton); + + return hr; + } + + + int ShowStandardMsiFilesInUseDialog( + __in_z_opt LPCWSTR sczFilesInUse, + __out int* pnResult + ) + { + HRESULT hr = S_OK; + TASKDIALOGCONFIG config = { }; + LPWSTR sczTitle = NULL; + LPWSTR sczLabel = NULL; + LPWSTR sczRetryButton = NULL; + LPWSTR sczIgnoreButton = NULL; + LPWSTR sczExitButton = NULL; + + hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); + BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); + + hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); + BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); + + hr = BalFormatString(m_pFilesInUseRetryButtonLoc->wzText, &sczRetryButton); + BalExitOnFailure(hr, "Failed to format FilesInUseRetryButton loc string."); + + hr = BalFormatString(m_pFilesInUseIgnoreButtonLoc->wzText, &sczIgnoreButton); + BalExitOnFailure(hr, "Failed to format FilesInUseIgnoreButton loc string."); + + hr = BalFormatString(m_pFilesInUseExitButtonLoc->wzText, &sczExitButton); + BalExitOnFailure(hr, "Failed to format FilesInUseExitButton loc string."); + + const TASKDIALOG_BUTTON rgButtons[] = { + { IDRETRY, sczRetryButton }, + { IDIGNORE, sczIgnoreButton }, + { IDCANCEL, sczExitButton }, + }; + + config.cbSize = sizeof(config); + config.hwndParent = m_hWnd; + config.hInstance = m_hModule; + config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; + config.pszWindowTitle = sczTitle; + config.pszMainInstruction = sczLabel; + config.pszContent = sczFilesInUse ? sczFilesInUse : L""; + config.pButtons = rgButtons; + config.cButtons = countof(rgButtons); + + hr = ::TaskDialogIndirect(&config, pnResult, NULL, NULL); + BalExitOnFailure(hr, "Failed to show files-in-use task dialog."); + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: FilesInUse task dialog result: %d", *pnResult); +#endif + + LExit: + ReleaseStr(sczTitle); + ReleaseStr(sczLabel); + ReleaseStr(sczRetryButton); + ReleaseStr(sczIgnoreButton); + ReleaseStr(sczExitButton); + + return hr; + } + + + HRESULT ShowNetfxFilesInUse( + __in DWORD cFiles, + __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, + __inout int* pResult + ) + { + HRESULT hr = S_OK; + LPWSTR sczFilesInUse = NULL; + DWORD_PTR cchLen = 0; + int nResult = IDERROR; + + // If the user has chosen to ignore on a previously displayed "files in use" page, + // we will return the same result for other cases. No need to display the page again. + if (IDNO == m_nLastNetfxFilesInUseResult) + { + nResult = m_nLastNetfxFilesInUseResult; + } + else if (BOOTSTRAPPER_DISPLAY_FULL != m_commandDisplay) // Only show files in use when using full display mode. + { + nResult = IDYES; + } + else + { + for (DWORD i = 0; i < cFiles; ++i) + { + hr = ::StringCchLengthW(rgwzFiles[i], STRSAFE_MAX_CCH, reinterpret_cast(&cchLen)); + BalExitOnFailure(hr, "Failed to calculate length of string."); + + if (cchLen) + { + hr = StrAllocConcatFormatted(&sczFilesInUse, L"%ls\r\n", rgwzFiles[i]); + BalExitOnFailure(hr, "Failed to concat files in use."); + } + } + + // Show applications using the files. + hr = ShowNetfxFilesInUseDialog(sczFilesInUse, &nResult); + ExitOnFailure(hr, "Failed to show Netfx files-in-use dialog."); + } + + LExit: + ReleaseStr(sczFilesInUse); + + // Remember the answer from the user. + m_nLastNetfxFilesInUseResult = FAILED(hr) ? IDERROR : nResult; + *pResult = m_nLastNetfxFilesInUseResult; + + return hr; + } + + + int ShowNetfxFilesInUseDialog( + __in_z_opt LPCWSTR sczFilesInUse, + __out int* pnResult + ) + { + HRESULT hr = S_OK; + TASKDIALOGCONFIG config = { }; + LPWSTR sczTitle = NULL; + LPWSTR sczLabel = NULL; + LPWSTR sczNetfxCloseRadioButton = NULL; + LPWSTR sczDontCloseRadioButton = NULL; + int nButton = 0; + int nRadioButton = 0; + + hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); + BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); + + hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); + BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); + + hr = BalFormatString(m_pFilesInUseNetfxCloseRadioButtonLoc->wzText, &sczNetfxCloseRadioButton); + BalExitOnFailure(hr, "Failed to format FilesInUseNetfxCloseRadioButton loc string."); + + hr = BalFormatString(m_pFilesInUseDontCloseRadioButtonLoc->wzText, &sczDontCloseRadioButton); + BalExitOnFailure(hr, "Failed to format FilesInUseDontCloseRadioButton loc string."); + + const TASKDIALOG_BUTTON rgRadioButtons[] = { + { IDYES, sczNetfxCloseRadioButton }, + { IDNO, sczDontCloseRadioButton }, + }; + + config.cbSize = sizeof(config); + config.hwndParent = m_hWnd; + config.hInstance = m_hModule; + config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; + config.dwCommonButtons = TDCBF_RETRY_BUTTON | TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON; + config.pszWindowTitle = sczTitle; + config.pszMainInstruction = sczLabel; + config.pszContent = sczFilesInUse ? sczFilesInUse : L""; + config.nDefaultButton = IDRETRY; + config.pRadioButtons = rgRadioButtons; + config.cRadioButtons = countof(rgRadioButtons); + config.nDefaultRadioButton = IDYES; + + hr = ::TaskDialogIndirect(&config, &nButton, &nRadioButton, NULL); + BalExitOnFailure(hr, "Failed to show Netfx files-in-use task dialog."); + + *pnResult = IDOK == nButton ? nRadioButton : nButton; + +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: NetfxFilesInUse task dialog result: button - %d, radio button - %d, result - %d", nButton, nRadioButton, *pnResult); +#endif + + LExit: + ReleaseStr(sczTitle); + ReleaseStr(sczLabel); + ReleaseStr(sczNetfxCloseRadioButton); + ReleaseStr(sczDontCloseRadioButton); + + return hr; + } + +private: + // + // 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 = { }; + DWORD dwQuit = 0; + WM_WIXSTDBA firstAction = WM_WIXSTDBA_DETECT_PACKAGES; + + // Initialize COM and theme. + hr = ::CoInitialize(NULL); + BalExitOnFailure(hr, "Failed to initialize COM."); + fComInitialized = TRUE; + + hr = pThis->InitializeTheme(); + BalExitOnFailure(hr, "Failed to initialize theme."); + + // Create main window. + pThis->InitializeTaskbarButton(); + hr = pThis->CreateMainWindow(); + BalExitOnFailure(hr, "Failed to create wixstdba main window."); + + if (FAILED(pThis->m_hrFinal)) + { + pThis->SetState(WIXSTDBA_STATE_FAILED, hr); + firstAction = WM_WIXSTDBA_SHOW_FAILURE; + } + else + { + // Okay, we're ready for packages now. + pThis->SetState(WIXSTDBA_STATE_INITIALIZED, hr); + + if (pThis->m_fHandleHelp && BOOTSTRAPPER_ACTION_HELP == pThis->m_commandAction) + { + firstAction = WM_WIXSTDBA_SHOW_HELP; + } + } + + ::PostMessageW(pThis->m_hWnd, firstAction, 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(); + + if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == pThis->m_restartResult) + { + dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_INITIATED : ERROR_FAIL_REBOOT_INITIATED; + } + else if (BOOTSTRAPPER_APPLY_RESTART_REQUIRED == pThis->m_restartResult) + { + dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_REQUIRED : ERROR_FAIL_REBOOT_REQUIRED; + } + else if (SEVERITY_ERROR == HRESULT_SEVERITY(hr) && FACILITY_WIN32 == HRESULT_FACILITY(hr)) + { + // Convert Win32 HRESULTs back to the error code. + dwQuit = HRESULT_CODE(hr); + } + else + { + dwQuit = hr; + } + + // initiate engine shutdown + 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( + __in BOOTSTRAPPER_COMMAND* pCommand + ) + { + HRESULT hr = S_OK; + IXMLDOMDocument* pixdManifest = NULL; + + hr = XmlInitialize(); + BalExitOnFailure(hr, "Failed to initialize XML."); + + hr = BalManifestLoad(m_hModule, &pixdManifest); + BalExitOnFailure(hr, "Failed to load bootstrapper application manifest."); + + hr = BalInfoParseFromXml(&m_Bundle, pixdManifest); + BalExitOnFailure(hr, "Failed to load bundle information."); + + hr = ProcessCommandLine(&m_sczLanguage); + ExitOnFailure(hr, "Unknown commandline parameters."); + + hr = BalConditionsParseFromXml(&m_Conditions, pixdManifest, m_pWixLoc); + BalExitOnFailure(hr, "Failed to load conditions from XML."); + + hr = LoadBAFunctions(pixdManifest, pCommand); + BalExitOnFailure(hr, "Failed to load bootstrapper functions."); + + GetBundleFileVersion(); + // don't fail if we couldn't get the version info; best-effort only + + if (m_fPrereq) + { + hr = InitializePrerequisiteInformation(pixdManifest); + BalExitOnFailure(hr, "Failed to initialize prerequisite information."); + } + else + { + hr = ParseBootstrapperApplicationDataFromXml(pixdManifest); + BalExitOnFailure(hr, "Failed to read bootstrapper application data."); + } + + if (m_fRequestedCacheOnly) + { + if (m_fSupportCacheOnly) + { + // Doesn't make sense to prompt the user if cache only is requested. + if (BOOTSTRAPPER_DISPLAY_PASSIVE < m_commandDisplay) + { + m_commandDisplay = BOOTSTRAPPER_DISPLAY_PASSIVE; + } + + m_commandAction = BOOTSTRAPPER_ACTION_CACHE; + } + else + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to only cache a bundle that does not explicitly support it."); + } + } + + LExit: + ReleaseObject(pixdManifest); + + return hr; + } + + + // + // InitializeTheme - initializes the theme information. + // + HRESULT InitializeTheme() + { + HRESULT hr = S_OK; + LPWSTR sczModulePath = NULL; + + hr = ThemeInitialize(m_hModule); + BalExitOnFailure(hr, "Failed to initialize theme manager."); + + hr = PathRelativeToModule(&sczModulePath, NULL, m_hModule); + BalExitOnFailure(hr, "Failed to get module path."); + + hr = LoadLocalization(sczModulePath, m_sczLanguage); + ExitOnFailure(hr, "Failed to load localization."); + + LoadFilesInUse(); + + hr = LoadTheme(sczModulePath, m_sczLanguage); + ExitOnFailure(hr, "Failed to load theme."); + + LExit: + 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; + BOOL fUnknownArg = FALSE; + + argc = m_BalInfoCommand.cUnknownArgs; + argv = m_BalInfoCommand.rgUnknownArgs; + + if (argc) + { + for (int i = 0; i < argc; ++i) + { + fUnknownArg = FALSE; + + 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_fRequestedCacheOnly = TRUE; + } + else + { + fUnknownArg = TRUE; + } + } + else + { + fUnknownArg = TRUE; + } + + if (fUnknownArg) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Ignoring unknown argument: %ls", argv[i]); + } + } + } + + hr = BalSetOverridableVariablesFromEngine(&m_Bundle.overridableVariables, &m_BalInfoCommand, m_pEngine); + BalExitOnFailure(hr, "Failed to set overridable variables from the command line."); + + LExit: + 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"wixpreq.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 LoadIndividualLocString( + __in_z LPCWSTR wzId, + __out LOC_STRING** ppLocString + ) + { + HRESULT hr = LocGetString(m_pWixLoc, wzId, ppLocString); + + if (E_NOTFOUND == hr) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_DEBUG, "WIXSTDBA: Missing loc string '%ls'.", wzId); + } + + return hr; + } + + + void LoadFilesInUse() + { + // Get the loc strings for the files-in-use dialogs. + LoadIndividualLocString(L"#(loc.FilesInUseTitle)", &m_pFilesInUseTitleLoc); + LoadIndividualLocString(L"#(loc.FilesInUseLabel)", &m_pFilesInUseLabelLoc); + LoadIndividualLocString(L"#(loc.FilesInUseCloseRadioButton)", &m_pFilesInUseCloseRadioButtonLoc); + LoadIndividualLocString(L"#(loc.FilesInUseDontCloseRadioButton)", &m_pFilesInUseDontCloseRadioButtonLoc); + LoadIndividualLocString(L"#(loc.FilesInUseRetryButton)", &m_pFilesInUseRetryButtonLoc); + LoadIndividualLocString(L"#(loc.FilesInUseIgnoreButton)", &m_pFilesInUseIgnoreButtonLoc); + LoadIndividualLocString(L"#(loc.FilesInUseExitButton)", &m_pFilesInUseExitButtonLoc); + LoadIndividualLocString(L"#(loc.FilesInUseNetfxCloseRadioButton)", &m_pFilesInUseNetfxCloseRadioButtonLoc); + + m_fShowRMFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseCloseRadioButtonLoc && m_pFilesInUseDontCloseRadioButtonLoc; + m_fShowStandardFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseRetryButtonLoc && m_pFilesInUseIgnoreButtonLoc && m_pFilesInUseExitButtonLoc; + m_fShowNetfxFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseNetfxCloseRadioButtonLoc && m_pFilesInUseDontCloseRadioButtonLoc; + } + + + HRESULT LoadTheme( + __in_z LPCWSTR wzModulePath, + __in_z_opt LPCWSTR wzLanguage + ) + { + HRESULT hr = S_OK; + LPWSTR sczThemePath = NULL; + LPCWSTR wzThemeFileName = m_fPrereq ? L"wixpreq.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."); + + C_ASSERT(COUNT_WIXSTDBA_PAGE == countof(vrgwzPageNames)); + C_ASSERT(countof(m_rgdwPageIds) == countof(vrgwzPageNames)); + + ThemeGetPageIds(m_pTheme, vrgwzPageNames, m_rgdwPageIds, countof(m_rgdwPageIds)); + + hr = ThemeLocalize(m_pTheme, m_pWixLoc); + BalExitOnFailure(hr, "Failed to localize theme: %ls", sczThemePath); + + LExit: + ReleaseStr(sczThemePath); + + return hr; + } + + + HRESULT InitializePrerequisiteInformation( + __in IXMLDOMDocument* pixdManifest + ) + { + HRESULT hr = S_OK; + BAL_INFO_PACKAGE* pPackage = NULL; + IXMLDOMNode* pNode = NULL; + BOOL fXmlFound = FALSE; + DWORD dwBool = 0; + BOOL fHandleLayout = FALSE; + + // Read any prereq BA data from the BA manifest. + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixPrereqOptions", &pNode); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read prereq options from BootstrapperApplication.xml manifest."); + + if (fXmlFound) + { + hr = XmlGetAttributeNumber(pNode, L"Primary", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get WixPrereqOptions/@Primary value."); + + m_fPreplanPrereqs = fXmlFound && (0 != dwBool); + + hr = XmlGetAttributeNumber(pNode, L"HandleHelp", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get WixPrereqOptions/@HandleHelp value."); + + m_fHandleHelp = fXmlFound && (0 != dwBool); + + hr = XmlGetAttributeNumber(pNode, L"HandleLayout", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get WixPrereqOptions/@HandleLayout value."); + + fHandleLayout = fXmlFound && (0 != dwBool); + } + + // If pre-req BA has requested that this BA be in charge of layout. + if (fHandleLayout && BOOTSTRAPPER_ACTION_LAYOUT == m_commandAction) + { + m_fPrereq = FALSE; + ExitFunction(); + } + + // Pre-req BA should only show help or do an install (to launch the parent BA which can then do the right action). + if (BOOTSTRAPPER_ACTION_HELP != m_commandAction) + { + m_commandAction = BOOTSTRAPPER_ACTION_INSTALL; + } + + 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; + BOOL fXmlFound = FALSE; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaInformation", &pNode); + BalExitOnRequiredXmlQueryFailure(hr, "BootstrapperApplication.xml manifest is missing wixstdba information."); + + hr = XmlGetAttributeEx(pNode, L"LicenseFile", &m_sczLicenseFile); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license file."); + + hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &m_sczLicenseUrl); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license URL."); + + ReleaseObject(pNode); + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOptions", &pNode); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read wixstdba options from BootstrapperApplication.xml manifest."); + + if (!fXmlFound) + { + ExitFunction(); + } + + hr = XmlGetAttributeNumber(pNode, L"SuppressOptionsUI", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressOptionsUI value."); + + if (fXmlFound && dwBool) + { + hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI, 1); + BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI); + } + + dwBool = 0; + hr = XmlGetAttributeNumber(pNode, L"SuppressDowngradeFailure", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressDowngradeFailure value."); + + if (fXmlFound) + { + m_fSuppressDowngradeFailure = 0 < dwBool; + } + + dwBool = 0; + hr = XmlGetAttributeNumber(pNode, L"SuppressRepair", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressRepair value."); + + if (fXmlFound) + { + m_fSuppressRepair = 0 < dwBool; + } + + hr = XmlGetAttributeNumber(pNode, L"ShowVersion", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get ShowVersion value."); + + if (fXmlFound && dwBool) + { + hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SHOW_VERSION, 1); + BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SHOW_VERSION); + } + + hr = XmlGetAttributeNumber(pNode, L"SupportCacheOnly", &dwBool); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SupportCacheOnly value."); + + if (fXmlFound) + { + m_fSupportCacheOnly = 0 < dwBool; + } + + LExit: + ReleaseObject(pNode); + 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; + WNDCLASSW wc = { }; + DWORD dwWindowStyle = 0; + int x = CW_USEDEFAULT; + int y = CW_USEDEFAULT; + POINT ptCursor = { }; + + ThemeInitializeWindowClass(m_pTheme, &wc, CWixStandardBootstrapperApplication::WndProc, m_hModule, WIXSTDBA_WINDOW_CLASS); + + // If the theme did not provide an icon, try using the icon from the bundle engine. + if (!wc.hIcon) + { + HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL); + if (hBootstrapperEngine) + { + wc.hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1)); + } + } + + // Register the window class and create the window. + 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_commandDisplay || m_fPreplanPrereqs) + { + 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_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 wixstdba theme window."); + + OnThemeLoaded(); + + 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.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) + { + hr = S_OK; + } + else + { + BalExitOnFailure(hr, "BAFunctions WndProc failed."); + + if (wndProcResults.fProcessed) + { + lres = wndProcResults.lResult; + 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)); + + 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_THMUTIL_LOADING_CONTROL: + return pBA->OnThemeLoadingControl(reinterpret_cast(wParam), reinterpret_cast(lParam)); + + case WM_THMUTIL_LOADED_CONTROL: + return pBA->OnThemeLoadedControl(reinterpret_cast(wParam), reinterpret_cast(lParam)); + + 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_WIXSTDBA_PLAN_PREREQS: + pBA->OnPlanPrereqs(static_cast(lParam)); + return 0; + + case WM_THMUTIL_CONTROL_WM_COMMAND: + return pBA->OnThemeControlWmCommand(reinterpret_cast(wParam), reinterpret_cast(lParam)); + + case WM_THMUTIL_CONTROL_WM_NOTIFY: + return pBA->OnThemeControlWmNotify(reinterpret_cast(wParam), reinterpret_cast(lParam)); + } + + if (pBA && pBA->m_pTaskbarList && uMsg == pBA->m_uTaskbarButtonCreatedMessage) + { + pBA->m_fTaskbarButtonOK = TRUE; + return 0; + } + + return CallDefaultWndProc(pBA, hWnd, uMsg, wParam, lParam); + } + + + // + // OnThemeLoaded - finishes loading the theme. + // + BOOL OnThemeLoaded() + { + HRESULT hr = S_OK; + BA_FUNCTIONS_ONTHEMELOADED_ARGS themeLoadedArgs = { }; + BA_FUNCTIONS_ONTHEMELOADED_RESULTS themeLoadedResults = { }; + + if (m_pfnBAFunctionsProc) + { + themeLoadedArgs.cbSize = sizeof(themeLoadedArgs); + themeLoadedArgs.hWnd = m_pTheme->hwndParent; + themeLoadedResults.cbSize = sizeof(themeLoadedResults); + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMELOADED, &themeLoadedArgs, &themeLoadedResults, m_pvBAFunctionsProcContext); + BalExitOnFailure(hr, "BAFunctions OnThemeLoaded failed."); + } + + LExit: + return SUCCEEDED(hr); + } + + BOOL OnThemeLoadingControl( + __in const THEME_LOADINGCONTROL_ARGS* pArgs, + __in THEME_LOADINGCONTROL_RESULTS* pResults + ) + { + HRESULT hr = S_OK; + BOOL fProcessed = FALSE; + BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS themeControlLoadingArgs = { }; + BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS themeControlLoadingResults = { }; + + for (DWORD iAssignControl = 0; iAssignControl < countof(m_rgInitControls); ++iAssignControl) + { + THEME_ASSIGN_CONTROL_ID* pAssignControl = m_rgInitControls + iAssignControl; + if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, pAssignControl->wzName, -1)) + { + if (!pAssignControl->ppControl) + { + BalExitWithRootFailure(hr, E_INVALIDSTATE, "Control '%ls' has no member variable", pAssignControl->wzName); + } + + if (*pAssignControl->ppControl) + { + BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Duplicate control name: %ls", pAssignControl->wzName); + } + else + { + *pAssignControl->ppControl = pArgs->pThemeControl; + } + + fProcessed = TRUE; + pResults->wId = pAssignControl->wId; + pResults->dwAutomaticBehaviorType = pAssignControl->dwAutomaticBehaviorType; + ExitFunction(); + } + } + + if (m_pfnBAFunctionsProc) + { + themeControlLoadingArgs.cbSize = sizeof(themeControlLoadingArgs); + themeControlLoadingArgs.wzName = pArgs->pThemeControl->sczName; + + themeControlLoadingResults.cbSize = sizeof(themeControlLoadingResults); + themeControlLoadingResults.wId = pResults->wId; + themeControlLoadingResults.dwAutomaticBehaviorType = pResults->dwAutomaticBehaviorType; + + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING, &themeControlLoadingArgs, &themeControlLoadingResults, m_pvBAFunctionsProcContext); + + if (E_NOTIMPL == hr) + { + hr = S_OK; + } + else + { + BalExitOnFailure(hr, "BAFunctions OnThemeControlLoading failed."); + + if (themeControlLoadingResults.fProcessed) + { + fProcessed = TRUE; + pResults->wId = themeControlLoadingResults.wId; + pResults->dwAutomaticBehaviorType = themeControlLoadingResults.dwAutomaticBehaviorType; + } + } + } + + LExit: + pResults->hr = hr; + return fProcessed || FAILED(hr); + } + + BOOL OnThemeLoadedControl( + __in const THEME_LOADEDCONTROL_ARGS* pArgs, + __in THEME_LOADEDCONTROL_RESULTS* pResults + ) + { + HRESULT hr = S_OK; + BOOL fProcessed = FALSE; + BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS themeControlLoadedArgs = { }; + BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS themeControlLoadedResults = { }; + + if (WIXSTDBA_CONTROL_EULA_RICHEDIT == pArgs->pThemeControl->wId) + { + // Best effort to load the RTF EULA control with text. + OnLoadedEulaRtfControl(pArgs->pThemeControl); + fProcessed = TRUE; + ExitFunction(); + } + + if (m_pfnBAFunctionsProc) + { + themeControlLoadedArgs.cbSize = sizeof(themeControlLoadedArgs); + themeControlLoadedArgs.wzName = pArgs->pThemeControl->sczName; + themeControlLoadedArgs.wId = pArgs->pThemeControl->wId; + themeControlLoadedArgs.hWnd = pArgs->pThemeControl->hWnd; + + themeControlLoadedResults.cbSize = sizeof(themeControlLoadedResults); + + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADED, &themeControlLoadedArgs, &themeControlLoadedResults, m_pvBAFunctionsProcContext); + + if (E_NOTIMPL == hr) + { + hr = S_OK; + } + else + { + BalExitOnFailure(hr, "BAFunctions OnThemeControlLoaded failed."); + + if (themeControlLoadedResults.fProcessed) + { + fProcessed = TRUE; + } + } + } + + LExit: + pResults->hr = hr; + return fProcessed || FAILED(hr); + } + + HRESULT OnLoadedEulaRtfControl( + const THEME_CONTROL* pThemeControl + ) + { + HRESULT hr = S_OK; + LPWSTR sczLicenseFormatted = NULL; + LPWSTR sczLicensePath = NULL; + LPWSTR sczLicenseDirectory = NULL; + LPWSTR sczLicenseFilename = NULL; + + if (!m_sczLicenseFile || !*m_sczLicenseFile) + { + ExitWithRootFailure(hr, E_INVALIDDATA, "No license file in manifest."); + } + + hr = StrAllocString(&sczLicenseFormatted, m_sczLicenseFile, 0); + ExitOnFailure(hr, "Failed to copy manifest license file."); + + hr = LocLocalizeString(m_pWixLoc, &sczLicenseFormatted); + ExitOnFailure(hr, "Failed to localize manifest license file."); + + hr = BalFormatString(sczLicenseFormatted, &sczLicenseFormatted); + ExitOnFailure(hr, "Failed to expand localized manifest license file."); + + hr = PathRelativeToModule(&sczLicensePath, sczLicenseFormatted, m_hModule); + ExitOnFailure(hr, "Failed to get relative path for license file."); + + hr = PathGetDirectory(sczLicensePath, &sczLicenseDirectory); + ExitOnFailure(hr, "Failed to get license file directory."); + + hr = StrAllocString(&sczLicenseFilename, PathFile(sczLicenseFormatted), 0); + ExitOnFailure(hr, "Failed to copy license file name."); + + hr = LocProbeForFile(sczLicenseDirectory, sczLicenseFilename, m_sczLanguage, &sczLicensePath); + ExitOnFailure(hr, "Failed to probe for localized license file."); + + hr = ThemeLoadRichEditFromFile(pThemeControl, sczLicensePath, m_hModule); + ExitOnFailure(hr, "Failed to load license file into richedit control."); + + LExit: + 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); + } + + ReleaseStr(sczLicenseFilename); + ReleaseStr(sczLicenseDirectory); + ReleaseStr(sczLicensePath); + ReleaseStr(sczLicenseFormatted); + + return 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_commandDisplay) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + } + + + // + // 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_commandDisplay) + { + ::ShowWindow(m_pTheme->hwndParent, SW_SHOW); + } + + m_pEngine->CloseSplashScreen(); + } + + + // + // OnDetect - start the processing of packages. + // + void OnDetect() + { + HRESULT hr = S_OK; + + SetState(WIXSTDBA_STATE_DETECTING, hr); + + // 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); + } + } + + + // + // OnPlan - plan the detected changes. + // + void OnPlan( + __in BOOTSTRAPPER_ACTION action + ) + { + HRESULT hr = S_OK; + + m_plannedAction = action; + + 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); + } + } + + + // + // OnPlanPrereqs - preplan the packages to see if the preqba can be skipped. + // + void OnPlanPrereqs( + __in BOOTSTRAPPER_ACTION action + ) + { + HRESULT hr = S_OK; + + m_plannedAction = action; + + SetState(WIXSTDBA_STATE_PLANNING_PREREQS, hr); + + hr = m_pEngine->Plan(action); + BalExitOnFailure(hr, "Failed to start planning prereq packages."); + + LExit: + if (FAILED(hr)) + { + SetState(WIXSTDBA_STATE_PLANNING_PREREQS, hr); + } + } + + + // + // 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_pControlProgressCancelButton, TRUE); // ensure the cancel button is enabled before starting. + + LExit: + if (FAILED(hr)) + { + SetState(WIXSTDBA_STATE_APPLYING, hr); + } + } + + + // + // 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 not updating or + // we successfully installed the prerequisite(s) and either no restart is required or can automatically restart + // then exit. + if ((WIXSTDBA_STATE_APPLIED <= m_state && (BOOTSTRAPPER_DISPLAY_FULL > m_commandDisplay || BOOTSTRAPPER_ACTION_UPDATE_REPLACE == m_plannedAction)) || + (WIXSTDBA_STATE_APPLIED == m_state && m_fPrereq && (!m_fRestartRequired || m_fShouldRestart && m_fAllowRestart))) + { + // 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) + { + LONGLONG llCanRestart = 0; + LONGLONG llElevated = 0; + + BalGetNumericVariable(WIXBUNDLE_VARIABLE_CANRESTART, &llCanRestart); + BalGetNumericVariable(WIXBUNDLE_VARIABLE_ELEVATED, &llElevated); + m_fRestartRequiresElevation = !llCanRestart && !llElevated; + + // Enable disable controls per-page. + if (m_rgdwPageIds[WIXSTDBA_PAGE_INSTALL] == dwNewPageId) // on the "Install" page, ensure the install button is enabled/disabled correctly. + { + ThemeControlElevates(m_pControlInstallButton, (m_Bundle.fPerMachine && !llElevated)); + + // If the EULA control exists, show it only if a license URL is provided as well. + if (m_pControlEulaHyperlink) + { + BOOL fEulaLink = (m_sczLicenseUrl && *m_sczLicenseUrl); + ThemeControlEnable(m_pControlEulaHyperlink, fEulaLink); + ThemeControlEnable(m_pControlEulaAcceptCheckbox, fEulaLink); + } + + BOOL fAcceptedLicense = !m_pControlEulaAcceptCheckbox || !ThemeControlEnabled(m_pControlEulaAcceptCheckbox) || ThemeIsControlChecked(m_pControlEulaAcceptCheckbox); + ThemeControlEnable(m_pControlInstallButton, fAcceptedLicense); + } + else if (m_rgdwPageIds[WIXSTDBA_PAGE_MODIFY] == dwNewPageId) + { + ThemeControlElevates(m_pControlRepairButton, (m_Bundle.fPerMachine && !llElevated)); + ThemeControlElevates(m_pControlUninstallButton, (m_Bundle.fPerMachine && !llElevated)); + + ThemeControlEnable(m_pControlRepairButton, !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 fEnableRestartButton = FALSE; + BOOL fLaunchTargetExists = FALSE; + + ThemeControlElevates(m_pControlSuccessRestartButton, m_fRestartRequiresElevation); + + if (m_fShouldRestart) + { + if (BAL_INFO_RESTART_PROMPT == m_BalInfoCommand.restart) + { + fEnableRestartButton = TRUE; + } + } + else if (m_pControlLaunchButton) + { + fLaunchTargetExists = BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH); + } + + ThemeControlEnable(m_pControlLaunchButton, fLaunchTargetExists && BOOTSTRAPPER_ACTION_UNINSTALL < m_plannedAction); + ThemeControlEnable(m_pControlSuccessRestartButton, fEnableRestartButton); + } + 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 fEnableRestartButton = FALSE; + + ThemeControlElevates(m_pControlFailureRestartButton, m_fRestartRequiresElevation); + + 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_PREREQBA_INFINITE_LOOP == m_hrFinal) + { + HRESULT hr = StrAllocString(&sczUnformattedText, L"#(loc.PREREQBAINFINITELOOPErrorMessage)", 0); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to initialize PREREQBAINFINITELOOPErrorMessage loc identifier."); + } + else + { + hr = LocLocalizeString(m_pWixLoc, &sczUnformattedText); + if (FAILED(hr)) + { + BalLogError(hr, "Failed to localize PREREQBAINFINITELOOPErrorMessage: %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_PREREQBA_INFINITE_LOOP == m_hrFinal) + { + if (sczUnformattedText) + { + BalFormatString(sczUnformattedText, &sczText); + } + } + else + { + StrAllocFormatted(&sczText, L"0x%08x - %ls", m_hrFinal, sczUnformattedText); + } + + ThemeSetTextControl(m_pControlFailureMessageText, sczText); + fShowErrorMessage = TRUE; + } + + if (m_fShouldRestart) + { + if (BAL_INFO_RESTART_PROMPT == m_BalInfoCommand.restart) + { + fEnableRestartButton = TRUE; + } + } + + ThemeControlEnable(m_pControlFailureLogFileLink, fShowLogLink); + ThemeControlEnable(m_pControlFailureMessageText, fShowErrorMessage); + ThemeControlEnable(m_pControlFailureRestartButton, fEnableRestartButton); + } + + 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", dwNewPageId); + } + + // 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_pControlInstallButton); + } + } + } + + 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_commandDisplay || 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_pControlProgressCancelButton, 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_pControlEulaAcceptCheckbox); + ThemeControlEnable(m_pControlInstallButton, 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); + } + + + // + // OnClickUpdateButton - start the update process. + // + void OnClickUpdateButton() + { + this->OnPlan(BOOTSTRAPPER_ACTION_UPDATE_REPLACE); + } + + + // + // 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); + } + + + // + // 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); + } + + + // + // 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."); + + if (m_fRestartRequiresElevation) + { + m_fElevatingForRestart = TRUE; + ThemeControlEnable(m_pControlFailureRestartButton, FALSE); + ThemeControlEnable(m_pControlSuccessRestartButton, FALSE); + + m_pEngine->Elevate(m_hWnd); + } + else + { + m_fAllowRestart = TRUE; + + ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); + } + } + + + // + // 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); + } + + BOOL OnThemeControlWmCommand( + __in const THEME_CONTROLWMCOMMAND_ARGS* pArgs, + __in THEME_CONTROLWMCOMMAND_RESULTS* pResults + ) + { + HRESULT hr = S_OK; + BOOL fProcessed = FALSE; + BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS themeControlWmCommandArgs = { }; + BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS themeControlWmCommandResults = { }; + + switch (HIWORD(pArgs->wParam)) + { + case BN_CLICKED: + switch (pArgs->pThemeControl->wId) + { + case WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX: + OnClickAcceptCheckbox(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_INSTALL_BUTTON: + OnClickInstallButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_REPAIR_BUTTON: + OnClickRepairButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_UNINSTALL_BUTTON: + OnClickUninstallButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON: + case WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON: + OnClickUpdateButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_LAUNCH_BUTTON: + OnClickLaunchButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON: __fallthrough; + case WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON: + OnClickRestartButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + + case WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON: + OnClickCloseButton(); + fProcessed = TRUE; + pResults->lResult = 0; + ExitFunction(); + } + break; + } + + if (m_pfnBAFunctionsProc) + { + themeControlWmCommandArgs.cbSize = sizeof(themeControlWmCommandArgs); + themeControlWmCommandArgs.wParam = pArgs->wParam; + themeControlWmCommandArgs.wzName = pArgs->pThemeControl->sczName; + themeControlWmCommandArgs.wId = pArgs->pThemeControl->wId; + themeControlWmCommandArgs.hWnd = pArgs->pThemeControl->hWnd; + + themeControlWmCommandResults.cbSize = sizeof(themeControlWmCommandResults); + themeControlWmCommandResults.lResult = pResults->lResult; + + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND, &themeControlWmCommandArgs, &themeControlWmCommandResults, m_pvBAFunctionsProcContext); + if (E_NOTIMPL != hr) + { + BalExitOnFailure(hr, "BAFunctions OnThemeControlWmCommand failed."); + + if (themeControlWmCommandResults.fProcessed) + { + fProcessed = TRUE; + pResults->lResult = themeControlWmCommandResults.lResult; + ExitFunction(); + } + } + } + +LExit: + return fProcessed; + } + + BOOL OnThemeControlWmNotify( + __in const THEME_CONTROLWMNOTIFY_ARGS* pArgs, + __in THEME_CONTROLWMNOTIFY_RESULTS* pResults + ) + { + HRESULT hr = S_OK; + BOOL fProcessed = FALSE; + BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS themeControlWmNotifyArgs = { }; + BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS themeControlWmNotifyResults = { }; + + switch (pArgs->lParam->code) + { + case NM_CLICK: __fallthrough; + case NM_RETURN: + switch (pArgs->pThemeControl->wId) + { + case WIXSTDBA_CONTROL_EULA_LINK: + OnClickEulaLink(); + fProcessed = TRUE; + pResults->lResult = 1; + ExitFunction(); + case WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK: + OnClickLogFileLink(); + fProcessed = TRUE; + pResults->lResult = 1; + ExitFunction(); + } + } + + if (m_pfnBAFunctionsProc) + { + themeControlWmNotifyArgs.cbSize = sizeof(themeControlWmNotifyArgs); + themeControlWmNotifyArgs.lParam = pArgs->lParam; + themeControlWmNotifyArgs.wzName = pArgs->pThemeControl->sczName; + themeControlWmNotifyArgs.wId = pArgs->pThemeControl->wId; + themeControlWmNotifyArgs.hWnd = pArgs->pThemeControl->hWnd; + + themeControlWmNotifyResults.cbSize = sizeof(themeControlWmNotifyResults); + themeControlWmNotifyResults.lResult = pResults->lResult; + + hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND, &themeControlWmNotifyArgs, &themeControlWmNotifyResults, m_pvBAFunctionsProcContext); + if (E_NOTIMPL != hr) + { + BalExitOnFailure(hr, "BAFunctions OnThemeControlWmNotify failed."); + + if (themeControlWmNotifyResults.fProcessed) + { + fProcessed = TRUE; + pResults->lResult = themeControlWmNotifyResults.lResult; + ExitFunction(); + } + } + } + +LExit: + return fProcessed; + } + + + // + // SetState + // + void SetState( + __in WIXSTDBA_STATE state, + __in HRESULT hrStatus + ) + { +#ifdef DEBUG + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: SetState() - setting state to %u with status 0x%08x.", state, hrStatus); +#endif + + 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_commandDisplay) + { + switch (state) + { + case WIXSTDBA_STATE_INITIALIZED: + *pdwPageId = BOOTSTRAPPER_ACTION_HELP == m_commandAction ? 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_PREREQS: __fallthrough; + case WIXSTDBA_STATE_PLANNED_PREREQS: __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_commandDisplay) + { + switch (state) + { + case WIXSTDBA_STATE_INITIALIZING: + *pdwPageId = 0; + break; + + case WIXSTDBA_STATE_INITIALIZED: + *pdwPageId = BOOTSTRAPPER_ACTION_HELP == m_commandAction ? 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: + case WIXSTDBA_STATE_PLANNING_PREREQS: __fallthrough; + case WIXSTDBA_STATE_PLANNED_PREREQS: __fallthrough; + switch (m_commandAction) + { + 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_pControlCacheProgressText, wzProgress); + + ThemeSetProgressControl(m_pControlCacheProgressbar, dwOverallPercentage); + + m_dwCalculatedCacheProgress = dwOverallPercentage * WIXSTDBA_ACQUIRE_PERCENTAGE / 100; + ThemeSetProgressControl(m_pControlOverallCalculatedProgressbar, 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: %d.", 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, + __in BOOTSTRAPPER_COMMAND* pCommand + ) + { + HRESULT hr = S_OK; + IXMLDOMNode* pBAFunctionsNode = NULL; + LPWSTR sczBafName = NULL; + LPWSTR sczBafPath = NULL; + BA_FUNCTIONS_CREATE_ARGS bafCreateArgs = { }; + BA_FUNCTIONS_CREATE_RESULTS bafCreateResults = { }; + BOOL fXmlFound = FALSE; + + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFunctions", &pBAFunctionsNode); + BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read WixBalBAFunctions node from BootstrapperApplicationData.xml."); + + if (!fXmlFound) + { + ExitFunction(); + } + + hr = XmlGetAttributeEx(pBAFunctionsNode, L"FilePath", &sczBafName); + BalExitOnRequiredXmlQueryFailure(hr, "Failed to get BAFunctions FilePath."); + + 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(2024, 1, 1, 0); + bafCreateArgs.pEngine = m_pEngine; + bafCreateArgs.pCommand = pCommand; + + 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); + ReleaseObject(pBAFunctionsNode); + + return hr; + } + + +public: + // + // Constructor - initialize member variables. + // + CWixStandardBootstrapperApplication( + __in HMODULE hModule, + __in BOOL fRunAsPrereqBA + ) : CBalBaseBootstrapperApplication(3, 3000) + { + THEME_ASSIGN_CONTROL_ID* pAssignControl = NULL; + DWORD dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE; + + m_hModule = hModule; + m_commandAction = BOOTSTRAPPER_ACTION_UNKNOWN; + m_commandDisplay = BOOTSTRAPPER_DISPLAY_UNKNOWN; + m_commandResumeType = BOOTSTRAPPER_RESUME_TYPE_NONE; + m_commandRelationType = BOOTSTRAPPER_RELATION_NONE; + m_hwndSplashScreen = NULL; + + m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; + + m_sczAfterForcedRestartPackage = NULL; + m_sczBundleVersion = NULL; + + m_pWixLoc = NULL; + m_Bundle = { }; + 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 = S_OK; + + m_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE; + m_fRestartRequired = FALSE; + m_fShouldRestart = FALSE; + m_fAllowRestart = FALSE; + m_fRestartRequiresElevation = FALSE; + m_fElevatingForRestart = FALSE; + + m_sczLicenseFile = NULL; + m_sczLicenseUrl = NULL; + m_fSuppressDowngradeFailure = FALSE; + m_fDowngrading = FALSE; + m_fSuppressRepair = FALSE; + m_fSupportCacheOnly = FALSE; + m_fRequestedCacheOnly = FALSE; + + m_pTaskbarList = NULL; + m_uTaskbarButtonCreatedMessage = UINT_MAX; + m_fTaskbarButtonOK = FALSE; + ::InitializeCriticalSection(&m_csShowingInternalUiThisPackage); + m_fShowingInternalUiThisPackage = FALSE; + m_fTriedToLaunchElevated = FALSE; + + m_fPrereq = fRunAsPrereqBA; + m_fHandleHelp = FALSE; + m_fPreplanPrereqs = FALSE; + m_fPrereqPackagePlanned = FALSE; + m_fPrereqInstalled = FALSE; + m_fPrereqSkipped = FALSE; + + m_fShowStandardFilesInUse = FALSE; + m_fShowRMFilesInUse = FALSE; + m_fShowNetfxFilesInUse = FALSE; + m_nLastMsiFilesInUseResult = IDNOACTION; + m_nLastNetfxFilesInUseResult = IDNOACTION; + m_pFilesInUseTitleLoc = NULL; + m_pFilesInUseLabelLoc = NULL; + m_pFilesInUseCloseRadioButtonLoc = NULL; + m_pFilesInUseNetfxCloseRadioButtonLoc = NULL; + m_pFilesInUseDontCloseRadioButtonLoc = NULL; + m_pFilesInUseRetryButtonLoc = NULL; + m_pFilesInUseIgnoreButtonLoc = NULL; + m_pFilesInUseExitButtonLoc = NULL; + + m_hBAFModule = NULL; + m_pfnBAFunctionsProc = NULL; + m_pvBAFunctionsProcContext = NULL; + + C_ASSERT(0 == WIXSTDBA_CONTROL_INSTALL_BUTTON - WIXSTDBA_FIRST_ASSIGN_CONTROL_ID); + pAssignControl = m_rgInitControls; + + pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_BUTTON; + pAssignControl->wzName = L"InstallButton"; + pAssignControl->ppControl = &m_pControlInstallButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlInstallButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EULA_RICHEDIT; + pAssignControl->wzName = L"EulaRichedit"; + pAssignControl->ppControl = &m_pControlEulaRichedit; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlEulaRichedit = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EULA_LINK; + pAssignControl->wzName = L"EulaHyperlink"; + pAssignControl->ppControl = &m_pControlEulaHyperlink; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlEulaHyperlink = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX; + pAssignControl->wzName = L"EulaAcceptCheckbox"; + pAssignControl->ppControl = &m_pControlEulaAcceptCheckbox; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlEulaAcceptCheckbox = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_REPAIR_BUTTON; + pAssignControl->wzName = L"RepairButton"; + pAssignControl->ppControl = &m_pControlRepairButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlRepairButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_UNINSTALL_BUTTON; + pAssignControl->wzName = L"UninstallButton"; + pAssignControl->ppControl = &m_pControlUninstallButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlUninstallButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL; + pAssignControl->wzName = L"CheckingForUpdatesLabel"; + pAssignControl->ppControl = &m_pControlCheckingForUpdatesLabel; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlCheckingForUpdatesLabel = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON; + pAssignControl->wzName = L"InstallUpdateButton"; + pAssignControl->ppControl = &m_pControlInstallUpdateButton; + pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL; + m_pControlInstallUpdateButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON; + pAssignControl->wzName = L"ModifyUpdateButton"; + pAssignControl->ppControl = &m_pControlModifyUpdateButton; + pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL; + m_pControlModifyUpdateButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT; + pAssignControl->wzName = L"CacheProgressPackageText"; + pAssignControl->ppControl = &m_pControlCacheProgressPackageText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlCacheProgressPackageText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR; + pAssignControl->wzName = L"CacheProgressbar"; + pAssignControl->ppControl = &m_pControlCacheProgressbar; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlCacheProgressbar = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT; + pAssignControl->wzName = L"CacheProgressText"; + pAssignControl->ppControl = &m_pControlCacheProgressText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlCacheProgressText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT; + pAssignControl->wzName = L"ExecuteProgressPackageText"; + pAssignControl->ppControl = &m_pControlExecuteProgressPackageText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlExecuteProgressPackageText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR; + pAssignControl->wzName = L"ExecuteProgressbar"; + pAssignControl->ppControl = &m_pControlExecuteProgressbar; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlExecuteProgressbar = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT; + pAssignControl->wzName = L"ExecuteProgressText"; + pAssignControl->ppControl = &m_pControlExecuteProgressText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlExecuteProgressText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT; + pAssignControl->wzName = L"ExecuteProgressActionDataText"; + pAssignControl->ppControl = &m_pControlExecuteProgressActionDataText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlExecuteProgressActionDataText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT; + pAssignControl->wzName = L"OverallProgressPackageText"; + pAssignControl->ppControl = &m_pControlOverallProgressPackageText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlOverallProgressPackageText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR; + pAssignControl->wzName = L"OverallProgressbar"; + pAssignControl->ppControl = &m_pControlOverallProgressbar; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlOverallProgressbar = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR; + pAssignControl->wzName = L"OverallCalculatedProgressbar"; + pAssignControl->ppControl = &m_pControlOverallCalculatedProgressbar; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlOverallCalculatedProgressbar = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT; + pAssignControl->wzName = L"OverallProgressText"; + pAssignControl->ppControl = &m_pControlOverallProgressText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlOverallProgressText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON; + pAssignControl->wzName = L"ProgressCancelButton"; + pAssignControl->ppControl = &m_pControlProgressCancelButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlProgressCancelButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_LAUNCH_BUTTON; + pAssignControl->wzName = L"LaunchButton"; + pAssignControl->ppControl = &m_pControlLaunchButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlLaunchButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON; + pAssignControl->wzName = L"SuccessRestartButton"; + pAssignControl->ppControl = &m_pControlSuccessRestartButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlSuccessRestartButton = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK; + pAssignControl->wzName = L"FailureLogFileLink"; + pAssignControl->ppControl = &m_pControlFailureLogFileLink; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlFailureLogFileLink = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT; + pAssignControl->wzName = L"FailureMessageText"; + pAssignControl->ppControl = &m_pControlFailureMessageText; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlFailureMessageText = NULL; + ++pAssignControl; + + pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON; + pAssignControl->wzName = L"FailureRestartButton"; + pAssignControl->ppControl = &m_pControlFailureRestartButton; + pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; + m_pControlFailureRestartButton = NULL; + + C_ASSERT(LAST_WIXSTDBA_CONTROL == WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON + 1); + } + + + // + // 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."); + + ::DeleteCriticalSection(&m_csShowingInternalUiThisPackage); + 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_sczBundleVersion); + ReleaseStr(m_sczAfterForcedRestartPackage); + } + +private: + HMODULE m_hModule; + BOOTSTRAPPER_ACTION m_commandAction; + BOOTSTRAPPER_DISPLAY m_commandDisplay; + BOOTSTRAPPER_RESUME_TYPE m_commandResumeType; + BOOTSTRAPPER_RELATION_TYPE m_commandRelationType; + HWND m_hwndSplashScreen; + + BOOTSTRAPPER_ACTION m_plannedAction; + + LPWSTR m_sczAfterForcedRestartPackage; + LPWSTR m_sczBundleVersion; + + 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; + THEME_ASSIGN_CONTROL_ID m_rgInitControls[LAST_WIXSTDBA_CONTROL - WIXSTDBA_FIRST_ASSIGN_CONTROL_ID]; + DWORD m_rgdwPageIds[countof(vrgwzPageNames)]; + HANDLE m_hUiThread; + BOOL m_fRegistered; + HWND m_hWnd; + + // Welcome page + const THEME_CONTROL* m_pControlInstallButton; + const THEME_CONTROL* m_pControlEulaRichedit; + const THEME_CONTROL* m_pControlEulaHyperlink; + const THEME_CONTROL* m_pControlEulaAcceptCheckbox; + + // Modify page + const THEME_CONTROL* m_pControlRepairButton; + const THEME_CONTROL* m_pControlUninstallButton; + + // Update/loading pages + const THEME_CONTROL* m_pControlCheckingForUpdatesLabel; + const THEME_CONTROL* m_pControlInstallUpdateButton; + const THEME_CONTROL* m_pControlModifyUpdateButton; + + // Progress page + const THEME_CONTROL* m_pControlCacheProgressPackageText; + const THEME_CONTROL* m_pControlCacheProgressbar; + const THEME_CONTROL* m_pControlCacheProgressText; + + const THEME_CONTROL* m_pControlExecuteProgressPackageText; + const THEME_CONTROL* m_pControlExecuteProgressbar; + const THEME_CONTROL* m_pControlExecuteProgressText; + const THEME_CONTROL* m_pControlExecuteProgressActionDataText; + + const THEME_CONTROL* m_pControlOverallProgressPackageText; + const THEME_CONTROL* m_pControlOverallProgressbar; + const THEME_CONTROL* m_pControlOverallCalculatedProgressbar; + const THEME_CONTROL* m_pControlOverallProgressText; + + const THEME_CONTROL* m_pControlProgressCancelButton; + + // Success page + const THEME_CONTROL* m_pControlLaunchButton; + const THEME_CONTROL* m_pControlSuccessRestartButton; + + // Failure page + const THEME_CONTROL* m_pControlFailureLogFileLink; + const THEME_CONTROL* m_pControlFailureMessageText; + const THEME_CONTROL* m_pControlFailureRestartButton; + + WIXSTDBA_STATE m_state; + HRESULT m_hrFinal; + + BOOL m_fStartedExecution; + DWORD m_dwCalculatedCacheProgress; + DWORD m_dwCalculatedExecuteProgress; + + BOOTSTRAPPER_APPLY_RESTART m_restartResult; + BOOL m_fRestartRequired; + BOOL m_fShouldRestart; + BOOL m_fAllowRestart; + BOOL m_fRestartRequiresElevation; + BOOL m_fElevatingForRestart; + + LPWSTR m_sczLicenseFile; + LPWSTR m_sczLicenseUrl; + BOOL m_fSuppressDowngradeFailure; + BOOL m_fDowngrading; + BOOL m_fSuppressRepair; + BOOL m_fSupportCacheOnly; + BOOL m_fRequestedCacheOnly; + + BOOL m_fPrereq; + BOOL m_fPreplanPrereqs; + BOOL m_fHandleHelp; + BOOL m_fPrereqPackagePlanned; + BOOL m_fPrereqInstalled; + BOOL m_fPrereqSkipped; + + ITaskbarList3* m_pTaskbarList; + UINT m_uTaskbarButtonCreatedMessage; + BOOL m_fTaskbarButtonOK; + CRITICAL_SECTION m_csShowingInternalUiThisPackage; + BOOL m_fShowingInternalUiThisPackage; + BOOL m_fTriedToLaunchElevated; + + BOOL m_fShowStandardFilesInUse; + BOOL m_fShowRMFilesInUse; + BOOL m_fShowNetfxFilesInUse; + int m_nLastMsiFilesInUseResult; + int m_nLastNetfxFilesInUseResult; + LOC_STRING* m_pFilesInUseTitleLoc; + LOC_STRING* m_pFilesInUseLabelLoc; + LOC_STRING* m_pFilesInUseCloseRadioButtonLoc; + LOC_STRING* m_pFilesInUseNetfxCloseRadioButtonLoc; + LOC_STRING* m_pFilesInUseDontCloseRadioButtonLoc; + LOC_STRING* m_pFilesInUseRetryButtonLoc; + LOC_STRING* m_pFilesInUseIgnoreButtonLoc; + LOC_STRING* m_pFilesInUseExitButtonLoc; + + HMODULE m_hBAFModule; + PFN_BA_FUNCTIONS_PROC m_pfnBAFunctionsProc; + LPVOID m_pvBAFunctionsProcContext; +}; + + +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 LoggingBoolToString( + __in BOOL f + ) +{ + if (f) + { + return "Yes"; + } + + return "No"; +} + +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 LoggingPlanRelationTypeToString( + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE type + ) +{ + switch (type) + { + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE: + return "None"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE: + return "Downgrade"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_UPGRADE: + return "Upgrade"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_ADDON: + return "Addon"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_PATCH: + return "Patch"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON: + return "DependentAddon"; + case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH: + return "DependentPatch"; + 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"; + } +} + +EXTERN_C HRESULT CreateWixPrerequisiteBootstrapperApplication( + __in HINSTANCE hInstance, + __out IBootstrapperApplication** ppApplication + ) +{ + HRESULT hr = S_OK; + + CWixStandardBootstrapperApplication* pApplication = new CWixStandardBootstrapperApplication(hInstance, TRUE); + ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new bootstrapper application."); + + hr = pApplication->QueryInterface(IID_PPV_ARGS(ppApplication)); + ExitOnRootFailure(hr, "Failed to query for IBootstrapperApplication."); + +LExit: + ReleaseObject(pApplication); + + return hr; +} + +EXTERN_C HRESULT CreateWixStandardBootstrapperApplication( + __in HINSTANCE hInstance, + __out IBootstrapperApplication** ppApplication + ) +{ + HRESULT hr = S_OK; + + CWixStandardBootstrapperApplication* pApplication = new CWixStandardBootstrapperApplication(hInstance, FALSE); + ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new bootstrapper application."); + + hr = pApplication->QueryInterface(IID_PPV_ARGS(ppApplication)); + ExitOnRootFailure(hr, "Failed to query for IBootstrapperApplication."); + +LExit: + ReleaseObject(pApplication); + + return hr; +} diff --git a/src/ext/Bal/stdbas/inc/WixInternalUIBootstrapperApplication.h b/src/ext/Bal/stdbas/inc/WixInternalUIBootstrapperApplication.h new file mode 100644 index 00000000..6dfef7d9 --- /dev/null +++ b/src/ext/Bal/stdbas/inc/WixInternalUIBootstrapperApplication.h @@ -0,0 +1,7 @@ +#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. + +EXTERN_C HRESULT CreateWixInternalUIBootstrapperApplication( + __in HINSTANCE hInstance, + __out IBootstrapperApplication** ppApplication + ); diff --git a/src/ext/Bal/stdbas/inc/WixStandardBootstrapperApplication.h b/src/ext/Bal/stdbas/inc/WixStandardBootstrapperApplication.h new file mode 100644 index 00000000..c3742816 --- /dev/null +++ b/src/ext/Bal/stdbas/inc/WixStandardBootstrapperApplication.h @@ -0,0 +1,12 @@ +#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. + +EXTERN_C HRESULT CreateWixPrerequisiteBootstrapperApplication( + __in HINSTANCE hInstance, + __out IBootstrapperApplication** ppApplication + ); + +EXTERN_C HRESULT CreateWixStandardBootstrapperApplication( + __in HINSTANCE hInstance, + __out IBootstrapperApplication** ppApplication + ); diff --git a/src/ext/Bal/stdbas/precomp.cpp b/src/ext/Bal/stdbas/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/stdbas/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/stdbas/precomp.h b/src/ext/Bal/stdbas/precomp.h new file mode 100644 index 00000000..7f138035 --- /dev/null +++ b/src/ext/Bal/stdbas/precomp.h @@ -0,0 +1,49 @@ +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include "stdbas.messages.h" +#include "WixStandardBootstrapperApplication.h" diff --git a/src/ext/Bal/stdbas/stdbas.manifest b/src/ext/Bal/stdbas/stdbas.manifest new file mode 100644 index 00000000..d978bb2b --- /dev/null +++ b/src/ext/Bal/stdbas/stdbas.manifest @@ -0,0 +1,19 @@ + + + + WiX Toolset Bootstrapper Applications + + + + + + + + + + true/pm + PerMonitorV2, PerMonitor, System + true + + + diff --git a/src/ext/Bal/stdbas/stdbas.mc b/src/ext/Bal/stdbas/stdbas.mc new file mode 100644 index 00000000..025315a5 --- /dev/null +++ b/src/ext/Bal/stdbas/stdbas.mc @@ -0,0 +1,101 @@ +; // 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=4 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_COMPATIBLE_MSI_PACKAGE +Language=English +WIXSTDBA: Planned compatible package: %2!ls! for %1!ls!, wixstdba requested remove: %3!hs!, bafunctions requested remove: %4!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! +. + +MessageId=8 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_ROLLBACK_BOUNDARY +Language=English +WIXSTDBA: Planned rollback boundary: %1!ls!, wixstdba requested transaction: %2!hs!, bafunctions requested transaction: %3!hs! +. + +MessageId=9 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_RESTORE_RELATED_BUNDLE +Language=English +WIXSTDBA: Planned restore related bundle: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! +. + +MessageId=10 +Severity=Success +SymbolicName=MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE_TYPE +Language=English +WIXSTDBA: Planned related bundle type: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! +. + diff --git a/src/ext/Bal/stdbas/stdbas.vcxproj b/src/ext/Bal/stdbas/stdbas.vcxproj new file mode 100644 index 00000000..3722b40a --- /dev/null +++ b/src/ext/Bal/stdbas/stdbas.vcxproj @@ -0,0 +1,79 @@ + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {DBBF5F32-BAEA-46A8-99A0-17277A906456} + Win32Proj + StaticLibrary + Unicode + WiX Standard Bootstrapper Applications + ClCompile + + + + + + + + + + + + + + + + + + + Create + + + + + + + + Compiling message file... + mc.exe -h "$(IntDir)." -r "$(IntDir)." -A -c -z stdbas.messages "$(InputDir)stdbas.mc" +rc.exe -fo "$(OutDir)stdbas.res" "$(IntDir)stdbas.messages.rc" + $(InputDir)stdbas.mc + $(IntDir)stdbas.messages.h;$(IntDir)stdbas.messages.rc + + + + + + + + + + diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs index 2e60e2c0..217fdfb1 100644 --- a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs @@ -116,47 +116,47 @@ namespace WixToolsetTest.Bal } } - [Fact] - public void CanBuildUsingMBAWithAlwaysInstallPrereqs() - { - 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 baFolderPath = Path.Combine(baseFolder, "ba"); - var extractFolderPath = Path.Combine(baseFolder, "extract"); - - var compileResult = WixRunner.Execute(new[] - { - "build", - Path.Combine(bundleSourceFolder, "AlwaysInstallPrereqsBundle.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 wixMbaPrereqOptionsElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqOptions"); - WixAssert.CompareLineByLine(new[] - { - "", - }, wixMbaPrereqOptionsElements); - - var wixMbaPrereqInformationElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); - WixAssert.CompareLineByLine(new[] - { - "", - }, wixMbaPrereqInformationElements); - } - } + //[Fact] + //public void CanBuildUsingMBAWithAlwaysInstallPrereqs() + //{ + // 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 baFolderPath = Path.Combine(baseFolder, "ba"); + // var extractFolderPath = Path.Combine(baseFolder, "extract"); + + // var compileResult = WixRunner.Execute(new[] + // { + // "build", + // Path.Combine(bundleSourceFolder, "AlwaysInstallPrereqsBundle.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 wixPrereqOptionsElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqOptions"); + // WixAssert.CompareLineByLine(new[] + // { + // "", + // }, wixPrereqOptionsElements); + + // var wixPrereqInformationElements = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); + // WixAssert.CompareLineByLine(new[] + // { + // "", + // }, wixPrereqInformationElements); + // } + //} [Fact] public void CannotBuildUsingMBAWithNoPrereqs() @@ -165,7 +165,8 @@ namespace WixToolsetTest.Bal { var baseFolder = fs.GetFolder(); var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); - var bundleSourceFolder = TestData.Get(@"TestData\MBA"); + var bundleSourceFolder = TestData.Get(@"TestData", "MBA"); + var dataFolder = TestData.Get(@"TestData", ".Data"); var intermediateFolder = Path.Combine(baseFolder, "obj"); var compileResult = WixRunner.Execute(new[] @@ -174,10 +175,15 @@ namespace WixToolsetTest.Bal Path.Combine(bundleSourceFolder, "Bundle.wxs"), "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), "-intermediateFolder", intermediateFolder, + "-bindpath", dataFolder, "-o", bundleFile, }); - Assert.Equal(6802, compileResult.ExitCode); - WixAssert.StringEqual("There must be at least one package with bal:PrereqPackage=\"yes\" when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString()); + + WixAssert.CompareLineByLine(new[] + { + "The WixManagedBootstrapperApplicationHost element has been deprecated.", + }, compileResult.Messages.Select(m => m.ToString()).ToArray()); + Assert.Equal(1130, compileResult.ExitCode); Assert.False(File.Exists(bundleFile)); Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); @@ -202,11 +208,13 @@ namespace WixToolsetTest.Bal "-intermediateFolder", intermediateFolder, "-o", bundleFile, }); + WixAssert.CompareLineByLine(new[] { - "When using DotNetCoreBootstrapperApplicationHost, the Payload element for the BA's entry point DLL must have bal:BAFactoryAssembly=\"yes\".", + "The WixDotNetCoreBootstrapperApplicationHost element has been deprecated.", + "The BootstrapperApplication element's Name or SourceFile attribute was not found; one of these is required." }, compileResult.Messages.Select(x => x.ToString()).ToArray()); - Assert.Equal(6818, compileResult.ExitCode); + Assert.Equal(44, compileResult.ExitCode); Assert.False(File.Exists(bundleFile)); Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs index 314bcd35..22e2fec1 100644 --- a/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs @@ -45,8 +45,8 @@ namespace WixToolsetTest.Bal "", }, balPackageInfos); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); } } @@ -84,14 +84,14 @@ namespace WixToolsetTest.Bal "", }, balPackageInfos); - var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); + var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); WixAssert.CompareLineByLine(new[] { - "", + "", }, mbaPrereqInfos); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); } } @@ -129,14 +129,14 @@ namespace WixToolsetTest.Bal "", }, balPackageInfos); - var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); + var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); WixAssert.CompareLineByLine(new[] { - "", + "", }, mbaPrereqInfos); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); } } @@ -183,14 +183,14 @@ namespace WixToolsetTest.Bal "", }, balPackageInfos); - var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); + var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); WixAssert.CompareLineByLine(new[] { - "", + "", }, mbaPrereqInfos); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); - Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); + Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); } } diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/.Data/fake.exe b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/.Data/fake.exe new file mode 100644 index 00000000..f27639e9 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/.Data/fake.exe @@ -0,0 +1 @@ +This is fake.exe \ No newline at end of file diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs index ba1aefba..59be4bd4 100644 --- a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs @@ -2,7 +2,7 @@ - + diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs deleted file mode 100644 index 27729ac8..00000000 --- a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs +++ /dev/null @@ -1,45 +0,0 @@ -// 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.Dnc.HostGenerator -{ - using System; - using System.Collections.Immutable; - using Microsoft.CodeAnalysis; - using Microsoft.CodeAnalysis.CSharp; - using Microsoft.CodeAnalysis.CSharp.Testing; - using Microsoft.CodeAnalysis.Testing.Verifiers; - - public static class CSharpSourceGeneratorVerifier - where TSourceGenerator : ISourceGenerator, new() - { - public class Test : CSharpSourceGeneratorTest - { - public Test() - { - } - - protected override CompilationOptions CreateCompilationOptions() - { - var compilationOptions = base.CreateCompilationOptions(); - return compilationOptions.WithSpecificDiagnosticOptions( - compilationOptions.SpecificDiagnosticOptions.SetItems(GetNullableWarningsFromCompiler())); - } - - public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default; - - private static ImmutableDictionary GetNullableWarningsFromCompiler() - { - string[] args = { "/warnaserror:nullable" }; - var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory); - var nullableWarnings = commandLineArguments.CompilationOptions.SpecificDiagnosticOptions; - - return nullableWarnings; - } - - protected override ParseOptions CreateParseOptions() - { - return ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(this.LanguageVersion); - } - } - } -} diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs deleted file mode 100644 index ae55b2b5..00000000 --- a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs +++ /dev/null @@ -1,91 +0,0 @@ -// 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.Dnc.HostGenerator -{ - using System; - using System.Text; - using System.Threading.Tasks; - using Microsoft.CodeAnalysis; - using Microsoft.CodeAnalysis.Testing; - using Microsoft.CodeAnalysis.Text; - using WixToolset.Dnc.HostGenerator; - using WixToolset.Mba.Core; - using Xunit; - - using VerifyCS = CSharpSourceGeneratorVerifier; - - public class DncHostGeneratorTests - { - static readonly MetadataReference MbaCoreAssembly = MetadataReference.CreateFromFile(typeof(BootstrapperApplicationFactoryAttribute).Assembly.Location); - - // https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md#unit-testing-of-generators - [Fact] - public async Task FailsBuildWhenMissingAttribute() - { - var code = @" -//[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Test.BAFactory))] -namespace Test -{ - using WixToolset.Mba.Core; - - public class BAFactory : BaseBootstrapperApplicationFactory - { - protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) - { - return null; - } - } -} -"; - - await new VerifyCS.Test - { - TestState = - { - Sources = { code }, - ReferenceAssemblies = ReferenceAssemblies.Net.Net60, - AdditionalReferences = { MbaCoreAssembly }, - ExpectedDiagnostics = - { - new DiagnosticResult(DncHostGenerator.MissingFactoryAttributeDescriptor), - }, - }, - }.RunAsync(); - } - - [Fact] - public async Task GeneratesEntryPoint() - { - var code = @" -[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Test.BAFactory))] -namespace Test -{ - using WixToolset.Mba.Core; - - public class BAFactory : BaseBootstrapperApplicationFactory - { - protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) - { - return null; - } - } -} -"; - var generated = String.Format(DncHostGenerator.Template, DncHostGenerator.Version, "Test.BAFactory"); - - await new VerifyCS.Test - { - TestState = - { - Sources = { code }, - GeneratedSources = - { - (typeof(DncHostGenerator), "WixToolset.Dnc.Host.g.cs", SourceText.From(generated, Encoding.UTF8, SourceHashAlgorithm.Sha256)), - }, - ReferenceAssemblies = ReferenceAssemblies.Net.Net60, - AdditionalReferences = { MbaCoreAssembly }, - }, - }.RunAsync(); - } - } -} diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj deleted file mode 100644 index 1cbf702d..00000000 --- a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - net6.0 - true - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs deleted file mode 100644 index fe644d2d..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs +++ /dev/null @@ -1,285 +0,0 @@ -// 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; - using WixInternal.TestSupport; - using WixInternal.TestSupport.XunitExtensions; - 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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [SkippableFact] - public void CanLoadFDDx86EarliestCoreMBA() - { - // https://github.com/microsoft/vstest/issues/3586 - Environment.SetEnvironmentVariable("DOTNET_ROOT", null); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleFDDx86.exe"); - var testEngine = new TestEngine(); - - var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true); - var resultOutput = result.Output.ToArray(); - - if (resultOutput.Length > 0 && (resultOutput[0] == "error from hostfxr: It was not possible to find any compatible framework version" || - resultOutput[0] == "error from hostfxr: You must install or update .NET to run this application.")) - { - WixAssert.Skip(String.Join(Environment.NewLine, resultOutput)); - } - - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, resultOutput); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,ReloadBootstrapper,0", - "Loading .NET Core SCD bootstrapper application.", - "Reloaded 1 time(s)", // dnchost doesn't currently support unloading - "Creating BA thread to run asynchronously.", - "EarliestCoreBA", - "Shutdown,Restart,0", - - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [Fact] - public void CanLoadFDDx86LatestCoreMBA() - { - // https://github.com/microsoft/vstest/issues/3586 - Environment.SetEnvironmentVariable("DOTNET_ROOT", null); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDDx86.exe"); - var testEngine = new TestEngine(); - - var result = testEngine.RunShutdownEngine(bundleFile, baseFolder, x86: true); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - "Loading .NET Core FDD bootstrapper application.", - "Reloaded 1 time(s)", // dnchost doesn't currently support unloading - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,Restart,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - var logMessages = result.Output; - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core SCD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,ReloadBootstrapper,0", - "Loading .NET Core SCD bootstrapper application.", - "Reloaded 1 time(s)", // dnchost doesn't currently support unloading - "Creating BA thread to run asynchronously.", - "LatestCoreBA", - "Shutdown,Restart,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading .NET Core FDD bootstrapper application.", - "Creating BA thread to run asynchronously.", - "WPFCoreBA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - } -} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs deleted file mode 100644 index 6f7709b5..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs +++ /dev/null @@ -1,100 +0,0 @@ -// 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 WixInternal.TestSupport; - 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); - WixAssert.CompareLineByLine(new[] - { - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework2BA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework4BA", - "Shutdown,ReloadBootstrapper,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework2BA", - "Shutdown,ReloadBootstrapper,0", - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework2BA", - "Shutdown,Restart,0", - }, result.Output.ToArray()); - } - } - - [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); - WixAssert.CompareLineByLine(new[] - { - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework4BA", - "Shutdown,ReloadBootstrapper,0", - "Loading managed bootstrapper application.", - "Creating BA thread to run asynchronously.", - "FullFramework4BA", - "Shutdown,Restart,0", - }, result.Output.ToArray()); - } - } - } -} diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md deleted file mode 100644 index cbec1387..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md +++ /dev/null @@ -1,5 +0,0 @@ -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 devbuild.cmd to publish everything before the tests can be run. -devbuild.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 deleted file mode 100644 index 8be62e92..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs +++ /dev/null @@ -1,76 +0,0 @@ -// 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; - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using WixInternal.TestSupport; - using WixInternal.Core.TestPackage; - - public class TestEngine - { - private static readonly string TestEngineFile = TestData.Get(@"..\x64\examples\Example.TestEngine\Example.TestEngine.exe"); - private static readonly string TestEngineFileX86 = TestData.Get(@"..\x86\examples\Example.TestEngine\Example.TestEngine.exe"); - - public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath, bool x86 = false) - { - return this.RunTestEngine("reload", bundleFilePath, tempFolderPath, x86); - } - - public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath, bool x86 = false) - { - return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath, x86); - } - - private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath, bool x86 = false) - { - 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(x86 ? TestEngineFileX86 : 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 deleted file mode 100644 index 63f6f7f5..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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 deleted file mode 100644 index 9caf3aa6..00000000 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - net6.0 - true - - - - - - - - - - - - diff --git a/src/ext/Bal/test/examples/Directory.Build.props b/src/ext/Bal/test/examples/Directory.Build.props index 7f38564a..e7d65cdd 100644 --- a/src/ext/Bal/test/examples/Directory.Build.props +++ b/src/ext/Bal/test/examples/Directory.Build.props @@ -2,6 +2,5 @@ - diff --git a/src/ext/Bal/test/examples/Directory.Build.targets b/src/ext/Bal/test/examples/Directory.Build.targets index b27a1a41..3e9115e0 100644 --- a/src/ext/Bal/test/examples/Directory.Build.targets +++ b/src/ext/Bal/test/examples/Directory.Build.targets @@ -3,5 +3,4 @@ - diff --git a/src/ext/Bal/test/examples/Directory.csproj.props b/src/ext/Bal/test/examples/Directory.csproj.props deleted file mode 100644 index e314ca20..00000000 --- a/src/ext/Bal/test/examples/Directory.csproj.props +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/ext/Bal/test/examples/DncBA.targets b/src/ext/Bal/test/examples/DncBA.targets deleted file mode 100644 index 2b8c1428..00000000 --- a/src/ext/Bal/test/examples/DncBA.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - false - - - - - - - - - - diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs index 116d5223..bb83568f 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,12 +1,12 @@  - + - + - + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDDx86/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleFDDx86/FrameworkDependentBundle.wxs index 3672fc1d..ca3d4cf0 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleFDDx86/FrameworkDependentBundle.wxs +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDDx86/FrameworkDependentBundle.wxs @@ -1,12 +1,12 @@  - + - + - + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs index d888d3d9..38a167f1 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs @@ -1,7 +1,7 @@  - - + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt index 06b84256..d30b2564 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt @@ -11,10 +11,5 @@ - - - yes - - - + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs index 5f1aa557..bf4ad6e3 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -1,7 +1,7 @@  - - + + diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt index 06b84256..d30b2564 100644 --- a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt @@ -11,10 +11,5 @@ - - - yes - - - + diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs index c9291a7f..490f4051 100644 --- a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs @@ -6,14 +6,9 @@ namespace Example.EarliestCoreMBA public class EarliestCoreBA : BootstrapperApplication { - public EarliestCoreBA(IEngine engine) - : base(engine) - { - - } - protected override void Run() { + this.engine.Quit(0); } protected override void OnStartup(StartupEventArgs args) diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs deleted file mode 100644 index 672e17ee..00000000 --- a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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 index 7b9d1670..958381c3 100644 --- a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj @@ -3,7 +3,12 @@ net6.0 win-x86;win-x64 - true + WinExe + embedded Earliest .NET Core MBA + + + + diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/Program.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/Program.cs new file mode 100644 index 00000000..11cc46f0 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Program.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 Example.EarliestCoreMBA +{ + using WixToolset.Mba.Core; + + internal class Program + { + private static int Main() + { + var application = new EarliestCoreBA(); + + ManagedBootstrapperApplication.Run(application); + + return 0; + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs index ba4f02b6..9ca93c7f 100644 --- a/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs @@ -1,11 +1,10 @@  - - + + - - + diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj index ba75a9ff..7f9c222e 100644 --- a/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj @@ -1,2 +1,6 @@ - + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/App.config b/src/ext/Bal/test/examples/FullFramework2MBA/App.config new file mode 100644 index 00000000..cd68f257 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/App.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj index f6280a9e..7c4db8c1 100644 --- a/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj +++ b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj @@ -4,6 +4,7 @@ net462 + WinExe Example.FullFramework2MBA Example.FullFramework2MBA embedded @@ -11,10 +12,10 @@ - + - + diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs index 32cd19c8..c6d478af 100644 --- a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs @@ -6,14 +6,9 @@ namespace Example.FullFramework2MBA public class FullFramework2BA : BootstrapperApplication { - public FullFramework2BA(IEngine engine) - : base(engine) - { - - } - protected override void Run() { + this.engine.Quit(42); } protected override void OnStartup(StartupEventArgs args) diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs deleted file mode 100644 index 647c2040..00000000 --- a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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/Program.cs b/src/ext/Bal/test/examples/FullFramework2MBA/Program.cs new file mode 100644 index 00000000..067fefe8 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/Program.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 Example.FullFramework2MBA +{ + using WixToolset.Mba.Core; + + internal class Program + { + private static int Main() + { + var application = new FullFramework2BA(); + + ManagedBootstrapperApplication.Run(application); + + return 0; + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config deleted file mode 100644 index 41cacce5..00000000 --- a/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - -
- - - - - - - - - - - - diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs index 802b8b1e..7cac54f2 100644 --- a/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs @@ -1,11 +1,11 @@  - - + + + - - + diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj index ba75a9ff..f36d1910 100644 --- a/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj @@ -1,2 +1,7 @@ - + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/App.config b/src/ext/Bal/test/examples/FullFramework4MBA/App.config new file mode 100644 index 00000000..dfb3084c --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/App.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj index 247c8173..09665180 100644 --- a/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj +++ b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj @@ -4,14 +4,12 @@ net472 + WinExe Full Framework v4 MBA + embedded win-x64 - - - - diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs index 8ee3bd19..8a91195a 100644 --- a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs @@ -6,14 +6,9 @@ namespace Example.FullFramework4MBA public class FullFramework4BA : BootstrapperApplication { - public FullFramework4BA(IEngine engine) - : base(engine) - { - - } - protected override void Run() { + this.engine.Quit(0); } protected override void OnStartup(StartupEventArgs args) diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs deleted file mode 100644 index 6a571a54..00000000 --- a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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/Program.cs b/src/ext/Bal/test/examples/FullFramework4MBA/Program.cs new file mode 100644 index 00000000..23fb6851 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/Program.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 Example.FullFramework4MBA +{ + using WixToolset.Mba.Core; + + internal class Program + { + private static int Main() + { + var application = new FullFramework4BA(); + + ManagedBootstrapperApplication.Run(application); + + return 0; + } + } +} diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config deleted file mode 100644 index ac4770df..00000000 --- a/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
- - - - - - - - - diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs index b29363dd..74f82d99 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,12 +1,12 @@  - + - + - + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDDx86/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleFDDx86/FrameworkDependentBundle.wxs index 15dd290a..ab40a543 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleFDDx86/FrameworkDependentBundle.wxs +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDDx86/FrameworkDependentBundle.wxs @@ -1,12 +1,12 @@  - + - + - + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs index 56edc986..0022b690 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs @@ -1,7 +1,7 @@  - - + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt index acc7474c..f606296e 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt @@ -11,10 +11,5 @@ - - - yes - - - + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs index 7ac9c34a..322a27a3 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -1,7 +1,7 @@  - - + + diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt index acc7474c..f606296e 100644 --- a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt @@ -11,10 +11,5 @@ - - - yes - - - + diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj index 236e715c..c4d31151 100644 --- a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj @@ -3,7 +3,12 @@ net6.0 win-x86;win-x64 - true + WinExe + embedded Latest .NET Core MBA + + + + diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs index 50386a87..bd5378eb 100644 --- a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs @@ -6,13 +6,9 @@ namespace Example.LatestCoreMBA public class LatestCoreBA : BootstrapperApplication { - public LatestCoreBA(IEngine engine) - : base(engine) - { - } - protected override void Run() { + this.engine.Quit(0); } protected override void OnStartup(StartupEventArgs args) diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs deleted file mode 100644 index fff3b5c5..00000000 --- a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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/LatestCoreMBA/Program.cs b/src/ext/Bal/test/examples/LatestCoreMBA/Program.cs new file mode 100644 index 00000000..94da360b --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Program.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 Example.LatestCoreMBA +{ + using WixToolset.Mba.Core; + + internal class Program + { + private static int Main() + { + var application = new LatestCoreBA(); + + ManagedBootstrapperApplication.Run(application); + + return 0; + } + } +} diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp index 5c6ed398..197e3116 100644 --- a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp @@ -26,16 +26,12 @@ HRESULT TestEngine::LoadBA( { HRESULT hr = S_OK; BOOTSTRAPPER_COMMAND command = { }; - BOOTSTRAPPER_CREATE_ARGS args = { }; - PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; - if (m_pCreateResults || m_hBAModule) + if (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); @@ -44,14 +40,7 @@ HRESULT TestEngine::LoadBA( 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); - +#ifdef TODO_DELETE m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll."); @@ -60,6 +49,7 @@ HRESULT TestEngine::LoadBA( hr = pfnCreate(&args, m_pCreateResults); ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); +#endif LExit: ReleaseStr(command.wzBootstrapperApplicationDataPath); @@ -117,7 +107,7 @@ HRESULT TestEngine::SendShutdownEvent( 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); + // hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); return hr; } @@ -128,7 +118,7 @@ HRESULT TestEngine::SendStartupEvent() 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); + // hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); return hr; } @@ -151,6 +141,7 @@ void TestEngine::UnloadBA( __in BOOL fReload ) { +#ifdef TODO_DELETE PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; BOOTSTRAPPER_DESTROY_ARGS args = { }; BOOTSTRAPPER_DESTROY_RESULTS results = { }; @@ -178,6 +169,7 @@ void TestEngine::UnloadBA( m_hBAModule = NULL; } +#endif } HRESULT TestEngine::BAEngineLog( @@ -254,11 +246,9 @@ HRESULT TestEngine::ProcessBAMessage( 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 index 248e979a..6c4867b0 100644 --- a/src/ext/Bal/test/examples/TestEngine/TestEngine.h +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.h @@ -77,6 +77,5 @@ public: private: HMODULE m_hBAModule; - BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; DWORD m_dwThreadId; }; diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.h b/src/ext/Bal/test/examples/TestEngine/precomp.h index f943f420..e9ba3f98 100644 --- a/src/ext/Bal/test/examples/TestEngine/precomp.h +++ b/src/ext/Bal/test/examples/TestEngine/precomp.h @@ -11,8 +11,8 @@ #include "pathutil.h" #include "strutil.h" -#include "BootstrapperEngine.h" -#include "BootstrapperApplication.h" +#include +#include #include "TestEngine.h" #include "ReloadEngine.h" diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs index 5f054ca4..e95fbba0 100644 --- a/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,12 +1,12 @@  - + - + - + diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj index 338da446..279b498f 100644 --- a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj @@ -1,10 +1,14 @@ + WinExe net6.0-windows win-x86;win-x64 - true WPF .NET Core MBA true + + + + diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Program.cs b/src/ext/Bal/test/examples/WPFCoreMBA/Program.cs new file mode 100644 index 00000000..185e92cc --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Program.cs @@ -0,0 +1,19 @@ +// 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 WixToolset.Mba.Core; + // using WixToolset.BootstrapperApplications.Managed; + + public class Program + { + public static int Main(string[] args) + { + var app = new WPFCoreBA(); + + ManagedBootstrapperApplication.Run(app); + + return 0; + } + } +} diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs index d50be813..7bc06094 100644 --- a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs @@ -7,11 +7,6 @@ namespace Example.WPFCoreMBA public class WPFCoreBA : BootstrapperApplication { - public WPFCoreBA(IEngine engine) - : base(engine) - { - } - public Dispatcher BADispatcher { get; private set; } protected override void Run() @@ -21,7 +16,7 @@ namespace Example.WPFCoreMBA window.Closed += (s, e) => this.BADispatcher.InvokeShutdown(); //window.Show(); //Dispatcher.Run(); - //this.engine.Quit(0); + this.engine.Quit(0); } protected override void OnStartup(StartupEventArgs args) diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs deleted file mode 100644 index a3ccdf9f..00000000 --- a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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/examples.proj b/src/ext/Bal/test/examples/examples.proj index 60388a93..c1544766 100644 --- a/src/ext/Bal/test/examples/examples.proj +++ b/src/ext/Bal/test/examples/examples.proj @@ -6,8 +6,6 @@ EarliestCoreMBA\Example.EarliestCoreMBA.csproj - FullFramework2MBA\Example.FullFramework2MBA.csproj - FullFramework4MBA\Example.FullFramework4MBA.csproj LatestCoreMBA\Example.LatestCoreMBA.csproj WPFCoreMBA\Example.WPFCoreMBA.csproj $(OutputPath)examples\publish\ @@ -27,9 +25,6 @@ true true - - - @@ -41,7 +36,7 @@ Condition="'%(CoreMBAProject.SkipSCD)'==''" /> SymbolDefinitions => BurnSymbolDefinitions; @@ -112,59 +113,28 @@ namespace WixToolset.Bal } var isIuiBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.InternalUi; + var isPreqBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.Prerequisite; var isStdBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.Standard; - var isMBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.ManagedHost; - var isDNC = balBaSymbol.Type == WixBalBootstrapperApplicationType.DotNetCoreHost; - var isSCD = isDNC && this.VerifySCD(section); - - if (!isIuiBA && !isStdBA && !isMBA && !isDNC) + if (!isIuiBA && !isPreqBA && !isStdBA) { throw new WixException($"Invalid WixBalBootstrapperApplicationType: '{balBaSymbol.Type}'"); } + this.VerifyBAFunctions(section); + if (isIuiBA) { // This needs to happen before VerifyPrereqPackages because it can add prereq packages. this.VerifyPrimaryPackages(section, balBaSymbol.SourceLineNumbers); } - if (isDNC) + if (isIuiBA || isPreqBA) { - this.FinalizeBAFactorySymbol(section, balBaSymbol.SourceLineNumbers); - } - - if (isIuiBA || isStdBA || isMBA || isDNC) - { - this.VerifyBAFunctions(section); - } - - if (isIuiBA || isMBA || (isDNC && !isSCD)) - { - this.VerifyPrereqPackages(section, balBaSymbol.SourceLineNumbers, isDNC, isIuiBA); + this.VerifyPrereqPackages(section, balBaSymbol.SourceLineNumbers, isIuiBA); } } - private void FinalizeBAFactorySymbol(IntermediateSection section, SourceLineNumber baSourceLineNumbers) - { - var factorySymbol = section.Symbols.OfType().SingleOrDefault(); - if (null == factorySymbol) - { - this.Messaging.Write(BalErrors.MissingDNCBAFactoryAssembly(baSourceLineNumbers)); - return; - } - - var factoryPayloadSymbol = section.Symbols.OfType() - .Where(p => p.Id.Id == factorySymbol.PayloadId) - .SingleOrDefault(); - if (null == factoryPayloadSymbol) - { - throw new WixException($"Missing payload symbol with id: 'factorySymbol.PayloadId'"); - } - - factorySymbol.FilePath = factoryPayloadSymbol.Name; - } - private void VerifyBAFunctions(IntermediateSection section) { WixBalBAFunctionsSymbol baFunctionsSymbol = null; @@ -234,7 +204,7 @@ namespace WixToolset.Bal var nonPermanentNonPrimaryPackages = new List(); var balPackageInfoSymbolsByPackageId = section.Symbols.OfType().ToDictionary(x => x.PackageId); - var mbaPrereqInfoSymbolsByPackageId = section.Symbols.OfType().ToDictionary(x => x.PackageId); + var mbaPrereqInfoSymbolsByPackageId = section.Symbols.OfType().ToDictionary(x => x.PackageId); var msiPackageSymbolsByPackageId = section.Symbols.OfType().ToDictionary(x => x.Id.Id); var packageSymbols = section.Symbols.OfType().ToList(); foreach (var packageSymbol in packageSymbols) @@ -263,7 +233,7 @@ namespace WixToolset.Bal { if (!isPrereq) { - var prereqInfoSymbol = section.AddSymbol(new WixMbaPrereqInformationSymbol(packageSymbol.SourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) + var prereqInfoSymbol = section.AddSymbol(new WixPrereqInformationSymbol(packageSymbol.SourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) { PackageId = packageId, }); @@ -476,13 +446,12 @@ namespace WixToolset.Bal } } - private void VerifyPrereqPackages(IntermediateSection section, SourceLineNumber baSourceLineNumbers, bool isDNC, bool isIuiBA) + private void VerifyPrereqPackages(IntermediateSection section, SourceLineNumber baSourceLineNumbers, bool isIuiBA) { - var prereqInfoSymbols = section.Symbols.OfType().ToList(); + var prereqInfoSymbols = section.Symbols.OfType().ToList(); if (!isIuiBA && prereqInfoSymbols.Count == 0) { - var message = isDNC ? BalErrors.MissingDNCPrereq(baSourceLineNumbers) : BalErrors.MissingMBAPrereq(baSourceLineNumbers); - this.Messaging.Write(message); + this.Messaging.Write(BalErrors.MissingPrereq(baSourceLineNumbers)); return; } @@ -514,18 +483,5 @@ namespace WixToolset.Bal } } } - - 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 index 72883bdf..829da0e6 100644 --- a/src/ext/Bal/wixext/BalCompiler.cs +++ b/src/ext/Bal/wixext/BalCompiler.cs @@ -7,6 +7,7 @@ namespace WixToolset.Bal using System.Xml.Linq; using WixToolset.Bal.Symbols; using WixToolset.Data; + using WixToolset.Data.Burn; using WixToolset.Data.Symbols; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; @@ -17,16 +18,9 @@ namespace WixToolset.Bal public sealed class BalCompiler : BaseCompilerExtension { private readonly Dictionary packageInfoSymbolsByPackageId = new Dictionary(); - private readonly Dictionary prereqInfoSymbolsByPackageId = new Dictionary(); + private readonly Dictionary prereqInfoSymbolsByPackageId = new Dictionary(); - private enum WixDotNetCoreBootstrapperApplicationHostTheme - { - Unknown, - None, - Standard, - } - - private enum WixManagedBootstrapperApplicationHostTheme + private enum WixPrerequisiteBootstrapperApplicationTheme { Unknown, None, @@ -63,17 +57,35 @@ namespace WixToolset.Bal /// 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) { + this.ParsePossibleKeyPathElement(intermediate, section, parentElement, element, context); + } + + /// + /// Processes an element for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + { + IComponentKeyPath exePayloadRef = null; + switch (parentElement.Name.LocalName) { case "Bundle": case "Fragment": switch (element.Name.LocalName) { + case "BootstrapperApplicationPrerequisiteInformation": + this.ParseBootstrapperApplicationPrerequisiteInformationElement(intermediate, section, element); + break; case "Condition": this.ParseConditionElement(intermediate, section, element); break; case "ManagedBootstrapperApplicationPrereqInformation": - this.ParseMbaPrereqInfoElement(intermediate, section, element); + this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName, "BootstrapperApplicationPrerequisiteInformation")); + this.ParseBootstrapperApplicationPrerequisiteInformationElement(intermediate, section, element); break; default: this.ParseHelper.UnexpectedElement(parentElement, element); @@ -84,16 +96,19 @@ namespace WixToolset.Bal switch (element.Name.LocalName) { case "WixInternalUIBootstrapperApplication": - this.ParseWixInternalUIBootstrapperApplicationElement(intermediate, section, element); + exePayloadRef = this.ParseWixInternalUIBootstrapperApplicationElement(intermediate, section, element); + break; + case "WixPrerequisiteBootstrapperApplication": + this.ParseWixPrerequisiteBootstrapperApplicationElement(intermediate, section, element, context); break; case "WixStandardBootstrapperApplication": - this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element); + exePayloadRef = this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element); break; case "WixManagedBootstrapperApplicationHost": - this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); + this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName)); break; case "WixDotNetCoreBootstrapperApplicationHost": - this.ParseWixDotNetCoreBootstrapperApplicationHostElement(intermediate, section, element); + this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName)); break; default: this.ParseHelper.UnexpectedElement(parentElement, element); @@ -104,6 +119,8 @@ namespace WixToolset.Bal this.ParseHelper.UnexpectedElement(parentElement, element); break; } + + return exePayloadRef; } /// @@ -282,15 +299,7 @@ namespace WixToolset.Bal 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, - }); - } + this.Messaging.Write(BalWarnings.DeprecatedBAFactoryAssemblyAttribute(this.ParseHelper.GetSourceLineNumbers(parentElement), parentElement.Name.LocalName, attribute.Name.LocalName)); break; case "BAFunctions": if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) @@ -352,15 +361,15 @@ namespace WixToolset.Bal return packageInfo; } - private WixMbaPrereqInformationSymbol GetMbaPrereqInformationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute prereqAttribute, string packageId) + private WixPrereqInformationSymbol GetMbaPrereqInformationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute prereqAttribute, string packageId) { - WixMbaPrereqInformationSymbol prereqInfo = null; + WixPrereqInformationSymbol prereqInfo = null; if (prereqAttribute != null && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqAttribute)) { if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo)) { - prereqInfo = section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) + prereqInfo = section.AddSymbol(new WixPrereqInformationSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) { PackageId = packageId, }); @@ -432,7 +441,7 @@ namespace WixToolset.Bal /// Parses a Condition element for Bundles. /// /// The element to parse. - private void ParseMbaPrereqInfoElement(Intermediate intermediate, IntermediateSection section, XElement node) + private void ParseBootstrapperApplicationPrerequisiteInformationElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); string packageId = null; @@ -480,7 +489,7 @@ namespace WixToolset.Bal if (!this.Messaging.EncounteredError) { - section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) + section.AddSymbol(new WixPrereqInformationSymbol(sourceLineNumbers) { PackageId = packageId, LicenseFile = licenseFile, @@ -490,14 +499,16 @@ namespace WixToolset.Bal } } - private void ParseWixInternalUIBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) + private IComponentKeyPath ParseWixInternalUIBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); - WixInternalUIBootstrapperApplicationTheme? theme = null; + var theme = WixInternalUIBootstrapperApplicationTheme.Standard; string themeFile = null; string logoFile = null; string localizationFile = null; + IComponentKeyPath exePayloadRef = null; + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) @@ -542,11 +553,6 @@ namespace WixToolset.Bal this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); - if (!theme.HasValue) - { - theme = WixInternalUIBootstrapperApplicationTheme.Standard; - } - if (!this.Messaging.EncounteredError) { if (!String.IsNullOrEmpty(logoFile)) @@ -573,23 +579,41 @@ namespace WixToolset.Bal }); } - var baId = "WixInternalUIBootstrapperApplication"; switch (theme) { case WixInternalUIBootstrapperApplicationTheme.Standard: - baId = "WixInternalUIBootstrapperApplication.Standard"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixIuibaStandardPayloads", platformSpecific: false); break; } - this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.InternalUi); + section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers) + { + Type = WixBalBootstrapperApplicationType.InternalUi, + }); + + section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions")) + { + Primary = 1, + HandleHelp = 1, + HandleLayout = 1, + }); + + var exePayloadId = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixInternalUIBootstrapperApplication", platformSpecific: true); + + exePayloadRef = this.CreateComponentKeyPath(); + exePayloadRef.Id = new Identifier(AccessModifier.Section, exePayloadId); + exePayloadRef.Explicit = true; // Internal UI BA is always secondary because the PrereqBA is always primary to handle the help and layout options. + exePayloadRef.Type = PossibleKeyPathType.File; } + + return exePayloadRef; } /// /// Parses a WixStandardBootstrapperApplication element for Bundles. /// /// The element to parse. - private void ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) + private IComponentKeyPath ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); string launchTarget = null; @@ -610,6 +634,8 @@ namespace WixToolset.Bal var showVersion = YesNoType.NotSet; var supportCacheOnly = YesNoType.NotSet; + IComponentKeyPath exePayloadRef = null; + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) @@ -840,35 +866,159 @@ namespace WixToolset.Bal } } - var baId = "WixStandardBootstrapperApplication"; switch (theme) { case WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense: - baId = "WixStandardBootstrapperApplication.HyperlinkLargeLicense"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkLargeLicensePayloads", platformSpecific: false); break; case WixStandardBootstrapperApplicationTheme.HyperlinkLicense: - baId = "WixStandardBootstrapperApplication.HyperlinkLicense"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkLicensePayloads", platformSpecific: false); break; case WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense: - baId = "WixStandardBootstrapperApplication.HyperlinkSidebarLicense"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkSidebarLicensePayloads", platformSpecific: false); break; case WixStandardBootstrapperApplicationTheme.RtfLargeLicense: - baId = "WixStandardBootstrapperApplication.RtfLargeLicense"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaRtfLargeLicensePayloads", platformSpecific: false); break; case WixStandardBootstrapperApplicationTheme.RtfLicense: - baId = "WixStandardBootstrapperApplication.RtfLicense"; + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaRtfLicensePayloads", platformSpecific: false); + break; + } + + section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers) + { + Type = WixBalBootstrapperApplicationType.Standard, + }); + + var exePayloadId = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStandardBootstrapperApplication", platformSpecific: true); + + exePayloadRef = this.CreateComponentKeyPath(); + exePayloadRef.Id = new Identifier(AccessModifier.Section, exePayloadId); + exePayloadRef.Type = PossibleKeyPathType.File; + } + + return exePayloadRef; + } + + /// + /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. + /// + /// The element to parse. + private void ParseWixPrerequisiteBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node, IDictionary context) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string logoFile = null; + string themeFile = null; + string localizationFile = null; + var theme = WixPrerequisiteBootstrapperApplicationTheme.Standard; + + 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 = WixPrerequisiteBootstrapperApplicationTheme.None; + break; + case "standard": + theme = WixPrerequisiteBootstrapperApplicationTheme.Standard; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard")); + theme = WixPrerequisiteBootstrapperApplicationTheme.Unknown; + 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 (!this.Messaging.EncounteredError) + { + if (!String.IsNullOrEmpty(logoFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaLogo")) + { + Value = logoFile, + }); + } + + if (!String.IsNullOrEmpty(themeFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaThemeXml")) + { + Value = themeFile, + }); + } + + if (!String.IsNullOrEmpty(localizationFile)) + { + section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaThemeWxl")) + { + Value = localizationFile, + }); + } + + switch (theme) + { + case WixPrerequisiteBootstrapperApplicationTheme.Standard: + this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixPreqbaStandardPayloads", platformSpecific: false); break; } - this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.Standard); + section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers) + { + Type = WixBalBootstrapperApplicationType.Prerequisite, + }); + + var primary = context.TryGetValue("Secondary", out var parentSecondaryValue) && "True".Equals(parentSecondaryValue, StringComparison.OrdinalIgnoreCase) ? true : false; + + var baId = this.CreateIdentifierFromPlatform(sourceLineNumbers, node, primary ? "WixPrereqBootstrapperApplication.Primary" : "WixPrereqBootstrapperApplication.Secondary"); + + if (!String.IsNullOrEmpty(baId)) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBootstrapperApplication, baId); + } + + if (primary) + { + section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions")) + { + Primary = 1 + }); + } } } +#if DELETE /// /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. /// /// The element to parse. - private void ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) + private IComponentKeyPath ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); bool alwaysInstallPrereqs = false; @@ -877,6 +1027,8 @@ namespace WixToolset.Bal string localizationFile = null; WixManagedBootstrapperApplicationHostTheme? theme = null; + IComponentKeyPath exePayloadRef = null; + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) @@ -963,23 +1115,25 @@ namespace WixToolset.Bal break; } - this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.ManagedHost); + exePayloadRef = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixManagedBootstrapperApplicationHost", baId, WixBalBootstrapperApplicationType.ManagedHost); if (alwaysInstallPrereqs) { - section.AddSymbol(new WixMbaPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixMbaPrereqOptions")) + section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions")) { AlwaysInstallPrereqs = 1, }); } } + + return exePayloadRef; } /// /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles. /// /// The element to parse. - private void ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) + private IComponentKeyPath ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); bool alwaysInstallPrereqs = false; @@ -989,6 +1143,8 @@ namespace WixToolset.Bal var selfContainedDeployment = YesNoType.NotSet; WixDotNetCoreBootstrapperApplicationHostTheme? theme = null; + IComponentKeyPath exePayloadRef = null; + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) @@ -1086,19 +1242,36 @@ namespace WixToolset.Bal break; } - this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.DotNetCoreHost); + exePayloadRef = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixDotNetCoreBootstrapperApplicationHost", baId, WixBalBootstrapperApplicationType.DotNetCoreHost); if (alwaysInstallPrereqs) { - section.AddSymbol(new WixMbaPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixMbaPrereqOptions")) + section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions")) { AlwaysInstallPrereqs = 1, }); } } + + return exePayloadRef; + } +#endif + + private string CreatePayloadGroupRef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string basePayloadGroupId, bool platformSpecific) + { + var id = platformSpecific ? this.CreateIdentifierFromPlatform(sourceLineNumbers, node, basePayloadGroupId) : basePayloadGroupId; + + if (!String.IsNullOrEmpty(id)) + { + this.ParseHelper.CreateWixGroupSymbol(section, sourceLineNumbers, ComplexReferenceParentType.Container, BurnConstants.BurnUXContainerName, ComplexReferenceChildType.PayloadGroup, id); + + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, id); + } + + return id; } - private void CreateBARef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string name, WixBalBootstrapperApplicationType baType) + private string CreateIdentifierFromPlatform(SourceLineNumber sourceLineNumbers, XElement node, string name) { var id = this.ParseHelper.CreateIdentifierValueFromPlatform(name, this.Context.Platform, BurnPlatforms.X86 | BurnPlatforms.X64 | BurnPlatforms.ARM64); if (id == null) @@ -1106,15 +1279,7 @@ namespace WixToolset.Bal 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); - - section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers) - { - Type = baType, - }); - } + return id; } } } diff --git a/src/ext/Bal/wixext/BalErrors.cs b/src/ext/Bal/wixext/BalErrors.cs index 7fbccecb..10986f0e 100644 --- a/src/ext/Bal/wixext/BalErrors.cs +++ b/src/ext/Bal/wixext/BalErrors.cs @@ -48,9 +48,9 @@ namespace WixToolset.Bal return Message(sourceLineNumbers, Ids.MissingDNCBAFactoryAssembly, "When using DotNetCoreBootstrapperApplicationHost, the Payload element for the BA's entry point DLL must have bal:BAFactoryAssembly=\"yes\"."); } - public static Message MissingDNCPrereq(SourceLineNumber sourceLineNumbers) + public static Message MissingPrereq(SourceLineNumber sourceLineNumbers) { - return Message(sourceLineNumbers, Ids.MissingDNCPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\"."); + return Message(sourceLineNumbers, Ids.MissingPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the bal:WixPrerequisiteBootstrapperApplication."); } public static Message MissingIUIPrimaryPackage(SourceLineNumber sourceLineNumbers) @@ -58,11 +58,6 @@ namespace WixToolset.Bal return Message(sourceLineNumbers, Ids.MissingIUIPrimaryPackage, "When using WixInternalUIBootstrapperApplication, there must be one package with bal:PrimaryPackageType=\"default\"."); } - public static Message MissingMBAPrereq(SourceLineNumber sourceLineNumbers) - { - return Message(sourceLineNumbers, Ids.MissingMBAPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" 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."); @@ -106,11 +101,10 @@ namespace WixToolset.Bal public enum Ids { AttributeRequiresPrereqPackage = 6801, - MissingMBAPrereq = 6802, + MissingPrereq = 6802, MultiplePrereqLicenses = 6803, MultipleBAFunctions = 6804, BAFunctionsPayloadRequiredInUXContainer = 6805, - MissingDNCPrereq = 6806, MissingIUIPrimaryPackage = 6808, MultiplePrimaryPackageType = 6809, MultiplePrimaryPackageType2 = 6810, diff --git a/src/ext/Bal/wixext/BalWarnings.cs b/src/ext/Bal/wixext/BalWarnings.cs index 96e7a523..73a19d07 100644 --- a/src/ext/Bal/wixext/BalWarnings.cs +++ b/src/ext/Bal/wixext/BalWarnings.cs @@ -33,6 +33,11 @@ namespace WixToolset.Bal return Message(sourceLineNumbers, Ids.UnmarkedBAFunctionsDLL, "WixStandardBootstrapperApplication doesn't automatically load BAFunctions.dll. Use the bal:BAFunctions attribute to indicate that it should be loaded."); } + public static Message DeprecatedBAFactoryAssemblyAttribute(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) + { + return Message(sourceLineNumbers, Ids.DeprecatedBAFactoryAssemblyAttribute, "The {0}/@{1} attribute has been deprecated. Move the Payload/@SourceFile attribute to be the BootstrapperApplication/@SourceFile attribute and remove the Payload element.", elementName, attributeName); + } + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) { return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); @@ -50,6 +55,7 @@ namespace WixToolset.Bal IuibaPrimaryPackageInstallCondition = 6503, IuibaPrimaryPackageDisplayInternalUICondition = 6504, IuibaPrereqPackageAfterPrimaryPackage = 6505, + DeprecatedBAFactoryAssemblyAttribute = 6506, } } } diff --git a/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs b/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs index 5229f278..5e9fb936 100644 --- a/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs +++ b/src/ext/Bal/wixext/Symbols/BalSymbolDefinitions.cs @@ -13,11 +13,11 @@ namespace WixToolset.Bal WixBalCondition, WixBalPackageInfo, WixDncOptions, - WixMbaPrereqInformation, + WixPrereqInformation, WixStdbaCommandLine, WixStdbaOptions, WixStdbaOverridableVariable, - WixMbaPrereqOptions, + WixPrereqOptions, WixBalBootstrapperApplication, } @@ -37,8 +37,10 @@ namespace WixToolset.Bal { switch (type) { +#pragma warning disable 0612 // obsolete case BalSymbolDefinitionType.WixBalBAFactoryAssembly: return BalSymbolDefinitions.WixBalBAFactoryAssembly; +#pragma warning restore 0612 case BalSymbolDefinitionType.WixBalBAFunctions: return BalSymbolDefinitions.WixBalBAFunctions; @@ -49,11 +51,8 @@ namespace WixToolset.Bal case BalSymbolDefinitionType.WixBalPackageInfo: return BalSymbolDefinitions.WixBalPackageInfo; - case BalSymbolDefinitionType.WixDncOptions: - return BalSymbolDefinitions.WixDncOptions; - - case BalSymbolDefinitionType.WixMbaPrereqInformation: - return BalSymbolDefinitions.WixMbaPrereqInformation; + case BalSymbolDefinitionType.WixPrereqInformation: + return BalSymbolDefinitions.WixPrereqInformation; case BalSymbolDefinitionType.WixStdbaCommandLine: return BalSymbolDefinitions.WixStdbaCommandLine; @@ -64,8 +63,8 @@ namespace WixToolset.Bal case BalSymbolDefinitionType.WixStdbaOverridableVariable: return BalSymbolDefinitions.WixStdbaOverridableVariable; - case BalSymbolDefinitionType.WixMbaPrereqOptions: - return BalSymbolDefinitions.WixMbaPrereqOptions; + case BalSymbolDefinitionType.WixPrereqOptions: + return BalSymbolDefinitions.WixPrereqOptions; case BalSymbolDefinitionType.WixBalBootstrapperApplication: return BalSymbolDefinitions.WixBalBootstrapperApplication; @@ -77,16 +76,17 @@ namespace WixToolset.Bal static BalSymbolDefinitions() { +#pragma warning disable 0612 // obsolete WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); +#pragma warning restore 0612 WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); WixBalPackageInfo.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); - WixDncOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); - WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); WixStdbaCommandLine.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); - WixMbaPrereqOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); + WixPrereqOptions.AddTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag); } } } diff --git a/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs index 52042e4c..3ce535a3 100644 --- a/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs +++ b/src/ext/Bal/wixext/Symbols/WixBalBAFactoryAssemblySymbol.cs @@ -2,11 +2,13 @@ namespace WixToolset.Bal { + using System; using WixToolset.Data; using WixToolset.Bal.Symbols; public static partial class BalSymbolDefinitions { + [Obsolete] public static readonly IntermediateSymbolDefinition WixBalBAFactoryAssembly = new IntermediateSymbolDefinition( BalSymbolDefinitionType.WixBalBAFactoryAssembly.ToString(), new[] @@ -20,14 +22,17 @@ namespace WixToolset.Bal namespace WixToolset.Bal.Symbols { + using System; using WixToolset.Data; + [Obsolete] public enum WixBalBAFactorySymbolFields { PayloadId, FilePath, } + [Obsolete] public class WixBalBAFactoryAssemblySymbol : IntermediateSymbol { public WixBalBAFactoryAssemblySymbol() : base(BalSymbolDefinitions.WixBalBAFactoryAssembly, null, null) @@ -52,4 +57,4 @@ namespace WixToolset.Bal.Symbols set => this.Set((int)WixBalBAFactorySymbolFields.FilePath, value); } } -} \ No newline at end of file +} diff --git a/src/ext/Bal/wixext/Symbols/WixBalBootstrapperApplicationSymbol.cs b/src/ext/Bal/wixext/Symbols/WixBalBootstrapperApplicationSymbol.cs index 7096930d..47e930c2 100644 --- a/src/ext/Bal/wixext/Symbols/WixBalBootstrapperApplicationSymbol.cs +++ b/src/ext/Bal/wixext/Symbols/WixBalBootstrapperApplicationSymbol.cs @@ -19,15 +19,19 @@ namespace WixToolset.Bal namespace WixToolset.Bal.Symbols { + using System; using WixToolset.Data; public enum WixBalBootstrapperApplicationType { Unknown, Standard, + [Obsolete] ManagedHost, + [Obsolete] DotNetCoreHost, InternalUi, + Prerequisite, } public enum WixBalBootstrapperApplicationSymbolFields diff --git a/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs deleted file mode 100644 index b9a41c21..00000000 --- a/src/ext/Bal/wixext/Symbols/WixDncOptionsSymbol.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 deleted file mode 100644 index e4d78da0..00000000 --- a/src/ext/Bal/wixext/Symbols/WixMbaPrereqInformationSymbol.cs +++ /dev/null @@ -1,63 +0,0 @@ -// 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/WixMbaPrereqOptionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixMbaPrereqOptionsSymbol.cs deleted file mode 100644 index 66374579..00000000 --- a/src/ext/Bal/wixext/Symbols/WixMbaPrereqOptionsSymbol.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 WixMbaPrereqOptions = new IntermediateSymbolDefinition( - BalSymbolDefinitionType.WixMbaPrereqOptions.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixMbaPrereqOptionsSymbolFields.AlwaysInstallPrereqs), IntermediateFieldType.Number), - }, - typeof(WixMbaPrereqOptionsSymbol)); - } -} - -namespace WixToolset.Bal.Symbols -{ - using WixToolset.Data; - - public enum WixMbaPrereqOptionsSymbolFields - { - AlwaysInstallPrereqs, - } - - public class WixMbaPrereqOptionsSymbol : IntermediateSymbol - { - public WixMbaPrereqOptionsSymbol() : base(BalSymbolDefinitions.WixMbaPrereqOptions, null, null) - { - } - - public WixMbaPrereqOptionsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixMbaPrereqOptions, sourceLineNumber, id) - { - } - - public IntermediateField this[WixMbaPrereqOptionsSymbolFields index] => this.Fields[(int)index]; - - public int AlwaysInstallPrereqs - { - get => this.Fields[(int)WixMbaPrereqOptionsSymbolFields.AlwaysInstallPrereqs].AsNumber(); - set => this.Set((int)WixMbaPrereqOptionsSymbolFields.AlwaysInstallPrereqs, value); - } - } -} diff --git a/src/ext/Bal/wixext/Symbols/WixPrereqInformationSymbol.cs b/src/ext/Bal/wixext/Symbols/WixPrereqInformationSymbol.cs new file mode 100644 index 00000000..4b5e301e --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixPrereqInformationSymbol.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 WixPrereqInformation = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixPrereqInformation.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixPrereqInformationSymbolFields.PackageId), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixPrereqInformationSymbolFields.LicenseFile), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixPrereqInformationSymbolFields.LicenseUrl), IntermediateFieldType.String), + }, + typeof(WixPrereqInformationSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixPrereqInformationSymbolFields + { + PackageId, + LicenseFile, + LicenseUrl, + } + + public class WixPrereqInformationSymbol : IntermediateSymbol + { + public WixPrereqInformationSymbol() : base(BalSymbolDefinitions.WixPrereqInformation, null, null) + { + } + + public WixPrereqInformationSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixPrereqInformation, sourceLineNumber, id) + { + } + + public IntermediateField this[WixPrereqInformationSymbolFields index] => this.Fields[(int)index]; + + public string PackageId + { + get => this.Fields[(int)WixPrereqInformationSymbolFields.PackageId].AsString(); + set => this.Set((int)WixPrereqInformationSymbolFields.PackageId, value); + } + + public string LicenseFile + { + get => this.Fields[(int)WixPrereqInformationSymbolFields.LicenseFile].AsString(); + set => this.Set((int)WixPrereqInformationSymbolFields.LicenseFile, value); + } + + public string LicenseUrl + { + get => this.Fields[(int)WixPrereqInformationSymbolFields.LicenseUrl].AsString(); + set => this.Set((int)WixPrereqInformationSymbolFields.LicenseUrl, value); + } + } +} diff --git a/src/ext/Bal/wixext/Symbols/WixPrereqOptionsSymbol.cs b/src/ext/Bal/wixext/Symbols/WixPrereqOptionsSymbol.cs new file mode 100644 index 00000000..a351d7da --- /dev/null +++ b/src/ext/Bal/wixext/Symbols/WixPrereqOptionsSymbol.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 WixPrereqOptions = new IntermediateSymbolDefinition( + BalSymbolDefinitionType.WixPrereqOptions.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixPrereqOptionsSymbolFields.Primary), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixPrereqOptionsSymbolFields.HandleHelp), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixPrereqOptionsSymbolFields.HandleLayout), IntermediateFieldType.Number), + }, + typeof(WixPrereqOptionsSymbol)); + } +} + +namespace WixToolset.Bal.Symbols +{ + using WixToolset.Data; + + public enum WixPrereqOptionsSymbolFields + { + Primary, + HandleHelp, + HandleLayout, + } + + public class WixPrereqOptionsSymbol : IntermediateSymbol + { + public WixPrereqOptionsSymbol() : base(BalSymbolDefinitions.WixPrereqOptions, null, null) + { + } + + public WixPrereqOptionsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalSymbolDefinitions.WixPrereqOptions, sourceLineNumber, id) + { + } + + public IntermediateField this[WixPrereqOptionsSymbolFields index] => this.Fields[(int)index]; + + public int Primary + { + get => this.Fields[(int)WixPrereqOptionsSymbolFields.Primary].AsNumber(); + set => this.Set((int)WixPrereqOptionsSymbolFields.Primary, value); + } + + public int? HandleHelp + { + get => (int?)this.Fields[(int)WixPrereqOptionsSymbolFields.HandleHelp]; + set => this.Set((int)WixPrereqOptionsSymbolFields.HandleHelp, value); + } + + public int? HandleLayout + { + get => (int?)this.Fields[(int)WixPrereqOptionsSymbolFields.HandleLayout]; + set => this.Set((int)WixPrereqOptionsSymbolFields.HandleLayout, value); + } + } +} diff --git a/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.cpp b/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.cpp deleted file mode 100644 index 6ff6559b..00000000 --- a/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.cpp +++ /dev/null @@ -1,918 +0,0 @@ -// 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 WIXIUIBA_WINDOW_CLASS = L"WixInternalUIBA"; - -enum WM_WIXIUIBA -{ - WM_WIXIUIBA_DETECT_PACKAGES = WM_APP + 100, - WM_WIXIUIBA_PLAN_PACKAGES, - WM_WIXIUIBA_APPLY_PACKAGES, - WM_WIXIUIBA_DETECT_FOR_CLEANUP, - WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP, -}; - - -class CWixInternalUIBootstrapperApplication : 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) - { - BalExitWithLastError(hr, "Failed to create UI thread."); - } - - LExit: - return hr; - } - - - virtual STDMETHODIMP OnShutdown( - __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction - ) - { - // wait for UI thread to terminate - if (m_hUiThread) - { - ::WaitForSingleObject(m_hUiThread, INFINITE); - ReleaseHandle(m_hUiThread); - } - - if (m_fFailedToLoadPackage) - { - Assert(FAILED(m_hrFinal)); - m_pPrereqData->hrFatalError = m_hrFinal; - BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to load primary package as the BA. The bootstrapper application will be reloaded to show the error."); - *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER; - } - - return S_OK; - } - - - virtual STDMETHODIMP OnDetectPackageComplete( - __in_z LPCWSTR wzPackageId, - __in HRESULT hrStatus, - __in BOOTSTRAPPER_PACKAGE_STATE state, - __in BOOL fCached - ) - { - BAL_INFO_PACKAGE* pPackage = NULL; - - if (SUCCEEDED(hrStatus) && SUCCEEDED(BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage)) && - BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT == pPackage->primaryPackageType) - { - BOOL fInstalled = BOOTSTRAPPER_PACKAGE_STATE_ABSENT < state; - - // Maybe modify the action state if the primary package is or is not already installed. - if (fInstalled && BOOTSTRAPPER_ACTION_INSTALL == m_command.action) - { - m_command.action = BOOTSTRAPPER_ACTION_MODIFY; - } - else if (!fInstalled && (BOOTSTRAPPER_ACTION_MODIFY == m_command.action || BOOTSTRAPPER_ACTION_REPAIR == m_command.action)) - { - m_command.action = BOOTSTRAPPER_ACTION_INSTALL; - } - - if (m_fApplied && !fInstalled && fCached) - { - m_fAutomaticRemoval = TRUE; - } - } - - return __super::OnDetectPackageComplete(wzPackageId, hrStatus, state, fCached); - } - - - virtual STDMETHODIMP OnDetectComplete( - __in HRESULT hrStatus, - __in BOOL fEligibleForCleanup - ) - { - if (m_fAutomaticRemoval && SUCCEEDED(hrStatus)) - { - ::PostMessageW(m_hWnd, WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP, 0, BOOTSTRAPPER_ACTION_UNINSTALL); - ExitFunction(); - } - else if (m_fApplied) - { - ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); - ExitFunction(); - } - - // If we're performing an action that modifies machine state then evaluate conditions. - BOOL fEvaluateConditions = SUCCEEDED(hrStatus) && - (BOOTSTRAPPER_ACTION_LAYOUT < m_command.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > m_command.action); - - if (fEvaluateConditions) - { - hrStatus = EvaluateConditions(); - } - - if (SUCCEEDED(hrStatus)) - { - ::PostMessageW(m_hWnd, WM_WIXIUIBA_PLAN_PACKAGES, 0, m_command.action); - } - else - { - SetLoadPackageFailure(hrStatus); - } - - LExit: - return __super::OnDetectComplete(hrStatus, fEligibleForCleanup); - } - - - virtual STDMETHODIMP OnPlanPackageBegin( - __in_z LPCWSTR wzPackageId, - __in BOOTSTRAPPER_PACKAGE_STATE state, - __in BOOL fCached, - __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, - __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, - __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; - BAL_INFO_PACKAGE* pPackage = NULL; - - hr = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); - if (FAILED(hr)) - { - // Non-chain package, keep default. - } - else if (BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT != pPackage->primaryPackageType) - { - // Only the primary package should be cached or executed. - if (BOOTSTRAPPER_CACHE_TYPE_FORCE == *pRequestedCacheType) - { - *pRequestedCacheType = BOOTSTRAPPER_CACHE_TYPE_KEEP; - } - - *pRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE; - } - else if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display && !m_fAutomaticRemoval) - { - // Make sure the MSI UI is shown regardless of the current state of the package. - *pRequestState = BOOTSTRAPPER_REQUEST_STATE_FORCE_PRESENT; - } - - return __super::OnPlanPackageBegin(wzPackageId, state, fCached, installCondition, repairCondition, recommendedState, recommendedCacheType, pRequestState, pRequestedCacheType, pfCancel); - } - - - virtual STDMETHODIMP OnPlanMsiPackage( - __in_z LPCWSTR wzPackageId, - __in BOOL fExecute, - __in BOOTSTRAPPER_ACTION_STATE action, - __in BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, - __inout BOOL* pfCancel, - __inout BURN_MSI_PROPERTY* pActionMsiProperty, - __inout INSTALLUILEVEL* pUiLevel, - __inout BOOL* pfDisableExternalUiHandler, - __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning - ) - { - INSTALLUILEVEL uiLevel = INSTALLUILEVEL_NOCHANGE; - - if (m_fAutomaticRemoval) - { - ExitFunction(); - } - - switch (m_command.display) - { - case BOOTSTRAPPER_DISPLAY_FULL: - uiLevel = INSTALLUILEVEL_FULL; - break; - - case BOOTSTRAPPER_DISPLAY_PASSIVE: - uiLevel = INSTALLUILEVEL_REDUCED; - break; - } - - if (INSTALLUILEVEL_NOCHANGE != uiLevel) - { - *pUiLevel = uiLevel; - } - - *pActionMsiProperty = BURN_MSI_PROPERTY_NONE; - *pfDisableExternalUiHandler = TRUE; - - LExit: - return __super::OnPlanMsiPackage(wzPackageId, fExecute, action, recommendedFileVersioning, pfCancel, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); - } - - - virtual STDMETHODIMP OnPlanComplete( - __in HRESULT hrStatus - ) - { - if (SUCCEEDED(hrStatus)) - { - ::PostMessageW(m_hWnd, WM_WIXIUIBA_APPLY_PACKAGES, 0, 0); - } - else if (m_fAutomaticRemoval) - { - ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); - } - else - { - SetLoadPackageFailure(hrStatus); - } - - return __super::OnPlanComplete(hrStatus); - } - - - virtual STDMETHODIMP OnApplyBegin( - __in DWORD dwPhaseCount, - __inout BOOL* pfCancel - ) - { - m_fApplying = TRUE; - return __super::OnApplyBegin(dwPhaseCount, pfCancel); - } - - - virtual STDMETHODIMP OnCacheComplete( - __in HRESULT hrStatus - ) - { - if (FAILED(hrStatus) && !m_fAutomaticRemoval) - { - SetLoadPackageFailure(hrStatus); - } - - return __super::OnCacheComplete(hrStatus); - } - - - virtual STDMETHODIMP OnExecuteBegin( - __in DWORD cExecutingPackages, - __in BOOL* pfCancel - ) - { - m_pEngine->CloseSplashScreen(); - - return __super::OnExecuteBegin(cExecutingPackages, pfCancel); - } - - - virtual STDMETHODIMP OnApplyComplete( - __in HRESULT hrStatus, - __in BOOTSTRAPPER_APPLY_RESTART restart, - __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, - __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction - ) - { - HRESULT hr = __super::OnApplyComplete(hrStatus, restart, recommendation, pAction); - - *pAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE; - m_fApplying = FALSE; - - if (m_fAutomaticRemoval) - { - ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); - } - else - { - m_restartResult = restart; // remember the restart result so we return the correct error code. - m_fApplied = TRUE; - - if (FAILED(hrStatus)) - { - m_hrFinal = hrStatus; - } - - ::PostMessageW(m_hWnd, WM_WIXIUIBA_DETECT_FOR_CLEANUP, 0, 0); - } - - return hr; - } - - -public: //CBalBaseBootstrapperApplication - virtual STDMETHODIMP Initialize( - __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs - ) - { - HRESULT hr = S_OK; - - hr = __super::Initialize(pCreateArgs); - BalExitOnFailure(hr, "CBalBaseBootstrapperApplication initialization failed."); - - memcpy_s(&m_command, sizeof(m_command), pCreateArgs->pCommand, sizeof(BOOTSTRAPPER_COMMAND)); - memcpy_s(&m_createArgs, sizeof(m_createArgs), pCreateArgs, sizeof(BOOTSTRAPPER_CREATE_ARGS)); - m_createArgs.pCommand = &m_command; - - LExit: - return hr; - } - - void Uninitialize( - __in const BOOTSTRAPPER_DESTROY_ARGS* /*pArgs*/, - __in BOOTSTRAPPER_DESTROY_RESULTS* /*pResults*/ - ) - { - } - - -private: - // - // UiThreadProc - entrypoint for UI thread. - // - static DWORD WINAPI UiThreadProc( - __in LPVOID pvContext - ) - { - HRESULT hr = S_OK; - CWixInternalUIBootstrapperApplication* pThis = (CWixInternalUIBootstrapperApplication*)pvContext; - BOOL fComInitialized = FALSE; - BOOL fRet = FALSE; - MSG msg = { }; - DWORD dwQuit = 0; - - // Initialize COM and theme. - hr = ::CoInitialize(NULL); - BalExitOnFailure(hr, "Failed to initialize COM."); - fComInitialized = TRUE; - - hr = pThis->InitializeData(); - BalExitOnFailure(hr, "Failed to initialize data in bootstrapper application."); - - // Create main window. - hr = pThis->CreateMainWindow(); - BalExitOnFailure(hr, "Failed to create main window."); - - ::PostMessageW(pThis->m_hWnd, WM_WIXIUIBA_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 (!::IsDialogMessageW(pThis->m_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(); - - if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == pThis->m_restartResult) - { - dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_INITIATED : ERROR_FAIL_REBOOT_INITIATED; - } - else if (BOOTSTRAPPER_APPLY_RESTART_REQUIRED == pThis->m_restartResult) - { - dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_REQUIRED : ERROR_FAIL_REBOOT_REQUIRED; - } - else if (SEVERITY_ERROR == HRESULT_SEVERITY(hr) && FACILITY_WIN32 == HRESULT_FACILITY(hr)) - { - // Convert Win32 HRESULTs back to the error code. - dwQuit = HRESULT_CODE(hr); - } - else - { - dwQuit = hr; - } - - // initiate engine shutdown - pThis->m_pEngine->Quit(dwQuit); - - // uninitialize COM - if (fComInitialized) - { - ::CoUninitialize(); - } - - return hr; - } - - - // - // InitializeData - initializes all the package and prerequisite information. - // - HRESULT InitializeData() - { - HRESULT hr = S_OK; - IXMLDOMDocument* pixdManifest = NULL; - - hr = BalManifestLoad(m_hModule, &pixdManifest); - BalExitOnFailure(hr, "Failed to load bootstrapper application manifest."); - - hr = BalInfoParseFromXml(&m_Bundle, pixdManifest); - BalExitOnFailure(hr, "Failed to load bundle information."); - - hr = EnsureSinglePrimaryPackage(); - BalExitOnFailure(hr, "Failed to ensure single primary package."); - - hr = ProcessCommandLine(); - ExitOnFailure(hr, "Unknown commandline parameters."); - - hr = BalConditionsParseFromXml(&m_Conditions, pixdManifest, NULL); - BalExitOnFailure(hr, "Failed to load conditions from XML."); - - LExit: - ReleaseObject(pixdManifest); - - return hr; - } - - - // - // ProcessCommandLine - process the provided command line arguments. - // - HRESULT ProcessCommandLine() - { - HRESULT hr = S_OK; - int argc = 0; - LPWSTR* argv = NULL; - - argc = m_BalInfoCommand.cUnknownArgs; - argv = m_BalInfoCommand.rgUnknownArgs; - - for (int i = 0; i < argc; ++i) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Ignoring unknown argument: %ls", argv[i]); - } - - hr = BalSetOverridableVariablesFromEngine(&m_Bundle.overridableVariables, &m_BalInfoCommand, m_pEngine); - BalExitOnFailure(hr, "Failed to set overridable variables from the command line."); - - LExit: - return hr; - } - - HRESULT EnsureSinglePrimaryPackage() - { - HRESULT hr = S_OK; - BAL_INFO_PACKAGE* pDefaultPackage = NULL; - BOOL fPrimaryArchSpecific = FALSE; - USHORT usNativeMachine = 0; - BAL_INFO_PRIMARY_PACKAGE_TYPE nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE; - - hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); - BalExitOnFailure(hr, "Failed to get native machine value."); - - if (S_FALSE != hr) - { - switch (usNativeMachine) - { - case IMAGE_FILE_MACHINE_I386: - nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X86; - break; - case IMAGE_FILE_MACHINE_AMD64: - nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X64; - break; - case IMAGE_FILE_MACHINE_ARM64: - nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_ARM64; - break; - } - } - else - { -#if !defined(_WIN64) - BOOL fIsWow64 = FALSE; - - ProcWow64(::GetCurrentProcess(), &fIsWow64); - if (!fIsWow64) - { - nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X86; - } - else -#endif - { - nativeType = BAL_INFO_PRIMARY_PACKAGE_TYPE_X64; - } - } - - for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) - { - BAL_INFO_PACKAGE* pPackage = m_Bundle.packages.rgPackages + i; - - if (BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE == pPackage->primaryPackageType) - { - // Skip. - } - else if (nativeType == pPackage->primaryPackageType) - { - if (fPrimaryArchSpecific) - { - BalExitWithRootFailure(hr, E_INVALIDDATA, "Bundle contains multiple primary packages for same architecture: %u.", nativeType); - } - - pPackage->primaryPackageType = BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT; - fPrimaryArchSpecific = TRUE; - } - else if (BAL_INFO_PRIMARY_PACKAGE_TYPE_DEFAULT == pPackage->primaryPackageType) - { - if (pDefaultPackage) - { - BalExitWithRootFailure(hr, E_INVALIDDATA, "Bundle contains multiple default primary packages."); - } - - pDefaultPackage = pPackage; - } - } - - BalExitOnNull(pDefaultPackage, hr, E_INVALIDSTATE, "Bundle did not contain default primary package."); - - if (fPrimaryArchSpecific) - { - pDefaultPackage->primaryPackageType = BAL_INFO_PRIMARY_PACKAGE_TYPE_NONE; - } - - LExit: - return hr; - } - - - // - // CreateMainWindow - creates the main install window. - // - HRESULT CreateMainWindow() - { - HRESULT hr = S_OK; - WNDCLASSW wc = { }; - DWORD dwWindowStyle = WS_POPUP; - - wc.lpfnWndProc = CWixInternalUIBootstrapperApplication::WndProc; - wc.hInstance = m_hModule; - wc.lpszClassName = WIXIUIBA_WINDOW_CLASS; - - if (!::RegisterClassW(&wc)) - { - ExitWithLastError(hr, "Failed to register window."); - } - - m_fRegistered = TRUE; - - // If the UI should be visible, allow it to be visible and activated so we are the foreground window. - // This allows the UAC prompt and MSI UI to automatically be activated. - if (BOOTSTRAPPER_DISPLAY_NONE < m_command.display) - { - dwWindowStyle |= WS_VISIBLE; - } - - m_hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, dwWindowStyle, 0, 0, 0, 0, HWND_DESKTOP, NULL, m_hModule, this); - ExitOnNullWithLastError(m_hWnd, hr, "Failed to create window."); - - LExit: - return hr; - } - - // - // DestroyMainWindow - clean up all the window registration. - // - void DestroyMainWindow() - { - if (::IsWindow(m_hWnd)) - { - ::DestroyWindow(m_hWnd); - m_hWnd = NULL; - } - - if (m_fRegistered) - { - ::UnregisterClassW(WIXIUIBA_WINDOW_CLASS, m_hModule); - m_fRegistered = FALSE; - } - } - - // - // 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) - CWixInternalUIBootstrapperApplication* pBA = reinterpret_cast(::GetWindowLongPtrW(hWnd, GWLP_USERDATA)); - - 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 = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); - ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, 0); - ::PostQuitMessage(0); - return lres; - } - - 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_WIXIUIBA_DETECT_PACKAGES: __fallthrough; - case WM_WIXIUIBA_DETECT_FOR_CLEANUP: - pBA->OnDetect(); - return 0; - - case WM_WIXIUIBA_PLAN_PACKAGES: - case WM_WIXIUIBA_PLAN_PACKAGES_FOR_CLEANUP: - pBA->OnPlan(static_cast(lParam)); - return 0; - - case WM_WIXIUIBA_APPLY_PACKAGES: - pBA->OnApply(); - return 0; - } - - return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); - } - - - // - // OnDetect - start the processing of packages. - // - void OnDetect() - { - HRESULT hr = S_OK; - - hr = m_pEngine->Detect(); - BalExitOnFailure(hr, "Failed to start detecting chain."); - - LExit: - if (FAILED(hr)) - { - SetLoadPackageFailure(hr); - } - } - - - // - // OnPlan - plan the detected changes. - // - void OnPlan( - __in BOOTSTRAPPER_ACTION action - ) - { - HRESULT hr = S_OK; - - m_plannedAction = action; - - hr = m_pEngine->Plan(action); - BalExitOnFailure(hr, "Failed to start planning packages."); - - LExit: - if (FAILED(hr)) - { - SetLoadPackageFailure(hr); - } - } - - - // - // OnApply - apply the packages. - // - void OnApply() - { - HRESULT hr = S_OK; - - hr = m_pEngine->Apply(m_hWnd); - BalExitOnFailure(hr, "Failed to start applying packages."); - - LExit: - if (FAILED(hr)) - { - SetLoadPackageFailure(hr); - } - } - - - // - // OnClose - called when the window is trying to be closed. - // - BOOL OnClose() - { - BOOL fClose = FALSE; - - // If we've already applied, just close. - if (m_fApplied) - { - fClose = TRUE; - } - else - { - PromptCancel(m_hWnd, TRUE, NULL, NULL); - - // If we're inside Apply then we never close, we just cancel to let rollback occur. - fClose = !m_fApplying; - } - - return fClose; - } - - - 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 SetLoadPackageFailure( - __in HRESULT hrStatus - ) - { - Assert(FAILED(hrStatus)); - - if (!m_fApplied) - { - m_hrFinal = hrStatus; - m_fFailedToLoadPackage = TRUE; - } - - // Quietly exit. - ::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); - } - - -public: - // - // Constructor - initialize member variables. - // - CWixInternalUIBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __in IBootstrapperEngine* pEngine - ) : CBalBaseBootstrapperApplication(pEngine, 3, 3000) - { - m_hModule = hModule; - m_command = { }; - m_createArgs = { }; - - m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; - - m_Bundle = { }; - m_Conditions = { }; - m_sczConfirmCloseMessage = NULL; - m_sczFailedMessage = NULL; - - m_hUiThread = NULL; - m_fRegistered = FALSE; - m_hWnd = NULL; - - m_hrFinal = S_OK; - - m_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE; - - m_fApplying = FALSE; - m_fApplied = FALSE; - m_fAutomaticRemoval = FALSE; - m_fFailedToLoadPackage = FALSE; - m_pPrereqData = pPrereqData; - - pEngine->AddRef(); - m_pEngine = pEngine; - } - - - // - // Destructor - release member variables. - // - ~CWixInternalUIBootstrapperApplication() - { - ReleaseStr(m_sczFailedMessage); - ReleaseStr(m_sczConfirmCloseMessage); - BalConditionsUninitialize(&m_Conditions); - BalInfoUninitialize(&m_Bundle); - - ReleaseNullObject(m_pEngine); - } - -private: - HMODULE m_hModule; - BOOTSTRAPPER_CREATE_ARGS m_createArgs; - BOOTSTRAPPER_COMMAND m_command; - IBootstrapperEngine* m_pEngine; - BOOTSTRAPPER_ACTION m_plannedAction; - - BAL_INFO_BUNDLE m_Bundle; - BAL_CONDITIONS m_Conditions; - LPWSTR m_sczFailedMessage; - LPWSTR m_sczConfirmCloseMessage; - - HANDLE m_hUiThread; - BOOL m_fRegistered; - HWND m_hWnd; - - HRESULT m_hrFinal; - - BOOTSTRAPPER_APPLY_RESTART m_restartResult; - - BOOL m_fApplying; - BOOL m_fApplied; - BOOL m_fAutomaticRemoval; - BOOL m_fFailedToLoadPackage; - PREQBA_DATA* m_pPrereqData; -}; - - -// -// CreateBootstrapperApplication - creates a new IBootstrapperApplication object. -// -HRESULT CreateBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, - __out IBootstrapperApplication** ppApplication - ) -{ - HRESULT hr = S_OK; - CWixInternalUIBootstrapperApplication* pApplication = NULL; - - pApplication = new CWixInternalUIBootstrapperApplication(hModule, pPrereqData, pEngine); - BalExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new InternalUI bootstrapper application object."); - - hr = pApplication->Initialize(pArgs); - ExitOnFailure(hr, "CWixInternalUIBootstrapperApplication initialization failed."); - - pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; - pResults->pvBootstrapperApplicationProcContext = pApplication; - *ppApplication = pApplication; - pApplication = NULL; - -LExit: - ReleaseObject(pApplication); - return hr; -} - - -void DestroyBootstrapperApplication( - __in IBootstrapperApplication* pApplication, - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __inout BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - CWixInternalUIBootstrapperApplication* pBA = (CWixInternalUIBootstrapperApplication*)pApplication; - pBA->Uninitialize(pArgs, pResults); -} diff --git a/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.h b/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.h deleted file mode 100644 index b0b782dd..00000000 --- a/src/ext/Bal/wixiuiba/WixInternalUIBootstrapperApplication.h +++ /dev/null @@ -1,18 +0,0 @@ -#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 CreateBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, - __out IBootstrapperApplication** ppApplication - ); - -void DestroyBootstrapperApplication( - __in IBootstrapperApplication* pApplication, - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __inout BOOTSTRAPPER_DESTROY_RESULTS* pResults - ); diff --git a/src/ext/Bal/wixiuiba/precomp.h b/src/ext/Bal/wixiuiba/precomp.h index 89ec6eab..cb6730fd 100644 --- a/src/ext/Bal/wixiuiba/precomp.h +++ b/src/ext/Bal/wixiuiba/precomp.h @@ -15,8 +15,9 @@ #include #include -#include -#include +#include +#include + #include #include @@ -24,7 +25,4 @@ #include #include -#include - #include "WixInternalUIBootstrapperApplication.h" -#include "wixiuiba.h" diff --git a/src/ext/Bal/wixiuiba/wixiuiba.cpp b/src/ext/Bal/wixiuiba/wixiuiba.cpp index 3e751893..92261e9b 100644 --- a/src/ext/Bal/wixiuiba/wixiuiba.cpp +++ b/src/ext/Bal/wixiuiba/wixiuiba.cpp @@ -2,191 +2,27 @@ #include "precomp.h" -static INTERNAL_UI_BA_STATE vstate = { }; - - -// internal function declarations - -static HRESULT LoadModulePaths( - __in INTERNAL_UI_BA_STATE* pState - ); -static HRESULT LoadInternalUIBAConfiguration( - __in INTERNAL_UI_BA_STATE* pState, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs - ); -static HRESULT CreatePrerequisiteBA( - __in INTERNAL_UI_BA_STATE* pState, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults - ); - // function definitions -extern "C" BOOL WINAPI DllMain( +EXTERN_C int WINAPI wWinMain( __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; -} - -// 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; - IBootstrapperEngine* pEngine = NULL; - - 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 load the module paths."); - - hr = LoadInternalUIBAConfiguration(&vstate, pArgs); - BalExitOnFailure(hr, "Failed to get the InternalUIBA configuration."); - - vstate.fInitialized = TRUE; - } - - if (vstate.prereqData.fAlwaysInstallPrereqs && !vstate.prereqData.fCompleted || - FAILED(vstate.prereqData.hrFatalError)) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application."); - - hr = CreatePrerequisiteBA(&vstate, pEngine, pArgs, pResults); - BalExitOnFailure(hr, "Failed to create the pre-requisite bootstrapper application."); - } - else - { - hr = CreateBootstrapperApplication(vstate.hInstance, &vstate.prereqData, pEngine, pArgs, pResults, &vstate.pApplication); - BalExitOnFailure(hr, "Failed to create bootstrapper application interface."); - } - -LExit: - ReleaseNullObject(pEngine); - - return hr; -} - -extern "C" void WINAPI BootstrapperApplicationDestroy( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - BOOTSTRAPPER_DESTROY_RESULTS childResults = { }; - - if (vstate.hPrereqModule) - { - PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = reinterpret_cast(::GetProcAddress(vstate.hPrereqModule, "PrereqBootstrapperApplicationDestroy")); - if (pfnDestroy) - { - (*pfnDestroy)(pArgs, &childResults); - } - - ::FreeLibrary(vstate.hPrereqModule); - vstate.hPrereqModule = NULL; - } - - if (vstate.pApplication) - { - DestroyBootstrapperApplication(vstate.pApplication, pArgs, pResults); - ReleaseNullObject(vstate.pApplication); - } - - BalUninitialize(); - - // Need to keep track of state between reloads. - pResults->fDisableUnloading = TRUE; -} - -static HRESULT LoadModulePaths( - __in INTERNAL_UI_BA_STATE* pState - ) -{ - HRESULT hr = S_OK; - LPWSTR sczFullPath = NULL; - - hr = PathForCurrentProcess(&sczFullPath, pState->hInstance); - ExitOnFailure(hr, "Failed to get the full host path."); - - hr = PathGetDirectory(sczFullPath, &pState->sczAppBase); - ExitOnFailure(hr, "Failed to get the directory of the full process path."); - -LExit: - ReleaseStr(sczFullPath); - - return hr; -} - -static HRESULT LoadInternalUIBAConfiguration( - __in INTERNAL_UI_BA_STATE* pState, - __in const BOOTSTRAPPER_CREATE_ARGS* /*pArgs*/ + __in_opt HINSTANCE /* hPrevInstance */, + __in_z_opt LPWSTR /*lpCmdLine*/, + __in int /*nCmdShow*/ ) { HRESULT hr = S_OK; + IBootstrapperApplication* pApplication = NULL; - pState->prereqData.fAlwaysInstallPrereqs = TRUE; - pState->prereqData.fPerformHelp = TRUE; - pState->prereqData.fPerformLayout = TRUE; - - return hr; -} - -static HRESULT CreatePrerequisiteBA( - __in INTERNAL_UI_BA_STATE* pState, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults - ) -{ - HRESULT hr = S_OK; - LPWSTR sczPrereqPath = NULL; - HMODULE hModule = NULL; - - hr = PathConcat(pState->sczAppBase, L"prereqba.dll", &sczPrereqPath); - BalExitOnFailure(hr, "Failed to get path to pre-requisite BA."); - - hModule = ::LoadLibraryExW(sczPrereqPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - ExitOnNullWithLastError(hModule, hr, "Failed to load pre-requisite BA DLL."); - - PFN_PREQ_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = reinterpret_cast(::GetProcAddress(hModule, "PrereqBootstrapperApplicationCreate")); - ExitOnNullWithLastError(pfnCreate, hr, "Failed to get PrereqBootstrapperApplicationCreate entry-point from: %ls", sczPrereqPath); - - hr = pfnCreate(&pState->prereqData, pEngine, pArgs, pResults); - ExitOnFailure(hr, "Failed to create prequisite bootstrapper app."); + hr = CreateWixInternalUIBootstrapperApplication(hInstance, &pApplication); + ExitOnFailure(hr, "Failed to create WiX internal UI bootstrapper application."); - pState->hPrereqModule = hModule; - hModule = NULL; + hr = BootstrapperApplicationRun(pApplication); + ExitOnFailure(hr, "Failed to run WiX internal UI bootstrapper application."); LExit: - if (hModule) - { - ::FreeLibrary(hModule); - } - ReleaseStr(sczPrereqPath); + ReleaseObject(pApplication); - return hr; + return 0; } diff --git a/src/ext/Bal/wixiuiba/wixiuiba.def b/src/ext/Bal/wixiuiba/wixiuiba.def deleted file mode 100644 index 4488df94..00000000 --- a/src/ext/Bal/wixiuiba/wixiuiba.def +++ /dev/null @@ -1,6 +0,0 @@ -; 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/wixiuiba/wixiuiba.h b/src/ext/Bal/wixiuiba/wixiuiba.h deleted file mode 100644 index 76077f42..00000000 --- a/src/ext/Bal/wixiuiba/wixiuiba.h +++ /dev/null @@ -1,13 +0,0 @@ -#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. - - -struct INTERNAL_UI_BA_STATE -{ - BOOL fInitialized; - HINSTANCE hInstance; - LPWSTR sczAppBase; - HMODULE hPrereqModule; - PREQBA_DATA prereqData; - IBootstrapperApplication* pApplication; -}; diff --git a/src/ext/Bal/wixiuiba/wixiuiba.rc b/src/ext/Bal/wixiuiba/wixiuiba.rc new file mode 100644 index 00000000..a029458e --- /dev/null +++ b/src/ext/Bal/wixiuiba/wixiuiba.rc @@ -0,0 +1 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. diff --git a/src/ext/Bal/wixiuiba/wixiuiba.vcxproj b/src/ext/Bal/wixiuiba/wixiuiba.vcxproj index 29c7cb50..6b20db30 100644 --- a/src/ext/Bal/wixiuiba/wixiuiba.vcxproj +++ b/src/ext/Bal/wixiuiba/wixiuiba.vcxproj @@ -1,7 +1,7 @@ - + Debug @@ -31,39 +31,58 @@ {0F73E566-925C-448D-99CB-3A7F5DF399C8} - DynamicLibrary + Win32Proj + Application + Windows Unicode - wixiuiba - wixiuiba.def + WiX Internal UI Bootstrapper Application + + + + + + - ..\wixstdba\inc - shlwapi.lib + $(ProjectDir)..\stdbas\inc + stdbas.res + + + version.dll + /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions) + + + + + + + Create - + - - - + + + - + + {DBBF5F32-BAEA-46A8-99A0-17277A906456} + - diff --git a/src/ext/Bal/wixlib/BalExtension_arm64.wxs b/src/ext/Bal/wixlib/BalExtension_arm64.wxs deleted file mode 100644 index 9a1ca60c..00000000 --- a/src/ext/Bal/wixlib/BalExtension_arm64.wxs +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/ext/Bal/wixlib/BalExtension_platform.wxi b/src/ext/Bal/wixlib/BalExtension_platform.wxi deleted file mode 100644 index bb922317..00000000 --- a/src/ext/Bal/wixlib/BalExtension_platform.wxi +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixlib/BalExtension_x64.wxs b/src/ext/Bal/wixlib/BalExtension_x64.wxs deleted file mode 100644 index e5252718..00000000 --- a/src/ext/Bal/wixlib/BalExtension_x64.wxs +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/ext/Bal/wixlib/BalExtension_x86.wxs b/src/ext/Bal/wixlib/BalExtension_x86.wxs deleted file mode 100644 index 1045160d..00000000 --- a/src/ext/Bal/wixlib/BalExtension_x86.wxs +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/ext/Bal/wixlib/Dnc.wxs b/src/ext/Bal/wixlib/Dnc.wxs deleted file mode 100644 index 242bb30e..00000000 --- a/src/ext/Bal/wixlib/Dnc.wxs +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixlib/Mba.wxs b/src/ext/Bal/wixlib/Mba.wxs deleted file mode 100644 index 2d407c88..00000000 --- a/src/ext/Bal/wixlib/Mba.wxs +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixlib/Mbahost_platform.wxi b/src/ext/Bal/wixlib/Mbahost_platform.wxi deleted file mode 100644 index 3ea7840f..00000000 --- a/src/ext/Bal/wixlib/Mbahost_platform.wxi +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixlib/bal.wixproj b/src/ext/Bal/wixlib/bal.wixproj index 9e1b111a..31369115 100644 --- a/src/ext/Bal/wixlib/bal.wixproj +++ b/src/ext/Bal/wixlib/bal.wixproj @@ -7,14 +7,13 @@ - + - - + diff --git a/src/ext/Bal/wixlib/bal_arm64.wxs b/src/ext/Bal/wixlib/bal_arm64.wxs new file mode 100644 index 00000000..4ddbfc47 --- /dev/null +++ b/src/ext/Bal/wixlib/bal_arm64.wxs @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ext/Bal/wixlib/bal_platform.wxi b/src/ext/Bal/wixlib/bal_platform.wxi new file mode 100644 index 00000000..af58f4c3 --- /dev/null +++ b/src/ext/Bal/wixlib/bal_platform.wxi @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Bal/wixlib/bal_x64.wxs b/src/ext/Bal/wixlib/bal_x64.wxs new file mode 100644 index 00000000..f2c62418 --- /dev/null +++ b/src/ext/Bal/wixlib/bal_x64.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/wixlib/bal_x86.wxs b/src/ext/Bal/wixlib/bal_x86.wxs new file mode 100644 index 00000000..e00115b2 --- /dev/null +++ b/src/ext/Bal/wixlib/bal_x86.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Bal/wixlib/wixiuiba.wxs b/src/ext/Bal/wixlib/wixiuiba.wxs index 5501a23f..a7885ffb 100644 --- a/src/ext/Bal/wixlib/wixiuiba.wxs +++ b/src/ext/Bal/wixlib/wixiuiba.wxs @@ -4,9 +4,9 @@ - - - + + + diff --git a/src/ext/Bal/wixlib/wixprqba.wxs b/src/ext/Bal/wixlib/wixprqba.wxs new file mode 100644 index 00000000..72b92f1f --- /dev/null +++ b/src/ext/Bal/wixlib/wixprqba.wxs @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/src/ext/Bal/wixprqba/precomp.cpp b/src/ext/Bal/wixprqba/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/wixprqba/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/wixprqba/precomp.h b/src/ext/Bal/wixprqba/precomp.h new file mode 100644 index 00000000..8844d150 --- /dev/null +++ b/src/ext/Bal/wixprqba/precomp.h @@ -0,0 +1,47 @@ +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include "WixStandardBootstrapperApplication.h" diff --git a/src/ext/Bal/wixprqba/wixprqba.cpp b/src/ext/Bal/wixprqba/wixprqba.cpp new file mode 100644 index 00000000..c6e5dfef --- /dev/null +++ b/src/ext/Bal/wixprqba/wixprqba.cpp @@ -0,0 +1,25 @@ +// 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" + +EXTERN_C int WINAPI wWinMain( + __in HINSTANCE hInstance, + __in_opt HINSTANCE /* hPrevInstance */, + __in_z_opt LPWSTR /*lpCmdLine*/, + __in int /*nCmdShow*/ + ) +{ + HRESULT hr = S_OK; + IBootstrapperApplication* pApplication = NULL; + + hr = CreateWixPrerequisiteBootstrapperApplication(hInstance, &pApplication); + ExitOnFailure(hr, "Failed to create WiX prerequisite bootstrapper application."); + + hr = BootstrapperApplicationRun(pApplication); + ExitOnFailure(hr, "Failed to run WiX prerequisite bootstrapper application."); + +LExit: + ReleaseObject(pApplication); + + return 0; +} diff --git a/src/ext/Bal/wixprqba/wixprqba.rc b/src/ext/Bal/wixprqba/wixprqba.rc new file mode 100644 index 00000000..a029458e --- /dev/null +++ b/src/ext/Bal/wixprqba/wixprqba.rc @@ -0,0 +1 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. diff --git a/src/ext/Bal/wixprqba/wixprqba.vcxproj b/src/ext/Bal/wixprqba/wixprqba.vcxproj new file mode 100644 index 00000000..b992fe14 --- /dev/null +++ b/src/ext/Bal/wixprqba/wixprqba.vcxproj @@ -0,0 +1,90 @@ + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {662B4347-1BC1-4042-B628-EC92B1158F4F} + Win32Proj + Application + Windows + Unicode + WiX Prerequisite Bootstrapper Application + + + + + + + + + + + + + $(ProjectDir)..\stdbas\inc + comctl32.lib;gdiplus.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;stdbas.res + + + + + comctl32.dll;gdiplus.dll;shlwapi.dll;version.dll;wininet.dll + /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions) + + + + + + + + + + Create + + + + + + + + + + + + {DBBF5F32-BAEA-46A8-99A0-17277A906456} + + + + + + + + + + diff --git a/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl deleted file mode 100644 index 1ab287e4..00000000 --- a/src/ext/Bal/wixstdba/Resources/1028/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl deleted file mode 100644 index e60c92cb..00000000 --- a/src/ext/Bal/wixstdba/Resources/1029/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl deleted file mode 100644 index b895bb76..00000000 --- a/src/ext/Bal/wixstdba/Resources/1030/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl deleted file mode 100644 index 760b1ceb..00000000 --- a/src/ext/Bal/wixstdba/Resources/1031/mbapreq.wxl +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl deleted file mode 100644 index a9cd7a5b..00000000 --- a/src/ext/Bal/wixstdba/Resources/1032/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl deleted file mode 100644 index b54476bd..00000000 --- a/src/ext/Bal/wixstdba/Resources/1035/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl deleted file mode 100644 index cd17ae34..00000000 --- a/src/ext/Bal/wixstdba/Resources/1036/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl deleted file mode 100644 index 6cbb1d34..00000000 --- a/src/ext/Bal/wixstdba/Resources/1038/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl deleted file mode 100644 index 66940e85..00000000 --- a/src/ext/Bal/wixstdba/Resources/1040/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl deleted file mode 100644 index c830072e..00000000 --- a/src/ext/Bal/wixstdba/Resources/1041/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl deleted file mode 100644 index df6e9b31..00000000 --- a/src/ext/Bal/wixstdba/Resources/1042/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl deleted file mode 100644 index c9d7b8e4..00000000 --- a/src/ext/Bal/wixstdba/Resources/1043/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl deleted file mode 100644 index 9a5f8ea1..00000000 --- a/src/ext/Bal/wixstdba/Resources/1044/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl deleted file mode 100644 index f7d0de6a..00000000 --- a/src/ext/Bal/wixstdba/Resources/1045/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl deleted file mode 100644 index dc8d22d1..00000000 --- a/src/ext/Bal/wixstdba/Resources/1046/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl deleted file mode 100644 index 0614da9e..00000000 --- a/src/ext/Bal/wixstdba/Resources/1049/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl deleted file mode 100644 index 0dd75159..00000000 --- a/src/ext/Bal/wixstdba/Resources/1051/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl deleted file mode 100644 index 068f5519..00000000 --- a/src/ext/Bal/wixstdba/Resources/1053/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl deleted file mode 100644 index f4d98354..00000000 --- a/src/ext/Bal/wixstdba/Resources/1055/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl deleted file mode 100644 index d24231db..00000000 --- a/src/ext/Bal/wixstdba/Resources/1060/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl deleted file mode 100644 index 43ed19fe..00000000 --- a/src/ext/Bal/wixstdba/Resources/2052/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl deleted file mode 100644 index 1e57ec2f..00000000 --- a/src/ext/Bal/wixstdba/Resources/2070/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl b/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl deleted file mode 100644 index cd835913..00000000 --- a/src/ext/Bal/wixstdba/Resources/3082/mbapreq.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml b/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml deleted file mode 100644 index 6e7b69ee..00000000 --- a/src/ext/Bal/wixstdba/Resources/HyperlinkLargeTheme.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 59a03ad0..00000000 --- a/src/ext/Bal/wixstdba/Resources/HyperlinkSidebarTheme.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 24e7b728..00000000 --- a/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml b/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml deleted file mode 100644 index c82e1b9f..00000000 --- a/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 1a183236..00000000 Binary files a/src/ext/Bal/wixstdba/Resources/LoremIpsumLicense.rtf and /dev/null differ diff --git a/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml b/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml deleted file mode 100644 index b30fe3cd..00000000 --- a/src/ext/Bal/wixstdba/Resources/RtfLargeTheme.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - 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 deleted file mode 100644 index a827d1a9..00000000 --- a/src/ext/Bal/wixstdba/Resources/RtfTheme.wxl +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/RtfTheme.xml b/src/ext/Bal/wixstdba/Resources/RtfTheme.xml deleted file mode 100644 index e1a486c8..00000000 --- a/src/ext/Bal/wixstdba/Resources/RtfTheme.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - 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 deleted file mode 100644 index fda84004..00000000 --- a/src/ext/Bal/wixstdba/Resources/dncpreq.thm +++ /dev/null @@ -1,60 +0,0 @@ - - - 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 deleted file mode 100644 index 42c8fa63..00000000 --- a/src/ext/Bal/wixstdba/Resources/dncpreq.wxl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/iuipreq.thm b/src/ext/Bal/wixstdba/Resources/iuipreq.thm deleted file mode 100644 index 5429b3d2..00000000 --- a/src/ext/Bal/wixstdba/Resources/iuipreq.thm +++ /dev/null @@ -1,67 +0,0 @@ - - - Segoe UI - Segoe UI - Segoe UI - Segoe UI - - - - - - - - - - - - #(loc.InstallLicenseTerms) - - - - - - - - - - - - - - - - - - - #(loc.FailureLogLinkText) - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/iuipreq.wxl b/src/ext/Bal/wixstdba/Resources/iuipreq.wxl deleted file mode 100644 index fb3d0cc2..00000000 --- a/src/ext/Bal/wixstdba/Resources/iuipreq.wxl +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/Resources/logo.png b/src/ext/Bal/wixstdba/Resources/logo.png deleted file mode 100644 index 7adc6e11..00000000 Binary files a/src/ext/Bal/wixstdba/Resources/logo.png and /dev/null differ diff --git a/src/ext/Bal/wixstdba/Resources/logoSide.png b/src/ext/Bal/wixstdba/Resources/logoSide.png deleted file mode 100644 index 308841c5..00000000 Binary files a/src/ext/Bal/wixstdba/Resources/logoSide.png and /dev/null differ diff --git a/src/ext/Bal/wixstdba/Resources/mbapreq.png b/src/ext/Bal/wixstdba/Resources/mbapreq.png deleted file mode 100644 index c6e9527b..00000000 Binary files a/src/ext/Bal/wixstdba/Resources/mbapreq.png and /dev/null differ diff --git a/src/ext/Bal/wixstdba/Resources/mbapreq.thm b/src/ext/Bal/wixstdba/Resources/mbapreq.thm deleted file mode 100644 index fda84004..00000000 --- a/src/ext/Bal/wixstdba/Resources/mbapreq.thm +++ /dev/null @@ -1,60 +0,0 @@ - - - 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 deleted file mode 100644 index c7df9ec8..00000000 --- a/src/ext/Bal/wixstdba/Resources/mbapreq.wxl +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp deleted file mode 100644 index e4eee002..00000000 --- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp +++ /dev/null @@ -1,5372 +0,0 @@ -// 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_CANRESTART = L"WixCanRestart"; -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"; -static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable"; - -enum WIXSTDBA_STATE -{ - WIXSTDBA_STATE_INITIALIZING, - WIXSTDBA_STATE_INITIALIZED, - WIXSTDBA_STATE_HELP, - WIXSTDBA_STATE_DETECTING, - WIXSTDBA_STATE_DETECTED, - WIXSTDBA_STATE_PLANNING_PREREQS, - WIXSTDBA_STATE_PLANNED_PREREQS, - 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, - WM_WIXSTDBA_PLAN_PREREQS, -}; - -// 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", -}; - -// The range [0, 100) is unused to avoid collisions with system ids, -// the range [100, 0x4000) is unused to avoid collisions with thmutil, -// the range [0x4000, 0x8000) is unused to avoid collisions with BAFunctions. -const WORD WIXSTDBA_FIRST_ASSIGN_CONTROL_ID = 0x8000; - -enum WIXSTDBA_CONTROL -{ - // Welcome page - WIXSTDBA_CONTROL_INSTALL_BUTTON = WIXSTDBA_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, - - // Updates - WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL, - WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON, - WIXSTDBA_CONTROL_MODIFY_UPDATE_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, - - LAST_WIXSTDBA_CONTROL, -}; - - -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 LoggingBoolToString( - __in BOOL f - ); -static LPCSTR LoggingRequestStateToString( - __in BOOTSTRAPPER_REQUEST_STATE requestState - ); -static LPCSTR LoggingPlanRelationTypeToString( - __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE type - ); -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) - { - BalExitWithLastError(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_fShouldRestart && m_fAllowRestart) - { - *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART; - } - - if (m_fPrereq) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART == *pAction - ? "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 || m_fPrereqSkipped) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, m_fPrereqInstalled - ? "The prerequisites were successfully installed. The bootstrapper application will be reloaded." - : "The prerequisites were already installed. The bootstrapper application will be reloaded."); - *pAction = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER; - m_pPrereqData->fCompleted = TRUE; - } - 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 OnDetectBegin( - __in BOOL fCached, - __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, - __in DWORD cPackages, - __inout BOOL* pfCancel - ) - { - HRESULT hr = S_OK; - BOOL fInstalled = BOOTSTRAPPER_REGISTRATION_TYPE_FULL == registrationType; - - if (m_fPrereq) - { - if (m_pPrereqData->fPerformLayout && BOOTSTRAPPER_ACTION_LAYOUT == m_command.action) - { - // The parent BA has requested that this BA be in charge of layout. - m_fPrereq = FALSE; - } - else - { - m_fPreplanPrereqs = m_pPrereqData->fAlwaysInstallPrereqs; - - // Pre-req BA should only show help or do an install (to launch the parent BA which can then do the right action). - if (BOOTSTRAPPER_ACTION_HELP != m_command.action) - { - m_command.action = BOOTSTRAPPER_ACTION_INSTALL; - } - } - } - else if (BOOTSTRAPPER_DISPLAY_FULL <= m_command.display) // only modify the action state if showing full UI. - { - // Maybe modify the action state if the bundle is or is not already installed. - if (fInstalled && BOOTSTRAPPER_RESUME_TYPE_REBOOT != m_command.resumeType && BOOTSTRAPPER_ACTION_INSTALL == m_command.action) - { - m_command.action = BOOTSTRAPPER_ACTION_MODIFY; - } - else if (!fInstalled && (BOOTSTRAPPER_ACTION_MODIFY == m_command.action || BOOTSTRAPPER_ACTION_REPAIR == m_command.action)) - { - m_command.action = BOOTSTRAPPER_ACTION_INSTALL; - } - } - - // 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. - 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. - hr = BalGetStringVariable(L"WixBundleForcedRestartPackage", &m_sczAfterForcedRestartPackage); - if (FAILED(hr) || !m_sczAfterForcedRestartPackage || !*m_sczAfterForcedRestartPackage) - { - ReleaseNullStr(m_sczAfterForcedRestartPackage); - } - - hr = S_OK; - } - - if (!m_fPreplanPrereqs) - { - // 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 __super::OnDetectBegin(fCached, registrationType, cPackages, pfCancel); - } - - virtual STDMETHODIMP OnDetectRelatedBundle( - __in LPCWSTR wzBundleId, - __in BOOTSTRAPPER_RELATION_TYPE relationType, - __in LPCWSTR wzBundleTag, - __in BOOL fPerMachine, - __in LPCWSTR wzVersion, - __in BOOL fMissingFromCache, - __inout BOOL* pfCancel - ) - { - BAL_INFO_PACKAGE* pPackage = NULL; - - if (!fMissingFromCache) - { - BalInfoAddRelatedBundleAsPackage(&m_Bundle.packages, wzBundleId, relationType, fPerMachine, &pPackage); - // Best effort - } - - if (BOOTSTRAPPER_ACTION_INSTALL == m_command.action && BOOTSTRAPPER_RELATION_UPGRADE != m_command.relationType && BOOTSTRAPPER_RELATION_UPGRADE == relationType) - { - int nResult = 0; - HRESULT hr = VerCompareStringVersions(m_sczBundleVersion, wzVersion, TRUE/*fStrict*/, &nResult); - BalExitOnFailure(hr, "Failed to compare bundle version: %ls to related bundle version: %ls.", m_sczBundleVersion, wzVersion); - - if (0 > nResult) - { - m_fDowngrading = TRUE; - - BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Related bundle version: %ls is a downgrade for bundle version: %ls.", wzVersion, m_sczBundleVersion); - } - } - - LExit: - return CBalBaseBootstrapperApplication::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel); - } - - - virtual STDMETHODIMP OnDetectUpdateBegin( - __in_z LPCWSTR wzUpdateLocation, - __inout BOOL* pfCancel, - __inout BOOL* pfSkip - ) - { -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnDetectUpdateBegin() - update location: %ls", wzUpdateLocation); -#endif - - // Try update detection only if we have a potential update source and are in full UI mode. - *pfSkip = !wzUpdateLocation - || !*wzUpdateLocation - || BOOTSTRAPPER_DISPLAY_FULL != m_command.display; - - ThemeShowControl(m_pControlCheckingForUpdatesLabel, *pfSkip ? SW_HIDE : SW_SHOW); - - return __super::OnDetectUpdateBegin(wzUpdateLocation, pfCancel, pfSkip); - } - - - virtual STDMETHODIMP OnDetectUpdate( - __in_z LPCWSTR wzUpdateLocation, - __in DWORD64 dw64Size, - __in_z_opt LPCWSTR wzHash, - __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm, - __in LPCWSTR wzUpdateVersion, - __in_z LPCWSTR wzTitle, - __in_z LPCWSTR wzSummary, - __in_z LPCWSTR wzContentType, - __in_z LPCWSTR wzContent, - __inout BOOL* pfCancel, - __inout BOOL* pfStopProcessingUpdates - ) - { -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnDetectUpdate() - update location: %ls, version: %ls", wzUpdateLocation, wzUpdateVersion); -#endif - - HRESULT hr = S_OK; - int nResult = 0; - - hr = VerCompareStringVersions(m_sczBundleVersion, wzUpdateVersion, TRUE/*fStrict*/, &nResult); - BalExitOnFailure(hr, "Failed to compare bundle version: %ls to update version: %ls.", m_sczBundleVersion, wzUpdateVersion); - - // Burn sends the feed in descending version order so we need only the first one. - *pfStopProcessingUpdates = TRUE; - - if (0 <= nResult) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "WIXSTDBA: Update version: %ls is a match or downgrade for bundle version: %ls.", wzUpdateVersion, m_sczBundleVersion); - } - else - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: Update v%ls for bundle v%ls available from: %ls.", wzUpdateVersion, m_sczBundleVersion, wzUpdateLocation); - - hr = BalSetVersionVariable(WIXSTDBA_VARIABLE_UPDATE_AVAILABLE, wzUpdateVersion); - BalExitOnFailure(hr, "Failed to set WixStdBAUpdateAvailable value: %ls.", wzUpdateVersion); - - hr = m_pEngine->SetUpdate(NULL, wzUpdateLocation, dw64Size, hashAlgorithm, wzHash); - BalExitOnFailure(hr, "Failed to set update location: %ls.", wzUpdateLocation); - } - - LExit: - return __super::OnDetectUpdate(wzUpdateLocation, dw64Size, wzHash, hashAlgorithm, wzUpdateVersion, wzTitle, wzSummary, wzContentType, wzContent, pfCancel, pfStopProcessingUpdates); - } - - - virtual STDMETHODIMP OnDetectUpdateComplete( - __in HRESULT /*hrStatus*/, - __inout BOOL* pfIgnoreError - ) - { - // A failed update is very sad indeed, but shouldn't be fatal. - *pfIgnoreError = TRUE; - - return S_OK; - } - - virtual STDMETHODIMP OnDetectComplete( - __in HRESULT hrStatus, - __in BOOL /*fEligibleForCleanup*/ - ) - { - HRESULT hr = S_OK; - - if (m_fSuppressDowngradeFailure && m_fDowngrading) - { - SetState(WIXSTDBA_STATE_APPLIED, hrStatus); - - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Bundle downgrade was attempted but downgrade failure has been suppressed."); - - ExitFunction(); - } - - // 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(); - } - - SetState(WIXSTDBA_STATE_DETECTED, hrStatus); - - if (SUCCEEDED(hrStatus)) - { - if (m_fPreplanPrereqs) - { - ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PREREQS, 0, BOOTSTRAPPER_ACTION_INSTALL); - } - else if (fSkipToPlan) - { - ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PACKAGES, 0, m_command.action); - } - } - - LExit: - return hr; - } - - - virtual STDMETHODIMP OnPlanBegin( - __in DWORD cPackages, - __in BOOL* pfCancel - ) - { - m_fPrereqPackagePlanned = FALSE; - - return __super::OnPlanBegin(cPackages, pfCancel); - } - - - virtual STDMETHODIMP OnPlanRelatedBundleType( - __in_z LPCWSTR wzBundleId, - __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE recommendedType, - __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType, - __inout BOOL* pfCancel - ) - { - // If we're only installing prerequisites, do not touch related bundles. - if (m_fPrereq) - { - *pRequestedType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE; - } - - return CBalBaseBootstrapperApplication::OnPlanRelatedBundleType(wzBundleId, recommendedType, pRequestedType, pfCancel); - } - - - virtual STDMETHODIMP OnPlanPackageBegin( - __in_z LPCWSTR wzPackageId, - __in BOOTSTRAPPER_PACKAGE_STATE state, - __in BOOL fCached, - __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, - __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, - __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; - 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 = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); - if (SUCCEEDED(hr) && pPackage->fPrereqPackage) - { - 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, repairCondition, recommendedState, recommendedCacheType, pRequestState, pRequestedCacheType, pfCancel); - } - - - virtual STDMETHODIMP OnPlanMsiPackage( - __in_z LPCWSTR wzPackageId, - __in BOOL fExecute, - __in BOOTSTRAPPER_ACTION_STATE action, - __in BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, - __inout BOOL* pfCancel, - __inout BURN_MSI_PROPERTY* pActionMsiProperty, - __inout INSTALLUILEVEL* pUiLevel, - __inout BOOL* pfDisableExternalUiHandler, - __inout BOOTSTRAPPER_MSI_FILE_VERSIONING* pFileVersioning - ) - { - HRESULT hr = S_OK; - 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 = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &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, recommendedFileVersioning, pfCancel, pActionMsiProperty, pUiLevel, pfDisableExternalUiHandler, pFileVersioning); - } - - - virtual STDMETHODIMP OnPlannedPackage( - __in_z LPCWSTR wzPackageId, - __in BOOTSTRAPPER_ACTION_STATE execute, - __in BOOTSTRAPPER_ACTION_STATE rollback, - __in BOOL fPlannedCache, - __in BOOL fPlannedUncache - ) - { - if (m_fPrereq && BOOTSTRAPPER_ACTION_STATE_NONE != execute) - { - m_fPrereqPackagePlanned = TRUE; - } - - return __super::OnPlannedPackage(wzPackageId, execute, rollback, fPlannedCache, fPlannedUncache); - } - - - virtual STDMETHODIMP OnPlanComplete( - __in HRESULT hrStatus - ) - { - HRESULT hr = S_OK; - BOOL fPreplannedPrereqs = WIXSTDBA_STATE_PLANNING_PREREQS == m_state; - WIXSTDBA_STATE completedState = WIXSTDBA_STATE_PLANNED; - BOOL fApply = TRUE; - - if (fPreplannedPrereqs) - { - if (SUCCEEDED(hrStatus) && !m_fPrereqPackagePlanned) - { - // Nothing to do, so close and let the parent BA take over. - m_fPrereqSkipped = TRUE; - SetState(WIXSTDBA_STATE_APPLIED, S_OK); - ExitFunction(); - } - else if (BOOTSTRAPPER_ACTION_HELP == m_command.action) - { - // If prereq packages were planned then the managed BA probably can't be loaded, so show the help from this BA. - - // Need to force the state change since normally moving backwards is prevented. - ::PostMessageW(m_hWnd, WM_WIXSTDBA_CHANGE_STATE, 0, WIXSTDBA_STATE_HELP); - - ::PostMessageW(m_hWnd, WM_WIXSTDBA_SHOW_HELP, 0, 0); - - ExitFunction(); - } - - completedState = WIXSTDBA_STATE_PLANNED_PREREQS; - } - - SetState(completedState, hrStatus); - - if (FAILED(hrStatus)) - { - ExitFunction(); - } - - if (fPreplannedPrereqs) - { - // 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(); - - fApply = BOOTSTRAPPER_DISPLAY_FULL > m_command.display || - BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_command.resumeType; - } - - if (fApply) - { - ::PostMessageW(m_hWnd, WM_WIXSTDBA_APPLY_PACKAGES, 0, 0); - } - - LExit: - return hr; - } - - - virtual STDMETHODIMP OnApplyBegin( - __in DWORD dwPhaseCount, - __in BOOL* pfCancel - ) - { - m_fStartedExecution = FALSE; - m_dwCalculatedCacheProgress = 0; - m_dwCalculatedExecuteProgress = 0; - m_nLastMsiFilesInUseResult = IDNOACTION; - m_nLastNetfxFilesInUseResult = IDNOACTION; - - return __super::OnApplyBegin(dwPhaseCount, pfCancel); - } - - - 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_pControlOverallProgressPackageText, 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_pControlOverallProgressPackageText, wz); - - ReleaseStr(sczFormattedString); - return hr; - } - - - virtual STDMETHODIMP OnCachePackageBegin( - __in_z LPCWSTR wzPackageId, - __in DWORD cCachePayloads, - __in DWORD64 dw64PackageCacheSize, - __in BOOL fVital, - __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_pControlCacheProgressPackageText, wz); - - // If something started executing, leave it in the overall progress text. - if (!m_fStartedExecution) - { - ThemeSetTextControl(m_pControlOverallProgressPackageText, wz); - } - } - - return __super::OnCachePackageBegin(wzPackageId, cCachePayloads, dw64PackageCacheSize, fVital, 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_pControlCacheProgressPackageText, 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 - ) - { -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, code: %d, ui hint: %d, message: %ls", wzPackageId, dwCode, dwUIHint, wzError); -#endif - - 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) - { - 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; - -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, hr: 0x%0x, result: %d", wzPackageId, hr, nResult); -#endif - - return FAILED(hr) ? hr : __super::OnError(errorType, wzPackageId, dwCode, wzError, dwUIHint, cData, rgwzData, nRecommendation, pResult); - } - - - 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); - - *pResult = nResult; - - return __super::OnExecuteMsiMessage(wzPackageId, messageType, dwUIHint, wzMessage, cData, rgwzData, nRecommendation, pResult); - } - } - - if (INSTALLMESSAGE_ACTIONSTART == messageType) - { - ThemeSetTextControl(m_pControlExecuteProgressActionDataText, 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_pControlOverallProgressText, wzProgress); - - ThemeSetProgressControl(m_pControlOverallProgressbar, 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_pControlExecuteProgressPackageText, wz); - ThemeSetTextControl(m_pControlOverallProgressPackageText, 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_pControlExecuteProgressText, wzProgress); - - ThemeSetProgressControl(m_pControlExecuteProgressbar, dwOverallProgressPercentage); - - m_dwCalculatedExecuteProgress = dwOverallProgressPercentage * (100 - WIXSTDBA_ACQUIRE_PERCENTAGE) / 100; - ThemeSetProgressControl(m_pControlOverallCalculatedProgressbar, m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); - - SetTaskbarButtonProgress(m_dwCalculatedCacheProgress + m_dwCalculatedExecuteProgress); - - return __super::OnExecuteProgress(wzPackageId, dwProgressPercentage, dwOverallProgressPercentage, pfCancel); - } - - - virtual STDMETHODIMP OnExecuteFilesInUse( - __in_z LPCWSTR wzPackageId, - __in DWORD cFiles, - __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, - __in int nRecommendation, - __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, - __inout int* pResult - ) - { - - if (!m_fShowingInternalUiThisPackage && wzPackageId && *wzPackageId) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "Package %ls has %d applications holding files in use.", wzPackageId, cFiles); - - switch (source) - { - case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI: - if (m_fShowStandardFilesInUse) - { - return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); - } - break; - case BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM: - if (m_fShowRMFilesInUse) - { - return ShowMsiFilesInUse(cFiles, rgwzFiles, source, pResult); - } - break; - case BOOTSTRAPPER_FILES_IN_USE_TYPE_NETFX: - if (m_fShowNetfxFilesInUse) - { - return ShowNetfxFilesInUse(cFiles, rgwzFiles, pResult); - } - break; - } - } - - return __super::OnExecuteFilesInUse(wzPackageId, cFiles, rgwzFiles, nRecommendation, source, pResult); - } - - - 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); - - if (m_fPrereq && BOOTSTRAPPER_APPLY_RESTART_NONE != restart) - { - BAL_INFO_PACKAGE* pPackage = NULL; - HRESULT hrPrereq = BalInfoFindPackageById(&m_Bundle.packages, wzPackageId, &pPackage); - - // 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 (SUCCEEDED(hrPrereq) && pPackage->fPrereqPackage) - { - *pAction = BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART; - } - } - - return hr; - } - - - virtual STDMETHODIMP OnExecuteComplete( - __in HRESULT hrStatus - ) - { - HRESULT hr = S_OK; - - ThemeSetTextControl(m_pControlExecuteProgressPackageText, L""); - ThemeSetTextControl(m_pControlExecuteProgressActionDataText, L""); - ThemeSetTextControl(m_pControlOverallProgressPackageText, L""); - ThemeControlEnable(m_pControlProgressCancelButton, 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; - LPWSTR sczPath = NULL; - - if (BOOTSTRAPPER_CACHE_RESOLVE_NONE == *pAction && BOOTSTRAPPER_DISPLAY_FULL == m_command.display) // prompt to change the source location. - { - static COMDLG_FILTERSPEC vrgFilters[] = - { - { L"All Files", L"*.*" }, - }; - - hr = WnduShowOpenFileDialog(m_hWnd, TRUE, TRUE, m_pTheme->sczCaption, vrgFilters, countof(vrgFilters), 1, rgSearchPaths[dwRecommendedSearchPath], &sczPath); - if (SUCCEEDED(hr)) - { - hr = m_pEngine->SetLocalSource(wzPackageOrContainerId, wzPayloadId, sczPath); - *pAction = BOOTSTRAPPER_CACHE_RESOLVE_RETRY; - } - else - { - *pfCancel = TRUE; - } - } - // else there's nothing more we can do in non-interactive mode - - *pfCancel |= CheckCanceled(); - - ReleaseStr(sczPath); - - 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. - m_fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_NONE != restart; - BalSetStringVariable(WIXSTDBA_VARIABLE_RESTART_REQUIRED, m_fRestartRequired ? L"1" : NULL, FALSE); - - m_fShouldRestart = m_fRestartRequired && BAL_INFO_RESTART_NEVER < m_BalInfoCommand.restart; - - // Automatically restart if we're not displaying a UI or the command line said to always allow restarts. - m_fAllowRestart = m_fShouldRestart && (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || BAL_INFO_RESTART_PROMPT < m_BalInfoCommand.restart); - - if (m_fPrereq) - { - m_fPrereqInstalled = SUCCEEDED(hrStatus); - } - - // 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 OnSetUpdateComplete( - __in HRESULT hrStatus, - __in_z_opt LPCWSTR wzPreviousPackageId, - __in_z_opt LPCWSTR wzNewPackageId - ) - { - BAL_INFO_PACKAGE* pPackage = NULL; - - if (SUCCEEDED(hrStatus) && wzNewPackageId) - { - BalInfoAddUpdateBundleAsPackage(&m_Bundle.packages, wzNewPackageId, wzPreviousPackageId, &pPackage); - // Best effort - } - - return S_OK; - } - - - virtual STDMETHODIMP OnElevateComplete( - __in HRESULT hrStatus - ) - { - if (m_fElevatingForRestart) - { - m_fElevatingForRestart = FALSE; - - if (SUCCEEDED(hrStatus)) - { - m_fAllowRestart = TRUE; - - ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); - } - // else if failed then OnError showed the user an error message box - } - - return __super::OnElevateComplete(hrStatus); - } - - - 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_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; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY: - OnPlanRollbackBoundaryFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATEBEGIN: - OnSetUpdateBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSETUPDATECOMPLETE: - OnSetUpdateCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE: - OnDetectCompatibleMsiPackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN: - OnPlanCompatibleMsiPackageBeginFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE: - OnPlanCompatibleMsiPackageCompleteFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: - OnPlannedCompatiblePackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE: - OnPlanRestoreRelatedBundleFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE: - OnPlanRelatedBundleTypeFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE: - OnApplyDowngradeFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE: - OnDetectRelatedBundlePackageFallback(reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE: - OnCachePackageNonVitalValidationFailureFallback(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 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 OnPlanRelatedBundleTypeFallback( - __in BA_ONPLANRELATEDBUNDLETYPE_ARGS* pArgs, - __inout BA_ONPLANRELATEDBUNDLETYPE_RESULTS* pResults - ) - { - BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE requestedType = pResults->requestedType; - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE, pArgs, pResults, m_pvBAFunctionsProcContext); - BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE_TYPE, m_hModule, pArgs->wzBundleId, LoggingPlanRelationTypeToString(requestedType), LoggingPlanRelationTypeToString(pResults->requestedType)); - } - - 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 OnPlannedCompatiblePackageFallback( - __in BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS* pArgs, - __inout BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, 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); - } - - void OnPlanRollbackBoundaryFallback( - __in BA_ONPLANROLLBACKBOUNDARY_ARGS* pArgs, - __inout BA_ONPLANROLLBACKBOUNDARY_RESULTS* pResults - ) - { - BOOL fTransaction = pResults->fTransaction; - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANROLLBACKBOUNDARY, pArgs, pResults, m_pvBAFunctionsProcContext); - BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_ROLLBACK_BOUNDARY, m_hModule, pArgs->wzRollbackBoundaryId, LoggingBoolToString(fTransaction), LoggingBoolToString(pResults->fTransaction)); - } - - void OnSetUpdateBeginFallback( - __in BA_ONSETUPDATEBEGIN_ARGS* pArgs, - __inout BA_ONSETUPDATEBEGIN_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSETUPDATEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnSetUpdateCompleteFallback( - __in BA_ONSETUPDATECOMPLETE_ARGS* pArgs, - __inout BA_ONSETUPDATECOMPLETE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONSETUPDATECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnDetectCompatibleMsiPackageFallback( - __in BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS* pArgs, - __inout BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnPlanCompatibleMsiPackageBeginFallback( - __in BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS* pArgs, - __inout BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS* pResults - ) - { - BOOL fRequestRemove = pResults->fRequestRemove; - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, pArgs, pResults, m_pvBAFunctionsProcContext); - BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_COMPATIBLE_MSI_PACKAGE, m_hModule, pArgs->wzPackageId, pArgs->wzCompatiblePackageId, LoggingBoolToString(fRequestRemove), LoggingBoolToString(pResults->fRequestRemove)); - } - - void OnPlanCompatibleMsiPackageCompleteFallback( - __in BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS* pArgs, - __inout BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnPlanRestoreRelatedBundleFallback( - __in BA_ONPLANRESTORERELATEDBUNDLE_ARGS* pArgs, - __inout BA_ONPLANRESTORERELATEDBUNDLE_RESULTS* pResults - ) - { - BOOTSTRAPPER_REQUEST_STATE requestedState = pResults->requestedState; - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE, pArgs, pResults, m_pvBAFunctionsProcContext); - BalLogId(BOOTSTRAPPER_LOG_LEVEL_STANDARD, MSG_WIXSTDBA_PLANNED_RESTORE_RELATED_BUNDLE, m_hModule, pArgs->wzBundleId, LoggingRequestStateToString(requestedState), LoggingRequestStateToString(pResults->requestedState)); - } - - void OnApplyDowngradeFallback( - __in BA_ONAPPLYDOWNGRADE_ARGS* pArgs, - __inout BA_ONAPPLYDOWNGRADE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnExecuteProcessCancelFallback( - __in BA_ONEXECUTEPROCESSCANCEL_ARGS* pArgs, - __inout BA_ONEXECUTEPROCESSCANCEL_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONEXECUTEPROCESSCANCEL, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnDetectRelatedBundlePackageFallback( - __in BA_ONDETECTRELATEDBUNDLEPACKAGE_ARGS* pArgs, - __inout BA_ONDETECTRELATEDBUNDLEPACKAGE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLEPACKAGE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - void OnCachePackageNonVitalValidationFailureFallback( - __in BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_ARGS* pArgs, - __inout BA_ONCACHEPACKAGENONVITALVALIDATIONFAILURE_RESULTS* pResults - ) - { - m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGENONVITALVALIDATIONFAILURE, pArgs, pResults, m_pvBAFunctionsProcContext); - } - - - HRESULT ShowMsiFilesInUse( - __in DWORD cFiles, - __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, - __in BOOTSTRAPPER_FILES_IN_USE_TYPE source, - __inout int* pResult - ) - { - HRESULT hr = S_OK; - LPWSTR sczFilesInUse = NULL; - DWORD_PTR cchLen = 0; - int nResult = IDERROR; - - // If the user has chosen to ignore on a previously displayed "files in use" page, - // we will return the same result for other cases. No need to display the page again. - if (IDIGNORE == m_nLastMsiFilesInUseResult) - { - nResult = m_nLastMsiFilesInUseResult; - } - else if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display) // Only show files in use when using full display mode. - { - // See https://docs.microsoft.com/en-us/windows/win32/msi/sending-messages-to-windows-installer-using-msiprocessmessage for details. - for (DWORD i = 1; i < cFiles; i += 2) - { - hr = ::StringCchLengthW(rgwzFiles[i], STRSAFE_MAX_CCH, reinterpret_cast(&cchLen)); - BalExitOnFailure(hr, "Failed to calculate length of string."); - - if (cchLen) - { - hr = StrAllocConcatFormatted(&sczFilesInUse, L"%ls\r\n", rgwzFiles[i]); - BalExitOnFailure(hr, "Failed to concat files in use."); - } - } - - // Show applications using the files. - if (BOOTSTRAPPER_FILES_IN_USE_TYPE_MSI_RM == source) - { - hr = ShowRestartManagerMsiFilesInUseDialog(sczFilesInUse, &nResult); - ExitOnFailure(hr, "Failed to show RM files-in-use dialog."); - } - else - { - hr = ShowStandardMsiFilesInUseDialog(sczFilesInUse, &nResult); - ExitOnFailure(hr, "Failed to show files-in-use dialog."); - } - } - else - { - // Silent UI level installations always shut down applications and services, - // and on Windows Vista and later, use Restart Manager unless disabled. - nResult = IDOK; - } - - LExit: - ReleaseStr(sczFilesInUse); - - // Remember the answer from the user. - m_nLastMsiFilesInUseResult = FAILED(hr) ? IDERROR : nResult; - *pResult = m_nLastMsiFilesInUseResult; - - return hr; - } - - - int ShowRestartManagerMsiFilesInUseDialog( - __in_z_opt LPCWSTR sczFilesInUse, - __out int* pnResult - ) - { - HRESULT hr = S_OK; - TASKDIALOGCONFIG config = { }; - LPWSTR sczTitle = NULL; - LPWSTR sczLabel = NULL; - LPWSTR sczCloseRadioButton = NULL; - LPWSTR sczDontCloseRadioButton = NULL; - int nButton = 0; - int nRadioButton = 0; - - hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); - BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); - - hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); - BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); - - hr = BalFormatString(m_pFilesInUseCloseRadioButtonLoc->wzText, &sczCloseRadioButton); - BalExitOnFailure(hr, "Failed to format FilesInUseCloseRadioButton loc string."); - - hr = BalFormatString(m_pFilesInUseDontCloseRadioButtonLoc->wzText, &sczDontCloseRadioButton); - BalExitOnFailure(hr, "Failed to format FilesInUseDontCloseRadioButton loc string."); - - const TASKDIALOG_BUTTON rgRadioButtons[] = { - { IDOK, sczCloseRadioButton }, - { IDIGNORE, sczDontCloseRadioButton }, - }; - - config.cbSize = sizeof(config); - config.hwndParent = m_hWnd; - config.hInstance = m_hModule; - config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; - config.dwCommonButtons = TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON; - config.pszWindowTitle = sczTitle; - config.pszMainInstruction = sczLabel; - config.pszContent = sczFilesInUse ? sczFilesInUse : L""; - config.nDefaultButton = IDOK; - config.pRadioButtons = rgRadioButtons; - config.cRadioButtons = countof(rgRadioButtons); - config.nDefaultRadioButton = IDOK; - - hr = ::TaskDialogIndirect(&config, &nButton, &nRadioButton, NULL); - BalExitOnFailure(hr, "Failed to show RM files-in-use task dialog."); - - *pnResult = IDOK == nButton ? nRadioButton : nButton; - -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: RMFilesInUse task dialog result: button - %d, radio button - %d, result - %d", nButton, nRadioButton, *pnResult); -#endif - - LExit: - ReleaseStr(sczTitle); - ReleaseStr(sczLabel); - ReleaseStr(sczCloseRadioButton); - ReleaseStr(sczDontCloseRadioButton); - - return hr; - } - - - int ShowStandardMsiFilesInUseDialog( - __in_z_opt LPCWSTR sczFilesInUse, - __out int* pnResult - ) - { - HRESULT hr = S_OK; - TASKDIALOGCONFIG config = { }; - LPWSTR sczTitle = NULL; - LPWSTR sczLabel = NULL; - LPWSTR sczRetryButton = NULL; - LPWSTR sczIgnoreButton = NULL; - LPWSTR sczExitButton = NULL; - - hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); - BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); - - hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); - BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); - - hr = BalFormatString(m_pFilesInUseRetryButtonLoc->wzText, &sczRetryButton); - BalExitOnFailure(hr, "Failed to format FilesInUseRetryButton loc string."); - - hr = BalFormatString(m_pFilesInUseIgnoreButtonLoc->wzText, &sczIgnoreButton); - BalExitOnFailure(hr, "Failed to format FilesInUseIgnoreButton loc string."); - - hr = BalFormatString(m_pFilesInUseExitButtonLoc->wzText, &sczExitButton); - BalExitOnFailure(hr, "Failed to format FilesInUseExitButton loc string."); - - const TASKDIALOG_BUTTON rgButtons[] = { - { IDRETRY, sczRetryButton }, - { IDIGNORE, sczIgnoreButton }, - { IDCANCEL, sczExitButton }, - }; - - config.cbSize = sizeof(config); - config.hwndParent = m_hWnd; - config.hInstance = m_hModule; - config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; - config.pszWindowTitle = sczTitle; - config.pszMainInstruction = sczLabel; - config.pszContent = sczFilesInUse ? sczFilesInUse : L""; - config.pButtons = rgButtons; - config.cButtons = countof(rgButtons); - - hr = ::TaskDialogIndirect(&config, pnResult, NULL, NULL); - BalExitOnFailure(hr, "Failed to show files-in-use task dialog."); - -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: FilesInUse task dialog result: %d", *pnResult); -#endif - - LExit: - ReleaseStr(sczTitle); - ReleaseStr(sczLabel); - ReleaseStr(sczRetryButton); - ReleaseStr(sczIgnoreButton); - ReleaseStr(sczExitButton); - - return hr; - } - - - HRESULT ShowNetfxFilesInUse( - __in DWORD cFiles, - __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, - __inout int* pResult - ) - { - HRESULT hr = S_OK; - LPWSTR sczFilesInUse = NULL; - DWORD_PTR cchLen = 0; - int nResult = IDERROR; - - // If the user has chosen to ignore on a previously displayed "files in use" page, - // we will return the same result for other cases. No need to display the page again. - if (IDNO == m_nLastNetfxFilesInUseResult) - { - nResult = m_nLastNetfxFilesInUseResult; - } - else if (BOOTSTRAPPER_DISPLAY_FULL != m_command.display) // Only show files in use when using full display mode. - { - nResult = IDYES; - } - else - { - for (DWORD i = 0; i < cFiles; ++i) - { - hr = ::StringCchLengthW(rgwzFiles[i], STRSAFE_MAX_CCH, reinterpret_cast(&cchLen)); - BalExitOnFailure(hr, "Failed to calculate length of string."); - - if (cchLen) - { - hr = StrAllocConcatFormatted(&sczFilesInUse, L"%ls\r\n", rgwzFiles[i]); - BalExitOnFailure(hr, "Failed to concat files in use."); - } - } - - // Show applications using the files. - hr = ShowNetfxFilesInUseDialog(sczFilesInUse, &nResult); - ExitOnFailure(hr, "Failed to show Netfx files-in-use dialog."); - } - - LExit: - ReleaseStr(sczFilesInUse); - - // Remember the answer from the user. - m_nLastNetfxFilesInUseResult = FAILED(hr) ? IDERROR : nResult; - *pResult = m_nLastNetfxFilesInUseResult; - - return hr; - } - - - int ShowNetfxFilesInUseDialog( - __in_z_opt LPCWSTR sczFilesInUse, - __out int* pnResult - ) - { - HRESULT hr = S_OK; - TASKDIALOGCONFIG config = { }; - LPWSTR sczTitle = NULL; - LPWSTR sczLabel = NULL; - LPWSTR sczNetfxCloseRadioButton = NULL; - LPWSTR sczDontCloseRadioButton = NULL; - int nButton = 0; - int nRadioButton = 0; - - hr = BalFormatString(m_pFilesInUseTitleLoc->wzText, &sczTitle); - BalExitOnFailure(hr, "Failed to format FilesInUseTitle loc string."); - - hr = BalFormatString(m_pFilesInUseLabelLoc->wzText, &sczLabel); - BalExitOnFailure(hr, "Failed to format FilesInUseLabel loc string."); - - hr = BalFormatString(m_pFilesInUseNetfxCloseRadioButtonLoc->wzText, &sczNetfxCloseRadioButton); - BalExitOnFailure(hr, "Failed to format FilesInUseNetfxCloseRadioButton loc string."); - - hr = BalFormatString(m_pFilesInUseDontCloseRadioButtonLoc->wzText, &sczDontCloseRadioButton); - BalExitOnFailure(hr, "Failed to format FilesInUseDontCloseRadioButton loc string."); - - const TASKDIALOG_BUTTON rgRadioButtons[] = { - { IDYES, sczNetfxCloseRadioButton }, - { IDNO, sczDontCloseRadioButton }, - }; - - config.cbSize = sizeof(config); - config.hwndParent = m_hWnd; - config.hInstance = m_hModule; - config.dwFlags = TDF_SIZE_TO_CONTENT | TDF_POSITION_RELATIVE_TO_WINDOW; - config.dwCommonButtons = TDCBF_RETRY_BUTTON | TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON; - config.pszWindowTitle = sczTitle; - config.pszMainInstruction = sczLabel; - config.pszContent = sczFilesInUse ? sczFilesInUse : L""; - config.nDefaultButton = IDRETRY; - config.pRadioButtons = rgRadioButtons; - config.cRadioButtons = countof(rgRadioButtons); - config.nDefaultRadioButton = IDYES; - - hr = ::TaskDialogIndirect(&config, &nButton, &nRadioButton, NULL); - BalExitOnFailure(hr, "Failed to show Netfx files-in-use task dialog."); - - *pnResult = IDOK == nButton ? nRadioButton : nButton; - -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: NetfxFilesInUse task dialog result: button - %d, radio button - %d, result - %d", nButton, nRadioButton, *pnResult); -#endif - - LExit: - ReleaseStr(sczTitle); - ReleaseStr(sczLabel); - ReleaseStr(sczNetfxCloseRadioButton); - ReleaseStr(sczDontCloseRadioButton); - - return hr; - } - - -public: //CBalBaseBootstrapperApplication - virtual STDMETHODIMP Initialize( - __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs - ) - { - HRESULT hr = S_OK; - - hr = __super::Initialize(pCreateArgs); - BalExitOnFailure(hr, "CBalBaseBootstrapperApplication initialization failed."); - - memcpy_s(&m_command, sizeof(m_command), pCreateArgs->pCommand, sizeof(BOOTSTRAPPER_COMMAND)); - memcpy_s(&m_createArgs, sizeof(m_createArgs), pCreateArgs, sizeof(BOOTSTRAPPER_CREATE_ARGS)); - m_createArgs.pCommand = &m_command; - - hr = BalGetStringVariable(L"WixBundleVersion", &m_sczBundleVersion); - BalExitOnFailure(hr, "CWixStandardBootstrapperApplication initialization failed."); - - LExit: - return hr; - } - - void Uninitialize( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* /*pResults*/ - ) - { - if (m_hBAFModule) - { - BA_FUNCTIONS_DESTROY_ARGS args = { }; - BA_FUNCTIONS_DESTROY_RESULTS results = { }; - - args.cbSize = sizeof(BA_FUNCTIONS_DESTROY_ARGS); - args.fReload = pArgs->fReload; - - results.cbSize = sizeof(BA_FUNCTIONS_DESTROY_RESULTS); - - PFN_BA_FUNCTIONS_DESTROY pfnBAFunctionsDestroy = reinterpret_cast(::GetProcAddress(m_hBAFModule, "BAFunctionsDestroy")); - if (pfnBAFunctionsDestroy) - { - pfnBAFunctionsDestroy(&args, &results); - } - - if (!results.fDisableUnloading) - { - ::FreeLibrary(m_hBAFModule); - m_hBAFModule = NULL; - } - } - } - - -private: - // - // 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 = { }; - DWORD dwQuit = 0; - WM_WIXSTDBA firstAction = WM_WIXSTDBA_DETECT_PACKAGES; - - // 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); - firstAction = WM_WIXSTDBA_SHOW_FAILURE; - } - else - { - // Okay, we're ready for packages now. - pThis->SetState(WIXSTDBA_STATE_INITIALIZED, hr); - - if (pThis->m_fPerformHelp && BOOTSTRAPPER_ACTION_HELP == pThis->m_command.action) - { - firstAction = WM_WIXSTDBA_SHOW_HELP; - } - } - - ::PostMessageW(pThis->m_hWnd, firstAction, 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(); - - if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == pThis->m_restartResult) - { - dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_INITIATED : ERROR_FAIL_REBOOT_INITIATED; - } - else if (BOOTSTRAPPER_APPLY_RESTART_REQUIRED == pThis->m_restartResult) - { - dwQuit = SUCCEEDED(hr) ? ERROR_SUCCESS_REBOOT_REQUIRED : ERROR_FAIL_REBOOT_REQUIRED; - } - else if (SEVERITY_ERROR == HRESULT_SEVERITY(hr) && FACILITY_WIN32 == HRESULT_FACILITY(hr)) - { - // Convert Win32 HRESULTs back to the error code. - dwQuit = HRESULT_CODE(hr); - } - else - { - dwQuit = hr; - } - - // initiate engine shutdown - 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 = BalInfoParseFromXml(&m_Bundle, pixdManifest); - BalExitOnFailure(hr, "Failed to load bundle information."); - - 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."); - - LoadFilesInUse(); - - hr = LoadTheme(sczModulePath, m_sczLanguage); - ExitOnFailure(hr, "Failed to load theme."); - - 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 - - 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 (m_fRequestedCacheOnly) - { - 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."); - } - } - - 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; - BOOL fUnknownArg = FALSE; - - argc = m_BalInfoCommand.cUnknownArgs; - argv = m_BalInfoCommand.rgUnknownArgs; - - if (argc) - { - for (int i = 0; i < argc; ++i) - { - fUnknownArg = FALSE; - - 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_fRequestedCacheOnly = TRUE; - } - else - { - fUnknownArg = TRUE; - } - } - else - { - fUnknownArg = TRUE; - } - - if (fUnknownArg) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Ignoring unknown argument: %ls", argv[i]); - } - } - } - - hr = BalSetOverridableVariablesFromEngine(&m_Bundle.overridableVariables, &m_BalInfoCommand, m_pEngine); - BalExitOnFailure(hr, "Failed to set overridable variables from the command line."); - - LExit: - 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 LoadIndividualLocString( - __in_z LPCWSTR wzId, - __out LOC_STRING** ppLocString - ) - { - HRESULT hr = LocGetString(m_pWixLoc, wzId, ppLocString); - - if (E_NOTFOUND == hr) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_DEBUG, "WIXSTDBA: Missing loc string '%ls'.", wzId); - } - - return hr; - } - - - void LoadFilesInUse() - { - // Get the loc strings for the files-in-use dialogs. - LoadIndividualLocString(L"#(loc.FilesInUseTitle)", &m_pFilesInUseTitleLoc); - LoadIndividualLocString(L"#(loc.FilesInUseLabel)", &m_pFilesInUseLabelLoc); - LoadIndividualLocString(L"#(loc.FilesInUseCloseRadioButton)", &m_pFilesInUseCloseRadioButtonLoc); - LoadIndividualLocString(L"#(loc.FilesInUseDontCloseRadioButton)", &m_pFilesInUseDontCloseRadioButtonLoc); - LoadIndividualLocString(L"#(loc.FilesInUseRetryButton)", &m_pFilesInUseRetryButtonLoc); - LoadIndividualLocString(L"#(loc.FilesInUseIgnoreButton)", &m_pFilesInUseIgnoreButtonLoc); - LoadIndividualLocString(L"#(loc.FilesInUseExitButton)", &m_pFilesInUseExitButtonLoc); - LoadIndividualLocString(L"#(loc.FilesInUseNetfxCloseRadioButton)", &m_pFilesInUseNetfxCloseRadioButtonLoc); - - m_fShowRMFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseCloseRadioButtonLoc && m_pFilesInUseDontCloseRadioButtonLoc; - m_fShowStandardFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseRetryButtonLoc && m_pFilesInUseIgnoreButtonLoc && m_pFilesInUseExitButtonLoc; - m_fShowNetfxFilesInUse = m_pFilesInUseTitleLoc && m_pFilesInUseLabelLoc && m_pFilesInUseNetfxCloseRadioButtonLoc && m_pFilesInUseDontCloseRadioButtonLoc; - } - - - 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."); - - C_ASSERT(COUNT_WIXSTDBA_PAGE == countof(vrgwzPageNames)); - C_ASSERT(countof(m_rgdwPageIds) == countof(vrgwzPageNames)); - - ThemeGetPageIds(m_pTheme, vrgwzPageNames, m_rgdwPageIds, countof(m_rgdwPageIds)); - - hr = ThemeLocalize(m_pTheme, m_pWixLoc); - BalExitOnFailure(hr, "Failed to localize theme: %ls", sczThemePath); - - LExit: - ReleaseStr(sczThemePath); - - 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; - BOOL fXmlFound = FALSE; - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaInformation", &pNode); - BalExitOnRequiredXmlQueryFailure(hr, "BootstrapperApplication.xml manifest is missing wixstdba information."); - - hr = XmlGetAttributeEx(pNode, L"LicenseFile", &m_sczLicenseFile); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license file."); - - hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &m_sczLicenseUrl); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get license URL."); - - ReleaseObject(pNode); - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixStdbaOptions", &pNode); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read wixstdba options from BootstrapperApplication.xml manifest."); - - if (!fXmlFound) - { - ExitFunction(); - } - - hr = XmlGetAttributeNumber(pNode, L"SuppressOptionsUI", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressOptionsUI value."); - - if (fXmlFound && dwBool) - { - hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI, 1); - BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI); - } - - dwBool = 0; - hr = XmlGetAttributeNumber(pNode, L"SuppressDowngradeFailure", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressDowngradeFailure value."); - - if (fXmlFound) - { - m_fSuppressDowngradeFailure = 0 < dwBool; - } - - dwBool = 0; - hr = XmlGetAttributeNumber(pNode, L"SuppressRepair", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SuppressRepair value."); - - if (fXmlFound) - { - m_fSuppressRepair = 0 < dwBool; - } - - hr = XmlGetAttributeNumber(pNode, L"ShowVersion", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get ShowVersion value."); - - if (fXmlFound && dwBool) - { - hr = BalSetNumericVariable(WIXSTDBA_VARIABLE_SHOW_VERSION, 1); - BalExitOnFailure(hr, "Failed to set '%ls' variable.", WIXSTDBA_VARIABLE_SHOW_VERSION); - } - - hr = XmlGetAttributeNumber(pNode, L"SupportCacheOnly", &dwBool); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get SupportCacheOnly value."); - - if (fXmlFound) - { - m_fSupportCacheOnly = 0 < dwBool; - } - - LExit: - ReleaseObject(pNode); - 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; - WNDCLASSW wc = { }; - DWORD dwWindowStyle = 0; - int x = CW_USEDEFAULT; - int y = CW_USEDEFAULT; - POINT ptCursor = { }; - - ThemeInitializeWindowClass(m_pTheme, &wc, CWixStandardBootstrapperApplication::WndProc, m_hModule, WIXSTDBA_WINDOW_CLASS); - - // If the theme did not provide an icon, try using the icon from the bundle engine. - if (!wc.hIcon) - { - HMODULE hBootstrapperEngine = ::GetModuleHandleW(NULL); - if (hBootstrapperEngine) - { - wc.hIcon = ::LoadIconW(hBootstrapperEngine, MAKEINTRESOURCEW(1)); - } - } - - // Register the window class and create the window. - 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 || m_fPreplanPrereqs) - { - 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."); - - OnThemeLoaded(); - - 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.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) - { - hr = S_OK; - } - else - { - BalExitOnFailure(hr, "BAFunctions WndProc failed."); - - if (wndProcResults.fProcessed) - { - lres = wndProcResults.lResult; - 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)); - - 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_THMUTIL_LOADING_CONTROL: - return pBA->OnThemeLoadingControl(reinterpret_cast(wParam), reinterpret_cast(lParam)); - - case WM_THMUTIL_LOADED_CONTROL: - return pBA->OnThemeLoadedControl(reinterpret_cast(wParam), reinterpret_cast(lParam)); - - 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_WIXSTDBA_PLAN_PREREQS: - pBA->OnPlanPrereqs(static_cast(lParam)); - return 0; - - case WM_THMUTIL_CONTROL_WM_COMMAND: - return pBA->OnThemeControlWmCommand(reinterpret_cast(wParam), reinterpret_cast(lParam)); - - case WM_THMUTIL_CONTROL_WM_NOTIFY: - return pBA->OnThemeControlWmNotify(reinterpret_cast(wParam), reinterpret_cast(lParam)); - } - - if (pBA && pBA->m_pTaskbarList && uMsg == pBA->m_uTaskbarButtonCreatedMessage) - { - pBA->m_fTaskbarButtonOK = TRUE; - return 0; - } - - return CallDefaultWndProc(pBA, hWnd, uMsg, wParam, lParam); - } - - - // - // OnThemeLoaded - finishes loading the theme. - // - BOOL OnThemeLoaded() - { - HRESULT hr = S_OK; - BA_FUNCTIONS_ONTHEMELOADED_ARGS themeLoadedArgs = { }; - BA_FUNCTIONS_ONTHEMELOADED_RESULTS themeLoadedResults = { }; - - if (m_pfnBAFunctionsProc) - { - themeLoadedArgs.cbSize = sizeof(themeLoadedArgs); - themeLoadedArgs.hWnd = m_pTheme->hwndParent; - themeLoadedResults.cbSize = sizeof(themeLoadedResults); - hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMELOADED, &themeLoadedArgs, &themeLoadedResults, m_pvBAFunctionsProcContext); - BalExitOnFailure(hr, "BAFunctions OnThemeLoaded failed."); - } - - LExit: - return SUCCEEDED(hr); - } - - BOOL OnThemeLoadingControl( - __in const THEME_LOADINGCONTROL_ARGS* pArgs, - __in THEME_LOADINGCONTROL_RESULTS* pResults - ) - { - HRESULT hr = S_OK; - BOOL fProcessed = FALSE; - BA_FUNCTIONS_ONTHEMECONTROLLOADING_ARGS themeControlLoadingArgs = { }; - BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS themeControlLoadingResults = { }; - - for (DWORD iAssignControl = 0; iAssignControl < countof(m_rgInitControls); ++iAssignControl) - { - THEME_ASSIGN_CONTROL_ID* pAssignControl = m_rgInitControls + iAssignControl; - if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, pAssignControl->wzName, -1)) - { - if (!pAssignControl->ppControl) - { - BalExitWithRootFailure(hr, E_INVALIDSTATE, "Control '%ls' has no member variable", pAssignControl->wzName); - } - - if (*pAssignControl->ppControl) - { - BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Duplicate control name: %ls", pAssignControl->wzName); - } - else - { - *pAssignControl->ppControl = pArgs->pThemeControl; - } - - fProcessed = TRUE; - pResults->wId = pAssignControl->wId; - pResults->dwAutomaticBehaviorType = pAssignControl->dwAutomaticBehaviorType; - ExitFunction(); - } - } - - if (m_pfnBAFunctionsProc) - { - themeControlLoadingArgs.cbSize = sizeof(themeControlLoadingArgs); - themeControlLoadingArgs.wzName = pArgs->pThemeControl->sczName; - - themeControlLoadingResults.cbSize = sizeof(themeControlLoadingResults); - themeControlLoadingResults.wId = pResults->wId; - themeControlLoadingResults.dwAutomaticBehaviorType = pResults->dwAutomaticBehaviorType; - - hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING, &themeControlLoadingArgs, &themeControlLoadingResults, m_pvBAFunctionsProcContext); - - if (E_NOTIMPL == hr) - { - hr = S_OK; - } - else - { - BalExitOnFailure(hr, "BAFunctions OnThemeControlLoading failed."); - - if (themeControlLoadingResults.fProcessed) - { - fProcessed = TRUE; - pResults->wId = themeControlLoadingResults.wId; - pResults->dwAutomaticBehaviorType = themeControlLoadingResults.dwAutomaticBehaviorType; - } - } - } - - LExit: - pResults->hr = hr; - return fProcessed || FAILED(hr); - } - - BOOL OnThemeLoadedControl( - __in const THEME_LOADEDCONTROL_ARGS* pArgs, - __in THEME_LOADEDCONTROL_RESULTS* pResults - ) - { - HRESULT hr = S_OK; - BOOL fProcessed = FALSE; - BA_FUNCTIONS_ONTHEMECONTROLLOADED_ARGS themeControlLoadedArgs = { }; - BA_FUNCTIONS_ONTHEMECONTROLLOADED_RESULTS themeControlLoadedResults = { }; - - if (WIXSTDBA_CONTROL_EULA_RICHEDIT == pArgs->pThemeControl->wId) - { - // Best effort to load the RTF EULA control with text. - OnLoadedEulaRtfControl(pArgs->pThemeControl); - fProcessed = TRUE; - ExitFunction(); - } - - if (m_pfnBAFunctionsProc) - { - themeControlLoadedArgs.cbSize = sizeof(themeControlLoadedArgs); - themeControlLoadedArgs.wzName = pArgs->pThemeControl->sczName; - themeControlLoadedArgs.wId = pArgs->pThemeControl->wId; - themeControlLoadedArgs.hWnd = pArgs->pThemeControl->hWnd; - - themeControlLoadedResults.cbSize = sizeof(themeControlLoadedResults); - - hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADED, &themeControlLoadedArgs, &themeControlLoadedResults, m_pvBAFunctionsProcContext); - - if (E_NOTIMPL == hr) - { - hr = S_OK; - } - else - { - BalExitOnFailure(hr, "BAFunctions OnThemeControlLoaded failed."); - - if (themeControlLoadedResults.fProcessed) - { - fProcessed = TRUE; - } - } - } - - LExit: - pResults->hr = hr; - return fProcessed || FAILED(hr); - } - - HRESULT OnLoadedEulaRtfControl( - const THEME_CONTROL* pThemeControl - ) - { - HRESULT hr = S_OK; - LPWSTR sczLicenseFormatted = NULL; - LPWSTR sczLicensePath = NULL; - LPWSTR sczLicenseDirectory = NULL; - LPWSTR sczLicenseFilename = NULL; - - if (!m_sczLicenseFile || !*m_sczLicenseFile) - { - ExitWithRootFailure(hr, E_INVALIDDATA, "No license file in manifest."); - } - - hr = StrAllocString(&sczLicenseFormatted, m_sczLicenseFile, 0); - ExitOnFailure(hr, "Failed to copy manifest license file."); - - hr = LocLocalizeString(m_pWixLoc, &sczLicenseFormatted); - ExitOnFailure(hr, "Failed to localize manifest license file."); - - hr = BalFormatString(sczLicenseFormatted, &sczLicenseFormatted); - ExitOnFailure(hr, "Failed to expand localized manifest license file."); - - hr = PathRelativeToModule(&sczLicensePath, sczLicenseFormatted, m_hModule); - ExitOnFailure(hr, "Failed to get relative path for license file."); - - hr = PathGetDirectory(sczLicensePath, &sczLicenseDirectory); - ExitOnFailure(hr, "Failed to get license file directory."); - - hr = StrAllocString(&sczLicenseFilename, PathFile(sczLicenseFormatted), 0); - ExitOnFailure(hr, "Failed to copy license file name."); - - hr = LocProbeForFile(sczLicenseDirectory, sczLicenseFilename, m_sczLanguage, &sczLicensePath); - ExitOnFailure(hr, "Failed to probe for localized license file."); - - hr = ThemeLoadRichEditFromFile(pThemeControl, sczLicensePath, m_hModule); - ExitOnFailure(hr, "Failed to load license file into richedit control."); - - LExit: - 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); - } - - ReleaseStr(sczLicenseFilename); - ReleaseStr(sczLicenseDirectory); - ReleaseStr(sczLicensePath); - ReleaseStr(sczLicenseFormatted); - - return 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(); - } - - - // - // 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(); - } - - - // - // OnDetect - start the processing of packages. - // - void OnDetect() - { - HRESULT hr = S_OK; - - SetState(WIXSTDBA_STATE_DETECTING, hr); - - // 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); - } - } - - - // - // OnPlan - plan the detected changes. - // - void OnPlan( - __in BOOTSTRAPPER_ACTION action - ) - { - HRESULT hr = S_OK; - - m_plannedAction = action; - - 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); - } - } - - - // - // OnPlanPrereqs - preplan the packages to see if the preqba can be skipped. - // - void OnPlanPrereqs( - __in BOOTSTRAPPER_ACTION action - ) - { - HRESULT hr = S_OK; - - m_plannedAction = action; - - SetState(WIXSTDBA_STATE_PLANNING_PREREQS, hr); - - hr = m_pEngine->Plan(action); - BalExitOnFailure(hr, "Failed to start planning prereq packages."); - - LExit: - if (FAILED(hr)) - { - SetState(WIXSTDBA_STATE_PLANNING_PREREQS, hr); - } - } - - - // - // 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_pControlProgressCancelButton, TRUE); // ensure the cancel button is enabled before starting. - - LExit: - if (FAILED(hr)) - { - SetState(WIXSTDBA_STATE_APPLYING, hr); - } - } - - - // - // 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 not updating or - // we successfully installed the prerequisite(s) and either no restart is required or can automatically restart - // then exit. - if ((WIXSTDBA_STATE_APPLIED <= m_state && (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || BOOTSTRAPPER_ACTION_UPDATE_REPLACE == m_plannedAction)) || - (WIXSTDBA_STATE_APPLIED == m_state && m_fPrereq && (!m_fRestartRequired || m_fShouldRestart && m_fAllowRestart))) - { - // 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) - { - LONGLONG llCanRestart = 0; - LONGLONG llElevated = 0; - - BalGetNumericVariable(WIXBUNDLE_VARIABLE_CANRESTART, &llCanRestart); - BalGetNumericVariable(WIXBUNDLE_VARIABLE_ELEVATED, &llElevated); - m_fRestartRequiresElevation = !llCanRestart && !llElevated; - - // Enable disable controls per-page. - if (m_rgdwPageIds[WIXSTDBA_PAGE_INSTALL] == dwNewPageId) // on the "Install" page, ensure the install button is enabled/disabled correctly. - { - ThemeControlElevates(m_pControlInstallButton, (m_Bundle.fPerMachine && !llElevated)); - - // If the EULA control exists, show it only if a license URL is provided as well. - if (m_pControlEulaHyperlink) - { - BOOL fEulaLink = (m_sczLicenseUrl && *m_sczLicenseUrl); - ThemeControlEnable(m_pControlEulaHyperlink, fEulaLink); - ThemeControlEnable(m_pControlEulaAcceptCheckbox, fEulaLink); - } - - BOOL fAcceptedLicense = !m_pControlEulaAcceptCheckbox || !ThemeControlEnabled(m_pControlEulaAcceptCheckbox) || ThemeIsControlChecked(m_pControlEulaAcceptCheckbox); - ThemeControlEnable(m_pControlInstallButton, fAcceptedLicense); - } - else if (m_rgdwPageIds[WIXSTDBA_PAGE_MODIFY] == dwNewPageId) - { - ThemeControlElevates(m_pControlRepairButton, (m_Bundle.fPerMachine && !llElevated)); - ThemeControlElevates(m_pControlUninstallButton, (m_Bundle.fPerMachine && !llElevated)); - - ThemeControlEnable(m_pControlRepairButton, !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 fEnableRestartButton = FALSE; - BOOL fLaunchTargetExists = FALSE; - - ThemeControlElevates(m_pControlSuccessRestartButton, m_fRestartRequiresElevation); - - if (m_fShouldRestart) - { - if (BAL_INFO_RESTART_PROMPT == m_BalInfoCommand.restart) - { - fEnableRestartButton = TRUE; - } - } - else if (m_pControlLaunchButton) - { - fLaunchTargetExists = BalVariableExists(WIXSTDBA_VARIABLE_LAUNCH_TARGET_PATH); - } - - ThemeControlEnable(m_pControlLaunchButton, fLaunchTargetExists && BOOTSTRAPPER_ACTION_UNINSTALL < m_plannedAction); - ThemeControlEnable(m_pControlSuccessRestartButton, fEnableRestartButton); - } - 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 fEnableRestartButton = FALSE; - - ThemeControlElevates(m_pControlFailureRestartButton, m_fRestartRequiresElevation); - - 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 if (E_PREREQBA_INFINITE_LOOP == m_hrFinal) - { - HRESULT hr = StrAllocString(&sczUnformattedText, L"#(loc.PREREQBAINFINITELOOPErrorMessage)", 0); - if (FAILED(hr)) - { - BalLogError(hr, "Failed to initialize PREREQBAINFINITELOOPErrorMessage loc identifier."); - } - else - { - hr = LocLocalizeString(m_pWixLoc, &sczUnformattedText); - if (FAILED(hr)) - { - BalLogError(hr, "Failed to localize PREREQBAINFINITELOOPErrorMessage: %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 || - E_DNCHOST_SCD_RUNTIME_FAILURE == m_hrFinal || - E_PREREQBA_INFINITE_LOOP == m_hrFinal) - { - if (sczUnformattedText) - { - BalFormatString(sczUnformattedText, &sczText); - } - } - else - { - StrAllocFormatted(&sczText, L"0x%08x - %ls", m_hrFinal, sczUnformattedText); - } - - ThemeSetTextControl(m_pControlFailureMessageText, sczText); - fShowErrorMessage = TRUE; - } - - if (m_fShouldRestart) - { - if (BAL_INFO_RESTART_PROMPT == m_BalInfoCommand.restart) - { - fEnableRestartButton = TRUE; - } - } - - ThemeControlEnable(m_pControlFailureLogFileLink, fShowLogLink); - ThemeControlEnable(m_pControlFailureMessageText, fShowErrorMessage); - ThemeControlEnable(m_pControlFailureRestartButton, fEnableRestartButton); - } - - 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", dwNewPageId); - } - - // 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_pControlInstallButton); - } - } - } - - 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_pControlProgressCancelButton, 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_pControlEulaAcceptCheckbox); - ThemeControlEnable(m_pControlInstallButton, 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); - } - - - // - // OnClickUpdateButton - start the update process. - // - void OnClickUpdateButton() - { - this->OnPlan(BOOTSTRAPPER_ACTION_UPDATE_REPLACE); - } - - - // - // 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); - } - - - // - // 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); - } - - - // - // 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."); - - if (m_fRestartRequiresElevation) - { - m_fElevatingForRestart = TRUE; - ThemeControlEnable(m_pControlFailureRestartButton, FALSE); - ThemeControlEnable(m_pControlSuccessRestartButton, FALSE); - - m_pEngine->Elevate(m_hWnd); - } - else - { - m_fAllowRestart = TRUE; - - ::SendMessageW(m_hWnd, WM_CLOSE, 0, 0); - } - } - - - // - // 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); - } - - BOOL OnThemeControlWmCommand( - __in const THEME_CONTROLWMCOMMAND_ARGS* pArgs, - __in THEME_CONTROLWMCOMMAND_RESULTS* pResults - ) - { - HRESULT hr = S_OK; - BOOL fProcessed = FALSE; - BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS themeControlWmCommandArgs = { }; - BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_RESULTS themeControlWmCommandResults = { }; - - switch (HIWORD(pArgs->wParam)) - { - case BN_CLICKED: - switch (pArgs->pThemeControl->wId) - { - case WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX: - OnClickAcceptCheckbox(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_INSTALL_BUTTON: - OnClickInstallButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_REPAIR_BUTTON: - OnClickRepairButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_UNINSTALL_BUTTON: - OnClickUninstallButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON: - case WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON: - OnClickUpdateButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_LAUNCH_BUTTON: - OnClickLaunchButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON: __fallthrough; - case WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON: - OnClickRestartButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - - case WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON: - OnClickCloseButton(); - fProcessed = TRUE; - pResults->lResult = 0; - ExitFunction(); - } - break; - } - - if (m_pfnBAFunctionsProc) - { - themeControlWmCommandArgs.cbSize = sizeof(themeControlWmCommandArgs); - themeControlWmCommandArgs.wParam = pArgs->wParam; - themeControlWmCommandArgs.wzName = pArgs->pThemeControl->sczName; - themeControlWmCommandArgs.wId = pArgs->pThemeControl->wId; - themeControlWmCommandArgs.hWnd = pArgs->pThemeControl->hWnd; - - themeControlWmCommandResults.cbSize = sizeof(themeControlWmCommandResults); - themeControlWmCommandResults.lResult = pResults->lResult; - - hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND, &themeControlWmCommandArgs, &themeControlWmCommandResults, m_pvBAFunctionsProcContext); - if (E_NOTIMPL != hr) - { - BalExitOnFailure(hr, "BAFunctions OnThemeControlWmCommand failed."); - - if (themeControlWmCommandResults.fProcessed) - { - fProcessed = TRUE; - pResults->lResult = themeControlWmCommandResults.lResult; - ExitFunction(); - } - } - } - -LExit: - return fProcessed; - } - - BOOL OnThemeControlWmNotify( - __in const THEME_CONTROLWMNOTIFY_ARGS* pArgs, - __in THEME_CONTROLWMNOTIFY_RESULTS* pResults - ) - { - HRESULT hr = S_OK; - BOOL fProcessed = FALSE; - BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_ARGS themeControlWmNotifyArgs = { }; - BA_FUNCTIONS_ONTHEMECONTROLWMNOTIFY_RESULTS themeControlWmNotifyResults = { }; - - switch (pArgs->lParam->code) - { - case NM_CLICK: __fallthrough; - case NM_RETURN: - switch (pArgs->pThemeControl->wId) - { - case WIXSTDBA_CONTROL_EULA_LINK: - OnClickEulaLink(); - fProcessed = TRUE; - pResults->lResult = 1; - ExitFunction(); - case WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK: - OnClickLogFileLink(); - fProcessed = TRUE; - pResults->lResult = 1; - ExitFunction(); - } - } - - if (m_pfnBAFunctionsProc) - { - themeControlWmNotifyArgs.cbSize = sizeof(themeControlWmNotifyArgs); - themeControlWmNotifyArgs.lParam = pArgs->lParam; - themeControlWmNotifyArgs.wzName = pArgs->pThemeControl->sczName; - themeControlWmNotifyArgs.wId = pArgs->pThemeControl->wId; - themeControlWmNotifyArgs.hWnd = pArgs->pThemeControl->hWnd; - - themeControlWmNotifyResults.cbSize = sizeof(themeControlWmNotifyResults); - themeControlWmNotifyResults.lResult = pResults->lResult; - - hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLWMCOMMAND, &themeControlWmNotifyArgs, &themeControlWmNotifyResults, m_pvBAFunctionsProcContext); - if (E_NOTIMPL != hr) - { - BalExitOnFailure(hr, "BAFunctions OnThemeControlWmNotify failed."); - - if (themeControlWmNotifyResults.fProcessed) - { - fProcessed = TRUE; - pResults->lResult = themeControlWmNotifyResults.lResult; - ExitFunction(); - } - } - } - -LExit: - return fProcessed; - } - - - // - // SetState - // - void SetState( - __in WIXSTDBA_STATE state, - __in HRESULT hrStatus - ) - { -#ifdef DEBUG - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: SetState() - setting state to %u with status 0x%08x.", state, hrStatus); -#endif - - 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_PREREQS: __fallthrough; - case WIXSTDBA_STATE_PLANNED_PREREQS: __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: - case WIXSTDBA_STATE_PLANNING_PREREQS: __fallthrough; - case WIXSTDBA_STATE_PLANNED_PREREQS: __fallthrough; - 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_pControlCacheProgressText, wzProgress); - - ThemeSetProgressControl(m_pControlCacheProgressbar, dwOverallPercentage); - - m_dwCalculatedCacheProgress = dwOverallPercentage * WIXSTDBA_ACQUIRE_PERCENTAGE / 100; - ThemeSetProgressControl(m_pControlOverallCalculatedProgressbar, 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: %d.", 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; - LPWSTR sczBafName = NULL; - LPWSTR sczBafPath = NULL; - BA_FUNCTIONS_CREATE_ARGS bafCreateArgs = { }; - BA_FUNCTIONS_CREATE_RESULTS bafCreateResults = { }; - BOOL fXmlFound = FALSE; - - hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFunctions", &pBAFunctionsNode); - BalExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to read WixBalBAFunctions node from BootstrapperApplicationData.xml."); - - if (!fXmlFound) - { - ExitFunction(); - } - - hr = XmlGetAttributeEx(pBAFunctionsNode, L"FilePath", &sczBafName); - BalExitOnRequiredXmlQueryFailure(hr, "Failed to get BAFunctions FilePath."); - - 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(2021, 11, 8, 0); - 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); - ReleaseObject(pBAFunctionsNode); - - return hr; - } - - -public: - // - // Constructor - initialize member variables. - // - CWixStandardBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __in IBootstrapperEngine* pEngine - ) : CBalBaseBootstrapperApplication(pEngine, 3, 3000) - { - THEME_ASSIGN_CONTROL_ID* pAssignControl = NULL; - DWORD dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE; - - m_hModule = hModule; - m_command = { }; - m_createArgs = { }; - - m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN; - - m_sczAfterForcedRestartPackage = NULL; - m_sczBundleVersion = NULL; - - m_pWixLoc = NULL; - m_Bundle = { }; - 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 = pPrereqData ? pPrereqData->hrFatalError : S_OK; - - m_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE; - m_fRestartRequired = FALSE; - m_fShouldRestart = FALSE; - m_fAllowRestart = FALSE; - m_fRestartRequiresElevation = FALSE; - m_fElevatingForRestart = FALSE; - - m_sczLicenseFile = NULL; - m_sczLicenseUrl = NULL; - m_fSuppressDowngradeFailure = FALSE; - m_fDowngrading = FALSE; - m_fSuppressRepair = FALSE; - m_fSupportCacheOnly = FALSE; - m_fRequestedCacheOnly = FALSE; - - m_pTaskbarList = NULL; - m_uTaskbarButtonCreatedMessage = UINT_MAX; - m_fTaskbarButtonOK = FALSE; - ::InitializeCriticalSection(&m_csShowingInternalUiThisPackage); - m_fShowingInternalUiThisPackage = FALSE; - m_fTriedToLaunchElevated = FALSE; - - m_pPrereqData = pPrereqData; - m_fPrereq = NULL != pPrereqData; - m_fPreplanPrereqs = FALSE; - m_fPerformHelp = !m_fPrereq || m_pPrereqData->fPerformHelp; - m_fPrereqPackagePlanned = FALSE; - m_fPrereqInstalled = FALSE; - m_fPrereqSkipped = FALSE; - - m_fShowStandardFilesInUse = FALSE; - m_fShowRMFilesInUse = FALSE; - m_fShowNetfxFilesInUse = FALSE; - m_nLastMsiFilesInUseResult = IDNOACTION; - m_nLastNetfxFilesInUseResult = IDNOACTION; - m_pFilesInUseTitleLoc = NULL; - m_pFilesInUseLabelLoc = NULL; - m_pFilesInUseCloseRadioButtonLoc = NULL; - m_pFilesInUseNetfxCloseRadioButtonLoc = NULL; - m_pFilesInUseDontCloseRadioButtonLoc = NULL; - m_pFilesInUseRetryButtonLoc = NULL; - m_pFilesInUseIgnoreButtonLoc = NULL; - m_pFilesInUseExitButtonLoc = NULL; - - pEngine->AddRef(); - m_pEngine = pEngine; - - m_hBAFModule = NULL; - m_pfnBAFunctionsProc = NULL; - m_pvBAFunctionsProcContext = NULL; - - C_ASSERT(0 == WIXSTDBA_CONTROL_INSTALL_BUTTON - WIXSTDBA_FIRST_ASSIGN_CONTROL_ID); - pAssignControl = m_rgInitControls; - - pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_BUTTON; - pAssignControl->wzName = L"InstallButton"; - pAssignControl->ppControl = &m_pControlInstallButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlInstallButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EULA_RICHEDIT; - pAssignControl->wzName = L"EulaRichedit"; - pAssignControl->ppControl = &m_pControlEulaRichedit; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlEulaRichedit = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EULA_LINK; - pAssignControl->wzName = L"EulaHyperlink"; - pAssignControl->ppControl = &m_pControlEulaHyperlink; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlEulaHyperlink = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX; - pAssignControl->wzName = L"EulaAcceptCheckbox"; - pAssignControl->ppControl = &m_pControlEulaAcceptCheckbox; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlEulaAcceptCheckbox = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_REPAIR_BUTTON; - pAssignControl->wzName = L"RepairButton"; - pAssignControl->ppControl = &m_pControlRepairButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlRepairButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_UNINSTALL_BUTTON; - pAssignControl->wzName = L"UninstallButton"; - pAssignControl->ppControl = &m_pControlUninstallButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlUninstallButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL; - pAssignControl->wzName = L"CheckingForUpdatesLabel"; - pAssignControl->ppControl = &m_pControlCheckingForUpdatesLabel; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlCheckingForUpdatesLabel = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON; - pAssignControl->wzName = L"InstallUpdateButton"; - pAssignControl->ppControl = &m_pControlInstallUpdateButton; - pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL; - m_pControlInstallUpdateButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON; - pAssignControl->wzName = L"ModifyUpdateButton"; - pAssignControl->ppControl = &m_pControlModifyUpdateButton; - pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL; - m_pControlModifyUpdateButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT; - pAssignControl->wzName = L"CacheProgressPackageText"; - pAssignControl->ppControl = &m_pControlCacheProgressPackageText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlCacheProgressPackageText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR; - pAssignControl->wzName = L"CacheProgressbar"; - pAssignControl->ppControl = &m_pControlCacheProgressbar; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlCacheProgressbar = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT; - pAssignControl->wzName = L"CacheProgressText"; - pAssignControl->ppControl = &m_pControlCacheProgressText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlCacheProgressText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT; - pAssignControl->wzName = L"ExecuteProgressPackageText"; - pAssignControl->ppControl = &m_pControlExecuteProgressPackageText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlExecuteProgressPackageText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR; - pAssignControl->wzName = L"ExecuteProgressbar"; - pAssignControl->ppControl = &m_pControlExecuteProgressbar; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlExecuteProgressbar = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT; - pAssignControl->wzName = L"ExecuteProgressText"; - pAssignControl->ppControl = &m_pControlExecuteProgressText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlExecuteProgressText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT; - pAssignControl->wzName = L"ExecuteProgressActionDataText"; - pAssignControl->ppControl = &m_pControlExecuteProgressActionDataText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlExecuteProgressActionDataText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT; - pAssignControl->wzName = L"OverallProgressPackageText"; - pAssignControl->ppControl = &m_pControlOverallProgressPackageText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlOverallProgressPackageText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR; - pAssignControl->wzName = L"OverallProgressbar"; - pAssignControl->ppControl = &m_pControlOverallProgressbar; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlOverallProgressbar = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR; - pAssignControl->wzName = L"OverallCalculatedProgressbar"; - pAssignControl->ppControl = &m_pControlOverallCalculatedProgressbar; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlOverallCalculatedProgressbar = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT; - pAssignControl->wzName = L"OverallProgressText"; - pAssignControl->ppControl = &m_pControlOverallProgressText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlOverallProgressText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON; - pAssignControl->wzName = L"ProgressCancelButton"; - pAssignControl->ppControl = &m_pControlProgressCancelButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlProgressCancelButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_LAUNCH_BUTTON; - pAssignControl->wzName = L"LaunchButton"; - pAssignControl->ppControl = &m_pControlLaunchButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlLaunchButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON; - pAssignControl->wzName = L"SuccessRestartButton"; - pAssignControl->ppControl = &m_pControlSuccessRestartButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlSuccessRestartButton = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK; - pAssignControl->wzName = L"FailureLogFileLink"; - pAssignControl->ppControl = &m_pControlFailureLogFileLink; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlFailureLogFileLink = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT; - pAssignControl->wzName = L"FailureMessageText"; - pAssignControl->ppControl = &m_pControlFailureMessageText; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlFailureMessageText = NULL; - ++pAssignControl; - - pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON; - pAssignControl->wzName = L"FailureRestartButton"; - pAssignControl->ppControl = &m_pControlFailureRestartButton; - pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType; - m_pControlFailureRestartButton = NULL; - - C_ASSERT(LAST_WIXSTDBA_CONTROL == WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON + 1); - } - - - // - // 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."); - - ::DeleteCriticalSection(&m_csShowingInternalUiThisPackage); - 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_sczBundleVersion); - ReleaseStr(m_sczAfterForcedRestartPackage); - - ReleaseNullObject(m_pEngine); - } - -private: - HMODULE m_hModule; - BOOTSTRAPPER_CREATE_ARGS m_createArgs; - BOOTSTRAPPER_COMMAND m_command; - IBootstrapperEngine* m_pEngine; - BOOTSTRAPPER_ACTION m_plannedAction; - - LPWSTR m_sczAfterForcedRestartPackage; - LPWSTR m_sczBundleVersion; - - 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; - THEME_ASSIGN_CONTROL_ID m_rgInitControls[LAST_WIXSTDBA_CONTROL - WIXSTDBA_FIRST_ASSIGN_CONTROL_ID]; - DWORD m_rgdwPageIds[countof(vrgwzPageNames)]; - HANDLE m_hUiThread; - BOOL m_fRegistered; - HWND m_hWnd; - - // Welcome page - const THEME_CONTROL* m_pControlInstallButton; - const THEME_CONTROL* m_pControlEulaRichedit; - const THEME_CONTROL* m_pControlEulaHyperlink; - const THEME_CONTROL* m_pControlEulaAcceptCheckbox; - - // Modify page - const THEME_CONTROL* m_pControlRepairButton; - const THEME_CONTROL* m_pControlUninstallButton; - - // Update/loading pages - const THEME_CONTROL* m_pControlCheckingForUpdatesLabel; - const THEME_CONTROL* m_pControlInstallUpdateButton; - const THEME_CONTROL* m_pControlModifyUpdateButton; - - // Progress page - const THEME_CONTROL* m_pControlCacheProgressPackageText; - const THEME_CONTROL* m_pControlCacheProgressbar; - const THEME_CONTROL* m_pControlCacheProgressText; - - const THEME_CONTROL* m_pControlExecuteProgressPackageText; - const THEME_CONTROL* m_pControlExecuteProgressbar; - const THEME_CONTROL* m_pControlExecuteProgressText; - const THEME_CONTROL* m_pControlExecuteProgressActionDataText; - - const THEME_CONTROL* m_pControlOverallProgressPackageText; - const THEME_CONTROL* m_pControlOverallProgressbar; - const THEME_CONTROL* m_pControlOverallCalculatedProgressbar; - const THEME_CONTROL* m_pControlOverallProgressText; - - const THEME_CONTROL* m_pControlProgressCancelButton; - - // Success page - const THEME_CONTROL* m_pControlLaunchButton; - const THEME_CONTROL* m_pControlSuccessRestartButton; - - // Failure page - const THEME_CONTROL* m_pControlFailureLogFileLink; - const THEME_CONTROL* m_pControlFailureMessageText; - const THEME_CONTROL* m_pControlFailureRestartButton; - - WIXSTDBA_STATE m_state; - HRESULT m_hrFinal; - - BOOL m_fStartedExecution; - DWORD m_dwCalculatedCacheProgress; - DWORD m_dwCalculatedExecuteProgress; - - BOOTSTRAPPER_APPLY_RESTART m_restartResult; - BOOL m_fRestartRequired; - BOOL m_fShouldRestart; - BOOL m_fAllowRestart; - BOOL m_fRestartRequiresElevation; - BOOL m_fElevatingForRestart; - - LPWSTR m_sczLicenseFile; - LPWSTR m_sczLicenseUrl; - BOOL m_fSuppressDowngradeFailure; - BOOL m_fDowngrading; - BOOL m_fSuppressRepair; - BOOL m_fSupportCacheOnly; - BOOL m_fRequestedCacheOnly; - - PREQBA_DATA* m_pPrereqData; - BOOL m_fPrereq; - BOOL m_fPreplanPrereqs; - BOOL m_fPerformHelp; - BOOL m_fPrereqPackagePlanned; - BOOL m_fPrereqInstalled; - BOOL m_fPrereqSkipped; - - ITaskbarList3* m_pTaskbarList; - UINT m_uTaskbarButtonCreatedMessage; - BOOL m_fTaskbarButtonOK; - CRITICAL_SECTION m_csShowingInternalUiThisPackage; - BOOL m_fShowingInternalUiThisPackage; - BOOL m_fTriedToLaunchElevated; - - BOOL m_fShowStandardFilesInUse; - BOOL m_fShowRMFilesInUse; - BOOL m_fShowNetfxFilesInUse; - int m_nLastMsiFilesInUseResult; - int m_nLastNetfxFilesInUseResult; - LOC_STRING* m_pFilesInUseTitleLoc; - LOC_STRING* m_pFilesInUseLabelLoc; - LOC_STRING* m_pFilesInUseCloseRadioButtonLoc; - LOC_STRING* m_pFilesInUseNetfxCloseRadioButtonLoc; - LOC_STRING* m_pFilesInUseDontCloseRadioButtonLoc; - LOC_STRING* m_pFilesInUseRetryButtonLoc; - LOC_STRING* m_pFilesInUseIgnoreButtonLoc; - LOC_STRING* m_pFilesInUseExitButtonLoc; - - HMODULE m_hBAFModule; - PFN_BA_FUNCTIONS_PROC m_pfnBAFunctionsProc; - LPVOID m_pvBAFunctionsProcContext; -}; - - -// -// CreateBootstrapperApplication - creates a new IBootstrapperApplication object. -// -HRESULT CreateBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __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, pPrereqData, pEngine); - BalExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new standard bootstrapper application object."); - - hr = pApplication->Initialize(pArgs); - ExitOnFailure(hr, "CWixStandardBootstrapperApplication initialization failed."); - - pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; - pResults->pvBootstrapperApplicationProcContext = pApplication; - *ppApplication = pApplication; - pApplication = NULL; - -LExit: - ReleaseObject(pApplication); - return hr; -} - - -void DestroyBootstrapperApplication( - __in IBootstrapperApplication* pApplication, - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __inout BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - CWixStandardBootstrapperApplication* pBA = (CWixStandardBootstrapperApplication*)pApplication; - pBA->Uninitialize(pArgs, pResults); -} - - -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 LoggingBoolToString( - __in BOOL f - ) -{ - if (f) - { - return "Yes"; - } - - return "No"; -} - -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 LoggingPlanRelationTypeToString( - __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE type - ) -{ - switch (type) - { - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE: - return "None"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE: - return "Downgrade"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_UPGRADE: - return "Upgrade"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_ADDON: - return "Addon"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_PATCH: - return "Patch"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON: - return "DependentAddon"; - case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH: - return "DependentPatch"; - 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/inc/preqba.h b/src/ext/Bal/wixstdba/inc/preqba.h deleted file mode 100644 index 25fa7105..00000000 --- a/src/ext/Bal/wixstdba/inc/preqba.h +++ /dev/null @@ -1,19 +0,0 @@ -#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. - - -struct PREQBA_DATA -{ - HRESULT hrFatalError; - BOOL fAlwaysInstallPrereqs; - BOOL fPerformHelp; - BOOL fPerformLayout; - BOOL fCompleted; -}; - -extern "C" typedef HRESULT(WINAPI* PFN_PREQ_BOOTSTRAPPER_APPLICATION_CREATE)( - __in PREQBA_DATA* pPreqData, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults - ); diff --git a/src/ext/Bal/wixstdba/precomp.h b/src/ext/Bal/wixstdba/precomp.h index 290c125b..8844d150 100644 --- a/src/ext/Bal/wixstdba/precomp.h +++ b/src/ext/Bal/wixstdba/precomp.h @@ -35,8 +35,6 @@ #include #include -#include -#include #include #include @@ -46,20 +44,4 @@ #include -#include "inc\preqba.h" -#include "wixstdba.messages.h" - -HRESULT CreateBootstrapperApplication( - __in HMODULE hModule, - __in_opt PREQBA_DATA* pPrereqData, - __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, - __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, - __out IBootstrapperApplication** ppApplication - ); - -void DestroyBootstrapperApplication( - __in IBootstrapperApplication* pApplication, - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __inout BOOTSTRAPPER_DESTROY_RESULTS* pResults - ); +#include "WixStandardBootstrapperApplication.h" diff --git a/src/ext/Bal/wixstdba/resource.h b/src/ext/Bal/wixstdba/resource.h deleted file mode 100644 index 149a8ff4..00000000 --- a/src/ext/Bal/wixstdba/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -// 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 index 47f3f677..1024848d 100644 --- a/src/ext/Bal/wixstdba/wixstdba.cpp +++ b/src/ext/Bal/wixstdba/wixstdba.cpp @@ -2,9 +2,6 @@ #include "precomp.h" -static HINSTANCE vhInstance = NULL; -static IBootstrapperApplication* vpApplication = NULL; - static void CALLBACK WixstdbaTraceError( __in_z LPCSTR szFile, __in int iLine, @@ -15,94 +12,28 @@ static void CALLBACK WixstdbaTraceError( __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 +EXTERN_C int WINAPI wWinMain( + __in HINSTANCE hInstance, + __in_opt HINSTANCE /* hPrevInstance */, + __in_z_opt LPWSTR /*lpCmdLine*/, + __in int /*nCmdShow*/ ) { HRESULT hr = S_OK; - IBootstrapperEngine* pEngine = NULL; + IBootstrapperApplication* pApplication = NULL; DutilInitialize(&WixstdbaTraceError); - hr = BalInitializeFromCreateArgs(pArgs, &pEngine); - ExitOnFailure(hr, "Failed to initialize Bal."); + hr = CreateWixStandardBootstrapperApplication(hInstance, &pApplication); + ExitOnFailure(hr, "Failed to create WiX standard bootstrapper application."); - hr = CreateBootstrapperApplication(vhInstance, NULL, pEngine, pArgs, pResults, &vpApplication); - BalExitOnFailure(hr, "Failed to create bootstrapper application interface."); + hr = BootstrapperApplicationRun(pApplication); + ExitOnFailure(hr, "Failed to run WiX standard bootstrapper application."); LExit: - ReleaseObject(pEngine); - - return hr; -} - - -extern "C" void WINAPI BootstrapperApplicationDestroy( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - if (vpApplication) - { - DestroyBootstrapperApplication(vpApplication, pArgs, pResults); - } + ReleaseObject(pApplication); - ReleaseNullObject(vpApplication); - BalUninitialize(); - DutilUninitialize(); -} - - -extern "C" HRESULT WINAPI PrereqBootstrapperApplicationCreate( - __in_opt PREQBA_DATA* pPrereqData, - __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, pPrereqData, pEngine, pArgs, pResults, &vpApplication); - BalExitOnFailure(hr, "Failed to create prerequisite bootstrapper application interface."); - -LExit: - return hr; -} - - -extern "C" void WINAPI PrereqBootstrapperApplicationDestroy( - __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs, - __in BOOTSTRAPPER_DESTROY_RESULTS* pResults - ) -{ - BootstrapperApplicationDestroy(pArgs, pResults); + return 0; } static void CALLBACK WixstdbaTraceError( diff --git a/src/ext/Bal/wixstdba/wixstdba.def b/src/ext/Bal/wixstdba/wixstdba.def deleted file mode 100644 index e377196b..00000000 --- a/src/ext/Bal/wixstdba/wixstdba.def +++ /dev/null @@ -1,8 +0,0 @@ -; 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 - PrereqBootstrapperApplicationCreate - PrereqBootstrapperApplicationDestroy diff --git a/src/ext/Bal/wixstdba/wixstdba.mc b/src/ext/Bal/wixstdba/wixstdba.mc deleted file mode 100644 index 025315a5..00000000 --- a/src/ext/Bal/wixstdba/wixstdba.mc +++ /dev/null @@ -1,101 +0,0 @@ -; // 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=4 -Severity=Success -SymbolicName=MSG_WIXSTDBA_PLANNED_COMPATIBLE_MSI_PACKAGE -Language=English -WIXSTDBA: Planned compatible package: %2!ls! for %1!ls!, wixstdba requested remove: %3!hs!, bafunctions requested remove: %4!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! -. - -MessageId=8 -Severity=Success -SymbolicName=MSG_WIXSTDBA_PLANNED_ROLLBACK_BOUNDARY -Language=English -WIXSTDBA: Planned rollback boundary: %1!ls!, wixstdba requested transaction: %2!hs!, bafunctions requested transaction: %3!hs! -. - -MessageId=9 -Severity=Success -SymbolicName=MSG_WIXSTDBA_PLANNED_RESTORE_RELATED_BUNDLE -Language=English -WIXSTDBA: Planned restore related bundle: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! -. - -MessageId=10 -Severity=Success -SymbolicName=MSG_WIXSTDBA_PLANNED_RELATED_BUNDLE_TYPE -Language=English -WIXSTDBA: Planned related bundle type: %1!ls!, wixstdba requested: %2!hs!, bafunctions requested: %3!hs! -. - diff --git a/src/ext/Bal/wixstdba/wixstdba.rc b/src/ext/Bal/wixstdba/wixstdba.rc new file mode 100644 index 00000000..a029458e --- /dev/null +++ b/src/ext/Bal/wixstdba/wixstdba.rc @@ -0,0 +1 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. diff --git a/src/ext/Bal/wixstdba/wixstdba.vcxproj b/src/ext/Bal/wixstdba/wixstdba.vcxproj index 9df3d5fd..e8317fbf 100644 --- a/src/ext/Bal/wixstdba/wixstdba.vcxproj +++ b/src/ext/Bal/wixstdba/wixstdba.vcxproj @@ -1,7 +1,7 @@ - + Debug @@ -31,49 +31,58 @@ {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA} - DynamicLibrary + Win32Proj + Application + Windows Unicode - WixStdBA - wixstdba.def + WiX Standard Bootstrapper Application + + + + + + - comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;wixstdba.res + $(ProjectDir)..\stdbas\inc + comctl32.lib;gdiplus.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;stdbas.res + + + comctl32.dll;gdiplus.dll;shlwapi.dll;version.dll;wininet.dll + /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions) + + + - - Create - - - - - - - + + 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 - + + {DBBF5F32-BAEA-46A8-99A0-17277A906456} + - diff --git a/src/ext/Dependency/ca/wixdepca.cpp b/src/ext/Dependency/ca/wixdepca.cpp index 87610420..dc967a1d 100644 --- a/src/ext/Dependency/ca/wixdepca.cpp +++ b/src/ext/Dependency/ca/wixdepca.cpp @@ -209,7 +209,7 @@ static HRESULT EnsureRequiredDependencies( // Send a yes/no message with a warning icon since continuing could be detrimental. // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding - // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + // or if Windows Installer or a dependency-unaware bootstrapper is returning a typical default response. er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); switch (er) { @@ -359,7 +359,7 @@ static HRESULT EnsureAbsentDependents( // Send a yes/no message with a warning icon since continuing could be detrimental. // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding - // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + // or if Windows Installer or a dependency-unaware bootstrapper is returning a typical default response. er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); switch (er) { diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi index affe0143..e8f981ea 100644 --- a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi @@ -35,7 +35,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -59,6 +59,6 @@ - + diff --git a/src/ext/NetFx/wixlib/NetFx462.wxs b/src/ext/NetFx/wixlib/NetFx462.wxs index 904d2be0..57407bcd 100644 --- a/src/ext/NetFx/wixlib/NetFx462.wxs +++ b/src/ext/NetFx/wixlib/NetFx462.wxs @@ -40,7 +40,7 @@ - + @@ -62,6 +62,6 @@ - + diff --git a/src/ext/NetFx/wixlib/NetFx472.wxs b/src/ext/NetFx/wixlib/NetFx472.wxs index 15cb0de2..7d2ce72d 100644 --- a/src/ext/NetFx/wixlib/NetFx472.wxs +++ b/src/ext/NetFx/wixlib/NetFx472.wxs @@ -40,7 +40,7 @@ - + @@ -62,6 +62,6 @@ - + diff --git a/src/ext/NetFx/wixlib/NetFx48.wxs b/src/ext/NetFx/wixlib/NetFx48.wxs index fc2f97f5..395a0b47 100644 --- a/src/ext/NetFx/wixlib/NetFx48.wxs +++ b/src/ext/NetFx/wixlib/NetFx48.wxs @@ -40,7 +40,7 @@ - + @@ -62,6 +62,6 @@ - + diff --git a/src/ext/NetFx/wixlib/NetFx481.wxs b/src/ext/NetFx/wixlib/NetFx481.wxs index b0da8bb0..dc29a585 100644 --- a/src/ext/NetFx/wixlib/NetFx481.wxs +++ b/src/ext/NetFx/wixlib/NetFx481.wxs @@ -63,7 +63,7 @@ - + @@ -74,28 +74,28 @@ - - @@ -106,6 +106,6 @@ - + diff --git a/src/ext/Util/ca/test.cpp b/src/ext/Util/ca/test.cpp index c4d215f0..e9d02ed3 100644 --- a/src/ext/Util/ca/test.cpp +++ b/src/ext/Util/ca/test.cpp @@ -216,7 +216,7 @@ static DWORD WINAPI ThreadProc( // Create the window to handle reboots without activating it. hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, SW_SHOWNA, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, NULL); - ExitOnNullWithLastError(hWnd, hr, "Failed to create window."); + ExitOnNullWithLastError(hWnd, hr, "Failed to create test UI thread window."); // Persist the window handle and let the caller know we've initialized. pContext->hWnd = hWnd; diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs index 45147066..09ce72a5 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs @@ -1,8 +1,6 @@ - - - + diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs index cc7162d7..db36f9b4 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs @@ -1,8 +1,6 @@ - - - + diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index f7bb0614..6221c052 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs @@ -800,7 +800,7 @@ namespace WixToolset.Util } var componentKeyPath = this.CreateComponentKeyPath(); - componentKeyPath.Id = id.Id; + componentKeyPath.Id = id; componentKeyPath.Explicit = isKeyPath; componentKeyPath.Type = PossibleKeyPathType.Registry; return componentKeyPath; -- cgit v1.2.3-55-g6feb