ReactOS 0.4.15-dev-7931-gfd331f1
query.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/dnsapi/dnsapi/query.c
5 * PURPOSE: DNSAPI functions built on the ADNS library.
6 * PROGRAMER: Art Yerkes
7 * UPDATE HISTORY:
8 * 12/15/03 -- Created
9 */
10
11#include "precomp.h"
12#include <winreg.h>
13#include <iphlpapi.h>
14#include <strsafe.h>
15
16#define NDEBUG
17#include <debug.h>
18
19static
20BOOL
22 _In_ PCWSTR AddressString,
23 _Out_ PIN_ADDR pAddress)
24{
25 PCWSTR pTerminator = NULL;
27
28 Status = RtlIpv4StringToAddressW(AddressString,
29 TRUE,
30 &pTerminator,
31 pAddress);
32 if (NT_SUCCESS(Status) && pTerminator != NULL && *pTerminator == L'\0')
33 return TRUE;
34
35 return FALSE;
36}
37
38
39static
40BOOL
42 _In_ PCWSTR AddressString,
43 _Out_ PIN6_ADDR pAddress)
44{
45 PCWSTR pTerminator = NULL;
47
48 Status = RtlIpv6StringToAddressW(AddressString,
49 &pTerminator,
50 pAddress);
51 if (NT_SUCCESS(Status) && pTerminator != NULL && *pTerminator == L'\0')
52 return TRUE;
53
54 return FALSE;
55}
56
57
58static
63{
64 IN_ADDR Ip4Address;
65 IN6_ADDR Ip6Address;
66 PDNS_RECORDW pRecord = NULL;
67
68 if (Type == DNS_TYPE_A)
69 {
70 if (ParseIpv4Address(Name, &Ip4Address))
71 {
72 pRecord = RtlAllocateHeap(RtlGetProcessHeap(),
74 sizeof(DNS_RECORDW));
75 if (pRecord == NULL)
76 return NULL;
77
78 pRecord->pName = RtlAllocateHeap(RtlGetProcessHeap(),
79 0,
80 (wcslen(Name) + 1) * sizeof(WCHAR));
81 if (pRecord == NULL)
82 {
83 RtlFreeHeap(RtlGetProcessHeap(), 0, pRecord);
84 return NULL;
85 }
86
87 wcscpy(pRecord->pName, Name);
88 pRecord->wType = DNS_TYPE_A;
89 pRecord->wDataLength = sizeof(DNS_A_DATA);
92 pRecord->dwTtl = 7 * 24 * 60 * 60;
93
94 pRecord->Data.A.IpAddress = Ip4Address.S_un.S_addr;
95
96 return pRecord;
97 }
98 }
99 else if (Type == DNS_TYPE_AAAA)
100 {
101 if (ParseIpv6Address(Name, &Ip6Address))
102 {
103 pRecord = RtlAllocateHeap(RtlGetProcessHeap(),
105 sizeof(DNS_RECORDW));
106 if (pRecord == NULL)
107 return NULL;
108
109 pRecord->pName = RtlAllocateHeap(RtlGetProcessHeap(),
110 0,
111 (wcslen(Name) + 1) * sizeof(WCHAR));
112 if (pRecord == NULL)
113 {
114 RtlFreeHeap(RtlGetProcessHeap(), 0, pRecord);
115 return NULL;
116 }
117
118 wcscpy(pRecord->pName, Name);
119 pRecord->wType = DNS_TYPE_AAAA;
120 pRecord->wDataLength = sizeof(DNS_AAAA_DATA);
122 pRecord->Flags.S.CharSet = DnsCharSetUnicode;
123 pRecord->dwTtl = 7 * 24 * 60 * 60;
124
125 CopyMemory(&pRecord->Data.AAAA.Ip6Address,
126 &Ip6Address.u.Byte,
127 sizeof(IN6_ADDR));
128
129 return pRecord;
130 }
131 }
132
133 return NULL;
134}
135
136
137/* DnsQuery ****************************
138 * Begin a DNS query, and allow the result to be placed in the application
139 * supplied result pointer. The result can be manipulated with the record
140 * functions.
141 *
142 * Name -- The DNS object to be queried.
143 * Type -- The type of records to be returned. These are
144 * listed in windns.h
145 * Options -- Query options. DNS_QUERY_STANDARD is the base
146 * state, and every other option takes precedence.
147 * multiple options can be combined. Listed in
148 * windns.h
149 * Servers -- List of alternate servers (optional)
150 * QueryResultSet -- Pointer to the result pointer that will be filled
151 * when the response is available.
152 * Reserved -- Response as it appears on the wire. Optional.
153 */
154
155static PCHAR
156DnsWToC(const WCHAR *WideString)
157{
159 int AnsiLen = WideCharToMultiByte(CP_ACP,
160 0,
161 WideString,
162 -1,
163 NULL,
164 0,
165 NULL,
166 0);
167 if (AnsiLen == 0)
168 return NULL;
169 AnsiString = RtlAllocateHeap(RtlGetProcessHeap(), 0, AnsiLen);
170 if (AnsiString == NULL)
171 {
172 return NULL;
173 }
175 0,
176 WideString,
177 -1,
179 AnsiLen,
180 NULL,
181 0);
182
183 return AnsiString;
184}
185
186static PWCHAR
187DnsCToW(const CHAR *NarrowString)
188{
189 PWCHAR WideString;
190 int WideLen = MultiByteToWideChar(CP_ACP,
191 0,
192 NarrowString,
193 -1,
194 NULL,
195 0);
196 if (WideLen == 0)
197 return NULL;
198 WideString = RtlAllocateHeap(RtlGetProcessHeap(), 0, WideLen * sizeof(WCHAR));
199 if (WideString == NULL)
200 {
201 return NULL;
202 }
204 0,
205 NarrowString,
206 -1,
207 WideString,
208 WideLen);
209
210 return WideString;
211}
212
213static PCHAR
214DnsWToUTF8(const WCHAR *WideString)
215{
217 int AnsiLen = WideCharToMultiByte(CP_UTF8,
218 0,
219 WideString,
220 -1,
221 NULL,
222 0,
223 NULL,
224 0);
225 if (AnsiLen == 0)
226 return NULL;
227 AnsiString = RtlAllocateHeap(RtlGetProcessHeap(), 0, AnsiLen);
228 if (AnsiString == NULL)
229 {
230 return NULL;
231 }
233 0,
234 WideString,
235 -1,
237 AnsiLen,
238 NULL,
239 0);
240
241 return AnsiString;
242}
243
244static PWCHAR
245DnsUTF8ToW(const CHAR *NarrowString)
246{
247 PWCHAR WideString;
248 int WideLen = MultiByteToWideChar(CP_UTF8,
249 0,
250 NarrowString,
251 -1,
252 NULL,
253 0);
254 if (WideLen == 0)
255 return NULL;
256 WideString = RtlAllocateHeap(RtlGetProcessHeap(), 0, WideLen * sizeof(WCHAR));
257 if (WideString == NULL)
258 {
259 return NULL;
260 }
262 0,
263 NarrowString,
264 -1,
265 WideString,
266 WideLen);
267
268 return WideString;
269}
270
271DNS_STATUS WINAPI
273 LPCSTR Name,
274 WORD Type,
276 PVOID Extra,
277 PDNS_RECORD *QueryResultSet,
279{
280 UINT i;
282 DNS_STATUS Status;
283 PDNS_RECORD QueryResultWide;
284 PDNS_RECORD ConvertedRecord = 0, LastRecord = 0;
285
286 if (Name == NULL)
288 if (QueryResultSet == NULL)
290
291 switch (CodePage)
292 {
293 case CP_ACP:
295 break;
296
297 case CP_UTF8:
299 break;
300
301 default:
303 }
304
305 Status = DnsQuery_W(Buffer, Type, Options, Extra, &QueryResultWide, Reserved);
306
307 while (Status == ERROR_SUCCESS && QueryResultWide)
308 {
309 switch (QueryResultWide->wType)
310 {
311 case DNS_TYPE_A:
312 case DNS_TYPE_WKS:
313 case DNS_TYPE_CNAME:
314 case DNS_TYPE_PTR:
315 case DNS_TYPE_NS:
316 case DNS_TYPE_MB:
317 case DNS_TYPE_MD:
318 case DNS_TYPE_MF:
319 case DNS_TYPE_MG:
320 case DNS_TYPE_MR:
321 ConvertedRecord = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DNS_RECORD));
322 break;
323
324 case DNS_TYPE_MINFO:
325 ConvertedRecord = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DNS_TXT_DATA) + QueryResultWide->Data.TXT.dwStringCount);
326 break;
327
328 case DNS_TYPE_NULL:
329 ConvertedRecord = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DNS_NULL_DATA) + QueryResultWide->Data.Null.dwByteCount);
330 break;
331 }
332 if (ConvertedRecord == NULL)
333 {
334 /* The name */
335 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
336 /* The result*/
337 DnsIntFreeRecordList(QueryResultWide);
338 QueryResultSet = NULL;
339 return ERROR_OUTOFMEMORY;
340 }
341
342 if (CodePage == CP_ACP)
343 {
344 ConvertedRecord->pName = DnsWToC((PWCHAR)QueryResultWide->pName);
345 ConvertedRecord->Flags.S.CharSet = DnsCharSetAnsi;
346 }
347 else
348 {
349 ConvertedRecord->pName = DnsWToUTF8((PWCHAR)QueryResultWide->pName);
350 ConvertedRecord->Flags.S.CharSet = DnsCharSetUtf8;
351 }
352
353 ConvertedRecord->wType = QueryResultWide->wType;
354
355 switch (QueryResultWide->wType)
356 {
357 case DNS_TYPE_A:
358 case DNS_TYPE_WKS:
359 ConvertedRecord->wDataLength = QueryResultWide->wDataLength;
360 memcpy(&ConvertedRecord->Data, &QueryResultWide->Data, QueryResultWide->wDataLength);
361 break;
362
363 case DNS_TYPE_CNAME:
364 case DNS_TYPE_PTR:
365 case DNS_TYPE_NS:
366 case DNS_TYPE_MB:
367 case DNS_TYPE_MD:
368 case DNS_TYPE_MF:
369 case DNS_TYPE_MG:
370 case DNS_TYPE_MR:
371 ConvertedRecord->wDataLength = sizeof(DNS_PTR_DATA);
372 if (CodePage == CP_ACP)
373 ConvertedRecord->Data.PTR.pNameHost = DnsWToC((PWCHAR)QueryResultWide->Data.PTR.pNameHost);
374 else
375 ConvertedRecord->Data.PTR.pNameHost = DnsWToUTF8((PWCHAR)QueryResultWide->Data.PTR.pNameHost);
376 break;
377
378 case DNS_TYPE_MINFO:
379 ConvertedRecord->wDataLength = sizeof(DNS_MINFO_DATA);
380 if (CodePage == CP_ACP)
381 {
382 ConvertedRecord->Data.MINFO.pNameMailbox = DnsWToC((PWCHAR)QueryResultWide->Data.MINFO.pNameMailbox);
383 ConvertedRecord->Data.MINFO.pNameErrorsMailbox = DnsWToC((PWCHAR)QueryResultWide->Data.MINFO.pNameErrorsMailbox);
384 }
385 else
386 {
387 ConvertedRecord->Data.MINFO.pNameMailbox = DnsWToUTF8((PWCHAR)QueryResultWide->Data.MINFO.pNameMailbox);
388 ConvertedRecord->Data.MINFO.pNameErrorsMailbox = DnsWToUTF8((PWCHAR)QueryResultWide->Data.MINFO.pNameErrorsMailbox);
389 }
390 break;
391
392 case DNS_TYPE_MX:
393 ConvertedRecord->wDataLength = sizeof(DNS_MX_DATA);
394 if (CodePage == CP_ACP)
395 ConvertedRecord->Data.MX.pNameExchange = DnsWToC((PWCHAR)QueryResultWide->Data.MX.pNameExchange);
396 else
397 ConvertedRecord->Data.MX.pNameExchange = DnsWToUTF8((PWCHAR)QueryResultWide->Data.MX.pNameExchange);
398 ConvertedRecord->Data.MX.wPreference = QueryResultWide->Data.MX.wPreference;
399 break;
400
401 case DNS_TYPE_HINFO:
402 ConvertedRecord->wDataLength = sizeof(DNS_TXT_DATA) + (sizeof(PCHAR) * QueryResultWide->Data.TXT.dwStringCount);
403 ConvertedRecord->Data.TXT.dwStringCount = QueryResultWide->Data.TXT.dwStringCount;
404
405 if (CodePage == CP_ACP)
406 for (i = 0; i < ConvertedRecord->Data.TXT.dwStringCount; i++)
407 ConvertedRecord->Data.TXT.pStringArray[i] = DnsWToC((PWCHAR)QueryResultWide->Data.TXT.pStringArray[i]);
408 else
409 for (i = 0; i < ConvertedRecord->Data.TXT.dwStringCount; i++)
410 ConvertedRecord->Data.TXT.pStringArray[i] = DnsWToUTF8((PWCHAR)QueryResultWide->Data.TXT.pStringArray[i]);
411
412 break;
413
414 case DNS_TYPE_NULL:
415 ConvertedRecord->wDataLength = sizeof(DNS_NULL_DATA) + QueryResultWide->Data.Null.dwByteCount;
416 ConvertedRecord->Data.Null.dwByteCount = QueryResultWide->Data.Null.dwByteCount;
417 memcpy(&ConvertedRecord->Data.Null.Data, &QueryResultWide->Data.Null.Data, QueryResultWide->Data.Null.dwByteCount);
418 break;
419 }
420
421 if (LastRecord)
422 {
423 LastRecord->pNext = ConvertedRecord;
424 LastRecord = LastRecord->pNext;
425 }
426 else
427 {
428 LastRecord = *QueryResultSet = ConvertedRecord;
429 }
430
431 QueryResultWide = QueryResultWide->pNext;
432 }
433
434 if (LastRecord)
435 LastRecord->pNext = 0;
436
437 /* The name */
438 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
439 /* The result*/
440 if (QueryResultWide) DnsIntFreeRecordList(QueryResultWide);
441
442 return Status;
443}
444
445DNS_STATUS WINAPI
447 WORD Type,
449 PVOID Extra,
450 PDNS_RECORD *QueryResultSet,
452{
453 return DnsQuery_CodePage(CP_ACP, Name, Type, Options, Extra, QueryResultSet, Reserved);
454}
455
456DNS_STATUS WINAPI
458 WORD Type,
460 PVOID Extra,
461 PDNS_RECORD *QueryResultSet,
463{
464 return DnsQuery_CodePage(CP_UTF8, Name, Type, Options, Extra, QueryResultSet, Reserved);
465}
466
467DNS_STATUS
468WINAPI
470 WORD Type,
472 PVOID Extra,
473 PDNS_RECORD *QueryResultSet,
475{
476 DWORD dwRecords = 0;
477 PDNS_RECORDW pRecord = NULL;
478 size_t NameLen, i;
479 DNS_STATUS Status = ERROR_SUCCESS;
480
481 DPRINT("DnsQuery_W()\n");
482
483 if ((Name == NULL) ||
484 (QueryResultSet == NULL))
486
487 *QueryResultSet = NULL;
488
489 /* Create an A or AAAA record for an IP4 or IP6 address */
491 Type);
492 if (pRecord != NULL)
493 {
494 *QueryResultSet = (PDNS_RECORD)pRecord;
495 return ERROR_SUCCESS;
496 }
497
498 /*
499 * Check allowed characters
500 * According to RFC a-z,A-Z,0-9,-,_, but can't start or end with - or _
501 */
502 NameLen = wcslen(Name);
503 if (Name[0] == L'-' || Name[0] == L'_' || Name[NameLen - 1] == L'-' ||
504 Name[NameLen - 1] == L'_' || wcsstr(Name, L"..") != NULL)
505 {
506 return ERROR_INVALID_NAME;
507 }
508
509 i = 0;
510 while (i < NameLen)
511 {
512 if (!((Name[i] >= L'a' && Name[i] <= L'z') ||
513 (Name[i] >= L'A' && Name[i] <= L'Z') ||
514 (Name[i] >= L'0' && Name[i] <= L'9') ||
515 Name[i] == L'-' || Name[i] == L'_' || Name[i] == L'.'))
516 {
518 }
519
520 i++;
521 }
522
524 {
526 Name,
527 Type,
528 Options,
529 &dwRecords,
530 (DNS_RECORDW **)QueryResultSet);
531 DPRINT("R_ResolverQuery() returned %lu\n", Status);
532 }
534 {
536 DPRINT("Exception returned %lu\n", Status);
537 }
539
540 return Status;
541}
542
543WCHAR
545{
546 WCHAR *p;
547 size_t len = 0;
548
549 /* FIXME: how much instead of MAX_PATH? */
551 len+=sizeof(WCHAR);
552
553 p = RtlAllocateHeap(RtlGetProcessHeap(), 0, len);
554
555 if (p)
557
558 return p;
559}
560
561CHAR
563{
564 CHAR *p;
565 size_t len = 0;
566
567 /* FIXME: how much instead of MAX_PATH? */
569 len++;
570
571 p = RtlAllocateHeap(RtlGetProcessHeap(), 0, len);
572
573 if (p)
575
576 return p;
577}
578
579
580/* This function is far from perfect but it works enough */
583{
584 PCHAR TempName;
585 DWORD AdapterAddressesSize, Status;
587 PIP_ADAPTER_ADDRESSES Addresses = NULL, pip;
588 BOOL Found = FALSE;
589
590 if (network_info->DomainName[0])
591 {
592 size_t StringLength;
593 size_t TempSize = 2;
594 StringCchLengthA(network_info->HostName, sizeof(network_info->HostName), &StringLength);
595 TempSize += StringLength;
596 StringCchLengthA(network_info->DomainName, sizeof(network_info->DomainName), &StringLength);
597 TempSize += StringLength;
598 TempName = RtlAllocateHeap(RtlGetProcessHeap(), 0, TempSize);
599 StringCchCopyA(TempName, TempSize, network_info->HostName);
600 StringCchCatA(TempName, TempSize, ".");
601 StringCchCatA(TempName, TempSize, network_info->DomainName);
602 }
603 else
604 {
605 TempName = RtlAllocateHeap(RtlGetProcessHeap(), 0, 1);
606 TempName[0] = 0;
607 }
608 Found = !stricmp(Name, network_info->HostName) || !stricmp(Name, TempName);
609 RtlFreeHeap(RtlGetProcessHeap(), 0, TempName);
610 if (!Found)
611 {
612 return 0;
613 }
614 /* get adapter info */
615 AdapterAddressesSize = 0;
616 GetAdaptersAddresses(AF_INET,
617 GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_DNS_SERVER |
618 GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST,
619 NULL,
620 Addresses,
621 &AdapterAddressesSize);
622 if (!AdapterAddressesSize)
623 {
624 return 0;
625 }
626 Addresses = RtlAllocateHeap(RtlGetProcessHeap(), 0, AdapterAddressesSize);
627 Status = GetAdaptersAddresses(AF_INET,
628 GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_DNS_SERVER |
629 GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST,
630 NULL,
631 Addresses,
632 &AdapterAddressesSize);
633 if (Status)
634 {
635 RtlFreeHeap(RtlGetProcessHeap(), 0, Addresses);
636 return 0;
637 }
638 for (pip = Addresses; pip != NULL; pip = pip->Next) {
639 Address = ((LPSOCKADDR_IN)pip->FirstUnicastAddress->Address.lpSockaddr)->sin_addr.S_un.S_addr;
641 break;
642 }
644 {
645 ret = Address;
646 }
647 RtlFreeHeap(RtlGetProcessHeap(), 0, Addresses);
648 return ret;
649}
650
651
652DNS_STATUS
653WINAPI
655 WORD Type,
657 PDNS_RECORD *QueryResultSet)
658{
659 adns_state astate;
660 int quflags = (Options & DNS_QUERY_NO_RECURSION) == 0 ? adns_qf_search : 0;
661 int adns_error;
662 adns_answer *answer;
663 LPSTR CurrentName;
664 unsigned CNameLoop;
665 PFIXED_INFO network_info;
666 ULONG network_info_blen = 0;
667 DWORD network_info_result;
668 PIP_ADDR_STRING pip;
670 struct in_addr addr;
671 PCHAR HostWithDomainName;
672 PCHAR AnsiName;
673 size_t NameLen = 0;
674
675 if (Name == NULL)
677 if (QueryResultSet == NULL)
679
680 *QueryResultSet = NULL;
681
682 switch (Type)
683 {
684 case DNS_TYPE_A:
685 /* FIXME: how much instead of MAX_PATH? */
686 NameLen = WideCharToMultiByte(CP_ACP,
687 0,
688 Name,
689 -1,
690 NULL,
691 0,
692 NULL,
693 0);
694 AnsiName = RtlAllocateHeap(RtlGetProcessHeap(), 0, NameLen);
695 if (NULL == AnsiName)
696 {
697 return ERROR_OUTOFMEMORY;
698 }
700 0,
701 Name,
702 -1,
703 AnsiName,
704 NameLen,
705 NULL,
706 0);
707 NameLen--;
708
709 network_info_result = GetNetworkParams(NULL, &network_info_blen);
710 network_info = (PFIXED_INFO)RtlAllocateHeap(RtlGetProcessHeap(), 0, (size_t)network_info_blen);
711 if (NULL == network_info)
712 {
713 return ERROR_OUTOFMEMORY;
714 }
715
716 network_info_result = GetNetworkParams(network_info, &network_info_blen);
717 if (network_info_result != ERROR_SUCCESS)
718 {
719 RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
720 return network_info_result;
721 }
722
723 if ((Address = CheckForCurrentHostname(NameLen != 0 ? AnsiName : network_info->HostName, network_info)) != 0)
724 {
725 size_t TempLen = 2, StringLength = 0;
726 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
727 StringCchLengthA(network_info->HostName, sizeof(network_info->HostName), &StringLength);
728 TempLen += StringLength;
729 StringCchLengthA(network_info->DomainName, sizeof(network_info->DomainName), &StringLength);
730 TempLen += StringLength;
731 HostWithDomainName = (PCHAR)RtlAllocateHeap(RtlGetProcessHeap(), 0, TempLen);
732 StringCchCopyA(HostWithDomainName, TempLen, network_info->HostName);
733 if (network_info->DomainName[0])
734 {
735 StringCchCatA(HostWithDomainName, TempLen, ".");
736 StringCchCatA(HostWithDomainName, TempLen, network_info->DomainName);
737 }
738 RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
739 *QueryResultSet = (PDNS_RECORD)RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DNS_RECORD));
740
741 if (NULL == *QueryResultSet)
742 {
743 RtlFreeHeap(RtlGetProcessHeap(), 0, HostWithDomainName);
744 return ERROR_OUTOFMEMORY;
745 }
746
747 (*QueryResultSet)->pNext = NULL;
748 (*QueryResultSet)->wType = Type;
749 (*QueryResultSet)->wDataLength = sizeof(DNS_A_DATA);
750 (*QueryResultSet)->Flags.S.Section = DnsSectionAnswer;
751 (*QueryResultSet)->Flags.S.CharSet = DnsCharSetUnicode;
752 (*QueryResultSet)->Data.A.IpAddress = Address;
753
754 (*QueryResultSet)->pName = (LPSTR)DnsCToW(HostWithDomainName);
755
756 RtlFreeHeap(RtlGetProcessHeap(), 0, HostWithDomainName);
757 return (*QueryResultSet)->pName ? ERROR_SUCCESS : ERROR_OUTOFMEMORY;
758 }
759
760 if ((Options & DNS_QUERY_NO_WIRE_QUERY) != 0)
761 {
762 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
763 RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
765 }
766
768 if (adns_error != adns_s_ok)
769 {
770 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
771 RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
772 return DnsIntTranslateAdnsToDNS_STATUS(adns_error);
773 }
774 for (pip = &(network_info->DnsServerList); pip; pip = pip->Next)
775 {
776 addr.s_addr = inet_addr(pip->IpAddress.String);
777 if ((addr.s_addr != INADDR_ANY) && (addr.s_addr != INADDR_NONE))
778 adns_addserver(astate, addr);
779 }
780 if (network_info->DomainName[0])
781 {
782 adns_ccf_search(astate, "LOCALDOMAIN", -1, network_info->DomainName);
783 }
784 RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
785
786 if (!adns_numservers(astate))
787 {
788 /* There are no servers to query so bail out */
789 adns_finish(astate);
790 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
792 }
793
794 /*
795 * adns doesn't resolve chained CNAME records (a CNAME which points to
796 * another CNAME pointing to another... pointing to an A record), according
797 * to a mailing list thread the authors believe that chained CNAME records
798 * are invalid and the DNS entries should be fixed. That's a nice academic
799 * standpoint, but there certainly are chained CNAME records out there,
800 * even some fairly major ones (at the time of this writing
801 * download.mozilla.org is a chained CNAME). Everyone else seems to resolve
802 * these fine, so we should too. So we loop here to try to resolve CNAME
803 * chains ourselves. Of course, there must be a limit to protect against
804 * CNAME loops.
805 */
806
807#define CNAME_LOOP_MAX 16
808
809 CurrentName = AnsiName;
810
811 for (CNameLoop = 0; CNameLoop < CNAME_LOOP_MAX; CNameLoop++)
812 {
813 adns_error = adns_synchronous(astate, CurrentName, adns_r_addr, quflags, &answer);
814
815 if (adns_error != adns_s_ok)
816 {
817 adns_finish(astate);
818
819 if (CurrentName != AnsiName)
820 RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentName);
821
822 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
823 return DnsIntTranslateAdnsToDNS_STATUS(adns_error);
824 }
825
826 if (answer && answer->rrs.addr)
827 {
828 if (CurrentName != AnsiName)
829 RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentName);
830
831 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
832 *QueryResultSet = (PDNS_RECORD)RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DNS_RECORD));
833
834 if (NULL == *QueryResultSet)
835 {
836 adns_finish(astate);
837 return ERROR_OUTOFMEMORY;
838 }
839
840 (*QueryResultSet)->pNext = NULL;
841 (*QueryResultSet)->wType = Type;
842 (*QueryResultSet)->wDataLength = sizeof(DNS_A_DATA);
843 (*QueryResultSet)->Flags.S.Section = DnsSectionAnswer;
844 (*QueryResultSet)->Flags.S.CharSet = DnsCharSetUnicode;
845 (*QueryResultSet)->Data.A.IpAddress = answer->rrs.addr->addr.inet.sin_addr.s_addr;
846
847 adns_finish(astate);
848
849 (*QueryResultSet)->pName = (LPSTR)xstrsave(Name);
850
851 return (*QueryResultSet)->pName ? ERROR_SUCCESS : ERROR_OUTOFMEMORY;
852 }
853
854 if (NULL == answer || adns_s_prohibitedcname != answer->status || NULL == answer->cname)
855 {
856 adns_finish(astate);
857
858 if (CurrentName != AnsiName)
859 RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentName);
860
861 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
863 }
864
865 if (CurrentName != AnsiName)
866 RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentName);
867
868 CurrentName = (LPSTR)xstrsaveA(answer->cname);
869
870 if (!CurrentName)
871 {
872 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
873 adns_finish(astate);
874 return ERROR_OUTOFMEMORY;
875 }
876 }
877
878 adns_finish(astate);
879 RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
880 RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentName);
882
883 default:
884 return ERROR_OUTOFMEMORY; /* XXX arty: find a better error code. */
885 }
886}
887
888void
890{
891 UINT i;
892 PDNS_RECORD next = 0;
893
894 while(ToDelete)
895 {
896 if(ToDelete->pName)
897 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->pName);
898
899 switch(ToDelete->wType)
900 {
901 case DNS_TYPE_CNAME:
902 case DNS_TYPE_PTR:
903 case DNS_TYPE_NS:
904 case DNS_TYPE_MB:
905 case DNS_TYPE_MD:
906 case DNS_TYPE_MF:
907 case DNS_TYPE_MG:
908 case DNS_TYPE_MR:
909 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.PTR.pNameHost);
910 break;
911
912 case DNS_TYPE_MINFO:
913 case DNS_TYPE_MX:
914 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.MX.pNameExchange);
915 break;
916
917 case DNS_TYPE_HINFO:
918 for(i = 0; i < ToDelete->Data.TXT.dwStringCount; i++)
919 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.TXT.pStringArray[i]);
920
921 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete->Data.TXT.pStringArray);
922 break;
923 }
924
925 next = ToDelete->pNext;
926 RtlFreeHeap(RtlGetProcessHeap(), 0, ToDelete);
927 ToDelete = next;
928 }
929}
930
931BOOL
932WINAPI
934{
935 DNS_STATUS Status = ERROR_SUCCESS;
936
937 DPRINT("DnsFlushResolverCache()\n");
938
940 {
942 DPRINT("R_ResolverFlushCache() returned %lu\n", Status);
943 }
945 {
947 DPRINT("Exception returned %lu\n", Status);
948 }
950
951 return (Status == ERROR_SUCCESS);
952}
953
954
955BOOL
956WINAPI
958 _In_ LPCSTR pszEntry)
959{
960 DNS_STATUS Status = ERROR_SUCCESS;
961 LPWSTR pszUnicodeEntry;
962
963 DPRINT1("DnsFlushResolverCacheEntry_A(%s)\n", pszEntry);
964
965 if (pszEntry == NULL)
966 return FALSE;
967
968 pszUnicodeEntry = DnsCToW(pszEntry);
969 if (pszUnicodeEntry == NULL)
970 return FALSE;
971
973 {
975 DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
976 }
978 {
980 DPRINT("Exception returned %lu\n", Status);
981 }
983
984 RtlFreeHeap(RtlGetProcessHeap(), 0, pszUnicodeEntry);
985
986 return (Status == ERROR_SUCCESS);
987}
988
989
990BOOL
991WINAPI
993 _In_ LPCSTR pszEntry)
994{
995 DNS_STATUS Status = ERROR_SUCCESS;
996 LPWSTR pszUnicodeEntry;
997
998 DPRINT1("DnsFlushResolverCacheEntry_UTF8(%s)\n", pszEntry);
999
1000 if (pszEntry == NULL)
1001 return FALSE;
1002
1003 pszUnicodeEntry = DnsCToW(pszEntry);
1004 if (pszUnicodeEntry == NULL)
1005 return FALSE;
1006
1008 {
1010 DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
1011 }
1013 {
1015 DPRINT("Exception returned %lu\n", Status);
1016 }
1018
1019 RtlFreeHeap(RtlGetProcessHeap(), 0, pszUnicodeEntry);
1020
1021 return (Status == ERROR_SUCCESS);
1022}
1023
1024
1025BOOL
1026WINAPI
1028 _In_ LPCWSTR pszEntry)
1029{
1030 DNS_STATUS Status = ERROR_SUCCESS;
1031
1032 DPRINT1("DnsFlushResolverCacheEntry_W(%S)\n", pszEntry);
1033
1034 if (pszEntry == NULL)
1035 return FALSE;
1036
1038 {
1040 DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
1041 }
1043 {
1045 DPRINT("Exception returned %lu\n", Status);
1046 }
1048
1049 return (Status == ERROR_SUCCESS);
1050}
1051
1052
1053BOOL
1054WINAPI
1057{
1058 DNS_STATUS Status = ERROR_SUCCESS;
1059 PDNS_CACHE_ENTRY CacheEntries = NULL;
1060
1061 if (DnsCache == NULL)
1062 return FALSE;
1063
1065 {
1067 &CacheEntries);
1068 DPRINT("CRrReadCache() returned %lu\n", Status);
1069 }
1071 {
1073 DPRINT1("Exception returned %lu\n", Status);
1074 }
1076
1077 if (Status != ERROR_SUCCESS)
1078 return FALSE;
1079
1080 if (CacheEntries == NULL)
1081 return FALSE;
1082
1083 *DnsCache = CacheEntries;
1084
1085 return TRUE;
1086}
1087
1088DWORD
1089WINAPI
1091{
1092 FILETIME Time;
1094 ULARGE_INTEGER lTime, lAdj;
1095 SYSTEMTIME st = {1970, 1, 0, 1, 0, 0, 0};
1096
1098 memcpy(&lAdj, &Adjustment, sizeof(lAdj));
1100 memcpy(&lTime, &Time, sizeof(lTime));
1101 lTime.QuadPart -= lAdj.QuadPart;
1102 return (DWORD)(lTime.QuadPart/10000000ULL);
1103}
Type
Definition: Type.h:7
DNS_STATUS DnsIntTranslateAdnsToDNS_STATUS(int Status)
Definition: adns.c:17
@ adns_r_addr
Definition: adns.h:143
ADNS_API void adns_addserver(adns_state state, struct in_addr server)
Definition: setup.c:712
ADNS_API void adns_finish(adns_state ads)
Definition: setup.c:650
ADNS_API int adns_synchronous(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, adns_answer **answer_r)
Definition: query.c:314
ADNS_API int adns_numservers(adns_state state)
Definition: setup.c:718
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile)
Definition: setup.c:568
@ adns_if_noerrprint
Definition: adns.h:89
@ adns_if_noenv
Definition: adns.h:88
@ adns_if_noserverwarn
Definition: adns.h:90
@ adns_s_ok
Definition: adns.h:216
@ adns_s_prohibitedcname
Definition: adns.h:245
ADNS_API void adns_ccf_search(adns_state state, const char *fn, int lno, const char *buf)
Definition: setup.c:715
@ adns_qf_search
Definition: adns.h:101
LONG NTSTATUS
Definition: precomp.h:26
#define INADDR_NONE
Definition: tcp.c:42
#define DPRINT1
Definition: precomp.h:8
static RESOLVER_CACHE DnsCache
Definition: cache.c:14
DWORD __stdcall CRrReadCache(_In_ DNSRSLVR_HANDLE pwszServerName, _Out_ DNS_CACHE_ENTRY **ppCacheEntries)
Definition: rpcserver.c:48
DWORD __stdcall R_ResolverQuery(_In_ DNSRSLVR_HANDLE pszServerName, _In_ LPCWSTR pszName, _In_ WORD wType, _In_ DWORD dwFlags, _Inout_ DWORD *dwRecords, _Out_ DNS_RECORDW **ppResultRecords)
Definition: rpcserver.c:93
DWORD __stdcall R_ResolverFlushCache(_In_ DNSRSLVR_HANDLE pszServerName)
Definition: rpcserver.c:62
DWORD __stdcall R_ResolverFlushCacheEntry(_In_ DNSRSLVR_HANDLE pszServerName, _In_ LPCWSTR pszName, _In_ WORD wType)
Definition: rpcserver.c:75
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
return Found
Definition: dirsup.c:1270
Definition: bufpool.h:45
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define stricmp(_String1, _String2)
Definition: compat.h:24
#define MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CNAME_LOOP_MAX
DNS_STATUS WINAPI DnsQuery_CodePage(UINT CodePage, LPCSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
Definition: query.c:272
BOOL WINAPI DnsFlushResolverCache(VOID)
Definition: query.c:933
DNS_STATUS WINAPI DnsQuery_A(LPCSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
Definition: query.c:446
void DnsIntFreeRecordList(PDNS_RECORD ToDelete)
Definition: query.c:889
static BOOL ParseIpv4Address(_In_ PCWSTR AddressString, _Out_ PIN_ADDR pAddress)
Definition: query.c:21
BOOL WINAPI DnsFlushResolverCacheEntry_A(_In_ LPCSTR pszEntry)
Definition: query.c:957
BOOL WINAPI DnsFlushResolverCacheEntry_W(_In_ LPCWSTR pszEntry)
Definition: query.c:1027
DNS_STATUS WINAPI DnsQuery_W(LPCWSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
Definition: query.c:469
DNS_STATUS WINAPI DnsQuery_UTF8(LPCSTR Name, WORD Type, DWORD Options, PVOID Extra, PDNS_RECORD *QueryResultSet, PVOID *Reserved)
Definition: query.c:457
static PWCHAR DnsUTF8ToW(const CHAR *NarrowString)
Definition: query.c:245
BOOL WINAPI DnsGetCacheDataTable(_Out_ PDNS_CACHE_ENTRY *DnsCache)
Definition: query.c:1055
BOOL WINAPI DnsFlushResolverCacheEntry_UTF8(_In_ LPCSTR pszEntry)
Definition: query.c:992
static PWCHAR DnsCToW(const CHAR *NarrowString)
Definition: query.c:187
DWORD WINAPI GetCurrentTimeInSeconds(VOID)
Definition: query.c:1090
IP4_ADDRESS CheckForCurrentHostname(CONST CHAR *Name, PFIXED_INFO network_info)
Definition: query.c:582
static PCHAR DnsWToUTF8(const WCHAR *WideString)
Definition: query.c:214
static PDNS_RECORDW CreateRecordForIpAddress(_In_ PCWSTR Name, _In_ WORD Type)
Definition: query.c:60
CHAR * xstrsaveA(const CHAR *str)
Definition: query.c:562
DNS_STATUS WINAPI Query_Main(LPCWSTR Name, WORD Type, DWORD Options, PDNS_RECORD *QueryResultSet)
Definition: query.c:654
static PCHAR DnsWToC(const WCHAR *WideString)
Definition: query.c:156
WCHAR * xstrsave(const WCHAR *str)
Definition: query.c:544
static BOOL ParseIpv6Address(_In_ PCWSTR AddressString, _Out_ PIN6_ADDR pAddress)
Definition: query.c:41
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
@ AnsiString
Definition: dnslib.h:19
__kernel_size_t size_t
Definition: linux.h:237
#define AF_INET
Definition: tcpip.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
GLenum const GLvoid * addr
Definition: glext.h:9621
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
static PIP_ADAPTER_ADDRESSES
Definition: iphlpapi.c:76
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
#define GAA_FLAG_SKIP_FRIENDLY_NAME
struct FIXED_INFO * PFIXED_INFO
#define inet_addr(cp)
Definition: inet.h:98
#define INADDR_ANY
Definition: inet.h:53
#define INADDR_LOOPBACK
Definition: inet.h:51
#define PCHAR
Definition: match.c:90
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ntohl(x)
Definition: module.h:205
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PLARGE_INTEGER Time
Definition: time.c:105
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI RtlIpv6StringToAddressW(_In_ PCWSTR String, _Out_ PCWSTR *Terminator, _Out_ struct in6_addr *Addr)
Definition: network.c:806
NTSYSAPI NTSTATUS NTAPI RtlIpv4StringToAddressW(_In_ PCWSTR String, _In_ BOOLEAN Strict, _Out_ PCWSTR *Terminator, _Out_ struct in_addr *Addr)
Definition: network.c:405
#define L(x)
Definition: ntvdm.h:50
#define CONST
Definition: pedump.c:81
static WCHAR Address[46]
Definition: ping.c:68
static unsigned __int64 next
Definition: rand_nt.c:6
const WCHAR * str
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define CP_UTF8
Definition: nls.h:20
#define RpcEndExcept
Definition: rpc.h:128
#define RpcTryExcept
Definition: rpc.h:126
#define RpcExcept(expr)
Definition: rpc.h:127
#define RpcExceptionCode()
Definition: rpc.h:132
#define DPRINT
Definition: sndvol32.h:71
STRSAFEAPI StringCchCatA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:320
STRSAFEAPI StringCbLengthW(STRSAFE_LPCWSTR psz, size_t cbMax, size_t *pcbLength)
Definition: strsafe.h:876
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbLengthA(STRSAFE_LPCSTR psz, size_t cbMax, size_t *pcbLength)
Definition: strsafe.h:859
STRSAFEAPI StringCchLengthA(STRSAFE_LPCSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:832
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
STRSAFEAPI StringCbCopyA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:161
DNS_IP6_ADDRESS Ip6Address
Definition: windns.h:250
IP4_ADDRESS IpAddress
Definition: windns.h:246
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
char HostName[MAX_HOSTNAME_LEN+4]
Definition: iptypes.h:81
char DomainName[MAX_DOMAIN_NAME_LEN+4]
Definition: iptypes.h:82
char String[4 *4]
Definition: iptypes.h:42
Definition: windns_undoc.h:9
DWORD CharSet
Definition: windns.h:240
DWORD Section
Definition: windns.h:238
union _DnsRecordW::@3309 Flags
WORD wType
Definition: windns.h:600
LPWSTR pName
Definition: windns.h:599
DNS_A_DATA A
Definition: windns.h:609
union _DnsRecordW::@3310 Data
DNS_AAAA_DATA AAAA
Definition: windns.h:617
DNS_RECORD_FLAGS S
Definition: windns.h:604
DWORD dwTtl
Definition: windns.h:606
WORD wDataLength
Definition: windns.h:601
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
union adns_answer::@4225 rrs
adns_rr_addr * addr
Definition: adns.h:322
adns_status status
Definition: adns.h:311
char * cname
Definition: adns.h:312
union adns_rr_addr::@4224 addr
struct sockaddr_in inet
Definition: adns.h:271
UCHAR Byte[16]
Definition: in6addr.h:5
union in6_addr::@3002 u
Definition: tcpip.h:126
u_long S_addr
Definition: tcpip.h:131
union in_addr::@1020 S_un
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
int ret
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
#define CopyMemory
Definition: winbase.h:1710
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define DNS_RECORD
Definition: windns.h:635
#define DNS_TYPE_MINFO
Definition: windns.h:54
#define DNS_QUERY_NO_RECURSION
Definition: windns.h:11
#define DNS_TYPE_HINFO
Definition: windns.h:53
#define DNS_TYPE_MX
Definition: windns.h:55
#define DNS_TYPE_ANY
Definition: windns.h:94
#define DNS_TYPE_WKS
Definition: windns.h:51
@ DnsSectionAnswer
Definition: windns.h:154
@ DnsSectionQuestion
Definition: windns.h:153
#define DNS_TYPE_PTR
Definition: windns.h:52
#define DNS_TYPE_MB
Definition: windns.h:47
#define DNS_TYPE_MG
Definition: windns.h:48
#define DNS_MX_DATA
Definition: windns.h:919
DWORD IP4_ADDRESS
Definition: windns.h:36
#define DNS_TXT_DATA
Definition: windns.h:929
#define DNS_TYPE_CNAME
Definition: windns.h:45
#define DNS_TYPE_NS
Definition: windns.h:42
#define DNS_PTR_DATA
Definition: windns.h:923
#define DNS_TYPE_MD
Definition: windns.h:43
@ DnsCharSetUnicode
Definition: windns.h:111
@ DnsCharSetUtf8
Definition: windns.h:112
@ DnsCharSetAnsi
Definition: windns.h:113
#define DNS_MINFO_DATA
Definition: windns.h:917
#define DNS_TYPE_MF
Definition: windns.h:44
#define DNS_QUERY_NO_WIRE_QUERY
Definition: windns.h:13
#define DNS_TYPE_AAAA
Definition: windns.h:68
#define DNS_TYPE_NULL
Definition: windns.h:50
#define PDNS_RECORD
Definition: windns.h:636
#define DNS_TYPE_MR
Definition: windns.h:49
#define DNS_TYPE_A
Definition: windns.h:41
#define WINAPI
Definition: msvc.h:6
#define DNS_ERROR_INVALID_NAME_CHAR
Definition: winerror.h:1877
struct sockaddr_in * LPSOCKADDR_IN
Definition: winsock.h:489
_In_ KPRIORITY _In_ LONG Adjustment
Definition: kefuncs.h:427
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175