forked from microsoft/cppwinrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.cpp
More file actions
29 lines (24 loc) · 676 Bytes
/
module.cpp
File metadata and controls
29 lines (24 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "pch.h"
bool __stdcall test_can_unload_now() noexcept;
void* __stdcall test_get_activation_factory(std::wstring_view const& name);
int32_t __stdcall DllCanUnloadNow() noexcept
{
return test_can_unload_now() ? 0 : 1;
}
int32_t __stdcall DllGetActivationFactory(void* classId, void** factory) noexcept
{
try
{
std::wstring_view const name{ *reinterpret_cast<winrt::hstring*>(&classId) };
*factory = test_get_activation_factory(name);
if (*factory)
{
return 0;
}
return winrt::hresult_class_not_available(name).to_abi();
}
catch (...)
{
return winrt::to_hresult();
}
}