source: trunk/Utilities/MaxMindGeoLite/MaxMindGeoLite.cpp @ 48

Last change on this file since 48 was 47, checked in by roman, 10 years ago
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2012
3// Created by Roman Ryltsov roman@alax.info
4//
5// $Id: MaxMindGeoLite.cpp 47 2012-02-11 13:53:43Z 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
19STDAPI DllCanUnloadNow() throw()
20{
21    return _AtlModule.DllCanUnloadNow();
22}
23
24STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
25{
26    return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
27}
28
29STDAPI DllRegisterServer() throw()
30{
31        HRESULT nResult;
32        _ATLTRY
33        {
34                nResult = _AtlModule.DllRegisterServer();
35                __C(nResult);
36        }
37        _ATLCATCH(Exception)
38        {
39                _C(Exception);
40        }
41        return nResult;
42}
43
44STDAPI DllUnregisterServer() throw()
45{
46        HRESULT nResult;
47        _ATLTRY
48        {
49                nResult = _AtlModule.DllUnregisterServer();
50                __C(nResult);
51        }
52        _ATLCATCH(Exception)
53        {
54                _C(Exception);
55        }
56        return nResult;
57}
58
59STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
60{
61        HRESULT nResult;
62        _ATLTRY
63        {
64                static const WCHAR g_pszUser[] = _T("user");
65                if(pszCommandLine)
66                {
67                if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0)
68                        AtlSetPerUserRegistration(TRUE);
69                }
70                if(bInstall)
71                {       
72                nResult = DllRegisterServer();
73                if(FAILED(nResult))
74                        DllUnregisterServer();
75                } else
76                nResult = DllUnregisterServer();
77        }
78        _ATLCATCH(Exception)
79        {
80                _C(Exception);
81        }
82        return nResult;
83}
Note: See TracBrowser for help on using the repository browser.