diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
| commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
| tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | |
| parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
| download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip | |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp')
| -rw-r--r-- | src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp index 35949eb9..c93f9d3f 100644 --- a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | |||
| @@ -9,6 +9,22 @@ class CPrereqBaf : public CBalBaseBAFunctions | |||
| 9 | public: // IBAFunctions | 9 | public: // IBAFunctions |
| 10 | 10 | ||
| 11 | public: //IBootstrapperApplication | 11 | public: //IBootstrapperApplication |
| 12 | STDMETHODIMP OnCreate( | ||
| 13 | __in IBootstrapperEngine* pEngine, | ||
| 14 | __in BOOTSTRAPPER_COMMAND* pCommand | ||
| 15 | ) | ||
| 16 | { | ||
| 17 | HRESULT hr = S_OK; | ||
| 18 | |||
| 19 | hr = __super::OnCreate(pEngine, pCommand); | ||
| 20 | ExitOnFailure(hr, "CBalBaseBootstrapperApplication initialization failed."); | ||
| 21 | |||
| 22 | hr = StrAllocString(&m_sczBARuntimeDirectory, pCommand->wzBootstrapperWorkingFolder, 0); | ||
| 23 | ExitOnFailure(hr, "Failed to copy working folder"); | ||
| 24 | |||
| 25 | LExit: | ||
| 26 | return hr; | ||
| 27 | } | ||
| 12 | 28 | ||
| 13 | virtual STDMETHODIMP OnDetectBegin( | 29 | virtual STDMETHODIMP OnDetectBegin( |
| 14 | __in BOOL /*fCached*/, | 30 | __in BOOL /*fCached*/, |
| @@ -19,7 +35,7 @@ public: //IBootstrapperApplication | |||
| 19 | { | 35 | { |
| 20 | HRESULT hr = S_OK; | 36 | HRESULT hr = S_OK; |
| 21 | 37 | ||
| 22 | hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_command.wzBootstrapperWorkingFolder, FALSE); | 38 | hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_sczBARuntimeDirectory, FALSE); |
| 23 | ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); | 39 | ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); |
| 24 | 40 | ||
| 25 | LExit: | 41 | LExit: |
| @@ -33,11 +49,10 @@ public: | |||
| 33 | // Constructor - initialize member variables. | 49 | // Constructor - initialize member variables. |
| 34 | // | 50 | // |
| 35 | CPrereqBaf( | 51 | CPrereqBaf( |
| 36 | __in HMODULE hModule, | 52 | __in HMODULE hModule |
| 37 | __in IBootstrapperEngine* pEngine, | 53 | ) : CBalBaseBAFunctions(hModule) |
| 38 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
| 39 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
| 40 | { | 54 | { |
| 55 | m_sczBARuntimeDirectory = NULL; | ||
| 41 | } | 56 | } |
| 42 | 57 | ||
| 43 | // | 58 | // |
| @@ -45,9 +60,11 @@ public: | |||
| 45 | // | 60 | // |
| 46 | ~CPrereqBaf() | 61 | ~CPrereqBaf() |
| 47 | { | 62 | { |
| 63 | ReleaseNullStr(m_sczBARuntimeDirectory); | ||
| 48 | } | 64 | } |
| 49 | 65 | ||
| 50 | private: | 66 | private: |
| 67 | LPWSTR m_sczBARuntimeDirectory; | ||
| 51 | }; | 68 | }; |
| 52 | 69 | ||
| 53 | 70 | ||
| @@ -59,21 +76,21 @@ HRESULT WINAPI CreateBAFunctions( | |||
| 59 | { | 76 | { |
| 60 | HRESULT hr = S_OK; | 77 | HRESULT hr = S_OK; |
| 61 | CPrereqBaf* pBAFunctions = NULL; | 78 | CPrereqBaf* pBAFunctions = NULL; |
| 62 | IBootstrapperEngine* pEngine = NULL; | ||
| 63 | 79 | ||
| 64 | hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); | 80 | BalInitialize(pArgs->pEngine); |
| 65 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
| 66 | 81 | ||
| 67 | pBAFunctions = new CPrereqBaf(hModule, pEngine, pArgs); | 82 | pBAFunctions = new CPrereqBaf(hModule); |
| 68 | ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); | 83 | ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); |
| 69 | 84 | ||
| 85 | hr = pBAFunctions->OnCreate(pArgs->pEngine, pArgs->pCommand); | ||
| 86 | ExitOnFailure(hr, "Failed to call OnCreate CPrereqBaf."); | ||
| 87 | |||
| 70 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | 88 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; |
| 71 | pResults->pvBAFunctionsProcContext = pBAFunctions; | 89 | pResults->pvBAFunctionsProcContext = pBAFunctions; |
| 72 | pBAFunctions = NULL; | 90 | pBAFunctions = NULL; |
| 73 | 91 | ||
| 74 | LExit: | 92 | LExit: |
| 75 | ReleaseObject(pBAFunctions); | 93 | ReleaseObject(pBAFunctions); |
| 76 | ReleaseObject(pEngine); | ||
| 77 | 94 | ||
| 78 | return hr; | 95 | return hr; |
| 79 | } | 96 | } |
