activeds: Implement IADsPathname::GetElement().

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Dmitry Timoshkov 2020-04-10 15:34:35 +08:00 committed by Alexandre Julliard
parent d0eaaea855
commit 0051bea4ec
2 changed files with 29 additions and 3 deletions

View File

@ -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)

View File

@ -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);