Top Inners Fields Methods
com.sun.jna.platform.win32

public Interface Wtsapi32

extends StdCallLibrary
Imports
com.sun.jna.Native, .Pointer, .Structure, .Structure.FieldOrder, com.sun.jna.platform.win32.WinDef.HWND, .WinNT.HANDLE, .WinNT.LARGE_INTEGER, .WinNT.PSID, com.sun.jna.ptr.IntByReference, .PointerByReference, com.sun.jna.win32.StdCallLibrary, .W32APIOptions, .W32APITypeMapper

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Wtsapi32.WTS_CLIENT_ADDRESS

Contains the client network address of a Remote Desktop Services session.

public static interface
Wtsapi32.WTS_CONNECTSTATE_CLASS

Specifies the connection state of a Remote Desktop Services session.

public static interface
public static class
Wtsapi32.WTS_PROCESS_INFO_EX

Contains extended information about a process running on a Remote Desktop Session Host (RD Session Host) server.

public static class
Wtsapi32.WTS_SESSION_INFO

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

public static class
Wtsapi32.WTSINFO

Contains information about a Remote Desktop Services session.

Field Summary

Modifier and TypeField and Description
public static final int
DOMAIN_LENGTH

Defined in winsta.h and present in this interface to properly size the WTSINFO structure.

public static final Wtsapi32
public static final int
public static final int
public static final int
USERNAME_LENGTH

Defined in winsta.h and present in this interface to properly size the WTSINFO structure.

public static final int
WINSTATIONNAME_LENGTH

Defined in winsta.h and present in this interface to properly size the WTSINFO structure.

public static final int
WTS_ANY_SESSION

Specifies any-session (SessionId)

public static final int
WTS_CONSOLE_CONNECT

The session identified by lParam was connected to the console terminal or RemoteFX session.

public static final int
WTS_CONSOLE_DISCONNECT

The session identified by lParam was disconnected from the console terminal or RemoteFX session.

public static final WinNT.HANDLE
WTS_CURRENT_SERVER_HANDLE

Specifies the current server

public static final int
WTS_CURRENT_SESSION

Specifies the current session (SessionId)

public static final int
public static final int
public static final int
WTS_REMOTE_CONNECT

The session identified by lParam was connected to the remote terminal.

public static final int
WTS_REMOTE_DISCONNECT

The session identified by lParam was disconnected from the remote terminal.

public static final int
WTS_SESSION_LOCK

The session identified by lParam has been locked.

public static final int
WTS_SESSION_LOGOFF

A user has logged off the session identified by lParam.

public static final int
WTS_SESSION_LOGON

A user has logged on to the session identified by lParam.

public static final int
WTS_SESSION_REMOTE_CONTROL

The session identified by lParam has changed its remote controlled status.

public static final int
WTS_SESSION_UNLOCK

The session identified by lParam has been unlocked.

Inherited from com.sun.jna.win32.StdCallLibrary:
FUNCTION_MAPPERSTDCALL_CONVENTION

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

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 the GetLastError function.
WTSEnumerateProcessesEx
(WinNT.HANDLE
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 server on which your application is running.
hServer
,
IntByReference
A pointer to a DWORD variable that, on input, specifies the type of information to return. To return an array of WTS_PROCESS_INFO structures, specify zero. To return an array of WTS_PROCESS_INFO_EX structures, specify one. If you do not specify a valid value for this parameter, on output, WTSEnumerateProcessesEx sets this parameter to one and returns an error. Otherwise, on output, WTSEnumerateProcessesEx does not change the value of this parameter.
pLevel
,
int
The session for which to enumerate processes. To enumerate processes for all sessions on the server, specify WTS_ANY_SESSION.
SessionID
,
PointerByReference
A pointer to a variable that receives a pointer to an array of WTS_PROCESS_INFO or WTS_PROCESS_INFO_EX structures. The type of structure is determined by the value passed to the pLevel parameter. Each structure in the array contains information about an active process. When you have finished using the array, free it by calling the WTSFreeMemoryEx function. You should also set the pointer to NULL.
ppProcessInfo
,
IntByReference
A pointer to a variable that receives the number of structures returned in the buffer referenced by the ppProcessInfo parameter.
pCount
)

Retrieves information about the active processes on the specified Remote Desktop Session Host (RD Session Host) server or Remote Desktop Virtualization Host (RD Virtualization Host) server.

public boolean

Returns:

Returns false if this function fails. If this function succeeds, returns true.

To get extended error information, call Kernel32#GetLastError().

WTSEnumerateSessions
(WinNT.HANDLE
A handle to the RD Session Host server.

You can use the WTSOpenServer or WTSOpenServerEx functions to retrieve a handle to a specific server, or WTS_CURRENT_SERVER_HANDLE to use the RD Session Host server that hosts your application.

hServer
,
int
This parameter is reserved. It must be zero.
Reserved
,
int
The version of the enumeration request. This parameter must be 1.
Version
,
PointerByReference
A pointer to an array of WTS_SESSION_INFO structures that represent the retrieved sessions. To free the returned buffer, call the Wtsapi32#WTSFreeMemory function.
ppSessionInfo
,
IntByReference
A pointer to the number of WTS_SESSION_INFO structures returned in the ppSessionInfo parameter.
pCount
)

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

public void
WTSFreeMemory(Pointer
Pointer to the memory to free.
pMemory
)

Frees memory allocated by a Remote Desktop Services function.

public boolean

Returns:

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 the GetLastError function.
WTSFreeMemoryEx
(int
A value of the WTS_TYPE_CLASS enumeration type that specifies the type of structures contained in the buffer referenced by the pMemory parameter.
WTSTypeClass
,
Pointer
A pointer to the buffer to free.
pMemory
,
int
The number of elements in the buffer referenced by the pMemory parameter.
NumberOfEntries
)

Frees memory that contains WTS_PROCESS_INFO_EX or WTS_SESSION_INFO_1 structures allocated by a Remote Desktop Services function.

public boolean

Returns:

If the function succeeds, returns true.

If the function fails, returns false. To get extended error information, call Kernel32#GetLastError().

WTSQuerySessionInformation
(WinNT.HANDLE
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.
hServer
,
int
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 WTSEnumerateSessionsEx function to retrieve the identifiers of all sessions on a specified RD Session Host server.

To query information for another user's session, you must have Query Information permission.

SessionId
,
int
A value of the WTS_INFO_CLASS enumeration that indicates the type of session information to retrieve in a call to the WTSQuerySessionInformation function.
WTSInfoClass
,
PointerByReference
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 WTSInfoClass parameter. To free the returned buffer, call the WTSFreeMemory function.
ppBuffer
,
IntByReference
A pointer to a variable that receives the size, in bytes, of the data returned in ppBuffer.
pBytesReturned
)

Retrieves session information for the specified session on the specified Remote Desktop Session Host (RD Session Host) server.

public boolean

Returns:

If the function succeeds, the return value is TRUE. Otherwise, it is FALSE. To get extended error information, call GetLastError.
WTSRegisterSessionNotification
(WinDef.HWND
[in] Handle of the window to receive session change notifications.
hWnd
,
int
[in] Specifies which session notifications are to be received. This parameter can be one of the following values.
dwFlags
)

Registers the specified window to receive session change notifications.

public boolean

Returns:

If the function succeeds, the return value is TRUE. Otherwise, it is FALSE. To get extended error information, call GetLastError.
WTSUnRegisterSessionNotification
(WinDef.HWND
[in] Handle of the window to be unregistered from receiving session notifications.
hWnd
)

Unregisters the specified window so that it receives no further session change notifications.