1*34dd1e25SAndrew Rist /**************************************************************
2*34dd1e25SAndrew Rist  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*34dd1e25SAndrew Rist  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*34dd1e25SAndrew Rist  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19*34dd1e25SAndrew Rist  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // so_activex.cpp : Implementation of DLL Exports.
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // Note: Proxy/Stub Information
28cdf0e10cSrcweir //      To build a separate proxy/stub DLL,
29cdf0e10cSrcweir //      run nmake -f so_activexps.mk in the project directory.
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "stdafx2.h"
32cdf0e10cSrcweir #include "resource.h"
33cdf0e10cSrcweir #include <initguid.h>
34cdf0e10cSrcweir #include "so_activex.h"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "so_activex_i.c"
37cdf0e10cSrcweir #include "SOActiveX.h"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir CComModule _Module;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_SOActiveX,CSOActiveX)43cdf0e10cSrcweir OBJECT_ENTRY(CLSID_SOActiveX, CSOActiveX)
44cdf0e10cSrcweir END_OBJECT_MAP()
45cdf0e10cSrcweir 
46cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
47cdf0e10cSrcweir // DLL Entry Point
48cdf0e10cSrcweir 
49cdf0e10cSrcweir extern "C"
50cdf0e10cSrcweir BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir     if (dwReason == DLL_PROCESS_ATTACH)
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         _Module.Init(ObjectMap, hInstance, &LIBID_SO_ACTIVEXLib);
55cdf0e10cSrcweir         DisableThreadLibraryCalls(hInstance);
56cdf0e10cSrcweir     }
57cdf0e10cSrcweir     else if (dwReason == DLL_PROCESS_DETACH)
58cdf0e10cSrcweir         _Module.Term();
59cdf0e10cSrcweir     return TRUE;    // ok
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
63cdf0e10cSrcweir // Used to determine whether the DLL can be unloaded by OLE
64cdf0e10cSrcweir 
DllCanUnloadNow(void)65cdf0e10cSrcweir STDAPI DllCanUnloadNow(void)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
71cdf0e10cSrcweir // Returns a class factory to create an object of the requested type
72cdf0e10cSrcweir 
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)73cdf0e10cSrcweir STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
74cdf0e10cSrcweir {
75cdf0e10cSrcweir     return _Module.GetClassObject(rclsid, riid, ppv);
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
79cdf0e10cSrcweir // DllRegisterServer - Adds entries to the system registry
80cdf0e10cSrcweir 
DllRegisterServer(void)81cdf0e10cSrcweir STDAPI DllRegisterServer(void)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     HRESULT aResult = _Module.RegisterServer(TRUE);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	return aResult;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
89cdf0e10cSrcweir // DllUnregisterServer - Removes entries from the system registry
90cdf0e10cSrcweir 
DllUnregisterServer(void)91cdf0e10cSrcweir STDAPI DllUnregisterServer(void)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     HRESULT aResult = _Module.UnregisterServer(TRUE);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	return aResult;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98