About WTSEnumerateSessions

Hi there,

I try to use the API Function WTSEnumerateSessions to get a list of Terminal Server Sessions.
Of course, it doesn't work quite well, so any help would be highly appreciated.

Look at the here-attached piece of code.
At line 64, replace "TerminalServerName" by a valid one and see what happen.
Apparently we have a valid handle to the server, the WTSEnumerateSessions returns the correct number of sessions, but I can't analyze the list of SessionId/Name/State.

WTS3.p5.3 KB