1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2012 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | // |
---|
5 | // $Id: MaxMindGeoLite.cpp 300 2014-07-08 16:34:37Z roman $ |
---|
6 | |
---|
7 | #include "stdafx.h" |
---|
8 | #include "resource.h" |
---|
9 | #include "MaxMindGeoLite_i.h" |
---|
10 | #include "dllmain.h" |
---|
11 | |
---|
12 | #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) |
---|
13 | #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." |
---|
14 | #endif |
---|
15 | |
---|
16 | //////////////////////////////////////////////////////////// |
---|
17 | // DLL Exports |
---|
18 | |
---|
19 | STDAPI DllCanUnloadNow() throw() |
---|
20 | { |
---|
21 | #if FALSE |
---|
22 | const HRESULT nDllCanUnloadNowResult = _AtlModule.DllCanUnloadNow(); |
---|
23 | _Z2(atlTraceCOM, 2, _T("nDllCanUnloadNowResult 0x%08x, _AtlModule.GetLockCount() %d\n"), nDllCanUnloadNowResult, _AtlModule.GetLockCount()); |
---|
24 | return nDllCanUnloadNowResult; |
---|
25 | #else |
---|
26 | return _AtlModule.DllCanUnloadNow(); |
---|
27 | #endif |
---|
28 | } |
---|
29 | |
---|
30 | STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw() |
---|
31 | { |
---|
32 | return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject); |
---|
33 | } |
---|
34 | |
---|
35 | STDAPI DllRegisterServer() throw() |
---|
36 | { |
---|
37 | HRESULT nResult; |
---|
38 | _ATLTRY |
---|
39 | { |
---|
40 | nResult = _AtlModule.DllRegisterServer(); |
---|
41 | __C(nResult); |
---|
42 | } |
---|
43 | _ATLCATCH(Exception) |
---|
44 | { |
---|
45 | _C(Exception); |
---|
46 | } |
---|
47 | return nResult; |
---|
48 | } |
---|
49 | |
---|
50 | STDAPI DllUnregisterServer() throw() |
---|
51 | { |
---|
52 | HRESULT nResult; |
---|
53 | _ATLTRY |
---|
54 | { |
---|
55 | nResult = _AtlModule.DllUnregisterServer(); |
---|
56 | __C(nResult); |
---|
57 | } |
---|
58 | _ATLCATCH(Exception) |
---|
59 | { |
---|
60 | _C(Exception); |
---|
61 | } |
---|
62 | return nResult; |
---|
63 | } |
---|
64 | |
---|
65 | STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw() |
---|
66 | { |
---|
67 | HRESULT nResult; |
---|
68 | _ATLTRY |
---|
69 | { |
---|
70 | static const WCHAR g_pszUser[] = _T("user"); |
---|
71 | if(pszCommandLine) |
---|
72 | { |
---|
73 | if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0) |
---|
74 | AtlSetPerUserRegistration(TRUE); |
---|
75 | } |
---|
76 | if(bInstall) |
---|
77 | { |
---|
78 | nResult = DllRegisterServer(); |
---|
79 | if(FAILED(nResult)) |
---|
80 | DllUnregisterServer(); |
---|
81 | } else |
---|
82 | nResult = DllUnregisterServer(); |
---|
83 | } |
---|
84 | _ATLCATCH(Exception) |
---|
85 | { |
---|
86 | _C(Exception); |
---|
87 | } |
---|
88 | return nResult; |
---|
89 | } |
---|