source: Daodan/MinGW/include/wtsapi32.h@ 1051

Last change on this file since 1051 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 5.5 KB
Line 
1#ifndef _WTSAPI32_H
2#define _WTSAPI32_H
3#if __GNUC__ >= 3
4#pragma GCC system_header
5#endif
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#if (_WIN32_WINNT >= 0x0501)
12 // session notification message
13#define WM_WTSSESSION_CHANGE 0x02B1
14
15typedef enum _WTS_INFO_CLASS {
16 WTSInitialProgram = 0,
17 WTSApplicationName = 1,
18 WTSWorkingDirectory = 2,
19 WTSOEMId = 3,
20 WTSSessionId = 4,
21 WTSUserName = 5,
22 WTSWinStationName = 6,
23 WTSDomainName = 7,
24 WTSConnectState = 8,
25 WTSClientBuildNumber = 9,
26 WTSClientName = 10,
27 WTSClientDirectory = 11,
28 WTSClientProductId = 12,
29 WTSClientHardwareId = 13,
30 WTSClientAddress = 14,
31 WTSClientDisplay = 15,
32 WTSClientProtocolType = 16,
33 WTSIdleTime = 17,
34 WTSLogonTime = 18,
35 WTSIncomingBytes = 19,
36 WTSOutgoingBytes = 20,
37 WTSIncomingFrames = 21,
38 WTSOutgoingFrames = 22,
39 WTSClientInfo = 23,
40 WTSSessionInfo = 24
41} WTS_INFO_CLASS;
42
43typedef enum _WTS_CONNECTSTATE_CLASS {
44 WTSActive,
45 WTSConnected,
46 WTSConnectQuery,
47 WTSShadow,
48 WTSDisconnected,
49 WTSIdle,
50 WTSListen,
51 WTSReset,
52 WTSDown,
53 WTSInit
54} WTS_CONNECTSTATE_CLASS;
55
56 // session notification message flags
57#define WTS_CONSOLE_CONNECT 0x1
58#define WTS_CONSOLE_DISCONNECT 0x2
59#define WTS_REMOTE_CONNECT 0x3
60#define WTS_REMOTE_DISCONNECT 0x4
61#define WTS_SESSION_LOGON 0x5
62#define WTS_SESSION_LOGOFF 0x6
63#define WTS_SESSION_LOCK 0x7
64#define WTS_SESSION_UNLOCK 0x8
65#define WTS_SESSION_REMOTE_CONTROL 0x9
66
67 // WTSRegisterSessionNotifiction flags
68#define NOTIFY_FOR_THIS_SESSION 0
69#define NOTIFY_FOR_ALL_SESSIONS 1
70
71BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags);
72BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd);
73BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE pToken);
74
75#endif /* _WIN32_WINNT >= 0x0501 */
76
77#if (_WIN32_WINNT >= 0x0500)
78
79typedef struct _WTS_SESSION_INFOW {
80 DWORD SessionId;
81 LPWSTR pWinStationName;
82 WTS_CONNECTSTATE_CLASS State;
83} WTS_SESSION_INFOW, *PWTS_SESSION_INFOW;
84
85typedef struct _WTS_SESSION_INFOA {
86 DWORD SessionId;
87 LPSTR pWinStationName;
88 WTS_CONNECTSTATE_CLASS State;
89} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
90
91#ifdef UNICODE
92#define WTS_SESSION_INFO WTS_SESSION_INFOW
93#define PWTS_SESSION_INFO PWTS_SESSION_INFOW
94#else
95#define WTS_SESSION_INFO WTS_SESSION_INFOA
96#define PWTS_SESSION_INFO PWTS_SESSION_INFOA
97#endif
98
99 // WTSWaitSystemEvent local server handle
100#define WTS_CURRENT_SERVER_HANDLE 0
101#define WTS_CURRENT_SESSION ((DWORD)-1)
102
103 // WTSWaitSystemEvent flags
104#define WTS_EVENT_NONE 0x00000000
105#define WTS_EVENT_CREATE 0x00000001
106#define WTS_EVENT_DELETE 0x00000002
107#define WTS_EVENT_RENAME 0x00000004
108#define WTS_EVENT_CONNECT 0x00000008
109#define WTS_EVENT_DISCONNECT 0x00000010
110#define WTS_EVENT_LOGON 0x00000020
111#define WTS_EVENT_LOGOFF 0x00000040
112#define WTS_EVENT_STATECHANGE 0x00000080
113#define WTS_EVENT_LICENSE 0x00000100
114#define WTS_EVENT_ALL 0x7FFFFFFF
115#define WTS_EVENT_FLUSH 0x80000000
116
117BOOL WINAPI WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass,
118 LPSTR *ppBuffer, DWORD *pBytesReturned);
119BOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass,
120 LPTSTR *ppBuffer, DWORD *pBytesReturned);
121BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags);
122BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait);
123BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
124 PWTS_SESSION_INFOW *ppSessionInfo,
125 PDWORD pCount);
126BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
127 PWTS_SESSION_INFOA *ppSessionInfo,
128 PDWORD pCount);
129void WINAPI WTSFreeMemory(PVOID pMemory);
130
131#ifdef UNICODE
132#define WTSEnumerateSessions WTSEnumerateSessionsW
133#define WTSQuerySessionInformation WTSQuerySessionInformationW
134#else
135#define WTSEnumerateSessions WTSEnumerateSessionsA
136#define WTSQuerySessionInformation WTSQuerySessionInformationA
137#endif
138
139BOOL WTSSendMessageA(
140 HANDLE hServer,
141 DWORD SessionId,
142 LPSTR pTitle,
143 DWORD TitleLength,
144 LPSTR pMessage,
145 DWORD MessageLength,
146 DWORD Style,
147 DWORD Timeout,
148 DWORD *pResponse,
149 BOOL bWait
150);
151
152BOOL WTSSendMessageW(
153 HANDLE hServer,
154 DWORD SessionId,
155 LPWSTR pTitle,
156 DWORD TitleLength,
157 LPWSTR pMessage,
158 DWORD MessageLength,
159 DWORD Style,
160 DWORD Timeout,
161 DWORD *pResponse,
162 BOOL bWait
163);
164
165#ifdef UNICODE
166#define WTSSendMessage WTSSendMessageW
167#else
168#define WTSSendMessage WTSSendMessageA
169#endif
170
171BOOL WTSVirtualChannelClose(
172 HANDLE hChannelHandle
173);
174
175HANDLE WTSVirtualChannelOpen(
176 HANDLE hServer,
177 DWORD SessionId,
178 LPSTR pVirtualName
179);
180
181#if (_WIN32_WINNT >= 0x600)
182HANDLE WTSVirtualChannelOpenEx(
183 DWORD SessionId,
184 LPSTR pVirtualName,
185 DWORD flags
186);
187#endif
188
189BOOL WTSVirtualChannelPurgeInput(
190 HANDLE hChannelHandle
191);
192
193BOOL WTSVirtualChannelPurgeOutput(
194 HANDLE hChannelHandle
195);
196
197#if (_WIN32_WINNT >= 0x501)
198BOOL WTSVirtualChannelQuery(
199 HANDLE hChannelHandle,
200 WTS_VIRTUAL_CLASS WtsVirtualClass,
201 PVOID *ppBuffer,
202 DWORD *pBytesReturned
203);
204#endif
205
206BOOL WTSVirtualChannelRead(
207 HANDLE hChannelHandle,
208 ULONG TimeOut,
209 PCHAR Buffer,
210 ULONG BufferSize,
211 PULONG pBytesRead
212);
213
214BOOL WTSVirtualChannelWrite(
215 HANDLE hChannelHandle,
216 PCHAR Buffer,
217 ULONG Length,
218 PULONG pBytesWritten
219);
220
221#endif /* _WIN32_WINNT >= 0x0500 */
222
223#ifdef __cplusplus
224}
225#endif
226
227#endif /* _WTSAPI32_H */
Note: See TracBrowser for help on using the repository browser.