Group: Terminal Services - Library: wtsapi32
How to enumerate terminal servers within the specified Windows domain
BOOL WTSEnumerateServers(
LPTSTR pDomainName,
DWORD Reserved,
DWORD Version,
PWTS_SERVER_INFO* ppServerInfo,
DWORD* pCount
);
DECLARE INTEGER WTSEnumerateServers IN Wtsapi32;
STRING pDomainName,;
LONG Reserved,;
LONG RqVersion,;
LONG @ppServerInfo,;
LONG @SICount
pDomainName [in] Pointer to the name of the Windows NT domain to be queried.
Reserved [in] Reserved. The value of this parameter must be 0.
Version [in] Version of the enumeration request. The value of the parameter must be 1.
ppServerInfo Points to an array of WTS_SERVER_INFO structures, which contains the returned results of the enumeration.
pCount Pointer to a variable that receives the number of WTS_SERVER_INFO structures returned in the ppServerInfo buffer.
If the function succeeds, the return value is a nonzero value.
If pDomainName is NULL, the specified domain is the current domain.
After use, the memory used by ppServerInfo should be freed by calling WTSFreeMemory.