4 * Copyright (C) 2006 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
23 #include "wine/debug.h"
27 #include <sys/types.h>
29 #ifdef HAVE_NETINET_IN_H
30 # include <netinet/in.h>
32 #ifdef HAVE_ARPA_NAMESER_H
33 # include <arpa/nameser.h>
51 WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
55 /* call res_init() just once because of a bug in Mac OS X 10.4 */
56 /* call once per thread on systems that have per-thread _res */
57 static void initialise_resolver( void )
59 if ((_res.options & RES_INIT) == 0)
63 static const char *dns_section_to_str( ns_sect section )
67 case ns_s_qd: return "Question";
68 case ns_s_an: return "Answer";
69 case ns_s_ns: return "Authority";
70 case ns_s_ar: return "Additional";
74 FIXME( "unknown section: 0x%02x\n", section );
75 sprintf( tmp, "0x%02x", section );
81 static unsigned long dns_map_options( DWORD options )
83 unsigned long ret = 0;
85 if (options == DNS_QUERY_STANDARD)
88 if (options & DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE)
90 if (options & DNS_QUERY_USE_TCP_ONLY)
92 if (options & DNS_QUERY_NO_RECURSION)
94 if (options & DNS_QUERY_NO_LOCAL_NAME)
96 if (options & DNS_QUERY_NO_HOSTS_FILE)
98 if (options & DNS_QUERY_TREAT_AS_FQDN)
101 if (options & DNS_QUERY_DONT_RESET_TTL_VALUES)
102 FIXME( "option DNS_QUERY_DONT_RESET_TTL_VALUES not implemented\n" );
103 if (options & DNS_QUERY_RESERVED)
104 FIXME( "option DNS_QUERY_RESERVED not implemented\n" );
105 if (options & DNS_QUERY_WIRE_ONLY)
106 FIXME( "option DNS_QUERY_WIRE_ONLY not implemented\n" );
107 if (options & DNS_QUERY_NO_WIRE_QUERY)
108 FIXME( "option DNS_QUERY_NO_WIRE_QUERY not implemented\n" );
109 if (options & DNS_QUERY_BYPASS_CACHE)
110 FIXME( "option DNS_QUERY_BYPASS_CACHE not implemented\n" );
111 if (options & DNS_QUERY_RETURN_MESSAGE)
112 FIXME( "option DNS_QUERY_RETURN_MESSAGE not implemented\n" );
114 if (options & DNS_QUERY_NO_NETBT)
115 TRACE( "netbios query disabled\n" );
120 static DNS_STATUS dns_map_error( int error )
124 case ns_r_noerror: return ERROR_SUCCESS;
125 case ns_r_formerr: return DNS_ERROR_RCODE_FORMAT_ERROR;
126 case ns_r_servfail: return DNS_ERROR_RCODE_SERVER_FAILURE;
127 case ns_r_nxdomain: return DNS_ERROR_RCODE_NAME_ERROR;
128 case ns_r_notimpl: return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
129 case ns_r_refused: return DNS_ERROR_RCODE_REFUSED;
130 case ns_r_yxdomain: return DNS_ERROR_RCODE_YXDOMAIN;
131 case ns_r_yxrrset: return DNS_ERROR_RCODE_YXRRSET;
132 case ns_r_nxrrset: return DNS_ERROR_RCODE_NXRRSET;
133 case ns_r_notauth: return DNS_ERROR_RCODE_NOTAUTH;
134 case ns_r_notzone: return DNS_ERROR_RCODE_NOTZONE;
136 FIXME( "unmapped error code: %d\n", error );
137 return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
141 static DNS_STATUS dns_map_h_errno( int error )
146 case HOST_NOT_FOUND: return DNS_ERROR_RCODE_NAME_ERROR;
147 case TRY_AGAIN: return DNS_ERROR_RCODE_SERVER_FAILURE;
148 case NO_RECOVERY: return DNS_ERROR_RCODE_REFUSED;
149 case NETDB_INTERNAL: return DNS_ERROR_RCODE;
151 FIXME( "unmapped error code: %d\n", error );
152 return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
156 static char *dns_dname_from_msg( ns_msg msg, const unsigned char *pos )
159 char *str, dname[NS_MAXDNAME] = ".";
161 /* returns *compressed* length, ignore it */
162 dns_ns_name_uncompress( ns_msg_base(msg), ns_msg_end(msg), pos, dname, sizeof(dname) );
164 len = strlen( dname );
165 str = heap_alloc( len + 1 );
166 if (str) strcpy( str, dname );
170 static char *dns_str_from_rdata( const unsigned char *rdata )
173 unsigned int len = rdata[0];
175 str = heap_alloc( len + 1 );
178 memcpy( str, ++rdata, len );
184 static unsigned int dns_get_record_size( const ns_rr *rr )
186 const unsigned char *pos = rr->rdata;
187 unsigned int num = 0, size = sizeof(DNS_RECORDA);
193 pos += sizeof(WORD) + sizeof(BYTE) + sizeof(BYTE);
194 size += rr->rdata + rr->rdlength - pos - 1;
199 pos += sizeof(PCHAR) + sizeof(WORD) + 2 * sizeof(BYTE);
200 pos += 3 * sizeof(DWORD) + 2 * sizeof(WORD);
201 size += rr->rdata + rr->rdlength - pos - 1;
209 while (pos[0] && pos < rr->rdata + rr->rdlength)
214 size += (num - 1) * sizeof(PCHAR);
219 size += rr->rdlength - 1;
224 case 0xff01: /* WINS */
226 FIXME( "unhandled type: %s\n", dns_type_to_str( rr->type ) );
235 static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD *dlen )
237 DNS_STATUS ret = ERROR_SUCCESS;
238 const unsigned char *pos = rr->rdata;
239 unsigned int i, size;
245 r->Data.A.IpAddress = *(const DWORD *)pos;
246 *dlen = sizeof(DNS_A_DATA);
251 for (i = 0; i < sizeof(IP6_ADDRESS)/sizeof(DWORD); i++)
253 r->Data.AAAA.Ip6Address.IP6Dword[i] = *(const DWORD *)pos;
254 pos += sizeof(DWORD);
257 *dlen = sizeof(DNS_AAAA_DATA);
262 /* FIXME: byte order? */
263 r->Data.KEY.wFlags = *(const WORD *)pos; pos += sizeof(WORD);
264 r->Data.KEY.chProtocol = *pos++;
265 r->Data.KEY.chAlgorithm = *pos++;
267 size = rr->rdata + rr->rdlength - pos;
269 for (i = 0; i < size; i++)
270 r->Data.KEY.Key[i] = *pos++;
272 *dlen = sizeof(DNS_KEY_DATA) + (size - 1) * sizeof(BYTE);
278 r->Data.MINFO.pNameMailbox = dns_dname_from_msg( msg, pos );
279 if (!r->Data.MINFO.pNameMailbox) return ERROR_NOT_ENOUGH_MEMORY;
281 if (dns_ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
282 return DNS_ERROR_BAD_PACKET;
284 r->Data.MINFO.pNameErrorsMailbox = dns_dname_from_msg( msg, pos );
285 if (!r->Data.MINFO.pNameErrorsMailbox)
287 heap_free( r->Data.MINFO.pNameMailbox );
288 return ERROR_NOT_ENOUGH_MEMORY;
291 *dlen = sizeof(DNS_MINFO_DATAA);
298 r->Data.MX.wPreference = ntohs( *(const WORD *)pos );
299 r->Data.MX.pNameExchange = dns_dname_from_msg( msg, pos + sizeof(WORD) );
300 if (!r->Data.MX.pNameExchange) return ERROR_NOT_ENOUGH_MEMORY;
302 *dlen = sizeof(DNS_MX_DATAA);
307 r->Data.Null.dwByteCount = rr->rdlength;
308 memcpy( r->Data.Null.Data, rr->rdata, rr->rdlength );
310 *dlen = sizeof(DNS_NULL_DATA) + rr->rdlength - 1;
322 r->Data.PTR.pNameHost = dns_dname_from_msg( msg, pos );
323 if (!r->Data.PTR.pNameHost) return ERROR_NOT_ENOUGH_MEMORY;
325 *dlen = sizeof(DNS_PTR_DATAA);
330 r->Data.SIG.pNameSigner = dns_dname_from_msg( msg, pos );
331 if (!r->Data.SIG.pNameSigner) return ERROR_NOT_ENOUGH_MEMORY;
333 if (dns_ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
334 return DNS_ERROR_BAD_PACKET;
336 /* FIXME: byte order? */
337 r->Data.SIG.wTypeCovered = *(const WORD *)pos; pos += sizeof(WORD);
338 r->Data.SIG.chAlgorithm = *pos++;
339 r->Data.SIG.chLabelCount = *pos++;
340 r->Data.SIG.dwOriginalTtl = *(const DWORD *)pos; pos += sizeof(DWORD);
341 r->Data.SIG.dwExpiration = *(const DWORD *)pos; pos += sizeof(DWORD);
342 r->Data.SIG.dwTimeSigned = *(const DWORD *)pos; pos += sizeof(DWORD);
343 r->Data.SIG.wKeyTag = *(const WORD *)pos;
345 size = rr->rdata + rr->rdlength - pos;
347 for (i = 0; i < size; i++)
348 r->Data.SIG.Signature[i] = *pos++;
350 *dlen = sizeof(DNS_SIG_DATAA) + (size - 1) * sizeof(BYTE);
355 r->Data.SOA.pNamePrimaryServer = dns_dname_from_msg( msg, pos );
356 if (!r->Data.SOA.pNamePrimaryServer) return ERROR_NOT_ENOUGH_MEMORY;
358 if (dns_ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
359 return DNS_ERROR_BAD_PACKET;
361 r->Data.SOA.pNameAdministrator = dns_dname_from_msg( msg, pos );
362 if (!r->Data.SOA.pNameAdministrator)
364 heap_free( r->Data.SOA.pNamePrimaryServer );
365 return ERROR_NOT_ENOUGH_MEMORY;
368 if (dns_ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
369 return DNS_ERROR_BAD_PACKET;
371 r->Data.SOA.dwSerialNo = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
372 r->Data.SOA.dwRefresh = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
373 r->Data.SOA.dwRetry = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
374 r->Data.SOA.dwExpire = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
375 r->Data.SOA.dwDefaultTtl = ntohl( *(const DWORD *)pos ); pos += sizeof(DWORD);
377 *dlen = sizeof(DNS_SOA_DATAA);
382 r->Data.SRV.wPriority = ntohs( *(const WORD *)pos ); pos += sizeof(WORD);
383 r->Data.SRV.wWeight = ntohs( *(const WORD *)pos ); pos += sizeof(WORD);
384 r->Data.SRV.wPort = ntohs( *(const WORD *)pos ); pos += sizeof(WORD);
386 r->Data.SRV.pNameTarget = dns_dname_from_msg( msg, pos );
387 if (!r->Data.SRV.pNameTarget) return ERROR_NOT_ENOUGH_MEMORY;
389 *dlen = sizeof(DNS_SRV_DATAA);
398 while (pos[0] && pos < rr->rdata + rr->rdlength)
400 r->Data.TXT.pStringArray[i] = dns_str_from_rdata( pos );
401 if (!r->Data.TXT.pStringArray[i])
403 while (i > 0) heap_free( r->Data.TXT.pStringArray[--i] );
404 return ERROR_NOT_ENOUGH_MEMORY;
409 r->Data.TXT.dwStringCount = i;
410 *dlen = sizeof(DNS_TXT_DATAA) + (i - 1) * sizeof(PCHAR);
418 case 0x00f9: /* TKEY */
419 case 0xff01: /* WINS */
420 case 0xff02: /* WINSR */
422 FIXME( "unhandled type: %s\n", dns_type_to_str( rr->type ) );
423 return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
429 static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
430 unsigned short num, DNS_RECORDA **recp )
437 if (dns_ns_parserr( &msg, section, num, &rr ) < 0)
438 return DNS_ERROR_BAD_PACKET;
440 if (!(record = heap_alloc_zero( dns_get_record_size( &rr ) )))
441 return ERROR_NOT_ENOUGH_MEMORY;
443 record->pName = dns_strdup_u( rr.name );
447 return ERROR_NOT_ENOUGH_MEMORY;
450 record->wType = rr.type;
451 record->Flags.S.Section = section;
452 record->Flags.S.CharSet = DnsCharSetUtf8;
453 record->dwTtl = rr.ttl;
455 if ((ret = dns_copy_rdata( msg, &rr, record, &dlen )))
457 heap_free( record->pName );
461 record->wDataLength = dlen;
464 TRACE( "found %s record in %s section\n",
465 dns_type_to_str( rr.type ), dns_section_to_str( section ) );
466 return ERROR_SUCCESS;
469 #define DEFAULT_TTL 1200
471 static DNS_STATUS dns_do_query_netbios( PCSTR name, DNS_RECORDA **recp )
476 FIND_NAME_BUFFER *buffer;
477 FIND_NAME_HEADER *header;
478 DNS_RECORDA *record = NULL;
480 DNS_STATUS status = ERROR_INVALID_NAME;
482 len = strlen( name );
483 if (len >= NCBNAMSZ) return DNS_ERROR_RCODE_NAME_ERROR;
485 DNS_RRSET_INIT( rrset );
487 memset( &ncb, 0, sizeof(ncb) );
488 ncb.ncb_command = NCBFINDNAME;
490 memset( ncb.ncb_callname, ' ', sizeof(ncb.ncb_callname) );
491 memcpy( ncb.ncb_callname, name, len );
492 ncb.ncb_callname[NCBNAMSZ - 1] = '\0';
494 ret = Netbios( &ncb );
495 if (ret != NRC_GOODRET) return ERROR_INVALID_NAME;
497 header = (FIND_NAME_HEADER *)ncb.ncb_buffer;
498 buffer = (FIND_NAME_BUFFER *)((char *)header + sizeof(FIND_NAME_HEADER));
500 for (i = 0; i < header->node_count; i++)
502 record = heap_alloc_zero( sizeof(DNS_RECORDA) );
505 status = ERROR_NOT_ENOUGH_MEMORY;
510 record->pName = dns_strdup_u( name );
513 status = ERROR_NOT_ENOUGH_MEMORY;
517 record->wType = DNS_TYPE_A;
518 record->Flags.S.Section = DnsSectionAnswer;
519 record->Flags.S.CharSet = DnsCharSetUtf8;
520 record->dwTtl = DEFAULT_TTL;
522 /* FIXME: network byte order? */
523 record->Data.A.IpAddress = *(DWORD *)((char *)buffer[i].destination_addr + 2);
525 DNS_RRSET_ADD( rrset, (DNS_RECORD *)record );
528 status = ERROR_SUCCESS;
531 DNS_RRSET_TERMINATE( rrset );
533 if (status != ERROR_SUCCESS)
534 DnsRecordListFree( rrset.pFirstRR, DnsFreeRecordList );
536 *recp = (DNS_RECORDA *)rrset.pFirstRR;
541 /* res_init() must have been called before calling these three functions.
543 static DNS_STATUS dns_set_serverlist( const IP4_ARRAY *addrs )
547 if (addrs->AddrCount > MAXNS)
549 WARN( "too many servers: %d only using the first: %d\n",
550 addrs->AddrCount, MAXNS );
551 _res.nscount = MAXNS;
553 else _res.nscount = addrs->AddrCount;
555 for (i = 0; i < _res.nscount; i++)
556 _res.nsaddr_list[i].sin_addr.s_addr = addrs->AddrArray[i];
558 return ERROR_SUCCESS;
561 static DNS_STATUS dns_get_serverlist( PIP4_ARRAY addrs, PDWORD len )
566 size = FIELD_OFFSET(IP4_ARRAY, AddrArray[_res.nscount]);
567 if (!addrs || *len < size)
570 return ERROR_INSUFFICIENT_BUFFER;
573 addrs->AddrCount = _res.nscount;
575 for (i = 0; i < _res.nscount; i++)
576 addrs->AddrArray[i] = _res.nsaddr_list[i].sin_addr.s_addr;
578 return ERROR_SUCCESS;
581 static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options,
582 PDNS_RECORDA *result )
584 DNS_STATUS ret = DNS_ERROR_RCODE_NOT_IMPLEMENTED;
587 unsigned char answer[NS_PACKETSZ];
588 ns_sect sections[] = { ns_s_an, ns_s_ar };
591 DNS_RECORDA *record = NULL;
595 DNS_RRSET_INIT( rrset );
597 len = res_query( name, ns_c_in, type, answer, sizeof(answer) );
600 ret = dns_map_h_errno( h_errno );
604 if (dns_ns_initparse( answer, len, &msg ) < 0)
606 ret = DNS_ERROR_BAD_PACKET;
610 #define RCODE_MASK 0x0f
611 if ((msg._flags & RCODE_MASK) != ns_r_noerror)
613 ret = dns_map_error( msg._flags & RCODE_MASK );
617 for (i = 0; i < sizeof(sections)/sizeof(sections[0]); i++)
619 for (num = 0; num < ns_msg_count( msg, sections[i] ); num++)
621 ret = dns_copy_record( msg, sections[i], num, &record );
622 if (ret != ERROR_SUCCESS) goto exit;
624 DNS_RRSET_ADD( rrset, (DNS_RECORD *)record );
629 DNS_RRSET_TERMINATE( rrset );
631 if (ret != ERROR_SUCCESS)
632 DnsRecordListFree( rrset.pFirstRR, DnsFreeRecordList );
634 *result = (DNS_RECORDA *)rrset.pFirstRR;
639 #endif /* HAVE_RESOLV */
641 /******************************************************************************
642 * DnsQuery_A [DNSAPI.@]
645 DNS_STATUS WINAPI DnsQuery_A( PCSTR name, WORD type, DWORD options, PVOID servers,
646 PDNS_RECORDA *result, PVOID *reserved )
649 DNS_RECORDW *resultW;
652 TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), dns_type_to_str( type ),
653 options, servers, result, reserved );
655 if (!name || !result)
656 return ERROR_INVALID_PARAMETER;
658 nameW = dns_strdup_aw( name );
659 if (!nameW) return ERROR_NOT_ENOUGH_MEMORY;
661 status = DnsQuery_W( nameW, type, options, servers, &resultW, reserved );
663 if (status == ERROR_SUCCESS)
665 *result = (DNS_RECORDA *)DnsRecordSetCopyEx(
666 (DNS_RECORD *)resultW, DnsCharSetUnicode, DnsCharSetAnsi );
668 if (!*result) status = ERROR_NOT_ENOUGH_MEMORY;
669 DnsRecordListFree( (DNS_RECORD *)resultW, DnsFreeRecordList );
676 /******************************************************************************
677 * DnsQuery_UTF8 [DNSAPI.@]
680 DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID servers,
681 PDNS_RECORDA *result, PVOID *reserved )
683 DNS_STATUS ret = DNS_ERROR_RCODE_NOT_IMPLEMENTED;
686 TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), dns_type_to_str( type ),
687 options, servers, result, reserved );
689 if (!name || !result)
690 return ERROR_INVALID_PARAMETER;
692 initialise_resolver();
693 _res.options |= dns_map_options( options );
695 if (servers && (ret = dns_set_serverlist( servers )))
698 ret = dns_do_query( name, type, options, result );
700 if (ret == DNS_ERROR_RCODE_NAME_ERROR && type == DNS_TYPE_A &&
701 !(options & DNS_QUERY_NO_NETBT))
703 TRACE( "dns lookup failed, trying netbios query\n" );
704 ret = dns_do_query_netbios( name, result );
711 /******************************************************************************
712 * DnsQuery_W [DNSAPI.@]
715 DNS_STATUS WINAPI DnsQuery_W( PCWSTR name, WORD type, DWORD options, PVOID servers,
716 PDNS_RECORDW *result, PVOID *reserved )
719 DNS_RECORDA *resultA;
722 TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_w(name), dns_type_to_str( type ),
723 options, servers, result, reserved );
725 if (!name || !result)
726 return ERROR_INVALID_PARAMETER;
728 nameU = dns_strdup_wu( name );
729 if (!nameU) return ERROR_NOT_ENOUGH_MEMORY;
731 status = DnsQuery_UTF8( nameU, type, options, servers, &resultA, reserved );
733 if (status == ERROR_SUCCESS)
735 *result = (DNS_RECORDW *)DnsRecordSetCopyEx(
736 (DNS_RECORD *)resultA, DnsCharSetUtf8, DnsCharSetUnicode );
738 if (!*result) status = ERROR_NOT_ENOUGH_MEMORY;
739 DnsRecordListFree( (DNS_RECORD *)resultA, DnsFreeRecordList );
746 static DNS_STATUS dns_get_hostname_a( COMPUTER_NAME_FORMAT format,
747 PSTR buffer, PDWORD len )
750 DWORD size = sizeof(name)/sizeof(name[0]);
752 if (!GetComputerNameExA( format, name, &size ))
753 return DNS_ERROR_NAME_DOES_NOT_EXIST;
755 if (!buffer || (size = lstrlenA( name ) + 1) > *len)
758 return ERROR_INSUFFICIENT_BUFFER;
761 lstrcpyA( buffer, name );
762 return ERROR_SUCCESS;
765 static DNS_STATUS dns_get_hostname_w( COMPUTER_NAME_FORMAT format,
766 PWSTR buffer, PDWORD len )
769 DWORD size = sizeof(name)/sizeof(name[0]);
771 if (!GetComputerNameExW( format, name, &size ))
772 return DNS_ERROR_NAME_DOES_NOT_EXIST;
774 if (!buffer || (size = lstrlenW( name ) + 1) > *len)
777 return ERROR_INSUFFICIENT_BUFFER;
780 lstrcpyW( buffer, name );
781 return ERROR_SUCCESS;
784 /******************************************************************************
785 * DnsQueryConfig [DNSAPI.@]
788 DNS_STATUS WINAPI DnsQueryConfig( DNS_CONFIG_TYPE config, DWORD flag, PCWSTR adapter,
789 PVOID reserved, PVOID buffer, PDWORD len )
791 DNS_STATUS ret = ERROR_INVALID_PARAMETER;
793 TRACE( "(%d,0x%08x,%s,%p,%p,%p)\n", config, flag, debugstr_w(adapter),
794 reserved, buffer, len );
796 if (!len) return ERROR_INVALID_PARAMETER;
800 case DnsConfigDnsServerList:
803 initialise_resolver();
804 ret = dns_get_serverlist( buffer, len );
807 WARN( "compiled without resolver support\n" );
811 case DnsConfigHostName_A:
812 case DnsConfigHostName_UTF8:
813 return dns_get_hostname_a( ComputerNameDnsHostname, buffer, len );
815 case DnsConfigFullHostName_A:
816 case DnsConfigFullHostName_UTF8:
817 return dns_get_hostname_a( ComputerNameDnsFullyQualified, buffer, len );
819 case DnsConfigPrimaryDomainName_A:
820 case DnsConfigPrimaryDomainName_UTF8:
821 return dns_get_hostname_a( ComputerNameDnsDomain, buffer, len );
823 case DnsConfigHostName_W:
824 return dns_get_hostname_w( ComputerNameDnsHostname, buffer, len );
826 case DnsConfigFullHostName_W:
827 return dns_get_hostname_w( ComputerNameDnsFullyQualified, buffer, len );
829 case DnsConfigPrimaryDomainName_W:
830 return dns_get_hostname_w( ComputerNameDnsDomain, buffer, len );
832 case DnsConfigAdapterDomainName_A:
833 case DnsConfigAdapterDomainName_W:
834 case DnsConfigAdapterDomainName_UTF8:
835 case DnsConfigSearchList:
836 case DnsConfigAdapterInfo:
837 case DnsConfigPrimaryHostNameRegistrationEnabled:
838 case DnsConfigAdapterHostNameRegistrationEnabled:
839 case DnsConfigAddressRegistrationMaxCount:
840 FIXME( "unimplemented config type %d\n", config );
844 WARN( "unknown config type: %d\n", config );