diff options
author | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:42:09 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:42:09 -0700 |
commit | 8e1207c4c5e451ba1a087f0fa11b63964ac35f3c (patch) | |
tree | 8cdfc18d38f25a5fb8e63f115d3447b11172e1e5 | |
parent | 6fa3bf7fe67e25650d5a2b6bec09a9813b1a4722 (diff) | |
parent | c00516901e6b67e398396b14fe7682d0376f8643 (diff) | |
download | wix-8e1207c4c5e451ba1a087f0fa11b63964ac35f3c.tar.gz wix-8e1207c4c5e451ba1a087f0fa11b63964ac35f3c.tar.bz2 wix-8e1207c4c5e451ba1a087f0fa11b63964ac35f3c.zip |
Merge balutil
105 files changed, 19988 insertions, 0 deletions
diff --git a/src/api/burn/CustomizedNativeRecommendedRules.ruleset b/src/api/burn/CustomizedNativeRecommendedRules.ruleset new file mode 100644 index 00000000..142b141c --- /dev/null +++ b/src/api/burn/CustomizedNativeRecommendedRules.ruleset | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <RuleSet Name="Customized Microsoft Native Recommended Rules" Description="Microsoft Native Recommended Rules, -C26812" ToolsVersion="16.0"> | ||
3 | <Include Path="nativerecommendedrules.ruleset" Action="Default" /> | ||
4 | <Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native"> | ||
5 | <!-- We need C style enums since we support BAs written in C --> | ||
6 | <Rule Id="C26812" Action="None" /> | ||
7 | </Rules> | ||
8 | </RuleSet> \ No newline at end of file | ||
diff --git a/src/api/burn/Directory.Build.props b/src/api/burn/Directory.Build.props new file mode 100644 index 00000000..fb34d54e --- /dev/null +++ b/src/api/burn/Directory.Build.props | |||
@@ -0,0 +1,26 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <!-- | ||
4 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\Directory.Build.props | ||
5 | then update all of the repos. | ||
6 | --> | ||
7 | <Project> | ||
8 | <PropertyGroup> | ||
9 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
10 | <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> | ||
11 | |||
12 | <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> | ||
13 | <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath> | ||
14 | <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath> | ||
15 | <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> | ||
16 | |||
17 | <Authors>WiX Toolset Team</Authors> | ||
18 | <Company>WiX Toolset</Company> | ||
19 | <Copyright>Copyright (c) .NET Foundation and contributors. All rights reserved.</Copyright> | ||
20 | <PackageLicenseExpression>MS-RL</PackageLicenseExpression> | ||
21 | <Product>WiX Toolset</Product> | ||
22 | </PropertyGroup> | ||
23 | |||
24 | <Import Project="Directory$(MSBuildProjectExtension).props" Condition=" Exists('Directory$(MSBuildProjectExtension).props') " /> | ||
25 | <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> | ||
26 | </Project> | ||
diff --git a/src/api/burn/Directory.Build.targets b/src/api/burn/Directory.Build.targets new file mode 100644 index 00000000..44701fb6 --- /dev/null +++ b/src/api/burn/Directory.Build.targets | |||
@@ -0,0 +1,73 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <!-- | ||
4 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\Directory.Build.targets | ||
5 | then update all of the repos. | ||
6 | --> | ||
7 | <Project> | ||
8 | <PropertyGroup> | ||
9 | <SigningToolFolder>$(BaseOutputPath)obj\.tools</SigningToolFolder> | ||
10 | <SigningToolExe>$(SigningToolFolder)\SignClient.exe</SigningToolExe> | ||
11 | <SigningFilelist>$(SigningToolFolder)\empty-filelist.txt</SigningFilelist> | ||
12 | <SigningConfiguration>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), signing.json))\signing.json</SigningConfiguration> | ||
13 | </PropertyGroup> | ||
14 | |||
15 | <PropertyGroup> | ||
16 | <CreateDocumentation Condition=" '$(CreateDocumentationFile)'!='true' ">false</CreateDocumentation> | ||
17 | <DocumentationFile Condition=" '$(CreateDocumentationFile)'=='true' ">$(OutputPath)\$(AssemblyName).xml</DocumentationFile> | ||
18 | </PropertyGroup> | ||
19 | |||
20 | <Target Name="SetNuspecProperties" DependsOnTargets="InitializeSourceControlInformation" AfterTargets="GetBuildVersion" | ||
21 | Condition=" Exists('$(MSBuildProjectName).nuspec') "> | ||
22 | <PropertyGroup> | ||
23 | <ProjectUrl Condition=" '$(ProjectUrl)'=='' and '$(PrivateRepositoryUrl)'!='' ">$(PrivateRepositoryUrl.Replace('.git',''))</ProjectUrl> | ||
24 | |||
25 | <NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile> | ||
26 | <NuspecBasePath Condition=" '$(NuspecBasePath)'=='' ">$(MSBuildProjectDirectory)</NuspecBasePath> | ||
27 | <NuspecProperties>$(NuspecProperties);Id=$(PackageId);Authors="$(Authors)";Configuration=$(Configuration);Copyright="$(Copyright)";Description="$(Description)";Title="$(Title)"</NuspecProperties> | ||
28 | <NuspecProperties>$(NuspecProperties);Version=$(NPMPackageVersion);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);ProjectFolder=$(MSBuildProjectDirectory)\;ProjectUrl=$(ProjectUrl)</NuspecProperties> | ||
29 | <PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
30 | <SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
31 | </PropertyGroup> | ||
32 | </Target> | ||
33 | |||
34 | <Target Name="PackNative" DependsOnTargets="GetBuildVersion;SetNuspecProperties" | ||
35 | Condition=" Exists('$(MSBuildProjectName).nuspec') "> | ||
36 | |||
37 | <Exec Command='nuget pack $(NuspecFile) -OutputDirectory "$(BaseOutputPath)$(Configuration)" -BasePath "$(NuspecBasePath)" -Properties $(NuspecProperties)' | ||
38 | WorkingDirectory="$(MSBuildProjectDirectory)" /> | ||
39 | |||
40 | <ItemGroup> | ||
41 | <NuGetPackOutput Include="$(BaseOutputPath)$(Configuration)\**\$(PackageId)*.nupkg" /> | ||
42 | </ItemGroup> | ||
43 | </Target> | ||
44 | |||
45 | <Target Name="_GetSignClient" | ||
46 | Condition=" !Exists('$(SigningToolExe)') "> | ||
47 | |||
48 | <WriteLinesToFile File='$(SigningFilelist)' Lines='do-not-sign-files-in-nupkg' Overwrite='true' /> | ||
49 | |||
50 | <Exec Command='dotnet.exe tool install --tool-path "$(SigningToolFolder)" SignClient' /> | ||
51 | </Target> | ||
52 | |||
53 | <Target Name="SignOutput" DependsOnTargets="_GetSignClient" AfterTargets="AfterBuild" | ||
54 | Condition=" '$(SigningUser)'!='' and '$(SignOutput)'!='false' and | ||
55 | ('$(MSBuildProjectExtension)'=='.csproj' or ('$(MSBuildProjectExtension)'=='.vcxproj' and '$(ConfigurationType)'!='StaticLibrary'))"> | ||
56 | |||
57 | <Exec Command='"$(SigningToolExe)" sign -i $(TargetPath) -c "$(SigningConfiguration)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"' | ||
58 | WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" /> | ||
59 | </Target> | ||
60 | |||
61 | <Target Name="SignNupkg" DependsOnTargets="_GetSignClient" AfterTargets="Pack;PackNative" | ||
62 | Condition=" '$(SigningUser)'!='' and '@(NuGetPackOutput)'!='' and '$(SignNupkg)'!='false' "> | ||
63 | <ItemGroup> | ||
64 | <SigningNupkgs Include="@(NuGetPackOutput)" Condition=" '%(Extension)'=='.nupkg' " /> | ||
65 | </ItemGroup> | ||
66 | |||
67 | <Exec Command='"$(SigningToolExe)" sign -i "@(SigningNupkgs->'%(Identity)')" -c "$(SigningConfiguration)" -f "$(SigningFilelist)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"' | ||
68 | WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" /> | ||
69 | </Target> | ||
70 | |||
71 | <Import Project="Directory$(MSBuildProjectExtension).targets" Condition=" Exists('Directory$(MSBuildProjectExtension).targets') " /> | ||
72 | <Import Project="Custom.Build.targets" Condition=" Exists('Custom.Build.targets') " /> | ||
73 | </Project> | ||
diff --git a/src/api/burn/Directory.csproj.props b/src/api/burn/Directory.csproj.props new file mode 100644 index 00000000..81d24ad1 --- /dev/null +++ b/src/api/burn/Directory.csproj.props | |||
@@ -0,0 +1,13 @@ | |||
1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
2 | <!-- | ||
3 | Do NOT modify this file. Update the canonical version in Home\repo-template\src\CSharp.Build.props | ||
4 | then update all of the repos. | ||
5 | --> | ||
6 | <Project> | ||
7 | <PropertyGroup> | ||
8 | <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> | ||
9 | <SignAssembly>true</SignAssembly> | ||
10 | <AssemblyOriginatorKeyFile>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk))</AssemblyOriginatorKeyFile> | ||
11 | <NBGV_EmitThisAssemblyClass>false</NBGV_EmitThisAssemblyClass> | ||
12 | </PropertyGroup> | ||
13 | </Project> | ||
diff --git a/src/api/burn/Directory.vcxproj.props b/src/api/burn/Directory.vcxproj.props new file mode 100644 index 00000000..9ea7071b --- /dev/null +++ b/src/api/burn/Directory.vcxproj.props | |||
@@ -0,0 +1,115 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project> | ||
5 | <PropertyGroup> | ||
6 | <Platform Condition=" '$(Platform)' == '' OR '$(Platform)' == 'AnyCPU' ">Win32</Platform> | ||
7 | <IntDir>$(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\</IntDir> | ||
8 | <OutDir>$(OutputPath)$(Platform)\</OutDir> | ||
9 | |||
10 | <!-- NBGV properties --> | ||
11 | <AssemblyCompany>$(Company)</AssemblyCompany> | ||
12 | <AssemblyCopyright>$(Copyright)</AssemblyCopyright> | ||
13 | |||
14 | <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers> | ||
15 | <NuGetTargetMoniker>native,Version=v0.0</NuGetTargetMoniker> | ||
16 | </PropertyGroup> | ||
17 | |||
18 | <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' AND '$(VisualStudioVersion)'>='15.0'"> | ||
19 | <WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion> | ||
20 | </PropertyGroup> | ||
21 | |||
22 | <PropertyGroup> | ||
23 | <CodeAnalysisRuleSet Condition=" Exists('$(MSBuildThisFileDirectory)CustomizedNativeRecommendedRules.ruleset') ">$(MSBuildThisFileDirectory)CustomizedNativeRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
24 | </PropertyGroup> | ||
25 | |||
26 | <ItemDefinitionGroup> | ||
27 | <ClCompile> | ||
28 | <DisableSpecificWarnings>$(DisableSpecificCompilerWarnings)</DisableSpecificWarnings> | ||
29 | <WarningLevel>Level4</WarningLevel> | ||
30 | <AdditionalIncludeDirectories>$(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
31 | <PreprocessorDefinitions>WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
32 | <PrecompiledHeader>Use</PrecompiledHeader> | ||
33 | <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile> | ||
34 | <CallingConvention Condition="'$(Platform)'=='Win32'">StdCall</CallingConvention> | ||
35 | <TreatWarningAsError>true</TreatWarningAsError> | ||
36 | <ExceptionHandling>false</ExceptionHandling> | ||
37 | <AdditionalOptions>-YlprecompDefine</AdditionalOptions> | ||
38 | <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions> | ||
39 | <MultiProcessorCompilation Condition=" $(NUMBER_OF_PROCESSORS) > 4 ">true</MultiProcessorCompilation> | ||
40 | </ClCompile> | ||
41 | <ResourceCompile> | ||
42 | <PreprocessorDefinitions>$(ArmPreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
43 | <AdditionalIncludeDirectories>$(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
44 | </ResourceCompile> | ||
45 | <Lib> | ||
46 | <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
47 | </Lib> | ||
48 | <Link> | ||
49 | <SubSystem>$(ProjectSubSystem)</SubSystem> | ||
50 | <ModuleDefinitionFile>$(ProjectModuleDefinitionFile)</ModuleDefinitionFile> | ||
51 | <NoEntryPoint>$(ResourceOnlyDll)</NoEntryPoint> | ||
52 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
53 | <AdditionalDependencies>$(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
54 | <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
55 | <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/IGNORE:4099 %(AdditionalOptions)</AdditionalOptions> | ||
56 | </Link> | ||
57 | </ItemDefinitionGroup> | ||
58 | |||
59 | <ItemDefinitionGroup Condition=" '$(Platform)'=='Win32' and '$(PlatformToolset)'!='v100'"> | ||
60 | <ClCompile> | ||
61 | <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet> | ||
62 | </ClCompile> | ||
63 | </ItemDefinitionGroup> | ||
64 | <ItemDefinitionGroup Condition=" '$(Platform)'=='arm' "> | ||
65 | <ClCompile> | ||
66 | <CallingConvention>CDecl</CallingConvention> | ||
67 | </ClCompile> | ||
68 | </ItemDefinitionGroup> | ||
69 | <ItemDefinitionGroup Condition=" '$(ConfigurationType)'=='StaticLibrary' "> | ||
70 | <ClCompile> | ||
71 | <DebugInformationFormat>OldStyle</DebugInformationFormat> | ||
72 | <OmitDefaultLibName>true</OmitDefaultLibName> | ||
73 | <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> | ||
74 | </ClCompile> | ||
75 | </ItemDefinitionGroup> | ||
76 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' "> | ||
77 | <ClCompile> | ||
78 | <Optimization>Disabled</Optimization> | ||
79 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
80 | <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
81 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
82 | </ClCompile> | ||
83 | </ItemDefinitionGroup> | ||
84 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' and '$(CLRSupport)'=='true' "> | ||
85 | <ClCompile> | ||
86 | <BasicRuntimeChecks></BasicRuntimeChecks> | ||
87 | <RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary> | ||
88 | </ClCompile> | ||
89 | </ItemDefinitionGroup> | ||
90 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' "> | ||
91 | <ClCompile> | ||
92 | <Optimization>MinSpace</Optimization> | ||
93 | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
94 | <FunctionLevelLinking>true</FunctionLevelLinking> | ||
95 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
96 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
97 | </ClCompile> | ||
98 | <Link> | ||
99 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
100 | <OptimizeReferences>true</OptimizeReferences> | ||
101 | </Link> | ||
102 | </ItemDefinitionGroup> | ||
103 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' and '$(CLRSupport)'=='true' "> | ||
104 | <ClCompile> | ||
105 | <BasicRuntimeChecks></BasicRuntimeChecks> | ||
106 | <RuntimeLibrary>MultiThreadedDll</RuntimeLibrary> | ||
107 | </ClCompile> | ||
108 | </ItemDefinitionGroup> | ||
109 | <ItemDefinitionGroup Condition=" '$(CLRSupport)'=='true' "> | ||
110 | <Link> | ||
111 | <KeyFile>$(LinkKeyFile)</KeyFile> | ||
112 | <DelaySign>$(LinkDelaySign)</DelaySign> | ||
113 | </Link> | ||
114 | </ItemDefinitionGroup> | ||
115 | </Project> | ||
diff --git a/src/api/burn/NativeMultiTargeting.Build.props b/src/api/burn/NativeMultiTargeting.Build.props new file mode 100644 index 00000000..1ff46559 --- /dev/null +++ b/src/api/burn/NativeMultiTargeting.Build.props | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project> | ||
5 | <!-- Overrides the standard Cpp.Build.props to include the PlatformToolset in the output path. --> | ||
6 | <PropertyGroup> | ||
7 | <IntDir>$(BaseIntermediateOutputPath)$(Configuration)\$(PlatformToolset)\$(PlatformTarget)\</IntDir> | ||
8 | <OutDir>$(OutputPath)$(PlatformToolset)\$(PlatformTarget)\</OutDir> | ||
9 | </PropertyGroup> | ||
10 | </Project> | ||
diff --git a/src/api/burn/README.md b/src/api/burn/README.md new file mode 100644 index 00000000..380bbda3 --- /dev/null +++ b/src/api/burn/README.md | |||
@@ -0,0 +1,2 @@ | |||
1 | # balutil | ||
2 | balutil.lib - WiX Toolset Bootstrapper Application Layer native utility library | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec b/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec new file mode 100644 index 00000000..b10b75d2 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec | |||
@@ -0,0 +1,19 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <package > | ||
3 | <metadata> | ||
4 | <id>$id$</id> | ||
5 | <version>$version$</version> | ||
6 | <authors>WiX Toolset Team</authors> | ||
7 | <owners>WiX Toolset Team</owners> | ||
8 | <license type="expression">MS-RL</license> | ||
9 | <projectUrl>https://github.com/wixtoolset/BootstrapperCore</projectUrl> | ||
10 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
11 | <description>$description$</description> | ||
12 | <copyright>$copyright$</copyright> | ||
13 | </metadata> | ||
14 | |||
15 | <files> | ||
16 | <file src="build\$id$.props" target="build\" /> | ||
17 | <file src="inc\*" target="build\native\include" /> | ||
18 | </files> | ||
19 | </package> | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj b/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj new file mode 100644 index 00000000..0899bdcf --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj | |||
@@ -0,0 +1,19 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Project ToolsVersion="4.0" DefaultTargets="Pack" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <PropertyGroup> | ||
7 | <PackageId>WixToolset.BootstrapperCore.Native</PackageId> | ||
8 | <Description>WiX Bootstrapper native interfaces</Description> | ||
9 | </PropertyGroup> | ||
10 | |||
11 | <Target Name="PackNative" DependsOnTargets="GetBuildVersion"> | ||
12 | <Exec Command='nuget pack $(PackageId).nuspec -OutputDirectory "$(BaseOutputPath)$(Configuration)" -Properties Id=$(PackageId);Version="$(BuildVersionSimple)";Authors="$(Authors)";Copyright="$(Copyright)";Description="$(Description)"' /> | ||
13 | </Target> | ||
14 | |||
15 | <Import Project="..\Directory.Build.props" /> | ||
16 | <!-- <Import Project="..\Directory.Build.targets" /> --> | ||
17 | |||
18 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
19 | </Project> | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props b/src/api/burn/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props new file mode 100644 index 00000000..82f81163 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props | |||
@@ -0,0 +1,13 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <ItemDefinitionGroup> | ||
6 | <ClCompile> | ||
7 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
8 | </ClCompile> | ||
9 | <ResourceCompile> | ||
10 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
11 | </ResourceCompile> | ||
12 | </ItemDefinitionGroup> | ||
13 | </Project> | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h new file mode 100644 index 00000000..2a6d5c8a --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h | |||
@@ -0,0 +1,1318 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | enum BOOTSTRAPPER_DISPLAY | ||
6 | { | ||
7 | BOOTSTRAPPER_DISPLAY_UNKNOWN, | ||
8 | BOOTSTRAPPER_DISPLAY_EMBEDDED, | ||
9 | BOOTSTRAPPER_DISPLAY_NONE, | ||
10 | BOOTSTRAPPER_DISPLAY_PASSIVE, | ||
11 | BOOTSTRAPPER_DISPLAY_FULL, | ||
12 | }; | ||
13 | |||
14 | enum BOOTSTRAPPER_RESTART | ||
15 | { | ||
16 | BOOTSTRAPPER_RESTART_UNKNOWN, | ||
17 | BOOTSTRAPPER_RESTART_NEVER, | ||
18 | BOOTSTRAPPER_RESTART_PROMPT, | ||
19 | BOOTSTRAPPER_RESTART_AUTOMATIC, | ||
20 | BOOTSTRAPPER_RESTART_ALWAYS, | ||
21 | }; | ||
22 | |||
23 | enum BOOTSTRAPPER_RESUME_TYPE | ||
24 | { | ||
25 | BOOTSTRAPPER_RESUME_TYPE_NONE, | ||
26 | BOOTSTRAPPER_RESUME_TYPE_INVALID, // resume information is present but invalid | ||
27 | BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, // relaunched after an unexpected interruption | ||
28 | BOOTSTRAPPER_RESUME_TYPE_REBOOT_PENDING, // reboot has not taken place yet | ||
29 | BOOTSTRAPPER_RESUME_TYPE_REBOOT, // relaunched after reboot | ||
30 | BOOTSTRAPPER_RESUME_TYPE_SUSPEND, // relaunched after suspend | ||
31 | BOOTSTRAPPER_RESUME_TYPE_ARP, // launched from ARP | ||
32 | }; | ||
33 | |||
34 | enum BOOTSTRAPPER_ERROR_TYPE | ||
35 | { | ||
36 | BOOTSTRAPPER_ERROR_TYPE_ELEVATE, // error occurred trying to elevate. | ||
37 | BOOTSTRAPPER_ERROR_TYPE_WINDOWS_INSTALLER, // error came from windows installer. | ||
38 | BOOTSTRAPPER_ERROR_TYPE_EXE_PACKAGE, // error came from an exe package. | ||
39 | BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER, // error occurred trying to authenticate with HTTP server. | ||
40 | BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY, // error occurred trying to authenticate with HTTP proxy. | ||
41 | BOOTSTRAPPER_ERROR_TYPE_APPLY, // error occurred during apply. | ||
42 | }; | ||
43 | |||
44 | enum BOOTSTRAPPER_RELATED_OPERATION | ||
45 | { | ||
46 | BOOTSTRAPPER_RELATED_OPERATION_NONE, | ||
47 | BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE, | ||
48 | BOOTSTRAPPER_RELATED_OPERATION_MINOR_UPDATE, | ||
49 | BOOTSTRAPPER_RELATED_OPERATION_MAJOR_UPGRADE, | ||
50 | BOOTSTRAPPER_RELATED_OPERATION_REMOVE, | ||
51 | BOOTSTRAPPER_RELATED_OPERATION_INSTALL, | ||
52 | BOOTSTRAPPER_RELATED_OPERATION_REPAIR, | ||
53 | }; | ||
54 | |||
55 | enum BOOTSTRAPPER_CACHE_OPERATION | ||
56 | { | ||
57 | // There is no source available. | ||
58 | BOOTSTRAPPER_CACHE_OPERATION_NONE, | ||
59 | // Copy the payload or container from the chosen local source. | ||
60 | BOOTSTRAPPER_CACHE_OPERATION_COPY, | ||
61 | // Download the payload or container using the download URL. | ||
62 | BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD, | ||
63 | // Extract the payload from the container. | ||
64 | BOOTSTRAPPER_CACHE_OPERATION_EXTRACT, | ||
65 | }; | ||
66 | |||
67 | enum BOOTSTRAPPER_CACHE_RESOLVE_OPERATION | ||
68 | { | ||
69 | // There is no source available. | ||
70 | BOOTSTRAPPER_CACHE_RESOLVE_NONE, | ||
71 | // Copy the payload or container from the chosen local source. | ||
72 | BOOTSTRAPPER_CACHE_RESOLVE_LOCAL, | ||
73 | // Download the payload or container from the download URL. | ||
74 | BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD, | ||
75 | // Extract the payload from the container. | ||
76 | BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER, | ||
77 | // Look again for the payload or container locally. | ||
78 | BOOTSTRAPPER_CACHE_RESOLVE_RETRY, | ||
79 | }; | ||
80 | |||
81 | enum BOOTSTRAPPER_CACHE_VERIFY_STEP | ||
82 | { | ||
83 | BOOTSTRAPPER_CACHE_VERIFY_STEP_STAGE, | ||
84 | BOOTSTRAPPER_CACHE_VERIFY_STEP_HASH, | ||
85 | BOOTSTRAPPER_CACHE_VERIFY_STEP_FINALIZE, | ||
86 | }; | ||
87 | |||
88 | enum BOOTSTRAPPER_APPLY_RESTART | ||
89 | { | ||
90 | BOOTSTRAPPER_APPLY_RESTART_NONE, | ||
91 | BOOTSTRAPPER_APPLY_RESTART_REQUIRED, | ||
92 | BOOTSTRAPPER_APPLY_RESTART_INITIATED, | ||
93 | }; | ||
94 | |||
95 | enum BOOTSTRAPPER_RELATION_TYPE | ||
96 | { | ||
97 | BOOTSTRAPPER_RELATION_NONE, | ||
98 | BOOTSTRAPPER_RELATION_DETECT, | ||
99 | BOOTSTRAPPER_RELATION_UPGRADE, | ||
100 | BOOTSTRAPPER_RELATION_ADDON, | ||
101 | BOOTSTRAPPER_RELATION_PATCH, | ||
102 | BOOTSTRAPPER_RELATION_DEPENDENT, | ||
103 | BOOTSTRAPPER_RELATION_UPDATE, | ||
104 | }; | ||
105 | |||
106 | enum BOOTSTRAPPER_CACHE_TYPE | ||
107 | { | ||
108 | BOOTSTRAPPER_CACHE_TYPE_REMOVE, | ||
109 | BOOTSTRAPPER_CACHE_TYPE_KEEP, | ||
110 | BOOTSTRAPPER_CACHE_TYPE_FORCE, | ||
111 | }; | ||
112 | |||
113 | enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT | ||
114 | { | ||
115 | BOOTSTRAPPER_PACKAGE_CONDITION_DEFAULT, | ||
116 | BOOTSTRAPPER_PACKAGE_CONDITION_FALSE, | ||
117 | BOOTSTRAPPER_PACKAGE_CONDITION_TRUE, | ||
118 | }; | ||
119 | |||
120 | enum BOOTSTRAPPER_APPLICATION_MESSAGE | ||
121 | { | ||
122 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, | ||
123 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, | ||
124 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, | ||
125 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, | ||
126 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, | ||
127 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, | ||
128 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, | ||
129 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, | ||
130 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, | ||
131 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, | ||
132 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, | ||
133 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, | ||
134 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, | ||
135 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, | ||
136 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, | ||
137 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, | ||
138 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, | ||
139 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, | ||
140 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, | ||
141 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, | ||
142 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, | ||
143 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, | ||
144 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, | ||
145 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, | ||
146 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, | ||
147 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, | ||
148 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, | ||
149 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, | ||
150 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, | ||
151 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, | ||
152 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, | ||
153 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, | ||
154 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, | ||
155 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, | ||
156 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, | ||
157 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, | ||
158 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, | ||
159 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, | ||
160 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, | ||
161 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, | ||
162 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, | ||
163 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, | ||
164 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, | ||
165 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, | ||
166 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, | ||
167 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, | ||
168 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, | ||
169 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, | ||
170 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, | ||
171 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, | ||
172 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, | ||
173 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, | ||
174 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, | ||
175 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, | ||
176 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, | ||
177 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, | ||
178 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, | ||
179 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, | ||
180 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, | ||
181 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, | ||
182 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, | ||
183 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, | ||
184 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, | ||
185 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, | ||
186 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, | ||
187 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, | ||
188 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, | ||
189 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, | ||
190 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, | ||
191 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, | ||
192 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, | ||
193 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, | ||
194 | }; | ||
195 | |||
196 | enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION | ||
197 | { | ||
198 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE, | ||
199 | // Instructs the engine to restart. | ||
200 | // The engine will not launch again after the machine is rebooted. | ||
201 | // Ignored if reboot was already initiated by OnExecutePackageComplete(). | ||
202 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART, | ||
203 | }; | ||
204 | |||
205 | enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION | ||
206 | { | ||
207 | BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE, | ||
208 | // Instructs the engine to try the acquisition of the payload again. | ||
209 | // Ignored if hrStatus is a success. | ||
210 | BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY, | ||
211 | }; | ||
212 | |||
213 | enum BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION | ||
214 | { | ||
215 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE, | ||
216 | // Instructs the engine to ignore non-vital package failures and | ||
217 | // continue with the caching. | ||
218 | // Ignored if hrStatus is a success or the package is vital. | ||
219 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_IGNORE, | ||
220 | // Instructs the engine to try the acquisition and verification of the package again. | ||
221 | // Ignored if hrStatus is a success. | ||
222 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_RETRY, | ||
223 | }; | ||
224 | |||
225 | enum BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION | ||
226 | { | ||
227 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE, | ||
228 | // Ignored if hrStatus is a success. | ||
229 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION, | ||
230 | // Ignored if hrStatus is a success. | ||
231 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYACQUISITION, | ||
232 | }; | ||
233 | |||
234 | enum BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION | ||
235 | { | ||
236 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_NONE, | ||
237 | // Instructs the engine to ignore non-vital package failures and | ||
238 | // continue with the install. | ||
239 | // Ignored if hrStatus is a success or the package is vital. | ||
240 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_IGNORE, | ||
241 | // Instructs the engine to try the execution of the package again. | ||
242 | // Ignored if hrStatus is a success. | ||
243 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RETRY, | ||
244 | // Instructs the engine to stop processing the chain and restart. | ||
245 | // The engine will launch again after the machine is restarted. | ||
246 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART, | ||
247 | // Instructs the engine to stop processing the chain and | ||
248 | // suspend the current state. | ||
249 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_SUSPEND, | ||
250 | }; | ||
251 | |||
252 | enum BOOTSTRAPPER_SHUTDOWN_ACTION | ||
253 | { | ||
254 | BOOTSTRAPPER_SHUTDOWN_ACTION_NONE, | ||
255 | // Instructs the engine to restart. | ||
256 | // The engine will not launch again after the machine is rebooted. | ||
257 | // Ignored if reboot was already initiated by OnExecutePackageComplete(). | ||
258 | BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART, | ||
259 | // Instructs the engine to unload the bootstrapper application and | ||
260 | // restart the engine which will load the bootstrapper application again. | ||
261 | // Typically used to switch from a native bootstrapper application to a managed one. | ||
262 | BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER, | ||
263 | // Opts out of the engine behavior of trying to uninstall itself | ||
264 | // when no non-permanent packages are installed. | ||
265 | BOOTSTRAPPER_SHUTDOWN_ACTION_SKIP_CLEANUP, | ||
266 | }; | ||
267 | |||
268 | enum BURN_MSI_PROPERTY | ||
269 | { | ||
270 | BURN_MSI_PROPERTY_NONE, // no property added | ||
271 | BURN_MSI_PROPERTY_INSTALL, // add BURNMSIINSTALL=1 | ||
272 | BURN_MSI_PROPERTY_MODIFY, // add BURNMSIMODIFY=1 | ||
273 | BURN_MSI_PROPERTY_REPAIR, // add BURNMSIREPAIR=1 | ||
274 | BURN_MSI_PROPERTY_UNINSTALL,// add BURNMSIUNINSTALL=1 | ||
275 | }; | ||
276 | |||
277 | struct BOOTSTRAPPER_COMMAND | ||
278 | { | ||
279 | DWORD cbSize; | ||
280 | BOOTSTRAPPER_ACTION action; | ||
281 | BOOTSTRAPPER_DISPLAY display; | ||
282 | BOOTSTRAPPER_RESTART restart; | ||
283 | |||
284 | LPWSTR wzCommandLine; | ||
285 | int nCmdShow; | ||
286 | |||
287 | BOOTSTRAPPER_RESUME_TYPE resumeType; | ||
288 | HWND hwndSplashScreen; | ||
289 | |||
290 | // If this was run from a related bundle, specifies the relation type | ||
291 | BOOTSTRAPPER_RELATION_TYPE relationType; | ||
292 | BOOL fPassthrough; | ||
293 | |||
294 | LPWSTR wzLayoutDirectory; | ||
295 | LPWSTR wzBootstrapperWorkingFolder; | ||
296 | LPWSTR wzBootstrapperApplicationDataPath; | ||
297 | }; | ||
298 | |||
299 | struct BA_ONAPPLYBEGIN_ARGS | ||
300 | { | ||
301 | DWORD cbSize; | ||
302 | DWORD dwPhaseCount; | ||
303 | }; | ||
304 | |||
305 | struct BA_ONAPPLYBEGIN_RESULTS | ||
306 | { | ||
307 | DWORD cbSize; | ||
308 | BOOL fCancel; | ||
309 | }; | ||
310 | |||
311 | struct BA_ONAPPLYCOMPLETE_ARGS | ||
312 | { | ||
313 | DWORD cbSize; | ||
314 | HRESULT hrStatus; | ||
315 | // Indicates whether any package required a reboot or initiated the reboot already. | ||
316 | BOOTSTRAPPER_APPLY_RESTART restart; | ||
317 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation; | ||
318 | }; | ||
319 | |||
320 | struct BA_ONAPPLYCOMPLETE_RESULTS | ||
321 | { | ||
322 | DWORD cbSize; | ||
323 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION action; | ||
324 | }; | ||
325 | |||
326 | struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS | ||
327 | { | ||
328 | DWORD cbSize; | ||
329 | LPCWSTR wzTransactionId; | ||
330 | }; | ||
331 | |||
332 | struct BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS | ||
333 | { | ||
334 | DWORD cbSize; | ||
335 | BOOL fCancel; | ||
336 | }; | ||
337 | |||
338 | struct BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS | ||
339 | { | ||
340 | DWORD cbSize; | ||
341 | LPCWSTR wzTransactionId; | ||
342 | HRESULT hrStatus; | ||
343 | }; | ||
344 | |||
345 | struct BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS | ||
346 | { | ||
347 | DWORD cbSize; | ||
348 | }; | ||
349 | |||
350 | struct BA_ONCACHEACQUIREBEGIN_ARGS | ||
351 | { | ||
352 | DWORD cbSize; | ||
353 | LPCWSTR wzPackageOrContainerId; | ||
354 | LPCWSTR wzPayloadId; | ||
355 | LPCWSTR wzSource; | ||
356 | LPCWSTR wzDownloadUrl; | ||
357 | LPCWSTR wzPayloadContainerId; | ||
358 | BOOTSTRAPPER_CACHE_OPERATION recommendation; | ||
359 | }; | ||
360 | |||
361 | struct BA_ONCACHEACQUIREBEGIN_RESULTS | ||
362 | { | ||
363 | DWORD cbSize; | ||
364 | BOOL fCancel; | ||
365 | BOOTSTRAPPER_CACHE_OPERATION action; | ||
366 | }; | ||
367 | |||
368 | struct BA_ONCACHEACQUIRECOMPLETE_ARGS | ||
369 | { | ||
370 | DWORD cbSize; | ||
371 | LPCWSTR wzPackageOrContainerId; | ||
372 | LPCWSTR wzPayloadId; | ||
373 | HRESULT hrStatus; | ||
374 | BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation; | ||
375 | }; | ||
376 | |||
377 | struct BA_ONCACHEACQUIRECOMPLETE_RESULTS | ||
378 | { | ||
379 | DWORD cbSize; | ||
380 | BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action; | ||
381 | }; | ||
382 | |||
383 | struct BA_ONCACHEACQUIREPROGRESS_ARGS | ||
384 | { | ||
385 | DWORD cbSize; | ||
386 | LPCWSTR wzPackageOrContainerId; | ||
387 | LPCWSTR wzPayloadId; | ||
388 | DWORD64 dw64Progress; | ||
389 | DWORD64 dw64Total; | ||
390 | DWORD dwOverallPercentage; | ||
391 | }; | ||
392 | |||
393 | struct BA_ONCACHEACQUIREPROGRESS_RESULTS | ||
394 | { | ||
395 | DWORD cbSize; | ||
396 | BOOL fCancel; | ||
397 | }; | ||
398 | |||
399 | struct BA_ONCACHEACQUIRERESOLVING_ARGS | ||
400 | { | ||
401 | DWORD cbSize; | ||
402 | LPCWSTR wzPackageOrContainerId; | ||
403 | LPCWSTR wzPayloadId; | ||
404 | LPCWSTR* rgSearchPaths; | ||
405 | DWORD cSearchPaths; | ||
406 | BOOL fFoundLocal; | ||
407 | DWORD dwRecommendedSearchPath; | ||
408 | LPCWSTR wzDownloadUrl; | ||
409 | LPCWSTR wzPayloadContainerId; | ||
410 | BOOTSTRAPPER_CACHE_RESOLVE_OPERATION recommendation; | ||
411 | }; | ||
412 | |||
413 | struct BA_ONCACHEACQUIRERESOLVING_RESULTS | ||
414 | { | ||
415 | DWORD cbSize; | ||
416 | DWORD dwChosenSearchPath; | ||
417 | BOOTSTRAPPER_CACHE_RESOLVE_OPERATION action; | ||
418 | BOOL fCancel; | ||
419 | }; | ||
420 | |||
421 | struct BA_ONCACHEBEGIN_ARGS | ||
422 | { | ||
423 | DWORD cbSize; | ||
424 | }; | ||
425 | |||
426 | struct BA_ONCACHEBEGIN_RESULTS | ||
427 | { | ||
428 | DWORD cbSize; | ||
429 | BOOL fCancel; | ||
430 | }; | ||
431 | |||
432 | struct BA_ONCACHECOMPLETE_ARGS | ||
433 | { | ||
434 | DWORD cbSize; | ||
435 | HRESULT hrStatus; | ||
436 | }; | ||
437 | |||
438 | struct BA_ONCACHECOMPLETE_RESULTS | ||
439 | { | ||
440 | DWORD cbSize; | ||
441 | }; | ||
442 | |||
443 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS | ||
444 | { | ||
445 | DWORD cbSize; | ||
446 | LPCWSTR wzPackageOrContainerId; | ||
447 | LPCWSTR wzPayloadId; | ||
448 | }; | ||
449 | |||
450 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS | ||
451 | { | ||
452 | DWORD cbSize; | ||
453 | BOOL fCancel; | ||
454 | }; | ||
455 | |||
456 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS | ||
457 | { | ||
458 | DWORD cbSize; | ||
459 | LPCWSTR wzPackageOrContainerId; | ||
460 | LPCWSTR wzPayloadId; | ||
461 | HRESULT hrStatus; | ||
462 | }; | ||
463 | |||
464 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS | ||
465 | { | ||
466 | DWORD cbSize; | ||
467 | }; | ||
468 | |||
469 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS | ||
470 | { | ||
471 | DWORD cbSize; | ||
472 | LPCWSTR wzPackageOrContainerId; | ||
473 | LPCWSTR wzPayloadId; | ||
474 | DWORD64 dw64Progress; | ||
475 | DWORD64 dw64Total; | ||
476 | DWORD dwOverallPercentage; | ||
477 | }; | ||
478 | |||
479 | struct BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS | ||
480 | { | ||
481 | DWORD cbSize; | ||
482 | BOOL fCancel; | ||
483 | }; | ||
484 | |||
485 | struct BA_ONCACHEPACKAGEBEGIN_ARGS | ||
486 | { | ||
487 | DWORD cbSize; | ||
488 | LPCWSTR wzPackageId; | ||
489 | DWORD cCachePayloads; | ||
490 | DWORD64 dw64PackageCacheSize; | ||
491 | }; | ||
492 | |||
493 | struct BA_ONCACHEPACKAGEBEGIN_RESULTS | ||
494 | { | ||
495 | DWORD cbSize; | ||
496 | BOOL fCancel; | ||
497 | }; | ||
498 | |||
499 | struct BA_ONCACHEPACKAGECOMPLETE_ARGS | ||
500 | { | ||
501 | DWORD cbSize; | ||
502 | LPCWSTR wzPackageId; | ||
503 | HRESULT hrStatus; | ||
504 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation; | ||
505 | }; | ||
506 | |||
507 | struct BA_ONCACHEPACKAGECOMPLETE_RESULTS | ||
508 | { | ||
509 | DWORD cbSize; | ||
510 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action; | ||
511 | }; | ||
512 | |||
513 | struct BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS | ||
514 | { | ||
515 | DWORD cbSize; | ||
516 | LPCWSTR wzContainerId; | ||
517 | LPCWSTR wzPayloadId; | ||
518 | }; | ||
519 | |||
520 | struct BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS | ||
521 | { | ||
522 | DWORD cbSize; | ||
523 | BOOL fCancel; | ||
524 | }; | ||
525 | |||
526 | struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS | ||
527 | { | ||
528 | DWORD cbSize; | ||
529 | LPCWSTR wzContainerId; | ||
530 | LPCWSTR wzPayloadId; | ||
531 | HRESULT hrStatus; | ||
532 | }; | ||
533 | |||
534 | struct BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS | ||
535 | { | ||
536 | DWORD cbSize; | ||
537 | }; | ||
538 | |||
539 | struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS | ||
540 | { | ||
541 | DWORD cbSize; | ||
542 | LPCWSTR wzContainerId; | ||
543 | LPCWSTR wzPayloadId; | ||
544 | DWORD64 dw64Progress; | ||
545 | DWORD64 dw64Total; | ||
546 | DWORD dwOverallPercentage; | ||
547 | }; | ||
548 | |||
549 | struct BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS | ||
550 | { | ||
551 | DWORD cbSize; | ||
552 | BOOL fCancel; | ||
553 | }; | ||
554 | |||
555 | struct BA_ONCACHEVERIFYBEGIN_ARGS | ||
556 | { | ||
557 | DWORD cbSize; | ||
558 | LPCWSTR wzPackageOrContainerId; | ||
559 | LPCWSTR wzPayloadId; | ||
560 | }; | ||
561 | |||
562 | struct BA_ONCACHEVERIFYBEGIN_RESULTS | ||
563 | { | ||
564 | DWORD cbSize; | ||
565 | BOOL fCancel; | ||
566 | }; | ||
567 | |||
568 | struct BA_ONCACHEVERIFYCOMPLETE_ARGS | ||
569 | { | ||
570 | DWORD cbSize; | ||
571 | LPCWSTR wzPackageOrContainerId; | ||
572 | LPCWSTR wzPayloadId; | ||
573 | HRESULT hrStatus; | ||
574 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation; | ||
575 | }; | ||
576 | |||
577 | struct BA_ONCACHEVERIFYCOMPLETE_RESULTS | ||
578 | { | ||
579 | DWORD cbSize; | ||
580 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action; | ||
581 | }; | ||
582 | |||
583 | struct BA_ONCACHEVERIFYPROGRESS_ARGS | ||
584 | { | ||
585 | DWORD cbSize; | ||
586 | LPCWSTR wzPackageOrContainerId; | ||
587 | LPCWSTR wzPayloadId; | ||
588 | DWORD64 dw64Progress; | ||
589 | DWORD64 dw64Total; | ||
590 | DWORD dwOverallPercentage; | ||
591 | BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep; | ||
592 | }; | ||
593 | |||
594 | struct BA_ONCACHEVERIFYPROGRESS_RESULTS | ||
595 | { | ||
596 | DWORD cbSize; | ||
597 | BOOL fCancel; | ||
598 | }; | ||
599 | |||
600 | struct BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS | ||
601 | { | ||
602 | DWORD cbSize; | ||
603 | LPCWSTR wzTransactionId; | ||
604 | }; | ||
605 | |||
606 | struct BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS | ||
607 | { | ||
608 | DWORD cbSize; | ||
609 | BOOL fCancel; | ||
610 | }; | ||
611 | |||
612 | struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS | ||
613 | { | ||
614 | DWORD cbSize; | ||
615 | LPCWSTR wzTransactionId; | ||
616 | HRESULT hrStatus; | ||
617 | }; | ||
618 | |||
619 | struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS | ||
620 | { | ||
621 | DWORD cbSize; | ||
622 | }; | ||
623 | |||
624 | struct BA_ONDETECTBEGIN_ARGS | ||
625 | { | ||
626 | DWORD cbSize; | ||
627 | BOOL fInstalled; | ||
628 | DWORD cPackages; | ||
629 | BOOL fCached; | ||
630 | }; | ||
631 | |||
632 | struct BA_ONDETECTBEGIN_RESULTS | ||
633 | { | ||
634 | DWORD cbSize; | ||
635 | BOOL fCancel; | ||
636 | }; | ||
637 | |||
638 | struct BA_ONDETECTCOMPLETE_ARGS | ||
639 | { | ||
640 | DWORD cbSize; | ||
641 | HRESULT hrStatus; | ||
642 | BOOL fEligibleForCleanup; | ||
643 | }; | ||
644 | |||
645 | struct BA_ONDETECTCOMPLETE_RESULTS | ||
646 | { | ||
647 | DWORD cbSize; | ||
648 | }; | ||
649 | |||
650 | struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS | ||
651 | { | ||
652 | DWORD cbSize; | ||
653 | LPCWSTR wzBundleId; | ||
654 | BOOTSTRAPPER_RELATION_TYPE relationType; | ||
655 | LPCWSTR wzBundleTag; | ||
656 | BOOL fPerMachine; | ||
657 | LPCWSTR wzVersion; | ||
658 | BOOL fMissingFromCache; | ||
659 | }; | ||
660 | |||
661 | struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS | ||
662 | { | ||
663 | DWORD cbSize; | ||
664 | BOOL fCancel; | ||
665 | }; | ||
666 | |||
667 | struct BA_ONDETECTMSIFEATURE_ARGS | ||
668 | { | ||
669 | DWORD cbSize; | ||
670 | LPCWSTR wzPackageId; | ||
671 | LPCWSTR wzFeatureId; | ||
672 | BOOTSTRAPPER_FEATURE_STATE state; | ||
673 | }; | ||
674 | |||
675 | struct BA_ONDETECTMSIFEATURE_RESULTS | ||
676 | { | ||
677 | DWORD cbSize; | ||
678 | BOOL fCancel; | ||
679 | }; | ||
680 | |||
681 | struct BA_ONDETECTPACKAGEBEGIN_ARGS | ||
682 | { | ||
683 | DWORD cbSize; | ||
684 | LPCWSTR wzPackageId; | ||
685 | }; | ||
686 | |||
687 | struct BA_ONDETECTPACKAGEBEGIN_RESULTS | ||
688 | { | ||
689 | DWORD cbSize; | ||
690 | BOOL fCancel; | ||
691 | }; | ||
692 | |||
693 | struct BA_ONDETECTPACKAGECOMPLETE_ARGS | ||
694 | { | ||
695 | DWORD cbSize; | ||
696 | LPCWSTR wzPackageId; | ||
697 | HRESULT hrStatus; | ||
698 | BOOTSTRAPPER_PACKAGE_STATE state; | ||
699 | BOOL fCached; | ||
700 | }; | ||
701 | |||
702 | struct BA_ONDETECTPACKAGECOMPLETE_RESULTS | ||
703 | { | ||
704 | DWORD cbSize; | ||
705 | }; | ||
706 | |||
707 | struct BA_ONDETECTRELATEDBUNDLE_ARGS | ||
708 | { | ||
709 | DWORD cbSize; | ||
710 | LPCWSTR wzBundleId; | ||
711 | BOOTSTRAPPER_RELATION_TYPE relationType; | ||
712 | LPCWSTR wzBundleTag; | ||
713 | BOOL fPerMachine; | ||
714 | LPCWSTR wzVersion; | ||
715 | BOOTSTRAPPER_RELATED_OPERATION operation; | ||
716 | BOOL fMissingFromCache; | ||
717 | }; | ||
718 | |||
719 | struct BA_ONDETECTRELATEDBUNDLE_RESULTS | ||
720 | { | ||
721 | DWORD cbSize; | ||
722 | BOOL fCancel; | ||
723 | }; | ||
724 | |||
725 | struct BA_ONDETECTRELATEDMSIPACKAGE_ARGS | ||
726 | { | ||
727 | DWORD cbSize; | ||
728 | LPCWSTR wzPackageId; | ||
729 | LPCWSTR wzUpgradeCode; | ||
730 | LPCWSTR wzProductCode; | ||
731 | BOOL fPerMachine; | ||
732 | LPCWSTR wzVersion; | ||
733 | BOOTSTRAPPER_RELATED_OPERATION operation; | ||
734 | }; | ||
735 | |||
736 | struct BA_ONDETECTRELATEDMSIPACKAGE_RESULTS | ||
737 | { | ||
738 | DWORD cbSize; | ||
739 | BOOL fCancel; | ||
740 | }; | ||
741 | |||
742 | struct BA_ONDETECTPATCHTARGET_ARGS | ||
743 | { | ||
744 | DWORD cbSize; | ||
745 | LPCWSTR wzPackageId; | ||
746 | LPCWSTR wzProductCode; | ||
747 | BOOTSTRAPPER_PACKAGE_STATE patchState; | ||
748 | }; | ||
749 | |||
750 | struct BA_ONDETECTPATCHTARGET_RESULTS | ||
751 | { | ||
752 | DWORD cbSize; | ||
753 | BOOL fCancel; | ||
754 | }; | ||
755 | |||
756 | struct BA_ONDETECTUPDATE_ARGS | ||
757 | { | ||
758 | DWORD cbSize; | ||
759 | LPCWSTR wzUpdateLocation; | ||
760 | DWORD64 dw64Size; | ||
761 | LPCWSTR wzVersion; | ||
762 | LPCWSTR wzTitle; | ||
763 | LPCWSTR wzSummary; | ||
764 | LPCWSTR wzContentType; | ||
765 | LPCWSTR wzContent; | ||
766 | }; | ||
767 | |||
768 | struct BA_ONDETECTUPDATE_RESULTS | ||
769 | { | ||
770 | DWORD cbSize; | ||
771 | BOOL fCancel; | ||
772 | BOOL fStopProcessingUpdates; | ||
773 | }; | ||
774 | |||
775 | struct BA_ONDETECTUPDATEBEGIN_ARGS | ||
776 | { | ||
777 | DWORD cbSize; | ||
778 | LPCWSTR wzUpdateLocation; | ||
779 | }; | ||
780 | |||
781 | struct BA_ONDETECTUPDATEBEGIN_RESULTS | ||
782 | { | ||
783 | DWORD cbSize; | ||
784 | BOOL fCancel; | ||
785 | BOOL fSkip; | ||
786 | }; | ||
787 | |||
788 | struct BA_ONDETECTUPDATECOMPLETE_ARGS | ||
789 | { | ||
790 | DWORD cbSize; | ||
791 | HRESULT hrStatus; | ||
792 | }; | ||
793 | |||
794 | struct BA_ONDETECTUPDATECOMPLETE_RESULTS | ||
795 | { | ||
796 | DWORD cbSize; | ||
797 | BOOL fIgnoreError; | ||
798 | }; | ||
799 | |||
800 | struct BA_ONELEVATEBEGIN_ARGS | ||
801 | { | ||
802 | DWORD cbSize; | ||
803 | }; | ||
804 | |||
805 | struct BA_ONELEVATEBEGIN_RESULTS | ||
806 | { | ||
807 | DWORD cbSize; | ||
808 | BOOL fCancel; | ||
809 | }; | ||
810 | |||
811 | struct BA_ONELEVATECOMPLETE_ARGS | ||
812 | { | ||
813 | DWORD cbSize; | ||
814 | HRESULT hrStatus; | ||
815 | }; | ||
816 | |||
817 | struct BA_ONELEVATECOMPLETE_RESULTS | ||
818 | { | ||
819 | DWORD cbSize; | ||
820 | }; | ||
821 | |||
822 | struct BA_ONERROR_ARGS | ||
823 | { | ||
824 | DWORD cbSize; | ||
825 | BOOTSTRAPPER_ERROR_TYPE errorType; | ||
826 | LPCWSTR wzPackageId; | ||
827 | DWORD dwCode; | ||
828 | LPCWSTR wzError; | ||
829 | DWORD dwUIHint; | ||
830 | DWORD cData; | ||
831 | LPCWSTR* rgwzData; | ||
832 | int nRecommendation; | ||
833 | }; | ||
834 | |||
835 | struct BA_ONERROR_RESULTS | ||
836 | { | ||
837 | DWORD cbSize; | ||
838 | int nResult; | ||
839 | }; | ||
840 | |||
841 | struct BA_ONEXECUTEBEGIN_ARGS | ||
842 | { | ||
843 | DWORD cbSize; | ||
844 | DWORD cExecutingPackages; | ||
845 | }; | ||
846 | |||
847 | struct BA_ONEXECUTEBEGIN_RESULTS | ||
848 | { | ||
849 | DWORD cbSize; | ||
850 | BOOL fCancel; | ||
851 | }; | ||
852 | |||
853 | struct BA_ONEXECUTECOMPLETE_ARGS | ||
854 | { | ||
855 | DWORD cbSize; | ||
856 | HRESULT hrStatus; | ||
857 | }; | ||
858 | |||
859 | struct BA_ONEXECUTECOMPLETE_RESULTS | ||
860 | { | ||
861 | DWORD cbSize; | ||
862 | }; | ||
863 | |||
864 | struct BA_ONEXECUTEFILESINUSE_ARGS | ||
865 | { | ||
866 | DWORD cbSize; | ||
867 | LPCWSTR wzPackageId; | ||
868 | DWORD cFiles; | ||
869 | LPCWSTR* rgwzFiles; | ||
870 | int nRecommendation; | ||
871 | }; | ||
872 | |||
873 | struct BA_ONEXECUTEFILESINUSE_RESULTS | ||
874 | { | ||
875 | DWORD cbSize; | ||
876 | int nResult; | ||
877 | }; | ||
878 | |||
879 | struct BA_ONEXECUTEMSIMESSAGE_ARGS | ||
880 | { | ||
881 | DWORD cbSize; | ||
882 | LPCWSTR wzPackageId; | ||
883 | INSTALLMESSAGE messageType; | ||
884 | DWORD dwUIHint; | ||
885 | LPCWSTR wzMessage; | ||
886 | DWORD cData; | ||
887 | LPCWSTR* rgwzData; | ||
888 | int nRecommendation; | ||
889 | }; | ||
890 | |||
891 | struct BA_ONEXECUTEMSIMESSAGE_RESULTS | ||
892 | { | ||
893 | DWORD cbSize; | ||
894 | int nResult; | ||
895 | }; | ||
896 | |||
897 | struct BA_ONEXECUTEPACKAGEBEGIN_ARGS | ||
898 | { | ||
899 | DWORD cbSize; | ||
900 | LPCWSTR wzPackageId; | ||
901 | BOOL fExecute; // false means rollback. | ||
902 | BOOTSTRAPPER_ACTION_STATE action; | ||
903 | INSTALLUILEVEL uiLevel; | ||
904 | BOOL fDisableExternalUiHandler; | ||
905 | }; | ||
906 | |||
907 | struct BA_ONEXECUTEPACKAGEBEGIN_RESULTS | ||
908 | { | ||
909 | DWORD cbSize; | ||
910 | BOOL fCancel; | ||
911 | }; | ||
912 | |||
913 | struct BA_ONEXECUTEPACKAGECOMPLETE_ARGS | ||
914 | { | ||
915 | DWORD cbSize; | ||
916 | LPCWSTR wzPackageId; | ||
917 | HRESULT hrStatus; | ||
918 | // Indicates whether this package requires a reboot or initiated the reboot already. | ||
919 | BOOTSTRAPPER_APPLY_RESTART restart; | ||
920 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation; | ||
921 | }; | ||
922 | |||
923 | struct BA_ONEXECUTEPACKAGECOMPLETE_RESULTS | ||
924 | { | ||
925 | DWORD cbSize; | ||
926 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action; | ||
927 | }; | ||
928 | |||
929 | struct BA_ONEXECUTEPATCHTARGET_ARGS | ||
930 | { | ||
931 | DWORD cbSize; | ||
932 | LPCWSTR wzPackageId; | ||
933 | LPCWSTR wzTargetProductCode; | ||
934 | }; | ||
935 | |||
936 | struct BA_ONEXECUTEPATCHTARGET_RESULTS | ||
937 | { | ||
938 | DWORD cbSize; | ||
939 | BOOL fCancel; | ||
940 | }; | ||
941 | |||
942 | struct BA_ONEXECUTEPROGRESS_ARGS | ||
943 | { | ||
944 | DWORD cbSize; | ||
945 | LPCWSTR wzPackageId; | ||
946 | DWORD dwProgressPercentage; | ||
947 | DWORD dwOverallPercentage; | ||
948 | }; | ||
949 | |||
950 | struct BA_ONEXECUTEPROGRESS_RESULTS | ||
951 | { | ||
952 | DWORD cbSize; | ||
953 | BOOL fCancel; | ||
954 | }; | ||
955 | |||
956 | struct BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS | ||
957 | { | ||
958 | DWORD cbSize; | ||
959 | }; | ||
960 | |||
961 | struct BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS | ||
962 | { | ||
963 | DWORD cbSize; | ||
964 | BOOL fCancel; | ||
965 | }; | ||
966 | |||
967 | struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS | ||
968 | { | ||
969 | DWORD cbSize; | ||
970 | HRESULT hrStatus; | ||
971 | // Only valid if the operation succeeded. | ||
972 | DWORD dwProcessId; | ||
973 | }; | ||
974 | |||
975 | struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS | ||
976 | { | ||
977 | DWORD cbSize; | ||
978 | }; | ||
979 | |||
980 | struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS | ||
981 | { | ||
982 | DWORD cbSize; | ||
983 | }; | ||
984 | |||
985 | struct BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS | ||
986 | { | ||
987 | DWORD cbSize; | ||
988 | }; | ||
989 | |||
990 | struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS | ||
991 | { | ||
992 | DWORD cbSize; | ||
993 | HRESULT hrStatus; | ||
994 | }; | ||
995 | |||
996 | struct BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS | ||
997 | { | ||
998 | DWORD cbSize; | ||
999 | }; | ||
1000 | |||
1001 | struct BA_ONPLANBEGIN_ARGS | ||
1002 | { | ||
1003 | DWORD cbSize; | ||
1004 | DWORD cPackages; | ||
1005 | }; | ||
1006 | |||
1007 | struct BA_ONPLANBEGIN_RESULTS | ||
1008 | { | ||
1009 | DWORD cbSize; | ||
1010 | BOOL fCancel; | ||
1011 | }; | ||
1012 | |||
1013 | struct BA_ONPLANCOMPLETE_ARGS | ||
1014 | { | ||
1015 | DWORD cbSize; | ||
1016 | HRESULT hrStatus; | ||
1017 | }; | ||
1018 | |||
1019 | struct BA_ONPLANCOMPLETE_RESULTS | ||
1020 | { | ||
1021 | DWORD cbSize; | ||
1022 | }; | ||
1023 | |||
1024 | struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS | ||
1025 | { | ||
1026 | DWORD cbSize; | ||
1027 | LPCWSTR wzBundleId; | ||
1028 | BOOTSTRAPPER_RELATION_TYPE relationType; | ||
1029 | LPCWSTR wzBundleTag; | ||
1030 | BOOL fPerMachine; | ||
1031 | LPCWSTR wzVersion; | ||
1032 | BOOL fRecommendedIgnoreBundle; | ||
1033 | }; | ||
1034 | |||
1035 | struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS | ||
1036 | { | ||
1037 | DWORD cbSize; | ||
1038 | BOOL fCancel; | ||
1039 | BOOL fIgnoreBundle; | ||
1040 | }; | ||
1041 | |||
1042 | struct BA_ONPLANMSIFEATURE_ARGS | ||
1043 | { | ||
1044 | DWORD cbSize; | ||
1045 | LPCWSTR wzPackageId; | ||
1046 | LPCWSTR wzFeatureId; | ||
1047 | BOOTSTRAPPER_FEATURE_STATE recommendedState; | ||
1048 | }; | ||
1049 | |||
1050 | struct BA_ONPLANMSIFEATURE_RESULTS | ||
1051 | { | ||
1052 | DWORD cbSize; | ||
1053 | BOOTSTRAPPER_FEATURE_STATE requestedState; | ||
1054 | BOOL fCancel; | ||
1055 | }; | ||
1056 | |||
1057 | struct BA_ONPLANMSIPACKAGE_ARGS | ||
1058 | { | ||
1059 | DWORD cbSize; | ||
1060 | LPCWSTR wzPackageId; | ||
1061 | BOOL fExecute; // false means rollback. | ||
1062 | BOOTSTRAPPER_ACTION_STATE action; | ||
1063 | }; | ||
1064 | |||
1065 | struct BA_ONPLANMSIPACKAGE_RESULTS | ||
1066 | { | ||
1067 | DWORD cbSize; | ||
1068 | BOOL fCancel; | ||
1069 | BURN_MSI_PROPERTY actionMsiProperty; | ||
1070 | INSTALLUILEVEL uiLevel; | ||
1071 | BOOL fDisableExternalUiHandler; | ||
1072 | }; | ||
1073 | |||
1074 | struct BA_ONPLANNEDPACKAGE_ARGS | ||
1075 | { | ||
1076 | DWORD cbSize; | ||
1077 | LPCWSTR wzPackageId; | ||
1078 | BOOTSTRAPPER_ACTION_STATE execute; | ||
1079 | BOOTSTRAPPER_ACTION_STATE rollback; | ||
1080 | BOOL fPlannedCache; | ||
1081 | BOOL fPlannedUncache; | ||
1082 | }; | ||
1083 | |||
1084 | struct BA_ONPLANNEDPACKAGE_RESULTS | ||
1085 | { | ||
1086 | DWORD cbSize; | ||
1087 | }; | ||
1088 | |||
1089 | struct BA_ONPLANPACKAGEBEGIN_ARGS | ||
1090 | { | ||
1091 | DWORD cbSize; | ||
1092 | LPCWSTR wzPackageId; | ||
1093 | BOOTSTRAPPER_PACKAGE_STATE state; | ||
1094 | BOOL fCached; | ||
1095 | BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition; | ||
1096 | BOOTSTRAPPER_REQUEST_STATE recommendedState; | ||
1097 | BOOTSTRAPPER_CACHE_TYPE recommendedCacheType; | ||
1098 | }; | ||
1099 | |||
1100 | struct BA_ONPLANPACKAGEBEGIN_RESULTS | ||
1101 | { | ||
1102 | DWORD cbSize; | ||
1103 | BOOL fCancel; | ||
1104 | BOOTSTRAPPER_REQUEST_STATE requestedState; | ||
1105 | BOOTSTRAPPER_CACHE_TYPE requestedCacheType; | ||
1106 | }; | ||
1107 | |||
1108 | struct BA_ONPLANPACKAGECOMPLETE_ARGS | ||
1109 | { | ||
1110 | DWORD cbSize; | ||
1111 | LPCWSTR wzPackageId; | ||
1112 | HRESULT hrStatus; | ||
1113 | BOOTSTRAPPER_REQUEST_STATE requested; | ||
1114 | }; | ||
1115 | |||
1116 | struct BA_ONPLANPACKAGECOMPLETE_RESULTS | ||
1117 | { | ||
1118 | DWORD cbSize; | ||
1119 | }; | ||
1120 | |||
1121 | struct BA_ONPLANRELATEDBUNDLE_ARGS | ||
1122 | { | ||
1123 | DWORD cbSize; | ||
1124 | LPCWSTR wzBundleId; | ||
1125 | BOOTSTRAPPER_REQUEST_STATE recommendedState; | ||
1126 | }; | ||
1127 | |||
1128 | struct BA_ONPLANRELATEDBUNDLE_RESULTS | ||
1129 | { | ||
1130 | DWORD cbSize; | ||
1131 | BOOL fCancel; | ||
1132 | BOOTSTRAPPER_REQUEST_STATE requestedState; | ||
1133 | }; | ||
1134 | |||
1135 | struct BA_ONPLANPATCHTARGET_ARGS | ||
1136 | { | ||
1137 | DWORD cbSize; | ||
1138 | LPCWSTR wzPackageId; | ||
1139 | LPCWSTR wzProductCode; | ||
1140 | BOOTSTRAPPER_REQUEST_STATE recommendedState; | ||
1141 | }; | ||
1142 | |||
1143 | struct BA_ONPLANPATCHTARGET_RESULTS | ||
1144 | { | ||
1145 | DWORD cbSize; | ||
1146 | BOOTSTRAPPER_REQUEST_STATE requestedState; | ||
1147 | BOOL fCancel; | ||
1148 | }; | ||
1149 | |||
1150 | struct BA_ONPROGRESS_ARGS | ||
1151 | { | ||
1152 | DWORD cbSize; | ||
1153 | DWORD dwProgressPercentage; | ||
1154 | DWORD dwOverallPercentage; | ||
1155 | }; | ||
1156 | |||
1157 | struct BA_ONPROGRESS_RESULTS | ||
1158 | { | ||
1159 | DWORD cbSize; | ||
1160 | BOOL fCancel; | ||
1161 | }; | ||
1162 | |||
1163 | struct BA_ONREGISTERBEGIN_ARGS | ||
1164 | { | ||
1165 | DWORD cbSize; | ||
1166 | }; | ||
1167 | |||
1168 | struct BA_ONREGISTERBEGIN_RESULTS | ||
1169 | { | ||
1170 | DWORD cbSize; | ||
1171 | BOOL fCancel; | ||
1172 | }; | ||
1173 | |||
1174 | struct BA_ONREGISTERCOMPLETE_ARGS | ||
1175 | { | ||
1176 | DWORD cbSize; | ||
1177 | HRESULT hrStatus; | ||
1178 | }; | ||
1179 | |||
1180 | struct BA_ONREGISTERCOMPLETE_RESULTS | ||
1181 | { | ||
1182 | DWORD cbSize; | ||
1183 | }; | ||
1184 | |||
1185 | struct BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS | ||
1186 | { | ||
1187 | DWORD cbSize; | ||
1188 | LPCWSTR wzTransactionId; | ||
1189 | }; | ||
1190 | |||
1191 | struct BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS | ||
1192 | { | ||
1193 | DWORD cbSize; | ||
1194 | }; | ||
1195 | |||
1196 | struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS | ||
1197 | { | ||
1198 | DWORD cbSize; | ||
1199 | LPCWSTR wzTransactionId; | ||
1200 | HRESULT hrStatus; | ||
1201 | }; | ||
1202 | |||
1203 | struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS | ||
1204 | { | ||
1205 | DWORD cbSize; | ||
1206 | }; | ||
1207 | |||
1208 | struct BA_ONSHUTDOWN_ARGS | ||
1209 | { | ||
1210 | DWORD cbSize; | ||
1211 | }; | ||
1212 | |||
1213 | struct BA_ONSHUTDOWN_RESULTS | ||
1214 | { | ||
1215 | DWORD cbSize; | ||
1216 | BOOTSTRAPPER_SHUTDOWN_ACTION action; | ||
1217 | }; | ||
1218 | |||
1219 | struct BA_ONSTARTUP_ARGS | ||
1220 | { | ||
1221 | DWORD cbSize; | ||
1222 | }; | ||
1223 | |||
1224 | struct BA_ONSTARTUP_RESULTS | ||
1225 | { | ||
1226 | DWORD cbSize; | ||
1227 | }; | ||
1228 | |||
1229 | struct BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS | ||
1230 | { | ||
1231 | DWORD cbSize; | ||
1232 | }; | ||
1233 | |||
1234 | struct BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS | ||
1235 | { | ||
1236 | DWORD cbSize; | ||
1237 | }; | ||
1238 | |||
1239 | struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS | ||
1240 | { | ||
1241 | DWORD cbSize; | ||
1242 | HRESULT hrStatus; | ||
1243 | }; | ||
1244 | |||
1245 | struct BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS | ||
1246 | { | ||
1247 | DWORD cbSize; | ||
1248 | }; | ||
1249 | |||
1250 | struct BA_ONSYSTEMSHUTDOWN_ARGS | ||
1251 | { | ||
1252 | DWORD cbSize; | ||
1253 | DWORD dwEndSession; | ||
1254 | }; | ||
1255 | |||
1256 | struct BA_ONSYSTEMSHUTDOWN_RESULTS | ||
1257 | { | ||
1258 | DWORD cbSize; | ||
1259 | BOOL fCancel; | ||
1260 | }; | ||
1261 | |||
1262 | struct BA_ONUNREGISTERBEGIN_ARGS | ||
1263 | { | ||
1264 | DWORD cbSize; | ||
1265 | BOOL fKeepRegistration; | ||
1266 | }; | ||
1267 | |||
1268 | struct BA_ONUNREGISTERBEGIN_RESULTS | ||
1269 | { | ||
1270 | DWORD cbSize; | ||
1271 | BOOL fForceKeepRegistration; | ||
1272 | }; | ||
1273 | |||
1274 | struct BA_ONUNREGISTERCOMPLETE_ARGS | ||
1275 | { | ||
1276 | DWORD cbSize; | ||
1277 | HRESULT hrStatus; | ||
1278 | }; | ||
1279 | |||
1280 | struct BA_ONUNREGISTERCOMPLETE_RESULTS | ||
1281 | { | ||
1282 | DWORD cbSize; | ||
1283 | }; | ||
1284 | |||
1285 | |||
1286 | |||
1287 | extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_PROC)( | ||
1288 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
1289 | __in const LPVOID pvArgs, | ||
1290 | __inout LPVOID pvResults, | ||
1291 | __in_opt LPVOID pvContext | ||
1292 | ); | ||
1293 | |||
1294 | extern "C" typedef void (WINAPI *PFN_BOOTSTRAPPER_APPLICATION_DESTROY)(); | ||
1295 | |||
1296 | |||
1297 | |||
1298 | struct BOOTSTRAPPER_CREATE_ARGS | ||
1299 | { | ||
1300 | DWORD cbSize; | ||
1301 | DWORD64 qwEngineAPIVersion; | ||
1302 | PFN_BOOTSTRAPPER_ENGINE_PROC pfnBootstrapperEngineProc; | ||
1303 | LPVOID pvBootstrapperEngineProcContext; | ||
1304 | BOOTSTRAPPER_COMMAND* pCommand; | ||
1305 | }; | ||
1306 | |||
1307 | struct BOOTSTRAPPER_CREATE_RESULTS | ||
1308 | { | ||
1309 | DWORD cbSize; | ||
1310 | PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBootstrapperApplicationProc; | ||
1311 | LPVOID pvBootstrapperApplicationProcContext; | ||
1312 | BOOL fDisableUnloading; // indicates the BA dll must not be unloaded after BootstrapperApplicationDestroy. | ||
1313 | }; | ||
1314 | |||
1315 | extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_CREATE)( | ||
1316 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
1317 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults | ||
1318 | ); | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h new file mode 100644 index 00000000..9c9b38a5 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h | |||
@@ -0,0 +1,442 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #if defined(__cplusplus) | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | #define IDERROR -1 | ||
10 | #define IDNOACTION 0 | ||
11 | |||
12 | #ifndef FACILITY_WIX | ||
13 | #define FACILITY_WIX 500 | ||
14 | #endif | ||
15 | |||
16 | static const HRESULT E_SUSPECTED_AV_INTERFERENCE = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 2000); | ||
17 | |||
18 | // Note that ordering of the enumeration values is important. | ||
19 | // Some code paths use < or > comparisions and simply reording values will break those comparisons. | ||
20 | enum BOOTSTRAPPER_ACTION | ||
21 | { | ||
22 | BOOTSTRAPPER_ACTION_UNKNOWN, | ||
23 | BOOTSTRAPPER_ACTION_HELP, | ||
24 | BOOTSTRAPPER_ACTION_LAYOUT, | ||
25 | BOOTSTRAPPER_ACTION_UNINSTALL, | ||
26 | BOOTSTRAPPER_ACTION_CACHE, | ||
27 | BOOTSTRAPPER_ACTION_INSTALL, | ||
28 | BOOTSTRAPPER_ACTION_MODIFY, | ||
29 | BOOTSTRAPPER_ACTION_REPAIR, | ||
30 | BOOTSTRAPPER_ACTION_UPDATE_REPLACE, | ||
31 | BOOTSTRAPPER_ACTION_UPDATE_REPLACE_EMBEDDED, | ||
32 | }; | ||
33 | |||
34 | enum BOOTSTRAPPER_ACTION_STATE | ||
35 | { | ||
36 | BOOTSTRAPPER_ACTION_STATE_NONE, | ||
37 | BOOTSTRAPPER_ACTION_STATE_UNINSTALL, | ||
38 | BOOTSTRAPPER_ACTION_STATE_INSTALL, | ||
39 | BOOTSTRAPPER_ACTION_STATE_MODIFY, | ||
40 | BOOTSTRAPPER_ACTION_STATE_MEND, | ||
41 | BOOTSTRAPPER_ACTION_STATE_REPAIR, | ||
42 | BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE, | ||
43 | }; | ||
44 | |||
45 | enum BOOTSTRAPPER_PACKAGE_STATE | ||
46 | { | ||
47 | BOOTSTRAPPER_PACKAGE_STATE_UNKNOWN, | ||
48 | BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE, | ||
49 | BOOTSTRAPPER_PACKAGE_STATE_ABSENT, | ||
50 | BOOTSTRAPPER_PACKAGE_STATE_PRESENT, | ||
51 | BOOTSTRAPPER_PACKAGE_STATE_SUPERSEDED, | ||
52 | }; | ||
53 | |||
54 | enum BOOTSTRAPPER_REQUEST_STATE | ||
55 | { | ||
56 | BOOTSTRAPPER_REQUEST_STATE_NONE, | ||
57 | BOOTSTRAPPER_REQUEST_STATE_FORCE_ABSENT, | ||
58 | BOOTSTRAPPER_REQUEST_STATE_ABSENT, | ||
59 | BOOTSTRAPPER_REQUEST_STATE_CACHE, | ||
60 | BOOTSTRAPPER_REQUEST_STATE_PRESENT, | ||
61 | BOOTSTRAPPER_REQUEST_STATE_MEND, | ||
62 | BOOTSTRAPPER_REQUEST_STATE_REPAIR, | ||
63 | }; | ||
64 | |||
65 | enum BOOTSTRAPPER_FEATURE_STATE | ||
66 | { | ||
67 | BOOTSTRAPPER_FEATURE_STATE_UNKNOWN, | ||
68 | BOOTSTRAPPER_FEATURE_STATE_ABSENT, | ||
69 | BOOTSTRAPPER_FEATURE_STATE_ADVERTISED, | ||
70 | BOOTSTRAPPER_FEATURE_STATE_LOCAL, | ||
71 | BOOTSTRAPPER_FEATURE_STATE_SOURCE, | ||
72 | }; | ||
73 | |||
74 | enum BOOTSTRAPPER_LOG_LEVEL | ||
75 | { | ||
76 | BOOTSTRAPPER_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) | ||
77 | BOOTSTRAPPER_LOG_LEVEL_STANDARD, // written if reporting is on | ||
78 | BOOTSTRAPPER_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on | ||
79 | BOOTSTRAPPER_LOG_LEVEL_DEBUG, // reporting useful when debugging code | ||
80 | BOOTSTRAPPER_LOG_LEVEL_ERROR, // always gets reported, but can never be specified | ||
81 | }; | ||
82 | |||
83 | enum BOOTSTRAPPER_UPDATE_HASH_TYPE | ||
84 | { | ||
85 | BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE, | ||
86 | BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512, | ||
87 | }; | ||
88 | |||
89 | enum BOOTSTRAPPER_ENGINE_MESSAGE | ||
90 | { | ||
91 | BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, | ||
92 | BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, | ||
93 | BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, | ||
94 | BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION, | ||
95 | BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING, | ||
96 | BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING, | ||
97 | BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION, | ||
98 | BOOTSTRAPPER_ENGINE_MESSAGE_LOG, | ||
99 | BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR, | ||
100 | BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS, | ||
101 | BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE, | ||
102 | BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE, | ||
103 | BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE, | ||
104 | BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC, | ||
105 | BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING, | ||
106 | BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION, | ||
107 | BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN, | ||
108 | BOOTSTRAPPER_ENGINE_MESSAGE_DETECT, | ||
109 | BOOTSTRAPPER_ENGINE_MESSAGE_PLAN, | ||
110 | BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE, | ||
111 | BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, | ||
112 | BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, | ||
113 | BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, | ||
114 | BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, | ||
115 | BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, | ||
116 | }; | ||
117 | |||
118 | typedef struct _BAENGINE_APPLY_ARGS | ||
119 | { | ||
120 | DWORD cbSize; | ||
121 | HWND hwndParent; | ||
122 | } BAENGINE_APPLY_ARGS; | ||
123 | |||
124 | typedef struct _BAENGINE_APPLY_RESULTS | ||
125 | { | ||
126 | DWORD cbSize; | ||
127 | } BAENGINE_APPLY_RESULTS; | ||
128 | |||
129 | typedef struct _BAENGINE_CLOSESPLASHSCREEN_ARGS | ||
130 | { | ||
131 | DWORD cbSize; | ||
132 | } BAENGINE_CLOSESPLASHSCREEN_ARGS; | ||
133 | |||
134 | typedef struct _BAENGINE_CLOSESPLASHSCREEN_RESULTS | ||
135 | { | ||
136 | DWORD cbSize; | ||
137 | } BAENGINE_CLOSESPLASHSCREEN_RESULTS; | ||
138 | |||
139 | typedef struct _BAENGINE_COMPAREVERSIONS_ARGS | ||
140 | { | ||
141 | DWORD cbSize; | ||
142 | LPCWSTR wzVersion1; | ||
143 | LPCWSTR wzVersion2; | ||
144 | } BAENGINE_COMPAREVERSIONS_ARGS; | ||
145 | |||
146 | typedef struct _BAENGINE_COMPAREVERSIONS_RESULTS | ||
147 | { | ||
148 | DWORD cbSize; | ||
149 | int nResult; | ||
150 | } BAENGINE_COMPAREVERSIONS_RESULTS; | ||
151 | |||
152 | typedef struct _BAENGINE_DETECT_ARGS | ||
153 | { | ||
154 | DWORD cbSize; | ||
155 | HWND hwndParent; | ||
156 | } BAENGINE_DETECT_ARGS; | ||
157 | |||
158 | typedef struct _BAENGINE_DETECT_RESULTS | ||
159 | { | ||
160 | DWORD cbSize; | ||
161 | } BAENGINE_DETECT_RESULTS; | ||
162 | |||
163 | typedef struct _BAENGINE_ELEVATE_ARGS | ||
164 | { | ||
165 | DWORD cbSize; | ||
166 | HWND hwndParent; | ||
167 | } BAENGINE_ELEVATE_ARGS; | ||
168 | |||
169 | typedef struct _BAENGINE_ELEVATE_RESULTS | ||
170 | { | ||
171 | DWORD cbSize; | ||
172 | } BAENGINE_ELEVATE_RESULTS; | ||
173 | |||
174 | typedef struct _BAENGINE_ESCAPESTRING_ARGS | ||
175 | { | ||
176 | DWORD cbSize; | ||
177 | LPCWSTR wzIn; | ||
178 | } BAENGINE_ESCAPESTRING_ARGS; | ||
179 | |||
180 | typedef struct _BAENGINE_ESCAPESTRING_RESULTS | ||
181 | { | ||
182 | DWORD cbSize; | ||
183 | LPWSTR wzOut; | ||
184 | // Should be initialized to the size of wzOut. | ||
185 | SIZE_T cchOut; | ||
186 | } BAENGINE_ESCAPESTRING_RESULTS; | ||
187 | |||
188 | typedef struct _BAENGINE_EVALUATECONDITION_ARGS | ||
189 | { | ||
190 | DWORD cbSize; | ||
191 | LPCWSTR wzCondition; | ||
192 | } BAENGINE_EVALUATECONDITION_ARGS; | ||
193 | |||
194 | typedef struct _BAENGINE_EVALUATECONDITION_RESULTS | ||
195 | { | ||
196 | DWORD cbSize; | ||
197 | BOOL f; | ||
198 | } BAENGINE_EVALUATECONDITION_RESULTS; | ||
199 | |||
200 | typedef struct _BAENGINE_FORMATSTRING_ARGS | ||
201 | { | ||
202 | DWORD cbSize; | ||
203 | LPCWSTR wzIn; | ||
204 | } BAENGINE_FORMATSTRING_ARGS; | ||
205 | |||
206 | typedef struct _BAENGINE_FORMATSTRING_RESULTS | ||
207 | { | ||
208 | DWORD cbSize; | ||
209 | LPWSTR wzOut; | ||
210 | // Should be initialized to the size of wzOut. | ||
211 | SIZE_T cchOut; | ||
212 | } BAENGINE_FORMATSTRING_RESULTS; | ||
213 | |||
214 | typedef struct _BAENGINE_GETPACKAGECOUNT_ARGS | ||
215 | { | ||
216 | DWORD cbSize; | ||
217 | } BAENGINE_GETPACKAGECOUNT_ARGS; | ||
218 | |||
219 | typedef struct _BAENGINE_GETPACKAGECOUNT_RESULTS | ||
220 | { | ||
221 | DWORD cbSize; | ||
222 | DWORD cPackages; | ||
223 | } BAENGINE_GETPACKAGECOUNT_RESULTS; | ||
224 | |||
225 | typedef struct _BAENGINE_GETVARIABLENUMERIC_ARGS | ||
226 | { | ||
227 | DWORD cbSize; | ||
228 | LPCWSTR wzVariable; | ||
229 | } BAENGINE_GETVARIABLENUMERIC_ARGS; | ||
230 | |||
231 | typedef struct _BAENGINE_GETVARIABLENUMERIC_RESULTS | ||
232 | { | ||
233 | DWORD cbSize; | ||
234 | LONGLONG llValue; | ||
235 | } BAENGINE_GETVARIABLENUMERIC_RESULTS; | ||
236 | |||
237 | typedef struct _BAENGINE_GETVARIABLESTRING_ARGS | ||
238 | { | ||
239 | DWORD cbSize; | ||
240 | LPCWSTR wzVariable; | ||
241 | } BAENGINE_GETVARIABLESTRING_ARGS; | ||
242 | |||
243 | typedef struct _BAENGINE_GETVARIABLESTRING_RESULTS | ||
244 | { | ||
245 | DWORD cbSize; | ||
246 | LPWSTR wzValue; | ||
247 | // Should be initialized to the size of wzValue. | ||
248 | SIZE_T cchValue; | ||
249 | } BAENGINE_GETVARIABLESTRING_RESULTS; | ||
250 | |||
251 | typedef struct _BAENGINE_GETVARIABLEVERSION_ARGS | ||
252 | { | ||
253 | DWORD cbSize; | ||
254 | LPCWSTR wzVariable; | ||
255 | } BAENGINE_GETVARIABLEVERSION_ARGS; | ||
256 | |||
257 | typedef struct _BAENGINE_GETVARIABLEVERSION_RESULTS | ||
258 | { | ||
259 | DWORD cbSize; | ||
260 | LPWSTR wzValue; | ||
261 | // Should be initialized to the size of wzValue. | ||
262 | SIZE_T cchValue; | ||
263 | } BAENGINE_GETVARIABLEVERSION_RESULTS; | ||
264 | |||
265 | typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS | ||
266 | { | ||
267 | DWORD cbSize; | ||
268 | HWND hwndParent; | ||
269 | LPCWSTR wzApprovedExeForElevationId; | ||
270 | LPCWSTR wzArguments; | ||
271 | DWORD dwWaitForInputIdleTimeout; | ||
272 | } BAENGINE_LAUNCHAPPROVEDEXE_ARGS; | ||
273 | |||
274 | typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_RESULTS | ||
275 | { | ||
276 | DWORD cbSize; | ||
277 | } BAENGINE_LAUNCHAPPROVEDEXE_RESULTS; | ||
278 | |||
279 | typedef struct _BAENGINE_SETUPDATESOURCE_ARGS | ||
280 | { | ||
281 | DWORD cbSize; | ||
282 | LPCWSTR wzUrl; | ||
283 | } BAENGINE_SETUPDATESOURCE_ARGS; | ||
284 | |||
285 | typedef struct _BAENGINE_SETUPDATESOURCE_RESULTS | ||
286 | { | ||
287 | DWORD cbSize; | ||
288 | } BAENGINE_SETUPDATESOURCE_RESULTS; | ||
289 | |||
290 | typedef struct _BAENGINE_LOG_ARGS | ||
291 | { | ||
292 | DWORD cbSize; | ||
293 | BOOTSTRAPPER_LOG_LEVEL level; | ||
294 | LPCWSTR wzMessage; | ||
295 | } BAENGINE_LOG_ARGS; | ||
296 | |||
297 | typedef struct _BAENGINE_LOG_RESULTS | ||
298 | { | ||
299 | DWORD cbSize; | ||
300 | } BAENGINE_LOG_RESULTS; | ||
301 | |||
302 | typedef struct _BAENGINE_PLAN_ARGS | ||
303 | { | ||
304 | DWORD cbSize; | ||
305 | BOOTSTRAPPER_ACTION action; | ||
306 | } BAENGINE_PLAN_ARGS; | ||
307 | |||
308 | typedef struct _BAENGINE_PLAN_RESULTS | ||
309 | { | ||
310 | DWORD cbSize; | ||
311 | } BAENGINE_PLAN_RESULTS; | ||
312 | |||
313 | typedef struct _BAENGINE_QUIT_ARGS | ||
314 | { | ||
315 | DWORD cbSize; | ||
316 | DWORD dwExitCode; | ||
317 | } BAENGINE_QUIT_ARGS; | ||
318 | |||
319 | typedef struct _BAENGINE_QUIT_RESULTS | ||
320 | { | ||
321 | DWORD cbSize; | ||
322 | } BAENGINE_QUIT_RESULTS; | ||
323 | |||
324 | typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS | ||
325 | { | ||
326 | DWORD cbSize; | ||
327 | DWORD dwErrorCode; | ||
328 | LPCWSTR wzMessage; | ||
329 | DWORD dwUIHint; | ||
330 | } BAENGINE_SENDEMBEDDEDERROR_ARGS; | ||
331 | |||
332 | typedef struct _BAENGINE_SENDEMBEDDEDERROR_RESULTS | ||
333 | { | ||
334 | DWORD cbSize; | ||
335 | int nResult; | ||
336 | } BAENGINE_SENDEMBEDDEDERROR_RESULTS; | ||
337 | |||
338 | typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS | ||
339 | { | ||
340 | DWORD cbSize; | ||
341 | DWORD dwProgressPercentage; | ||
342 | DWORD dwOverallProgressPercentage; | ||
343 | } BAENGINE_SENDEMBEDDEDPROGRESS_ARGS; | ||
344 | |||
345 | typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS | ||
346 | { | ||
347 | DWORD cbSize; | ||
348 | int nResult; | ||
349 | } BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS; | ||
350 | |||
351 | typedef struct _BAENGINE_SETDOWNLOADSOURCE_ARGS | ||
352 | { | ||
353 | DWORD cbSize; | ||
354 | LPCWSTR wzPackageOrContainerId; | ||
355 | LPCWSTR wzPayloadId; | ||
356 | LPCWSTR wzUrl; | ||
357 | LPCWSTR wzUser; | ||
358 | LPCWSTR wzPassword; | ||
359 | } BAENGINE_SETDOWNLOADSOURCE_ARGS; | ||
360 | |||
361 | typedef struct _BAENGINE_SETDOWNLOADSOURCE_RESULTS | ||
362 | { | ||
363 | DWORD cbSize; | ||
364 | } BAENGINE_SETDOWNLOADSOURCE_RESULTS; | ||
365 | |||
366 | typedef struct _BAENGINE_SETLOCALSOURCE_ARGS | ||
367 | { | ||
368 | DWORD cbSize; | ||
369 | LPCWSTR wzPackageOrContainerId; | ||
370 | LPCWSTR wzPayloadId; | ||
371 | LPCWSTR wzPath; | ||
372 | } BAENGINE_SETLOCALSOURCE_ARGS; | ||
373 | |||
374 | typedef struct _BAENGINE_SETLOCALSOURCE_RESULTS | ||
375 | { | ||
376 | DWORD cbSize; | ||
377 | } BAENGINE_SETLOCALSOURCE_RESULTS; | ||
378 | |||
379 | typedef struct _BAENGINE_SETUPDATE_ARGS | ||
380 | { | ||
381 | DWORD cbSize; | ||
382 | LPCWSTR wzLocalSource; | ||
383 | LPCWSTR wzDownloadSource; | ||
384 | DWORD64 qwSize; | ||
385 | BOOTSTRAPPER_UPDATE_HASH_TYPE hashType; | ||
386 | BYTE* rgbHash; | ||
387 | DWORD cbHash; | ||
388 | } BAENGINE_SETUPDATE_ARGS; | ||
389 | |||
390 | typedef struct _BAENGINE_SETUPDATE_RESULTS | ||
391 | { | ||
392 | DWORD cbSize; | ||
393 | } BAENGINE_SETUPDATE_RESULTS; | ||
394 | |||
395 | typedef struct _BAENGINE_SETVARIABLENUMERIC_ARGS | ||
396 | { | ||
397 | DWORD cbSize; | ||
398 | LPCWSTR wzVariable; | ||
399 | LONGLONG llValue; | ||
400 | } BAENGINE_SETVARIABLENUMERIC_ARGS; | ||
401 | |||
402 | typedef struct _BAENGINE_SETVARIABLENUMERIC_RESULTS | ||
403 | { | ||
404 | DWORD cbSize; | ||
405 | } BAENGINE_SETVARIABLENUMERIC_RESULTS; | ||
406 | |||
407 | typedef struct _BAENGINE_SETVARIABLESTRING_ARGS | ||
408 | { | ||
409 | DWORD cbSize; | ||
410 | LPCWSTR wzVariable; | ||
411 | LPCWSTR wzValue; | ||
412 | BOOL fFormatted; | ||
413 | } BAENGINE_SETVARIABLESTRING_ARGS; | ||
414 | |||
415 | typedef struct _BAENGINE_SETVARIABLESTRING_RESULTS | ||
416 | { | ||
417 | DWORD cbSize; | ||
418 | } BAENGINE_SETVARIABLESTRING_RESULTS; | ||
419 | |||
420 | typedef struct _BAENGINE_SETVARIABLEVERSION_ARGS | ||
421 | { | ||
422 | DWORD cbSize; | ||
423 | LPCWSTR wzVariable; | ||
424 | LPCWSTR wzValue; | ||
425 | } BAENGINE_SETVARIABLEVERSION_ARGS; | ||
426 | |||
427 | typedef struct _BAENGINE_SETVARIABLEVERSION_RESULTS | ||
428 | { | ||
429 | DWORD cbSize; | ||
430 | } BAENGINE_SETVARIABLEVERSION_RESULTS; | ||
431 | |||
432 | |||
433 | extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)( | ||
434 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
435 | __in const LPVOID pvArgs, | ||
436 | __inout LPVOID pvResults, | ||
437 | __in_opt LPVOID pvContext | ||
438 | ); | ||
439 | |||
440 | #if defined(__cplusplus) | ||
441 | } | ||
442 | #endif | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h new file mode 100644 index 00000000..be76a1a5 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #if defined(__cplusplus) | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | enum BUNDLE_EXTENSION_MESSAGE | ||
10 | { | ||
11 | BUNDLE_EXTENSION_MESSAGE_SEARCH, | ||
12 | }; | ||
13 | |||
14 | typedef struct _BUNDLE_EXTENSION_SEARCH_ARGS | ||
15 | { | ||
16 | DWORD cbSize; | ||
17 | LPCWSTR wzId; | ||
18 | LPCWSTR wzVariable; | ||
19 | } BUNDLE_EXTENSION_SEARCH_ARGS; | ||
20 | |||
21 | typedef struct _BUNDLE_EXTENSION_SEARCH_RESULTS | ||
22 | { | ||
23 | DWORD cbSize; | ||
24 | } BUNDLE_EXTENSION_SEARCH_RESULTS; | ||
25 | |||
26 | extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_PROC)( | ||
27 | __in BUNDLE_EXTENSION_MESSAGE message, | ||
28 | __in const LPVOID pvArgs, | ||
29 | __inout LPVOID pvResults, | ||
30 | __in_opt LPVOID pvContext | ||
31 | ); | ||
32 | |||
33 | typedef struct _BUNDLE_EXTENSION_CREATE_ARGS | ||
34 | { | ||
35 | DWORD cbSize; | ||
36 | DWORD64 qwEngineAPIVersion; | ||
37 | PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc; | ||
38 | LPVOID pvBundleExtensionEngineProcContext; | ||
39 | LPCWSTR wzBootstrapperWorkingFolder; | ||
40 | LPCWSTR wzBundleExtensionDataPath; | ||
41 | LPCWSTR wzExtensionId; | ||
42 | } BUNDLE_EXTENSION_CREATE_ARGS; | ||
43 | |||
44 | typedef struct _BUNDLE_EXTENSION_CREATE_RESULTS | ||
45 | { | ||
46 | DWORD cbSize; | ||
47 | PFN_BUNDLE_EXTENSION_PROC pfnBundleExtensionProc; | ||
48 | LPVOID pvBundleExtensionProcContext; | ||
49 | } BUNDLE_EXTENSION_CREATE_RESULTS; | ||
50 | |||
51 | extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_CREATE)( | ||
52 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
53 | __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults | ||
54 | ); | ||
55 | |||
56 | extern "C" typedef void (WINAPI *PFN_BUNDLE_EXTENSION_DESTROY)(); | ||
57 | |||
58 | #if defined(__cplusplus) | ||
59 | } | ||
60 | #endif | ||
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h new file mode 100644 index 00000000..b397ec16 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h | |||
@@ -0,0 +1,184 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #if defined(__cplusplus) | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | enum BUNDLE_EXTENSION_LOG_LEVEL | ||
10 | { | ||
11 | BUNDLE_EXTENSION_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) | ||
12 | BUNDLE_EXTENSION_LOG_LEVEL_STANDARD, // written if reporting is on | ||
13 | BUNDLE_EXTENSION_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on | ||
14 | BUNDLE_EXTENSION_LOG_LEVEL_DEBUG, // reporting useful when debugging code | ||
15 | BUNDLE_EXTENSION_LOG_LEVEL_ERROR, // always gets reported, but can never be specified | ||
16 | }; | ||
17 | |||
18 | enum BUNDLE_EXTENSION_ENGINE_MESSAGE | ||
19 | { | ||
20 | BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, | ||
21 | BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, | ||
22 | BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, | ||
23 | BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, | ||
24 | BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, | ||
25 | BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, | ||
26 | BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, | ||
27 | BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, | ||
28 | BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, | ||
29 | BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, | ||
30 | BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, | ||
31 | }; | ||
32 | |||
33 | typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS | ||
34 | { | ||
35 | DWORD cbSize; | ||
36 | LPCWSTR wzVersion1; | ||
37 | LPCWSTR wzVersion2; | ||
38 | } BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS; | ||
39 | |||
40 | typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS | ||
41 | { | ||
42 | DWORD cbSize; | ||
43 | int nResult; | ||
44 | } BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS; | ||
45 | |||
46 | typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS | ||
47 | { | ||
48 | DWORD cbSize; | ||
49 | LPCWSTR wzIn; | ||
50 | } BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS; | ||
51 | |||
52 | typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS | ||
53 | { | ||
54 | DWORD cbSize; | ||
55 | LPWSTR wzOut; | ||
56 | // Should be initialized to the size of wzOut. | ||
57 | SIZE_T cchOut; | ||
58 | } BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS; | ||
59 | |||
60 | typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS | ||
61 | { | ||
62 | DWORD cbSize; | ||
63 | LPCWSTR wzCondition; | ||
64 | } BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS; | ||
65 | |||
66 | typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS | ||
67 | { | ||
68 | DWORD cbSize; | ||
69 | BOOL f; | ||
70 | } BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS; | ||
71 | |||
72 | typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS | ||
73 | { | ||
74 | DWORD cbSize; | ||
75 | LPCWSTR wzIn; | ||
76 | } BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS; | ||
77 | |||
78 | typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS | ||
79 | { | ||
80 | DWORD cbSize; | ||
81 | LPWSTR wzOut; | ||
82 | // Should be initialized to the size of wzOut. | ||
83 | SIZE_T cchOut; | ||
84 | } BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS; | ||
85 | |||
86 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS | ||
87 | { | ||
88 | DWORD cbSize; | ||
89 | LPCWSTR wzVariable; | ||
90 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS; | ||
91 | |||
92 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS | ||
93 | { | ||
94 | DWORD cbSize; | ||
95 | LONGLONG llValue; | ||
96 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS; | ||
97 | |||
98 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS | ||
99 | { | ||
100 | DWORD cbSize; | ||
101 | LPCWSTR wzVariable; | ||
102 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS; | ||
103 | |||
104 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS | ||
105 | { | ||
106 | DWORD cbSize; | ||
107 | LPWSTR wzValue; | ||
108 | // Should be initialized to the size of wzValue. | ||
109 | SIZE_T cchValue; | ||
110 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS; | ||
111 | |||
112 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS | ||
113 | { | ||
114 | DWORD cbSize; | ||
115 | LPCWSTR wzVariable; | ||
116 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS; | ||
117 | |||
118 | typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS | ||
119 | { | ||
120 | DWORD cbSize; | ||
121 | LPWSTR wzValue; | ||
122 | // Should be initialized to the size of wzValue. | ||
123 | SIZE_T cchValue; | ||
124 | } BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS; | ||
125 | |||
126 | typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_ARGS | ||
127 | { | ||
128 | DWORD cbSize; | ||
129 | BUNDLE_EXTENSION_LOG_LEVEL level; | ||
130 | LPCWSTR wzMessage; | ||
131 | } BUNDLE_EXTENSION_ENGINE_LOG_ARGS; | ||
132 | |||
133 | typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_RESULTS | ||
134 | { | ||
135 | DWORD cbSize; | ||
136 | } BUNDLE_EXTENSION_ENGINE_LOG_RESULTS; | ||
137 | |||
138 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS | ||
139 | { | ||
140 | DWORD cbSize; | ||
141 | LPCWSTR wzVariable; | ||
142 | LONGLONG llValue; | ||
143 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS; | ||
144 | |||
145 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS | ||
146 | { | ||
147 | DWORD cbSize; | ||
148 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS; | ||
149 | |||
150 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS | ||
151 | { | ||
152 | DWORD cbSize; | ||
153 | LPCWSTR wzVariable; | ||
154 | LPCWSTR wzValue; | ||
155 | BOOL fFormatted; | ||
156 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS; | ||
157 | |||
158 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS | ||
159 | { | ||
160 | DWORD cbSize; | ||
161 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS; | ||
162 | |||
163 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS | ||
164 | { | ||
165 | DWORD cbSize; | ||
166 | LPCWSTR wzVariable; | ||
167 | LPCWSTR wzValue; | ||
168 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS; | ||
169 | |||
170 | typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS | ||
171 | { | ||
172 | DWORD cbSize; | ||
173 | } BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS; | ||
174 | |||
175 | extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_ENGINE_PROC)( | ||
176 | __in BUNDLE_EXTENSION_ENGINE_MESSAGE message, | ||
177 | __in const LPVOID pvArgs, | ||
178 | __inout LPVOID pvResults, | ||
179 | __in_opt LPVOID pvContext | ||
180 | ); | ||
181 | |||
182 | #if defined(__cplusplus) | ||
183 | } | ||
184 | #endif | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BalUtil.cs b/src/api/burn/WixToolset.Mba.Core/BalUtil.cs new file mode 100644 index 00000000..f478eca4 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BalUtil.cs | |||
@@ -0,0 +1,22 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | internal static class BalUtil | ||
9 | { | ||
10 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
11 | internal static extern IBootstrapperEngine InitializeFromCreateArgs( | ||
12 | IntPtr pArgs, | ||
13 | ref Command pCommand | ||
14 | ); | ||
15 | |||
16 | [DllImport("mbanative.dll", ExactSpelling = true)] | ||
17 | internal static extern void StoreBAInCreateResults( | ||
18 | IntPtr pResults, | ||
19 | [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA | ||
20 | ); | ||
21 | } | ||
22 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs new file mode 100644 index 00000000..ad8a5dc0 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs | |||
@@ -0,0 +1,63 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Default implementation of <see cref="IBootstrapperApplicationFactory"/>. | ||
10 | /// </summary> | ||
11 | public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Default implementation of <see cref="IBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> | ||
15 | /// </summary> | ||
16 | /// <param name="pArgs"></param> | ||
17 | /// <param name="pResults"></param> | ||
18 | public void Create(IntPtr pArgs, IntPtr pResults) | ||
19 | { | ||
20 | InitializeFromCreateArgs(pArgs, out var engine, out var bootstrapperCommand); | ||
21 | |||
22 | var ba = this.Create(engine, bootstrapperCommand); | ||
23 | StoreBAInCreateResults(pResults, ba); | ||
24 | } | ||
25 | |||
26 | /// <summary> | ||
27 | /// Called by <see cref="BaseBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> to get the <see cref="IBootstrapperApplication"/>. | ||
28 | /// </summary> | ||
29 | /// <param name="engine">The bundle engine.</param> | ||
30 | /// <param name="bootstrapperCommand">Command information passed from the engine for the BA to perform.</param> | ||
31 | /// <returns>The <see cref="IBootstrapperApplication"/> for the bundle.</returns> | ||
32 | protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); | ||
33 | |||
34 | /// <summary> | ||
35 | /// Initializes the native part of <see cref="WixToolset.Mba.Core"/>. | ||
36 | /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method. | ||
37 | /// </summary> | ||
38 | /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param> | ||
39 | /// <param name="engine">The bundle engine interface.</param> | ||
40 | /// <param name="bootstrapperCommand">The context of the current run of the bundle.</param> | ||
41 | public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) | ||
42 | { | ||
43 | Command pCommand = new Command | ||
44 | { | ||
45 | cbSize = Marshal.SizeOf(typeof(Command)) | ||
46 | }; | ||
47 | var pEngine = BalUtil.InitializeFromCreateArgs(pArgs, ref pCommand); | ||
48 | engine = new Engine(pEngine); | ||
49 | bootstrapperCommand = pCommand.GetBootstrapperCommand(); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Registers the BA with the engine using the default mapping between the message based interface and the COM interface. | ||
54 | /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method. | ||
55 | /// </summary> | ||
56 | /// <param name="pResults">The results struct given by the engine when initially creating the BA</param> | ||
57 | /// <param name="ba">The <see cref="IBootstrapperApplication"/>.</param> | ||
58 | public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) | ||
59 | { | ||
60 | BalUtil.StoreBAInCreateResults(pResults, ba); | ||
61 | } | ||
62 | } | ||
63 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs new file mode 100644 index 00000000..072d3ef0 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
@@ -0,0 +1,1873 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | using System.Threading; | ||
8 | |||
9 | /// <summary> | ||
10 | /// The default bootstrapper application. | ||
11 | /// </summary> | ||
12 | [ClassInterface(ClassInterfaceType.None)] | ||
13 | public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Specifies whether this bootstrapper should run asynchronously. The default is true. | ||
17 | /// </summary> | ||
18 | protected readonly bool asyncExecution; | ||
19 | |||
20 | /// <summary> | ||
21 | /// Gets the <see cref="IEngine"/> for interaction with the engine. | ||
22 | /// </summary> | ||
23 | protected readonly IEngine engine; | ||
24 | |||
25 | private bool applying; | ||
26 | |||
27 | /// <summary> | ||
28 | /// Creates a new instance of the <see cref="BootstrapperApplication"/> class. | ||
29 | /// </summary> | ||
30 | protected BootstrapperApplication(IEngine engine) | ||
31 | { | ||
32 | this.engine = engine; | ||
33 | this.applying = false; | ||
34 | this.asyncExecution = true; | ||
35 | } | ||
36 | |||
37 | /// <inheritdoc/> | ||
38 | public event EventHandler<StartupEventArgs> Startup; | ||
39 | |||
40 | /// <inheritdoc/> | ||
41 | public event EventHandler<ShutdownEventArgs> Shutdown; | ||
42 | |||
43 | /// <inheritdoc/> | ||
44 | public event EventHandler<SystemShutdownEventArgs> SystemShutdown; | ||
45 | |||
46 | /// <inheritdoc/> | ||
47 | public event EventHandler<DetectBeginEventArgs> DetectBegin; | ||
48 | |||
49 | /// <inheritdoc/> | ||
50 | public event EventHandler<DetectForwardCompatibleBundleEventArgs> DetectForwardCompatibleBundle; | ||
51 | |||
52 | /// <inheritdoc/> | ||
53 | public event EventHandler<DetectUpdateBeginEventArgs> DetectUpdateBegin; | ||
54 | |||
55 | /// <inheritdoc/> | ||
56 | public event EventHandler<DetectUpdateEventArgs> DetectUpdate; | ||
57 | |||
58 | /// <inheritdoc/> | ||
59 | public event EventHandler<DetectUpdateCompleteEventArgs> DetectUpdateComplete; | ||
60 | |||
61 | /// <inheritdoc/> | ||
62 | public event EventHandler<DetectRelatedBundleEventArgs> DetectRelatedBundle; | ||
63 | |||
64 | /// <inheritdoc/> | ||
65 | public event EventHandler<DetectPackageBeginEventArgs> DetectPackageBegin; | ||
66 | |||
67 | /// <inheritdoc/> | ||
68 | public event EventHandler<DetectRelatedMsiPackageEventArgs> DetectRelatedMsiPackage; | ||
69 | |||
70 | /// <inheritdoc/> | ||
71 | public event EventHandler<DetectPatchTargetEventArgs> DetectPatchTarget; | ||
72 | |||
73 | /// <inheritdoc/> | ||
74 | public event EventHandler<DetectMsiFeatureEventArgs> DetectMsiFeature; | ||
75 | |||
76 | /// <inheritdoc/> | ||
77 | public event EventHandler<DetectPackageCompleteEventArgs> DetectPackageComplete; | ||
78 | |||
79 | /// <inheritdoc/> | ||
80 | public event EventHandler<DetectCompleteEventArgs> DetectComplete; | ||
81 | |||
82 | /// <inheritdoc/> | ||
83 | public event EventHandler<PlanBeginEventArgs> PlanBegin; | ||
84 | |||
85 | /// <inheritdoc/> | ||
86 | public event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; | ||
87 | |||
88 | /// <inheritdoc/> | ||
89 | public event EventHandler<PlanPackageBeginEventArgs> PlanPackageBegin; | ||
90 | |||
91 | /// <inheritdoc/> | ||
92 | public event EventHandler<PlanPatchTargetEventArgs> PlanPatchTarget; | ||
93 | |||
94 | /// <inheritdoc/> | ||
95 | public event EventHandler<PlanMsiFeatureEventArgs> PlanMsiFeature; | ||
96 | |||
97 | /// <inheritdoc/> | ||
98 | public event EventHandler<PlanMsiPackageEventArgs> PlanMsiPackage; | ||
99 | |||
100 | /// <inheritdoc/> | ||
101 | public event EventHandler<PlanPackageCompleteEventArgs> PlanPackageComplete; | ||
102 | |||
103 | /// <inheritdoc/> | ||
104 | public event EventHandler<PlannedPackageEventArgs> PlannedPackage; | ||
105 | |||
106 | /// <inheritdoc/> | ||
107 | public event EventHandler<PlanCompleteEventArgs> PlanComplete; | ||
108 | |||
109 | /// <inheritdoc/> | ||
110 | public event EventHandler<ApplyBeginEventArgs> ApplyBegin; | ||
111 | |||
112 | /// <inheritdoc/> | ||
113 | public event EventHandler<ElevateBeginEventArgs> ElevateBegin; | ||
114 | |||
115 | /// <inheritdoc/> | ||
116 | public event EventHandler<ElevateCompleteEventArgs> ElevateComplete; | ||
117 | |||
118 | /// <inheritdoc/> | ||
119 | public event EventHandler<ProgressEventArgs> Progress; | ||
120 | |||
121 | /// <inheritdoc/> | ||
122 | public event EventHandler<ErrorEventArgs> Error; | ||
123 | |||
124 | /// <inheritdoc/> | ||
125 | public event EventHandler<RegisterBeginEventArgs> RegisterBegin; | ||
126 | |||
127 | /// <inheritdoc/> | ||
128 | public event EventHandler<RegisterCompleteEventArgs> RegisterComplete; | ||
129 | |||
130 | /// <inheritdoc/> | ||
131 | public event EventHandler<UnregisterBeginEventArgs> UnregisterBegin; | ||
132 | |||
133 | /// <inheritdoc/> | ||
134 | public event EventHandler<UnregisterCompleteEventArgs> UnregisterComplete; | ||
135 | |||
136 | /// <inheritdoc/> | ||
137 | public event EventHandler<CacheBeginEventArgs> CacheBegin; | ||
138 | |||
139 | /// <inheritdoc/> | ||
140 | public event EventHandler<CachePackageBeginEventArgs> CachePackageBegin; | ||
141 | |||
142 | /// <inheritdoc/> | ||
143 | public event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; | ||
144 | |||
145 | /// <inheritdoc/> | ||
146 | public event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; | ||
147 | |||
148 | /// <inheritdoc/> | ||
149 | public event EventHandler<CacheAcquireResolvingEventArgs> CacheAcquireResolving; | ||
150 | |||
151 | /// <inheritdoc/> | ||
152 | public event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; | ||
153 | |||
154 | /// <inheritdoc/> | ||
155 | public event EventHandler<CacheVerifyBeginEventArgs> CacheVerifyBegin; | ||
156 | |||
157 | /// <inheritdoc/> | ||
158 | public event EventHandler<CacheVerifyProgressEventArgs> CacheVerifyProgress; | ||
159 | |||
160 | /// <inheritdoc/> | ||
161 | public event EventHandler<CacheVerifyCompleteEventArgs> CacheVerifyComplete; | ||
162 | |||
163 | /// <inheritdoc/> | ||
164 | public event EventHandler<CachePackageCompleteEventArgs> CachePackageComplete; | ||
165 | |||
166 | /// <inheritdoc/> | ||
167 | public event EventHandler<CacheCompleteEventArgs> CacheComplete; | ||
168 | |||
169 | /// <inheritdoc/> | ||
170 | public event EventHandler<ExecuteBeginEventArgs> ExecuteBegin; | ||
171 | |||
172 | /// <inheritdoc/> | ||
173 | public event EventHandler<ExecutePackageBeginEventArgs> ExecutePackageBegin; | ||
174 | |||
175 | /// <inheritdoc/> | ||
176 | public event EventHandler<ExecutePatchTargetEventArgs> ExecutePatchTarget; | ||
177 | |||
178 | /// <inheritdoc/> | ||
179 | public event EventHandler<ExecuteMsiMessageEventArgs> ExecuteMsiMessage; | ||
180 | |||
181 | /// <inheritdoc/> | ||
182 | public event EventHandler<ExecuteFilesInUseEventArgs> ExecuteFilesInUse; | ||
183 | |||
184 | /// <inheritdoc/> | ||
185 | public event EventHandler<ExecutePackageCompleteEventArgs> ExecutePackageComplete; | ||
186 | |||
187 | /// <inheritdoc/> | ||
188 | public event EventHandler<ExecuteCompleteEventArgs> ExecuteComplete; | ||
189 | |||
190 | /// <inheritdoc/> | ||
191 | public event EventHandler<ApplyCompleteEventArgs> ApplyComplete; | ||
192 | |||
193 | /// <inheritdoc/> | ||
194 | public event EventHandler<ExecuteProgressEventArgs> ExecuteProgress; | ||
195 | |||
196 | /// <inheritdoc/> | ||
197 | public event EventHandler<LaunchApprovedExeBeginEventArgs> LaunchApprovedExeBegin; | ||
198 | |||
199 | /// <inheritdoc/> | ||
200 | public event EventHandler<LaunchApprovedExeCompleteEventArgs> LaunchApprovedExeComplete; | ||
201 | |||
202 | /// <inheritdoc/> | ||
203 | public event EventHandler<BeginMsiTransactionBeginEventArgs> BeginMsiTransactionBegin; | ||
204 | |||
205 | /// <inheritdoc/> | ||
206 | public event EventHandler<BeginMsiTransactionCompleteEventArgs> BeginMsiTransactionComplete; | ||
207 | |||
208 | /// <inheritdoc/> | ||
209 | public event EventHandler<CommitMsiTransactionBeginEventArgs> CommitMsiTransactionBegin; | ||
210 | |||
211 | /// <inheritdoc/> | ||
212 | public event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete; | ||
213 | |||
214 | /// <inheritdoc/> | ||
215 | public event EventHandler<RollbackMsiTransactionBeginEventArgs> RollbackMsiTransactionBegin; | ||
216 | |||
217 | /// <inheritdoc/> | ||
218 | public event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; | ||
219 | |||
220 | /// <inheritdoc/> | ||
221 | public event EventHandler<PauseAutomaticUpdatesBeginEventArgs> PauseAutomaticUpdatesBegin; | ||
222 | |||
223 | /// <inheritdoc/> | ||
224 | public event EventHandler<PauseAutomaticUpdatesCompleteEventArgs> PauseAutomaticUpdatesComplete; | ||
225 | |||
226 | /// <inheritdoc/> | ||
227 | public event EventHandler<SystemRestorePointBeginEventArgs> SystemRestorePointBegin; | ||
228 | |||
229 | /// <inheritdoc/> | ||
230 | public event EventHandler<SystemRestorePointCompleteEventArgs> SystemRestorePointComplete; | ||
231 | |||
232 | /// <inheritdoc/> | ||
233 | public event EventHandler<PlanForwardCompatibleBundleEventArgs> PlanForwardCompatibleBundle; | ||
234 | |||
235 | /// <inheritdoc/> | ||
236 | public event EventHandler<CacheContainerOrPayloadVerifyBeginEventArgs> CacheContainerOrPayloadVerifyBegin; | ||
237 | |||
238 | /// <inheritdoc/> | ||
239 | public event EventHandler<CacheContainerOrPayloadVerifyProgressEventArgs> CacheContainerOrPayloadVerifyProgress; | ||
240 | |||
241 | /// <inheritdoc/> | ||
242 | public event EventHandler<CacheContainerOrPayloadVerifyCompleteEventArgs> CacheContainerOrPayloadVerifyComplete; | ||
243 | |||
244 | /// <inheritdoc/> | ||
245 | public event EventHandler<CachePayloadExtractBeginEventArgs> CachePayloadExtractBegin; | ||
246 | |||
247 | /// <inheritdoc/> | ||
248 | public event EventHandler<CachePayloadExtractProgressEventArgs> CachePayloadExtractProgress; | ||
249 | |||
250 | /// <inheritdoc/> | ||
251 | public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; | ||
252 | |||
253 | /// <summary> | ||
254 | /// Entry point that is called when the bootstrapper application is ready to run. | ||
255 | /// </summary> | ||
256 | protected abstract void Run(); | ||
257 | |||
258 | /// <summary> | ||
259 | /// Called by the engine, raises the <see cref="Startup"/> event. | ||
260 | /// </summary> | ||
261 | /// <param name="args">Additional arguments for this event.</param> | ||
262 | protected virtual void OnStartup(StartupEventArgs args) | ||
263 | { | ||
264 | EventHandler<StartupEventArgs> handler = this.Startup; | ||
265 | if (null != handler) | ||
266 | { | ||
267 | handler(this, args); | ||
268 | } | ||
269 | |||
270 | if (this.asyncExecution) | ||
271 | { | ||
272 | this.engine.Log(LogLevel.Verbose, "Creating BA thread to run asynchronously."); | ||
273 | Thread uiThread = new Thread(this.Run); | ||
274 | uiThread.Name = "UIThread"; | ||
275 | uiThread.SetApartmentState(ApartmentState.STA); | ||
276 | uiThread.Start(); | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | this.engine.Log(LogLevel.Verbose, "Creating BA thread to run synchronously."); | ||
281 | this.Run(); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Called by the engine, raises the <see cref="Shutdown"/> event. | ||
287 | /// </summary> | ||
288 | /// <param name="args">Additional arguments for this event.</param> | ||
289 | protected virtual void OnShutdown(ShutdownEventArgs args) | ||
290 | { | ||
291 | EventHandler<ShutdownEventArgs> handler = this.Shutdown; | ||
292 | if (null != handler) | ||
293 | { | ||
294 | handler(this, args); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | /// <summary> | ||
299 | /// Called by the engine, raises the <see cref="SystemShutdown"/> event. | ||
300 | /// </summary> | ||
301 | /// <param name="args">Additional arguments for this event.</param> | ||
302 | protected virtual void OnSystemShutdown(SystemShutdownEventArgs args) | ||
303 | { | ||
304 | EventHandler<SystemShutdownEventArgs> handler = this.SystemShutdown; | ||
305 | if (null != handler) | ||
306 | { | ||
307 | handler(this, args); | ||
308 | } | ||
309 | else if (null != args) | ||
310 | { | ||
311 | // Allow requests to shut down when critical or not applying. | ||
312 | bool critical = EndSessionReasons.Critical == (EndSessionReasons.Critical & args.Reasons); | ||
313 | args.Cancel = !critical && this.applying; | ||
314 | } | ||
315 | } | ||
316 | |||
317 | /// <summary> | ||
318 | /// Called by the engine, raises the <see cref="DetectBegin"/> event. | ||
319 | /// </summary> | ||
320 | /// <param name="args">Additional arguments for this event.</param> | ||
321 | protected virtual void OnDetectBegin(DetectBeginEventArgs args) | ||
322 | { | ||
323 | EventHandler<DetectBeginEventArgs> handler = this.DetectBegin; | ||
324 | if (null != handler) | ||
325 | { | ||
326 | handler(this, args); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | /// <summary> | ||
331 | /// Called by the engine, raises the <see cref="DetectForwardCompatibleBundle"/> event. | ||
332 | /// </summary> | ||
333 | /// <param name="args">Additional arguments for this event.</param> | ||
334 | protected virtual void OnDetectForwardCompatibleBundle(DetectForwardCompatibleBundleEventArgs args) | ||
335 | { | ||
336 | EventHandler<DetectForwardCompatibleBundleEventArgs> handler = this.DetectForwardCompatibleBundle; | ||
337 | if (null != handler) | ||
338 | { | ||
339 | handler(this, args); | ||
340 | } | ||
341 | } | ||
342 | |||
343 | /// <summary> | ||
344 | /// Called by the engine, raises the <see cref="DetectUpdateBegin"/> event. | ||
345 | /// </summary> | ||
346 | /// <param name="args">Additional arguments for this event.</param> | ||
347 | protected virtual void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args) | ||
348 | { | ||
349 | EventHandler<DetectUpdateBeginEventArgs> handler = this.DetectUpdateBegin; | ||
350 | if (null != handler) | ||
351 | { | ||
352 | handler(this, args); | ||
353 | } | ||
354 | } | ||
355 | |||
356 | /// <summary> | ||
357 | /// Called by the engine, raises the <see cref="DetectUpdate"/> event. | ||
358 | /// </summary> | ||
359 | /// <param name="args">Additional arguments for this event.</param> | ||
360 | protected virtual void OnDetectUpdate(DetectUpdateEventArgs args) | ||
361 | { | ||
362 | EventHandler<DetectUpdateEventArgs> handler = this.DetectUpdate; | ||
363 | if (null != handler) | ||
364 | { | ||
365 | handler(this, args); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | /// <summary> | ||
370 | /// Called by the engine, raises the <see cref="DetectUpdateComplete"/> event. | ||
371 | /// </summary> | ||
372 | /// <param name="args">Additional arguments for this event.</param> | ||
373 | protected virtual void OnDetectUpdateComplete(DetectUpdateCompleteEventArgs args) | ||
374 | { | ||
375 | EventHandler<DetectUpdateCompleteEventArgs> handler = this.DetectUpdateComplete; | ||
376 | if (null != handler) | ||
377 | { | ||
378 | handler(this, args); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | /// <summary> | ||
383 | /// Called by the engine, raises the <see cref="DetectRelatedBundle"/> event. | ||
384 | /// </summary> | ||
385 | /// <param name="args">Additional arguments for this event.</param> | ||
386 | protected virtual void OnDetectRelatedBundle(DetectRelatedBundleEventArgs args) | ||
387 | { | ||
388 | EventHandler<DetectRelatedBundleEventArgs> handler = this.DetectRelatedBundle; | ||
389 | if (null != handler) | ||
390 | { | ||
391 | handler(this, args); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | /// <summary> | ||
396 | /// Called by the engine, raises the <see cref="DetectPackageBegin"/> event. | ||
397 | /// </summary> | ||
398 | /// <param name="args">Additional arguments for this event.</param> | ||
399 | protected virtual void OnDetectPackageBegin(DetectPackageBeginEventArgs args) | ||
400 | { | ||
401 | EventHandler<DetectPackageBeginEventArgs> handler = this.DetectPackageBegin; | ||
402 | if (null != handler) | ||
403 | { | ||
404 | handler(this, args); | ||
405 | } | ||
406 | } | ||
407 | |||
408 | /// <summary> | ||
409 | /// Called by the engine, raises the <see cref="DetectRelatedMsiPackage"/> event. | ||
410 | /// </summary> | ||
411 | /// <param name="args">Additional arguments for this event.</param> | ||
412 | protected virtual void OnDetectRelatedMsiPackage(DetectRelatedMsiPackageEventArgs args) | ||
413 | { | ||
414 | EventHandler<DetectRelatedMsiPackageEventArgs> handler = this.DetectRelatedMsiPackage; | ||
415 | if (null != handler) | ||
416 | { | ||
417 | handler(this, args); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /// <summary> | ||
422 | /// Called by the engine, raises the <see cref="DetectPatchTarget"/> event. | ||
423 | /// </summary> | ||
424 | /// <param name="args">Additional arguments for this event.</param> | ||
425 | protected virtual void OnDetectPatchTarget(DetectPatchTargetEventArgs args) | ||
426 | { | ||
427 | EventHandler<DetectPatchTargetEventArgs> handler = this.DetectPatchTarget; | ||
428 | if (null != handler) | ||
429 | { | ||
430 | handler(this, args); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
435 | /// Called by the engine, raises the <see cref="DetectMsiFeature"/> event. | ||
436 | /// </summary> | ||
437 | /// <param name="args">Additional arguments for this event.</param> | ||
438 | protected virtual void OnDetectMsiFeature(DetectMsiFeatureEventArgs args) | ||
439 | { | ||
440 | EventHandler<DetectMsiFeatureEventArgs> handler = this.DetectMsiFeature; | ||
441 | if (null != handler) | ||
442 | { | ||
443 | handler(this, args); | ||
444 | } | ||
445 | } | ||
446 | |||
447 | /// <summary> | ||
448 | /// Called by the engine, raises the <see cref="DetectPackageComplete"/> event. | ||
449 | /// </summary> | ||
450 | /// <param name="args">Additional arguments for this event.</param> | ||
451 | protected virtual void OnDetectPackageComplete(DetectPackageCompleteEventArgs args) | ||
452 | { | ||
453 | EventHandler<DetectPackageCompleteEventArgs> handler = this.DetectPackageComplete; | ||
454 | if (null != handler) | ||
455 | { | ||
456 | handler(this, args); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | /// <summary> | ||
461 | /// Called by the engine, raises the <see cref="DetectComplete"/> event. | ||
462 | /// </summary> | ||
463 | /// <param name="args">Additional arguments for this event.</param> | ||
464 | protected virtual void OnDetectComplete(DetectCompleteEventArgs args) | ||
465 | { | ||
466 | EventHandler<DetectCompleteEventArgs> handler = this.DetectComplete; | ||
467 | if (null != handler) | ||
468 | { | ||
469 | handler(this, args); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | /// <summary> | ||
474 | /// Called by the engine, raises the <see cref="PlanBegin"/> event. | ||
475 | /// </summary> | ||
476 | /// <param name="args">Additional arguments for this event.</param> | ||
477 | protected virtual void OnPlanBegin(PlanBeginEventArgs args) | ||
478 | { | ||
479 | EventHandler<PlanBeginEventArgs> handler = this.PlanBegin; | ||
480 | if (null != handler) | ||
481 | { | ||
482 | handler(this, args); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | /// <summary> | ||
487 | /// Called by the engine, raises the <see cref="PlanRelatedBundle"/> event. | ||
488 | /// </summary> | ||
489 | /// <param name="args">Additional arguments for this event.</param> | ||
490 | protected virtual void OnPlanRelatedBundle(PlanRelatedBundleEventArgs args) | ||
491 | { | ||
492 | EventHandler<PlanRelatedBundleEventArgs> handler = this.PlanRelatedBundle; | ||
493 | if (null != handler) | ||
494 | { | ||
495 | handler(this, args); | ||
496 | } | ||
497 | } | ||
498 | |||
499 | /// <summary> | ||
500 | /// Called by the engine, raises the <see cref="PlanPackageBegin"/> event. | ||
501 | /// </summary> | ||
502 | /// <param name="args">Additional arguments for this event.</param> | ||
503 | protected virtual void OnPlanPackageBegin(PlanPackageBeginEventArgs args) | ||
504 | { | ||
505 | EventHandler<PlanPackageBeginEventArgs> handler = this.PlanPackageBegin; | ||
506 | if (null != handler) | ||
507 | { | ||
508 | handler(this, args); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | /// <summary> | ||
513 | /// Called by the engine, raises the <see cref="PlanPatchTarget"/> event. | ||
514 | /// </summary> | ||
515 | /// <param name="args">Additional arguments for this event.</param> | ||
516 | protected virtual void OnPlanPatchTarget(PlanPatchTargetEventArgs args) | ||
517 | { | ||
518 | EventHandler<PlanPatchTargetEventArgs> handler = this.PlanPatchTarget; | ||
519 | if (null != handler) | ||
520 | { | ||
521 | handler(this, args); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | /// <summary> | ||
526 | /// Called by the engine, raises the <see cref="PlanMsiFeature"/> event. | ||
527 | /// </summary> | ||
528 | /// <param name="args">Additional arguments for this event.</param> | ||
529 | protected virtual void OnPlanMsiFeature(PlanMsiFeatureEventArgs args) | ||
530 | { | ||
531 | EventHandler<PlanMsiFeatureEventArgs> handler = this.PlanMsiFeature; | ||
532 | if (null != handler) | ||
533 | { | ||
534 | handler(this, args); | ||
535 | } | ||
536 | } | ||
537 | |||
538 | /// <summary> | ||
539 | /// Called by the engine, raises the <see cref="PlanMsiPackage"/> event. | ||
540 | /// </summary> | ||
541 | /// <param name="args">Additional arguments for this event.</param> | ||
542 | protected virtual void OnPlanMsiPackage(PlanMsiPackageEventArgs args) | ||
543 | { | ||
544 | EventHandler<PlanMsiPackageEventArgs> handler = this.PlanMsiPackage; | ||
545 | if (null != handler) | ||
546 | { | ||
547 | handler(this, args); | ||
548 | } | ||
549 | } | ||
550 | |||
551 | /// <summary> | ||
552 | /// Called by the engine, raises the <see cref="PlanPackageComplete"/> event. | ||
553 | /// </summary> | ||
554 | /// <param name="args">Additional arguments for this event.</param> | ||
555 | protected virtual void OnPlanPackageComplete(PlanPackageCompleteEventArgs args) | ||
556 | { | ||
557 | EventHandler<PlanPackageCompleteEventArgs> handler = this.PlanPackageComplete; | ||
558 | if (null != handler) | ||
559 | { | ||
560 | handler(this, args); | ||
561 | } | ||
562 | } | ||
563 | |||
564 | /// <summary> | ||
565 | /// Called by the engine, raises the <see cref="PlannedPackage"/> event. | ||
566 | /// </summary> | ||
567 | /// <param name="args">Additional arguments for this event.</param> | ||
568 | protected virtual void OnPlannedPackage(PlannedPackageEventArgs args) | ||
569 | { | ||
570 | EventHandler<PlannedPackageEventArgs> handler = this.PlannedPackage; | ||
571 | if (null != handler) | ||
572 | { | ||
573 | handler(this, args); | ||
574 | } | ||
575 | } | ||
576 | |||
577 | /// <summary> | ||
578 | /// Called by the engine, raises the <see cref="PlanComplete"/> event. | ||
579 | /// </summary> | ||
580 | /// <param name="args">Additional arguments for this event.</param> | ||
581 | protected virtual void OnPlanComplete(PlanCompleteEventArgs args) | ||
582 | { | ||
583 | EventHandler<PlanCompleteEventArgs> handler = this.PlanComplete; | ||
584 | if (null != handler) | ||
585 | { | ||
586 | handler(this, args); | ||
587 | } | ||
588 | } | ||
589 | |||
590 | /// <summary> | ||
591 | /// Called by the engine, raises the <see cref="ApplyBegin"/> event. | ||
592 | /// </summary> | ||
593 | /// <param name="args">Additional arguments for this event.</param> | ||
594 | protected virtual void OnApplyBegin(ApplyBeginEventArgs args) | ||
595 | { | ||
596 | EventHandler<ApplyBeginEventArgs> handler = this.ApplyBegin; | ||
597 | if (null != handler) | ||
598 | { | ||
599 | handler(this, args); | ||
600 | } | ||
601 | } | ||
602 | |||
603 | /// <summary> | ||
604 | /// Called by the engine, raises the <see cref="ElevateBegin"/> event. | ||
605 | /// </summary> | ||
606 | /// <param name="args">Additional arguments for this event.</param> | ||
607 | protected virtual void OnElevateBegin(ElevateBeginEventArgs args) | ||
608 | { | ||
609 | EventHandler<ElevateBeginEventArgs> handler = this.ElevateBegin; | ||
610 | if (null != handler) | ||
611 | { | ||
612 | handler(this, args); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /// <summary> | ||
617 | /// Called by the engine, raises the <see cref="ElevateComplete"/> event. | ||
618 | /// </summary> | ||
619 | /// <param name="args">Additional arguments for this event.</param> | ||
620 | protected virtual void OnElevateComplete(ElevateCompleteEventArgs args) | ||
621 | { | ||
622 | EventHandler<ElevateCompleteEventArgs> handler = this.ElevateComplete; | ||
623 | if (null != handler) | ||
624 | { | ||
625 | handler(this, args); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | /// <summary> | ||
630 | /// Called by the engine, raises the <see cref="Progress"/> event. | ||
631 | /// </summary> | ||
632 | /// <param name="args">Additional arguments for this event.</param> | ||
633 | protected virtual void OnProgress(ProgressEventArgs args) | ||
634 | { | ||
635 | EventHandler<ProgressEventArgs> handler = this.Progress; | ||
636 | if (null != handler) | ||
637 | { | ||
638 | handler(this, args); | ||
639 | } | ||
640 | } | ||
641 | |||
642 | /// <summary> | ||
643 | /// Called by the engine, raises the <see cref="Error"/> event. | ||
644 | /// </summary> | ||
645 | /// <param name="args">Additional arguments for this event.</param> | ||
646 | protected virtual void OnError(ErrorEventArgs args) | ||
647 | { | ||
648 | EventHandler<ErrorEventArgs> handler = this.Error; | ||
649 | if (null != handler) | ||
650 | { | ||
651 | handler(this, args); | ||
652 | } | ||
653 | } | ||
654 | |||
655 | /// <summary> | ||
656 | /// Called by the engine, raises the <see cref="RegisterBegin"/> event. | ||
657 | /// </summary> | ||
658 | /// <param name="args">Additional arguments for this event.</param> | ||
659 | protected virtual void OnRegisterBegin(RegisterBeginEventArgs args) | ||
660 | { | ||
661 | EventHandler<RegisterBeginEventArgs> handler = this.RegisterBegin; | ||
662 | if (null != handler) | ||
663 | { | ||
664 | handler(this, args); | ||
665 | } | ||
666 | } | ||
667 | |||
668 | /// <summary> | ||
669 | /// Called by the engine, raises the <see cref="RegisterComplete"/> event. | ||
670 | /// </summary> | ||
671 | /// <param name="args">Additional arguments for this event.</param> | ||
672 | protected virtual void OnRegisterComplete(RegisterCompleteEventArgs args) | ||
673 | { | ||
674 | EventHandler<RegisterCompleteEventArgs> handler = this.RegisterComplete; | ||
675 | if (null != handler) | ||
676 | { | ||
677 | handler(this, args); | ||
678 | } | ||
679 | } | ||
680 | |||
681 | /// <summary> | ||
682 | /// Called by the engine, raises the <see cref="UnregisterBegin"/> event. | ||
683 | /// </summary> | ||
684 | /// <param name="args">Additional arguments for this event.</param> | ||
685 | protected virtual void OnUnregisterBegin(UnregisterBeginEventArgs args) | ||
686 | { | ||
687 | EventHandler<UnregisterBeginEventArgs> handler = this.UnregisterBegin; | ||
688 | if (null != handler) | ||
689 | { | ||
690 | handler(this, args); | ||
691 | } | ||
692 | } | ||
693 | |||
694 | /// <summary> | ||
695 | /// Called by the engine, raises the <see cref="UnregisterComplete"/> event. | ||
696 | /// </summary> | ||
697 | /// <param name="args">Additional arguments for this event.</param> | ||
698 | protected virtual void OnUnregisterComplete(UnregisterCompleteEventArgs args) | ||
699 | { | ||
700 | EventHandler<UnregisterCompleteEventArgs> handler = this.UnregisterComplete; | ||
701 | if (null != handler) | ||
702 | { | ||
703 | handler(this, args); | ||
704 | } | ||
705 | } | ||
706 | |||
707 | /// <summary> | ||
708 | /// Called by the engine, raises the <see cref="CacheBegin"/> event. | ||
709 | /// </summary> | ||
710 | /// <param name="args"></param> | ||
711 | protected virtual void OnCacheBegin(CacheBeginEventArgs args) | ||
712 | { | ||
713 | EventHandler<CacheBeginEventArgs> handler = this.CacheBegin; | ||
714 | if (null != handler) | ||
715 | { | ||
716 | handler(this, args); | ||
717 | } | ||
718 | } | ||
719 | |||
720 | /// <summary> | ||
721 | /// Called by the engine, raises the <see cref="CachePackageBegin"/> event. | ||
722 | /// </summary> | ||
723 | /// <param name="args"></param> | ||
724 | protected virtual void OnCachePackageBegin(CachePackageBeginEventArgs args) | ||
725 | { | ||
726 | EventHandler<CachePackageBeginEventArgs> handler = this.CachePackageBegin; | ||
727 | if (null != handler) | ||
728 | { | ||
729 | handler(this, args); | ||
730 | } | ||
731 | } | ||
732 | |||
733 | /// <summary> | ||
734 | /// Called by the engine, raises the <see cref="CacheAcquireBegin"/> event. | ||
735 | /// </summary> | ||
736 | /// <param name="args"></param> | ||
737 | protected virtual void OnCacheAcquireBegin(CacheAcquireBeginEventArgs args) | ||
738 | { | ||
739 | EventHandler<CacheAcquireBeginEventArgs> handler = this.CacheAcquireBegin; | ||
740 | if (null != handler) | ||
741 | { | ||
742 | handler(this, args); | ||
743 | } | ||
744 | } | ||
745 | |||
746 | /// <summary> | ||
747 | /// Called by the engine, raises the <see cref="CacheAcquireProgress"/> event. | ||
748 | /// </summary> | ||
749 | /// <param name="args"></param> | ||
750 | protected virtual void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args) | ||
751 | { | ||
752 | EventHandler<CacheAcquireProgressEventArgs> handler = this.CacheAcquireProgress; | ||
753 | if (null != handler) | ||
754 | { | ||
755 | handler(this, args); | ||
756 | } | ||
757 | } | ||
758 | |||
759 | /// <summary> | ||
760 | /// Called by the engine, raises the <see cref="CacheAcquireResolving"/> event. | ||
761 | /// </summary> | ||
762 | /// <param name="args">Additional arguments for this event.</param> | ||
763 | protected virtual void OnCacheAcquireResolving(CacheAcquireResolvingEventArgs args) | ||
764 | { | ||
765 | EventHandler<CacheAcquireResolvingEventArgs> handler = this.CacheAcquireResolving; | ||
766 | if (null != handler) | ||
767 | { | ||
768 | handler(this, args); | ||
769 | } | ||
770 | } | ||
771 | |||
772 | /// <summary> | ||
773 | /// Called by the engine, raises the <see cref="CacheAcquireComplete"/> event. | ||
774 | /// </summary> | ||
775 | /// <param name="args"></param> | ||
776 | protected virtual void OnCacheAcquireComplete(CacheAcquireCompleteEventArgs args) | ||
777 | { | ||
778 | EventHandler<CacheAcquireCompleteEventArgs> handler = this.CacheAcquireComplete; | ||
779 | if (null != handler) | ||
780 | { | ||
781 | handler(this, args); | ||
782 | } | ||
783 | } | ||
784 | |||
785 | /// <summary> | ||
786 | /// Called by the engine, raises the <see cref="CacheVerifyBegin"/> event. | ||
787 | /// </summary> | ||
788 | /// <param name="args"></param> | ||
789 | protected virtual void OnCacheVerifyBegin(CacheVerifyBeginEventArgs args) | ||
790 | { | ||
791 | EventHandler<CacheVerifyBeginEventArgs> handler = this.CacheVerifyBegin; | ||
792 | if (null != handler) | ||
793 | { | ||
794 | handler(this, args); | ||
795 | } | ||
796 | } | ||
797 | |||
798 | /// <summary> | ||
799 | /// Called by the engine, raises the <see cref="CacheVerifyProgress"/> event. | ||
800 | /// </summary> | ||
801 | /// <param name="args"></param> | ||
802 | protected virtual void OnCacheVerifyProgress(CacheVerifyProgressEventArgs args) | ||
803 | { | ||
804 | EventHandler<CacheVerifyProgressEventArgs> handler = this.CacheVerifyProgress; | ||
805 | if (null != handler) | ||
806 | { | ||
807 | handler(this, args); | ||
808 | } | ||
809 | } | ||
810 | |||
811 | /// <summary> | ||
812 | /// Called by the engine, raises the <see cref="CacheVerifyComplete"/> event. | ||
813 | /// </summary> | ||
814 | /// <param name="args"></param> | ||
815 | protected virtual void OnCacheVerifyComplete(CacheVerifyCompleteEventArgs args) | ||
816 | { | ||
817 | EventHandler<CacheVerifyCompleteEventArgs> handler = this.CacheVerifyComplete; | ||
818 | if (null != handler) | ||
819 | { | ||
820 | handler(this, args); | ||
821 | } | ||
822 | } | ||
823 | |||
824 | /// <summary> | ||
825 | /// Called by the engine, raises the <see cref="CachePackageComplete"/> event. | ||
826 | /// </summary> | ||
827 | /// <param name="args"></param> | ||
828 | protected virtual void OnCachePackageComplete(CachePackageCompleteEventArgs args) | ||
829 | { | ||
830 | EventHandler<CachePackageCompleteEventArgs> handler = this.CachePackageComplete; | ||
831 | if (null != handler) | ||
832 | { | ||
833 | handler(this, args); | ||
834 | } | ||
835 | } | ||
836 | |||
837 | /// <summary> | ||
838 | /// Called by the engine, raises the <see cref="CacheComplete"/> event. | ||
839 | /// </summary> | ||
840 | /// <param name="args">Additional arguments for this event.</param> | ||
841 | protected virtual void OnCacheComplete(CacheCompleteEventArgs args) | ||
842 | { | ||
843 | EventHandler<CacheCompleteEventArgs> handler = this.CacheComplete; | ||
844 | if (null != handler) | ||
845 | { | ||
846 | handler(this, args); | ||
847 | } | ||
848 | } | ||
849 | |||
850 | /// <summary> | ||
851 | /// Called by the engine, raises the <see cref="ExecuteBegin"/> event. | ||
852 | /// </summary> | ||
853 | /// <param name="args">Additional arguments for this event.</param> | ||
854 | protected virtual void OnExecuteBegin(ExecuteBeginEventArgs args) | ||
855 | { | ||
856 | EventHandler<ExecuteBeginEventArgs> handler = this.ExecuteBegin; | ||
857 | if (null != handler) | ||
858 | { | ||
859 | handler(this, args); | ||
860 | } | ||
861 | } | ||
862 | |||
863 | /// <summary> | ||
864 | /// Called by the engine, raises the <see cref="ExecutePackageBegin"/> event. | ||
865 | /// </summary> | ||
866 | /// <param name="args">Additional arguments for this event.</param> | ||
867 | protected virtual void OnExecutePackageBegin(ExecutePackageBeginEventArgs args) | ||
868 | { | ||
869 | EventHandler<ExecutePackageBeginEventArgs> handler = this.ExecutePackageBegin; | ||
870 | if (null != handler) | ||
871 | { | ||
872 | handler(this, args); | ||
873 | } | ||
874 | } | ||
875 | |||
876 | /// <summary> | ||
877 | /// Called by the engine, raises the <see cref="ExecutePatchTarget"/> event. | ||
878 | /// </summary> | ||
879 | /// <param name="args">Additional arguments for this event.</param> | ||
880 | protected virtual void OnExecutePatchTarget(ExecutePatchTargetEventArgs args) | ||
881 | { | ||
882 | EventHandler<ExecutePatchTargetEventArgs> handler = this.ExecutePatchTarget; | ||
883 | if (null != handler) | ||
884 | { | ||
885 | handler(this, args); | ||
886 | } | ||
887 | } | ||
888 | |||
889 | /// <summary> | ||
890 | /// Called by the engine, raises the <see cref="ExecuteMsiMessage"/> event. | ||
891 | /// </summary> | ||
892 | /// <param name="args">Additional arguments for this event.</param> | ||
893 | protected virtual void OnExecuteMsiMessage(ExecuteMsiMessageEventArgs args) | ||
894 | { | ||
895 | EventHandler<ExecuteMsiMessageEventArgs> handler = this.ExecuteMsiMessage; | ||
896 | if (null != handler) | ||
897 | { | ||
898 | handler(this, args); | ||
899 | } | ||
900 | } | ||
901 | |||
902 | /// <summary> | ||
903 | /// Called by the engine, raises the <see cref="ExecuteFilesInUse"/> event. | ||
904 | /// </summary> | ||
905 | /// <param name="args">Additional arguments for this event.</param> | ||
906 | protected virtual void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args) | ||
907 | { | ||
908 | EventHandler<ExecuteFilesInUseEventArgs> handler = this.ExecuteFilesInUse; | ||
909 | if (null != handler) | ||
910 | { | ||
911 | handler(this, args); | ||
912 | } | ||
913 | } | ||
914 | |||
915 | /// <summary> | ||
916 | /// Called by the engine, raises the <see cref="ExecutePackageComplete"/> event. | ||
917 | /// </summary> | ||
918 | /// <param name="args">Additional arguments for this event.</param> | ||
919 | protected virtual void OnExecutePackageComplete(ExecutePackageCompleteEventArgs args) | ||
920 | { | ||
921 | EventHandler<ExecutePackageCompleteEventArgs> handler = this.ExecutePackageComplete; | ||
922 | if (null != handler) | ||
923 | { | ||
924 | handler(this, args); | ||
925 | } | ||
926 | } | ||
927 | |||
928 | /// <summary> | ||
929 | /// Called by the engine, raises the <see cref="ExecuteComplete"/> event. | ||
930 | /// </summary> | ||
931 | /// <param name="args">Additional arguments for this event.</param> | ||
932 | protected virtual void OnExecuteComplete(ExecuteCompleteEventArgs args) | ||
933 | { | ||
934 | EventHandler<ExecuteCompleteEventArgs> handler = this.ExecuteComplete; | ||
935 | if (null != handler) | ||
936 | { | ||
937 | handler(this, args); | ||
938 | } | ||
939 | } | ||
940 | |||
941 | /// <summary> | ||
942 | /// Called by the engine, raises the <see cref="ApplyComplete"/> event. | ||
943 | /// </summary> | ||
944 | /// <param name="args">Additional arguments for this event.</param> | ||
945 | protected virtual void OnApplyComplete(ApplyCompleteEventArgs args) | ||
946 | { | ||
947 | EventHandler<ApplyCompleteEventArgs> handler = this.ApplyComplete; | ||
948 | if (null != handler) | ||
949 | { | ||
950 | handler(this, args); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | /// <summary> | ||
955 | /// Called by the engine, raises the <see cref="ExecuteProgress"/> event. | ||
956 | /// </summary> | ||
957 | /// <param name="args">Additional arguments for this event.</param> | ||
958 | protected virtual void OnExecuteProgress(ExecuteProgressEventArgs args) | ||
959 | { | ||
960 | EventHandler<ExecuteProgressEventArgs> handler = this.ExecuteProgress; | ||
961 | if (null != handler) | ||
962 | { | ||
963 | handler(this, args); | ||
964 | } | ||
965 | } | ||
966 | |||
967 | /// <summary> | ||
968 | /// Called by the engine, raises the <see cref="LaunchApprovedExeBegin"/> event. | ||
969 | /// </summary> | ||
970 | /// <param name="args">Additional arguments for this event.</param> | ||
971 | protected virtual void OnLaunchApprovedExeBegin(LaunchApprovedExeBeginEventArgs args) | ||
972 | { | ||
973 | EventHandler<LaunchApprovedExeBeginEventArgs> handler = this.LaunchApprovedExeBegin; | ||
974 | if (null != handler) | ||
975 | { | ||
976 | handler(this, args); | ||
977 | } | ||
978 | } | ||
979 | |||
980 | /// <summary> | ||
981 | /// Called by the engine, raises the <see cref="LaunchApprovedExeComplete"/> event. | ||
982 | /// </summary> | ||
983 | /// <param name="args">Additional arguments for this event.</param> | ||
984 | protected virtual void OnLaunchApprovedExeComplete(LaunchApprovedExeCompleteEventArgs args) | ||
985 | { | ||
986 | EventHandler<LaunchApprovedExeCompleteEventArgs> handler = this.LaunchApprovedExeComplete; | ||
987 | if (null != handler) | ||
988 | { | ||
989 | handler(this, args); | ||
990 | } | ||
991 | } | ||
992 | |||
993 | /// <summary> | ||
994 | /// Called by the engine, raises the <see cref="BeginMsiTransactionBegin"/> event. | ||
995 | /// </summary> | ||
996 | /// <param name="args">Additional arguments for this event.</param> | ||
997 | protected virtual void OnBeginMsiTransactionBegin(BeginMsiTransactionBeginEventArgs args) | ||
998 | { | ||
999 | EventHandler<BeginMsiTransactionBeginEventArgs> handler = this.BeginMsiTransactionBegin; | ||
1000 | if (null != handler) | ||
1001 | { | ||
1002 | handler(this, args); | ||
1003 | } | ||
1004 | } | ||
1005 | |||
1006 | /// <summary> | ||
1007 | /// Called by the engine, raises the <see cref="BeginMsiTransactionComplete"/> event. | ||
1008 | /// </summary> | ||
1009 | /// <param name="args">Additional arguments for this event.</param> | ||
1010 | protected virtual void OnBeginMsiTransactionComplete(BeginMsiTransactionCompleteEventArgs args) | ||
1011 | { | ||
1012 | EventHandler<BeginMsiTransactionCompleteEventArgs> handler = this.BeginMsiTransactionComplete; | ||
1013 | if (null != handler) | ||
1014 | { | ||
1015 | handler(this, args); | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | /// <summary> | ||
1020 | /// Called by the engine, raises the <see cref="CommitMsiTransactionBegin"/> event. | ||
1021 | /// </summary> | ||
1022 | /// <param name="args">Additional arguments for this event.</param> | ||
1023 | protected virtual void OnCommitMsiTransactionBegin(CommitMsiTransactionBeginEventArgs args) | ||
1024 | { | ||
1025 | EventHandler<CommitMsiTransactionBeginEventArgs> handler = this.CommitMsiTransactionBegin; | ||
1026 | if (null != handler) | ||
1027 | { | ||
1028 | handler(this, args); | ||
1029 | } | ||
1030 | } | ||
1031 | |||
1032 | /// <summary> | ||
1033 | /// Called by the engine, raises the <see cref="CommitMsiTransactionComplete"/> event. | ||
1034 | /// </summary> | ||
1035 | /// <param name="args">Additional arguments for this event.</param> | ||
1036 | protected virtual void OnCommitMsiTransactionComplete(CommitMsiTransactionCompleteEventArgs args) | ||
1037 | { | ||
1038 | EventHandler<CommitMsiTransactionCompleteEventArgs> handler = this.CommitMsiTransactionComplete; | ||
1039 | if (null != handler) | ||
1040 | { | ||
1041 | handler(this, args); | ||
1042 | } | ||
1043 | } | ||
1044 | |||
1045 | /// <summary> | ||
1046 | /// Called by the engine, raises the <see cref="RollbackMsiTransactionBegin"/> event. | ||
1047 | /// </summary> | ||
1048 | /// <param name="args">Additional arguments for this event.</param> | ||
1049 | protected virtual void OnRollbackMsiTransactionBegin(RollbackMsiTransactionBeginEventArgs args) | ||
1050 | { | ||
1051 | EventHandler<RollbackMsiTransactionBeginEventArgs> handler = this.RollbackMsiTransactionBegin; | ||
1052 | if (null != handler) | ||
1053 | { | ||
1054 | handler(this, args); | ||
1055 | } | ||
1056 | } | ||
1057 | |||
1058 | /// <summary> | ||
1059 | /// Called by the engine, raises the <see cref="RollbackMsiTransactionComplete"/> event. | ||
1060 | /// </summary> | ||
1061 | /// <param name="args">Additional arguments for this event.</param> | ||
1062 | protected virtual void OnRollbackMsiTransactionComplete(RollbackMsiTransactionCompleteEventArgs args) | ||
1063 | { | ||
1064 | EventHandler<RollbackMsiTransactionCompleteEventArgs> handler = this.RollbackMsiTransactionComplete; | ||
1065 | if (null != handler) | ||
1066 | { | ||
1067 | handler(this, args); | ||
1068 | } | ||
1069 | } | ||
1070 | |||
1071 | /// <summary> | ||
1072 | /// Called by the engine, raises the <see cref="PauseAutomaticUpdatesBegin"/> event. | ||
1073 | /// </summary> | ||
1074 | /// <param name="args">Additional arguments for this event.</param> | ||
1075 | protected virtual void OnPauseAutomaticUpdatesBegin(PauseAutomaticUpdatesBeginEventArgs args) | ||
1076 | { | ||
1077 | EventHandler<PauseAutomaticUpdatesBeginEventArgs> handler = this.PauseAutomaticUpdatesBegin; | ||
1078 | if (null != handler) | ||
1079 | { | ||
1080 | handler(this, args); | ||
1081 | } | ||
1082 | } | ||
1083 | |||
1084 | /// <summary> | ||
1085 | /// Called by the engine, raises the <see cref="PauseAutomaticUpdatesComplete"/> event. | ||
1086 | /// </summary> | ||
1087 | /// <param name="args">Additional arguments for this event.</param> | ||
1088 | protected virtual void OnPauseAutomaticUpdatesComplete(PauseAutomaticUpdatesCompleteEventArgs args) | ||
1089 | { | ||
1090 | EventHandler<PauseAutomaticUpdatesCompleteEventArgs> handler = this.PauseAutomaticUpdatesComplete; | ||
1091 | if (null != handler) | ||
1092 | { | ||
1093 | handler(this, args); | ||
1094 | } | ||
1095 | } | ||
1096 | |||
1097 | /// <summary> | ||
1098 | /// Called by the engine, raises the <see cref="SystemRestorePointBegin"/> event. | ||
1099 | /// </summary> | ||
1100 | /// <param name="args">Additional arguments for this event.</param> | ||
1101 | protected virtual void OnSystemRestorePointBegin(SystemRestorePointBeginEventArgs args) | ||
1102 | { | ||
1103 | EventHandler<SystemRestorePointBeginEventArgs> handler = this.SystemRestorePointBegin; | ||
1104 | if (null != handler) | ||
1105 | { | ||
1106 | handler(this, args); | ||
1107 | } | ||
1108 | } | ||
1109 | |||
1110 | /// <summary> | ||
1111 | /// Called by the engine, raises the <see cref="SystemRestorePointComplete"/> event. | ||
1112 | /// </summary> | ||
1113 | /// <param name="args">Additional arguments for this event.</param> | ||
1114 | protected virtual void OnSystemRestorePointComplete(SystemRestorePointCompleteEventArgs args) | ||
1115 | { | ||
1116 | EventHandler<SystemRestorePointCompleteEventArgs> handler = this.SystemRestorePointComplete; | ||
1117 | if (null != handler) | ||
1118 | { | ||
1119 | handler(this, args); | ||
1120 | } | ||
1121 | } | ||
1122 | |||
1123 | /// <summary> | ||
1124 | /// Called by the engine, raises the <see cref="PlanForwardCompatibleBundle"/> event. | ||
1125 | /// </summary> | ||
1126 | protected virtual void OnPlanForwardCompatibleBundle(PlanForwardCompatibleBundleEventArgs args) | ||
1127 | { | ||
1128 | EventHandler<PlanForwardCompatibleBundleEventArgs> handler = this.PlanForwardCompatibleBundle; | ||
1129 | if (null != handler) | ||
1130 | { | ||
1131 | handler(this, args); | ||
1132 | } | ||
1133 | } | ||
1134 | |||
1135 | /// <summary> | ||
1136 | /// Called by the engine, raises the <see cref="CacheContainerOrPayloadVerifyBegin"/> event. | ||
1137 | /// </summary> | ||
1138 | /// <param name="args"></param> | ||
1139 | protected virtual void OnCacheContainerOrPayloadVerifyBegin(CacheContainerOrPayloadVerifyBeginEventArgs args) | ||
1140 | { | ||
1141 | EventHandler<CacheContainerOrPayloadVerifyBeginEventArgs> handler = this.CacheContainerOrPayloadVerifyBegin; | ||
1142 | if (null != handler) | ||
1143 | { | ||
1144 | handler(this, args); | ||
1145 | } | ||
1146 | } | ||
1147 | |||
1148 | /// <summary> | ||
1149 | /// Called by the engine, raises the <see cref="CacheContainerOrPayloadVerifyProgress"/> event. | ||
1150 | /// </summary> | ||
1151 | /// <param name="args"></param> | ||
1152 | protected virtual void OnCacheContainerOrPayloadVerifyProgress(CacheContainerOrPayloadVerifyProgressEventArgs args) | ||
1153 | { | ||
1154 | EventHandler<CacheContainerOrPayloadVerifyProgressEventArgs> handler = this.CacheContainerOrPayloadVerifyProgress; | ||
1155 | if (null != handler) | ||
1156 | { | ||
1157 | handler(this, args); | ||
1158 | } | ||
1159 | } | ||
1160 | |||
1161 | /// <summary> | ||
1162 | /// Called by the engine, raises the <see cref="CacheContainerOrPayloadVerifyComplete"/> event. | ||
1163 | /// </summary> | ||
1164 | /// <param name="args"></param> | ||
1165 | protected virtual void OnCacheContainerOrPayloadVerifyComplete(CacheContainerOrPayloadVerifyCompleteEventArgs args) | ||
1166 | { | ||
1167 | EventHandler<CacheContainerOrPayloadVerifyCompleteEventArgs> handler = this.CacheContainerOrPayloadVerifyComplete; | ||
1168 | if (null != handler) | ||
1169 | { | ||
1170 | handler(this, args); | ||
1171 | } | ||
1172 | } | ||
1173 | |||
1174 | /// <summary> | ||
1175 | /// Called by the engine, raises the <see cref="CachePayloadExtractBegin"/> event. | ||
1176 | /// </summary> | ||
1177 | /// <param name="args"></param> | ||
1178 | protected virtual void OnCachePayloadExtractBegin(CachePayloadExtractBeginEventArgs args) | ||
1179 | { | ||
1180 | EventHandler<CachePayloadExtractBeginEventArgs> handler = this.CachePayloadExtractBegin; | ||
1181 | if (null != handler) | ||
1182 | { | ||
1183 | handler(this, args); | ||
1184 | } | ||
1185 | } | ||
1186 | |||
1187 | /// <summary> | ||
1188 | /// Called by the engine, raises the <see cref="CachePayloadExtractProgress"/> event. | ||
1189 | /// </summary> | ||
1190 | /// <param name="args"></param> | ||
1191 | protected virtual void OnCachePayloadExtractProgress(CachePayloadExtractProgressEventArgs args) | ||
1192 | { | ||
1193 | EventHandler<CachePayloadExtractProgressEventArgs> handler = this.CachePayloadExtractProgress; | ||
1194 | if (null != handler) | ||
1195 | { | ||
1196 | handler(this, args); | ||
1197 | } | ||
1198 | } | ||
1199 | |||
1200 | /// <summary> | ||
1201 | /// Called by the engine, raises the <see cref="CachePayloadExtractComplete"/> event. | ||
1202 | /// </summary> | ||
1203 | /// <param name="args"></param> | ||
1204 | protected virtual void OnCachePayloadExtractComplete(CachePayloadExtractCompleteEventArgs args) | ||
1205 | { | ||
1206 | EventHandler<CachePayloadExtractCompleteEventArgs> handler = this.CachePayloadExtractComplete; | ||
1207 | if (null != handler) | ||
1208 | { | ||
1209 | handler(this, args); | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1213 | #region IBootstrapperApplication Members | ||
1214 | |||
1215 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) | ||
1216 | { | ||
1217 | switch (message) | ||
1218 | { | ||
1219 | default: | ||
1220 | return NativeMethods.E_NOTIMPL; | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext) | ||
1225 | { | ||
1226 | } | ||
1227 | |||
1228 | int IBootstrapperApplication.OnStartup() | ||
1229 | { | ||
1230 | StartupEventArgs args = new StartupEventArgs(); | ||
1231 | this.OnStartup(args); | ||
1232 | |||
1233 | return args.HResult; | ||
1234 | } | ||
1235 | |||
1236 | int IBootstrapperApplication.OnShutdown(ref BOOTSTRAPPER_SHUTDOWN_ACTION action) | ||
1237 | { | ||
1238 | ShutdownEventArgs args = new ShutdownEventArgs(action); | ||
1239 | this.OnShutdown(args); | ||
1240 | |||
1241 | action = args.Action; | ||
1242 | return args.HResult; | ||
1243 | } | ||
1244 | |||
1245 | int IBootstrapperApplication.OnSystemShutdown(EndSessionReasons dwEndSession, ref bool fCancel) | ||
1246 | { | ||
1247 | SystemShutdownEventArgs args = new SystemShutdownEventArgs(dwEndSession, fCancel); | ||
1248 | this.OnSystemShutdown(args); | ||
1249 | |||
1250 | fCancel = args.Cancel; | ||
1251 | return args.HResult; | ||
1252 | } | ||
1253 | |||
1254 | int IBootstrapperApplication.OnDetectBegin(bool fCached, bool fInstalled, int cPackages, ref bool fCancel) | ||
1255 | { | ||
1256 | DetectBeginEventArgs args = new DetectBeginEventArgs(fCached, fInstalled, cPackages, fCancel); | ||
1257 | this.OnDetectBegin(args); | ||
1258 | |||
1259 | fCancel = args.Cancel; | ||
1260 | return args.HResult; | ||
1261 | } | ||
1262 | |||
1263 | int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fMissingFromCache, ref bool fCancel) | ||
1264 | { | ||
1265 | DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, fCancel); | ||
1266 | this.OnDetectForwardCompatibleBundle(args); | ||
1267 | |||
1268 | fCancel = args.Cancel; | ||
1269 | return args.HResult; | ||
1270 | } | ||
1271 | |||
1272 | int IBootstrapperApplication.OnDetectUpdateBegin(string wzUpdateLocation, ref bool fCancel, ref bool fSkip) | ||
1273 | { | ||
1274 | DetectUpdateBeginEventArgs args = new DetectUpdateBeginEventArgs(wzUpdateLocation, fCancel, fSkip); | ||
1275 | this.OnDetectUpdateBegin(args); | ||
1276 | |||
1277 | fCancel = args.Cancel; | ||
1278 | fSkip = args.Skip; | ||
1279 | return args.HResult; | ||
1280 | } | ||
1281 | |||
1282 | int IBootstrapperApplication.OnDetectUpdate(string wzUpdateLocation, long dw64Size, string wzVersion, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates) | ||
1283 | { | ||
1284 | DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, wzVersion, wzTitle, wzSummary, wzContentType, wzContent, fCancel, fStopProcessingUpdates); | ||
1285 | this.OnDetectUpdate(args); | ||
1286 | |||
1287 | fCancel = args.Cancel; | ||
1288 | fStopProcessingUpdates = args.StopProcessingUpdates; | ||
1289 | return args.HResult; | ||
1290 | } | ||
1291 | |||
1292 | int IBootstrapperApplication.OnDetectUpdateComplete(int hrStatus, ref bool fIgnoreError) | ||
1293 | { | ||
1294 | DetectUpdateCompleteEventArgs args = new DetectUpdateCompleteEventArgs(hrStatus, fIgnoreError); | ||
1295 | this.OnDetectUpdateComplete(args); | ||
1296 | |||
1297 | fIgnoreError = args.IgnoreError; | ||
1298 | return args.HResult; | ||
1299 | } | ||
1300 | |||
1301 | int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, RelatedOperation operation, bool fMissingFromCache, ref bool fCancel) | ||
1302 | { | ||
1303 | DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, wzVersion, operation, fMissingFromCache, fCancel); | ||
1304 | this.OnDetectRelatedBundle(args); | ||
1305 | |||
1306 | fCancel = args.Cancel; | ||
1307 | return args.HResult; | ||
1308 | } | ||
1309 | |||
1310 | int IBootstrapperApplication.OnDetectPackageBegin(string wzPackageId, ref bool fCancel) | ||
1311 | { | ||
1312 | DetectPackageBeginEventArgs args = new DetectPackageBeginEventArgs(wzPackageId, fCancel); | ||
1313 | this.OnDetectPackageBegin(args); | ||
1314 | |||
1315 | fCancel = args.Cancel; | ||
1316 | return args.HResult; | ||
1317 | } | ||
1318 | |||
1319 | int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, string wzVersion, RelatedOperation operation, ref bool fCancel) | ||
1320 | { | ||
1321 | DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, wzVersion, operation, fCancel); | ||
1322 | this.OnDetectRelatedMsiPackage(args); | ||
1323 | |||
1324 | fCancel = args.Cancel; | ||
1325 | return args.HResult; | ||
1326 | } | ||
1327 | |||
1328 | int IBootstrapperApplication.OnDetectPatchTarget(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel) | ||
1329 | { | ||
1330 | DetectPatchTargetEventArgs args = new DetectPatchTargetEventArgs(wzPackageId, wzProductCode, patchState, fCancel); | ||
1331 | this.OnDetectPatchTarget(args); | ||
1332 | |||
1333 | fCancel = args.Cancel; | ||
1334 | return args.HResult; | ||
1335 | } | ||
1336 | |||
1337 | int IBootstrapperApplication.OnDetectMsiFeature(string wzPackageId, string wzFeatureId, FeatureState state, ref bool fCancel) | ||
1338 | { | ||
1339 | DetectMsiFeatureEventArgs args = new DetectMsiFeatureEventArgs(wzPackageId, wzFeatureId, state, fCancel); | ||
1340 | this.OnDetectMsiFeature(args); | ||
1341 | |||
1342 | fCancel = args.Cancel; | ||
1343 | return args.HResult; | ||
1344 | } | ||
1345 | |||
1346 | int IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state, bool fCached) | ||
1347 | { | ||
1348 | DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state, fCached); | ||
1349 | this.OnDetectPackageComplete(args); | ||
1350 | |||
1351 | return args.HResult; | ||
1352 | } | ||
1353 | |||
1354 | int IBootstrapperApplication.OnDetectComplete(int hrStatus, bool fEligibleForCleanup) | ||
1355 | { | ||
1356 | DetectCompleteEventArgs args = new DetectCompleteEventArgs(hrStatus, fEligibleForCleanup); | ||
1357 | this.OnDetectComplete(args); | ||
1358 | |||
1359 | return args.HResult; | ||
1360 | } | ||
1361 | |||
1362 | int IBootstrapperApplication.OnPlanBegin(int cPackages, ref bool fCancel) | ||
1363 | { | ||
1364 | PlanBeginEventArgs args = new PlanBeginEventArgs(cPackages, fCancel); | ||
1365 | this.OnPlanBegin(args); | ||
1366 | |||
1367 | fCancel = args.Cancel; | ||
1368 | return args.HResult; | ||
1369 | } | ||
1370 | |||
1371 | int IBootstrapperApplication.OnPlanRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) | ||
1372 | { | ||
1373 | PlanRelatedBundleEventArgs args = new PlanRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel); | ||
1374 | this.OnPlanRelatedBundle(args); | ||
1375 | |||
1376 | pRequestedState = args.State; | ||
1377 | fCancel = args.Cancel; | ||
1378 | return args.HResult; | ||
1379 | } | ||
1380 | |||
1381 | int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fCached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, ref RequestState pRequestedState, ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, ref bool fCancel) | ||
1382 | { | ||
1383 | PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fCached, installCondition, recommendedState, recommendedCacheType, pRequestedState, pRequestedCacheType, fCancel); | ||
1384 | this.OnPlanPackageBegin(args); | ||
1385 | |||
1386 | pRequestedState = args.State; | ||
1387 | fCancel = args.Cancel; | ||
1388 | return args.HResult; | ||
1389 | } | ||
1390 | |||
1391 | int IBootstrapperApplication.OnPlanPatchTarget(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) | ||
1392 | { | ||
1393 | PlanPatchTargetEventArgs args = new PlanPatchTargetEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel); | ||
1394 | this.OnPlanPatchTarget(args); | ||
1395 | |||
1396 | pRequestedState = args.State; | ||
1397 | fCancel = args.Cancel; | ||
1398 | return args.HResult; | ||
1399 | } | ||
1400 | |||
1401 | int IBootstrapperApplication.OnPlanMsiFeature(string wzPackageId, string wzFeatureId, FeatureState recommendedState, ref FeatureState pRequestedState, ref bool fCancel) | ||
1402 | { | ||
1403 | PlanMsiFeatureEventArgs args = new PlanMsiFeatureEventArgs(wzPackageId, wzFeatureId, recommendedState, pRequestedState, fCancel); | ||
1404 | this.OnPlanMsiFeature(args); | ||
1405 | |||
1406 | pRequestedState = args.State; | ||
1407 | fCancel = args.Cancel; | ||
1408 | return args.HResult; | ||
1409 | } | ||
1410 | |||
1411 | int IBootstrapperApplication.OnPlanMsiPackage(string wzPackageId, bool fExecute, ActionState action, ref bool fCancel, ref BURN_MSI_PROPERTY actionMsiProperty, ref INSTALLUILEVEL uiLevel, ref bool fDisableExternalUiHandler) | ||
1412 | { | ||
1413 | PlanMsiPackageEventArgs args = new PlanMsiPackageEventArgs(wzPackageId, fExecute, action, fCancel, actionMsiProperty, uiLevel, fDisableExternalUiHandler); | ||
1414 | this.OnPlanMsiPackage(args); | ||
1415 | |||
1416 | fCancel = args.Cancel; | ||
1417 | actionMsiProperty = args.ActionMsiProperty; | ||
1418 | uiLevel = args.UiLevel; | ||
1419 | fDisableExternalUiHandler = args.DisableExternalUiHandler; | ||
1420 | return args.HResult; | ||
1421 | } | ||
1422 | |||
1423 | int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, RequestState requested) | ||
1424 | { | ||
1425 | var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, requested); | ||
1426 | this.OnPlanPackageComplete(args); | ||
1427 | |||
1428 | return args.HResult; | ||
1429 | } | ||
1430 | |||
1431 | int IBootstrapperApplication.OnPlannedPackage(string wzPackageId, ActionState execute, ActionState rollback, bool fPlannedCache, bool fPlannedUncache) | ||
1432 | { | ||
1433 | var args = new PlannedPackageEventArgs(wzPackageId, execute, rollback, fPlannedCache, fPlannedUncache); | ||
1434 | this.OnPlannedPackage(args); | ||
1435 | |||
1436 | return args.HResult; | ||
1437 | } | ||
1438 | |||
1439 | int IBootstrapperApplication.OnPlanComplete(int hrStatus) | ||
1440 | { | ||
1441 | PlanCompleteEventArgs args = new PlanCompleteEventArgs(hrStatus); | ||
1442 | this.OnPlanComplete(args); | ||
1443 | |||
1444 | return args.HResult; | ||
1445 | } | ||
1446 | |||
1447 | int IBootstrapperApplication.OnApplyBegin(int dwPhaseCount, ref bool fCancel) | ||
1448 | { | ||
1449 | this.applying = true; | ||
1450 | |||
1451 | ApplyBeginEventArgs args = new ApplyBeginEventArgs(dwPhaseCount, fCancel); | ||
1452 | this.OnApplyBegin(args); | ||
1453 | |||
1454 | fCancel = args.Cancel; | ||
1455 | return args.HResult; | ||
1456 | } | ||
1457 | |||
1458 | int IBootstrapperApplication.OnElevateBegin(ref bool fCancel) | ||
1459 | { | ||
1460 | ElevateBeginEventArgs args = new ElevateBeginEventArgs(fCancel); | ||
1461 | this.OnElevateBegin(args); | ||
1462 | |||
1463 | fCancel = args.Cancel; | ||
1464 | return args.HResult; | ||
1465 | } | ||
1466 | |||
1467 | int IBootstrapperApplication.OnElevateComplete(int hrStatus) | ||
1468 | { | ||
1469 | ElevateCompleteEventArgs args = new ElevateCompleteEventArgs(hrStatus); | ||
1470 | this.OnElevateComplete(args); | ||
1471 | |||
1472 | return args.HResult; | ||
1473 | } | ||
1474 | |||
1475 | int IBootstrapperApplication.OnProgress(int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel) | ||
1476 | { | ||
1477 | ProgressEventArgs args = new ProgressEventArgs(dwProgressPercentage, dwOverallPercentage, fCancel); | ||
1478 | this.OnProgress(args); | ||
1479 | |||
1480 | fCancel = args.Cancel; | ||
1481 | return args.HResult; | ||
1482 | } | ||
1483 | |||
1484 | int IBootstrapperApplication.OnError(ErrorType errorType, string wzPackageId, int dwCode, string wzError, int dwUIHint, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult) | ||
1485 | { | ||
1486 | ErrorEventArgs args = new ErrorEventArgs(errorType, wzPackageId, dwCode, wzError, dwUIHint, rgwzData, nRecommendation, pResult); | ||
1487 | this.OnError(args); | ||
1488 | |||
1489 | pResult = args.Result; | ||
1490 | return args.HResult; | ||
1491 | } | ||
1492 | |||
1493 | int IBootstrapperApplication.OnRegisterBegin(ref bool fCancel) | ||
1494 | { | ||
1495 | RegisterBeginEventArgs args = new RegisterBeginEventArgs(fCancel); | ||
1496 | this.OnRegisterBegin(args); | ||
1497 | |||
1498 | fCancel = args.Cancel; | ||
1499 | return args.HResult; | ||
1500 | } | ||
1501 | |||
1502 | int IBootstrapperApplication.OnRegisterComplete(int hrStatus) | ||
1503 | { | ||
1504 | RegisterCompleteEventArgs args = new RegisterCompleteEventArgs(hrStatus); | ||
1505 | this.OnRegisterComplete(args); | ||
1506 | |||
1507 | return args.HResult; | ||
1508 | } | ||
1509 | |||
1510 | int IBootstrapperApplication.OnCacheBegin(ref bool fCancel) | ||
1511 | { | ||
1512 | CacheBeginEventArgs args = new CacheBeginEventArgs(fCancel); | ||
1513 | this.OnCacheBegin(args); | ||
1514 | |||
1515 | fCancel = args.Cancel; | ||
1516 | return args.HResult; | ||
1517 | } | ||
1518 | |||
1519 | int IBootstrapperApplication.OnCachePackageBegin(string wzPackageId, int cCachePayloads, long dw64PackageCacheSize, ref bool fCancel) | ||
1520 | { | ||
1521 | CachePackageBeginEventArgs args = new CachePackageBeginEventArgs(wzPackageId, cCachePayloads, dw64PackageCacheSize, fCancel); | ||
1522 | this.OnCachePackageBegin(args); | ||
1523 | |||
1524 | fCancel = args.Cancel; | ||
1525 | return args.HResult; | ||
1526 | } | ||
1527 | |||
1528 | int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, string wzSource, string wzDownloadUrl, string wzPayloadContainerId, CacheOperation recommendation, ref CacheOperation action, ref bool fCancel) | ||
1529 | { | ||
1530 | CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, wzSource, wzDownloadUrl, wzPayloadContainerId, recommendation, action, fCancel); | ||
1531 | this.OnCacheAcquireBegin(args); | ||
1532 | |||
1533 | action = args.Action; | ||
1534 | fCancel = args.Cancel; | ||
1535 | return args.HResult; | ||
1536 | } | ||
1537 | |||
1538 | int IBootstrapperApplication.OnCacheAcquireProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel) | ||
1539 | { | ||
1540 | CacheAcquireProgressEventArgs args = new CacheAcquireProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel); | ||
1541 | this.OnCacheAcquireProgress(args); | ||
1542 | |||
1543 | fCancel = args.Cancel; | ||
1544 | return args.HResult; | ||
1545 | } | ||
1546 | |||
1547 | int IBootstrapperApplication.OnCacheAcquireResolving(string wzPackageOrContainerId, string wzPayloadId, string[] searchPaths, int cSearchPaths, bool fFoundLocal, int dwRecommendedSearchPath, string wzDownloadUrl, string wzPayloadContainerId, CacheResolveOperation recommendation, ref int dwChosenSearchPath, ref CacheResolveOperation action, ref bool fCancel) | ||
1548 | { | ||
1549 | CacheAcquireResolvingEventArgs args = new CacheAcquireResolvingEventArgs(wzPackageOrContainerId, wzPayloadId, searchPaths, fFoundLocal, dwRecommendedSearchPath, wzDownloadUrl, wzPayloadContainerId, recommendation, dwChosenSearchPath, action, fCancel); | ||
1550 | this.OnCacheAcquireResolving(args); | ||
1551 | |||
1552 | dwChosenSearchPath = args.ChosenSearchPath; | ||
1553 | action = args.Action; | ||
1554 | fCancel = args.Cancel; | ||
1555 | return args.HResult; | ||
1556 | } | ||
1557 | |||
1558 | int IBootstrapperApplication.OnCacheAcquireComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action) | ||
1559 | { | ||
1560 | CacheAcquireCompleteEventArgs args = new CacheAcquireCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, action); | ||
1561 | this.OnCacheAcquireComplete(args); | ||
1562 | |||
1563 | action = args.Action; | ||
1564 | return args.HResult; | ||
1565 | } | ||
1566 | |||
1567 | int IBootstrapperApplication.OnCacheVerifyBegin(string wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) | ||
1568 | { | ||
1569 | CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); | ||
1570 | this.OnCacheVerifyBegin(args); | ||
1571 | |||
1572 | fCancel = args.Cancel; | ||
1573 | return args.HResult; | ||
1574 | } | ||
1575 | |||
1576 | int IBootstrapperApplication.OnCacheVerifyProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, CacheVerifyStep verifyStep, ref bool fCancel) | ||
1577 | { | ||
1578 | CacheVerifyProgressEventArgs args = new CacheVerifyProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, verifyStep, fCancel); | ||
1579 | this.OnCacheVerifyProgress(args); | ||
1580 | |||
1581 | fCancel = args.Cancel; | ||
1582 | return args.HResult; | ||
1583 | } | ||
1584 | |||
1585 | int IBootstrapperApplication.OnCacheVerifyComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) | ||
1586 | { | ||
1587 | CacheVerifyCompleteEventArgs args = new CacheVerifyCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, action); | ||
1588 | this.OnCacheVerifyComplete(args); | ||
1589 | |||
1590 | action = args.Action; | ||
1591 | return args.HResult; | ||
1592 | } | ||
1593 | |||
1594 | int IBootstrapperApplication.OnCachePackageComplete(string wzPackageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action) | ||
1595 | { | ||
1596 | CachePackageCompleteEventArgs args = new CachePackageCompleteEventArgs(wzPackageId, hrStatus, recommendation, action); | ||
1597 | this.OnCachePackageComplete(args); | ||
1598 | |||
1599 | action = args.Action; | ||
1600 | return args.HResult; | ||
1601 | } | ||
1602 | |||
1603 | int IBootstrapperApplication.OnCacheComplete(int hrStatus) | ||
1604 | { | ||
1605 | CacheCompleteEventArgs args = new CacheCompleteEventArgs(hrStatus); | ||
1606 | this.OnCacheComplete(args); | ||
1607 | |||
1608 | return args.HResult; | ||
1609 | } | ||
1610 | |||
1611 | int IBootstrapperApplication.OnExecuteBegin(int cExecutingPackages, ref bool fCancel) | ||
1612 | { | ||
1613 | ExecuteBeginEventArgs args = new ExecuteBeginEventArgs(cExecutingPackages, fCancel); | ||
1614 | this.OnExecuteBegin(args); | ||
1615 | |||
1616 | args.Cancel = fCancel; | ||
1617 | return args.HResult; | ||
1618 | } | ||
1619 | |||
1620 | int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ActionState action, INSTALLUILEVEL uiLevel, bool fDisableExternalUiHandler, ref bool fCancel) | ||
1621 | { | ||
1622 | ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, action, uiLevel, fDisableExternalUiHandler, fCancel); | ||
1623 | this.OnExecutePackageBegin(args); | ||
1624 | |||
1625 | fCancel = args.Cancel; | ||
1626 | return args.HResult; | ||
1627 | } | ||
1628 | |||
1629 | int IBootstrapperApplication.OnExecutePatchTarget(string wzPackageId, string wzTargetProductCode, ref bool fCancel) | ||
1630 | { | ||
1631 | ExecutePatchTargetEventArgs args = new ExecutePatchTargetEventArgs(wzPackageId, wzTargetProductCode, fCancel); | ||
1632 | this.OnExecutePatchTarget(args); | ||
1633 | |||
1634 | fCancel = args.Cancel; | ||
1635 | return args.HResult; | ||
1636 | } | ||
1637 | |||
1638 | int IBootstrapperApplication.OnExecuteProgress(string wzPackageId, int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel) | ||
1639 | { | ||
1640 | ExecuteProgressEventArgs args = new ExecuteProgressEventArgs(wzPackageId, dwProgressPercentage, dwOverallPercentage, fCancel); | ||
1641 | this.OnExecuteProgress(args); | ||
1642 | |||
1643 | fCancel = args.Cancel; | ||
1644 | return args.HResult; | ||
1645 | } | ||
1646 | |||
1647 | int IBootstrapperApplication.OnExecuteMsiMessage(string wzPackageId, InstallMessage messageType, int dwUIHint, string wzMessage, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult) | ||
1648 | { | ||
1649 | ExecuteMsiMessageEventArgs args = new ExecuteMsiMessageEventArgs(wzPackageId, messageType, dwUIHint, wzMessage, rgwzData, nRecommendation, pResult); | ||
1650 | this.OnExecuteMsiMessage(args); | ||
1651 | |||
1652 | pResult = args.Result; | ||
1653 | return args.HResult; | ||
1654 | } | ||
1655 | |||
1656 | int IBootstrapperApplication.OnExecuteFilesInUse(string wzPackageId, int cFiles, string[] rgwzFiles, Result nRecommendation, ref Result pResult) | ||
1657 | { | ||
1658 | ExecuteFilesInUseEventArgs args = new ExecuteFilesInUseEventArgs(wzPackageId, rgwzFiles, nRecommendation, pResult); | ||
1659 | this.OnExecuteFilesInUse(args); | ||
1660 | |||
1661 | pResult = args.Result; | ||
1662 | return args.HResult; | ||
1663 | } | ||
1664 | |||
1665 | int IBootstrapperApplication.OnExecutePackageComplete(string wzPackageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION pAction) | ||
1666 | { | ||
1667 | ExecutePackageCompleteEventArgs args = new ExecutePackageCompleteEventArgs(wzPackageId, hrStatus, restart, recommendation, pAction); | ||
1668 | this.OnExecutePackageComplete(args); | ||
1669 | |||
1670 | pAction = args.Action; | ||
1671 | return args.HResult; | ||
1672 | } | ||
1673 | |||
1674 | int IBootstrapperApplication.OnExecuteComplete(int hrStatus) | ||
1675 | { | ||
1676 | ExecuteCompleteEventArgs args = new ExecuteCompleteEventArgs(hrStatus); | ||
1677 | this.OnExecuteComplete(args); | ||
1678 | |||
1679 | return args.HResult; | ||
1680 | } | ||
1681 | |||
1682 | int IBootstrapperApplication.OnUnregisterBegin(bool fKeepRegistration, ref bool fForceKeepRegistration) | ||
1683 | { | ||
1684 | UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(fKeepRegistration, fForceKeepRegistration); | ||
1685 | this.OnUnregisterBegin(args); | ||
1686 | |||
1687 | fForceKeepRegistration = args.ForceKeepRegistration; | ||
1688 | return args.HResult; | ||
1689 | } | ||
1690 | |||
1691 | int IBootstrapperApplication.OnUnregisterComplete(int hrStatus) | ||
1692 | { | ||
1693 | UnregisterCompleteEventArgs args = new UnregisterCompleteEventArgs(hrStatus); | ||
1694 | this.OnUnregisterComplete(args); | ||
1695 | |||
1696 | return args.HResult; | ||
1697 | } | ||
1698 | |||
1699 | int IBootstrapperApplication.OnApplyComplete(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_APPLYCOMPLETE_ACTION pAction) | ||
1700 | { | ||
1701 | ApplyCompleteEventArgs args = new ApplyCompleteEventArgs(hrStatus, restart, recommendation, pAction); | ||
1702 | this.OnApplyComplete(args); | ||
1703 | |||
1704 | this.applying = false; | ||
1705 | |||
1706 | pAction = args.Action; | ||
1707 | return args.HResult; | ||
1708 | } | ||
1709 | |||
1710 | int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel) | ||
1711 | { | ||
1712 | LaunchApprovedExeBeginEventArgs args = new LaunchApprovedExeBeginEventArgs(fCancel); | ||
1713 | this.OnLaunchApprovedExeBegin(args); | ||
1714 | |||
1715 | fCancel = args.Cancel; | ||
1716 | return args.HResult; | ||
1717 | } | ||
1718 | |||
1719 | int IBootstrapperApplication.OnLaunchApprovedExeComplete(int hrStatus, int processId) | ||
1720 | { | ||
1721 | LaunchApprovedExeCompleteEventArgs args = new LaunchApprovedExeCompleteEventArgs(hrStatus, processId); | ||
1722 | this.OnLaunchApprovedExeComplete(args); | ||
1723 | |||
1724 | return args.HResult; | ||
1725 | } | ||
1726 | |||
1727 | int IBootstrapperApplication.OnBeginMsiTransactionBegin(string transactionId, ref bool fCancel) | ||
1728 | { | ||
1729 | BeginMsiTransactionBeginEventArgs args = new BeginMsiTransactionBeginEventArgs(transactionId, fCancel); | ||
1730 | this.OnBeginMsiTransactionBegin(args); | ||
1731 | |||
1732 | fCancel = args.Cancel; | ||
1733 | return args.HResult; | ||
1734 | } | ||
1735 | |||
1736 | int IBootstrapperApplication.OnBeginMsiTransactionComplete(string transactionId, int hrStatus) | ||
1737 | { | ||
1738 | BeginMsiTransactionCompleteEventArgs args = new BeginMsiTransactionCompleteEventArgs(transactionId, hrStatus); | ||
1739 | this.OnBeginMsiTransactionComplete(args); | ||
1740 | |||
1741 | return args.HResult; | ||
1742 | } | ||
1743 | |||
1744 | int IBootstrapperApplication.OnCommitMsiTransactionBegin(string transactionId, ref bool fCancel) | ||
1745 | { | ||
1746 | CommitMsiTransactionBeginEventArgs args = new CommitMsiTransactionBeginEventArgs(transactionId, fCancel); | ||
1747 | this.OnCommitMsiTransactionBegin(args); | ||
1748 | |||
1749 | fCancel = args.Cancel; | ||
1750 | return args.HResult; | ||
1751 | } | ||
1752 | |||
1753 | int IBootstrapperApplication.OnCommitMsiTransactionComplete(string transactionId, int hrStatus) | ||
1754 | { | ||
1755 | CommitMsiTransactionCompleteEventArgs args = new CommitMsiTransactionCompleteEventArgs(transactionId, hrStatus); | ||
1756 | this.OnCommitMsiTransactionComplete(args); | ||
1757 | |||
1758 | return args.HResult; | ||
1759 | } | ||
1760 | |||
1761 | int IBootstrapperApplication.OnRollbackMsiTransactionBegin(string transactionId) | ||
1762 | { | ||
1763 | RollbackMsiTransactionBeginEventArgs args = new RollbackMsiTransactionBeginEventArgs(transactionId); | ||
1764 | this.OnRollbackMsiTransactionBegin(args); | ||
1765 | |||
1766 | return args.HResult; | ||
1767 | } | ||
1768 | |||
1769 | int IBootstrapperApplication.OnRollbackMsiTransactionComplete(string transactionId, int hrStatus) | ||
1770 | { | ||
1771 | RollbackMsiTransactionCompleteEventArgs args = new RollbackMsiTransactionCompleteEventArgs(transactionId, hrStatus); | ||
1772 | this.OnRollbackMsiTransactionComplete(args); | ||
1773 | |||
1774 | return args.HResult; | ||
1775 | } | ||
1776 | |||
1777 | int IBootstrapperApplication.OnPauseAutomaticUpdatesBegin() | ||
1778 | { | ||
1779 | PauseAutomaticUpdatesBeginEventArgs args = new PauseAutomaticUpdatesBeginEventArgs(); | ||
1780 | this.OnPauseAutomaticUpdatesBegin(args); | ||
1781 | |||
1782 | return args.HResult; | ||
1783 | } | ||
1784 | |||
1785 | int IBootstrapperApplication.OnPauseAutomaticUpdatesComplete(int hrStatus) | ||
1786 | { | ||
1787 | PauseAutomaticUpdatesCompleteEventArgs args = new PauseAutomaticUpdatesCompleteEventArgs(hrStatus); | ||
1788 | this.OnPauseAutomaticUpdatesComplete(args); | ||
1789 | |||
1790 | return args.HResult; | ||
1791 | } | ||
1792 | |||
1793 | int IBootstrapperApplication.OnSystemRestorePointBegin() | ||
1794 | { | ||
1795 | SystemRestorePointBeginEventArgs args = new SystemRestorePointBeginEventArgs(); | ||
1796 | this.OnSystemRestorePointBegin(args); | ||
1797 | |||
1798 | return args.HResult; | ||
1799 | } | ||
1800 | |||
1801 | int IBootstrapperApplication.OnSystemRestorePointComplete(int hrStatus) | ||
1802 | { | ||
1803 | SystemRestorePointCompleteEventArgs args = new SystemRestorePointCompleteEventArgs(hrStatus); | ||
1804 | this.OnSystemRestorePointComplete(args); | ||
1805 | |||
1806 | return args.HResult; | ||
1807 | } | ||
1808 | |||
1809 | int IBootstrapperApplication.OnPlanForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fRecommendedIgnoreBundle, ref bool fCancel, ref bool fIgnoreBundle) | ||
1810 | { | ||
1811 | PlanForwardCompatibleBundleEventArgs args = new PlanForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fRecommendedIgnoreBundle, fCancel, fIgnoreBundle); | ||
1812 | this.OnPlanForwardCompatibleBundle(args); | ||
1813 | |||
1814 | fCancel = args.Cancel; | ||
1815 | fIgnoreBundle = args.IgnoreBundle; | ||
1816 | return args.HResult; | ||
1817 | } | ||
1818 | |||
1819 | int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyBegin(string wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) | ||
1820 | { | ||
1821 | CacheContainerOrPayloadVerifyBeginEventArgs args = new CacheContainerOrPayloadVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); | ||
1822 | this.OnCacheContainerOrPayloadVerifyBegin(args); | ||
1823 | |||
1824 | fCancel = args.Cancel; | ||
1825 | return args.HResult; | ||
1826 | } | ||
1827 | |||
1828 | int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel) | ||
1829 | { | ||
1830 | CacheContainerOrPayloadVerifyProgressEventArgs args = new CacheContainerOrPayloadVerifyProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel); | ||
1831 | this.OnCacheContainerOrPayloadVerifyProgress(args); | ||
1832 | |||
1833 | fCancel = args.Cancel; | ||
1834 | return args.HResult; | ||
1835 | } | ||
1836 | |||
1837 | int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus) | ||
1838 | { | ||
1839 | CacheContainerOrPayloadVerifyCompleteEventArgs args = new CacheContainerOrPayloadVerifyCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus); | ||
1840 | this.OnCacheContainerOrPayloadVerifyComplete(args); | ||
1841 | |||
1842 | return args.HResult; | ||
1843 | } | ||
1844 | |||
1845 | int IBootstrapperApplication.OnCachePayloadExtractBegin(string wzContainerId, string wzPayloadId, ref bool fCancel) | ||
1846 | { | ||
1847 | CachePayloadExtractBeginEventArgs args = new CachePayloadExtractBeginEventArgs(wzContainerId, wzPayloadId, fCancel); | ||
1848 | this.OnCachePayloadExtractBegin(args); | ||
1849 | |||
1850 | fCancel = args.Cancel; | ||
1851 | return args.HResult; | ||
1852 | } | ||
1853 | |||
1854 | int IBootstrapperApplication.OnCachePayloadExtractProgress(string wzContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel) | ||
1855 | { | ||
1856 | CachePayloadExtractProgressEventArgs args = new CachePayloadExtractProgressEventArgs(wzContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel); | ||
1857 | this.OnCachePayloadExtractProgress(args); | ||
1858 | |||
1859 | fCancel = args.Cancel; | ||
1860 | return args.HResult; | ||
1861 | } | ||
1862 | |||
1863 | int IBootstrapperApplication.OnCachePayloadExtractComplete(string wzContainerId, string wzPayloadId, int hrStatus) | ||
1864 | { | ||
1865 | CachePayloadExtractCompleteEventArgs args = new CachePayloadExtractCompleteEventArgs(wzContainerId, wzPayloadId, hrStatus); | ||
1866 | this.OnCachePayloadExtractComplete(args); | ||
1867 | |||
1868 | return args.HResult; | ||
1869 | } | ||
1870 | |||
1871 | #endregion | ||
1872 | } | ||
1873 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationData.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationData.cs new file mode 100644 index 00000000..739a08bb --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationData.cs | |||
@@ -0,0 +1,101 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Xml.XPath; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Utility class for reading BootstrapperApplicationData.xml. | ||
11 | /// </summary> | ||
12 | public class BootstrapperApplicationData : IBootstrapperApplicationData | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// | ||
16 | /// </summary> | ||
17 | public const string DefaultFileName = "BootstrapperApplicationData.xml"; | ||
18 | |||
19 | /// <summary> | ||
20 | /// | ||
21 | /// </summary> | ||
22 | public const string XMLNamespace = "http://wixtoolset.org/schemas/v4/BootstrapperApplicationData"; | ||
23 | |||
24 | /// <summary> | ||
25 | /// The default path of where the BA was extracted to. | ||
26 | /// </summary> | ||
27 | public static readonly DirectoryInfo DefaultFolder; | ||
28 | |||
29 | /// <summary> | ||
30 | /// The default path to BootstrapperApplicationData.xml. | ||
31 | /// </summary> | ||
32 | public static readonly FileInfo DefaultFile; | ||
33 | |||
34 | static BootstrapperApplicationData() | ||
35 | { | ||
36 | DefaultFolder = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); | ||
37 | DefaultFile = new FileInfo(Path.Combine(DefaultFolder.FullName, DefaultFileName)); | ||
38 | } | ||
39 | |||
40 | /// <inheritdoc/> | ||
41 | public FileInfo BADataFile { get; private set; } | ||
42 | |||
43 | /// <inheritdoc/> | ||
44 | public IBundleInfo Bundle { get; private set; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Uses the default location for BootstrapperApplicationData.xml. | ||
48 | /// </summary> | ||
49 | public BootstrapperApplicationData() : this(DefaultFile) { } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Uses the given file for BootstrapperApplicationData.xml. | ||
53 | /// </summary> | ||
54 | /// <param name="baDataFile"></param> | ||
55 | public BootstrapperApplicationData(FileInfo baDataFile) | ||
56 | { | ||
57 | this.BADataFile = baDataFile; | ||
58 | |||
59 | using (FileStream fs = this.BADataFile.OpenRead()) | ||
60 | { | ||
61 | this.Bundle = BundleInfo.ParseBundleFromStream(fs); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Utility method for parsing BootstrapperApplicationData.xml. | ||
67 | /// </summary> | ||
68 | /// <param name="node"></param> | ||
69 | /// <param name="attributeName"></param> | ||
70 | /// <returns></returns> | ||
71 | public static string GetAttribute(XPathNavigator node, string attributeName) | ||
72 | { | ||
73 | XPathNavigator attribute = node.SelectSingleNode("@" + attributeName); | ||
74 | |||
75 | if (attribute == null) | ||
76 | { | ||
77 | return null; | ||
78 | } | ||
79 | |||
80 | return attribute.Value; | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Utility method for parsing BootstrapperApplicationData.xml. | ||
85 | /// </summary> | ||
86 | /// <param name="node"></param> | ||
87 | /// <param name="attributeName"></param> | ||
88 | /// <returns></returns> | ||
89 | public static bool? GetYesNoAttribute(XPathNavigator node, string attributeName) | ||
90 | { | ||
91 | string attributeValue = GetAttribute(node, attributeName); | ||
92 | |||
93 | if (attributeValue == null) | ||
94 | { | ||
95 | return null; | ||
96 | } | ||
97 | |||
98 | return attributeValue.Equals("yes", StringComparison.InvariantCulture); | ||
99 | } | ||
100 | } | ||
101 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs new file mode 100644 index 00000000..95252cf3 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Identifies the bootstrapper application factory class. | ||
9 | /// </summary> | ||
10 | /// <remarks> | ||
11 | /// This required assembly attribute identifies the bootstrapper application factory class. | ||
12 | /// </remarks> | ||
13 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] | ||
14 | public sealed class BootstrapperApplicationFactoryAttribute : Attribute | ||
15 | { | ||
16 | private Type bootstrapperApplicationFactoryType; | ||
17 | |||
18 | /// <summary> | ||
19 | /// Creates a new instance of the <see cref="BootstrapperApplicationFactoryAttribute"/> class. | ||
20 | /// </summary> | ||
21 | /// <param name="bootstrapperApplicationFactoryType">The <see cref="Type"/> of the BA factory.</param> | ||
22 | public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType) | ||
23 | { | ||
24 | this.bootstrapperApplicationFactoryType = bootstrapperApplicationFactoryType; | ||
25 | } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Gets the type of the bootstrapper application factory class to create. | ||
29 | /// </summary> | ||
30 | public Type BootstrapperApplicationFactoryType | ||
31 | { | ||
32 | get { return this.bootstrapperApplicationFactoryType; } | ||
33 | } | ||
34 | } | ||
35 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs new file mode 100644 index 00000000..65dde0f4 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs | |||
@@ -0,0 +1,145 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.ComponentModel; | ||
7 | using System.Runtime.InteropServices; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Default implementation of <see cref="IBootstrapperCommand"/>. | ||
11 | /// </summary> | ||
12 | public sealed class BootstrapperCommand : IBootstrapperCommand | ||
13 | { | ||
14 | private readonly string commandLine; | ||
15 | |||
16 | /// <summary> | ||
17 | /// | ||
18 | /// </summary> | ||
19 | /// <param name="action"></param> | ||
20 | /// <param name="display"></param> | ||
21 | /// <param name="restart"></param> | ||
22 | /// <param name="commandLine"></param> | ||
23 | /// <param name="cmdShow"></param> | ||
24 | /// <param name="resume"></param> | ||
25 | /// <param name="splashScreen"></param> | ||
26 | /// <param name="relation"></param> | ||
27 | /// <param name="passthrough"></param> | ||
28 | /// <param name="layoutDirectory"></param> | ||
29 | /// <param name="bootstrapperWorkingFolder"></param> | ||
30 | /// <param name="bootstrapperApplicationDataPath"></param> | ||
31 | public BootstrapperCommand( | ||
32 | LaunchAction action, | ||
33 | Display display, | ||
34 | Restart restart, | ||
35 | string commandLine, | ||
36 | int cmdShow, | ||
37 | ResumeType resume, | ||
38 | IntPtr splashScreen, | ||
39 | RelationType relation, | ||
40 | bool passthrough, | ||
41 | string layoutDirectory, | ||
42 | string bootstrapperWorkingFolder, | ||
43 | string bootstrapperApplicationDataPath) | ||
44 | { | ||
45 | this.Action = action; | ||
46 | this.Display = display; | ||
47 | this.Restart = restart; | ||
48 | this.commandLine = commandLine; | ||
49 | this.CmdShow = cmdShow; | ||
50 | this.Resume = resume; | ||
51 | this.SplashScreen = splashScreen; | ||
52 | this.Relation = relation; | ||
53 | this.Passthrough = passthrough; | ||
54 | this.LayoutDirectory = layoutDirectory; | ||
55 | this.BootstrapperWorkingFolder = bootstrapperWorkingFolder; | ||
56 | this.BootstrapperApplicationDataPath = bootstrapperApplicationDataPath; | ||
57 | } | ||
58 | |||
59 | /// <inheritdoc/> | ||
60 | public LaunchAction Action { get; } | ||
61 | |||
62 | /// <inheritdoc/> | ||
63 | public Display Display { get; } | ||
64 | |||
65 | /// <inheritdoc/> | ||
66 | public Restart Restart { get; } | ||
67 | |||
68 | /// <inheritdoc/> | ||
69 | public string[] CommandLineArgs => GetCommandLineArgs(this.commandLine); | ||
70 | |||
71 | /// <inheritdoc/> | ||
72 | public int CmdShow { get; } | ||
73 | |||
74 | /// <inheritdoc/> | ||
75 | public ResumeType Resume { get; } | ||
76 | |||
77 | /// <inheritdoc/> | ||
78 | public IntPtr SplashScreen { get; } | ||
79 | |||
80 | /// <inheritdoc/> | ||
81 | public RelationType Relation { get; } | ||
82 | |||
83 | /// <inheritdoc/> | ||
84 | public bool Passthrough { get; } | ||
85 | |||
86 | /// <inheritdoc/> | ||
87 | public string LayoutDirectory { get; } | ||
88 | |||
89 | /// <inheritdoc/> | ||
90 | public string BootstrapperWorkingFolder { get; } | ||
91 | |||
92 | /// <inheritdoc/> | ||
93 | public string BootstrapperApplicationDataPath { get; } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets the command line arguments as a string array. | ||
97 | /// </summary> | ||
98 | /// <returns> | ||
99 | /// Array of command line arguments. | ||
100 | /// </returns> | ||
101 | /// <exception type="Win32Exception">The command line could not be parsed into an array.</exception> | ||
102 | /// <remarks> | ||
103 | /// This method uses the same parsing as the operating system which handles quotes and spaces correctly. | ||
104 | /// </remarks> | ||
105 | public static string[] GetCommandLineArgs(string commandLine) | ||
106 | { | ||
107 | if (null == commandLine) | ||
108 | { | ||
109 | return new string[0]; | ||
110 | } | ||
111 | |||
112 | // Parse the filtered command line arguments into a native array. | ||
113 | int argc = 0; | ||
114 | |||
115 | // CommandLineToArgvW tries to treat the first argument as the path to the process, | ||
116 | // which fails pretty miserably if your first argument is something like | ||
117 | // FOO="C:\Program Files\My Company". So give it something harmless to play with. | ||
118 | IntPtr argv = NativeMethods.CommandLineToArgvW("ignored " + commandLine, out argc); | ||
119 | |||
120 | if (IntPtr.Zero == argv) | ||
121 | { | ||
122 | // Throw an exception with the last error. | ||
123 | throw new Win32Exception(); | ||
124 | } | ||
125 | |||
126 | // Marshal each native array pointer to a managed string. | ||
127 | try | ||
128 | { | ||
129 | // Skip "ignored" argument/hack. | ||
130 | string[] args = new string[argc - 1]; | ||
131 | for (int i = 1; i < argc; ++i) | ||
132 | { | ||
133 | IntPtr argvi = Marshal.ReadIntPtr(argv, i * IntPtr.Size); | ||
134 | args[i - 1] = Marshal.PtrToStringUni(argvi); | ||
135 | } | ||
136 | |||
137 | return args; | ||
138 | } | ||
139 | finally | ||
140 | { | ||
141 | NativeMethods.LocalFree(argv); | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs new file mode 100644 index 00000000..3d5d535d --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs | |||
@@ -0,0 +1,86 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.IO; | ||
8 | using System.Xml; | ||
9 | using System.Xml.XPath; | ||
10 | |||
11 | /// <summary> | ||
12 | /// Default implementation of <see cref="IBundleInfo"/>. | ||
13 | /// </summary> | ||
14 | public class BundleInfo : IBundleInfo | ||
15 | { | ||
16 | /// <inheritdoc/> | ||
17 | public bool PerMachine { get; internal set; } | ||
18 | |||
19 | /// <inheritdoc/> | ||
20 | public string Name { get; internal set; } | ||
21 | |||
22 | /// <inheritdoc/> | ||
23 | public string LogVariable { get; internal set; } | ||
24 | |||
25 | /// <inheritdoc/> | ||
26 | public IDictionary<string, IPackageInfo> Packages { get; internal set; } | ||
27 | |||
28 | internal BundleInfo() | ||
29 | { | ||
30 | this.Packages = new Dictionary<string, IPackageInfo>(); | ||
31 | } | ||
32 | |||
33 | /// <inheritdoc/> | ||
34 | public IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e) | ||
35 | { | ||
36 | var package = PackageInfo.GetRelatedBundleAsPackage(e.ProductCode, e.RelationType, e.PerMachine, e.Version); | ||
37 | this.Packages.Add(package.Id, package); | ||
38 | return package; | ||
39 | } | ||
40 | |||
41 | /// <summary> | ||
42 | /// Parses BA manifest from the given stream. | ||
43 | /// </summary> | ||
44 | /// <param name="stream"></param> | ||
45 | /// <returns></returns> | ||
46 | public static IBundleInfo ParseBundleFromStream(Stream stream) | ||
47 | { | ||
48 | XPathDocument manifest = new XPathDocument(stream); | ||
49 | XPathNavigator root = manifest.CreateNavigator(); | ||
50 | return ParseBundleFromXml(root); | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Parses BA manifest from the given <see cref="XPathNavigator"/>. | ||
55 | /// </summary> | ||
56 | /// <param name="root">The root of the BA manifest.</param> | ||
57 | /// <returns></returns> | ||
58 | public static IBundleInfo ParseBundleFromXml(XPathNavigator root) | ||
59 | { | ||
60 | BundleInfo bundle = new BundleInfo(); | ||
61 | |||
62 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); | ||
63 | namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); | ||
64 | XPathNavigator bundleNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:WixBundleProperties", namespaceManager); | ||
65 | |||
66 | if (bundleNode == null) | ||
67 | { | ||
68 | throw new Exception("Failed to select bundle information."); | ||
69 | } | ||
70 | |||
71 | bool? perMachine = BootstrapperApplicationData.GetYesNoAttribute(bundleNode, "PerMachine"); | ||
72 | if (perMachine.HasValue) | ||
73 | { | ||
74 | bundle.PerMachine = perMachine.Value; | ||
75 | } | ||
76 | |||
77 | bundle.Name = BootstrapperApplicationData.GetAttribute(bundleNode, "DisplayName"); | ||
78 | |||
79 | bundle.LogVariable = BootstrapperApplicationData.GetAttribute(bundleNode, "LogPathVariable"); | ||
80 | |||
81 | bundle.Packages = PackageInfo.ParsePackagesFromXml(root); | ||
82 | |||
83 | return bundle; | ||
84 | } | ||
85 | } | ||
86 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/Engine.cs b/src/api/burn/WixToolset.Mba.Core/Engine.cs new file mode 100644 index 00000000..aed420d5 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/Engine.cs | |||
@@ -0,0 +1,541 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.ComponentModel; | ||
7 | using System.Runtime.InteropServices; | ||
8 | using System.Security; | ||
9 | using System.Text; | ||
10 | |||
11 | /// <summary> | ||
12 | /// Default implementation of <see cref="IEngine"/>. | ||
13 | /// </summary> | ||
14 | public sealed class Engine : IEngine | ||
15 | { | ||
16 | // Burn errs on empty strings, so declare initial buffer size. | ||
17 | private const int InitialBufferSize = 80; | ||
18 | private static readonly string normalizeVersionFormatString = "{0} must be less than or equal to " + UInt16.MaxValue; | ||
19 | |||
20 | private IBootstrapperEngine engine; | ||
21 | |||
22 | /// <summary> | ||
23 | /// Creates a new instance of the <see cref="Engine"/> container class. | ||
24 | /// </summary> | ||
25 | /// <param name="engine">The <see cref="IBootstrapperEngine"/> to contain.</param> | ||
26 | internal Engine(IBootstrapperEngine engine) | ||
27 | { | ||
28 | this.engine = engine; | ||
29 | } | ||
30 | |||
31 | /// <inheritdoc/> | ||
32 | public int PackageCount | ||
33 | { | ||
34 | get | ||
35 | { | ||
36 | int count; | ||
37 | this.engine.GetPackageCount(out count); | ||
38 | |||
39 | return count; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | /// <inheritdoc/> | ||
44 | public void Apply(IntPtr hwndParent) | ||
45 | { | ||
46 | this.engine.Apply(hwndParent); | ||
47 | } | ||
48 | |||
49 | /// <inheritdoc/> | ||
50 | public void CloseSplashScreen() | ||
51 | { | ||
52 | this.engine.CloseSplashScreen(); | ||
53 | } | ||
54 | |||
55 | /// <inheritdoc/> | ||
56 | public int CompareVersions(string version1, string version2) | ||
57 | { | ||
58 | this.engine.CompareVersions(version1, version2, out var result); | ||
59 | return result; | ||
60 | } | ||
61 | |||
62 | /// <inheritdoc/> | ||
63 | public bool ContainsVariable(string name) | ||
64 | { | ||
65 | IntPtr capacity = new IntPtr(0); | ||
66 | int ret = this.engine.GetVariableString(name, IntPtr.Zero, ref capacity); | ||
67 | return NativeMethods.E_NOTFOUND != ret; | ||
68 | } | ||
69 | |||
70 | /// <inheritdoc/> | ||
71 | public void Detect() | ||
72 | { | ||
73 | this.Detect(IntPtr.Zero); | ||
74 | } | ||
75 | |||
76 | /// <inheritdoc/> | ||
77 | public void Detect(IntPtr hwndParent) | ||
78 | { | ||
79 | this.engine.Detect(hwndParent); | ||
80 | } | ||
81 | |||
82 | /// <inheritdoc/> | ||
83 | public bool Elevate(IntPtr hwndParent) | ||
84 | { | ||
85 | int ret = this.engine.Elevate(hwndParent); | ||
86 | |||
87 | if (NativeMethods.S_OK == ret || NativeMethods.E_ALREADYINITIALIZED == ret) | ||
88 | { | ||
89 | return true; | ||
90 | } | ||
91 | else if (NativeMethods.E_CANCELLED == ret) | ||
92 | { | ||
93 | return false; | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | throw new Win32Exception(ret); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /// <inheritdoc/> | ||
102 | public string EscapeString(string input) | ||
103 | { | ||
104 | IntPtr capacity = new IntPtr(InitialBufferSize); | ||
105 | StringBuilder sb = new StringBuilder(capacity.ToInt32()); | ||
106 | |||
107 | // Get the size of the buffer. | ||
108 | int ret = this.engine.EscapeString(input, sb, ref capacity); | ||
109 | if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) | ||
110 | { | ||
111 | capacity = new IntPtr(capacity.ToInt32() + 1); // Add one for the null terminator. | ||
112 | sb.Capacity = capacity.ToInt32(); | ||
113 | ret = this.engine.EscapeString(input, sb, ref capacity); | ||
114 | } | ||
115 | |||
116 | if (NativeMethods.S_OK != ret) | ||
117 | { | ||
118 | throw new Win32Exception(ret); | ||
119 | } | ||
120 | |||
121 | return sb.ToString(); | ||
122 | } | ||
123 | |||
124 | /// <inheritdoc/> | ||
125 | public bool EvaluateCondition(string condition) | ||
126 | { | ||
127 | bool value; | ||
128 | this.engine.EvaluateCondition(condition, out value); | ||
129 | |||
130 | return value; | ||
131 | } | ||
132 | |||
133 | /// <inheritdoc/> | ||
134 | public string FormatString(string format) | ||
135 | { | ||
136 | IntPtr capacity = new IntPtr(InitialBufferSize); | ||
137 | StringBuilder sb = new StringBuilder(capacity.ToInt32()); | ||
138 | |||
139 | // Get the size of the buffer. | ||
140 | int ret = this.engine.FormatString(format, sb, ref capacity); | ||
141 | if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) | ||
142 | { | ||
143 | capacity = new IntPtr(capacity.ToInt32() + 1); // Add one for the null terminator. | ||
144 | sb.Capacity = capacity.ToInt32(); | ||
145 | ret = this.engine.FormatString(format, sb, ref capacity); | ||
146 | } | ||
147 | |||
148 | if (NativeMethods.S_OK != ret) | ||
149 | { | ||
150 | throw new Win32Exception(ret); | ||
151 | } | ||
152 | |||
153 | return sb.ToString(); | ||
154 | } | ||
155 | |||
156 | /// <inheritdoc/> | ||
157 | public long GetVariableNumeric(string name) | ||
158 | { | ||
159 | int ret = this.engine.GetVariableNumeric(name, out long value); | ||
160 | if (NativeMethods.S_OK != ret) | ||
161 | { | ||
162 | throw new Win32Exception(ret); | ||
163 | } | ||
164 | |||
165 | return value; | ||
166 | } | ||
167 | |||
168 | /// <inheritdoc/> | ||
169 | public SecureString GetVariableSecureString(string name) | ||
170 | { | ||
171 | var pUniString = this.getStringVariable(name, out var length); | ||
172 | try | ||
173 | { | ||
174 | return this.convertToSecureString(pUniString, length); | ||
175 | } | ||
176 | finally | ||
177 | { | ||
178 | if (IntPtr.Zero != pUniString) | ||
179 | { | ||
180 | Marshal.FreeCoTaskMem(pUniString); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /// <inheritdoc/> | ||
186 | public string GetVariableString(string name) | ||
187 | { | ||
188 | int length; | ||
189 | IntPtr pUniString = this.getStringVariable(name, out length); | ||
190 | try | ||
191 | { | ||
192 | return Marshal.PtrToStringUni(pUniString, length); | ||
193 | } | ||
194 | finally | ||
195 | { | ||
196 | if (IntPtr.Zero != pUniString) | ||
197 | { | ||
198 | Marshal.FreeCoTaskMem(pUniString); | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | |||
203 | /// <inheritdoc/> | ||
204 | public string GetVariableVersion(string name) | ||
205 | { | ||
206 | int length; | ||
207 | IntPtr pUniString = this.getVersionVariable(name, out length); | ||
208 | try | ||
209 | { | ||
210 | return Marshal.PtrToStringUni(pUniString, length); | ||
211 | } | ||
212 | finally | ||
213 | { | ||
214 | if (IntPtr.Zero != pUniString) | ||
215 | { | ||
216 | Marshal.FreeCoTaskMem(pUniString); | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | |||
221 | /// <inheritdoc/> | ||
222 | public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments) | ||
223 | { | ||
224 | this.LaunchApprovedExe(hwndParent, approvedExeForElevationId, arguments, 0); | ||
225 | } | ||
226 | |||
227 | /// <inheritdoc/> | ||
228 | public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout) | ||
229 | { | ||
230 | this.engine.LaunchApprovedExe(hwndParent, approvedExeForElevationId, arguments, waitForInputIdleTimeout); | ||
231 | } | ||
232 | /// <inheritdoc/> | ||
233 | |||
234 | public void Log(LogLevel level, string message) | ||
235 | { | ||
236 | this.engine.Log(level, message); | ||
237 | } | ||
238 | |||
239 | /// <inheritdoc/> | ||
240 | public void Plan(LaunchAction action) | ||
241 | { | ||
242 | this.engine.Plan(action); | ||
243 | } | ||
244 | |||
245 | /// <inheritdoc/> | ||
246 | public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, byte[] hash) | ||
247 | { | ||
248 | this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash, null == hash ? 0 : hash.Length); | ||
249 | } | ||
250 | |||
251 | /// <inheritdoc/> | ||
252 | public void SetUpdateSource(string url) | ||
253 | { | ||
254 | this.engine.SetUpdateSource(url); | ||
255 | } | ||
256 | |||
257 | /// <inheritdoc/> | ||
258 | public void SetLocalSource(string packageOrContainerId, string payloadId, string path) | ||
259 | { | ||
260 | this.engine.SetLocalSource(packageOrContainerId, payloadId, path); | ||
261 | } | ||
262 | |||
263 | /// <inheritdoc/> | ||
264 | public void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password) | ||
265 | { | ||
266 | this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password); | ||
267 | } | ||
268 | |||
269 | /// <inheritdoc/> | ||
270 | public void SetVariableNumeric(string name, long value) | ||
271 | { | ||
272 | this.engine.SetVariableNumeric(name, value); | ||
273 | } | ||
274 | |||
275 | /// <inheritdoc/> | ||
276 | public void SetVariableString(string name, SecureString value, bool formatted) | ||
277 | { | ||
278 | IntPtr pValue = Marshal.SecureStringToCoTaskMemUnicode(value); | ||
279 | try | ||
280 | { | ||
281 | this.engine.SetVariableString(name, pValue, formatted); | ||
282 | } | ||
283 | finally | ||
284 | { | ||
285 | Marshal.FreeCoTaskMem(pValue); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | /// <inheritdoc/> | ||
290 | public void SetVariableString(string name, string value, bool formatted) | ||
291 | { | ||
292 | IntPtr pValue = Marshal.StringToCoTaskMemUni(value); | ||
293 | try | ||
294 | { | ||
295 | this.engine.SetVariableString(name, pValue, formatted); | ||
296 | } | ||
297 | finally | ||
298 | { | ||
299 | Marshal.FreeCoTaskMem(pValue); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /// <inheritdoc/> | ||
304 | public void SetVariableVersion(string name, string value) | ||
305 | { | ||
306 | IntPtr pValue = Marshal.StringToCoTaskMemUni(value); | ||
307 | try | ||
308 | { | ||
309 | this.engine.SetVariableVersion(name, pValue); | ||
310 | } | ||
311 | finally | ||
312 | { | ||
313 | Marshal.FreeCoTaskMem(pValue); | ||
314 | } | ||
315 | } | ||
316 | |||
317 | /// <inheritdoc/> | ||
318 | public int SendEmbeddedError(int errorCode, string message, int uiHint) | ||
319 | { | ||
320 | int result = 0; | ||
321 | this.engine.SendEmbeddedError(errorCode, message, uiHint, out result); | ||
322 | return result; | ||
323 | } | ||
324 | |||
325 | /// <inheritdoc/> | ||
326 | public int SendEmbeddedProgress(int progressPercentage, int overallPercentage) | ||
327 | { | ||
328 | int result = 0; | ||
329 | this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out result); | ||
330 | return result; | ||
331 | } | ||
332 | |||
333 | /// <inheritdoc/> | ||
334 | public void Quit(int exitCode) | ||
335 | { | ||
336 | this.engine.Quit(exitCode); | ||
337 | } | ||
338 | |||
339 | /// <summary> | ||
340 | /// Gets the variable given by <paramref name="name"/> as a string. | ||
341 | /// </summary> | ||
342 | /// <param name="name">The name of the variable to get.</param> | ||
343 | /// <param name="length">The length of the Unicode string.</param> | ||
344 | /// <returns>The value by a pointer to a Unicode string. Must be freed by Marshal.FreeCoTaskMem.</returns> | ||
345 | /// <exception cref="Exception">An error occurred getting the variable.</exception> | ||
346 | internal IntPtr getStringVariable(string name, out int length) | ||
347 | { | ||
348 | IntPtr capacity = new IntPtr(InitialBufferSize); | ||
349 | bool success = false; | ||
350 | IntPtr pValue = Marshal.AllocCoTaskMem(capacity.ToInt32() * UnicodeEncoding.CharSize); | ||
351 | try | ||
352 | { | ||
353 | // Get the size of the buffer. | ||
354 | int ret = this.engine.GetVariableString(name, pValue, ref capacity); | ||
355 | if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) | ||
356 | { | ||
357 | // Don't need to add 1 for the null terminator, the engine already includes that. | ||
358 | pValue = Marshal.ReAllocCoTaskMem(pValue, capacity.ToInt32() * UnicodeEncoding.CharSize); | ||
359 | ret = this.engine.GetVariableString(name, pValue, ref capacity); | ||
360 | } | ||
361 | |||
362 | if (NativeMethods.S_OK != ret) | ||
363 | { | ||
364 | throw Marshal.GetExceptionForHR(ret); | ||
365 | } | ||
366 | |||
367 | // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves. | ||
368 | int maxLength = capacity.ToInt32(); | ||
369 | for (length = 0; length < maxLength; ++length) | ||
370 | { | ||
371 | if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize)) | ||
372 | { | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | success = true; | ||
378 | return pValue; | ||
379 | } | ||
380 | finally | ||
381 | { | ||
382 | if (!success && IntPtr.Zero != pValue) | ||
383 | { | ||
384 | Marshal.FreeCoTaskMem(pValue); | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | |||
389 | /// <summary> | ||
390 | /// Gets the variable given by <paramref name="name"/> as a version string. | ||
391 | /// </summary> | ||
392 | /// <param name="name">The name of the variable to get.</param> | ||
393 | /// <param name="length">The length of the Unicode string.</param> | ||
394 | /// <returns>The value by a pointer to a Unicode string. Must be freed by Marshal.FreeCoTaskMem.</returns> | ||
395 | /// <exception cref="Exception">An error occurred getting the variable.</exception> | ||
396 | internal IntPtr getVersionVariable(string name, out int length) | ||
397 | { | ||
398 | IntPtr capacity = new IntPtr(InitialBufferSize); | ||
399 | bool success = false; | ||
400 | IntPtr pValue = Marshal.AllocCoTaskMem(capacity.ToInt32() * UnicodeEncoding.CharSize); | ||
401 | try | ||
402 | { | ||
403 | // Get the size of the buffer. | ||
404 | int ret = this.engine.GetVariableVersion(name, pValue, ref capacity); | ||
405 | if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) | ||
406 | { | ||
407 | // Don't need to add 1 for the null terminator, the engine already includes that. | ||
408 | pValue = Marshal.ReAllocCoTaskMem(pValue, capacity.ToInt32() * UnicodeEncoding.CharSize); | ||
409 | ret = this.engine.GetVariableVersion(name, pValue, ref capacity); | ||
410 | } | ||
411 | |||
412 | if (NativeMethods.S_OK != ret) | ||
413 | { | ||
414 | throw Marshal.GetExceptionForHR(ret); | ||
415 | } | ||
416 | |||
417 | // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves. | ||
418 | int maxLength = capacity.ToInt32(); | ||
419 | for (length = 0; length < maxLength; ++length) | ||
420 | { | ||
421 | if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize)) | ||
422 | { | ||
423 | break; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | success = true; | ||
428 | return pValue; | ||
429 | } | ||
430 | finally | ||
431 | { | ||
432 | if (!success && IntPtr.Zero != pValue) | ||
433 | { | ||
434 | Marshal.FreeCoTaskMem(pValue); | ||
435 | } | ||
436 | } | ||
437 | } | ||
438 | |||
439 | /// <summary> | ||
440 | /// Initialize a SecureString with the given Unicode string. | ||
441 | /// </summary> | ||
442 | /// <param name="pUniString">Pointer to Unicode string.</param> | ||
443 | /// <param name="length">The string's length.</param> | ||
444 | internal SecureString convertToSecureString(IntPtr pUniString, int length) | ||
445 | { | ||
446 | if (IntPtr.Zero == pUniString) | ||
447 | { | ||
448 | return null; | ||
449 | } | ||
450 | |||
451 | SecureString value = new SecureString(); | ||
452 | short s; | ||
453 | char c; | ||
454 | for (int charIndex = 0; charIndex < length; charIndex++) | ||
455 | { | ||
456 | s = Marshal.ReadInt16(pUniString, charIndex * UnicodeEncoding.CharSize); | ||
457 | c = (char)s; | ||
458 | value.AppendChar(c); | ||
459 | s = 0; | ||
460 | c = (char)0; | ||
461 | } | ||
462 | return value; | ||
463 | } | ||
464 | |||
465 | /// <summary> | ||
466 | /// Utility method for converting a <see cref="Version"/> into a <see cref="long"/>. | ||
467 | /// </summary> | ||
468 | /// <param name="version"></param> | ||
469 | /// <returns></returns> | ||
470 | public static long VersionToLong(Version version) | ||
471 | { | ||
472 | // In Windows, each version component has a max value of 65535, | ||
473 | // so we truncate the version before shifting it, which will overflow if invalid. | ||
474 | long major = (long)(ushort)version.Major << 48; | ||
475 | long minor = (long)(ushort)version.Minor << 32; | ||
476 | long build = (long)(ushort)version.Build << 16; | ||
477 | long revision = (long)(ushort)version.Revision; | ||
478 | |||
479 | return major | minor | build | revision; | ||
480 | } | ||
481 | |||
482 | /// <summary> | ||
483 | /// Utility method for converting a <see cref="long"/> into a <see cref="Version"/>. | ||
484 | /// </summary> | ||
485 | /// <param name="version"></param> | ||
486 | /// <returns></returns> | ||
487 | public static Version LongToVersion(long version) | ||
488 | { | ||
489 | int major = (int)((version & ((long)0xffff << 48)) >> 48); | ||
490 | int minor = (int)((version & ((long)0xffff << 32)) >> 32); | ||
491 | int build = (int)((version & ((long)0xffff << 16)) >> 16); | ||
492 | int revision = (int)(version & 0xffff); | ||
493 | |||
494 | return new Version(major, minor, build, revision); | ||
495 | } | ||
496 | |||
497 | /// <summary> | ||
498 | /// Verifies that Version can be represented in a <see cref="long"/>. | ||
499 | /// If the Build or Revision fields are undefined, they are set to zero. | ||
500 | /// </summary> | ||
501 | public static Version NormalizeVersion(Version version) | ||
502 | { | ||
503 | if (version == null) | ||
504 | { | ||
505 | throw new ArgumentNullException("version"); | ||
506 | } | ||
507 | |||
508 | int major = version.Major; | ||
509 | int minor = version.Minor; | ||
510 | int build = version.Build; | ||
511 | int revision = version.Revision; | ||
512 | |||
513 | if (major > UInt16.MaxValue) | ||
514 | { | ||
515 | throw new ArgumentOutOfRangeException("version", String.Format(normalizeVersionFormatString, "Major")); | ||
516 | } | ||
517 | if (minor > UInt16.MaxValue) | ||
518 | { | ||
519 | throw new ArgumentOutOfRangeException("version", String.Format(normalizeVersionFormatString, "Minor")); | ||
520 | } | ||
521 | if (build > UInt16.MaxValue) | ||
522 | { | ||
523 | throw new ArgumentOutOfRangeException("version", String.Format(normalizeVersionFormatString, "Build")); | ||
524 | } | ||
525 | if (build == -1) | ||
526 | { | ||
527 | build = 0; | ||
528 | } | ||
529 | if (revision > UInt16.MaxValue) | ||
530 | { | ||
531 | throw new ArgumentOutOfRangeException("version", String.Format(normalizeVersionFormatString, "Revision")); | ||
532 | } | ||
533 | if (revision == -1) | ||
534 | { | ||
535 | revision = 0; | ||
536 | } | ||
537 | |||
538 | return new Version(major, minor, build, revision); | ||
539 | } | ||
540 | } | ||
541 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs new file mode 100644 index 00000000..8ef8af14 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
@@ -0,0 +1,2186 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Collections.ObjectModel; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Base class for BA <see cref="EventArgs"/> classes. | ||
11 | /// </summary> | ||
12 | [Serializable] | ||
13 | public abstract class HResultEventArgs : EventArgs | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Creates a new instance of the <see cref="HResultEventArgs"/> class. | ||
17 | /// </summary> | ||
18 | public HResultEventArgs() | ||
19 | { | ||
20 | } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Gets or sets the <see cref="HResult"/> of the operation. This is passed back to the engine. | ||
24 | /// </summary> | ||
25 | public int HResult { get; set; } | ||
26 | } | ||
27 | |||
28 | /// <summary> | ||
29 | /// Base class for cancellable BA <see cref="EventArgs"/> classes. | ||
30 | /// </summary> | ||
31 | [Serializable] | ||
32 | public abstract class CancellableHResultEventArgs : HResultEventArgs | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Creates a new instance of the <see cref="CancellableHResultEventArgs"/> class. | ||
36 | /// </summary> | ||
37 | public CancellableHResultEventArgs(bool cancelRecommendation) | ||
38 | { | ||
39 | this.Cancel = cancelRecommendation; | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Gets or sets whether to cancel the operation. This is passed back to the engine. | ||
44 | /// </summary> | ||
45 | public bool Cancel { get; set; } | ||
46 | } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Base class for <see cref="EventArgs"/> classes that must return a <see cref="Result"/>. | ||
50 | /// </summary> | ||
51 | [Serializable] | ||
52 | public abstract class ResultEventArgs : HResultEventArgs | ||
53 | { | ||
54 | /// <summary /> | ||
55 | public ResultEventArgs(Result recommendation, Result result) | ||
56 | { | ||
57 | this.Recommendation = recommendation; | ||
58 | this.Result = result; | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Gets the recommended <see cref="Result"/> of the operation. | ||
63 | /// </summary> | ||
64 | public Result Recommendation { get; private set; } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Gets or sets the <see cref="Result"/> of the operation. This is passed back to the engine. | ||
68 | /// </summary> | ||
69 | public Result Result { get; set; } | ||
70 | } | ||
71 | |||
72 | /// <summary> | ||
73 | /// Base class for <see cref="EventArgs"/> classes that receive status from the engine. | ||
74 | /// </summary> | ||
75 | [Serializable] | ||
76 | public abstract class StatusEventArgs : HResultEventArgs | ||
77 | { | ||
78 | /// <summary> | ||
79 | /// Creates a new instance of the <see cref="StatusEventArgs"/> class. | ||
80 | /// </summary> | ||
81 | /// <param name="hrStatus">The return code of the operation.</param> | ||
82 | public StatusEventArgs(int hrStatus) | ||
83 | { | ||
84 | this.Status = hrStatus; | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Gets the return code of the operation. | ||
89 | /// </summary> | ||
90 | public int Status { get; private set; } | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
94 | /// Base class for <see cref="EventArgs"/> classes that receive status from the engine and return an action. | ||
95 | /// </summary> | ||
96 | public abstract class ActionEventArgs<T> : StatusEventArgs | ||
97 | { | ||
98 | /// <summary /> | ||
99 | public ActionEventArgs(int hrStatus, T recommendation, T action) | ||
100 | : base(hrStatus) | ||
101 | { | ||
102 | this.Recommendation = recommendation; | ||
103 | this.Action = action; | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Gets the recommended action from the engine. | ||
108 | /// </summary> | ||
109 | public T Recommendation { get; private set; } | ||
110 | |||
111 | /// <summary> | ||
112 | /// Gets or sets the action to be performed. This is passed back to the engine. | ||
113 | /// </summary> | ||
114 | public T Action { get; set; } | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// Base class for cancellable action BA <see cref="EventArgs"/> classes. | ||
119 | /// </summary> | ||
120 | [Serializable] | ||
121 | public abstract class CancellableActionEventArgs<T> : CancellableHResultEventArgs | ||
122 | { | ||
123 | /// <summary /> | ||
124 | public CancellableActionEventArgs(bool cancelRecommendation, T recommendation, T action) | ||
125 | : base(cancelRecommendation) | ||
126 | { | ||
127 | this.Recommendation = recommendation; | ||
128 | this.Action = action; | ||
129 | } | ||
130 | |||
131 | /// <summary> | ||
132 | /// Gets the recommended action from the engine. | ||
133 | /// </summary> | ||
134 | public T Recommendation { get; private set; } | ||
135 | |||
136 | /// <summary> | ||
137 | /// Gets or sets the action to be performed. This is passed back to the engine. | ||
138 | /// </summary> | ||
139 | public T Action { get; set; } | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Base class for cache progress events. | ||
144 | /// </summary> | ||
145 | [Serializable] | ||
146 | public abstract class CacheProgressBaseEventArgs : CancellableHResultEventArgs | ||
147 | { | ||
148 | /// <summary /> | ||
149 | public CacheProgressBaseEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) | ||
150 | : base(cancelRecommendation) | ||
151 | { | ||
152 | this.PackageOrContainerId = packageOrContainerId; | ||
153 | this.PayloadId = payloadId; | ||
154 | this.Progress = progress; | ||
155 | this.Total = total; | ||
156 | this.OverallPercentage = overallPercentage; | ||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// Gets the identifier of the container or package. | ||
161 | /// </summary> | ||
162 | public string PackageOrContainerId { get; private set; } | ||
163 | |||
164 | /// <summary> | ||
165 | /// Gets the identifier of the payload. | ||
166 | /// </summary> | ||
167 | public string PayloadId { get; private set; } | ||
168 | |||
169 | /// <summary> | ||
170 | /// Gets the number of bytes cached thus far. | ||
171 | /// </summary> | ||
172 | public long Progress { get; private set; } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Gets the total bytes to cache. | ||
176 | /// </summary> | ||
177 | public long Total { get; private set; } | ||
178 | |||
179 | /// <summary> | ||
180 | /// Gets the overall percentage of progress of caching. | ||
181 | /// </summary> | ||
182 | public int OverallPercentage { get; private set; } | ||
183 | } | ||
184 | |||
185 | /// <summary> | ||
186 | /// Additional arguments used when startup has begun. | ||
187 | /// </summary> | ||
188 | [Serializable] | ||
189 | public class StartupEventArgs : HResultEventArgs | ||
190 | { | ||
191 | /// <summary> | ||
192 | /// Creates a new instance of the <see cref="StartupEventArgs"/> class. | ||
193 | /// </summary> | ||
194 | public StartupEventArgs() | ||
195 | { | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /// <summary> | ||
200 | /// Additional arguments used when shutdown has begun. | ||
201 | /// </summary> | ||
202 | [Serializable] | ||
203 | public class ShutdownEventArgs : HResultEventArgs | ||
204 | { | ||
205 | /// <summary> | ||
206 | /// Creates a new instance of the <see cref="ShutdownEventArgs"/> class. | ||
207 | /// </summary> | ||
208 | public ShutdownEventArgs(BOOTSTRAPPER_SHUTDOWN_ACTION action) | ||
209 | { | ||
210 | this.Action = action; | ||
211 | } | ||
212 | |||
213 | /// <summary> | ||
214 | /// The action for OnShutdown. | ||
215 | /// </summary> | ||
216 | public BOOTSTRAPPER_SHUTDOWN_ACTION Action { get; set; } | ||
217 | } | ||
218 | |||
219 | /// <summary> | ||
220 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.SystemShutdown"/> | ||
221 | /// </summary> | ||
222 | [Serializable] | ||
223 | public class SystemShutdownEventArgs : CancellableHResultEventArgs | ||
224 | { | ||
225 | /// <summary /> | ||
226 | public SystemShutdownEventArgs(EndSessionReasons reasons, bool cancelRecommendation) | ||
227 | : base(cancelRecommendation) | ||
228 | { | ||
229 | this.Reasons = reasons; | ||
230 | } | ||
231 | |||
232 | /// <summary> | ||
233 | /// Gets the reason the application is requested to close or being closed. | ||
234 | /// </summary> | ||
235 | /// <remarks> | ||
236 | /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to | ||
237 | /// true; otherwise, set it to false.</para> | ||
238 | /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/> | ||
239 | /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other | ||
240 | /// critical operations before being closed by the operating system.</para> | ||
241 | /// </remarks> | ||
242 | public EndSessionReasons Reasons { get; private set; } | ||
243 | } | ||
244 | |||
245 | /// <summary> | ||
246 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectBegin"/> | ||
247 | /// </summary> | ||
248 | [Serializable] | ||
249 | public class DetectBeginEventArgs : CancellableHResultEventArgs | ||
250 | { | ||
251 | /// <summary /> | ||
252 | public DetectBeginEventArgs(bool cached, bool installed, int packageCount, bool cancelRecommendation) | ||
253 | : base(cancelRecommendation) | ||
254 | { | ||
255 | this.Cached = cached; | ||
256 | this.Installed = installed; | ||
257 | this.PackageCount = packageCount; | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Gets whether the bundle is cached. | ||
262 | /// </summary> | ||
263 | public bool Cached { get; private set; } | ||
264 | |||
265 | /// <summary> | ||
266 | /// Gets whether the bundle is installed. | ||
267 | /// </summary> | ||
268 | public bool Installed { get; private set; } | ||
269 | |||
270 | /// <summary> | ||
271 | /// Gets the number of packages to detect. | ||
272 | /// </summary> | ||
273 | public int PackageCount { get; private set; } | ||
274 | } | ||
275 | |||
276 | /// <summary> | ||
277 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectForwardCompatibleBundle"/> | ||
278 | /// </summary> | ||
279 | [Serializable] | ||
280 | public class DetectForwardCompatibleBundleEventArgs : CancellableHResultEventArgs | ||
281 | { | ||
282 | /// <summary /> | ||
283 | public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation) | ||
284 | : base(cancelRecommendation) | ||
285 | { | ||
286 | this.BundleId = bundleId; | ||
287 | this.RelationType = relationType; | ||
288 | this.BundleTag = bundleTag; | ||
289 | this.PerMachine = perMachine; | ||
290 | this.Version = version; | ||
291 | this.MissingFromCache = missingFromCache; | ||
292 | } | ||
293 | |||
294 | /// <summary> | ||
295 | /// Gets the identity of the forward compatible bundle detected. | ||
296 | /// </summary> | ||
297 | public string BundleId { get; private set; } | ||
298 | |||
299 | /// <summary> | ||
300 | /// Gets the relationship type of the forward compatible bundle. | ||
301 | /// </summary> | ||
302 | public RelationType RelationType { get; private set; } | ||
303 | |||
304 | /// <summary> | ||
305 | /// Gets the tag of the forward compatible bundle. | ||
306 | /// </summary> | ||
307 | public string BundleTag { get; private set; } | ||
308 | |||
309 | /// <summary> | ||
310 | /// Gets whether the detected forward compatible bundle is per machine. | ||
311 | /// </summary> | ||
312 | public bool PerMachine { get; private set; } | ||
313 | |||
314 | /// <summary> | ||
315 | /// Gets the version of the forward compatible bundle detected. | ||
316 | /// </summary> | ||
317 | public string Version { get; private set; } | ||
318 | |||
319 | /// <summary> | ||
320 | /// Whether the forward compatible bundle is missing from the package cache. | ||
321 | /// </summary> | ||
322 | public bool MissingFromCache { get; set; } | ||
323 | } | ||
324 | |||
325 | /// <summary> | ||
326 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectUpdateBegin"/> | ||
327 | /// </summary> | ||
328 | [Serializable] | ||
329 | public class DetectUpdateBeginEventArgs : CancellableHResultEventArgs | ||
330 | { | ||
331 | /// <summary /> | ||
332 | public DetectUpdateBeginEventArgs(string updateLocation, bool cancelRecommendation, bool skipRecommendation) | ||
333 | : base(cancelRecommendation) | ||
334 | { | ||
335 | this.UpdateLocation = updateLocation; | ||
336 | this.Skip = skipRecommendation; | ||
337 | } | ||
338 | |||
339 | /// <summary> | ||
340 | /// Gets the identity of the bundle to detect. | ||
341 | /// </summary> | ||
342 | public string UpdateLocation { get; private set; } | ||
343 | |||
344 | /// <summary> | ||
345 | /// Whether to skip checking for bundle updates. | ||
346 | /// </summary> | ||
347 | public bool Skip { get; set; } | ||
348 | } | ||
349 | |||
350 | /// <summary> | ||
351 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectUpdate"/> | ||
352 | /// </summary> | ||
353 | [Serializable] | ||
354 | public class DetectUpdateEventArgs : CancellableHResultEventArgs | ||
355 | { | ||
356 | /// <summary /> | ||
357 | public DetectUpdateEventArgs(string updateLocation, long size, string version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation) | ||
358 | : base(cancelRecommendation) | ||
359 | { | ||
360 | this.UpdateLocation = updateLocation; | ||
361 | this.Size = size; | ||
362 | this.Version = version; | ||
363 | this.Title = title; | ||
364 | this.Summary = summary; | ||
365 | this.ContentType = contentType; | ||
366 | this.Content = content; | ||
367 | this.StopProcessingUpdates = stopRecommendation; | ||
368 | } | ||
369 | |||
370 | /// <summary> | ||
371 | /// Gets the identity of the bundle to detect. | ||
372 | /// </summary> | ||
373 | public string UpdateLocation { get; private set; } | ||
374 | |||
375 | /// <summary> | ||
376 | /// Gets the size of the updated bundle. | ||
377 | /// </summary> | ||
378 | public long Size { get; private set; } | ||
379 | |||
380 | /// <summary> | ||
381 | /// Gets the version of the updated bundle. | ||
382 | /// </summary> | ||
383 | public string Version { get; private set; } | ||
384 | |||
385 | /// <summary> | ||
386 | /// Gets the title of the the updated bundle. | ||
387 | /// </summary> | ||
388 | public string Title { get; private set; } | ||
389 | |||
390 | /// <summary> | ||
391 | /// Gets the summary of the updated bundle. | ||
392 | /// </summary> | ||
393 | public string Summary { get; private set; } | ||
394 | |||
395 | /// <summary> | ||
396 | /// Gets the content type of the content of the updated bundle. | ||
397 | /// </summary> | ||
398 | public string ContentType { get; private set; } | ||
399 | |||
400 | /// <summary> | ||
401 | /// Gets the content of the updated bundle. | ||
402 | /// </summary> | ||
403 | public string Content { get; private set; } | ||
404 | |||
405 | /// <summary> | ||
406 | /// Tells the engine to stop giving the rest of the updates found in the feed. | ||
407 | /// </summary> | ||
408 | public bool StopProcessingUpdates { get; set; } | ||
409 | } | ||
410 | |||
411 | /// <summary> | ||
412 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectUpdateComplete"/> | ||
413 | /// </summary> | ||
414 | [Serializable] | ||
415 | public class DetectUpdateCompleteEventArgs : StatusEventArgs | ||
416 | { | ||
417 | /// <summary /> | ||
418 | public DetectUpdateCompleteEventArgs(int hrStatus, bool ignoreRecommendation) | ||
419 | : base(hrStatus) | ||
420 | { | ||
421 | this.IgnoreError = ignoreRecommendation; | ||
422 | } | ||
423 | |||
424 | /// <summary> | ||
425 | /// If Status is an error, then set this to true to ignore it and continue detecting. | ||
426 | /// </summary> | ||
427 | public bool IgnoreError { get; set; } | ||
428 | } | ||
429 | |||
430 | /// <summary> | ||
431 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectRelatedBundle"/> | ||
432 | /// </summary> | ||
433 | [Serializable] | ||
434 | public class DetectRelatedBundleEventArgs : CancellableHResultEventArgs | ||
435 | { | ||
436 | /// <summary /> | ||
437 | public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, string version, RelatedOperation operation, bool missingFromCache, bool cancelRecommendation) | ||
438 | : base(cancelRecommendation) | ||
439 | { | ||
440 | this.ProductCode = productCode; | ||
441 | this.RelationType = relationType; | ||
442 | this.BundleTag = bundleTag; | ||
443 | this.PerMachine = perMachine; | ||
444 | this.Version = version; | ||
445 | this.Operation = operation; | ||
446 | this.MissingFromCache = missingFromCache; | ||
447 | } | ||
448 | |||
449 | /// <summary> | ||
450 | /// Gets the identity of the related bundle detected. | ||
451 | /// </summary> | ||
452 | public string ProductCode { get; private set; } | ||
453 | |||
454 | /// <summary> | ||
455 | /// Gets the relationship type of the related bundle. | ||
456 | /// </summary> | ||
457 | public RelationType RelationType { get; private set; } | ||
458 | |||
459 | /// <summary> | ||
460 | /// Gets the tag of the related package bundle. | ||
461 | /// </summary> | ||
462 | public string BundleTag { get; private set; } | ||
463 | |||
464 | /// <summary> | ||
465 | /// Gets whether the detected bundle is per machine. | ||
466 | /// </summary> | ||
467 | public bool PerMachine { get; private set; } | ||
468 | |||
469 | /// <summary> | ||
470 | /// Gets the version of the related bundle detected. | ||
471 | /// </summary> | ||
472 | public string Version { get; private set; } | ||
473 | |||
474 | /// <summary> | ||
475 | /// Gets the operation that will be taken on the detected bundle. | ||
476 | /// </summary> | ||
477 | public RelatedOperation Operation { get; private set; } | ||
478 | |||
479 | /// <summary> | ||
480 | /// Whether the related bundle is missing from the package cache. | ||
481 | /// </summary> | ||
482 | public bool MissingFromCache { get; set; } | ||
483 | } | ||
484 | |||
485 | /// <summary> | ||
486 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectPackageBegin"/> | ||
487 | /// </summary> | ||
488 | [Serializable] | ||
489 | public class DetectPackageBeginEventArgs : CancellableHResultEventArgs | ||
490 | { | ||
491 | /// <summary /> | ||
492 | public DetectPackageBeginEventArgs(string packageId, bool cancelRecommendation) | ||
493 | : base(cancelRecommendation) | ||
494 | { | ||
495 | this.PackageId = packageId; | ||
496 | } | ||
497 | |||
498 | /// <summary> | ||
499 | /// Gets the identity of the package to detect. | ||
500 | /// </summary> | ||
501 | public string PackageId { get; private set; } | ||
502 | } | ||
503 | |||
504 | /// <summary> | ||
505 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectRelatedMsiPackage"/> | ||
506 | /// </summary> | ||
507 | [Serializable] | ||
508 | public class DetectRelatedMsiPackageEventArgs : CancellableHResultEventArgs | ||
509 | { | ||
510 | /// <summary /> | ||
511 | public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) | ||
512 | : base(cancelRecommendation) | ||
513 | { | ||
514 | this.PackageId = packageId; | ||
515 | this.UpgradeCode = upgradeCode; | ||
516 | this.ProductCode = productCode; | ||
517 | this.PerMachine = perMachine; | ||
518 | this.Version = version; | ||
519 | this.Operation = operation; | ||
520 | } | ||
521 | |||
522 | /// <summary> | ||
523 | /// Gets the identity of the product's package detected. | ||
524 | /// </summary> | ||
525 | public string PackageId { get; private set; } | ||
526 | |||
527 | /// <summary> | ||
528 | /// Gets the upgrade code of the related package detected. | ||
529 | /// </summary> | ||
530 | public string UpgradeCode { get; private set; } | ||
531 | |||
532 | /// <summary> | ||
533 | /// Gets the identity of the related package detected. | ||
534 | /// </summary> | ||
535 | public string ProductCode { get; private set; } | ||
536 | |||
537 | /// <summary> | ||
538 | /// Gets whether the detected package is per machine. | ||
539 | /// </summary> | ||
540 | public bool PerMachine { get; private set; } | ||
541 | |||
542 | /// <summary> | ||
543 | /// Gets the version of the related package detected. | ||
544 | /// </summary> | ||
545 | public string Version { get; private set; } | ||
546 | |||
547 | /// <summary> | ||
548 | /// Gets the operation that will be taken on the detected package. | ||
549 | /// </summary> | ||
550 | public RelatedOperation Operation { get; private set; } | ||
551 | } | ||
552 | |||
553 | /// <summary> | ||
554 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectPatchTarget"/> | ||
555 | /// </summary> | ||
556 | public class DetectPatchTargetEventArgs : CancellableHResultEventArgs | ||
557 | { | ||
558 | /// <summary> | ||
559 | /// | ||
560 | /// </summary> | ||
561 | /// <param name="packageId"></param> | ||
562 | /// <param name="productCode"></param> | ||
563 | /// <param name="state"></param> | ||
564 | /// <param name="cancelRecommendation"></param> | ||
565 | public DetectPatchTargetEventArgs(string packageId, string productCode, PackageState state, bool cancelRecommendation) | ||
566 | : base(cancelRecommendation) | ||
567 | { | ||
568 | this.PackageId = packageId; | ||
569 | this.ProductCode = productCode; | ||
570 | this.State = state; | ||
571 | } | ||
572 | |||
573 | /// <summary> | ||
574 | /// Gets the identity of the patch's package. | ||
575 | /// </summary> | ||
576 | public string PackageId { get; private set; } | ||
577 | |||
578 | /// <summary> | ||
579 | /// Gets the product code of the target. | ||
580 | /// </summary> | ||
581 | public string ProductCode { get; private set; } | ||
582 | |||
583 | /// <summary> | ||
584 | /// Gets the detected patch state for the target. | ||
585 | /// </summary> | ||
586 | public PackageState State { get; private set; } | ||
587 | } | ||
588 | |||
589 | /// <summary> | ||
590 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.DetectMsiFeature"/> | ||
591 | /// </summary> | ||
592 | public class DetectMsiFeatureEventArgs : CancellableHResultEventArgs | ||
593 | { | ||
594 | /// <summary /> | ||
595 | public DetectMsiFeatureEventArgs(string packageId, string featureId, FeatureState state, bool cancelRecommendation) | ||
596 | : base(cancelRecommendation) | ||
597 | { | ||
598 | this.PackageId = packageId; | ||
599 | this.FeatureId = featureId; | ||
600 | this.State = state; | ||
601 | } | ||
602 | |||
603 | /// <summary> | ||
604 | /// Gets the identity of the feature's package detected. | ||
605 | /// </summary> | ||
606 | public string PackageId { get; private set; } | ||
607 | |||
608 | /// <summary> | ||
609 | /// Gets the identity of the feature detected. | ||
610 | /// </summary> | ||
611 | public string FeatureId { get; private set; } | ||
612 | |||
613 | /// <summary> | ||
614 | /// Gets the detected feature state. | ||
615 | /// </summary> | ||
616 | public FeatureState State { get; private set; } | ||
617 | } | ||
618 | |||
619 | /// <summary> | ||
620 | /// Additional arguments for <see cref="IDefaultBootstrapperApplication.DetectPackageComplete"/>. | ||
621 | /// </summary> | ||
622 | [Serializable] | ||
623 | public class DetectPackageCompleteEventArgs : StatusEventArgs | ||
624 | { | ||
625 | /// <summary /> | ||
626 | public DetectPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state, bool cached) | ||
627 | : base(hrStatus) | ||
628 | { | ||
629 | this.PackageId = packageId; | ||
630 | this.State = state; | ||
631 | this.Cached = cached; | ||
632 | } | ||
633 | |||
634 | /// <summary> | ||
635 | /// Gets the identity of the package detected. | ||
636 | /// </summary> | ||
637 | public string PackageId { get; private set; } | ||
638 | |||
639 | /// <summary> | ||
640 | /// Gets the state of the specified package. | ||
641 | /// </summary> | ||
642 | public PackageState State { get; private set; } | ||
643 | |||
644 | /// <summary> | ||
645 | /// Gets whether any part of the package is cached. | ||
646 | /// </summary> | ||
647 | public bool Cached { get; private set; } | ||
648 | } | ||
649 | |||
650 | /// <summary> | ||
651 | /// Additional arguments used when the detection phase has completed. | ||
652 | /// </summary> | ||
653 | [Serializable] | ||
654 | public class DetectCompleteEventArgs : StatusEventArgs | ||
655 | { | ||
656 | /// <summary> | ||
657 | /// Creates a new instance of the <see cref="DetectCompleteEventArgs"/> class. | ||
658 | /// </summary> | ||
659 | /// <param name="hrStatus">The return code of the operation.</param> | ||
660 | /// <param name="eligibleForCleanup"></param> | ||
661 | public DetectCompleteEventArgs(int hrStatus, bool eligibleForCleanup) | ||
662 | : base(hrStatus) | ||
663 | { | ||
664 | this.EligibleForCleanup = eligibleForCleanup; | ||
665 | } | ||
666 | |||
667 | /// <summary> | ||
668 | /// Indicates whether the engine will uninstall the bundle if shutdown without running Apply. | ||
669 | /// </summary> | ||
670 | public bool EligibleForCleanup { get; private set; } | ||
671 | } | ||
672 | |||
673 | /// <summary> | ||
674 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanBegin"/> | ||
675 | /// </summary> | ||
676 | [Serializable] | ||
677 | public class PlanBeginEventArgs : CancellableHResultEventArgs | ||
678 | { | ||
679 | /// <summary /> | ||
680 | public PlanBeginEventArgs(int packageCount, bool cancelRecommendation) | ||
681 | : base(cancelRecommendation) | ||
682 | { | ||
683 | this.PackageCount = packageCount; | ||
684 | } | ||
685 | |||
686 | /// <summary> | ||
687 | /// Gets the number of packages to plan for. | ||
688 | /// </summary> | ||
689 | public int PackageCount { get; private set; } | ||
690 | } | ||
691 | |||
692 | /// <summary> | ||
693 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRelatedBundle"/> | ||
694 | /// </summary> | ||
695 | [Serializable] | ||
696 | public class PlanRelatedBundleEventArgs : CancellableHResultEventArgs | ||
697 | { | ||
698 | /// <summary /> | ||
699 | public PlanRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation) | ||
700 | : base(cancelRecommendation) | ||
701 | { | ||
702 | this.BundleId = bundleId; | ||
703 | this.RecommendedState = recommendedState; | ||
704 | this.State = state; | ||
705 | } | ||
706 | |||
707 | /// <summary> | ||
708 | /// Gets the identity of the bundle to plan for. | ||
709 | /// </summary> | ||
710 | public string BundleId { get; private set; } | ||
711 | |||
712 | /// <summary> | ||
713 | /// Gets the recommended requested state for the bundle. | ||
714 | /// </summary> | ||
715 | public RequestState RecommendedState { get; private set; } | ||
716 | |||
717 | /// <summary> | ||
718 | /// Gets or sets the requested state for the bundle. | ||
719 | /// </summary> | ||
720 | public RequestState State { get; set; } | ||
721 | } | ||
722 | |||
723 | /// <summary> | ||
724 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/> | ||
725 | /// </summary> | ||
726 | [Serializable] | ||
727 | public class PlanPackageBeginEventArgs : CancellableHResultEventArgs | ||
728 | { | ||
729 | /// <summary /> | ||
730 | public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool cached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, RequestState state, BOOTSTRAPPER_CACHE_TYPE cacheType, bool cancelRecommendation) | ||
731 | : base(cancelRecommendation) | ||
732 | { | ||
733 | this.PackageId = packageId; | ||
734 | this.CurrentState = currentState; | ||
735 | this.Cached = cached; | ||
736 | this.InstallCondition = installCondition; | ||
737 | this.RecommendedState = recommendedState; | ||
738 | this.RecommendedCacheType = recommendedCacheType; | ||
739 | this.State = state; | ||
740 | this.CacheType = cacheType; | ||
741 | } | ||
742 | |||
743 | /// <summary> | ||
744 | /// Gets the identity of the package to plan for. | ||
745 | /// </summary> | ||
746 | public string PackageId { get; private set; } | ||
747 | |||
748 | /// <summary> | ||
749 | /// Gets the current state of the package. | ||
750 | /// </summary> | ||
751 | public PackageState CurrentState { get; private set; } | ||
752 | |||
753 | /// <summary> | ||
754 | /// Gets whether any part of the package is cached. | ||
755 | /// </summary> | ||
756 | public bool Cached { get; private set; } | ||
757 | |||
758 | /// <summary> | ||
759 | /// Gets the evaluated result of the package's install condition. | ||
760 | /// </summary> | ||
761 | public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT InstallCondition { get; private set; } | ||
762 | |||
763 | /// <summary> | ||
764 | /// Gets the recommended requested state for the package. | ||
765 | /// </summary> | ||
766 | public RequestState RecommendedState { get; private set; } | ||
767 | |||
768 | /// <summary> | ||
769 | /// The authored cache type of the package. | ||
770 | /// </summary> | ||
771 | public BOOTSTRAPPER_CACHE_TYPE RecommendedCacheType { get; private set; } | ||
772 | |||
773 | /// <summary> | ||
774 | /// Gets or sets the requested state for the package. | ||
775 | /// </summary> | ||
776 | public RequestState State { get; set; } | ||
777 | |||
778 | /// <summary> | ||
779 | /// Gets or sets the requested cache type for the package. | ||
780 | /// </summary> | ||
781 | public BOOTSTRAPPER_CACHE_TYPE CacheType { get; set; } | ||
782 | } | ||
783 | |||
784 | /// <summary> | ||
785 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanPatchTarget"/> | ||
786 | /// </summary> | ||
787 | [Serializable] | ||
788 | public class PlanPatchTargetEventArgs : CancellableHResultEventArgs | ||
789 | { | ||
790 | /// <summary> | ||
791 | /// | ||
792 | /// </summary> | ||
793 | /// <param name="packageId"></param> | ||
794 | /// <param name="productCode"></param> | ||
795 | /// <param name="recommendedState"></param> | ||
796 | /// <param name="state"></param> | ||
797 | /// <param name="cancelRecommendation"></param> | ||
798 | public PlanPatchTargetEventArgs(string packageId, string productCode, RequestState recommendedState, RequestState state, bool cancelRecommendation) | ||
799 | : base(cancelRecommendation) | ||
800 | { | ||
801 | this.PackageId = packageId; | ||
802 | this.ProductCode = productCode; | ||
803 | this.RecommendedState = recommendedState; | ||
804 | this.State = state; | ||
805 | } | ||
806 | |||
807 | /// <summary> | ||
808 | /// Gets the identity of the patch's package. | ||
809 | /// </summary> | ||
810 | public string PackageId { get; private set; } | ||
811 | |||
812 | /// <summary> | ||
813 | /// Gets the product code of the target. | ||
814 | /// </summary> | ||
815 | public string ProductCode { get; private set; } | ||
816 | |||
817 | /// <summary> | ||
818 | /// Gets the recommended state of the patch to use by planning for the target. | ||
819 | /// </summary> | ||
820 | public RequestState RecommendedState { get; private set; } | ||
821 | |||
822 | /// <summary> | ||
823 | /// Gets or sets the state of the patch to use by planning for the target. | ||
824 | /// </summary> | ||
825 | public RequestState State { get; set; } | ||
826 | } | ||
827 | |||
828 | /// <summary> | ||
829 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanMsiFeature"/> | ||
830 | /// </summary> | ||
831 | [Serializable] | ||
832 | public class PlanMsiFeatureEventArgs : CancellableHResultEventArgs | ||
833 | { | ||
834 | /// <summary /> | ||
835 | public PlanMsiFeatureEventArgs(string packageId, string featureId, FeatureState recommendedState, FeatureState state, bool cancelRecommendation) | ||
836 | : base(cancelRecommendation) | ||
837 | { | ||
838 | this.PackageId = packageId; | ||
839 | this.FeatureId = featureId; | ||
840 | this.RecommendedState = recommendedState; | ||
841 | this.State = state; | ||
842 | } | ||
843 | |||
844 | /// <summary> | ||
845 | /// Gets the identity of the feature's package to plan. | ||
846 | /// </summary> | ||
847 | public string PackageId { get; private set; } | ||
848 | |||
849 | /// <summary> | ||
850 | /// Gets the identity of the feature to plan. | ||
851 | /// </summary> | ||
852 | public string FeatureId { get; private set; } | ||
853 | |||
854 | /// <summary> | ||
855 | /// Gets the recommended feature state to use by planning. | ||
856 | /// </summary> | ||
857 | public FeatureState RecommendedState { get; private set; } | ||
858 | |||
859 | /// <summary> | ||
860 | /// Gets or sets the feature state to use by planning. | ||
861 | /// </summary> | ||
862 | public FeatureState State { get; set; } | ||
863 | } | ||
864 | |||
865 | /// <summary> | ||
866 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanMsiPackage"/> | ||
867 | /// </summary> | ||
868 | [Serializable] | ||
869 | public class PlanMsiPackageEventArgs : CancellableHResultEventArgs | ||
870 | { | ||
871 | /// <summary /> | ||
872 | public PlanMsiPackageEventArgs(string packageId, bool shouldExecute, ActionState action, bool cancelRecommendation, BURN_MSI_PROPERTY actionMsiProperty, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler) | ||
873 | : base(cancelRecommendation) | ||
874 | { | ||
875 | this.PackageId = packageId; | ||
876 | this.ShouldExecute = shouldExecute; | ||
877 | this.Action = action; | ||
878 | this.ActionMsiProperty = actionMsiProperty; | ||
879 | this.UiLevel = uiLevel; | ||
880 | this.DisableExternalUiHandler = disableExternalUiHandler; | ||
881 | } | ||
882 | |||
883 | /// <summary> | ||
884 | /// Gets identity of the package planned for. | ||
885 | /// </summary> | ||
886 | public string PackageId { get; private set; } | ||
887 | |||
888 | /// <summary> | ||
889 | /// Gets whether the package is planned to execute or roll back. | ||
890 | /// </summary> | ||
891 | public bool ShouldExecute { get; private set; } | ||
892 | |||
893 | /// <summary> | ||
894 | /// Gets the action planned for the package. | ||
895 | /// </summary> | ||
896 | public ActionState Action { get; private set; } | ||
897 | |||
898 | /// <summary> | ||
899 | /// Gets or sets the requested MSI property to add. | ||
900 | /// </summary> | ||
901 | public BURN_MSI_PROPERTY ActionMsiProperty { get; set; } | ||
902 | |||
903 | /// <summary> | ||
904 | /// Gets or sets the requested internal UI level. | ||
905 | /// </summary> | ||
906 | public INSTALLUILEVEL UiLevel { get; set; } | ||
907 | |||
908 | /// <summary> | ||
909 | /// Gets or sets whether Burn is requested to set up an external UI handler. | ||
910 | /// </summary> | ||
911 | public bool DisableExternalUiHandler { get; set; } | ||
912 | } | ||
913 | |||
914 | /// <summary> | ||
915 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanPackageComplete"/> | ||
916 | /// </summary> | ||
917 | [Serializable] | ||
918 | public class PlanPackageCompleteEventArgs : StatusEventArgs | ||
919 | { | ||
920 | /// <summary> | ||
921 | /// | ||
922 | /// </summary> | ||
923 | /// <param name="packageId"></param> | ||
924 | /// <param name="hrStatus"></param> | ||
925 | /// <param name="requested"></param> | ||
926 | public PlanPackageCompleteEventArgs(string packageId, int hrStatus, RequestState requested) | ||
927 | : base(hrStatus) | ||
928 | { | ||
929 | this.PackageId = packageId; | ||
930 | this.Requested = requested; | ||
931 | } | ||
932 | |||
933 | /// <summary> | ||
934 | /// Gets the identity of the package planned for. | ||
935 | /// </summary> | ||
936 | public string PackageId { get; private set; } | ||
937 | |||
938 | /// <summary> | ||
939 | /// Gets the requested state for the package. | ||
940 | /// </summary> | ||
941 | public RequestState Requested { get; private set; } | ||
942 | } | ||
943 | |||
944 | /// <summary> | ||
945 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlannedPackage"/> | ||
946 | /// </summary> | ||
947 | [Serializable] | ||
948 | public class PlannedPackageEventArgs : HResultEventArgs | ||
949 | { | ||
950 | /// <summary /> | ||
951 | public PlannedPackageEventArgs(string packageId, ActionState execute, ActionState rollback, bool cache, bool uncache) | ||
952 | { | ||
953 | this.PackageId = packageId; | ||
954 | this.Execute = execute; | ||
955 | this.Rollback = rollback; | ||
956 | this.Cache = cache; | ||
957 | this.Uncache = uncache; | ||
958 | } | ||
959 | |||
960 | /// <summary> | ||
961 | /// Gets the identity of the package planned for. | ||
962 | /// </summary> | ||
963 | public string PackageId { get; private set; } | ||
964 | |||
965 | /// <summary> | ||
966 | /// Gets the planned execution action. | ||
967 | /// </summary> | ||
968 | public ActionState Execute { get; private set; } | ||
969 | |||
970 | /// <summary> | ||
971 | /// Gets the planned rollback action. | ||
972 | /// </summary> | ||
973 | public ActionState Rollback { get; private set; } | ||
974 | |||
975 | /// <summary> | ||
976 | /// Gets whether the package will be cached. | ||
977 | /// </summary> | ||
978 | public bool Cache { get; private set; } | ||
979 | |||
980 | /// <summary> | ||
981 | /// Gets whether the package will be removed from the package cache. | ||
982 | /// </summary> | ||
983 | public bool Uncache { get; private set; } | ||
984 | } | ||
985 | |||
986 | /// <summary> | ||
987 | /// Additional arguments used when the engine has completed planning the installation. | ||
988 | /// </summary> | ||
989 | [Serializable] | ||
990 | public class PlanCompleteEventArgs : StatusEventArgs | ||
991 | { | ||
992 | /// <summary> | ||
993 | /// Creates a new instance of the <see cref="PlanCompleteEventArgs"/> class. | ||
994 | /// </summary> | ||
995 | /// <param name="hrStatus">The return code of the operation.</param> | ||
996 | public PlanCompleteEventArgs(int hrStatus) | ||
997 | : base(hrStatus) | ||
998 | { | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | /// <summary> | ||
1003 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanForwardCompatibleBundle"/> | ||
1004 | /// </summary> | ||
1005 | [Serializable] | ||
1006 | public class PlanForwardCompatibleBundleEventArgs : CancellableHResultEventArgs | ||
1007 | { | ||
1008 | /// <summary /> | ||
1009 | public PlanForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool recommendedIgnoreBundle, bool cancelRecommendation, bool ignoreBundle) | ||
1010 | : base(cancelRecommendation) | ||
1011 | { | ||
1012 | this.BundleId = bundleId; | ||
1013 | this.RelationType = relationType; | ||
1014 | this.BundleTag = bundleTag; | ||
1015 | this.PerMachine = perMachine; | ||
1016 | this.Version = version; | ||
1017 | this.RecommendedIgnoreBundle = recommendedIgnoreBundle; | ||
1018 | this.IgnoreBundle = ignoreBundle; | ||
1019 | } | ||
1020 | |||
1021 | /// <summary> | ||
1022 | /// Gets the identity of the forward compatible bundle detected. | ||
1023 | /// </summary> | ||
1024 | public string BundleId { get; private set; } | ||
1025 | |||
1026 | /// <summary> | ||
1027 | /// Gets the relationship type of the forward compatible bundle. | ||
1028 | /// </summary> | ||
1029 | public RelationType RelationType { get; private set; } | ||
1030 | |||
1031 | /// <summary> | ||
1032 | /// Gets the tag of the forward compatible bundle. | ||
1033 | /// </summary> | ||
1034 | public string BundleTag { get; private set; } | ||
1035 | |||
1036 | /// <summary> | ||
1037 | /// Gets whether the forward compatible bundle is per machine. | ||
1038 | /// </summary> | ||
1039 | public bool PerMachine { get; private set; } | ||
1040 | |||
1041 | /// <summary> | ||
1042 | /// Gets the version of the forward compatible bundle. | ||
1043 | /// </summary> | ||
1044 | public string Version { get; private set; } | ||
1045 | |||
1046 | /// <summary> | ||
1047 | /// Gets the recommendation of whether the engine should use the forward compatible bundle. | ||
1048 | /// </summary> | ||
1049 | public bool RecommendedIgnoreBundle { get; set; } | ||
1050 | |||
1051 | /// <summary> | ||
1052 | /// Gets or sets whether the engine will use the forward compatible bundle. | ||
1053 | /// </summary> | ||
1054 | public bool IgnoreBundle { get; set; } | ||
1055 | } | ||
1056 | |||
1057 | /// <summary> | ||
1058 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ApplyBegin"/> | ||
1059 | /// </summary> | ||
1060 | [Serializable] | ||
1061 | public class ApplyBeginEventArgs : CancellableHResultEventArgs | ||
1062 | { | ||
1063 | /// <summary /> | ||
1064 | public ApplyBeginEventArgs(int phaseCount, bool cancelRecommendation) | ||
1065 | : base(cancelRecommendation) | ||
1066 | { | ||
1067 | this.PhaseCount = phaseCount; | ||
1068 | } | ||
1069 | |||
1070 | /// <summary> | ||
1071 | /// Gets the number of phases that the engine will go through in apply. | ||
1072 | /// There are currently two possible phases: cache and execute. | ||
1073 | /// </summary> | ||
1074 | public int PhaseCount { get; private set; } | ||
1075 | } | ||
1076 | |||
1077 | /// <summary> | ||
1078 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ElevateBegin"/> | ||
1079 | /// </summary> | ||
1080 | [Serializable] | ||
1081 | public class ElevateBeginEventArgs : CancellableHResultEventArgs | ||
1082 | { | ||
1083 | /// <summary /> | ||
1084 | public ElevateBeginEventArgs(bool cancelRecommendation) | ||
1085 | : base(cancelRecommendation) | ||
1086 | { | ||
1087 | } | ||
1088 | } | ||
1089 | |||
1090 | /// <summary> | ||
1091 | /// Additional arguments used when the engine has completed starting the elevated process. | ||
1092 | /// </summary> | ||
1093 | [Serializable] | ||
1094 | public class ElevateCompleteEventArgs : StatusEventArgs | ||
1095 | { | ||
1096 | /// <summary> | ||
1097 | /// Creates a new instance of the <see cref="ElevateCompleteEventArgs"/> class. | ||
1098 | /// </summary> | ||
1099 | /// <param name="hrStatus">The return code of the operation.</param> | ||
1100 | public ElevateCompleteEventArgs(int hrStatus) | ||
1101 | : base(hrStatus) | ||
1102 | { | ||
1103 | } | ||
1104 | } | ||
1105 | |||
1106 | /// <summary> | ||
1107 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Progress"/> | ||
1108 | /// </summary> | ||
1109 | [Serializable] | ||
1110 | public class ProgressEventArgs : CancellableHResultEventArgs | ||
1111 | { | ||
1112 | /// <summary /> | ||
1113 | public ProgressEventArgs(int progressPercentage, int overallPercentage, bool cancelRecommendation) | ||
1114 | : base(cancelRecommendation) | ||
1115 | { | ||
1116 | this.ProgressPercentage = progressPercentage; | ||
1117 | this.OverallPercentage = overallPercentage; | ||
1118 | } | ||
1119 | |||
1120 | /// <summary> | ||
1121 | /// Gets the percentage from 0 to 100 completed for a package. | ||
1122 | /// </summary> | ||
1123 | public int ProgressPercentage { get; private set; } | ||
1124 | |||
1125 | /// <summary> | ||
1126 | /// Gets the percentage from 0 to 100 completed for the bundle. | ||
1127 | /// </summary> | ||
1128 | public int OverallPercentage { get; private set; } | ||
1129 | } | ||
1130 | |||
1131 | /// <summary> | ||
1132 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Error"/> | ||
1133 | /// </summary> | ||
1134 | [Serializable] | ||
1135 | public class ErrorEventArgs : ResultEventArgs | ||
1136 | { | ||
1137 | /// <summary /> | ||
1138 | public ErrorEventArgs(ErrorType errorType, string packageId, int errorCode, string errorMessage, int dwUIHint, string[] data, Result recommendation, Result result) | ||
1139 | : base(recommendation, result) | ||
1140 | { | ||
1141 | this.ErrorType = errorType; | ||
1142 | this.PackageId = packageId; | ||
1143 | this.ErrorCode = errorCode; | ||
1144 | this.ErrorMessage = errorMessage; | ||
1145 | this.UIHint = dwUIHint; | ||
1146 | this.Data = new ReadOnlyCollection<string>(data ?? new string[] { }); | ||
1147 | } | ||
1148 | |||
1149 | /// <summary> | ||
1150 | /// Gets the type of error that occurred. | ||
1151 | /// </summary> | ||
1152 | public ErrorType ErrorType { get; private set; } | ||
1153 | |||
1154 | /// <summary> | ||
1155 | /// Gets the identity of the package that yielded the error. | ||
1156 | /// </summary> | ||
1157 | public string PackageId { get; private set; } | ||
1158 | |||
1159 | /// <summary> | ||
1160 | /// Gets the error code. | ||
1161 | /// </summary> | ||
1162 | public int ErrorCode { get; private set; } | ||
1163 | |||
1164 | /// <summary> | ||
1165 | /// Gets the error message. | ||
1166 | /// </summary> | ||
1167 | public string ErrorMessage { get; private set; } | ||
1168 | |||
1169 | /// <summary> | ||
1170 | /// Gets the recommended display flags for an error dialog. | ||
1171 | /// </summary> | ||
1172 | public int UIHint { get; private set; } | ||
1173 | |||
1174 | /// <summary> | ||
1175 | /// Gets the extended data for the error. | ||
1176 | /// </summary> | ||
1177 | public IList<string> Data { get; private set; } | ||
1178 | } | ||
1179 | |||
1180 | /// <summary> | ||
1181 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.RegisterBegin"/> | ||
1182 | /// </summary> | ||
1183 | [Serializable] | ||
1184 | public class RegisterBeginEventArgs : CancellableHResultEventArgs | ||
1185 | { | ||
1186 | /// <summary /> | ||
1187 | public RegisterBeginEventArgs(bool cancelRecommendation) | ||
1188 | : base(cancelRecommendation) | ||
1189 | { | ||
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | /// <summary> | ||
1194 | /// Additional arguments used when the engine has completed registering the location and visilibity of the bundle. | ||
1195 | /// </summary> | ||
1196 | [Serializable] | ||
1197 | public class RegisterCompleteEventArgs : StatusEventArgs | ||
1198 | { | ||
1199 | /// <summary> | ||
1200 | /// Creates a new instance of the <see cref="RegisterCompleteEventArgs"/> class. | ||
1201 | /// </summary> | ||
1202 | /// <param name="hrStatus">The return code of the operation.</param> | ||
1203 | public RegisterCompleteEventArgs(int hrStatus) | ||
1204 | : base(hrStatus) | ||
1205 | { | ||
1206 | } | ||
1207 | } | ||
1208 | |||
1209 | /// <summary> | ||
1210 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.UnregisterBegin"/> | ||
1211 | /// </summary> | ||
1212 | [Serializable] | ||
1213 | public class UnregisterBeginEventArgs : HResultEventArgs | ||
1214 | { | ||
1215 | /// <summary> | ||
1216 | /// | ||
1217 | /// </summary> | ||
1218 | /// <param name="keepRegistration"></param> | ||
1219 | /// <param name="forceKeepRegistration"></param> | ||
1220 | public UnregisterBeginEventArgs(bool keepRegistration, bool forceKeepRegistration) | ||
1221 | { | ||
1222 | this.KeepRegistration = keepRegistration; | ||
1223 | this.ForceKeepRegistration = forceKeepRegistration; | ||
1224 | } | ||
1225 | |||
1226 | /// <summary> | ||
1227 | /// Indicates whether the engine will uninstall the bundle. | ||
1228 | /// </summary> | ||
1229 | public bool ForceKeepRegistration { get; set; } | ||
1230 | |||
1231 | /// <summary> | ||
1232 | /// If <see cref="KeepRegistration"/> is FALSE, then this can be set to TRUE to make the engine keep the bundle installed. | ||
1233 | /// </summary> | ||
1234 | public bool KeepRegistration { get; private set; } | ||
1235 | } | ||
1236 | |||
1237 | /// <summary> | ||
1238 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.UnregisterComplete"/> | ||
1239 | /// </summary> | ||
1240 | [Serializable] | ||
1241 | public class UnregisterCompleteEventArgs : StatusEventArgs | ||
1242 | { | ||
1243 | /// <summary> | ||
1244 | /// | ||
1245 | /// </summary> | ||
1246 | /// <param name="hrStatus"></param> | ||
1247 | public UnregisterCompleteEventArgs(int hrStatus) | ||
1248 | : base(hrStatus) | ||
1249 | { | ||
1250 | } | ||
1251 | } | ||
1252 | |||
1253 | /// <summary> | ||
1254 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CacheBegin"/> | ||
1255 | /// </summary> | ||
1256 | [Serializable] | ||
1257 | public class CacheBeginEventArgs : CancellableHResultEventArgs | ||
1258 | { | ||
1259 | /// <summary /> | ||
1260 | public CacheBeginEventArgs(bool cancelRecommendation) | ||
1261 | : base(cancelRecommendation) | ||
1262 | { | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | /// <summary> | ||
1267 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireBegin"/>. | ||
1268 | /// </summary> | ||
1269 | [Serializable] | ||
1270 | public class CacheAcquireBeginEventArgs : CancellableActionEventArgs<CacheOperation> | ||
1271 | { | ||
1272 | /// <summary /> | ||
1273 | public CacheAcquireBeginEventArgs(string packageOrContainerId, string payloadId, string source, string downloadUrl, string payloadContainerId, CacheOperation recommendation, CacheOperation action, bool cancelRecommendation) | ||
1274 | : base(cancelRecommendation, recommendation, action) | ||
1275 | { | ||
1276 | this.PackageOrContainerId = packageOrContainerId; | ||
1277 | this.PayloadId = payloadId; | ||
1278 | this.Source = source; | ||
1279 | this.DownloadUrl = downloadUrl; | ||
1280 | this.PayloadContainerId = payloadContainerId; | ||
1281 | } | ||
1282 | |||
1283 | /// <summary> | ||
1284 | /// Gets the identifier of the container or package. | ||
1285 | /// </summary> | ||
1286 | public string PackageOrContainerId { get; private set; } | ||
1287 | |||
1288 | /// <summary> | ||
1289 | /// Gets the identifier of the payload (if acquiring a payload). | ||
1290 | /// </summary> | ||
1291 | public string PayloadId { get; private set; } | ||
1292 | |||
1293 | /// <summary> | ||
1294 | /// Gets the source of the container or payload. | ||
1295 | /// </summary> | ||
1296 | public string Source { get; private set; } | ||
1297 | |||
1298 | /// <summary> | ||
1299 | /// Gets the optional URL to download container or payload. | ||
1300 | /// </summary> | ||
1301 | public string DownloadUrl { get; private set; } | ||
1302 | |||
1303 | /// <summary> | ||
1304 | /// Gets the optional identity of the container that contains the payload being acquired. | ||
1305 | /// </summary> | ||
1306 | public string PayloadContainerId { get; private set; } | ||
1307 | } | ||
1308 | |||
1309 | /// <summary> | ||
1310 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireProgress"/>. | ||
1311 | /// </summary> | ||
1312 | [Serializable] | ||
1313 | public class CacheAcquireProgressEventArgs : CacheProgressBaseEventArgs | ||
1314 | { | ||
1315 | /// <summary /> | ||
1316 | public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) | ||
1317 | : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) | ||
1318 | { | ||
1319 | } | ||
1320 | } | ||
1321 | |||
1322 | /// <summary> | ||
1323 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. | ||
1324 | /// </summary> | ||
1325 | [Serializable] | ||
1326 | public class CacheAcquireCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION> | ||
1327 | { | ||
1328 | /// <summary /> | ||
1329 | public CacheAcquireCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action) | ||
1330 | : base(hrStatus, recommendation, action) | ||
1331 | { | ||
1332 | this.PackageOrContainerId = packageOrContainerId; | ||
1333 | this.PayloadId = payloadId; | ||
1334 | } | ||
1335 | |||
1336 | /// <summary> | ||
1337 | /// Gets the identifier of the container or package. | ||
1338 | /// </summary> | ||
1339 | public string PackageOrContainerId { get; private set; } | ||
1340 | |||
1341 | /// <summary> | ||
1342 | /// Gets the identifier of the payload (if acquiring a payload). | ||
1343 | /// </summary> | ||
1344 | public string PayloadId { get; private set; } | ||
1345 | } | ||
1346 | |||
1347 | /// <summary> | ||
1348 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheVerifyBegin"/>. | ||
1349 | /// </summary> | ||
1350 | [Serializable] | ||
1351 | public class CacheVerifyBeginEventArgs : CancellableHResultEventArgs | ||
1352 | { | ||
1353 | /// <summary /> | ||
1354 | public CacheVerifyBeginEventArgs(string packageOrContainerId, string payloadId, bool cancelRecommendation) | ||
1355 | : base(cancelRecommendation) | ||
1356 | { | ||
1357 | this.PackageOrContainerId = packageOrContainerId; | ||
1358 | this.PayloadId = payloadId; | ||
1359 | } | ||
1360 | |||
1361 | /// <summary> | ||
1362 | /// Gets the identifier of the container or package. | ||
1363 | /// </summary> | ||
1364 | public string PackageOrContainerId { get; private set; } | ||
1365 | |||
1366 | /// <summary> | ||
1367 | /// Gets the identifier of the payload. | ||
1368 | /// </summary> | ||
1369 | public string PayloadId { get; private set; } | ||
1370 | } | ||
1371 | |||
1372 | /// <summary> | ||
1373 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheVerifyProgress"/>. | ||
1374 | /// </summary> | ||
1375 | [Serializable] | ||
1376 | public class CacheVerifyProgressEventArgs : CacheProgressBaseEventArgs | ||
1377 | { | ||
1378 | /// <summary /> | ||
1379 | public CacheVerifyProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, CacheVerifyStep verifyStep, bool cancelRecommendation) | ||
1380 | : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) | ||
1381 | { | ||
1382 | this.Step = verifyStep; | ||
1383 | } | ||
1384 | |||
1385 | /// <summary> | ||
1386 | /// Gets the current verification step. | ||
1387 | /// </summary> | ||
1388 | public CacheVerifyStep Step { get; private set; } | ||
1389 | } | ||
1390 | |||
1391 | /// <summary> | ||
1392 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CacheVerifyComplete"/> | ||
1393 | /// </summary> | ||
1394 | [Serializable] | ||
1395 | public class CacheVerifyCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION> | ||
1396 | { | ||
1397 | /// <summary /> | ||
1398 | public CacheVerifyCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) | ||
1399 | : base(hrStatus, recommendation, action) | ||
1400 | { | ||
1401 | this.PackageOrContainerId = packageOrContainerId; | ||
1402 | this.PayloadId = payloadId; | ||
1403 | } | ||
1404 | |||
1405 | /// <summary> | ||
1406 | /// Gets the identifier of the container or package. | ||
1407 | /// </summary> | ||
1408 | public string PackageOrContainerId { get; private set; } | ||
1409 | |||
1410 | /// <summary> | ||
1411 | /// Gets the identifier of the payload. | ||
1412 | /// </summary> | ||
1413 | public string PayloadId { get; private set; } | ||
1414 | } | ||
1415 | |||
1416 | /// <summary> | ||
1417 | /// Additional arguments used after the engine has cached the installation sources. | ||
1418 | /// </summary> | ||
1419 | [Serializable] | ||
1420 | public class CacheCompleteEventArgs : StatusEventArgs | ||
1421 | { | ||
1422 | /// <summary> | ||
1423 | /// Creates a new instance of the <see cref="CacheCompleteEventArgs"/> class. | ||
1424 | /// </summary> | ||
1425 | /// <param name="hrStatus">The return code of the operation.</param> | ||
1426 | public CacheCompleteEventArgs(int hrStatus) | ||
1427 | : base(hrStatus) | ||
1428 | { | ||
1429 | } | ||
1430 | } | ||
1431 | |||
1432 | /// <summary> | ||
1433 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecuteBegin"/> | ||
1434 | /// </summary> | ||
1435 | [Serializable] | ||
1436 | public class ExecuteBeginEventArgs : CancellableHResultEventArgs | ||
1437 | { | ||
1438 | /// <summary /> | ||
1439 | public ExecuteBeginEventArgs(int packageCount, bool cancelRecommendation) | ||
1440 | : base(cancelRecommendation) | ||
1441 | { | ||
1442 | this.PackageCount = packageCount; | ||
1443 | } | ||
1444 | |||
1445 | /// <summary> | ||
1446 | /// Gets the number of packages to act on. | ||
1447 | /// </summary> | ||
1448 | public int PackageCount { get; private set; } | ||
1449 | } | ||
1450 | |||
1451 | /// <summary> | ||
1452 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecutePackageBegin"/> | ||
1453 | /// </summary> | ||
1454 | [Serializable] | ||
1455 | public class ExecutePackageBeginEventArgs : CancellableHResultEventArgs | ||
1456 | { | ||
1457 | /// <summary /> | ||
1458 | public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler, bool cancelRecommendation) | ||
1459 | : base(cancelRecommendation) | ||
1460 | { | ||
1461 | this.PackageId = packageId; | ||
1462 | this.ShouldExecute = shouldExecute; | ||
1463 | this.Action = action; | ||
1464 | this.UiLevel = uiLevel; | ||
1465 | this.DisableExternalUiHandler = disableExternalUiHandler; | ||
1466 | } | ||
1467 | |||
1468 | /// <summary> | ||
1469 | /// Gets the identity of the package to act on. | ||
1470 | /// </summary> | ||
1471 | public string PackageId { get; private set; } | ||
1472 | |||
1473 | /// <summary> | ||
1474 | /// Gets whether the package is being executed or rolled back. | ||
1475 | /// </summary> | ||
1476 | public bool ShouldExecute { get; private set; } | ||
1477 | |||
1478 | /// <summary> | ||
1479 | /// Gets the action about to be executed. | ||
1480 | /// </summary> | ||
1481 | public ActionState Action { get; private set; } | ||
1482 | |||
1483 | /// <summary> | ||
1484 | /// Gets the internal UI level (if this is an MSI or MSP package). | ||
1485 | /// </summary> | ||
1486 | public INSTALLUILEVEL UiLevel { get; private set; } | ||
1487 | |||
1488 | /// <summary> | ||
1489 | /// Gets whether Burn will set up an external UI handler (if this is an MSI or MSP package). | ||
1490 | /// </summary> | ||
1491 | public bool DisableExternalUiHandler { get; private set; } | ||
1492 | } | ||
1493 | |||
1494 | /// <summary> | ||
1495 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecutePatchTarget"/> | ||
1496 | /// </summary> | ||
1497 | [Serializable] | ||
1498 | public class ExecutePatchTargetEventArgs : CancellableHResultEventArgs | ||
1499 | { | ||
1500 | /// <summary /> | ||
1501 | public ExecutePatchTargetEventArgs(string packageId, string targetProductCode, bool cancelRecommendation) | ||
1502 | : base(cancelRecommendation) | ||
1503 | { | ||
1504 | this.PackageId = packageId; | ||
1505 | this.TargetProductCode = targetProductCode; | ||
1506 | } | ||
1507 | |||
1508 | /// <summary> | ||
1509 | /// Gets the identity of the package to act on. | ||
1510 | /// </summary> | ||
1511 | public string PackageId { get; private set; } | ||
1512 | |||
1513 | /// <summary> | ||
1514 | /// Gets the product code being targeted. | ||
1515 | /// </summary> | ||
1516 | public string TargetProductCode { get; private set; } | ||
1517 | } | ||
1518 | |||
1519 | /// <summary> | ||
1520 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecuteMsiMessage"/> | ||
1521 | /// </summary> | ||
1522 | [Serializable] | ||
1523 | public class ExecuteMsiMessageEventArgs : ResultEventArgs | ||
1524 | { | ||
1525 | /// <summary /> | ||
1526 | public ExecuteMsiMessageEventArgs(string packageId, InstallMessage messageType, int dwUIHint, string message, string[] data, Result recommendation, Result result) | ||
1527 | : base(recommendation, result) | ||
1528 | { | ||
1529 | this.PackageId = packageId; | ||
1530 | this.MessageType = messageType; | ||
1531 | this.UIHint = dwUIHint; | ||
1532 | this.Message = message; | ||
1533 | this.Data = new ReadOnlyCollection<string>(data ?? new string[] { }); | ||
1534 | } | ||
1535 | |||
1536 | /// <summary> | ||
1537 | /// Gets the identity of the package that yielded this message. | ||
1538 | /// </summary> | ||
1539 | public string PackageId { get; private set; } | ||
1540 | |||
1541 | /// <summary> | ||
1542 | /// Gets the type of this message. | ||
1543 | /// </summary> | ||
1544 | public InstallMessage MessageType { get; private set; } | ||
1545 | |||
1546 | /// <summary> | ||
1547 | /// Gets the recommended display flags for this message. | ||
1548 | /// </summary> | ||
1549 | public int UIHint { get; private set; } | ||
1550 | |||
1551 | /// <summary> | ||
1552 | /// Gets the message. | ||
1553 | /// </summary> | ||
1554 | public string Message { get; private set; } | ||
1555 | |||
1556 | /// <summary> | ||
1557 | /// Gets the extended data for the message. | ||
1558 | /// </summary> | ||
1559 | public IList<string> Data { get; private set; } | ||
1560 | } | ||
1561 | |||
1562 | /// <summary> | ||
1563 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecuteFilesInUse"/> | ||
1564 | /// </summary> | ||
1565 | [Serializable] | ||
1566 | public class ExecuteFilesInUseEventArgs : ResultEventArgs | ||
1567 | { | ||
1568 | /// <summary /> | ||
1569 | public ExecuteFilesInUseEventArgs(string packageId, string[] files, Result recommendation, Result result) | ||
1570 | : base(recommendation, result) | ||
1571 | { | ||
1572 | this.PackageId = packageId; | ||
1573 | this.Files = new ReadOnlyCollection<string>(files ?? new string[] { }); | ||
1574 | } | ||
1575 | |||
1576 | /// <summary> | ||
1577 | /// Gets the identity of the package that yielded the files in use message. | ||
1578 | /// </summary> | ||
1579 | public string PackageId { get; private set; } | ||
1580 | |||
1581 | /// <summary> | ||
1582 | /// Gets the list of files in use. | ||
1583 | /// </summary> | ||
1584 | public IList<string> Files { get; private set; } | ||
1585 | } | ||
1586 | |||
1587 | /// <summary> | ||
1588 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecutePackageComplete"/> | ||
1589 | /// Additional arguments used when the engine has completed installing a specific package. | ||
1590 | /// </summary> | ||
1591 | [Serializable] | ||
1592 | public class ExecutePackageCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION> | ||
1593 | { | ||
1594 | /// <summary /> | ||
1595 | public ExecutePackageCompleteEventArgs(string packageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action) | ||
1596 | : base(hrStatus, recommendation, action) | ||
1597 | { | ||
1598 | this.PackageId = packageId; | ||
1599 | this.Restart = restart; | ||
1600 | } | ||
1601 | |||
1602 | /// <summary> | ||
1603 | /// Gets the identity of the package that was acted on. | ||
1604 | /// </summary> | ||
1605 | public string PackageId { get; private set; } | ||
1606 | |||
1607 | /// <summary> | ||
1608 | /// Gets the package restart state after being applied. | ||
1609 | /// </summary> | ||
1610 | public ApplyRestart Restart { get; private set; } | ||
1611 | } | ||
1612 | |||
1613 | /// <summary> | ||
1614 | /// Additional arguments used when the engine has completed installing packages. | ||
1615 | /// </summary> | ||
1616 | [Serializable] | ||
1617 | public class ExecuteCompleteEventArgs : StatusEventArgs | ||
1618 | { | ||
1619 | /// <summary> | ||
1620 | /// Creates a new instance of the <see cref="ExecuteCompleteEventArgs"/> class. | ||
1621 | /// </summary> | ||
1622 | /// <param name="hrStatus">The return code of the operation.</param> | ||
1623 | public ExecuteCompleteEventArgs(int hrStatus) | ||
1624 | : base(hrStatus) | ||
1625 | { | ||
1626 | } | ||
1627 | } | ||
1628 | |||
1629 | /// <summary> | ||
1630 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ApplyComplete"/> | ||
1631 | /// </summary> | ||
1632 | [Serializable] | ||
1633 | public class ApplyCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_APPLYCOMPLETE_ACTION> | ||
1634 | { | ||
1635 | /// <summary /> | ||
1636 | public ApplyCompleteEventArgs(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_APPLYCOMPLETE_ACTION action) | ||
1637 | : base(hrStatus, recommendation, action) | ||
1638 | { | ||
1639 | this.Restart = restart; | ||
1640 | } | ||
1641 | |||
1642 | /// <summary> | ||
1643 | /// Gets the apply restart state when complete. | ||
1644 | /// </summary> | ||
1645 | public ApplyRestart Restart { get; private set; } | ||
1646 | } | ||
1647 | |||
1648 | /// <summary> | ||
1649 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. | ||
1650 | /// </summary> | ||
1651 | [Serializable] | ||
1652 | public class CacheAcquireResolvingEventArgs : CancellableActionEventArgs<CacheResolveOperation> | ||
1653 | { | ||
1654 | /// <summary /> | ||
1655 | public CacheAcquireResolvingEventArgs(string packageOrContainerId, string payloadId, string[] searchPaths, bool foundLocal, int recommendedSearchPath, string downloadUrl, string payloadContainerId, CacheResolveOperation recommendation, int chosenSearchPath, CacheResolveOperation action, bool cancel) | ||
1656 | : base(cancel, recommendation, action) | ||
1657 | { | ||
1658 | this.PackageOrContainerId = packageOrContainerId; | ||
1659 | this.PayloadId = payloadId; | ||
1660 | this.SearchPaths = searchPaths; | ||
1661 | this.FoundLocal = foundLocal; | ||
1662 | this.RecommendedSearchPath = recommendedSearchPath; | ||
1663 | this.DownloadUrl = downloadUrl; | ||
1664 | this.PayloadContainerId = payloadContainerId; | ||
1665 | this.ChosenSearchPath = chosenSearchPath; | ||
1666 | } | ||
1667 | |||
1668 | /// <summary> | ||
1669 | /// Gets the identity of the package or container that is being acquired. | ||
1670 | /// </summary> | ||
1671 | public string PackageOrContainerId { get; private set; } | ||
1672 | |||
1673 | /// <summary> | ||
1674 | /// Gets the identity of the payload that is being acquired. | ||
1675 | /// </summary> | ||
1676 | public string PayloadId { get; private set; } | ||
1677 | |||
1678 | /// <summary> | ||
1679 | /// Gets the search paths used for source resolution. | ||
1680 | /// </summary> | ||
1681 | public string[] SearchPaths { get; private set; } | ||
1682 | |||
1683 | /// <summary> | ||
1684 | /// Gets whether <see cref="RecommendedSearchPath"/> indicates that a file was found at that search path. | ||
1685 | /// </summary> | ||
1686 | public bool FoundLocal { get; private set; } | ||
1687 | |||
1688 | /// <summary> | ||
1689 | /// When <see cref="FoundLocal"/> is true, the index to <see cref="SearchPaths"/> for the recommended local file. | ||
1690 | /// </summary> | ||
1691 | public int RecommendedSearchPath { get; private set; } | ||
1692 | |||
1693 | /// <summary> | ||
1694 | /// Gets the optional URL to download container or payload. | ||
1695 | /// </summary> | ||
1696 | public string DownloadUrl { get; private set; } | ||
1697 | |||
1698 | /// <summary> | ||
1699 | /// Gets the optional identity of the container that contains the payload being acquired. | ||
1700 | /// </summary> | ||
1701 | public string PayloadContainerId { get; private set; } | ||
1702 | |||
1703 | /// <summary> | ||
1704 | /// Gets or sets the index to <see cref="SearchPaths"/> to use when <see cref="CancellableActionEventArgs{T}.Action"/> is set to <see cref="CacheOperation.Copy"/>. | ||
1705 | /// </summary> | ||
1706 | public int ChosenSearchPath { get; set; } | ||
1707 | } | ||
1708 | |||
1709 | /// <summary> | ||
1710 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CachePackageBegin"/> | ||
1711 | /// </summary> | ||
1712 | [Serializable] | ||
1713 | public class CachePackageBeginEventArgs : CancellableHResultEventArgs | ||
1714 | { | ||
1715 | /// <summary /> | ||
1716 | public CachePackageBeginEventArgs(string packageId, int cachePayloads, long packageCacheSize, bool cancelRecommendation) | ||
1717 | : base(cancelRecommendation) | ||
1718 | { | ||
1719 | this.PackageId = packageId; | ||
1720 | this.CachePayloads = cachePayloads; | ||
1721 | this.PackageCacheSize = packageCacheSize; | ||
1722 | } | ||
1723 | |||
1724 | /// <summary> | ||
1725 | /// Gets the identity of the package that is being cached. | ||
1726 | /// </summary> | ||
1727 | public string PackageId { get; private set; } | ||
1728 | |||
1729 | /// <summary> | ||
1730 | /// Gets number of payloads to be cached. | ||
1731 | /// </summary> | ||
1732 | public long CachePayloads { get; private set; } | ||
1733 | |||
1734 | /// <summary> | ||
1735 | /// Gets the size on disk required by the specific package. | ||
1736 | /// </summary> | ||
1737 | public long PackageCacheSize { get; private set; } | ||
1738 | } | ||
1739 | |||
1740 | /// <summary> | ||
1741 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CachePackageComplete"/> | ||
1742 | /// </summary> | ||
1743 | [Serializable] | ||
1744 | public class CachePackageCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION> | ||
1745 | { | ||
1746 | /// <summary /> | ||
1747 | public CachePackageCompleteEventArgs(string packageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action) | ||
1748 | : base(hrStatus, recommendation, action) | ||
1749 | { | ||
1750 | this.PackageId = packageId; | ||
1751 | } | ||
1752 | |||
1753 | /// <summary> | ||
1754 | /// Gets the identity of the package that was cached. | ||
1755 | /// </summary> | ||
1756 | public string PackageId { get; private set; } | ||
1757 | } | ||
1758 | |||
1759 | /// <summary> | ||
1760 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecuteProgress"/> | ||
1761 | /// </summary> | ||
1762 | [Serializable] | ||
1763 | public class ExecuteProgressEventArgs : CancellableHResultEventArgs | ||
1764 | { | ||
1765 | /// <summary /> | ||
1766 | public ExecuteProgressEventArgs(string packageId, int progressPercentage, int overallPercentage, bool cancelRecommendation) | ||
1767 | : base(cancelRecommendation) | ||
1768 | { | ||
1769 | this.PackageId = packageId; | ||
1770 | this.ProgressPercentage = progressPercentage; | ||
1771 | this.OverallPercentage = overallPercentage; | ||
1772 | } | ||
1773 | |||
1774 | /// <summary> | ||
1775 | /// Gets the identity of the package that was executed. | ||
1776 | /// </summary> | ||
1777 | public string PackageId { get; private set; } | ||
1778 | |||
1779 | /// <summary> | ||
1780 | /// Gets the percentage from 0 to 100 of the execution progress for a single payload. | ||
1781 | /// </summary> | ||
1782 | public int ProgressPercentage { get; private set; } | ||
1783 | |||
1784 | /// <summary> | ||
1785 | /// Gets the percentage from 0 to 100 of the execution progress for all payloads. | ||
1786 | /// </summary> | ||
1787 | public int OverallPercentage { get; private set; } | ||
1788 | } | ||
1789 | |||
1790 | /// <summary> | ||
1791 | /// Additional arguments passed by the engine before it tries to launch the preapproved executable. | ||
1792 | /// </summary> | ||
1793 | [Serializable] | ||
1794 | public class LaunchApprovedExeBeginEventArgs : CancellableHResultEventArgs | ||
1795 | { | ||
1796 | /// <summary> | ||
1797 | /// | ||
1798 | /// </summary> | ||
1799 | /// <param name="cancelRecommendation"></param> | ||
1800 | public LaunchApprovedExeBeginEventArgs(bool cancelRecommendation) | ||
1801 | : base(cancelRecommendation) | ||
1802 | { | ||
1803 | } | ||
1804 | } | ||
1805 | |||
1806 | /// <summary> | ||
1807 | /// Additional arguments passed by the engine after it finished trying to launch the preapproved executable. | ||
1808 | /// </summary> | ||
1809 | [Serializable] | ||
1810 | public class LaunchApprovedExeCompleteEventArgs : StatusEventArgs | ||
1811 | { | ||
1812 | private int processId; | ||
1813 | |||
1814 | /// <summary> | ||
1815 | /// | ||
1816 | /// </summary> | ||
1817 | /// <param name="hrStatus"></param> | ||
1818 | /// <param name="processId"></param> | ||
1819 | public LaunchApprovedExeCompleteEventArgs(int hrStatus, int processId) | ||
1820 | : base(hrStatus) | ||
1821 | { | ||
1822 | this.processId = processId; | ||
1823 | } | ||
1824 | |||
1825 | /// <summary> | ||
1826 | /// Gets the ProcessId of the process that was launched. | ||
1827 | /// This is only valid if the status reports success. | ||
1828 | /// </summary> | ||
1829 | public int ProcessId | ||
1830 | { | ||
1831 | get { return this.processId; } | ||
1832 | } | ||
1833 | } | ||
1834 | |||
1835 | /// <summary> | ||
1836 | /// Additional arguments passed by the engine before beginning an MSI transaction. | ||
1837 | /// </summary> | ||
1838 | [Serializable] | ||
1839 | public class BeginMsiTransactionBeginEventArgs : CancellableHResultEventArgs | ||
1840 | { | ||
1841 | private string transactionId; | ||
1842 | |||
1843 | /// <summary> | ||
1844 | /// | ||
1845 | /// </summary> | ||
1846 | /// <param name="transactionId"></param> | ||
1847 | /// <param name="cancelRecommendation"></param> | ||
1848 | public BeginMsiTransactionBeginEventArgs(string transactionId, bool cancelRecommendation) | ||
1849 | : base(cancelRecommendation) | ||
1850 | { | ||
1851 | this.transactionId = transactionId; | ||
1852 | } | ||
1853 | |||
1854 | /// <summary> | ||
1855 | /// Gets the MSI transaction Id. | ||
1856 | /// </summary> | ||
1857 | public string TransactionId | ||
1858 | { | ||
1859 | get { return this.transactionId; } | ||
1860 | } | ||
1861 | } | ||
1862 | |||
1863 | /// <summary> | ||
1864 | /// Additional arguments passed by the engine after beginning an MSI transaction. | ||
1865 | /// </summary> | ||
1866 | [Serializable] | ||
1867 | public class BeginMsiTransactionCompleteEventArgs : StatusEventArgs | ||
1868 | { | ||
1869 | private string transactionId; | ||
1870 | |||
1871 | /// <summary> | ||
1872 | /// | ||
1873 | /// </summary> | ||
1874 | /// <param name="transactionId"></param> | ||
1875 | /// <param name="hrStatus"></param> | ||
1876 | public BeginMsiTransactionCompleteEventArgs(string transactionId, int hrStatus) | ||
1877 | : base(hrStatus) | ||
1878 | { | ||
1879 | this.transactionId = transactionId; | ||
1880 | } | ||
1881 | |||
1882 | /// <summary> | ||
1883 | /// Gets the MSI transaction Id. | ||
1884 | /// </summary> | ||
1885 | public string TransactionId | ||
1886 | { | ||
1887 | get { return this.transactionId; } | ||
1888 | } | ||
1889 | } | ||
1890 | |||
1891 | /// <summary> | ||
1892 | /// Additional arguments passed by the engine before committing an MSI transaction. | ||
1893 | /// </summary> | ||
1894 | [Serializable] | ||
1895 | public class CommitMsiTransactionBeginEventArgs : CancellableHResultEventArgs | ||
1896 | { | ||
1897 | private string transactionId; | ||
1898 | |||
1899 | /// <summary> | ||
1900 | /// | ||
1901 | /// </summary> | ||
1902 | /// <param name="transactionId"></param> | ||
1903 | /// <param name="cancelRecommendation"></param> | ||
1904 | public CommitMsiTransactionBeginEventArgs(string transactionId, bool cancelRecommendation) | ||
1905 | : base(cancelRecommendation) | ||
1906 | { | ||
1907 | this.transactionId = transactionId; | ||
1908 | } | ||
1909 | |||
1910 | /// <summary> | ||
1911 | /// Gets the MSI transaction Id. | ||
1912 | /// </summary> | ||
1913 | public string TransactionId | ||
1914 | { | ||
1915 | get { return this.transactionId; } | ||
1916 | } | ||
1917 | } | ||
1918 | |||
1919 | /// <summary> | ||
1920 | /// Additional arguments passed by the engine after committing an MSI transaction. | ||
1921 | /// </summary> | ||
1922 | [Serializable] | ||
1923 | public class CommitMsiTransactionCompleteEventArgs : StatusEventArgs | ||
1924 | { | ||
1925 | private string transactionId; | ||
1926 | |||
1927 | /// <summary> | ||
1928 | /// | ||
1929 | /// </summary> | ||
1930 | /// <param name="transactionId"></param> | ||
1931 | /// <param name="hrStatus"></param> | ||
1932 | public CommitMsiTransactionCompleteEventArgs(string transactionId, int hrStatus) | ||
1933 | : base(hrStatus) | ||
1934 | { | ||
1935 | this.transactionId = transactionId; | ||
1936 | } | ||
1937 | |||
1938 | /// <summary> | ||
1939 | /// Gets the MSI transaction Id. | ||
1940 | /// </summary> | ||
1941 | public string TransactionId | ||
1942 | { | ||
1943 | get { return this.transactionId; } | ||
1944 | } | ||
1945 | } | ||
1946 | |||
1947 | /// <summary> | ||
1948 | /// Additional arguments passed by the engine before rolling back an MSI transaction. | ||
1949 | /// </summary> | ||
1950 | [Serializable] | ||
1951 | public class RollbackMsiTransactionBeginEventArgs : HResultEventArgs | ||
1952 | { | ||
1953 | private string transactionId; | ||
1954 | |||
1955 | /// <summary> | ||
1956 | /// | ||
1957 | /// </summary> | ||
1958 | /// <param name="transactionId"></param> | ||
1959 | public RollbackMsiTransactionBeginEventArgs(string transactionId) | ||
1960 | { | ||
1961 | this.transactionId = transactionId; | ||
1962 | } | ||
1963 | |||
1964 | /// <summary> | ||
1965 | /// Gets the MSI transaction Id. | ||
1966 | /// </summary> | ||
1967 | public string TransactionId | ||
1968 | { | ||
1969 | get { return this.transactionId; } | ||
1970 | } | ||
1971 | } | ||
1972 | |||
1973 | /// <summary> | ||
1974 | /// Additional arguments passed by the engine after rolling back an MSI transaction. | ||
1975 | /// </summary> | ||
1976 | [Serializable] | ||
1977 | public class RollbackMsiTransactionCompleteEventArgs : StatusEventArgs | ||
1978 | { | ||
1979 | private string transactionId; | ||
1980 | |||
1981 | /// <summary> | ||
1982 | /// | ||
1983 | /// </summary> | ||
1984 | /// <param name="transactionId"></param> | ||
1985 | /// <param name="hrStatus"></param> | ||
1986 | public RollbackMsiTransactionCompleteEventArgs(string transactionId, int hrStatus) | ||
1987 | : base(hrStatus) | ||
1988 | { | ||
1989 | this.transactionId = transactionId; | ||
1990 | } | ||
1991 | |||
1992 | /// <summary> | ||
1993 | /// Gets the MSI transaction Id. | ||
1994 | /// </summary> | ||
1995 | public string TransactionId | ||
1996 | { | ||
1997 | get { return this.transactionId; } | ||
1998 | } | ||
1999 | } | ||
2000 | |||
2001 | /// <summary> | ||
2002 | /// Additional arguments passed by the engine before pausing Windows automatic updates. | ||
2003 | /// </summary> | ||
2004 | [Serializable] | ||
2005 | public class PauseAutomaticUpdatesBeginEventArgs : HResultEventArgs | ||
2006 | { | ||
2007 | /// <summary> | ||
2008 | /// | ||
2009 | /// </summary> | ||
2010 | public PauseAutomaticUpdatesBeginEventArgs() | ||
2011 | { | ||
2012 | } | ||
2013 | } | ||
2014 | |||
2015 | /// <summary> | ||
2016 | /// Additional arguments passed by the engine after pausing Windows automatic updates. | ||
2017 | /// </summary> | ||
2018 | [Serializable] | ||
2019 | public class PauseAutomaticUpdatesCompleteEventArgs : StatusEventArgs | ||
2020 | { | ||
2021 | /// <summary> | ||
2022 | /// | ||
2023 | /// </summary> | ||
2024 | /// <param name="hrStatus"></param> | ||
2025 | public PauseAutomaticUpdatesCompleteEventArgs(int hrStatus) | ||
2026 | : base(hrStatus) | ||
2027 | { | ||
2028 | } | ||
2029 | } | ||
2030 | |||
2031 | /// <summary> | ||
2032 | /// Additional arguments passed by the engine before taking a system restore point. | ||
2033 | /// </summary> | ||
2034 | [Serializable] | ||
2035 | public class SystemRestorePointBeginEventArgs : HResultEventArgs | ||
2036 | { | ||
2037 | /// <summary> | ||
2038 | /// | ||
2039 | /// </summary> | ||
2040 | public SystemRestorePointBeginEventArgs() | ||
2041 | { | ||
2042 | } | ||
2043 | } | ||
2044 | |||
2045 | /// <summary> | ||
2046 | /// Additional arguments passed by the engine after taking a system restore point. | ||
2047 | /// </summary> | ||
2048 | [Serializable] | ||
2049 | public class SystemRestorePointCompleteEventArgs : StatusEventArgs | ||
2050 | { | ||
2051 | /// <summary> | ||
2052 | /// | ||
2053 | /// </summary> | ||
2054 | /// <param name="hrStatus"></param> | ||
2055 | public SystemRestorePointCompleteEventArgs(int hrStatus) | ||
2056 | : base(hrStatus) | ||
2057 | { | ||
2058 | } | ||
2059 | } | ||
2060 | |||
2061 | /// <summary> | ||
2062 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyBegin"/>. | ||
2063 | /// </summary> | ||
2064 | [Serializable] | ||
2065 | public class CacheContainerOrPayloadVerifyBeginEventArgs : CancellableHResultEventArgs | ||
2066 | { | ||
2067 | /// <summary /> | ||
2068 | public CacheContainerOrPayloadVerifyBeginEventArgs(string packageOrContainerId, string payloadId, bool cancelRecommendation) | ||
2069 | : base(cancelRecommendation) | ||
2070 | { | ||
2071 | this.PackageOrContainerId = packageOrContainerId; | ||
2072 | this.PayloadId = payloadId; | ||
2073 | } | ||
2074 | |||
2075 | /// <summary> | ||
2076 | /// Gets the identifier of the container or package. | ||
2077 | /// </summary> | ||
2078 | public string PackageOrContainerId { get; private set; } | ||
2079 | |||
2080 | /// <summary> | ||
2081 | /// Gets the identifier of the payload. | ||
2082 | /// </summary> | ||
2083 | public string PayloadId { get; private set; } | ||
2084 | } | ||
2085 | |||
2086 | /// <summary> | ||
2087 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyProgress"/>. | ||
2088 | /// </summary> | ||
2089 | [Serializable] | ||
2090 | public class CacheContainerOrPayloadVerifyProgressEventArgs : CacheProgressBaseEventArgs | ||
2091 | { | ||
2092 | /// <summary /> | ||
2093 | public CacheContainerOrPayloadVerifyProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) | ||
2094 | : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) | ||
2095 | { | ||
2096 | } | ||
2097 | } | ||
2098 | |||
2099 | /// <summary> | ||
2100 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyComplete"/> | ||
2101 | /// </summary> | ||
2102 | [Serializable] | ||
2103 | public class CacheContainerOrPayloadVerifyCompleteEventArgs : StatusEventArgs | ||
2104 | { | ||
2105 | /// <summary /> | ||
2106 | public CacheContainerOrPayloadVerifyCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus) | ||
2107 | : base(hrStatus) | ||
2108 | { | ||
2109 | this.PackageOrContainerId = packageOrContainerId; | ||
2110 | this.PayloadId = payloadId; | ||
2111 | } | ||
2112 | |||
2113 | /// <summary> | ||
2114 | /// Gets the identifier of the container or package. | ||
2115 | /// </summary> | ||
2116 | public string PackageOrContainerId { get; private set; } | ||
2117 | |||
2118 | /// <summary> | ||
2119 | /// Gets the identifier of the payload. | ||
2120 | /// </summary> | ||
2121 | public string PayloadId { get; private set; } | ||
2122 | } | ||
2123 | |||
2124 | /// <summary> | ||
2125 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CachePayloadExtractBegin"/>. | ||
2126 | /// </summary> | ||
2127 | [Serializable] | ||
2128 | public class CachePayloadExtractBeginEventArgs : CancellableHResultEventArgs | ||
2129 | { | ||
2130 | /// <summary /> | ||
2131 | public CachePayloadExtractBeginEventArgs(string containerId, string payloadId, bool cancelRecommendation) | ||
2132 | : base(cancelRecommendation) | ||
2133 | { | ||
2134 | this.ContainerId = containerId; | ||
2135 | this.PayloadId = payloadId; | ||
2136 | } | ||
2137 | |||
2138 | /// <summary> | ||
2139 | /// Gets the identifier of the container. | ||
2140 | /// </summary> | ||
2141 | public string ContainerId { get; private set; } | ||
2142 | |||
2143 | /// <summary> | ||
2144 | /// Gets the identifier of the payload. | ||
2145 | /// </summary> | ||
2146 | public string PayloadId { get; private set; } | ||
2147 | } | ||
2148 | |||
2149 | /// <summary> | ||
2150 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CachePayloadExtractProgress"/>. | ||
2151 | /// </summary> | ||
2152 | [Serializable] | ||
2153 | public class CachePayloadExtractProgressEventArgs : CacheProgressBaseEventArgs | ||
2154 | { | ||
2155 | /// <summary /> | ||
2156 | public CachePayloadExtractProgressEventArgs(string containerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) | ||
2157 | : base(containerId, payloadId, progress, total, overallPercentage, cancelRecommendation) | ||
2158 | { | ||
2159 | } | ||
2160 | } | ||
2161 | |||
2162 | /// <summary> | ||
2163 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.CachePayloadExtractComplete"/> | ||
2164 | /// </summary> | ||
2165 | [Serializable] | ||
2166 | public class CachePayloadExtractCompleteEventArgs : StatusEventArgs | ||
2167 | { | ||
2168 | /// <summary /> | ||
2169 | public CachePayloadExtractCompleteEventArgs(string containerId, string payloadId, int hrStatus) | ||
2170 | : base(hrStatus) | ||
2171 | { | ||
2172 | this.ContainerId = containerId; | ||
2173 | this.PayloadId = payloadId; | ||
2174 | } | ||
2175 | |||
2176 | /// <summary> | ||
2177 | /// Gets the identifier of the container. | ||
2178 | /// </summary> | ||
2179 | public string ContainerId { get; private set; } | ||
2180 | |||
2181 | /// <summary> | ||
2182 | /// Gets the identifier of the payload. | ||
2183 | /// </summary> | ||
2184 | public string PayloadId { get; private set; } | ||
2185 | } | ||
2186 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs new file mode 100644 index 00000000..530fb1a9 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
@@ -0,0 +1,1917 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Allows customization of the bootstrapper application. | ||
10 | /// </summary> | ||
11 | [ComImport] | ||
12 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
13 | [Guid("53C31D56-49C0-426B-AB06-099D717C67FE")] | ||
14 | public interface IBootstrapperApplication | ||
15 | { | ||
16 | /// <summary> | ||
17 | /// Low level method that is called directly from the engine. | ||
18 | /// </summary> | ||
19 | [PreserveSig] | ||
20 | [return: MarshalAs(UnmanagedType.I4)] | ||
21 | int BAProc( | ||
22 | int message, | ||
23 | IntPtr pvArgs, | ||
24 | IntPtr pvResults, | ||
25 | IntPtr pvContext | ||
26 | ); | ||
27 | |||
28 | /// <summary> | ||
29 | /// Low level method that is called directly from the engine. | ||
30 | /// </summary> | ||
31 | void BAProcFallback( | ||
32 | int message, | ||
33 | IntPtr pvArgs, | ||
34 | IntPtr pvResults, | ||
35 | ref int phr, | ||
36 | IntPtr pvContext | ||
37 | ); | ||
38 | |||
39 | /// <summary> | ||
40 | /// See <see cref="IDefaultBootstrapperApplication.Startup"/>. | ||
41 | /// </summary> | ||
42 | [PreserveSig] | ||
43 | [return: MarshalAs(UnmanagedType.I4)] | ||
44 | int OnStartup(); | ||
45 | |||
46 | /// <summary> | ||
47 | /// See <see cref="IDefaultBootstrapperApplication.Shutdown"/>. | ||
48 | /// </summary> | ||
49 | [PreserveSig] | ||
50 | [return: MarshalAs(UnmanagedType.I4)] | ||
51 | int OnShutdown(ref BOOTSTRAPPER_SHUTDOWN_ACTION action); | ||
52 | |||
53 | /// <summary> | ||
54 | /// See <see cref="IDefaultBootstrapperApplication.SystemShutdown"/>. | ||
55 | /// </summary> | ||
56 | /// <param name="dwEndSession"></param> | ||
57 | /// <param name="fCancel"></param> | ||
58 | /// <returns></returns> | ||
59 | [PreserveSig] | ||
60 | [return: MarshalAs(UnmanagedType.I4)] | ||
61 | int OnSystemShutdown( | ||
62 | [MarshalAs(UnmanagedType.U4)] EndSessionReasons dwEndSession, | ||
63 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
64 | ); | ||
65 | |||
66 | /// <summary> | ||
67 | /// See <see cref="IDefaultBootstrapperApplication.DetectBegin"/>. | ||
68 | /// </summary> | ||
69 | [PreserveSig] | ||
70 | [return: MarshalAs(UnmanagedType.I4)] | ||
71 | int OnDetectBegin( | ||
72 | [MarshalAs(UnmanagedType.Bool)] bool fCached, | ||
73 | [MarshalAs(UnmanagedType.Bool)] bool fInstalled, | ||
74 | [MarshalAs(UnmanagedType.U4)] int cPackages, | ||
75 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
76 | ); | ||
77 | |||
78 | /// <summary> | ||
79 | /// See <see cref="IDefaultBootstrapperApplication.DetectForwardCompatibleBundle"/>. | ||
80 | /// </summary> | ||
81 | /// <param name="wzBundleId"></param> | ||
82 | /// <param name="relationType"></param> | ||
83 | /// <param name="wzBundleTag"></param> | ||
84 | /// <param name="fPerMachine"></param> | ||
85 | /// <param name="wzVersion"></param> | ||
86 | /// <param name="fMissingFromCache"></param> | ||
87 | /// <param name="fCancel"></param> | ||
88 | /// <returns></returns> | ||
89 | [PreserveSig] | ||
90 | [return: MarshalAs(UnmanagedType.I4)] | ||
91 | int OnDetectForwardCompatibleBundle( | ||
92 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, | ||
93 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, | ||
94 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, | ||
95 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | ||
96 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
97 | [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, | ||
98 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
99 | ); | ||
100 | |||
101 | /// <summary> | ||
102 | /// See <see cref="IDefaultBootstrapperApplication.DetectUpdateBegin"/>. | ||
103 | /// </summary> | ||
104 | /// <param name="wzUpdateLocation"></param> | ||
105 | /// <param name="fCancel"></param> | ||
106 | /// <param name="fSkip"></param> | ||
107 | /// <returns></returns> | ||
108 | [PreserveSig] | ||
109 | [return: MarshalAs(UnmanagedType.I4)] | ||
110 | int OnDetectUpdateBegin( | ||
111 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, | ||
112 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | ||
113 | [MarshalAs(UnmanagedType.Bool)] ref bool fSkip | ||
114 | ); | ||
115 | |||
116 | /// <summary> | ||
117 | /// See <see cref="IDefaultBootstrapperApplication.DetectUpdate"/>. | ||
118 | /// </summary> | ||
119 | /// <param name="wzUpdateLocation"></param> | ||
120 | /// <param name="dw64Size"></param> | ||
121 | /// <param name="wzVersion"></param> | ||
122 | /// <param name="wzTitle"></param> | ||
123 | /// <param name="wzSummary"></param> | ||
124 | /// <param name="wzContentType"></param> | ||
125 | /// <param name="wzContent"></param> | ||
126 | /// <param name="fCancel"></param> | ||
127 | /// <param name="fStopProcessingUpdates"></param> | ||
128 | /// <returns></returns> | ||
129 | [PreserveSig] | ||
130 | [return: MarshalAs(UnmanagedType.I4)] | ||
131 | int OnDetectUpdate( | ||
132 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, | ||
133 | [MarshalAs(UnmanagedType.U8)] long dw64Size, | ||
134 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
135 | [MarshalAs(UnmanagedType.LPWStr)] string wzTitle, | ||
136 | [MarshalAs(UnmanagedType.LPWStr)] string wzSummary, | ||
137 | [MarshalAs(UnmanagedType.LPWStr)] string wzContentType, | ||
138 | [MarshalAs(UnmanagedType.LPWStr)] string wzContent, | ||
139 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | ||
140 | [MarshalAs(UnmanagedType.Bool)] ref bool fStopProcessingUpdates | ||
141 | ); | ||
142 | |||
143 | /// <summary> | ||
144 | /// See <see cref="IDefaultBootstrapperApplication.DetectUpdateComplete"/>. | ||
145 | /// </summary> | ||
146 | /// <param name="hrStatus"></param> | ||
147 | /// <param name="fIgnoreError"></param> | ||
148 | /// <returns></returns> | ||
149 | [PreserveSig] | ||
150 | [return: MarshalAs(UnmanagedType.I4)] | ||
151 | int OnDetectUpdateComplete( | ||
152 | int hrStatus, | ||
153 | [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreError | ||
154 | ); | ||
155 | |||
156 | /// <summary> | ||
157 | /// See <see cref="IDefaultBootstrapperApplication.DetectRelatedBundle"/>. | ||
158 | /// </summary> | ||
159 | /// <param name="wzBundleId"></param> | ||
160 | /// <param name="relationType"></param> | ||
161 | /// <param name="wzBundleTag"></param> | ||
162 | /// <param name="fPerMachine"></param> | ||
163 | /// <param name="wzVersion"></param> | ||
164 | /// <param name="operation"></param> | ||
165 | /// <param name="fMissingFromCache"></param> | ||
166 | /// <param name="fCancel"></param> | ||
167 | /// <returns></returns> | ||
168 | [PreserveSig] | ||
169 | [return: MarshalAs(UnmanagedType.I4)] | ||
170 | int OnDetectRelatedBundle( | ||
171 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, | ||
172 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, | ||
173 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, | ||
174 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | ||
175 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
176 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, | ||
177 | [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, | ||
178 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
179 | ); | ||
180 | |||
181 | /// <summary> | ||
182 | /// See <see cref="IDefaultBootstrapperApplication.DetectPackageBegin"/>. | ||
183 | /// </summary> | ||
184 | /// <param name="wzPackageId"></param> | ||
185 | /// <param name="fCancel"></param> | ||
186 | /// <returns></returns> | ||
187 | [PreserveSig] | ||
188 | [return: MarshalAs(UnmanagedType.I4)] | ||
189 | int OnDetectPackageBegin( | ||
190 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
191 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
192 | ); | ||
193 | |||
194 | /// <summary> | ||
195 | /// See <see cref="IDefaultBootstrapperApplication.DetectRelatedMsiPackage"/>. | ||
196 | /// </summary> | ||
197 | /// <param name="wzPackageId"></param> | ||
198 | /// <param name="wzUpgradeCode"></param> | ||
199 | /// <param name="wzProductCode"></param> | ||
200 | /// <param name="fPerMachine"></param> | ||
201 | /// <param name="wzVersion"></param> | ||
202 | /// <param name="operation"></param> | ||
203 | /// <param name="fCancel"></param> | ||
204 | /// <returns></returns> | ||
205 | [PreserveSig] | ||
206 | [return: MarshalAs(UnmanagedType.I4)] | ||
207 | int OnDetectRelatedMsiPackage( | ||
208 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
209 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpgradeCode, | ||
210 | [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, | ||
211 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | ||
212 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
213 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, | ||
214 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
215 | ); | ||
216 | |||
217 | /// <summary> | ||
218 | /// See <see cref="IDefaultBootstrapperApplication.DetectPatchTarget"/>. | ||
219 | /// </summary> | ||
220 | /// <param name="wzPackageId"></param> | ||
221 | /// <param name="wzProductCode"></param> | ||
222 | /// <param name="patchState"></param> | ||
223 | /// <param name="fCancel"></param> | ||
224 | /// <returns></returns> | ||
225 | [PreserveSig] | ||
226 | [return: MarshalAs(UnmanagedType.I4)] | ||
227 | int OnDetectPatchTarget( | ||
228 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
229 | [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, | ||
230 | [MarshalAs(UnmanagedType.U4)] PackageState patchState, | ||
231 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
232 | ); | ||
233 | |||
234 | /// <summary> | ||
235 | /// See <see cref="IDefaultBootstrapperApplication.DetectMsiFeature"/>. | ||
236 | /// </summary> | ||
237 | /// <param name="wzPackageId"></param> | ||
238 | /// <param name="wzFeatureId"></param> | ||
239 | /// <param name="state"></param> | ||
240 | /// <param name="fCancel"></param> | ||
241 | /// <returns></returns> | ||
242 | [PreserveSig] | ||
243 | [return: MarshalAs(UnmanagedType.I4)] | ||
244 | int OnDetectMsiFeature( | ||
245 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
246 | [MarshalAs(UnmanagedType.LPWStr)] string wzFeatureId, | ||
247 | [MarshalAs(UnmanagedType.U4)] FeatureState state, | ||
248 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
249 | ); | ||
250 | |||
251 | /// <summary> | ||
252 | /// See <see cref="IDefaultBootstrapperApplication.DetectPackageComplete"/>. | ||
253 | /// </summary> | ||
254 | [PreserveSig] | ||
255 | [return: MarshalAs(UnmanagedType.I4)] | ||
256 | int OnDetectPackageComplete( | ||
257 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
258 | int hrStatus, | ||
259 | [MarshalAs(UnmanagedType.U4)] PackageState state, | ||
260 | [MarshalAs(UnmanagedType.Bool)] bool fCached | ||
261 | ); | ||
262 | |||
263 | /// <summary> | ||
264 | /// See <see cref="IDefaultBootstrapperApplication.DetectComplete"/>. | ||
265 | /// </summary> | ||
266 | /// <param name="hrStatus"></param> | ||
267 | /// <param name="fEligibleForCleanup"></param> | ||
268 | /// <returns></returns> | ||
269 | [PreserveSig] | ||
270 | [return: MarshalAs(UnmanagedType.I4)] | ||
271 | int OnDetectComplete( | ||
272 | int hrStatus, | ||
273 | [MarshalAs(UnmanagedType.Bool)] bool fEligibleForCleanup | ||
274 | ); | ||
275 | |||
276 | /// <summary> | ||
277 | /// See <see cref="IDefaultBootstrapperApplication.PlanBegin"/>. | ||
278 | /// </summary> | ||
279 | /// <param name="cPackages"></param> | ||
280 | /// <param name="fCancel"></param> | ||
281 | /// <returns></returns> | ||
282 | [PreserveSig] | ||
283 | [return: MarshalAs(UnmanagedType.I4)] | ||
284 | int OnPlanBegin( | ||
285 | [MarshalAs(UnmanagedType.U4)] int cPackages, | ||
286 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
287 | ); | ||
288 | |||
289 | /// <summary> | ||
290 | /// See <see cref="IDefaultBootstrapperApplication.PlanRelatedBundle"/>. | ||
291 | /// </summary> | ||
292 | /// <param name="wzBundleId"></param> | ||
293 | /// <param name="recommendedState"></param> | ||
294 | /// <param name="pRequestedState"></param> | ||
295 | /// <param name="fCancel"></param> | ||
296 | /// <returns></returns> | ||
297 | [PreserveSig] | ||
298 | [return: MarshalAs(UnmanagedType.I4)] | ||
299 | int OnPlanRelatedBundle( | ||
300 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, | ||
301 | [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, | ||
302 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, | ||
303 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
304 | ); | ||
305 | |||
306 | /// <summary> | ||
307 | /// See <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/>. | ||
308 | /// </summary> | ||
309 | [PreserveSig] | ||
310 | [return: MarshalAs(UnmanagedType.I4)] | ||
311 | int OnPlanPackageBegin( | ||
312 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
313 | [MarshalAs(UnmanagedType.U4)] PackageState state, | ||
314 | [MarshalAs(UnmanagedType.Bool)] bool fCached, | ||
315 | [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | ||
316 | [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, | ||
317 | [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, | ||
318 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, | ||
319 | [MarshalAs(UnmanagedType.U4)] ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, | ||
320 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
321 | ); | ||
322 | |||
323 | /// <summary> | ||
324 | /// See <see cref="IDefaultBootstrapperApplication.PlanPatchTarget"/>. | ||
325 | /// </summary> | ||
326 | /// <param name="wzPackageId"></param> | ||
327 | /// <param name="wzProductCode"></param> | ||
328 | /// <param name="recommendedState"></param> | ||
329 | /// <param name="pRequestedState"></param> | ||
330 | /// <param name="fCancel"></param> | ||
331 | /// <returns></returns> | ||
332 | [PreserveSig] | ||
333 | [return: MarshalAs(UnmanagedType.I4)] | ||
334 | int OnPlanPatchTarget( | ||
335 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
336 | [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, | ||
337 | [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, | ||
338 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, | ||
339 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
340 | ); | ||
341 | |||
342 | /// <summary> | ||
343 | /// See <see cref="IDefaultBootstrapperApplication.PlanMsiFeature"/>. | ||
344 | /// </summary> | ||
345 | /// <param name="wzPackageId"></param> | ||
346 | /// <param name="wzFeatureId"></param> | ||
347 | /// <param name="recommendedState"></param> | ||
348 | /// <param name="pRequestedState"></param> | ||
349 | /// <param name="fCancel"></param> | ||
350 | /// <returns></returns> | ||
351 | [PreserveSig] | ||
352 | [return: MarshalAs(UnmanagedType.I4)] | ||
353 | int OnPlanMsiFeature( | ||
354 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
355 | [MarshalAs(UnmanagedType.LPWStr)] string wzFeatureId, | ||
356 | [MarshalAs(UnmanagedType.U4)] FeatureState recommendedState, | ||
357 | [MarshalAs(UnmanagedType.U4)] ref FeatureState pRequestedState, | ||
358 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
359 | ); | ||
360 | |||
361 | /// <summary> | ||
362 | /// See <see cref="IDefaultBootstrapperApplication.PlanMsiPackage"/>. | ||
363 | /// </summary> | ||
364 | /// <param name="wzPackageId"></param> | ||
365 | /// <param name="fExecute"></param> | ||
366 | /// <param name="action"></param> | ||
367 | /// <param name="fCancel"></param> | ||
368 | /// <param name="actionMsiProperty"></param> | ||
369 | /// <param name="uiLevel"></param> | ||
370 | /// <param name="fDisableExternalUiHandler"></param> | ||
371 | /// <returns></returns> | ||
372 | [PreserveSig] | ||
373 | [return: MarshalAs(UnmanagedType.I4)] | ||
374 | int OnPlanMsiPackage( | ||
375 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
376 | [MarshalAs(UnmanagedType.Bool)] bool fExecute, | ||
377 | [MarshalAs(UnmanagedType.U4)] ActionState action, | ||
378 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | ||
379 | [MarshalAs(UnmanagedType.U4)] ref BURN_MSI_PROPERTY actionMsiProperty, | ||
380 | [MarshalAs(UnmanagedType.U4)] ref INSTALLUILEVEL uiLevel, | ||
381 | [MarshalAs(UnmanagedType.Bool)] ref bool fDisableExternalUiHandler | ||
382 | ); | ||
383 | |||
384 | /// <summary> | ||
385 | /// See <see cref="IDefaultBootstrapperApplication.PlanPackageComplete"/>. | ||
386 | /// </summary> | ||
387 | /// <param name="wzPackageId"></param> | ||
388 | /// <param name="hrStatus"></param> | ||
389 | /// <param name="requested"></param> | ||
390 | /// <returns></returns> | ||
391 | [PreserveSig] | ||
392 | [return: MarshalAs(UnmanagedType.I4)] | ||
393 | int OnPlanPackageComplete( | ||
394 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
395 | int hrStatus, | ||
396 | [MarshalAs(UnmanagedType.U4)] RequestState requested | ||
397 | ); | ||
398 | |||
399 | /// <summary> | ||
400 | /// See <see cref="IDefaultBootstrapperApplication.PlannedPackage"/>. | ||
401 | /// </summary> | ||
402 | [PreserveSig] | ||
403 | [return: MarshalAs(UnmanagedType.I4)] | ||
404 | int OnPlannedPackage( | ||
405 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
406 | [MarshalAs(UnmanagedType.U4)] ActionState execute, | ||
407 | [MarshalAs(UnmanagedType.U4)] ActionState rollback, | ||
408 | [MarshalAs(UnmanagedType.Bool)] bool fPlannedCache, | ||
409 | [MarshalAs(UnmanagedType.Bool)] bool fPlannedUncache | ||
410 | ); | ||
411 | |||
412 | /// <summary> | ||
413 | /// See <see cref="IDefaultBootstrapperApplication.PlanComplete"/>. | ||
414 | /// </summary> | ||
415 | /// <param name="hrStatus"></param> | ||
416 | /// <returns></returns> | ||
417 | [PreserveSig] | ||
418 | [return: MarshalAs(UnmanagedType.I4)] | ||
419 | int OnPlanComplete( | ||
420 | int hrStatus | ||
421 | ); | ||
422 | |||
423 | /// <summary> | ||
424 | /// See <see cref="IDefaultBootstrapperApplication.ApplyBegin"/>. | ||
425 | /// </summary> | ||
426 | /// <param name="dwPhaseCount"></param> | ||
427 | /// <param name="fCancel"></param> | ||
428 | /// <returns></returns> | ||
429 | [PreserveSig] | ||
430 | [return: MarshalAs(UnmanagedType.I4)] | ||
431 | int OnApplyBegin( | ||
432 | [MarshalAs(UnmanagedType.U4)] int dwPhaseCount, | ||
433 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
434 | ); | ||
435 | |||
436 | /// <summary> | ||
437 | /// See <see cref="IDefaultBootstrapperApplication.ElevateBegin"/>. | ||
438 | /// </summary> | ||
439 | /// <param name="fCancel"></param> | ||
440 | /// <returns></returns> | ||
441 | [PreserveSig] | ||
442 | [return: MarshalAs(UnmanagedType.I4)] | ||
443 | int OnElevateBegin( | ||
444 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
445 | ); | ||
446 | |||
447 | /// <summary> | ||
448 | /// See <see cref="IDefaultBootstrapperApplication.ElevateComplete"/>. | ||
449 | /// </summary> | ||
450 | /// <param name="hrStatus"></param> | ||
451 | /// <returns></returns> | ||
452 | [PreserveSig] | ||
453 | [return: MarshalAs(UnmanagedType.I4)] | ||
454 | int OnElevateComplete( | ||
455 | int hrStatus | ||
456 | ); | ||
457 | |||
458 | /// <summary> | ||
459 | /// See <see cref="IDefaultBootstrapperApplication.Progress"/>. | ||
460 | /// </summary> | ||
461 | /// <param name="dwProgressPercentage"></param> | ||
462 | /// <param name="dwOverallPercentage"></param> | ||
463 | /// <param name="fCancel"></param> | ||
464 | /// <returns></returns> | ||
465 | [PreserveSig] | ||
466 | [return: MarshalAs(UnmanagedType.I4)] | ||
467 | int OnProgress( | ||
468 | [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, | ||
469 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
470 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
471 | ); | ||
472 | |||
473 | /// <summary> | ||
474 | /// See <see cref="IDefaultBootstrapperApplication.Error"/>. | ||
475 | /// </summary> | ||
476 | /// <param name="errorType"></param> | ||
477 | /// <param name="wzPackageId"></param> | ||
478 | /// <param name="dwCode"></param> | ||
479 | /// <param name="wzError"></param> | ||
480 | /// <param name="dwUIHint"></param> | ||
481 | /// <param name="cData"></param> | ||
482 | /// <param name="rgwzData"></param> | ||
483 | /// <param name="nRecommendation"></param> | ||
484 | /// <param name="pResult"></param> | ||
485 | /// <returns></returns> | ||
486 | [PreserveSig] | ||
487 | [return: MarshalAs(UnmanagedType.I4)] | ||
488 | int OnError( | ||
489 | [MarshalAs(UnmanagedType.U4)] ErrorType errorType, | ||
490 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
491 | [MarshalAs(UnmanagedType.U4)] int dwCode, | ||
492 | [MarshalAs(UnmanagedType.LPWStr)] string wzError, | ||
493 | [MarshalAs(UnmanagedType.I4)] int dwUIHint, | ||
494 | [MarshalAs(UnmanagedType.U4)] int cData, | ||
495 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzData, | ||
496 | [MarshalAs(UnmanagedType.I4)] Result nRecommendation, | ||
497 | [MarshalAs(UnmanagedType.I4)] ref Result pResult | ||
498 | ); | ||
499 | |||
500 | /// <summary> | ||
501 | /// See <see cref="IDefaultBootstrapperApplication.RegisterBegin"/>. | ||
502 | /// </summary> | ||
503 | /// <param name="fCancel"></param> | ||
504 | /// <returns></returns> | ||
505 | [PreserveSig] | ||
506 | [return: MarshalAs(UnmanagedType.I4)] | ||
507 | int OnRegisterBegin( | ||
508 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
509 | ); | ||
510 | |||
511 | /// <summary> | ||
512 | /// See <see cref="IDefaultBootstrapperApplication.RegisterComplete"/>. | ||
513 | /// </summary> | ||
514 | /// <param name="hrStatus"></param> | ||
515 | /// <returns></returns> | ||
516 | [PreserveSig] | ||
517 | [return: MarshalAs(UnmanagedType.I4)] | ||
518 | int OnRegisterComplete( | ||
519 | int hrStatus | ||
520 | ); | ||
521 | |||
522 | /// <summary> | ||
523 | /// See <see cref="IDefaultBootstrapperApplication.CacheBegin"/>. | ||
524 | /// </summary> | ||
525 | /// <param name="fCancel"></param> | ||
526 | /// <returns></returns> | ||
527 | [PreserveSig] | ||
528 | [return: MarshalAs(UnmanagedType.I4)] | ||
529 | int OnCacheBegin( | ||
530 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
531 | ); | ||
532 | |||
533 | /// <summary> | ||
534 | /// See <see cref="IDefaultBootstrapperApplication.CachePackageBegin"/>. | ||
535 | /// </summary> | ||
536 | /// <param name="wzPackageId"></param> | ||
537 | /// <param name="cCachePayloads"></param> | ||
538 | /// <param name="dw64PackageCacheSize"></param> | ||
539 | /// <param name="fCancel"></param> | ||
540 | /// <returns></returns> | ||
541 | [PreserveSig] | ||
542 | [return: MarshalAs(UnmanagedType.I4)] | ||
543 | int OnCachePackageBegin( | ||
544 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
545 | [MarshalAs(UnmanagedType.U4)] int cCachePayloads, | ||
546 | [MarshalAs(UnmanagedType.U8)] long dw64PackageCacheSize, | ||
547 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
548 | ); | ||
549 | |||
550 | /// <summary> | ||
551 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireBegin"/>. | ||
552 | /// </summary> | ||
553 | [PreserveSig] | ||
554 | [return: MarshalAs(UnmanagedType.I4)] | ||
555 | int OnCacheAcquireBegin( | ||
556 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
557 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
558 | [MarshalAs(UnmanagedType.LPWStr)] string wzSource, | ||
559 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, | ||
560 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, | ||
561 | [MarshalAs(UnmanagedType.U4)] CacheOperation recommendation, | ||
562 | [MarshalAs(UnmanagedType.I4)] ref CacheOperation action, | ||
563 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
564 | ); | ||
565 | |||
566 | /// <summary> | ||
567 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireProgress"/>. | ||
568 | /// </summary> | ||
569 | [PreserveSig] | ||
570 | [return: MarshalAs(UnmanagedType.I4)] | ||
571 | int OnCacheAcquireProgress( | ||
572 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
573 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
574 | [MarshalAs(UnmanagedType.U8)] long dw64Progress, | ||
575 | [MarshalAs(UnmanagedType.U8)] long dw64Total, | ||
576 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
577 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
578 | ); | ||
579 | |||
580 | /// <summary> | ||
581 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. | ||
582 | /// </summary> | ||
583 | [PreserveSig] | ||
584 | [return: MarshalAs(UnmanagedType.I4)] | ||
585 | int OnCacheAcquireResolving( | ||
586 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
587 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
588 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3, ArraySubType = UnmanagedType.LPWStr), In] string[] searchPaths, | ||
589 | [MarshalAs(UnmanagedType.U4)] int cSearchPaths, | ||
590 | [MarshalAs(UnmanagedType.Bool)] bool fFoundLocal, | ||
591 | [MarshalAs(UnmanagedType.U4)] int dwRecommendedSearchPath, | ||
592 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, | ||
593 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, | ||
594 | [MarshalAs(UnmanagedType.I4)] CacheResolveOperation recommendation, | ||
595 | [MarshalAs(UnmanagedType.U4)] ref int dwChosenSearchPath, | ||
596 | [MarshalAs(UnmanagedType.I4)] ref CacheResolveOperation action, | ||
597 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
598 | ); | ||
599 | |||
600 | /// <summary> | ||
601 | /// See <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. | ||
602 | /// </summary> | ||
603 | [PreserveSig] | ||
604 | [return: MarshalAs(UnmanagedType.I4)] | ||
605 | int OnCacheAcquireComplete( | ||
606 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
607 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
608 | int hrStatus, | ||
609 | BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, | ||
610 | ref BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION pAction | ||
611 | ); | ||
612 | |||
613 | /// <summary> | ||
614 | /// See <see cref="IDefaultBootstrapperApplication.CacheVerifyBegin"/>. | ||
615 | /// </summary> | ||
616 | [PreserveSig] | ||
617 | [return: MarshalAs(UnmanagedType.I4)] | ||
618 | int OnCacheVerifyBegin( | ||
619 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
620 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
621 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
622 | ); | ||
623 | |||
624 | /// <summary> | ||
625 | /// See <see cref="IDefaultBootstrapperApplication.CacheVerifyProgress"/>. | ||
626 | /// </summary> | ||
627 | [PreserveSig] | ||
628 | [return: MarshalAs(UnmanagedType.I4)] | ||
629 | int OnCacheVerifyProgress( | ||
630 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
631 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
632 | [MarshalAs(UnmanagedType.U8)] long dw64Progress, | ||
633 | [MarshalAs(UnmanagedType.U8)] long dw64Total, | ||
634 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
635 | [MarshalAs(UnmanagedType.I4)] CacheVerifyStep verifyStep, | ||
636 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
637 | ); | ||
638 | |||
639 | /// <summary> | ||
640 | /// See <see cref="IDefaultBootstrapperApplication.CacheVerifyComplete"/>. | ||
641 | /// </summary> | ||
642 | [PreserveSig] | ||
643 | [return: MarshalAs(UnmanagedType.I4)] | ||
644 | int OnCacheVerifyComplete( | ||
645 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
646 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
647 | int hrStatus, | ||
648 | BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, | ||
649 | ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action | ||
650 | ); | ||
651 | |||
652 | /// <summary> | ||
653 | /// See <see cref="IDefaultBootstrapperApplication.CachePackageComplete"/>. | ||
654 | /// </summary> | ||
655 | /// <param name="wzPackageId"></param> | ||
656 | /// <param name="hrStatus"></param> | ||
657 | /// <param name="recommendation"></param> | ||
658 | /// <param name="action"></param> | ||
659 | /// <returns></returns> | ||
660 | [PreserveSig] | ||
661 | [return: MarshalAs(UnmanagedType.I4)] | ||
662 | int OnCachePackageComplete( | ||
663 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
664 | int hrStatus, | ||
665 | BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, | ||
666 | ref BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action | ||
667 | ); | ||
668 | |||
669 | /// <summary> | ||
670 | /// See <see cref="IDefaultBootstrapperApplication.CacheComplete"/>. | ||
671 | /// </summary> | ||
672 | /// <param name="hrStatus"></param> | ||
673 | /// <returns></returns> | ||
674 | [PreserveSig] | ||
675 | [return: MarshalAs(UnmanagedType.I4)] | ||
676 | int OnCacheComplete( | ||
677 | int hrStatus | ||
678 | ); | ||
679 | |||
680 | /// <summary> | ||
681 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteBegin"/>. | ||
682 | /// </summary> | ||
683 | /// <param name="cExecutingPackages"></param> | ||
684 | /// <param name="fCancel"></param> | ||
685 | /// <returns></returns> | ||
686 | [PreserveSig] | ||
687 | [return: MarshalAs(UnmanagedType.I4)] | ||
688 | int OnExecuteBegin( | ||
689 | [MarshalAs(UnmanagedType.U4)] int cExecutingPackages, | ||
690 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
691 | ); | ||
692 | |||
693 | /// <summary> | ||
694 | /// See <see cref="IDefaultBootstrapperApplication.ExecutePackageBegin"/>. | ||
695 | /// </summary> | ||
696 | /// <param name="wzPackageId"></param> | ||
697 | /// <param name="fExecute"></param> | ||
698 | /// <param name="action"></param> | ||
699 | /// <param name="uiLevel"></param> | ||
700 | /// <param name="fDisableExternalUiHandler"></param> | ||
701 | /// <param name="fCancel"></param> | ||
702 | /// <returns></returns> | ||
703 | [PreserveSig] | ||
704 | [return: MarshalAs(UnmanagedType.I4)] | ||
705 | int OnExecutePackageBegin( | ||
706 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
707 | [MarshalAs(UnmanagedType.Bool)] bool fExecute, | ||
708 | [MarshalAs(UnmanagedType.U4)] ActionState action, | ||
709 | [MarshalAs(UnmanagedType.U4)] INSTALLUILEVEL uiLevel, | ||
710 | [MarshalAs(UnmanagedType.Bool)] bool fDisableExternalUiHandler, | ||
711 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
712 | ); | ||
713 | |||
714 | /// <summary> | ||
715 | /// See <see cref="IDefaultBootstrapperApplication.ExecutePatchTarget"/>. | ||
716 | /// </summary> | ||
717 | /// <param name="wzPackageId"></param> | ||
718 | /// <param name="wzTargetProductCode"></param> | ||
719 | /// <param name="fCancel"></param> | ||
720 | /// <returns></returns> | ||
721 | [PreserveSig] | ||
722 | [return: MarshalAs(UnmanagedType.I4)] | ||
723 | int OnExecutePatchTarget( | ||
724 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
725 | [MarshalAs(UnmanagedType.LPWStr)] string wzTargetProductCode, | ||
726 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
727 | ); | ||
728 | |||
729 | /// <summary> | ||
730 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteProgress"/>. | ||
731 | /// </summary> | ||
732 | /// <param name="wzPackageId"></param> | ||
733 | /// <param name="dwProgressPercentage"></param> | ||
734 | /// <param name="dwOverallPercentage"></param> | ||
735 | /// <param name="fCancel"></param> | ||
736 | /// <returns></returns> | ||
737 | [PreserveSig] | ||
738 | [return: MarshalAs(UnmanagedType.I4)] | ||
739 | int OnExecuteProgress( | ||
740 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
741 | [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, | ||
742 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
743 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
744 | ); | ||
745 | |||
746 | /// <summary> | ||
747 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteMsiMessage"/>. | ||
748 | /// </summary> | ||
749 | /// <param name="wzPackageId"></param> | ||
750 | /// <param name="messageType"></param> | ||
751 | /// <param name="dwUIHint"></param> | ||
752 | /// <param name="wzMessage"></param> | ||
753 | /// <param name="cData"></param> | ||
754 | /// <param name="rgwzData"></param> | ||
755 | /// <param name="nRecommendation"></param> | ||
756 | /// <param name="pResult"></param> | ||
757 | /// <returns></returns> | ||
758 | [PreserveSig] | ||
759 | [return: MarshalAs(UnmanagedType.I4)] | ||
760 | int OnExecuteMsiMessage( | ||
761 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
762 | [MarshalAs(UnmanagedType.U4)] InstallMessage messageType, | ||
763 | [MarshalAs(UnmanagedType.I4)] int dwUIHint, | ||
764 | [MarshalAs(UnmanagedType.LPWStr)] string wzMessage, | ||
765 | [MarshalAs(UnmanagedType.U4)] int cData, | ||
766 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzData, | ||
767 | [MarshalAs(UnmanagedType.I4)] Result nRecommendation, | ||
768 | [MarshalAs(UnmanagedType.I4)] ref Result pResult | ||
769 | ); | ||
770 | |||
771 | /// <summary> | ||
772 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteFilesInUse"/>. | ||
773 | /// </summary> | ||
774 | /// <param name="wzPackageId"></param> | ||
775 | /// <param name="cFiles"></param> | ||
776 | /// <param name="rgwzFiles"></param> | ||
777 | /// <param name="nRecommendation"></param> | ||
778 | /// <param name="pResult"></param> | ||
779 | /// <returns></returns> | ||
780 | [PreserveSig] | ||
781 | [return: MarshalAs(UnmanagedType.I4)] | ||
782 | int OnExecuteFilesInUse( | ||
783 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
784 | [MarshalAs(UnmanagedType.U4)] int cFiles, | ||
785 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzFiles, | ||
786 | [MarshalAs(UnmanagedType.I4)] Result nRecommendation, | ||
787 | [MarshalAs(UnmanagedType.I4)] ref Result pResult | ||
788 | ); | ||
789 | |||
790 | /// <summary> | ||
791 | /// See <see cref="IDefaultBootstrapperApplication.ExecutePackageComplete"/>. | ||
792 | /// </summary> | ||
793 | /// <param name="wzPackageId"></param> | ||
794 | /// <param name="hrStatus"></param> | ||
795 | /// <param name="restart"></param> | ||
796 | /// <param name="recommendation"></param> | ||
797 | /// <param name="pAction"></param> | ||
798 | /// <returns></returns> | ||
799 | [PreserveSig] | ||
800 | [return: MarshalAs(UnmanagedType.I4)] | ||
801 | int OnExecutePackageComplete( | ||
802 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
803 | int hrStatus, | ||
804 | [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, | ||
805 | [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, | ||
806 | [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION pAction | ||
807 | ); | ||
808 | |||
809 | /// <summary> | ||
810 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteComplete"/>. | ||
811 | /// </summary> | ||
812 | /// <param name="hrStatus"></param> | ||
813 | /// <returns></returns> | ||
814 | [PreserveSig] | ||
815 | [return: MarshalAs(UnmanagedType.I4)] | ||
816 | int OnExecuteComplete( | ||
817 | int hrStatus | ||
818 | ); | ||
819 | |||
820 | /// <summary> | ||
821 | /// See <see cref="IDefaultBootstrapperApplication.UnregisterBegin"/>. | ||
822 | /// </summary> | ||
823 | /// <param name="fKeepRegistration"></param> | ||
824 | /// <param name="fForceKeepRegistration"></param> | ||
825 | /// <returns></returns> | ||
826 | [PreserveSig] | ||
827 | [return: MarshalAs(UnmanagedType.I4)] | ||
828 | int OnUnregisterBegin( | ||
829 | [MarshalAs(UnmanagedType.Bool)] bool fKeepRegistration, | ||
830 | [MarshalAs(UnmanagedType.Bool)] ref bool fForceKeepRegistration | ||
831 | ); | ||
832 | |||
833 | /// <summary> | ||
834 | /// See <see cref="IDefaultBootstrapperApplication.UnregisterComplete"/>. | ||
835 | /// </summary> | ||
836 | /// <param name="hrStatus"></param> | ||
837 | /// <returns></returns> | ||
838 | [PreserveSig] | ||
839 | [return: MarshalAs(UnmanagedType.I4)] | ||
840 | int OnUnregisterComplete( | ||
841 | int hrStatus | ||
842 | ); | ||
843 | |||
844 | /// <summary> | ||
845 | /// See <see cref="IDefaultBootstrapperApplication.ApplyComplete"/>. | ||
846 | /// </summary> | ||
847 | /// <param name="hrStatus"></param> | ||
848 | /// <param name="restart"></param> | ||
849 | /// <param name="recommendation"></param> | ||
850 | /// <param name="pAction"></param> | ||
851 | /// <returns></returns> | ||
852 | [PreserveSig] | ||
853 | [return: MarshalAs(UnmanagedType.I4)] | ||
854 | int OnApplyComplete( | ||
855 | int hrStatus, | ||
856 | [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, | ||
857 | [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, | ||
858 | [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_APPLYCOMPLETE_ACTION pAction | ||
859 | ); | ||
860 | |||
861 | /// <summary> | ||
862 | /// See <see cref="IDefaultBootstrapperApplication.LaunchApprovedExeBegin"/>. | ||
863 | /// </summary> | ||
864 | /// <param name="fCancel"></param> | ||
865 | /// <returns></returns> | ||
866 | [PreserveSig] | ||
867 | [return: MarshalAs(UnmanagedType.I4)] | ||
868 | int OnLaunchApprovedExeBegin( | ||
869 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
870 | ); | ||
871 | |||
872 | /// <summary> | ||
873 | /// See <see cref="IDefaultBootstrapperApplication.LaunchApprovedExeComplete"/>. | ||
874 | /// </summary> | ||
875 | /// <param name="hrStatus"></param> | ||
876 | /// <param name="processId"></param> | ||
877 | /// <returns></returns> | ||
878 | [PreserveSig] | ||
879 | [return: MarshalAs(UnmanagedType.I4)] | ||
880 | int OnLaunchApprovedExeComplete( | ||
881 | int hrStatus, | ||
882 | int processId | ||
883 | ); | ||
884 | |||
885 | /// <summary> | ||
886 | /// See <see cref="IDefaultBootstrapperApplication.BeginMsiTransactionBegin"/>. | ||
887 | /// </summary> | ||
888 | /// <param name="wzTransactionId"></param> | ||
889 | /// <param name="fCancel"></param> | ||
890 | /// <returns></returns> | ||
891 | [PreserveSig] | ||
892 | [return: MarshalAs(UnmanagedType.I4)] | ||
893 | int OnBeginMsiTransactionBegin( | ||
894 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, | ||
895 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
896 | ); | ||
897 | |||
898 | /// <summary> | ||
899 | /// See <see cref="IDefaultBootstrapperApplication.BeginMsiTransactionComplete"/>. | ||
900 | /// </summary> | ||
901 | /// <param name="wzTransactionId"></param> | ||
902 | /// <param name="hrStatus"></param> | ||
903 | /// <returns></returns> | ||
904 | [PreserveSig] | ||
905 | [return: MarshalAs(UnmanagedType.I4)] | ||
906 | int OnBeginMsiTransactionComplete( | ||
907 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, | ||
908 | int hrStatus | ||
909 | ); | ||
910 | |||
911 | /// <summary> | ||
912 | /// See <see cref="IDefaultBootstrapperApplication.CommitMsiTransactionBegin"/>. | ||
913 | /// </summary> | ||
914 | /// <param name="wzTransactionId"></param> | ||
915 | /// <param name="fCancel"></param> | ||
916 | /// <returns></returns> | ||
917 | [PreserveSig] | ||
918 | [return: MarshalAs(UnmanagedType.I4)] | ||
919 | int OnCommitMsiTransactionBegin( | ||
920 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, | ||
921 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
922 | ); | ||
923 | |||
924 | /// <summary> | ||
925 | /// See <see cref="IDefaultBootstrapperApplication.CommitMsiTransactionComplete"/>. | ||
926 | /// </summary> | ||
927 | /// <param name="wzTransactionId"></param> | ||
928 | /// <param name="hrStatus"></param> | ||
929 | /// <returns></returns> | ||
930 | [PreserveSig] | ||
931 | [return: MarshalAs(UnmanagedType.I4)] | ||
932 | int OnCommitMsiTransactionComplete( | ||
933 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, | ||
934 | int hrStatus | ||
935 | ); | ||
936 | |||
937 | /// <summary> | ||
938 | /// See <see cref="IDefaultBootstrapperApplication.RollbackMsiTransactionBegin"/>. | ||
939 | /// </summary> | ||
940 | /// <param name="wzTransactionId"></param> | ||
941 | /// <returns></returns> | ||
942 | [PreserveSig] | ||
943 | [return: MarshalAs(UnmanagedType.I4)] | ||
944 | int OnRollbackMsiTransactionBegin( | ||
945 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId | ||
946 | ); | ||
947 | |||
948 | /// <summary> | ||
949 | /// See <see cref="IDefaultBootstrapperApplication.RollbackMsiTransactionComplete"/>. | ||
950 | /// </summary> | ||
951 | /// <param name="wzTransactionId"></param> | ||
952 | /// <param name="hrStatus"></param> | ||
953 | /// <returns></returns> | ||
954 | [PreserveSig] | ||
955 | [return: MarshalAs(UnmanagedType.I4)] | ||
956 | int OnRollbackMsiTransactionComplete( | ||
957 | [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, | ||
958 | int hrStatus | ||
959 | ); | ||
960 | |||
961 | /// <summary> | ||
962 | /// See <see cref="IDefaultBootstrapperApplication.PauseAutomaticUpdatesBegin"/>. | ||
963 | /// </summary> | ||
964 | /// <returns></returns> | ||
965 | [PreserveSig] | ||
966 | [return: MarshalAs(UnmanagedType.I4)] | ||
967 | int OnPauseAutomaticUpdatesBegin( | ||
968 | ); | ||
969 | |||
970 | /// <summary> | ||
971 | /// See <see cref="IDefaultBootstrapperApplication.PauseAutomaticUpdatesComplete"/>. | ||
972 | /// </summary> | ||
973 | /// <param name="hrStatus"></param> | ||
974 | /// <returns></returns> | ||
975 | [PreserveSig] | ||
976 | [return: MarshalAs(UnmanagedType.I4)] | ||
977 | int OnPauseAutomaticUpdatesComplete( | ||
978 | int hrStatus | ||
979 | ); | ||
980 | |||
981 | /// <summary> | ||
982 | /// See <see cref="IDefaultBootstrapperApplication.SystemRestorePointBegin"/>. | ||
983 | /// </summary> | ||
984 | /// <returns></returns> | ||
985 | [PreserveSig] | ||
986 | [return: MarshalAs(UnmanagedType.I4)] | ||
987 | int OnSystemRestorePointBegin( | ||
988 | ); | ||
989 | |||
990 | /// <summary> | ||
991 | /// See <see cref="IDefaultBootstrapperApplication.SystemRestorePointComplete"/>. | ||
992 | /// </summary> | ||
993 | /// <param name="hrStatus"></param> | ||
994 | /// <returns></returns> | ||
995 | [PreserveSig] | ||
996 | [return: MarshalAs(UnmanagedType.I4)] | ||
997 | int OnSystemRestorePointComplete( | ||
998 | int hrStatus | ||
999 | ); | ||
1000 | |||
1001 | /// <summary> | ||
1002 | /// See <see cref="IDefaultBootstrapperApplication.PlanForwardCompatibleBundle"/>. | ||
1003 | /// </summary> | ||
1004 | /// <param name="wzBundleId"></param> | ||
1005 | /// <param name="relationType"></param> | ||
1006 | /// <param name="wzBundleTag"></param> | ||
1007 | /// <param name="fPerMachine"></param> | ||
1008 | /// <param name="wzVersion"></param> | ||
1009 | /// <param name="fRecommendedIgnoreBundle"></param> | ||
1010 | /// <param name="fCancel"></param> | ||
1011 | /// <param name="fIgnoreBundle"></param> | ||
1012 | /// <returns></returns> | ||
1013 | [PreserveSig] | ||
1014 | [return: MarshalAs(UnmanagedType.I4)] | ||
1015 | int OnPlanForwardCompatibleBundle( | ||
1016 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, | ||
1017 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, | ||
1018 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, | ||
1019 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | ||
1020 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
1021 | [MarshalAs(UnmanagedType.Bool)] bool fRecommendedIgnoreBundle, | ||
1022 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | ||
1023 | [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle | ||
1024 | ); | ||
1025 | |||
1026 | /// <summary> | ||
1027 | /// See <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyBegin"/>. | ||
1028 | /// </summary> | ||
1029 | [PreserveSig] | ||
1030 | [return: MarshalAs(UnmanagedType.I4)] | ||
1031 | int OnCacheContainerOrPayloadVerifyBegin( | ||
1032 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
1033 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1034 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
1035 | ); | ||
1036 | |||
1037 | /// <summary> | ||
1038 | /// See <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyProgress"/>. | ||
1039 | /// </summary> | ||
1040 | [PreserveSig] | ||
1041 | [return: MarshalAs(UnmanagedType.I4)] | ||
1042 | int OnCacheContainerOrPayloadVerifyProgress( | ||
1043 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
1044 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1045 | [MarshalAs(UnmanagedType.U8)] long dw64Progress, | ||
1046 | [MarshalAs(UnmanagedType.U8)] long dw64Total, | ||
1047 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
1048 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
1049 | ); | ||
1050 | |||
1051 | /// <summary> | ||
1052 | /// See <see cref="IDefaultBootstrapperApplication.CacheContainerOrPayloadVerifyComplete"/>. | ||
1053 | /// </summary> | ||
1054 | [PreserveSig] | ||
1055 | [return: MarshalAs(UnmanagedType.I4)] | ||
1056 | int OnCacheContainerOrPayloadVerifyComplete( | ||
1057 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
1058 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1059 | int hrStatus | ||
1060 | ); | ||
1061 | |||
1062 | /// <summary> | ||
1063 | /// See <see cref="IDefaultBootstrapperApplication.CachePayloadExtractBegin"/>. | ||
1064 | /// </summary> | ||
1065 | [PreserveSig] | ||
1066 | [return: MarshalAs(UnmanagedType.I4)] | ||
1067 | int OnCachePayloadExtractBegin( | ||
1068 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
1069 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1070 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
1071 | ); | ||
1072 | |||
1073 | /// <summary> | ||
1074 | /// See <see cref="IDefaultBootstrapperApplication.CachePayloadExtractProgress"/>. | ||
1075 | /// </summary> | ||
1076 | [PreserveSig] | ||
1077 | [return: MarshalAs(UnmanagedType.I4)] | ||
1078 | int OnCachePayloadExtractProgress( | ||
1079 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
1080 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1081 | [MarshalAs(UnmanagedType.U8)] long dw64Progress, | ||
1082 | [MarshalAs(UnmanagedType.U8)] long dw64Total, | ||
1083 | [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, | ||
1084 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
1085 | ); | ||
1086 | |||
1087 | /// <summary> | ||
1088 | /// See <see cref="IDefaultBootstrapperApplication.CachePayloadExtractComplete"/>. | ||
1089 | /// </summary> | ||
1090 | [PreserveSig] | ||
1091 | [return: MarshalAs(UnmanagedType.I4)] | ||
1092 | int OnCachePayloadExtractComplete( | ||
1093 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
1094 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
1095 | int hrStatus | ||
1096 | ); | ||
1097 | } | ||
1098 | |||
1099 | /// <summary> | ||
1100 | /// The display level for the BA. | ||
1101 | /// </summary> | ||
1102 | public enum Display | ||
1103 | { | ||
1104 | /// <summary> | ||
1105 | /// | ||
1106 | /// </summary> | ||
1107 | Unknown, | ||
1108 | |||
1109 | /// <summary> | ||
1110 | /// | ||
1111 | /// </summary> | ||
1112 | Embedded, | ||
1113 | |||
1114 | /// <summary> | ||
1115 | /// | ||
1116 | /// </summary> | ||
1117 | None, | ||
1118 | |||
1119 | /// <summary> | ||
1120 | /// | ||
1121 | /// </summary> | ||
1122 | Passive, | ||
1123 | |||
1124 | /// <summary> | ||
1125 | /// | ||
1126 | /// </summary> | ||
1127 | Full, | ||
1128 | } | ||
1129 | |||
1130 | /// <summary> | ||
1131 | /// Messages from Windows Installer (msi.h). | ||
1132 | /// </summary> | ||
1133 | public enum InstallMessage | ||
1134 | { | ||
1135 | /// <summary> | ||
1136 | /// premature termination, possibly fatal OOM | ||
1137 | /// </summary> | ||
1138 | FatalExit, | ||
1139 | |||
1140 | /// <summary> | ||
1141 | /// formatted error message | ||
1142 | /// </summary> | ||
1143 | Error = 0x01000000, | ||
1144 | |||
1145 | /// <summary> | ||
1146 | /// formatted warning message | ||
1147 | /// </summary> | ||
1148 | Warning = 0x02000000, | ||
1149 | |||
1150 | /// <summary> | ||
1151 | /// user request message | ||
1152 | /// </summary> | ||
1153 | User = 0x03000000, | ||
1154 | |||
1155 | /// <summary> | ||
1156 | /// informative message for log | ||
1157 | /// </summary> | ||
1158 | Info = 0x04000000, | ||
1159 | |||
1160 | /// <summary> | ||
1161 | /// list of files in use that need to be replaced | ||
1162 | /// </summary> | ||
1163 | FilesInUse = 0x05000000, | ||
1164 | |||
1165 | /// <summary> | ||
1166 | /// request to determine a valid source location | ||
1167 | /// </summary> | ||
1168 | ResolveSource = 0x06000000, | ||
1169 | |||
1170 | /// <summary> | ||
1171 | /// insufficient disk space message | ||
1172 | /// </summary> | ||
1173 | OutOfDiskSpace = 0x07000000, | ||
1174 | |||
1175 | /// <summary> | ||
1176 | /// start of action: action name & description | ||
1177 | /// </summary> | ||
1178 | ActionStart = 0x08000000, | ||
1179 | |||
1180 | /// <summary> | ||
1181 | /// formatted data associated with individual action item | ||
1182 | /// </summary> | ||
1183 | ActionData = 0x09000000, | ||
1184 | |||
1185 | /// <summary> | ||
1186 | /// progress gauge info: units so far, total | ||
1187 | /// </summary> | ||
1188 | Progress = 0x0a000000, | ||
1189 | |||
1190 | /// <summary> | ||
1191 | /// product info for dialog: language Id, dialog caption | ||
1192 | /// </summary> | ||
1193 | CommonData = 0x0b000000, | ||
1194 | |||
1195 | /// <summary> | ||
1196 | /// sent prior to UI initialization, no string data | ||
1197 | /// </summary> | ||
1198 | Initialize = 0x0c000000, | ||
1199 | |||
1200 | /// <summary> | ||
1201 | /// sent after UI termination, no string data | ||
1202 | /// </summary> | ||
1203 | Terminate = 0x0d000000, | ||
1204 | |||
1205 | /// <summary> | ||
1206 | /// sent prior to display or authored dialog or wizard | ||
1207 | /// </summary> | ||
1208 | ShowDialog = 0x0e000000, | ||
1209 | |||
1210 | /// <summary> | ||
1211 | /// log only, to log performance number like action time | ||
1212 | /// </summary> | ||
1213 | Performance = 0x0f000000, | ||
1214 | |||
1215 | /// <summary> | ||
1216 | /// the list of apps that the user can request Restart Manager to shut down and restart | ||
1217 | /// </summary> | ||
1218 | RMFilesInUse = 0x19000000, | ||
1219 | |||
1220 | /// <summary> | ||
1221 | /// sent prior to server-side install of a product | ||
1222 | /// </summary> | ||
1223 | InstallStart = 0x1a000000, | ||
1224 | |||
1225 | /// <summary> | ||
1226 | /// sent after server-side install | ||
1227 | /// </summary> | ||
1228 | InstallEnd = 0x1B000000, | ||
1229 | } | ||
1230 | |||
1231 | /// <summary> | ||
1232 | /// The action to perform when a reboot is necessary. | ||
1233 | /// </summary> | ||
1234 | public enum Restart | ||
1235 | { | ||
1236 | /// <summary> | ||
1237 | /// | ||
1238 | /// </summary> | ||
1239 | Unknown, | ||
1240 | |||
1241 | /// <summary> | ||
1242 | /// | ||
1243 | /// </summary> | ||
1244 | Never, | ||
1245 | |||
1246 | /// <summary> | ||
1247 | /// | ||
1248 | /// </summary> | ||
1249 | Prompt, | ||
1250 | |||
1251 | /// <summary> | ||
1252 | /// | ||
1253 | /// </summary> | ||
1254 | Automatic, | ||
1255 | |||
1256 | /// <summary> | ||
1257 | /// | ||
1258 | /// </summary> | ||
1259 | Always, | ||
1260 | } | ||
1261 | |||
1262 | /// <summary> | ||
1263 | /// Result codes (based on Dialog Box Command IDs from WinUser.h). | ||
1264 | /// </summary> | ||
1265 | public enum Result | ||
1266 | { | ||
1267 | /// <summary> | ||
1268 | /// | ||
1269 | /// </summary> | ||
1270 | Error = -1, | ||
1271 | |||
1272 | /// <summary> | ||
1273 | /// | ||
1274 | /// </summary> | ||
1275 | None, | ||
1276 | |||
1277 | /// <summary> | ||
1278 | /// | ||
1279 | /// </summary> | ||
1280 | Ok, | ||
1281 | |||
1282 | /// <summary> | ||
1283 | /// | ||
1284 | /// </summary> | ||
1285 | Cancel, | ||
1286 | |||
1287 | /// <summary> | ||
1288 | /// | ||
1289 | /// </summary> | ||
1290 | Abort, | ||
1291 | |||
1292 | /// <summary> | ||
1293 | /// | ||
1294 | /// </summary> | ||
1295 | Retry, | ||
1296 | |||
1297 | /// <summary> | ||
1298 | /// | ||
1299 | /// </summary> | ||
1300 | Ignore, | ||
1301 | |||
1302 | /// <summary> | ||
1303 | /// | ||
1304 | /// </summary> | ||
1305 | Yes, | ||
1306 | |||
1307 | /// <summary> | ||
1308 | /// | ||
1309 | /// </summary> | ||
1310 | No, | ||
1311 | |||
1312 | /// <summary> | ||
1313 | /// / | ||
1314 | /// </summary> | ||
1315 | Close, | ||
1316 | |||
1317 | /// <summary> | ||
1318 | /// | ||
1319 | /// </summary> | ||
1320 | Help, | ||
1321 | |||
1322 | /// <summary> | ||
1323 | /// | ||
1324 | /// </summary> | ||
1325 | TryAgain, | ||
1326 | |||
1327 | /// <summary> | ||
1328 | /// | ||
1329 | /// </summary> | ||
1330 | Continue, | ||
1331 | } | ||
1332 | |||
1333 | /// <summary> | ||
1334 | /// Describes why a bundle or packaged is being resumed. | ||
1335 | /// </summary> | ||
1336 | public enum ResumeType | ||
1337 | { | ||
1338 | /// <summary> | ||
1339 | /// | ||
1340 | /// </summary> | ||
1341 | None, | ||
1342 | |||
1343 | /// <summary> | ||
1344 | /// Resume information exists but is invalid. | ||
1345 | /// </summary> | ||
1346 | Invalid, | ||
1347 | |||
1348 | /// <summary> | ||
1349 | /// The bundle was re-launched after an unexpected interruption. | ||
1350 | /// </summary> | ||
1351 | Interrupted, | ||
1352 | |||
1353 | /// <summary> | ||
1354 | /// A reboot is pending. | ||
1355 | /// </summary> | ||
1356 | RebootPending, | ||
1357 | |||
1358 | /// <summary> | ||
1359 | /// The bundle was re-launched after a reboot. | ||
1360 | /// </summary> | ||
1361 | Reboot, | ||
1362 | |||
1363 | /// <summary> | ||
1364 | /// The bundle was re-launched after being suspended. | ||
1365 | /// </summary> | ||
1366 | Suspend, | ||
1367 | |||
1368 | /// <summary> | ||
1369 | /// The bundle was launched from Add/Remove Programs. | ||
1370 | /// </summary> | ||
1371 | Arp, | ||
1372 | } | ||
1373 | |||
1374 | /// <summary> | ||
1375 | /// Indicates what caused the error. | ||
1376 | /// </summary> | ||
1377 | public enum ErrorType | ||
1378 | { | ||
1379 | /// <summary> | ||
1380 | /// The error occurred trying to elevate. | ||
1381 | /// </summary> | ||
1382 | Elevate, | ||
1383 | |||
1384 | /// <summary> | ||
1385 | /// The error came from the Windows Installer. | ||
1386 | /// </summary> | ||
1387 | WindowsInstaller, | ||
1388 | |||
1389 | /// <summary> | ||
1390 | /// The error came from an EXE Package. | ||
1391 | /// </summary> | ||
1392 | ExePackage, | ||
1393 | |||
1394 | /// <summary> | ||
1395 | /// The error came while trying to authenticate with an HTTP server. | ||
1396 | /// </summary> | ||
1397 | HttpServerAuthentication, | ||
1398 | |||
1399 | /// <summary> | ||
1400 | /// The error came while trying to authenticate with an HTTP proxy. | ||
1401 | /// </summary> | ||
1402 | HttpProxyAuthentication, | ||
1403 | |||
1404 | /// <summary> | ||
1405 | /// The error occurred during apply. | ||
1406 | /// </summary> | ||
1407 | Apply, | ||
1408 | }; | ||
1409 | |||
1410 | /// <summary> | ||
1411 | /// The calculated operation for the related bundle. | ||
1412 | /// </summary> | ||
1413 | public enum RelatedOperation | ||
1414 | { | ||
1415 | /// <summary> | ||
1416 | /// | ||
1417 | /// </summary> | ||
1418 | None, | ||
1419 | |||
1420 | /// <summary> | ||
1421 | /// The related bundle or package will be downgraded. | ||
1422 | /// </summary> | ||
1423 | Downgrade, | ||
1424 | |||
1425 | /// <summary> | ||
1426 | /// The related package will be upgraded as a minor revision. | ||
1427 | /// </summary> | ||
1428 | MinorUpdate, | ||
1429 | |||
1430 | /// <summary> | ||
1431 | /// The related bundle or package will be upgraded as a major revision. | ||
1432 | /// </summary> | ||
1433 | MajorUpgrade, | ||
1434 | |||
1435 | /// <summary> | ||
1436 | /// The related bundle will be removed. | ||
1437 | /// </summary> | ||
1438 | Remove, | ||
1439 | |||
1440 | /// <summary> | ||
1441 | /// The related bundle will be installed. | ||
1442 | /// </summary> | ||
1443 | Install, | ||
1444 | |||
1445 | /// <summary> | ||
1446 | /// The related bundle will be repaired. | ||
1447 | /// </summary> | ||
1448 | Repair, | ||
1449 | }; | ||
1450 | |||
1451 | /// <summary> | ||
1452 | /// The cache operation used to acquire a container or payload. | ||
1453 | /// </summary> | ||
1454 | public enum CacheOperation | ||
1455 | { | ||
1456 | /// <summary> | ||
1457 | /// There is no source available. | ||
1458 | /// </summary> | ||
1459 | None, | ||
1460 | |||
1461 | /// <summary> | ||
1462 | /// Copy the payload or container from the chosen local source. | ||
1463 | /// </summary> | ||
1464 | Copy, | ||
1465 | |||
1466 | /// <summary> | ||
1467 | /// Download the payload or container using the download URL. | ||
1468 | /// </summary> | ||
1469 | Download, | ||
1470 | |||
1471 | /// <summary> | ||
1472 | /// Extract the payload from the container. | ||
1473 | /// </summary> | ||
1474 | Extract, | ||
1475 | } | ||
1476 | |||
1477 | /// <summary> | ||
1478 | /// The source to be used to acquire a container or payload. | ||
1479 | /// </summary> | ||
1480 | public enum CacheResolveOperation | ||
1481 | { | ||
1482 | /// <summary> | ||
1483 | /// There is no source available. | ||
1484 | /// </summary> | ||
1485 | None, | ||
1486 | |||
1487 | /// <summary> | ||
1488 | /// Copy the payload or container from the chosen local source. | ||
1489 | /// </summary> | ||
1490 | Local, | ||
1491 | |||
1492 | /// <summary> | ||
1493 | /// Download the payload or container from the download URL. | ||
1494 | /// </summary> | ||
1495 | Download, | ||
1496 | |||
1497 | /// <summary> | ||
1498 | /// Extract the payload from the container. | ||
1499 | /// </summary> | ||
1500 | Container, | ||
1501 | |||
1502 | /// <summary> | ||
1503 | /// Look again for the payload or container locally. | ||
1504 | /// </summary> | ||
1505 | Retry, | ||
1506 | } | ||
1507 | |||
1508 | /// <summary> | ||
1509 | /// The current step when verifying a container or payload. | ||
1510 | /// </summary> | ||
1511 | public enum CacheVerifyStep | ||
1512 | { | ||
1513 | /// <summary> | ||
1514 | /// Copying or moving the file from the working path to the unverified path. | ||
1515 | /// Not used during Layout. | ||
1516 | /// </summary> | ||
1517 | Stage, | ||
1518 | /// <summary> | ||
1519 | /// Hashing the file. | ||
1520 | /// </summary> | ||
1521 | Hash, | ||
1522 | /// <summary> | ||
1523 | /// Copying or moving the file to the final location. | ||
1524 | /// </summary> | ||
1525 | Finalize, | ||
1526 | } | ||
1527 | |||
1528 | /// <summary> | ||
1529 | /// The restart state after a package or all packages were applied. | ||
1530 | /// </summary> | ||
1531 | public enum ApplyRestart | ||
1532 | { | ||
1533 | /// <summary> | ||
1534 | /// Package or chain does not require a restart. | ||
1535 | /// </summary> | ||
1536 | None, | ||
1537 | |||
1538 | /// <summary> | ||
1539 | /// Package or chain requires a restart but it has not been initiated yet. | ||
1540 | /// </summary> | ||
1541 | RestartRequired, | ||
1542 | |||
1543 | /// <summary> | ||
1544 | /// Package or chain has already initiated the restart. | ||
1545 | /// </summary> | ||
1546 | RestartInitiated | ||
1547 | } | ||
1548 | |||
1549 | /// <summary> | ||
1550 | /// The relation type for related bundles. | ||
1551 | /// </summary> | ||
1552 | public enum RelationType | ||
1553 | { | ||
1554 | /// <summary> | ||
1555 | /// | ||
1556 | /// </summary> | ||
1557 | None, | ||
1558 | |||
1559 | /// <summary> | ||
1560 | /// | ||
1561 | /// </summary> | ||
1562 | Detect, | ||
1563 | |||
1564 | /// <summary> | ||
1565 | /// | ||
1566 | /// </summary> | ||
1567 | Upgrade, | ||
1568 | |||
1569 | /// <summary> | ||
1570 | /// | ||
1571 | /// </summary> | ||
1572 | Addon, | ||
1573 | |||
1574 | /// <summary> | ||
1575 | /// | ||
1576 | /// </summary> | ||
1577 | Patch, | ||
1578 | |||
1579 | /// <summary> | ||
1580 | /// | ||
1581 | /// </summary> | ||
1582 | Dependent, | ||
1583 | |||
1584 | /// <summary> | ||
1585 | /// | ||
1586 | /// </summary> | ||
1587 | Update, | ||
1588 | } | ||
1589 | |||
1590 | /// <summary> | ||
1591 | /// One or more reasons why the application is requested to be closed or is being closed. | ||
1592 | /// </summary> | ||
1593 | [Flags] | ||
1594 | public enum EndSessionReasons | ||
1595 | { | ||
1596 | /// <summary> | ||
1597 | /// The system is shutting down or restarting (it is not possible to determine which event is occurring). | ||
1598 | /// </summary> | ||
1599 | Unknown, | ||
1600 | |||
1601 | /// <summary> | ||
1602 | /// The application is using a file that must be replaced, the system is being serviced, or system resources are exhausted. | ||
1603 | /// </summary> | ||
1604 | CloseApplication, | ||
1605 | |||
1606 | /// <summary> | ||
1607 | /// The application is forced to shut down. | ||
1608 | /// </summary> | ||
1609 | Critical = 0x40000000, | ||
1610 | |||
1611 | /// <summary> | ||
1612 | /// The user is logging off. | ||
1613 | /// </summary> | ||
1614 | Logoff = unchecked((int)0x80000000) | ||
1615 | } | ||
1616 | |||
1617 | /// <summary> | ||
1618 | /// The available actions for <see cref="IDefaultBootstrapperApplication.ApplyComplete"/>. | ||
1619 | /// </summary> | ||
1620 | public enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION | ||
1621 | { | ||
1622 | /// <summary> | ||
1623 | /// | ||
1624 | /// </summary> | ||
1625 | None, | ||
1626 | |||
1627 | /// <summary> | ||
1628 | /// Instructs the engine to restart. | ||
1629 | /// The engine will not launch again after the machine is rebooted. | ||
1630 | /// Ignored if reboot was already initiated by <see cref="IDefaultBootstrapperApplication.ExecutePackageComplete"/>. | ||
1631 | /// </summary> | ||
1632 | Restart, | ||
1633 | } | ||
1634 | |||
1635 | /// <summary> | ||
1636 | /// The cache strategy to be used for the package. | ||
1637 | /// </summary> | ||
1638 | public enum BOOTSTRAPPER_CACHE_TYPE | ||
1639 | { | ||
1640 | /// <summary> | ||
1641 | /// The package will be cached in order to securely run the package, but will always be cleaned from the cache at the end. | ||
1642 | /// </summary> | ||
1643 | Remove, | ||
1644 | |||
1645 | /// <summary> | ||
1646 | /// The package will be cached in order to run the package, and then kept in the cache until the package is uninstalled. | ||
1647 | /// </summary> | ||
1648 | Keep, | ||
1649 | |||
1650 | /// <summary> | ||
1651 | /// The package will always be cached and stay in the cache, unless the package and bundle are both being uninstalled. | ||
1652 | /// </summary> | ||
1653 | Force, | ||
1654 | } | ||
1655 | |||
1656 | /// <summary> | ||
1657 | /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. | ||
1658 | /// </summary> | ||
1659 | public enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION | ||
1660 | { | ||
1661 | /// <summary> | ||
1662 | /// | ||
1663 | /// </summary> | ||
1664 | None, | ||
1665 | |||
1666 | /// <summary> | ||
1667 | /// Instructs the engine to try the acquisition of the payload again. | ||
1668 | /// Ignored if hrStatus is a success. | ||
1669 | /// </summary> | ||
1670 | Retry, | ||
1671 | } | ||
1672 | |||
1673 | /// <summary> | ||
1674 | /// The available actions for <see cref="IDefaultBootstrapperApplication.CachePackageComplete"/>. | ||
1675 | /// </summary> | ||
1676 | public enum BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION | ||
1677 | { | ||
1678 | /// <summary> | ||
1679 | /// | ||
1680 | /// </summary> | ||
1681 | None, | ||
1682 | |||
1683 | /// <summary> | ||
1684 | /// Instructs the engine to ignore non-vital package failures and continue with the caching. | ||
1685 | /// Ignored if hrStatus is a success or the package is vital. | ||
1686 | /// </summary> | ||
1687 | Ignore, | ||
1688 | |||
1689 | /// <summary> | ||
1690 | /// Instructs the engine to try the acquisition and verification of the package again. | ||
1691 | /// Ignored if hrStatus is a success. | ||
1692 | /// </summary> | ||
1693 | Retry, | ||
1694 | } | ||
1695 | |||
1696 | /// <summary> | ||
1697 | /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheVerifyComplete"/>. | ||
1698 | /// </summary> | ||
1699 | public enum BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION | ||
1700 | { | ||
1701 | /// <summary> | ||
1702 | /// | ||
1703 | /// </summary> | ||
1704 | None, | ||
1705 | |||
1706 | /// <summary> | ||
1707 | /// Ignored if hrStatus is a success. | ||
1708 | /// </summary> | ||
1709 | RetryVerification, | ||
1710 | |||
1711 | /// <summary> | ||
1712 | /// Ignored if hrStatus is a success. | ||
1713 | /// </summary> | ||
1714 | RetryAcquisition, | ||
1715 | } | ||
1716 | |||
1717 | /// <summary> | ||
1718 | /// The available actions for <see cref="IDefaultBootstrapperApplication.ExecutePackageComplete"/>. | ||
1719 | /// </summary> | ||
1720 | public enum BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION | ||
1721 | { | ||
1722 | /// <summary> | ||
1723 | /// | ||
1724 | /// </summary> | ||
1725 | None, | ||
1726 | |||
1727 | /// <summary> | ||
1728 | /// Instructs the engine to ignore non-vital package failures and continue with the install. | ||
1729 | /// Ignored if hrStatus is a success or the package is vital. | ||
1730 | /// </summary> | ||
1731 | Ignore, | ||
1732 | |||
1733 | /// <summary> | ||
1734 | /// Instructs the engine to try the execution of the package again. | ||
1735 | /// Ignored if hrStatus is a success. | ||
1736 | /// </summary> | ||
1737 | Retry, | ||
1738 | |||
1739 | /// <summary> | ||
1740 | /// Instructs the engine to stop processing the chain and restart. | ||
1741 | /// The engine will launch again after the machine is restarted. | ||
1742 | /// </summary> | ||
1743 | Restart, | ||
1744 | |||
1745 | /// <summary> | ||
1746 | /// Instructs the engine to stop processing the chain and suspend the current state. | ||
1747 | /// </summary> | ||
1748 | Suspend, | ||
1749 | } | ||
1750 | |||
1751 | /// <summary> | ||
1752 | /// The result of evaluating a condition from a package. | ||
1753 | /// </summary> | ||
1754 | public enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT | ||
1755 | { | ||
1756 | /// <summary> | ||
1757 | /// No condition was authored. | ||
1758 | /// </summary> | ||
1759 | Default, | ||
1760 | |||
1761 | /// <summary> | ||
1762 | /// Evaluated to false. | ||
1763 | /// </summary> | ||
1764 | False, | ||
1765 | |||
1766 | /// <summary> | ||
1767 | /// Evaluated to true. | ||
1768 | /// </summary> | ||
1769 | True, | ||
1770 | } | ||
1771 | |||
1772 | /// <summary> | ||
1773 | /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. | ||
1774 | /// </summary> | ||
1775 | public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION | ||
1776 | { | ||
1777 | /// <summary> | ||
1778 | /// Instructs the engine that the source can't be found. | ||
1779 | /// </summary> | ||
1780 | None, | ||
1781 | |||
1782 | /// <summary> | ||
1783 | /// Instructs the engine to try the local source again. | ||
1784 | /// </summary> | ||
1785 | Retry, | ||
1786 | |||
1787 | /// <summary> | ||
1788 | /// Instructs the engine to try the download source. | ||
1789 | /// </summary> | ||
1790 | Download, | ||
1791 | } | ||
1792 | |||
1793 | /// <summary> | ||
1794 | /// The available actions for <see cref="IDefaultBootstrapperApplication.Shutdown"/>. | ||
1795 | /// </summary> | ||
1796 | public enum BOOTSTRAPPER_SHUTDOWN_ACTION | ||
1797 | { | ||
1798 | /// <summary> | ||
1799 | /// | ||
1800 | /// </summary> | ||
1801 | None, | ||
1802 | |||
1803 | /// <summary> | ||
1804 | /// Instructs the engine to restart. | ||
1805 | /// The engine will not launch again after the machine is rebooted. | ||
1806 | /// Ignored if reboot was already initiated by <see cref="IDefaultBootstrapperApplication.ExecutePackageComplete"/>. | ||
1807 | /// </summary> | ||
1808 | Restart, | ||
1809 | |||
1810 | /// <summary> | ||
1811 | /// Instructs the engine to unload the bootstrapper application and | ||
1812 | /// restart the engine which will load the bootstrapper application again. | ||
1813 | /// Typically used to switch from a native bootstrapper application to a managed one. | ||
1814 | /// </summary> | ||
1815 | ReloadBootstrapper, | ||
1816 | |||
1817 | /// <summary> | ||
1818 | /// Opts out of the engine behavior of trying to uninstall itself when no non-permanent packages are installed. | ||
1819 | /// </summary> | ||
1820 | SkipCleanup, | ||
1821 | } | ||
1822 | |||
1823 | /// <summary> | ||
1824 | /// The property Burn will add so the MSI can know the planned action for the package. | ||
1825 | /// </summary> | ||
1826 | public enum BURN_MSI_PROPERTY | ||
1827 | { | ||
1828 | /// <summary> | ||
1829 | /// No property will be added. | ||
1830 | /// </summary> | ||
1831 | None, | ||
1832 | |||
1833 | /// <summary> | ||
1834 | /// Add BURNMSIINSTALL=1 | ||
1835 | /// </summary> | ||
1836 | Install, | ||
1837 | |||
1838 | /// <summary> | ||
1839 | /// Add BURNMSIMODFIY=1 | ||
1840 | /// </summary> | ||
1841 | Modify, | ||
1842 | |||
1843 | /// <summary> | ||
1844 | /// Add BURNMSIREPAIR=1 | ||
1845 | /// </summary> | ||
1846 | Repair, | ||
1847 | |||
1848 | /// <summary> | ||
1849 | /// Add BURNMSIUNINSTALL=1 | ||
1850 | /// </summary> | ||
1851 | Uninstall, | ||
1852 | } | ||
1853 | |||
1854 | /// <summary> | ||
1855 | /// From msi.h | ||
1856 | /// https://docs.microsoft.com/en-us/windows/win32/api/msi/nf-msi-msisetinternalui | ||
1857 | /// </summary> | ||
1858 | [Flags] | ||
1859 | public enum INSTALLUILEVEL | ||
1860 | { | ||
1861 | /// <summary> | ||
1862 | /// UI level is unchanged | ||
1863 | /// </summary> | ||
1864 | NoChange = 0, | ||
1865 | |||
1866 | /// <summary> | ||
1867 | /// default UI is used | ||
1868 | /// </summary> | ||
1869 | Default = 1, | ||
1870 | |||
1871 | /// <summary> | ||
1872 | /// completely silent installation | ||
1873 | /// </summary> | ||
1874 | None = 2, | ||
1875 | |||
1876 | /// <summary> | ||
1877 | /// simple progress and error handling | ||
1878 | /// </summary> | ||
1879 | Basic = 3, | ||
1880 | |||
1881 | /// <summary> | ||
1882 | /// authored UI, wizard dialogs suppressed | ||
1883 | /// </summary> | ||
1884 | Reduced = 4, | ||
1885 | |||
1886 | /// <summary> | ||
1887 | /// authored UI with wizards, progress, errors | ||
1888 | /// </summary> | ||
1889 | Full = 5, | ||
1890 | |||
1891 | /// <summary> | ||
1892 | /// display success/failure dialog at end of install | ||
1893 | /// </summary> | ||
1894 | EndDialog = 0x80, | ||
1895 | |||
1896 | /// <summary> | ||
1897 | /// display only progress dialog | ||
1898 | /// </summary> | ||
1899 | ProgressOnly = 0x40, | ||
1900 | |||
1901 | /// <summary> | ||
1902 | /// do not display the cancel button in basic UI | ||
1903 | /// </summary> | ||
1904 | HideCancel = 0x20, | ||
1905 | |||
1906 | /// <summary> | ||
1907 | /// force display of source resolution even if quiet | ||
1908 | /// </summary> | ||
1909 | SourceResOnly = 0x100, | ||
1910 | |||
1911 | /// <summary> | ||
1912 | /// show UAC prompt even if quiet | ||
1913 | /// Can only be used if on Windows Installer 5.0 or later | ||
1914 | /// </summary> | ||
1915 | UacOnly = 0x200, | ||
1916 | } | ||
1917 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationData.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationData.cs new file mode 100644 index 00000000..23a1c8a3 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationData.cs | |||
@@ -0,0 +1,22 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System.IO; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface for BootstrapperApplicationData.xml. | ||
9 | /// </summary> | ||
10 | public interface IBootstrapperApplicationData | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// The BootstrapperApplicationData.xml file. | ||
14 | /// </summary> | ||
15 | FileInfo BADataFile { get; } | ||
16 | |||
17 | /// <summary> | ||
18 | /// The BA manifest. | ||
19 | /// </summary> | ||
20 | IBundleInfo Bundle { get; } | ||
21 | } | ||
22 | } \ No newline at end of file | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs new file mode 100644 index 00000000..0f9193d0 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs | |||
@@ -0,0 +1,66 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.CodeDom.Compiler; | ||
7 | using System.Runtime.InteropServices; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Interface used by WixToolset.Mba.Host to dynamically load the BA. | ||
11 | /// </summary> | ||
12 | [ComVisible(true)] | ||
13 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
14 | [Guid("2965A12F-AC7B-43A0-85DF-E4B2168478A4")] | ||
15 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
16 | public interface IBootstrapperApplicationFactory | ||
17 | { | ||
18 | /// <summary> | ||
19 | /// Low level method called by the native host. | ||
20 | /// </summary> | ||
21 | /// <param name="pArgs"></param> | ||
22 | /// <param name="pResults"></param> | ||
23 | void Create( | ||
24 | IntPtr pArgs, | ||
25 | IntPtr pResults | ||
26 | ); | ||
27 | } | ||
28 | |||
29 | [Serializable] | ||
30 | [StructLayout(LayoutKind.Sequential)] | ||
31 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
32 | internal struct Command | ||
33 | { | ||
34 | // Strings must be declared as pointers so that Marshaling doesn't free them. | ||
35 | [MarshalAs(UnmanagedType.I4)] internal int cbSize; | ||
36 | [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; | ||
37 | [MarshalAs(UnmanagedType.U4)] private readonly Display display; | ||
38 | [MarshalAs(UnmanagedType.U4)] private readonly Restart restart; | ||
39 | private readonly IntPtr wzCommandLine; | ||
40 | [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; | ||
41 | [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; | ||
42 | private readonly IntPtr hwndSplashScreen; | ||
43 | [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation; | ||
44 | [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough; | ||
45 | private readonly IntPtr wzLayoutDirectory; | ||
46 | private readonly IntPtr wzBootstrapperWorkingFolder; | ||
47 | private readonly IntPtr wzBootstrapperApplicationDataPath; | ||
48 | |||
49 | public IBootstrapperCommand GetBootstrapperCommand() | ||
50 | { | ||
51 | return new BootstrapperCommand( | ||
52 | this.action, | ||
53 | this.display, | ||
54 | this.restart, | ||
55 | Marshal.PtrToStringUni(this.wzCommandLine), | ||
56 | this.nCmdShow, | ||
57 | this.resume, | ||
58 | this.hwndSplashScreen, | ||
59 | this.relation, | ||
60 | this.passthrough, | ||
61 | Marshal.PtrToStringUni(this.wzLayoutDirectory), | ||
62 | Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder), | ||
63 | Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath)); | ||
64 | } | ||
65 | } | ||
66 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs new file mode 100644 index 00000000..e861813f --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs | |||
@@ -0,0 +1,76 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Command information passed from the engine for the BA to perform. | ||
9 | /// </summary> | ||
10 | public interface IBootstrapperCommand | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Gets the action for the BA to perform. | ||
14 | /// </summary> | ||
15 | LaunchAction Action { get; } | ||
16 | |||
17 | /// <summary> | ||
18 | /// Gets the display level for the BA. | ||
19 | /// </summary> | ||
20 | Display Display { get; } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Gets the action to perform if a reboot is required. | ||
24 | /// </summary> | ||
25 | Restart Restart { get; } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Gets the command line arguments as a string array. | ||
29 | /// </summary> | ||
30 | /// <returns> | ||
31 | /// Array of command line arguments not handled by the engine. | ||
32 | /// </returns> | ||
33 | /// <exception type="Win32Exception">The command line could not be parsed into an array.</exception> | ||
34 | string[] CommandLineArgs { get; } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Hint for the initial visibility of the window. | ||
38 | /// </summary> | ||
39 | int CmdShow { get; } | ||
40 | |||
41 | /// <summary> | ||
42 | /// Gets the method of how the engine was resumed from a previous installation step. | ||
43 | /// </summary> | ||
44 | ResumeType Resume { get; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Gets the handle to the splash screen window. If no splash screen was displayed this value will be IntPtr.Zero. | ||
48 | /// </summary> | ||
49 | IntPtr SplashScreen { get; } | ||
50 | |||
51 | /// <summary> | ||
52 | /// If this was run from a related bundle, specifies the relation type. | ||
53 | /// </summary> | ||
54 | RelationType Relation { get; } | ||
55 | |||
56 | /// <summary> | ||
57 | /// If this was run from a backward compatible bundle. | ||
58 | /// </summary> | ||
59 | bool Passthrough { get; } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Gets layout directory. | ||
63 | /// </summary> | ||
64 | string LayoutDirectory { get; } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Gets bootstrapper working folder. | ||
68 | /// </summary> | ||
69 | string BootstrapperWorkingFolder { get; } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Gets path to BootstrapperApplicationData.xml. | ||
73 | /// </summary> | ||
74 | string BootstrapperApplicationDataPath { get; } | ||
75 | } | ||
76 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs new file mode 100644 index 00000000..4e19bf0f --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs | |||
@@ -0,0 +1,536 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.CodeDom.Compiler; | ||
7 | using System.Runtime.InteropServices; | ||
8 | using System.Text; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Allows calls into the bootstrapper engine. | ||
12 | /// </summary> | ||
13 | [ComImport] | ||
14 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
15 | [Guid("6480D616-27A0-44D7-905B-81512C29C2FB")] | ||
16 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
17 | public interface IBootstrapperEngine | ||
18 | { | ||
19 | /// <summary> | ||
20 | /// See <see cref="IEngine.PackageCount"/>. | ||
21 | /// </summary> | ||
22 | /// <param name="pcPackages"></param> | ||
23 | void GetPackageCount( | ||
24 | [MarshalAs(UnmanagedType.U4)] out int pcPackages | ||
25 | ); | ||
26 | |||
27 | /// <summary> | ||
28 | /// See <see cref="IEngine.GetVariableNumeric(string)"/>. | ||
29 | /// </summary> | ||
30 | /// <param name="wzVariable"></param> | ||
31 | /// <param name="pllValue"></param> | ||
32 | /// <returns></returns> | ||
33 | [PreserveSig] | ||
34 | int GetVariableNumeric( | ||
35 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
36 | out long pllValue | ||
37 | ); | ||
38 | |||
39 | /// <summary> | ||
40 | /// See <see cref="IEngine.GetVariableString(string)"/>. | ||
41 | /// </summary> | ||
42 | [PreserveSig] | ||
43 | int GetVariableString( | ||
44 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
45 | IntPtr wzValue, | ||
46 | ref IntPtr pcchValue | ||
47 | ); | ||
48 | |||
49 | /// <summary> | ||
50 | /// See <see cref="IEngine.GetVariableVersion(string)"/>. | ||
51 | /// </summary> | ||
52 | [PreserveSig] | ||
53 | int GetVariableVersion( | ||
54 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
55 | IntPtr wzValue, | ||
56 | ref IntPtr pcchValue | ||
57 | ); | ||
58 | |||
59 | /// <summary> | ||
60 | /// See <see cref="IEngine.FormatString(string)"/>. | ||
61 | /// </summary> | ||
62 | [PreserveSig] | ||
63 | int FormatString( | ||
64 | [MarshalAs(UnmanagedType.LPWStr)] string wzIn, | ||
65 | [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, | ||
66 | ref IntPtr pcchOut | ||
67 | ); | ||
68 | |||
69 | /// <summary> | ||
70 | /// See <see cref="IEngine.EscapeString(string)"/>. | ||
71 | /// </summary> | ||
72 | [PreserveSig] | ||
73 | int EscapeString( | ||
74 | [MarshalAs(UnmanagedType.LPWStr)] string wzIn, | ||
75 | [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, | ||
76 | ref IntPtr pcchOut | ||
77 | ); | ||
78 | |||
79 | /// <summary> | ||
80 | /// See <see cref="IEngine.EvaluateCondition(string)"/>. | ||
81 | /// </summary> | ||
82 | /// <param name="wzCondition"></param> | ||
83 | /// <param name="pf"></param> | ||
84 | void EvaluateCondition( | ||
85 | [MarshalAs(UnmanagedType.LPWStr)] string wzCondition, | ||
86 | [MarshalAs(UnmanagedType.Bool)] out bool pf | ||
87 | ); | ||
88 | |||
89 | /// <summary> | ||
90 | /// See <see cref="IEngine.Log(LogLevel, string)"/>. | ||
91 | /// </summary> | ||
92 | /// <param name="level"></param> | ||
93 | /// <param name="wzMessage"></param> | ||
94 | void Log( | ||
95 | [MarshalAs(UnmanagedType.U4)] LogLevel level, | ||
96 | [MarshalAs(UnmanagedType.LPWStr)] string wzMessage | ||
97 | ); | ||
98 | |||
99 | /// <summary> | ||
100 | /// See <see cref="IEngine.SendEmbeddedError(int, string, int)"/>. | ||
101 | /// </summary> | ||
102 | /// <param name="dwErrorCode"></param> | ||
103 | /// <param name="wzMessage"></param> | ||
104 | /// <param name="dwUIHint"></param> | ||
105 | /// <param name="pnResult"></param> | ||
106 | void SendEmbeddedError( | ||
107 | [MarshalAs(UnmanagedType.U4)] int dwErrorCode, | ||
108 | [MarshalAs(UnmanagedType.LPWStr)] string wzMessage, | ||
109 | [MarshalAs(UnmanagedType.U4)] int dwUIHint, | ||
110 | [MarshalAs(UnmanagedType.I4)] out int pnResult | ||
111 | ); | ||
112 | |||
113 | /// <summary> | ||
114 | /// See <see cref="IEngine.SendEmbeddedProgress(int, int)"/>. | ||
115 | /// </summary> | ||
116 | /// <param name="dwProgressPercentage"></param> | ||
117 | /// <param name="dwOverallProgressPercentage"></param> | ||
118 | /// <param name="pnResult"></param> | ||
119 | void SendEmbeddedProgress( | ||
120 | [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, | ||
121 | [MarshalAs(UnmanagedType.U4)] int dwOverallProgressPercentage, | ||
122 | [MarshalAs(UnmanagedType.I4)] out int pnResult | ||
123 | ); | ||
124 | |||
125 | /// <summary> | ||
126 | /// See <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, byte[])"/>. | ||
127 | /// </summary> | ||
128 | /// <param name="wzLocalSource"></param> | ||
129 | /// <param name="wzDownloadSource"></param> | ||
130 | /// <param name="qwValue"></param> | ||
131 | /// <param name="hashType"></param> | ||
132 | /// <param name="rgbHash"></param> | ||
133 | /// <param name="cbHash"></param> | ||
134 | void SetUpdate( | ||
135 | [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, | ||
136 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, | ||
137 | [MarshalAs(UnmanagedType.U8)] long qwValue, | ||
138 | [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType, | ||
139 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=4)] byte[] rgbHash, | ||
140 | [MarshalAs(UnmanagedType.U4)] int cbHash | ||
141 | ); | ||
142 | |||
143 | /// <summary> | ||
144 | /// See <see cref="IEngine.SetLocalSource(string, string, string)"/>. | ||
145 | /// </summary> | ||
146 | /// <param name="wzPackageOrContainerId"></param> | ||
147 | /// <param name="wzPayloadId"></param> | ||
148 | /// <param name="wzPath"></param> | ||
149 | void SetLocalSource( | ||
150 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
151 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
152 | [MarshalAs(UnmanagedType.LPWStr)] string wzPath | ||
153 | ); | ||
154 | |||
155 | /// <summary> | ||
156 | /// See <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
157 | /// </summary> | ||
158 | /// <param name="wzPackageOrContainerId"></param> | ||
159 | /// <param name="wzPayloadId"></param> | ||
160 | /// <param name="wzUrl"></param> | ||
161 | /// <param name="wzUser"></param> | ||
162 | /// <param name="wzPassword"></param> | ||
163 | void SetDownloadSource( | ||
164 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, | ||
165 | [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, | ||
166 | [MarshalAs(UnmanagedType.LPWStr)] string wzUrl, | ||
167 | [MarshalAs(UnmanagedType.LPWStr)] string wzUser, | ||
168 | [MarshalAs(UnmanagedType.LPWStr)] string wzPassword | ||
169 | ); | ||
170 | |||
171 | /// <summary> | ||
172 | /// See <see cref="IEngine.SetVariableNumeric(string, long)"/>. | ||
173 | /// </summary> | ||
174 | /// <param name="wzVariable"></param> | ||
175 | /// <param name="llValue"></param> | ||
176 | void SetVariableNumeric( | ||
177 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
178 | long llValue | ||
179 | ); | ||
180 | |||
181 | /// <summary> | ||
182 | /// See <see cref="IEngine.SetVariableString(string, string, bool)"/>. | ||
183 | /// </summary> | ||
184 | /// <param name="wzVariable"></param> | ||
185 | /// <param name="wzValue"></param> | ||
186 | /// <param name="fFormatted"></param> | ||
187 | void SetVariableString( | ||
188 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
189 | IntPtr wzValue, | ||
190 | [MarshalAs(UnmanagedType.Bool)] bool fFormatted | ||
191 | ); | ||
192 | |||
193 | /// <summary> | ||
194 | /// See <see cref="IEngine.SetVariableVersion(string, string)"/>. | ||
195 | /// </summary> | ||
196 | /// <param name="wzVariable"></param> | ||
197 | /// <param name="wzValue"></param> | ||
198 | void SetVariableVersion( | ||
199 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | ||
200 | IntPtr wzValue | ||
201 | ); | ||
202 | |||
203 | /// <summary> | ||
204 | /// See <see cref="IEngine.CloseSplashScreen"/>. | ||
205 | /// </summary> | ||
206 | void CloseSplashScreen(); | ||
207 | |||
208 | /// <summary> | ||
209 | /// See <see cref="IEngine.Detect(IntPtr)"/>. | ||
210 | /// </summary> | ||
211 | /// <param name="hwndParent"></param> | ||
212 | void Detect( | ||
213 | IntPtr hwndParent | ||
214 | ); | ||
215 | |||
216 | /// <summary> | ||
217 | /// See <see cref="IEngine.Plan(LaunchAction)"/>. | ||
218 | /// </summary> | ||
219 | /// <param name="action"></param> | ||
220 | void Plan( | ||
221 | [MarshalAs(UnmanagedType.U4)] LaunchAction action | ||
222 | ); | ||
223 | |||
224 | /// <summary> | ||
225 | /// See <see cref="IEngine.Elevate(IntPtr)"/>. | ||
226 | /// </summary> | ||
227 | /// <param name="hwndParent"></param> | ||
228 | /// <returns></returns> | ||
229 | [PreserveSig] | ||
230 | int Elevate( | ||
231 | IntPtr hwndParent | ||
232 | ); | ||
233 | |||
234 | /// <summary> | ||
235 | /// See <see cref="IEngine.Apply(IntPtr)"/>. | ||
236 | /// </summary> | ||
237 | /// <param name="hwndParent"></param> | ||
238 | void Apply( | ||
239 | IntPtr hwndParent | ||
240 | ); | ||
241 | |||
242 | /// <summary> | ||
243 | /// See <see cref="IEngine.Quit(int)"/>. | ||
244 | /// </summary> | ||
245 | /// <param name="dwExitCode"></param> | ||
246 | void Quit( | ||
247 | [MarshalAs(UnmanagedType.U4)] int dwExitCode | ||
248 | ); | ||
249 | |||
250 | /// <summary> | ||
251 | /// See <see cref="IEngine.LaunchApprovedExe(IntPtr, string, string, int)"/>. | ||
252 | /// </summary> | ||
253 | /// <param name="hwndParent"></param> | ||
254 | /// <param name="wzApprovedExeForElevationId"></param> | ||
255 | /// <param name="wzArguments"></param> | ||
256 | /// <param name="dwWaitForInputIdleTimeout"></param> | ||
257 | void LaunchApprovedExe( | ||
258 | IntPtr hwndParent, | ||
259 | [MarshalAs(UnmanagedType.LPWStr)] string wzApprovedExeForElevationId, | ||
260 | [MarshalAs(UnmanagedType.LPWStr)] string wzArguments, | ||
261 | [MarshalAs(UnmanagedType.U4)] int dwWaitForInputIdleTimeout | ||
262 | ); | ||
263 | |||
264 | /// <summary> | ||
265 | /// Sets the URL to the update feed. | ||
266 | /// </summary> | ||
267 | /// <param name="url">URL of the update feed.</param> | ||
268 | void SetUpdateSource( | ||
269 | [MarshalAs(UnmanagedType.LPWStr)] string url | ||
270 | ); | ||
271 | |||
272 | /// <summary> | ||
273 | /// See <see cref="IEngine.CompareVersions(string, string)"/>. | ||
274 | /// </summary> | ||
275 | /// <param name="wzVersion1"></param> | ||
276 | /// <param name="wzVersion2"></param> | ||
277 | /// <param name="pnResult"></param> | ||
278 | void CompareVersions( | ||
279 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion1, | ||
280 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion2, | ||
281 | [MarshalAs(UnmanagedType.I4)] out int pnResult | ||
282 | ); | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// The installation action for the bundle or current package. | ||
287 | /// </summary> | ||
288 | public enum ActionState | ||
289 | { | ||
290 | /// <summary> | ||
291 | /// | ||
292 | /// </summary> | ||
293 | None, | ||
294 | |||
295 | /// <summary> | ||
296 | /// | ||
297 | /// </summary> | ||
298 | Uninstall, | ||
299 | |||
300 | /// <summary> | ||
301 | /// | ||
302 | /// </summary> | ||
303 | Install, | ||
304 | |||
305 | /// <summary> | ||
306 | /// | ||
307 | /// </summary> | ||
308 | Modify, | ||
309 | |||
310 | /// <summary> | ||
311 | /// | ||
312 | /// </summary> | ||
313 | Mend, | ||
314 | |||
315 | /// <summary> | ||
316 | /// | ||
317 | /// </summary> | ||
318 | Repair, | ||
319 | |||
320 | /// <summary> | ||
321 | /// | ||
322 | /// </summary> | ||
323 | MinorUpgrade, | ||
324 | } | ||
325 | |||
326 | /// <summary> | ||
327 | /// The action for the BA to perform. | ||
328 | /// </summary> | ||
329 | public enum LaunchAction | ||
330 | { | ||
331 | /// <summary> | ||
332 | /// | ||
333 | /// </summary> | ||
334 | Unknown, | ||
335 | |||
336 | /// <summary> | ||
337 | /// | ||
338 | /// </summary> | ||
339 | Help, | ||
340 | |||
341 | /// <summary> | ||
342 | /// | ||
343 | /// </summary> | ||
344 | Layout, | ||
345 | |||
346 | /// <summary> | ||
347 | /// | ||
348 | /// </summary> | ||
349 | Uninstall, | ||
350 | |||
351 | /// <summary> | ||
352 | /// | ||
353 | /// </summary> | ||
354 | Cache, | ||
355 | |||
356 | /// <summary> | ||
357 | /// | ||
358 | /// </summary> | ||
359 | Install, | ||
360 | |||
361 | /// <summary> | ||
362 | /// | ||
363 | /// </summary> | ||
364 | Modify, | ||
365 | |||
366 | /// <summary> | ||
367 | /// | ||
368 | /// </summary> | ||
369 | Repair, | ||
370 | |||
371 | /// <summary> | ||
372 | /// | ||
373 | /// </summary> | ||
374 | UpdateReplace, | ||
375 | |||
376 | /// <summary> | ||
377 | /// | ||
378 | /// </summary> | ||
379 | UpdateReplaceEmbedded, | ||
380 | } | ||
381 | |||
382 | /// <summary> | ||
383 | /// The message log level. | ||
384 | /// </summary> | ||
385 | public enum LogLevel | ||
386 | { | ||
387 | /// <summary> | ||
388 | /// No logging level (generic). | ||
389 | /// </summary> | ||
390 | None, | ||
391 | |||
392 | /// <summary> | ||
393 | /// User messages. | ||
394 | /// </summary> | ||
395 | Standard, | ||
396 | |||
397 | /// <summary> | ||
398 | /// Verbose messages. | ||
399 | /// </summary> | ||
400 | Verbose, | ||
401 | |||
402 | /// <summary> | ||
403 | /// Messages for debugging. | ||
404 | /// </summary> | ||
405 | Debug, | ||
406 | |||
407 | /// <summary> | ||
408 | /// Error messages. | ||
409 | /// </summary> | ||
410 | Error, | ||
411 | } | ||
412 | |||
413 | /// <summary> | ||
414 | /// Type of hash used for update bundle. | ||
415 | /// </summary> | ||
416 | public enum UpdateHashType | ||
417 | { | ||
418 | /// <summary> | ||
419 | /// No hash provided. | ||
420 | /// </summary> | ||
421 | None, | ||
422 | |||
423 | /// <summary> | ||
424 | /// SHA-1 based hash provided. | ||
425 | /// </summary> | ||
426 | Sha1, | ||
427 | } | ||
428 | |||
429 | /// <summary> | ||
430 | /// Describes the state of an installation package. | ||
431 | /// </summary> | ||
432 | public enum PackageState | ||
433 | { | ||
434 | /// <summary> | ||
435 | /// | ||
436 | /// </summary> | ||
437 | Unknown, | ||
438 | |||
439 | /// <summary> | ||
440 | /// | ||
441 | /// </summary> | ||
442 | Obsolete, | ||
443 | |||
444 | /// <summary> | ||
445 | /// | ||
446 | /// </summary> | ||
447 | Absent, | ||
448 | |||
449 | /// <summary> | ||
450 | /// | ||
451 | /// </summary> | ||
452 | Cached, | ||
453 | |||
454 | /// <summary> | ||
455 | /// | ||
456 | /// </summary> | ||
457 | Present, | ||
458 | |||
459 | /// <summary> | ||
460 | /// | ||
461 | /// </summary> | ||
462 | Superseded, | ||
463 | } | ||
464 | |||
465 | /// <summary> | ||
466 | /// Indicates the state desired for an installation package. | ||
467 | /// </summary> | ||
468 | public enum RequestState | ||
469 | { | ||
470 | /// <summary> | ||
471 | /// | ||
472 | /// </summary> | ||
473 | None, | ||
474 | |||
475 | /// <summary> | ||
476 | /// / | ||
477 | /// </summary> | ||
478 | ForceAbsent, | ||
479 | |||
480 | /// <summary> | ||
481 | /// | ||
482 | /// </summary> | ||
483 | Absent, | ||
484 | |||
485 | /// <summary> | ||
486 | /// | ||
487 | /// </summary> | ||
488 | Cache, | ||
489 | |||
490 | /// <summary> | ||
491 | /// | ||
492 | /// </summary> | ||
493 | Present, | ||
494 | |||
495 | /// <summary> | ||
496 | /// | ||
497 | /// </summary> | ||
498 | Mend, | ||
499 | |||
500 | /// <summary> | ||
501 | /// | ||
502 | /// </summary> | ||
503 | Repair, | ||
504 | } | ||
505 | |||
506 | /// <summary> | ||
507 | /// Indicates the state of a feature. | ||
508 | /// </summary> | ||
509 | public enum FeatureState | ||
510 | { | ||
511 | /// <summary> | ||
512 | /// | ||
513 | /// </summary> | ||
514 | Unknown, | ||
515 | |||
516 | /// <summary> | ||
517 | /// | ||
518 | /// </summary> | ||
519 | Absent, | ||
520 | |||
521 | /// <summary> | ||
522 | /// | ||
523 | /// </summary> | ||
524 | Advertised, | ||
525 | |||
526 | /// <summary> | ||
527 | /// | ||
528 | /// </summary> | ||
529 | Local, | ||
530 | |||
531 | /// <summary> | ||
532 | /// | ||
533 | /// </summary> | ||
534 | Source, | ||
535 | } | ||
536 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs new file mode 100644 index 00000000..f4a82f36 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | |||
7 | /// <summary> | ||
8 | /// BA manifest data. | ||
9 | /// </summary> | ||
10 | public interface IBundleInfo | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// | ||
14 | /// </summary> | ||
15 | string LogVariable { get; } | ||
16 | |||
17 | /// <summary> | ||
18 | /// | ||
19 | /// </summary> | ||
20 | string Name { get; } | ||
21 | |||
22 | /// <summary> | ||
23 | /// | ||
24 | /// </summary> | ||
25 | IDictionary<string, IPackageInfo> Packages { get; } | ||
26 | |||
27 | /// <summary> | ||
28 | /// | ||
29 | /// </summary> | ||
30 | bool PerMachine { get; } | ||
31 | |||
32 | /// <summary> | ||
33 | /// Adds a related bundle as a package. | ||
34 | /// </summary> | ||
35 | /// <param name="e"></param> | ||
36 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> | ||
37 | IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e); | ||
38 | } | ||
39 | } \ No newline at end of file | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs new file mode 100644 index 00000000..a295f6c0 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
@@ -0,0 +1,387 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interface for built-in implementation of <see cref="IBootstrapperApplication"/>. | ||
9 | /// </summary> | ||
10 | public interface IDefaultBootstrapperApplication : IBootstrapperApplication | ||
11 | { | ||
12 | /// <summary> | ||
13 | /// Fired when the engine has begun installing the bundle. | ||
14 | /// </summary> | ||
15 | event EventHandler<ApplyBeginEventArgs> ApplyBegin; | ||
16 | |||
17 | /// <summary> | ||
18 | /// Fired when the engine has completed installing the bundle. | ||
19 | /// </summary> | ||
20 | event EventHandler<ApplyCompleteEventArgs> ApplyComplete; | ||
21 | |||
22 | /// <summary> | ||
23 | /// Fired when the engine is about to begin an MSI transaction. | ||
24 | /// </summary> | ||
25 | event EventHandler<BeginMsiTransactionBeginEventArgs> BeginMsiTransactionBegin; | ||
26 | |||
27 | /// <summary> | ||
28 | /// Fired when the engine has completed beginning an MSI transaction. | ||
29 | /// </summary> | ||
30 | event EventHandler<BeginMsiTransactionCompleteEventArgs> BeginMsiTransactionComplete; | ||
31 | |||
32 | /// <summary> | ||
33 | /// Fired when the engine has begun acquiring the payload or container. | ||
34 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(string, string, string)"/> | ||
35 | /// or <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
36 | /// </summary> | ||
37 | event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin; | ||
38 | |||
39 | /// <summary> | ||
40 | /// Fired when the engine has completed the acquisition of the payload or container. | ||
41 | /// The BA can change the source using <see cref="IEngine.SetLocalSource(string, string, string)"/> | ||
42 | /// or <see cref="IEngine.SetDownloadSource(string, string, string, string, string)"/>. | ||
43 | /// </summary> | ||
44 | event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete; | ||
45 | |||
46 | /// <summary> | ||
47 | /// Fired when the engine has progress acquiring the payload or container. | ||
48 | /// </summary> | ||
49 | event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Fired by the engine to allow the BA to override the acquisition action. | ||
53 | /// </summary> | ||
54 | event EventHandler<CacheAcquireResolvingEventArgs> CacheAcquireResolving; | ||
55 | |||
56 | /// <summary> | ||
57 | /// Fired when the engine has begun caching the installation sources. | ||
58 | /// </summary> | ||
59 | event EventHandler<CacheBeginEventArgs> CacheBegin; | ||
60 | |||
61 | /// <summary> | ||
62 | /// Fired after the engine has cached the installation sources. | ||
63 | /// </summary> | ||
64 | event EventHandler<CacheCompleteEventArgs> CacheComplete; | ||
65 | |||
66 | /// <summary> | ||
67 | /// Fired when the engine begins the verification of the payload or container that was already in the package cache. | ||
68 | /// </summary> | ||
69 | event EventHandler<CacheContainerOrPayloadVerifyBeginEventArgs> CacheContainerOrPayloadVerifyBegin; | ||
70 | |||
71 | /// <summary> | ||
72 | /// Fired when the engine has completed the verification of the payload or container that was already in the package cache. | ||
73 | /// </summary> | ||
74 | event EventHandler<CacheContainerOrPayloadVerifyCompleteEventArgs> CacheContainerOrPayloadVerifyComplete; | ||
75 | |||
76 | /// <summary> | ||
77 | /// Fired when the engine has progress verifying the payload or container that was already in the package cache. | ||
78 | /// </summary> | ||
79 | event EventHandler<CacheContainerOrPayloadVerifyProgressEventArgs> CacheContainerOrPayloadVerifyProgress; | ||
80 | |||
81 | /// <summary> | ||
82 | /// Fired when the engine has begun caching a specific package. | ||
83 | /// </summary> | ||
84 | event EventHandler<CachePackageBeginEventArgs> CachePackageBegin; | ||
85 | |||
86 | /// <summary> | ||
87 | /// Fired when the engine has completed caching a specific package. | ||
88 | /// </summary> | ||
89 | event EventHandler<CachePackageCompleteEventArgs> CachePackageComplete; | ||
90 | |||
91 | /// <summary> | ||
92 | /// Fired when the engine begins the extraction of the payload from the container. | ||
93 | /// </summary> | ||
94 | event EventHandler<CachePayloadExtractBeginEventArgs> CachePayloadExtractBegin; | ||
95 | |||
96 | /// <summary> | ||
97 | /// Fired when the engine has completed the extraction of the payload from the container. | ||
98 | /// </summary> | ||
99 | event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; | ||
100 | |||
101 | /// <summary> | ||
102 | /// Fired when the engine has progress extracting the payload from the container. | ||
103 | /// </summary> | ||
104 | event EventHandler<CachePayloadExtractProgressEventArgs> CachePayloadExtractProgress; | ||
105 | |||
106 | /// <summary> | ||
107 | /// Fired when the engine begins the verification of the acquired payload or container. | ||
108 | /// </summary> | ||
109 | event EventHandler<CacheVerifyBeginEventArgs> CacheVerifyBegin; | ||
110 | |||
111 | /// <summary> | ||
112 | /// Fired when the engine has completed the verification of the acquired payload or container. | ||
113 | /// </summary> | ||
114 | event EventHandler<CacheVerifyCompleteEventArgs> CacheVerifyComplete; | ||
115 | |||
116 | /// <summary> | ||
117 | /// Fired when the engine has progress verifying the payload or container. | ||
118 | /// </summary> | ||
119 | event EventHandler<CacheVerifyProgressEventArgs> CacheVerifyProgress; | ||
120 | |||
121 | /// <summary> | ||
122 | /// Fired when the engine is about to commit an MSI transaction. | ||
123 | /// </summary> | ||
124 | event EventHandler<CommitMsiTransactionBeginEventArgs> CommitMsiTransactionBegin; | ||
125 | |||
126 | /// <summary> | ||
127 | /// Fired when the engine has completed comitting an MSI transaction. | ||
128 | /// </summary> | ||
129 | event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete; | ||
130 | |||
131 | /// <summary> | ||
132 | /// Fired when the overall detection phase has begun. | ||
133 | /// </summary> | ||
134 | event EventHandler<DetectBeginEventArgs> DetectBegin; | ||
135 | |||
136 | /// <summary> | ||
137 | /// Fired when the detection phase has completed. | ||
138 | /// </summary> | ||
139 | event EventHandler<DetectCompleteEventArgs> DetectComplete; | ||
140 | |||
141 | /// <summary> | ||
142 | /// Fired when a forward compatible bundle is detected. | ||
143 | /// </summary> | ||
144 | event EventHandler<DetectForwardCompatibleBundleEventArgs> DetectForwardCompatibleBundle; | ||
145 | |||
146 | /// <summary> | ||
147 | /// Fired when a feature in an MSI package has been detected. | ||
148 | /// </summary> | ||
149 | event EventHandler<DetectMsiFeatureEventArgs> DetectMsiFeature; | ||
150 | |||
151 | /// <summary> | ||
152 | /// Fired when the detection for a specific package has begun. | ||
153 | /// </summary> | ||
154 | event EventHandler<DetectPackageBeginEventArgs> DetectPackageBegin; | ||
155 | |||
156 | /// <summary> | ||
157 | /// Fired when the detection for a specific package has completed. | ||
158 | /// </summary> | ||
159 | event EventHandler<DetectPackageCompleteEventArgs> DetectPackageComplete; | ||
160 | |||
161 | /// <summary> | ||
162 | /// Fired when the engine detects a target product for an MSP package. | ||
163 | /// </summary> | ||
164 | event EventHandler<DetectPatchTargetEventArgs> DetectPatchTarget; | ||
165 | |||
166 | /// <summary> | ||
167 | /// Fired when a related bundle has been detected for a bundle. | ||
168 | /// </summary> | ||
169 | event EventHandler<DetectRelatedBundleEventArgs> DetectRelatedBundle; | ||
170 | |||
171 | /// <summary> | ||
172 | /// Fired when a related MSI package has been detected for a package. | ||
173 | /// </summary> | ||
174 | event EventHandler<DetectRelatedMsiPackageEventArgs> DetectRelatedMsiPackage; | ||
175 | |||
176 | /// <summary> | ||
177 | /// Fired when the update detection has found a potential update candidate. | ||
178 | /// </summary> | ||
179 | event EventHandler<DetectUpdateEventArgs> DetectUpdate; | ||
180 | |||
181 | /// <summary> | ||
182 | /// Fired when the update detection phase has begun. | ||
183 | /// </summary> | ||
184 | event EventHandler<DetectUpdateBeginEventArgs> DetectUpdateBegin; | ||
185 | |||
186 | /// <summary> | ||
187 | /// Fired when the update detection phase has completed. | ||
188 | /// </summary> | ||
189 | event EventHandler<DetectUpdateCompleteEventArgs> DetectUpdateComplete; | ||
190 | |||
191 | /// <summary> | ||
192 | /// Fired when the engine is about to start the elevated process. | ||
193 | /// </summary> | ||
194 | event EventHandler<ElevateBeginEventArgs> ElevateBegin; | ||
195 | |||
196 | /// <summary> | ||
197 | /// Fired when the engine has completed starting the elevated process. | ||
198 | /// </summary> | ||
199 | event EventHandler<ElevateCompleteEventArgs> ElevateComplete; | ||
200 | |||
201 | /// <summary> | ||
202 | /// Fired when the engine has encountered an error. | ||
203 | /// </summary> | ||
204 | event EventHandler<ErrorEventArgs> Error; | ||
205 | |||
206 | /// <summary> | ||
207 | /// Fired when the engine has begun installing packages. | ||
208 | /// </summary> | ||
209 | event EventHandler<ExecuteBeginEventArgs> ExecuteBegin; | ||
210 | |||
211 | /// <summary> | ||
212 | /// Fired when the engine has completed installing packages. | ||
213 | /// </summary> | ||
214 | event EventHandler<ExecuteCompleteEventArgs> ExecuteComplete; | ||
215 | |||
216 | /// <summary> | ||
217 | /// Fired when a package sends a files in use installation message. | ||
218 | /// </summary> | ||
219 | event EventHandler<ExecuteFilesInUseEventArgs> ExecuteFilesInUse; | ||
220 | |||
221 | /// <summary> | ||
222 | /// Fired when Windows Installer sends an installation message. | ||
223 | /// </summary> | ||
224 | event EventHandler<ExecuteMsiMessageEventArgs> ExecuteMsiMessage; | ||
225 | |||
226 | /// <summary> | ||
227 | /// Fired when the engine has begun installing a specific package. | ||
228 | /// </summary> | ||
229 | event EventHandler<ExecutePackageBeginEventArgs> ExecutePackageBegin; | ||
230 | |||
231 | /// <summary> | ||
232 | /// Fired when the engine has completed installing a specific package. | ||
233 | /// </summary> | ||
234 | event EventHandler<ExecutePackageCompleteEventArgs> ExecutePackageComplete; | ||
235 | |||
236 | /// <summary> | ||
237 | /// Fired when the engine executes one or more patches targeting a product. | ||
238 | /// </summary> | ||
239 | event EventHandler<ExecutePatchTargetEventArgs> ExecutePatchTarget; | ||
240 | |||
241 | /// <summary> | ||
242 | /// Fired by the engine while executing a package. | ||
243 | /// </summary> | ||
244 | event EventHandler<ExecuteProgressEventArgs> ExecuteProgress; | ||
245 | |||
246 | /// <summary> | ||
247 | /// Fired when the engine is about to launch the preapproved executable. | ||
248 | /// </summary> | ||
249 | event EventHandler<LaunchApprovedExeBeginEventArgs> LaunchApprovedExeBegin; | ||
250 | |||
251 | /// <summary> | ||
252 | /// Fired when the engine has completed launching the preapproved executable. | ||
253 | /// </summary> | ||
254 | event EventHandler<LaunchApprovedExeCompleteEventArgs> LaunchApprovedExeComplete; | ||
255 | |||
256 | /// <summary> | ||
257 | /// Fired when the engine is about to pause Windows automatic updates. | ||
258 | /// </summary> | ||
259 | event EventHandler<PauseAutomaticUpdatesBeginEventArgs> PauseAutomaticUpdatesBegin; | ||
260 | |||
261 | /// <summary> | ||
262 | /// Fired when the engine has completed pausing Windows automatic updates. | ||
263 | /// </summary> | ||
264 | event EventHandler<PauseAutomaticUpdatesCompleteEventArgs> PauseAutomaticUpdatesComplete; | ||
265 | |||
266 | /// <summary> | ||
267 | /// Fired when the engine has begun planning the installation. | ||
268 | /// </summary> | ||
269 | event EventHandler<PlanBeginEventArgs> PlanBegin; | ||
270 | |||
271 | /// <summary> | ||
272 | /// Fired when the engine has completed planning the installation. | ||
273 | /// </summary> | ||
274 | event EventHandler<PlanCompleteEventArgs> PlanComplete; | ||
275 | |||
276 | /// <summary> | ||
277 | /// Fired when the engine is about to plan a forward compatible bundle. | ||
278 | /// </summary> | ||
279 | event EventHandler<PlanForwardCompatibleBundleEventArgs> PlanForwardCompatibleBundle; | ||
280 | |||
281 | /// <summary> | ||
282 | /// Fired when the engine has completed planning a package. | ||
283 | /// </summary> | ||
284 | event EventHandler<PlannedPackageEventArgs> PlannedPackage; | ||
285 | |||
286 | /// <summary> | ||
287 | /// Fired when the engine is about to plan a feature in an MSI package. | ||
288 | /// </summary> | ||
289 | event EventHandler<PlanMsiFeatureEventArgs> PlanMsiFeature; | ||
290 | |||
291 | /// <summary> | ||
292 | /// Fired when the engine is planning an MSI or MSP package. | ||
293 | /// </summary> | ||
294 | event EventHandler<PlanMsiPackageEventArgs> PlanMsiPackage; | ||
295 | |||
296 | /// <summary> | ||
297 | /// Fired when the engine has begun getting the BA's input for planning a package. | ||
298 | /// </summary> | ||
299 | event EventHandler<PlanPackageBeginEventArgs> PlanPackageBegin; | ||
300 | |||
301 | /// <summary> | ||
302 | /// Fired when the engine has completed getting the BA's input for planning a package. | ||
303 | /// </summary> | ||
304 | event EventHandler<PlanPackageCompleteEventArgs> PlanPackageComplete; | ||
305 | |||
306 | /// <summary> | ||
307 | /// Fired when the engine is about to plan a target of an MSP package. | ||
308 | /// </summary> | ||
309 | event EventHandler<PlanPatchTargetEventArgs> PlanPatchTarget; | ||
310 | |||
311 | /// <summary> | ||
312 | /// Fired when the engine has begun planning for a related bundle. | ||
313 | /// </summary> | ||
314 | event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; | ||
315 | |||
316 | /// <summary> | ||
317 | /// Fired when the engine has changed progress for the bundle installation. | ||
318 | /// </summary> | ||
319 | event EventHandler<ProgressEventArgs> Progress; | ||
320 | |||
321 | /// <summary> | ||
322 | /// Fired when the engine has begun registering the location and visibility of the bundle. | ||
323 | /// </summary> | ||
324 | event EventHandler<RegisterBeginEventArgs> RegisterBegin; | ||
325 | |||
326 | /// <summary> | ||
327 | /// Fired when the engine has completed registering the location and visibility of the bundle. | ||
328 | /// </summary> | ||
329 | event EventHandler<RegisterCompleteEventArgs> RegisterComplete; | ||
330 | |||
331 | /// <summary> | ||
332 | /// Fired when the engine is about to rollback an MSI transaction. | ||
333 | /// </summary> | ||
334 | event EventHandler<RollbackMsiTransactionBeginEventArgs> RollbackMsiTransactionBegin; | ||
335 | |||
336 | /// <summary> | ||
337 | /// Fired when the engine has completed rolling back an MSI transaction. | ||
338 | /// </summary> | ||
339 | event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; | ||
340 | |||
341 | /// <summary> | ||
342 | /// Fired when the engine is shutting down the bootstrapper application. | ||
343 | /// </summary> | ||
344 | event EventHandler<ShutdownEventArgs> Shutdown; | ||
345 | |||
346 | /// <summary> | ||
347 | /// Fired when the engine is starting up the bootstrapper application. | ||
348 | /// </summary> | ||
349 | event EventHandler<StartupEventArgs> Startup; | ||
350 | |||
351 | /// <summary> | ||
352 | /// Fired when the engine is about to take a system restore point. | ||
353 | /// </summary> | ||
354 | event EventHandler<SystemRestorePointBeginEventArgs> SystemRestorePointBegin; | ||
355 | |||
356 | /// <summary> | ||
357 | /// Fired when the engine has completed taking a system restore point. | ||
358 | /// </summary> | ||
359 | event EventHandler<SystemRestorePointCompleteEventArgs> SystemRestorePointComplete; | ||
360 | |||
361 | /// <summary> | ||
362 | /// Fired when the system is shutting down or user is logging off. | ||
363 | /// </summary> | ||
364 | /// <remarks> | ||
365 | /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to | ||
366 | /// true; otherwise, set it to false.</para> | ||
367 | /// <para>By default setup will prevent shutting down or logging off between | ||
368 | /// <see cref="IDefaultBootstrapperApplication.ApplyBegin"/> and <see cref="IDefaultBootstrapperApplication.ApplyComplete"/>. | ||
369 | /// Derivatives can change this behavior by handling <see cref="IDefaultBootstrapperApplication.SystemShutdown"/>.</para> | ||
370 | /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/> | ||
371 | /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other | ||
372 | /// critical operations before being closed by the operating system.</para> | ||
373 | /// <para>This event may be fired on a different thread.</para> | ||
374 | /// </remarks> | ||
375 | event EventHandler<SystemShutdownEventArgs> SystemShutdown; | ||
376 | |||
377 | /// <summary> | ||
378 | /// Fired when the engine unregisters the bundle. | ||
379 | /// </summary> | ||
380 | event EventHandler<UnregisterBeginEventArgs> UnregisterBegin; | ||
381 | |||
382 | /// <summary> | ||
383 | /// Fired when the engine unregistration is complete. | ||
384 | /// </summary> | ||
385 | event EventHandler<UnregisterCompleteEventArgs> UnregisterComplete; | ||
386 | } | ||
387 | } \ No newline at end of file | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IEngine.cs b/src/api/burn/WixToolset.Mba.Core/IEngine.cs new file mode 100644 index 00000000..3e636961 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IEngine.cs | |||
@@ -0,0 +1,222 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.ComponentModel; | ||
7 | using System.Security; | ||
8 | |||
9 | /// <summary> | ||
10 | /// High level abstraction over the <see cref="IBootstrapperEngine"/> interface. | ||
11 | /// </summary> | ||
12 | public interface IEngine | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Gets the number of packages in the bundle. | ||
16 | /// </summary> | ||
17 | int PackageCount { get; } | ||
18 | |||
19 | /// <summary> | ||
20 | /// Install the packages. | ||
21 | /// </summary> | ||
22 | /// <param name="hwndParent">The parent window for the installation user interface.</param> | ||
23 | void Apply(IntPtr hwndParent); | ||
24 | |||
25 | /// <summary> | ||
26 | /// Close the splash screen if it is still open. Does nothing if the splash screen is not or | ||
27 | /// never was opened. | ||
28 | /// </summary> | ||
29 | void CloseSplashScreen(); | ||
30 | |||
31 | /// <returns>0 if equal, 1 if version1 > version2, -1 if version1 < version2</returns> | ||
32 | int CompareVersions(string version1, string version2); | ||
33 | |||
34 | /// <summary> | ||
35 | /// Checks if a variable exists in the engine. | ||
36 | /// </summary> | ||
37 | /// <param name="name">The name of the variable.</param> | ||
38 | /// <returns>Whether the variable exists.</returns> | ||
39 | bool ContainsVariable(string name); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Determine if all installation conditions are fulfilled. | ||
43 | /// </summary> | ||
44 | void Detect(); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Determine if all installation conditions are fulfilled. | ||
48 | /// </summary> | ||
49 | /// <param name="hwndParent">The parent window for the installation user interface.</param> | ||
50 | void Detect(IntPtr hwndParent); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Elevate the install. | ||
54 | /// </summary> | ||
55 | /// <param name="hwndParent">The parent window of the elevation dialog.</param> | ||
56 | /// <returns>true if elevation succeeded; otherwise, false if the user cancelled.</returns> | ||
57 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
58 | bool Elevate(IntPtr hwndParent); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Escapes the input string. | ||
62 | /// </summary> | ||
63 | /// <param name="input">The string to escape.</param> | ||
64 | /// <returns>The escaped string.</returns> | ||
65 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
66 | string EscapeString(string input); | ||
67 | |||
68 | /// <summary> | ||
69 | /// Evaluates the <paramref name="condition"/> string. | ||
70 | /// </summary> | ||
71 | /// <param name="condition">The string representing the condition to evaluate.</param> | ||
72 | /// <returns>Whether the condition evaluated to true or false.</returns> | ||
73 | bool EvaluateCondition(string condition); | ||
74 | |||
75 | /// <summary> | ||
76 | /// Formats the input string. | ||
77 | /// </summary> | ||
78 | /// <param name="format">The string to format.</param> | ||
79 | /// <returns>The formatted string.</returns> | ||
80 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
81 | string FormatString(string format); | ||
82 | |||
83 | /// <summary> | ||
84 | /// Gets numeric variables for the engine. | ||
85 | /// </summary> | ||
86 | /// <param name="name">The name of the variable.</param> | ||
87 | long GetVariableNumeric(string name); | ||
88 | |||
89 | /// <summary> | ||
90 | /// Gets string variables for the engine using SecureStrings. | ||
91 | /// </summary> | ||
92 | /// <param name="name">The name of the variable.</param> | ||
93 | SecureString GetVariableSecureString(string name); | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets string variables for the engine. | ||
97 | /// </summary> | ||
98 | /// <param name="name">The name of the variable.</param> | ||
99 | string GetVariableString(string name); | ||
100 | |||
101 | /// <summary> | ||
102 | /// Gets <see cref="Version"/> variables for the engine. | ||
103 | /// </summary> | ||
104 | /// <param name="name">The name of the variable.</param> | ||
105 | string GetVariableVersion(string name); | ||
106 | |||
107 | /// <summary> | ||
108 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. | ||
109 | /// </summary> | ||
110 | /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param> | ||
111 | /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param> | ||
112 | /// <param name="arguments">Optional arguments.</param> | ||
113 | void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments); | ||
114 | |||
115 | /// <summary> | ||
116 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. | ||
117 | /// </summary> | ||
118 | /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param> | ||
119 | /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param> | ||
120 | /// <param name="arguments">Optional arguments.</param> | ||
121 | /// <param name="waitForInputIdleTimeout">Timeout in milliseconds. When set to something other than zero, the engine will call WaitForInputIdle for the new process with this timeout before calling OnLaunchApprovedExeComplete.</param> | ||
122 | void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout); | ||
123 | |||
124 | /// <summary> | ||
125 | /// Logs the <paramref name="message"/>. | ||
126 | /// </summary> | ||
127 | /// <param name="level">The logging level.</param> | ||
128 | /// <param name="message">The message to log.</param> | ||
129 | void Log(LogLevel level, string message); | ||
130 | |||
131 | /// <summary> | ||
132 | /// Determine the installation sequencing and costing. | ||
133 | /// </summary> | ||
134 | /// <param name="action">The action to perform when planning.</param> | ||
135 | void Plan(LaunchAction action); | ||
136 | |||
137 | /// <summary> | ||
138 | /// Set the update information for a bundle. | ||
139 | /// </summary> | ||
140 | /// <param name="localSource">Optional local source path for the update. Default is "update\[OriginalNameOfBundle].exe".</param> | ||
141 | /// <param name="downloadSource">Optional download source for the update.</param> | ||
142 | /// <param name="size">Size of the expected update.</param> | ||
143 | /// <param name="hashType">Type of the hash expected on the update.</param> | ||
144 | /// <param name="hash">Optional hash expected for the update.</param> | ||
145 | void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, byte[] hash); | ||
146 | |||
147 | /// <summary> | ||
148 | /// Sets the URL to the update feed. | ||
149 | /// </summary> | ||
150 | /// <param name="url">URL of the update feed.</param> | ||
151 | void SetUpdateSource(string url); | ||
152 | |||
153 | /// <summary> | ||
154 | /// Set the local source for a package or container. | ||
155 | /// </summary> | ||
156 | /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param> | ||
157 | /// <param name="payloadId">The id that uniquely identifies the payload.</param> | ||
158 | /// <param name="path">The new source path.</param> | ||
159 | void SetLocalSource(string packageOrContainerId, string payloadId, string path); | ||
160 | |||
161 | /// <summary> | ||
162 | /// Set the new download URL for a package or container. | ||
163 | /// </summary> | ||
164 | /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param> | ||
165 | /// <param name="payloadId">The id that uniquely identifies the payload.</param> | ||
166 | /// <param name="url">The new url.</param> | ||
167 | /// <param name="user">The user name for proxy authentication.</param> | ||
168 | /// <param name="password">The password for proxy authentication.</param> | ||
169 | void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password); | ||
170 | |||
171 | /// <summary> | ||
172 | /// Sets numeric variables for the engine. | ||
173 | /// </summary> | ||
174 | /// <param name="name">The name of the variable.</param> | ||
175 | /// <param name="value">The value to set.</param> | ||
176 | void SetVariableNumeric(string name, long value); | ||
177 | |||
178 | /// <summary> | ||
179 | /// Sets string variables for the engine using SecureStrings. | ||
180 | /// </summary> | ||
181 | /// <param name="name">The name of the variable.</param> | ||
182 | /// <param name="value">The value to set.</param> | ||
183 | /// <param name="formatted">False if the value is a literal string.</param> | ||
184 | void SetVariableString(string name, SecureString value, bool formatted); | ||
185 | |||
186 | /// <summary> | ||
187 | /// Sets string variables for the engine. | ||
188 | /// </summary> | ||
189 | /// <param name="name">The name of the variable.</param> | ||
190 | /// <param name="value">The value to set.</param> | ||
191 | /// <param name="formatted">False if the value is a literal string.</param> | ||
192 | void SetVariableString(string name, string value, bool formatted); | ||
193 | |||
194 | /// <summary> | ||
195 | /// Sets version variables for the engine. | ||
196 | /// </summary> | ||
197 | /// <param name="name">The name of the variable.</param> | ||
198 | /// <param name="value">The value to set.</param> | ||
199 | void SetVariableVersion(string name, string value); | ||
200 | |||
201 | /// <summary> | ||
202 | /// Sends error message when embedded. | ||
203 | /// </summary> | ||
204 | /// <param name="errorCode">Error code.</param> | ||
205 | /// <param name="message">Error message.</param> | ||
206 | /// <param name="uiHint">UI buttons to show on error dialog.</param> | ||
207 | int SendEmbeddedError(int errorCode, string message, int uiHint); | ||
208 | |||
209 | /// <summary> | ||
210 | /// Sends progress percentages when embedded. | ||
211 | /// </summary> | ||
212 | /// <param name="progressPercentage">Percentage completed thus far.</param> | ||
213 | /// <param name="overallPercentage">Overall percentage completed.</param> | ||
214 | int SendEmbeddedProgress(int progressPercentage, int overallPercentage); | ||
215 | |||
216 | /// <summary> | ||
217 | /// Shuts down the engine. | ||
218 | /// </summary> | ||
219 | /// <param name="exitCode">Exit code indicating reason for shut down.</param> | ||
220 | void Quit(int exitCode); | ||
221 | } | ||
222 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs new file mode 100644 index 00000000..a1d99b10 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs | |||
@@ -0,0 +1,90 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | /// <summary> | ||
6 | /// Package information from the BA manifest. | ||
7 | /// </summary> | ||
8 | public interface IPackageInfo | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// | ||
12 | /// </summary> | ||
13 | BOOTSTRAPPER_CACHE_TYPE CacheType { get; } | ||
14 | |||
15 | /// <summary> | ||
16 | /// Place for the BA to store it's own custom data for this package. | ||
17 | /// </summary> | ||
18 | object CustomData { get; set; } | ||
19 | |||
20 | /// <summary> | ||
21 | /// | ||
22 | /// </summary> | ||
23 | string Description { get; } | ||
24 | |||
25 | /// <summary> | ||
26 | /// | ||
27 | /// </summary> | ||
28 | string DisplayInternalUICondition { get; } | ||
29 | |||
30 | /// <summary> | ||
31 | /// | ||
32 | /// </summary> | ||
33 | string DisplayName { get; } | ||
34 | |||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | string Id { get; } | ||
39 | |||
40 | /// <summary> | ||
41 | /// | ||
42 | /// </summary> | ||
43 | string InstallCondition { get; } | ||
44 | |||
45 | /// <summary> | ||
46 | /// | ||
47 | /// </summary> | ||
48 | bool Permanent { get; } | ||
49 | |||
50 | /// <summary> | ||
51 | /// | ||
52 | /// </summary> | ||
53 | bool PrereqPackage { get; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// | ||
57 | /// </summary> | ||
58 | string PrereqLicenseFile { get; } | ||
59 | |||
60 | /// <summary> | ||
61 | /// | ||
62 | /// </summary> | ||
63 | string PrereqLicenseUrl { get; } | ||
64 | |||
65 | /// <summary> | ||
66 | /// | ||
67 | /// </summary> | ||
68 | string ProductCode { get; } | ||
69 | |||
70 | /// <summary> | ||
71 | /// | ||
72 | /// </summary> | ||
73 | PackageType Type { get; } | ||
74 | |||
75 | /// <summary> | ||
76 | /// | ||
77 | /// </summary> | ||
78 | string UpgradeCode { get; } | ||
79 | |||
80 | /// <summary> | ||
81 | /// | ||
82 | /// </summary> | ||
83 | string Version { get; } | ||
84 | |||
85 | /// <summary> | ||
86 | /// | ||
87 | /// </summary> | ||
88 | bool Vital { get; } | ||
89 | } | ||
90 | } \ No newline at end of file | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/NativeMethods.cs b/src/api/burn/WixToolset.Mba.Core/NativeMethods.cs new file mode 100644 index 00000000..adb2256e --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/NativeMethods.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Contains native constants, functions, and structures for this assembly. | ||
10 | /// </summary> | ||
11 | internal static class NativeMethods | ||
12 | { | ||
13 | #region Error Constants | ||
14 | internal const int S_OK = 0; | ||
15 | internal const int E_MOREDATA = unchecked((int)0x800700ea); | ||
16 | internal const int E_INSUFFICIENT_BUFFER = unchecked((int)0x8007007a); | ||
17 | internal const int E_CANCELLED = unchecked((int)0x800704c7); | ||
18 | internal const int E_ALREADYINITIALIZED = unchecked((int)0x800704df); | ||
19 | internal const int E_NOTFOUND = unchecked((int)0x80070490); | ||
20 | internal const int E_NOTIMPL = unchecked((int)0x80004001); | ||
21 | internal const int E_UNEXPECTED = unchecked((int)0x8000ffff); | ||
22 | #endregion | ||
23 | |||
24 | #region Functions | ||
25 | [DllImport("shell32.dll", ExactSpelling = true, SetLastError = true)] | ||
26 | internal static extern IntPtr CommandLineToArgvW( | ||
27 | [MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, | ||
28 | out int pNumArgs | ||
29 | ); | ||
30 | |||
31 | [DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)] | ||
32 | internal static extern IntPtr LocalFree( | ||
33 | IntPtr hMem | ||
34 | ); | ||
35 | #endregion | ||
36 | } | ||
37 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs new file mode 100644 index 00000000..567a7cdd --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs | |||
@@ -0,0 +1,317 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Xml; | ||
8 | using System.Xml.XPath; | ||
9 | |||
10 | /// <summary> | ||
11 | /// | ||
12 | /// </summary> | ||
13 | public enum PackageType | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// | ||
17 | /// </summary> | ||
18 | Unknown, | ||
19 | |||
20 | /// <summary> | ||
21 | /// | ||
22 | /// </summary> | ||
23 | Exe, | ||
24 | |||
25 | /// <summary> | ||
26 | /// | ||
27 | /// </summary> | ||
28 | Msi, | ||
29 | |||
30 | /// <summary> | ||
31 | /// | ||
32 | /// </summary> | ||
33 | Msp, | ||
34 | |||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | Msu, | ||
39 | |||
40 | /// <summary> | ||
41 | /// | ||
42 | /// </summary> | ||
43 | UpgradeBundle, | ||
44 | |||
45 | /// <summary> | ||
46 | /// | ||
47 | /// </summary> | ||
48 | AddonBundle, | ||
49 | |||
50 | /// <summary> | ||
51 | /// | ||
52 | /// </summary> | ||
53 | PatchBundle, | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// Default implementation of <see cref="IPackageInfo"/>. | ||
58 | /// </summary> | ||
59 | public class PackageInfo : IPackageInfo | ||
60 | { | ||
61 | /// <inheritdoc/> | ||
62 | public string Id { get; internal set; } | ||
63 | |||
64 | /// <inheritdoc/> | ||
65 | public string DisplayName { get; internal set; } | ||
66 | |||
67 | /// <inheritdoc/> | ||
68 | public string Description { get; internal set; } | ||
69 | |||
70 | /// <inheritdoc/> | ||
71 | public PackageType Type { get; internal set; } | ||
72 | |||
73 | /// <inheritdoc/> | ||
74 | public bool Permanent { get; internal set; } | ||
75 | |||
76 | /// <inheritdoc/> | ||
77 | public bool Vital { get; internal set; } | ||
78 | |||
79 | /// <inheritdoc/> | ||
80 | public string DisplayInternalUICondition { get; internal set; } | ||
81 | |||
82 | /// <inheritdoc/> | ||
83 | public string ProductCode { get; internal set; } | ||
84 | |||
85 | /// <inheritdoc/> | ||
86 | public string UpgradeCode { get; internal set; } | ||
87 | |||
88 | /// <inheritdoc/> | ||
89 | public string Version { get; internal set; } | ||
90 | |||
91 | /// <inheritdoc/> | ||
92 | public string InstallCondition { get; internal set; } | ||
93 | |||
94 | /// <inheritdoc/> | ||
95 | public BOOTSTRAPPER_CACHE_TYPE CacheType { get; internal set; } | ||
96 | |||
97 | /// <inheritdoc/> | ||
98 | public bool PrereqPackage { get; internal set; } | ||
99 | |||
100 | /// <inheritdoc/> | ||
101 | public string PrereqLicenseFile { get; internal set; } | ||
102 | |||
103 | /// <inheritdoc/> | ||
104 | public string PrereqLicenseUrl { get; internal set; } | ||
105 | |||
106 | /// <inheritdoc/> | ||
107 | public object CustomData { get; set; } | ||
108 | |||
109 | internal PackageInfo() { } | ||
110 | |||
111 | /// <summary> | ||
112 | /// | ||
113 | /// </summary> | ||
114 | /// <param name="root"></param> | ||
115 | /// <returns></returns> | ||
116 | public static IDictionary<string, IPackageInfo> ParsePackagesFromXml(XPathNavigator root) | ||
117 | { | ||
118 | var packagesById = new Dictionary<string, IPackageInfo>(); | ||
119 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); | ||
120 | namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); | ||
121 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixPackageProperties", namespaceManager); | ||
122 | |||
123 | foreach (XPathNavigator node in nodes) | ||
124 | { | ||
125 | var package = new PackageInfo(); | ||
126 | |||
127 | string id = BootstrapperApplicationData.GetAttribute(node, "Package"); | ||
128 | if (id == null) | ||
129 | { | ||
130 | throw new Exception("Failed to get package identifier for package."); | ||
131 | } | ||
132 | package.Id = id; | ||
133 | |||
134 | package.DisplayName = BootstrapperApplicationData.GetAttribute(node, "DisplayName"); | ||
135 | |||
136 | package.Description = BootstrapperApplicationData.GetAttribute(node, "Description"); | ||
137 | |||
138 | PackageType? packageType = GetPackageTypeAttribute(node, "PackageType"); | ||
139 | if (!packageType.HasValue) | ||
140 | { | ||
141 | throw new Exception("Failed to get package type for package."); | ||
142 | } | ||
143 | package.Type = packageType.Value; | ||
144 | |||
145 | bool? permanent = BootstrapperApplicationData.GetYesNoAttribute(node, "Permanent"); | ||
146 | if (!permanent.HasValue) | ||
147 | { | ||
148 | throw new Exception("Failed to get permanent settings for package."); | ||
149 | } | ||
150 | package.Permanent = permanent.Value; | ||
151 | |||
152 | bool? vital = BootstrapperApplicationData.GetYesNoAttribute(node, "Vital"); | ||
153 | if (!vital.HasValue) | ||
154 | { | ||
155 | throw new Exception("Failed to get vital setting for package."); | ||
156 | } | ||
157 | package.Vital = vital.Value; | ||
158 | |||
159 | package.ProductCode = BootstrapperApplicationData.GetAttribute(node, "ProductCode"); | ||
160 | |||
161 | package.UpgradeCode = BootstrapperApplicationData.GetAttribute(node, "UpgradeCode"); | ||
162 | |||
163 | package.Version = BootstrapperApplicationData.GetAttribute(node, "Version"); | ||
164 | |||
165 | package.InstallCondition = BootstrapperApplicationData.GetAttribute(node, "InstallCondition"); | ||
166 | |||
167 | packagesById.Add(package.Id, package); | ||
168 | } | ||
169 | |||
170 | ParseBalPackageInfoFromXml(root, namespaceManager, packagesById); | ||
171 | return packagesById; | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// | ||
176 | /// </summary> | ||
177 | /// <param name="node"></param> | ||
178 | /// <param name="attributeName"></param> | ||
179 | /// <returns></returns> | ||
180 | public static BOOTSTRAPPER_CACHE_TYPE? GetCacheTypeAttribute(XPathNavigator node, string attributeName) | ||
181 | { | ||
182 | string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName); | ||
183 | |||
184 | if (attributeValue == null) | ||
185 | { | ||
186 | return null; | ||
187 | } | ||
188 | |||
189 | if (attributeValue.Equals("keep", StringComparison.InvariantCulture)) | ||
190 | { | ||
191 | return BOOTSTRAPPER_CACHE_TYPE.Keep; | ||
192 | } | ||
193 | else if (attributeValue.Equals("force", StringComparison.InvariantCulture)) | ||
194 | { | ||
195 | return BOOTSTRAPPER_CACHE_TYPE.Force; | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | return BOOTSTRAPPER_CACHE_TYPE.Remove; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | /// <summary> | ||
204 | /// | ||
205 | /// </summary> | ||
206 | /// <param name="node"></param> | ||
207 | /// <param name="attributeName"></param> | ||
208 | /// <returns></returns> | ||
209 | public static PackageType? GetPackageTypeAttribute(XPathNavigator node, string attributeName) | ||
210 | { | ||
211 | string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName); | ||
212 | |||
213 | if (attributeValue == null) | ||
214 | { | ||
215 | return null; | ||
216 | } | ||
217 | |||
218 | if (attributeValue.Equals("Exe", StringComparison.InvariantCulture)) | ||
219 | { | ||
220 | return PackageType.Exe; | ||
221 | } | ||
222 | else if (attributeValue.Equals("Msi", StringComparison.InvariantCulture)) | ||
223 | { | ||
224 | return PackageType.Msi; | ||
225 | } | ||
226 | else if (attributeValue.Equals("Msp", StringComparison.InvariantCulture)) | ||
227 | { | ||
228 | return PackageType.Msp; | ||
229 | } | ||
230 | else if (attributeValue.Equals("Msu", StringComparison.InvariantCulture)) | ||
231 | { | ||
232 | return PackageType.Msu; | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | return PackageType.Unknown; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | /// <summary> | ||
241 | /// | ||
242 | /// </summary> | ||
243 | /// <param name="id"></param> | ||
244 | /// <param name="relationType"></param> | ||
245 | /// <param name="perMachine"></param> | ||
246 | /// <param name="version"></param> | ||
247 | /// <returns></returns> | ||
248 | public static IPackageInfo GetRelatedBundleAsPackage(string id, RelationType relationType, bool perMachine, string version) | ||
249 | { | ||
250 | PackageInfo package = new PackageInfo(); | ||
251 | package.Id = id; | ||
252 | package.Version = version; | ||
253 | |||
254 | switch (relationType) | ||
255 | { | ||
256 | case RelationType.Addon: | ||
257 | package.Type = PackageType.AddonBundle; | ||
258 | break; | ||
259 | case RelationType.Patch: | ||
260 | package.Type = PackageType.PatchBundle; | ||
261 | break; | ||
262 | case RelationType.Upgrade: | ||
263 | package.Type = PackageType.UpgradeBundle; | ||
264 | break; | ||
265 | default: | ||
266 | throw new Exception(string.Format("Unknown related bundle type: {0}", relationType)); | ||
267 | } | ||
268 | |||
269 | return package; | ||
270 | } | ||
271 | |||
272 | internal static void ParseBalPackageInfoFromXml(XPathNavigator root, XmlNamespaceManager namespaceManager, Dictionary<string, IPackageInfo> packagesById) | ||
273 | { | ||
274 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixBalPackageInfo", namespaceManager); | ||
275 | |||
276 | foreach (XPathNavigator node in nodes) | ||
277 | { | ||
278 | string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); | ||
279 | if (id == null) | ||
280 | { | ||
281 | throw new Exception("Failed to get package identifier for WixBalPackageInfo."); | ||
282 | } | ||
283 | |||
284 | if (!packagesById.TryGetValue(id, out var ipackage)) | ||
285 | { | ||
286 | throw new Exception(string.Format("Failed to find package specified in WixBalPackageInfo: {0}", id)); | ||
287 | } | ||
288 | |||
289 | var package = (PackageInfo)ipackage; | ||
290 | |||
291 | package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition"); | ||
292 | } | ||
293 | |||
294 | nodes = root.Select("/p:BootstrapperApplicationData/p:WixMbaPrereqInformation", namespaceManager); | ||
295 | |||
296 | foreach (XPathNavigator node in nodes) | ||
297 | { | ||
298 | string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); | ||
299 | if (id == null) | ||
300 | { | ||
301 | throw new Exception("Failed to get package identifier for WixMbaPrereqInformation."); | ||
302 | } | ||
303 | |||
304 | if (!packagesById.TryGetValue(id, out var ipackage)) | ||
305 | { | ||
306 | throw new Exception(string.Format("Failed to find package specified in WixMbaPrereqInformation: {0}", id)); | ||
307 | } | ||
308 | |||
309 | var package = (PackageInfo)ipackage; | ||
310 | |||
311 | package.PrereqPackage = true; | ||
312 | package.PrereqLicenseFile = BootstrapperApplicationData.GetAttribute(node, "LicenseFile"); | ||
313 | package.PrereqLicenseUrl = BootstrapperApplicationData.GetAttribute(node, "LicenseUrl"); | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/VerUtil.cs b/src/api/burn/WixToolset.Mba.Core/VerUtil.cs new file mode 100644 index 00000000..81c5b716 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/VerUtil.cs | |||
@@ -0,0 +1,145 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | using System.Text; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Managed wrapper for verutil. | ||
11 | /// </summary> | ||
12 | public static class VerUtil | ||
13 | { | ||
14 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
15 | internal static extern int VerCompareParsedVersions( | ||
16 | VersionHandle pVersion1, | ||
17 | VersionHandle pVersion2 | ||
18 | ); | ||
19 | |||
20 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
21 | internal static extern int VerCompareStringVersions( | ||
22 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion1, | ||
23 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion2, | ||
24 | [MarshalAs(UnmanagedType.Bool)] bool fStrict | ||
25 | ); | ||
26 | |||
27 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
28 | internal static extern VersionHandle VerCopyVersion( | ||
29 | VersionHandle pSource | ||
30 | ); | ||
31 | |||
32 | [DllImport("mbanative.dll", ExactSpelling = true)] | ||
33 | internal static extern void VerFreeVersion( | ||
34 | IntPtr pVersion | ||
35 | ); | ||
36 | |||
37 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
38 | internal static extern VersionHandle VerParseVersion( | ||
39 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, | ||
40 | [MarshalAs(UnmanagedType.U4)] uint cchValue, | ||
41 | [MarshalAs(UnmanagedType.Bool)] bool fStrict | ||
42 | ); | ||
43 | |||
44 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | ||
45 | internal static extern VersionHandle VerVersionFromQword( | ||
46 | [MarshalAs(UnmanagedType.I8)] long qwVersion | ||
47 | ); | ||
48 | |||
49 | [StructLayout(LayoutKind.Sequential)] | ||
50 | internal struct VersionReleaseLabelStruct | ||
51 | { | ||
52 | public bool fNumeric; | ||
53 | public uint dwValue; | ||
54 | public IntPtr cchLabelOffset; | ||
55 | public int cchLabel; | ||
56 | } | ||
57 | |||
58 | [StructLayout(LayoutKind.Sequential)] | ||
59 | internal struct VersionStruct | ||
60 | { | ||
61 | public IntPtr sczVersion; | ||
62 | public uint dwMajor; | ||
63 | public uint dwMinor; | ||
64 | public uint dwPatch; | ||
65 | public uint dwRevision; | ||
66 | public int cReleaseLabels; | ||
67 | public IntPtr rgReleaseLabels; | ||
68 | public IntPtr cchMetadataOffset; | ||
69 | public bool fInvalid; | ||
70 | } | ||
71 | |||
72 | internal static string VersionStringFromOffset(IntPtr wzVersion, IntPtr cchOffset, int? cchLength = null) | ||
73 | { | ||
74 | var offset = cchOffset.ToInt64() * UnicodeEncoding.CharSize; | ||
75 | var wz = new IntPtr(wzVersion.ToInt64() + offset); | ||
76 | if (cchLength.HasValue) | ||
77 | { | ||
78 | return Marshal.PtrToStringUni(wz, (int)cchLength); | ||
79 | } | ||
80 | else | ||
81 | { | ||
82 | return Marshal.PtrToStringUni(wz); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | internal sealed class VersionHandle : SafeHandle | ||
87 | { | ||
88 | public VersionHandle() : base(IntPtr.Zero, true) { } | ||
89 | |||
90 | public override bool IsInvalid => false; | ||
91 | |||
92 | protected override bool ReleaseHandle() | ||
93 | { | ||
94 | VerFreeVersion(this.handle); | ||
95 | return true; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <returns>0 if equal, 1 if version1 > version2, -1 if version1 < version2</returns> | ||
100 | public static int CompareParsedVersions(VerUtilVersion version1, VerUtilVersion version2) | ||
101 | { | ||
102 | return VerCompareParsedVersions(version1.GetHandle(), version2.GetHandle()); | ||
103 | } | ||
104 | |||
105 | /// <returns>0 if equal, 1 if version1 > version2, -1 if version1 < version2</returns> | ||
106 | public static int CompareStringVersions(string version1, string version2, bool strict) | ||
107 | { | ||
108 | return VerCompareStringVersions(version1, version2, strict); | ||
109 | } | ||
110 | |||
111 | /// <summary> | ||
112 | /// | ||
113 | /// </summary> | ||
114 | /// <param name="version"></param> | ||
115 | /// <returns></returns> | ||
116 | public static VerUtilVersion CopyVersion(VerUtilVersion version) | ||
117 | { | ||
118 | var handle = VerCopyVersion(version.GetHandle()); | ||
119 | return new VerUtilVersion(handle); | ||
120 | } | ||
121 | |||
122 | /// <summary> | ||
123 | /// | ||
124 | /// </summary> | ||
125 | /// <param name="version"></param> | ||
126 | /// <param name="strict">Whether to throw exception on invalid version.</param> | ||
127 | /// <returns></returns> | ||
128 | public static VerUtilVersion ParseVersion(string version, bool strict) | ||
129 | { | ||
130 | var handle = VerParseVersion(version, 0, strict); | ||
131 | return new VerUtilVersion(handle); | ||
132 | } | ||
133 | |||
134 | /// <summary> | ||
135 | /// | ||
136 | /// </summary> | ||
137 | /// <param name="version"></param> | ||
138 | /// <returns></returns> | ||
139 | public static VerUtilVersion VersionFromQword(long version) | ||
140 | { | ||
141 | var handle = VerVersionFromQword(version); | ||
142 | return new VerUtilVersion(handle); | ||
143 | } | ||
144 | } | ||
145 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/VerUtilVersion.cs b/src/api/burn/WixToolset.Mba.Core/VerUtilVersion.cs new file mode 100644 index 00000000..7408c26f --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/VerUtilVersion.cs | |||
@@ -0,0 +1,99 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | /// <summary> | ||
9 | /// An enhanced implementation of SemVer 2.0. | ||
10 | /// </summary> | ||
11 | public sealed class VerUtilVersion : IDisposable | ||
12 | { | ||
13 | internal VerUtilVersion(VerUtil.VersionHandle handle) | ||
14 | { | ||
15 | this.Handle = handle; | ||
16 | |||
17 | var pVersion = handle.DangerousGetHandle(); | ||
18 | var version = (VerUtil.VersionStruct)Marshal.PtrToStructure(pVersion, typeof(VerUtil.VersionStruct)); | ||
19 | this.Version = Marshal.PtrToStringUni(version.sczVersion); | ||
20 | this.Major = version.dwMajor; | ||
21 | this.Minor = version.dwMinor; | ||
22 | this.Patch = version.dwPatch; | ||
23 | this.Revision = version.dwRevision; | ||
24 | this.ReleaseLabels = new VerUtilVersionReleaseLabel[version.cReleaseLabels]; | ||
25 | this.Metadata = VerUtil.VersionStringFromOffset(version.sczVersion, version.cchMetadataOffset); | ||
26 | this.IsInvalid = version.fInvalid; | ||
27 | |||
28 | for (var i = 0; i < version.cReleaseLabels; ++i) | ||
29 | { | ||
30 | var offset = i * Marshal.SizeOf(typeof(VerUtil.VersionReleaseLabelStruct)); | ||
31 | var pReleaseLabel = new IntPtr(version.rgReleaseLabels.ToInt64() + offset); | ||
32 | this.ReleaseLabels[i] = new VerUtilVersionReleaseLabel(pReleaseLabel, version.sczVersion); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// String version, which would have stripped the leading 'v'. | ||
38 | /// </summary> | ||
39 | public string Version { get; private set; } | ||
40 | |||
41 | /// <summary> | ||
42 | /// For version A.B.C.D, Major is A. It is 0 if not specified. | ||
43 | /// </summary> | ||
44 | public uint Major { get; private set; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// For version A.B.C.D, Minor is B. It is 0 if not specified. | ||
48 | /// </summary> | ||
49 | public uint Minor { get; private set; } | ||
50 | |||
51 | /// <summary> | ||
52 | /// For version A.B.C.D, Patch is C. It is 0 if not specified. | ||
53 | /// </summary> | ||
54 | public uint Patch { get; private set; } | ||
55 | |||
56 | /// <summary> | ||
57 | /// For version A.B.C.D, Revision is D. It is 0 if not specified. | ||
58 | /// </summary> | ||
59 | public uint Revision { get; private set; } | ||
60 | |||
61 | /// <summary> | ||
62 | /// For version X.Y.Z-releaselabels+metadata, ReleaseLabels is the parsed information for releaselabels. | ||
63 | /// </summary> | ||
64 | public VerUtilVersionReleaseLabel[] ReleaseLabels { get; private set; } | ||
65 | |||
66 | /// <summary> | ||
67 | /// For version X.Y.Z-releaselabels+metadata, Metadata is the rest of the string after +. | ||
68 | /// For invalid versions, it is all of the string after the point where it was an invalid string. | ||
69 | /// </summary> | ||
70 | public string Metadata { get; private set; } | ||
71 | |||
72 | /// <summary> | ||
73 | /// Whether the version conformed to the spec. | ||
74 | /// </summary> | ||
75 | public bool IsInvalid { get; private set; } | ||
76 | |||
77 | /// <inheritdoc/> | ||
78 | public void Dispose() | ||
79 | { | ||
80 | if (this.Handle != null) | ||
81 | { | ||
82 | this.Handle.Dispose(); | ||
83 | this.Handle = null; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private VerUtil.VersionHandle Handle { get; set; } | ||
88 | |||
89 | internal VerUtil.VersionHandle GetHandle() | ||
90 | { | ||
91 | if (this.Handle == null) | ||
92 | { | ||
93 | throw new ObjectDisposedException(this.Version); | ||
94 | } | ||
95 | |||
96 | return this.Handle; | ||
97 | } | ||
98 | } | ||
99 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/VerUtilVersionReleaseLabel.cs b/src/api/burn/WixToolset.Mba.Core/VerUtilVersionReleaseLabel.cs new file mode 100644 index 00000000..97e8190d --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/VerUtilVersionReleaseLabel.cs | |||
@@ -0,0 +1,36 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | |||
8 | /// <summary> | ||
9 | /// A release label from a <see cref="VerUtilVersion"/>. | ||
10 | /// </summary> | ||
11 | public sealed class VerUtilVersionReleaseLabel | ||
12 | { | ||
13 | internal VerUtilVersionReleaseLabel(IntPtr pReleaseLabel, IntPtr wzVersion) | ||
14 | { | ||
15 | var releaseLabel = (VerUtil.VersionReleaseLabelStruct)Marshal.PtrToStructure(pReleaseLabel, typeof(VerUtil.VersionReleaseLabelStruct)); | ||
16 | this.IsNumeric = releaseLabel.fNumeric; | ||
17 | this.Value = releaseLabel.dwValue; | ||
18 | this.Label = VerUtil.VersionStringFromOffset(wzVersion, releaseLabel.cchLabelOffset, releaseLabel.cchLabel); | ||
19 | } | ||
20 | |||
21 | /// <summary> | ||
22 | /// Whether the label was parsed as a number. | ||
23 | /// </summary> | ||
24 | public bool IsNumeric { get; private set; } | ||
25 | |||
26 | /// <summary> | ||
27 | /// If <see cref="IsNumeric"/> then the value that was parsed. | ||
28 | /// </summary> | ||
29 | public uint Value { get; private set; } | ||
30 | |||
31 | /// <summary> | ||
32 | /// The string version of the label. | ||
33 | /// </summary> | ||
34 | public string Label { get; private set; } | ||
35 | } | ||
36 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj b/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj new file mode 100644 index 00000000..2bd7ca80 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.csproj | |||
@@ -0,0 +1,59 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFrameworks>netstandard2.0;net20</TargetFrameworks> | ||
7 | <AssemblyName>WixToolset.Mba.Core</AssemblyName> | ||
8 | <RootNamespace>WixToolset.Mba.Core</RootNamespace> | ||
9 | <DebugType>embedded</DebugType> | ||
10 | <Description>Managed Bootstrapper Application Core</Description> | ||
11 | <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile> | ||
12 | <IncludeSymbols>true</IncludeSymbols> | ||
13 | <CreateDocumentationFile>true</CreateDocumentationFile> | ||
14 | </PropertyGroup> | ||
15 | |||
16 | <ItemGroup> | ||
17 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> | ||
18 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" /> | ||
19 | </ItemGroup> | ||
20 | |||
21 | <PropertyGroup> | ||
22 | <NuspecBasePath>$(OutputPath)</NuspecBasePath> | ||
23 | <NativeFileListPath Condition=" '$(NCrunch)'=='' ">$(MSBuildProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath> | ||
24 | <NativeFileListPath Condition=" '$(NCrunch)'=='1' ">$(NCrunchOriginalProjectDir)..\..\build\obj\$(ProjectName)\$(Configuration)\NativeFileList.txt</NativeFileListPath> | ||
25 | </PropertyGroup> | ||
26 | |||
27 | <Target Name="BuildMbaNative" BeforeTargets="GetCopyToOutputDirectoryItems" Condition=" '$(NCrunch)'=='' "> | ||
28 | <MSBuild Projects="..\mbanative\mbanative.vcxproj" Properties="Platform=Win32" Targets="Build;BuiltProjectOutputGroup;ContentFilesProjectOutputGroup;DebugSymbolsProjectOutputGroup"> | ||
29 | <Output TaskParameter="TargetOutputs" ItemName="_NativeProjectOutput" /> | ||
30 | </MSBuild> | ||
31 | |||
32 | <WriteLinesToFile File="$(NativeFileListPath)" Lines="@(_NativeProjectOutput)" Overwrite="true" /> | ||
33 | |||
34 | <ItemGroup> | ||
35 | <FileWrites Include="$(NativeFileListPath)" /> | ||
36 | |||
37 | <AllItemsFullPathWithTargetPath Include="@(_NativeProjectOutput->'%(FullPath)')"> | ||
38 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
39 | <TargetPath>%(Filename)%(Extension)</TargetPath> | ||
40 | </AllItemsFullPathWithTargetPath> | ||
41 | </ItemGroup> | ||
42 | </Target> | ||
43 | |||
44 | <Target Name="NCrunchCopyNative" AfterTargets="AfterBuild" Condition=" '$(NCrunch)'=='1' "> | ||
45 | <ReadLinesFromFile File="$(NativeFileListPath)"> | ||
46 | <Output TaskParameter="Lines" ItemName="_NCrunchNativeProjectOutput" /> | ||
47 | </ReadLinesFromFile> | ||
48 | |||
49 | <Error Text="You must build $(MSBuildProjectName) to create the referenced native projects. Once built, 'Reload and rebuild' the project in the NCrunch Tests. The $(NativeFileListPath) file must not be empty." Condition=" '@(_NCrunchNativeProjectOutput)'=='' " /> | ||
50 | |||
51 | <Copy SourceFiles="@(_NCrunchNativeProjectOutput)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true"> | ||
52 | <Output TaskParameter="CopiedFiles" ItemName="_NCrunchNativeCopied" /> | ||
53 | </Copy> | ||
54 | |||
55 | <ItemGroup> | ||
56 | <FileWrites Include="@(_NCrunchNativeCopied)" /> | ||
57 | </ItemGroup> | ||
58 | </Target> | ||
59 | </Project> | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec b/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec new file mode 100644 index 00000000..a5e09ea9 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/WixToolset.Mba.Core.nuspec | |||
@@ -0,0 +1,33 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
3 | <metadata minClientVersion="4.0"> | ||
4 | <id>$id$</id> | ||
5 | <version>$version$</version> | ||
6 | <authors>$authors$</authors> | ||
7 | <owners>$authors$</owners> | ||
8 | <license type="expression">MS-RL</license> | ||
9 | <projectUrl>https://github.com/wixtoolset/balutil</projectUrl> | ||
10 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
11 | <description>$description$</description> | ||
12 | <copyright>$copyright$</copyright> | ||
13 | <repository type="$repositorytype$" url="$repositoryurl$" commit="$repositorycommit$" /> | ||
14 | <dependencies> | ||
15 | <group targetFramework=".NETFramework2.0" /> | ||
16 | <group targetFramework=".NETStandard2.0" /> | ||
17 | </dependencies> | ||
18 | </metadata> | ||
19 | |||
20 | <files> | ||
21 | <file src="net20\$id$.dll" target="lib\net20" /> | ||
22 | <file src="net20\$id$.xml" target="lib\net20" /> | ||
23 | <file src="netstandard2.0\$id$.dll" target="lib\netstandard2.0" /> | ||
24 | <file src="netstandard2.0\$id$.xml" target="lib\netstandard2.0" /> | ||
25 | |||
26 | <file src="v142\ARM64\mbanative.dll" target="runtimes\win-arm64\native" /> | ||
27 | <file src="v142\ARM64\mbanative.pdb" target="runtimes\win-arm64\native" /> | ||
28 | <file src="v142\x64\mbanative.dll" target="runtimes\win-x64\native" /> | ||
29 | <file src="v142\x64\mbanative.pdb" target="runtimes\win-x64\native" /> | ||
30 | <file src="v142\x86\mbanative.dll" target="runtimes\win-x86\native" /> | ||
31 | <file src="v142\x86\mbanative.pdb" target="runtimes\win-x86\native" /> | ||
32 | </files> | ||
33 | </package> | ||
diff --git a/src/api/burn/appveyor.cmd b/src/api/burn/appveyor.cmd new file mode 100644 index 00000000..26f75243 --- /dev/null +++ b/src/api/burn/appveyor.cmd | |||
@@ -0,0 +1,27 @@ | |||
1 | @setlocal | ||
2 | @pushd %~dp0 | ||
3 | @set _C=Release | ||
4 | @if /i "%1"=="debug" set _C=Debug | ||
5 | |||
6 | nuget restore || exit /b | ||
7 | |||
8 | msbuild -p:Configuration=%_C%;Platform=x86;PlatformToolset=v140 || exit /b | ||
9 | msbuild -p:Configuration=%_C%;Platform=x64;PlatformToolset=v140 || exit /b | ||
10 | |||
11 | msbuild -p:Configuration=%_C%;Platform=x86;PlatformToolset=v141 || exit /b | ||
12 | msbuild -p:Configuration=%_C%;Platform=x64;PlatformToolset=v141 || exit /b | ||
13 | msbuild -p:Configuration=%_C%;Platform=ARM64;PlatformToolset=v141 || exit /b | ||
14 | |||
15 | msbuild -p:Configuration=%_C%;Platform=x86;PlatformToolset=v142 || exit /b | ||
16 | msbuild -p:Configuration=%_C%;Platform=x64;PlatformToolset=v142 || exit /b | ||
17 | msbuild -p:Configuration=%_C%;Platform=ARM64;PlatformToolset=v142 || exit /b | ||
18 | |||
19 | dotnet test -c %_C% --no-build src\test\WixToolsetTest.Mba.Core\WixToolsetTest.Mba.Core.csproj || exit /b | ||
20 | |||
21 | msbuild -t:PackNative -p:Configuration=%_C% src\balutil\balutil.vcxproj || exit /b | ||
22 | msbuild -t:PackNative -p:Configuration=%_C% src\bextutil\bextutil.vcxproj || exit /b | ||
23 | msbuild -t:PackNative -p:Configuration=%_C% src\WixToolset.BootstrapperCore.Native\WixToolset.BootstrapperCore.Native.proj || exit /b | ||
24 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj || exit /b | ||
25 | |||
26 | @popd | ||
27 | @endlocal \ No newline at end of file | ||
diff --git a/src/api/burn/appveyor.yml b/src/api/burn/appveyor.yml new file mode 100644 index 00000000..e4d25586 --- /dev/null +++ b/src/api/burn/appveyor.yml | |||
@@ -0,0 +1,42 @@ | |||
1 | # Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | # | ||
3 | # Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml | ||
4 | # then update all of the repos. | ||
5 | |||
6 | branches: | ||
7 | only: | ||
8 | - master | ||
9 | - develop | ||
10 | |||
11 | image: Visual Studio 2019 | ||
12 | |||
13 | version: 0.0.0.{build} | ||
14 | configuration: Release | ||
15 | |||
16 | environment: | ||
17 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
18 | DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
19 | NUGET_XMLDOC_MODE: skip | ||
20 | |||
21 | build_script: | ||
22 | - appveyor.cmd | ||
23 | |||
24 | test: off | ||
25 | |||
26 | pull_requests: | ||
27 | do_not_increment_build_number: true | ||
28 | |||
29 | nuget: | ||
30 | disable_publish_on_pr: true | ||
31 | |||
32 | skip_branch_with_pr: true | ||
33 | skip_tags: true | ||
34 | |||
35 | artifacts: | ||
36 | - path: build\Release\**\*.nupkg | ||
37 | name: nuget | ||
38 | |||
39 | notifications: | ||
40 | - provider: Slack | ||
41 | incoming_webhook: | ||
42 | secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= | ||
diff --git a/src/api/burn/balutil.sln b/src/api/burn/balutil.sln new file mode 100644 index 00000000..cae580f3 --- /dev/null +++ b/src/api/burn/balutil.sln | |||
@@ -0,0 +1,113 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 12.00 | ||
3 | # Visual Studio Version 16 | ||
4 | VisualStudioVersion = 16.0.29503.13 | ||
5 | MinimumVisualStudioVersion = 15.0.26124.0 | ||
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "balutil", "src\balutil\balutil.vcxproj", "{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}" | ||
7 | EndProject | ||
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bextutil", "src\bextutil\bextutil.vcxproj", "{06027492-1CB9-48BC-B31E-C1F9356ED07E}" | ||
9 | EndProject | ||
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Mba.Core", "src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj", "{E7E1841E-A58E-4901-B9CA-4845B807D45F}" | ||
11 | EndProject | ||
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbanative", "src\mbanative\mbanative.vcxproj", "{665E0441-17F9-4105-B202-EDF274657F6E}" | ||
13 | EndProject | ||
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Mba.Core", "src\test\WixToolsetTest.Mba.Core\WixToolsetTest.Mba.Core.csproj", "{F54997F7-10D7-409B-B9F2-DB546490EDC0}" | ||
15 | EndProject | ||
16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BalUtilUnitTest", "src\test\BalUtilUnitTest\BalUtilUnitTest.vcxproj", "{9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}" | ||
17 | EndProject | ||
18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BextUtilUnitTest", "src\test\BextUtilUnitTest\BextUtilUnitTest.vcxproj", "{B69E6422-49B0-4E28-92F9-B8A7410A6ED9}" | ||
19 | EndProject | ||
20 | Global | ||
21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
22 | Debug|ARM64 = Debug|ARM64 | ||
23 | Debug|x64 = Debug|x64 | ||
24 | Debug|x86 = Debug|x86 | ||
25 | Release|ARM64 = Release|ARM64 | ||
26 | Release|x64 = Release|x64 | ||
27 | Release|x86 = Release|x86 | ||
28 | EndGlobalSection | ||
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
30 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
31 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
32 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|x64.ActiveCfg = Debug|x64 | ||
33 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|x64.Build.0 = Debug|x64 | ||
34 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|x86.ActiveCfg = Debug|Win32 | ||
35 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Debug|x86.Build.0 = Debug|Win32 | ||
36 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
37 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|ARM64.Build.0 = Release|ARM64 | ||
38 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x64.ActiveCfg = Release|x64 | ||
39 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x64.Build.0 = Release|x64 | ||
40 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.ActiveCfg = Release|Win32 | ||
41 | {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.Build.0 = Release|Win32 | ||
42 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
43 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
44 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x64.ActiveCfg = Debug|x64 | ||
45 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x64.Build.0 = Debug|x64 | ||
46 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x86.ActiveCfg = Debug|Win32 | ||
47 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x86.Build.0 = Debug|Win32 | ||
48 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
49 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|ARM64.Build.0 = Release|ARM64 | ||
50 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x64.ActiveCfg = Release|x64 | ||
51 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x64.Build.0 = Release|x64 | ||
52 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x86.ActiveCfg = Release|Win32 | ||
53 | {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x86.Build.0 = Release|Win32 | ||
54 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|ARM64.ActiveCfg = Debug|Any CPU | ||
55 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|ARM64.Build.0 = Debug|Any CPU | ||
56 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
57 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.Build.0 = Debug|Any CPU | ||
58 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
59 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x86.Build.0 = Debug|Any CPU | ||
60 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|ARM64.ActiveCfg = Release|Any CPU | ||
61 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|ARM64.Build.0 = Release|Any CPU | ||
62 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|x64.ActiveCfg = Release|Any CPU | ||
63 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|x64.Build.0 = Release|Any CPU | ||
64 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|x86.ActiveCfg = Release|Any CPU | ||
65 | {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Release|x86.Build.0 = Release|Any CPU | ||
66 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
67 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
68 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|x64.ActiveCfg = Debug|x64 | ||
69 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|x64.Build.0 = Debug|x64 | ||
70 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|x86.ActiveCfg = Debug|Win32 | ||
71 | {665E0441-17F9-4105-B202-EDF274657F6E}.Debug|x86.Build.0 = Debug|Win32 | ||
72 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
73 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|ARM64.Build.0 = Release|ARM64 | ||
74 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|x64.ActiveCfg = Release|x64 | ||
75 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|x64.Build.0 = Release|x64 | ||
76 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|x86.ActiveCfg = Release|Win32 | ||
77 | {665E0441-17F9-4105-B202-EDF274657F6E}.Release|x86.Build.0 = Release|Win32 | ||
78 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|ARM64.ActiveCfg = Debug|Any CPU | ||
79 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|ARM64.Build.0 = Debug|Any CPU | ||
80 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
81 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|x64.Build.0 = Debug|Any CPU | ||
82 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
83 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Debug|x86.Build.0 = Debug|Any CPU | ||
84 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|ARM64.ActiveCfg = Release|Any CPU | ||
85 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|ARM64.Build.0 = Release|Any CPU | ||
86 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|x64.ActiveCfg = Release|Any CPU | ||
87 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|x64.Build.0 = Release|Any CPU | ||
88 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|x86.ActiveCfg = Release|Any CPU | ||
89 | {F54997F7-10D7-409B-B9F2-DB546490EDC0}.Release|x86.Build.0 = Release|Any CPU | ||
90 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Debug|ARM64.ActiveCfg = Debug|Win32 | ||
91 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Debug|x64.ActiveCfg = Debug|Win32 | ||
92 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Debug|x86.ActiveCfg = Debug|Win32 | ||
93 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Debug|x86.Build.0 = Debug|Win32 | ||
94 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Release|ARM64.ActiveCfg = Release|Win32 | ||
95 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Release|x64.ActiveCfg = Release|Win32 | ||
96 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Release|x86.ActiveCfg = Release|Win32 | ||
97 | {9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}.Release|x86.Build.0 = Release|Win32 | ||
98 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Debug|ARM64.ActiveCfg = Debug|Win32 | ||
99 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Debug|x64.ActiveCfg = Debug|Win32 | ||
100 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Debug|x86.ActiveCfg = Debug|Win32 | ||
101 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Debug|x86.Build.0 = Debug|Win32 | ||
102 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Release|ARM64.ActiveCfg = Release|Win32 | ||
103 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Release|x64.ActiveCfg = Release|Win32 | ||
104 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Release|x86.ActiveCfg = Release|Win32 | ||
105 | {B69E6422-49B0-4E28-92F9-B8A7410A6ED9}.Release|x86.Build.0 = Release|Win32 | ||
106 | EndGlobalSection | ||
107 | GlobalSection(SolutionProperties) = preSolution | ||
108 | HideSolutionNode = FALSE | ||
109 | EndGlobalSection | ||
110 | GlobalSection(ExtensibilityGlobals) = postSolution | ||
111 | SolutionGuid = {8741FA43-6BD2-40F9-ABA5-A5BD466A6518} | ||
112 | EndGlobalSection | ||
113 | EndGlobal | ||
diff --git a/src/api/burn/balutil/BalBootstrapperEngine.cpp b/src/api/burn/balutil/BalBootstrapperEngine.cpp new file mode 100644 index 00000000..301b88a5 --- /dev/null +++ b/src/api/burn/balutil/BalBootstrapperEngine.cpp | |||
@@ -0,0 +1,629 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | |||
6 | class CBalBootstrapperEngine : public IBootstrapperEngine | ||
7 | { | ||
8 | public: // IUnknown | ||
9 | virtual STDMETHODIMP QueryInterface( | ||
10 | __in REFIID riid, | ||
11 | __out LPVOID *ppvObject | ||
12 | ) | ||
13 | { | ||
14 | if (!ppvObject) | ||
15 | { | ||
16 | return E_INVALIDARG; | ||
17 | } | ||
18 | |||
19 | *ppvObject = NULL; | ||
20 | |||
21 | if (::IsEqualIID(__uuidof(IBootstrapperEngine), riid)) | ||
22 | { | ||
23 | *ppvObject = static_cast<IBootstrapperEngine*>(this); | ||
24 | } | ||
25 | else if (::IsEqualIID(IID_IMarshal, riid)) | ||
26 | { | ||
27 | return m_pFreeThreadedMarshaler->QueryInterface(riid, ppvObject); | ||
28 | } | ||
29 | else if (::IsEqualIID(IID_IUnknown, riid)) | ||
30 | { | ||
31 | *ppvObject = reinterpret_cast<IUnknown*>(this); | ||
32 | } | ||
33 | else // no interface for requested iid | ||
34 | { | ||
35 | return E_NOINTERFACE; | ||
36 | } | ||
37 | |||
38 | AddRef(); | ||
39 | return S_OK; | ||
40 | } | ||
41 | |||
42 | virtual STDMETHODIMP_(ULONG) AddRef() | ||
43 | { | ||
44 | return ::InterlockedIncrement(&this->m_cReferences); | ||
45 | } | ||
46 | |||
47 | virtual STDMETHODIMP_(ULONG) Release() | ||
48 | { | ||
49 | long l = ::InterlockedDecrement(&this->m_cReferences); | ||
50 | if (0 < l) | ||
51 | { | ||
52 | return l; | ||
53 | } | ||
54 | |||
55 | delete this; | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | public: // IBootstrapperEngine | ||
60 | virtual STDMETHODIMP GetPackageCount( | ||
61 | __out DWORD* pcPackages | ||
62 | ) | ||
63 | { | ||
64 | HRESULT hr = S_OK; | ||
65 | BAENGINE_GETPACKAGECOUNT_ARGS args = { }; | ||
66 | BAENGINE_GETPACKAGECOUNT_RESULTS results = { }; | ||
67 | |||
68 | ExitOnNull(pcPackages, hr, E_INVALIDARG, "pcPackages is required"); | ||
69 | |||
70 | args.cbSize = sizeof(args); | ||
71 | |||
72 | results.cbSize = sizeof(results); | ||
73 | |||
74 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, &args, &results, m_pvBAEngineProcContext); | ||
75 | |||
76 | *pcPackages = results.cPackages; | ||
77 | |||
78 | LExit: | ||
79 | return hr; | ||
80 | } | ||
81 | |||
82 | virtual STDMETHODIMP GetVariableNumeric( | ||
83 | __in_z LPCWSTR wzVariable, | ||
84 | __out LONGLONG* pllValue | ||
85 | ) | ||
86 | { | ||
87 | HRESULT hr = S_OK; | ||
88 | BAENGINE_GETVARIABLENUMERIC_ARGS args = { }; | ||
89 | BAENGINE_GETVARIABLENUMERIC_RESULTS results = { }; | ||
90 | |||
91 | ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required"); | ||
92 | |||
93 | args.cbSize = sizeof(args); | ||
94 | args.wzVariable = wzVariable; | ||
95 | |||
96 | results.cbSize = sizeof(results); | ||
97 | |||
98 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBAEngineProcContext); | ||
99 | |||
100 | *pllValue = results.llValue; | ||
101 | |||
102 | LExit: | ||
103 | SecureZeroMemory(&results, sizeof(results)); | ||
104 | return hr; | ||
105 | } | ||
106 | |||
107 | virtual STDMETHODIMP GetVariableString( | ||
108 | __in_z LPCWSTR wzVariable, | ||
109 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
110 | __inout SIZE_T* pcchValue | ||
111 | ) | ||
112 | { | ||
113 | HRESULT hr = S_OK; | ||
114 | BAENGINE_GETVARIABLESTRING_ARGS args = { }; | ||
115 | BAENGINE_GETVARIABLESTRING_RESULTS results = { }; | ||
116 | |||
117 | ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); | ||
118 | |||
119 | args.cbSize = sizeof(args); | ||
120 | args.wzVariable = wzVariable; | ||
121 | |||
122 | results.cbSize = sizeof(results); | ||
123 | results.wzValue = wzValue; | ||
124 | results.cchValue = *pcchValue; | ||
125 | |||
126 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBAEngineProcContext); | ||
127 | |||
128 | *pcchValue = results.cchValue; | ||
129 | |||
130 | LExit: | ||
131 | return hr; | ||
132 | } | ||
133 | |||
134 | virtual STDMETHODIMP GetVariableVersion( | ||
135 | __in_z LPCWSTR wzVariable, | ||
136 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
137 | __inout SIZE_T* pcchValue | ||
138 | ) | ||
139 | { | ||
140 | HRESULT hr = S_OK; | ||
141 | BAENGINE_GETVARIABLEVERSION_ARGS args = { }; | ||
142 | BAENGINE_GETVARIABLEVERSION_RESULTS results = { }; | ||
143 | |||
144 | ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); | ||
145 | |||
146 | args.cbSize = sizeof(args); | ||
147 | args.wzVariable = wzVariable; | ||
148 | |||
149 | results.cbSize = sizeof(results); | ||
150 | results.wzValue = wzValue; | ||
151 | results.cchValue = *pcchValue; | ||
152 | |||
153 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBAEngineProcContext); | ||
154 | |||
155 | *pcchValue = results.cchValue; | ||
156 | |||
157 | LExit: | ||
158 | return hr; | ||
159 | } | ||
160 | |||
161 | virtual STDMETHODIMP FormatString( | ||
162 | __in_z LPCWSTR wzIn, | ||
163 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
164 | __inout SIZE_T* pcchOut | ||
165 | ) | ||
166 | { | ||
167 | HRESULT hr = S_OK; | ||
168 | BAENGINE_FORMATSTRING_ARGS args = { }; | ||
169 | BAENGINE_FORMATSTRING_RESULTS results = { }; | ||
170 | |||
171 | ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); | ||
172 | |||
173 | args.cbSize = sizeof(args); | ||
174 | args.wzIn = wzIn; | ||
175 | |||
176 | results.cbSize = sizeof(results); | ||
177 | results.wzOut = wzOut; | ||
178 | results.cchOut = *pcchOut; | ||
179 | |||
180 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBAEngineProcContext); | ||
181 | |||
182 | *pcchOut = results.cchOut; | ||
183 | |||
184 | LExit: | ||
185 | return hr; | ||
186 | } | ||
187 | |||
188 | virtual STDMETHODIMP EscapeString( | ||
189 | __in_z LPCWSTR wzIn, | ||
190 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
191 | __inout SIZE_T* pcchOut | ||
192 | ) | ||
193 | { | ||
194 | HRESULT hr = S_OK; | ||
195 | BAENGINE_ESCAPESTRING_ARGS args = { }; | ||
196 | BAENGINE_ESCAPESTRING_RESULTS results = { }; | ||
197 | |||
198 | ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); | ||
199 | |||
200 | args.cbSize = sizeof(args); | ||
201 | args.wzIn = wzIn; | ||
202 | |||
203 | results.cbSize = sizeof(results); | ||
204 | results.wzOut = wzOut; | ||
205 | results.cchOut = *pcchOut; | ||
206 | |||
207 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBAEngineProcContext); | ||
208 | |||
209 | *pcchOut = results.cchOut; | ||
210 | |||
211 | LExit: | ||
212 | return hr; | ||
213 | } | ||
214 | |||
215 | virtual STDMETHODIMP EvaluateCondition( | ||
216 | __in_z LPCWSTR wzCondition, | ||
217 | __out BOOL* pf | ||
218 | ) | ||
219 | { | ||
220 | HRESULT hr = S_OK; | ||
221 | BAENGINE_EVALUATECONDITION_ARGS args = { }; | ||
222 | BAENGINE_EVALUATECONDITION_RESULTS results = { }; | ||
223 | |||
224 | ExitOnNull(pf, hr, E_INVALIDARG, "pf is required"); | ||
225 | |||
226 | args.cbSize = sizeof(args); | ||
227 | args.wzCondition = wzCondition; | ||
228 | |||
229 | results.cbSize = sizeof(results); | ||
230 | |||
231 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBAEngineProcContext); | ||
232 | |||
233 | *pf = results.f; | ||
234 | |||
235 | LExit: | ||
236 | return hr; | ||
237 | } | ||
238 | |||
239 | virtual STDMETHODIMP Log( | ||
240 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
241 | __in_z LPCWSTR wzMessage | ||
242 | ) | ||
243 | { | ||
244 | BAENGINE_LOG_ARGS args = { }; | ||
245 | BAENGINE_LOG_RESULTS results = { }; | ||
246 | |||
247 | args.cbSize = sizeof(args); | ||
248 | args.level = level; | ||
249 | args.wzMessage = wzMessage; | ||
250 | |||
251 | results.cbSize = sizeof(results); | ||
252 | |||
253 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_LOG, &args, &results, m_pvBAEngineProcContext); | ||
254 | } | ||
255 | |||
256 | virtual STDMETHODIMP SendEmbeddedError( | ||
257 | __in DWORD dwErrorCode, | ||
258 | __in_z_opt LPCWSTR wzMessage, | ||
259 | __in DWORD dwUIHint, | ||
260 | __out int* pnResult | ||
261 | ) | ||
262 | { | ||
263 | HRESULT hr = S_OK; | ||
264 | BAENGINE_SENDEMBEDDEDERROR_ARGS args = { }; | ||
265 | BAENGINE_SENDEMBEDDEDERROR_RESULTS results = { }; | ||
266 | |||
267 | ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); | ||
268 | |||
269 | args.cbSize = sizeof(args); | ||
270 | args.dwErrorCode = dwErrorCode; | ||
271 | args.wzMessage = wzMessage; | ||
272 | args.dwUIHint = dwUIHint; | ||
273 | |||
274 | results.cbSize = sizeof(results); | ||
275 | |||
276 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR, &args, &results, m_pvBAEngineProcContext); | ||
277 | |||
278 | *pnResult = results.nResult; | ||
279 | |||
280 | LExit: | ||
281 | return hr; | ||
282 | } | ||
283 | |||
284 | virtual STDMETHODIMP SendEmbeddedProgress( | ||
285 | __in DWORD dwProgressPercentage, | ||
286 | __in DWORD dwOverallProgressPercentage, | ||
287 | __out int* pnResult | ||
288 | ) | ||
289 | { | ||
290 | HRESULT hr = S_OK; | ||
291 | BAENGINE_SENDEMBEDDEDPROGRESS_ARGS args = { }; | ||
292 | BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS results = { }; | ||
293 | |||
294 | ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); | ||
295 | |||
296 | args.cbSize = sizeof(args); | ||
297 | args.dwProgressPercentage = dwProgressPercentage; | ||
298 | args.dwOverallProgressPercentage = dwOverallProgressPercentage; | ||
299 | |||
300 | results.cbSize = sizeof(results); | ||
301 | |||
302 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS, &args, &results, m_pvBAEngineProcContext); | ||
303 | |||
304 | *pnResult = results.nResult; | ||
305 | |||
306 | LExit: | ||
307 | return hr; | ||
308 | } | ||
309 | |||
310 | virtual STDMETHODIMP SetUpdate( | ||
311 | __in_z_opt LPCWSTR wzLocalSource, | ||
312 | __in_z_opt LPCWSTR wzDownloadSource, | ||
313 | __in DWORD64 qwSize, | ||
314 | __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, | ||
315 | __in_bcount_opt(cbHash) BYTE* rgbHash, | ||
316 | __in DWORD cbHash | ||
317 | ) | ||
318 | { | ||
319 | BAENGINE_SETUPDATE_ARGS args = { }; | ||
320 | BAENGINE_SETUPDATE_RESULTS results = { }; | ||
321 | |||
322 | args.cbSize = sizeof(args); | ||
323 | args.wzLocalSource = wzLocalSource; | ||
324 | args.wzDownloadSource = wzDownloadSource; | ||
325 | args.qwSize = qwSize; | ||
326 | args.hashType = hashType; | ||
327 | args.rgbHash = rgbHash; | ||
328 | args.cbHash = cbHash; | ||
329 | |||
330 | results.cbSize = sizeof(results); | ||
331 | |||
332 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE, &args, &results, m_pvBAEngineProcContext); | ||
333 | } | ||
334 | |||
335 | virtual STDMETHODIMP SetLocalSource( | ||
336 | __in_z LPCWSTR wzPackageOrContainerId, | ||
337 | __in_z_opt LPCWSTR wzPayloadId, | ||
338 | __in_z LPCWSTR wzPath | ||
339 | ) | ||
340 | { | ||
341 | BAENGINE_SETLOCALSOURCE_ARGS args = { }; | ||
342 | BAENGINE_SETLOCALSOURCE_RESULTS results = { }; | ||
343 | |||
344 | args.cbSize = sizeof(args); | ||
345 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
346 | args.wzPayloadId = wzPayloadId; | ||
347 | args.wzPath = wzPath; | ||
348 | |||
349 | results.cbSize = sizeof(results); | ||
350 | |||
351 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE, &args, &results, m_pvBAEngineProcContext); | ||
352 | } | ||
353 | |||
354 | virtual STDMETHODIMP SetDownloadSource( | ||
355 | __in_z LPCWSTR wzPackageOrContainerId, | ||
356 | __in_z_opt LPCWSTR wzPayloadId, | ||
357 | __in_z LPCWSTR wzUrl, | ||
358 | __in_z_opt LPCWSTR wzUser, | ||
359 | __in_z_opt LPCWSTR wzPassword | ||
360 | ) | ||
361 | { | ||
362 | BAENGINE_SETDOWNLOADSOURCE_ARGS args = { }; | ||
363 | BAENGINE_SETDOWNLOADSOURCE_RESULTS results = { }; | ||
364 | |||
365 | args.cbSize = sizeof(args); | ||
366 | args.wzPackageOrContainerId = wzPackageOrContainerId; | ||
367 | args.wzPayloadId = wzPayloadId; | ||
368 | args.wzUrl = wzUrl; | ||
369 | args.wzUser = wzUser; | ||
370 | args.wzPassword = wzPassword; | ||
371 | |||
372 | results.cbSize = sizeof(results); | ||
373 | |||
374 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE, &args, &results, m_pvBAEngineProcContext); | ||
375 | } | ||
376 | |||
377 | virtual STDMETHODIMP SetVariableNumeric( | ||
378 | __in_z LPCWSTR wzVariable, | ||
379 | __in LONGLONG llValue | ||
380 | ) | ||
381 | { | ||
382 | BAENGINE_SETVARIABLENUMERIC_ARGS args = { }; | ||
383 | BAENGINE_SETVARIABLENUMERIC_RESULTS results = { }; | ||
384 | |||
385 | args.cbSize = sizeof(args); | ||
386 | args.wzVariable = wzVariable; | ||
387 | args.llValue = llValue; | ||
388 | |||
389 | results.cbSize = sizeof(results); | ||
390 | |||
391 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBAEngineProcContext); | ||
392 | } | ||
393 | |||
394 | virtual STDMETHODIMP SetVariableString( | ||
395 | __in_z LPCWSTR wzVariable, | ||
396 | __in_z_opt LPCWSTR wzValue, | ||
397 | __in BOOL fFormatted | ||
398 | ) | ||
399 | { | ||
400 | BAENGINE_SETVARIABLESTRING_ARGS args = { }; | ||
401 | BAENGINE_SETVARIABLESTRING_RESULTS results = { }; | ||
402 | |||
403 | args.cbSize = sizeof(args); | ||
404 | args.wzVariable = wzVariable; | ||
405 | args.wzValue = wzValue; | ||
406 | args.fFormatted = fFormatted; | ||
407 | |||
408 | results.cbSize = sizeof(results); | ||
409 | |||
410 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBAEngineProcContext); | ||
411 | } | ||
412 | |||
413 | virtual STDMETHODIMP SetVariableVersion( | ||
414 | __in_z LPCWSTR wzVariable, | ||
415 | __in_z_opt LPCWSTR wzValue | ||
416 | ) | ||
417 | { | ||
418 | BAENGINE_SETVARIABLEVERSION_ARGS args = { }; | ||
419 | BAENGINE_SETVARIABLEVERSION_RESULTS results = { }; | ||
420 | |||
421 | args.cbSize = sizeof(args); | ||
422 | args.wzVariable = wzVariable; | ||
423 | args.wzValue = wzValue; | ||
424 | |||
425 | results.cbSize = sizeof(results); | ||
426 | |||
427 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBAEngineProcContext); | ||
428 | } | ||
429 | |||
430 | virtual STDMETHODIMP CloseSplashScreen() | ||
431 | { | ||
432 | BAENGINE_CLOSESPLASHSCREEN_ARGS args = { }; | ||
433 | BAENGINE_CLOSESPLASHSCREEN_RESULTS results = { }; | ||
434 | |||
435 | args.cbSize = sizeof(args); | ||
436 | |||
437 | results.cbSize = sizeof(results); | ||
438 | |||
439 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN, &args, &results, m_pvBAEngineProcContext); | ||
440 | } | ||
441 | |||
442 | virtual STDMETHODIMP Detect( | ||
443 | __in_opt HWND hwndParent | ||
444 | ) | ||
445 | { | ||
446 | BAENGINE_DETECT_ARGS args = { }; | ||
447 | BAENGINE_DETECT_RESULTS results = { }; | ||
448 | |||
449 | args.cbSize = sizeof(args); | ||
450 | args.hwndParent = hwndParent; | ||
451 | |||
452 | results.cbSize = sizeof(results); | ||
453 | |||
454 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_DETECT, &args, &results, m_pvBAEngineProcContext); | ||
455 | } | ||
456 | |||
457 | virtual STDMETHODIMP Plan( | ||
458 | __in BOOTSTRAPPER_ACTION action | ||
459 | ) | ||
460 | { | ||
461 | BAENGINE_PLAN_ARGS args = { }; | ||
462 | BAENGINE_PLAN_RESULTS results = { }; | ||
463 | |||
464 | args.cbSize = sizeof(args); | ||
465 | args.action = action; | ||
466 | |||
467 | results.cbSize = sizeof(results); | ||
468 | |||
469 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_PLAN, &args, &results, m_pvBAEngineProcContext); | ||
470 | } | ||
471 | |||
472 | virtual STDMETHODIMP Elevate( | ||
473 | __in_opt HWND hwndParent | ||
474 | ) | ||
475 | { | ||
476 | BAENGINE_ELEVATE_ARGS args = { }; | ||
477 | BAENGINE_ELEVATE_RESULTS results = { }; | ||
478 | |||
479 | args.cbSize = sizeof(args); | ||
480 | args.hwndParent = hwndParent; | ||
481 | |||
482 | results.cbSize = sizeof(results); | ||
483 | |||
484 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE, &args, &results, m_pvBAEngineProcContext); | ||
485 | } | ||
486 | |||
487 | virtual STDMETHODIMP Apply( | ||
488 | __in HWND hwndParent | ||
489 | ) | ||
490 | { | ||
491 | BAENGINE_APPLY_ARGS args = { }; | ||
492 | BAENGINE_APPLY_RESULTS results = { }; | ||
493 | |||
494 | args.cbSize = sizeof(args); | ||
495 | args.hwndParent = hwndParent; | ||
496 | |||
497 | results.cbSize = sizeof(results); | ||
498 | |||
499 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, &args, &results, m_pvBAEngineProcContext); | ||
500 | } | ||
501 | |||
502 | virtual STDMETHODIMP Quit( | ||
503 | __in DWORD dwExitCode | ||
504 | ) | ||
505 | { | ||
506 | BAENGINE_QUIT_ARGS args = { }; | ||
507 | BAENGINE_QUIT_RESULTS results = { }; | ||
508 | |||
509 | args.cbSize = sizeof(args); | ||
510 | args.dwExitCode = dwExitCode; | ||
511 | |||
512 | results.cbSize = sizeof(results); | ||
513 | |||
514 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, &args, &results, m_pvBAEngineProcContext); | ||
515 | } | ||
516 | |||
517 | virtual STDMETHODIMP LaunchApprovedExe( | ||
518 | __in_opt HWND hwndParent, | ||
519 | __in_z LPCWSTR wzApprovedExeForElevationId, | ||
520 | __in_z_opt LPCWSTR wzArguments, | ||
521 | __in DWORD dwWaitForInputIdleTimeout | ||
522 | ) | ||
523 | { | ||
524 | BAENGINE_LAUNCHAPPROVEDEXE_ARGS args = { }; | ||
525 | BAENGINE_LAUNCHAPPROVEDEXE_RESULTS results = { }; | ||
526 | |||
527 | args.cbSize = sizeof(args); | ||
528 | args.hwndParent = hwndParent; | ||
529 | args.wzApprovedExeForElevationId = wzApprovedExeForElevationId; | ||
530 | args.wzArguments = wzArguments; | ||
531 | args.dwWaitForInputIdleTimeout = dwWaitForInputIdleTimeout; | ||
532 | |||
533 | results.cbSize = sizeof(results); | ||
534 | |||
535 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, &args, &results, m_pvBAEngineProcContext); | ||
536 | } | ||
537 | |||
538 | virtual STDMETHODIMP SetUpdateSource( | ||
539 | __in_z LPCWSTR wzUrl | ||
540 | ) | ||
541 | { | ||
542 | BAENGINE_SETUPDATESOURCE_ARGS args = { }; | ||
543 | BAENGINE_SETUPDATESOURCE_RESULTS results = { }; | ||
544 | |||
545 | args.cbSize = sizeof(args); | ||
546 | args.wzUrl = wzUrl; | ||
547 | |||
548 | results.cbSize = sizeof(results); | ||
549 | |||
550 | return m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE, &args, &results, m_pvBAEngineProcContext); | ||
551 | } | ||
552 | |||
553 | virtual STDMETHODIMP CompareVersions( | ||
554 | __in_z LPCWSTR wzVersion1, | ||
555 | __in_z LPCWSTR wzVersion2, | ||
556 | __out int* pnResult | ||
557 | ) | ||
558 | { | ||
559 | HRESULT hr = S_OK; | ||
560 | BAENGINE_COMPAREVERSIONS_ARGS args = { }; | ||
561 | BAENGINE_COMPAREVERSIONS_RESULTS results = { }; | ||
562 | |||
563 | ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); | ||
564 | |||
565 | args.cbSize = sizeof(args); | ||
566 | args.wzVersion1 = wzVersion1; | ||
567 | args.wzVersion2 = wzVersion2; | ||
568 | |||
569 | results.cbSize = sizeof(results); | ||
570 | |||
571 | hr = m_pfnBAEngineProc(BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, &args, &results, m_pvBAEngineProcContext); | ||
572 | |||
573 | *pnResult = results.nResult; | ||
574 | |||
575 | LExit: | ||
576 | return hr; | ||
577 | } | ||
578 | |||
579 | public: | ||
580 | HRESULT Init() | ||
581 | { | ||
582 | return ::CoCreateFreeThreadedMarshaler(this, &m_pFreeThreadedMarshaler); | ||
583 | } | ||
584 | |||
585 | CBalBootstrapperEngine( | ||
586 | __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, | ||
587 | __in_opt LPVOID pvBAEngineProcContext | ||
588 | ) | ||
589 | { | ||
590 | m_cReferences = 1; | ||
591 | m_pfnBAEngineProc = pfnBAEngineProc; | ||
592 | m_pvBAEngineProcContext = pvBAEngineProcContext; | ||
593 | m_pFreeThreadedMarshaler = NULL; | ||
594 | } | ||
595 | |||
596 | ~CBalBootstrapperEngine() | ||
597 | { | ||
598 | ReleaseObject(m_pFreeThreadedMarshaler); | ||
599 | } | ||
600 | |||
601 | private: | ||
602 | long m_cReferences; | ||
603 | PFN_BOOTSTRAPPER_ENGINE_PROC m_pfnBAEngineProc; | ||
604 | LPVOID m_pvBAEngineProcContext; | ||
605 | IUnknown* m_pFreeThreadedMarshaler; | ||
606 | }; | ||
607 | |||
608 | HRESULT BalBootstrapperEngineCreate( | ||
609 | __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, | ||
610 | __in_opt LPVOID pvBAEngineProcContext, | ||
611 | __out IBootstrapperEngine** ppBootstrapperEngine | ||
612 | ) | ||
613 | { | ||
614 | HRESULT hr = S_OK; | ||
615 | CBalBootstrapperEngine* pBootstrapperEngine = NULL; | ||
616 | |||
617 | pBootstrapperEngine = new CBalBootstrapperEngine(pfnBAEngineProc, pvBAEngineProcContext); | ||
618 | ExitOnNull(pBootstrapperEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BalBootstrapperEngine object."); | ||
619 | |||
620 | hr = pBootstrapperEngine->Init(); | ||
621 | ExitOnFailure(hr, "Failed to initialize CBalBootstrapperEngine."); | ||
622 | |||
623 | hr = pBootstrapperEngine->QueryInterface(IID_PPV_ARGS(ppBootstrapperEngine)); | ||
624 | ExitOnFailure(hr, "Failed to QI for IBootstrapperEngine from BalBootstrapperEngine object."); | ||
625 | |||
626 | LExit: | ||
627 | ReleaseObject(pBootstrapperEngine); | ||
628 | return hr; | ||
629 | } | ||
diff --git a/src/api/burn/balutil/balcondition.cpp b/src/api/burn/balutil/balcondition.cpp new file mode 100644 index 00000000..8b05508f --- /dev/null +++ b/src/api/burn/balutil/balcondition.cpp | |||
@@ -0,0 +1,124 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | // prototypes | ||
6 | |||
7 | |||
8 | DAPI_(HRESULT) BalConditionsParseFromXml( | ||
9 | __in BAL_CONDITIONS* pConditions, | ||
10 | __in IXMLDOMDocument* pixdManifest, | ||
11 | __in_opt WIX_LOCALIZATION* pWixLoc | ||
12 | ) | ||
13 | { | ||
14 | HRESULT hr = S_OK; | ||
15 | IXMLDOMNodeList* pNodeList = NULL; | ||
16 | IXMLDOMNode* pNode = NULL; | ||
17 | BAL_CONDITION* prgConditions = NULL; | ||
18 | DWORD cConditions = 0; | ||
19 | |||
20 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixBalCondition", &pNodeList); | ||
21 | ExitOnFailure(hr, "Failed to select all conditions."); | ||
22 | |||
23 | hr = pNodeList->get_length(reinterpret_cast<long*>(&cConditions)); | ||
24 | ExitOnFailure(hr, "Failed to get the condition count."); | ||
25 | |||
26 | if (!cConditions) | ||
27 | { | ||
28 | ExitFunction(); | ||
29 | } | ||
30 | |||
31 | prgConditions = static_cast<BAL_CONDITION*>(MemAlloc(sizeof(BAL_CONDITION) * cConditions, TRUE)); | ||
32 | ExitOnNull(prgConditions, hr, E_OUTOFMEMORY, "Failed to allocate memory for conditions."); | ||
33 | |||
34 | DWORD iCondition = 0; | ||
35 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | ||
36 | { | ||
37 | hr = XmlGetAttributeEx(pNode, L"Condition", &prgConditions[iCondition].sczCondition); | ||
38 | ExitOnFailure(hr, "Failed to get condition for condition."); | ||
39 | |||
40 | hr = XmlGetAttributeEx(pNode, L"Message", &prgConditions[iCondition].sczMessage); | ||
41 | ExitOnFailure(hr, "Failed to get message for condition."); | ||
42 | |||
43 | if (pWixLoc && prgConditions[iCondition].sczMessage && *prgConditions[iCondition].sczMessage) | ||
44 | { | ||
45 | hr = LocLocalizeString(pWixLoc, &prgConditions[iCondition].sczMessage); | ||
46 | ExitOnFailure(hr, "Failed to localize condition message."); | ||
47 | } | ||
48 | |||
49 | ++iCondition; | ||
50 | ReleaseNullObject(pNode); | ||
51 | } | ||
52 | ExitOnFailure(hr, "Failed to parse all condition elements."); | ||
53 | |||
54 | if (S_FALSE == hr) | ||
55 | { | ||
56 | hr = S_OK; | ||
57 | } | ||
58 | |||
59 | pConditions->cConditions = cConditions; | ||
60 | pConditions->rgConditions = prgConditions; | ||
61 | prgConditions = NULL; | ||
62 | |||
63 | LExit: | ||
64 | ReleaseMem(prgConditions); | ||
65 | ReleaseObject(pNode); | ||
66 | ReleaseObject(pNodeList); | ||
67 | |||
68 | return hr; | ||
69 | } | ||
70 | |||
71 | |||
72 | //the contents of psczMessage may be sensitive, should keep encrypted and SecureZeroFree | ||
73 | DAPI_(HRESULT) BalConditionEvaluate( | ||
74 | __in BAL_CONDITION* pCondition, | ||
75 | __in IBootstrapperEngine* pEngine, | ||
76 | __out BOOL* pfResult, | ||
77 | __out_z_opt LPWSTR* psczMessage | ||
78 | ) | ||
79 | { | ||
80 | HRESULT hr = S_OK; | ||
81 | SIZE_T cchMessage = 0; | ||
82 | |||
83 | hr = pEngine->EvaluateCondition(pCondition->sczCondition, pfResult); | ||
84 | ExitOnFailure(hr, "Failed to evaluate condition with bootstrapper engine."); | ||
85 | |||
86 | if (psczMessage) | ||
87 | { | ||
88 | if (*psczMessage) | ||
89 | { | ||
90 | hr = StrMaxLength(*psczMessage, &cchMessage); | ||
91 | ExitOnFailure(hr, "Failed to get length of message."); | ||
92 | } | ||
93 | |||
94 | hr = pEngine->FormatString(pCondition->sczMessage, *psczMessage, &cchMessage); | ||
95 | if (E_MOREDATA == hr) | ||
96 | { | ||
97 | ++cchMessage; | ||
98 | |||
99 | hr = StrAllocSecure(psczMessage, cchMessage); | ||
100 | ExitOnFailure(hr, "Failed to allocate string for condition's formatted message."); | ||
101 | |||
102 | hr = pEngine->FormatString(pCondition->sczMessage, *psczMessage, &cchMessage); | ||
103 | } | ||
104 | ExitOnFailure(hr, "Failed to format condition's message."); | ||
105 | } | ||
106 | |||
107 | LExit: | ||
108 | return hr; | ||
109 | } | ||
110 | |||
111 | |||
112 | DAPI_(void) BalConditionsUninitialize( | ||
113 | __in BAL_CONDITIONS* pConditions | ||
114 | ) | ||
115 | { | ||
116 | for (DWORD i = 0; i < pConditions->cConditions; ++i) | ||
117 | { | ||
118 | ReleaseStr(pConditions->rgConditions[i].sczMessage); | ||
119 | ReleaseStr(pConditions->rgConditions[i].sczCondition); | ||
120 | } | ||
121 | |||
122 | ReleaseMem(pConditions->rgConditions); | ||
123 | memset(pConditions, 0, sizeof(BAL_CONDITIONS)); | ||
124 | } | ||
diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp new file mode 100644 index 00000000..3abb9286 --- /dev/null +++ b/src/api/burn/balutil/balinfo.cpp | |||
@@ -0,0 +1,373 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | // prototypes | ||
6 | static HRESULT ParsePackagesFromXml( | ||
7 | __in BAL_INFO_PACKAGES* pPackages, | ||
8 | __in IXMLDOMDocument* pixdManifest | ||
9 | ); | ||
10 | static HRESULT ParseBalPackageInfoFromXml( | ||
11 | __in BAL_INFO_PACKAGES* pPackages, | ||
12 | __in IXMLDOMDocument* pixdManifest | ||
13 | ); | ||
14 | |||
15 | |||
16 | DAPI_(HRESULT) BalInfoParseFromXml( | ||
17 | __in BAL_INFO_BUNDLE* pBundle, | ||
18 | __in IXMLDOMDocument* pixdManifest | ||
19 | ) | ||
20 | { | ||
21 | HRESULT hr = S_OK; | ||
22 | IXMLDOMNode* pNode = NULL; | ||
23 | |||
24 | hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBundleProperties", &pNode); | ||
25 | ExitOnFailure(hr, "Failed to select bundle information."); | ||
26 | |||
27 | if (S_OK == hr) | ||
28 | { | ||
29 | hr = XmlGetYesNoAttribute(pNode, L"PerMachine", &pBundle->fPerMachine); | ||
30 | if (E_NOTFOUND != hr) | ||
31 | { | ||
32 | ExitOnFailure(hr, "Failed to read bundle information per-machine."); | ||
33 | } | ||
34 | |||
35 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &pBundle->sczName); | ||
36 | if (E_NOTFOUND != hr) | ||
37 | { | ||
38 | ExitOnFailure(hr, "Failed to read bundle information display name."); | ||
39 | } | ||
40 | |||
41 | hr = XmlGetAttributeEx(pNode, L"LogPathVariable", &pBundle->sczLogVariable); | ||
42 | if (E_NOTFOUND != hr) | ||
43 | { | ||
44 | ExitOnFailure(hr, "Failed to read bundle information log path variable."); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | hr = ParsePackagesFromXml(&pBundle->packages, pixdManifest); | ||
49 | BalExitOnFailure(hr, "Failed to parse package information from bootstrapper application data."); | ||
50 | |||
51 | hr = ParseBalPackageInfoFromXml(&pBundle->packages, pixdManifest); | ||
52 | BalExitOnFailure(hr, "Failed to parse bal package information from bootstrapper application data."); | ||
53 | |||
54 | LExit: | ||
55 | ReleaseObject(pNode); | ||
56 | |||
57 | return hr; | ||
58 | } | ||
59 | |||
60 | |||
61 | DAPI_(HRESULT) BalInfoAddRelatedBundleAsPackage( | ||
62 | __in BAL_INFO_PACKAGES* pPackages, | ||
63 | __in LPCWSTR wzId, | ||
64 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
65 | __in BOOL /*fPerMachine*/, | ||
66 | __out_opt BAL_INFO_PACKAGE** ppPackage | ||
67 | ) | ||
68 | { | ||
69 | HRESULT hr = S_OK; | ||
70 | BAL_INFO_PACKAGE_TYPE type = BAL_INFO_PACKAGE_TYPE_UNKNOWN; | ||
71 | BAL_INFO_PACKAGE* pPackage = NULL; | ||
72 | |||
73 | // Ensure we have a supported relation type. | ||
74 | switch (relationType) | ||
75 | { | ||
76 | case BOOTSTRAPPER_RELATION_ADDON: | ||
77 | type = BAL_INFO_PACKAGE_TYPE_BUNDLE_ADDON; | ||
78 | break; | ||
79 | |||
80 | case BOOTSTRAPPER_RELATION_PATCH: | ||
81 | type = BAL_INFO_PACKAGE_TYPE_BUNDLE_PATCH; | ||
82 | break; | ||
83 | |||
84 | case BOOTSTRAPPER_RELATION_UPGRADE: | ||
85 | type = BAL_INFO_PACKAGE_TYPE_BUNDLE_UPGRADE; | ||
86 | break; | ||
87 | |||
88 | default: | ||
89 | ExitOnFailure(hr = E_INVALIDARG, "Unknown related bundle type: %u", relationType); | ||
90 | } | ||
91 | |||
92 | // Check to see if the bundle is already in the list of packages. | ||
93 | for (DWORD i = 0; i < pPackages->cPackages; ++i) | ||
94 | { | ||
95 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzId, -1, pPackages->rgPackages[i].sczId, -1)) | ||
96 | { | ||
97 | ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | // Add the related bundle as a package. | ||
102 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pPackages->rgPackages), pPackages->cPackages + 1, sizeof(BAL_INFO_PACKAGE), 2); | ||
103 | ExitOnFailure(hr, "Failed to allocate memory for related bundle package information."); | ||
104 | |||
105 | pPackage = pPackages->rgPackages + pPackages->cPackages; | ||
106 | ++pPackages->cPackages; | ||
107 | |||
108 | hr = StrAllocString(&pPackage->sczId, wzId, 0); | ||
109 | ExitOnFailure(hr, "Failed to copy related bundle package id."); | ||
110 | |||
111 | pPackage->type = type; | ||
112 | |||
113 | // TODO: try to look up the DisplayName and Description in Add/Remove Programs with the wzId. | ||
114 | |||
115 | if (ppPackage) | ||
116 | { | ||
117 | *ppPackage = pPackage; | ||
118 | } | ||
119 | |||
120 | LExit: | ||
121 | return hr; | ||
122 | } | ||
123 | |||
124 | |||
125 | DAPI_(HRESULT) BalInfoFindPackageById( | ||
126 | __in BAL_INFO_PACKAGES* pPackages, | ||
127 | __in LPCWSTR wzId, | ||
128 | __out BAL_INFO_PACKAGE** ppPackage | ||
129 | ) | ||
130 | { | ||
131 | *ppPackage = NULL; | ||
132 | |||
133 | for (DWORD i = 0; i < pPackages->cPackages; ++i) | ||
134 | { | ||
135 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzId, -1, pPackages->rgPackages[i].sczId, -1)) | ||
136 | { | ||
137 | *ppPackage = pPackages->rgPackages + i; | ||
138 | break; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | return *ppPackage ? S_OK : E_NOTFOUND; | ||
143 | } | ||
144 | |||
145 | |||
146 | DAPI_(void) BalInfoUninitialize( | ||
147 | __in BAL_INFO_BUNDLE* pBundle | ||
148 | ) | ||
149 | { | ||
150 | for (DWORD i = 0; i < pBundle->packages.cPackages; ++i) | ||
151 | { | ||
152 | ReleaseStr(pBundle->packages.rgPackages[i].sczDisplayName); | ||
153 | ReleaseStr(pBundle->packages.rgPackages[i].sczDescription); | ||
154 | ReleaseStr(pBundle->packages.rgPackages[i].sczId); | ||
155 | ReleaseStr(pBundle->packages.rgPackages[i].sczDisplayInternalUICondition); | ||
156 | ReleaseStr(pBundle->packages.rgPackages[i].sczProductCode); | ||
157 | ReleaseStr(pBundle->packages.rgPackages[i].sczUpgradeCode); | ||
158 | ReleaseStr(pBundle->packages.rgPackages[i].sczVersion); | ||
159 | ReleaseStr(pBundle->packages.rgPackages[i].sczInstallCondition); | ||
160 | ReleaseStr(pBundle->packages.rgPackages[i].sczPrereqLicenseFile); | ||
161 | ReleaseStr(pBundle->packages.rgPackages[i].sczPrereqLicenseUrl); | ||
162 | } | ||
163 | |||
164 | ReleaseMem(pBundle->packages.rgPackages); | ||
165 | |||
166 | ReleaseStr(pBundle->sczName); | ||
167 | ReleaseStr(pBundle->sczLogVariable); | ||
168 | memset(pBundle, 0, sizeof(BAL_INFO_BUNDLE)); | ||
169 | } | ||
170 | |||
171 | |||
172 | static HRESULT ParsePackagesFromXml( | ||
173 | __in BAL_INFO_PACKAGES* pPackages, | ||
174 | __in IXMLDOMDocument* pixdManifest | ||
175 | ) | ||
176 | { | ||
177 | HRESULT hr = S_OK; | ||
178 | IXMLDOMNodeList* pNodeList = NULL; | ||
179 | IXMLDOMNode* pNode = NULL; | ||
180 | BAL_INFO_PACKAGE* prgPackages = NULL; | ||
181 | DWORD cPackages = 0; | ||
182 | LPWSTR scz = NULL; | ||
183 | |||
184 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixPackageProperties", &pNodeList); | ||
185 | ExitOnFailure(hr, "Failed to select all packages."); | ||
186 | |||
187 | hr = pNodeList->get_length(reinterpret_cast<long*>(&cPackages)); | ||
188 | ExitOnFailure(hr, "Failed to get the package count."); | ||
189 | |||
190 | prgPackages = static_cast<BAL_INFO_PACKAGE*>(MemAlloc(sizeof(BAL_INFO_PACKAGE) * cPackages, TRUE)); | ||
191 | ExitOnNull(prgPackages, hr, E_OUTOFMEMORY, "Failed to allocate memory for packages."); | ||
192 | |||
193 | DWORD iPackage = 0; | ||
194 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | ||
195 | { | ||
196 | hr = XmlGetAttributeEx(pNode, L"Package", &prgPackages[iPackage].sczId); | ||
197 | ExitOnFailure(hr, "Failed to get package identifier for package."); | ||
198 | |||
199 | hr = XmlGetAttributeEx(pNode, L"DisplayName", &prgPackages[iPackage].sczDisplayName); | ||
200 | if (E_NOTFOUND != hr) | ||
201 | { | ||
202 | ExitOnFailure(hr, "Failed to get display name for package."); | ||
203 | } | ||
204 | |||
205 | hr = XmlGetAttributeEx(pNode, L"Description", &prgPackages[iPackage].sczDescription); | ||
206 | if (E_NOTFOUND != hr) | ||
207 | { | ||
208 | ExitOnFailure(hr, "Failed to get description for package."); | ||
209 | } | ||
210 | |||
211 | hr = XmlGetAttributeEx(pNode, L"PackageType", &scz); | ||
212 | ExitOnFailure(hr, "Failed to get package type for package."); | ||
213 | |||
214 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Exe", -1, scz, -1)) | ||
215 | { | ||
216 | prgPackages[iPackage].type = BAL_INFO_PACKAGE_TYPE_EXE; | ||
217 | } | ||
218 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Msi", -1, scz, -1)) | ||
219 | { | ||
220 | prgPackages[iPackage].type = BAL_INFO_PACKAGE_TYPE_MSI; | ||
221 | } | ||
222 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Msp", -1, scz, -1)) | ||
223 | { | ||
224 | prgPackages[iPackage].type = BAL_INFO_PACKAGE_TYPE_MSP; | ||
225 | } | ||
226 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, L"Msu", -1, scz, -1)) | ||
227 | { | ||
228 | prgPackages[iPackage].type = BAL_INFO_PACKAGE_TYPE_MSU; | ||
229 | } | ||
230 | |||
231 | hr = XmlGetYesNoAttribute(pNode, L"Permanent", &prgPackages[iPackage].fPermanent); | ||
232 | ExitOnFailure(hr, "Failed to get permanent setting for package."); | ||
233 | |||
234 | hr = XmlGetYesNoAttribute(pNode, L"Vital", &prgPackages[iPackage].fVital); | ||
235 | ExitOnFailure(hr, "Failed to get vital setting for package."); | ||
236 | |||
237 | hr = XmlGetAttributeEx(pNode, L"ProductCode", &prgPackages[iPackage].sczProductCode); | ||
238 | if (E_NOTFOUND != hr) | ||
239 | { | ||
240 | ExitOnFailure(hr, "Failed to get product code for package."); | ||
241 | } | ||
242 | |||
243 | hr = XmlGetAttributeEx(pNode, L"UpgradeCode", &prgPackages[iPackage].sczUpgradeCode); | ||
244 | if (E_NOTFOUND != hr) | ||
245 | { | ||
246 | ExitOnFailure(hr, "Failed to get upgrade code for package."); | ||
247 | } | ||
248 | |||
249 | hr = XmlGetAttributeEx(pNode, L"Version", &prgPackages[iPackage].sczVersion); | ||
250 | if (E_NOTFOUND != hr) | ||
251 | { | ||
252 | ExitOnFailure(hr, "Failed to get version for package."); | ||
253 | } | ||
254 | |||
255 | hr = XmlGetAttributeEx(pNode, L"InstallCondition", &prgPackages[iPackage].sczInstallCondition); | ||
256 | if (E_NOTFOUND != hr) | ||
257 | { | ||
258 | ExitOnFailure(hr, "Failed to get install condition for package."); | ||
259 | } | ||
260 | |||
261 | hr = XmlGetAttributeEx(pNode, L"Cache", &scz); | ||
262 | ExitOnFailure(hr, "Failed to get cache type for package."); | ||
263 | |||
264 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, scz, -1, L"remove", -1)) | ||
265 | { | ||
266 | prgPackages[iPackage].cacheType = BOOTSTRAPPER_CACHE_TYPE_REMOVE; | ||
267 | } | ||
268 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, scz, -1, L"keep", -1)) | ||
269 | { | ||
270 | prgPackages[iPackage].cacheType = BOOTSTRAPPER_CACHE_TYPE_KEEP; | ||
271 | } | ||
272 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, scz, -1, L"force", -1)) | ||
273 | { | ||
274 | prgPackages[iPackage].cacheType = BOOTSTRAPPER_CACHE_TYPE_FORCE; | ||
275 | } | ||
276 | |||
277 | ++iPackage; | ||
278 | ReleaseNullObject(pNode); | ||
279 | } | ||
280 | ExitOnFailure(hr, "Failed to parse all package property elements."); | ||
281 | |||
282 | if (S_FALSE == hr) | ||
283 | { | ||
284 | hr = S_OK; | ||
285 | } | ||
286 | |||
287 | pPackages->cPackages = cPackages; | ||
288 | pPackages->rgPackages = prgPackages; | ||
289 | prgPackages = NULL; | ||
290 | |||
291 | LExit: | ||
292 | ReleaseStr(scz); | ||
293 | ReleaseMem(prgPackages); | ||
294 | ReleaseObject(pNode); | ||
295 | ReleaseObject(pNodeList); | ||
296 | |||
297 | return hr; | ||
298 | } | ||
299 | |||
300 | |||
301 | static HRESULT ParseBalPackageInfoFromXml( | ||
302 | __in BAL_INFO_PACKAGES* pPackages, | ||
303 | __in IXMLDOMDocument* pixdManifest | ||
304 | ) | ||
305 | { | ||
306 | HRESULT hr = S_OK; | ||
307 | IXMLDOMNodeList* pNodeList = NULL; | ||
308 | IXMLDOMNode* pNode = NULL; | ||
309 | LPWSTR scz = NULL; | ||
310 | BAL_INFO_PACKAGE* pPackage = NULL; | ||
311 | |||
312 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixBalPackageInfo", &pNodeList); | ||
313 | ExitOnFailure(hr, "Failed to select all packages."); | ||
314 | |||
315 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | ||
316 | { | ||
317 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); | ||
318 | ExitOnFailure(hr, "Failed to get package identifier for WixBalPackageInfo."); | ||
319 | |||
320 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); | ||
321 | ExitOnFailure(hr, "Failed to find package specified in WixBalPackageInfo: %ls", scz); | ||
322 | |||
323 | hr = XmlGetAttributeEx(pNode, L"DisplayInternalUICondition", &pPackage->sczDisplayInternalUICondition); | ||
324 | if (E_NOTFOUND != hr) | ||
325 | { | ||
326 | ExitOnFailure(hr, "Failed to get DisplayInternalUICondition setting for package."); | ||
327 | } | ||
328 | |||
329 | ReleaseNullObject(pNode); | ||
330 | } | ||
331 | ExitOnFailure(hr, "Failed to parse all WixBalPackageInfo elements."); | ||
332 | |||
333 | hr = XmlSelectNodes(pixdManifest, L"/BootstrapperApplicationData/WixMbaPrereqInformation", &pNodeList); | ||
334 | ExitOnFailure(hr, "Failed to select all packages."); | ||
335 | |||
336 | while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, NULL))) | ||
337 | { | ||
338 | hr = XmlGetAttributeEx(pNode, L"PackageId", &scz); | ||
339 | ExitOnFailure(hr, "Failed to get package identifier for WixMbaPrereqInformation."); | ||
340 | |||
341 | hr = BalInfoFindPackageById(pPackages, scz, &pPackage); | ||
342 | ExitOnFailure(hr, "Failed to find package specified in WixMbaPrereqInformation: %ls", scz); | ||
343 | |||
344 | pPackage->fPrereqPackage = TRUE; | ||
345 | |||
346 | hr = XmlGetAttributeEx(pNode, L"LicenseFile", &pPackage->sczPrereqLicenseFile); | ||
347 | if (E_NOTFOUND != hr) | ||
348 | { | ||
349 | ExitOnFailure(hr, "Failed to get LicenseFile setting for prereq package."); | ||
350 | } | ||
351 | |||
352 | hr = XmlGetAttributeEx(pNode, L"LicenseUrl", &pPackage->sczPrereqLicenseUrl); | ||
353 | if (E_NOTFOUND != hr) | ||
354 | { | ||
355 | ExitOnFailure(hr, "Failed to get LicenseUrl setting for prereq package."); | ||
356 | } | ||
357 | |||
358 | ReleaseNullObject(pNode); | ||
359 | } | ||
360 | ExitOnFailure(hr, "Failed to parse all WixMbaPrereqInformation elements."); | ||
361 | |||
362 | if (S_FALSE == hr) | ||
363 | { | ||
364 | hr = S_OK; | ||
365 | } | ||
366 | |||
367 | LExit: | ||
368 | ReleaseStr(scz); | ||
369 | ReleaseObject(pNode); | ||
370 | ReleaseObject(pNodeList); | ||
371 | |||
372 | return hr; | ||
373 | } | ||
diff --git a/src/api/burn/balutil/balretry.cpp b/src/api/burn/balutil/balretry.cpp new file mode 100644 index 00000000..9d8abd6d --- /dev/null +++ b/src/api/burn/balutil/balretry.cpp | |||
@@ -0,0 +1,246 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | typedef enum BALRETRY_TYPE | ||
6 | { | ||
7 | BALRETRY_TYPE_CACHE_CONTAINER, | ||
8 | BALRETRY_TYPE_CACHE_PAYLOAD, | ||
9 | BALRETRY_TYPE_EXECUTE, | ||
10 | } BALRETRY_TYPE; | ||
11 | |||
12 | struct BALRETRY_INFO | ||
13 | { | ||
14 | LPWSTR sczId; | ||
15 | DWORD cRetries; | ||
16 | DWORD dwLastError; | ||
17 | }; | ||
18 | |||
19 | static DWORD vdwMaxRetries = 0; | ||
20 | static DWORD vdwTimeout = 0; | ||
21 | static BALRETRY_INFO vrgRetryInfo[3]; | ||
22 | |||
23 | // prototypes | ||
24 | static BOOL IsActiveRetryEntry( | ||
25 | __in BALRETRY_TYPE type, | ||
26 | __in_z LPCWSTR sczId | ||
27 | ); | ||
28 | |||
29 | static HRESULT StartActiveRetryEntry( | ||
30 | __in BALRETRY_TYPE type, | ||
31 | __in_z LPCWSTR sczId | ||
32 | ); | ||
33 | |||
34 | |||
35 | DAPI_(void) BalRetryInitialize( | ||
36 | __in DWORD dwMaxRetries, | ||
37 | __in DWORD dwTimeout | ||
38 | ) | ||
39 | { | ||
40 | BalRetryUninitialize(); // clean everything out. | ||
41 | |||
42 | vdwMaxRetries = dwMaxRetries; | ||
43 | vdwTimeout = dwTimeout; | ||
44 | } | ||
45 | |||
46 | |||
47 | DAPI_(void) BalRetryUninitialize() | ||
48 | { | ||
49 | for (DWORD i = 0; i < countof(vrgRetryInfo); ++i) | ||
50 | { | ||
51 | ReleaseStr(vrgRetryInfo[i].sczId); | ||
52 | memset(vrgRetryInfo + i, 0, sizeof(BALRETRY_INFO)); | ||
53 | } | ||
54 | |||
55 | vdwMaxRetries = 0; | ||
56 | vdwTimeout = 0; | ||
57 | } | ||
58 | |||
59 | |||
60 | DAPI_(void) BalRetryStartContainerOrPayload( | ||
61 | __in_z_opt LPCWSTR wzContainerOrPackageId, | ||
62 | __in_z_opt LPCWSTR wzPayloadId | ||
63 | ) | ||
64 | { | ||
65 | if (!wzContainerOrPackageId && !wzPayloadId) | ||
66 | { | ||
67 | ReleaseNullStr(vrgRetryInfo[BALRETRY_TYPE_CACHE_CONTAINER].sczId); | ||
68 | ReleaseNullStr(vrgRetryInfo[BALRETRY_TYPE_CACHE_PAYLOAD].sczId); | ||
69 | } | ||
70 | else if (wzPayloadId) | ||
71 | { | ||
72 | StartActiveRetryEntry(BALRETRY_TYPE_CACHE_PAYLOAD, wzPayloadId); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | StartActiveRetryEntry(BALRETRY_TYPE_CACHE_CONTAINER, wzContainerOrPackageId); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | |||
81 | DAPI_(void) BalRetryStartPackage( | ||
82 | __in_z LPCWSTR wzPackageId | ||
83 | ) | ||
84 | { | ||
85 | StartActiveRetryEntry(BALRETRY_TYPE_EXECUTE, wzPackageId); | ||
86 | } | ||
87 | |||
88 | |||
89 | DAPI_(void) BalRetryErrorOccurred( | ||
90 | __in_z LPCWSTR wzPackageId, | ||
91 | __in DWORD dwError | ||
92 | ) | ||
93 | { | ||
94 | if (IsActiveRetryEntry(BALRETRY_TYPE_EXECUTE, wzPackageId)) | ||
95 | { | ||
96 | vrgRetryInfo[BALRETRY_TYPE_EXECUTE].dwLastError = dwError; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | |||
101 | DAPI_(HRESULT) BalRetryEndContainerOrPayload( | ||
102 | __in_z_opt LPCWSTR wzContainerOrPackageId, | ||
103 | __in_z_opt LPCWSTR wzPayloadId, | ||
104 | __in HRESULT hrError, | ||
105 | __inout BOOL* pfRetry | ||
106 | ) | ||
107 | { | ||
108 | HRESULT hr = S_OK; | ||
109 | BALRETRY_TYPE type = BALRETRY_TYPE_CACHE_PAYLOAD; | ||
110 | LPCWSTR wzId = NULL; | ||
111 | |||
112 | if (!wzContainerOrPackageId && !wzPayloadId) | ||
113 | { | ||
114 | ReleaseNullStr(vrgRetryInfo[BALRETRY_TYPE_CACHE_CONTAINER].sczId); | ||
115 | ReleaseNullStr(vrgRetryInfo[BALRETRY_TYPE_CACHE_PAYLOAD].sczId); | ||
116 | ExitFunction(); | ||
117 | } | ||
118 | else if (wzPayloadId) | ||
119 | { | ||
120 | type = BALRETRY_TYPE_CACHE_PAYLOAD; | ||
121 | wzId = wzPayloadId; | ||
122 | } | ||
123 | else | ||
124 | { | ||
125 | type = BALRETRY_TYPE_CACHE_CONTAINER; | ||
126 | wzId = wzContainerOrPackageId; | ||
127 | } | ||
128 | |||
129 | if (FAILED(hrError) && vrgRetryInfo[type].cRetries < vdwMaxRetries && IsActiveRetryEntry(type, wzId)) | ||
130 | { | ||
131 | // Retry on all errors except the following. | ||
132 | if (HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) != hrError && | ||
133 | BG_E_NETWORK_DISCONNECTED != hrError && | ||
134 | HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) != hrError && | ||
135 | HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED) != hrError) | ||
136 | { | ||
137 | *pfRetry = TRUE; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | LExit: | ||
142 | return hr; | ||
143 | } | ||
144 | |||
145 | |||
146 | DAPI_(HRESULT) BalRetryEndPackage( | ||
147 | __in_z LPCWSTR wzPackageId, | ||
148 | __in HRESULT hrError, | ||
149 | __inout BOOL* pfRetry | ||
150 | ) | ||
151 | { | ||
152 | HRESULT hr = S_OK; | ||
153 | BALRETRY_TYPE type = BALRETRY_TYPE_EXECUTE; | ||
154 | |||
155 | if (!wzPackageId || !*wzPackageId) | ||
156 | { | ||
157 | ReleaseNullStr(vrgRetryInfo[type].sczId); | ||
158 | } | ||
159 | else if (FAILED(hrError) && vrgRetryInfo[type].cRetries < vdwMaxRetries && IsActiveRetryEntry(type, wzPackageId)) | ||
160 | { | ||
161 | // If the service is out of whack, just try again. | ||
162 | if (HRESULT_FROM_WIN32(ERROR_INSTALL_SERVICE_FAILURE) == hrError) | ||
163 | { | ||
164 | *pfRetry = TRUE; | ||
165 | } | ||
166 | else if (HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE) == hrError) | ||
167 | { | ||
168 | DWORD dwError = vrgRetryInfo[type].dwLastError; | ||
169 | |||
170 | // If we failed with one of these specific error codes, then retry since | ||
171 | // we've seen these have a high success of succeeding on retry. | ||
172 | if (1303 == dwError || | ||
173 | 1304 == dwError || | ||
174 | 1306 == dwError || | ||
175 | 1307 == dwError || | ||
176 | 1309 == dwError || | ||
177 | 1310 == dwError || | ||
178 | 1311 == dwError || | ||
179 | 1312 == dwError || | ||
180 | 1316 == dwError || | ||
181 | 1317 == dwError || | ||
182 | 1321 == dwError || | ||
183 | 1335 == dwError || | ||
184 | 1402 == dwError || | ||
185 | 1406 == dwError || | ||
186 | 1606 == dwError || | ||
187 | 1706 == dwError || | ||
188 | 1719 == dwError || | ||
189 | 1723 == dwError || | ||
190 | 1923 == dwError || | ||
191 | 1931 == dwError) | ||
192 | { | ||
193 | *pfRetry = TRUE; | ||
194 | } | ||
195 | } | ||
196 | else if (HRESULT_FROM_WIN32(ERROR_INSTALL_ALREADY_RUNNING) == hrError) | ||
197 | { | ||
198 | *pfRetry = TRUE; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | return hr; | ||
203 | } | ||
204 | |||
205 | |||
206 | // Internal functions. | ||
207 | |||
208 | static BOOL IsActiveRetryEntry( | ||
209 | __in BALRETRY_TYPE type, | ||
210 | __in_z LPCWSTR sczId | ||
211 | ) | ||
212 | { | ||
213 | BOOL fActive = FALSE; | ||
214 | |||
215 | fActive = vrgRetryInfo[type].sczId && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, sczId, -1, vrgRetryInfo[type].sczId, -1); | ||
216 | |||
217 | return fActive; | ||
218 | } | ||
219 | |||
220 | static HRESULT StartActiveRetryEntry( | ||
221 | __in BALRETRY_TYPE type, | ||
222 | __in_z LPCWSTR sczId | ||
223 | ) | ||
224 | { | ||
225 | HRESULT hr = S_OK; | ||
226 | |||
227 | if (!sczId || !*sczId) | ||
228 | { | ||
229 | ReleaseNullStr(vrgRetryInfo[type].sczId); | ||
230 | } | ||
231 | else if (IsActiveRetryEntry(type, sczId)) | ||
232 | { | ||
233 | ++vrgRetryInfo[type].cRetries; | ||
234 | ::Sleep(vdwTimeout); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | hr = StrAllocString(&vrgRetryInfo[type].sczId, sczId, 0); | ||
239 | |||
240 | vrgRetryInfo[type].cRetries = 0; | ||
241 | } | ||
242 | |||
243 | vrgRetryInfo[type].dwLastError = ERROR_SUCCESS; | ||
244 | |||
245 | return hr; | ||
246 | } | ||
diff --git a/src/api/burn/balutil/balutil.cpp b/src/api/burn/balutil/balutil.cpp new file mode 100644 index 00000000..7a638219 --- /dev/null +++ b/src/api/burn/balutil/balutil.cpp | |||
@@ -0,0 +1,425 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | const DWORD VARIABLE_GROW_FACTOR = 80; | ||
6 | static IBootstrapperEngine* vpEngine = NULL; | ||
7 | |||
8 | // prototypes | ||
9 | |||
10 | DAPI_(void) BalInitialize( | ||
11 | __in IBootstrapperEngine* pEngine | ||
12 | ) | ||
13 | { | ||
14 | pEngine->AddRef(); | ||
15 | |||
16 | ReleaseObject(vpEngine); | ||
17 | vpEngine = pEngine; | ||
18 | } | ||
19 | |||
20 | DAPI_(HRESULT) BalInitializeFromCreateArgs( | ||
21 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
22 | __out_opt IBootstrapperEngine** ppEngine | ||
23 | ) | ||
24 | { | ||
25 | HRESULT hr = S_OK; | ||
26 | IBootstrapperEngine* pEngine = NULL; | ||
27 | |||
28 | hr = BalBootstrapperEngineCreate(pArgs->pfnBootstrapperEngineProc, pArgs->pvBootstrapperEngineProcContext, &pEngine); | ||
29 | ExitOnFailure(hr, "Failed to create BalBootstrapperEngine."); | ||
30 | |||
31 | BalInitialize(pEngine); | ||
32 | |||
33 | if (ppEngine) | ||
34 | { | ||
35 | *ppEngine = pEngine; | ||
36 | } | ||
37 | pEngine = NULL; | ||
38 | |||
39 | LExit: | ||
40 | ReleaseObject(pEngine); | ||
41 | |||
42 | return hr; | ||
43 | } | ||
44 | |||
45 | |||
46 | DAPI_(void) BalUninitialize() | ||
47 | { | ||
48 | ReleaseNullObject(vpEngine); | ||
49 | } | ||
50 | |||
51 | |||
52 | DAPI_(HRESULT) BalManifestLoad( | ||
53 | __in HMODULE hBootstrapperApplicationModule, | ||
54 | __out IXMLDOMDocument** ppixdManifest | ||
55 | ) | ||
56 | { | ||
57 | HRESULT hr = S_OK; | ||
58 | LPWSTR sczPath = NULL; | ||
59 | |||
60 | hr = PathRelativeToModule(&sczPath, BAL_MANIFEST_FILENAME, hBootstrapperApplicationModule); | ||
61 | ExitOnFailure(hr, "Failed to get path to bootstrapper application manifest: %ls", BAL_MANIFEST_FILENAME); | ||
62 | |||
63 | hr = XmlLoadDocumentFromFile(sczPath, ppixdManifest); | ||
64 | ExitOnFailure(hr, "Failed to load bootstrapper application manifest '%ls' from path: %ls", BAL_MANIFEST_FILENAME, sczPath); | ||
65 | |||
66 | LExit: | ||
67 | ReleaseStr(sczPath); | ||
68 | return hr; | ||
69 | } | ||
70 | |||
71 | |||
72 | DAPI_(HRESULT) BalEvaluateCondition( | ||
73 | __in_z LPCWSTR wzCondition, | ||
74 | __out BOOL* pf | ||
75 | ) | ||
76 | { | ||
77 | HRESULT hr = S_OK; | ||
78 | |||
79 | if (!vpEngine) | ||
80 | { | ||
81 | hr = E_POINTER; | ||
82 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
83 | } | ||
84 | |||
85 | hr = vpEngine->EvaluateCondition(wzCondition, pf); | ||
86 | |||
87 | LExit: | ||
88 | return hr; | ||
89 | } | ||
90 | |||
91 | |||
92 | // The contents of psczOut may be sensitive, should keep encrypted and SecureZeroFree. | ||
93 | DAPI_(HRESULT) BalFormatString( | ||
94 | __in_z LPCWSTR wzFormat, | ||
95 | __inout LPWSTR* psczOut | ||
96 | ) | ||
97 | { | ||
98 | HRESULT hr = S_OK; | ||
99 | SIZE_T cch = 0; | ||
100 | |||
101 | if (!vpEngine) | ||
102 | { | ||
103 | hr = E_POINTER; | ||
104 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
105 | } | ||
106 | |||
107 | if (*psczOut) | ||
108 | { | ||
109 | hr = StrMaxLength(*psczOut, &cch); | ||
110 | ExitOnFailure(hr, "Failed to determine length of value."); | ||
111 | } | ||
112 | |||
113 | hr = vpEngine->FormatString(wzFormat, *psczOut, &cch); | ||
114 | if (E_MOREDATA == hr) | ||
115 | { | ||
116 | ++cch; | ||
117 | |||
118 | hr = StrAllocSecure(psczOut, cch); | ||
119 | ExitOnFailure(hr, "Failed to allocate value."); | ||
120 | |||
121 | hr = vpEngine->FormatString(wzFormat, *psczOut, &cch); | ||
122 | } | ||
123 | |||
124 | LExit: | ||
125 | return hr; | ||
126 | } | ||
127 | |||
128 | |||
129 | // The contents of pllValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroMemory. | ||
130 | DAPI_(HRESULT) BalGetNumericVariable( | ||
131 | __in_z LPCWSTR wzVariable, | ||
132 | __out LONGLONG* pllValue | ||
133 | ) | ||
134 | { | ||
135 | HRESULT hr = S_OK; | ||
136 | |||
137 | if (!vpEngine) | ||
138 | { | ||
139 | hr = E_POINTER; | ||
140 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
141 | } | ||
142 | |||
143 | hr = vpEngine->GetVariableNumeric(wzVariable, pllValue); | ||
144 | |||
145 | LExit: | ||
146 | return hr; | ||
147 | } | ||
148 | |||
149 | |||
150 | DAPI_(HRESULT) BalSetNumericVariable( | ||
151 | __in_z LPCWSTR wzVariable, | ||
152 | __in LONGLONG llValue | ||
153 | ) | ||
154 | { | ||
155 | HRESULT hr = S_OK; | ||
156 | |||
157 | if (!vpEngine) | ||
158 | { | ||
159 | hr = E_POINTER; | ||
160 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
161 | } | ||
162 | |||
163 | hr = vpEngine->SetVariableNumeric(wzVariable, llValue); | ||
164 | |||
165 | LExit: | ||
166 | return hr; | ||
167 | } | ||
168 | |||
169 | |||
170 | DAPI_(BOOL) BalVariableExists( | ||
171 | __in_z LPCWSTR wzVariable | ||
172 | ) | ||
173 | { | ||
174 | HRESULT hr = S_OK; | ||
175 | SIZE_T cch = 0; | ||
176 | |||
177 | if (!vpEngine) | ||
178 | { | ||
179 | hr = E_POINTER; | ||
180 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
181 | } | ||
182 | |||
183 | hr = vpEngine->GetVariableString(wzVariable, NULL, &cch); | ||
184 | |||
185 | LExit: | ||
186 | return E_NOTFOUND != hr; | ||
187 | } | ||
188 | |||
189 | |||
190 | // The contents of psczValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroFree. | ||
191 | DAPI_(HRESULT) BalGetStringVariable( | ||
192 | __in_z LPCWSTR wzVariable, | ||
193 | __inout LPWSTR* psczValue | ||
194 | ) | ||
195 | { | ||
196 | HRESULT hr = S_OK; | ||
197 | SIZE_T cch = 0; | ||
198 | |||
199 | if (!vpEngine) | ||
200 | { | ||
201 | hr = E_POINTER; | ||
202 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
203 | } | ||
204 | |||
205 | if (*psczValue) | ||
206 | { | ||
207 | hr = StrMaxLength(*psczValue, &cch); | ||
208 | ExitOnFailure(hr, "Failed to determine length of value."); | ||
209 | } | ||
210 | |||
211 | hr = vpEngine->GetVariableString(wzVariable, *psczValue, &cch); | ||
212 | if (E_MOREDATA == hr) | ||
213 | { | ||
214 | ++cch; | ||
215 | |||
216 | hr = StrAllocSecure(psczValue, cch); | ||
217 | ExitOnFailure(hr, "Failed to allocate value."); | ||
218 | |||
219 | hr = vpEngine->GetVariableString(wzVariable, *psczValue, &cch); | ||
220 | } | ||
221 | |||
222 | LExit: | ||
223 | return hr; | ||
224 | } | ||
225 | |||
226 | DAPI_(HRESULT) BalSetStringVariable( | ||
227 | __in_z LPCWSTR wzVariable, | ||
228 | __in_z_opt LPCWSTR wzValue, | ||
229 | __in BOOL fFormatted | ||
230 | ) | ||
231 | { | ||
232 | HRESULT hr = S_OK; | ||
233 | |||
234 | if (!vpEngine) | ||
235 | { | ||
236 | hr = E_POINTER; | ||
237 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
238 | } | ||
239 | |||
240 | hr = vpEngine->SetVariableString(wzVariable, wzValue, fFormatted); | ||
241 | |||
242 | LExit: | ||
243 | return hr; | ||
244 | } | ||
245 | |||
246 | |||
247 | DAPIV_(HRESULT) BalLog( | ||
248 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
249 | __in_z __format_string LPCSTR szFormat, | ||
250 | ... | ||
251 | ) | ||
252 | { | ||
253 | HRESULT hr = S_OK; | ||
254 | va_list args; | ||
255 | |||
256 | if (!vpEngine) | ||
257 | { | ||
258 | hr = E_POINTER; | ||
259 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
260 | } | ||
261 | |||
262 | va_start(args, szFormat); | ||
263 | hr = BalLogArgs(level, szFormat, args); | ||
264 | va_end(args); | ||
265 | |||
266 | LExit: | ||
267 | return hr; | ||
268 | } | ||
269 | |||
270 | |||
271 | DAPI_(HRESULT) BalLogArgs( | ||
272 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
273 | __in_z __format_string LPCSTR szFormat, | ||
274 | __in va_list args | ||
275 | ) | ||
276 | { | ||
277 | HRESULT hr = S_OK; | ||
278 | LPSTR sczFormattedAnsi = NULL; | ||
279 | LPWSTR sczMessage = NULL; | ||
280 | |||
281 | if (!vpEngine) | ||
282 | { | ||
283 | hr = E_POINTER; | ||
284 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
285 | } | ||
286 | |||
287 | hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args); | ||
288 | ExitOnFailure(hr, "Failed to format log string."); | ||
289 | |||
290 | hr = StrAllocStringAnsi(&sczMessage, sczFormattedAnsi, 0, CP_UTF8); | ||
291 | ExitOnFailure(hr, "Failed to convert log string to Unicode."); | ||
292 | |||
293 | hr = vpEngine->Log(level, sczMessage); | ||
294 | |||
295 | LExit: | ||
296 | ReleaseStr(sczMessage); | ||
297 | ReleaseStr(sczFormattedAnsi); | ||
298 | return hr; | ||
299 | } | ||
300 | |||
301 | |||
302 | DAPIV_(HRESULT) BalLogError( | ||
303 | __in HRESULT hrError, | ||
304 | __in_z __format_string LPCSTR szFormat, | ||
305 | ... | ||
306 | ) | ||
307 | { | ||
308 | HRESULT hr = S_OK; | ||
309 | va_list args; | ||
310 | |||
311 | if (!vpEngine) | ||
312 | { | ||
313 | hr = E_POINTER; | ||
314 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
315 | } | ||
316 | |||
317 | va_start(args, szFormat); | ||
318 | hr = BalLogErrorArgs(hrError, szFormat, args); | ||
319 | va_end(args); | ||
320 | |||
321 | LExit: | ||
322 | return hr; | ||
323 | } | ||
324 | |||
325 | |||
326 | DAPI_(HRESULT) BalLogErrorArgs( | ||
327 | __in HRESULT hrError, | ||
328 | __in_z __format_string LPCSTR szFormat, | ||
329 | __in va_list args | ||
330 | ) | ||
331 | { | ||
332 | HRESULT hr = S_OK; | ||
333 | LPSTR sczFormattedAnsi = NULL; | ||
334 | LPWSTR sczMessage = NULL; | ||
335 | |||
336 | if (!vpEngine) | ||
337 | { | ||
338 | hr = E_POINTER; | ||
339 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
340 | } | ||
341 | |||
342 | hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args); | ||
343 | ExitOnFailure(hr, "Failed to format error log string."); | ||
344 | |||
345 | hr = StrAllocFormatted(&sczMessage, L"Error 0x%08x: %S", hrError, sczFormattedAnsi); | ||
346 | ExitOnFailure(hr, "Failed to prepend error number to error log string."); | ||
347 | |||
348 | hr = vpEngine->Log(BOOTSTRAPPER_LOG_LEVEL_ERROR, sczMessage); | ||
349 | |||
350 | LExit: | ||
351 | ReleaseStr(sczMessage); | ||
352 | ReleaseStr(sczFormattedAnsi); | ||
353 | return hr; | ||
354 | } | ||
355 | |||
356 | DAPIV_(HRESULT) BalLogId( | ||
357 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
358 | __in DWORD dwLogId, | ||
359 | __in HMODULE hModule, | ||
360 | ... | ||
361 | ) | ||
362 | { | ||
363 | HRESULT hr = S_OK; | ||
364 | va_list args; | ||
365 | |||
366 | if (!vpEngine) | ||
367 | { | ||
368 | hr = E_POINTER; | ||
369 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
370 | } | ||
371 | |||
372 | va_start(args, hModule); | ||
373 | hr = BalLogIdArgs(level, dwLogId, hModule, args); | ||
374 | va_end(args); | ||
375 | |||
376 | LExit: | ||
377 | return hr; | ||
378 | } | ||
379 | |||
380 | DAPI_(HRESULT) BalLogIdArgs( | ||
381 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
382 | __in DWORD dwLogId, | ||
383 | __in HMODULE hModule, | ||
384 | __in va_list args | ||
385 | ) | ||
386 | { | ||
387 | |||
388 | HRESULT hr = S_OK; | ||
389 | LPWSTR pwz = NULL; | ||
390 | DWORD cch = 0; | ||
391 | |||
392 | if (!vpEngine) | ||
393 | { | ||
394 | hr = E_POINTER; | ||
395 | ExitOnRootFailure(hr, "BalInitialize() must be called first."); | ||
396 | } | ||
397 | |||
398 | // Get the string for the id. | ||
399 | #pragma prefast(push) | ||
400 | #pragma prefast(disable:25028) | ||
401 | #pragma prefast(disable:25068) | ||
402 | cch = ::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE, | ||
403 | static_cast<LPCVOID>(hModule), dwLogId, 0, reinterpret_cast<LPWSTR>(&pwz), 0, &args); | ||
404 | #pragma prefast(pop) | ||
405 | |||
406 | if (0 == cch) | ||
407 | { | ||
408 | ExitOnLastError(hr, "Failed to log id: %d", dwLogId); | ||
409 | } | ||
410 | |||
411 | if (2 <= cch && L'\r' == pwz[cch - 2] && L'\n' == pwz[cch - 1]) | ||
412 | { | ||
413 | pwz[cch - 2] = L'\0'; // remove newline from message table. | ||
414 | } | ||
415 | |||
416 | hr = vpEngine->Log(level, pwz); | ||
417 | |||
418 | LExit: | ||
419 | if (pwz) | ||
420 | { | ||
421 | ::LocalFree(pwz); | ||
422 | } | ||
423 | |||
424 | return hr; | ||
425 | } | ||
diff --git a/src/api/burn/balutil/balutil.nuspec b/src/api/burn/balutil/balutil.nuspec new file mode 100644 index 00000000..e38362ec --- /dev/null +++ b/src/api/burn/balutil/balutil.nuspec | |||
@@ -0,0 +1,31 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <package > | ||
3 | <metadata> | ||
4 | <id>$id$</id> | ||
5 | <version>$version$</version> | ||
6 | <authors>$authors$</authors> | ||
7 | <owners>$authors$</owners> | ||
8 | <license type="expression">MS-RL</license> | ||
9 | <projectUrl>https://github.com/wixtoolset/balutil</projectUrl> | ||
10 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
11 | <description>$description$</description> | ||
12 | <copyright>$copyright$</copyright> | ||
13 | <dependencies> | ||
14 | <dependency id="WixToolset.BootstrapperCore.Native" version="[4,5)" /> | ||
15 | <dependency id="WixToolset.DUtil" version="[4,5)" /> | ||
16 | </dependencies> | ||
17 | </metadata> | ||
18 | |||
19 | <files> | ||
20 | <file src="build\$id$.props" target="build\" /> | ||
21 | <file src="inc\*" target="build\native\include" /> | ||
22 | <file src="..\..\build\$configuration$\v140\x86\balutil.lib" target="build\native\v140\x86" /> | ||
23 | <file src="..\..\build\$configuration$\v140\x64\balutil.lib" target="build\native\v140\x64" /> | ||
24 | <file src="..\..\build\$configuration$\v141\x86\balutil.lib" target="build\native\v141\x86" /> | ||
25 | <file src="..\..\build\$configuration$\v141\x64\balutil.lib" target="build\native\v141\x64" /> | ||
26 | <file src="..\..\build\$configuration$\v141\ARM64\balutil.lib" target="build\native\v141\ARM64" /> | ||
27 | <file src="..\..\build\$configuration$\v142\x86\balutil.lib" target="build\native\v142\x86" /> | ||
28 | <file src="..\..\build\$configuration$\v142\x64\balutil.lib" target="build\native\v142\x64" /> | ||
29 | <file src="..\..\build\$configuration$\v142\ARM64\balutil.lib" target="build\native\v142\ARM64" /> | ||
30 | </files> | ||
31 | </package> | ||
diff --git a/src/api/burn/balutil/balutil.vcxproj b/src/api/burn/balutil/balutil.vcxproj new file mode 100644 index 00000000..ab33f159 --- /dev/null +++ b/src/api/burn/balutil/balutil.vcxproj | |||
@@ -0,0 +1,101 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
6 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
7 | |||
8 | <ItemGroup Label="ProjectConfigurations"> | ||
9 | <ProjectConfiguration Include="Debug|ARM64"> | ||
10 | <Configuration>Debug</Configuration> | ||
11 | <Platform>ARM64</Platform> | ||
12 | </ProjectConfiguration> | ||
13 | <ProjectConfiguration Include="Release|ARM64"> | ||
14 | <Configuration>Release</Configuration> | ||
15 | <Platform>ARM64</Platform> | ||
16 | </ProjectConfiguration> | ||
17 | <ProjectConfiguration Include="Debug|Win32"> | ||
18 | <Configuration>Debug</Configuration> | ||
19 | <Platform>Win32</Platform> | ||
20 | </ProjectConfiguration> | ||
21 | <ProjectConfiguration Include="Release|Win32"> | ||
22 | <Configuration>Release</Configuration> | ||
23 | <Platform>Win32</Platform> | ||
24 | </ProjectConfiguration> | ||
25 | <ProjectConfiguration Include="Debug|x64"> | ||
26 | <Configuration>Debug</Configuration> | ||
27 | <Platform>x64</Platform> | ||
28 | </ProjectConfiguration> | ||
29 | <ProjectConfiguration Include="Release|x64"> | ||
30 | <Configuration>Release</Configuration> | ||
31 | <Platform>x64</Platform> | ||
32 | </ProjectConfiguration> | ||
33 | </ItemGroup> | ||
34 | |||
35 | <PropertyGroup Label="Globals"> | ||
36 | <ProjectGuid>{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}</ProjectGuid> | ||
37 | <ConfigurationType>StaticLibrary</ConfigurationType> | ||
38 | <TargetName>balutil</TargetName> | ||
39 | <PlatformToolset>v142</PlatformToolset> | ||
40 | <CharacterSet>MultiByte</CharacterSet> | ||
41 | <Description>WiX Toolset Bootstrapper Application Layer native utility library</Description> | ||
42 | <PackageId>WixToolset.BalUtil</PackageId> | ||
43 | </PropertyGroup> | ||
44 | |||
45 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
46 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
47 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
48 | <Import Project="..\NativeMultiTargeting.Build.props" /> | ||
49 | |||
50 | <ImportGroup Label="ExtensionSettings"> | ||
51 | </ImportGroup> | ||
52 | |||
53 | <ImportGroup Label="Shared"> | ||
54 | </ImportGroup> | ||
55 | |||
56 | <PropertyGroup> | ||
57 | <ProjectAdditionalIncludeDirectories>$(ProjectDir)..\inc</ProjectAdditionalIncludeDirectories> | ||
58 | </PropertyGroup> | ||
59 | |||
60 | <ItemGroup> | ||
61 | <ClCompile Include="BalBootstrapperEngine.cpp" /> | ||
62 | <ClCompile Include="balcondition.cpp" /> | ||
63 | <ClCompile Include="balinfo.cpp" /> | ||
64 | <ClCompile Include="balretry.cpp" /> | ||
65 | <ClCompile Include="balutil.cpp" /> | ||
66 | <ClCompile Include="precomp.cpp"> | ||
67 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
68 | </ClCompile> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ClInclude Include="inc\BAFunctions.h" /> | ||
72 | <ClInclude Include="inc\BalBaseBAFunctions.h" /> | ||
73 | <ClInclude Include="inc\BalBaseBAFunctionsProc.h" /> | ||
74 | <ClInclude Include="inc\BalBaseBootstrapperApplication.h" /> | ||
75 | <ClInclude Include="inc\BalBaseBootstrapperApplicationProc.h" /> | ||
76 | <ClInclude Include="inc\BalBootstrapperEngine.h" /> | ||
77 | <ClInclude Include="inc\balcondition.h" /> | ||
78 | <ClInclude Include="inc\balinfo.h" /> | ||
79 | <ClInclude Include="inc\balretry.h" /> | ||
80 | <ClInclude Include="inc\balutil.h" /> | ||
81 | <ClInclude Include="inc\IBAFunctions.h" /> | ||
82 | <ClInclude Include="inc\IBootstrapperApplication.h" /> | ||
83 | <ClInclude Include="inc\IBootstrapperApplicationFactory.h" /> | ||
84 | <ClInclude Include="inc\IBootstrapperEngine.h" /> | ||
85 | <ClInclude Include="precomp.h" /> | ||
86 | </ItemGroup> | ||
87 | |||
88 | <ItemGroup> | ||
89 | <None Include="packages.config" /> | ||
90 | </ItemGroup> | ||
91 | |||
92 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
93 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
94 | <PropertyGroup> | ||
95 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
96 | </PropertyGroup> | ||
97 | <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
98 | <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" /> | ||
99 | <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
100 | </Target> | ||
101 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/balutil/build/WixToolset.BalUtil.props b/src/api/burn/balutil/build/WixToolset.BalUtil.props new file mode 100644 index 00000000..45b97f6a --- /dev/null +++ b/src/api/burn/balutil/build/WixToolset.BalUtil.props | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <ItemDefinitionGroup> | ||
6 | <ClCompile> | ||
7 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
8 | </ClCompile> | ||
9 | <ResourceCompile> | ||
10 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
11 | </ResourceCompile> | ||
12 | </ItemDefinitionGroup> | ||
13 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v140')) "> | ||
14 | <Link> | ||
15 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v140\$(PlatformTarget)\balutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
16 | </Link> | ||
17 | </ItemDefinitionGroup> | ||
18 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v141')) "> | ||
19 | <Link> | ||
20 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v141\$(PlatformTarget)\balutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
21 | </Link> | ||
22 | </ItemDefinitionGroup> | ||
23 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v142')) "> | ||
24 | <Link> | ||
25 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v142\$(PlatformTarget)\balutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
26 | </Link> | ||
27 | </ItemDefinitionGroup> | ||
28 | </Project> | ||
diff --git a/src/api/burn/balutil/inc/BAFunctions.h b/src/api/burn/balutil/inc/BAFunctions.h new file mode 100644 index 00000000..2970478f --- /dev/null +++ b/src/api/burn/balutil/inc/BAFunctions.h | |||
@@ -0,0 +1,147 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | // The first 1024 messages are reserved so that the BA messages have the same value here. | ||
10 | enum BA_FUNCTIONS_MESSAGE | ||
11 | { | ||
12 | BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, | ||
13 | BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, | ||
14 | BA_FUNCTIONS_MESSAGE_ONPLANBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, | ||
15 | BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, | ||
16 | BA_FUNCTIONS_MESSAGE_ONSTARTUP = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, | ||
17 | BA_FUNCTIONS_MESSAGE_ONSHUTDOWN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, | ||
18 | BA_FUNCTIONS_MESSAGE_ONSYSTEMSHUTDOWN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, | ||
19 | BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, | ||
20 | BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, | ||
21 | BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, | ||
22 | BA_FUNCTIONS_MESSAGE_ONDETECTUPDATECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, | ||
23 | BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, | ||
24 | BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, | ||
25 | BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDMSIPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, | ||
26 | BA_FUNCTIONS_MESSAGE_ONDETECTPATCHTARGET = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET, | ||
27 | BA_FUNCTIONS_MESSAGE_ONDETECTMSIFEATURE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, | ||
28 | BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, | ||
29 | BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, | ||
30 | BA_FUNCTIONS_MESSAGE_ONPLANPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, | ||
31 | BA_FUNCTIONS_MESSAGE_ONPLANPATCHTARGET = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET, | ||
32 | BA_FUNCTIONS_MESSAGE_ONPLANMSIFEATURE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, | ||
33 | BA_FUNCTIONS_MESSAGE_ONPLANPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, | ||
34 | BA_FUNCTIONS_MESSAGE_ONAPPLYBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, | ||
35 | BA_FUNCTIONS_MESSAGE_ONELEVATEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, | ||
36 | BA_FUNCTIONS_MESSAGE_ONELEVATECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, | ||
37 | BA_FUNCTIONS_MESSAGE_ONPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, | ||
38 | BA_FUNCTIONS_MESSAGE_ONERROR = BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, | ||
39 | BA_FUNCTIONS_MESSAGE_ONREGISTERBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, | ||
40 | BA_FUNCTIONS_MESSAGE_ONREGISTERCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, | ||
41 | BA_FUNCTIONS_MESSAGE_ONCACHEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, | ||
42 | BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, | ||
43 | BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, | ||
44 | BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, | ||
45 | BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRERESOLVING = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING, | ||
46 | BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, | ||
47 | BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, | ||
48 | BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, | ||
49 | BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, | ||
50 | BA_FUNCTIONS_MESSAGE_ONCACHECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, | ||
51 | BA_FUNCTIONS_MESSAGE_ONEXECUTEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, | ||
52 | BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, | ||
53 | BA_FUNCTIONS_MESSAGE_ONEXECUTEPATCHTARGET = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, | ||
54 | BA_FUNCTIONS_MESSAGE_ONEXECUTEPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, | ||
55 | BA_FUNCTIONS_MESSAGE_ONEXECUTEMSIMESSAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, | ||
56 | BA_FUNCTIONS_MESSAGE_ONEXECUTEFILESINUSE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, | ||
57 | BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, | ||
58 | BA_FUNCTIONS_MESSAGE_ONEXECUTECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, | ||
59 | BA_FUNCTIONS_MESSAGE_ONUNREGISTERBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, | ||
60 | BA_FUNCTIONS_MESSAGE_ONUNREGISTERCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, | ||
61 | BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, | ||
62 | BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, | ||
63 | BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, | ||
64 | BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, | ||
65 | BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, | ||
66 | BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, | ||
67 | BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, | ||
68 | BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, | ||
69 | BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, | ||
70 | BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, | ||
71 | BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN, | ||
72 | BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE, | ||
73 | BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, | ||
74 | BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, | ||
75 | BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, | ||
76 | BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, | ||
77 | BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, | ||
78 | BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, | ||
79 | BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, | ||
80 | BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, | ||
81 | BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, | ||
82 | BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, | ||
83 | BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, | ||
84 | |||
85 | BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, | ||
86 | BA_FUNCTIONS_MESSAGE_WNDPROC, | ||
87 | }; | ||
88 | |||
89 | typedef HRESULT(WINAPI *PFN_BA_FUNCTIONS_PROC)( | ||
90 | __in BA_FUNCTIONS_MESSAGE message, | ||
91 | __in const LPVOID pvArgs, | ||
92 | __inout LPVOID pvResults, | ||
93 | __in_opt LPVOID pvContext | ||
94 | ); | ||
95 | |||
96 | struct BA_FUNCTIONS_CREATE_ARGS | ||
97 | { | ||
98 | DWORD cbSize; | ||
99 | DWORD64 qwBAFunctionsAPIVersion; | ||
100 | BOOTSTRAPPER_CREATE_ARGS* pBootstrapperCreateArgs; | ||
101 | }; | ||
102 | |||
103 | struct BA_FUNCTIONS_CREATE_RESULTS | ||
104 | { | ||
105 | DWORD cbSize; | ||
106 | PFN_BA_FUNCTIONS_PROC pfnBAFunctionsProc; | ||
107 | LPVOID pvBAFunctionsProcContext; | ||
108 | }; | ||
109 | |||
110 | struct BA_FUNCTIONS_ONTHEMELOADED_ARGS | ||
111 | { | ||
112 | DWORD cbSize; | ||
113 | THEME* pTheme; | ||
114 | WIX_LOCALIZATION* pWixLoc; | ||
115 | }; | ||
116 | |||
117 | struct BA_FUNCTIONS_ONTHEMELOADED_RESULTS | ||
118 | { | ||
119 | DWORD cbSize; | ||
120 | }; | ||
121 | |||
122 | struct BA_FUNCTIONS_WNDPROC_ARGS | ||
123 | { | ||
124 | DWORD cbSize; | ||
125 | THEME* pTheme; | ||
126 | HWND hWnd; | ||
127 | UINT uMsg; | ||
128 | WPARAM wParam; | ||
129 | LPARAM lParam; | ||
130 | }; | ||
131 | |||
132 | struct BA_FUNCTIONS_WNDPROC_RESULTS | ||
133 | { | ||
134 | DWORD cbSize; | ||
135 | LRESULT lres; | ||
136 | }; | ||
137 | |||
138 | typedef HRESULT(WINAPI *PFN_BA_FUNCTIONS_CREATE)( | ||
139 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
140 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
141 | ); | ||
142 | |||
143 | typedef void (WINAPI *PFN_BA_FUNCTIONS_DESTROY)(); | ||
144 | |||
145 | #ifdef __cplusplus | ||
146 | } | ||
147 | #endif | ||
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h new file mode 100644 index 00000000..ee2e452f --- /dev/null +++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h | |||
@@ -0,0 +1,867 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | |||
8 | #include "dutil.h" | ||
9 | #include "locutil.h" | ||
10 | #include "thmutil.h" | ||
11 | #include "BAFunctions.h" | ||
12 | #include "IBAFunctions.h" | ||
13 | #include "BootstrapperEngine.h" | ||
14 | #include "BootstrapperApplication.h" | ||
15 | #include "IBootstrapperEngine.h" | ||
16 | #include "IBootstrapperApplication.h" | ||
17 | |||
18 | class CBalBaseBAFunctions : public IBAFunctions | ||
19 | { | ||
20 | public: // IUnknown | ||
21 | virtual STDMETHODIMP QueryInterface( | ||
22 | __in REFIID riid, | ||
23 | __out LPVOID *ppvObject | ||
24 | ) | ||
25 | { | ||
26 | if (!ppvObject) | ||
27 | { | ||
28 | return E_INVALIDARG; | ||
29 | } | ||
30 | |||
31 | *ppvObject = NULL; | ||
32 | |||
33 | if (::IsEqualIID(__uuidof(IBAFunctions), riid)) | ||
34 | { | ||
35 | *ppvObject = static_cast<IBAFunctions*>(this); | ||
36 | } | ||
37 | else if (::IsEqualIID(__uuidof(IBootstrapperApplication), riid)) | ||
38 | { | ||
39 | *ppvObject = static_cast<IBootstrapperApplication*>(this); | ||
40 | } | ||
41 | else if (::IsEqualIID(IID_IUnknown, riid)) | ||
42 | { | ||
43 | *ppvObject = static_cast<IUnknown*>(this); | ||
44 | } | ||
45 | else // no interface for requested iid | ||
46 | { | ||
47 | return E_NOINTERFACE; | ||
48 | } | ||
49 | |||
50 | AddRef(); | ||
51 | return S_OK; | ||
52 | } | ||
53 | |||
54 | virtual STDMETHODIMP_(ULONG) AddRef() | ||
55 | { | ||
56 | return ::InterlockedIncrement(&this->m_cReferences); | ||
57 | } | ||
58 | |||
59 | virtual STDMETHODIMP_(ULONG) Release() | ||
60 | { | ||
61 | long l = ::InterlockedDecrement(&this->m_cReferences); | ||
62 | if (0 < l) | ||
63 | { | ||
64 | return l; | ||
65 | } | ||
66 | |||
67 | delete this; | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | public: // IBootstrapperApplication | ||
72 | virtual STDMETHODIMP_(HRESULT) BAProc( | ||
73 | __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, | ||
74 | __in const LPVOID /*pvArgs*/, | ||
75 | __inout LPVOID /*pvResults*/, | ||
76 | __in_opt LPVOID /*pvContext*/ | ||
77 | ) | ||
78 | { | ||
79 | return E_NOTIMPL; | ||
80 | } | ||
81 | |||
82 | virtual STDMETHODIMP_(void) BAProcFallback( | ||
83 | __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, | ||
84 | __in const LPVOID /*pvArgs*/, | ||
85 | __inout LPVOID /*pvResults*/, | ||
86 | __inout HRESULT* /*phr*/, | ||
87 | __in_opt LPVOID /*pvContext*/ | ||
88 | ) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | virtual STDMETHODIMP OnStartup() | ||
93 | { | ||
94 | return S_OK; | ||
95 | } | ||
96 | |||
97 | virtual STDMETHODIMP OnShutdown( | ||
98 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* /*pAction*/ | ||
99 | ) | ||
100 | { | ||
101 | return S_OK; | ||
102 | } | ||
103 | |||
104 | virtual STDMETHODIMP OnSystemShutdown( | ||
105 | __in DWORD /*dwEndSession*/, | ||
106 | __inout BOOL* /*pfCancel*/ | ||
107 | ) | ||
108 | { | ||
109 | return S_OK; | ||
110 | } | ||
111 | |||
112 | virtual STDMETHODIMP OnDetectBegin( | ||
113 | __in BOOL /*fCached*/, | ||
114 | __in BOOL /*fInstalled*/, | ||
115 | __in DWORD /*cPackages*/, | ||
116 | __inout BOOL* /*pfCancel*/ | ||
117 | ) | ||
118 | { | ||
119 | return S_OK; | ||
120 | } | ||
121 | |||
122 | virtual STDMETHODIMP OnDetectForwardCompatibleBundle( | ||
123 | __in_z LPCWSTR /*wzBundleId*/, | ||
124 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
125 | __in_z LPCWSTR /*wzBundleTag*/, | ||
126 | __in BOOL /*fPerMachine*/, | ||
127 | __in LPCWSTR /*wzVersion*/, | ||
128 | __in BOOL /*fMissingFromCache*/, | ||
129 | __inout BOOL* /*pfCancel*/ | ||
130 | ) | ||
131 | { | ||
132 | return S_OK; | ||
133 | } | ||
134 | |||
135 | virtual STDMETHODIMP OnDetectUpdateBegin( | ||
136 | __in_z LPCWSTR /*wzUpdateLocation*/, | ||
137 | __inout BOOL* /*pfCancel*/, | ||
138 | __inout BOOL* /*pfSkip*/ | ||
139 | ) | ||
140 | { | ||
141 | return S_OK; | ||
142 | } | ||
143 | |||
144 | virtual STDMETHODIMP OnDetectUpdate( | ||
145 | __in_z LPCWSTR /*wzUpdateLocation*/, | ||
146 | __in DWORD64 /*dw64Size*/, | ||
147 | __in LPCWSTR /*wzVersion*/, | ||
148 | __in_z LPCWSTR /*wzTitle*/, | ||
149 | __in_z LPCWSTR /*wzSummary*/, | ||
150 | __in_z LPCWSTR /*wzContentType*/, | ||
151 | __in_z LPCWSTR /*wzContent*/, | ||
152 | __inout BOOL* /*pfCancel*/, | ||
153 | __inout BOOL* /*pfStopProcessingUpdates*/ | ||
154 | ) | ||
155 | { | ||
156 | return S_OK; | ||
157 | } | ||
158 | |||
159 | virtual STDMETHODIMP OnDetectUpdateComplete( | ||
160 | __in HRESULT /*hrStatus*/, | ||
161 | __inout BOOL* /*pfIgnoreError*/ | ||
162 | ) | ||
163 | { | ||
164 | return S_OK; | ||
165 | } | ||
166 | |||
167 | virtual STDMETHODIMP OnDetectRelatedBundle( | ||
168 | __in_z LPCWSTR /*wzBundleId*/, | ||
169 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
170 | __in_z LPCWSTR /*wzBundleTag*/, | ||
171 | __in BOOL /*fPerMachine*/, | ||
172 | __in LPCWSTR /*wzVersion*/, | ||
173 | __in BOOTSTRAPPER_RELATED_OPERATION /*operation*/, | ||
174 | __in BOOL /*fMissingFromCache*/, | ||
175 | __inout BOOL* /*pfCancel*/ | ||
176 | ) | ||
177 | { | ||
178 | return S_OK; | ||
179 | } | ||
180 | |||
181 | virtual STDMETHODIMP OnDetectPackageBegin( | ||
182 | __in_z LPCWSTR /*wzPackageId*/, | ||
183 | __inout BOOL* /*pfCancel*/ | ||
184 | ) | ||
185 | { | ||
186 | return S_OK; | ||
187 | } | ||
188 | |||
189 | virtual STDMETHODIMP OnDetectRelatedMsiPackage( | ||
190 | __in_z LPCWSTR /*wzPackageId*/, | ||
191 | __in_z LPCWSTR /*wzUpgradeCode*/, | ||
192 | __in_z LPCWSTR /*wzProductCode*/, | ||
193 | __in BOOL /*fPerMachine*/, | ||
194 | __in LPCWSTR /*wzVersion*/, | ||
195 | __in BOOTSTRAPPER_RELATED_OPERATION /*operation*/, | ||
196 | __inout BOOL* /*pfCancel*/ | ||
197 | ) | ||
198 | { | ||
199 | return S_OK; | ||
200 | } | ||
201 | |||
202 | virtual STDMETHODIMP OnDetectPatchTarget( | ||
203 | __in_z LPCWSTR /*wzPackageId*/, | ||
204 | __in_z LPCWSTR /*wzProductCode*/, | ||
205 | __in BOOTSTRAPPER_PACKAGE_STATE /*patchState*/, | ||
206 | __inout BOOL* /*pfCancel*/ | ||
207 | ) | ||
208 | { | ||
209 | return S_OK; | ||
210 | } | ||
211 | |||
212 | virtual STDMETHODIMP OnDetectMsiFeature( | ||
213 | __in_z LPCWSTR /*wzPackageId*/, | ||
214 | __in_z LPCWSTR /*wzFeatureId*/, | ||
215 | __in BOOTSTRAPPER_FEATURE_STATE /*state*/, | ||
216 | __inout BOOL* /*pfCancel*/ | ||
217 | ) | ||
218 | { | ||
219 | return S_OK; | ||
220 | } | ||
221 | |||
222 | virtual STDMETHODIMP OnDetectPackageComplete( | ||
223 | __in_z LPCWSTR /*wzPackageId*/, | ||
224 | __in HRESULT /*hrStatus*/, | ||
225 | __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, | ||
226 | __in BOOL /*fCached*/ | ||
227 | ) | ||
228 | { | ||
229 | return S_OK; | ||
230 | } | ||
231 | |||
232 | virtual STDMETHODIMP OnDetectComplete( | ||
233 | __in HRESULT /*hrStatus*/, | ||
234 | __in BOOL /*fEligibleForCleanup*/ | ||
235 | ) | ||
236 | { | ||
237 | return S_OK; | ||
238 | } | ||
239 | |||
240 | virtual STDMETHODIMP OnPlanBegin( | ||
241 | __in DWORD /*cPackages*/, | ||
242 | __inout BOOL* /*pfCancel*/ | ||
243 | ) | ||
244 | { | ||
245 | return S_OK; | ||
246 | } | ||
247 | |||
248 | virtual STDMETHODIMP OnPlanRelatedBundle( | ||
249 | __in_z LPCWSTR /*wzBundleId*/, | ||
250 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
251 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/, | ||
252 | __inout BOOL* /*pfCancel*/ | ||
253 | ) | ||
254 | { | ||
255 | return S_OK; | ||
256 | } | ||
257 | |||
258 | virtual STDMETHODIMP OnPlanPackageBegin( | ||
259 | __in_z LPCWSTR /*wzPackageId*/, | ||
260 | __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, | ||
261 | __in BOOL /*fCached*/, | ||
262 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*installCondition*/, | ||
263 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
264 | __in BOOTSTRAPPER_CACHE_TYPE /*recommendedCacheType*/, | ||
265 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestState*/, | ||
266 | __inout BOOTSTRAPPER_CACHE_TYPE* /*pRequestedCacheType*/, | ||
267 | __inout BOOL* /*pfCancel*/ | ||
268 | ) | ||
269 | { | ||
270 | return S_OK; | ||
271 | } | ||
272 | |||
273 | virtual STDMETHODIMP OnPlanPatchTarget( | ||
274 | __in_z LPCWSTR /*wzPackageId*/, | ||
275 | __in_z LPCWSTR /*wzProductCode*/, | ||
276 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
277 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/, | ||
278 | __inout BOOL* /*pfCancel*/ | ||
279 | ) | ||
280 | { | ||
281 | return S_OK; | ||
282 | } | ||
283 | |||
284 | virtual STDMETHODIMP OnPlanMsiFeature( | ||
285 | __in_z LPCWSTR /*wzPackageId*/, | ||
286 | __in_z LPCWSTR /*wzFeatureId*/, | ||
287 | __in BOOTSTRAPPER_FEATURE_STATE /*recommendedState*/, | ||
288 | __inout BOOTSTRAPPER_FEATURE_STATE* /*pRequestedState*/, | ||
289 | __inout BOOL* /*pfCancel*/ | ||
290 | ) | ||
291 | { | ||
292 | return S_OK; | ||
293 | } | ||
294 | |||
295 | virtual STDMETHODIMP OnPlanMsiPackage( | ||
296 | __in_z LPCWSTR /*wzPackageId*/, | ||
297 | __in BOOL /*fExecute*/, | ||
298 | __in BOOTSTRAPPER_ACTION_STATE /*action*/, | ||
299 | __inout BOOL* /*pfCancel*/, | ||
300 | __inout BURN_MSI_PROPERTY* /*pActionMsiProperty*/, | ||
301 | __inout INSTALLUILEVEL* /*pUiLevel*/, | ||
302 | __inout BOOL* /*pfDisableExternalUiHandler*/ | ||
303 | ) | ||
304 | { | ||
305 | return S_OK; | ||
306 | } | ||
307 | |||
308 | virtual STDMETHODIMP OnPlanPackageComplete( | ||
309 | __in_z LPCWSTR /*wzPackageId*/, | ||
310 | __in HRESULT /*hrStatus*/, | ||
311 | __in BOOTSTRAPPER_REQUEST_STATE /*requested*/ | ||
312 | ) | ||
313 | { | ||
314 | return S_OK; | ||
315 | } | ||
316 | |||
317 | virtual STDMETHODIMP OnPlannedPackage( | ||
318 | __in_z LPCWSTR /*wzPackageId*/, | ||
319 | __in BOOTSTRAPPER_ACTION_STATE /*execute*/, | ||
320 | __in BOOTSTRAPPER_ACTION_STATE /*rollback*/, | ||
321 | __in BOOL /*fPlannedCache*/, | ||
322 | __in BOOL /*fPlannedUncache*/ | ||
323 | ) | ||
324 | { | ||
325 | return S_OK; | ||
326 | } | ||
327 | |||
328 | virtual STDMETHODIMP OnPlanComplete( | ||
329 | __in HRESULT /*hrStatus*/ | ||
330 | ) | ||
331 | { | ||
332 | return S_OK; | ||
333 | } | ||
334 | |||
335 | virtual STDMETHODIMP OnApplyBegin( | ||
336 | __in DWORD /*dwPhaseCount*/, | ||
337 | __inout BOOL* /*pfCancel*/ | ||
338 | ) | ||
339 | { | ||
340 | return S_OK; | ||
341 | } | ||
342 | |||
343 | virtual STDMETHODIMP OnElevateBegin( | ||
344 | __inout BOOL* /*pfCancel*/ | ||
345 | ) | ||
346 | { | ||
347 | return S_OK; | ||
348 | } | ||
349 | |||
350 | virtual STDMETHODIMP OnElevateComplete( | ||
351 | __in HRESULT /*hrStatus*/ | ||
352 | ) | ||
353 | { | ||
354 | return S_OK; | ||
355 | } | ||
356 | |||
357 | virtual STDMETHODIMP OnProgress( | ||
358 | __in DWORD /*dwProgressPercentage*/, | ||
359 | __in DWORD /*dwOverallProgressPercentage*/, | ||
360 | __inout BOOL* /*pfCancel*/ | ||
361 | ) | ||
362 | { | ||
363 | return IDNOACTION; | ||
364 | } | ||
365 | |||
366 | virtual STDMETHODIMP OnError( | ||
367 | __in BOOTSTRAPPER_ERROR_TYPE /*errorType*/, | ||
368 | __in_z LPCWSTR /*wzPackageId*/, | ||
369 | __in DWORD /*dwCode*/, | ||
370 | __in_z LPCWSTR /*wzError*/, | ||
371 | __in DWORD /*dwUIHint*/, | ||
372 | __in DWORD /*cData*/, | ||
373 | __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/, | ||
374 | __in int /*nRecommendation*/, | ||
375 | __inout int* /*pResult*/ | ||
376 | ) | ||
377 | { | ||
378 | return S_OK; | ||
379 | } | ||
380 | |||
381 | virtual STDMETHODIMP OnRegisterBegin( | ||
382 | __inout BOOL* /*pfCancel*/ | ||
383 | ) | ||
384 | { | ||
385 | return S_OK; | ||
386 | } | ||
387 | |||
388 | virtual STDMETHODIMP OnRegisterComplete( | ||
389 | __in HRESULT /*hrStatus*/ | ||
390 | ) | ||
391 | { | ||
392 | return S_OK; | ||
393 | } | ||
394 | |||
395 | virtual STDMETHODIMP OnCacheBegin( | ||
396 | __inout BOOL* /*pfCancel*/ | ||
397 | ) | ||
398 | { | ||
399 | return S_OK; | ||
400 | } | ||
401 | |||
402 | virtual STDMETHODIMP OnCachePackageBegin( | ||
403 | __in_z LPCWSTR /*wzPackageId*/, | ||
404 | __in DWORD /*cCachePayloads*/, | ||
405 | __in DWORD64 /*dw64PackageCacheSize*/, | ||
406 | __inout BOOL* /*pfCancel*/ | ||
407 | ) | ||
408 | { | ||
409 | return S_OK; | ||
410 | } | ||
411 | |||
412 | virtual STDMETHODIMP OnCacheAcquireBegin( | ||
413 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
414 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
415 | __in_z LPCWSTR /*wzSource*/, | ||
416 | __in_z_opt LPCWSTR /*wzDownloadUrl*/, | ||
417 | __in_z_opt LPCWSTR /*wzPayloadContainerId*/, | ||
418 | __in BOOTSTRAPPER_CACHE_OPERATION /*recommendation*/, | ||
419 | __inout BOOTSTRAPPER_CACHE_OPERATION* /*pAction*/, | ||
420 | __inout BOOL* /*pfCancel*/ | ||
421 | ) | ||
422 | { | ||
423 | return S_OK; | ||
424 | } | ||
425 | |||
426 | virtual STDMETHODIMP OnCacheAcquireProgress( | ||
427 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
428 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
429 | __in DWORD64 /*dw64Progress*/, | ||
430 | __in DWORD64 /*dw64Total*/, | ||
431 | __in DWORD /*dwOverallPercentage*/, | ||
432 | __inout BOOL* /*pfCancel*/ | ||
433 | ) | ||
434 | { | ||
435 | return S_OK; | ||
436 | } | ||
437 | |||
438 | virtual STDMETHODIMP OnCacheAcquireResolving( | ||
439 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
440 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
441 | __in_z LPCWSTR* /*rgSearchPaths*/, | ||
442 | __in DWORD /*cSearchPaths*/, | ||
443 | __in BOOL /*fFoundLocal*/, | ||
444 | __in DWORD /*dwRecommendedSearchPath*/, | ||
445 | __in_z_opt LPCWSTR /*wzDownloadUrl*/, | ||
446 | __in_z_opt LPCWSTR /*wzPayloadContainerId*/, | ||
447 | __in BOOTSTRAPPER_CACHE_RESOLVE_OPERATION /*recommendation*/, | ||
448 | __inout DWORD* /*pdwChosenSearchPath*/, | ||
449 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* /*pAction*/, | ||
450 | __inout BOOL* /*pfCancel*/ | ||
451 | ) | ||
452 | { | ||
453 | return S_OK; | ||
454 | } | ||
455 | |||
456 | virtual STDMETHODIMP OnCacheAcquireComplete( | ||
457 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
458 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
459 | __in HRESULT /*hrStatus*/, | ||
460 | __in BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION /*recommendation*/, | ||
461 | __inout BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION* /*pAction*/ | ||
462 | ) | ||
463 | { | ||
464 | return S_OK; | ||
465 | } | ||
466 | |||
467 | virtual STDMETHODIMP OnCacheVerifyBegin( | ||
468 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
469 | __in_z LPCWSTR /*wzPayloadId*/, | ||
470 | __inout BOOL* /*pfCancel*/ | ||
471 | ) | ||
472 | { | ||
473 | return S_OK; | ||
474 | } | ||
475 | |||
476 | virtual STDMETHODIMP OnCacheVerifyProgress( | ||
477 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
478 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
479 | __in DWORD64 /*dw64Progress*/, | ||
480 | __in DWORD64 /*dw64Total*/, | ||
481 | __in DWORD /*dwOverallPercentage*/, | ||
482 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP /*verifyStep*/, | ||
483 | __inout BOOL* /*pfCancel*/ | ||
484 | ) | ||
485 | { | ||
486 | return S_OK; | ||
487 | } | ||
488 | |||
489 | virtual STDMETHODIMP OnCacheVerifyComplete( | ||
490 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
491 | __in_z LPCWSTR /*wzPayloadId*/, | ||
492 | __in HRESULT /*hrStatus*/, | ||
493 | __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION /*recommendation*/, | ||
494 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* /*pAction*/ | ||
495 | ) | ||
496 | { | ||
497 | return S_OK; | ||
498 | } | ||
499 | |||
500 | virtual STDMETHODIMP OnCachePackageComplete( | ||
501 | __in_z LPCWSTR /*wzPackageId*/, | ||
502 | __in HRESULT /*hrStatus*/, | ||
503 | __in BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION /*recommendation*/, | ||
504 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* /*pAction*/ | ||
505 | ) | ||
506 | { | ||
507 | return S_OK; | ||
508 | } | ||
509 | |||
510 | virtual STDMETHODIMP OnCacheComplete( | ||
511 | __in HRESULT /*hrStatus*/ | ||
512 | ) | ||
513 | { | ||
514 | return S_OK; | ||
515 | } | ||
516 | |||
517 | virtual STDMETHODIMP OnExecuteBegin( | ||
518 | __in DWORD /*cExecutingPackages*/, | ||
519 | __inout BOOL* /*pfCancel*/ | ||
520 | ) | ||
521 | { | ||
522 | return S_OK; | ||
523 | } | ||
524 | |||
525 | virtual STDMETHODIMP OnExecutePackageBegin( | ||
526 | __in_z LPCWSTR /*wzPackageId*/, | ||
527 | __in BOOL /*fExecute*/, | ||
528 | __in BOOTSTRAPPER_ACTION_STATE /*action*/, | ||
529 | __in INSTALLUILEVEL /*uiLevel*/, | ||
530 | __in BOOL /*fDisableExternalUiHandler*/, | ||
531 | __inout BOOL* /*pfCancel*/ | ||
532 | ) | ||
533 | { | ||
534 | return S_OK; | ||
535 | } | ||
536 | |||
537 | virtual STDMETHODIMP OnExecutePatchTarget( | ||
538 | __in_z LPCWSTR /*wzPackageId*/, | ||
539 | __in_z LPCWSTR /*wzTargetProductCode*/, | ||
540 | __inout BOOL* /*pfCancel*/ | ||
541 | ) | ||
542 | { | ||
543 | return S_OK; | ||
544 | } | ||
545 | |||
546 | virtual STDMETHODIMP OnExecuteProgress( | ||
547 | __in_z LPCWSTR /*wzPackageId*/, | ||
548 | __in DWORD /*dwProgressPercentage*/, | ||
549 | __in DWORD /*dwOverallProgressPercentage*/, | ||
550 | __inout BOOL* /*pfCancel*/ | ||
551 | ) | ||
552 | { | ||
553 | return S_OK; | ||
554 | } | ||
555 | |||
556 | virtual STDMETHODIMP OnExecuteMsiMessage( | ||
557 | __in_z LPCWSTR /*wzPackageId*/, | ||
558 | __in INSTALLMESSAGE /*messageType*/, | ||
559 | __in DWORD /*dwUIHint*/, | ||
560 | __in_z LPCWSTR /*wzMessage*/, | ||
561 | __in DWORD /*cData*/, | ||
562 | __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/, | ||
563 | __in int /*nRecommendation*/, | ||
564 | __inout int* /*pResult*/ | ||
565 | ) | ||
566 | { | ||
567 | return S_OK; | ||
568 | } | ||
569 | |||
570 | virtual STDMETHODIMP OnExecuteFilesInUse( | ||
571 | __in_z LPCWSTR /*wzPackageId*/, | ||
572 | __in DWORD /*cFiles*/, | ||
573 | __in_ecount_z(cFiles) LPCWSTR* /*rgwzFiles*/, | ||
574 | __in int /*nRecommendation*/, | ||
575 | __inout int* /*pResult*/ | ||
576 | ) | ||
577 | { | ||
578 | return S_OK; | ||
579 | } | ||
580 | |||
581 | virtual STDMETHODIMP OnExecutePackageComplete( | ||
582 | __in_z LPCWSTR /*wzPackageId*/, | ||
583 | __in HRESULT /*hrStatus*/, | ||
584 | __in BOOTSTRAPPER_APPLY_RESTART /*restart*/, | ||
585 | __in BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION /*recommendation*/, | ||
586 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* /*pAction*/ | ||
587 | ) | ||
588 | { | ||
589 | return S_OK; | ||
590 | } | ||
591 | |||
592 | virtual STDMETHODIMP OnExecuteComplete( | ||
593 | __in HRESULT /*hrStatus*/ | ||
594 | ) | ||
595 | { | ||
596 | return S_OK; | ||
597 | } | ||
598 | |||
599 | virtual STDMETHODIMP OnUnregisterBegin( | ||
600 | __in BOOL /*fKeepRegistration*/, | ||
601 | __inout BOOL* /*pfForceKeepRegistration*/ | ||
602 | ) | ||
603 | { | ||
604 | return S_OK; | ||
605 | } | ||
606 | |||
607 | virtual STDMETHODIMP OnUnregisterComplete( | ||
608 | __in HRESULT /*hrStatus*/ | ||
609 | ) | ||
610 | { | ||
611 | return S_OK; | ||
612 | } | ||
613 | |||
614 | virtual STDMETHODIMP OnApplyComplete( | ||
615 | __in HRESULT /*hrStatus*/, | ||
616 | __in BOOTSTRAPPER_APPLY_RESTART /*restart*/, | ||
617 | __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION /*recommendation*/, | ||
618 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* /*pAction*/ | ||
619 | ) | ||
620 | { | ||
621 | return S_OK; | ||
622 | } | ||
623 | |||
624 | virtual STDMETHODIMP OnLaunchApprovedExeBegin( | ||
625 | __inout BOOL* /*pfCancel*/ | ||
626 | ) | ||
627 | { | ||
628 | return S_OK; | ||
629 | } | ||
630 | |||
631 | virtual STDMETHODIMP OnLaunchApprovedExeComplete( | ||
632 | __in HRESULT /*hrStatus*/, | ||
633 | __in DWORD /*dwProcessId*/ | ||
634 | ) | ||
635 | { | ||
636 | return S_OK; | ||
637 | } | ||
638 | |||
639 | virtual STDMETHODIMP OnBeginMsiTransactionBegin( | ||
640 | __in_z LPCWSTR /*wzTransactionId*/, | ||
641 | __inout BOOL* /*pfCancel*/ | ||
642 | ) | ||
643 | { | ||
644 | return S_OK; | ||
645 | } | ||
646 | |||
647 | virtual STDMETHODIMP OnBeginMsiTransactionComplete( | ||
648 | __in_z LPCWSTR /*wzTransactionId*/, | ||
649 | __in HRESULT /*hrStatus*/ | ||
650 | ) | ||
651 | { | ||
652 | return S_OK; | ||
653 | } | ||
654 | |||
655 | virtual STDMETHODIMP OnCommitMsiTransactionBegin( | ||
656 | __in_z LPCWSTR /*wzTransactionId*/, | ||
657 | __inout BOOL* /*pfCancel*/ | ||
658 | ) | ||
659 | { | ||
660 | return S_OK; | ||
661 | } | ||
662 | |||
663 | virtual STDMETHODIMP OnCommitMsiTransactionComplete( | ||
664 | __in_z LPCWSTR /*wzTransactionId*/, | ||
665 | __in HRESULT /*hrStatus*/ | ||
666 | ) | ||
667 | { | ||
668 | return S_OK; | ||
669 | } | ||
670 | |||
671 | virtual STDMETHODIMP OnRollbackMsiTransactionBegin( | ||
672 | __in_z LPCWSTR /*wzTransactionId*/ | ||
673 | ) | ||
674 | { | ||
675 | return S_OK; | ||
676 | } | ||
677 | |||
678 | virtual STDMETHODIMP OnRollbackMsiTransactionComplete( | ||
679 | __in_z LPCWSTR /*wzTransactionId*/, | ||
680 | __in HRESULT /*hrStatus*/ | ||
681 | ) | ||
682 | { | ||
683 | return S_OK; | ||
684 | } | ||
685 | |||
686 | virtual STDMETHODIMP OnPauseAutomaticUpdatesBegin( | ||
687 | ) | ||
688 | { | ||
689 | return S_OK; | ||
690 | } | ||
691 | |||
692 | virtual STDMETHODIMP OnPauseAutomaticUpdatesComplete( | ||
693 | __in HRESULT /*hrStatus*/ | ||
694 | ) | ||
695 | { | ||
696 | return S_OK; | ||
697 | } | ||
698 | |||
699 | virtual STDMETHODIMP OnSystemRestorePointBegin( | ||
700 | ) | ||
701 | { | ||
702 | return S_OK; | ||
703 | } | ||
704 | |||
705 | virtual STDMETHODIMP OnSystemRestorePointComplete( | ||
706 | __in HRESULT /*hrStatus*/ | ||
707 | ) | ||
708 | { | ||
709 | return S_OK; | ||
710 | } | ||
711 | |||
712 | virtual STDMETHODIMP OnPlanForwardCompatibleBundle( | ||
713 | __in_z LPCWSTR /*wzBundleId*/, | ||
714 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
715 | __in_z LPCWSTR /*wzBundleTag*/, | ||
716 | __in BOOL /*fPerMachine*/, | ||
717 | __in LPCWSTR /*wzVersion*/, | ||
718 | __in BOOL /*fRecommendedIgnoreBundle*/, | ||
719 | __inout BOOL* /*pfCancel*/, | ||
720 | __inout BOOL* /*pfIgnoreBundle*/ | ||
721 | ) | ||
722 | { | ||
723 | return S_OK; | ||
724 | } | ||
725 | |||
726 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyBegin( | ||
727 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
728 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
729 | __inout BOOL* /*pfCancel*/ | ||
730 | ) | ||
731 | { | ||
732 | return S_OK; | ||
733 | } | ||
734 | |||
735 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyProgress( | ||
736 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
737 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
738 | __in DWORD64 /*dw64Progress*/, | ||
739 | __in DWORD64 /*dw64Total*/, | ||
740 | __in DWORD /*dwOverallPercentage*/, | ||
741 | __inout BOOL* /*pfCancel*/ | ||
742 | ) | ||
743 | { | ||
744 | return S_OK; | ||
745 | } | ||
746 | |||
747 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyComplete( | ||
748 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
749 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
750 | __in HRESULT /*hrStatus*/ | ||
751 | ) | ||
752 | { | ||
753 | return S_OK; | ||
754 | } | ||
755 | |||
756 | virtual STDMETHODIMP OnCachePayloadExtractBegin( | ||
757 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
758 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
759 | __inout BOOL* /*pfCancel*/ | ||
760 | ) | ||
761 | { | ||
762 | return S_OK; | ||
763 | } | ||
764 | |||
765 | virtual STDMETHODIMP OnCachePayloadExtractProgress( | ||
766 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
767 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
768 | __in DWORD64 /*dw64Progress*/, | ||
769 | __in DWORD64 /*dw64Total*/, | ||
770 | __in DWORD /*dwOverallPercentage*/, | ||
771 | __inout BOOL* /*pfCancel*/ | ||
772 | ) | ||
773 | { | ||
774 | return S_OK; | ||
775 | } | ||
776 | |||
777 | virtual STDMETHODIMP OnCachePayloadExtractComplete( | ||
778 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
779 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
780 | __in HRESULT /*hrStatus*/ | ||
781 | ) | ||
782 | { | ||
783 | return S_OK; | ||
784 | } | ||
785 | |||
786 | public: // IBAFunctions | ||
787 | virtual STDMETHODIMP OnPlan( | ||
788 | ) | ||
789 | { | ||
790 | return S_OK; | ||
791 | } | ||
792 | |||
793 | virtual STDMETHODIMP OnThemeLoaded( | ||
794 | THEME* pTheme, | ||
795 | WIX_LOCALIZATION* pWixLoc | ||
796 | ) | ||
797 | { | ||
798 | HRESULT hr = S_OK; | ||
799 | |||
800 | m_pTheme = pTheme; | ||
801 | m_pWixLoc = pWixLoc; | ||
802 | |||
803 | return hr; | ||
804 | } | ||
805 | |||
806 | virtual STDMETHODIMP WndProc( | ||
807 | __in THEME* pTheme, | ||
808 | __in HWND hWnd, | ||
809 | __in UINT uMsg, | ||
810 | __in WPARAM wParam, | ||
811 | __in LPARAM lParam, | ||
812 | __inout LRESULT* plRes | ||
813 | ) | ||
814 | { | ||
815 | HRESULT hr = S_OK; | ||
816 | |||
817 | *plRes = ThemeDefWindowProc(pTheme, hWnd, uMsg, wParam, lParam); | ||
818 | |||
819 | return hr; | ||
820 | } | ||
821 | |||
822 | virtual STDMETHODIMP BAFunctionsProc( | ||
823 | __in BA_FUNCTIONS_MESSAGE /*message*/, | ||
824 | __in const LPVOID /*pvArgs*/, | ||
825 | __inout LPVOID /*pvResults*/, | ||
826 | __in_opt LPVOID /*pvContext*/ | ||
827 | ) | ||
828 | { | ||
829 | return E_NOTIMPL; | ||
830 | } | ||
831 | |||
832 | protected: | ||
833 | CBalBaseBAFunctions( | ||
834 | __in HMODULE hModule, | ||
835 | __in IBootstrapperEngine* pEngine, | ||
836 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
837 | ) | ||
838 | { | ||
839 | m_cReferences = 1; | ||
840 | m_hModule = hModule; | ||
841 | pEngine->AddRef(); | ||
842 | m_pEngine = pEngine; | ||
843 | |||
844 | memcpy_s(&m_command, sizeof(m_command), pArgs->pBootstrapperCreateArgs->pCommand, sizeof(BOOTSTRAPPER_COMMAND)); | ||
845 | memcpy_s(&m_baCreateArgs, sizeof(m_baCreateArgs), pArgs->pBootstrapperCreateArgs, sizeof(BOOTSTRAPPER_CREATE_ARGS)); | ||
846 | memcpy_s(&m_bafCreateArgs, sizeof(m_bafCreateArgs), pArgs, sizeof(BA_FUNCTIONS_CREATE_ARGS)); | ||
847 | m_baCreateArgs.pCommand = &m_command; | ||
848 | m_bafCreateArgs.pBootstrapperCreateArgs = &m_baCreateArgs; | ||
849 | } | ||
850 | |||
851 | virtual ~CBalBaseBAFunctions() | ||
852 | { | ||
853 | ReleaseNullObject(m_pEngine); | ||
854 | } | ||
855 | |||
856 | private: | ||
857 | long m_cReferences; | ||
858 | |||
859 | protected: | ||
860 | IBootstrapperEngine* m_pEngine; | ||
861 | HMODULE m_hModule; | ||
862 | BA_FUNCTIONS_CREATE_ARGS m_bafCreateArgs; | ||
863 | BOOTSTRAPPER_CREATE_ARGS m_baCreateArgs; | ||
864 | BOOTSTRAPPER_COMMAND m_command; | ||
865 | THEME* m_pTheme; | ||
866 | WIX_LOCALIZATION* m_pWixLoc; | ||
867 | }; | ||
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h new file mode 100644 index 00000000..7e89fe83 --- /dev/null +++ b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h | |||
@@ -0,0 +1,124 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include "BalBaseBootstrapperApplicationProc.h" | ||
6 | #include "BAFunctions.h" | ||
7 | #include "IBAFunctions.h" | ||
8 | |||
9 | static HRESULT BalBaseBAFunctionsProcOnThemeLoaded( | ||
10 | __in IBAFunctions* pBAFunctions, | ||
11 | __in BA_FUNCTIONS_ONTHEMELOADED_ARGS* pArgs, | ||
12 | __inout BA_FUNCTIONS_ONTHEMELOADED_RESULTS* /*pResults*/ | ||
13 | ) | ||
14 | { | ||
15 | return pBAFunctions->OnThemeLoaded(pArgs->pTheme, pArgs->pWixLoc); | ||
16 | } | ||
17 | |||
18 | static HRESULT BalBaseBAFunctionsProcWndProc( | ||
19 | __in IBAFunctions* pBAFunctions, | ||
20 | __in BA_FUNCTIONS_WNDPROC_ARGS* pArgs, | ||
21 | __inout BA_FUNCTIONS_WNDPROC_RESULTS* pResults | ||
22 | ) | ||
23 | { | ||
24 | return pBAFunctions->WndProc(pArgs->pTheme, pArgs->hWnd, pArgs->uMsg, pArgs->wParam, pArgs->lParam, &pResults->lres); | ||
25 | } | ||
26 | |||
27 | /******************************************************************* | ||
28 | BalBaseBAFunctionsProc - requires pvContext to be of type IBAFunctions. | ||
29 | Provides a default mapping between the message based BAFunctions interface and | ||
30 | the COM-based BAFunctions interface. | ||
31 | |||
32 | *******************************************************************/ | ||
33 | static HRESULT WINAPI BalBaseBAFunctionsProc( | ||
34 | __in BA_FUNCTIONS_MESSAGE message, | ||
35 | __in const LPVOID pvArgs, | ||
36 | __inout LPVOID pvResults, | ||
37 | __in_opt LPVOID pvContext | ||
38 | ) | ||
39 | { | ||
40 | IBAFunctions* pBAFunctions = reinterpret_cast<IBAFunctions*>(pvContext); | ||
41 | HRESULT hr = pBAFunctions->BAFunctionsProc(message, pvArgs, pvResults, pvContext); | ||
42 | |||
43 | if (E_NOTIMPL == hr) | ||
44 | { | ||
45 | switch (message) | ||
46 | { | ||
47 | case BA_FUNCTIONS_MESSAGE_ONDETECTBEGIN: | ||
48 | case BA_FUNCTIONS_MESSAGE_ONDETECTCOMPLETE: | ||
49 | case BA_FUNCTIONS_MESSAGE_ONPLANBEGIN: | ||
50 | case BA_FUNCTIONS_MESSAGE_ONPLANCOMPLETE: | ||
51 | case BA_FUNCTIONS_MESSAGE_ONSTARTUP: | ||
52 | case BA_FUNCTIONS_MESSAGE_ONSHUTDOWN: | ||
53 | case BA_FUNCTIONS_MESSAGE_ONSYSTEMSHUTDOWN: | ||
54 | case BA_FUNCTIONS_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE: | ||
55 | case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATEBEGIN: | ||
56 | case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATE: | ||
57 | case BA_FUNCTIONS_MESSAGE_ONDETECTUPDATECOMPLETE: | ||
58 | case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDBUNDLE: | ||
59 | case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGEBEGIN: | ||
60 | case BA_FUNCTIONS_MESSAGE_ONDETECTRELATEDMSIPACKAGE: | ||
61 | case BA_FUNCTIONS_MESSAGE_ONDETECTPATCHTARGET: | ||
62 | case BA_FUNCTIONS_MESSAGE_ONDETECTMSIFEATURE: | ||
63 | case BA_FUNCTIONS_MESSAGE_ONDETECTPACKAGECOMPLETE: | ||
64 | case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLE: | ||
65 | case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGEBEGIN: | ||
66 | case BA_FUNCTIONS_MESSAGE_ONPLANPATCHTARGET: | ||
67 | case BA_FUNCTIONS_MESSAGE_ONPLANMSIFEATURE: | ||
68 | case BA_FUNCTIONS_MESSAGE_ONPLANPACKAGECOMPLETE: | ||
69 | case BA_FUNCTIONS_MESSAGE_ONAPPLYBEGIN: | ||
70 | case BA_FUNCTIONS_MESSAGE_ONELEVATEBEGIN: | ||
71 | case BA_FUNCTIONS_MESSAGE_ONELEVATECOMPLETE: | ||
72 | case BA_FUNCTIONS_MESSAGE_ONPROGRESS: | ||
73 | case BA_FUNCTIONS_MESSAGE_ONERROR: | ||
74 | case BA_FUNCTIONS_MESSAGE_ONREGISTERBEGIN: | ||
75 | case BA_FUNCTIONS_MESSAGE_ONREGISTERCOMPLETE: | ||
76 | case BA_FUNCTIONS_MESSAGE_ONCACHEBEGIN: | ||
77 | case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGEBEGIN: | ||
78 | case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREBEGIN: | ||
79 | case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIREPROGRESS: | ||
80 | case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRERESOLVING: | ||
81 | case BA_FUNCTIONS_MESSAGE_ONCACHEACQUIRECOMPLETE: | ||
82 | case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYBEGIN: | ||
83 | case BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYCOMPLETE: | ||
84 | case BA_FUNCTIONS_MESSAGE_ONCACHEPACKAGECOMPLETE: | ||
85 | case BA_FUNCTIONS_MESSAGE_ONCACHECOMPLETE: | ||
86 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEBEGIN: | ||
87 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGEBEGIN: | ||
88 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEPATCHTARGET: | ||
89 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEPROGRESS: | ||
90 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEMSIMESSAGE: | ||
91 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEFILESINUSE: | ||
92 | case BA_FUNCTIONS_MESSAGE_ONEXECUTEPACKAGECOMPLETE: | ||
93 | case BA_FUNCTIONS_MESSAGE_ONEXECUTECOMPLETE: | ||
94 | case BA_FUNCTIONS_MESSAGE_ONUNREGISTERBEGIN: | ||
95 | case BA_FUNCTIONS_MESSAGE_ONUNREGISTERCOMPLETE: | ||
96 | case BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE: | ||
97 | case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN: | ||
98 | case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE: | ||
99 | case BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE: | ||
100 | case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONBEGIN: | ||
101 | case BA_FUNCTIONS_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE: | ||
102 | case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN: | ||
103 | case BA_FUNCTIONS_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE: | ||
104 | case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN: | ||
105 | case BA_FUNCTIONS_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE: | ||
106 | case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN: | ||
107 | case BA_FUNCTIONS_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE: | ||
108 | case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN: | ||
109 | case BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE: | ||
110 | case BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE: | ||
111 | case BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE: | ||
112 | hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); | ||
113 | break; | ||
114 | case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: | ||
115 | hr = BalBaseBAFunctionsProcOnThemeLoaded(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_ONTHEMELOADED_RESULTS*>(pvResults)); | ||
116 | break; | ||
117 | case BA_FUNCTIONS_MESSAGE_WNDPROC: | ||
118 | hr = BalBaseBAFunctionsProcWndProc(pBAFunctions, reinterpret_cast<BA_FUNCTIONS_WNDPROC_ARGS*>(pvArgs), reinterpret_cast<BA_FUNCTIONS_WNDPROC_RESULTS*>(pvResults)); | ||
119 | break; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | return hr; | ||
124 | } | ||
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h new file mode 100644 index 00000000..bf21c4a5 --- /dev/null +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h | |||
@@ -0,0 +1,1076 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include <windows.h> | ||
4 | #include <msiquery.h> | ||
5 | |||
6 | #include "BootstrapperEngine.h" | ||
7 | #include "BootstrapperApplication.h" | ||
8 | #include "IBootstrapperEngine.h" | ||
9 | #include "IBootstrapperApplication.h" | ||
10 | |||
11 | #include "balutil.h" | ||
12 | #include "balretry.h" | ||
13 | |||
14 | class CBalBaseBootstrapperApplication : public IBootstrapperApplication | ||
15 | { | ||
16 | public: // IUnknown | ||
17 | virtual STDMETHODIMP QueryInterface( | ||
18 | __in REFIID riid, | ||
19 | __out LPVOID *ppvObject | ||
20 | ) | ||
21 | { | ||
22 | if (!ppvObject) | ||
23 | { | ||
24 | return E_INVALIDARG; | ||
25 | } | ||
26 | |||
27 | *ppvObject = NULL; | ||
28 | |||
29 | if (::IsEqualIID(__uuidof(IBootstrapperApplication), riid)) | ||
30 | { | ||
31 | *ppvObject = static_cast<IBootstrapperApplication*>(this); | ||
32 | } | ||
33 | else if (::IsEqualIID(IID_IUnknown, riid)) | ||
34 | { | ||
35 | *ppvObject = static_cast<IUnknown*>(this); | ||
36 | } | ||
37 | else // no interface for requested iid | ||
38 | { | ||
39 | return E_NOINTERFACE; | ||
40 | } | ||
41 | |||
42 | AddRef(); | ||
43 | return S_OK; | ||
44 | } | ||
45 | |||
46 | virtual STDMETHODIMP_(ULONG) AddRef() | ||
47 | { | ||
48 | return ::InterlockedIncrement(&this->m_cReferences); | ||
49 | } | ||
50 | |||
51 | virtual STDMETHODIMP_(ULONG) Release() | ||
52 | { | ||
53 | long l = ::InterlockedDecrement(&this->m_cReferences); | ||
54 | if (0 < l) | ||
55 | { | ||
56 | return l; | ||
57 | } | ||
58 | |||
59 | delete this; | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | public: // IBootstrapperApplication | ||
64 | virtual STDMETHODIMP_(HRESULT) BAProc( | ||
65 | __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, | ||
66 | __in const LPVOID /*pvArgs*/, | ||
67 | __inout LPVOID /*pvResults*/, | ||
68 | __in_opt LPVOID /*pvContext*/ | ||
69 | ) | ||
70 | { | ||
71 | return E_NOTIMPL; | ||
72 | } | ||
73 | |||
74 | virtual STDMETHODIMP_(void) BAProcFallback( | ||
75 | __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, | ||
76 | __in const LPVOID /*pvArgs*/, | ||
77 | __inout LPVOID /*pvResults*/, | ||
78 | __inout HRESULT* /*phr*/, | ||
79 | __in_opt LPVOID /*pvContext*/ | ||
80 | ) | ||
81 | { | ||
82 | } | ||
83 | |||
84 | virtual STDMETHODIMP OnStartup() | ||
85 | { | ||
86 | return S_OK; | ||
87 | } | ||
88 | |||
89 | virtual STDMETHODIMP OnShutdown( | ||
90 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* /*pAction*/ | ||
91 | ) | ||
92 | { | ||
93 | return S_OK; | ||
94 | } | ||
95 | |||
96 | virtual STDMETHODIMP OnSystemShutdown( | ||
97 | __in DWORD dwEndSession, | ||
98 | __inout BOOL* pfCancel | ||
99 | ) | ||
100 | { | ||
101 | HRESULT hr = S_OK; | ||
102 | |||
103 | // Allow requests to shut down when critical or not applying. | ||
104 | *pfCancel = !(ENDSESSION_CRITICAL & dwEndSession || !m_fApplying); | ||
105 | |||
106 | return hr; | ||
107 | } | ||
108 | |||
109 | virtual STDMETHODIMP OnDetectBegin( | ||
110 | __in BOOL /*fCached*/, | ||
111 | __in BOOL /*fInstalled*/, | ||
112 | __in DWORD /*cPackages*/, | ||
113 | __inout BOOL* pfCancel | ||
114 | ) | ||
115 | { | ||
116 | *pfCancel |= CheckCanceled(); | ||
117 | return S_OK; | ||
118 | } | ||
119 | |||
120 | virtual STDMETHODIMP OnDetectForwardCompatibleBundle( | ||
121 | __in_z LPCWSTR /*wzBundleId*/, | ||
122 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
123 | __in_z LPCWSTR /*wzBundleTag*/, | ||
124 | __in BOOL /*fPerMachine*/, | ||
125 | __in LPCWSTR /*wzVersion*/, | ||
126 | __in BOOL /*fMissingFromCache*/, | ||
127 | __inout BOOL* pfCancel | ||
128 | ) | ||
129 | { | ||
130 | *pfCancel |= CheckCanceled(); | ||
131 | return S_OK; | ||
132 | } | ||
133 | |||
134 | virtual STDMETHODIMP OnDetectUpdateBegin( | ||
135 | __in_z LPCWSTR /*wzUpdateLocation*/, | ||
136 | __inout BOOL* pfCancel, | ||
137 | __inout BOOL* /*pfSkip*/ | ||
138 | ) | ||
139 | { | ||
140 | *pfCancel |= CheckCanceled(); | ||
141 | return S_OK; | ||
142 | } | ||
143 | |||
144 | virtual STDMETHODIMP OnDetectUpdate( | ||
145 | __in_z LPCWSTR /*wzUpdateLocation*/, | ||
146 | __in DWORD64 /*dw64Size*/, | ||
147 | __in LPCWSTR /*wzVersion*/, | ||
148 | __in_z LPCWSTR /*wzTitle*/, | ||
149 | __in_z LPCWSTR /*wzSummary*/, | ||
150 | __in_z LPCWSTR /*wzContentType*/, | ||
151 | __in_z LPCWSTR /*wzContent*/, | ||
152 | __inout BOOL* pfCancel, | ||
153 | __inout BOOL* /*pfStopProcessingUpdates*/ | ||
154 | ) | ||
155 | { | ||
156 | *pfCancel |= CheckCanceled(); | ||
157 | return S_OK; | ||
158 | } | ||
159 | |||
160 | virtual STDMETHODIMP OnDetectUpdateComplete( | ||
161 | __in HRESULT /*hrStatus*/, | ||
162 | __inout BOOL* /*pfIgnoreError*/ | ||
163 | ) | ||
164 | { | ||
165 | return S_OK; | ||
166 | } | ||
167 | |||
168 | virtual STDMETHODIMP OnDetectRelatedBundle( | ||
169 | __in_z LPCWSTR /*wzBundleId*/, | ||
170 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
171 | __in_z LPCWSTR /*wzBundleTag*/, | ||
172 | __in BOOL /*fPerMachine*/, | ||
173 | __in LPCWSTR /*wzVersion*/, | ||
174 | __in BOOTSTRAPPER_RELATED_OPERATION /*operation*/, | ||
175 | __in BOOL /*fMissingFromCache*/, | ||
176 | __inout BOOL* pfCancel | ||
177 | ) | ||
178 | { | ||
179 | *pfCancel |= CheckCanceled(); | ||
180 | return S_OK; | ||
181 | } | ||
182 | |||
183 | virtual STDMETHODIMP OnDetectPackageBegin( | ||
184 | __in_z LPCWSTR /*wzPackageId*/, | ||
185 | __inout BOOL* pfCancel | ||
186 | ) | ||
187 | { | ||
188 | *pfCancel |= CheckCanceled(); | ||
189 | return S_OK; | ||
190 | } | ||
191 | |||
192 | virtual STDMETHODIMP OnDetectRelatedMsiPackage( | ||
193 | __in_z LPCWSTR /*wzPackageId*/, | ||
194 | __in_z LPCWSTR /*wzUpgradeCode*/, | ||
195 | __in_z LPCWSTR /*wzProductCode*/, | ||
196 | __in BOOL /*fPerMachine*/, | ||
197 | __in LPCWSTR /*wzVersion*/, | ||
198 | __in BOOTSTRAPPER_RELATED_OPERATION /*operation*/, | ||
199 | __inout BOOL* pfCancel | ||
200 | ) | ||
201 | { | ||
202 | *pfCancel |= CheckCanceled(); | ||
203 | return S_OK; | ||
204 | } | ||
205 | |||
206 | virtual STDMETHODIMP OnDetectPatchTarget( | ||
207 | __in_z LPCWSTR /*wzPackageId*/, | ||
208 | __in_z LPCWSTR /*wzProductCode*/, | ||
209 | __in BOOTSTRAPPER_PACKAGE_STATE /*patchState*/, | ||
210 | __inout BOOL* pfCancel | ||
211 | ) | ||
212 | { | ||
213 | *pfCancel |= CheckCanceled(); | ||
214 | return S_OK; | ||
215 | } | ||
216 | |||
217 | virtual STDMETHODIMP OnDetectMsiFeature( | ||
218 | __in_z LPCWSTR /*wzPackageId*/, | ||
219 | __in_z LPCWSTR /*wzFeatureId*/, | ||
220 | __in BOOTSTRAPPER_FEATURE_STATE /*state*/, | ||
221 | __inout BOOL* pfCancel | ||
222 | ) | ||
223 | { | ||
224 | *pfCancel |= CheckCanceled(); | ||
225 | return S_OK; | ||
226 | } | ||
227 | |||
228 | virtual STDMETHODIMP OnDetectPackageComplete( | ||
229 | __in_z LPCWSTR /*wzPackageId*/, | ||
230 | __in HRESULT /*hrStatus*/, | ||
231 | __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, | ||
232 | __in BOOL /*fCached*/ | ||
233 | ) | ||
234 | { | ||
235 | return S_OK; | ||
236 | } | ||
237 | |||
238 | virtual STDMETHODIMP OnDetectComplete( | ||
239 | __in HRESULT /*hrStatus*/, | ||
240 | __in BOOL /*fEligibleForCleanup*/ | ||
241 | ) | ||
242 | { | ||
243 | return S_OK; | ||
244 | } | ||
245 | |||
246 | virtual STDMETHODIMP OnPlanBegin( | ||
247 | __in DWORD /*cPackages*/, | ||
248 | __inout BOOL* pfCancel | ||
249 | ) | ||
250 | { | ||
251 | *pfCancel |= CheckCanceled(); | ||
252 | return S_OK; | ||
253 | } | ||
254 | |||
255 | virtual STDMETHODIMP OnPlanRelatedBundle( | ||
256 | __in_z LPCWSTR /*wzBundleId*/, | ||
257 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
258 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/, | ||
259 | __inout BOOL* pfCancel | ||
260 | ) | ||
261 | { | ||
262 | *pfCancel |= CheckCanceled(); | ||
263 | return S_OK; | ||
264 | } | ||
265 | |||
266 | virtual STDMETHODIMP OnPlanPackageBegin( | ||
267 | __in_z LPCWSTR /*wzPackageId*/, | ||
268 | __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, | ||
269 | __in BOOL /*fCached*/, | ||
270 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*installCondition*/, | ||
271 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
272 | __in BOOTSTRAPPER_CACHE_TYPE /*recommendedCacheType*/, | ||
273 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestState*/, | ||
274 | __inout BOOTSTRAPPER_CACHE_TYPE* /*pRequestedCacheType*/, | ||
275 | __inout BOOL* pfCancel | ||
276 | ) | ||
277 | { | ||
278 | *pfCancel |= CheckCanceled(); | ||
279 | return S_OK; | ||
280 | } | ||
281 | |||
282 | virtual STDMETHODIMP OnPlanPatchTarget( | ||
283 | __in_z LPCWSTR /*wzPackageId*/, | ||
284 | __in_z LPCWSTR /*wzProductCode*/, | ||
285 | __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, | ||
286 | __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/, | ||
287 | __inout BOOL* pfCancel | ||
288 | ) | ||
289 | { | ||
290 | *pfCancel |= CheckCanceled(); | ||
291 | return S_OK; | ||
292 | } | ||
293 | |||
294 | virtual STDMETHODIMP OnPlanMsiFeature( | ||
295 | __in_z LPCWSTR /*wzPackageId*/, | ||
296 | __in_z LPCWSTR /*wzFeatureId*/, | ||
297 | __in BOOTSTRAPPER_FEATURE_STATE /*recommendedState*/, | ||
298 | __inout BOOTSTRAPPER_FEATURE_STATE* /*pRequestedState*/, | ||
299 | __inout BOOL* pfCancel | ||
300 | ) | ||
301 | { | ||
302 | *pfCancel |= CheckCanceled(); | ||
303 | return S_OK; | ||
304 | } | ||
305 | |||
306 | virtual STDMETHODIMP OnPlanMsiPackage( | ||
307 | __in_z LPCWSTR /*wzPackageId*/, | ||
308 | __in BOOL /*fExecute*/, | ||
309 | __in BOOTSTRAPPER_ACTION_STATE /*action*/, | ||
310 | __inout BOOL* pfCancel, | ||
311 | __inout BURN_MSI_PROPERTY* /*pActionMsiProperty*/, | ||
312 | __inout INSTALLUILEVEL* /*pUiLevel*/, | ||
313 | __inout BOOL* /*pfDisableExternalUiHandler*/ | ||
314 | ) | ||
315 | { | ||
316 | *pfCancel |= CheckCanceled(); | ||
317 | return S_OK; | ||
318 | } | ||
319 | |||
320 | virtual STDMETHODIMP OnPlanPackageComplete( | ||
321 | __in_z LPCWSTR /*wzPackageId*/, | ||
322 | __in HRESULT /*hrStatus*/, | ||
323 | __in BOOTSTRAPPER_REQUEST_STATE /*requested*/ | ||
324 | ) | ||
325 | { | ||
326 | return S_OK; | ||
327 | } | ||
328 | |||
329 | virtual STDMETHODIMP OnPlannedPackage( | ||
330 | __in_z LPCWSTR /*wzPackageId*/, | ||
331 | __in BOOTSTRAPPER_ACTION_STATE /*execute*/, | ||
332 | __in BOOTSTRAPPER_ACTION_STATE /*rollback*/, | ||
333 | __in BOOL /*fPlannedCache*/, | ||
334 | __in BOOL /*fPlannedUncache*/ | ||
335 | ) | ||
336 | { | ||
337 | return S_OK; | ||
338 | } | ||
339 | |||
340 | virtual STDMETHODIMP OnPlanComplete( | ||
341 | __in HRESULT /*hrStatus*/ | ||
342 | ) | ||
343 | { | ||
344 | return S_OK; | ||
345 | } | ||
346 | |||
347 | virtual STDMETHODIMP OnApplyBegin( | ||
348 | __in DWORD /*dwPhaseCount*/, | ||
349 | __inout BOOL* pfCancel | ||
350 | ) | ||
351 | { | ||
352 | m_fApplying = TRUE; | ||
353 | |||
354 | m_dwProgressPercentage = 0; | ||
355 | m_dwOverallProgressPercentage = 0; | ||
356 | |||
357 | *pfCancel |= CheckCanceled(); | ||
358 | return S_OK; | ||
359 | } | ||
360 | |||
361 | virtual STDMETHODIMP OnElevateBegin( | ||
362 | __inout BOOL* pfCancel | ||
363 | ) | ||
364 | { | ||
365 | *pfCancel |= CheckCanceled(); | ||
366 | return S_OK; | ||
367 | } | ||
368 | |||
369 | virtual STDMETHODIMP OnElevateComplete( | ||
370 | __in HRESULT /*hrStatus*/ | ||
371 | ) | ||
372 | { | ||
373 | return S_OK; | ||
374 | } | ||
375 | |||
376 | virtual STDMETHODIMP OnProgress( | ||
377 | __in DWORD dwProgressPercentage, | ||
378 | __in DWORD dwOverallProgressPercentage, | ||
379 | __inout BOOL* pfCancel | ||
380 | ) | ||
381 | { | ||
382 | HRESULT hr = S_OK; | ||
383 | int nResult = IDNOACTION; | ||
384 | |||
385 | m_dwProgressPercentage = dwProgressPercentage; | ||
386 | m_dwOverallProgressPercentage = dwOverallProgressPercentage; | ||
387 | |||
388 | if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) | ||
389 | { | ||
390 | hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); | ||
391 | BalExitOnFailure(hr, "Failed to send embedded overall progress."); | ||
392 | |||
393 | if (IDERROR == nResult) | ||
394 | { | ||
395 | hr = E_FAIL; | ||
396 | } | ||
397 | else if (IDCANCEL == nResult) | ||
398 | { | ||
399 | *pfCancel = TRUE; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | LExit: | ||
404 | *pfCancel |= CheckCanceled(); | ||
405 | return hr; | ||
406 | } | ||
407 | |||
408 | virtual STDMETHODIMP OnError( | ||
409 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
410 | __in_z LPCWSTR wzPackageId, | ||
411 | __in DWORD dwCode, | ||
412 | __in_z LPCWSTR /*wzError*/, | ||
413 | __in DWORD /*dwUIHint*/, | ||
414 | __in DWORD /*cData*/, | ||
415 | __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/, | ||
416 | __in int /*nRecommendation*/, | ||
417 | __inout int* pResult | ||
418 | ) | ||
419 | { | ||
420 | BalRetryErrorOccurred(wzPackageId, dwCode); | ||
421 | |||
422 | if (CheckCanceled()) | ||
423 | { | ||
424 | *pResult = IDCANCEL; | ||
425 | } | ||
426 | else if (BOOTSTRAPPER_DISPLAY_FULL == m_display) | ||
427 | { | ||
428 | if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType) | ||
429 | { | ||
430 | *pResult = IDTRYAGAIN; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | return S_OK; | ||
435 | } | ||
436 | |||
437 | virtual STDMETHODIMP OnRegisterBegin( | ||
438 | __inout BOOL* pfCancel | ||
439 | ) | ||
440 | { | ||
441 | *pfCancel |= CheckCanceled(); | ||
442 | return S_OK; | ||
443 | } | ||
444 | |||
445 | virtual STDMETHODIMP OnRegisterComplete( | ||
446 | __in HRESULT /*hrStatus*/ | ||
447 | ) | ||
448 | { | ||
449 | return S_OK; | ||
450 | } | ||
451 | |||
452 | virtual STDMETHODIMP OnCacheBegin( | ||
453 | __inout BOOL* pfCancel | ||
454 | ) | ||
455 | { | ||
456 | *pfCancel |= CheckCanceled(); | ||
457 | return S_OK; | ||
458 | } | ||
459 | |||
460 | virtual STDMETHODIMP OnCachePackageBegin( | ||
461 | __in_z LPCWSTR /*wzPackageId*/, | ||
462 | __in DWORD /*cCachePayloads*/, | ||
463 | __in DWORD64 /*dw64PackageCacheSize*/, | ||
464 | __inout BOOL* pfCancel | ||
465 | ) | ||
466 | { | ||
467 | *pfCancel |= CheckCanceled(); | ||
468 | return S_OK; | ||
469 | } | ||
470 | |||
471 | virtual STDMETHODIMP OnCacheAcquireBegin( | ||
472 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
473 | __in_z_opt LPCWSTR wzPayloadId, | ||
474 | __in_z LPCWSTR /*wzSource*/, | ||
475 | __in_z_opt LPCWSTR /*wzDownloadUrl*/, | ||
476 | __in_z_opt LPCWSTR /*wzPayloadContainerId*/, | ||
477 | __in BOOTSTRAPPER_CACHE_OPERATION /*recommendation*/, | ||
478 | __inout BOOTSTRAPPER_CACHE_OPERATION* /*pAction*/, | ||
479 | __inout BOOL* pfCancel | ||
480 | ) | ||
481 | { | ||
482 | BalRetryStartContainerOrPayload(wzPackageOrContainerId, wzPayloadId); | ||
483 | *pfCancel |= CheckCanceled(); | ||
484 | return S_OK; | ||
485 | } | ||
486 | |||
487 | virtual STDMETHODIMP OnCacheAcquireProgress( | ||
488 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
489 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
490 | __in DWORD64 /*dw64Progress*/, | ||
491 | __in DWORD64 /*dw64Total*/, | ||
492 | __in DWORD /*dwOverallPercentage*/, | ||
493 | __inout BOOL* pfCancel | ||
494 | ) | ||
495 | { | ||
496 | HRESULT hr = S_OK; | ||
497 | int nResult = IDNOACTION; | ||
498 | |||
499 | // Send progress even though we don't update the numbers to at least give the caller an opportunity | ||
500 | // to cancel. | ||
501 | if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) | ||
502 | { | ||
503 | hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); | ||
504 | BalExitOnFailure(hr, "Failed to send embedded cache progress."); | ||
505 | |||
506 | if (IDERROR == nResult) | ||
507 | { | ||
508 | hr = E_FAIL; | ||
509 | } | ||
510 | else if (IDCANCEL == nResult) | ||
511 | { | ||
512 | *pfCancel = TRUE; | ||
513 | } | ||
514 | } | ||
515 | |||
516 | LExit: | ||
517 | *pfCancel |= CheckCanceled(); | ||
518 | return hr; | ||
519 | } | ||
520 | |||
521 | virtual STDMETHODIMP OnCacheAcquireResolving( | ||
522 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
523 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
524 | __in_z LPCWSTR* /*rgSearchPaths*/, | ||
525 | __in DWORD /*cSearchPaths*/, | ||
526 | __in BOOL /*fFoundLocal*/, | ||
527 | __in DWORD /*dwRecommendedSearchPath*/, | ||
528 | __in_z_opt LPCWSTR /*wzDownloadUrl*/, | ||
529 | __in_z_opt LPCWSTR /*wzPayloadContainerId*/, | ||
530 | __in BOOTSTRAPPER_CACHE_RESOLVE_OPERATION /*recommendation*/, | ||
531 | __inout DWORD* /*pdwChosenSearchPath*/, | ||
532 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* /*pAction*/, | ||
533 | __inout BOOL* pfCancel | ||
534 | ) | ||
535 | { | ||
536 | *pfCancel |= CheckCanceled(); | ||
537 | return S_OK; | ||
538 | } | ||
539 | |||
540 | virtual STDMETHODIMP OnCacheAcquireComplete( | ||
541 | __in_z LPCWSTR wzPackageOrContainerId, | ||
542 | __in_z_opt LPCWSTR wzPayloadId, | ||
543 | __in HRESULT hrStatus, | ||
544 | __in BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION /*recommendation*/, | ||
545 | __inout BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION* pAction | ||
546 | ) | ||
547 | { | ||
548 | HRESULT hr = S_OK; | ||
549 | BOOL fRetry = FALSE; | ||
550 | |||
551 | if (CheckCanceled()) | ||
552 | { | ||
553 | ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT)); | ||
554 | } | ||
555 | |||
556 | hr = BalRetryEndContainerOrPayload(wzPackageOrContainerId, wzPayloadId, hrStatus, &fRetry); | ||
557 | ExitOnFailure(hr, "BalRetryEndPackage for cache failed"); | ||
558 | |||
559 | if (fRetry) | ||
560 | { | ||
561 | *pAction = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY; | ||
562 | } | ||
563 | |||
564 | LExit: | ||
565 | return hr; | ||
566 | } | ||
567 | |||
568 | virtual STDMETHODIMP OnCacheVerifyBegin( | ||
569 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
570 | __in_z LPCWSTR /*wzPayloadId*/, | ||
571 | __inout BOOL* pfCancel | ||
572 | ) | ||
573 | { | ||
574 | *pfCancel |= CheckCanceled(); | ||
575 | return S_OK; | ||
576 | } | ||
577 | |||
578 | virtual STDMETHODIMP OnCacheVerifyProgress( | ||
579 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
580 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
581 | __in DWORD64 /*dw64Progress*/, | ||
582 | __in DWORD64 /*dw64Total*/, | ||
583 | __in DWORD /*dwOverallPercentage*/, | ||
584 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP /*verifyStep*/, | ||
585 | __inout BOOL* pfCancel | ||
586 | ) | ||
587 | { | ||
588 | *pfCancel |= CheckCanceled(); | ||
589 | return S_OK; | ||
590 | } | ||
591 | |||
592 | virtual STDMETHODIMP OnCacheVerifyComplete( | ||
593 | __in_z LPCWSTR /*wzPackageOrContainerId*/, | ||
594 | __in_z LPCWSTR /*wzPayloadId*/, | ||
595 | __in HRESULT /*hrStatus*/, | ||
596 | __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION /*recommendation*/, | ||
597 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | ||
598 | ) | ||
599 | { | ||
600 | if (CheckCanceled()) | ||
601 | { | ||
602 | *pAction = BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE; | ||
603 | } | ||
604 | |||
605 | return S_OK; | ||
606 | } | ||
607 | |||
608 | virtual STDMETHODIMP OnCachePackageComplete( | ||
609 | __in_z LPCWSTR /*wzPackageId*/, | ||
610 | __in HRESULT /*hrStatus*/, | ||
611 | __in BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION /*recommendation*/, | ||
612 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | ||
613 | ) | ||
614 | { | ||
615 | if (CheckCanceled()) | ||
616 | { | ||
617 | *pAction = BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE; | ||
618 | } | ||
619 | |||
620 | return S_OK; | ||
621 | } | ||
622 | |||
623 | virtual STDMETHODIMP OnCacheComplete( | ||
624 | __in HRESULT /*hrStatus*/ | ||
625 | ) | ||
626 | { | ||
627 | return S_OK; | ||
628 | } | ||
629 | |||
630 | virtual STDMETHODIMP OnExecuteBegin( | ||
631 | __in DWORD /*cExecutingPackages*/, | ||
632 | __inout BOOL* pfCancel | ||
633 | ) | ||
634 | { | ||
635 | *pfCancel |= CheckCanceled(); | ||
636 | return S_OK; | ||
637 | } | ||
638 | |||
639 | virtual STDMETHODIMP OnExecutePackageBegin( | ||
640 | __in_z LPCWSTR wzPackageId, | ||
641 | __in BOOL fExecute, | ||
642 | __in BOOTSTRAPPER_ACTION_STATE /*action*/, | ||
643 | __in INSTALLUILEVEL /*uiLevel*/, | ||
644 | __in BOOL /*fDisableExternalUiHandler*/, | ||
645 | __inout BOOL* pfCancel | ||
646 | ) | ||
647 | { | ||
648 | // Only track retry on execution (not rollback). | ||
649 | if (fExecute) | ||
650 | { | ||
651 | BalRetryStartPackage(wzPackageId); | ||
652 | } | ||
653 | |||
654 | m_fRollingBack = !fExecute; | ||
655 | *pfCancel |= CheckCanceled(); | ||
656 | return S_OK; | ||
657 | } | ||
658 | |||
659 | virtual STDMETHODIMP OnExecutePatchTarget( | ||
660 | __in_z LPCWSTR /*wzPackageId*/, | ||
661 | __in_z LPCWSTR /*wzTargetProductCode*/, | ||
662 | __inout BOOL* pfCancel | ||
663 | ) | ||
664 | { | ||
665 | *pfCancel |= CheckCanceled(); | ||
666 | return S_OK; | ||
667 | } | ||
668 | |||
669 | virtual STDMETHODIMP OnExecuteProgress( | ||
670 | __in_z LPCWSTR /*wzPackageId*/, | ||
671 | __in DWORD /*dwProgressPercentage*/, | ||
672 | __in DWORD /*dwOverallProgressPercentage*/, | ||
673 | __inout BOOL* pfCancel | ||
674 | ) | ||
675 | { | ||
676 | HRESULT hr = S_OK; | ||
677 | int nResult = IDNOACTION; | ||
678 | |||
679 | // Send progress even though we don't update the numbers to at least give the caller an opportunity | ||
680 | // to cancel. | ||
681 | if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) | ||
682 | { | ||
683 | hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); | ||
684 | BalExitOnFailure(hr, "Failed to send embedded execute progress."); | ||
685 | |||
686 | if (IDERROR == nResult) | ||
687 | { | ||
688 | hr = E_FAIL; | ||
689 | } | ||
690 | else if (IDCANCEL == nResult) | ||
691 | { | ||
692 | *pfCancel = TRUE; | ||
693 | } | ||
694 | } | ||
695 | |||
696 | LExit: | ||
697 | *pfCancel |= CheckCanceled(); | ||
698 | return hr; | ||
699 | } | ||
700 | |||
701 | virtual STDMETHODIMP OnExecuteMsiMessage( | ||
702 | __in_z LPCWSTR /*wzPackageId*/, | ||
703 | __in INSTALLMESSAGE /*messageType*/, | ||
704 | __in DWORD /*dwUIHint*/, | ||
705 | __in_z LPCWSTR /*wzMessage*/, | ||
706 | __in DWORD /*cData*/, | ||
707 | __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/, | ||
708 | __in int /*nRecommendation*/, | ||
709 | __inout int* pResult | ||
710 | ) | ||
711 | { | ||
712 | if (CheckCanceled()) | ||
713 | { | ||
714 | *pResult = IDCANCEL; | ||
715 | } | ||
716 | |||
717 | return S_OK; | ||
718 | } | ||
719 | |||
720 | virtual STDMETHODIMP OnExecuteFilesInUse( | ||
721 | __in_z LPCWSTR /*wzPackageId*/, | ||
722 | __in DWORD /*cFiles*/, | ||
723 | __in_ecount_z(cFiles) LPCWSTR* /*rgwzFiles*/, | ||
724 | __in int /*nRecommendation*/, | ||
725 | __inout int* pResult | ||
726 | ) | ||
727 | { | ||
728 | if (CheckCanceled()) | ||
729 | { | ||
730 | *pResult = IDCANCEL; | ||
731 | } | ||
732 | |||
733 | return S_OK; | ||
734 | } | ||
735 | |||
736 | virtual STDMETHODIMP OnExecutePackageComplete( | ||
737 | __in_z LPCWSTR wzPackageId, | ||
738 | __in HRESULT hrStatus, | ||
739 | __in BOOTSTRAPPER_APPLY_RESTART /*restart*/, | ||
740 | __in BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION /*recommendation*/, | ||
741 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | ||
742 | ) | ||
743 | { | ||
744 | HRESULT hr = S_OK; | ||
745 | BOOL fRetry = FALSE; | ||
746 | |||
747 | if (CheckCanceled()) | ||
748 | { | ||
749 | ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT)); | ||
750 | } | ||
751 | |||
752 | hr = BalRetryEndPackage(wzPackageId, hrStatus, &fRetry); | ||
753 | ExitOnFailure(hr, "BalRetryEndPackage for execute failed"); | ||
754 | |||
755 | if (fRetry) | ||
756 | { | ||
757 | *pAction = BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RETRY; | ||
758 | } | ||
759 | |||
760 | LExit: | ||
761 | return hr; | ||
762 | } | ||
763 | |||
764 | virtual STDMETHODIMP OnExecuteComplete( | ||
765 | __in HRESULT /*hrStatus*/ | ||
766 | ) | ||
767 | { | ||
768 | return S_OK; | ||
769 | } | ||
770 | |||
771 | virtual STDMETHODIMP OnUnregisterBegin( | ||
772 | __in BOOL /*fKeepRegistration*/, | ||
773 | __inout BOOL* /*pfForceKeepRegistration*/ | ||
774 | ) | ||
775 | { | ||
776 | return S_OK; | ||
777 | } | ||
778 | |||
779 | virtual STDMETHODIMP OnUnregisterComplete( | ||
780 | __in HRESULT /*hrStatus*/ | ||
781 | ) | ||
782 | { | ||
783 | return S_OK; | ||
784 | } | ||
785 | |||
786 | virtual STDMETHODIMP OnApplyComplete( | ||
787 | __in HRESULT /*hrStatus*/, | ||
788 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
789 | __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION /*recommendation*/, | ||
790 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | ||
791 | ) | ||
792 | { | ||
793 | HRESULT hr = S_OK; | ||
794 | BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart; | ||
795 | BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_display && BOOTSTRAPPER_RESTART_PROMPT >= m_restart; | ||
796 | |||
797 | if (fRestartRequired && !fShouldBlockRestart) | ||
798 | { | ||
799 | *pAction = BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART; | ||
800 | } | ||
801 | |||
802 | m_fApplying = FALSE; | ||
803 | |||
804 | return hr; | ||
805 | } | ||
806 | |||
807 | virtual STDMETHODIMP OnLaunchApprovedExeBegin( | ||
808 | __inout BOOL* pfCancel | ||
809 | ) | ||
810 | { | ||
811 | *pfCancel |= CheckCanceled(); | ||
812 | return S_OK; | ||
813 | } | ||
814 | |||
815 | virtual STDMETHODIMP OnLaunchApprovedExeComplete( | ||
816 | __in HRESULT /*hrStatus*/, | ||
817 | __in DWORD /*dwProcessId*/ | ||
818 | ) | ||
819 | { | ||
820 | return S_OK; | ||
821 | } | ||
822 | |||
823 | virtual STDMETHODIMP OnBeginMsiTransactionBegin( | ||
824 | __in_z LPCWSTR /*wzTransactionId*/, | ||
825 | __inout BOOL* pfCancel | ||
826 | ) | ||
827 | { | ||
828 | *pfCancel |= CheckCanceled(); | ||
829 | return S_OK; | ||
830 | } | ||
831 | |||
832 | virtual STDMETHODIMP OnBeginMsiTransactionComplete( | ||
833 | __in_z LPCWSTR /*wzTransactionId*/, | ||
834 | __in HRESULT /*hrStatus*/ | ||
835 | ) | ||
836 | { | ||
837 | return S_OK; | ||
838 | } | ||
839 | |||
840 | virtual STDMETHODIMP OnCommitMsiTransactionBegin( | ||
841 | __in_z LPCWSTR /*wzTransactionId*/, | ||
842 | __inout BOOL* pfCancel | ||
843 | ) | ||
844 | { | ||
845 | *pfCancel |= CheckCanceled(); | ||
846 | return S_OK; | ||
847 | } | ||
848 | |||
849 | virtual STDMETHODIMP OnCommitMsiTransactionComplete( | ||
850 | __in_z LPCWSTR /*wzTransactionId*/, | ||
851 | __in HRESULT /*hrStatus*/ | ||
852 | ) | ||
853 | { | ||
854 | return S_OK; | ||
855 | } | ||
856 | |||
857 | virtual STDMETHODIMP OnRollbackMsiTransactionBegin( | ||
858 | __in_z LPCWSTR /*wzTransactionId*/ | ||
859 | ) | ||
860 | { | ||
861 | return S_OK; | ||
862 | } | ||
863 | |||
864 | virtual STDMETHODIMP OnRollbackMsiTransactionComplete( | ||
865 | __in_z LPCWSTR /*wzTransactionId*/, | ||
866 | __in HRESULT /*hrStatus*/ | ||
867 | ) | ||
868 | { | ||
869 | return S_OK; | ||
870 | } | ||
871 | |||
872 | virtual STDMETHODIMP OnPauseAutomaticUpdatesBegin( | ||
873 | ) | ||
874 | { | ||
875 | return S_OK; | ||
876 | } | ||
877 | |||
878 | virtual STDMETHODIMP OnPauseAutomaticUpdatesComplete( | ||
879 | __in HRESULT /*hrStatus*/ | ||
880 | ) | ||
881 | { | ||
882 | return S_OK; | ||
883 | } | ||
884 | |||
885 | virtual STDMETHODIMP OnSystemRestorePointBegin( | ||
886 | ) | ||
887 | { | ||
888 | return S_OK; | ||
889 | } | ||
890 | |||
891 | virtual STDMETHODIMP OnSystemRestorePointComplete( | ||
892 | __in HRESULT /*hrStatus*/ | ||
893 | ) | ||
894 | { | ||
895 | return S_OK; | ||
896 | } | ||
897 | |||
898 | virtual STDMETHODIMP OnPlanForwardCompatibleBundle( | ||
899 | __in_z LPCWSTR /*wzBundleId*/, | ||
900 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
901 | __in_z LPCWSTR /*wzBundleTag*/, | ||
902 | __in BOOL /*fPerMachine*/, | ||
903 | __in LPCWSTR /*wzVersion*/, | ||
904 | __in BOOL /*fRecommendedIgnoreBundle*/, | ||
905 | __inout BOOL* pfCancel, | ||
906 | __inout BOOL* /*pfIgnoreBundle*/ | ||
907 | ) | ||
908 | { | ||
909 | *pfCancel |= CheckCanceled(); | ||
910 | return S_OK; | ||
911 | } | ||
912 | |||
913 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyBegin( | ||
914 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
915 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
916 | __inout BOOL* pfCancel | ||
917 | ) | ||
918 | { | ||
919 | *pfCancel |= CheckCanceled(); | ||
920 | return S_OK; | ||
921 | } | ||
922 | |||
923 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyProgress( | ||
924 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
925 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
926 | __in DWORD64 /*dw64Progress*/, | ||
927 | __in DWORD64 /*dw64Total*/, | ||
928 | __in DWORD /*dwOverallPercentage*/, | ||
929 | __inout BOOL* pfCancel | ||
930 | ) | ||
931 | { | ||
932 | *pfCancel |= CheckCanceled(); | ||
933 | return S_OK; | ||
934 | } | ||
935 | |||
936 | virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyComplete( | ||
937 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
938 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
939 | __in HRESULT /*hrStatus*/ | ||
940 | ) | ||
941 | { | ||
942 | return S_OK; | ||
943 | } | ||
944 | |||
945 | virtual STDMETHODIMP OnCachePayloadExtractBegin( | ||
946 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
947 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
948 | __inout BOOL* pfCancel | ||
949 | ) | ||
950 | { | ||
951 | *pfCancel |= CheckCanceled(); | ||
952 | return S_OK; | ||
953 | } | ||
954 | |||
955 | virtual STDMETHODIMP OnCachePayloadExtractProgress( | ||
956 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
957 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
958 | __in DWORD64 /*dw64Progress*/, | ||
959 | __in DWORD64 /*dw64Total*/, | ||
960 | __in DWORD /*dwOverallPercentage*/, | ||
961 | __inout BOOL* pfCancel | ||
962 | ) | ||
963 | { | ||
964 | *pfCancel |= CheckCanceled(); | ||
965 | return S_OK; | ||
966 | } | ||
967 | |||
968 | virtual STDMETHODIMP OnCachePayloadExtractComplete( | ||
969 | __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, | ||
970 | __in_z_opt LPCWSTR /*wzPayloadId*/, | ||
971 | __in HRESULT /*hrStatus*/ | ||
972 | ) | ||
973 | { | ||
974 | return S_OK; | ||
975 | } | ||
976 | |||
977 | protected: | ||
978 | // | ||
979 | // PromptCancel - prompts the user to close (if not forced). | ||
980 | // | ||
981 | virtual BOOL PromptCancel( | ||
982 | __in HWND hWnd, | ||
983 | __in BOOL fForceCancel, | ||
984 | __in_z_opt LPCWSTR wzMessage, | ||
985 | __in_z_opt LPCWSTR wzCaption | ||
986 | ) | ||
987 | { | ||
988 | ::EnterCriticalSection(&m_csCanceled); | ||
989 | |||
990 | // Only prompt the user to close if we have not canceled already. | ||
991 | if (!m_fCanceled) | ||
992 | { | ||
993 | if (fForceCancel) | ||
994 | { | ||
995 | m_fCanceled = TRUE; | ||
996 | } | ||
997 | else | ||
998 | { | ||
999 | m_fCanceled = (IDYES == ::MessageBoxW(hWnd, wzMessage, wzCaption, MB_YESNO | MB_ICONEXCLAMATION)); | ||
1000 | } | ||
1001 | } | ||
1002 | |||
1003 | ::LeaveCriticalSection(&m_csCanceled); | ||
1004 | |||
1005 | return m_fCanceled; | ||
1006 | } | ||
1007 | |||
1008 | // | ||
1009 | // CheckCanceled - waits if the cancel dialog is up and checks to see if the user canceled the operation. | ||
1010 | // | ||
1011 | BOOL CheckCanceled() | ||
1012 | { | ||
1013 | ::EnterCriticalSection(&m_csCanceled); | ||
1014 | ::LeaveCriticalSection(&m_csCanceled); | ||
1015 | return m_fRollingBack ? FALSE : m_fCanceled; | ||
1016 | } | ||
1017 | |||
1018 | BOOL IsRollingBack() | ||
1019 | { | ||
1020 | return m_fRollingBack; | ||
1021 | } | ||
1022 | |||
1023 | BOOL IsCanceled() | ||
1024 | { | ||
1025 | return m_fCanceled; | ||
1026 | } | ||
1027 | |||
1028 | CBalBaseBootstrapperApplication( | ||
1029 | __in IBootstrapperEngine* pEngine, | ||
1030 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
1031 | __in DWORD dwRetryCount = 0, | ||
1032 | __in DWORD dwRetryTimeout = 1000 | ||
1033 | ) | ||
1034 | { | ||
1035 | m_cReferences = 1; | ||
1036 | m_display = pArgs->pCommand->display; | ||
1037 | m_restart = pArgs->pCommand->restart; | ||
1038 | |||
1039 | pEngine->AddRef(); | ||
1040 | m_pEngine = pEngine; | ||
1041 | |||
1042 | ::InitializeCriticalSection(&m_csCanceled); | ||
1043 | m_fCanceled = FALSE; | ||
1044 | m_fApplying = FALSE; | ||
1045 | m_fRollingBack = FALSE; | ||
1046 | |||
1047 | m_dwProgressPercentage = 0; | ||
1048 | m_dwOverallProgressPercentage = 0; | ||
1049 | |||
1050 | BalRetryInitialize(dwRetryCount, dwRetryTimeout); | ||
1051 | } | ||
1052 | |||
1053 | virtual ~CBalBaseBootstrapperApplication() | ||
1054 | { | ||
1055 | BalRetryUninitialize(); | ||
1056 | ::DeleteCriticalSection(&m_csCanceled); | ||
1057 | |||
1058 | ReleaseNullObject(m_pEngine); | ||
1059 | } | ||
1060 | |||
1061 | protected: | ||
1062 | CRITICAL_SECTION m_csCanceled; | ||
1063 | BOOL m_fCanceled; | ||
1064 | |||
1065 | private: | ||
1066 | long m_cReferences; | ||
1067 | BOOTSTRAPPER_DISPLAY m_display; | ||
1068 | BOOTSTRAPPER_RESTART m_restart; | ||
1069 | IBootstrapperEngine* m_pEngine; | ||
1070 | |||
1071 | BOOL m_fApplying; | ||
1072 | BOOL m_fRollingBack; | ||
1073 | |||
1074 | DWORD m_dwProgressPercentage; | ||
1075 | DWORD m_dwOverallProgressPercentage; | ||
1076 | }; | ||
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h new file mode 100644 index 00000000..7fe3ffd8 --- /dev/null +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h | |||
@@ -0,0 +1,901 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | |||
7 | #include "BootstrapperEngine.h" | ||
8 | #include "BootstrapperApplication.h" | ||
9 | #include "IBootstrapperEngine.h" | ||
10 | #include "IBootstrapperApplication.h" | ||
11 | |||
12 | static HRESULT BalBaseBAProcOnDetectBegin( | ||
13 | __in IBootstrapperApplication* pBA, | ||
14 | __in BA_ONDETECTBEGIN_ARGS* pArgs, | ||
15 | __inout BA_ONDETECTBEGIN_RESULTS* pResults | ||
16 | ) | ||
17 | { | ||
18 | return pBA->OnDetectBegin(pArgs->fCached, pArgs->fInstalled, pArgs->cPackages, &pResults->fCancel); | ||
19 | } | ||
20 | |||
21 | static HRESULT BalBaseBAProcOnDetectComplete( | ||
22 | __in IBootstrapperApplication* pBA, | ||
23 | __in BA_ONDETECTCOMPLETE_ARGS* pArgs, | ||
24 | __inout BA_ONDETECTCOMPLETE_RESULTS* /*pResults*/ | ||
25 | ) | ||
26 | { | ||
27 | return pBA->OnDetectComplete(pArgs->hrStatus, pArgs->fEligibleForCleanup); | ||
28 | } | ||
29 | |||
30 | static HRESULT BalBaseBAProcOnPlanBegin( | ||
31 | __in IBootstrapperApplication* pBA, | ||
32 | __in BA_ONPLANBEGIN_ARGS* pArgs, | ||
33 | __inout BA_ONPLANBEGIN_RESULTS* pResults | ||
34 | ) | ||
35 | { | ||
36 | return pBA->OnPlanBegin(pArgs->cPackages, &pResults->fCancel); | ||
37 | } | ||
38 | |||
39 | static HRESULT BalBaseBAProcOnPlanComplete( | ||
40 | __in IBootstrapperApplication* pBA, | ||
41 | __in BA_ONPLANCOMPLETE_ARGS* pArgs, | ||
42 | __inout BA_ONPLANCOMPLETE_RESULTS* /*pResults*/ | ||
43 | ) | ||
44 | { | ||
45 | return pBA->OnPlanComplete(pArgs->hrStatus); | ||
46 | } | ||
47 | |||
48 | static HRESULT BalBaseBAProcOnStartup( | ||
49 | __in IBootstrapperApplication* pBA, | ||
50 | __in BA_ONSTARTUP_ARGS* /*pArgs*/, | ||
51 | __inout BA_ONSTARTUP_RESULTS* /*pResults*/ | ||
52 | ) | ||
53 | { | ||
54 | return pBA->OnStartup(); | ||
55 | } | ||
56 | |||
57 | static HRESULT BalBaseBAProcOnShutdown( | ||
58 | __in IBootstrapperApplication* pBA, | ||
59 | __in BA_ONSHUTDOWN_ARGS* /*pArgs*/, | ||
60 | __inout BA_ONSHUTDOWN_RESULTS* pResults | ||
61 | ) | ||
62 | { | ||
63 | return pBA->OnShutdown(&pResults->action); | ||
64 | } | ||
65 | |||
66 | static HRESULT BalBaseBAProcOnSystemShutdown( | ||
67 | __in IBootstrapperApplication* pBA, | ||
68 | __in BA_ONSYSTEMSHUTDOWN_ARGS* pArgs, | ||
69 | __inout BA_ONSYSTEMSHUTDOWN_RESULTS* pResults | ||
70 | ) | ||
71 | { | ||
72 | return pBA->OnSystemShutdown(pArgs->dwEndSession, &pResults->fCancel); | ||
73 | } | ||
74 | |||
75 | static HRESULT BalBaseBAProcOnDetectForwardCompatibleBundle( | ||
76 | __in IBootstrapperApplication* pBA, | ||
77 | __in BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs, | ||
78 | __inout BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults | ||
79 | ) | ||
80 | { | ||
81 | return pBA->OnDetectForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fMissingFromCache, &pResults->fCancel); | ||
82 | } | ||
83 | |||
84 | static HRESULT BalBaseBAProcOnDetectUpdateBegin( | ||
85 | __in IBootstrapperApplication* pBA, | ||
86 | __in BA_ONDETECTUPDATEBEGIN_ARGS* pArgs, | ||
87 | __inout BA_ONDETECTUPDATEBEGIN_RESULTS* pResults | ||
88 | ) | ||
89 | { | ||
90 | return pBA->OnDetectUpdateBegin(pArgs->wzUpdateLocation, &pResults->fCancel, &pResults->fSkip); | ||
91 | } | ||
92 | |||
93 | static HRESULT BalBaseBAProcOnDetectUpdate( | ||
94 | __in IBootstrapperApplication* pBA, | ||
95 | __in BA_ONDETECTUPDATE_ARGS* pArgs, | ||
96 | __inout BA_ONDETECTUPDATE_RESULTS* pResults | ||
97 | ) | ||
98 | { | ||
99 | return pBA->OnDetectUpdate(pArgs->wzUpdateLocation, pArgs->dw64Size, pArgs->wzVersion, pArgs->wzTitle, pArgs->wzSummary, pArgs->wzContentType, pArgs->wzContent, &pResults->fCancel, &pResults->fStopProcessingUpdates); | ||
100 | } | ||
101 | |||
102 | static HRESULT BalBaseBAProcOnDetectUpdateComplete( | ||
103 | __in IBootstrapperApplication* pBA, | ||
104 | __in BA_ONDETECTUPDATECOMPLETE_ARGS* pArgs, | ||
105 | __inout BA_ONDETECTUPDATECOMPLETE_RESULTS* pResults | ||
106 | ) | ||
107 | { | ||
108 | return pBA->OnDetectUpdateComplete(pArgs->hrStatus, &pResults->fIgnoreError); | ||
109 | } | ||
110 | |||
111 | static HRESULT BalBaseBAProcOnDetectRelatedBundle( | ||
112 | __in IBootstrapperApplication* pBA, | ||
113 | __in BA_ONDETECTRELATEDBUNDLE_ARGS* pArgs, | ||
114 | __inout BA_ONDETECTRELATEDBUNDLE_RESULTS* pResults | ||
115 | ) | ||
116 | { | ||
117 | return pBA->OnDetectRelatedBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->operation, pArgs->fMissingFromCache, &pResults->fCancel); | ||
118 | } | ||
119 | |||
120 | static HRESULT BalBaseBAProcOnDetectPackageBegin( | ||
121 | __in IBootstrapperApplication* pBA, | ||
122 | __in BA_ONDETECTPACKAGEBEGIN_ARGS* pArgs, | ||
123 | __inout BA_ONDETECTPACKAGEBEGIN_RESULTS* pResults | ||
124 | ) | ||
125 | { | ||
126 | return pBA->OnDetectPackageBegin(pArgs->wzPackageId, &pResults->fCancel); | ||
127 | } | ||
128 | |||
129 | static HRESULT BalBaseBAProcOnDetectRelatedMsiPackage( | ||
130 | __in IBootstrapperApplication* pBA, | ||
131 | __in BA_ONDETECTRELATEDMSIPACKAGE_ARGS* pArgs, | ||
132 | __inout BA_ONDETECTRELATEDMSIPACKAGE_RESULTS* pResults | ||
133 | ) | ||
134 | { | ||
135 | return pBA->OnDetectRelatedMsiPackage(pArgs->wzPackageId, pArgs->wzUpgradeCode, pArgs->wzProductCode, pArgs->fPerMachine, pArgs->wzVersion, pArgs->operation, &pResults->fCancel); | ||
136 | } | ||
137 | |||
138 | static HRESULT BalBaseBAProcOnDetectPatchTarget( | ||
139 | __in IBootstrapperApplication* pBA, | ||
140 | __in BA_ONDETECTPATCHTARGET_ARGS* pArgs, | ||
141 | __inout BA_ONDETECTPATCHTARGET_RESULTS* pResults | ||
142 | ) | ||
143 | { | ||
144 | return pBA->OnDetectPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->patchState, &pResults->fCancel); | ||
145 | } | ||
146 | |||
147 | static HRESULT BalBaseBAProcOnDetectMsiFeature( | ||
148 | __in IBootstrapperApplication* pBA, | ||
149 | __in BA_ONDETECTMSIFEATURE_ARGS* pArgs, | ||
150 | __inout BA_ONDETECTMSIFEATURE_RESULTS* pResults | ||
151 | ) | ||
152 | { | ||
153 | return pBA->OnDetectMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->state, &pResults->fCancel); | ||
154 | } | ||
155 | |||
156 | static HRESULT BalBaseBAProcOnDetectPackageComplete( | ||
157 | __in IBootstrapperApplication* pBA, | ||
158 | __in BA_ONDETECTPACKAGECOMPLETE_ARGS* pArgs, | ||
159 | __inout BA_ONDETECTPACKAGECOMPLETE_RESULTS* /*pResults*/ | ||
160 | ) | ||
161 | { | ||
162 | return pBA->OnDetectPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->state, pArgs->fCached); | ||
163 | } | ||
164 | |||
165 | static HRESULT BalBaseBAProcOnPlanRelatedBundle( | ||
166 | __in IBootstrapperApplication* pBA, | ||
167 | __in BA_ONPLANRELATEDBUNDLE_ARGS* pArgs, | ||
168 | __inout BA_ONPLANRELATEDBUNDLE_RESULTS* pResults | ||
169 | ) | ||
170 | { | ||
171 | return pBA->OnPlanRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel); | ||
172 | } | ||
173 | |||
174 | static HRESULT BalBaseBAProcOnPlanPackageBegin( | ||
175 | __in IBootstrapperApplication* pBA, | ||
176 | __in BA_ONPLANPACKAGEBEGIN_ARGS* pArgs, | ||
177 | __inout BA_ONPLANPACKAGEBEGIN_RESULTS* pResults | ||
178 | ) | ||
179 | { | ||
180 | return pBA->OnPlanPackageBegin(pArgs->wzPackageId, pArgs->state, pArgs->fCached, pArgs->installCondition, pArgs->recommendedState, pArgs->recommendedCacheType, &pResults->requestedState, &pResults->requestedCacheType, &pResults->fCancel); | ||
181 | } | ||
182 | |||
183 | static HRESULT BalBaseBAProcOnPlanPatchTarget( | ||
184 | __in IBootstrapperApplication* pBA, | ||
185 | __in BA_ONPLANPATCHTARGET_ARGS* pArgs, | ||
186 | __inout BA_ONPLANPATCHTARGET_RESULTS* pResults | ||
187 | ) | ||
188 | { | ||
189 | return pBA->OnPlanPatchTarget(pArgs->wzPackageId, pArgs->wzProductCode, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel); | ||
190 | } | ||
191 | |||
192 | static HRESULT BalBaseBAProcOnPlanMsiFeature( | ||
193 | __in IBootstrapperApplication* pBA, | ||
194 | __in BA_ONPLANMSIFEATURE_ARGS* pArgs, | ||
195 | __inout BA_ONPLANMSIFEATURE_RESULTS* pResults | ||
196 | ) | ||
197 | { | ||
198 | return pBA->OnPlanMsiFeature(pArgs->wzPackageId, pArgs->wzFeatureId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel); | ||
199 | } | ||
200 | |||
201 | static HRESULT BalBaseBAProcOnPlanPackageComplete( | ||
202 | __in IBootstrapperApplication* pBA, | ||
203 | __in BA_ONPLANPACKAGECOMPLETE_ARGS* pArgs, | ||
204 | __inout BA_ONPLANPACKAGECOMPLETE_RESULTS* /*pResults*/ | ||
205 | ) | ||
206 | { | ||
207 | return pBA->OnPlanPackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->requested); | ||
208 | } | ||
209 | |||
210 | static HRESULT BalBaseBAProcOnPlannedPackage( | ||
211 | __in IBootstrapperApplication* pBA, | ||
212 | __in BA_ONPLANNEDPACKAGE_ARGS* pArgs, | ||
213 | __inout BA_ONPLANNEDPACKAGE_RESULTS* /*pResults*/ | ||
214 | ) | ||
215 | { | ||
216 | return pBA->OnPlannedPackage(pArgs->wzPackageId, pArgs->execute, pArgs->rollback, pArgs->fPlannedCache, pArgs->fPlannedUncache); | ||
217 | } | ||
218 | |||
219 | static HRESULT BalBaseBAProcOnApplyBegin( | ||
220 | __in IBootstrapperApplication* pBA, | ||
221 | __in BA_ONAPPLYBEGIN_ARGS* pArgs, | ||
222 | __inout BA_ONAPPLYBEGIN_RESULTS* pResults | ||
223 | ) | ||
224 | { | ||
225 | return pBA->OnApplyBegin(pArgs->dwPhaseCount, &pResults->fCancel); | ||
226 | } | ||
227 | |||
228 | static HRESULT BalBaseBAProcOnElevateBegin( | ||
229 | __in IBootstrapperApplication* pBA, | ||
230 | __in BA_ONELEVATEBEGIN_ARGS* /*pArgs*/, | ||
231 | __inout BA_ONELEVATEBEGIN_RESULTS* pResults | ||
232 | ) | ||
233 | { | ||
234 | return pBA->OnElevateBegin(&pResults->fCancel); | ||
235 | } | ||
236 | |||
237 | static HRESULT BalBaseBAProcOnElevateComplete( | ||
238 | __in IBootstrapperApplication* pBA, | ||
239 | __in BA_ONELEVATECOMPLETE_ARGS* pArgs, | ||
240 | __inout BA_ONELEVATECOMPLETE_RESULTS* /*pResults*/ | ||
241 | ) | ||
242 | { | ||
243 | return pBA->OnElevateComplete(pArgs->hrStatus); | ||
244 | } | ||
245 | |||
246 | static HRESULT BalBaseBAProcOnProgress( | ||
247 | __in IBootstrapperApplication* pBA, | ||
248 | __in BA_ONPROGRESS_ARGS* pArgs, | ||
249 | __inout BA_ONPROGRESS_RESULTS* pResults | ||
250 | ) | ||
251 | { | ||
252 | return pBA->OnProgress(pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel); | ||
253 | } | ||
254 | |||
255 | static HRESULT BalBaseBAProcOnError( | ||
256 | __in IBootstrapperApplication* pBA, | ||
257 | __in BA_ONERROR_ARGS* pArgs, | ||
258 | __inout BA_ONERROR_RESULTS* pResults | ||
259 | ) | ||
260 | { | ||
261 | return pBA->OnError(pArgs->errorType, pArgs->wzPackageId, pArgs->dwCode, pArgs->wzError, pArgs->dwUIHint, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult); | ||
262 | } | ||
263 | |||
264 | static HRESULT BalBaseBAProcOnRegisterBegin( | ||
265 | __in IBootstrapperApplication* pBA, | ||
266 | __in BA_ONREGISTERBEGIN_ARGS* /*pArgs*/, | ||
267 | __inout BA_ONREGISTERBEGIN_RESULTS* pResults | ||
268 | ) | ||
269 | { | ||
270 | return pBA->OnRegisterBegin(&pResults->fCancel); | ||
271 | } | ||
272 | |||
273 | static HRESULT BalBaseBAProcOnRegisterComplete( | ||
274 | __in IBootstrapperApplication* pBA, | ||
275 | __in BA_ONREGISTERCOMPLETE_ARGS* pArgs, | ||
276 | __inout BA_ONREGISTERCOMPLETE_RESULTS* /*pResults*/ | ||
277 | ) | ||
278 | { | ||
279 | return pBA->OnRegisterComplete(pArgs->hrStatus); | ||
280 | } | ||
281 | |||
282 | static HRESULT BalBaseBAProcOnCacheBegin( | ||
283 | __in IBootstrapperApplication* pBA, | ||
284 | __in BA_ONCACHEBEGIN_ARGS* /*pArgs*/, | ||
285 | __inout BA_ONCACHEBEGIN_RESULTS* pResults | ||
286 | ) | ||
287 | { | ||
288 | return pBA->OnCacheBegin(&pResults->fCancel); | ||
289 | } | ||
290 | |||
291 | static HRESULT BalBaseBAProcOnCachePackageBegin( | ||
292 | __in IBootstrapperApplication* pBA, | ||
293 | __in BA_ONCACHEPACKAGEBEGIN_ARGS* pArgs, | ||
294 | __inout BA_ONCACHEPACKAGEBEGIN_RESULTS* pResults | ||
295 | ) | ||
296 | { | ||
297 | return pBA->OnCachePackageBegin(pArgs->wzPackageId, pArgs->cCachePayloads, pArgs->dw64PackageCacheSize, &pResults->fCancel); | ||
298 | } | ||
299 | |||
300 | static HRESULT BalBaseBAProcOnCacheAcquireBegin( | ||
301 | __in IBootstrapperApplication* pBA, | ||
302 | __in BA_ONCACHEACQUIREBEGIN_ARGS* pArgs, | ||
303 | __inout BA_ONCACHEACQUIREBEGIN_RESULTS* pResults | ||
304 | ) | ||
305 | { | ||
306 | return pBA->OnCacheAcquireBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->wzSource, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->action, &pResults->fCancel); | ||
307 | } | ||
308 | |||
309 | static HRESULT BalBaseBAProcOnCacheAcquireProgress( | ||
310 | __in IBootstrapperApplication* pBA, | ||
311 | __in BA_ONCACHEACQUIREPROGRESS_ARGS* pArgs, | ||
312 | __inout BA_ONCACHEACQUIREPROGRESS_RESULTS* pResults | ||
313 | ) | ||
314 | { | ||
315 | return pBA->OnCacheAcquireProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel); | ||
316 | } | ||
317 | |||
318 | static HRESULT BalBaseBAProcOnCacheAcquireResolving( | ||
319 | __in IBootstrapperApplication* pBA, | ||
320 | __in BA_ONCACHEACQUIRERESOLVING_ARGS* pArgs, | ||
321 | __inout BA_ONCACHEACQUIRERESOLVING_RESULTS* pResults | ||
322 | ) | ||
323 | { | ||
324 | return pBA->OnCacheAcquireResolving(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->rgSearchPaths, pArgs->cSearchPaths, pArgs->fFoundLocal, pArgs->dwRecommendedSearchPath, pArgs->wzDownloadUrl, pArgs->wzPayloadContainerId, pArgs->recommendation, &pResults->dwChosenSearchPath, &pResults->action, &pResults->fCancel); | ||
325 | } | ||
326 | |||
327 | static HRESULT BalBaseBAProcOnCacheAcquireComplete( | ||
328 | __in IBootstrapperApplication* pBA, | ||
329 | __in BA_ONCACHEACQUIRECOMPLETE_ARGS* pArgs, | ||
330 | __inout BA_ONCACHEACQUIRECOMPLETE_RESULTS* pResults | ||
331 | ) | ||
332 | { | ||
333 | return pBA->OnCacheAcquireComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action); | ||
334 | } | ||
335 | |||
336 | static HRESULT BalBaseBAProcOnCacheVerifyBegin( | ||
337 | __in IBootstrapperApplication* pBA, | ||
338 | __in BA_ONCACHEVERIFYBEGIN_ARGS* pArgs, | ||
339 | __inout BA_ONCACHEVERIFYBEGIN_RESULTS* pResults | ||
340 | ) | ||
341 | { | ||
342 | return pBA->OnCacheVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel); | ||
343 | } | ||
344 | |||
345 | static HRESULT BalBaseBAProcOnCacheVerifyProgress( | ||
346 | __in IBootstrapperApplication* pBA, | ||
347 | __in BA_ONCACHEVERIFYPROGRESS_ARGS* pArgs, | ||
348 | __inout BA_ONCACHEVERIFYPROGRESS_RESULTS* pResults | ||
349 | ) | ||
350 | { | ||
351 | return pBA->OnCacheVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, pArgs->verifyStep, &pResults->fCancel); | ||
352 | } | ||
353 | |||
354 | static HRESULT BalBaseBAProcOnCacheVerifyComplete( | ||
355 | __in IBootstrapperApplication* pBA, | ||
356 | __in BA_ONCACHEVERIFYCOMPLETE_ARGS* pArgs, | ||
357 | __inout BA_ONCACHEVERIFYCOMPLETE_RESULTS* pResults | ||
358 | ) | ||
359 | { | ||
360 | return pBA->OnCacheVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus, pArgs->recommendation, &pResults->action); | ||
361 | } | ||
362 | |||
363 | static HRESULT BalBaseBAProcOnCachePackageComplete( | ||
364 | __in IBootstrapperApplication* pBA, | ||
365 | __in BA_ONCACHEPACKAGECOMPLETE_ARGS* pArgs, | ||
366 | __inout BA_ONCACHEPACKAGECOMPLETE_RESULTS* pResults | ||
367 | ) | ||
368 | { | ||
369 | return pBA->OnCachePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->recommendation, &pResults->action); | ||
370 | } | ||
371 | |||
372 | static HRESULT BalBaseBAProcOnCacheComplete( | ||
373 | __in IBootstrapperApplication* pBA, | ||
374 | __in BA_ONCACHECOMPLETE_ARGS* pArgs, | ||
375 | __inout BA_ONCACHECOMPLETE_RESULTS* /*pResults*/ | ||
376 | ) | ||
377 | { | ||
378 | return pBA->OnCacheComplete(pArgs->hrStatus); | ||
379 | } | ||
380 | |||
381 | static HRESULT BalBaseBAProcOnExecuteBegin( | ||
382 | __in IBootstrapperApplication* pBA, | ||
383 | __in BA_ONEXECUTEBEGIN_ARGS* pArgs, | ||
384 | __inout BA_ONEXECUTEBEGIN_RESULTS* pResults | ||
385 | ) | ||
386 | { | ||
387 | return pBA->OnExecuteBegin(pArgs->cExecutingPackages, &pResults->fCancel); | ||
388 | } | ||
389 | |||
390 | static HRESULT BalBaseBAProcOnExecutePackageBegin( | ||
391 | __in IBootstrapperApplication* pBA, | ||
392 | __in BA_ONEXECUTEPACKAGEBEGIN_ARGS* pArgs, | ||
393 | __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults | ||
394 | ) | ||
395 | { | ||
396 | return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->uiLevel, pArgs->fDisableExternalUiHandler, &pResults->fCancel); | ||
397 | } | ||
398 | |||
399 | static HRESULT BalBaseBAProcOnExecutePatchTarget( | ||
400 | __in IBootstrapperApplication* pBA, | ||
401 | __in BA_ONEXECUTEPATCHTARGET_ARGS* pArgs, | ||
402 | __inout BA_ONEXECUTEPATCHTARGET_RESULTS* pResults | ||
403 | ) | ||
404 | { | ||
405 | return pBA->OnExecutePatchTarget(pArgs->wzPackageId, pArgs->wzTargetProductCode, &pResults->fCancel); | ||
406 | } | ||
407 | |||
408 | static HRESULT BalBaseBAProcOnExecuteProgress( | ||
409 | __in IBootstrapperApplication* pBA, | ||
410 | __in BA_ONEXECUTEPROGRESS_ARGS* pArgs, | ||
411 | __inout BA_ONEXECUTEPROGRESS_RESULTS* pResults | ||
412 | ) | ||
413 | { | ||
414 | return pBA->OnExecuteProgress(pArgs->wzPackageId, pArgs->dwProgressPercentage, pArgs->dwOverallPercentage, &pResults->fCancel); | ||
415 | } | ||
416 | |||
417 | static HRESULT BalBaseBAProcOnExecuteMsiMessage( | ||
418 | __in IBootstrapperApplication* pBA, | ||
419 | __in BA_ONEXECUTEMSIMESSAGE_ARGS* pArgs, | ||
420 | __inout BA_ONEXECUTEMSIMESSAGE_RESULTS* pResults | ||
421 | ) | ||
422 | { | ||
423 | return pBA->OnExecuteMsiMessage(pArgs->wzPackageId, pArgs->messageType, pArgs->dwUIHint, pArgs->wzMessage, pArgs->cData, pArgs->rgwzData, pArgs->nRecommendation, &pResults->nResult); | ||
424 | } | ||
425 | |||
426 | static HRESULT BalBaseBAProcOnExecuteFilesInUse( | ||
427 | __in IBootstrapperApplication* pBA, | ||
428 | __in BA_ONEXECUTEFILESINUSE_ARGS* pArgs, | ||
429 | __inout BA_ONEXECUTEFILESINUSE_RESULTS* pResults | ||
430 | ) | ||
431 | { | ||
432 | return pBA->OnExecuteFilesInUse(pArgs->wzPackageId, pArgs->cFiles, pArgs->rgwzFiles, pArgs->nRecommendation, &pResults->nResult); | ||
433 | } | ||
434 | |||
435 | static HRESULT BalBaseBAProcOnExecutePackageComplete( | ||
436 | __in IBootstrapperApplication* pBA, | ||
437 | __in BA_ONEXECUTEPACKAGECOMPLETE_ARGS* pArgs, | ||
438 | __inout BA_ONEXECUTEPACKAGECOMPLETE_RESULTS* pResults | ||
439 | ) | ||
440 | { | ||
441 | return pBA->OnExecutePackageComplete(pArgs->wzPackageId, pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action); | ||
442 | } | ||
443 | |||
444 | static HRESULT BalBaseBAProcOnExecuteComplete( | ||
445 | __in IBootstrapperApplication* pBA, | ||
446 | __in BA_ONEXECUTECOMPLETE_ARGS* pArgs, | ||
447 | __inout BA_ONEXECUTECOMPLETE_RESULTS* /*pResults*/ | ||
448 | ) | ||
449 | { | ||
450 | return pBA->OnExecuteComplete(pArgs->hrStatus); | ||
451 | } | ||
452 | |||
453 | static HRESULT BalBaseBAProcOnUnregisterBegin( | ||
454 | __in IBootstrapperApplication* pBA, | ||
455 | __in BA_ONUNREGISTERBEGIN_ARGS* pArgs, | ||
456 | __inout BA_ONUNREGISTERBEGIN_RESULTS* pResults | ||
457 | ) | ||
458 | { | ||
459 | return pBA->OnUnregisterBegin(pArgs->fKeepRegistration, &pResults->fForceKeepRegistration); | ||
460 | } | ||
461 | |||
462 | static HRESULT BalBaseBAProcOnUnregisterComplete( | ||
463 | __in IBootstrapperApplication* pBA, | ||
464 | __in BA_ONUNREGISTERCOMPLETE_ARGS* pArgs, | ||
465 | __inout BA_ONUNREGISTERCOMPLETE_RESULTS* /*pResults*/ | ||
466 | ) | ||
467 | { | ||
468 | return pBA->OnUnregisterComplete(pArgs->hrStatus); | ||
469 | } | ||
470 | |||
471 | static HRESULT BalBaseBAProcOnApplyComplete( | ||
472 | __in IBootstrapperApplication* pBA, | ||
473 | __in BA_ONAPPLYCOMPLETE_ARGS* pArgs, | ||
474 | __inout BA_ONAPPLYCOMPLETE_RESULTS* pResults | ||
475 | ) | ||
476 | { | ||
477 | return pBA->OnApplyComplete(pArgs->hrStatus, pArgs->restart, pArgs->recommendation, &pResults->action); | ||
478 | } | ||
479 | |||
480 | static HRESULT BalBaseBAProcOnLaunchApprovedExeBegin( | ||
481 | __in IBootstrapperApplication* pBA, | ||
482 | __in BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS* /*pArgs*/, | ||
483 | __inout BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS* pResults | ||
484 | ) | ||
485 | { | ||
486 | return pBA->OnLaunchApprovedExeBegin(&pResults->fCancel); | ||
487 | } | ||
488 | |||
489 | static HRESULT BalBaseBAProcOnLaunchApprovedExeComplete( | ||
490 | __in IBootstrapperApplication* pBA, | ||
491 | __in BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS* pArgs, | ||
492 | __inout BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS* /*pResults*/ | ||
493 | ) | ||
494 | { | ||
495 | return pBA->OnLaunchApprovedExeComplete(pArgs->hrStatus, pArgs->dwProcessId); | ||
496 | } | ||
497 | |||
498 | static HRESULT BalBaseBAProcOnPlanMsiPackage( | ||
499 | __in IBootstrapperApplication* pBA, | ||
500 | __in BA_ONPLANMSIPACKAGE_ARGS* pArgs, | ||
501 | __inout BA_ONPLANMSIPACKAGE_RESULTS* pResults | ||
502 | ) | ||
503 | { | ||
504 | return pBA->OnPlanMsiPackage(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, &pResults->fCancel, &pResults->actionMsiProperty, &pResults->uiLevel, &pResults->fDisableExternalUiHandler); | ||
505 | } | ||
506 | |||
507 | static HRESULT BalBaseBAProcOnBeginMsiTransactionBegin( | ||
508 | __in IBootstrapperApplication* pBA, | ||
509 | __in BA_ONBEGINMSITRANSACTIONBEGIN_ARGS* pArgs, | ||
510 | __inout BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS* pResults | ||
511 | ) | ||
512 | { | ||
513 | return pBA->OnBeginMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel); | ||
514 | } | ||
515 | |||
516 | static HRESULT BalBaseBAProcOnBeginMsiTransactionComplete( | ||
517 | __in IBootstrapperApplication* pBA, | ||
518 | __in BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS* pArgs, | ||
519 | __inout BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS* /*pResults*/ | ||
520 | ) | ||
521 | { | ||
522 | return pBA->OnBeginMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus); | ||
523 | } | ||
524 | |||
525 | static HRESULT BalBaseBAProcOnCommitMsiTransactionBegin( | ||
526 | __in IBootstrapperApplication* pBA, | ||
527 | __in BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS* pArgs, | ||
528 | __inout BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS* pResults | ||
529 | ) | ||
530 | { | ||
531 | return pBA->OnCommitMsiTransactionBegin(pArgs->wzTransactionId, &pResults->fCancel); | ||
532 | } | ||
533 | |||
534 | static HRESULT BalBaseBAProcOnCommitMsiTransactionComplete( | ||
535 | __in IBootstrapperApplication* pBA, | ||
536 | __in BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS* pArgs, | ||
537 | __inout BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS* /*pResults*/ | ||
538 | ) | ||
539 | { | ||
540 | return pBA->OnCommitMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus); | ||
541 | } | ||
542 | |||
543 | static HRESULT BalBaseBAProcOnRollbackMsiTransactionBegin( | ||
544 | __in IBootstrapperApplication* pBA, | ||
545 | __in BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS* pArgs, | ||
546 | __inout BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS* /*pResults*/ | ||
547 | ) | ||
548 | { | ||
549 | return pBA->OnRollbackMsiTransactionBegin(pArgs->wzTransactionId); | ||
550 | } | ||
551 | |||
552 | static HRESULT BalBaseBAProcOnRollbackMsiTransactionComplete( | ||
553 | __in IBootstrapperApplication* pBA, | ||
554 | __in BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS* pArgs, | ||
555 | __inout BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS* /*pResults*/ | ||
556 | ) | ||
557 | { | ||
558 | return pBA->OnRollbackMsiTransactionComplete(pArgs->wzTransactionId, pArgs->hrStatus); | ||
559 | } | ||
560 | |||
561 | static HRESULT BalBaseBAProcOnPauseAutomaticUpdatesBegin( | ||
562 | __in IBootstrapperApplication* pBA, | ||
563 | __in BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS* /*pArgs*/, | ||
564 | __inout BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS* /*pResults*/ | ||
565 | ) | ||
566 | { | ||
567 | return pBA->OnPauseAutomaticUpdatesBegin(); | ||
568 | } | ||
569 | |||
570 | static HRESULT BalBaseBAProcOnPauseAutomaticUpdatesComplete( | ||
571 | __in IBootstrapperApplication* pBA, | ||
572 | __in BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS* pArgs, | ||
573 | __inout BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS* /*pResults*/ | ||
574 | ) | ||
575 | { | ||
576 | return pBA->OnPauseAutomaticUpdatesComplete(pArgs->hrStatus); | ||
577 | } | ||
578 | |||
579 | static HRESULT BalBaseBAProcOnSystemRestorePointBegin( | ||
580 | __in IBootstrapperApplication* pBA, | ||
581 | __in BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS* /*pArgs*/, | ||
582 | __inout BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS* /*pResults*/ | ||
583 | ) | ||
584 | { | ||
585 | return pBA->OnSystemRestorePointBegin(); | ||
586 | } | ||
587 | |||
588 | static HRESULT BalBaseBAProcOnSystemRestorePointComplete( | ||
589 | __in IBootstrapperApplication* pBA, | ||
590 | __in BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS* pArgs, | ||
591 | __inout BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS* /*pResults*/ | ||
592 | ) | ||
593 | { | ||
594 | return pBA->OnSystemRestorePointComplete(pArgs->hrStatus); | ||
595 | } | ||
596 | |||
597 | static HRESULT BalBaseBAProcOnPlanForwardCompatibleBundle( | ||
598 | __in IBootstrapperApplication* pBA, | ||
599 | __in BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS* pArgs, | ||
600 | __inout BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS* pResults | ||
601 | ) | ||
602 | { | ||
603 | return pBA->OnPlanForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fRecommendedIgnoreBundle, &pResults->fCancel, &pResults->fIgnoreBundle); | ||
604 | } | ||
605 | |||
606 | static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin( | ||
607 | __in IBootstrapperApplication* pBA, | ||
608 | __in BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS* pArgs, | ||
609 | __inout BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS* pResults | ||
610 | ) | ||
611 | { | ||
612 | return pBA->OnCacheContainerOrPayloadVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel); | ||
613 | } | ||
614 | |||
615 | static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress( | ||
616 | __in IBootstrapperApplication* pBA, | ||
617 | __in BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS* pArgs, | ||
618 | __inout BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS* pResults | ||
619 | ) | ||
620 | { | ||
621 | return pBA->OnCacheContainerOrPayloadVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel); | ||
622 | } | ||
623 | |||
624 | static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete( | ||
625 | __in IBootstrapperApplication* pBA, | ||
626 | __in BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS* pArgs, | ||
627 | __inout BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS* /*pResults*/ | ||
628 | ) | ||
629 | { | ||
630 | return pBA->OnCacheContainerOrPayloadVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus); | ||
631 | } | ||
632 | |||
633 | static HRESULT BalBaseBAProcOnCachePayloadExtractBegin( | ||
634 | __in IBootstrapperApplication* pBA, | ||
635 | __in BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS* pArgs, | ||
636 | __inout BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS* pResults | ||
637 | ) | ||
638 | { | ||
639 | return pBA->OnCachePayloadExtractBegin(pArgs->wzContainerId, pArgs->wzPayloadId, &pResults->fCancel); | ||
640 | } | ||
641 | |||
642 | static HRESULT BalBaseBAProcOnCachePayloadExtractProgress( | ||
643 | __in IBootstrapperApplication* pBA, | ||
644 | __in BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS* pArgs, | ||
645 | __inout BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS* pResults | ||
646 | ) | ||
647 | { | ||
648 | return pBA->OnCachePayloadExtractProgress(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel); | ||
649 | } | ||
650 | |||
651 | static HRESULT BalBaseBAProcOnCachePayloadExtractComplete( | ||
652 | __in IBootstrapperApplication* pBA, | ||
653 | __in BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS* pArgs, | ||
654 | __inout BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS* /*pResults*/ | ||
655 | ) | ||
656 | { | ||
657 | return pBA->OnCachePayloadExtractComplete(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->hrStatus); | ||
658 | } | ||
659 | |||
660 | /******************************************************************* | ||
661 | BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. | ||
662 | Provides a default mapping between the new message based BA interface and | ||
663 | the old COM-based BA interface. | ||
664 | |||
665 | *******************************************************************/ | ||
666 | static HRESULT WINAPI BalBaseBootstrapperApplicationProc( | ||
667 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
668 | __in const LPVOID pvArgs, | ||
669 | __inout LPVOID pvResults, | ||
670 | __in_opt LPVOID pvContext | ||
671 | ) | ||
672 | { | ||
673 | IBootstrapperApplication* pBA = reinterpret_cast<IBootstrapperApplication*>(pvContext); | ||
674 | HRESULT hr = pBA->BAProc(message, pvArgs, pvResults, pvContext); | ||
675 | |||
676 | if (E_NOTIMPL == hr) | ||
677 | { | ||
678 | switch (message) | ||
679 | { | ||
680 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN: | ||
681 | hr = BalBaseBAProcOnDetectBegin(pBA, reinterpret_cast<BA_ONDETECTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTBEGIN_RESULTS*>(pvResults)); | ||
682 | break; | ||
683 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE: | ||
684 | hr = BalBaseBAProcOnDetectComplete(pBA, reinterpret_cast<BA_ONDETECTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTCOMPLETE_RESULTS*>(pvResults)); | ||
685 | break; | ||
686 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN: | ||
687 | hr = BalBaseBAProcOnPlanBegin(pBA, reinterpret_cast<BA_ONPLANBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANBEGIN_RESULTS*>(pvResults)); | ||
688 | break; | ||
689 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE: | ||
690 | hr = BalBaseBAProcOnPlanComplete(pBA, reinterpret_cast<BA_ONPLANCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANCOMPLETE_RESULTS*>(pvResults)); | ||
691 | break; | ||
692 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP: | ||
693 | hr = BalBaseBAProcOnStartup(pBA, reinterpret_cast<BA_ONSTARTUP_ARGS*>(pvArgs), reinterpret_cast<BA_ONSTARTUP_RESULTS*>(pvResults)); | ||
694 | break; | ||
695 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN: | ||
696 | hr = BalBaseBAProcOnShutdown(pBA, reinterpret_cast<BA_ONSHUTDOWN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSHUTDOWN_RESULTS*>(pvResults)); | ||
697 | break; | ||
698 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN: | ||
699 | hr = BalBaseBAProcOnSystemShutdown(pBA, reinterpret_cast<BA_ONSYSTEMSHUTDOWN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMSHUTDOWN_RESULTS*>(pvResults)); | ||
700 | break; | ||
701 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE: | ||
702 | hr = BalBaseBAProcOnDetectForwardCompatibleBundle(pBA, reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults)); | ||
703 | break; | ||
704 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN: | ||
705 | hr = BalBaseBAProcOnDetectUpdateBegin(pBA, reinterpret_cast<BA_ONDETECTUPDATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATEBEGIN_RESULTS*>(pvResults)); | ||
706 | break; | ||
707 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE: | ||
708 | hr = BalBaseBAProcOnDetectUpdate(pBA, reinterpret_cast<BA_ONDETECTUPDATE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATE_RESULTS*>(pvResults)); | ||
709 | break; | ||
710 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE: | ||
711 | hr = BalBaseBAProcOnDetectUpdateComplete(pBA, reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTUPDATECOMPLETE_RESULTS*>(pvResults)); | ||
712 | break; | ||
713 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE: | ||
714 | hr = BalBaseBAProcOnDetectRelatedBundle(pBA, reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDBUNDLE_RESULTS*>(pvResults)); | ||
715 | break; | ||
716 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN: | ||
717 | hr = BalBaseBAProcOnDetectPackageBegin(pBA, reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGEBEGIN_RESULTS*>(pvResults)); | ||
718 | break; | ||
719 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE: | ||
720 | hr = BalBaseBAProcOnDetectRelatedMsiPackage(pBA, reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTRELATEDMSIPACKAGE_RESULTS*>(pvResults)); | ||
721 | break; | ||
722 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPATCHTARGET: | ||
723 | hr = BalBaseBAProcOnDetectPatchTarget(pBA, reinterpret_cast<BA_ONDETECTPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPATCHTARGET_RESULTS*>(pvResults)); | ||
724 | break; | ||
725 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE: | ||
726 | hr = BalBaseBAProcOnDetectMsiFeature(pBA, reinterpret_cast<BA_ONDETECTMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTMSIFEATURE_RESULTS*>(pvResults)); | ||
727 | break; | ||
728 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE: | ||
729 | hr = BalBaseBAProcOnDetectPackageComplete(pBA, reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONDETECTPACKAGECOMPLETE_RESULTS*>(pvResults)); | ||
730 | break; | ||
731 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE: | ||
732 | hr = BalBaseBAProcOnPlanRelatedBundle(pBA, reinterpret_cast<BA_ONPLANRELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLE_RESULTS*>(pvResults)); | ||
733 | break; | ||
734 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN: | ||
735 | hr = BalBaseBAProcOnPlanPackageBegin(pBA, reinterpret_cast<BA_ONPLANPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGEBEGIN_RESULTS*>(pvResults)); | ||
736 | break; | ||
737 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPATCHTARGET: | ||
738 | hr = BalBaseBAProcOnPlanPatchTarget(pBA, reinterpret_cast<BA_ONPLANPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPATCHTARGET_RESULTS*>(pvResults)); | ||
739 | break; | ||
740 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE: | ||
741 | hr = BalBaseBAProcOnPlanMsiFeature(pBA, reinterpret_cast<BA_ONPLANMSIFEATURE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIFEATURE_RESULTS*>(pvResults)); | ||
742 | break; | ||
743 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE: | ||
744 | hr = BalBaseBAProcOnPlanPackageComplete(pBA, reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANPACKAGECOMPLETE_RESULTS*>(pvResults)); | ||
745 | break; | ||
746 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN: | ||
747 | hr = BalBaseBAProcOnApplyBegin(pBA, reinterpret_cast<BA_ONAPPLYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYBEGIN_RESULTS*>(pvResults)); | ||
748 | break; | ||
749 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN: | ||
750 | hr = BalBaseBAProcOnElevateBegin(pBA, reinterpret_cast<BA_ONELEVATEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATEBEGIN_RESULTS*>(pvResults)); | ||
751 | break; | ||
752 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE: | ||
753 | hr = BalBaseBAProcOnElevateComplete(pBA, reinterpret_cast<BA_ONELEVATECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONELEVATECOMPLETE_RESULTS*>(pvResults)); | ||
754 | break; | ||
755 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS: | ||
756 | hr = BalBaseBAProcOnProgress(pBA, reinterpret_cast<BA_ONPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONPROGRESS_RESULTS*>(pvResults)); | ||
757 | break; | ||
758 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR: | ||
759 | hr = BalBaseBAProcOnError(pBA, reinterpret_cast<BA_ONERROR_ARGS*>(pvArgs), reinterpret_cast<BA_ONERROR_RESULTS*>(pvResults)); | ||
760 | break; | ||
761 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN: | ||
762 | hr = BalBaseBAProcOnRegisterBegin(pBA, reinterpret_cast<BA_ONREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERBEGIN_RESULTS*>(pvResults)); | ||
763 | break; | ||
764 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE: | ||
765 | hr = BalBaseBAProcOnRegisterComplete(pBA, reinterpret_cast<BA_ONREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONREGISTERCOMPLETE_RESULTS*>(pvResults)); | ||
766 | break; | ||
767 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN: | ||
768 | hr = BalBaseBAProcOnCacheBegin(pBA, reinterpret_cast<BA_ONCACHEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEBEGIN_RESULTS*>(pvResults)); | ||
769 | break; | ||
770 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN: | ||
771 | hr = BalBaseBAProcOnCachePackageBegin(pBA, reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGEBEGIN_RESULTS*>(pvResults)); | ||
772 | break; | ||
773 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN: | ||
774 | hr = BalBaseBAProcOnCacheAcquireBegin(pBA, reinterpret_cast<BA_ONCACHEACQUIREBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREBEGIN_RESULTS*>(pvResults)); | ||
775 | break; | ||
776 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS: | ||
777 | hr = BalBaseBAProcOnCacheAcquireProgress(pBA, reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIREPROGRESS_RESULTS*>(pvResults)); | ||
778 | break; | ||
779 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRERESOLVING: | ||
780 | hr = BalBaseBAProcOnCacheAcquireResolving(pBA, reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRERESOLVING_RESULTS*>(pvResults)); | ||
781 | break; | ||
782 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE: | ||
783 | hr = BalBaseBAProcOnCacheAcquireComplete(pBA, reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEACQUIRECOMPLETE_RESULTS*>(pvResults)); | ||
784 | break; | ||
785 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN: | ||
786 | hr = BalBaseBAProcOnCacheVerifyBegin(pBA, reinterpret_cast<BA_ONCACHEVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYBEGIN_RESULTS*>(pvResults)); | ||
787 | break; | ||
788 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS: | ||
789 | hr = BalBaseBAProcOnCacheVerifyProgress(pBA, reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYPROGRESS_RESULTS*>(pvResults)); | ||
790 | break; | ||
791 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE: | ||
792 | hr = BalBaseBAProcOnCacheVerifyComplete(pBA, reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEVERIFYCOMPLETE_RESULTS*>(pvResults)); | ||
793 | break; | ||
794 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE: | ||
795 | hr = BalBaseBAProcOnCachePackageComplete(pBA, reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPACKAGECOMPLETE_RESULTS*>(pvResults)); | ||
796 | break; | ||
797 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE: | ||
798 | hr = BalBaseBAProcOnCacheComplete(pBA, reinterpret_cast<BA_ONCACHECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECOMPLETE_RESULTS*>(pvResults)); | ||
799 | break; | ||
800 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN: | ||
801 | hr = BalBaseBAProcOnExecuteBegin(pBA, reinterpret_cast<BA_ONEXECUTEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEBEGIN_RESULTS*>(pvResults)); | ||
802 | break; | ||
803 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN: | ||
804 | hr = BalBaseBAProcOnExecutePackageBegin(pBA, reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGEBEGIN_RESULTS*>(pvResults)); | ||
805 | break; | ||
806 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET: | ||
807 | hr = BalBaseBAProcOnExecutePatchTarget(pBA, reinterpret_cast<BA_ONEXECUTEPATCHTARGET_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPATCHTARGET_RESULTS*>(pvResults)); | ||
808 | break; | ||
809 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS: | ||
810 | hr = BalBaseBAProcOnExecuteProgress(pBA, reinterpret_cast<BA_ONEXECUTEPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPROGRESS_RESULTS*>(pvResults)); | ||
811 | break; | ||
812 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE: | ||
813 | hr = BalBaseBAProcOnExecuteMsiMessage(pBA, reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEMSIMESSAGE_RESULTS*>(pvResults)); | ||
814 | break; | ||
815 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE: | ||
816 | hr = BalBaseBAProcOnExecuteFilesInUse(pBA, reinterpret_cast<BA_ONEXECUTEFILESINUSE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEFILESINUSE_RESULTS*>(pvResults)); | ||
817 | break; | ||
818 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE: | ||
819 | hr = BalBaseBAProcOnExecutePackageComplete(pBA, reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTEPACKAGECOMPLETE_RESULTS*>(pvResults)); | ||
820 | break; | ||
821 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE: | ||
822 | hr = BalBaseBAProcOnExecuteComplete(pBA, reinterpret_cast<BA_ONEXECUTECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONEXECUTECOMPLETE_RESULTS*>(pvResults)); | ||
823 | break; | ||
824 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN: | ||
825 | hr = BalBaseBAProcOnUnregisterBegin(pBA, reinterpret_cast<BA_ONUNREGISTERBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERBEGIN_RESULTS*>(pvResults)); | ||
826 | break; | ||
827 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE: | ||
828 | hr = BalBaseBAProcOnUnregisterComplete(pBA, reinterpret_cast<BA_ONUNREGISTERCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONUNREGISTERCOMPLETE_RESULTS*>(pvResults)); | ||
829 | break; | ||
830 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE: | ||
831 | hr = BalBaseBAProcOnApplyComplete(pBA, reinterpret_cast<BA_ONAPPLYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYCOMPLETE_RESULTS*>(pvResults)); | ||
832 | break; | ||
833 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN: | ||
834 | hr = BalBaseBAProcOnLaunchApprovedExeBegin(pBA, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS*>(pvResults)); | ||
835 | break; | ||
836 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE: | ||
837 | hr = BalBaseBAProcOnLaunchApprovedExeComplete(pBA, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS*>(pvResults)); | ||
838 | break; | ||
839 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE: | ||
840 | hr = BalBaseBAProcOnPlanMsiPackage(pBA, reinterpret_cast<BA_ONPLANMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIPACKAGE_RESULTS*>(pvResults)); | ||
841 | break; | ||
842 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN: | ||
843 | hr = BalBaseBAProcOnBeginMsiTransactionBegin(pBA, reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS*>(pvResults)); | ||
844 | break; | ||
845 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE: | ||
846 | hr = BalBaseBAProcOnBeginMsiTransactionComplete(pBA, reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults)); | ||
847 | break; | ||
848 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN: | ||
849 | hr = BalBaseBAProcOnCommitMsiTransactionBegin(pBA, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS*>(pvResults)); | ||
850 | break; | ||
851 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE: | ||
852 | hr = BalBaseBAProcOnCommitMsiTransactionComplete(pBA, reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults)); | ||
853 | break; | ||
854 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN: | ||
855 | hr = BalBaseBAProcOnRollbackMsiTransactionBegin(pBA, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS*>(pvResults)); | ||
856 | break; | ||
857 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE: | ||
858 | hr = BalBaseBAProcOnRollbackMsiTransactionComplete(pBA, reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS*>(pvResults)); | ||
859 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESBEGIN: | ||
860 | hr = BalBaseBAProcOnPauseAutomaticUpdatesBegin(pBA, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESBEGIN_RESULTS*>(pvResults)); | ||
861 | break; | ||
862 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPAUSEAUTOMATICUPDATESCOMPLETE: | ||
863 | hr = BalBaseBAProcOnPauseAutomaticUpdatesComplete(pBA, reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPAUSEAUTOMATICUPDATESCOMPLETE_RESULTS*>(pvResults)); | ||
864 | break; | ||
865 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN: | ||
866 | hr = BalBaseBAProcOnSystemRestorePointBegin(pBA, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTBEGIN_RESULTS*>(pvResults)); | ||
867 | break; | ||
868 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE: | ||
869 | hr = BalBaseBAProcOnSystemRestorePointComplete(pBA, reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONSYSTEMRESTOREPOINTCOMPLETE_RESULTS*>(pvResults)); | ||
870 | break; | ||
871 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE: | ||
872 | hr = BalBaseBAProcOnPlannedPackage(pBA, reinterpret_cast<BA_ONPLANNEDPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDPACKAGE_RESULTS*>(pvResults)); | ||
873 | break; | ||
874 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE: | ||
875 | hr = BalBaseBAProcOnPlanForwardCompatibleBundle(pBA, reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS*>(pvResults)); | ||
876 | break; | ||
877 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN: | ||
878 | hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS*>(pvResults)); | ||
879 | break; | ||
880 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS: | ||
881 | hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS*>(pvResults)); | ||
882 | break; | ||
883 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE: | ||
884 | hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete(pBA, reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS*>(pvResults)); | ||
885 | break; | ||
886 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN: | ||
887 | hr = BalBaseBAProcOnCachePayloadExtractBegin(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS*>(pvResults)); | ||
888 | break; | ||
889 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS: | ||
890 | hr = BalBaseBAProcOnCachePayloadExtractProgress(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS*>(pvResults)); | ||
891 | break; | ||
892 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE: | ||
893 | hr = BalBaseBAProcOnCachePayloadExtractComplete(pBA, reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS*>(pvResults)); | ||
894 | break; | ||
895 | } | ||
896 | } | ||
897 | |||
898 | pBA->BAProcFallback(message, pvArgs, pvResults, &hr, pvContext); | ||
899 | |||
900 | return hr; | ||
901 | } | ||
diff --git a/src/api/burn/balutil/inc/BalBootstrapperEngine.h b/src/api/burn/balutil/inc/BalBootstrapperEngine.h new file mode 100644 index 00000000..45131d98 --- /dev/null +++ b/src/api/burn/balutil/inc/BalBootstrapperEngine.h | |||
@@ -0,0 +1,17 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #ifdef __cplusplus | ||
4 | extern "C" { | ||
5 | #endif | ||
6 | |||
7 | // function declarations | ||
8 | |||
9 | HRESULT BalBootstrapperEngineCreate( | ||
10 | __in PFN_BOOTSTRAPPER_ENGINE_PROC pfnBAEngineProc, | ||
11 | __in_opt LPVOID pvBAEngineProcContext, | ||
12 | __out IBootstrapperEngine** ppEngineForApplication | ||
13 | ); | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | } | ||
17 | #endif | ||
diff --git a/src/api/burn/balutil/inc/IBAFunctions.h b/src/api/burn/balutil/inc/IBAFunctions.h new file mode 100644 index 00000000..7d8a07fa --- /dev/null +++ b/src/api/burn/balutil/inc/IBAFunctions.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | DECLARE_INTERFACE_IID_(IBAFunctions, IBootstrapperApplication, "0FB445ED-17BD-49C7-BE19-479776F8AE96") | ||
6 | { | ||
7 | // OnThemeLoaded - Called after the BA finished loading all the controls for the theme. | ||
8 | // | ||
9 | STDMETHOD(OnThemeLoaded)( | ||
10 | THEME* pTheme, | ||
11 | WIX_LOCALIZATION* pWixLoc | ||
12 | ) = 0; | ||
13 | |||
14 | // WndProc - Called if the BA hasn't handled the message. | ||
15 | // The implementation must either return E_NOTIMPL or call ThemeDefWindowProc for unhandled messages. | ||
16 | // | ||
17 | STDMETHOD(WndProc)( | ||
18 | __in THEME* pTheme, | ||
19 | __in HWND hWnd, | ||
20 | __in UINT uMsg, | ||
21 | __in WPARAM wParam, | ||
22 | __in LPARAM lParam, | ||
23 | __inout LRESULT* plRes | ||
24 | ) = 0; | ||
25 | |||
26 | // BAFunctionsProc - The PFN_BA_FUNCTIONS_PROC can call this method to give the BAFunctions raw access to the callback from WixStdBA. | ||
27 | // This might be used to help the BAFunctions support more than one version of the engine/WixStdBA. | ||
28 | STDMETHOD(BAFunctionsProc)( | ||
29 | __in BA_FUNCTIONS_MESSAGE message, | ||
30 | __in const LPVOID pvArgs, | ||
31 | __inout LPVOID pvResults, | ||
32 | __in_opt LPVOID pvContext | ||
33 | ) = 0; | ||
34 | }; | ||
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h new file mode 100644 index 00000000..c284cb49 --- /dev/null +++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h | |||
@@ -0,0 +1,649 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-AB06-099D717C67FE") | ||
6 | { | ||
7 | // BAProc - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method to give the BA raw access to the callback from the engine. | ||
8 | // This might be used to help the BA support more than one version of the engine. | ||
9 | STDMETHOD(BAProc)( | ||
10 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
11 | __in const LPVOID pvArgs, | ||
12 | __inout LPVOID pvResults, | ||
13 | __in_opt LPVOID pvContext | ||
14 | ) = 0; | ||
15 | |||
16 | // BAProcFallback - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method | ||
17 | // to give the BA the ability to use default behavior | ||
18 | // and then forward the message to extensions. | ||
19 | STDMETHOD_(void, BAProcFallback)( | ||
20 | __in BOOTSTRAPPER_APPLICATION_MESSAGE message, | ||
21 | __in const LPVOID pvArgs, | ||
22 | __inout LPVOID pvResults, | ||
23 | __inout HRESULT* phr, | ||
24 | __in_opt LPVOID pvContext | ||
25 | ) = 0; | ||
26 | |||
27 | // OnStartup - called when the engine is ready for the bootstrapper application to start. | ||
28 | // | ||
29 | STDMETHOD(OnStartup)() = 0; | ||
30 | |||
31 | // OnShutdown - called after the bootstrapper application quits the engine. | ||
32 | STDMETHOD(OnShutdown)( | ||
33 | __inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction | ||
34 | ) = 0; | ||
35 | |||
36 | // OnSystemShutdown - called when the operating system is instructed to shutdown the machine. | ||
37 | STDMETHOD(OnSystemShutdown)( | ||
38 | __in DWORD dwEndSession, | ||
39 | __inout BOOL* pfCancel | ||
40 | ) = 0; | ||
41 | |||
42 | // OnDetectBegin - called when the engine begins detection. | ||
43 | STDMETHOD(OnDetectBegin)( | ||
44 | __in BOOL fCached, | ||
45 | __in BOOL fInstalled, | ||
46 | __in DWORD cPackages, | ||
47 | __inout BOOL* pfCancel | ||
48 | ) = 0; | ||
49 | |||
50 | // OnDetectForwardCompatibleBundle - called when the engine detects a forward compatible bundle. | ||
51 | STDMETHOD(OnDetectForwardCompatibleBundle)( | ||
52 | __in_z LPCWSTR wzBundleId, | ||
53 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
54 | __in_z LPCWSTR wzBundleTag, | ||
55 | __in BOOL fPerMachine, | ||
56 | __in_z LPCWSTR wzVersion, | ||
57 | __in BOOL fMissingFromCache, | ||
58 | __inout BOOL* pfCancel | ||
59 | ) = 0; | ||
60 | |||
61 | // OnDetectUpdateBegin - called when the engine begins detection for bundle update. | ||
62 | STDMETHOD(OnDetectUpdateBegin)( | ||
63 | __in_z LPCWSTR wzUpdateLocation, | ||
64 | __inout BOOL* pfCancel, | ||
65 | __inout BOOL* pfSkip | ||
66 | ) = 0; | ||
67 | |||
68 | // OnDetectUpdate - called when the engine has an update candidate for bundle update. | ||
69 | STDMETHOD(OnDetectUpdate)( | ||
70 | __in_z_opt LPCWSTR wzUpdateLocation, | ||
71 | __in DWORD64 dw64Size, | ||
72 | __in_z LPCWSTR wzVersion, | ||
73 | __in_z_opt LPCWSTR wzTitle, | ||
74 | __in_z_opt LPCWSTR wzSummary, | ||
75 | __in_z_opt LPCWSTR wzContentType, | ||
76 | __in_z_opt LPCWSTR wzContent, | ||
77 | __inout BOOL* pfCancel, | ||
78 | __inout BOOL* pfStopProcessingUpdates | ||
79 | ) = 0; | ||
80 | |||
81 | // OnDetectUpdateComplete - called when the engine completes detection for bundle update. | ||
82 | STDMETHOD(OnDetectUpdateComplete)( | ||
83 | __in HRESULT hrStatus, | ||
84 | __inout BOOL* pfIgnoreError | ||
85 | ) = 0; | ||
86 | |||
87 | // OnDetectRelatedBundle - called when the engine detects a related bundle. | ||
88 | STDMETHOD(OnDetectRelatedBundle)( | ||
89 | __in_z LPCWSTR wzBundleId, | ||
90 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
91 | __in_z LPCWSTR wzBundleTag, | ||
92 | __in BOOL fPerMachine, | ||
93 | __in_z LPCWSTR wzVersion, | ||
94 | __in BOOTSTRAPPER_RELATED_OPERATION operation, | ||
95 | __in BOOL fMissingFromCache, | ||
96 | __inout BOOL* pfCancel | ||
97 | ) = 0; | ||
98 | |||
99 | // OnDetectPackageBegin - called when the engine begins detecting a package. | ||
100 | STDMETHOD(OnDetectPackageBegin)( | ||
101 | __in_z LPCWSTR wzPackageId, | ||
102 | __inout BOOL* pfCancel | ||
103 | ) = 0; | ||
104 | |||
105 | // OnDetectRelatedMsiPackage - called when the engine begins detects a related package. | ||
106 | STDMETHOD(OnDetectRelatedMsiPackage)( | ||
107 | __in_z LPCWSTR wzPackageId, | ||
108 | __in_z LPCWSTR wzUpgradeCode, | ||
109 | __in_z LPCWSTR wzProductCode, | ||
110 | __in BOOL fPerMachine, | ||
111 | __in_z LPCWSTR wzVersion, | ||
112 | __in BOOTSTRAPPER_RELATED_OPERATION operation, | ||
113 | __inout BOOL* pfCancel | ||
114 | ) = 0; | ||
115 | |||
116 | // OnDetectPatchTarget - called when the engine detects a target product | ||
117 | // for an MSP package. | ||
118 | STDMETHOD(OnDetectPatchTarget)( | ||
119 | __in_z LPCWSTR wzPackageId, | ||
120 | __in_z LPCWSTR wzProductCode, | ||
121 | __in BOOTSTRAPPER_PACKAGE_STATE patchState, | ||
122 | __inout BOOL* pfCancel | ||
123 | ) = 0; | ||
124 | |||
125 | // OnDetectMsiFeature - called when the engine detects a feature in an MSI package. | ||
126 | STDMETHOD(OnDetectMsiFeature)( | ||
127 | __in_z LPCWSTR wzPackageId, | ||
128 | __in_z LPCWSTR wzFeatureId, | ||
129 | __in BOOTSTRAPPER_FEATURE_STATE state, | ||
130 | __inout BOOL* pfCancel | ||
131 | ) = 0; | ||
132 | |||
133 | // OnDetectPackageComplete - called after the engine detects a package. | ||
134 | // | ||
135 | STDMETHOD(OnDetectPackageComplete)( | ||
136 | __in_z LPCWSTR wzPackageId, | ||
137 | __in HRESULT hrStatus, | ||
138 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
139 | __in BOOL fCached | ||
140 | ) = 0; | ||
141 | |||
142 | // OnDetectPackageComplete - called after the engine completes detection. | ||
143 | // | ||
144 | STDMETHOD(OnDetectComplete)( | ||
145 | __in HRESULT hrStatus, | ||
146 | __in BOOL fEligibleForCleanup | ||
147 | ) = 0; | ||
148 | |||
149 | // OnPlanBegin - called when the engine begins planning. | ||
150 | STDMETHOD(OnPlanBegin)( | ||
151 | __in DWORD cPackages, | ||
152 | __inout BOOL* pfCancel | ||
153 | ) = 0; | ||
154 | |||
155 | // OnPlanRelatedBundle - called when the engine begins planning a related bundle. | ||
156 | STDMETHOD(OnPlanRelatedBundle)( | ||
157 | __in_z LPCWSTR wzBundleId, | ||
158 | __in BOOTSTRAPPER_REQUEST_STATE recommendedState, | ||
159 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
160 | __inout BOOL* pfCancel | ||
161 | ) = 0; | ||
162 | |||
163 | // OnPlanPackageBegin - called when the engine has begun getting the BA's input | ||
164 | // for planning a package. | ||
165 | STDMETHOD(OnPlanPackageBegin)( | ||
166 | __in_z LPCWSTR wzPackageId, | ||
167 | __in BOOTSTRAPPER_PACKAGE_STATE state, | ||
168 | __in BOOL fCached, | ||
169 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | ||
170 | __in BOOTSTRAPPER_REQUEST_STATE recommendedState, | ||
171 | __in BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, | ||
172 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
173 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType, | ||
174 | __inout BOOL* pfCancel | ||
175 | ) = 0; | ||
176 | |||
177 | // OnPlanPatchTarget - called when the engine is about to plan a target | ||
178 | // of an MSP package. | ||
179 | STDMETHOD(OnPlanPatchTarget)( | ||
180 | __in_z LPCWSTR wzPackageId, | ||
181 | __in_z LPCWSTR wzProductCode, | ||
182 | __in BOOTSTRAPPER_REQUEST_STATE recommendedState, | ||
183 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | ||
184 | __inout BOOL* pfCancel | ||
185 | ) = 0; | ||
186 | |||
187 | // OnPlanMsiFeature - called when the engine plans a feature in an | ||
188 | // MSI package. | ||
189 | STDMETHOD(OnPlanMsiFeature)( | ||
190 | __in_z LPCWSTR wzPackageId, | ||
191 | __in_z LPCWSTR wzFeatureId, | ||
192 | __in BOOTSTRAPPER_FEATURE_STATE recommendedState, | ||
193 | __inout BOOTSTRAPPER_FEATURE_STATE* pRequestedState, | ||
194 | __inout BOOL* pfCancel | ||
195 | ) = 0; | ||
196 | |||
197 | // OnPlanMsiPackage - called when the engine plans an MSI or MSP package. | ||
198 | // | ||
199 | STDMETHOD(OnPlanMsiPackage)( | ||
200 | __in_z LPCWSTR wzPackageId, | ||
201 | __in BOOL fExecute, // false means rollback. | ||
202 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
203 | __inout BOOL* pfCancel, | ||
204 | __inout BURN_MSI_PROPERTY* pActionMsiProperty, | ||
205 | __inout INSTALLUILEVEL* pUiLevel, | ||
206 | __inout BOOL* pfDisableExternalUiHandler | ||
207 | ) = 0; | ||
208 | |||
209 | // OnPlanPackageComplete - called after the engine has completed getting the BA's input | ||
210 | // for planning a package. | ||
211 | STDMETHOD(OnPlanPackageComplete)( | ||
212 | __in_z LPCWSTR wzPackageId, | ||
213 | __in HRESULT hrStatus, | ||
214 | __in BOOTSTRAPPER_REQUEST_STATE requested | ||
215 | ) = 0; | ||
216 | |||
217 | // OnPlannedPackage - called after the engine has completed planning a package. | ||
218 | STDMETHOD(OnPlannedPackage)( | ||
219 | __in_z LPCWSTR wzPackageId, | ||
220 | __in BOOTSTRAPPER_ACTION_STATE execute, | ||
221 | __in BOOTSTRAPPER_ACTION_STATE rollback, | ||
222 | __in BOOL fPlannedCache, | ||
223 | __in BOOL fPlannedUncache | ||
224 | ) = 0; | ||
225 | |||
226 | // OnPlanComplete - called when the engine completes planning. | ||
227 | // | ||
228 | STDMETHOD(OnPlanComplete)( | ||
229 | __in HRESULT hrStatus | ||
230 | ) = 0; | ||
231 | |||
232 | // OnApplyBegin - called when the engine begins applying the plan. | ||
233 | // | ||
234 | STDMETHOD(OnApplyBegin)( | ||
235 | __in DWORD dwPhaseCount, | ||
236 | __inout BOOL* pfCancel | ||
237 | ) = 0; | ||
238 | |||
239 | // OnElevateBegin - called before the engine displays an elevation prompt. | ||
240 | // Will only happen once per execution of the engine, | ||
241 | // assuming the elevation was successful. | ||
242 | STDMETHOD(OnElevateBegin)( | ||
243 | __inout BOOL* pfCancel | ||
244 | ) = 0; | ||
245 | |||
246 | // OnElevateComplete - called after the engine attempted to elevate. | ||
247 | // | ||
248 | STDMETHOD(OnElevateComplete)( | ||
249 | __in HRESULT hrStatus | ||
250 | ) = 0; | ||
251 | |||
252 | // OnProgress - called when the engine makes progress. | ||
253 | // | ||
254 | STDMETHOD(OnProgress)( | ||
255 | __in DWORD dwProgressPercentage, | ||
256 | __in DWORD dwOverallPercentage, | ||
257 | __inout BOOL* pfCancel | ||
258 | ) = 0; | ||
259 | |||
260 | // OnError - called when the engine encounters an error. | ||
261 | // | ||
262 | // nResult: | ||
263 | // uiFlags is a combination of valid ID* return values appropriate for | ||
264 | // the error. | ||
265 | // | ||
266 | // IDNOACTION instructs the engine to pass the error through to default | ||
267 | // handling which usually results in the apply failing. | ||
268 | STDMETHOD(OnError)( | ||
269 | __in BOOTSTRAPPER_ERROR_TYPE errorType, | ||
270 | __in_z_opt LPCWSTR wzPackageId, | ||
271 | __in DWORD dwCode, | ||
272 | __in_z_opt LPCWSTR wzError, | ||
273 | __in DWORD dwUIHint, | ||
274 | __in DWORD cData, | ||
275 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
276 | __in int nRecommendation, | ||
277 | __inout int* pResult | ||
278 | ) = 0; | ||
279 | |||
280 | // OnRegisterBegin - called when the engine registers the bundle. | ||
281 | // | ||
282 | STDMETHOD(OnRegisterBegin)( | ||
283 | __inout BOOL* pfCancel | ||
284 | ) = 0; | ||
285 | |||
286 | // OnRegisterComplete - called when the engine registration is | ||
287 | // complete. | ||
288 | // | ||
289 | STDMETHOD(OnRegisterComplete)( | ||
290 | __in HRESULT hrStatus | ||
291 | ) = 0; | ||
292 | |||
293 | // OnCacheBegin - called when the engine begins caching. | ||
294 | // | ||
295 | STDMETHOD(OnCacheBegin)( | ||
296 | __inout BOOL* pfCancel | ||
297 | ) = 0; | ||
298 | |||
299 | // OnCachePackageBegin - called when the engine begins caching | ||
300 | // a package. | ||
301 | // | ||
302 | STDMETHOD(OnCachePackageBegin)( | ||
303 | __in_z LPCWSTR wzPackageId, | ||
304 | __in DWORD cCachePayloads, | ||
305 | __in DWORD64 dw64PackageCacheSize, | ||
306 | __inout BOOL* pfCancel | ||
307 | ) = 0; | ||
308 | |||
309 | // OnCacheAcquireBegin - called when the engine begins acquiring a payload or container. | ||
310 | // | ||
311 | // Notes: | ||
312 | // It is expected the BA may call IBootstrapperEngine::SetLocalSource() or IBootstrapperEngine::SetDownloadSource() | ||
313 | // to update the source location before returning. | ||
314 | // | ||
315 | STDMETHOD(OnCacheAcquireBegin)( | ||
316 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
317 | __in_z_opt LPCWSTR wzPayloadId, | ||
318 | __in_z LPCWSTR wzSource, | ||
319 | __in_z_opt LPCWSTR wzDownloadUrl, | ||
320 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
321 | __in BOOTSTRAPPER_CACHE_OPERATION recommendation, | ||
322 | __inout BOOTSTRAPPER_CACHE_OPERATION* pAction, | ||
323 | __inout BOOL* pfCancel | ||
324 | ) = 0; | ||
325 | |||
326 | // OnCacheAcquireProgress - called when the engine makes progress acquiring the payload or container. | ||
327 | // | ||
328 | STDMETHOD(OnCacheAcquireProgress)( | ||
329 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
330 | __in_z_opt LPCWSTR wzPayloadId, | ||
331 | __in DWORD64 dw64Progress, | ||
332 | __in DWORD64 dw64Total, | ||
333 | __in DWORD dwOverallPercentage, | ||
334 | __inout BOOL* pfCancel | ||
335 | ) = 0; | ||
336 | |||
337 | // OnCacheAcquireResolving - called to allow the BA to override the acquisition action for the payload or container. | ||
338 | // | ||
339 | // Parameters: | ||
340 | // wzPackageOrContainerId will be NULL when resolving a layout-only payload. | ||
341 | // wzPayloadId will be NULL when resolving a container. | ||
342 | // wzDownloadUrl will be NULL if the container or payload does not provide a DownloadURL. | ||
343 | // wzPayloadContainerId will not be NULL if acquiring a payload that is in a container. | ||
344 | // | ||
345 | // rgSearchPaths are the search paths used for source resolution. | ||
346 | // fFoundLocal is TRUE when dwRecommendedSearchPath indicates that the file was found. | ||
347 | // dwRecommendedSearchPath is the index into rgSearchPaths for the recommended local file. | ||
348 | // | ||
349 | STDMETHOD(OnCacheAcquireResolving)( | ||
350 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
351 | __in_z_opt LPCWSTR wzPayloadId, | ||
352 | __in_z LPCWSTR* rgSearchPaths, | ||
353 | __in DWORD cSearchPaths, | ||
354 | __in BOOL fFoundLocal, | ||
355 | __in DWORD dwRecommendedSearchPath, | ||
356 | __in_z_opt LPCWSTR wzDownloadUrl, | ||
357 | __in_z_opt LPCWSTR wzPayloadContainerId, | ||
358 | __in BOOTSTRAPPER_CACHE_RESOLVE_OPERATION recommendation, | ||
359 | __inout DWORD* pdwChosenSearchPath, | ||
360 | __inout BOOTSTRAPPER_CACHE_RESOLVE_OPERATION* pAction, | ||
361 | __inout BOOL* pfCancel | ||
362 | ) = 0; | ||
363 | |||
364 | // OnCacheAcquireComplete - called after the engine acquired the payload or container. | ||
365 | // | ||
366 | // Notes: | ||
367 | // It is expected the BA may call IBootstrapperEngine::SetLocalSource() or IBootstrapperEngine::SetDownloadSource() | ||
368 | // to update the source location before returning BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY. | ||
369 | // | ||
370 | STDMETHOD(OnCacheAcquireComplete)( | ||
371 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
372 | __in_z_opt LPCWSTR wzPayloadId, | ||
373 | __in HRESULT hrStatus, | ||
374 | __in BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, | ||
375 | __inout BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION* pAction | ||
376 | ) = 0; | ||
377 | |||
378 | // OnCacheVerifyBegin - called when the engine begins to verify then copy | ||
379 | // a payload or container to the package cache folder. | ||
380 | // | ||
381 | STDMETHOD(OnCacheVerifyBegin)( | ||
382 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
383 | __in_z_opt LPCWSTR wzPayloadId, | ||
384 | __inout BOOL* pfCancel | ||
385 | ) = 0; | ||
386 | |||
387 | STDMETHOD(OnCacheVerifyProgress)( | ||
388 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
389 | __in_z_opt LPCWSTR wzPayloadId, | ||
390 | __in DWORD64 dw64Progress, | ||
391 | __in DWORD64 dw64Total, | ||
392 | __in DWORD dwOverallPercentage, | ||
393 | __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep, | ||
394 | __inout BOOL* pfCancel | ||
395 | ) = 0; | ||
396 | |||
397 | // OnCacheVerifyComplete - called after the engine verifies and copies | ||
398 | // a payload or container to the package cache folder. | ||
399 | // | ||
400 | STDMETHOD(OnCacheVerifyComplete)( | ||
401 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
402 | __in_z_opt LPCWSTR wzPayloadId, | ||
403 | __in HRESULT hrStatus, | ||
404 | __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, | ||
405 | __inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction | ||
406 | ) = 0; | ||
407 | |||
408 | // OnCachePackageComplete - called after the engine attempts to copy or download all | ||
409 | // payloads of a package into the package cache folder. | ||
410 | // | ||
411 | STDMETHOD(OnCachePackageComplete)( | ||
412 | __in_z LPCWSTR wzPackageId, | ||
413 | __in HRESULT hrStatus, | ||
414 | __in BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, | ||
415 | __inout BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION* pAction | ||
416 | ) = 0; | ||
417 | |||
418 | // OnCacheComplete - called when the engine caching is complete. | ||
419 | // | ||
420 | STDMETHOD(OnCacheComplete)( | ||
421 | __in HRESULT hrStatus | ||
422 | ) = 0; | ||
423 | |||
424 | // OnExecuteBegin - called when the engine begins executing the plan. | ||
425 | // | ||
426 | STDMETHOD(OnExecuteBegin)( | ||
427 | __in DWORD cExecutingPackages, | ||
428 | __inout BOOL* pfCancel | ||
429 | ) = 0; | ||
430 | |||
431 | // OnExecutePackageBegin - called when the engine begins executing a package. | ||
432 | // | ||
433 | STDMETHOD(OnExecutePackageBegin)( | ||
434 | __in_z LPCWSTR wzPackageId, | ||
435 | __in BOOL fExecute, // false means rollback. | ||
436 | __in BOOTSTRAPPER_ACTION_STATE action, | ||
437 | __in INSTALLUILEVEL uiLevel, | ||
438 | __in BOOL fDisableExternalUiHandler, | ||
439 | __inout BOOL* pfCancel | ||
440 | ) = 0; | ||
441 | |||
442 | // OnExecutePatchTarget - called for each patch in an MspPackage targeting the product | ||
443 | // when the engine begins executing the MspPackage. | ||
444 | // | ||
445 | STDMETHOD(OnExecutePatchTarget)( | ||
446 | __in_z LPCWSTR wzPackageId, | ||
447 | __in_z LPCWSTR wzTargetProductCode, | ||
448 | __inout BOOL* pfCancel | ||
449 | ) = 0; | ||
450 | |||
451 | // OnExecuteProgress - called when the engine makes progress executing a package. | ||
452 | // | ||
453 | STDMETHOD(OnExecuteProgress)( | ||
454 | __in_z LPCWSTR wzPackageId, | ||
455 | __in DWORD dwProgressPercentage, | ||
456 | __in DWORD dwOverallPercentage, | ||
457 | __inout BOOL* pfCancel | ||
458 | ) = 0; | ||
459 | |||
460 | // OnExecuteMsiMessage - called when the engine receives an MSI package message. | ||
461 | // | ||
462 | // Return: | ||
463 | // uiFlags is a combination of valid ID* return values appropriate for | ||
464 | // the message. | ||
465 | // | ||
466 | // IDNOACTION instructs the engine to pass the message through to default | ||
467 | // handling which usually results in the execution continuing. | ||
468 | STDMETHOD(OnExecuteMsiMessage)( | ||
469 | __in_z LPCWSTR wzPackageId, | ||
470 | __in INSTALLMESSAGE messageType, | ||
471 | __in DWORD dwUIHint, | ||
472 | __in_z LPCWSTR wzMessage, | ||
473 | __in DWORD cData, | ||
474 | __in_ecount_z_opt(cData) LPCWSTR* rgwzData, | ||
475 | __in int nRecommendation, | ||
476 | __inout int* pResult | ||
477 | ) = 0; | ||
478 | |||
479 | // OnExecuteFilesInUse - called when the engine encounters files in use while | ||
480 | // executing a package. | ||
481 | // | ||
482 | // Return: | ||
483 | // IDOK instructs the engine to let the Restart Manager attempt to close the | ||
484 | // applications to avoid a restart. | ||
485 | // | ||
486 | // IDCANCEL instructs the engine to abort the execution and start rollback. | ||
487 | // | ||
488 | // IDIGNORE instructs the engine to ignore the running applications. A restart will be | ||
489 | // required. | ||
490 | // | ||
491 | // IDRETRY instructs the engine to check if the applications are still running again. | ||
492 | // | ||
493 | // IDNOACTION is equivalent to ignoring the running applications. A restart will be | ||
494 | // required. | ||
495 | STDMETHOD(OnExecuteFilesInUse)( | ||
496 | __in_z LPCWSTR wzPackageId, | ||
497 | __in DWORD cFiles, | ||
498 | __in_ecount_z(cFiles) LPCWSTR* rgwzFiles, | ||
499 | __in int nRecommendation, | ||
500 | __inout int* pResult | ||
501 | ) = 0; | ||
502 | |||
503 | // OnExecutePackageComplete - called when a package execution is complete. | ||
504 | // | ||
505 | STDMETHOD(OnExecutePackageComplete)( | ||
506 | __in_z LPCWSTR wzPackageId, | ||
507 | __in HRESULT hrStatus, | ||
508 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
509 | __in BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, | ||
510 | __inout BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION* pAction | ||
511 | ) = 0; | ||
512 | |||
513 | // OnExecuteComplete - called when the engine execution is complete. | ||
514 | // | ||
515 | STDMETHOD(OnExecuteComplete)( | ||
516 | __in HRESULT hrStatus | ||
517 | ) = 0; | ||
518 | |||
519 | // OnUnregisterBegin - called when the engine unregisters the bundle. | ||
520 | // | ||
521 | STDMETHOD(OnUnregisterBegin)( | ||
522 | __in BOOL fKeepRegistration, | ||
523 | __inout BOOL* pfForceKeepRegistration | ||
524 | ) = 0; | ||
525 | |||
526 | // OnUnregisterComplete - called when the engine unregistration is complete. | ||
527 | // | ||
528 | STDMETHOD(OnUnregisterComplete)( | ||
529 | __in HRESULT hrStatus | ||
530 | ) = 0; | ||
531 | |||
532 | // OnApplyComplete - called after the plan has been applied. | ||
533 | // | ||
534 | STDMETHOD(OnApplyComplete)( | ||
535 | __in HRESULT hrStatus, | ||
536 | __in BOOTSTRAPPER_APPLY_RESTART restart, | ||
537 | __in BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, | ||
538 | __inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction | ||
539 | ) = 0; | ||
540 | |||
541 | // OnLaunchApprovedExeBegin - called before trying to launch the preapproved executable. | ||
542 | // | ||
543 | STDMETHOD(OnLaunchApprovedExeBegin)( | ||
544 | __inout BOOL* pfCancel | ||
545 | ) = 0; | ||
546 | |||
547 | // OnLaunchApprovedExeComplete - called after trying to launch the preapproved executable. | ||
548 | // | ||
549 | STDMETHOD(OnLaunchApprovedExeComplete)( | ||
550 | __in HRESULT hrStatus, | ||
551 | __in DWORD dwProcessId | ||
552 | ) = 0; | ||
553 | |||
554 | STDMETHOD(OnBeginMsiTransactionBegin)( | ||
555 | __in_z LPCWSTR wzTransactionId, | ||
556 | __inout BOOL* pfCancel | ||
557 | ) = 0; | ||
558 | |||
559 | STDMETHOD(OnBeginMsiTransactionComplete)( | ||
560 | __in_z LPCWSTR wzTransactionId, | ||
561 | __in HRESULT hrStatus | ||
562 | ) = 0; | ||
563 | |||
564 | STDMETHOD(OnCommitMsiTransactionBegin)( | ||
565 | __in_z LPCWSTR wzTransactionId, | ||
566 | __inout BOOL* pfCancel | ||
567 | ) = 0; | ||
568 | |||
569 | STDMETHOD(OnCommitMsiTransactionComplete)( | ||
570 | __in_z LPCWSTR wzTransactionId, | ||
571 | __in HRESULT hrStatus | ||
572 | ) = 0; | ||
573 | |||
574 | STDMETHOD(OnRollbackMsiTransactionBegin)( | ||
575 | __in_z LPCWSTR wzTransactionId | ||
576 | ) = 0; | ||
577 | |||
578 | STDMETHOD(OnRollbackMsiTransactionComplete)( | ||
579 | __in_z LPCWSTR wzTransactionId, | ||
580 | __in HRESULT hrStatus | ||
581 | ) = 0; | ||
582 | |||
583 | STDMETHOD(OnPauseAutomaticUpdatesBegin)( | ||
584 | ) = 0; | ||
585 | |||
586 | STDMETHOD(OnPauseAutomaticUpdatesComplete)( | ||
587 | __in HRESULT hrStatus | ||
588 | ) = 0; | ||
589 | |||
590 | STDMETHOD(OnSystemRestorePointBegin)( | ||
591 | ) = 0; | ||
592 | |||
593 | STDMETHOD(OnSystemRestorePointComplete)( | ||
594 | __in HRESULT hrStatus | ||
595 | ) = 0; | ||
596 | |||
597 | STDMETHOD(OnPlanForwardCompatibleBundle)( | ||
598 | __in_z LPCWSTR wzBundleId, | ||
599 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
600 | __in_z LPCWSTR wzBundleTag, | ||
601 | __in BOOL fPerMachine, | ||
602 | __in_z LPCWSTR wzVersion, | ||
603 | __in BOOL fRecommendedIgnoreBundle, | ||
604 | __inout BOOL* pfCancel, | ||
605 | __inout BOOL* pfIgnoreBundle | ||
606 | ) = 0; | ||
607 | |||
608 | STDMETHOD(OnCacheContainerOrPayloadVerifyBegin)( | ||
609 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
610 | __in_z_opt LPCWSTR wzPayloadId, | ||
611 | __inout BOOL* pfCancel | ||
612 | ) = 0; | ||
613 | |||
614 | STDMETHOD(OnCacheContainerOrPayloadVerifyProgress)( | ||
615 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
616 | __in_z_opt LPCWSTR wzPayloadId, | ||
617 | __in DWORD64 dw64Progress, | ||
618 | __in DWORD64 dw64Total, | ||
619 | __in DWORD dwOverallPercentage, | ||
620 | __inout BOOL* pfCancel | ||
621 | ) = 0; | ||
622 | |||
623 | STDMETHOD(OnCacheContainerOrPayloadVerifyComplete)( | ||
624 | __in_z_opt LPCWSTR wzPackageOrContainerId, | ||
625 | __in_z_opt LPCWSTR wzPayloadId, | ||
626 | __in HRESULT hrStatus | ||
627 | ) = 0; | ||
628 | |||
629 | STDMETHOD(OnCachePayloadExtractBegin)( | ||
630 | __in_z_opt LPCWSTR wzContainerId, | ||
631 | __in_z_opt LPCWSTR wzPayloadId, | ||
632 | __inout BOOL* pfCancel | ||
633 | ) = 0; | ||
634 | |||
635 | STDMETHOD(OnCachePayloadExtractProgress)( | ||
636 | __in_z_opt LPCWSTR wzContainerId, | ||
637 | __in_z_opt LPCWSTR wzPayloadId, | ||
638 | __in DWORD64 dw64Progress, | ||
639 | __in DWORD64 dw64Total, | ||
640 | __in DWORD dwOverallPercentage, | ||
641 | __inout BOOL* pfCancel | ||
642 | ) = 0; | ||
643 | |||
644 | STDMETHOD(OnCachePayloadExtractComplete)( | ||
645 | __in_z_opt LPCWSTR wzContainerId, | ||
646 | __in_z_opt LPCWSTR wzPayloadId, | ||
647 | __in HRESULT hrStatus | ||
648 | ) = 0; | ||
649 | }; | ||
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h b/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h new file mode 100644 index 00000000..fd603e50 --- /dev/null +++ b/src/api/burn/balutil/inc/IBootstrapperApplicationFactory.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include "precomp.h" | ||
6 | |||
7 | DECLARE_INTERFACE_IID_(IBootstrapperApplicationFactory, IUnknown, "2965A12F-AC7B-43A0-85DF-E4B2168478A4") | ||
8 | { | ||
9 | STDMETHOD(Create)( | ||
10 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
11 | __inout BOOTSTRAPPER_CREATE_RESULTS *pResults | ||
12 | ); | ||
13 | }; | ||
diff --git a/src/api/burn/balutil/inc/IBootstrapperEngine.h b/src/api/burn/balutil/inc/IBootstrapperEngine.h new file mode 100644 index 00000000..ccb07f4f --- /dev/null +++ b/src/api/burn/balutil/inc/IBootstrapperEngine.h | |||
@@ -0,0 +1,140 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-81512C29C2FB") | ||
6 | { | ||
7 | STDMETHOD(GetPackageCount)( | ||
8 | __out DWORD* pcPackages | ||
9 | ) = 0; | ||
10 | |||
11 | STDMETHOD(GetVariableNumeric)( | ||
12 | __in_z LPCWSTR wzVariable, | ||
13 | __out LONGLONG* pllValue | ||
14 | ) = 0; | ||
15 | |||
16 | STDMETHOD(GetVariableString)( | ||
17 | __in_z LPCWSTR wzVariable, | ||
18 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
19 | __inout SIZE_T* pcchValue | ||
20 | ) = 0; | ||
21 | |||
22 | STDMETHOD(GetVariableVersion)( | ||
23 | __in_z LPCWSTR wzVariable, | ||
24 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
25 | __inout SIZE_T * pcchValue | ||
26 | ) = 0; | ||
27 | |||
28 | STDMETHOD(FormatString)( | ||
29 | __in_z LPCWSTR wzIn, | ||
30 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
31 | __inout SIZE_T * pcchOut | ||
32 | ) = 0; | ||
33 | |||
34 | STDMETHOD(EscapeString)( | ||
35 | __in_z LPCWSTR wzIn, | ||
36 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
37 | __inout SIZE_T * pcchOut | ||
38 | ) = 0; | ||
39 | |||
40 | STDMETHOD(EvaluateCondition)( | ||
41 | __in_z LPCWSTR wzCondition, | ||
42 | __out BOOL* pf | ||
43 | ) = 0; | ||
44 | |||
45 | STDMETHOD(Log)( | ||
46 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
47 | __in_z LPCWSTR wzMessage | ||
48 | ) = 0; | ||
49 | |||
50 | STDMETHOD(SendEmbeddedError)( | ||
51 | __in DWORD dwErrorCode, | ||
52 | __in_z_opt LPCWSTR wzMessage, | ||
53 | __in DWORD dwUIHint, | ||
54 | __out int* pnResult | ||
55 | ) = 0; | ||
56 | |||
57 | STDMETHOD(SendEmbeddedProgress)( | ||
58 | __in DWORD dwProgressPercentage, | ||
59 | __in DWORD dwOverallProgressPercentage, | ||
60 | __out int* pnResult | ||
61 | ) = 0; | ||
62 | |||
63 | STDMETHOD(SetUpdate)( | ||
64 | __in_z_opt LPCWSTR wzLocalSource, | ||
65 | __in_z_opt LPCWSTR wzDownloadSource, | ||
66 | __in DWORD64 qwSize, | ||
67 | __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashType, | ||
68 | __in_bcount_opt(cbHash) BYTE* rgbHash, | ||
69 | __in DWORD cbHash | ||
70 | ) = 0; | ||
71 | |||
72 | STDMETHOD(SetLocalSource)( | ||
73 | __in_z LPCWSTR wzPackageOrContainerId, | ||
74 | __in_z_opt LPCWSTR wzPayloadId, | ||
75 | __in_z LPCWSTR wzPath | ||
76 | ) = 0; | ||
77 | |||
78 | STDMETHOD(SetDownloadSource)( | ||
79 | __in_z LPCWSTR wzPackageOrContainerId, | ||
80 | __in_z_opt LPCWSTR wzPayloadId, | ||
81 | __in_z LPCWSTR wzUrl, | ||
82 | __in_z_opt LPCWSTR wzUser, | ||
83 | __in_z_opt LPCWSTR wzPassword | ||
84 | ) = 0; | ||
85 | |||
86 | STDMETHOD(SetVariableNumeric)( | ||
87 | __in_z LPCWSTR wzVariable, | ||
88 | __in LONGLONG llValue | ||
89 | ) = 0; | ||
90 | |||
91 | STDMETHOD(SetVariableString)( | ||
92 | __in_z LPCWSTR wzVariable, | ||
93 | __in_z_opt LPCWSTR wzValue, | ||
94 | __in BOOL fFormatted | ||
95 | ) = 0; | ||
96 | |||
97 | STDMETHOD(SetVariableVersion)( | ||
98 | __in_z LPCWSTR wzVariable, | ||
99 | __in_z_opt LPCWSTR wzValue | ||
100 | ) = 0; | ||
101 | |||
102 | STDMETHOD(CloseSplashScreen)() = 0; | ||
103 | |||
104 | STDMETHOD(Detect)( | ||
105 | __in_opt HWND hwndParent = NULL | ||
106 | ) = 0; | ||
107 | |||
108 | STDMETHOD(Plan)( | ||
109 | __in BOOTSTRAPPER_ACTION action | ||
110 | ) = 0; | ||
111 | |||
112 | STDMETHOD(Elevate)( | ||
113 | __in_opt HWND hwndParent | ||
114 | ) = 0; | ||
115 | |||
116 | STDMETHOD(Apply)( | ||
117 | __in HWND hwndParent | ||
118 | ) = 0; | ||
119 | |||
120 | STDMETHOD(Quit)( | ||
121 | __in DWORD dwExitCode | ||
122 | ) = 0; | ||
123 | |||
124 | STDMETHOD(LaunchApprovedExe)( | ||
125 | __in_opt HWND hwndParent, | ||
126 | __in_z LPCWSTR wzApprovedExeForElevationId, | ||
127 | __in_z_opt LPCWSTR wzArguments, | ||
128 | __in DWORD dwWaitForInputIdleTimeout | ||
129 | ) = 0; | ||
130 | |||
131 | STDMETHOD(SetUpdateSource)( | ||
132 | __in_z LPCWSTR wzUrl | ||
133 | ) = 0; | ||
134 | |||
135 | STDMETHOD(CompareVersions)( | ||
136 | __in_z LPCWSTR wzVersion1, | ||
137 | __in_z LPCWSTR wzVersion2, | ||
138 | __out int* pnResult | ||
139 | ) = 0; | ||
140 | }; | ||
diff --git a/src/api/burn/balutil/inc/balcondition.h b/src/api/burn/balutil/inc/balcondition.h new file mode 100644 index 00000000..677c593f --- /dev/null +++ b/src/api/burn/balutil/inc/balcondition.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | typedef struct _BAL_CONDITION | ||
10 | { | ||
11 | LPWSTR sczCondition; | ||
12 | LPWSTR sczMessage; | ||
13 | } BAL_CONDITION; | ||
14 | |||
15 | |||
16 | typedef struct _BAL_CONDITIONS | ||
17 | { | ||
18 | BAL_CONDITION* rgConditions; | ||
19 | DWORD cConditions; | ||
20 | } BAL_CONDITIONS; | ||
21 | |||
22 | |||
23 | /******************************************************************* | ||
24 | BalConditionsParseFromXml - loads the conditions from the UX manifest. | ||
25 | |||
26 | ********************************************************************/ | ||
27 | DAPI_(HRESULT) BalConditionsParseFromXml( | ||
28 | __in BAL_CONDITIONS* pConditions, | ||
29 | __in IXMLDOMDocument* pixdManifest, | ||
30 | __in_opt WIX_LOCALIZATION* pWixLoc | ||
31 | ); | ||
32 | |||
33 | |||
34 | /******************************************************************* | ||
35 | BalConditionEvaluate - evaluates condition against the provided IBurnCore. | ||
36 | |||
37 | NOTE: psczMessage is optional. | ||
38 | ********************************************************************/ | ||
39 | DAPI_(HRESULT) BalConditionEvaluate( | ||
40 | __in BAL_CONDITION* pCondition, | ||
41 | __in IBootstrapperEngine* pEngine, | ||
42 | __out BOOL* pfResult, | ||
43 | __out_z_opt LPWSTR* psczMessage | ||
44 | ); | ||
45 | |||
46 | |||
47 | /******************************************************************* | ||
48 | BalConditionsUninitialize - uninitializes any conditions previously loaded. | ||
49 | |||
50 | ********************************************************************/ | ||
51 | DAPI_(void) BalConditionsUninitialize( | ||
52 | __in BAL_CONDITIONS* pConditions | ||
53 | ); | ||
54 | |||
55 | |||
56 | #ifdef __cplusplus | ||
57 | } | ||
58 | #endif | ||
diff --git a/src/api/burn/balutil/inc/balinfo.h b/src/api/burn/balutil/inc/balinfo.h new file mode 100644 index 00000000..8c2155e9 --- /dev/null +++ b/src/api/burn/balutil/inc/balinfo.h | |||
@@ -0,0 +1,105 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | typedef enum BAL_INFO_PACKAGE_TYPE | ||
10 | { | ||
11 | BAL_INFO_PACKAGE_TYPE_UNKNOWN, | ||
12 | BAL_INFO_PACKAGE_TYPE_EXE, | ||
13 | BAL_INFO_PACKAGE_TYPE_MSI, | ||
14 | BAL_INFO_PACKAGE_TYPE_MSP, | ||
15 | BAL_INFO_PACKAGE_TYPE_MSU, | ||
16 | BAL_INFO_PACKAGE_TYPE_BUNDLE_UPGRADE, | ||
17 | BAL_INFO_PACKAGE_TYPE_BUNDLE_ADDON, | ||
18 | BAL_INFO_PACKAGE_TYPE_BUNDLE_PATCH, | ||
19 | } BAL_INFO_PACKAGE_TYPE; | ||
20 | |||
21 | |||
22 | typedef struct _BAL_INFO_PACKAGE | ||
23 | { | ||
24 | LPWSTR sczId; | ||
25 | LPWSTR sczDisplayName; | ||
26 | LPWSTR sczDescription; | ||
27 | BAL_INFO_PACKAGE_TYPE type; | ||
28 | BOOL fPermanent; | ||
29 | BOOL fVital; | ||
30 | LPWSTR sczDisplayInternalUICondition; | ||
31 | LPWSTR sczProductCode; | ||
32 | LPWSTR sczUpgradeCode; | ||
33 | LPWSTR sczVersion; | ||
34 | LPWSTR sczInstallCondition; | ||
35 | BOOTSTRAPPER_CACHE_TYPE cacheType; | ||
36 | BOOL fPrereqPackage; | ||
37 | LPWSTR sczPrereqLicenseFile; | ||
38 | LPWSTR sczPrereqLicenseUrl; | ||
39 | LPVOID pvCustomData; | ||
40 | } BAL_INFO_PACKAGE; | ||
41 | |||
42 | |||
43 | typedef struct _BAL_INFO_PACKAGES | ||
44 | { | ||
45 | BAL_INFO_PACKAGE* rgPackages; | ||
46 | DWORD cPackages; | ||
47 | } BAL_INFO_PACKAGES; | ||
48 | |||
49 | |||
50 | typedef struct _BAL_INFO_BUNDLE | ||
51 | { | ||
52 | BOOL fPerMachine; | ||
53 | LPWSTR sczName; | ||
54 | LPWSTR sczLogVariable; | ||
55 | BAL_INFO_PACKAGES packages; | ||
56 | } BAL_INFO_BUNDLE; | ||
57 | |||
58 | |||
59 | /******************************************************************* | ||
60 | BalInfoParseFromXml - loads the bundle and package info from the UX | ||
61 | manifest. | ||
62 | |||
63 | ********************************************************************/ | ||
64 | DAPI_(HRESULT) BalInfoParseFromXml( | ||
65 | __in BAL_INFO_BUNDLE* pBundle, | ||
66 | __in IXMLDOMDocument* pixdManifest | ||
67 | ); | ||
68 | |||
69 | |||
70 | /******************************************************************* | ||
71 | BalInfoAddRelatedBundleAsPackage - adds a related bundle as a package. | ||
72 | |||
73 | ********************************************************************/ | ||
74 | DAPI_(HRESULT) BalInfoAddRelatedBundleAsPackage( | ||
75 | __in BAL_INFO_PACKAGES* pPackages, | ||
76 | __in LPCWSTR wzId, | ||
77 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | ||
78 | __in BOOL fPerMachine, | ||
79 | __out_opt BAL_INFO_PACKAGE** ppPackage | ||
80 | ); | ||
81 | |||
82 | |||
83 | /******************************************************************* | ||
84 | BalInfoFindPackageById - finds a package by its id. | ||
85 | |||
86 | ********************************************************************/ | ||
87 | DAPI_(HRESULT) BalInfoFindPackageById( | ||
88 | __in BAL_INFO_PACKAGES* pPackages, | ||
89 | __in LPCWSTR wzId, | ||
90 | __out BAL_INFO_PACKAGE** ppPackage | ||
91 | ); | ||
92 | |||
93 | |||
94 | /******************************************************************* | ||
95 | BalInfoUninitialize - uninitializes any info previously loaded. | ||
96 | |||
97 | ********************************************************************/ | ||
98 | DAPI_(void) BalInfoUninitialize( | ||
99 | __in BAL_INFO_BUNDLE* pBundle | ||
100 | ); | ||
101 | |||
102 | |||
103 | #ifdef __cplusplus | ||
104 | } | ||
105 | #endif | ||
diff --git a/src/api/burn/balutil/inc/balretry.h b/src/api/burn/balutil/inc/balretry.h new file mode 100644 index 00000000..35282a7e --- /dev/null +++ b/src/api/burn/balutil/inc/balretry.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | /******************************************************************* | ||
10 | BalRetryInitialize - initialize the retry count and timeout between | ||
11 | retries (in milliseconds). | ||
12 | ********************************************************************/ | ||
13 | DAPI_(void) BalRetryInitialize( | ||
14 | __in DWORD dwMaxRetries, | ||
15 | __in DWORD dwTimeout | ||
16 | ); | ||
17 | |||
18 | /******************************************************************* | ||
19 | BalRetryUninitialize - call to cleanup any memory allocated during | ||
20 | use of the retry utility. | ||
21 | ********************************************************************/ | ||
22 | DAPI_(void) BalRetryUninitialize(); | ||
23 | |||
24 | /******************************************************************* | ||
25 | BalRetryStartPackage - call when a package begins to be modified. If | ||
26 | the package is being retried, the function will | ||
27 | wait the specified timeout. | ||
28 | ********************************************************************/ | ||
29 | DAPI_(void) BalRetryStartPackage( | ||
30 | __in_z LPCWSTR wzPackageId | ||
31 | ); | ||
32 | |||
33 | /******************************************************************* | ||
34 | BalRetryErrorOccured - call when an error occurs for the retry utility | ||
35 | to consider. | ||
36 | ********************************************************************/ | ||
37 | DAPI_(void) BalRetryErrorOccurred( | ||
38 | __in_z LPCWSTR wzPackageId, | ||
39 | __in DWORD dwError | ||
40 | ); | ||
41 | |||
42 | /******************************************************************* | ||
43 | BalRetryEndPackage - returns TRUE if a retry is recommended. | ||
44 | ********************************************************************/ | ||
45 | DAPI_(HRESULT) BalRetryEndPackage( | ||
46 | __in_z LPCWSTR wzPackageId, | ||
47 | __in HRESULT hrError, | ||
48 | __inout BOOL* pfRetry | ||
49 | ); | ||
50 | |||
51 | /******************************************************************* | ||
52 | BalRetryStartContainerOrPayload - call when a container or payload | ||
53 | begins to be acquired. If the target is being retried, | ||
54 | the function will wait the specified timeout. | ||
55 | ********************************************************************/ | ||
56 | DAPI_(void) BalRetryStartContainerOrPayload( | ||
57 | __in_z_opt LPCWSTR wzContainerOrPackageId, | ||
58 | __in_z_opt LPCWSTR wzPayloadId | ||
59 | ); | ||
60 | |||
61 | /******************************************************************* | ||
62 | BalRetryEndContainerOrPayload - returns TRUE if a retry is recommended. | ||
63 | ********************************************************************/ | ||
64 | DAPI_(HRESULT) BalRetryEndContainerOrPayload( | ||
65 | __in_z_opt LPCWSTR wzContainerOrPackageId, | ||
66 | __in_z_opt LPCWSTR wzPayloadId, | ||
67 | __in HRESULT hrError, | ||
68 | __inout BOOL* pfRetry | ||
69 | ); | ||
70 | |||
71 | |||
72 | #ifdef __cplusplus | ||
73 | } | ||
74 | #endif | ||
diff --git a/src/api/burn/balutil/inc/balutil.h b/src/api/burn/balutil/inc/balutil.h new file mode 100644 index 00000000..fad8a471 --- /dev/null +++ b/src/api/burn/balutil/inc/balutil.h | |||
@@ -0,0 +1,199 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include "dutil.h" | ||
6 | |||
7 | |||
8 | #ifdef __cplusplus | ||
9 | extern "C" { | ||
10 | #endif | ||
11 | |||
12 | #define BalExitOnFailureSource(d, x, f, ...) if (FAILED(x)) { BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
13 | #define BalExitOnRootFailureSource(d, x, f, ...) if (FAILED(x)) { BalLogError(x, f, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
14 | #define BalExitOnLastErrorSource(d, x, f, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } } | ||
15 | #define BalExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
16 | #define BalExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
17 | #define BalExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
18 | |||
19 | #define BalExitOnFailure(x, f, ...) BalExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
20 | #define BalExitOnRootFailure(x, f, ...) BalExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
21 | #define BalExitOnLastError(x, f, ...) BalExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
22 | #define BalExitOnNull(p, x, e, f, ...) BalExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) | ||
23 | #define BalExitOnNullWithLastError(p, x, f, ...) BalExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) | ||
24 | #define BalExitWithLastError(x, f, ...) BalExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
25 | |||
26 | #ifndef FACILITY_WIX | ||
27 | #define FACILITY_WIX 500 | ||
28 | #endif | ||
29 | |||
30 | const LPCWSTR BAL_MANIFEST_FILENAME = L"BootstrapperApplicationData.xml"; | ||
31 | |||
32 | static const HRESULT E_WIXSTDBA_CONDITION_FAILED = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1); | ||
33 | |||
34 | static const HRESULT E_MBAHOST_NET452_ON_WIN7RTM = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1000); | ||
35 | static const HRESULT E_DNCHOST_SCD_RUNTIME_FAILURE = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1001); | ||
36 | |||
37 | |||
38 | /******************************************************************* | ||
39 | BalInitialize - remembers the engine interface to enable logging and | ||
40 | other functions. | ||
41 | |||
42 | ********************************************************************/ | ||
43 | DAPI_(void) BalInitialize( | ||
44 | __in IBootstrapperEngine* pEngine | ||
45 | ); | ||
46 | |||
47 | /******************************************************************* | ||
48 | BalInitializeFromCreateArgs - convenience function to call BalBootstrapperEngineCreate | ||
49 | then pass it along to BalInitialize. | ||
50 | |||
51 | ********************************************************************/ | ||
52 | DAPI_(HRESULT) BalInitializeFromCreateArgs( | ||
53 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
54 | __out_opt IBootstrapperEngine** ppEngine | ||
55 | ); | ||
56 | |||
57 | /******************************************************************* | ||
58 | BalUninitialize - cleans up utility layer internals. | ||
59 | |||
60 | ********************************************************************/ | ||
61 | DAPI_(void) BalUninitialize(); | ||
62 | |||
63 | /******************************************************************* | ||
64 | BalManifestLoad - loads the Application manifest into an XML document. | ||
65 | |||
66 | ********************************************************************/ | ||
67 | DAPI_(HRESULT) BalManifestLoad( | ||
68 | __in HMODULE hUXModule, | ||
69 | __out IXMLDOMDocument** ppixdManifest | ||
70 | ); | ||
71 | |||
72 | /******************************************************************* | ||
73 | BalEvaluateCondition - evaluates a condition using variables in the engine. | ||
74 | |||
75 | ********************************************************************/ | ||
76 | DAPI_(HRESULT) BalEvaluateCondition( | ||
77 | __in_z LPCWSTR wzCondition, | ||
78 | __out BOOL* pf | ||
79 | ); | ||
80 | |||
81 | /******************************************************************* | ||
82 | BalFormatString - formats a string using variables in the engine. | ||
83 | |||
84 | Note: Use StrFree() to release psczOut. | ||
85 | ********************************************************************/ | ||
86 | DAPI_(HRESULT) BalFormatString( | ||
87 | __in_z LPCWSTR wzFormat, | ||
88 | __inout LPWSTR* psczOut | ||
89 | ); | ||
90 | |||
91 | /******************************************************************* | ||
92 | BalGetNumericVariable - gets a number from a variable in the engine. | ||
93 | |||
94 | Note: Returns E_NOTFOUND if variable does not exist. | ||
95 | ********************************************************************/ | ||
96 | DAPI_(HRESULT) BalGetNumericVariable( | ||
97 | __in_z LPCWSTR wzVariable, | ||
98 | __out LONGLONG* pllValue | ||
99 | ); | ||
100 | |||
101 | /******************************************************************* | ||
102 | BalSetNumericVariable - sets a numeric variable in the engine. | ||
103 | |||
104 | ********************************************************************/ | ||
105 | DAPI_(HRESULT) BalSetNumericVariable( | ||
106 | __in_z LPCWSTR wzVariable, | ||
107 | __in LONGLONG llValue | ||
108 | ); | ||
109 | |||
110 | /******************************************************************* | ||
111 | BalVariableExists - checks if a variable exists in the engine. | ||
112 | |||
113 | ********************************************************************/ | ||
114 | DAPI_(BOOL) BalVariableExists( | ||
115 | __in_z LPCWSTR wzVariable | ||
116 | ); | ||
117 | |||
118 | /******************************************************************* | ||
119 | BalGetStringVariable - gets a string from a variable in the engine. | ||
120 | |||
121 | Note: Use StrFree() to release psczValue. | ||
122 | ********************************************************************/ | ||
123 | DAPI_(HRESULT) BalGetStringVariable( | ||
124 | __in_z LPCWSTR wzVariable, | ||
125 | __inout LPWSTR* psczValue | ||
126 | ); | ||
127 | |||
128 | /******************************************************************* | ||
129 | BalSetStringVariable - sets a string variable in the engine. | ||
130 | |||
131 | ********************************************************************/ | ||
132 | DAPI_(HRESULT) BalSetStringVariable( | ||
133 | __in_z LPCWSTR wzVariable, | ||
134 | __in_z_opt LPCWSTR wzValue, | ||
135 | __in BOOL fFormatted | ||
136 | ); | ||
137 | |||
138 | /******************************************************************* | ||
139 | BalLog - logs a message with the engine. | ||
140 | |||
141 | ********************************************************************/ | ||
142 | DAPIV_(HRESULT) BalLog( | ||
143 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
144 | __in_z __format_string LPCSTR szFormat, | ||
145 | ... | ||
146 | ); | ||
147 | |||
148 | /******************************************************************* | ||
149 | BalLogArgs - logs a message with the engine. | ||
150 | |||
151 | ********************************************************************/ | ||
152 | DAPI_(HRESULT) BalLogArgs( | ||
153 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
154 | __in_z __format_string LPCSTR szFormat, | ||
155 | __in va_list args | ||
156 | ); | ||
157 | |||
158 | /******************************************************************* | ||
159 | BalLogError - logs an error message with the engine. | ||
160 | |||
161 | ********************************************************************/ | ||
162 | DAPIV_(HRESULT) BalLogError( | ||
163 | __in HRESULT hr, | ||
164 | __in_z __format_string LPCSTR szFormat, | ||
165 | ... | ||
166 | ); | ||
167 | |||
168 | /******************************************************************* | ||
169 | BalLogErrorArgs - logs an error message with the engine. | ||
170 | |||
171 | ********************************************************************/ | ||
172 | DAPI_(HRESULT) BalLogErrorArgs( | ||
173 | __in HRESULT hr, | ||
174 | __in_z __format_string LPCSTR szFormat, | ||
175 | __in va_list args | ||
176 | ); | ||
177 | |||
178 | /******************************************************************* | ||
179 | BalLogId - logs a message with the engine with a string embedded in a | ||
180 | MESSAGETABLE resource. | ||
181 | |||
182 | ********************************************************************/ | ||
183 | DAPIV_(HRESULT) BalLogId( | ||
184 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
185 | __in DWORD dwLogId, | ||
186 | __in HMODULE hModule, | ||
187 | ... | ||
188 | ); | ||
189 | |||
190 | DAPI_(HRESULT) BalLogIdArgs( | ||
191 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
192 | __in DWORD dwLogId, | ||
193 | __in HMODULE hModule, | ||
194 | __in va_list args | ||
195 | ); | ||
196 | |||
197 | #ifdef __cplusplus | ||
198 | } | ||
199 | #endif | ||
diff --git a/src/api/burn/balutil/packages.config b/src/api/burn/balutil/packages.config new file mode 100644 index 00000000..08ea3364 --- /dev/null +++ b/src/api/burn/balutil/packages.config | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <packages> | ||
3 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | ||
4 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
5 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
6 | </packages> \ No newline at end of file | ||
diff --git a/src/api/burn/balutil/precomp.cpp b/src/api/burn/balutil/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/api/burn/balutil/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/api/burn/balutil/precomp.h b/src/api/burn/balutil/precomp.h new file mode 100644 index 00000000..c500060a --- /dev/null +++ b/src/api/burn/balutil/precomp.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <bitsmsg.h> | ||
7 | #include <msi.h> | ||
8 | #include <wininet.h> | ||
9 | #include <CommCtrl.h> | ||
10 | |||
11 | #include <dutil.h> | ||
12 | #include <pathutil.h> | ||
13 | #include <locutil.h> | ||
14 | #include <memutil.h> | ||
15 | #include <strutil.h> | ||
16 | #include <thmutil.h> | ||
17 | #include <xmlutil.h> | ||
18 | |||
19 | #include <BootstrapperEngine.h> | ||
20 | #include <BootstrapperApplication.h> | ||
21 | |||
22 | #include "IBootstrapperEngine.h" | ||
23 | #include "IBootstrapperApplication.h" | ||
24 | |||
25 | #include "BAFunctions.h" | ||
26 | #include "IBAFunctions.h" | ||
27 | |||
28 | #include "balutil.h" | ||
29 | #include "BalBootstrapperEngine.h" | ||
30 | #include "balcondition.h" | ||
31 | #include "balinfo.h" | ||
32 | #include "balretry.h" | ||
diff --git a/src/api/burn/bextutil/BextBundleExtensionEngine.cpp b/src/api/burn/bextutil/BextBundleExtensionEngine.cpp new file mode 100644 index 00000000..6043e2db --- /dev/null +++ b/src/api/burn/bextutil/BextBundleExtensionEngine.cpp | |||
@@ -0,0 +1,344 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | |||
6 | class CBextBundleExtensionEngine : public IBundleExtensionEngine | ||
7 | { | ||
8 | public: // IUnknown | ||
9 | virtual STDMETHODIMP QueryInterface( | ||
10 | __in REFIID riid, | ||
11 | __out LPVOID *ppvObject | ||
12 | ) | ||
13 | { | ||
14 | if (!ppvObject) | ||
15 | { | ||
16 | return E_INVALIDARG; | ||
17 | } | ||
18 | |||
19 | *ppvObject = NULL; | ||
20 | |||
21 | if (::IsEqualIID(__uuidof(IBundleExtensionEngine), riid)) | ||
22 | { | ||
23 | *ppvObject = static_cast<IBundleExtensionEngine*>(this); | ||
24 | } | ||
25 | else if (::IsEqualIID(IID_IUnknown, riid)) | ||
26 | { | ||
27 | *ppvObject = reinterpret_cast<IUnknown*>(this); | ||
28 | } | ||
29 | else // no interface for requested iid | ||
30 | { | ||
31 | return E_NOINTERFACE; | ||
32 | } | ||
33 | |||
34 | AddRef(); | ||
35 | return S_OK; | ||
36 | } | ||
37 | |||
38 | virtual STDMETHODIMP_(ULONG) AddRef() | ||
39 | { | ||
40 | return ::InterlockedIncrement(&this->m_cReferences); | ||
41 | } | ||
42 | |||
43 | virtual STDMETHODIMP_(ULONG) Release() | ||
44 | { | ||
45 | long l = ::InterlockedDecrement(&this->m_cReferences); | ||
46 | if (0 < l) | ||
47 | { | ||
48 | return l; | ||
49 | } | ||
50 | |||
51 | delete this; | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | public: // IBundleExtensionEngine | ||
56 | virtual STDMETHODIMP EscapeString( | ||
57 | __in_z LPCWSTR wzIn, | ||
58 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
59 | __inout SIZE_T* pcchOut | ||
60 | ) | ||
61 | { | ||
62 | HRESULT hr = S_OK; | ||
63 | BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS args = { }; | ||
64 | BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS results = { }; | ||
65 | |||
66 | ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); | ||
67 | |||
68 | args.cbSize = sizeof(args); | ||
69 | args.wzIn = wzIn; | ||
70 | |||
71 | results.cbSize = sizeof(results); | ||
72 | results.wzOut = wzOut; | ||
73 | results.cchOut = *pcchOut; | ||
74 | |||
75 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
76 | |||
77 | *pcchOut = results.cchOut; | ||
78 | |||
79 | LExit: | ||
80 | return hr; | ||
81 | } | ||
82 | |||
83 | virtual STDMETHODIMP EvaluateCondition( | ||
84 | __in_z LPCWSTR wzCondition, | ||
85 | __out BOOL* pf | ||
86 | ) | ||
87 | { | ||
88 | HRESULT hr = S_OK; | ||
89 | BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS args = { }; | ||
90 | BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS results = { }; | ||
91 | |||
92 | ExitOnNull(pf, hr, E_INVALIDARG, "pf is required"); | ||
93 | |||
94 | args.cbSize = sizeof(args); | ||
95 | args.wzCondition = wzCondition; | ||
96 | |||
97 | results.cbSize = sizeof(results); | ||
98 | |||
99 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
100 | |||
101 | *pf = results.f; | ||
102 | |||
103 | LExit: | ||
104 | return hr; | ||
105 | } | ||
106 | |||
107 | virtual STDMETHODIMP FormatString( | ||
108 | __in_z LPCWSTR wzIn, | ||
109 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
110 | __inout SIZE_T* pcchOut | ||
111 | ) | ||
112 | { | ||
113 | HRESULT hr = S_OK; | ||
114 | BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS args = { }; | ||
115 | BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS results = { }; | ||
116 | |||
117 | ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); | ||
118 | |||
119 | args.cbSize = sizeof(args); | ||
120 | args.wzIn = wzIn; | ||
121 | |||
122 | results.cbSize = sizeof(results); | ||
123 | results.wzOut = wzOut; | ||
124 | results.cchOut = *pcchOut; | ||
125 | |||
126 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
127 | |||
128 | *pcchOut = results.cchOut; | ||
129 | |||
130 | LExit: | ||
131 | return hr; | ||
132 | } | ||
133 | |||
134 | virtual STDMETHODIMP GetVariableNumeric( | ||
135 | __in_z LPCWSTR wzVariable, | ||
136 | __out LONGLONG* pllValue | ||
137 | ) | ||
138 | { | ||
139 | HRESULT hr = S_OK; | ||
140 | BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS args = { }; | ||
141 | BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS results = { }; | ||
142 | |||
143 | ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required"); | ||
144 | |||
145 | args.cbSize = sizeof(args); | ||
146 | args.wzVariable = wzVariable; | ||
147 | |||
148 | results.cbSize = sizeof(results); | ||
149 | |||
150 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
151 | |||
152 | *pllValue = results.llValue; | ||
153 | |||
154 | LExit: | ||
155 | SecureZeroMemory(&results, sizeof(results)); | ||
156 | return hr; | ||
157 | } | ||
158 | |||
159 | virtual STDMETHODIMP GetVariableString( | ||
160 | __in_z LPCWSTR wzVariable, | ||
161 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
162 | __inout SIZE_T* pcchValue | ||
163 | ) | ||
164 | { | ||
165 | HRESULT hr = S_OK; | ||
166 | BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS args = { }; | ||
167 | BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS results = { }; | ||
168 | |||
169 | ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); | ||
170 | |||
171 | args.cbSize = sizeof(args); | ||
172 | args.wzVariable = wzVariable; | ||
173 | |||
174 | results.cbSize = sizeof(results); | ||
175 | results.wzValue = wzValue; | ||
176 | results.cchValue = *pcchValue; | ||
177 | |||
178 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
179 | |||
180 | *pcchValue = results.cchValue; | ||
181 | |||
182 | LExit: | ||
183 | return hr; | ||
184 | } | ||
185 | |||
186 | virtual STDMETHODIMP GetVariableVersion( | ||
187 | __in_z LPCWSTR wzVariable, | ||
188 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
189 | __inout SIZE_T* pcchValue | ||
190 | ) | ||
191 | { | ||
192 | HRESULT hr = S_OK; | ||
193 | BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS args = { }; | ||
194 | BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS results = { }; | ||
195 | |||
196 | ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); | ||
197 | |||
198 | args.cbSize = sizeof(args); | ||
199 | args.wzVariable = wzVariable; | ||
200 | |||
201 | results.cbSize = sizeof(results); | ||
202 | results.wzValue = wzValue; | ||
203 | results.cchValue = *pcchValue; | ||
204 | |||
205 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
206 | |||
207 | *pcchValue = results.cchValue; | ||
208 | |||
209 | LExit: | ||
210 | return hr; | ||
211 | } | ||
212 | |||
213 | virtual STDMETHODIMP Log( | ||
214 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
215 | __in_z LPCWSTR wzMessage | ||
216 | ) | ||
217 | { | ||
218 | BUNDLE_EXTENSION_ENGINE_LOG_ARGS args = { }; | ||
219 | BUNDLE_EXTENSION_ENGINE_LOG_RESULTS results = { }; | ||
220 | |||
221 | args.cbSize = sizeof(args); | ||
222 | args.level = level; | ||
223 | args.wzMessage = wzMessage; | ||
224 | |||
225 | results.cbSize = sizeof(results); | ||
226 | |||
227 | return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
228 | } | ||
229 | |||
230 | virtual STDMETHODIMP SetVariableNumeric( | ||
231 | __in_z LPCWSTR wzVariable, | ||
232 | __in LONGLONG llValue | ||
233 | ) | ||
234 | { | ||
235 | BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS args = { }; | ||
236 | BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS results = { }; | ||
237 | |||
238 | args.cbSize = sizeof(args); | ||
239 | args.wzVariable = wzVariable; | ||
240 | args.llValue = llValue; | ||
241 | |||
242 | results.cbSize = sizeof(results); | ||
243 | |||
244 | return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
245 | } | ||
246 | |||
247 | virtual STDMETHODIMP SetVariableString( | ||
248 | __in_z LPCWSTR wzVariable, | ||
249 | __in_z_opt LPCWSTR wzValue, | ||
250 | __in BOOL fFormatted | ||
251 | ) | ||
252 | { | ||
253 | BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS args = { }; | ||
254 | BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS results = { }; | ||
255 | |||
256 | args.cbSize = sizeof(args); | ||
257 | args.wzVariable = wzVariable; | ||
258 | args.wzValue = wzValue; | ||
259 | args.fFormatted = fFormatted; | ||
260 | |||
261 | results.cbSize = sizeof(results); | ||
262 | |||
263 | return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
264 | } | ||
265 | |||
266 | virtual STDMETHODIMP SetVariableVersion( | ||
267 | __in_z LPCWSTR wzVariable, | ||
268 | __in_z_opt LPCWSTR wzValue | ||
269 | ) | ||
270 | { | ||
271 | BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS args = { }; | ||
272 | BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS results = { }; | ||
273 | |||
274 | args.cbSize = sizeof(args); | ||
275 | args.wzVariable = wzVariable; | ||
276 | args.wzValue = wzValue; | ||
277 | |||
278 | results.cbSize = sizeof(results); | ||
279 | |||
280 | return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
281 | } | ||
282 | |||
283 | virtual STDMETHODIMP CompareVersions( | ||
284 | __in_z LPCWSTR wzVersion1, | ||
285 | __in_z LPCWSTR wzVersion2, | ||
286 | __out int* pnResult | ||
287 | ) | ||
288 | { | ||
289 | HRESULT hr = S_OK; | ||
290 | BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS args = { }; | ||
291 | BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS results = { }; | ||
292 | |||
293 | ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); | ||
294 | |||
295 | args.cbSize = sizeof(args); | ||
296 | args.wzVersion1 = wzVersion1; | ||
297 | args.wzVersion2 = wzVersion2; | ||
298 | |||
299 | results.cbSize = sizeof(results); | ||
300 | |||
301 | hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, &args, &results, m_pvBundleExtensionEngineProcContext); | ||
302 | |||
303 | *pnResult = results.nResult; | ||
304 | |||
305 | LExit: | ||
306 | return hr; | ||
307 | } | ||
308 | |||
309 | public: | ||
310 | CBextBundleExtensionEngine( | ||
311 | __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, | ||
312 | __in_opt LPVOID pvBundleExtensionEngineProcContext | ||
313 | ) | ||
314 | { | ||
315 | m_cReferences = 1; | ||
316 | m_pfnBundleExtensionEngineProc = pfnBundleExtensionEngineProc; | ||
317 | m_pvBundleExtensionEngineProcContext = pvBundleExtensionEngineProcContext; | ||
318 | } | ||
319 | |||
320 | private: | ||
321 | long m_cReferences; | ||
322 | PFN_BUNDLE_EXTENSION_ENGINE_PROC m_pfnBundleExtensionEngineProc; | ||
323 | LPVOID m_pvBundleExtensionEngineProcContext; | ||
324 | }; | ||
325 | |||
326 | HRESULT BextBundleExtensionEngineCreate( | ||
327 | __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, | ||
328 | __in_opt LPVOID pvBundleExtensionEngineProcContext, | ||
329 | __out IBundleExtensionEngine** ppEngineForExtension | ||
330 | ) | ||
331 | { | ||
332 | HRESULT hr = S_OK; | ||
333 | CBextBundleExtensionEngine* pBundleExtensionEngine = NULL; | ||
334 | |||
335 | pBundleExtensionEngine = new CBextBundleExtensionEngine(pfnBundleExtensionEngineProc, pvBundleExtensionEngineProcContext); | ||
336 | ExitOnNull(pBundleExtensionEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BextBundleExtensionEngine object."); | ||
337 | |||
338 | hr = pBundleExtensionEngine->QueryInterface(IID_PPV_ARGS(ppEngineForExtension)); | ||
339 | ExitOnFailure(hr, "Failed to QI for IBundleExtensionEngine from BextBundleExtensionEngine object."); | ||
340 | |||
341 | LExit: | ||
342 | ReleaseObject(pBundleExtensionEngine); | ||
343 | return hr; | ||
344 | } | ||
diff --git a/src/api/burn/bextutil/bextutil.cpp b/src/api/burn/bextutil/bextutil.cpp new file mode 100644 index 00000000..4b22d502 --- /dev/null +++ b/src/api/burn/bextutil/bextutil.cpp | |||
@@ -0,0 +1,221 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | static IBundleExtensionEngine* vpEngine = NULL; | ||
6 | |||
7 | // prototypes | ||
8 | |||
9 | DAPI_(void) BextInitialize( | ||
10 | __in IBundleExtensionEngine* pEngine | ||
11 | ) | ||
12 | { | ||
13 | pEngine->AddRef(); | ||
14 | |||
15 | ReleaseObject(vpEngine); | ||
16 | vpEngine = pEngine; | ||
17 | } | ||
18 | |||
19 | DAPI_(HRESULT) BextInitializeFromCreateArgs( | ||
20 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
21 | __out_opt IBundleExtensionEngine** ppEngine | ||
22 | ) | ||
23 | { | ||
24 | HRESULT hr = S_OK; | ||
25 | IBundleExtensionEngine* pEngine = NULL; | ||
26 | |||
27 | hr = BextBundleExtensionEngineCreate(pArgs->pfnBundleExtensionEngineProc, pArgs->pvBundleExtensionEngineProcContext, &pEngine); | ||
28 | ExitOnFailure(hr, "Failed to create BextBundleExtensionEngine."); | ||
29 | |||
30 | BextInitialize(pEngine); | ||
31 | |||
32 | if (ppEngine) | ||
33 | { | ||
34 | *ppEngine = pEngine; | ||
35 | } | ||
36 | pEngine = NULL; | ||
37 | |||
38 | LExit: | ||
39 | ReleaseObject(pEngine); | ||
40 | |||
41 | return hr; | ||
42 | } | ||
43 | |||
44 | |||
45 | DAPI_(void) BextUninitialize() | ||
46 | { | ||
47 | ReleaseNullObject(vpEngine); | ||
48 | } | ||
49 | |||
50 | DAPI_(HRESULT) BextGetBundleExtensionDataNode( | ||
51 | __in IXMLDOMDocument* pixdManifest, | ||
52 | __in LPCWSTR wzExtensionId, | ||
53 | __out IXMLDOMNode** ppixnBundleExtension | ||
54 | ) | ||
55 | { | ||
56 | HRESULT hr = S_OK; | ||
57 | IXMLDOMElement* pixeBundleExtensionData = NULL; | ||
58 | IXMLDOMNodeList* pixnNodes = NULL; | ||
59 | IXMLDOMNode* pixnNode = NULL; | ||
60 | DWORD cNodes = 0; | ||
61 | LPWSTR sczId = NULL; | ||
62 | |||
63 | // Get BundleExtensionData element. | ||
64 | hr = pixdManifest->get_documentElement(&pixeBundleExtensionData); | ||
65 | ExitOnFailure(hr, "Failed to get BundleExtensionData element."); | ||
66 | |||
67 | // Select BundleExtension nodes. | ||
68 | hr = XmlSelectNodes(pixeBundleExtensionData, L"BundleExtension", &pixnNodes); | ||
69 | ExitOnFailure(hr, "Failed to select BundleExtension nodes."); | ||
70 | |||
71 | // Get BundleExtension node count. | ||
72 | hr = pixnNodes->get_length((long*)&cNodes); | ||
73 | ExitOnFailure(hr, "Failed to get BundleExtension node count."); | ||
74 | |||
75 | if (!cNodes) | ||
76 | { | ||
77 | ExitFunction(); | ||
78 | } | ||
79 | |||
80 | // Find requested extension. | ||
81 | for (DWORD i = 0; i < cNodes; ++i) | ||
82 | { | ||
83 | hr = XmlNextElement(pixnNodes, &pixnNode, NULL); | ||
84 | ExitOnFailure(hr, "Failed to get next node."); | ||
85 | |||
86 | // @Id | ||
87 | hr = XmlGetAttributeEx(pixnNode, L"Id", &sczId); | ||
88 | ExitOnFailure(hr, "Failed to get @Id."); | ||
89 | |||
90 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczId, -1, wzExtensionId, -1)) | ||
91 | { | ||
92 | *ppixnBundleExtension = pixnNode; | ||
93 | pixnNode = NULL; | ||
94 | |||
95 | ExitFunction1(hr = S_OK); | ||
96 | } | ||
97 | |||
98 | // Prepare next iteration. | ||
99 | ReleaseNullObject(pixnNode); | ||
100 | } | ||
101 | |||
102 | hr = E_NOTFOUND; | ||
103 | |||
104 | LExit: | ||
105 | ReleaseStr(sczId); | ||
106 | ReleaseObject(pixnNode); | ||
107 | ReleaseObject(pixnNodes); | ||
108 | ReleaseObject(pixeBundleExtensionData); | ||
109 | |||
110 | return hr; | ||
111 | } | ||
112 | |||
113 | |||
114 | DAPIV_(HRESULT) BextLog( | ||
115 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
116 | __in_z __format_string LPCSTR szFormat, | ||
117 | ... | ||
118 | ) | ||
119 | { | ||
120 | HRESULT hr = S_OK; | ||
121 | va_list args; | ||
122 | |||
123 | if (!vpEngine) | ||
124 | { | ||
125 | hr = E_POINTER; | ||
126 | ExitOnRootFailure(hr, "BextInitialize() must be called first."); | ||
127 | } | ||
128 | |||
129 | va_start(args, szFormat); | ||
130 | hr = BextLogArgs(level, szFormat, args); | ||
131 | va_end(args); | ||
132 | |||
133 | LExit: | ||
134 | return hr; | ||
135 | } | ||
136 | |||
137 | |||
138 | DAPI_(HRESULT) BextLogArgs( | ||
139 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
140 | __in_z __format_string LPCSTR szFormat, | ||
141 | __in va_list args | ||
142 | ) | ||
143 | { | ||
144 | HRESULT hr = S_OK; | ||
145 | LPSTR sczFormattedAnsi = NULL; | ||
146 | LPWSTR sczMessage = NULL; | ||
147 | |||
148 | if (!vpEngine) | ||
149 | { | ||
150 | hr = E_POINTER; | ||
151 | ExitOnRootFailure(hr, "BextInitialize() must be called first."); | ||
152 | } | ||
153 | |||
154 | hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args); | ||
155 | ExitOnFailure(hr, "Failed to format log string."); | ||
156 | |||
157 | hr = StrAllocStringAnsi(&sczMessage, sczFormattedAnsi, 0, CP_UTF8); | ||
158 | ExitOnFailure(hr, "Failed to convert log string to Unicode."); | ||
159 | |||
160 | hr = vpEngine->Log(level, sczMessage); | ||
161 | |||
162 | LExit: | ||
163 | ReleaseStr(sczMessage); | ||
164 | ReleaseStr(sczFormattedAnsi); | ||
165 | return hr; | ||
166 | } | ||
167 | |||
168 | |||
169 | DAPIV_(HRESULT) BextLogError( | ||
170 | __in HRESULT hrError, | ||
171 | __in_z __format_string LPCSTR szFormat, | ||
172 | ... | ||
173 | ) | ||
174 | { | ||
175 | HRESULT hr = S_OK; | ||
176 | va_list args; | ||
177 | |||
178 | if (!vpEngine) | ||
179 | { | ||
180 | hr = E_POINTER; | ||
181 | ExitOnRootFailure(hr, "BextInitialize() must be called first."); | ||
182 | } | ||
183 | |||
184 | va_start(args, szFormat); | ||
185 | hr = BextLogErrorArgs(hrError, szFormat, args); | ||
186 | va_end(args); | ||
187 | |||
188 | LExit: | ||
189 | return hr; | ||
190 | } | ||
191 | |||
192 | |||
193 | DAPI_(HRESULT) BextLogErrorArgs( | ||
194 | __in HRESULT hrError, | ||
195 | __in_z __format_string LPCSTR szFormat, | ||
196 | __in va_list args | ||
197 | ) | ||
198 | { | ||
199 | HRESULT hr = S_OK; | ||
200 | LPSTR sczFormattedAnsi = NULL; | ||
201 | LPWSTR sczMessage = NULL; | ||
202 | |||
203 | if (!vpEngine) | ||
204 | { | ||
205 | hr = E_POINTER; | ||
206 | ExitOnRootFailure(hr, "BextInitialize() must be called first."); | ||
207 | } | ||
208 | |||
209 | hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args); | ||
210 | ExitOnFailure(hr, "Failed to format error log string."); | ||
211 | |||
212 | hr = StrAllocFormatted(&sczMessage, L"Error 0x%08x: %S", hrError, sczFormattedAnsi); | ||
213 | ExitOnFailure(hr, "Failed to prepend error number to error log string."); | ||
214 | |||
215 | hr = vpEngine->Log(BUNDLE_EXTENSION_LOG_LEVEL_ERROR, sczMessage); | ||
216 | |||
217 | LExit: | ||
218 | ReleaseStr(sczMessage); | ||
219 | ReleaseStr(sczFormattedAnsi); | ||
220 | return hr; | ||
221 | } | ||
diff --git a/src/api/burn/bextutil/bextutil.nuspec b/src/api/burn/bextutil/bextutil.nuspec new file mode 100644 index 00000000..752dbb97 --- /dev/null +++ b/src/api/burn/bextutil/bextutil.nuspec | |||
@@ -0,0 +1,31 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <package > | ||
3 | <metadata> | ||
4 | <id>$id$</id> | ||
5 | <version>$version$</version> | ||
6 | <authors>$authors$</authors> | ||
7 | <owners>$authors$</owners> | ||
8 | <license type="expression">MS-RL</license> | ||
9 | <projectUrl>https://github.com/wixtoolset/balutil</projectUrl> | ||
10 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
11 | <description>$description$</description> | ||
12 | <copyright>$copyright$</copyright> | ||
13 | <dependencies> | ||
14 | <dependency id="WixToolset.BootstrapperCore.Native" version="[4,5)" /> | ||
15 | <dependency id="WixToolset.DUtil" version="[4,5)" /> | ||
16 | </dependencies> | ||
17 | </metadata> | ||
18 | |||
19 | <files> | ||
20 | <file src="build\$id$.props" target="build\" /> | ||
21 | <file src="inc\*" target="build\native\include" /> | ||
22 | <file src="..\..\build\$configuration$\v140\x86\bextutil.lib" target="build\native\v140\x86" /> | ||
23 | <file src="..\..\build\$configuration$\v140\x64\bextutil.lib" target="build\native\v140\x64" /> | ||
24 | <file src="..\..\build\$configuration$\v141\x86\bextutil.lib" target="build\native\v141\x86" /> | ||
25 | <file src="..\..\build\$configuration$\v141\x64\bextutil.lib" target="build\native\v141\x64" /> | ||
26 | <file src="..\..\build\$configuration$\v141\ARM64\bextutil.lib" target="build\native\v141\ARM64" /> | ||
27 | <file src="..\..\build\$configuration$\v142\x86\bextutil.lib" target="build\native\v142\x86" /> | ||
28 | <file src="..\..\build\$configuration$\v142\x64\bextutil.lib" target="build\native\v142\x64" /> | ||
29 | <file src="..\..\build\$configuration$\v142\ARM64\bextutil.lib" target="build\native\v142\ARM64" /> | ||
30 | </files> | ||
31 | </package> | ||
diff --git a/src/api/burn/bextutil/bextutil.vcxproj b/src/api/burn/bextutil/bextutil.vcxproj new file mode 100644 index 00000000..b9334cf3 --- /dev/null +++ b/src/api/burn/bextutil/bextutil.vcxproj | |||
@@ -0,0 +1,90 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
6 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
7 | |||
8 | <ItemGroup Label="ProjectConfigurations"> | ||
9 | <ProjectConfiguration Include="Debug|ARM64"> | ||
10 | <Configuration>Debug</Configuration> | ||
11 | <Platform>ARM64</Platform> | ||
12 | </ProjectConfiguration> | ||
13 | <ProjectConfiguration Include="Release|ARM64"> | ||
14 | <Configuration>Release</Configuration> | ||
15 | <Platform>ARM64</Platform> | ||
16 | </ProjectConfiguration> | ||
17 | <ProjectConfiguration Include="Debug|Win32"> | ||
18 | <Configuration>Debug</Configuration> | ||
19 | <Platform>Win32</Platform> | ||
20 | </ProjectConfiguration> | ||
21 | <ProjectConfiguration Include="Release|Win32"> | ||
22 | <Configuration>Release</Configuration> | ||
23 | <Platform>Win32</Platform> | ||
24 | </ProjectConfiguration> | ||
25 | <ProjectConfiguration Include="Debug|x64"> | ||
26 | <Configuration>Debug</Configuration> | ||
27 | <Platform>x64</Platform> | ||
28 | </ProjectConfiguration> | ||
29 | <ProjectConfiguration Include="Release|x64"> | ||
30 | <Configuration>Release</Configuration> | ||
31 | <Platform>x64</Platform> | ||
32 | </ProjectConfiguration> | ||
33 | </ItemGroup> | ||
34 | |||
35 | <PropertyGroup Label="Globals"> | ||
36 | <ProjectGuid>{06027492-1CB9-48BC-B31E-C1F9356ED07E}</ProjectGuid> | ||
37 | <ConfigurationType>StaticLibrary</ConfigurationType> | ||
38 | <TargetName>bextutil</TargetName> | ||
39 | <PlatformToolset>v142</PlatformToolset> | ||
40 | <CharacterSet>MultiByte</CharacterSet> | ||
41 | <Description>WiX Toolset Bundle Extension native utility library</Description> | ||
42 | <PackageId>WixToolset.BextUtil</PackageId> | ||
43 | </PropertyGroup> | ||
44 | |||
45 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
46 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
47 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
48 | <Import Project="..\NativeMultiTargeting.Build.props" /> | ||
49 | |||
50 | <ImportGroup Label="ExtensionSettings"> | ||
51 | </ImportGroup> | ||
52 | |||
53 | <ImportGroup Label="Shared"> | ||
54 | </ImportGroup> | ||
55 | |||
56 | <PropertyGroup> | ||
57 | <ProjectAdditionalIncludeDirectories>$(ProjectDir)..\inc</ProjectAdditionalIncludeDirectories> | ||
58 | </PropertyGroup> | ||
59 | |||
60 | <ItemGroup> | ||
61 | <ClCompile Include="BextBundleExtensionEngine.cpp" /> | ||
62 | <ClCompile Include="bextutil.cpp" /> | ||
63 | <ClCompile Include="precomp.cpp"> | ||
64 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
65 | </ClCompile> | ||
66 | </ItemGroup> | ||
67 | <ItemGroup> | ||
68 | <ClInclude Include="inc\BextBaseBundleExtension.h" /> | ||
69 | <ClInclude Include="inc\BextBaseBundleExtensionProc.h" /> | ||
70 | <ClInclude Include="inc\BextBundleExtensionEngine.h" /> | ||
71 | <ClInclude Include="inc\bextutil.h" /> | ||
72 | <ClInclude Include="inc\IBundleExtension.h" /> | ||
73 | <ClInclude Include="inc\IBundleExtensionEngine.h" /> | ||
74 | <ClInclude Include="precomp.h" /> | ||
75 | </ItemGroup> | ||
76 | |||
77 | <ItemGroup> | ||
78 | <None Include="packages.config" /> | ||
79 | </ItemGroup> | ||
80 | |||
81 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
82 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
83 | <PropertyGroup> | ||
84 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
85 | </PropertyGroup> | ||
86 | <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
87 | <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" /> | ||
88 | <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
89 | </Target> | ||
90 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/bextutil/build/WixToolset.BextUtil.props b/src/api/burn/bextutil/build/WixToolset.BextUtil.props new file mode 100644 index 00000000..60a2db54 --- /dev/null +++ b/src/api/burn/bextutil/build/WixToolset.BextUtil.props | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <ItemDefinitionGroup> | ||
6 | <ClCompile> | ||
7 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
8 | </ClCompile> | ||
9 | <ResourceCompile> | ||
10 | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
11 | </ResourceCompile> | ||
12 | </ItemDefinitionGroup> | ||
13 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v140')) "> | ||
14 | <Link> | ||
15 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v140\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
16 | </Link> | ||
17 | </ItemDefinitionGroup> | ||
18 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v141')) "> | ||
19 | <Link> | ||
20 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v141\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
21 | </Link> | ||
22 | </ItemDefinitionGroup> | ||
23 | <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v142')) "> | ||
24 | <Link> | ||
25 | <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v142\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
26 | </Link> | ||
27 | </ItemDefinitionGroup> | ||
28 | </Project> | ||
diff --git a/src/api/burn/bextutil/inc/BextBaseBundleExtension.h b/src/api/burn/bextutil/inc/BextBaseBundleExtension.h new file mode 100644 index 00000000..69c338e4 --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBaseBundleExtension.h | |||
@@ -0,0 +1,120 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include <windows.h> | ||
4 | |||
5 | #include "BundleExtensionEngine.h" | ||
6 | #include "BundleExtension.h" | ||
7 | #include "IBundleExtensionEngine.h" | ||
8 | #include "IBundleExtension.h" | ||
9 | |||
10 | #include "bextutil.h" | ||
11 | |||
12 | class CBextBaseBundleExtension : public IBundleExtension | ||
13 | { | ||
14 | public: // IUnknown | ||
15 | virtual STDMETHODIMP QueryInterface( | ||
16 | __in REFIID riid, | ||
17 | __out LPVOID *ppvObject | ||
18 | ) | ||
19 | { | ||
20 | if (!ppvObject) | ||
21 | { | ||
22 | return E_INVALIDARG; | ||
23 | } | ||
24 | |||
25 | *ppvObject = NULL; | ||
26 | |||
27 | if (::IsEqualIID(__uuidof(IBundleExtension), riid)) | ||
28 | { | ||
29 | *ppvObject = static_cast<IBundleExtension*>(this); | ||
30 | } | ||
31 | else if (::IsEqualIID(IID_IUnknown, riid)) | ||
32 | { | ||
33 | *ppvObject = static_cast<IUnknown*>(this); | ||
34 | } | ||
35 | else // no interface for requested iid | ||
36 | { | ||
37 | return E_NOINTERFACE; | ||
38 | } | ||
39 | |||
40 | AddRef(); | ||
41 | return S_OK; | ||
42 | } | ||
43 | |||
44 | virtual STDMETHODIMP_(ULONG) AddRef() | ||
45 | { | ||
46 | return ::InterlockedIncrement(&this->m_cReferences); | ||
47 | } | ||
48 | |||
49 | virtual STDMETHODIMP_(ULONG) Release() | ||
50 | { | ||
51 | long l = ::InterlockedDecrement(&this->m_cReferences); | ||
52 | if (0 < l) | ||
53 | { | ||
54 | return l; | ||
55 | } | ||
56 | |||
57 | delete this; | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | public: // IBundleExtension | ||
62 | virtual STDMETHODIMP Search( | ||
63 | __in LPCWSTR /*wzId*/, | ||
64 | __in LPCWSTR /*wzVariable*/ | ||
65 | ) | ||
66 | { | ||
67 | return E_NOTIMPL; | ||
68 | } | ||
69 | |||
70 | virtual STDMETHODIMP BundleExtensionProc( | ||
71 | __in BUNDLE_EXTENSION_MESSAGE /*message*/, | ||
72 | __in const LPVOID /*pvArgs*/, | ||
73 | __inout LPVOID /*pvResults*/, | ||
74 | __in_opt LPVOID /*pvContext*/ | ||
75 | ) | ||
76 | { | ||
77 | return E_NOTIMPL; | ||
78 | } | ||
79 | |||
80 | public: //CBextBaseBundleExtension | ||
81 | virtual STDMETHODIMP Initialize( | ||
82 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs | ||
83 | ) | ||
84 | { | ||
85 | HRESULT hr = S_OK; | ||
86 | |||
87 | hr = StrAllocString(&m_sczBundleExtensionDataPath, pCreateArgs->wzBundleExtensionDataPath, 0); | ||
88 | ExitOnFailure(hr, "Failed to copy BundleExtensionDataPath."); | ||
89 | |||
90 | LExit: | ||
91 | return hr; | ||
92 | } | ||
93 | |||
94 | protected: | ||
95 | |||
96 | CBextBaseBundleExtension( | ||
97 | __in IBundleExtensionEngine* pEngine | ||
98 | ) | ||
99 | { | ||
100 | m_cReferences = 1; | ||
101 | |||
102 | pEngine->AddRef(); | ||
103 | m_pEngine = pEngine; | ||
104 | |||
105 | m_sczBundleExtensionDataPath = NULL; | ||
106 | } | ||
107 | |||
108 | virtual ~CBextBaseBundleExtension() | ||
109 | { | ||
110 | ReleaseNullObject(m_pEngine); | ||
111 | ReleaseStr(m_sczBundleExtensionDataPath); | ||
112 | } | ||
113 | |||
114 | protected: | ||
115 | IBundleExtensionEngine* m_pEngine; | ||
116 | LPWSTR m_sczBundleExtensionDataPath; | ||
117 | |||
118 | private: | ||
119 | long m_cReferences; | ||
120 | }; | ||
diff --git a/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h b/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h new file mode 100644 index 00000000..f71e3b92 --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | |||
7 | #include "BundleExtensionEngine.h" | ||
8 | #include "BundleExtension.h" | ||
9 | #include "IBundleExtensionEngine.h" | ||
10 | #include "IBundleExtension.h" | ||
11 | |||
12 | static HRESULT BextBaseBEProcSearch( | ||
13 | __in IBundleExtension* pBE, | ||
14 | __in BUNDLE_EXTENSION_SEARCH_ARGS* pArgs, | ||
15 | __inout BUNDLE_EXTENSION_SEARCH_RESULTS* /*pResults*/ | ||
16 | ) | ||
17 | { | ||
18 | return pBE->Search(pArgs->wzId, pArgs->wzVariable); | ||
19 | } | ||
20 | |||
21 | /******************************************************************* | ||
22 | BextBaseBundleExtensionProc - requires pvContext to be of type IBundleExtension. | ||
23 | Provides a default mapping between the message based | ||
24 | BundleExtension interface and the COM-based BundleExtension interface. | ||
25 | |||
26 | *******************************************************************/ | ||
27 | static HRESULT WINAPI BextBaseBundleExtensionProc( | ||
28 | __in BUNDLE_EXTENSION_MESSAGE message, | ||
29 | __in const LPVOID pvArgs, | ||
30 | __inout LPVOID pvResults, | ||
31 | __in_opt LPVOID pvContext | ||
32 | ) | ||
33 | { | ||
34 | IBundleExtension* pBE = reinterpret_cast<IBundleExtension*>(pvContext); | ||
35 | HRESULT hr = pBE->BundleExtensionProc(message, pvArgs, pvResults, pvContext); | ||
36 | |||
37 | if (E_NOTIMPL == hr) | ||
38 | { | ||
39 | switch (message) | ||
40 | { | ||
41 | case BUNDLE_EXTENSION_MESSAGE_SEARCH: | ||
42 | hr = BextBaseBEProcSearch(pBE, reinterpret_cast<BUNDLE_EXTENSION_SEARCH_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_SEARCH_RESULTS*>(pvResults)); | ||
43 | break; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | return hr; | ||
48 | } | ||
diff --git a/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h b/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h new file mode 100644 index 00000000..9fdcb700 --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h | |||
@@ -0,0 +1,17 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #ifdef __cplusplus | ||
4 | extern "C" { | ||
5 | #endif | ||
6 | |||
7 | // function declarations | ||
8 | |||
9 | HRESULT BextBundleExtensionEngineCreate( | ||
10 | __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, | ||
11 | __in_opt LPVOID pvBundleExtensionEngineProcContext, | ||
12 | __out IBundleExtensionEngine** ppEngineForExtension | ||
13 | ); | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | } | ||
17 | #endif | ||
diff --git a/src/api/burn/bextutil/inc/IBundleExtension.h b/src/api/burn/bextutil/inc/IBundleExtension.h new file mode 100644 index 00000000..7516c11b --- /dev/null +++ b/src/api/burn/bextutil/inc/IBundleExtension.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | DECLARE_INTERFACE_IID_(IBundleExtension, IUnknown, "93123C9D-796B-4FCD-A507-6EDEF9A925FD") | ||
6 | { | ||
7 | STDMETHOD(Search)( | ||
8 | __in LPCWSTR wzId, | ||
9 | __in LPCWSTR wzVariable | ||
10 | ) = 0; | ||
11 | |||
12 | // BundleExtensionProc - The PFN_BUNDLE_EXTENSION_PROC can call this method to give the BundleExtension raw access to the callback from the engine. | ||
13 | // This might be used to help the BundleExtension support more than one version of the engine. | ||
14 | STDMETHOD(BundleExtensionProc)( | ||
15 | __in BUNDLE_EXTENSION_MESSAGE message, | ||
16 | __in const LPVOID pvArgs, | ||
17 | __inout LPVOID pvResults, | ||
18 | __in_opt LPVOID pvContext | ||
19 | ) = 0; | ||
20 | }; | ||
diff --git a/src/api/burn/bextutil/inc/IBundleExtensionEngine.h b/src/api/burn/bextutil/inc/IBundleExtensionEngine.h new file mode 100644 index 00000000..63dadb06 --- /dev/null +++ b/src/api/burn/bextutil/inc/IBundleExtensionEngine.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | DECLARE_INTERFACE_IID_(IBundleExtensionEngine, IUnknown, "9D027A39-F6B6-42CC-9737-C185089EB263") | ||
6 | { | ||
7 | STDMETHOD(EscapeString)( | ||
8 | __in_z LPCWSTR wzIn, | ||
9 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
10 | __inout SIZE_T* pcchOut | ||
11 | ) = 0; | ||
12 | |||
13 | STDMETHOD(EvaluateCondition)( | ||
14 | __in_z LPCWSTR wzCondition, | ||
15 | __out BOOL* pf | ||
16 | ) = 0; | ||
17 | |||
18 | STDMETHOD(FormatString)( | ||
19 | __in_z LPCWSTR wzIn, | ||
20 | __out_ecount_opt(*pcchOut) LPWSTR wzOut, | ||
21 | __inout SIZE_T* pcchOut | ||
22 | ) = 0; | ||
23 | |||
24 | STDMETHOD(GetVariableNumeric)( | ||
25 | __in_z LPCWSTR wzVariable, | ||
26 | __out LONGLONG* pllValue | ||
27 | ) = 0; | ||
28 | |||
29 | STDMETHOD(GetVariableString)( | ||
30 | __in_z LPCWSTR wzVariable, | ||
31 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
32 | __inout SIZE_T* pcchValue | ||
33 | ) = 0; | ||
34 | |||
35 | STDMETHOD(GetVariableVersion)( | ||
36 | __in_z LPCWSTR wzVariable, | ||
37 | __out_ecount_opt(*pcchValue) LPWSTR wzValue, | ||
38 | __inout SIZE_T* pcchValue | ||
39 | ) = 0; | ||
40 | |||
41 | STDMETHOD(Log)( | ||
42 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
43 | __in_z LPCWSTR wzMessage | ||
44 | ) = 0; | ||
45 | |||
46 | STDMETHOD(SetVariableNumeric)( | ||
47 | __in_z LPCWSTR wzVariable, | ||
48 | __in LONGLONG llValue | ||
49 | ) = 0; | ||
50 | |||
51 | STDMETHOD(SetVariableString)( | ||
52 | __in_z LPCWSTR wzVariable, | ||
53 | __in_z_opt LPCWSTR wzValue, | ||
54 | __in BOOL fFormatted | ||
55 | ) = 0; | ||
56 | |||
57 | STDMETHOD(SetVariableVersion)( | ||
58 | __in_z LPCWSTR wzVariable, | ||
59 | __in_z_opt LPCWSTR wzValue | ||
60 | ) = 0; | ||
61 | |||
62 | STDMETHOD(CompareVersions)( | ||
63 | __in_z LPCWSTR wzVersion1, | ||
64 | __in_z LPCWSTR wzVersion2, | ||
65 | __out int* pnResult | ||
66 | ) = 0; | ||
67 | }; | ||
diff --git a/src/api/burn/bextutil/inc/bextutil.h b/src/api/burn/bextutil/inc/bextutil.h new file mode 100644 index 00000000..ac9c0062 --- /dev/null +++ b/src/api/burn/bextutil/inc/bextutil.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include "dutil.h" | ||
6 | |||
7 | |||
8 | #ifdef __cplusplus | ||
9 | extern "C" { | ||
10 | #endif | ||
11 | |||
12 | #define BextExitOnFailureSource(d, x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
13 | #define BextExitOnRootFailureSource(d, x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
14 | #define BextExitOnLastErrorSource(d, x, f, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } } | ||
15 | #define BextExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
16 | #define BextExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
17 | #define BextExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
18 | |||
19 | #define BextExitOnFailure(x, f, ...) BextExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
20 | #define BextExitOnRootFailure(x, f, ...) BextExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
21 | #define BextExitOnLastError(x, f, ...) BextExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
22 | #define BextExitOnNull(p, x, e, f, ...) BextExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) | ||
23 | #define BextExitOnNullWithLastError(p, x, f, ...) BextExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) | ||
24 | #define BextExitWithLastError(x, f, ...) BextExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
25 | |||
26 | const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; | ||
27 | |||
28 | |||
29 | /******************************************************************* | ||
30 | BextInitialize - remembers the engine interface to enable logging and | ||
31 | other functions. | ||
32 | |||
33 | ********************************************************************/ | ||
34 | DAPI_(void) BextInitialize( | ||
35 | __in IBundleExtensionEngine* pEngine | ||
36 | ); | ||
37 | |||
38 | /******************************************************************* | ||
39 | BextInitializeFromCreateArgs - convenience function to call BextBundleExtensionEngineCreate | ||
40 | then pass it along to BextInitialize. | ||
41 | |||
42 | ********************************************************************/ | ||
43 | DAPI_(HRESULT) BextInitializeFromCreateArgs( | ||
44 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
45 | __out IBundleExtensionEngine** ppEngine | ||
46 | ); | ||
47 | |||
48 | /******************************************************************* | ||
49 | BextUninitialize - cleans up utility layer internals. | ||
50 | |||
51 | ********************************************************************/ | ||
52 | DAPI_(void) BextUninitialize(); | ||
53 | |||
54 | /******************************************************************* | ||
55 | BextGetBundleExtensionDataNode - gets the requested BundleExtension node. | ||
56 | |||
57 | ********************************************************************/ | ||
58 | DAPI_(HRESULT) BextGetBundleExtensionDataNode( | ||
59 | __in IXMLDOMDocument* pixdManifest, | ||
60 | __in LPCWSTR wzExtensionId, | ||
61 | __out IXMLDOMNode** ppixnBundleExtension | ||
62 | ); | ||
63 | |||
64 | /******************************************************************* | ||
65 | BextLog - logs a message with the engine. | ||
66 | |||
67 | ********************************************************************/ | ||
68 | DAPIV_(HRESULT) BextLog( | ||
69 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
70 | __in_z __format_string LPCSTR szFormat, | ||
71 | ... | ||
72 | ); | ||
73 | |||
74 | /******************************************************************* | ||
75 | BextLogArgs - logs a message with the engine. | ||
76 | |||
77 | ********************************************************************/ | ||
78 | DAPI_(HRESULT) BextLogArgs( | ||
79 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
80 | __in_z __format_string LPCSTR szFormat, | ||
81 | __in va_list args | ||
82 | ); | ||
83 | |||
84 | /******************************************************************* | ||
85 | BextLogError - logs an error message with the engine. | ||
86 | |||
87 | ********************************************************************/ | ||
88 | DAPIV_(HRESULT) BextLogError( | ||
89 | __in HRESULT hr, | ||
90 | __in_z __format_string LPCSTR szFormat, | ||
91 | ... | ||
92 | ); | ||
93 | |||
94 | /******************************************************************* | ||
95 | BextLogErrorArgs - logs an error message with the engine. | ||
96 | |||
97 | ********************************************************************/ | ||
98 | DAPI_(HRESULT) BextLogErrorArgs( | ||
99 | __in HRESULT hr, | ||
100 | __in_z __format_string LPCSTR szFormat, | ||
101 | __in va_list args | ||
102 | ); | ||
103 | |||
104 | #ifdef __cplusplus | ||
105 | } | ||
106 | #endif | ||
diff --git a/src/api/burn/bextutil/packages.config b/src/api/burn/bextutil/packages.config new file mode 100644 index 00000000..08ea3364 --- /dev/null +++ b/src/api/burn/bextutil/packages.config | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <packages> | ||
3 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | ||
4 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
5 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
6 | </packages> \ No newline at end of file | ||
diff --git a/src/api/burn/bextutil/precomp.cpp b/src/api/burn/bextutil/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/api/burn/bextutil/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/api/burn/bextutil/precomp.h b/src/api/burn/bextutil/precomp.h new file mode 100644 index 00000000..5d1dd20b --- /dev/null +++ b/src/api/burn/bextutil/precomp.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <strsafe.h> | ||
7 | #include <msxml2.h> | ||
8 | |||
9 | #include <dutil.h> | ||
10 | #include <locutil.h> | ||
11 | #include <memutil.h> | ||
12 | #include <strutil.h> | ||
13 | #include <xmlutil.h> | ||
14 | |||
15 | #include <BundleExtensionEngine.h> | ||
16 | #include <BundleExtension.h> | ||
17 | |||
18 | #include "IBundleExtensionEngine.h" | ||
19 | #include "IBundleExtension.h" | ||
20 | |||
21 | #include "bextutil.h" | ||
22 | #include "BextBundleExtensionEngine.h" | ||
diff --git a/src/api/burn/mbanative/mbanative.cpp b/src/api/burn/mbanative/mbanative.cpp new file mode 100644 index 00000000..98ea3c30 --- /dev/null +++ b/src/api/burn/mbanative/mbanative.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BalBaseBootstrapperApplicationProc.h" | ||
5 | |||
6 | extern "C" HRESULT WINAPI InitializeFromCreateArgs( | ||
7 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
8 | __inout BOOTSTRAPPER_COMMAND* pCommand, | ||
9 | __out IBootstrapperEngine** ppEngine | ||
10 | ) | ||
11 | { | ||
12 | HRESULT hr = S_OK; | ||
13 | |||
14 | hr = BalInitializeFromCreateArgs(pArgs, ppEngine); | ||
15 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
16 | |||
17 | memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, min(pArgs->pCommand->cbSize, pCommand->cbSize)); | ||
18 | LExit: | ||
19 | return hr; | ||
20 | } | ||
21 | |||
22 | extern "C" void WINAPI StoreBAInCreateResults( | ||
23 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, | ||
24 | __in IBootstrapperApplication* pBA | ||
25 | ) | ||
26 | { | ||
27 | pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; | ||
28 | pResults->pvBootstrapperApplicationProcContext = pBA; | ||
29 | } | ||
diff --git a/src/api/burn/mbanative/mbanative.def b/src/api/burn/mbanative/mbanative.def new file mode 100644 index 00000000..28e923b6 --- /dev/null +++ b/src/api/burn/mbanative/mbanative.def | |||
@@ -0,0 +1,12 @@ | |||
1 | ; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | |||
4 | EXPORTS | ||
5 | InitializeFromCreateArgs | ||
6 | StoreBAInCreateResults | ||
7 | VerCompareParsedVersions | ||
8 | VerCompareStringVersions | ||
9 | VerCopyVersion | ||
10 | VerFreeVersion | ||
11 | VerParseVersion | ||
12 | VerVersionFromQword | ||
diff --git a/src/api/burn/mbanative/mbanative.vcxproj b/src/api/burn/mbanative/mbanative.vcxproj new file mode 100644 index 00000000..f91fe3be --- /dev/null +++ b/src/api/burn/mbanative/mbanative.vcxproj | |||
@@ -0,0 +1,102 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
6 | <Import Project="..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props" Condition="Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" /> | ||
7 | <Import Project="..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props" Condition="Exists('..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" /> | ||
8 | <Import Project="..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" /> | ||
9 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
10 | |||
11 | <ItemGroup Label="ProjectConfigurations"> | ||
12 | <ProjectConfiguration Include="Debug|ARM64"> | ||
13 | <Configuration>Debug</Configuration> | ||
14 | <Platform>ARM64</Platform> | ||
15 | </ProjectConfiguration> | ||
16 | <ProjectConfiguration Include="Release|ARM64"> | ||
17 | <Configuration>Release</Configuration> | ||
18 | <Platform>ARM64</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | <ProjectConfiguration Include="Debug|Win32"> | ||
21 | <Configuration>Debug</Configuration> | ||
22 | <Platform>Win32</Platform> | ||
23 | </ProjectConfiguration> | ||
24 | <ProjectConfiguration Include="Release|Win32"> | ||
25 | <Configuration>Release</Configuration> | ||
26 | <Platform>Win32</Platform> | ||
27 | </ProjectConfiguration> | ||
28 | <ProjectConfiguration Include="Debug|x64"> | ||
29 | <Configuration>Debug</Configuration> | ||
30 | <Platform>x64</Platform> | ||
31 | </ProjectConfiguration> | ||
32 | <ProjectConfiguration Include="Release|x64"> | ||
33 | <Configuration>Release</Configuration> | ||
34 | <Platform>x64</Platform> | ||
35 | </ProjectConfiguration> | ||
36 | </ItemGroup> | ||
37 | |||
38 | <PropertyGroup Label="Globals"> | ||
39 | <ProjectGuid>{665E0441-17F9-4105-B202-EDF274657F6E}</ProjectGuid> | ||
40 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
41 | <PlatformToolset>v142</PlatformToolset> | ||
42 | <CharacterSet>Unicode</CharacterSet> | ||
43 | <TargetName>mbanative</TargetName> | ||
44 | <ProjectModuleDefinitionFile>mbanative.def</ProjectModuleDefinitionFile> | ||
45 | <EnableSourceLink Condition=" '$(PlatformToolset)'=='v140' ">false</EnableSourceLink> | ||
46 | </PropertyGroup> | ||
47 | |||
48 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
49 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
50 | <Import Project="..\NativeMultiTargeting.Build.props" /> | ||
51 | |||
52 | <ImportGroup Label="Shared"> | ||
53 | <Import Project="..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets" Condition="Exists('..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" /> | ||
54 | <Import Project="..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets" Condition="Exists('..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" /> | ||
55 | <Import Project="..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets" Condition="Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" /> | ||
56 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
57 | </ImportGroup> | ||
58 | |||
59 | <PropertyGroup> | ||
60 | <ProjectAdditionalIncludeDirectories>..\balutil\inc</ProjectAdditionalIncludeDirectories> | ||
61 | <ProjectAdditionalLinkLibraries>balutil.lib</ProjectAdditionalLinkLibraries> | ||
62 | </PropertyGroup> | ||
63 | |||
64 | <ItemGroup> | ||
65 | <ClCompile Include="mbanative.cpp" /> | ||
66 | <ClCompile Include="precomp.cpp"> | ||
67 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
68 | </ClCompile> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ClInclude Include="precomp.h" /> | ||
72 | </ItemGroup> | ||
73 | <ItemGroup> | ||
74 | <None Include="mbanative.def" /> | ||
75 | </ItemGroup> | ||
76 | |||
77 | <ItemGroup> | ||
78 | <None Include="packages.config" /> | ||
79 | </ItemGroup> | ||
80 | |||
81 | <ItemGroup> | ||
82 | <ProjectReference Include="..\balutil\balutil.vcxproj"> | ||
83 | <Project>{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}</Project> | ||
84 | </ProjectReference> | ||
85 | </ItemGroup> | ||
86 | |||
87 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
88 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
89 | <PropertyGroup> | ||
90 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
91 | </PropertyGroup> | ||
92 | <Error Condition="!Exists('..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props'))" /> | ||
93 | <Error Condition="!Exists('..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.targets'))" /> | ||
94 | <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props'))" /> | ||
95 | <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.targets'))" /> | ||
96 | <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props'))" /> | ||
97 | <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets'))" /> | ||
98 | <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" /> | ||
99 | <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
100 | <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
101 | </Target> | ||
102 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/mbanative/packages.config b/src/api/burn/mbanative/packages.config new file mode 100644 index 00000000..745fcae9 --- /dev/null +++ b/src/api/burn/mbanative/packages.config | |||
@@ -0,0 +1,9 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <packages> | ||
3 | <package id="Microsoft.Build.Tasks.Git" version="1.0.0" targetFramework="native" developmentDependency="true" /> | ||
4 | <package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="native" developmentDependency="true" /> | ||
5 | <package id="Microsoft.SourceLink.GitHub" version="1.0.0" targetFramework="native" developmentDependency="true" /> | ||
6 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | ||
7 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
8 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
9 | </packages> \ No newline at end of file | ||
diff --git a/src/api/burn/mbanative/precomp.cpp b/src/api/burn/mbanative/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/api/burn/mbanative/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/api/burn/mbanative/precomp.h b/src/api/burn/mbanative/precomp.h new file mode 100644 index 00000000..2e2f3ff8 --- /dev/null +++ b/src/api/burn/mbanative/precomp.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | |||
8 | #include <dutil.h> | ||
9 | #include <verutil.h> | ||
10 | |||
11 | #include <BootstrapperEngine.h> | ||
12 | #include <BootstrapperApplication.h> | ||
13 | |||
14 | #include <IBootstrapperEngine.h> | ||
15 | #include <IBootstrapperApplication.h> | ||
16 | #include <balutil.h> | ||
diff --git a/src/api/burn/nuget.config b/src/api/burn/nuget.config new file mode 100644 index 00000000..2c6c5608 --- /dev/null +++ b/src/api/burn/nuget.config | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <configuration> | ||
3 | <packageSources> | ||
4 | <clear /> | ||
5 | <add key="wixbuildtools" value="https://ci.appveyor.com/nuget/wixbuildtools" /> | ||
6 | <add key="wixtoolset-burn" value="https://ci.appveyor.com/nuget/wixtoolset-burn" /> | ||
7 | <add key="wixtoolset-dutil" value="https://ci.appveyor.com/nuget/wixtoolset-dutil" /> | ||
8 | <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
9 | </packageSources> | ||
10 | </configuration> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj new file mode 100644 index 00000000..d3a81e2a --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj | |||
@@ -0,0 +1,76 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <Import Project="..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
7 | <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props')" /> | ||
8 | <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
9 | <ItemGroup Label="ProjectConfigurations"> | ||
10 | <ProjectConfiguration Include="Debug|Win32"> | ||
11 | <Configuration>Debug</Configuration> | ||
12 | <Platform>Win32</Platform> | ||
13 | </ProjectConfiguration> | ||
14 | <ProjectConfiguration Include="Release|Win32"> | ||
15 | <Configuration>Release</Configuration> | ||
16 | <Platform>Win32</Platform> | ||
17 | </ProjectConfiguration> | ||
18 | </ItemGroup> | ||
19 | <PropertyGroup Label="Globals"> | ||
20 | <ProjectTypes>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</ProjectTypes> | ||
21 | <ProjectGuid>{9B507AF9-035E-4DB6-8C0C-5DCC3FEF2631}</ProjectGuid> | ||
22 | <RootNamespace>UnitTest</RootNamespace> | ||
23 | <Keyword>ManagedCProj</Keyword> | ||
24 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
25 | <CharacterSet>Unicode</CharacterSet> | ||
26 | <CLRSupport>true</CLRSupport> | ||
27 | <SignOutput>false</SignOutput> | ||
28 | </PropertyGroup> | ||
29 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
30 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
31 | <PropertyGroup> | ||
32 | <ProjectAdditionalIncludeDirectories>..\..\balutil\inc</ProjectAdditionalIncludeDirectories> | ||
33 | <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries> | ||
34 | </PropertyGroup> | ||
35 | <ItemGroup> | ||
36 | <ClCompile Include="precomp.cpp"> | ||
37 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
38 | <!-- Warnings from referencing netstandard dlls --> | ||
39 | <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings> | ||
40 | </ClCompile> | ||
41 | <ClCompile Include="TestBAFunctions.cpp" /> | ||
42 | <ClCompile Include="TestBootstrapperApplication.cpp" /> | ||
43 | </ItemGroup> | ||
44 | <ItemGroup> | ||
45 | <ClInclude Include="precomp.h" /> | ||
46 | </ItemGroup> | ||
47 | <ItemGroup> | ||
48 | <None Include="packages.config" /> | ||
49 | </ItemGroup> | ||
50 | <ItemGroup> | ||
51 | <Reference Include="System" /> | ||
52 | <Reference Include="System.Core" /> | ||
53 | <Reference Include="WixBuildTools.TestSupport"> | ||
54 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.4.0.50\lib\net472\WixBuildTools.TestSupport.dll</HintPath> | ||
55 | </Reference> | ||
56 | <Reference Include="WixBuildTools.TestSupport.Native"> | ||
57 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\lib\net472\WixBuildTools.TestSupport.Native.dll</HintPath> | ||
58 | </Reference> | ||
59 | </ItemGroup> | ||
60 | <ItemGroup> | ||
61 | <ProjectReference Include="..\..\balutil\balutil.vcxproj"> | ||
62 | <Project>{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}</Project> | ||
63 | </ProjectReference> | ||
64 | </ItemGroup> | ||
65 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
66 | <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets')" /> | ||
67 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
68 | <PropertyGroup> | ||
69 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
70 | </PropertyGroup> | ||
71 | <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props'))" /> | ||
72 | <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets'))" /> | ||
73 | <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
74 | <Error Condition="!Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
75 | </Target> | ||
76 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters new file mode 100644 index 00000000..85f31076 --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/BalUtilUnitTest.vcxproj.filters | |||
@@ -0,0 +1,33 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup> | ||
4 | <Filter Include="Source Files"> | ||
5 | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
6 | <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
7 | </Filter> | ||
8 | <Filter Include="Header Files"> | ||
9 | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
10 | <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
11 | </Filter> | ||
12 | <Filter Include="Resource Files"> | ||
13 | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
14 | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> | ||
15 | </Filter> | ||
16 | </ItemGroup> | ||
17 | <ItemGroup> | ||
18 | <ClCompile Include="precomp.cpp"> | ||
19 | <Filter>Source Files</Filter> | ||
20 | </ClCompile> | ||
21 | <ClCompile Include="TestBAFunctions.cpp"> | ||
22 | <Filter>Source Files</Filter> | ||
23 | </ClCompile> | ||
24 | <ClCompile Include="TestBootstrapperApplication.cpp"> | ||
25 | <Filter>Source Files</Filter> | ||
26 | </ClCompile> | ||
27 | </ItemGroup> | ||
28 | <ItemGroup> | ||
29 | <ClInclude Include="precomp.h"> | ||
30 | <Filter>Header Files</Filter> | ||
31 | </ClInclude> | ||
32 | </ItemGroup> | ||
33 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp new file mode 100644 index 00000000..927a8d10 --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/TestBAFunctions.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BalBaseBAFunctions.h" | ||
5 | #include "BalBaseBAFunctionsProc.h" | ||
6 | |||
7 | class CTestBAFunctions : public CBalBaseBAFunctions | ||
8 | { | ||
9 | public: | ||
10 | CTestBAFunctions( | ||
11 | __in HMODULE hModule, | ||
12 | __in IBootstrapperEngine* pEngine, | ||
13 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
14 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
15 | { | ||
16 | } | ||
17 | }; | ||
18 | |||
19 | HRESULT CreateBAFunctions( | ||
20 | __in HMODULE hModule, | ||
21 | __in IBootstrapperEngine* pEngine, | ||
22 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
23 | __in BA_FUNCTIONS_CREATE_RESULTS* pResults, | ||
24 | __out IBAFunctions** ppApplication | ||
25 | ) | ||
26 | { | ||
27 | HRESULT hr = S_OK; | ||
28 | CTestBAFunctions* pApplication = NULL; | ||
29 | |||
30 | pApplication = new CTestBAFunctions(hModule, pEngine, pArgs); | ||
31 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bafunctions object."); | ||
32 | |||
33 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | ||
34 | pResults->pvBAFunctionsProcContext = pApplication; | ||
35 | *ppApplication = pApplication; | ||
36 | pApplication = NULL; | ||
37 | |||
38 | LExit: | ||
39 | ReleaseObject(pApplication); | ||
40 | return hr; | ||
41 | } | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp new file mode 100644 index 00000000..13d22e72 --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/TestBootstrapperApplication.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BalBaseBootstrapperApplication.h" | ||
5 | #include "BalBaseBootstrapperApplicationProc.h" | ||
6 | |||
7 | class CTestBootstrapperApplication : public CBalBaseBootstrapperApplication | ||
8 | { | ||
9 | public: | ||
10 | CTestBootstrapperApplication( | ||
11 | __in IBootstrapperEngine* pEngine, | ||
12 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs | ||
13 | ) : CBalBaseBootstrapperApplication(pEngine, pArgs) | ||
14 | { | ||
15 | } | ||
16 | }; | ||
17 | |||
18 | HRESULT CreateBootstrapperApplication( | ||
19 | __in IBootstrapperEngine* pEngine, | ||
20 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
21 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults, | ||
22 | __out IBootstrapperApplication** ppApplication | ||
23 | ) | ||
24 | { | ||
25 | HRESULT hr = S_OK; | ||
26 | CTestBootstrapperApplication* pApplication = NULL; | ||
27 | |||
28 | pApplication = new CTestBootstrapperApplication(pEngine, pArgs); | ||
29 | ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new test bootstrapper application object."); | ||
30 | |||
31 | pResults->pfnBootstrapperApplicationProc = BalBaseBootstrapperApplicationProc; | ||
32 | pResults->pvBootstrapperApplicationProcContext = pApplication; | ||
33 | *ppApplication = pApplication; | ||
34 | pApplication = NULL; | ||
35 | |||
36 | LExit: | ||
37 | ReleaseObject(pApplication); | ||
38 | return hr; | ||
39 | } | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/packages.config b/src/api/burn/test/BalUtilUnitTest/packages.config new file mode 100644 index 00000000..6d381fbe --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/packages.config | |||
@@ -0,0 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <packages> | ||
4 | <package id="WixBuildTools.TestSupport" version="4.0.50" /> | ||
5 | <package id="WixBuildTools.TestSupport.Native" version="4.0.50" /> | ||
6 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
7 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
8 | <package id="xunit.abstractions" version="2.0.3" /> | ||
9 | <package id="xunit.assert" version="2.4.1" /> | ||
10 | <package id="xunit.core" version="2.4.1" /> | ||
11 | <package id="xunit.extensibility.core" version="2.4.1" /> | ||
12 | <package id="xunit.extensibility.execution" version="2.4.1" /> | ||
13 | <package id="xunit.runner.msbuild" version="2.4.1" /> | ||
14 | <package id="xunit.runner.visualstudio" version="2.4.1" /> | ||
15 | </packages> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/precomp.cpp b/src/api/burn/test/BalUtilUnitTest/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/api/burn/test/BalUtilUnitTest/precomp.h b/src/api/burn/test/BalUtilUnitTest/precomp.h new file mode 100644 index 00000000..a84391f9 --- /dev/null +++ b/src/api/burn/test/BalUtilUnitTest/precomp.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | #include <CommCtrl.h> | ||
8 | |||
9 | #include <dutil.h> | ||
10 | #include <locutil.h> | ||
11 | #include <thmutil.h> | ||
12 | |||
13 | #include <BootstrapperEngine.h> | ||
14 | #include <BootstrapperApplication.h> | ||
15 | |||
16 | #include "IBootstrapperEngine.h" | ||
17 | #include "IBootstrapperApplication.h" | ||
18 | #include "balutil.h" | ||
19 | #include "balretry.h" | ||
20 | #include "BAFunctions.h" | ||
21 | |||
22 | #pragma managed | ||
23 | #include <vcclr.h> | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj new file mode 100644 index 00000000..a9937894 --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj | |||
@@ -0,0 +1,75 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <Import Project="..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
7 | <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props')" /> | ||
8 | <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
9 | <ItemGroup Label="ProjectConfigurations"> | ||
10 | <ProjectConfiguration Include="Debug|Win32"> | ||
11 | <Configuration>Debug</Configuration> | ||
12 | <Platform>Win32</Platform> | ||
13 | </ProjectConfiguration> | ||
14 | <ProjectConfiguration Include="Release|Win32"> | ||
15 | <Configuration>Release</Configuration> | ||
16 | <Platform>Win32</Platform> | ||
17 | </ProjectConfiguration> | ||
18 | </ItemGroup> | ||
19 | <PropertyGroup Label="Globals"> | ||
20 | <ProjectTypes>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</ProjectTypes> | ||
21 | <ProjectGuid>{B69E6422-49B0-4E28-92F9-B8A7410A6ED9}</ProjectGuid> | ||
22 | <RootNamespace>UnitTest</RootNamespace> | ||
23 | <Keyword>ManagedCProj</Keyword> | ||
24 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
25 | <CharacterSet>Unicode</CharacterSet> | ||
26 | <CLRSupport>true</CLRSupport> | ||
27 | <SignOutput>false</SignOutput> | ||
28 | </PropertyGroup> | ||
29 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
30 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
31 | <PropertyGroup> | ||
32 | <ProjectAdditionalIncludeDirectories>..\..\bextutil\inc</ProjectAdditionalIncludeDirectories> | ||
33 | <ProjectAdditionalLinkLibraries></ProjectAdditionalLinkLibraries> | ||
34 | </PropertyGroup> | ||
35 | <ItemGroup> | ||
36 | <ClCompile Include="precomp.cpp"> | ||
37 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
38 | <!-- Warnings from referencing netstandard dlls --> | ||
39 | <DisableSpecificWarnings>4564;4691</DisableSpecificWarnings> | ||
40 | </ClCompile> | ||
41 | <ClCompile Include="TestBundleExtension.cpp" /> | ||
42 | </ItemGroup> | ||
43 | <ItemGroup> | ||
44 | <ClInclude Include="precomp.h" /> | ||
45 | </ItemGroup> | ||
46 | <ItemGroup> | ||
47 | <None Include="packages.config" /> | ||
48 | </ItemGroup> | ||
49 | <ItemGroup> | ||
50 | <Reference Include="System" /> | ||
51 | <Reference Include="System.Core" /> | ||
52 | <Reference Include="WixBuildTools.TestSupport"> | ||
53 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.4.0.50\lib\net472\WixBuildTools.TestSupport.dll</HintPath> | ||
54 | </Reference> | ||
55 | <Reference Include="WixBuildTools.TestSupport.Native"> | ||
56 | <HintPath>..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\lib\net472\WixBuildTools.TestSupport.Native.dll</HintPath> | ||
57 | </Reference> | ||
58 | </ItemGroup> | ||
59 | <ItemGroup> | ||
60 | <ProjectReference Include="..\..\balutil\balutil.vcxproj"> | ||
61 | <Project>{06027492-1CB9-48BC-B31E-C1F9356ED07E}</Project> | ||
62 | </ProjectReference> | ||
63 | </ItemGroup> | ||
64 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
65 | <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets')" /> | ||
66 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
67 | <PropertyGroup> | ||
68 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
69 | </PropertyGroup> | ||
70 | <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.props'))" /> | ||
71 | <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.50\build\WixBuildTools.TestSupport.Native.targets'))" /> | ||
72 | <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
73 | <Error Condition="!Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
74 | </Target> | ||
75 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters new file mode 100644 index 00000000..f1711f81 --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters | |||
@@ -0,0 +1,30 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup> | ||
4 | <Filter Include="Source Files"> | ||
5 | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
6 | <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
7 | </Filter> | ||
8 | <Filter Include="Header Files"> | ||
9 | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
10 | <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
11 | </Filter> | ||
12 | <Filter Include="Resource Files"> | ||
13 | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
14 | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> | ||
15 | </Filter> | ||
16 | </ItemGroup> | ||
17 | <ItemGroup> | ||
18 | <ClCompile Include="precomp.cpp"> | ||
19 | <Filter>Source Files</Filter> | ||
20 | </ClCompile> | ||
21 | <ClCompile Include="TestBundleExtension.cpp"> | ||
22 | <Filter>Source Files</Filter> | ||
23 | </ClCompile> | ||
24 | </ItemGroup> | ||
25 | <ItemGroup> | ||
26 | <ClInclude Include="precomp.h"> | ||
27 | <Filter>Header Files</Filter> | ||
28 | </ClInclude> | ||
29 | </ItemGroup> | ||
30 | </Project> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp b/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp new file mode 100644 index 00000000..921303bb --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp | |||
@@ -0,0 +1,42 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BextBaseBundleExtension.h" | ||
5 | #include "BextBaseBundleExtensionProc.h" | ||
6 | |||
7 | class CTestBundleExtension : public CBextBaseBundleExtension | ||
8 | { | ||
9 | public: | ||
10 | CTestBundleExtension( | ||
11 | __in IBundleExtensionEngine* pEngine | ||
12 | ) : CBextBaseBundleExtension(pEngine) | ||
13 | { | ||
14 | } | ||
15 | }; | ||
16 | |||
17 | HRESULT TestBundleExtensionCreate( | ||
18 | __in IBundleExtensionEngine* pEngine, | ||
19 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
20 | __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults, | ||
21 | __out IBundleExtension** ppBundleExtension | ||
22 | ) | ||
23 | { | ||
24 | HRESULT hr = S_OK; | ||
25 | CTestBundleExtension* pExtension = NULL; | ||
26 | |||
27 | pExtension = new CTestBundleExtension(pEngine); | ||
28 | ExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CTestBundleExtension."); | ||
29 | |||
30 | hr = pExtension->Initialize(pArgs); | ||
31 | ExitOnFailure(hr, "CTestBundleExtension initialization failed"); | ||
32 | |||
33 | pResults->pfnBundleExtensionProc = BextBaseBundleExtensionProc; | ||
34 | pResults->pvBundleExtensionProcContext = pExtension; | ||
35 | |||
36 | *ppBundleExtension = pExtension; | ||
37 | pExtension = NULL; | ||
38 | |||
39 | LExit: | ||
40 | ReleaseObject(pExtension); | ||
41 | return hr; | ||
42 | } | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/packages.config b/src/api/burn/test/BextUtilUnitTest/packages.config new file mode 100644 index 00000000..6d381fbe --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/packages.config | |||
@@ -0,0 +1,15 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <packages> | ||
4 | <package id="WixBuildTools.TestSupport" version="4.0.50" /> | ||
5 | <package id="WixBuildTools.TestSupport.Native" version="4.0.50" /> | ||
6 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
7 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
8 | <package id="xunit.abstractions" version="2.0.3" /> | ||
9 | <package id="xunit.assert" version="2.4.1" /> | ||
10 | <package id="xunit.core" version="2.4.1" /> | ||
11 | <package id="xunit.extensibility.core" version="2.4.1" /> | ||
12 | <package id="xunit.extensibility.execution" version="2.4.1" /> | ||
13 | <package id="xunit.runner.msbuild" version="2.4.1" /> | ||
14 | <package id="xunit.runner.visualstudio" version="2.4.1" /> | ||
15 | </packages> \ No newline at end of file | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/precomp.cpp b/src/api/burn/test/BextUtilUnitTest/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
diff --git a/src/api/burn/test/BextUtilUnitTest/precomp.h b/src/api/burn/test/BextUtilUnitTest/precomp.h new file mode 100644 index 00000000..a6586f70 --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/precomp.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | |||
8 | #include <dutil.h> | ||
9 | #include <strutil.h> | ||
10 | |||
11 | #include <BundleExtensionEngine.h> | ||
12 | #include <BundleExtension.h> | ||
13 | |||
14 | #include "IBundleExtensionEngine.h" | ||
15 | #include "IBundleExtension.h" | ||
16 | #include "bextutil.h" | ||
17 | |||
18 | #pragma managed | ||
19 | #include <vcclr.h> | ||
diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs b/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs new file mode 100644 index 00000000..aaf5ee29 --- /dev/null +++ b/src/api/burn/test/WixToolsetTest.Mba.Core/BaseBootstrapperApplicationFactoryFixture.cs | |||
@@ -0,0 +1,132 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using System.Runtime.InteropServices; | ||
7 | using WixToolset.Mba.Core; | ||
8 | using Xunit; | ||
9 | |||
10 | public class BaseBootstrapperApplicationFactoryFixture | ||
11 | { | ||
12 | [Fact] | ||
13 | public void CanCreateBA() | ||
14 | { | ||
15 | var command = new TestCommand | ||
16 | { | ||
17 | action = LaunchAction.Install, | ||
18 | cbSize = Marshal.SizeOf(typeof(TestCommand)), | ||
19 | display = Display.Full, | ||
20 | wzCommandLine = "this \"is a\" test", | ||
21 | }; | ||
22 | var pCommand = Marshal.AllocHGlobal(command.cbSize); | ||
23 | try | ||
24 | { | ||
25 | Marshal.StructureToPtr(command, pCommand, false); | ||
26 | var createArgs = new BootstrapperCreateArgs(0, IntPtr.Zero, IntPtr.Zero, pCommand); | ||
27 | var pArgs = Marshal.AllocHGlobal(createArgs.cbSize); | ||
28 | try | ||
29 | { | ||
30 | Marshal.StructureToPtr(createArgs, pArgs, false); | ||
31 | var createResults = new TestCreateResults | ||
32 | { | ||
33 | cbSize = Marshal.SizeOf<TestCreateResults>(), | ||
34 | }; | ||
35 | var pResults = Marshal.AllocHGlobal(createResults.cbSize); | ||
36 | try | ||
37 | { | ||
38 | var baFactory = new TestBAFactory(); | ||
39 | baFactory.Create(pArgs, pResults); | ||
40 | |||
41 | createResults = Marshal.PtrToStructure<TestCreateResults>(pResults); | ||
42 | Assert.Equal(baFactory.BA, createResults.pBA); | ||
43 | Assert.Equal(baFactory.BA.Command.Action, command.action); | ||
44 | Assert.Equal(baFactory.BA.Command.Display, command.display); | ||
45 | Assert.Equal(baFactory.BA.Command.CommandLineArgs, new string[] { "this", "is a", "test" }); | ||
46 | } | ||
47 | finally | ||
48 | { | ||
49 | Marshal.FreeHGlobal(pResults); | ||
50 | } | ||
51 | } | ||
52 | finally | ||
53 | { | ||
54 | Marshal.FreeHGlobal(pArgs); | ||
55 | } | ||
56 | } | ||
57 | finally | ||
58 | { | ||
59 | Marshal.FreeHGlobal(pCommand); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | internal class TestBAFactory : BaseBootstrapperApplicationFactory | ||
64 | { | ||
65 | public TestBA BA { get; private set; } | ||
66 | |||
67 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
68 | { | ||
69 | this.BA = new TestBA(engine, bootstrapperCommand); | ||
70 | return this.BA; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | internal class TestBA : BootstrapperApplication | ||
75 | { | ||
76 | public IBootstrapperCommand Command { get; } | ||
77 | |||
78 | public TestBA(IEngine engine, IBootstrapperCommand command) | ||
79 | : base(engine) | ||
80 | { | ||
81 | this.Command = command; | ||
82 | } | ||
83 | |||
84 | protected override void Run() | ||
85 | { | ||
86 | } | ||
87 | } | ||
88 | |||
89 | [StructLayout(LayoutKind.Sequential)] | ||
90 | public struct TestCommand | ||
91 | { | ||
92 | public int cbSize; | ||
93 | public LaunchAction action; | ||
94 | public Display display; | ||
95 | public Restart restart; | ||
96 | [MarshalAs(UnmanagedType.LPWStr)] public string wzCommandLine; | ||
97 | public int nCmdShow; | ||
98 | public ResumeType resume; | ||
99 | public IntPtr hwndSplashScreen; | ||
100 | public RelationType relation; | ||
101 | [MarshalAs(UnmanagedType.Bool)] public bool passthrough; | ||
102 | [MarshalAs(UnmanagedType.LPWStr)] public string wzLayoutDirectory; | ||
103 | } | ||
104 | |||
105 | [StructLayout(LayoutKind.Sequential)] | ||
106 | public struct BootstrapperCreateArgs | ||
107 | { | ||
108 | [MarshalAs(UnmanagedType.I4)] public readonly int cbSize; | ||
109 | [MarshalAs(UnmanagedType.I8)] public readonly long qwEngineAPIVersion; | ||
110 | public readonly IntPtr pfnBootstrapperEngineProc; | ||
111 | public readonly IntPtr pvBootstrapperEngineProcContext; | ||
112 | public readonly IntPtr pCommand; | ||
113 | |||
114 | public BootstrapperCreateArgs(long version, IntPtr pEngineProc, IntPtr pEngineContext, IntPtr pCommand) | ||
115 | { | ||
116 | this.cbSize = Marshal.SizeOf(typeof(BootstrapperCreateArgs)); | ||
117 | this.qwEngineAPIVersion = version; | ||
118 | this.pfnBootstrapperEngineProc = pEngineProc; | ||
119 | this.pvBootstrapperEngineProcContext = pEngineContext; | ||
120 | this.pCommand = pCommand; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | [StructLayout(LayoutKind.Sequential)] | ||
125 | public struct TestCreateResults | ||
126 | { | ||
127 | public int cbSize; | ||
128 | public IntPtr pBAProc; | ||
129 | [MarshalAs(UnmanagedType.Interface)] public IBootstrapperApplication pBA; | ||
130 | } | ||
131 | } | ||
132 | } | ||
diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/VerUtilFixture.cs b/src/api/burn/test/WixToolsetTest.Mba.Core/VerUtilFixture.cs new file mode 100644 index 00000000..44142e3d --- /dev/null +++ b/src/api/burn/test/WixToolsetTest.Mba.Core/VerUtilFixture.cs | |||
@@ -0,0 +1,93 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Mba.Core | ||
4 | { | ||
5 | using System; | ||
6 | using WixToolset.Mba.Core; | ||
7 | using Xunit; | ||
8 | |||
9 | public class VerUtilFixture | ||
10 | { | ||
11 | [Fact] | ||
12 | public void CanCompareStringVersions() | ||
13 | { | ||
14 | var version1 = "1.2.3.4+abcd"; | ||
15 | var version2 = "1.2.3.4+zyxw"; | ||
16 | |||
17 | Assert.Equal(0, VerUtil.CompareStringVersions(version1, version2, strict: false)); | ||
18 | } | ||
19 | |||
20 | [Fact] | ||
21 | public void CanCopyVersion() | ||
22 | { | ||
23 | var version = "1.2.3.4-5.6.7.8.9.0"; | ||
24 | |||
25 | VerUtilVersion copiedVersion = null; | ||
26 | try | ||
27 | { | ||
28 | using (var parsedVersion = VerUtil.ParseVersion(version, strict: true)) | ||
29 | { | ||
30 | copiedVersion = VerUtil.CopyVersion(parsedVersion); | ||
31 | } | ||
32 | |||
33 | using (var secondVersion = VerUtil.ParseVersion(version, strict: true)) | ||
34 | { | ||
35 | Assert.Equal(0, VerUtil.CompareParsedVersions(copiedVersion, secondVersion)); | ||
36 | } | ||
37 | } | ||
38 | finally | ||
39 | { | ||
40 | copiedVersion?.Dispose(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | [Fact] | ||
45 | public void CanCreateFromQword() | ||
46 | { | ||
47 | var version = new Version(100, 200, 300, 400); | ||
48 | var qwVersion = Engine.VersionToLong(version); | ||
49 | |||
50 | using var parsedVersion = VerUtil.VersionFromQword(qwVersion); | ||
51 | Assert.Equal("100.200.300.400", parsedVersion.Version); | ||
52 | Assert.Equal(100u, parsedVersion.Major); | ||
53 | Assert.Equal(200u, parsedVersion.Minor); | ||
54 | Assert.Equal(300u, parsedVersion.Patch); | ||
55 | Assert.Equal(400u, parsedVersion.Revision); | ||
56 | Assert.Empty(parsedVersion.ReleaseLabels); | ||
57 | Assert.Equal("", parsedVersion.Metadata); | ||
58 | Assert.False(parsedVersion.IsInvalid); | ||
59 | } | ||
60 | |||
61 | [Fact] | ||
62 | public void CanParseVersion() | ||
63 | { | ||
64 | var version = "1.2.3.4-a.b.c.d.5.+abc123"; | ||
65 | |||
66 | using var parsedVersion = VerUtil.ParseVersion(version, strict: false); | ||
67 | Assert.Equal(version, parsedVersion.Version); | ||
68 | Assert.Equal(1u, parsedVersion.Major); | ||
69 | Assert.Equal(2u, parsedVersion.Minor); | ||
70 | Assert.Equal(3u, parsedVersion.Patch); | ||
71 | Assert.Equal(4u, parsedVersion.Revision); | ||
72 | Assert.Equal(5, parsedVersion.ReleaseLabels.Length); | ||
73 | Assert.Equal("+abc123", parsedVersion.Metadata); | ||
74 | Assert.True(parsedVersion.IsInvalid); | ||
75 | |||
76 | Assert.Equal("a", parsedVersion.ReleaseLabels[0].Label); | ||
77 | Assert.False(parsedVersion.ReleaseLabels[0].IsNumeric); | ||
78 | |||
79 | Assert.Equal("b", parsedVersion.ReleaseLabels[1].Label); | ||
80 | Assert.False(parsedVersion.ReleaseLabels[1].IsNumeric); | ||
81 | |||
82 | Assert.Equal("c", parsedVersion.ReleaseLabels[2].Label); | ||
83 | Assert.False(parsedVersion.ReleaseLabels[2].IsNumeric); | ||
84 | |||
85 | Assert.Equal("d", parsedVersion.ReleaseLabels[3].Label); | ||
86 | Assert.False(parsedVersion.ReleaseLabels[3].IsNumeric); | ||
87 | |||
88 | Assert.Equal("5", parsedVersion.ReleaseLabels[4].Label); | ||
89 | Assert.True(parsedVersion.ReleaseLabels[4].IsNumeric); | ||
90 | Assert.Equal(5u, parsedVersion.ReleaseLabels[4].Value); | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj new file mode 100644 index 00000000..53d82f7e --- /dev/null +++ b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.csproj | |||
@@ -0,0 +1,21 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
9 | <SignOutput>false</SignOutput> | ||
10 | </PropertyGroup> | ||
11 | |||
12 | <ItemGroup> | ||
13 | <ProjectReference Include="..\..\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj" /> | ||
14 | </ItemGroup> | ||
15 | |||
16 | <ItemGroup> | ||
17 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> | ||
18 | <PackageReference Include="xunit" Version="2.4.1" /> | ||
19 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | ||
20 | </ItemGroup> | ||
21 | </Project> | ||
diff --git a/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.v3.ncrunchproject b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.v3.ncrunchproject new file mode 100644 index 00000000..7b5b2139 --- /dev/null +++ b/src/api/burn/test/WixToolsetTest.Mba.Core/WixToolsetTest.Mba.Core.v3.ncrunchproject | |||
@@ -0,0 +1,5 @@ | |||
1 | <ProjectConfiguration> | ||
2 | <Settings> | ||
3 | <CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace> | ||
4 | </Settings> | ||
5 | </ProjectConfiguration> \ No newline at end of file | ||