source: trunk/Utilities/UaMobileTools/UaMobileTools.cpp

Last change on this file was 184, checked in by roman, 8 years ago

Update to follow website changes

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2013
3// Created by Roman Ryltsov roman@alax.info
4
5#include "stdafx.h"
6#include "resource.h"
7#include "UaMobileTools_i.h"
8#include "dllmain.h"
9
10#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
11#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."
12#endif
13
14////////////////////////////////////////////////////////////
15// DLL Exports
16
17STDAPI DllCanUnloadNow() throw()
18{
19    return _AtlModule.DllCanUnloadNow();
20}
21STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
22{
23    return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
24}
25STDAPI DllRegisterServer() throw()
26{
27        HRESULT nResult;
28        _ATLTRY
29        {
30                nResult = _AtlModule.DllRegisterServer();
31                __C(nResult);
32        }
33        _ATLCATCH(Exception)
34        {
35                _C(Exception);
36        }
37        return nResult;
38}
39STDAPI DllUnregisterServer() throw()
40{
41        HRESULT nResult;
42        _ATLTRY
43        {
44                nResult = _AtlModule.DllUnregisterServer();
45                __C(nResult);
46        }
47        _ATLCATCH(Exception)
48        {
49                _C(Exception);
50        }
51        return nResult;
52}
53STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
54{
55        HRESULT nResult;
56        _ATLTRY
57        {
58                static const WCHAR g_pszUser[] = _T("user");
59                if(pszCommandLine)
60                {
61                if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0)
62                        AtlSetPerUserRegistration(TRUE);
63                }
64                if(bInstall)
65                {       
66                nResult = DllRegisterServer();
67                if(FAILED(nResult))
68                        DllUnregisterServer();
69                } else
70                nResult = DllUnregisterServer();
71        }
72        _ATLCATCH(Exception)
73        {
74                _C(Exception);
75        }
76        return nResult;
77}
Note: See TracBrowser for help on using the repository browser.