diff options
Diffstat (limited to 'src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp')
-rw-r--r-- | src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp new file mode 100644 index 00000000..35949eb9 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | |||
@@ -0,0 +1,79 @@ | |||
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 CPrereqBaf : public CBalBaseBAFunctions | ||
8 | { | ||
9 | public: // IBAFunctions | ||
10 | |||
11 | public: //IBootstrapperApplication | ||
12 | |||
13 | virtual STDMETHODIMP OnDetectBegin( | ||
14 | __in BOOL /*fCached*/, | ||
15 | __in BOOTSTRAPPER_REGISTRATION_TYPE /*registrationType*/, | ||
16 | __in DWORD /*cPackages*/, | ||
17 | __inout BOOL* /*pfCancel*/ | ||
18 | ) | ||
19 | { | ||
20 | HRESULT hr = S_OK; | ||
21 | |||
22 | hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_command.wzBootstrapperWorkingFolder, FALSE); | ||
23 | ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); | ||
24 | |||
25 | LExit: | ||
26 | return hr; | ||
27 | } | ||
28 | |||
29 | private: | ||
30 | |||
31 | public: | ||
32 | // | ||
33 | // Constructor - initialize member variables. | ||
34 | // | ||
35 | CPrereqBaf( | ||
36 | __in HMODULE hModule, | ||
37 | __in IBootstrapperEngine* pEngine, | ||
38 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
39 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | // | ||
44 | // Destructor - release member variables. | ||
45 | // | ||
46 | ~CPrereqBaf() | ||
47 | { | ||
48 | } | ||
49 | |||
50 | private: | ||
51 | }; | ||
52 | |||
53 | |||
54 | HRESULT WINAPI CreateBAFunctions( | ||
55 | __in HMODULE hModule, | ||
56 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
57 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
58 | ) | ||
59 | { | ||
60 | HRESULT hr = S_OK; | ||
61 | CPrereqBaf* pBAFunctions = NULL; | ||
62 | IBootstrapperEngine* pEngine = NULL; | ||
63 | |||
64 | hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); | ||
65 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
66 | |||
67 | pBAFunctions = new CPrereqBaf(hModule, pEngine, pArgs); | ||
68 | ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); | ||
69 | |||
70 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | ||
71 | pResults->pvBAFunctionsProcContext = pBAFunctions; | ||
72 | pBAFunctions = NULL; | ||
73 | |||
74 | LExit: | ||
75 | ReleaseObject(pBAFunctions); | ||
76 | ReleaseObject(pEngine); | ||
77 | |||
78 | return hr; | ||
79 | } | ||