4 * Copyright (C) 2006 Matthew Kehrer
5 * Copyright (C) 2006 Hans Leidekker
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/debug.h"
23 #include "wine/unicode.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dnsapi
);
37 /******************************************************************************
38 * DnsNameCompare_A [DNSAPI.@]
41 BOOL WINAPI
DnsNameCompare_A( LPSTR name1
, LPSTR name2
)
44 LPWSTR name1W
, name2W
;
46 TRACE( "(%s,%s)\n", debugstr_a(name1
), debugstr_a(name2
) );
48 name1W
= dns_strdup_aw( name1
);
49 name2W
= dns_strdup_aw( name2
);
51 ret
= DnsNameCompare_W( name1W
, name2W
);
59 /******************************************************************************
60 * DnsNameCompare_W [DNSAPI.@]
63 BOOL WINAPI
DnsNameCompare_W( LPWSTR name1
, LPWSTR name2
)
67 TRACE( "(%s,%s)\n", debugstr_w(name1
), debugstr_w(name2
) );
69 if (!name1
&& !name2
) return TRUE
;
70 if (!name1
|| !name2
) return FALSE
;
72 p
= name1
+ lstrlenW( name1
) - 1;
73 q
= name2
+ lstrlenW( name2
) - 1;
75 while (*p
== '.' && p
>= name1
) p
--;
76 while (*q
== '.' && q
>= name2
) q
--;
78 if (p
- name1
!= q
- name2
) return FALSE
;
82 if (toupperW( *name1
) != toupperW( *name2
))