| INT
InetGetHostFile(
|
|
|
LPTSTR
lpszFileName, |
|
|
|
INT
cchMaxLength |
|
| );
|
The InetGetHostFile function returns the name of the host
file previously set using the InetSetHostFile function. The
host file is used as a database that maps an IP address to one or
more hostnames, and is used by the InetGetHostAddress and
InetGetHostNames function.
Parameters
- lpszFileName
- Pointer to a null-terminated string buffer that will contain
the host file name. It is recommended that this buffer be at least
MAX_PATH characters in size. This parameter may be NULL, in which
case the function will return the length of the string, not
including the terminating null byte.
- cchMaxLength
- The maximum number of characters that may be copied to the
string buffer.
Return Value
If the function succeeds, the return value is length of the
string. A return value of zero indicates that no host file has been
specified or the function was unable to determine the file name. To
get extended error information, call InetGetLastError. If
the last error is zero, this indicates that no host file name has
been specified for the current thread. If the last error is
non-zero, this indicates the reason that the function failed.
Remarks
This function only returns the name of the host file that is
cached in memory for the current thread. The contents of the file
on the disk may have changed after the file was loaded into memory.
To reload the host file or clear the cache, call the
InetSetHostFile function.
If a host file has been specified, it is processed before the
default host file when resolving a hostname into an IP address, or
an IP address into a hostname. If the host name or address is not
found, or no host file has been specified, a nameserver lookup is
performed.
The host file returned by this function may be different than
the default host file for the local system. To determine the file
name for the default host file, use the
InetGetDefaultHostFile function.
Requirements
Client: Requires Windows Vista, Windows XP or Windows
2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or
Windows 2000 Server.
Header: Include cswsock6.h.
Library: Use cswskav6.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
InetGetDefaultHostFile, InetGetHostAddress, InetGetHostName, InetSetHostFile
|