IcmpResolveAddress Function  
 
INT WINAPI IcmpResolveAddress(
  DWORD dwAddress,  
  LPTSTR lpszHostName,  
  INT nMaxLength  
);

The IcmpResolveAddress function resolves a numeric IP address into a fully qualified domain name.

Parameters

dwAddress
The IP address to be resolved, specified as an unsigned 32-bit integer in network byte order.
lpszHostName
A buffer that will contain a null-terminated string that specifies the fully qualified domain name for the host. It is recommended that this buffer be at least 64 characters in length.
nMaxLength
The maximum number of characters that can be copied into the string buffer, including the terminating null character.

Return Value

If the function succeeds, the return value is the length of the host name. If the function fails, the return value is ICMP_ERROR. To get extended error information, call IcmpGetLastError.

Remarks

The IcmpResolveAddress function is used to perform a reverse DNS lookup, converting a numeric IP address into a fully qualified domain name. This is useful for functions like IcmpTraceRoute, which return host addresses as numeric values in network byte order. If the reverse DNS lookup fails because there is no PTR record for the given IP address, a printable form of the address in dotted notation will be returned in the string buffer.

Calling this function will cause the thread to block until the IP address is resolved, or until the DNS query times out because there is no reverse record for the address. In some cases, a reverse lookup can take several seconds.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csicmv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also