17{
18
20 char host_name[255];
22 char host_nameUTF8[255];
23 char test_nameUTF8[255];
25 WCHAR host_nameW[255];
26 WCHAR test_nameW[255];
28 ULONG network_info_blen = 0;
29 DWORD network_info_result;
30
33 if (
NULL == network_info)
34 {
35 skip(
"Not enough memory. Can't continue!\n");
36 return;
37 }
38
41 {
43 skip(
"Can't get network info. Some results may be wrong.\n");
44 return;
45 }
46 else
47 {
50 {
53 }
55 mbstowcs(host_nameW, host_name, 255);
56 wcstombs(host_nameUTF8, host_nameW, 255);
57 }
58
59
60
65
66
67 if (dp)
68 {
71 }
72
73
76 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
78 {
79 ok(
strcmp(dp->
pName, host_name) == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName, host_name);
82 }
85
86
89 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
91 {
92 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
96 }
99
100
103 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
105 {
106
111 }
114
117 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
119 {
120
125 }
128
131 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
133 {
134 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
138 }
141
144 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
146 {
147
151 }
154
157
160 {
161 ok(
strcmp(dp->
pName, host_name) == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName, host_name);
164 }
167
170 ok(dns_status ==
NO_ERROR,
"DnsQuery_A failed with error %lu\n", dns_status);
172 {
173 ok(
strcmp(dp->
pName,
"0.0.0.0") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"0.0.0.0");
177 }
180
183
186 {
187 ok(
strcmp(dp->
pName,
"0.0.0.0") == 0 ||
broken(
strcmp(dp->
pName,
"0.0.0.0 ") == 0),
"DnsQuery_A returned wrong answer '%s' expected '%s' or '%s'\n", dp->
pName,
"0.0.0.0",
"0.0.0.0 ");
191 }
194
197
200 {
201 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0 ||
strcmp(dp->
pName,
"127.0.0.1 ") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s' or '%s'\n", dp->
pName,
"127.0.0.1",
"127.0.0.1 ");
205 }
208
213 {
214 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
218 }
221
226 {
227 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
231 }
234
239 {
240 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
244 }
247
252 {
253 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
257 }
260
266 {
267 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_A returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
271 }
274
275
276
281
282
283 if (dp)
284 {
287 }
288
289
292 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
294 {
295 ok(
strcmp(dp->
pName, host_name) == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName, host_name);
298 }
301
302
304 wcscpy(test_nameW,
L"127.0.0.1");
305 wcstombs(test_nameUTF8, test_nameW, 255);
307 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
309 {
310 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
314 }
317
318
320 wcscpy(test_nameW,
L"LocalHost");
321 wcstombs(test_nameUTF8, test_nameW, 255);
323 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
325 {
326
327 ok(
strcmp(dp->
pName,
"localhost") == 0 ||
broken(
strcmp(dp->
pName,
"LocalHost") == 0),
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
331 }
334
336 wcscpy(test_nameW,
L"Localhost");
337 wcstombs(test_nameUTF8, test_nameW, 255);
339 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
341 {
342
343 ok(
strcmp(dp->
pName,
"localhost") == 0 ||
broken(
strcmp(dp->
pName,
"Localhost") == 0),
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
347 }
350
352 wcscpy(test_nameW,
L"localhost");
353 wcstombs(test_nameUTF8, test_nameW, 255);
355 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
357 {
358 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
362 }
365
368 wcstombs(test_nameUTF8, test_nameW, 255);
370 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
372 {
373
377 }
380
383 wcstombs(test_nameUTF8, test_nameW, 255);
385
388 {
389 ok(
strcmp(dp->
pName, host_name) == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName, host_name);
392 }
395
397 wcscpy(test_nameW,
L"0.0.0.0");
398 wcstombs(test_nameUTF8, test_nameW, 255);
400 ok(dns_status ==
NO_ERROR,
"DnsQuery_UTF8 failed with error %lu\n", dns_status);
402 {
403 ok(
strcmp(dp->
pName,
"0.0.0.0") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"0.0.0.0");
407 }
410
412 wcscpy(test_nameW,
L"0.0.0.0 ");
413 wcstombs(test_nameUTF8, test_nameW, 255);
415
418 {
419 ok(
strcmp(dp->
pName,
"0.0.0.0") == 0 ||
broken(
strcmp(dp->
pName,
"0.0.0.0 ") == 0),
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s' or '%s'\n", dp->
pName,
"0.0.0.0",
"0.0.0.0 ");
423 }
426
428 wcscpy(test_nameW,
L"127.0.0.1 ");
429 wcstombs(test_nameUTF8, test_nameW, 255);
431
434 {
435 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0 ||
strcmp(dp->
pName,
"127.0.0.1 ") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s' or '%s'\n", dp->
pName,
"127.0.0.1",
"127.0.0.1 ");
439 }
442
444 wcscpy(test_nameW,
L" 127.0.0.1 ");
445 wcstombs(test_nameUTF8, test_nameW, 255);
449 {
450 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
454 }
457
459 wcscpy(test_nameW,
L" 127.0. 0.1 ");
460 wcstombs(test_nameUTF8, test_nameW, 255);
464 {
465 ok(
strcmp(dp->
pName,
"127.0.0.1") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"127.0.0.1");
469 }
472
474 wcscpy(test_nameW,
L"localhost ");
475 wcstombs(test_nameUTF8, test_nameW, 255);
479 {
480 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
484 }
487
489 wcscpy(test_nameW,
L" localhost");
490 wcstombs(test_nameUTF8, test_nameW, 255);
494 {
495 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
499 }
502
504 wcscpy(test_nameW,
L" local host ");
505 wcstombs(test_nameUTF8, test_nameW, 255);
509 {
510 ok(
strcmp(dp->
pName,
"localhost") == 0,
"DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->
pName,
"localhost");
514 }
517
518
519
523 {
524
525 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
527 }
528 else
529 {
530
533 }
535
536
537 if (dp)
538 {
541 }
542
543
545 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
547 {
551 }
554
555
557 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
559 {
564 }
567
568
570 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
572 {
577 }
580
582 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
584 {
589 }
592
594 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
596 {
601 }
604
606 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
608 {
609
613 }
616
621 {
626 }
629
631 ok(dns_status ==
NO_ERROR,
"DnsQuery_W failed with error %lu\n", dns_status);
633 {
638 }
641
646 {
651 }
654
659 {
664 }
667
672 {
677 }
680
685 {
690 }
693
698 {
703 }
706
711 {
716 }
719
721 wcscpy(test_nameW,
L" local host ");
725 {
730 }
733}
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
#define ERROR_INVALID_NAME
DNS_STATUS WINAPI DnsQuery_A(LPCSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
DNS_STATUS WINAPI DnsQuery_W(LPCWSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
DNS_STATUS WINAPI DnsQuery_UTF8(LPCSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
VOID WINAPI DnsRecordListFree(PDNS_RECORD list, DNS_FREE_TYPE type)
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
static const char * test_name
FIXED_INFO_W2KSP1 * PFIXED_INFO
#define DNS_QUERY_STANDARD
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
char DomainName[MAX_DOMAIN_NAME_LEN+4]
char HostName[MAX_HOSTNAME_LEN+4]
union _DnsRecordA::@3510 Data
#define DNS_ERROR_RCODE_NAME_ERROR
#define DNS_ERROR_INVALID_NAME_CHAR