1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2012 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | // |
---|
5 | // $Id: dllmain.h 47 2012-02-11 13:53:43Z roman $ |
---|
6 | |
---|
7 | #pragma once |
---|
8 | |
---|
9 | //////////////////////////////////////////////////////////// |
---|
10 | // CMaxMindGeoLiteModule |
---|
11 | |
---|
12 | class CMaxMindGeoLiteModule : |
---|
13 | public CAtlDllModuleT<CMaxMindGeoLiteModule> |
---|
14 | { |
---|
15 | public: |
---|
16 | |
---|
17 | DECLARE_LIBID(LIBID_AlaxInfoMaxMindGeoLite) |
---|
18 | |
---|
19 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MODULE, "{F80BC862-E43E-4809-ACFC-1A608209C860}") |
---|
20 | |
---|
21 | public: |
---|
22 | // CMaxMindGeoLiteModule |
---|
23 | CMaxMindGeoLiteModule() throw() |
---|
24 | { |
---|
25 | #if defined(_DEBUG) |
---|
26 | AtlTraceLoadSettings(NULL); |
---|
27 | #endif // defined(_DEBUG) |
---|
28 | _W(CExceptionFilter::Initialize()); |
---|
29 | TraceModuleVersion(); |
---|
30 | //TraceModuleTerminationLockCount(); |
---|
31 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
32 | } |
---|
33 | ~CMaxMindGeoLiteModule() throw() |
---|
34 | { |
---|
35 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
36 | CExceptionFilter::Terminate(); |
---|
37 | } |
---|
38 | |
---|
39 | // CAtlModule |
---|
40 | HRESULT AddCommonRGSReplacements(IRegistrarBase* pRegistrar) throw() |
---|
41 | { |
---|
42 | _A(pRegistrar); |
---|
43 | _ATLTRY |
---|
44 | { |
---|
45 | __C(__super::AddCommonRGSReplacements(pRegistrar)); |
---|
46 | _A(m_libid != GUID_NULL); |
---|
47 | __C(pRegistrar->AddReplacement(L"LIBID", _PersistHelper::StringFromIdentifier(m_libid))); |
---|
48 | TCHAR pszPath[MAX_PATH] = { 0 }; |
---|
49 | _W(GetModuleFileName(_AtlBaseModule.GetModuleInstance(), pszPath, DIM(pszPath))); |
---|
50 | __C(pRegistrar->AddReplacement(L"FILENAME", CStringW(PathFindFileName(pszPath)))); |
---|
51 | __C(pRegistrar->AddReplacement(L"DESCRIPTION", CStringW(AtlLoadString(IDS_PROJNAME)))); |
---|
52 | } |
---|
53 | _ATLCATCH(Exception) |
---|
54 | { |
---|
55 | _C(Exception); |
---|
56 | } |
---|
57 | return S_OK; |
---|
58 | } |
---|
59 | BOOL WINAPI DllMain(DWORD nReason, VOID* pvReserved) throw() |
---|
60 | { |
---|
61 | return __super::DllMain(nReason, pvReserved); |
---|
62 | } |
---|
63 | }; |
---|
64 | |
---|
65 | extern class CMaxMindGeoLiteModule _AtlModule; |
---|