summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-11-24 00:23:44 +0100
committerMichael Stahl <mstahl@redhat.com>2013-11-24 01:02:46 +0100
commit732ec36edfd09d2091d70c4d71b5f182fe279c45 (patch)
tree6305a6006b25ce9cc379770e6a5676412eb50d3c
parentd04c970e8f33109a1ef5c52f922a48a0ff62adb0 (diff)
winaccessibility: let CoCreateInstance calls find the components
The COM services are not found because they are not registered in the registry via regsvr32 (doing that is unnecessary since the components are only instantiated by winaccessibility code and undesirable since that would likely register the IAccessible2 types too, breaking A11y tools) and the special manifest resource #97 that ActivateActContext() tries to load does not exist in UAccCOM.dll; this would need to be a XML manifest, the *.rgs and *.tlb that are already included as individual resources won't work. After reading ATL headers for hours it is immediately obvious that the COM components can simply be registered by a call to CComModule::RegisterClassObjects() from DllMain; this just requires actually loading the UAccCOM library from somewhere so the DllMain runs. Change-Id: Id58b754835cd2f1bcada37e5639a6b6042a42fd5
-rw-r--r--winaccessibility/source/UAccCOM/UAccCOM.cxx4
-rw-r--r--winaccessibility/source/service/msaaservice_impl.cxx8
2 files changed, 12 insertions, 0 deletions
diff --git a/winaccessibility/source/UAccCOM/UAccCOM.cxx b/winaccessibility/source/UAccCOM/UAccCOM.cxx
index 1f7eab49da71..851464f058f9 100644
--- a/winaccessibility/source/UAccCOM/UAccCOM.cxx
+++ b/winaccessibility/source/UAccCOM/UAccCOM.cxx
@@ -66,10 +66,14 @@ extern "C"
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
+ _Module.RegisterClassObjects(CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
+ {
+ _Module.RevokeClassObjects();
_Module.Term();
+ }
return TRUE; // ok
}
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index 950ef9b66cae..6dc1b250bf42 100644
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -267,6 +267,14 @@ Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentCo
}
}
+ // load UAccCOM library so its DllMain can register its COM components
+ static HMODULE h = LoadLibrary("UAccCOM.dll");
+ if (!h)
+ {
+ assert(false);
+ return 0;
+ }
+
Reference< XMSAAService > xAccMgr( new MSAAServiceImpl() );
AccessBridgeUpdateOldTopWindows( xAccMgr );