Commit 46b78c5d authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Don't return oleacc proxy IAccessibles from GetIAccessible for MSAA providers.

parent 00799933
......@@ -3474,6 +3474,12 @@ static void test_uia_prov_from_acc_fragment_root(HWND hwnd)
CHECK_CALLED(winproc_GETOBJECT_CLIENT);
/*
* ILegacyIAccessibleProvider::GetIAccessible returns a NULL
* IAccessible if the provider represents an oleacc proxy.
*/
check_msaa_prov_acc(elroot, NULL, CHILDID_SELF);
/*
* Returns a provider from get_HostRawElementProvider without having
* to query the HWND.
*/
......@@ -3494,6 +3500,7 @@ static void test_uia_prov_from_acc_fragment_root(HWND hwnd)
IRawElementProviderFragment_Release(elfrag2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!elroot2, "elroot2 == NULL\n");
check_msaa_prov_acc(elroot2, NULL, CHILDID_SELF);
CHECK_CALLED(winproc_GETOBJECT_CLIENT);
ok(!iface_cmp((IUnknown *)elroot, (IUnknown *)elroot2), "elroot2 == elroot\n");
......
......@@ -84,6 +84,21 @@ static IAccessible *msaa_acc_da_unwrap(IAccessible *acc)
return acc;
}
static BOOL msaa_acc_is_oleacc_proxy(IAccessible *acc)
{
IUnknown *unk;
HRESULT hr;
hr = msaa_acc_get_service(acc, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk);
if (SUCCEEDED(hr) && unk)
{
IUnknown_Release(unk);
return TRUE;
}
return FALSE;
}
/*
* Compare role, state, child count, and location properties of the two
* IAccessibles. If all four are successfully retrieved and are equal, this is
......@@ -1103,10 +1118,11 @@ static HRESULT WINAPI msaa_acc_provider_GetIAccessible(ILegacyIAccessibleProvide
TRACE("%p, %p\n", iface, out_acc);
IAccessible_AddRef(msaa_prov->acc);
*out_acc = msaa_prov->acc;
*out_acc = NULL;
if (msaa_acc_is_oleacc_proxy(msaa_prov->acc))
return S_OK;
return S_OK;
return IAccessible_QueryInterface(msaa_prov->acc, &IID_IAccessible, (void **)out_acc);
}
static HRESULT WINAPI msaa_acc_provider_get_ChildId(ILegacyIAccessibleProvider *iface, int *out_cid)
......@@ -1252,7 +1268,6 @@ HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, LONG child_id, DWORD
IRawElementProviderSimple **elprov)
{
HWND hwnd = NULL;
IUnknown *unk;
HRESULT hr;
TRACE("(%p, %ld, %#lx, %p)\n", acc, child_id, flags, elprov);
......@@ -1271,11 +1286,9 @@ HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, LONG child_id, DWORD
return E_NOTIMPL;
}
hr = msaa_acc_get_service(acc, &IIS_IsOleaccProxy, &IID_IUnknown, (void **)&unk);
if (SUCCEEDED(hr) && unk)
if (msaa_acc_is_oleacc_proxy(acc))
{
WARN("Cannot wrap an oleacc proxy IAccessible!\n");
IUnknown_Release(unk);
return E_INVALIDARG;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment