2 * Copyright 2007 Hans Leidekker
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <wine/test.h>
26 static HMODULE hSnmpapi
= 0;
27 static INT (WINAPI
*pSnmpUtilAsnAnyCpy
)(AsnAny
*, AsnAny
*);
28 static VOID (WINAPI
*pSnmpUtilAsnAnyFree
)(AsnAny
*);
29 static INT (WINAPI
*pSnmpUtilOctetsCmp
)(AsnOctetString
*, AsnOctetString
*);
30 static INT (WINAPI
*pSnmpUtilOctetsCpy
)(AsnOctetString
*, AsnOctetString
*);
31 static VOID (WINAPI
*pSnmpUtilOctetsFree
)(AsnOctetString
*);
32 static INT (WINAPI
*pSnmpUtilOctetsNCmp
)(AsnOctetString
*, AsnOctetString
*, UINT
);
34 static void InitFunctionPtrs(void)
36 hSnmpapi
= GetModuleHandle("snmpapi.dll");
38 pSnmpUtilAsnAnyCpy
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilAsnAnyCpy");
39 pSnmpUtilAsnAnyFree
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilAsnAnyFree");
40 pSnmpUtilOctetsCmp
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilOctetsCmp");
41 pSnmpUtilOctetsCpy
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilOctetsCpy");
42 pSnmpUtilOctetsFree
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilOctetsFree");
43 pSnmpUtilOctetsNCmp
= (void*)GetProcAddress(hSnmpapi
, "SnmpUtilOctetsNCmp");
46 static void test_SnmpUtilOidToA(void)
49 static UINT ids1
[] = { 1,3,6,1,4,1,311 };
50 static UINT ids2
[] = {
51 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
52 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
53 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
54 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
55 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
56 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
57 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
58 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
59 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
60 static UINT ids3
[] = { 0xffffffff };
61 static AsnObjectIdentifier oid0
= { 0, ids1
};
62 static AsnObjectIdentifier oid1
= { 7, ids1
};
63 static AsnObjectIdentifier oid2
= { 256, ids2
};
64 static AsnObjectIdentifier oid3
= { 257, ids2
};
65 static AsnObjectIdentifier oid4
= { 258, ids2
};
66 static AsnObjectIdentifier oid5
= { 1, ids3
};
67 static const char expect0
[] = "<null oid>";
68 static const char expect1
[] = "1.3.6.1.4.1.311";
69 static const char expect2
[] =
70 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
71 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
72 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
73 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
74 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
75 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
76 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
77 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1";
78 static const char expect3
[] =
79 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
80 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
81 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
82 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
83 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
84 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
85 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1."
86 "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1";
87 static const char expect4
[] = "-1";
89 ret
= SnmpUtilOidToA(NULL
);
90 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
91 ok(!strcmp(ret
, expect0
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
94 ret
= SnmpUtilOidToA(&oid0
);
95 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
96 ok(!strcmp(ret
, expect0
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
99 ret
= SnmpUtilOidToA(&oid1
);
100 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
101 ok(!strcmp(ret
, expect1
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
104 ret
= SnmpUtilOidToA(&oid2
);
105 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
106 ok(!strcmp(ret
, expect2
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
109 ret
= SnmpUtilOidToA(&oid3
);
110 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
111 ok(!strcmp(ret
, expect3
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
114 ret
= SnmpUtilOidToA(&oid4
);
115 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
116 ok(!strcmp(ret
, expect3
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
119 ret
= SnmpUtilOidToA(&oid5
);
120 ok(ret
!= NULL
, "SnmpUtilOidToA failed\n");
121 ok(!strcmp(ret
, expect4
), "SnmpUtilOidToA failed got \n%s\n expected \n%s\n",
125 static void test_SnmpUtilAsnAnyCpyFree(void)
128 static AsnAny dst
, src
= { ASN_INTEGER
, { 1 } };
130 if (0) { /* these crash on XP */
131 ret
= pSnmpUtilAsnAnyCpy(NULL
, NULL
);
132 ok(!ret
, "SnmpUtilAsnAnyCpy succeeded\n");
134 ret
= pSnmpUtilAsnAnyCpy(&dst
, NULL
);
135 ok(!ret
, "SnmpUtilAsnAnyCpy succeeded\n");
137 ret
= pSnmpUtilAsnAnyCpy(NULL
, &src
);
138 ok(!ret
, "SnmpUtilAsnAnyCpy succeeded\n");
141 ret
= pSnmpUtilAsnAnyCpy(&dst
, &src
);
142 ok(ret
, "SnmpUtilAsnAnyCpy failed\n");
143 ok(!memcmp(&src
, &dst
, sizeof(AsnAny
)), "SnmpUtilAsnAnyCpy failed\n");
145 if (0) { /* crashes on XP */
146 pSnmpUtilAsnAnyFree(NULL
);
148 pSnmpUtilAsnAnyFree(&dst
);
149 ok(dst
.asnType
== ASN_NULL
, "SnmpUtilAsnAnyFree failed\n");
150 ok(dst
.asnValue
.number
== 1, "SnmpUtilAsnAnyFree failed\n");
153 static void test_SnmpUtilOctetsCpyFree(void)
156 static BYTE stream
[] = { '1', '2', '3', '4' };
157 static AsnOctetString dst
, src
= { stream
, 4, TRUE
};
159 ret
= pSnmpUtilOctetsCpy(NULL
, NULL
);
160 ok(!ret
, "SnmpUtilOctetsCpy succeeded\n");
162 memset(&dst
, 1, sizeof(AsnOctetString
));
163 ret
= pSnmpUtilOctetsCpy(&dst
, NULL
);
164 ok(ret
, "SnmpUtilOctetsCpy failed\n");
165 ok(dst
.length
== 0, "SnmpUtilOctetsCpy failed\n");
166 ok(dst
.stream
== NULL
, "SnmpUtilOctetsCpy failed\n");
167 ok(dst
.dynamic
== FALSE
, "SnmpUtilOctetsCpy failed\n");
169 ret
= pSnmpUtilOctetsCpy(NULL
, &src
);
170 ok(!ret
, "SnmpUtilOctetsCpy succeeded\n");
172 memset(&dst
, 0, sizeof(AsnOctetString
));
173 ret
= pSnmpUtilOctetsCpy(&dst
, &src
);
174 ok(ret
, "SnmpUtilOctetsCpy failed\n");
175 ok(src
.length
== dst
.length
, "SnmpUtilOctetsCpy failed\n");
176 ok(!memcmp(src
.stream
, dst
.stream
, dst
.length
), "SnmpUtilOctetsCpy failed\n");
177 ok(dst
.dynamic
== TRUE
, "SnmpUtilOctetsCpy failed\n");
179 pSnmpUtilOctetsFree(NULL
);
180 pSnmpUtilOctetsFree(&dst
);
181 ok(dst
.stream
== NULL
, "SnmpUtilOctetsFree failed\n");
182 ok(dst
.length
== 0, "SnmpUtilOctetsFree failed\n");
183 ok(dst
.dynamic
== FALSE
, "SnmpUtilOctetsFree failed\n");
186 static void test_SnmpUtilOidCpyFree(void)
189 static UINT ids
[] = { 1, 3, 6, 1, 4, 1, 311 };
190 static AsnObjectIdentifier dst
, src
= { sizeof(ids
) / sizeof(ids
[0]), ids
};
192 ret
= SnmpUtilOidCpy(NULL
, NULL
);
193 ok(!ret
, "SnmpUtilOidCpy succeeded\n");
195 memset(&dst
, 1, sizeof(AsnObjectIdentifier
));
196 ret
= SnmpUtilOidCpy(&dst
, NULL
);
197 ok(ret
, "SnmpUtilOidCpy failed\n");
198 ok(dst
.idLength
== 0, "SnmpUtilOidCpy failed\n");
199 ok(dst
.ids
== NULL
, "SnmpUtilOidCpy failed\n");
201 ret
= SnmpUtilOidCpy(NULL
, &src
);
202 ok(!ret
, "SnmpUtilOidCpy succeeded\n");
204 memset(&dst
, 0, sizeof(AsnObjectIdentifier
));
205 ret
= SnmpUtilOidCpy(&dst
, &src
);
206 ok(ret
, "SnmpUtilOidCpy failed\n");
207 ok(src
.idLength
== dst
.idLength
, "SnmpUtilOidCpy failed\n");
208 ok(!memcmp(src
.ids
, dst
.ids
, dst
.idLength
* sizeof(UINT
)), "SnmpUtilOidCpy failed\n");
210 SnmpUtilOidFree(NULL
);
211 SnmpUtilOidFree(&dst
);
212 ok(dst
.idLength
== 0, "SnmpUtilOidFree failed\n");
213 ok(dst
.ids
== NULL
, "SnmpUtilOidFree failed\n");
216 static void test_SnmpUtilOctetsNCmp(void)
219 static BYTE stream1
[] = { '1', '2', '3', '4' };
220 static BYTE stream2
[] = { '5', '6', '7', '8' };
221 static AsnOctetString octets1
= { stream1
, 4, FALSE
};
222 static AsnOctetString octets2
= { stream2
, 4, FALSE
};
224 ret
= pSnmpUtilOctetsNCmp(NULL
, NULL
, 0);
225 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
227 ret
= pSnmpUtilOctetsNCmp(NULL
, NULL
, 1);
228 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
230 ret
= pSnmpUtilOctetsNCmp(&octets1
, NULL
, 0);
231 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
233 ret
= pSnmpUtilOctetsNCmp(&octets1
, NULL
, 1);
234 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
236 ret
= pSnmpUtilOctetsNCmp(NULL
, &octets2
, 0);
237 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
239 ret
= pSnmpUtilOctetsNCmp(NULL
, &octets2
, 1);
240 ok(!ret
, "SnmpUtilOctetsNCmp succeeded\n");
242 ret
= pSnmpUtilOctetsNCmp(&octets1
, &octets1
, 0);
243 ok(!ret
, "SnmpUtilOctetsNCmp failed\n");
245 ret
= pSnmpUtilOctetsNCmp(&octets1
, &octets1
, 4);
246 ok(!ret
, "SnmpUtilOctetsNCmp failed\n");
248 ret
= pSnmpUtilOctetsNCmp(&octets1
, &octets2
, 4);
249 ok(ret
== -4, "SnmpUtilOctetsNCmp failed\n");
251 ret
= pSnmpUtilOctetsNCmp(&octets2
, &octets1
, 4);
252 ok(ret
== 4, "SnmpUtilOctetsNCmp failed\n");
255 static void test_SnmpUtilOctetsCmp(void)
258 static BYTE stream1
[] = { '1', '2', '3' };
259 static BYTE stream2
[] = { '1', '2', '3', '4' };
260 static AsnOctetString octets1
= { stream1
, 3, FALSE
};
261 static AsnOctetString octets2
= { stream2
, 4, FALSE
};
263 if (0) { /* these crash on XP */
264 ret
= pSnmpUtilOctetsCmp(NULL
, NULL
);
265 ok(!ret
, "SnmpUtilOctetsCmp succeeded\n");
267 ret
= pSnmpUtilOctetsCmp(&octets1
, NULL
);
268 ok(!ret
, "SnmpUtilOctetsCmp succeeded\n");
270 ret
= pSnmpUtilOctetsCmp(NULL
, &octets2
);
271 ok(!ret
, "SnmpUtilOctetsCmp succeeded\n");
274 ret
= pSnmpUtilOctetsCmp(&octets2
, &octets1
);
275 ok(ret
== 1, "SnmpUtilOctetsCmp failed\n");
277 ret
= pSnmpUtilOctetsCmp(&octets1
, &octets2
);
278 ok(ret
== -1, "SnmpUtilOctetsCmp failed\n");
281 static void test_SnmpUtilOidNCmp(void)
284 static UINT ids1
[] = { 1, 2, 3, 4 };
285 static UINT ids2
[] = { 5, 6, 7, 8 };
286 static AsnObjectIdentifier oid1
= { 4, ids1
};
287 static AsnObjectIdentifier oid2
= { 4, ids2
};
289 ret
= SnmpUtilOidNCmp(NULL
, NULL
, 0);
290 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
292 ret
= SnmpUtilOidNCmp(NULL
, NULL
, 1);
293 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
295 ret
= SnmpUtilOidNCmp(&oid1
, NULL
, 0);
296 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
298 ret
= SnmpUtilOidNCmp(&oid1
, NULL
, 1);
299 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
301 ret
= SnmpUtilOidNCmp(NULL
, &oid2
, 0);
302 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
304 ret
= SnmpUtilOidNCmp(NULL
, &oid2
, 1);
305 ok(!ret
, "SnmpUtilOidNCmp succeeded\n");
307 ret
= SnmpUtilOidNCmp(&oid1
, &oid1
, 0);
308 ok(!ret
, "SnmpUtilOidNCmp failed\n");
310 ret
= SnmpUtilOidNCmp(&oid1
, &oid1
, 4);
311 ok(!ret
, "SnmpUtilOidNCmp failed\n");
313 ret
= SnmpUtilOidNCmp(&oid1
, &oid2
, 4);
314 ok(ret
== -1, "SnmpUtilOidNCmp failed: %d\n", ret
);
316 ret
= SnmpUtilOidNCmp(&oid2
, &oid1
, 4);
317 ok(ret
== 1, "SnmpUtilOidNCmp failed: %d\n", ret
);
320 static void test_SnmpUtilOidCmp(void)
323 static UINT ids1
[] = { 1, 2, 3 };
324 static UINT ids2
[] = { 1, 2, 3, 4 };
325 static AsnObjectIdentifier oid1
= { 3, ids1
};
326 static AsnObjectIdentifier oid2
= { 4, ids2
};
328 if (0) { /* these crash on XP */
329 ret
= SnmpUtilOidCmp(NULL
, NULL
);
330 ok(!ret
, "SnmpUtilOidCmp succeeded\n");
332 ret
= SnmpUtilOidCmp(&oid1
, NULL
);
333 ok(!ret
, "SnmpUtilOidCmp succeeded\n");
335 ret
= SnmpUtilOidCmp(NULL
, &oid2
);
336 ok(!ret
, "SnmpUtilOidCmp succeeded\n");
339 ret
= SnmpUtilOidCmp(&oid2
, &oid1
);
340 ok(ret
== 1, "SnmpUtilOidCmp failed\n");
342 ret
= SnmpUtilOidCmp(&oid1
, &oid2
);
343 ok(ret
== -1, "SnmpUtilOidCmp failed\n");
346 static void test_SnmpUtilOidAppend(void)
349 static UINT ids1
[] = { 1, 2, 3 };
350 static UINT ids2
[] = { 4, 5, 6 };
351 static AsnObjectIdentifier oid1
= { 3, ids1
};
352 static AsnObjectIdentifier oid2
= { 3, ids2
};
354 ret
= SnmpUtilOidAppend(NULL
, NULL
);
355 ok(!ret
, "SnmpUtilOidAppend succeeded\n");
357 ret
= SnmpUtilOidAppend(&oid1
, NULL
);
358 ok(ret
, "SnmpUtilOidAppend failed\n");
360 ret
= SnmpUtilOidAppend(NULL
, &oid2
);
361 ok(!ret
, "SnmpUtilOidAppend succeeded\n");
363 ret
= SnmpUtilOidAppend(&oid1
, &oid2
);
364 ok(ret
, "SnmpUtilOidAppend failed\n");
365 ok(oid1
.idLength
== 6, "SnmpUtilOidAppend failed\n");
366 ok(!memcmp(&oid1
.ids
[3], ids2
, 3 * sizeof(UINT
)),
367 "SnmpUtilOidAppend failed\n");
370 static void test_SnmpUtilVarBindCpyFree(void)
373 static UINT ids
[] = { 1, 3, 6, 1, 4, 1, 311 };
374 static SnmpVarBind dst
, src
= { { 7, ids
}, { ASN_INTEGER
, { 1 } } };
376 ret
= SnmpUtilVarBindCpy(NULL
, NULL
);
377 ok(!ret
, "SnmpUtilVarBindCpy succeeded\n");
379 memset(&dst
, 0, sizeof(SnmpVarBind
));
380 ret
= SnmpUtilVarBindCpy(&dst
, NULL
);
381 ok(ret
, "SnmpUtilVarBindCpy failed\n");
382 ok(dst
.name
.idLength
== 0, "SnmpUtilVarBindCpy failed\n");
383 ok(dst
.name
.ids
== NULL
, "SnmpUtilVarBindCpy failed\n");
384 ok(dst
.value
.asnType
== ASN_NULL
, "SnmpUtilVarBindCpy failed\n");
385 ok(dst
.value
.asnValue
.number
== 0, "SnmpUtilVarBindCpy failed\n");
387 ret
= SnmpUtilVarBindCpy(NULL
, &src
);
388 ok(!ret
, "SnmpUtilVarBindCpy succeeded\n");
390 memset(&dst
, 0, sizeof(SnmpVarBind
));
391 ret
= SnmpUtilVarBindCpy(&dst
, &src
);
392 ok(ret
, "SnmpUtilVarBindCpy failed\n");
393 ok(src
.name
.idLength
== dst
.name
.idLength
, "SnmpUtilVarBindCpy failed\n");
394 ok(!memcmp(src
.name
.ids
, dst
.name
.ids
, dst
.name
.idLength
* sizeof(UINT
)),
395 "SnmpUtilVarBindCpy failed\n");
396 ok(!memcmp(&src
.value
, &dst
.value
, sizeof(AsnObjectSyntax
)),
397 "SnmpUtilVarBindCpy failed\n");
399 SnmpUtilVarBindFree(NULL
);
400 SnmpUtilVarBindFree(&dst
);
401 ok(dst
.name
.idLength
== 0, "SnmpUtilVarBindFree failed\n");
402 ok(dst
.name
.ids
== NULL
, "SnmpUtilVarBindFree failed\n");
403 ok(dst
.value
.asnType
== ASN_NULL
, "SnmpUtilVarBindFree failed\n");
404 ok(dst
.value
.asnValue
.number
== 1, "SnmpUtilVarBindFree failed\n");
407 static void test_SnmpUtilVarBindListCpyFree(void)
410 static UINT ids
[] = { 1, 3, 6, 1, 4, 1, 311 };
411 static SnmpVarBind src
= { { 7, ids
}, { ASN_INTEGER
, { 1 } } };
412 static SnmpVarBindList dst_list
, src_list
= { &src
, 1 };
414 if (0) { /* these crash on XP */
415 ret
= SnmpUtilVarBindListCpy(NULL
, NULL
);
416 ok(!ret
, "SnmpUtilVarBindCpy succeeded\n");
418 ret
= SnmpUtilVarBindListCpy(NULL
, &src_list
);
419 ok(!ret
, "SnmpUtilVarBindListCpy succeeded\n");
422 memset(&dst_list
, 0xff, sizeof(SnmpVarBindList
));
423 ret
= SnmpUtilVarBindListCpy(&dst_list
, NULL
);
424 ok(ret
, "SnmpUtilVarBindListCpy failed\n");
425 ok(dst_list
.list
== NULL
, "SnmpUtilVarBindListCpy failed\n");
426 ok(dst_list
.len
== 0, "SnmpUtilVarBindListCpy failed\n");
428 ret
= SnmpUtilVarBindListCpy(&dst_list
, &src_list
);
429 ok(ret
, "SnmpUtilVarBindListCpy failed\n");
430 ok(src_list
.len
== dst_list
.len
, "SnmpUtilVarBindListCpy failed\n");
431 ok(src_list
.list
->name
.idLength
== dst_list
.list
->name
.idLength
,
432 "SnmpUtilVarBindListCpy failed\n");
433 ok(!memcmp(src_list
.list
->name
.ids
, dst_list
.list
->name
.ids
,
434 dst_list
.list
->name
.idLength
* sizeof(UINT
)),
435 "SnmpUtilVarBindListCpy failed\n");
436 ok(!memcmp(&src_list
.list
->value
, &dst_list
.list
->value
, sizeof(AsnAny
)),
437 "SnmpUtilVarBindListCpy failed\n");
439 if (0) { /* crashes on XP */
440 SnmpUtilVarBindListFree(NULL
);
442 SnmpUtilVarBindListFree(&dst_list
);
443 ok(dst_list
.list
== NULL
, "SnmpUtilVarBindListFree failed\n");
444 ok(dst_list
.len
== 0, "SnmpUtilVarBindListFree failed\n");
451 test_SnmpUtilOidToA();
453 if (!pSnmpUtilAsnAnyCpy
|| !pSnmpUtilAsnAnyFree
)
454 skip("SnmpUtilAsnAnyCpy and/or SnmpUtilAsnAnyFree not available\n");
456 test_SnmpUtilAsnAnyCpyFree();
458 if (!pSnmpUtilOctetsCpy
|| !pSnmpUtilOctetsFree
)
459 skip("SnmpUtilOctetsCpy and/or SnmpUtilOctetsFree not available\n");
461 test_SnmpUtilOctetsCpyFree();
463 test_SnmpUtilOidCpyFree();
465 if (!pSnmpUtilOctetsNCmp
)
466 skip("SnmpUtilOctetsNCmp not available\n");
468 test_SnmpUtilOctetsNCmp();
470 if (!pSnmpUtilOctetsCmp
)
471 skip("SnmpUtilOctetsCmp not available\n");
473 test_SnmpUtilOctetsCmp();
475 test_SnmpUtilOidCmp();
476 test_SnmpUtilOidNCmp();
477 test_SnmpUtilOidAppend();
478 test_SnmpUtilVarBindCpyFree();
479 test_SnmpUtilVarBindListCpyFree();