dnsapi: Get rid of the dns_ prefix on helpers.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0d26dd2afb
commit
fadcd9563f
|
@ -24,39 +24,36 @@
|
|||
|
||||
#include "wine/heap.h"
|
||||
|
||||
static inline LPSTR dns_strdup_a( LPCSTR src )
|
||||
static inline char *strdup_a( const char *src )
|
||||
{
|
||||
LPSTR dst;
|
||||
|
||||
char *dst;
|
||||
if (!src) return NULL;
|
||||
dst = heap_alloc( (lstrlenA( src ) + 1) * sizeof(char) );
|
||||
if (dst) lstrcpyA( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
static inline char *dns_strdup_u( const char *src )
|
||||
static inline char *strdup_u( const char *src )
|
||||
{
|
||||
char *dst;
|
||||
|
||||
if (!src) return NULL;
|
||||
dst = heap_alloc( (strlen( src ) + 1) * sizeof(char) );
|
||||
if (dst) strcpy( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
static inline LPWSTR dns_strdup_w( LPCWSTR src )
|
||||
static inline WCHAR *strdup_w( const WCHAR *src )
|
||||
{
|
||||
LPWSTR dst;
|
||||
|
||||
WCHAR *dst;
|
||||
if (!src) return NULL;
|
||||
dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
|
||||
if (dst) lstrcpyW( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
static inline LPWSTR dns_strdup_aw( LPCSTR str )
|
||||
static inline WCHAR *strdup_aw( const char *str )
|
||||
{
|
||||
LPWSTR ret = NULL;
|
||||
WCHAR *ret = NULL;
|
||||
if (str)
|
||||
{
|
||||
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||
|
@ -66,9 +63,9 @@ static inline LPWSTR dns_strdup_aw( LPCSTR str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline LPWSTR dns_strdup_uw( const char *str )
|
||||
static inline WCHAR *strdup_uw( const char *str )
|
||||
{
|
||||
LPWSTR ret = NULL;
|
||||
WCHAR *ret = NULL;
|
||||
if (str)
|
||||
{
|
||||
DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
|
||||
|
@ -78,9 +75,9 @@ static inline LPWSTR dns_strdup_uw( const char *str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline LPSTR dns_strdup_wa( LPCWSTR str )
|
||||
static inline char *strdup_wa( const WCHAR *str )
|
||||
{
|
||||
LPSTR ret = NULL;
|
||||
char *ret = NULL;
|
||||
if (str)
|
||||
{
|
||||
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
|
@ -90,9 +87,9 @@ static inline LPSTR dns_strdup_wa( LPCWSTR str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline char *dns_strdup_wu( LPCWSTR str )
|
||||
static inline char *strdup_wu( const WCHAR *str )
|
||||
{
|
||||
LPSTR ret = NULL;
|
||||
char *ret = NULL;
|
||||
if (str)
|
||||
{
|
||||
DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
|
@ -102,30 +99,28 @@ static inline char *dns_strdup_wu( LPCWSTR str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline char *dns_strdup_au( LPCSTR src )
|
||||
static inline char *strdup_au( const char *src )
|
||||
{
|
||||
char *dst = NULL;
|
||||
LPWSTR ret = dns_strdup_aw( src );
|
||||
|
||||
WCHAR *ret = strdup_aw( src );
|
||||
if (ret)
|
||||
{
|
||||
dst = dns_strdup_wu( ret );
|
||||
dst = strdup_wu( ret );
|
||||
heap_free( ret );
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
static inline LPSTR dns_strdup_ua( const char *src )
|
||||
static inline char *strdup_ua( const char *src )
|
||||
{
|
||||
LPSTR dst = NULL;
|
||||
LPWSTR ret = dns_strdup_uw( src );
|
||||
|
||||
char *dst = NULL;
|
||||
WCHAR *ret = strdup_uw( src );
|
||||
if (ret)
|
||||
{
|
||||
dst = dns_strdup_wa( ret );
|
||||
dst = strdup_wa( ret );
|
||||
heap_free( ret );
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
const char *dns_type_to_str( unsigned short ) DECLSPEC_HIDDEN;
|
||||
const char *type_to_str( unsigned short ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -58,8 +58,8 @@ BOOL WINAPI DnsNameCompare_A( PCSTR name1, PCSTR name2 )
|
|||
|
||||
TRACE( "(%s,%s)\n", debugstr_a(name1), debugstr_a(name2) );
|
||||
|
||||
name1W = dns_strdup_aw( name1 );
|
||||
name2W = dns_strdup_aw( name2 );
|
||||
name1W = strdup_aw( name1 );
|
||||
name2W = strdup_aw( name2 );
|
||||
|
||||
ret = DnsNameCompare_W( name1W, name2W );
|
||||
|
||||
|
@ -112,7 +112,7 @@ DNS_STATUS WINAPI DnsValidateName_A( PCSTR name, DNS_NAME_FORMAT format )
|
|||
|
||||
TRACE( "(%s, %d)\n", debugstr_a(name), format );
|
||||
|
||||
nameW = dns_strdup_aw( name );
|
||||
nameW = strdup_aw( name );
|
||||
ret = DnsValidateName_W( nameW, format );
|
||||
|
||||
heap_free( nameW );
|
||||
|
@ -130,7 +130,7 @@ DNS_STATUS WINAPI DnsValidateName_UTF8( PCSTR name, DNS_NAME_FORMAT format )
|
|||
|
||||
TRACE( "(%s, %d)\n", debugstr_a(name), format );
|
||||
|
||||
nameW = dns_strdup_uw( name );
|
||||
nameW = strdup_uw( name );
|
||||
ret = DnsValidateName_W( nameW, format );
|
||||
|
||||
heap_free( nameW );
|
||||
|
|
|
@ -61,7 +61,7 @@ static void initialise_resolver( void )
|
|||
res_init();
|
||||
}
|
||||
|
||||
static const char *dns_section_to_str( ns_sect section )
|
||||
static const char *section_to_str( ns_sect section )
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ static const char *dns_section_to_str( ns_sect section )
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned long dns_map_options( DWORD options )
|
||||
static unsigned long map_options( DWORD options )
|
||||
{
|
||||
unsigned long ret = 0;
|
||||
|
||||
|
@ -118,7 +118,7 @@ static unsigned long dns_map_options( DWORD options )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_map_error( int error )
|
||||
static DNS_STATUS map_error( int error )
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ static DNS_STATUS dns_map_error( int error )
|
|||
}
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_map_h_errno( int error )
|
||||
static DNS_STATUS map_h_errno( int error )
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ static DNS_STATUS dns_map_h_errno( int error )
|
|||
}
|
||||
}
|
||||
|
||||
static char *dns_dname_from_msg( ns_msg msg, const unsigned char *pos )
|
||||
static char *dname_from_msg( ns_msg msg, const unsigned char *pos )
|
||||
{
|
||||
int len;
|
||||
char *str, dname[NS_MAXDNAME] = ".";
|
||||
|
@ -170,7 +170,7 @@ static char *dns_dname_from_msg( ns_msg msg, const unsigned char *pos )
|
|||
return str;
|
||||
}
|
||||
|
||||
static char *dns_str_from_rdata( const unsigned char *rdata )
|
||||
static char *str_from_rdata( const unsigned char *rdata )
|
||||
{
|
||||
char *str;
|
||||
unsigned int len = rdata[0];
|
||||
|
@ -184,7 +184,7 @@ static char *dns_str_from_rdata( const unsigned char *rdata )
|
|||
return str;
|
||||
}
|
||||
|
||||
static unsigned int dns_get_record_size( const ns_rr *rr )
|
||||
static unsigned int get_record_size( const ns_rr *rr )
|
||||
{
|
||||
const unsigned char *pos = rr->rdata;
|
||||
unsigned int num = 0, size = sizeof(DNS_RECORDA);
|
||||
|
@ -227,7 +227,7 @@ static unsigned int dns_get_record_size( const ns_rr *rr )
|
|||
case ns_t_wks:
|
||||
case 0xff01: /* WINS */
|
||||
{
|
||||
FIXME( "unhandled type: %s\n", dns_type_to_str( rr->type ) );
|
||||
FIXME( "unhandled type: %s\n", type_to_str( rr->type ) );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -236,7 +236,7 @@ static unsigned int dns_get_record_size( const ns_rr *rr )
|
|||
return size;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD *dlen )
|
||||
static DNS_STATUS copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, WORD *dlen )
|
||||
{
|
||||
DNS_STATUS ret = ERROR_SUCCESS;
|
||||
const unsigned char *pos = rr->rdata;
|
||||
|
@ -279,13 +279,13 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
case ns_t_rp:
|
||||
case ns_t_minfo:
|
||||
{
|
||||
r->Data.MINFO.pNameMailbox = dns_dname_from_msg( msg, pos );
|
||||
r->Data.MINFO.pNameMailbox = dname_from_msg( msg, pos );
|
||||
if (!r->Data.MINFO.pNameMailbox) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
|
||||
return DNS_ERROR_BAD_PACKET;
|
||||
|
||||
r->Data.MINFO.pNameErrorsMailbox = dns_dname_from_msg( msg, pos );
|
||||
r->Data.MINFO.pNameErrorsMailbox = dname_from_msg( msg, pos );
|
||||
if (!r->Data.MINFO.pNameErrorsMailbox)
|
||||
{
|
||||
heap_free( r->Data.MINFO.pNameMailbox );
|
||||
|
@ -300,7 +300,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
case ns_t_mx:
|
||||
{
|
||||
r->Data.MX.wPreference = ntohs( *(const WORD *)pos );
|
||||
r->Data.MX.pNameExchange = dns_dname_from_msg( msg, pos + sizeof(WORD) );
|
||||
r->Data.MX.pNameExchange = dname_from_msg( msg, pos + sizeof(WORD) );
|
||||
if (!r->Data.MX.pNameExchange) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
*dlen = sizeof(DNS_MX_DATAA);
|
||||
|
@ -332,7 +332,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
case ns_t_mr:
|
||||
case ns_t_ptr:
|
||||
{
|
||||
r->Data.PTR.pNameHost = dns_dname_from_msg( msg, pos );
|
||||
r->Data.PTR.pNameHost = dname_from_msg( msg, pos );
|
||||
if (!r->Data.PTR.pNameHost) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
*dlen = sizeof(DNS_PTR_DATAA);
|
||||
|
@ -340,7 +340,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
}
|
||||
case ns_t_sig:
|
||||
{
|
||||
r->Data.SIG.pNameSigner = dns_dname_from_msg( msg, pos );
|
||||
r->Data.SIG.pNameSigner = dname_from_msg( msg, pos );
|
||||
if (!r->Data.SIG.pNameSigner) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
|
||||
|
@ -365,13 +365,13 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
}
|
||||
case ns_t_soa:
|
||||
{
|
||||
r->Data.SOA.pNamePrimaryServer = dns_dname_from_msg( msg, pos );
|
||||
r->Data.SOA.pNamePrimaryServer = dname_from_msg( msg, pos );
|
||||
if (!r->Data.SOA.pNamePrimaryServer) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
if (ns_name_skip( &pos, ns_msg_end( msg ) ) < 0)
|
||||
return DNS_ERROR_BAD_PACKET;
|
||||
|
||||
r->Data.SOA.pNameAdministrator = dns_dname_from_msg( msg, pos );
|
||||
r->Data.SOA.pNameAdministrator = dname_from_msg( msg, pos );
|
||||
if (!r->Data.SOA.pNameAdministrator)
|
||||
{
|
||||
heap_free( r->Data.SOA.pNamePrimaryServer );
|
||||
|
@ -396,7 +396,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
r->Data.SRV.wWeight = ntohs( *(const WORD *)pos ); pos += sizeof(WORD);
|
||||
r->Data.SRV.wPort = ntohs( *(const WORD *)pos ); pos += sizeof(WORD);
|
||||
|
||||
r->Data.SRV.pNameTarget = dns_dname_from_msg( msg, pos );
|
||||
r->Data.SRV.pNameTarget = dname_from_msg( msg, pos );
|
||||
if (!r->Data.SRV.pNameTarget) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
*dlen = sizeof(DNS_SRV_DATAA);
|
||||
|
@ -410,7 +410,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
i = 0;
|
||||
while (pos[0] && pos < rr->rdata + rr->rdlength)
|
||||
{
|
||||
r->Data.TXT.pStringArray[i] = dns_str_from_rdata( pos );
|
||||
r->Data.TXT.pStringArray[i] = str_from_rdata( pos );
|
||||
if (!r->Data.TXT.pStringArray[i])
|
||||
{
|
||||
while (i > 0) heap_free( r->Data.TXT.pStringArray[--i] );
|
||||
|
@ -432,14 +432,14 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
case 0xff01: /* WINS */
|
||||
case 0xff02: /* WINSR */
|
||||
default:
|
||||
FIXME( "unhandled type: %s\n", dns_type_to_str( rr->type ) );
|
||||
FIXME( "unhandled type: %s\n", type_to_str( rr->type ) );
|
||||
return DNS_ERROR_RCODE_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
||||
static DNS_STATUS copy_record( ns_msg msg, ns_sect section,
|
||||
unsigned short num, DNS_RECORDA **recp )
|
||||
{
|
||||
DNS_STATUS ret;
|
||||
|
@ -450,10 +450,10 @@ static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
|||
if (ns_parserr( &msg, section, num, &rr ) < 0)
|
||||
return DNS_ERROR_BAD_PACKET;
|
||||
|
||||
if (!(record = heap_alloc_zero( dns_get_record_size( &rr ) )))
|
||||
if (!(record = heap_alloc_zero( get_record_size( &rr ) )))
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
record->pName = dns_strdup_u( rr.name );
|
||||
record->pName = strdup_u( rr.name );
|
||||
if (!record->pName)
|
||||
{
|
||||
heap_free( record );
|
||||
|
@ -465,7 +465,7 @@ static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
|||
record->Flags.S.CharSet = DnsCharSetUtf8;
|
||||
record->dwTtl = rr.ttl;
|
||||
|
||||
if ((ret = dns_copy_rdata( msg, &rr, record, &dlen )))
|
||||
if ((ret = copy_rdata( msg, &rr, record, &dlen )))
|
||||
{
|
||||
heap_free( record->pName );
|
||||
heap_free( record );
|
||||
|
@ -475,13 +475,13 @@ static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
|||
*recp = record;
|
||||
|
||||
TRACE( "found %s record in %s section\n",
|
||||
dns_type_to_str( rr.type ), dns_section_to_str( section ) );
|
||||
type_to_str( rr.type ), section_to_str( section ) );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
#define DEFAULT_TTL 1200
|
||||
|
||||
static DNS_STATUS dns_do_query_netbios( PCSTR name, DNS_RECORDA **recp )
|
||||
static DNS_STATUS do_query_netbios( PCSTR name, DNS_RECORDA **recp )
|
||||
{
|
||||
NCB ncb;
|
||||
UCHAR ret;
|
||||
|
@ -520,7 +520,7 @@ static DNS_STATUS dns_do_query_netbios( PCSTR name, DNS_RECORDA **recp )
|
|||
}
|
||||
else
|
||||
{
|
||||
record->pName = dns_strdup_u( name );
|
||||
record->pName = strdup_u( name );
|
||||
if (!record->pName)
|
||||
{
|
||||
status = ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
@ -553,7 +553,7 @@ exit:
|
|||
|
||||
/* res_init() must have been called before calling these three functions.
|
||||
*/
|
||||
static DNS_STATUS dns_set_serverlist( const IP4_ARRAY *addrs )
|
||||
static DNS_STATUS set_serverlist( const IP4_ARRAY *addrs )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -572,7 +572,7 @@ static DNS_STATUS dns_set_serverlist( const IP4_ARRAY *addrs )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_get_serverlist( PIP4_ARRAY addrs, PDWORD len )
|
||||
static DNS_STATUS get_serverlist( PIP4_ARRAY addrs, PDWORD len )
|
||||
{
|
||||
unsigned int size;
|
||||
int i;
|
||||
|
@ -593,7 +593,7 @@ static DNS_STATUS dns_get_serverlist( PIP4_ARRAY addrs, PDWORD len )
|
|||
}
|
||||
|
||||
#define DNS_MAX_PACKET_SIZE 4096
|
||||
static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECORDA *result )
|
||||
static DNS_STATUS do_query( PCSTR name, WORD type, DWORD options, PDNS_RECORDA *result )
|
||||
{
|
||||
DNS_STATUS ret = DNS_ERROR_RCODE_NOT_IMPLEMENTED;
|
||||
|
||||
|
@ -611,7 +611,7 @@ static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECOR
|
|||
len = res_query( name, ns_c_in, type, answer, sizeof(answer) );
|
||||
if (len < 0)
|
||||
{
|
||||
ret = dns_map_h_errno( h_errno );
|
||||
ret = map_h_errno( h_errno );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECOR
|
|||
#define RCODE_MASK 0x0f
|
||||
if ((msg._flags & RCODE_MASK) != ns_r_noerror)
|
||||
{
|
||||
ret = dns_map_error( msg._flags & RCODE_MASK );
|
||||
ret = map_error( msg._flags & RCODE_MASK );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECOR
|
|||
{
|
||||
for (num = 0; num < ns_msg_count( msg, sections[i] ); num++)
|
||||
{
|
||||
ret = dns_copy_record( msg, sections[i], num, &record );
|
||||
ret = copy_record( msg, sections[i], num, &record );
|
||||
if (ret != ERROR_SUCCESS) goto exit;
|
||||
|
||||
DNS_RRSET_ADD( rrset, (DNS_RECORD *)record );
|
||||
|
@ -658,7 +658,7 @@ static const char *debugstr_query_request(const DNS_QUERY_REQUEST *req)
|
|||
return "(null)";
|
||||
|
||||
return wine_dbg_sprintf("{%d %s %s %x%08x %p %d %p %p}", req->Version,
|
||||
debugstr_w(req->QueryName), dns_type_to_str(req->QueryType),
|
||||
debugstr_w(req->QueryName), type_to_str(req->QueryType),
|
||||
(UINT32)(req->QueryOptions>>32u), (UINT32)req->QueryOptions, req->pDnsServerList,
|
||||
req->InterfaceIndex, req->pQueryCompletionCallback, req->pQueryContext);
|
||||
}
|
||||
|
@ -684,13 +684,13 @@ DNS_STATUS WINAPI DnsQuery_A( PCSTR name, WORD type, DWORD options, PVOID server
|
|||
DNS_RECORDW *resultW;
|
||||
DNS_STATUS status;
|
||||
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), dns_type_to_str( type ),
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), type_to_str( type ),
|
||||
options, servers, result, reserved );
|
||||
|
||||
if (!name || !result)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
nameW = dns_strdup_aw( name );
|
||||
nameW = strdup_aw( name );
|
||||
if (!nameW) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
status = DnsQuery_W( nameW, type, options, servers, &resultW, reserved );
|
||||
|
@ -718,24 +718,24 @@ DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID ser
|
|||
DNS_STATUS ret = DNS_ERROR_RCODE_NOT_IMPLEMENTED;
|
||||
#ifdef HAVE_RESOLV
|
||||
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), dns_type_to_str( type ),
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_a(name), type_to_str( type ),
|
||||
options, servers, result, reserved );
|
||||
|
||||
if (!name || !result)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
initialise_resolver();
|
||||
_res.options |= dns_map_options( options );
|
||||
_res.options |= map_options( options );
|
||||
|
||||
if ((ret = dns_set_serverlist( servers ))) return ret;
|
||||
if ((ret = set_serverlist( servers ))) return ret;
|
||||
|
||||
ret = dns_do_query( name, type, options, result );
|
||||
ret = do_query( name, type, options, result );
|
||||
|
||||
if (ret == DNS_ERROR_RCODE_NAME_ERROR && type == DNS_TYPE_A &&
|
||||
!(options & DNS_QUERY_NO_NETBT))
|
||||
{
|
||||
TRACE( "dns lookup failed, trying netbios query\n" );
|
||||
ret = dns_do_query_netbios( name, result );
|
||||
ret = do_query_netbios( name, result );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -753,13 +753,13 @@ DNS_STATUS WINAPI DnsQuery_W( PCWSTR name, WORD type, DWORD options, PVOID serve
|
|||
DNS_RECORDA *resultA;
|
||||
DNS_STATUS status;
|
||||
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_w(name), dns_type_to_str( type ),
|
||||
TRACE( "(%s,%s,0x%08x,%p,%p,%p)\n", debugstr_w(name), type_to_str( type ),
|
||||
options, servers, result, reserved );
|
||||
|
||||
if (!name || !result)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
nameU = dns_strdup_wu( name );
|
||||
nameU = strdup_wu( name );
|
||||
if (!nameU) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
status = DnsQuery_UTF8( nameU, type, options, servers, &resultA, reserved );
|
||||
|
@ -777,7 +777,7 @@ DNS_STATUS WINAPI DnsQuery_W( PCWSTR name, WORD type, DWORD options, PVOID serve
|
|||
return status;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_get_hostname_a( COMPUTER_NAME_FORMAT format,
|
||||
static DNS_STATUS get_hostname_a( COMPUTER_NAME_FORMAT format,
|
||||
PSTR buffer, PDWORD len )
|
||||
{
|
||||
char name[256];
|
||||
|
@ -796,7 +796,7 @@ static DNS_STATUS dns_get_hostname_a( COMPUTER_NAME_FORMAT format,
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static DNS_STATUS dns_get_hostname_w( COMPUTER_NAME_FORMAT format,
|
||||
static DNS_STATUS get_hostname_w( COMPUTER_NAME_FORMAT format,
|
||||
PWSTR buffer, PDWORD len )
|
||||
{
|
||||
WCHAR name[256];
|
||||
|
@ -835,7 +835,7 @@ DNS_STATUS WINAPI DnsQueryConfig( DNS_CONFIG_TYPE config, DWORD flag, PCWSTR ada
|
|||
{
|
||||
#ifdef HAVE_RESOLV
|
||||
initialise_resolver();
|
||||
ret = dns_get_serverlist( buffer, len );
|
||||
ret = get_serverlist( buffer, len );
|
||||
break;
|
||||
#else
|
||||
WARN( "compiled without resolver support\n" );
|
||||
|
@ -844,24 +844,24 @@ DNS_STATUS WINAPI DnsQueryConfig( DNS_CONFIG_TYPE config, DWORD flag, PCWSTR ada
|
|||
}
|
||||
case DnsConfigHostName_A:
|
||||
case DnsConfigHostName_UTF8:
|
||||
return dns_get_hostname_a( ComputerNameDnsHostname, buffer, len );
|
||||
return get_hostname_a( ComputerNameDnsHostname, buffer, len );
|
||||
|
||||
case DnsConfigFullHostName_A:
|
||||
case DnsConfigFullHostName_UTF8:
|
||||
return dns_get_hostname_a( ComputerNameDnsFullyQualified, buffer, len );
|
||||
return get_hostname_a( ComputerNameDnsFullyQualified, buffer, len );
|
||||
|
||||
case DnsConfigPrimaryDomainName_A:
|
||||
case DnsConfigPrimaryDomainName_UTF8:
|
||||
return dns_get_hostname_a( ComputerNameDnsDomain, buffer, len );
|
||||
return get_hostname_a( ComputerNameDnsDomain, buffer, len );
|
||||
|
||||
case DnsConfigHostName_W:
|
||||
return dns_get_hostname_w( ComputerNameDnsHostname, buffer, len );
|
||||
return get_hostname_w( ComputerNameDnsHostname, buffer, len );
|
||||
|
||||
case DnsConfigFullHostName_W:
|
||||
return dns_get_hostname_w( ComputerNameDnsFullyQualified, buffer, len );
|
||||
return get_hostname_w( ComputerNameDnsFullyQualified, buffer, len );
|
||||
|
||||
case DnsConfigPrimaryDomainName_W:
|
||||
return dns_get_hostname_w( ComputerNameDnsDomain, buffer, len );
|
||||
return get_hostname_w( ComputerNameDnsDomain, buffer, len );
|
||||
|
||||
case DnsConfigAdapterDomainName_A:
|
||||
case DnsConfigAdapterDomainName_W:
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
|
||||
|
||||
const char *dns_type_to_str( unsigned short type )
|
||||
const char *type_to_str( unsigned short type )
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ const char *dns_type_to_str( unsigned short type )
|
|||
}
|
||||
}
|
||||
|
||||
static int dns_strcmpX( LPCVOID str1, LPCVOID str2, BOOL wide )
|
||||
static int strcmpX( LPCVOID str1, LPCVOID str2, BOOL wide )
|
||||
{
|
||||
if (wide)
|
||||
return lstrcmpiW( str1, str2 );
|
||||
|
@ -141,7 +141,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
r1->dwReserved != r2->dwReserved) return FALSE;
|
||||
|
||||
wide = (r1->Flags.S.CharSet == DnsCharSetUnicode || r1->Flags.S.CharSet == DnsCharSetUnknown);
|
||||
if (dns_strcmpX( r1->pName, r2->pName, wide )) return FALSE;
|
||||
if (strcmpX( r1->pName, r2->pName, wide )) return FALSE;
|
||||
|
||||
switch (r1->wType)
|
||||
{
|
||||
|
@ -158,9 +158,9 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
r1->Data.SOA.dwExpire != r2->Data.SOA.dwExpire ||
|
||||
r1->Data.SOA.dwDefaultTtl != r2->Data.SOA.dwDefaultTtl)
|
||||
return FALSE;
|
||||
if (dns_strcmpX( r1->Data.SOA.pNamePrimaryServer,
|
||||
if (strcmpX( r1->Data.SOA.pNamePrimaryServer,
|
||||
r2->Data.SOA.pNamePrimaryServer, wide ) ||
|
||||
dns_strcmpX( r1->Data.SOA.pNameAdministrator,
|
||||
strcmpX( r1->Data.SOA.pNameAdministrator,
|
||||
r2->Data.SOA.pNameAdministrator, wide ))
|
||||
return FALSE;
|
||||
break;
|
||||
|
@ -174,16 +174,16 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
case DNS_TYPE_MG:
|
||||
case DNS_TYPE_MR:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.PTR.pNameHost,
|
||||
if (strcmpX( r1->Data.PTR.pNameHost,
|
||||
r2->Data.PTR.pNameHost, wide )) return FALSE;
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_MINFO:
|
||||
case DNS_TYPE_RP:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.MINFO.pNameMailbox,
|
||||
if (strcmpX( r1->Data.MINFO.pNameMailbox,
|
||||
r2->Data.MINFO.pNameMailbox, wide ) ||
|
||||
dns_strcmpX( r1->Data.MINFO.pNameErrorsMailbox,
|
||||
strcmpX( r1->Data.MINFO.pNameErrorsMailbox,
|
||||
r2->Data.MINFO.pNameErrorsMailbox, wide ))
|
||||
return FALSE;
|
||||
break;
|
||||
|
@ -194,7 +194,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
{
|
||||
if (r1->Data.MX.wPreference != r2->Data.MX.wPreference)
|
||||
return FALSE;
|
||||
if (dns_strcmpX( r1->Data.MX.pNameExchange,
|
||||
if (strcmpX( r1->Data.MX.pNameExchange,
|
||||
r2->Data.MX.pNameExchange, wide ))
|
||||
return FALSE;
|
||||
break;
|
||||
|
@ -208,7 +208,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
return FALSE;
|
||||
for (i = 0; i < r1->Data.TXT.dwStringCount; i++)
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.TXT.pStringArray[i],
|
||||
if (strcmpX( r1->Data.TXT.pStringArray[i],
|
||||
r2->Data.TXT.pStringArray[i], wide ))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
}
|
||||
case DNS_TYPE_SIG:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.SIG.pNameSigner,
|
||||
if (strcmpX( r1->Data.SIG.pNameSigner,
|
||||
r2->Data.SIG.pNameSigner, wide ))
|
||||
return FALSE;
|
||||
if (r1->Data.SIG.wTypeCovered != r2->Data.SIG.wTypeCovered ||
|
||||
|
@ -284,7 +284,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
}
|
||||
case DNS_TYPE_NXT:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.NXT.pNameNext,
|
||||
if (strcmpX( r1->Data.NXT.pNameNext,
|
||||
r2->Data.NXT.pNameNext, wide )) return FALSE;
|
||||
if (r1->Data.NXT.wNumTypes != r2->Data.NXT.wNumTypes) return FALSE;
|
||||
if (memcmp( r1->Data.NXT.wTypes, r2->Data.NXT.wTypes,
|
||||
|
@ -294,7 +294,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
}
|
||||
case DNS_TYPE_SRV:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.SRV.pNameTarget,
|
||||
if (strcmpX( r1->Data.SRV.pNameTarget,
|
||||
r2->Data.SRV.pNameTarget, wide )) return FALSE;
|
||||
if (r1->Data.SRV.wPriority != r2->Data.SRV.wPriority ||
|
||||
r1->Data.SRV.wWeight != r2->Data.SRV.wWeight ||
|
||||
|
@ -304,7 +304,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
}
|
||||
case DNS_TYPE_TKEY:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.TKEY.pNameAlgorithm,
|
||||
if (strcmpX( r1->Data.TKEY.pNameAlgorithm,
|
||||
r2->Data.TKEY.pNameAlgorithm, wide ))
|
||||
return FALSE;
|
||||
if (r1->Data.TKEY.dwCreateTime != r2->Data.TKEY.dwCreateTime ||
|
||||
|
@ -326,7 +326,7 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
}
|
||||
case DNS_TYPE_TSIG:
|
||||
{
|
||||
if (dns_strcmpX( r1->Data.TSIG.pNameAlgorithm,
|
||||
if (strcmpX( r1->Data.TSIG.pNameAlgorithm,
|
||||
r2->Data.TSIG.pNameAlgorithm, wide ))
|
||||
return FALSE;
|
||||
if (r1->Data.TSIG.i64CreateTime != r2->Data.TSIG.i64CreateTime ||
|
||||
|
@ -364,19 +364,19 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
|
|||
r1->Data.WINSR.dwLookupTimeout != r2->Data.WINSR.dwLookupTimeout ||
|
||||
r1->Data.WINSR.dwCacheTimeout != r2->Data.WINSR.dwCacheTimeout)
|
||||
return FALSE;
|
||||
if (dns_strcmpX( r1->Data.WINSR.pNameResultDomain,
|
||||
if (strcmpX( r1->Data.WINSR.pNameResultDomain,
|
||||
r2->Data.WINSR.pNameResultDomain, wide ))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME( "unknown type: %s\n", dns_type_to_str( r1->wType ) );
|
||||
FIXME( "unknown type: %s\n", type_to_str( r1->wType ) );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static LPVOID dns_strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
||||
static LPVOID strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
|
@ -384,9 +384,9 @@ static LPVOID dns_strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
|||
{
|
||||
switch (out)
|
||||
{
|
||||
case DnsCharSetUnicode: return dns_strdup_w( src );
|
||||
case DnsCharSetUtf8: return dns_strdup_wu( src );
|
||||
case DnsCharSetAnsi: return dns_strdup_wa( src );
|
||||
case DnsCharSetUnicode: return strdup_w( src );
|
||||
case DnsCharSetUtf8: return strdup_wu( src );
|
||||
case DnsCharSetAnsi: return strdup_wa( src );
|
||||
default:
|
||||
WARN( "unhandled target charset: %d\n", out );
|
||||
break;
|
||||
|
@ -396,9 +396,9 @@ static LPVOID dns_strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
|||
case DnsCharSetUtf8:
|
||||
switch (out)
|
||||
{
|
||||
case DnsCharSetUnicode: return dns_strdup_uw( src );
|
||||
case DnsCharSetUtf8: return dns_strdup_u( src );
|
||||
case DnsCharSetAnsi: return dns_strdup_ua( src );
|
||||
case DnsCharSetUnicode: return strdup_uw( src );
|
||||
case DnsCharSetUtf8: return strdup_u( src );
|
||||
case DnsCharSetAnsi: return strdup_ua( src );
|
||||
default:
|
||||
WARN( "unhandled target charset: %d\n", out );
|
||||
break;
|
||||
|
@ -407,9 +407,9 @@ static LPVOID dns_strcpyX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
|
|||
case DnsCharSetAnsi:
|
||||
switch (out)
|
||||
{
|
||||
case DnsCharSetUnicode: return dns_strdup_aw( src );
|
||||
case DnsCharSetUtf8: return dns_strdup_au( src );
|
||||
case DnsCharSetAnsi: return dns_strdup_a( src );
|
||||
case DnsCharSetUnicode: return strdup_aw( src );
|
||||
case DnsCharSetUtf8: return strdup_au( src );
|
||||
case DnsCharSetAnsi: return strdup_a( src );
|
||||
default:
|
||||
WARN( "unhandled target charset: %d\n", out );
|
||||
break;
|
||||
|
@ -444,7 +444,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
src->Flags.S.CharSet == DnsCharSetUnicode) in = src->Flags.S.CharSet;
|
||||
|
||||
dst->Flags.S.CharSet = out;
|
||||
dst->pName = dns_strcpyX( src->pName, in, out );
|
||||
dst->pName = strcpyX( src->pName, in, out );
|
||||
if (!dst->pName) goto error;
|
||||
|
||||
switch (src->wType)
|
||||
|
@ -456,9 +456,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
{
|
||||
for (i = 0; i < src->Data.TXT.dwStringCount; i++)
|
||||
{
|
||||
dst->Data.TXT.pStringArray[i] =
|
||||
dns_strcpyX( src->Data.TXT.pStringArray[i], in, out );
|
||||
|
||||
dst->Data.TXT.pStringArray[i] = strcpyX( src->Data.TXT.pStringArray[i], in, out );
|
||||
if (!dst->Data.TXT.pStringArray[i])
|
||||
{
|
||||
while (i > 0) heap_free( dst->Data.TXT.pStringArray[--i] );
|
||||
|
@ -470,12 +468,10 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
case DNS_TYPE_MINFO:
|
||||
case DNS_TYPE_RP:
|
||||
{
|
||||
dst->Data.MINFO.pNameMailbox =
|
||||
dns_strcpyX( src->Data.MINFO.pNameMailbox, in, out );
|
||||
dst->Data.MINFO.pNameMailbox = strcpyX( src->Data.MINFO.pNameMailbox, in, out );
|
||||
if (!dst->Data.MINFO.pNameMailbox) goto error;
|
||||
|
||||
dst->Data.MINFO.pNameErrorsMailbox =
|
||||
dns_strcpyX( src->Data.MINFO.pNameErrorsMailbox, in, out );
|
||||
dst->Data.MINFO.pNameErrorsMailbox = strcpyX( src->Data.MINFO.pNameErrorsMailbox, in, out );
|
||||
if (!dst->Data.MINFO.pNameErrorsMailbox)
|
||||
{
|
||||
heap_free( dst->Data.MINFO.pNameMailbox );
|
||||
|
@ -492,8 +488,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
case DNS_TYPE_RT:
|
||||
case DNS_TYPE_MX:
|
||||
{
|
||||
dst->Data.MX.pNameExchange =
|
||||
dns_strcpyX( src->Data.MX.pNameExchange, in, out );
|
||||
dst->Data.MX.pNameExchange = strcpyX( src->Data.MX.pNameExchange, in, out );
|
||||
if (!dst->Data.MX.pNameExchange) goto error;
|
||||
|
||||
dst->wDataLength = sizeof(dst->Data.MX);
|
||||
|
@ -503,8 +498,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
}
|
||||
case DNS_TYPE_NXT:
|
||||
{
|
||||
dst->Data.NXT.pNameNext =
|
||||
dns_strcpyX( src->Data.NXT.pNameNext, in, out );
|
||||
dst->Data.NXT.pNameNext = strcpyX( src->Data.NXT.pNameNext, in, out );
|
||||
if (!dst->Data.NXT.pNameNext) goto error;
|
||||
|
||||
dst->wDataLength = sizeof(dst->Data.NXT);
|
||||
|
@ -521,8 +515,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
case DNS_TYPE_NS:
|
||||
case DNS_TYPE_PTR:
|
||||
{
|
||||
dst->Data.PTR.pNameHost =
|
||||
dns_strcpyX( src->Data.PTR.pNameHost, in, out );
|
||||
dst->Data.PTR.pNameHost = strcpyX( src->Data.PTR.pNameHost, in, out );
|
||||
if (!dst->Data.PTR.pNameHost) goto error;
|
||||
|
||||
dst->wDataLength = sizeof(dst->Data.PTR);
|
||||
|
@ -532,8 +525,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
}
|
||||
case DNS_TYPE_SIG:
|
||||
{
|
||||
dst->Data.SIG.pNameSigner =
|
||||
dns_strcpyX( src->Data.SIG.pNameSigner, in, out );
|
||||
dst->Data.SIG.pNameSigner = strcpyX( src->Data.SIG.pNameSigner, in, out );
|
||||
if (!dst->Data.SIG.pNameSigner) goto error;
|
||||
|
||||
dst->wDataLength = sizeof(dst->Data.SIG);
|
||||
|
@ -543,12 +535,10 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
}
|
||||
case DNS_TYPE_SOA:
|
||||
{
|
||||
dst->Data.SOA.pNamePrimaryServer =
|
||||
dns_strcpyX( src->Data.SOA.pNamePrimaryServer, in, out );
|
||||
dst->Data.SOA.pNamePrimaryServer = strcpyX( src->Data.SOA.pNamePrimaryServer, in, out );
|
||||
if (!dst->Data.SOA.pNamePrimaryServer) goto error;
|
||||
|
||||
dst->Data.SOA.pNameAdministrator =
|
||||
dns_strcpyX( src->Data.SOA.pNameAdministrator, in, out );
|
||||
dst->Data.SOA.pNameAdministrator = strcpyX( src->Data.SOA.pNameAdministrator, in, out );
|
||||
if (!dst->Data.SOA.pNameAdministrator)
|
||||
{
|
||||
heap_free( dst->Data.SOA.pNamePrimaryServer );
|
||||
|
@ -563,8 +553,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
}
|
||||
case DNS_TYPE_SRV:
|
||||
{
|
||||
dst->Data.SRV.pNameTarget =
|
||||
dns_strcpyX( src->Data.SRV.pNameTarget, in, out );
|
||||
dst->Data.SRV.pNameTarget = strcpyX( src->Data.SRV.pNameTarget, in, out );
|
||||
if (!dst->Data.SRV.pNameTarget) goto error;
|
||||
|
||||
dst->wDataLength = sizeof(dst->Data.SRV);
|
||||
|
|
Loading…
Reference in New Issue