Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/oleacc/main.c | 45 +++++++++++++++++++++++++++++++++++++++++ dlls/oleacc/oleacc.spec | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/oleacc/main.c b/dlls/oleacc/main.c index f6b66a8bcab..27cc170de1b 100644 --- a/dlls/oleacc/main.c +++ b/dlls/oleacc/main.c @@ -331,6 +331,51 @@ HRESULT WINAPI AccessibleObjectFromPoint( POINT ptScreen, IAccessible** ppacc, V return E_NOTIMPL; }
+static void variant_init_i4( VARIANT *v, int val ) +{ + V_VT(v) = VT_I4; + V_I4(v) = val; +} + +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; + + 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) + { + IAccessible_Release(acc); + + IDispatch_QueryInterface(child, &IID_IAccessible, (void **)&acc); + IDispatch_Release(child); + + variant_init_i4(&child_id_variant, CHILDID_SELF); + } + + *acc_out = acc; + *child_id_out = child_id_variant; + + return S_OK; +} + HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID, REFIID riid, void** ppvObject ) { diff --git a/dlls/oleacc/oleacc.spec b/dlls/oleacc/oleacc.spec index 4cff0b8effc..9ad6e915965 100644 --- a/dlls/oleacc/oleacc.spec +++ b/dlls/oleacc/oleacc.spec @@ -1,5 +1,5 @@ @ stdcall AccessibleChildren(ptr long long ptr ptr) -@ stub AccessibleObjectFromEvent +@ stdcall AccessibleObjectFromEvent(ptr long long ptr ptr) @ stdcall AccessibleObjectFromPoint(int64 ptr ptr) @ stdcall AccessibleObjectFromWindow(ptr long ptr ptr) @ stdcall CreateStdAccessibleObject(ptr long ptr ptr)