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
75
76
77
78
79
80
81
82
83 |
////////////////////////////////////////////////////////////
// Copyright (C) Roman Ryltsov, 2008-2009
// Created by Roman Ryltsov roman@alax.info
//
// $Id$
#include "stdafx.h"
#include "resource.h"
#include "BdaHooks_i.h"
#include "dllmain.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
////////////////////////////////////////////////////////////
// DLL Exports
STDAPI DllCanUnloadNow() throw()
{
return _AtlModule.DllCanUnloadNow();
}
STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
{
return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
}
STDAPI DllRegisterServer() throw()
{
HRESULT nResult;
_ATLTRY
{
nResult = _AtlModule.DllRegisterServer();
__C(nResult);
}
_ATLCATCH(Exception)
{
_C(Exception);
}
return nResult;
}
STDAPI DllUnregisterServer() throw()
{
HRESULT nResult;
_ATLTRY
{
nResult = _AtlModule.DllUnregisterServer();
__C(nResult);
}
_ATLCATCH(Exception)
{
_C(Exception);
}
return nResult;
}
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
{
HRESULT nResult;
_ATLTRY
{
static const WCHAR g_pszUser[] = _T("user");
if(pszCommandLine)
{
if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0)
AtlSetPerUserRegistration(TRUE);
}
if(bInstall)
{
nResult = DllRegisterServer();
if(FAILED(nResult))
DllUnregisterServer();
} else
nResult = DllUnregisterServer();
}
_ATLCATCH(Exception)
{
_C(Exception);
}
return nResult;
} |