forked from MedicalUltrasound/Image3dAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
74 lines (59 loc) · 1.81 KB
/
Main.cpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "Image3dSource.hpp"
#include "Image3dFileLoader.hpp"
#include "resource.h"
#include "DummyLoader.h"
#include "DummyLoader_i.c"
class DummyLoaderModule :
public ATL::CAtlDllModuleT<DummyLoaderModule>
{
public:
DECLARE_LIBID(LIBID_DummyLoader)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_AppID, "{92280FDD-C149-44E3-BDEE-736F9F9EEA4E}")
};
DummyLoaderModule _AtlModule;
// DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID lpReserved)
{
return _AtlModule.DllMain(dwReason, lpReserved);
}
// Used to determine whether the DLL can be unloaded by OLE.
STDAPI DllCanUnloadNow()
{
return _AtlModule.DllCanUnloadNow();
}
// Returns a class factory to create an object of the requested type.
_Check_return_
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - Adds entries to the system registry.
STDAPI DllRegisterServer()
{
// registers object, typelib and all interfaces in typelib
return _AtlModule.DllRegisterServer();
}
// DllUnregisterServer - Removes entries from the system registry.
STDAPI DllUnregisterServer()
{
return _AtlModule.DllUnregisterServer();
}
// DllInstall - Adds/Removes entries to the system registry per user per machine.
STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
{
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL) {
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
ATL::AtlSetPerUserRegistration(true);
}
HRESULT hr = E_FAIL;
if (bInstall) {
hr = DllRegisterServer();
if (FAILED(hr))
DllUnregisterServer();
}
else {
hr = DllUnregisterServer();
}
return hr;
}