13a700b0aSSteve Yin /**************************************************************
23a700b0aSSteve Yin  *
33a700b0aSSteve Yin  * Licensed to the Apache Software Foundation (ASF) under one
43a700b0aSSteve Yin  * or more contributor license agreements.  See the NOTICE file
53a700b0aSSteve Yin  * distributed with this work for additional information
63a700b0aSSteve Yin  * regarding copyright ownership.  The ASF licenses this file
73a700b0aSSteve Yin  * to you under the Apache License, Version 2.0 (the
83a700b0aSSteve Yin  * "License"); you may not use this file except in compliance
93a700b0aSSteve Yin  * with the License.  You may obtain a copy of the License at
103a700b0aSSteve Yin  *
113a700b0aSSteve Yin  *   http://www.apache.org/licenses/LICENSE-2.0
123a700b0aSSteve Yin  *
133a700b0aSSteve Yin  * Unless required by applicable law or agreed to in writing,
143a700b0aSSteve Yin  * software distributed under the License is distributed on an
153a700b0aSSteve Yin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163a700b0aSSteve Yin  * KIND, either express or implied.  See the License for the
173a700b0aSSteve Yin  * specific language governing permissions and limitations
183a700b0aSSteve Yin  * under the License.
193a700b0aSSteve Yin  *
203a700b0aSSteve 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"
28*b0a7a3cfSSteve Yin #include "ia2_api_all_i.c"
295fdc4257SSteve Yin 
305fdc4257SSteve Yin #include "MAccessible.h"
315fdc4257SSteve Yin #include "EnumVariant.h"
325fdc4257SSteve Yin #include "UNOXWrapper.h"
335fdc4257SSteve Yin #include "AccComponent.h"
345fdc4257SSteve Yin #include "AccRelation.h"
355fdc4257SSteve Yin #include "AccAction.h"
365fdc4257SSteve Yin #include "AccText.h"
375fdc4257SSteve Yin #include "AccEditableText.h"
385fdc4257SSteve Yin #include "AccImage.h"
395fdc4257SSteve Yin #include "AccValue.h"
405fdc4257SSteve Yin #include "AccTable.h"
415fdc4257SSteve Yin #include "AccHyperLink.h"
425fdc4257SSteve Yin #include "AccHyperText.h"
435fdc4257SSteve Yin 
445fdc4257SSteve Yin 
455fdc4257SSteve Yin CComModule _Module;
465fdc4257SSteve Yin 
475fdc4257SSteve Yin BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_MAccessible,CMAccessible)485fdc4257SSteve Yin OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
495fdc4257SSteve Yin OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
505fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
515fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
525fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccAction, CAccAction)
535fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccText, CAccText)
545fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
555fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccImage, CAccImage)
565fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccValue, CAccValue)
575fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccTable, CAccTable)
585fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
595fdc4257SSteve Yin OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
605fdc4257SSteve Yin END_OBJECT_MAP()
615fdc4257SSteve Yin 
625fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
635fdc4257SSteve Yin // DLL Entry Point
645fdc4257SSteve Yin 
655fdc4257SSteve Yin extern "C"
665fdc4257SSteve Yin     BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
675fdc4257SSteve Yin {
685fdc4257SSteve Yin     if (dwReason == DLL_PROCESS_ATTACH)
695fdc4257SSteve Yin     {
705fdc4257SSteve Yin         _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
715fdc4257SSteve Yin         DisableThreadLibraryCalls(hInstance);
725fdc4257SSteve Yin     }
735fdc4257SSteve Yin     else if (dwReason == DLL_PROCESS_DETACH)
745fdc4257SSteve Yin         _Module.Term();
755fdc4257SSteve Yin     return TRUE;    // ok
765fdc4257SSteve Yin }
775fdc4257SSteve Yin 
785fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
795fdc4257SSteve Yin // Used to determine whether the DLL can be unloaded by OLE
805fdc4257SSteve Yin 
DllCanUnloadNow(void)815fdc4257SSteve Yin STDAPI DllCanUnloadNow(void)
825fdc4257SSteve Yin {
835fdc4257SSteve Yin     return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
845fdc4257SSteve Yin }
855fdc4257SSteve Yin 
865fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
875fdc4257SSteve Yin // Returns a class factory to create an object of the requested type
885fdc4257SSteve Yin 
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)895fdc4257SSteve Yin STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
905fdc4257SSteve Yin {
915fdc4257SSteve Yin     return _Module.GetClassObject(rclsid, riid, ppv);
925fdc4257SSteve Yin }
935fdc4257SSteve Yin 
945fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
955fdc4257SSteve Yin // DllRegisterServer - Adds entries to the system registry
965fdc4257SSteve Yin 
DllRegisterServer(void)975fdc4257SSteve Yin STDAPI DllRegisterServer(void)
985fdc4257SSteve Yin {
995fdc4257SSteve Yin     // registers object, typelib and all interfaces in typelib
1005fdc4257SSteve Yin     return _Module.RegisterServer(TRUE);
1015fdc4257SSteve Yin }
1025fdc4257SSteve Yin 
1035fdc4257SSteve Yin /////////////////////////////////////////////////////////////////////////////
1045fdc4257SSteve Yin // DllUnregisterServer - Removes entries from the system registry
1055fdc4257SSteve Yin 
DllUnregisterServer(void)1065fdc4257SSteve Yin STDAPI DllUnregisterServer(void)
1075fdc4257SSteve Yin {
1085fdc4257SSteve Yin     return _Module.UnregisterServer(TRUE);
1095fdc4257SSteve Yin }
110