summaryrefslogtreecommitdiff
path: root/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-11-10 22:48:05 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-11-10 23:49:10 -0600
commit209c92111928a98972d7f0f9d6d620ab566564d9 (patch)
treefd13d81105b02e63cc61c7819dba6f5c6c7e936e /src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting
parent3f6a633769a9c732db765411ef9b810133ad3957 (diff)
downloadwix-209c92111928a98972d7f0f9d6d620ab566564d9.tar.gz
wix-209c92111928a98972d7f0f9d6d620ab566564d9.tar.bz2
wix-209c92111928a98972d7f0f9d6d620ab566564d9.zip
Automate the test for GetRelatedBundleVariable.
Diffstat (limited to 'src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting')
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp102
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def6
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj66
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp48
-rw-r--r--src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h43
5 files changed, 265 insertions, 0 deletions
diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
new file mode 100644
index 00000000..01750b4b
--- /dev/null
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.cpp
@@ -0,0 +1,102 @@
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
7const LPCWSTR STRING_VARIABLE = L"AString";
8const LPCWSTR NUMBER_VARIABLE = L"ANumber";
9
10class CBafRelatedBundleVariableTesting : public CBalBaseBAFunctions
11{
12public: // IBAFunctions
13
14
15public: //IBootstrapperApplication
16 virtual STDMETHODIMP OnDetectRelatedBundle(
17 __in_z LPCWSTR wzBundleId,
18 __in BOOTSTRAPPER_RELATION_TYPE relationType,
19 __in_z LPCWSTR wzBundleTag,
20 __in BOOL fPerMachine,
21 __in LPCWSTR wzVersion,
22 __in BOOL fMissingFromCache,
23 __inout BOOL* pfCancel
24 )
25 {
26
27 HRESULT hr = S_OK;
28 LPWSTR wzValue = NULL;
29
30 hr = BalGetRelatedBundleVariable(wzBundleId, STRING_VARIABLE, &wzValue);
31
32 ExitOnFailure(hr, "Failed to get related bundle string variable.");
33
34 if (wzValue)
35 {
36 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: AString = %ws", wzValue);
37 }
38
39 hr = BalGetRelatedBundleVariable(wzBundleId, NUMBER_VARIABLE, &wzValue);
40
41 if (wzValue)
42 {
43 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieved related bundle variable with BAFunctions: ANumber = %ws", wzValue);
44 }
45
46 hr = __super::OnDetectRelatedBundle(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, pfCancel);
47 LExit:
48 ReleaseStr(wzValue);
49 return hr;
50 }
51private:
52
53
54public:
55 //
56 // Constructor - initialize member variables.
57 //
58 CBafRelatedBundleVariableTesting(
59 __in HMODULE hModule,
60 __in IBootstrapperEngine* pEngine,
61 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs
62 ) : CBalBaseBAFunctions(hModule, pEngine, pArgs)
63 {
64 }
65
66 //
67 // Destructor - release member variables.
68 //
69 ~CBafRelatedBundleVariableTesting()
70 {
71 }
72
73private:
74};
75
76
77HRESULT WINAPI CreateBAFunctions(
78 __in HMODULE hModule,
79 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
80 __inout BA_FUNCTIONS_CREATE_RESULTS* pResults
81 )
82{
83 HRESULT hr = S_OK;
84 CBafRelatedBundleVariableTesting* pBAFunctions = NULL;
85 IBootstrapperEngine* pEngine = NULL;
86
87 hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine);
88 ExitOnFailure(hr, "Failed to initialize Bal.");
89
90 pBAFunctions = new CBafRelatedBundleVariableTesting(hModule, pEngine, pArgs);
91 ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CBafRelatedBundleVariableTesting object.");
92
93 pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc;
94 pResults->pvBAFunctionsProcContext = pBAFunctions;
95 pBAFunctions = NULL;
96
97LExit:
98 ReleaseObject(pBAFunctions);
99 ReleaseObject(pEngine);
100
101 return hr;
102}
diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def
new file mode 100644
index 00000000..6e016dad
--- /dev/null
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.def
@@ -0,0 +1,6 @@
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
4EXPORTS
5 BAFunctionsCreate
6 BAFunctionsDestroy
diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj
new file mode 100644
index 00000000..94d44ac3
--- /dev/null
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/BafRelatedBundleVariableTesting.vcxproj
@@ -0,0 +1,66 @@
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" Toolsxmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <ItemGroup Label="ProjectConfigurations">
6 <ProjectConfiguration Include="Debug|ARM64">
7 <Configuration>Debug</Configuration>
8 <Platform>ARM64</Platform>
9 </ProjectConfiguration>
10 <ProjectConfiguration Include="Release|ARM64">
11 <Configuration>Release</Configuration>
12 <Platform>ARM64</Platform>
13 </ProjectConfiguration>
14 <ProjectConfiguration Include="Debug|Win32">
15 <Configuration>Debug</Configuration>
16 <Platform>Win32</Platform>
17 </ProjectConfiguration>
18 <ProjectConfiguration Include="Release|Win32">
19 <Configuration>Release</Configuration>
20 <Platform>Win32</Platform>
21 </ProjectConfiguration>
22 <ProjectConfiguration Include="Debug|x64">
23 <Configuration>Debug</Configuration>
24 <Platform>x64</Platform>
25 </ProjectConfiguration>
26 <ProjectConfiguration Include="Release|x64">
27 <Configuration>Release</Configuration>
28 <Platform>x64</Platform>
29 </ProjectConfiguration>
30 </ItemGroup>
31
32 <PropertyGroup Label="Globals">
33 <ProjectGuid>{DDD02BDE-B44F-4F37-A359-CE802750CB45}</ProjectGuid>
34 <ConfigurationType>DynamicLibrary</ConfigurationType>
35 <CharacterSet>Unicode</CharacterSet>
36 <TargetName>BafRelatedBundleVariableTesting</TargetName>
37 <ProjectModuleDefinitionFile>BafRelatedBundleVariableTesting.def</ProjectModuleDefinitionFile>
38 <IsWixTestProject>true</IsWixTestProject>
39 </PropertyGroup>
40
41 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
42 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
43
44 <PropertyGroup>
45 <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries>
46 </PropertyGroup>
47
48 <ItemGroup>
49 <ClCompile Include="BafRelatedBundleVariableTesting.cpp" />
50 <ClCompile Include="precomp.cpp">
51 <PrecompiledHeader>Create</PrecompiledHeader>
52 </ClCompile>
53 </ItemGroup>
54 <ItemGroup>
55 <ClInclude Include="precomp.h" />
56 </ItemGroup>
57 <ItemGroup>
58 <None Include="BafRelatedBundleVariableTesting.def" />
59 </ItemGroup>
60
61 <ItemGroup>
62 <PackageReference Include="WixToolset.BalUtil" />
63 </ItemGroup>
64
65 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
66</Project>
diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp
new file mode 100644
index 00000000..fc9d1177
--- /dev/null
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.cpp
@@ -0,0 +1,48 @@
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
5static HINSTANCE vhInstance = NULL;
6
7extern "C" BOOL WINAPI DllMain(
8 IN HINSTANCE hInstance,
9 IN DWORD dwReason,
10 IN LPVOID /* pvReserved */
11 )
12{
13 switch (dwReason)
14 {
15 case DLL_PROCESS_ATTACH:
16 ::DisableThreadLibraryCalls(hInstance);
17 vhInstance = hInstance;
18 break;
19
20 case DLL_PROCESS_DETACH:
21 vhInstance = NULL;
22 break;
23 }
24
25 return TRUE;
26}
27
28extern "C" HRESULT WINAPI BAFunctionsCreate(
29 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
30 __inout BA_FUNCTIONS_CREATE_RESULTS* pResults
31 )
32{
33 HRESULT hr = S_OK;
34
35 hr = CreateBAFunctions(vhInstance, pArgs, pResults);
36 BalExitOnFailure(hr, "Failed to create BAFunctions interface.");
37
38LExit:
39 return hr;
40}
41
42extern "C" void WINAPI BAFunctionsDestroy(
43 __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/,
44 __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/
45 )
46{
47 BalUninitialize();
48}
diff --git a/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h
new file mode 100644
index 00000000..2e14786a
--- /dev/null
+++ b/src/test/burn/TestData/BAFunctionsTests/BafRelatedBundleVariableTesting/precomp.h
@@ -0,0 +1,43 @@
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#pragma warning(push)
8#pragma warning(disable:4458) // declaration of 'xxx' hides class member
9#include <gdiplus.h>
10#pragma warning(pop)
11
12#include <msiquery.h>
13#include <objbase.h>
14#include <shlobj.h>
15#include <shlwapi.h>
16#include <stdlib.h>
17#include <strsafe.h>
18#include <CommCtrl.h>
19#include <sddl.h>
20
21#include "dutil.h"
22#include "dictutil.h"
23#include "fileutil.h"
24#include "locutil.h"
25#include "memutil.h"
26#include "pathutil.h"
27#include "procutil.h"
28#include "strutil.h"
29#include "thmutil.h"
30#include "regutil.h"
31#include "xmlutil.h"
32
33#include "BalBaseBootstrapperApplication.h"
34#include "balutil.h"
35
36#include "BAFunctions.h"
37#include "IBAFunctions.h"
38
39HRESULT WINAPI CreateBAFunctions(
40 __in HMODULE hModule,
41 __in const BA_FUNCTIONS_CREATE_ARGS* pArgs,
42 __inout BA_FUNCTIONS_CREATE_RESULTS* pResults
43 );