Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
System Services
 WTSEnumerateSessions function
WTSEnumerateSessions function

Applies to: desktop apps only

Retrieves a list of sessions on a specified Remote Desktop Session Host (RD Session Host) server.

Syntax

BOOL WTSEnumerateSessions(
  __in   HANDLE hServer,
  __in   DWORD Reserved,
  __in   DWORD Version,
  __out  PWTS_SESSION_INFO *ppSessionInfo,
  __out  DWORD *pCount
);

Parameters

hServer [in]

A handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer or WTSOpenServerEx function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.

Reserved [in]

This parameter is reserved. It must be zero.

Version [in]

The version of the enumeration request. This parameter must be 1.

ppSessionInfo [out]

A pointer to a variable that receives a pointer to an array of WTS_SESSION_INFO structures. Each structure in the array contains information about a session on the specified RD Session Host server. To free the returned buffer, call the WTSFreeMemory function.

To enumerate a session, you must have Query Information permission. For more information, see Remote Desktop Services Permissions. To modify permissions on a session, use the Remote Desktop Services Configuration administrative tool.

To enumerate sessions running on a virtual machine hosted on a RD Virtualization Host server, you must be a member of the Administrators group on the RD Virtualization Host server.

pCount [out]

A pointer to the variable that receives the number of WTS_SESSION_INFO structures returned in the ppSessionInfo buffer.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wtsapi32.h

Library

Wtsapi32.lib

DLL

Wtsapi32.dll

Unicode and ANSI names

WTSEnumerateSessionsW (Unicode) and WTSEnumerateSessionsA (ANSI)

See also

WTS_SESSION_INFO

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
empty      opmet   |   Edit   |   Show History
empty (edit)
Tags What's this?: Add a tag
Flag as ContentBug
<empty>      opmet   |   Edit   |   Show History
<empty>
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker