| |
| INT WINAPI DnsGetHostName(
|
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszHostAddress, |
|
| |
LPTSTR lpszHostName, |
|
| |
INT nMaxLength |
|
| );
|
The DnsGetHostName function resolves the specified IP
address, storing the fully qualified host name in the provided
buffer.
Parameters
- hClient
- Handle to the client session.
- lpszHostAddress
- Pointer to a null-terminated string that specifies an IPv4 or
IPv6 formatted address.
- lpszHostName
- Pointer to the buffer that will contain the fully qualified
domain name for the specified host. This buffer should be at least
64 characters in length.
- nMaxLength
- The maximum length of the string buffer.
Return Value
If the function succeeds, the return value is the number of
characters copied into the host name buffer. If the function fails,
the return value is DNS_ERROR. To get extended error information,
call DnsGetLastError.
Remarks
The DnsGetHostName function first looks to see if there
is an entry in the local host file for the specified IP address,
and if one exists, it will return the host name for that address.
If you do not want to use the local host file at all, and only
return an host name if a DNS query resolves the address, use the
DnsGetRecord function and specify a record type of
DNS_RECORD_PTR.
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
DnsEnumHostAliases,
DnsGetHostByAddress,
DnsGetHostByName, DnsGetHostAddress
|
|