source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/wtsapi32.h@ 1180

Last change on this file since 1180 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 12.7 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _INC_WTSAPI
7#define _INC_WTSAPI
8
9#include <_mingw_unicode.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define WTS_CURRENT_SERVER ((HANDLE)NULL)
16#define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL)
17#define WTS_CURRENT_SERVER_NAME (NULL)
18
19#define WTS_CURRENT_SESSION ((DWORD)-1)
20
21#ifndef IDTIMEOUT
22#define IDTIMEOUT 32000
23#endif
24#ifndef IDASYNC
25#define IDASYNC 32001
26#endif
27
28#define WTS_WSD_LOGOFF 0x1
29#define WTS_WSD_SHUTDOWN 0x2
30#define WTS_WSD_REBOOT 0x4
31#define WTS_WSD_POWEROFF 0x8
32
33#define WTS_WSD_FASTREBOOT 0x10
34
35 typedef enum _WTS_CONNECTSTATE_CLASS {
36 WTSActive,WTSConnected,WTSConnectQuery,WTSShadow,WTSDisconnected,WTSIdle,WTSListen,WTSReset,WTSDown,WTSInit
37 } WTS_CONNECTSTATE_CLASS;
38
39 typedef struct _WTS_SERVER_INFOW {
40 LPWSTR pServerName;
41 } WTS_SERVER_INFOW,*PWTS_SERVER_INFOW;
42
43 typedef struct _WTS_SERVER_INFOA {
44 LPSTR pServerName;
45 } WTS_SERVER_INFOA,*PWTS_SERVER_INFOA;
46
47#define WTS_SERVER_INFO __MINGW_NAME_AW(WTS_SERVER_INFO)
48#define PWTS_SERVER_INFO __MINGW_NAME_AW(PWTS_SERVER_INFO)
49
50 typedef struct _WTS_SESSION_INFOW {
51 DWORD SessionId;
52 LPWSTR pWinStationName;
53 WTS_CONNECTSTATE_CLASS State;
54 } WTS_SESSION_INFOW,*PWTS_SESSION_INFOW;
55
56 typedef struct _WTS_SESSION_INFOA {
57 DWORD SessionId;
58 LPSTR pWinStationName;
59 WTS_CONNECTSTATE_CLASS State;
60 } WTS_SESSION_INFOA,*PWTS_SESSION_INFOA;
61
62#define WTS_SESSION_INFO __MINGW_NAME_AW(WTS_SESSION_INFO)
63#define PWTS_SESSION_INFO __MINGW_NAME_AW(PWTS_SESSION_INFO)
64
65 typedef struct _WTS_PROCESS_INFOW {
66 DWORD SessionId;
67 DWORD ProcessId;
68 LPWSTR pProcessName;
69 PSID pUserSid;
70 } WTS_PROCESS_INFOW,*PWTS_PROCESS_INFOW;
71
72 typedef struct _WTS_PROCESS_INFOA {
73 DWORD SessionId;
74 DWORD ProcessId;
75 LPSTR pProcessName;
76 PSID pUserSid;
77 } WTS_PROCESS_INFOA,*PWTS_PROCESS_INFOA;
78
79#define WTS_PROCESS_INFO __MINGW_NAME_AW(WTS_PROCESS_INFO)
80#define PWTS_PROCESS_INFO __MINGW_NAME_AW(PWTS_PROCESS_INFO)
81
82#define WTS_PROTOCOL_TYPE_CONSOLE 0
83#define WTS_PROTOCOL_TYPE_ICA 1
84#define WTS_PROTOCOL_TYPE_RDP 2
85
86 typedef enum _WTS_INFO_CLASS {
87 WTSInitialProgram = 0,
88 WTSApplicationName = 1,
89 WTSWorkingDirectory = 2,
90 WTSOEMId = 3,
91 WTSSessionId = 4,
92 WTSUserName = 5,
93 WTSWinStationName = 6,
94 WTSDomainName = 7,
95 WTSConnectState = 8,
96 WTSClientBuildNumber = 9,
97 WTSClientName = 10,
98 WTSClientDirectory = 11,
99 WTSClientProductId = 12,
100 WTSClientHardwareId = 13,
101 WTSClientAddress = 14,
102 WTSClientDisplay = 15,
103 WTSClientProtocolType = 16,
104 WTSIdleTime = 17,
105 WTSLogonTime = 18,
106 WTSIncomingBytes = 19,
107 WTSOutgoingBytes = 20,
108 WTSIncomingFrames = 21,
109 WTSOutgoingFrames = 22,
110 WTSClientInfo = 23,
111 WTSSessionInfo = 24
112 } WTS_INFO_CLASS;
113
114 typedef struct _WTS_CLIENT_ADDRESS {
115 DWORD AddressFamily;
116 BYTE Address[20];
117 } WTS_CLIENT_ADDRESS,*PWTS_CLIENT_ADDRESS;
118
119 typedef struct _WTS_CLIENT_DISPLAY {
120 DWORD HorizontalResolution;
121 DWORD VerticalResolution;
122 DWORD ColorDepth;
123 } WTS_CLIENT_DISPLAY,*PWTS_CLIENT_DISPLAY;
124
125 typedef enum _WTS_CONFIG_CLASS {
126 WTSUserConfigInitialProgram,WTSUserConfigWorkingDirectory,WTSUserConfigfInheritInitialProgram,WTSUserConfigfAllowLogonTerminalServer,
127 WTSUserConfigTimeoutSettingsConnections,WTSUserConfigTimeoutSettingsDisconnections,WTSUserConfigTimeoutSettingsIdle,
128 WTSUserConfigfDeviceClientDrives,WTSUserConfigfDeviceClientPrinters,WTSUserConfigfDeviceClientDefaultPrinter,WTSUserConfigBrokenTimeoutSettings,
129 WTSUserConfigReconnectSettings,WTSUserConfigModemCallbackSettings,WTSUserConfigModemCallbackPhoneNumber,WTSUserConfigShadowingSettings,
130 WTSUserConfigTerminalServerProfilePath,WTSUserConfigTerminalServerHomeDir,WTSUserConfigTerminalServerHomeDirDrive,
131 WTSUserConfigfTerminalServerRemoteHomeDir
132 } WTS_CONFIG_CLASS;
133
134#define WTS_EVENT_NONE 0x0
135#define WTS_EVENT_CREATE 0x1
136#define WTS_EVENT_DELETE 0x2
137#define WTS_EVENT_RENAME 0x4
138#define WTS_EVENT_CONNECT 0x8
139#define WTS_EVENT_DISCONNECT 0x10
140#define WTS_EVENT_LOGON 0x20
141#define WTS_EVENT_LOGOFF 0x40
142#define WTS_EVENT_STATECHANGE 0x80
143#define WTS_EVENT_LICENSE 0x100
144#define WTS_EVENT_ALL 0x7fffffff
145#define WTS_EVENT_FLUSH 0x80000000
146
147 typedef enum _WTS_VIRTUAL_CLASS {
148 WTSVirtualClientData,WTSVirtualFileHandle
149 } WTS_VIRTUAL_CLASS;
150
151#define WTSEnumerateServers __MINGW_NAME_AW(WTSEnumerateServers)
152#define WTSOpenServer __MINGW_NAME_AW(WTSOpenServer)
153#define WTSEnumerateSessions __MINGW_NAME_AW(WTSEnumerateSessions)
154#define WTSEnumerateProcesses __MINGW_NAME_AW(WTSEnumerateProcesses)
155#define WTSQuerySessionInformation __MINGW_NAME_AW(WTSQuerySessionInformation)
156#define WTSQueryUserConfig __MINGW_NAME_AW(WTSQueryUserConfig)
157#define WTSSetUserConfig __MINGW_NAME_AW(WTSSetUserConfig)
158#define WTSSendMessage __MINGW_NAME_AW(WTSSendMessage)
159
160 WINBOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName,DWORD Reserved,DWORD Version,PWTS_SERVER_INFOW *ppServerInfo,DWORD *pCount);
161 WINBOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName,DWORD Reserved,DWORD Version,PWTS_SERVER_INFOA *ppServerInfo,DWORD *pCount);
162 HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName);
163 HANDLE WINAPI WTSOpenServerA(LPSTR pServerName);
164 VOID WINAPI WTSCloseServer(HANDLE hServer);
165 WINBOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_SESSION_INFOW *ppSessionInfo,DWORD *pCount);
166 WINBOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_SESSION_INFOA *ppSessionInfo,DWORD *pCount);
167 WINBOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_PROCESS_INFOW *ppProcessInfo,DWORD *pCount);
168 WINBOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer,DWORD Reserved,DWORD Version,PWTS_PROCESS_INFOA *ppProcessInfo,DWORD *pCount);
169 WINBOOL WINAPI WTSTerminateProcess(HANDLE hServer,DWORD ProcessId,DWORD ExitCode);
170 WINBOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer,DWORD SessionId,WTS_INFO_CLASS WTSInfoClass,LPWSTR *ppBuffer,DWORD *pBytesReturned);
171 WINBOOL WINAPI WTSQuerySessionInformationA(HANDLE hServer,DWORD SessionId,WTS_INFO_CLASS WTSInfoClass,LPSTR *ppBuffer,DWORD *pBytesReturned);
172 WINBOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName,LPWSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPWSTR *ppBuffer,DWORD *pBytesReturned);
173 WINBOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName,LPSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPSTR *ppBuffer,DWORD *pBytesReturned);
174 WINBOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName,LPWSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPWSTR pBuffer,DWORD DataLength);
175 WINBOOL WINAPI WTSSetUserConfigA(LPSTR pServerName,LPSTR pUserName,WTS_CONFIG_CLASS WTSConfigClass,LPSTR pBuffer,DWORD DataLength);
176 WINBOOL WINAPI WTSSendMessageW(HANDLE hServer,DWORD SessionId,LPWSTR pTitle,DWORD TitleLength,LPWSTR pMessage,DWORD MessageLength,DWORD Style,DWORD Timeout,DWORD *pResponse,WINBOOL bWait);
177 WINBOOL WINAPI WTSSendMessageA(HANDLE hServer,DWORD SessionId,LPSTR pTitle,DWORD TitleLength,LPSTR pMessage,DWORD MessageLength,DWORD Style,DWORD Timeout,DWORD *pResponse,WINBOOL bWait);
178 WINBOOL WINAPI WTSDisconnectSession(HANDLE hServer,DWORD SessionId,WINBOOL bWait);
179 WINBOOL WINAPI WTSLogoffSession(HANDLE hServer,DWORD SessionId,WINBOOL bWait);
180 WINBOOL WINAPI WTSShutdownSystem(HANDLE hServer,DWORD ShutdownFlag);
181 WINBOOL WINAPI WTSWaitSystemEvent(HANDLE hServer,DWORD EventMask,DWORD *pEventFlags);
182 HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer,DWORD SessionId,LPSTR pVirtualName);
183 WINBOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle);
184 WINBOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle,ULONG TimeOut,PCHAR Buffer,ULONG BufferSize,PULONG pBytesRead);
185 WINBOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle,PCHAR Buffer,ULONG Length,PULONG pBytesWritten);
186 WINBOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle);
187 WINBOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle);
188 WINBOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle,WTS_VIRTUAL_CLASS,PVOID *ppBuffer,DWORD *pBytesReturned);
189 VOID WINAPI WTSFreeMemory(PVOID pMemory);
190
191#define NOTIFY_FOR_ALL_SESSIONS 1
192#define NOTIFY_FOR_THIS_SESSION 0
193
194 WINBOOL WINAPI WTSRegisterSessionNotification(HWND hWnd,DWORD dwFlags);
195 WINBOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd);
196 WINBOOL WINAPI WTSQueryUserToken(ULONG SessionId,PHANDLE phToken);
197
198
199#define USERNAME_LENGTH 20
200#define CLIENTNAME_LENGTH 20
201#define CLIENTADDRESS_LENGTH 30
202#define WINSTATIONNAME_LENGTH 32
203#define DOMAIN_LENGTH 17
204
205#if (_WIN32_WINNT >= 0x0600)
206typedef struct _WTSCLIENTW {
207 WCHAR ClientName[CLIENTNAME_LENGTH + 1];
208 WCHAR Domain[DOMAIN_LENGTH + 1 ];
209 WCHAR UserName[USERNAME_LENGTH + 1];
210 WCHAR WorkDirectory[MAX_PATH + 1];
211 WCHAR InitialProgram[MAX_PATH + 1];
212 BYTE EncryptionLevel;
213 ULONG ClientAddressFamily;
214 USHORT ClientAddress[CLIENTADDRESS_LENGTH + 1];
215 USHORT HRes;
216 USHORT VRes;
217 USHORT ColorDepth;
218 WCHAR ClientDirectory[MAX_PATH + 1];
219 ULONG ClientBuildNumber;
220 ULONG ClientHardwareId;
221 USHORT ClientProductId;
222 USHORT OutBufCountHost;
223 USHORT OutBufCountClient;
224 USHORT OutBufLength;
225 WCHAR DeviceId[MAX_PATH + 1];
226} WTSCLIENTW, *PWTSCLIENTW;
227
228typedef struct _WTSCLIENTA {
229 CHAR ClientName[CLIENTNAME_LENGTH + 1];
230 CHAR Domain[DOMAIN_LENGTH + 1 ];
231 CHAR UserName[USERNAME_LENGTH + 1];
232 CHAR WorkDirectory[MAX_PATH + 1];
233 CHAR InitialProgram[MAX_PATH + 1];
234 BYTE EncryptionLevel;
235 ULONG ClientAddressFamily;
236 USHORT ClientAddress[CLIENTADDRESS_LENGTH + 1];
237 USHORT HRes;
238 USHORT VRes;
239 USHORT ColorDepth;
240 CHAR ClientDirectory[MAX_PATH + 1];
241 ULONG ClientBuildNumber;
242 ULONG ClientHardwareId;
243 USHORT ClientProductId;
244 USHORT OutBufCountHost;
245 USHORT OutBufCountClient;
246 USHORT OutBufLength;
247 CHAR DeviceId[MAX_PATH + 1];
248} WTSCLIENTA, *PWTSCLIENTA;
249
250__MINGW_TYPEDEF_AW(WTSCLIENT)
251__MINGW_TYPEDEF_AW(PWTSCLIENT)
252
253typedef struct _WTSINFOW {
254 WTS_CONNECTSTATE_CLASS State;
255 DWORD SessionId;
256 DWORD IncomingBytes;
257 DWORD OutgoingBytes;
258 DWORD IncomingFrames;
259 DWORD OutgoingFrames;
260 DWORD IncomingCompressedBytes;
261 DWORD OutgoingCompressedBytes;
262 WCHAR WinStationName[WINSTATIONNAME_LENGTH];
263 WCHAR Domain[DOMAIN_LENGTH];
264 WCHAR UserName[USERNAME_LENGTH+1];
265 LARGE_INTEGER ConnectTime;
266 LARGE_INTEGER DisconnectTime;
267 LARGE_INTEGER LastInputTime;
268 LARGE_INTEGER LogonTime;
269 LARGE_INTEGER CurrentTime;
270} WTSINFOW, *PWTSINFOW;
271
272typedef struct _WTSINFOA {
273 WTS_CONNECTSTATE_CLASS State;
274 DWORD SessionId;
275 DWORD IncomingBytes;
276 DWORD OutgoingBytes;
277 DWORD IncomingFrames;
278 DWORD OutgoingFrames;
279 DWORD IncomingCompressedBytes;
280 DWORD OutgoingCompressedBytes;
281 CHAR WinStationName[WINSTATIONNAME_LENGTH];
282 CHAR Domain[DOMAIN_LENGTH];
283 CHAR UserName[USERNAME_LENGTH+1];
284 LARGE_INTEGER ConnectTime;
285 LARGE_INTEGER DisconnectTime;
286 LARGE_INTEGER LastInputTime;
287 LARGE_INTEGER LogonTime;
288 LARGE_INTEGER CurrentTime;
289} WTSINFOA, *PWTSINFOA;
290
291__MINGW_TYPEDEF_AW(WTSINFO)
292__MINGW_TYPEDEF_AW(PWTSINFO)
293
294WINBOOL WINAPI WTSConnectSessionA(
295 ULONG LogonId,
296 ULONG TargetLogonId,
297 PSTR pPassword,
298 WINBOOL bWait
299);
300
301WINBOOL WINAPI WTSConnectSessionW(
302 ULONG LogonId,
303 ULONG TargetLogonId,
304 PWSTR pPassword,
305 WINBOOL bWait
306);
307
308WINBOOL WTSRegisterSessionNotificationEx(
309 HANDLE hServer,
310 HWND hWnd,
311 DWORD dwFlags
312);
313
314WINBOOL WINAPI WTSStartRemoteControlSessionA(
315 LPSTR pTargetServerName,
316 ULONG TargetLogonId,
317 BYTE HotkeyVk,
318 USHORT HotkeyModifiers
319);
320
321WINBOOL WINAPI WTSStartRemoteControlSessionW(
322 LPWSTR pTargetServerName,
323 ULONG TargetLogonId,
324 BYTE HotkeyVk,
325 USHORT HotkeyModifiers
326);
327
328#define WTSStartRemoteControlSession __MINGW_NAME_AW(WTSStartRemoteControlSession)
329#define WTSConnectSession __MINGW_NAME_AW(WTSConnectSession)
330
331WINBOOL WINAPI WTSStopRemoteControlSession(
332 ULONG LogonId
333);
334
335WINBOOL WINAPI WTSUnRegisterSessionNotificationEx(
336 HANDLE hServer,
337 HWND hWnd
338);
339
340HANDLE WINAPI WTSVirtualChannelOpenEx(
341 DWORD SessionId,
342 LPSTR pVirtualName,
343 DWORD flags
344);
345
346#endif /*(_WIN32_WINNT >= 0x0600)*/
347
348#ifdef __cplusplus
349}
350#endif
351#endif
Note: See TracBrowser for help on using the repository browser.