diff --git a/dlls/activeds/tests/activeds.c b/dlls/activeds/tests/activeds.c index 6f469f9dc16..81fe7540585 100644 --- a/dlls/activeds/tests/activeds.c +++ b/dlls/activeds/tests/activeds.c @@ -19,15 +19,20 @@ #include #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "objbase.h" +#include "initguid.h" #include "iads.h" #include "adshlp.h" #include "adserr.h" #include "wine/test.h" +DEFINE_GUID(CLSID_Pathname,0x080d0d78,0xf421,0x11d0,0xa3,0x6e,0x00,0xc0,0x4f,0xb9,0x50,0xdc); + static void test_ADsBuildVarArrayStr(void) { const WCHAR *props[] = { L"prop1", L"prop2" }; @@ -79,7 +84,100 @@ static void test_ADsBuildVarArrayStr(void) VariantClear(&var); } +static void test_Pathname(void) +{ + static const WCHAR * const elem[3] = { L"a=b",L"c=d",L"e=f" }; + HRESULT hr; + IADsPathname *path; + BSTR bstr; + LONG count, i; + + hr = CoCreateInstance(&CLSID_Pathname, 0, CLSCTX_INPROC_SERVER, &IID_IADsPathname, (void **)&path); + ok(hr == S_OK, "got %#x\n", hr); + + 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; + hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr); +todo_wine + 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); + + bstr = SysAllocString(L"LDAP://sample"); + hr = IADsPathname_Set(path, bstr, ADS_SETTYPE_FULL); + ok(hr == S_OK, "got %#x\n", hr); + SysFreeString(bstr); + + 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); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_INDEX), "got %#x\n", hr); + SysFreeString(bstr); + + bstr = SysAllocString(L"LDAP://sample:123/a=b,c=d,e=f"); + hr = IADsPathname_Set(path, bstr, ADS_SETTYPE_FULL); + ok(hr == S_OK, "got %#x\n", hr); + SysFreeString(bstr); + + 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); + ok(hr == S_OK, "got %#x\n", hr); + ok(!wcscmp(bstr, elem[i]), "%u: %s\n", i, wine_dbgstr_w(bstr)); + SysFreeString(bstr); + } + + hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr); + ok(hr == S_OK, "got %#x\n", hr); + 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); + + hr = IADsPathname_Retrieve(path, ADS_FORMAT_SERVER, &bstr); + ok(hr == S_OK, "got %#x\n", hr); +todo_wine + ok(!wcscmp(bstr, L"sample:123"), "got %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + hr = IADsPathname_Retrieve(path, ADS_FORMAT_LEAF, &bstr); + ok(hr == S_OK, "got %#x\n", hr); +todo_wine + ok(!wcscmp(bstr, L"a=b"), "got %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + IADsPathname_Release(path); +} + START_TEST(activeds) { + CoInitialize(NULL); + + test_Pathname(); test_ADsBuildVarArrayStr(); + + CoUninitialize(); } diff --git a/include/iads.idl b/include/iads.idl index e9eaab77bea..6dfafce3a87 100644 --- a/include/iads.idl +++ b/include/iads.idl @@ -370,6 +370,29 @@ typedef enum ADS_SECURITY_INFO_SACL = 0x8 } ADS_SECURITY_INFO_ENUM; +typedef enum +{ + ADS_SETTYPE_FULL = 1, + ADS_SETTYPE_PROVIDER = 2, + ADS_SETTYPE_SERVER = 3, + ADS_SETTYPE_DN = 4 +} ADS_SETTYPE_ENUM; + +typedef enum +{ + ADS_FORMAT_WINDOWS = 1, + ADS_FORMAT_WINDOWS_NO_SERVER = 2, + ADS_FORMAT_WINDOWS_DN = 3, + ADS_FORMAT_WINDOWS_PARENT = 4, + ADS_FORMAT_X500 = 5, + ADS_FORMAT_X500_NO_SERVER = 6, + ADS_FORMAT_X500_DN = 7, + ADS_FORMAT_X500_PARENT = 8, + ADS_FORMAT_SERVER = 9, + ADS_FORMAT_PROVIDER = 10, + ADS_FORMAT_LEAF = 11 +} ADS_FORMAT_ENUM; + /***************************************************************************** * IADsContainer interface */