source: trunk/Utilities/UaMobileTools/UaMobileTools.cpp @ 106

Last change on this file since 106 was 106, 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: UaMobileTools.cpp 106 2012-08-27 17:29:12Z roman $
6
7#include "stdafx.h"
8#include "resource.h"
9#include "UaMobileTools_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}
23STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
24{
25    return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
26}
27STDAPI DllRegisterServer() throw()
28{
29        HRESULT nResult;
30        _ATLTRY
31        {
32                nResult = _AtlModule.DllRegisterServer();
33                __C(nResult);
34        }
35        _ATLCATCH(Exception)
36        {
37                _C(Exception);
38        }
39        return nResult;
40}
41STDAPI DllUnregisterServer() throw()
42{
43        HRESULT nResult;
44        _ATLTRY
45        {
46                nResult = _AtlModule.DllUnregisterServer();
47                __C(nResult);
48        }
49        _ATLCATCH(Exception)
50        {
51                _C(Exception);
52        }
53        return nResult;
54}
55STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
56{
57        HRESULT nResult;
58        _ATLTRY
59        {
60                static const WCHAR g_pszUser[] = _T("user");
61                if(pszCommandLine)
62                {
63                if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0)
64                        AtlSetPerUserRegistration(TRUE);
65                }
66                if(bInstall)
67                {       
68                nResult = DllRegisterServer();
69                if(FAILED(nResult))
70                        DllUnregisterServer();
71                } else
72                nResult = DllUnregisterServer();
73        }
74        _ATLCATCH(Exception)
75        {
76                _C(Exception);
77        }
78        return nResult;
79}
Note: See TracBrowser for help on using the repository browser.