Click or drag to resize
Xcalibur Systems LLC Logo

TerminalServicesHelperWTSQuerySessionInformation Method

Retrieves session information for the specified session on the specified Remote Desktop Session Host (RD Session Host) server. It can be used to query session information on local and remote RD Session Host servers.

WTSQuerySessionInformation function


Namespace: Xcalibur.NativeMethods.V2.TerminalServices
Assembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax
[DllImportAttribute("wtsapi32.dll")]
public static bool WTSQuerySessionInformation(
	IntPtr serverHandle,
	uint sessionId,
	WtsInfoType infoType,
	out IntPtr bufferPointer,
	out uint bytesReturned
)

Parameters

serverHandle  IntPtr
A handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.
sessionId  UInt32
A Remote Desktop Services session identifier. To indicate the session in which the calling application is running (or the current session) specify WTS_CURRENT_SESSION. Only specify WTS_CURRENT_SESSION when obtaining session information on the local server. If WTS_CURRENT_SESSION is specified when querying session information on a remote server, the returned session information will be inconsistent. Do not use the returned data. You can use the function to retrieve the identifiers of all sessions on a specified RD Session Host server.
infoType  WtsInfoType
A value of the enumeration that indicates the type of session information to retrieve in a call to the WTSQuerySessionInformation function.
bufferPointer  IntPtr
A pointer to a variable that receives a pointer to the requested information. The format and contents of the data depend on the information class specified in the infoType parameter. To free the returned buffer, call the function.
bytesReturned  UInt32
A pointer to a variable that receives the size, in bytes, of the data returned in bufferPointer.

Return Value

Boolean
If the function succeeds, the return value is nonzero. To determine whether the function adjusted all of the specified privileges, call .
See Also