Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves a list of sessions on a Remote Desktop Session Host (RD Session Host) server.
BOOL WTSEnumerateSessionsA(
[in] HANDLE hServer,
[in] DWORD Reserved,
[in] DWORD Version,
[out] PWTS_SESSION_INFOA *ppSessionInfo,
[out] DWORD *pCount
);
[in] hServer
A handle to the RD Session Host server.
[in] Reserved
This parameter is reserved. It must be zero.
[in] Version
The version of the enumeration request. This parameter must be 1.
[out] ppSessionInfo
A pointer to an array of WTS_SESSION_INFO structures that represent the retrieved sessions. To free the returned buffer, call the WTSFreeMemory function.
Session permissions:
[out] pCount
A pointer to the number of WTS_SESSION_INFO structures returned in the ppSessionInfo parameter.
Returns zero if this function fails. If this function succeeds, a nonzero value is returned.
To get extended error information, call GetLastError.
Note
The wtsapi32.h header defines WTSEnumerateSessions as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirement | Value |
---|---|
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Target Platform | Windows |
Header | wtsapi32.h |
Library | Wtsapi32.lib |
DLL | Wtsapi32.dll |
API set | ext-ms-win-session-wtsapi32-l1-1-0 (introduced in Windows 8) |
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!