aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Bal/test/examples/TestEngine/TestEngine.cpp')
-rw-r--r--src/ext/Bal/test/examples/TestEngine/TestEngine.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp
index 5c6ed398..197e3116 100644
--- a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp
+++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp
@@ -26,16 +26,12 @@ HRESULT TestEngine::LoadBA(
26{ 26{
27 HRESULT hr = S_OK; 27 HRESULT hr = S_OK;
28 BOOTSTRAPPER_COMMAND command = { }; 28 BOOTSTRAPPER_COMMAND command = { };
29 BOOTSTRAPPER_CREATE_ARGS args = { };
30 PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL;
31 29
32 if (m_pCreateResults || m_hBAModule) 30 if (m_hBAModule)
33 { 31 {
34 ExitFunction1(hr = E_INVALIDSTATE); 32 ExitFunction1(hr = E_INVALIDSTATE);
35 } 33 }
36 34
37 m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE));
38
39 command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); 35 command.cbSize = sizeof(BOOTSTRAPPER_COMMAND);
40 36
41 hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder); 37 hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder);
@@ -44,14 +40,7 @@ HRESULT TestEngine::LoadBA(
44 hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath); 40 hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath);
45 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath"); 41 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath");
46 42
47 args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); 43#ifdef TODO_DELETE
48 args.pCommand = &command;
49 args.pfnBootstrapperEngineProc = TestEngine::EngineProc;
50 args.pvBootstrapperEngineProcContext = this;
51 args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1);
52
53 m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
54
55 m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); 44 m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
56 ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll."); 45 ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll.");
57 46
@@ -60,6 +49,7 @@ HRESULT TestEngine::LoadBA(
60 49
61 hr = pfnCreate(&args, m_pCreateResults); 50 hr = pfnCreate(&args, m_pCreateResults);
62 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); 51 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate.");
52#endif
63 53
64LExit: 54LExit:
65 ReleaseStr(command.wzBootstrapperApplicationDataPath); 55 ReleaseStr(command.wzBootstrapperApplicationDataPath);
@@ -117,7 +107,7 @@ HRESULT TestEngine::SendShutdownEvent(
117 shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS); 107 shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS);
118 shutdownResults.action = defaultAction; 108 shutdownResults.action = defaultAction;
119 shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS); 109 shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS);
120 hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); 110 // hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext);
121 return hr; 111 return hr;
122} 112}
123 113
@@ -128,7 +118,7 @@ HRESULT TestEngine::SendStartupEvent()
128 BA_ONSTARTUP_RESULTS startupResults = { }; 118 BA_ONSTARTUP_RESULTS startupResults = { };
129 startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS); 119 startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS);
130 startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS); 120 startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS);
131 hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); 121 // hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext);
132 return hr; 122 return hr;
133} 123}
134 124
@@ -151,6 +141,7 @@ void TestEngine::UnloadBA(
151 __in BOOL fReload 141 __in BOOL fReload
152 ) 142 )
153{ 143{
144#ifdef TODO_DELETE
154 PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; 145 PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL;
155 BOOTSTRAPPER_DESTROY_ARGS args = { }; 146 BOOTSTRAPPER_DESTROY_ARGS args = { };
156 BOOTSTRAPPER_DESTROY_RESULTS results = { }; 147 BOOTSTRAPPER_DESTROY_RESULTS results = { };
@@ -178,6 +169,7 @@ void TestEngine::UnloadBA(
178 169
179 m_hBAModule = NULL; 170 m_hBAModule = NULL;
180 } 171 }
172#endif
181} 173}
182 174
183HRESULT TestEngine::BAEngineLog( 175HRESULT TestEngine::BAEngineLog(
@@ -254,11 +246,9 @@ HRESULT TestEngine::ProcessBAMessage(
254TestEngine::TestEngine() 246TestEngine::TestEngine()
255{ 247{
256 m_hBAModule = NULL; 248 m_hBAModule = NULL;
257 m_pCreateResults = NULL;
258 m_dwThreadId = ::GetCurrentThreadId(); 249 m_dwThreadId = ::GetCurrentThreadId();
259} 250}
260 251
261TestEngine::~TestEngine() 252TestEngine::~TestEngine()
262{ 253{
263 ReleaseMem(m_pCreateResults);
264} 254}