| INT WINAPI DnsGetRecord(
|
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszHostName, |
|
| |
INT nRecordType, |
|
| |
LPTSTR lpszBuffer, |
|
| |
INT nMaxLength |
|
| );
|
The DnsGetRecord function returns the specified record
information for the given hostname.
Parameters
- hClient
- Handle to the client session.
- lpszHostName
- Pointer to the string which specifies the host name that
information will be returned for.
- nRecordType
- The record type for the information that should be returned.
The following record types are recognized:
| Value |
Constant |
Description |
| 0 |
DNS_RECORD_NONE |
No record type |
| 1 |
DNS_RECORD_ADDRESS |
IPv4 host address |
| 2 |
DNS_RECORD_NS |
Authoritative nameserver |
| 5 |
DNS_RECORD_CNAME |
Canonical host name (alias) |
| 6 |
DNS_RECORD_SOA |
Start of Authority |
| 11 |
DNS_RECORD_WKS |
Well known services |
| 12 |
DNS_RECORD_PTR |
Domain name |
| 13 |
DNS_RECORD_HINFO |
Host information |
| 14 |
DNS_RECORD_MINFO |
Mailbox information |
| 15 |
DNS_RECORD_MX |
Mail exchange host |
| 16 |
DNS_RECORD_TXT |
Text strings |
| 28 |
DNS_RECORD_AAAA |
IPv6 host address |
| 29 |
DNS_RECORD_LOC |
Location information |
| 100 |
DNS_RECORD_UINFO |
User information |
| 101 |
DNS_RECORD_UID |
User ID |
| 102 |
DNS_RECORD_GID |
Group ID |
- lpszBuffer
- Pointer to the buffer which will contain the host information
returned by the nameserver.
- nMaxLength
- Maximum number of characters that may be copied into the
specified buffer, including the null-byte terminator.
Return Value
If the function succeeds, the length of the information buffer
is returned. A return value of zero indicates that no information
for that record is available for the specified host. If the
function fails, the return value is DNS_ERROR. To get extended
error information, call DnsGetLastError.
Remarks
The DnsGetRecord function can be used to resolve a host
name into an IPv4 address using the record type DNS_RECORD_ADDRESS,
or an IPv6 address using the record type DNS_RECORD_AAAA. It can
also be used to perform a reverse lookup and resolve an IP address
into a host name by using the record type DNS_RECORD_PTR.
To determine the host that serves as the primary or master DNS
for a zone, the record name should be specified as the domain name
(e.g.: microsoft.com) and the record type should be DNS_RECORD_SOA.
The value returned will the fully qualified domain name for
host.
Note that this function does not reference a local host file
when resolving host names or addresses. If the record lookup fails,
this function will return an error even if there's an entry for the
host in the file that has been specified by a call to
DnsSetHostFile.
Requirements
Client: Requires Windows 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use csdnsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
DnsGetHostAddress, DnsGetHostName, DnsGetHostInfo, DnsGetHostServices, DnsGetMailExchange, DnsGetResolverAddress, DnsRegisterServer
|