Directory Services


The DsAddressToSiteNames function obtains the site names corresponding to the specified addresses.

DWORD DsAddressToSiteNames(
  LPCTSTR ComputerName,
  DWORD EntryCount,
  PSOCKET_ADDRESS SocketAddresses,
  LPTSTR** SiteNames


[in, optional] Pointer to a null-terminated string that specifies the name of the remote server to process this function. This parameter must be the name of a domain controller. A non-domain controller can call this function by calling DsGetDcName to find the domain controller.
[in] Contains the number of elements in the SocketAddresses array.
[in] Contains an array of SOCKET_ADDRESS structures that contain the addresses to convert. Each address in this array must be of the type AF_INET. EntryCount contains the number of elements in this array.
[out] Receives an array of null-terminated string pointers that contain the site names for the addresses. Each element in this array corresponds to the same element in the SocketAddresses array. An element is NULL if the corresponding address does not map to any known site or if the address entry is not of the proper form. The caller must free this array when it is no longer required by calling NetApiBufferFree.

Return Values

Returns NO_ERROR if successful or a Win32 or RPC error otherwise. The following table lists possible error codes.
Return Code Description
ERROR_INVALID_PARAMETER One or more parameters are invalid.
ERROR_NOT_ENOUGH_MEMORY A memory allocation failure occurred.


Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Unicode: Implemented as Unicode and ANSI versions.
Header: Declared in Dsgetdc.h.
Library: Use Netapi32.lib.

See Also

DsGetDcName, NetApiBufferFree, DsAddressToSiteNamesEx, Directory Service Functions