aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/wixstdba/wixstdba.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Bal/wixstdba/wixstdba.cpp')
-rw-r--r--src/ext/Bal/wixstdba/wixstdba.cpp93
1 files changed, 12 insertions, 81 deletions
diff --git a/src/ext/Bal/wixstdba/wixstdba.cpp b/src/ext/Bal/wixstdba/wixstdba.cpp
index 47f3f677..1024848d 100644
--- a/src/ext/Bal/wixstdba/wixstdba.cpp
+++ b/src/ext/Bal/wixstdba/wixstdba.cpp
@@ -2,9 +2,6 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5static HINSTANCE vhInstance = NULL;
6static IBootstrapperApplication* vpApplication = NULL;
7
8static void CALLBACK WixstdbaTraceError( 5static void CALLBACK WixstdbaTraceError(
9 __in_z LPCSTR szFile, 6 __in_z LPCSTR szFile,
10 __in int iLine, 7 __in int iLine,
@@ -15,94 +12,28 @@ static void CALLBACK WixstdbaTraceError(
15 __in va_list args 12 __in va_list args
16 ); 13 );
17 14
18extern "C" BOOL WINAPI DllMain( 15EXTERN_C int WINAPI wWinMain(
19 IN HINSTANCE hInstance, 16 __in HINSTANCE hInstance,
20 IN DWORD dwReason, 17 __in_opt HINSTANCE /* hPrevInstance */,
21 IN LPVOID /* pvReserved */ 18 __in_z_opt LPWSTR /*lpCmdLine*/,
22 ) 19 __in int /*nCmdShow*/
23{
24 switch(dwReason)
25 {
26 case DLL_PROCESS_ATTACH:
27 ::DisableThreadLibraryCalls(hInstance);
28 vhInstance = hInstance;
29 break;
30
31 case DLL_PROCESS_DETACH:
32 vhInstance = NULL;
33 break;
34 }
35
36 return TRUE;
37}
38
39
40extern "C" HRESULT WINAPI BootstrapperApplicationCreate(
41 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
42 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults
43 ) 20 )
44{ 21{
45 HRESULT hr = S_OK; 22 HRESULT hr = S_OK;
46 IBootstrapperEngine* pEngine = NULL; 23 IBootstrapperApplication* pApplication = NULL;
47 24
48 DutilInitialize(&WixstdbaTraceError); 25 DutilInitialize(&WixstdbaTraceError);
49 26
50 hr = BalInitializeFromCreateArgs(pArgs, &pEngine); 27 hr = CreateWixStandardBootstrapperApplication(hInstance, &pApplication);
51 ExitOnFailure(hr, "Failed to initialize Bal."); 28 ExitOnFailure(hr, "Failed to create WiX standard bootstrapper application.");
52 29
53 hr = CreateBootstrapperApplication(vhInstance, NULL, pEngine, pArgs, pResults, &vpApplication); 30 hr = BootstrapperApplicationRun(pApplication);
54 BalExitOnFailure(hr, "Failed to create bootstrapper application interface."); 31 ExitOnFailure(hr, "Failed to run WiX standard bootstrapper application.");
55 32
56LExit: 33LExit:
57 ReleaseObject(pEngine); 34 ReleaseObject(pApplication);
58
59 return hr;
60}
61
62
63extern "C" void WINAPI BootstrapperApplicationDestroy(
64 __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs,
65 __in BOOTSTRAPPER_DESTROY_RESULTS* pResults
66 )
67{
68 if (vpApplication)
69 {
70 DestroyBootstrapperApplication(vpApplication, pArgs, pResults);
71 }
72 35
73 ReleaseNullObject(vpApplication); 36 return 0;
74 BalUninitialize();
75 DutilUninitialize();
76}
77
78
79extern "C" HRESULT WINAPI PrereqBootstrapperApplicationCreate(
80 __in_opt PREQBA_DATA* pPrereqData,
81 __in IBootstrapperEngine* pEngine,
82 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
83 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults
84 )
85{
86 HRESULT hr = S_OK;
87
88 DutilInitialize(&WixstdbaTraceError);
89
90 BalInitialize(pEngine);
91
92 hr = CreateBootstrapperApplication(vhInstance, pPrereqData, pEngine, pArgs, pResults, &vpApplication);
93 BalExitOnFailure(hr, "Failed to create prerequisite bootstrapper application interface.");
94
95LExit:
96 return hr;
97}
98
99
100extern "C" void WINAPI PrereqBootstrapperApplicationDestroy(
101 __in const BOOTSTRAPPER_DESTROY_ARGS* pArgs,
102 __in BOOTSTRAPPER_DESTROY_RESULTS* pResults
103 )
104{
105 BootstrapperApplicationDestroy(pArgs, pResults);
106} 37}
107 38
108static void CALLBACK WixstdbaTraceError( 39static void CALLBACK WixstdbaTraceError(