1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 using namespace Microsoft::WRL
;
10 BOOL WINAPI
DllMain(_In_opt_ HINSTANCE aInstance
, _In_ DWORD aReason
,
11 _In_opt_ LPVOID aReserved
) {
12 if (DLL_PROCESS_ATTACH
== aReason
) {
13 DisableThreadLibraryCalls(aInstance
);
14 Module
<InProc
>::GetModule().Create();
15 } else if (DLL_PROCESS_DETACH
== aReason
) {
16 Module
<InProc
>::GetModule().Terminate();
22 DllGetActivationFactory(_In_ HSTRING aActivatibleClassId
,
23 _COM_Outptr_ IActivationFactory
** aFactory
) {
24 auto& module
= Module
<InProc
>::GetModule();
25 return module
.GetActivationFactory(aActivatibleClassId
, aFactory
);
28 HRESULT WINAPI
DllCanUnloadNow() {
29 auto& module
= Module
<InProc
>::GetModule();
30 return (module
.Terminate()) ? S_OK
: S_FALSE
;
33 STDAPI
DllGetClassObject(_In_ REFCLSID aRclsid
, _In_ REFIID aRiid
,
34 _COM_Outptr_ LPVOID FAR
* aPpv
) {
35 auto& module
= Module
<InProc
>::GetModule();
36 return module
.GetClassObject(aRclsid
, aRiid
, aPpv
);