xref: /reactos/sdk/include/psdk/windns.h (revision 34593d93)
1 #ifndef _WINDNS_INCLUDED_
2 #define _WINDNS_INCLUDED_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #define DNS_QUERY_STANDARD                  0x0
9 #define DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE 0x1
10 #define DNS_QUERY_USE_TCP_ONLY              0x2
11 #define DNS_QUERY_NO_RECURSION              0x4
12 #define DNS_QUERY_BYPASS_CACHE              0x8
13 #define DNS_QUERY_NO_WIRE_QUERY             0x10
14 #define DNS_QUERY_NO_LOCAL_NAME             0x20
15 #define DNS_QUERY_NO_HOSTS_FILE             0x40
16 #define DNS_QUERY_NO_NETBT                  0x80
17 #define DNS_QUERY_TREAT_AS_FQDN             0x1000
18 #define DNS_QUERY_WIRE_ONLY                 0x100
19 #define DNS_QUERY_RETURN_MESSAGE            0x200
20 #define DNS_QUERY_DONT_RESET_TTL_VALUES     0x100000
21 #define DNS_QUERY_RESERVED                  0xff000000
22 
23 #define DNS_UPDATE_SECURITY_USE_DEFAULT    0x0
24 #define DNS_UPDATE_SECURITY_OFF            0x10
25 #define DNS_UPDATE_SECURITY_ON             0x20
26 #define DNS_UPDATE_SECURITY_ONLY           0x100
27 #define DNS_UPDATE_CACHE_SECURITY_CONTEXT  0x200
28 #define DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT 0x400
29 #define DNS_UPDATE_FORCE_SECURITY_NEGO     0x800
30 #define DNS_UPDATE_RESERVED                0xffff0000
31 
32 #define DNS_CONFIG_FLAG_ALLOC TRUE
33 
34 #ifndef RC_INVOKE
35 
36 typedef DWORD IP4_ADDRESS;
37 
38 typedef _Return_type_success_(return == 0) DWORD DNS_STATUS;
39 
40 #define DNS_TYPE_ZERO    0x0000
41 #define DNS_TYPE_A       0x0001
42 #define DNS_TYPE_NS      0x0002
43 #define DNS_TYPE_MD      0x0003
44 #define DNS_TYPE_MF      0x0004
45 #define DNS_TYPE_CNAME   0x0005
46 #define DNS_TYPE_SOA     0x0006
47 #define DNS_TYPE_MB      0x0007
48 #define DNS_TYPE_MG      0x0008
49 #define DNS_TYPE_MR      0x0009
50 #define DNS_TYPE_NULL    0x000a
51 #define DNS_TYPE_WKS     0x000b
52 #define DNS_TYPE_PTR     0x000c
53 #define DNS_TYPE_HINFO   0x000d
54 #define DNS_TYPE_MINFO   0x000e
55 #define DNS_TYPE_MX      0x000f
56 #define DNS_TYPE_TEXT    0x0010
57 #define DNS_TYPE_RP      0x0011
58 #define DNS_TYPE_AFSDB   0x0012
59 #define DNS_TYPE_X25     0x0013
60 #define DNS_TYPE_ISDN    0x0014
61 #define DNS_TYPE_RT      0x0015
62 #define DNS_TYPE_NSAP    0x0016
63 #define DNS_TYPE_NSAPPTR 0x0017
64 #define DNS_TYPE_SIG     0x0018
65 #define DNS_TYPE_KEY     0x0019
66 #define DNS_TYPE_PX      0x001a
67 #define DNS_TYPE_GPOS    0x001b
68 #define DNS_TYPE_AAAA    0x001c
69 #define DNS_TYPE_LOC     0x001d
70 #define DNS_TYPE_NXT     0x001e
71 #define DNS_TYPE_EID     0x001f
72 #define DNS_TYPE_NIMLOC  0x0020
73 #define DNS_TYPE_SRV     0x0021
74 #define DNS_TYPE_ATMA    0x0022
75 #define DNS_TYPE_NAPTR   0x0023
76 #define DNS_TYPE_KX      0x0024
77 #define DNS_TYPE_CERT    0x0025
78 #define DNS_TYPE_A6      0x0026
79 #define DNS_TYPE_DNAME   0x0027
80 #define DNS_TYPE_SINK    0x0028
81 #define DNS_TYPE_OPT     0x0029
82 #define DNS_TYPE_UINFO   0x0064
83 #define DNS_TYPE_UID     0x0065
84 #define DNS_TYPE_GID     0x0066
85 #define DNS_TYPE_UNSPEC  0x0067
86 #define DNS_TYPE_ADDRS   0x00f8
87 #define DNS_TYPE_TKEY    0x00f9
88 #define DNS_TYPE_TSIG    0x00fa
89 #define DNS_TYPE_IXFR    0x00fb
90 #define DNS_TYPE_AXFR    0x00fc
91 #define DNS_TYPE_MAILB   0x00fd
92 #define DNS_TYPE_MAILA   0x00fe
93 #define DNS_TYPE_ALL     0x00ff
94 #define DNS_TYPE_ANY     0x00ff
95 
96 #define DNS_TYPE_WINS   0xff01
97 #define DNS_TYPE_WINSR  0xff02
98 #define DNS_TYPE_NBSTAT (DNS_TYPE_WINSR)
99 
100 #define DNSREC_QUESTION   0
101 #define DNSREC_ANSWER     1
102 #define DNSREC_AUTHORITY  2
103 #define DNSREC_ADDITIONAL 3
104 
105 #define DNS_ATMA_MAX_ADDR_LENGTH 20
106 
107 #define DNS_ADDR_MAX_SOCKADDR_LENGTH 32
108 
109 typedef enum _DNS_CHARSET {
110   DnsCharSetUnknown,
111   DnsCharSetUnicode,
112   DnsCharSetUtf8,
113   DnsCharSetAnsi
114 } DNS_CHARSET;
115 
116 typedef enum {
117   DnsConfigPrimaryDomainName_W,
118   DnsConfigPrimaryDomainName_A,
119   DnsConfigPrimaryDomainName_UTF8,
120   DnsConfigAdapterDomainName_W,
121   DnsConfigAdapterDomainName_A,
122   DnsConfigAdapterDomainName_UTF8,
123   DnsConfigDnsServerList,
124   DnsConfigSearchList,
125   DnsConfigAdapterInfo,
126   DnsConfigPrimaryHostNameRegistrationEnabled,
127   DnsConfigAdapterHostNameRegistrationEnabled,
128   DnsConfigAddressRegistrationMaxCount,
129   DnsConfigHostName_W,
130   DnsConfigHostName_A,
131   DnsConfigHostName_UTF8,
132   DnsConfigFullHostName_W,
133   DnsConfigFullHostName_A,
134   DnsConfigFullHostName_UTF8
135 } DNS_CONFIG_TYPE;
136 
137 typedef enum {
138   DnsFreeFlat = 0,
139   DnsFreeRecordList,
140   DnsFreeParsedMessageFields
141 } DNS_FREE_TYPE;
142 
143 typedef enum _DNS_NAME_FORMAT {
144   DnsNameDomain,
145   DnsNameDomainLabel,
146   DnsNameHostnameFull,
147   DnsNameHostnameLabel,
148   DnsNameWildcard,
149   DnsNameSrvRecord
150 } DNS_NAME_FORMAT;
151 
152 typedef enum {
153   DnsSectionQuestion,
154   DnsSectionAnswer,
155   DnsSectionAuthority,
156   DnsSectionAdditional
157 } DNS_SECTION;
158 
159 typedef struct _IP4_ARRAY {
160   DWORD AddrCount;
161   IP4_ADDRESS AddrArray[1];
162 } IP4_ARRAY, *PIP4_ARRAY;
163 
164 typedef struct {
165   DWORD IP6Dword[4];
166 } IP6_ADDRESS, *PIP6_ADDRESS, DNS_IP6_ADDRESS, *PDNS_IP6_ADDRESS;
167 
168 #pragma pack(push, 1)
169 
170 typedef struct _DnsAddr
171 {
172   CHAR MaxSa[DNS_ADDR_MAX_SOCKADDR_LENGTH];
173 #if defined(__midl) || defined(__WIDL__)
174   DWORD DnsAddrUserDword[8];
175 #else
176   union {
177     DWORD DnsAddrUserDword[8];
178   } Data;
179 #endif
180 } DNS_ADDR, *PDNS_ADDR;
181 
182 typedef struct _DnsAddrArray
183 {
184   DWORD MaxCount;
185   DWORD AddrCount;
186   DWORD Tag;
187   WORD  Family;
188   WORD  WordReserved;
189   DWORD Flags;
190   DWORD MatchFlag;
191   DWORD Reserved1;
192   DWORD Reserved2;
193 #if defined(__midl) || defined(__WIDL__)
194   [size_is(AddrCount)] DNS_ADDR AddrArray[];
195 #else
196   DNS_ADDR AddrArray[1];
197 #endif
198 } DNS_ADDR_ARRAY, *PDNS_ADDR_ARRAY;
199 
200 typedef struct _DNS_HEADER {
201   WORD Xid;
202   BYTE RecursionDesired:1;
203   BYTE Truncation:1;
204   BYTE Authoritative:1;
205   BYTE Opcode:4;
206   BYTE IsResponse:1;
207   BYTE ResponseCode:4;
208   BYTE CheckingDisabled:1;
209   BYTE AuthenticatedData:1;
210   BYTE Reserved:1;
211   BYTE RecursionAvailable:1;
212   WORD QuestionCount;
213   WORD AnswerCount;
214   WORD NameServerCount;
215   WORD AdditionalCount;
216 } DNS_HEADER, *PDNS_HEADER;
217 
218 typedef struct _DNS_WIRE_QUESTION {
219   WORD QuestionType;
220   WORD QuestionClass;
221 } DNS_WIRE_QUESTION, *PDNS_WIRE_QUESTION;
222 
223 typedef struct _DNS_WIRE_RECORD {
224   WORD RecordType;
225   WORD RecordClass;
226   DWORD TimeToLive;
227   WORD DataLength;
228 } DNS_WIRE_RECORD, *PDNS_WIRE_RECORD;
229 
230 #pragma pack(pop)
231 
232 typedef struct _DNS_MESSAGE_BUFFER {
233   DNS_HEADER MessageHead;
234   CHAR MessageBody[1];
235 } DNS_MESSAGE_BUFFER, *PDNS_MESSAGE_BUFFER;
236 
237 typedef struct _DnsRecordFlags {
238   DWORD Section:2;
239   DWORD Delete:1;
240   DWORD CharSet:2;
241   DWORD Unused:3;
242   DWORD Reserved:24;
243 } DNS_RECORD_FLAGS;
244 
245 typedef struct {
246   IP4_ADDRESS IpAddress;
247 } DNS_A_DATA, *PDNS_A_DATA;
248 
249 typedef struct {
250   DNS_IP6_ADDRESS Ip6Address;
251 } DNS_AAAA_DATA, *PDNS_AAAA_DATA;
252 
253 typedef struct {
254   BYTE AddressType;
255   BYTE Address[DNS_ATMA_MAX_ADDR_LENGTH];
256 } DNS_ATMA_DATA, *PDNS_ATMA_DATA;
257 
258 typedef struct {
259   WORD wFlags;
260   BYTE chProtocol;
261   BYTE chAlgorithm;
262   BYTE Key[1];
263 } DNS_KEY_DATA, *PDNS_KEY_DATA;
264 
265 typedef struct {
266   WORD wVersion;
267   WORD wSize;
268   WORD wHorPrec;
269   WORD wVerPrec;
270   DWORD dwLatitude;
271   DWORD dwLongitude;
272   DWORD dwAltitude;
273 } DNS_LOC_DATA, *PDNS_LOC_DATA;
274 
275 typedef struct {
276   LPSTR pNameMailbox;
277   LPSTR pNameErrorsMailbox;
278 } DNS_MINFO_DATAA, *PDNS_MINFO_DATAA;
279 
280 typedef struct {
281   LPWSTR pNameMailbox;
282   LPWSTR pNameErrorsMailbox;
283 } DNS_MINFO_DATAW, *PDNS_MINFO_DATAW;
284 
285 typedef struct {
286   LPSTR pNameExchange;
287   WORD wPreference;
288   WORD Pad;
289 } DNS_MX_DATAA, *PDNS_MX_DATAA;
290 
291 typedef struct {
292   LPWSTR pNameExchange;
293   WORD wPreference;
294   WORD Pad;
295 } DNS_MX_DATAW, *PDNS_MX_DATAW;
296 
297 typedef struct {
298   DWORD dwByteCount;
299   BYTE Data[1];
300 } DNS_NULL_DATA, *PDNS_NULL_DATA;
301 
302 typedef struct {
303   LPSTR pNameNext;
304   WORD wNumTypes;
305   WORD wTypes[1];
306 } DNS_NXT_DATAA, *PDNS_NXT_DATAA;
307 
308 typedef struct {
309   LPWSTR pNameNext;
310   WORD wNumTypes;
311   WORD wTypes[1];
312 } DNS_NXT_DATAW, *PDNS_NXT_DATAW;
313 
314 typedef struct {
315   LPSTR pNameHost;
316 } DNS_PTR_DATAA, *PDNS_PTR_DATAA;
317 
318 typedef struct {
319   LPWSTR pNameHost;
320 } DNS_PTR_DATAW, *PDNS_PTR_DATAW;
321 
322 typedef struct {
323   LPSTR pNameSigner;
324   WORD wTypeCovered;
325   BYTE chAlgorithm;
326   BYTE chLabelCount;
327   DWORD dwOriginalTtl;
328   DWORD dwExpiration;
329   DWORD dwTimeSigned;
330   WORD wKeyTag;
331   WORD Pad;
332   BYTE Signature[1];
333 } DNS_SIG_DATAA, *PDNS_SIG_DATAA;
334 
335 typedef struct {
336   LPWSTR pNameSigner;
337   WORD wTypeCovered;
338   BYTE chAlgorithm;
339   BYTE chLabelCount;
340   DWORD dwOriginalTtl;
341   DWORD dwExpiration;
342   DWORD dwTimeSigned;
343   WORD wKeyTag;
344   WORD Pad;
345   BYTE Signature[1];
346 } DNS_SIG_DATAW, *PDNS_SIG_DATAW;
347 
348 typedef struct {
349   LPSTR pNamePrimaryServer;
350   LPSTR pNameAdministrator;
351   DWORD dwSerialNo;
352   DWORD dwRefresh;
353   DWORD dwRetry;
354   DWORD dwExpire;
355   DWORD dwDefaultTtl;
356 } DNS_SOA_DATAA, *PDNS_SOA_DATAA;
357 
358 typedef struct {
359   LPWSTR pNamePrimaryServer;
360   LPWSTR pNameAdministrator;
361   DWORD dwSerialNo;
362   DWORD dwRefresh;
363   DWORD dwRetry;
364   DWORD dwExpire;
365   DWORD dwDefaultTtl;
366 } DNS_SOA_DATAW, *PDNS_SOA_DATAW;
367 
368 typedef struct {
369   LPSTR pNameTarget;
370   WORD wPriority;
371   WORD wWeight;
372   WORD wPort;
373   WORD Pad;
374 } DNS_SRV_DATAA, *PDNS_SRV_DATAA;
375 
376 typedef struct {
377   LPWSTR pNameTarget;
378   WORD wPriority;
379   WORD wWeight;
380   WORD wPort;
381   WORD Pad;
382 } DNS_SRV_DATAW, *PDNS_SRV_DATAW;
383 
384 typedef struct {
385   DWORD dwStringCount;
386   LPSTR pStringArray[1];
387 } DNS_TXT_DATAA, *PDNS_TXT_DATAA;
388 
389 typedef struct {
390   DWORD dwStringCount;
391   LPWSTR pStringArray[1];
392 } DNS_TXT_DATAW, *PDNS_TXT_DATAW;
393 
394 typedef struct {
395   LPSTR pNameAlgorithm;
396   PBYTE pAlgorithmPacket;
397   PBYTE pKey;
398   PBYTE pOtherData;
399   DWORD dwCreateTime;
400   DWORD dwExpireTime;
401   WORD wMode;
402   WORD wError;
403   WORD wKeyLength;
404   WORD wOtherLength;
405   UCHAR cAlgNameLength;
406   BOOL bPacketPointers;
407 } DNS_TKEY_DATAA, *PDNS_TKEY_DATAA;
408 
409 typedef struct {
410   LPWSTR pNameAlgorithm;
411   PBYTE pAlgorithmPacket;
412   PBYTE pKey;
413   PBYTE pOtherData;
414   DWORD dwCreateTime;
415   DWORD dwExpireTime;
416   WORD wMode;
417   WORD wError;
418   WORD wKeyLength;
419   WORD wOtherLength;
420   UCHAR cAlgNameLength;
421   BOOL bPacketPointers;
422 } DNS_TKEY_DATAW, *PDNS_TKEY_DATAW;
423 
424 typedef struct {
425   LPSTR pNameAlgorithm;
426   PBYTE pAlgorithmPacket;
427   PBYTE pSignature;
428   PBYTE pOtherData;
429   LONGLONG i64CreateTime;
430   WORD wFudgeTime;
431   WORD wOriginalXid;
432   WORD wError;
433   WORD wSigLength;
434   WORD wOtherLength;
435   UCHAR cAlgNameLength;
436   BOOL bPacketPointers;
437 } DNS_TSIG_DATAA, *PDNS_TSIG_DATAA;
438 
439 typedef struct {
440   LPWSTR pNameAlgorithm;
441   PBYTE pAlgorithmPacket;
442   PBYTE pSignature;
443   PBYTE pOtherData;
444   LONGLONG i64CreateTime;
445   WORD wFudgeTime;
446   WORD wOriginalXid;
447   WORD wError;
448   WORD wSigLength;
449   WORD wOtherLength;
450   UCHAR cAlgNameLength;
451   BOOL bPacketPointers;
452 } DNS_TSIG_DATAW, *PDNS_TSIG_DATAW;
453 
454 typedef struct {
455   DWORD dwMappingFlag;
456   DWORD dwLookupTimeout;
457   DWORD dwCacheTimeout;
458   DWORD cWinsServerCount;
459   IP4_ADDRESS WinsServers[1];
460 } DNS_WINS_DATA, *PDNS_WINS_DATA;
461 
462 typedef struct {
463   DWORD dwMappingFlag;
464   DWORD dwLookupTimeout;
465   DWORD dwCacheTimeout;
466   LPSTR pNameResultDomain;
467 } DNS_WINSR_DATAA, *PDNS_WINSR_DATAA;
468 
469 typedef struct {
470   DWORD dwMappingFlag;
471   DWORD dwLookupTimeout;
472   DWORD dwCacheTimeout;
473   LPWSTR pNameResultDomain;
474 } DNS_WINSR_DATAW, *PDNS_WINSR_DATAW;
475 
476 typedef struct {
477   IP4_ADDRESS IpAddress;
478   UCHAR chProtocol;
479   BYTE BitMask[1];
480 } DNS_WKS_DATA, *PDNS_WKS_DATA;
481 
482 typedef struct {
483   WORD wKeyTag;
484   BYTE chAlgorithm;
485   BYTE chDigestType;
486   WORD wDigestLength;
487   WORD wPad;
488   BYTE Digest[1];
489 } DNS_DS_DATA;
490 
491 typedef struct {
492   LPWSTR pNextDomainName;
493   WORD wTypeBitMapsLength;
494   WORD wPad;
495   BYTE TypeBitMaps[1];
496 } DNS_NSEC_DATAW;
497 
498 typedef struct {
499   WORD wFlags;
500   BYTE chProtocol;
501   BYTE chAlgorithm;
502   WORD wKeyLength;
503   WORD wPad;
504   BYTE Key[1];
505 } DNS_DNSKEY_DATA;
506 
507 typedef struct {
508   WORD wDataLength;
509   WORD wPad;
510   BYTE Data[1];
511 } DNS_OPT_DATA;
512 
513 typedef struct {
514   WORD wTypeCovered;
515   BYTE chAlgorithm;
516   BYTE chLabelCount;
517   DWORD dwOriginalTtl;
518   DWORD dwExpiration;
519   DWORD dwTimeSigned;
520   WORD wKeyTag;
521   WORD Pad;
522   LPWSTR pNameSigner;
523   BYTE Signature[1];
524 } DNS_RRSIG_DATAW;
525 
526 #if defined(__midl) || defined(__WIDL__)
527 typedef [switch_type(unsigned short )] union DNS_DATAW {
528   [case(1)] DNS_A_DATA A;
529   [case(6)] DNS_SOA_DATAW SOA;
530   [case(12)] DNS_PTR_DATAW PTR;
531   [case(2)] DNS_PTR_DATAW NS;
532   [case(5)] DNS_PTR_DATAW CNAME;
533   [case(7)] DNS_PTR_DATAW MB;
534   [case(3)] DNS_PTR_DATAW MD;
535   [case(4)] DNS_PTR_DATAW MF;
536   [case(8)] DNS_PTR_DATAW MG;
537   [case(9)] DNS_PTR_DATAW MR;
538   [case(14)] DNS_MINFO_DATAW MINFO;
539   [case(17)] DNS_MINFO_DATAW RP;
540   [case(15)] DNS_MX_DATAW MX;
541   [case(18)] DNS_MX_DATAW AFSDB;
542   [case(21)] DNS_MX_DATAW RT;
543   [case(28)] DNS_AAAA_DATA AAAA;
544   [case(33)] DNS_SRV_DATAW SRV;
545   [case(34)] DNS_ATMA_DATA ATMA;
546   [case(43)] DNS_DS_DATA DS;
547   [case(46)] DNS_RRSIG_DATAW RRSIG;
548   [case(47)] DNS_NSEC_DATAW NSEC;
549   [case(48)] DNS_DNSKEY_DATA DNSKEY;
550   [case(41)] DNS_OPT_DATA OPT;
551 } DNS_DATAW;
552 
553 typedef struct _DnsRecordW {
554   [unique]struct _DnsRecordW *pNext;
555   [unique][string] LPWSTR  pName;
556   WORD wType;
557   WORD wDataLength;
558   DWORD Flags;
559   DWORD dwTtl;
560   DWORD dwReserved;
561   [switch_is(wType)] DNS_DATAW Data;
562 } DNS_RECORDW, *PDNS_RECORDW;
563 #else
564 typedef struct _DnsRecordA {
565   struct _DnsRecordA* pNext;
566   LPSTR pName;
567   WORD wType;
568   WORD wDataLength;
569   union {
570     DWORD DW;
571     DNS_RECORD_FLAGS S;
572   } Flags;
573   DWORD dwTtl;
574   DWORD dwReserved;
575   union {
576     DNS_A_DATA A;
577     DNS_SOA_DATAA SOA, Soa;
578     DNS_PTR_DATAA PTR, Ptr, NS, Ns, CNAME, Cname, MB, Mb, MD, Md, MF, Mf, MG, Mg, MR, Mr;
579     DNS_MINFO_DATAA MINFO, Minfo, RP, Rp;
580     DNS_MX_DATAA MX, Mx, AFSDB, Afsdb, RT, Rt;
581     DNS_TXT_DATAA HINFO, Hinfo, ISDN, Isdn, TXT, Txt, X25;
582     DNS_NULL_DATA Null;
583     DNS_WKS_DATA WKS, Wks;
584     DNS_AAAA_DATA AAAA;
585     DNS_KEY_DATA KEY, Key;
586     DNS_SIG_DATAA SIG, Sig;
587     DNS_ATMA_DATA ATMA, Atma;
588     DNS_NXT_DATAA NXT, Nxt;
589     DNS_SRV_DATAA SRV, Srv;
590     DNS_TKEY_DATAA TKEY, Tkey;
591     DNS_TSIG_DATAA TSIG, Tsig;
592     DNS_WINS_DATA WINS, Wins;
593     DNS_WINSR_DATAA WINSR, WinsR, NBSTAT, Nbstat;
594   } Data;
595 } DNS_RECORDA, *PDNS_RECORDA;
596 
597 typedef struct _DnsRecordW {
598   struct _DnsRecordW* pNext;
599   LPWSTR pName;
600   WORD wType;
601   WORD wDataLength;
602   union {
603     DWORD DW;
604     DNS_RECORD_FLAGS S;
605   } Flags;
606   DWORD dwTtl;
607   DWORD dwReserved;
608   union {
609     DNS_A_DATA A;
610     DNS_SOA_DATAW SOA, Soa;
611     DNS_PTR_DATAW PTR, Ptr, NS, Ns, CNAME, Cname, MB, Mb, MD, Md, MF, Mf, MG, Mg, MR, Mr;
612     DNS_MINFO_DATAW MINFO, Minfo, RP, Rp;
613     DNS_MX_DATAW MX, Mx, AFSDB, Afsdb, RT, Rt;
614     DNS_TXT_DATAW HINFO, Hinfo, ISDN, Isdn, TXT, Txt, X25;
615     DNS_NULL_DATA Null;
616     DNS_WKS_DATA WKS, Wks;
617     DNS_AAAA_DATA AAAA;
618     DNS_KEY_DATA KEY, Key;
619     DNS_SIG_DATAW SIG, Sig;
620     DNS_ATMA_DATA ATMA, Atma;
621     DNS_NXT_DATAW NXT, Nxt;
622     DNS_SRV_DATAW SRV, Srv;
623     DNS_TKEY_DATAW TKEY, Tkey;
624     DNS_TSIG_DATAW TSIG, Tsig;
625     DNS_WINS_DATA WINS, Wins;
626     DNS_WINSR_DATAW WINSR, WinsR, NBSTAT, Nbstat;
627   } Data;
628 } DNS_RECORDW, *PDNS_RECORDW;
629 #endif
630 
631 #ifdef UNICODE
632 #define DNS_RECORD DNS_RECORDW
633 #define PDNS_RECORD PDNS_RECORDW
634 #else
635 #define DNS_RECORD DNS_RECORDA
636 #define PDNS_RECORD PDNS_RECORDA
637 #endif
638 
639 typedef struct _DnsRRSet {
640   PDNS_RECORD pFirstRR;
641   PDNS_RECORD pLastRR;
642 } DNS_RRSET, *PDNS_RRSET;
643 
644 #define DNS_RRSET_INIT(rrset)                            \
645 {                                                        \
646     PDNS_RRSET  _prrset = &(rrset);                      \
647     _prrset->pFirstRR = NULL;                            \
648     _prrset->pLastRR = (PDNS_RECORD) &_prrset->pFirstRR; \
649 }
650 
651 #define DNS_RRSET_ADD(rrset, pnewRR)   \
652 {                                      \
653     PDNS_RRSET  _prrset = &(rrset);    \
654     PDNS_RECORD _prrnew = (pnewRR);    \
655     _prrset->pLastRR->pNext = _prrnew; \
656     _prrset->pLastRR = _prrnew;        \
657 }
658 
659 #define DNS_RRSET_TERMINATE(rrset)   \
660 {                                    \
661     PDNS_RRSET  _prrset = &(rrset);  \
662     _prrset->pLastRR->pNext = NULL;  \
663 }
664 
665 #ifndef __WIDL__
666 // HACK
667 
668 DNS_STATUS
669 WINAPI
670 DnsAcquireContextHandle_A(
671   _In_ DWORD CredentialFlags,
672   _In_opt_ PVOID Credentials,
673   _Outptr_ PHANDLE pContext);
674 
675 DNS_STATUS
676 WINAPI
677 DnsAcquireContextHandle_W(
678   _In_ DWORD CredentialFlags,
679   _In_opt_ PVOID Credentials,
680   _Outptr_ PHANDLE pContext);
681 
682 DNS_STATUS
683 WINAPI
684 DnsExtractRecordsFromMessage_W(
685   _In_ PDNS_MESSAGE_BUFFER pDnsBuffer,
686   _In_ WORD wMessageLength,
687   _Outptr_ PDNS_RECORD *ppRecord);
688 
689 DNS_STATUS
690 WINAPI
691 DnsExtractRecordsFromMessage_UTF8(
692   _In_ PDNS_MESSAGE_BUFFER pDnsBuffer,
693   _In_ WORD wMessageLength,
694   _Outptr_ PDNS_RECORD *ppRecord);
695 
696 DNS_STATUS
697 WINAPI
698 DnsModifyRecordsInSet_A(
699   _In_opt_ PDNS_RECORD pAddRecords,
700   _In_opt_ PDNS_RECORD pDeleteRecords,
701   _In_ DWORD Options,
702   _In_opt_ HANDLE hCredentials,
703   _Inout_opt_ PIP4_ARRAY pExtraList,
704   _Inout_opt_ PVOID pReserved);
705 
706 DNS_STATUS
707 WINAPI
708 DnsModifyRecordsInSet_W(
709   _In_opt_ PDNS_RECORD pAddRecords,
710   _In_opt_ PDNS_RECORD pDeleteRecords,
711   _In_ DWORD Options,
712   _In_opt_ HANDLE hCredentials,
713   _Inout_opt_ PIP4_ARRAY pExtraList,
714   _Inout_opt_ PVOID pReserved);
715 
716 DNS_STATUS
717 WINAPI
718 DnsModifyRecordsInSet_UTF8(
719   _In_opt_ PDNS_RECORD pAddRecords,
720   _In_opt_ PDNS_RECORD pDeleteRecords,
721   _In_ DWORD Options,
722   _In_opt_ HANDLE hCredentials,
723   _Inout_opt_ PIP4_ARRAY pExtraList,
724   _Inout_opt_ PVOID pReserved);
725 
726 BOOL
727 WINAPI
728 DnsNameCompare_A(
729   _In_ PCSTR pszName1,
730   _In_ PCSTR pszName2);
731 
732 BOOL
733 WINAPI
734 DnsNameCompare_W(
735   _In_ PCWSTR pszwName1,
736   _In_ PCWSTR pszwName2);
737 
738 DNS_STATUS
739 WINAPI
740 DnsQuery_A(
741   _In_ PCSTR pszName,
742   _In_ WORD wType,
743   _In_ DWORD Options,
744   _Inout_opt_ PVOID pExtra,
745   _Outptr_result_maybenull_ PDNS_RECORD *ppQueryResults,
746   _Outptr_opt_result_maybenull_ PVOID *pReserved);
747 
748 DNS_STATUS
749 WINAPI
750 DnsQuery_W(
751   _In_ PCWSTR pszName,
752   _In_ WORD wType,
753   _In_ DWORD Options,
754   _Inout_opt_ PVOID pExtra,
755   _Outptr_result_maybenull_ PDNS_RECORD *ppQueryResults,
756   _Outptr_opt_result_maybenull_ PVOID *pReserved);
757 
758 DNS_STATUS
759 WINAPI
760 DnsQuery_UTF8(
761   _In_ PCSTR pszName,
762   _In_ WORD wType,
763   _In_ DWORD Options,
764   _Inout_opt_ PVOID pExtra,
765   _Outptr_result_maybenull_ PDNS_RECORD *ppQueryResults,
766   _Outptr_opt_result_maybenull_ PVOID *pReserved);
767 
768 DNS_STATUS
769 WINAPI
770 DnsQueryConfig(
771   _In_ DNS_CONFIG_TYPE Config,
772   _In_ DWORD Flag,
773   _In_opt_ PWSTR pwsAdapterName,
774   _In_opt_ PVOID pReserved,
775   _Out_writes_bytes_to_opt_(*pBufLen, *pBufLen) PVOID pBuffer,
776   _Inout_ PDWORD pBufLen);
777 
778 BOOL
779 WINAPI
780 DnsRecordCompare(
781   _In_ PDNS_RECORD,
782   _In_ PDNS_RECORD);
783 
784 PDNS_RECORD
785 WINAPI
786 DnsRecordCopyEx(
787   _In_ PDNS_RECORD pRecord,
788   _In_ DNS_CHARSET CharSetIn,
789   _In_ DNS_CHARSET CharSetOut);
790 
791 void
792 WINAPI
793 DnsRecordListFree(
794   _Inout_opt_ PDNS_RECORD,
795   _In_ DNS_FREE_TYPE);
796 
797 BOOL
798 WINAPI
799 DnsRecordSetCompare(
800   _Inout_ PDNS_RECORD pRR1,
801   _Inout_ PDNS_RECORD pRR2,
802   _Outptr_opt_result_maybenull_ PDNS_RECORD *ppDiff1,
803   _Outptr_opt_result_maybenull_ PDNS_RECORD *ppDiff2);
804 
805 PDNS_RECORD
806 WINAPI
807 DnsRecordSetCopyEx(
808   _In_ PDNS_RECORD pRecordSet,
809   _In_ DNS_CHARSET CharSetIn,
810   _In_ DNS_CHARSET CharSetOut);
811 
812 PDNS_RECORD
813 WINAPI
814 DnsRecordSetDetach(
815   _Inout_ PDNS_RECORD);
816 
817 void
818 WINAPI
819 DnsReleaseContextHandle(
820   _In_ HANDLE);
821 
822 DNS_STATUS
823 WINAPI
824 DnsReplaceRecordSetA(
825   _In_ PDNS_RECORD pReplaceSet,
826   _In_ DWORD Options,
827   _In_opt_ HANDLE hContext,
828   _Inout_opt_ PIP4_ARRAY pExtraInfo,
829   _Inout_opt_ PVOID pReserved);
830 
831 DNS_STATUS
832 WINAPI
833 DnsReplaceRecordSetW(
834   _In_ PDNS_RECORD pReplaceSet,
835   _In_ DWORD Options,
836   _In_opt_ HANDLE hContext,
837   _Inout_opt_ PIP4_ARRAY pExtraInfo,
838   _Inout_opt_ PVOID pReserved);
839 
840 DNS_STATUS
841 WINAPI
842 DnsReplaceRecordSetUTF8(
843   _In_ PDNS_RECORD pReplaceSet,
844   _In_ DWORD Options,
845   _In_opt_ HANDLE hContext,
846   _Inout_opt_ PIP4_ARRAY pExtraInfo,
847   _Inout_opt_ PVOID pReserved);
848 
849 DNS_STATUS
850 WINAPI
851 DnsValidateName_A(
852   _In_ LPCSTR,
853   _In_ DNS_NAME_FORMAT);
854 
855 DNS_STATUS
856 WINAPI
857 DnsValidateName_W(
858   _In_ LPCWSTR,
859   _In_ DNS_NAME_FORMAT);
860 
861 DNS_STATUS
862 WINAPI
863 DnsValidateName_UTF8(
864   _In_ LPCSTR,
865   _In_ DNS_NAME_FORMAT);
866 
867 BOOL
868 WINAPI
869 DnsWriteQuestionToBuffer_W(
870   _Inout_ PDNS_MESSAGE_BUFFER pDnsBuffer,
871   _Inout_ PDWORD pdwBufferSize,
872   _In_ LPWSTR pszName,
873   _In_ WORD wType,
874   _In_ WORD Xid,
875   _In_ BOOL fRecursionDesired);
876 
877 BOOL
878 WINAPI
879 DnsWriteQuestionToBuffer_UTF8(
880   _Inout_ PDNS_MESSAGE_BUFFER pDnsBuffer,
881   _Inout_ PDWORD pdwBufferSize,
882   _In_ LPSTR pszName,
883   _In_ WORD wType,
884   _In_ WORD Xid,
885   _In_ BOOL fRecursionDesired);
886 #endif
887 
888 #ifdef UNICODE
889 
890 #define DNS_MINFO_DATA DNS_MINFO_DATAW
891 #define PDNS_MINFO_DATA PDNS_MINFO_DATAW
892 #define DNS_MX_DATA DNS_MX_DATAW
893 #define PDNS_MX_DATA PDNS_MX_DATAW
894 #define DNS_NXT_DATA DNS_NXT_DATAW
895 #define PDNS_NXT_DATA PDNS_NXT_DATAW
896 #define DNS_PTR_DATA DNS_PTR_DATAW
897 #define PDNS_PTR_DATA PDNS_PTR_DATAW
898 #define DNS_SIG_DATA DNS_SIG_DATAW
899 #define PDNS_SIG_DATA PDNS_SIG_DATAW
900 #define DNS_SOA_DATA DNS_SOA_DATAW
901 #define PDNS_SOA_DATA PDNS_SOA_DATAW
902 #define DNS_TXT_DATA DNS_TXT_DATAW
903 #define PDNS_TXT_DATA PDNS_TXT_DATAW
904 #define DNS_TKEY_DATA DNS_TKEY_DATAW
905 #define PDNS_TKEY_DATA PDNS_TKEY_DATAW
906 #define DNS_WINSR_DATA DNS_WINSR_DATAW
907 #define PDNS_WINSR_DATA PDNS_WINSR_DATAW
908 #define DnsAcquireContextHandle DnsAcquireContextHandle_W
909 #define DnsModifyRecordsInSet DnsModifyRecordsInSet_W
910 #define DnsNameCompare DnsNameCompare_W
911 #define DnsQuery DnsQuery_W
912 #define DnsReplaceRecordSet DnsReplaceRecordSetW
913 #define DnsValidateName DnsValidateName_W
914 
915 #else /* UNICODE */
916 
917 #define DNS_MINFO_DATA DNS_MINFO_DATAA
918 #define PDNS_MINFO_DATA PDNS_MINFO_DATAA
919 #define DNS_MX_DATA DNS_MX_DATAA
920 #define PDNS_MX_DATA PDNS_MX_DATAA
921 #define DNS_NXT_DATA DNS_NXT_DATAA
922 #define PDNS_NXT_DATA PDNS_NXT_DATAA
923 #define DNS_PTR_DATA DNS_PTR_DATAA
924 #define PDNS_PTR_DATA PDNS_PTR_DATAA
925 #define DNS_SIG_DATA DNS_SIG_DATAA
926 #define PDNS_SIG_DATA PDNS_SIG_DATAA
927 #define DNS_SOA_DATA DNS_SOA_DATAA
928 #define PDNS_SOA_DATA PDNS_SOA_DATAA
929 #define DNS_TXT_DATA DNS_TXT_DATAA
930 #define PDNS_TXT_DATA PDNS_TXT_DATAA
931 #define DNS_TKEY_DATA DNS_TKEY_DATAA
932 #define PDNS_TKEY_DATA PDNS_TKEY_DATAA
933 #define DNS_WINSR_DATA DNS_WINSR_DATAA
934 #define PDNS_WINSR_DATA PDNS_WINSR_DATAA
935 #define DnsAcquireContextHandle DnsAcquireContextHandle_A
936 #define DnsModifyRecordsInSet DnsModifyRecordsInSet_A
937 #define DnsNameCompare DnsNameCompare_A
938 #define DnsQuery DnsQuery_A
939 #define DnsReplaceRecordSet DnsReplaceRecordSetA
940 #define DnsValidateName DnsValidateName_A
941 
942 #endif /* UNICODE */
943 
944 #endif /* RC_INVOKED */
945 
946 #ifdef __cplusplus
947 }
948 #endif
949 
950 #endif /* _WINDNS_INCLUDED_ */
951