Dmitry Timoshkov : activeds: Implement IADsPathname::GetElement().

Alexandre Julliard julliard at winehq.org
Fri Apr 10 13:56:08 CDT 2020


Module: wine
Branch: master
Commit: 0051bea4ece9273fef63e29329ee5fd5f86a6ded
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0051bea4ece9273fef63e29329ee5fd5f86a6ded

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Apr 10 15:34:35 2020 +0800

activeds: Implement IADsPathname::GetElement().

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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




More information about the wine-cvs mailing list