ReactOS 0.4.17-dev-116-ga4b6fe9
activeds.c File Reference
#include <stdarg.h>
#include <stdio.h>
#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"
Include dependency graph for activeds.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 DEFINE_GUID (CLSID_Pathname, 0x080d0d78, 0xf421, 0x11d0, 0xa3, 0x6e, 0x00, 0xc0, 0x4f, 0xb9, 0x50, 0xdc)
 
static void test_ADsBuildVarArrayStr (void)
 
static void test_Pathname (void)
 
 START_TEST (activeds)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file activeds.c.

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_Pathname  ,
0x080d0d78  ,
0xf421  ,
0x11d0  ,
0xa3  ,
0x6e  ,
0x00  ,
0xc0  ,
0x4f  ,
0xb9  ,
0x50  ,
0xdc   
)

◆ START_TEST()

START_TEST ( activeds  )

Definition at line 164 of file activeds.c.

165{
167
170
172}
static void test_ADsBuildVarArrayStr(void)
Definition: activeds.c:36
static void test_Pathname(void)
Definition: activeds.c:87
#define NULL
Definition: types.h:112
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531

◆ test_ADsBuildVarArrayStr()

static void test_ADsBuildVarArrayStr ( void  )
static

Definition at line 36 of file activeds.c.

37{
38 const WCHAR *props[] = { L"prop1", L"prop2" };
39 HRESULT hr;
41 LONG start, end, idx;
42
44 ok(hr == E_ADS_BAD_PARAMETER || hr == E_FAIL /* XP */, "got %#lx\n", hr);
45
47 ok(hr == S_OK, "got %#lx\n", hr);
48 ok(V_VT(&var) == (VT_ARRAY | VT_VARIANT), "got %d\n", V_VT(&var));
49 start = 0xdeadbeef;
51 ok(hr == S_OK, "got %#lx\n", hr);
52 ok(start == 0, "got %ld\n", start);
53 end = 0xdeadbeef;
55 ok(hr == S_OK, "got %#lx\n", hr);
56 ok(end == -1, "got %ld\n", end);
58
60 ok(hr == S_OK, "got %#lx\n", hr);
61 ok(V_VT(&var) == (VT_ARRAY | VT_VARIANT), "got %d\n", V_VT(&var));
62 start = 0xdeadbeef;
64 ok(hr == S_OK, "got %#lx\n", hr);
65 ok(start == 0, "got %ld\n", start);
66 end = 0xdeadbeef;
68 ok(hr == S_OK, "got %#lx\n", hr);
69 ok(end == 1, "got %ld\n", end);
70 idx = 0;
72 ok(hr == S_OK, "got %#lx\n", hr);
73 ok(V_VT(&item) == VT_BSTR, "got %d\n", V_VT(&item));
74 ok(!lstrcmpW(V_BSTR(&item), L"prop1"), "got %s\n", wine_dbgstr_w(V_BSTR(&item)));
76 hr = SafeArrayAccessData(V_ARRAY(&var), (void *)&data);
77 ok(hr == S_OK, "got %#lx\n", hr);
78 ok(V_VT(&data[0]) == VT_BSTR, "got %d\n", V_VT(&data[0]));
79 ok(!lstrcmpW(V_BSTR(&data[0]), L"prop1"), "got %s\n", wine_dbgstr_w(V_BSTR(&data[0])));
80 ok(V_VT(&data[0]) == VT_BSTR, "got %d\n", V_VT(&data[0]));
81 ok(!lstrcmpW(V_BSTR(&data[1]), L"prop2"), "got %s\n", wine_dbgstr_w(V_BSTR(&data[1])));
83 ok(hr == S_OK, "got %#lx\n", hr);
85}
HRESULT WINAPI ADsBuildVarArrayStr(LPWSTR *str, DWORD count, VARIANT *var)
Definition: activeds_main.c:86
#define E_ADS_BAD_PARAMETER
Definition: adserr.h:36
#define ok(value,...)
Definition: atltest.h:57
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:573
unsigned int idx
Definition: utils.c:41
@ VT_BSTR
Definition: compat.h:2303
@ VT_ARRAY
Definition: compat.h:2341
@ VT_VARIANT
Definition: compat.h:2307
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData)
Definition: safearray.c:947
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
#define L(x)
Definition: resources.c:13
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
const char * var
Definition: shader.c:5666
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
uint16_t * LPWSTR
Definition: typedefs.h:56
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by START_TEST().

◆ test_Pathname()

static void test_Pathname ( void  )
static

Definition at line 87 of file activeds.c.

88{
89 static const WCHAR * const elem[3] = { L"a=b",L"c=d",L"e=f" };
90 HRESULT hr;
91 IADsPathname *path;
92 BSTR bstr;
93 LONG count, i;
94
95 hr = CoCreateInstance(&CLSID_Pathname, 0, CLSCTX_INPROC_SERVER, &IID_IADsPathname, (void **)&path);
96 ok(hr == S_OK, "got %#lx\n", hr);
97
98 count = 0xdeadbeef;
99 hr = IADsPathname_GetNumElements(path, &count);
100 ok(hr == S_OK, "got %#lx\n", hr);
101 ok(count == 0, "got %ld\n", count);
102
103 bstr = NULL;
104 hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr);
105 ok(hr == S_OK, "got %#lx\n", hr);
106 ok(bstr && !wcscmp(bstr, L"LDAP://"), "got %s\n", wine_dbgstr_w(bstr));
107 SysFreeString(bstr);
108
109 bstr = SysAllocString(L"LDAP://sample");
110 hr = IADsPathname_Set(path, bstr, ADS_SETTYPE_FULL);
111 ok(hr == S_OK, "got %#lx\n", hr);
112 SysFreeString(bstr);
113
114 count = 0xdeadbeef;
115 hr = IADsPathname_GetNumElements(path, &count);
116 ok(hr == S_OK, "got %#lx\n", hr);
117 ok(count == 0, "got %ld\n", count);
118
119 hr = IADsPathname_GetElement(path, 0, &bstr);
120 ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_INDEX), "got %#lx\n", hr);
121 SysFreeString(bstr);
122
123 bstr = SysAllocString(L"LDAP://sample:123/a=b,c=d,e=f");
124 hr = IADsPathname_Set(path, bstr, ADS_SETTYPE_FULL);
125 ok(hr == S_OK, "got %#lx\n", hr);
126 SysFreeString(bstr);
127
128 count = 0xdeadbeef;
129 hr = IADsPathname_GetNumElements(path, &count);
130 ok(hr == S_OK, "got %#lx\n", hr);
131 ok(count == 3, "got %ld\n", count);
132
133 for (i = 0; i < count; i++)
134 {
135 hr = IADsPathname_GetElement(path, i, &bstr);
136 ok(hr == S_OK, "got %#lx\n", hr);
137 ok(!wcscmp(bstr, elem[i]), "%lu: %s\n", i, wine_dbgstr_w(bstr));
138 SysFreeString(bstr);
139 }
140
141 hr = IADsPathname_Retrieve(path, ADS_FORMAT_X500, &bstr);
142 ok(hr == S_OK, "got %#lx\n", hr);
143 ok(!wcscmp(bstr, L"LDAP://sample:123/a=b,c=d,e=f"), "got %s\n", wine_dbgstr_w(bstr));
144 SysFreeString(bstr);
145
146 hr = IADsPathname_Retrieve(path, ADS_FORMAT_PROVIDER, &bstr);
147 ok(hr == S_OK, "got %#lx\n", hr);
148 ok(!wcscmp(bstr, L"LDAP"), "got %s\n", wine_dbgstr_w(bstr));
149 SysFreeString(bstr);
150
151 hr = IADsPathname_Retrieve(path, ADS_FORMAT_SERVER, &bstr);
152 ok(hr == S_OK, "got %#lx\n", hr);
153 ok(!wcscmp(bstr, L"sample:123"), "got %s\n", wine_dbgstr_w(bstr));
154 SysFreeString(bstr);
155
156 hr = IADsPathname_Retrieve(path, ADS_FORMAT_LEAF, &bstr);
157 ok(hr == S_OK, "got %#lx\n", hr);
158 ok(!wcscmp(bstr, L"a=b"), "got %s\n", wine_dbgstr_w(bstr));
159 SysFreeString(bstr);
160
161 IADsPathname_Release(path);
162}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
OLECHAR * BSTR
Definition: compat.h:2293
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static size_t elem
Definition: string.c:71
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_INVALID_INDEX
Definition: winerror.h:1239

Referenced by START_TEST().