1*3a700b0aSSteve Yin /**************************************************************
2*3a700b0aSSteve Yin  *
3*3a700b0aSSteve Yin  * Licensed to the Apache Software Foundation (ASF) under one
4*3a700b0aSSteve Yin  * or more contributor license agreements.  See the NOTICE file
5*3a700b0aSSteve Yin  * distributed with this work for additional information
6*3a700b0aSSteve Yin  * regarding copyright ownership.  The ASF licenses this file
7*3a700b0aSSteve Yin  * to you under the Apache License, Version 2.0 (the
8*3a700b0aSSteve Yin  * "License"); you may not use this file except in compliance
9*3a700b0aSSteve Yin  * with the License.  You may obtain a copy of the License at
10*3a700b0aSSteve Yin  *
11*3a700b0aSSteve Yin  *   http://www.apache.org/licenses/LICENSE-2.0
12*3a700b0aSSteve Yin  *
13*3a700b0aSSteve Yin  * Unless required by applicable law or agreed to in writing,
14*3a700b0aSSteve Yin  * software distributed under the License is distributed on an
15*3a700b0aSSteve Yin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3a700b0aSSteve Yin  * KIND, either express or implied.  See the License for the
17*3a700b0aSSteve Yin  * specific language governing permissions and limitations
18*3a700b0aSSteve Yin  * under the License.
19*3a700b0aSSteve Yin  *
20*3a700b0aSSteve Yin  *************************************************************/
215fdc4257SSteve Yin 
225fdc4257SSteve Yin #include "stdafx.h"
235fdc4257SSteve Yin #include "resource.h"
245fdc4257SSteve Yin #include <initguid.h>
255fdc4257SSteve Yin #include "UAccCOM2.h"
265fdc4257SSteve Yin 
275fdc4257SSteve Yin #include "UAccCOM_i.c"
285fdc4257SSteve Yin #include "Accessible2_i.c"
295fdc4257SSteve Yin #include "AccessibleComponent_i.c"
305fdc4257SSteve Yin #include "AccessibleText_i.c"
315fdc4257SSteve Yin #include "AccessibleEditableText_i.c"
325fdc4257SSteve Yin #include "AccessibleImage_i.c"
335fdc4257SSteve Yin #include "AccessibleTable_i.c"
345fdc4257SSteve Yin #include "AccessibleAction_i.c"
355fdc4257SSteve Yin #include "AccessibleValue_i.c"
365fdc4257SSteve Yin #include "AccessibleHyperText_i.c"
375fdc4257SSteve Yin #include "AccessibleRelation_i.c"
385fdc4257SSteve Yin #include "AccessibleHyperLink_i.c"
395fdc4257SSteve Yin 
405fdc4257SSteve Yin #include "MAccessible.h"
415fdc4257SSteve Yin #include "EnumVariant.h"
425fdc4257SSteve Yin #include "UNOXWrapper.h"
435fdc4257SSteve Yin #include "AccComponent.h"
445fdc4257SSteve Yin #include "AccRelation.h"
455fdc4257SSteve Yin #include "AccAction.h"
465fdc4257SSteve Yin #include "AccText.h"
475fdc4257SSteve Yin #include "AccEditableText.h"
485fdc4257SSteve Yin #include "AccImage.h"
495fdc4257SSteve Yin #include "AccValue.h"
505fdc4257SSteve Yin #include "AccTable.h"
515fdc4257SSteve Yin #include "AccHyperLink.h"
525fdc4257SSteve Yin #include "AccHyperText.h"
535fdc4257SSteve Yin 
545fdc4257SSteve Yin 
555fdc4257SSteve Yin CComModule _Module;
565fdc4257SSteve Yin 
575fdc4257SSteve Yin BEGIN_OBJECT_MAP(ObjectMap)
585fdc4257SSteve Yin OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
595fdc4257SSteve Yin OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
605fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
615fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
625fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccAction, CAccAction)
635fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccText, CAccText)
645fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
655fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccImage, CAccImage)
665fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccValue, CAccValue)
675fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccTable, CAccTable)
685fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
695fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
705fdc4257SSteve Yin END_OBJECT_MAP()
715fdc4257SSteve Yin 
725fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
735fdc4257SSteve Yin // DLL Entry Point
745fdc4257SSteve Yin 
755fdc4257SSteve Yin extern "C"
765fdc4257SSteve Yin     BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
775fdc4257SSteve Yin {
785fdc4257SSteve Yin     if (dwReason == DLL_PROCESS_ATTACH)
795fdc4257SSteve Yin     {
805fdc4257SSteve Yin         _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
815fdc4257SSteve Yin         DisableThreadLibraryCalls(hInstance);
825fdc4257SSteve Yin     }
835fdc4257SSteve Yin     else if (dwReason == DLL_PROCESS_DETACH)
845fdc4257SSteve Yin         _Module.Term();
855fdc4257SSteve Yin     return TRUE;    // ok
865fdc4257SSteve Yin }
875fdc4257SSteve Yin 
885fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
895fdc4257SSteve Yin // Used to determine whether the DLL can be unloaded by OLE
905fdc4257SSteve Yin 
915fdc4257SSteve Yin STDAPI DllCanUnloadNow(void)
925fdc4257SSteve Yin {
935fdc4257SSteve Yin     return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
945fdc4257SSteve Yin }
955fdc4257SSteve Yin 
965fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
975fdc4257SSteve Yin // Returns a class factory to create an object of the requested type
985fdc4257SSteve Yin 
995fdc4257SSteve Yin STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
1005fdc4257SSteve Yin {
1015fdc4257SSteve Yin     return _Module.GetClassObject(rclsid, riid, ppv);
1025fdc4257SSteve Yin }
1035fdc4257SSteve Yin 
1045fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
1055fdc4257SSteve Yin // DllRegisterServer - Adds entries to the system registry
1065fdc4257SSteve Yin 
1075fdc4257SSteve Yin STDAPI DllRegisterServer(void)
1085fdc4257SSteve Yin {
1095fdc4257SSteve Yin     // registers object, typelib and all interfaces in typelib
1105fdc4257SSteve Yin     return _Module.RegisterServer(TRUE);
1115fdc4257SSteve Yin }
1125fdc4257SSteve Yin 
1135fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
1145fdc4257SSteve Yin // DllUnregisterServer - Removes entries from the system registry
1155fdc4257SSteve Yin 
1165fdc4257SSteve Yin STDAPI DllUnregisterServer(void)
1175fdc4257SSteve Yin {
1185fdc4257SSteve Yin     return _Module.UnregisterServer(TRUE);
1195fdc4257SSteve Yin }
120