diff options
Diffstat (limited to 'src/ext/NetFx/be/netfxbe.cpp')
| -rw-r--r-- | src/ext/NetFx/be/netfxbe.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/ext/NetFx/be/netfxbe.cpp b/src/ext/NetFx/be/netfxbe.cpp new file mode 100644 index 00000000..3a34cea3 --- /dev/null +++ b/src/ext/NetFx/be/netfxbe.cpp | |||
| @@ -0,0 +1,62 @@ | |||
| 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 "BextBaseBundleExtensionProc.h" | ||
| 5 | |||
| 6 | static HINSTANCE vhInstance = NULL; | ||
| 7 | static IBundleExtension* vpBundleExtension = NULL; | ||
| 8 | |||
| 9 | // function definitions | ||
| 10 | |||
| 11 | extern "C" BOOL WINAPI DllMain( | ||
| 12 | __in HINSTANCE hInstance, | ||
| 13 | __in DWORD dwReason, | ||
| 14 | __in LPVOID /*pvReserved*/ | ||
| 15 | ) | ||
| 16 | { | ||
| 17 | switch(dwReason) | ||
| 18 | { | ||
| 19 | case DLL_PROCESS_ATTACH: | ||
| 20 | vhInstance = hInstance; | ||
| 21 | break; | ||
| 22 | |||
| 23 | case DLL_PROCESS_DETACH: | ||
| 24 | vhInstance = NULL; | ||
| 25 | break; | ||
| 26 | } | ||
| 27 | |||
| 28 | return TRUE; | ||
| 29 | } | ||
| 30 | |||
| 31 | extern "C" HRESULT WINAPI BundleExtensionCreate( | ||
| 32 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
| 33 | __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults | ||
| 34 | ) | ||
| 35 | { | ||
| 36 | HRESULT hr = S_OK; | ||
| 37 | IBundleExtensionEngine* pEngine = NULL; | ||
| 38 | |||
| 39 | hr = XmlInitialize(); | ||
| 40 | ExitOnFailure(hr, "Failed to initialize XML."); | ||
| 41 | |||
| 42 | hr = BextInitializeFromCreateArgs(pArgs, &pEngine); | ||
| 43 | ExitOnFailure(hr, "Failed to initialize bext"); | ||
| 44 | |||
| 45 | hr = NetfxBundleExtensionCreate(vhInstance, pEngine, pArgs, &vpBundleExtension); | ||
| 46 | BextExitOnFailure(hr, "Failed to create WixNetfxBundleExtension"); | ||
| 47 | |||
| 48 | pResults->pfnBundleExtensionProc = BextBaseBundleExtensionProc; | ||
| 49 | pResults->pvBundleExtensionProcContext = vpBundleExtension; | ||
| 50 | |||
| 51 | LExit: | ||
| 52 | ReleaseObject(pEngine); | ||
| 53 | |||
| 54 | return hr; | ||
| 55 | } | ||
| 56 | |||
| 57 | extern "C" void WINAPI BundleExtensionDestroy() | ||
| 58 | { | ||
| 59 | BextUninitialize(); | ||
| 60 | ReleaseNullObject(vpBundleExtension); | ||
| 61 | XmlUninitialize(); | ||
| 62 | } | ||
