Hi Connor,
On 8/27/21 5:21 PM, Connor McAdams wrote:
+HRESULT WINAPI AccessibleObjectFromEvent( HWND hwnd, DWORD object_id, DWORD child_id,
IAccessible **acc_out, VARIANT *child_id_out )
+{
- VARIANT child_id_variant;
- IAccessible *acc = NULL;
- IDispatch *child = NULL;
- HRESULT hr;
- TRACE("%p %d %d %p %p\n", hwnd, object_id, child_id, acc_out, child_id_out);
- if (!acc_out)
return E_INVALIDARG;
- *acc_out = NULL;
child_id_out should be also zeroed at this point.
- hr = AccessibleObjectFromWindow(hwnd, object_id, &IID_IAccessible, (void **)&acc);
- if (FAILED(hr))
return hr;
- variant_init_i4(&child_id_variant, child_id);
- hr = IAccessible_get_accChild(acc, child_id_variant, &child);
- if (FAILED(hr))
TRACE("get_accChild failed with %#x!\n", hr);
- if (child)
A bad behaving IAccessible implementation may set child and return error. Please change it to something like: if (SUCCEEDED(hr) && child)
- {
IAccessible_Release(acc);
IDispatch_QueryInterface(child, &IID_IAccessible, (void **)&acc);
Please handle QueryInterface failure here.
Thanks, Piotr