|
|
| BOOL
MatchHostName(
|
|
|
LPCTSTR
lpszHostName, |
|
|
|
LPCTSTR
lpszHostMask |
|
|
|
BOOL bResolve |
|
| );
|
The MatchHostName method matches a host name against one
more strings that may contain wildcards.
Parameters
- lpszHostName
- A pointer to a null-terminated string which specifies the host
name or IP address to match.
- lpszHostMask
- A pointer to a null-terminated string which specifies one or
more values to match against the host name. The asterisk character
can be used to match any number of characters in the host name, and
the question mark can be used to match any single character.
Multiple values may be specified by separating them with a
semicolon.
- bResolve
- A boolean value which specifies if the host name or IP address
should be resolved when matching the host against the mask string.
If this parameter is non-zero, two checks against the host mask
string will be performed; once for the host name specified and once
for its IP address. If this parameter is zero, then the match is
made only against the host name string provided.
Return Value
If the method succeeds, the return value is non-zero. If the
method fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
The MatchHostName method provides a convenient way for an
application to determine if a given host name matches one or more
mask strings which may contain wildcard characters. For example,
the host name could be "www.microsoft.com" and the host mask string
could be "*.microsoft.com". In this example, the method would
return a non-zero value indicating the host name matched the mask.
However, if the mask string was "*.net" then the method would
return zero, indicating that there was no match. Multiple mask
values can be combined by separating them with a semicolon; for
example, the mask "*.com;*.org" would match any host name in either
the .com or .org top-level domains.
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 cstools6.h.
Library: Use csdnsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
GetAddress, GetHostAddress, GetHostName, GetLocalAddress
|
|