Author: spetreolle
Date: Fri Jul 9 20:56:12 2010
New Revision: 47982
URL:
http://svn.reactos.org/svn/reactos?rev=47982&view=rev
Log:
Import DnsNameCompare, DnsValidateName, DnsRecord* functions from Wine.
Fixes dnsapi:name tests.
Patch by Samuel Serapion.
Modified:
trunk/reactos/dll/win32/dnsapi/dnsapi.rbuild
trunk/reactos/dll/win32/dnsapi/dnsapi/free.c
trunk/reactos/dll/win32/dnsapi/dnsapi/names.c
trunk/reactos/dll/win32/dnsapi/dnsapi/precomp.h
trunk/reactos/dll/win32/dnsapi/dnsapi/stubs.c
trunk/reactos/include/psdk/windns.h
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi.rb…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi.rbuild [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -15,6 +15,7 @@
<file>free.c</file>
<file>names.c</file>
<file>query.c</file>
+ <file>record.c</file>
<file>stubs.c</file>
<pch>precomp.h</pch>
</directory>
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/free.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/fr…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi/free.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi/free.c [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -33,9 +33,3 @@
}
}
-VOID WINAPI
-DnsRecordListFree(PDNS_RECORD Data,
- DNS_FREE_TYPE FreeType)
-{
- DnsFree(Data, FreeType);
-}
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/names.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/na…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi/names.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi/names.c [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -1,218 +1,234 @@
+/*
+ * DNS support
+ *
+ * Copyright (C) 2006 Matthew Kehrer
+ * Copyright (C) 2006 Hans Leidekker
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
#include "precomp.h"
#define NDEBUG
#include <debug.h>
-static BOOL
-DnsIntNameContainsDots(LPCWSTR Name)
-{
- return wcschr(Name, '.') ? TRUE : FALSE;
-}
-
-static BOOL
-DnsIntTwoConsecutiveDots(LPCWSTR Name)
-{
- return wcsstr(Name, L"..") ? TRUE : FALSE;
-}
-
-static BOOL
-DnsIntContainsUnderscore(LPCWSTR Name)
-{
- return wcschr(Name, '_') ? TRUE : FALSE;
-}
-
-/* DnsValidateName *********************
- * Use some different algorithms to validate the given name as suitable for
- * use with DNS.
- *
- * Name -- The name to evaluate.
- * Format -- Format to use:
- * DnsNameDomain
- * DnsNameDomainLabel
- * DnsNameHostnameFull
- * DnsNameHostnameLabel
- * DnsNameWildcard
- * DnsNameSrvRecord
- * RETURNS:
- * ERROR_SUCCESS -- All good
- * ERROR_INVALID_NAME --
- * Name greater than 255 chars.
- * Label greater than 63 chars.
- * Two consecutive dots, or starts with dot.
- * Contains a dot, but a Label check was specified.
- * DNS_ERROR_INVALID_NAME_CHAR
- * Contains any invalid char: " {|}~[\]^':;<=>?@!"#$%^`()+/,"
- * Contains an *, except when it is the first label and Wildcard was
- * specified.
- * DNS_ERROR_NUMERIC_NAME
- * Set if the name contains only numerics, unless Domain is specified.
- * DNS_ERROR_NON_RFC_NAME
- * If the name contains underscore.
- * If there is an underscore in any position but the first in the SrvRecord
- * case.
- * If the name contains a non-ascii character.
- */
-
-DNS_STATUS WINAPI
-DnsValidateName_W(LPCWSTR Name,
- DNS_NAME_FORMAT Format)
-{
- BOOL AllowDot = FALSE;
- BOOL AllowLeadingAst = FALSE;
- BOOL AllowLeadingUnderscore = FALSE;
- BOOL AllowAllDigits = FALSE;
- const WCHAR *NextLabel, *CurrentLabel, *CurrentChar;
-
- switch(Format)
- {
- case DnsNameDomain:
- AllowAllDigits = TRUE;
- AllowDot = TRUE;
- break;
-
- case DnsNameDomainLabel:
- AllowAllDigits = TRUE;
- break;
-
- case DnsNameHostnameFull:
- AllowDot = TRUE;
- break;
-
- case DnsNameHostnameLabel:
- break;
-
- case DnsNameWildcard:
- AllowLeadingAst = TRUE;
- AllowDot = TRUE;
- break;
-
- case DnsNameSrvRecord:
- AllowLeadingUnderscore = TRUE;
- break;
-
- default:
- break;
- }
-
- /* Preliminary checks */
- if(Name[0] == 0)
- return ERROR_INVALID_NAME; /* XXX arty: Check this */
-
- /* Name too long */
- if(wcslen(Name) > 255)
- return ERROR_INVALID_NAME;
-
- /* Violations about dots */
- if((!AllowDot && DnsIntNameContainsDots(Name)) || Name[0] == '.' ||
DnsIntTwoConsecutiveDots(Name))
- return ERROR_INVALID_NAME;
-
- /* Check component sizes */
- CurrentLabel = Name;
-
- do
- {
- NextLabel = CurrentLabel;
- while(*NextLabel && *NextLabel != '.')
- NextLabel++;
-
- if(NextLabel - CurrentLabel > 63)
+/******************************************************************************
+ * DnsNameCompare_A [DNSAPI.@]
+ *
+ */
+BOOL WINAPI DnsNameCompare_A( LPCSTR name1, LPCSTR name2 )
+{
+ BOOL ret;
+ PWSTR name1W, name2W;
+
+ name1W = dns_strdup_aw( name1 );
+ name2W = dns_strdup_aw( name2 );
+
+ ret = DnsNameCompare_W( name1W, name2W );
+
+ HeapFree(GetProcessHeap(), 0, name1W );
+ HeapFree(GetProcessHeap(), 0, name2W );
+
+ return ret;
+}
+
+/******************************************************************************
+ * DnsNameCompare_W [DNSAPI.@]
+ *
+ */
+BOOL WINAPI DnsNameCompare_W( PCWSTR name1, PCWSTR name2 )
+{
+ PCWSTR p, q;
+
+ if (!name1 && !name2) return TRUE;
+ if (!name1 || !name2) return FALSE;
+
+ p = name1 + lstrlenW( name1 ) - 1;
+ q = name2 + lstrlenW( name2 ) - 1;
+
+ while (*p == '.' && p >= name1) p--;
+ while (*q == '.' && q >= name2) q--;
+
+ if (p - name1 != q - name2) return FALSE;
+
+ while (name1 <= p)
+ {
+ if (towupper( *name1 ) != towupper( *name2 ))
+ return FALSE;
+
+ name1++;
+ name2++;
+ }
+ return TRUE;
+}
+
+/******************************************************************************
+ * DnsValidateName_A [DNSAPI.@]
+ *
+ */
+DNS_STATUS WINAPI DnsValidateName_A( PCSTR name, DNS_NAME_FORMAT format )
+{
+ PWSTR nameW;
+ DNS_STATUS ret;
+
+ nameW = dns_strdup_aw( name );
+ ret = DnsValidateName_W( nameW, format );
+
+ HeapFree(GetProcessHeap(), 0, nameW );
+ return ret;
+}
+
+/******************************************************************************
+ * DnsValidateName_UTF8 [DNSAPI.@]
+ *
+ */
+DNS_STATUS WINAPI DnsValidateName_UTF8( PCSTR name, DNS_NAME_FORMAT format )
+{
+ PWSTR nameW;
+ DNS_STATUS ret;
+
+ nameW = dns_strdup_uw( name );
+ ret = DnsValidateName_W( nameW, format );
+
+ HeapFree(GetProcessHeap(), 0, nameW );
+ return ret;
+}
+
+#define HAS_EXTENDED 0x0001
+#define HAS_NUMERIC 0x0002
+#define HAS_NON_NUMERIC 0x0004
+#define HAS_DOT 0x0008
+#define HAS_DOT_DOT 0x0010
+#define HAS_SPACE 0x0020
+#define HAS_INVALID 0x0040
+#define HAS_ASTERISK 0x0080
+#define HAS_UNDERSCORE 0x0100
+#define HAS_LONG_LABEL 0x0200
+
+/******************************************************************************
+ * DnsValidateName_W [DNSAPI.@]
+ *
+ */
+DNS_STATUS WINAPI DnsValidateName_W( PCWSTR name, DNS_NAME_FORMAT format )
+{
+ PCWSTR p;
+ unsigned int i, j, state = 0;
+ static const WCHAR invalid[] = {
+
'{','|','}','~','[','\\',']','^','\'',':',';','<','=','>',
+
'?','@','!','\"','#','$','%','^','`','(',')','+','/',',',0
};
+
+ if (!name) return ERROR_INVALID_NAME;
+
+ for (p = name, i = 0, j = 0; *p; p++, i++, j++)
+ {
+ if (*p == '.')
+ {
+ j = 0;
+ state |= HAS_DOT;
+ if (p[1] == '.') state |= HAS_DOT_DOT;
+ }
+ else if (*p < '0' || *p > '9') state |= HAS_NON_NUMERIC;
+ else state |= HAS_NUMERIC;
+
+ if (j > 62) state |= HAS_LONG_LABEL;
+
+ if (wcschr( invalid, *p )) state |= HAS_INVALID;
+ else if ((unsigned)*p > 127) state |= HAS_EXTENDED;
+ else if (*p == ' ') state |= HAS_SPACE;
+ else if (*p == '_') state |= HAS_UNDERSCORE;
+ else if (*p == '*') state |= HAS_ASTERISK;
+ }
+
+ if (i == 0 || i > 255 ||
+ (state & HAS_LONG_LABEL) ||
+ (state & HAS_DOT_DOT) ||
+ (name[0] == '.' && name[1])) return ERROR_INVALID_NAME;
+
+ switch (format)
+ {
+ case DnsNameDomain:
+ {
+ if (!(state & HAS_NON_NUMERIC) && (state & HAS_NUMERIC))
+ return DNS_ERROR_NUMERIC_NAME;
+ if ((state & HAS_EXTENDED) || (state & HAS_UNDERSCORE))
+ return DNS_ERROR_NON_RFC_NAME;
+ if ((state & HAS_SPACE) ||
+ (state & HAS_INVALID) ||
+ (state & HAS_ASTERISK)) return DNS_ERROR_INVALID_NAME_CHAR;
+ break;
+ }
+ case DnsNameDomainLabel:
+ {
+ if (state & HAS_DOT) return ERROR_INVALID_NAME;
+ if ((state & HAS_EXTENDED) || (state & HAS_UNDERSCORE))
+ return DNS_ERROR_NON_RFC_NAME;
+ if ((state & HAS_SPACE) ||
+ (state & HAS_INVALID) ||
+ (state & HAS_ASTERISK)) return DNS_ERROR_INVALID_NAME_CHAR;
+ break;
+ }
+ case DnsNameHostnameFull:
+ {
+ if (!(state & HAS_NON_NUMERIC) && (state & HAS_NUMERIC))
+ return DNS_ERROR_NUMERIC_NAME;
+ if ((state & HAS_EXTENDED) || (state & HAS_UNDERSCORE))
+ return DNS_ERROR_NON_RFC_NAME;
+ if ((state & HAS_SPACE) ||
+ (state & HAS_INVALID) ||
+ (state & HAS_ASTERISK)) return DNS_ERROR_INVALID_NAME_CHAR;
+ break;
+ }
+ case DnsNameHostnameLabel:
+ {
+ if (state & HAS_DOT) return ERROR_INVALID_NAME;
+ if (!(state & HAS_NON_NUMERIC) && (state & HAS_NUMERIC))
+ return DNS_ERROR_NUMERIC_NAME;
+ if ((state & HAS_EXTENDED) || (state & HAS_UNDERSCORE))
+ return DNS_ERROR_NON_RFC_NAME;
+ if ((state & HAS_SPACE) ||
+ (state & HAS_INVALID) ||
+ (state & HAS_ASTERISK)) return DNS_ERROR_INVALID_NAME_CHAR;
+ break;
+ }
+ case DnsNameWildcard:
+ {
+ if (!(state & HAS_NON_NUMERIC) && (state & HAS_NUMERIC))
return ERROR_INVALID_NAME;
-
- CurrentLabel = NextLabel;
- } while(*CurrentLabel);
-
- CurrentChar = Name;
-
- while(*CurrentChar)
- {
- if(wcschr(L"
{|}~[\\]^':;<=>?@!\"#$%^`()+/,",*CurrentChar))
+ if (name[0] != '*') return ERROR_INVALID_NAME;
+ if (name[1] && name[1] != '.')
return DNS_ERROR_INVALID_NAME_CHAR;
-
- CurrentChar++;
- }
-
- if((!AllowLeadingAst && Name[0] == '*') || (AllowLeadingAst
&& Name[0] == '*' && Name[1] && Name[1] != '.'))
- return DNS_ERROR_INVALID_NAME_CHAR;
-
- if(wcschr(Name + 1, '*'))
- return DNS_ERROR_INVALID_NAME_CHAR;
-
- CurrentChar = Name;
-
- while(!AllowAllDigits && *CurrentChar)
- {
- if(*CurrentChar == '.' || (*CurrentChar >= '0' &&
*CurrentChar <= '9'))
- return DNS_ERROR_NUMERIC_NAME;
- }
-
- if(((AllowLeadingUnderscore && Name[0] == '_') || Name[0] !=
'_') && !DnsIntContainsUnderscore(Name + 1))
- return DNS_ERROR_NON_RFC_NAME;
-
+ if ((state & HAS_EXTENDED) ||
+ (state & HAS_SPACE) ||
+ (state & HAS_INVALID)) return ERROR_INVALID_NAME;
+ break;
+ }
+ case DnsNameSrvRecord:
+ {
+ if (!(state & HAS_NON_NUMERIC) && (state & HAS_NUMERIC))
+ return ERROR_INVALID_NAME;
+ if (name[0] != '_') return ERROR_INVALID_NAME;
+ if ((state & HAS_UNDERSCORE) && !name[1])
+ return DNS_ERROR_NON_RFC_NAME;
+ if ((state & HAS_EXTENDED) ||
+ (state & HAS_SPACE) ||
+ (state & HAS_INVALID)) return ERROR_INVALID_NAME;
+ break;
+ }
+ default:
+ DPRINT1( "unknown format: %d\n", format );
+ break;
+ }
return ERROR_SUCCESS;
}
-
-DNS_STATUS WINAPI
-DnsValidateName_UTF8(LPCSTR Name,
- DNS_NAME_FORMAT Format)
-{
- PWCHAR Buffer;
- int StrLenWc;
- DNS_STATUS Status;
-
- StrLenWc = mbstowcs(NULL, Name, 0);
- Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(WCHAR) * (StrLenWc + 1));
- mbstowcs(Buffer, Name, StrLenWc + 1);
- Status = DnsValidateName_W(Buffer, Format);
- RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
-
- return Status;
-}
-
-DNS_STATUS WINAPI
-DnsValidateName_A(LPCSTR Name,
- DNS_NAME_FORMAT Format)
-{
- return DnsValidateName_UTF8(Name, Format);
-}
-
-/* DnsNameCompare **********************
- * Return TRUE if the names are identical.
- *
- * Name1 & Name2 -- Names.
- */
-BOOL WINAPI
-DnsNameCompare_W(LPWSTR Name1,
- LPWSTR Name2)
-{
- int offset = 0;
-
- while(Name1[offset] && Name2[offset] && towupper(Name1[offset]) ==
towupper(Name2[offset]))
- offset++;
-
- return
- (!Name1[offset] && !Name2[offset]) ||
- (!Name1[offset] && !wcscmp(Name2 + offset, L".")) ||
- (!Name2[offset] && !wcscmp(Name1 + offset, L"."));
-}
-
-BOOL WINAPI
-DnsNameCompare_UTF8(LPCSTR Name1,
- LPCSTR Name2)
-{
- int offset = 0;
-
- while(Name1[offset] && Name2[offset] && toupper(Name1[offset]) ==
toupper(Name2[offset]))
- offset++;
-
- return
- (!Name1[offset] && !Name2[offset]) ||
- (!Name1[offset] && !strcmp(Name2 + offset, ".")) ||
- (!Name2[offset] && !strcmp(Name1 + offset, "."));
-}
-
-BOOL WINAPI
-DnsNameCompare_A(LPSTR Name1,
- LPSTR Name2)
-{
- return DnsNameCompare_UTF8(Name1, Name2);
-}
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/pr…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi/precomp.h [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -20,3 +20,106 @@
/* Internal DNSAPI Headers */
#include <internal/windns.h>
+static inline LPWSTR dns_strdup_uw( const char *str )
+{
+ LPWSTR ret = NULL;
+ if (str)
+ {
+ DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
+ if ((ret = HeapAlloc(GetProcessHeap(),0,( len * sizeof(WCHAR) ))))
+ MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
+ }
+ return ret;
+}
+
+static inline LPWSTR dns_strdup_aw( LPCSTR str )
+{
+ LPWSTR ret = NULL;
+ if (str)
+ {
+ DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
+ if ((ret = HeapAlloc(GetProcessHeap(), 0, ( len * sizeof(WCHAR) ))))
+ MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
+ }
+ return ret;
+}
+
+static inline LPSTR dns_strdup_a( LPCSTR src )
+{
+ LPSTR dst;
+
+ if (!src) return NULL;
+ dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenA( src ) + 1) * sizeof(char) );
+ if (dst) lstrcpyA( dst, src );
+ return dst;
+}
+
+static inline char *dns_strdup_u( const char *src )
+{
+ char *dst;
+
+ if (!src) return NULL;
+ dst = HeapAlloc(GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) );
+ if (dst) strcpy( dst, src );
+ return dst;
+}
+
+static inline LPWSTR dns_strdup_w( LPCWSTR src )
+{
+ LPWSTR dst;
+
+ if (!src) return NULL;
+ dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) );
+ if (dst) lstrcpyW( dst, src );
+ return dst;
+}
+
+static inline LPSTR dns_strdup_wa( LPCWSTR str )
+{
+ LPSTR ret = NULL;
+ if (str)
+ {
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
+ if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
+ WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
+ }
+ return ret;
+}
+
+static inline char *dns_strdup_wu( LPCWSTR str )
+{
+ LPSTR ret = NULL;
+ if (str)
+ {
+ DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
+ if ((ret = HeapAlloc(GetProcessHeap(), 0, len )))
+ WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
+ }
+ return ret;
+}
+
+static inline char *dns_strdup_au( LPCSTR src )
+{
+ char *dst = NULL;
+ LPWSTR ret = dns_strdup_aw( src );
+
+ if (ret)
+ {
+ dst = dns_strdup_wu( ret );
+ HeapFree( GetProcessHeap(), 0, ret );
+ }
+ return dst;
+}
+
+static inline LPSTR dns_strdup_ua( const char *src )
+{
+ LPSTR dst = NULL;
+ LPWSTR ret = dns_strdup_uw( src );
+
+ if (ret)
+ {
+ dst = dns_strdup_wa( ret );
+ HeapFree( GetProcessHeap(), 0, ret );
+ }
+ return dst;
+}
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/st…
==============================================================================
--- trunk/reactos/dll/win32/dnsapi/dnsapi/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/dnsapi/dnsapi/stubs.c [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -561,49 +561,6 @@
{
UNIMPLEMENTED;
return ERROR_OUTOFMEMORY;
-}
-
-BOOL WINAPI
-DnsRecordCompare(PDNS_RECORD pRecord1,
- PDNS_RECORD pRecord2)
-{
- UNIMPLEMENTED;
- return ERROR_OUTOFMEMORY;
-}
-
-PDNS_RECORD WINAPI
-DnsRecordCopyEx(PDNS_RECORD pRecord,
- DNS_CHARSET CharSetIn,
- DNS_CHARSET CharSetOut)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
-BOOL WINAPI
-DnsRecordSetCompare(PDNS_RECORD pRR1,
- PDNS_RECORD pRR2,
- PDNS_RECORD* ppDiff1,
- PDNS_RECORD* ppDiff2)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-PDNS_RECORD WINAPI
-DnsRecordSetCopyEx(PDNS_RECORD pRecordSet,
- DNS_CHARSET CharSetIn,
- DNS_CHARSET CharSetOut)
-{
- UNIMPLEMENTED;
- return NULL;
-}
-
-PDNS_RECORD WINAPI
-DnsRecordSetDetach(PDNS_RECORD pRR)
-{
- UNIMPLEMENTED;
- return NULL;
}
DNS_STATUS WINAPI
Modified: trunk/reactos/include/psdk/windns.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/windns.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/windns.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/windns.h [iso-8859-1] Fri Jul 9 20:56:12 2010
@@ -34,62 +34,67 @@
#ifndef RC_INVOKE
typedef DWORD IP4_ADDRESS;
typedef DWORD DNS_STATUS;
-enum {
- DNS_TYPE_A=1,
- DNS_TYPE_NS,
- DNS_TYPE_MD,
- DNS_TYPE_MF,
- DNS_TYPE_CNAME,
- DNS_TYPE_SOA,
- DNS_TYPE_MB,
- DNS_TYPE_MG,
- DNS_TYPE_MR,
- DNS_TYPE_NULL,
- DNS_TYPE_WKS,
- DNS_TYPE_PTR,
- DNS_TYPE_HINFO,
- DNS_TYPE_MINFO,
- DNS_TYPE_MX,
- DNS_TYPE_TEXT,
- DNS_TYPE_RP,
- DNS_TYPE_AFSDB,
- DNS_TYPE_X25,
- DNS_TYPE_ISDN,
- DNS_TYPE_RT,
- DNS_TYPE_NSAP,
- DNS_TYPE_NSAPPTR,
- DNS_TYPE_SIG,
- DNS_TYPE_KEY,
- DNS_TYPE_PX,
- DNS_TYPE_GPOS,
- DNS_TYPE_AAAA,
- DNS_TYPE_LOC,
- DNS_TYPE_NXT,
- DNS_TYPE_EID,
- DNS_TYPE_NIMLOC,
- DNS_TYPE_SRV,
- DNS_TYPE_ATMA,
- DNS_TYPE_NAPTR,
- DNS_TYPE_KX,
- DNS_TYPE_CERT,
- DNS_TYPE_A6,
- DNS_TYPE_DNAME,
- DNS_TYPE_SINK,
- DNS_TYPE_OPT,
- DNS_TYPE_UINFO=100,
- DNS_TYPE_UID,
- DNS_TYPE_GID,
- DNS_TYPE_UNSPEC,
- DNS_TYPE_ADDRS=248,
- DNS_TYPE_TKEY,
- DNS_TYPE_TSIG,
- DNS_TYPE_IXFR,
- DNS_TYPE_AXFR,
- DNS_TYPE_MAILB,
- DNS_TYPE_MAILA,
- DNS_TYPE_ALL,
- DNS_TYPE_ANY=DNS_TYPE_ALL
-};
+#define DNS_TYPE_ZERO 0x0000
+
+#define DNS_TYPE_A 0x0001
+#define DNS_TYPE_NS 0x0002
+#define DNS_TYPE_MD 0x0003
+#define DNS_TYPE_MF 0x0004
+#define DNS_TYPE_CNAME 0x0005
+#define DNS_TYPE_SOA 0x0006
+#define DNS_TYPE_MB 0x0007
+#define DNS_TYPE_MG 0x0008
+#define DNS_TYPE_MR 0x0009
+#define DNS_TYPE_NULL 0x000a
+#define DNS_TYPE_WKS 0x000b
+#define DNS_TYPE_PTR 0x000c
+#define DNS_TYPE_HINFO 0x000d
+#define DNS_TYPE_MINFO 0x000e
+#define DNS_TYPE_MX 0x000f
+#define DNS_TYPE_TEXT 0x0010
+#define DNS_TYPE_RP 0x0011
+#define DNS_TYPE_AFSDB 0x0012
+#define DNS_TYPE_X25 0x0013
+#define DNS_TYPE_ISDN 0x0014
+#define DNS_TYPE_RT 0x0015
+#define DNS_TYPE_NSAP 0x0016
+#define DNS_TYPE_NSAPPTR 0x0017
+#define DNS_TYPE_SIG 0x0018
+#define DNS_TYPE_KEY 0x0019
+#define DNS_TYPE_PX 0x001a
+#define DNS_TYPE_GPOS 0x001b
+#define DNS_TYPE_AAAA 0x001c
+#define DNS_TYPE_LOC 0x001d
+#define DNS_TYPE_NXT 0x001e
+#define DNS_TYPE_EID 0x001f
+#define DNS_TYPE_NIMLOC 0x0020
+#define DNS_TYPE_SRV 0x0021
+#define DNS_TYPE_ATMA 0x0022
+#define DNS_TYPE_NAPTR 0x0023
+#define DNS_TYPE_KX 0x0024
+#define DNS_TYPE_CERT 0x0025
+#define DNS_TYPE_A6 0x0026
+#define DNS_TYPE_DNAME 0x0027
+#define DNS_TYPE_SINK 0x0028
+#define DNS_TYPE_OPT 0x0029
+#define DNS_TYPE_UINFO 0x0064
+#define DNS_TYPE_UID 0x0065
+#define DNS_TYPE_GID 0x0066
+#define DNS_TYPE_UNSPEC 0x0067
+#define DNS_TYPE_ADDRS 0x00f8
+#define DNS_TYPE_TKEY 0x00f9
+#define DNS_TYPE_TSIG 0x00fa
+#define DNS_TYPE_IXFR 0x00fb
+#define DNS_TYPE_AXFR 0x00fc
+#define DNS_TYPE_MAILB 0x00fd
+#define DNS_TYPE_MAILA 0x00fe
+#define DNS_TYPE_ALL 0x00ff
+#define DNS_TYPE_ANY 0x00ff
+
+#define DNS_TYPE_WINS 0xff01
+#define DNS_TYPE_WINSR 0xff02
+#define DNS_TYPE_NBSTAT (DNS_TYPE_WINSR)
+
typedef enum _DNS_CHARSET
{
DnsCharSetUnknown,
@@ -503,8 +508,8 @@
DNS_STATUS WINAPI
DnsModifyRecordsInSet_A(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
DNS_STATUS WINAPI
DnsModifyRecordsInSet_W(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
DNS_STATUS WINAPI
DnsModifyRecordsInSet_UTF8(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
-BOOL WINAPI DnsNameCompare_A(LPSTR,LPSTR);
-BOOL WINAPI DnsNameCompare_W(LPWSTR,LPWSTR);
+BOOL WINAPI DnsNameCompare_A(PCSTR,PCSTR);
+BOOL WINAPI DnsNameCompare_W(PCWSTR,PCWSTR);
DNS_STATUS WINAPI DnsQuery_A(PCSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);
DNS_STATUS WINAPI DnsQuery_W(PCWSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);
DNS_STATUS WINAPI DnsQuery_UTF8(PCSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);