Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/activeds/pathname.c | 31 +++++++++++++++++++++++++++++-- dlls/activeds/tests/activeds.c | 1 - 2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/activeds/pathname.c b/dlls/activeds/pathname.c index d68f1cb8e9..a47a4e5343 100644 --- a/dlls/activeds/pathname.c +++ b/dlls/activeds/pathname.c @@ -299,8 +299,35 @@ static HRESULT WINAPI path_GetNumElements(IADsPathname *iface, LONG *count)
static HRESULT WINAPI path_GetElement(IADsPathname *iface, LONG index, BSTR *element) { - FIXME("%p,%d,%p: stub\n", iface, index, element); - return E_NOTIMPL; + Pathname *path = impl_from_IADsPathname(iface); + HRESULT hr; + WCHAR *p, *end; + LONG count; + + TRACE("%p,%d,%p\n", iface, index, element); + + if (!element) return E_INVALIDARG; + + count = 0; + hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX); + + p = path->dn; + while (p) + { + end = wcschr(p, ','); + + if (index == count) + { + *element = end ? SysAllocStringLen(p, end - p) : SysAllocString(p); + hr = *element ? S_OK : E_OUTOFMEMORY; + break; + } + + p = end ? end + 1 : NULL; + count++; + } + + return hr; }
static HRESULT WINAPI path_AddLeafElement(IADsPathname *iface, BSTR element) diff --git a/dlls/activeds/tests/activeds.c b/dlls/activeds/tests/activeds.c index 118c87634b..6df2d2bfd3 100644 --- a/dlls/activeds/tests/activeds.c +++ b/dlls/activeds/tests/activeds.c @@ -121,7 +121,6 @@ todo_wine ok(count == 0, "got %d\n", count);
hr = IADsPathname_GetElement(path, 0, &bstr); -todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_INDEX), "got %#x\n", hr); SysFreeString(bstr);