+/**
+ * @file wtsapi32.h
+ * @copy 2012 MinGW.org project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
#ifndef _WTSAPI32_H
#define _WTSAPI32_H
#pragma GCC system_header
+#include <_mingw.h>
#ifdef __cplusplus
extern "C" {
#endif
-#if (_WIN32_WINNT >= 0x0501)
- // session notification message
-#define WM_WTSSESSION_CHANGE 0x02B1
-
-typedef enum _WTS_INFO_CLASS {
- WTSInitialProgram = 0,
- WTSApplicationName = 1,
- WTSWorkingDirectory = 2,
- WTSOEMId = 3,
- WTSSessionId = 4,
- WTSUserName = 5,
- WTSWinStationName = 6,
- WTSDomainName = 7,
- WTSConnectState = 8,
- WTSClientBuildNumber = 9,
- WTSClientName = 10,
- WTSClientDirectory = 11,
- WTSClientProductId = 12,
- WTSClientHardwareId = 13,
- WTSClientAddress = 14,
- WTSClientDisplay = 15,
- WTSClientProtocolType = 16,
- WTSIdleTime = 17,
- WTSLogonTime = 18,
- WTSIncomingBytes = 19,
- WTSOutgoingBytes = 20,
- WTSIncomingFrames = 21,
- WTSOutgoingFrames = 22,
- WTSClientInfo = 23,
- WTSSessionInfo = 24
-} WTS_INFO_CLASS;
-
-typedef enum _WTS_CONNECTSTATE_CLASS {
- WTSActive,
- WTSConnected,
- WTSConnectQuery,
- WTSShadow,
- WTSDisconnected,
- WTSIdle,
- WTSListen,
- WTSReset,
- WTSDown,
- WTSInit
-} WTS_CONNECTSTATE_CLASS;
-
- // session notification message flags
-#define WTS_CONSOLE_CONNECT 0x1
-#define WTS_CONSOLE_DISCONNECT 0x2
-#define WTS_REMOTE_CONNECT 0x3
-#define WTS_REMOTE_DISCONNECT 0x4
-#define WTS_SESSION_LOGON 0x5
-#define WTS_SESSION_LOGOFF 0x6
-#define WTS_SESSION_LOCK 0x7
-#define WTS_SESSION_UNLOCK 0x8
-#define WTS_SESSION_REMOTE_CONTROL 0x9
-
- // WTSRegisterSessionNotifiction flags
-#define NOTIFY_FOR_THIS_SESSION 0
-#define NOTIFY_FOR_ALL_SESSIONS 1
-
-BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags);
-BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd);
-BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE pToken);
-
-#endif /* _WIN32_WINNT >= 0x0501 */
-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
-
typedef struct _WTS_SESSION_INFOW {
DWORD SessionId;
LPWSTR pWinStationName;
WTS_CONNECTSTATE_CLASS State;
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
-#ifdef UNICODE
-#define WTS_SESSION_INFO WTS_SESSION_INFOW
-#define PWTS_SESSION_INFO PWTS_SESSION_INFOW
-#else
-#define WTS_SESSION_INFO WTS_SESSION_INFOA
-#define PWTS_SESSION_INFO PWTS_SESSION_INFOA
-#endif
+#define WTS_SESSION_INFO __AW(WTS_SESSION_INFO)
+#define PWTS_SESSION_INFO __AW(PWTS_SESSION_INFO)
// WTSWaitSystemEvent local server handle
#define WTS_CURRENT_SERVER_HANDLE 0
PDWORD pCount);
void WINAPI WTSFreeMemory(PVOID pMemory);
-#ifdef UNICODE
-#define WTSEnumerateSessions WTSEnumerateSessionsW
-#define WTSQuerySessionInformation WTSQuerySessionInformationW
-#else
-#define WTSEnumerateSessions WTSEnumerateSessionsA
-#define WTSQuerySessionInformation WTSQuerySessionInformationA
-#endif
+#define WTSEnumerateSessions __AW(WTSEnumerateSessions)
+#define WTSQuerySessionInformation __AW(WTSQuerySessionInformation)
BOOL WTSSendMessageA(
HANDLE hServer,
BOOL bWait
);
-#ifdef UNICODE
-#define WTSSendMessage WTSSendMessageW
-#else
-#define WTSSendMessage WTSSendMessageA
-#endif
+#define WTSSendMessage __AW(WTSSendMessage)
BOOL WTSVirtualChannelClose(
__in HANDLE hChannelHandle
__in LPSTR pVirtualName
);
-#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
-HANDLE WTSVirtualChannelOpenEx(
- __in DWORD SessionId,
- __in LPSTR pVirtualName,
- __in DWORD flags
-);
-#endif
-
BOOL WTSVirtualChannelPurgeInput(
__in HANDLE hChannelHandle
);
__in HANDLE hChannelHandle
);
-#if _WIN32_WINNT >= _WIN32_WINNT_WINXP
-BOOL WTSVirtualChannelQuery(
- __in HANDLE hChannelHandle,
- __in WTS_VIRTUAL_CLASS WtsVirtualClass,
- __out PVOID *ppBuffer,
- __out DWORD *pBytesReturned
-);
-#endif
-
BOOL WTSVirtualChannelRead(
__in HANDLE hChannelHandle,
__in ULONG TimeOut,
__in ULONG Length,
__out PULONG pBytesWritten
);
+#endif /* _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
+
+#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+ // session notification message
+#define WM_WTSSESSION_CHANGE 0x02B1
+
+typedef enum _WTS_INFO_CLASS {
+ WTSInitialProgram = 0,
+ WTSApplicationName = 1,
+ WTSWorkingDirectory = 2,
+ WTSOEMId = 3,
+ WTSSessionId = 4,
+ WTSUserName = 5,
+ WTSWinStationName = 6,
+ WTSDomainName = 7,
+ WTSConnectState = 8,
+ WTSClientBuildNumber = 9,
+ WTSClientName = 10,
+ WTSClientDirectory = 11,
+ WTSClientProductId = 12,
+ WTSClientHardwareId = 13,
+ WTSClientAddress = 14,
+ WTSClientDisplay = 15,
+ WTSClientProtocolType = 16,
+ WTSIdleTime = 17,
+ WTSLogonTime = 18,
+ WTSIncomingBytes = 19,
+ WTSOutgoingBytes = 20,
+ WTSIncomingFrames = 21,
+ WTSOutgoingFrames = 22,
+ WTSClientInfo = 23,
+ WTSSessionInfo = 24
+} WTS_INFO_CLASS;
+
+typedef enum _WTS_CONNECTSTATE_CLASS {
+ WTSActive,
+ WTSConnected,
+ WTSConnectQuery,
+ WTSShadow,
+ WTSDisconnected,
+ WTSIdle,
+ WTSListen,
+ WTSReset,
+ WTSDown,
+ WTSInit
+} WTS_CONNECTSTATE_CLASS;
+
+ // session notification message flags
+#define WTS_CONSOLE_CONNECT 0x1
+#define WTS_CONSOLE_DISCONNECT 0x2
+#define WTS_REMOTE_CONNECT 0x3
+#define WTS_REMOTE_DISCONNECT 0x4
+#define WTS_SESSION_LOGON 0x5
+#define WTS_SESSION_LOGOFF 0x6
+#define WTS_SESSION_LOCK 0x7
+#define WTS_SESSION_UNLOCK 0x8
+#define WTS_SESSION_REMOTE_CONTROL 0x9
+
+ // WTSRegisterSessionNotifiction flags
+#define NOTIFY_FOR_THIS_SESSION 0
+#define NOTIFY_FOR_ALL_SESSIONS 1
+
+BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags);
+BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd);
+BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE pToken);
+
+BOOL WTSVirtualChannelQuery(
+ __in HANDLE hChannelHandle,
+ __in WTS_VIRTUAL_CLASS WtsVirtualClass,
+ __out PVOID *ppBuffer,
+ __out DWORD *pBytesReturned
+);
+#endif /* _WIN32_WINNT >= _WIN32_WINNT_WINXP */
-#endif /* _WIN32_WINNT >= 0x0500 */
+#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+HANDLE WTSVirtualChannelOpenEx(
+ __in DWORD SessionId,
+ __in LPSTR pVirtualName,
+ __in DWORD flags
+);
+#endif
#ifdef __cplusplus
}