WTS_SESSION_INFO_1A structure (wtsapi32.h)

Contains extended information about a client session on a Remote Desktop Session Host (RD Session Host) server or Remote Desktop Virtualization Host (RD Virtualization Host) server.

Syntax

typedef struct _WTS_SESSION_INFO_1A {
  DWORD                  ExecEnvId;
  WTS_CONNECTSTATE_CLASS State;
  DWORD                  SessionId;
  LPSTR                  pSessionName;
  LPSTR                  pHostName;
  LPSTR                  pUserName;
  LPSTR                  pDomainName;
  LPSTR                  pFarmName;
} WTS_SESSION_INFO_1A, *PWTS_SESSION_INFO_1A;

Members

ExecEnvId

An identifier that uniquely identifies the session within the list of sessions returned by the WTSEnumerateSessionsEx function. For more information, see Remarks.

State

A value of the WTS_CONNECTSTATE_CLASS enumeration type that specifies the connection state of a Remote Desktop Services session.

SessionId

A session identifier assigned by the RD Session Host server, RD Virtualization Host server, or virtual machine.

pSessionName

A pointer to a null-terminated string that contains the name of this session. For example, "services", "console", or "RDP-Tcp#0".

pHostName

A pointer to a null-terminated string that contains the name of the computer that the session is running on. If the session is running directly on an RD Session Host server or RD Virtualization Host server, the string contains NULL. If the session is running on a virtual machine, the string contains the name of the virtual machine.

pUserName

A pointer to a null-terminated string that contains the name of the user who is logged on to the session. If no user is logged on to the session, the string contains NULL.

pDomainName

A pointer to a null-terminated string that contains the domain name of the user who is logged on to the session. If no user is logged on to the session, the string contains NULL.

pFarmName

A pointer to a null-terminated string that contains the name of the farm that the virtual machine is joined to. If the session is not running on a virtual machine that is joined to a farm, the string contains NULL.

Remarks

The WTSEnumerateSessionsEx function returns this structure if you call the function and specify a handle to an RD Virtualization Host server that you obtained by calling the WTSOpenServerEx function. In this case, the WTSEnumerateSessionsEx function aggregates all the sessions running on the host itself as well as sessions running on individual virtual machines. The ExecEnvId parameter uniquely identifies each session in the aggregated list. This identifier may be different from the actual session identifier defined in the server or virtual machine that hosts the session, which is specified by the SessionId member.

The session represented by this structure could be a session running directly on the server or a session running within a virtual machine. If the session is running within a virtual machine, the pHostName member contains the name of the virtual machine. The pFarmName member is applicable to sessions that are hosted on virtual machines that are joined to a RD Session Host farm.

Note

The wtsapi32.h header defines WTS_SESSION_INFO_1 as an alias which 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 not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 7
Minimum supported server Windows Server 2008 R2
Header wtsapi32.h

See also

WTSEnumerateSessionsEx

WTS_SESSION_INFO