diff options
Diffstat (limited to 'src/wixstdba/wixstdba.cpp')
-rw-r--r-- | src/wixstdba/wixstdba.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/wixstdba/wixstdba.cpp b/src/wixstdba/wixstdba.cpp new file mode 100644 index 00000000..f47c1f4e --- /dev/null +++ b/src/wixstdba/wixstdba.cpp | |||
@@ -0,0 +1,78 @@ | |||
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 | |||
5 | static HINSTANCE vhInstance = NULL; | ||
6 | |||
7 | extern "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 | |||
28 | |||
29 | extern "C" HRESULT WINAPI BootstrapperApplicationCreate( | ||
30 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
31 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults | ||
32 | ) | ||
33 | { | ||
34 | HRESULT hr = S_OK; | ||
35 | IBootstrapperEngine* pEngine = NULL; | ||
36 | |||
37 | hr = BalInitializeFromCreateArgs(pArgs, &pEngine); | ||
38 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
39 | |||
40 | hr = CreateBootstrapperApplication(vhInstance, FALSE, S_OK, pEngine, pArgs, pResults); | ||
41 | BalExitOnFailure(hr, "Failed to create bootstrapper application interface."); | ||
42 | |||
43 | LExit: | ||
44 | ReleaseObject(pEngine); | ||
45 | |||
46 | return hr; | ||
47 | } | ||
48 | |||
49 | |||
50 | extern "C" void WINAPI BootstrapperApplicationDestroy() | ||
51 | { | ||
52 | BalUninitialize(); | ||
53 | } | ||
54 | |||
55 | |||
56 | extern "C" HRESULT WINAPI MbaPrereqBootstrapperApplicationCreate( | ||
57 | __in HRESULT hrHostInitialization, | ||
58 | __in IBootstrapperEngine* pEngine, | ||
59 | __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, | ||
60 | __inout BOOTSTRAPPER_CREATE_RESULTS* pResults | ||
61 | ) | ||
62 | { | ||
63 | HRESULT hr = S_OK; | ||
64 | |||
65 | BalInitialize(pEngine); | ||
66 | |||
67 | hr = CreateBootstrapperApplication(vhInstance, TRUE, hrHostInitialization, pEngine, pArgs, pResults); | ||
68 | BalExitOnFailure(hr, "Failed to create managed prerequisite bootstrapper application interface."); | ||
69 | |||
70 | LExit: | ||
71 | return hr; | ||
72 | } | ||
73 | |||
74 | |||
75 | extern "C" void WINAPI MbaPrereqBootstrapperApplicationDestroy() | ||
76 | { | ||
77 | BalUninitialize(); | ||
78 | } | ||