| 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 | extern "C" HRESULT WINAPI BAFunctionsCreate( |
| 29 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, |
| 30 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults |
| 31 | ) |
| 32 | { |
| 33 | HRESULT hr = S_OK; |
| 34 | |
| 35 | BalInitialize(pArgs->pEngine); |
| 36 | |
| 37 | hr = CreateBAFunctions(vhInstance, pArgs, pResults); |
| 38 | BalExitOnFailure(hr, "Failed to create BAFunctions interface."); |
| 39 | |
| 40 | LExit: |
| 41 | return hr; |
| 42 | } |
| 43 | |
| 44 | extern "C" void WINAPI BAFunctionsDestroy( |
| 45 | __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, |
| 46 | __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ |
| 47 | ) |
| 48 | { |
| 49 | BalUninitialize(); |
| 50 | } |