activeds/tests: Add some IADsPathname tests.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8af510ea47
commit
18631864de
|
@ -19,15 +19,20 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "objbase.h"
|
#include "objbase.h"
|
||||||
|
#include "initguid.h"
|
||||||
#include "iads.h"
|
#include "iads.h"
|
||||||
#include "adshlp.h"
|
#include "adshlp.h"
|
||||||
#include "adserr.h"
|
#include "adserr.h"
|
||||||
|
|
||||||
#include "wine/test.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)
|
static void test_ADsBuildVarArrayStr(void)
|
||||||
{
|
{
|
||||||
const WCHAR *props[] = { L"prop1", L"prop2" };
|
const WCHAR *props[] = { L"prop1", L"prop2" };
|
||||||
|
@ -79,7 +84,100 @@ static void test_ADsBuildVarArrayStr(void)
|
||||||
VariantClear(&var);
|
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)
|
START_TEST(activeds)
|
||||||
{
|
{
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
test_Pathname();
|
||||||
test_ADsBuildVarArrayStr();
|
test_ADsBuildVarArrayStr();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,6 +370,29 @@ typedef enum
|
||||||
ADS_SECURITY_INFO_SACL = 0x8
|
ADS_SECURITY_INFO_SACL = 0x8
|
||||||
} ADS_SECURITY_INFO_ENUM;
|
} 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
|
* IADsContainer interface
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue