Module: wine Branch: master Commit: 29967463ad26b4d1f935dc1db78994102c507a03 URL: https://source.winehq.org/git/wine.git/?a=commit;h=29967463ad26b4d1f935dc1db...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Fri Apr 10 15:34:26 2020 +0800
activeds: Implement IADsPathname::Retrieve(ADS_FORMAT_X500).
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/activeds/pathname.c | 32 +++++++++++++++++++++++++++++--- dlls/activeds/tests/activeds.c | 3 +-- 2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/dlls/activeds/pathname.c b/dlls/activeds/pathname.c index cffaf3d8e6..3a1d9e8c16 100644 --- a/dlls/activeds/pathname.c +++ b/dlls/activeds/pathname.c @@ -234,13 +234,39 @@ static HRESULT WINAPI path_SetDisplayType(IADsPathname *iface, LONG type) static HRESULT WINAPI path_Retrieve(IADsPathname *iface, LONG type, BSTR *adspath) { Pathname *path = impl_from_IADsPathname(iface); + int len;
- FIXME("%p,%d,%p: stub\n", iface, type, adspath); + TRACE("%p,%d,%p\n", iface, type, adspath);
if (!adspath) return E_INVALIDARG;
- *adspath = SysAllocString(path->provider); - return *adspath ? S_OK : E_OUTOFMEMORY; + switch (type) + { + default: + FIXME("type %d not implemented\n", type); + /* fall through */ + + case ADS_FORMAT_X500: + len = wcslen(path->provider) + 3; + if (path->server) len += wcslen(path->server) + 1; + if (path->dn) len += wcslen(path->dn); + + *adspath = SysAllocStringLen(NULL, len); + if (!*adspath) return E_OUTOFMEMORY; + + wcscpy(*adspath, path->provider); + wcscat(*adspath, L"://"); + if (path->server) + { + wcscat(*adspath, path->server); + wcscat(*adspath, L"/"); + } + if (path->dn) wcscat(*adspath, path->dn); + break; + } + + TRACE("=> %s\n", debugstr_w(*adspath)); + return S_OK; }
static HRESULT WINAPI path_GetNumElements(IADsPathname *iface, LONG *count) diff --git a/dlls/activeds/tests/activeds.c b/dlls/activeds/tests/activeds.c index dff30bbbba..6e5ecdf573 100644 --- a/dlls/activeds/tests/activeds.c +++ b/dlls/activeds/tests/activeds.c @@ -105,7 +105,6 @@ todo_wine bstr = NULL; hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr); ok(hr == S_OK, "got %#x\n", hr); -todo_wine ok(bstr && !wcscmp(bstr, L"LDAP://"), "got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr);
@@ -147,12 +146,12 @@ todo_wine
hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr); ok(hr == S_OK, "got %#x\n", hr); -todo_wine ok(!wcscmp(bstr, L"LDAP://sample:123/a=b,c=d,e=f"), "got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr);
hr = IADsPathname_Retrieve(path, ADS_FORMAT_PROVIDER, &bstr); ok(hr == S_OK, "got %#x\n", hr); +todo_wine ok(!wcscmp(bstr, L"LDAP"), "got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr);