From: Esme Povirk esme@codeweavers.com
--- dlls/comctl32/Makefile.in | 2 +- dlls/comctl32/syslink.c | 48 +++++++++++++++++++++++++++++++++-- dlls/comctl32/tests/syslink.c | 6 ++--- 3 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in index 383faee35ad..954572964f5 100644 --- a/dlls/comctl32/Makefile.in +++ b/dlls/comctl32/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D_COMCTL32_ MODULE = comctl32.dll IMPORTLIB = comctl32 -IMPORTS = uuid user32 gdi32 advapi32 imm32 kernelbase oleacc +IMPORTS = uuid user32 gdi32 advapi32 imm32 kernelbase oleacc oleaut32 DELAYIMPORTS = winmm uxtheme
SOURCES = \ diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index 50a52152eed..1c08cb2c121 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -238,8 +238,52 @@ static HRESULT WINAPI Accessible_get_accChild(IAccessible *iface, VARIANT childi
static HRESULT WINAPI Accessible_get_accName(IAccessible *iface, VARIANT childid, BSTR *name) { - FIXME("%p\n", iface); - return E_NOTIMPL; + SYSLINK_ACC *This = impl_from_IAccessible(iface); + HRESULT hr; + DOC_ITEM* item; + BSTR result; + + TRACE("%p, %s\n", iface, debugstr_variant(&childid)); + + if (!name) + return E_POINTER; + + *name = NULL; + + hr = Accessible_FindChild(This, childid, &item); + if (FAILED(hr)) + return hr; + + if (item) + { + result = SysAllocString(item->Text); + if (!result) + return E_OUTOFMEMORY; + } + else + { + UINT total_length = 0, i; + + LIST_FOR_EACH_ENTRY(item, &This->infoPtr->Items, DOC_ITEM, entry) + { + total_length += item->nText; + } + + result = SysAllocStringLen(NULL, total_length); + if (!result) + return E_OUTOFMEMORY; + + i = 0; + LIST_FOR_EACH_ENTRY(item, &This->infoPtr->Items, DOC_ITEM, entry) + { + memcpy(&result[i], item->Text, item->nText * sizeof(*result)); + i += item->nText; + } + } + + *name = result; + + return S_OK; }
static HRESULT WINAPI Accessible_get_accValue(IAccessible *iface, VARIANT childid, BSTR *value) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 67df0a041e8..a0e95aaee55 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -322,7 +322,6 @@ static void test_msaa(void) ok(V_VT(&varResult) == VT_I4, "accState returned vt=%x\n", V_VT(&varResult)); ok(V_I4(&varResult) == STATE_SYSTEM_FOCUSABLE, "accState returned %li\n", V_I4(&varResult));
-todo_wine { hr = IAccessible_get_accName(acc, varChild, &name); ok(hr == S_OK, "accName failed, hr=%lx\n", hr); if (SUCCEEDED(hr)) { @@ -331,6 +330,7 @@ todo_wine { SysFreeString(name); }
+todo_wine { hr = IAccessible_get_accDefaultAction(acc, varChild, &name); ok(hr == S_FALSE, "accDefaultAction failed, hr=%lx\n", hr); if (SUCCEEDED(hr)) @@ -361,7 +361,6 @@ todo_wine { ok(V_VT(&varResult) == VT_I4, "accState returned vt=%x\n", V_VT(&varResult)); ok(V_I4(&varResult) == (STATE_SYSTEM_FOCUSABLE|STATE_SYSTEM_LINKED), "accState returned %li\n", V_I4(&varResult));
-todo_wine { hr = IAccessible_get_accName(acc, varChild, &name); ok(hr == S_OK, "accName failed, hr=%lx\n", hr); if (SUCCEEDED(hr)) { @@ -370,6 +369,7 @@ todo_wine { SysFreeString(name); }
+todo_wine { hr = IAccessible_get_accDefaultAction(acc, varChild, &name); ok(hr == S_OK, "accDefaultAction failed, hr=%lx\n", hr); if (SUCCEEDED(hr)) @@ -407,7 +407,6 @@ todo_wine { ok(V_VT(&varResult) == VT_I4, "accState returned vt=%x\n", V_VT(&varResult)); ok(V_I4(&varResult) == (STATE_SYSTEM_FOCUSABLE|STATE_SYSTEM_LINKED), "accState returned %li\n", V_I4(&varResult));
-todo_wine { hr = IAccessible_get_accName(acc, varChild, &name); ok(hr == S_OK, "accName failed, hr=%lx\n", hr); if (SUCCEEDED(hr)) { @@ -416,6 +415,7 @@ todo_wine { SysFreeString(name); }
+todo_wine { hr = IAccessible_get_accDefaultAction(acc, varChild, &name); ok(hr == S_OK, "accDefaultAction failed, hr=%lx\n", hr); if (SUCCEEDED(hr))