1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include "stdafx.h"
23 #include "resource.h"
24 #include <initguid.h>
25 #include "UAccCOM2.h"
26 
27 #include "UAccCOM_i.c"
28 #include "Accessible2_i.c"
29 #include "AccessibleComponent_i.c"
30 #include "AccessibleText_i.c"
31 #include "AccessibleEditableText_i.c"
32 #include "AccessibleImage_i.c"
33 #include "AccessibleTable_i.c"
34 #include "AccessibleAction_i.c"
35 #include "AccessibleValue_i.c"
36 #include "AccessibleHyperText_i.c"
37 #include "AccessibleRelation_i.c"
38 #include "AccessibleHyperLink_i.c"
39 
40 #include "MAccessible.h"
41 #include "EnumVariant.h"
42 #include "UNOXWrapper.h"
43 #include "AccComponent.h"
44 #include "AccRelation.h"
45 #include "AccAction.h"
46 #include "AccText.h"
47 #include "AccEditableText.h"
48 #include "AccImage.h"
49 #include "AccValue.h"
50 #include "AccTable.h"
51 #include "AccHyperLink.h"
52 #include "AccHyperText.h"
53 
54 
55 CComModule _Module;
56 
57 BEGIN_OBJECT_MAP(ObjectMap)
58 OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
59 OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
60 OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
61 OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
62 OBJECT_ENTRY(CLSID_AccAction, CAccAction)
63 OBJECT_ENTRY(CLSID_AccText, CAccText)
64 OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
65 OBJECT_ENTRY(CLSID_AccImage, CAccImage)
66 OBJECT_ENTRY(CLSID_AccValue, CAccValue)
67 OBJECT_ENTRY(CLSID_AccTable, CAccTable)
68 OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
69 OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
70 END_OBJECT_MAP()
71 
72 /////////////////////////////////////////////////////////////////////////////
73 // DLL Entry Point
74 
75 extern "C"
76     BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
77 {
78     if (dwReason == DLL_PROCESS_ATTACH)
79     {
80         _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
81         DisableThreadLibraryCalls(hInstance);
82     }
83     else if (dwReason == DLL_PROCESS_DETACH)
84         _Module.Term();
85     return TRUE;    // ok
86 }
87 
88 /////////////////////////////////////////////////////////////////////////////
89 // Used to determine whether the DLL can be unloaded by OLE
90 
91 STDAPI DllCanUnloadNow(void)
92 {
93     return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
94 }
95 
96 /////////////////////////////////////////////////////////////////////////////
97 // Returns a class factory to create an object of the requested type
98 
99 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
100 {
101     return _Module.GetClassObject(rclsid, riid, ppv);
102 }
103 
104 /////////////////////////////////////////////////////////////////////////////
105 // DllRegisterServer - Adds entries to the system registry
106 
107 STDAPI DllRegisterServer(void)
108 {
109     // registers object, typelib and all interfaces in typelib
110     return _Module.RegisterServer(TRUE);
111 }
112 
113 /////////////////////////////////////////////////////////////////////////////
114 // DllUnregisterServer - Removes entries from the system registry
115 
116 STDAPI DllUnregisterServer(void)
117 {
118     return _Module.UnregisterServer(TRUE);
119 }
120