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
This commit is contained in:
Michael Stahl 2013-11-24 00:23:44 +01:00
parent d04c970e8f
commit 732ec36edf
2 changed files with 12 additions and 0 deletions

View file

@ -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
}

View file

@ -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 );