From d495541646bf8443f51f5b579193c35c84fe27f0 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 10 Apr 2020 15:34:38 +0800 Subject: [PATCH] activeds: Implement IADsPathname::GetNumElements(). Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- dlls/activeds/pathname.c | 20 ++++++++++++++++++-- dlls/activeds/tests/activeds.c | 7 +------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/dlls/activeds/pathname.c b/dlls/activeds/pathname.c index a47a4e53438..fbc7984f2e4 100644 --- a/dlls/activeds/pathname.c +++ b/dlls/activeds/pathname.c @@ -293,8 +293,24 @@ static HRESULT WINAPI path_Retrieve(IADsPathname *iface, LONG type, BSTR *adspat static HRESULT WINAPI path_GetNumElements(IADsPathname *iface, LONG *count) { - FIXME("%p,%p: stub\n", iface, count); - return E_NOTIMPL; + Pathname *path = impl_from_IADsPathname(iface); + WCHAR *p; + + TRACE("%p,%p\n", iface, count); + + if (!count) return E_INVALIDARG; + + *count = 0; + + p = path->dn; + while (p) + { + *count += 1; + p = wcschr(p, ','); + if (p) p++; + } + + return S_OK; } static HRESULT WINAPI path_GetElement(IADsPathname *iface, LONG index, BSTR *element) diff --git a/dlls/activeds/tests/activeds.c b/dlls/activeds/tests/activeds.c index 6df2d2bfd34..c2dc3d58c4b 100644 --- a/dlls/activeds/tests/activeds.c +++ b/dlls/activeds/tests/activeds.c @@ -97,9 +97,7 @@ static void test_Pathname(void) count = 0xdeadbeef; hr = IADsPathname_GetNumElements(path, &count); -todo_wine ok(hr == S_OK, "got %#x\n", hr); -todo_wine ok(count == 0, "got %d\n", count); bstr = NULL; @@ -115,9 +113,7 @@ todo_wine count = 0xdeadbeef; hr = IADsPathname_GetNumElements(path, &count); -todo_wine ok(hr == S_OK, "got %#x\n", hr); -todo_wine ok(count == 0, "got %d\n", count); hr = IADsPathname_GetElement(path, 0, &bstr); @@ -131,10 +127,9 @@ todo_wine count = 0xdeadbeef; hr = IADsPathname_GetNumElements(path, &count); -todo_wine ok(hr == S_OK, "got %#x\n", hr); -todo_wine ok(count == 3, "got %d\n", count); + for (i = 0; i < count; i++) { hr = IADsPathname_GetElement(path, i, &bstr);