22 #ifndef WINPR_WTSAPI_H
23 #define WINPR_WTSAPI_H
25 #include <winpr/winpr.h>
26 #include <winpr/wtypes.h>
28 #include <winpr/file.h>
30 #define CHANNEL_CHUNK_MAX_LENGTH 16256
32 WINPR_PRAGMA_DIAG_PUSH
33 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
37 #define CurrentTime _CurrentTime
41 #if defined(_WIN32) && !defined(_UWP)
51 #define CHANNEL_CHUNK_LENGTH 1600
53 #define CHANNEL_PDU_LENGTH (CHANNEL_CHUNK_LENGTH + sizeof(CHANNEL_PDU_HEADER))
55 #define CHANNEL_FLAG_FIRST 0x01
56 #define CHANNEL_FLAG_LAST 0x02
57 #define CHANNEL_FLAG_ONLY (CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST)
58 #define CHANNEL_FLAG_MIDDLE 0
59 #define CHANNEL_FLAG_FAIL 0x100
61 #define CHANNEL_OPTION_INITIALIZED 0x80000000
63 #define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
64 #define CHANNEL_OPTION_ENCRYPT_SC 0x20000000
65 #define CHANNEL_OPTION_ENCRYPT_CS 0x10000000
66 #define CHANNEL_OPTION_PRI_HIGH 0x08000000
67 #define CHANNEL_OPTION_PRI_MED 0x04000000
68 #define CHANNEL_OPTION_PRI_LOW 0x02000000
69 #define CHANNEL_OPTION_COMPRESS_RDP 0x00800000
70 #define CHANNEL_OPTION_COMPRESS 0x00400000
71 #define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
72 #define CHANNEL_OPTION_REMOTE_CONTROL_PERSISTENT 0x00100000
74 #define CHANNEL_MAX_COUNT 31
75 #define CHANNEL_NAME_LEN 7
77 typedef struct tagCHANNEL_DEF
79 char name[CHANNEL_NAME_LEN + 1];
85 typedef struct tagCHANNEL_PDU_HEADER
97 #ifndef CHANNEL_FLAG_SHOW_PROTOCOL
98 #define CHANNEL_FLAG_SHOW_PROTOCOL 0x10
100 #ifndef CHANNEL_FLAG_SUSPEND
101 #define CHANNEL_FLAG_SUSPEND 0x20
103 #ifndef CHANNEL_FLAG_RESUME
104 #define CHANNEL_FLAG_RESUME 0x40
106 #ifndef CHANNEL_FLAG_SHADOW_PERSISTENT
107 #define CHANNEL_FLAG_SHADOW_PERSISTENT 0x80
110 #if !defined(_WIN32) || !defined(H_CCHANNEL)
117 #define VCAPITYPE __stdcall
120 #define VCAPITYPE CALLBACK
121 #define VCEXPORT __export
124 typedef VOID VCAPITYPE CHANNEL_INIT_EVENT_FN(LPVOID pInitHandle, UINT event, LPVOID pData,
127 typedef CHANNEL_INIT_EVENT_FN* PCHANNEL_INIT_EVENT_FN;
129 typedef VOID VCAPITYPE CHANNEL_INIT_EVENT_EX_FN(LPVOID lpUserParam, LPVOID pInitHandle, UINT event,
130 LPVOID pData, UINT dataLength);
132 typedef CHANNEL_INIT_EVENT_EX_FN* PCHANNEL_INIT_EVENT_EX_FN;
134 #define CHANNEL_EVENT_INITIALIZED 0
135 #define CHANNEL_EVENT_CONNECTED 1
136 #define CHANNEL_EVENT_V1_CONNECTED 2
137 #define CHANNEL_EVENT_DISCONNECTED 3
138 #define CHANNEL_EVENT_TERMINATED 4
139 #define CHANNEL_EVENT_REMOTE_CONTROL_START 5
140 #define CHANNEL_EVENT_REMOTE_CONTROL_STOP 6
141 #define CHANNEL_EVENT_ATTACHED 7
142 #define CHANNEL_EVENT_DETACHED 8
143 #define CHANNEL_EVENT_DATA_RECEIVED 10
144 #define CHANNEL_EVENT_WRITE_COMPLETE 11
145 #define CHANNEL_EVENT_WRITE_CANCELLED 12
147 typedef VOID VCAPITYPE CHANNEL_OPEN_EVENT_FN(DWORD openHandle, UINT event, LPVOID pData,
148 UINT32 dataLength, UINT32 totalLength,
151 typedef CHANNEL_OPEN_EVENT_FN* PCHANNEL_OPEN_EVENT_FN;
153 typedef VOID VCAPITYPE CHANNEL_OPEN_EVENT_EX_FN(LPVOID lpUserParam, DWORD openHandle, UINT event,
154 LPVOID pData, UINT32 dataLength, UINT32 totalLength,
157 typedef CHANNEL_OPEN_EVENT_EX_FN* PCHANNEL_OPEN_EVENT_EX_FN;
159 #define CHANNEL_RC_OK 0
160 #define CHANNEL_RC_ALREADY_INITIALIZED 1
161 #define CHANNEL_RC_NOT_INITIALIZED 2
162 #define CHANNEL_RC_ALREADY_CONNECTED 3
163 #define CHANNEL_RC_NOT_CONNECTED 4
164 #define CHANNEL_RC_TOO_MANY_CHANNELS 5
165 #define CHANNEL_RC_BAD_CHANNEL 6
166 #define CHANNEL_RC_BAD_CHANNEL_HANDLE 7
167 #define CHANNEL_RC_NO_BUFFER 8
168 #define CHANNEL_RC_BAD_INIT_HANDLE 9
169 #define CHANNEL_RC_NOT_OPEN 10
170 #define CHANNEL_RC_BAD_PROC 11
171 #define CHANNEL_RC_NO_MEMORY 12
172 #define CHANNEL_RC_UNKNOWN_CHANNEL_NAME 13
173 #define CHANNEL_RC_ALREADY_OPEN 14
174 #define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY 15
175 #define CHANNEL_RC_NULL_DATA 16
176 #define CHANNEL_RC_ZERO_LENGTH 17
177 #define CHANNEL_RC_INVALID_INSTANCE 18
178 #define CHANNEL_RC_UNSUPPORTED_VERSION 19
179 #define CHANNEL_RC_INITIALIZATION_ERROR 20
181 #define VIRTUAL_CHANNEL_VERSION_WIN2000 1
183 typedef UINT VCAPITYPE VIRTUALCHANNELINIT(LPVOID* ppInitHandle,
PCHANNEL_DEF pChannel,
184 INT channelCount, ULONG versionRequested,
185 PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
187 typedef VIRTUALCHANNELINIT* PVIRTUALCHANNELINIT;
189 typedef UINT VCAPITYPE VIRTUALCHANNELINITEX(LPVOID lpUserParam, LPVOID clientContext,
191 INT channelCount, ULONG versionRequested,
192 PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx);
194 typedef VIRTUALCHANNELINITEX* PVIRTUALCHANNELINITEX;
196 typedef UINT VCAPITYPE VIRTUALCHANNELOPEN(LPVOID pInitHandle, LPDWORD pOpenHandle,
198 PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
200 typedef VIRTUALCHANNELOPEN* PVIRTUALCHANNELOPEN;
202 typedef UINT VCAPITYPE VIRTUALCHANNELOPENEX(LPVOID pInitHandle, LPDWORD pOpenHandle,
204 PCHANNEL_OPEN_EVENT_EX_FN pChannelOpenEventProcEx);
206 typedef VIRTUALCHANNELOPENEX* PVIRTUALCHANNELOPENEX;
208 typedef UINT VCAPITYPE VIRTUALCHANNELCLOSE(DWORD openHandle);
210 typedef VIRTUALCHANNELCLOSE* PVIRTUALCHANNELCLOSE;
212 typedef UINT VCAPITYPE VIRTUALCHANNELCLOSEEX(LPVOID pInitHandle, DWORD openHandle);
214 typedef VIRTUALCHANNELCLOSEEX* PVIRTUALCHANNELCLOSEEX;
216 typedef UINT VCAPITYPE VIRTUALCHANNELWRITE(DWORD openHandle, LPVOID pData, ULONG dataLength,
219 typedef VIRTUALCHANNELWRITE* PVIRTUALCHANNELWRITE;
221 typedef UINT VCAPITYPE VIRTUALCHANNELWRITEEX(LPVOID pInitHandle, DWORD openHandle, LPVOID pData,
222 ULONG dataLength, LPVOID pUserData);
224 typedef VIRTUALCHANNELWRITEEX* PVIRTUALCHANNELWRITEEX;
226 typedef struct tagCHANNEL_ENTRY_POINTS
229 DWORD protocolVersion;
230 PVIRTUALCHANNELINIT pVirtualChannelInit;
231 PVIRTUALCHANNELOPEN pVirtualChannelOpen;
232 PVIRTUALCHANNELCLOSE pVirtualChannelClose;
233 PVIRTUALCHANNELWRITE pVirtualChannelWrite;
236 typedef struct tagCHANNEL_ENTRY_POINTS_EX
239 DWORD protocolVersion;
240 PVIRTUALCHANNELINITEX pVirtualChannelInitEx;
241 PVIRTUALCHANNELOPENEX pVirtualChannelOpenEx;
242 PVIRTUALCHANNELCLOSEEX pVirtualChannelCloseEx;
243 PVIRTUALCHANNELWRITEEX pVirtualChannelWriteEx;
246 typedef BOOL VCAPITYPE VIRTUALCHANNELENTRY(PCHANNEL_ENTRY_POINTS pEntryPoints);
248 typedef VIRTUALCHANNELENTRY* PVIRTUALCHANNELENTRY;
250 typedef BOOL VCAPITYPE VIRTUALCHANNELENTRYEX(PCHANNEL_ENTRY_POINTS_EX pEntryPointsEx,
253 typedef VIRTUALCHANNELENTRYEX* PVIRTUALCHANNELENTRYEX;
255 typedef HRESULT(VCAPITYPE* PFNVCAPIGETINSTANCE)(REFIID refiid, PULONG pNumObjs, PVOID* ppObjArray);
259 #if !defined(_WIN32) || !defined(_INC_WTSAPI)
265 #define WTS_CURRENT_SERVER ((HANDLE)NULL)
266 #define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL)
267 #define WTS_CURRENT_SERVER_NAME (NULL)
269 #define WTS_CURRENT_SESSION ((DWORD)-1)
271 #define WTS_ANY_SESSION ((DWORD)-2)
273 #define IDTIMEOUT 32000
274 #define IDASYNC 32001
276 #define USERNAME_LENGTH 20
277 #define CLIENTNAME_LENGTH 20
278 #define CLIENTADDRESS_LENGTH 30
280 #define WTS_WSD_LOGOFF 0x00000001
281 #define WTS_WSD_SHUTDOWN 0x00000002
282 #define WTS_WSD_REBOOT 0x00000004
283 #define WTS_WSD_POWEROFF 0x00000008
284 #define WTS_WSD_FASTREBOOT 0x00000010
286 #define MAX_ELAPSED_TIME_LENGTH 15
287 #define MAX_DATE_TIME_LENGTH 56
288 #define WINSTATIONNAME_LENGTH 32
289 #define DOMAIN_LENGTH 17
291 #define WTS_DRIVE_LENGTH 3
292 #define WTS_LISTENER_NAME_LENGTH 32
293 #define WTS_COMMENT_LENGTH 60
295 #define WTS_LISTENER_CREATE 0x00000001
296 #define WTS_LISTENER_UPDATE 0x00000010
298 #define WTS_SECURITY_QUERY_INFORMATION 0x00000001
299 #define WTS_SECURITY_SET_INFORMATION 0x00000002
300 #define WTS_SECURITY_RESET 0x00000004
301 #define WTS_SECURITY_VIRTUAL_CHANNELS 0x00000008
302 #define WTS_SECURITY_REMOTE_CONTROL 0x00000010
303 #define WTS_SECURITY_LOGON 0x00000020
304 #define WTS_SECURITY_LOGOFF 0x00000040
305 #define WTS_SECURITY_MESSAGE 0x00000080
306 #define WTS_SECURITY_CONNECT 0x00000100
307 #define WTS_SECURITY_DISCONNECT 0x00000200
309 #define WTS_SECURITY_GUEST_ACCESS (WTS_SECURITY_LOGON)
311 #define WTS_SECURITY_CURRENT_GUEST_ACCESS (WTS_SECURITY_VIRTUAL_CHANNELS | WTS_SECURITY_LOGOFF)
313 #define WTS_SECURITY_USER_ACCESS \
314 (WTS_SECURITY_CURRENT_GUEST_ACCESS | WTS_SECURITY_QUERY_INFORMATION | WTS_SECURITY_CONNECT)
316 #define WTS_SECURITY_CURRENT_USER_ACCESS \
317 (WTS_SECURITY_SET_INFORMATION | WTS_SECURITY_RESET WTS_SECURITY_VIRTUAL_CHANNELS | \
318 WTS_SECURITY_LOGOFF WTS_SECURITY_DISCONNECT)
320 #define WTS_SECURITY_ALL_ACCESS \
321 (STANDARD_RIGHTS_REQUIRED | WTS_SECURITY_QUERY_INFORMATION | WTS_SECURITY_SET_INFORMATION | \
322 WTS_SECURITY_RESET | WTS_SECURITY_VIRTUAL_CHANNELS | WTS_SECURITY_REMOTE_CONTROL | \
323 WTS_SECURITY_LOGON | WTS_SECURITY_MESSAGE | WTS_SECURITY_CONNECT | WTS_SECURITY_DISCONNECT)
337 } WTS_CONNECTSTATE_CLASS;
352 LPWSTR pWinStationName;
353 WTS_CONNECTSTATE_CLASS State;
359 LPSTR pWinStationName;
360 WTS_CONNECTSTATE_CLASS State;
366 WTS_CONNECTSTATE_CLASS State;
378 WTS_CONNECTSTATE_CLASS State;
403 #define WTS_PROTOCOL_TYPE_CONSOLE 0
404 #define WTS_PROTOCOL_TYPE_ICA 1
405 #define WTS_PROTOCOL_TYPE_RDP 2
418 WTSClientBuildNumber,
425 WTSClientProtocolType,
444 ULONG fConnectClientDrivesAtLogon;
445 ULONG fConnectPrinterAtLogon;
446 ULONG fDisablePrinterRedirection;
447 ULONG fDisableDefaultMainClientPrinter;
448 ULONG ShadowSettings;
449 WCHAR LogonUserName[USERNAME_LENGTH + 1];
450 WCHAR LogonDomain[DOMAIN_LENGTH + 1];
451 WCHAR WorkDirectory[MAX_PATH + 1];
452 WCHAR InitialProgram[MAX_PATH + 1];
453 WCHAR ApplicationName[MAX_PATH + 1];
459 ULONG fConnectClientDrivesAtLogon;
460 ULONG fConnectPrinterAtLogon;
461 ULONG fDisablePrinterRedirection;
462 ULONG fDisableDefaultMainClientPrinter;
463 ULONG ShadowSettings;
464 CHAR LogonUserName[USERNAME_LENGTH + 1];
465 CHAR LogonDomain[DOMAIN_LENGTH + 1];
466 CHAR WorkDirectory[MAX_PATH + 1];
467 CHAR InitialProgram[MAX_PATH + 1];
468 CHAR ApplicationName[MAX_PATH + 1];
473 WTS_CONNECTSTATE_CLASS State;
477 DWORD IncomingFrames;
478 DWORD OutgoingFrames;
479 DWORD IncomingCompressedBytes;
480 DWORD OutgoingCompressedBytes;
481 WCHAR WinStationName[WINSTATIONNAME_LENGTH];
482 WCHAR Domain[DOMAIN_LENGTH];
483 WCHAR UserName[USERNAME_LENGTH + 1];
484 LARGE_INTEGER ConnectTime;
485 LARGE_INTEGER DisconnectTime;
486 LARGE_INTEGER LastInputTime;
487 LARGE_INTEGER LogonTime;
488 LARGE_INTEGER _CurrentTime;
493 WTS_CONNECTSTATE_CLASS State;
497 DWORD IncomingFrames;
498 DWORD OutgoingFrames;
499 DWORD IncomingCompressedBytes;
500 DWORD OutgoingCompressedBy;
501 CHAR WinStationName[WINSTATIONNAME_LENGTH];
502 CHAR Domain[DOMAIN_LENGTH];
503 CHAR UserName[USERNAME_LENGTH + 1];
504 LARGE_INTEGER ConnectTime;
505 LARGE_INTEGER DisconnectTime;
506 LARGE_INTEGER LastInputTime;
507 LARGE_INTEGER LogonTime;
508 LARGE_INTEGER _CurrentTime;
511 #define WTS_SESSIONSTATE_UNKNOWN 0xFFFFFFFF
512 #define WTS_SESSIONSTATE_LOCK 0x00000000
513 #define WTS_SESSIONSTATE_UNLOCK 0x00000001
518 WTS_CONNECTSTATE_CLASS SessionState;
520 WCHAR WinStationName[WINSTATIONNAME_LENGTH + 1];
521 WCHAR UserName[USERNAME_LENGTH + 1];
522 WCHAR DomainName[DOMAIN_LENGTH + 1];
523 LARGE_INTEGER LogonTime;
524 LARGE_INTEGER ConnectTime;
525 LARGE_INTEGER DisconnectTime;
526 LARGE_INTEGER LastInputTime;
527 LARGE_INTEGER _CurrentTime;
530 DWORD IncomingFrames;
531 DWORD OutgoingFrames;
532 DWORD IncomingCompressedBytes;
533 DWORD OutgoingCompressedBytes;
539 WTS_CONNECTSTATE_CLASS SessionState;
541 CHAR WinStationName[WINSTATIONNAME_LENGTH + 1];
542 CHAR UserName[USERNAME_LENGTH + 1];
543 CHAR DomainName[DOMAIN_LENGTH + 1];
544 LARGE_INTEGER LogonTime;
545 LARGE_INTEGER ConnectTime;
546 LARGE_INTEGER DisconnectTime;
547 LARGE_INTEGER LastInputTime;
548 LARGE_INTEGER _CurrentTime;
551 DWORD IncomingFrames;
552 DWORD OutgoingFrames;
553 DWORD IncomingCompressedBytes;
554 DWORD OutgoingCompressedBytes;
581 WCHAR ClientName[CLIENTNAME_LENGTH + 1];
582 WCHAR Domain[DOMAIN_LENGTH + 1];
583 WCHAR UserName[USERNAME_LENGTH + 1];
584 WCHAR WorkDirectory[MAX_PATH + 1];
585 WCHAR InitialProgram[MAX_PATH + 1];
586 BYTE EncryptionLevel;
587 ULONG ClientAddressFamily;
588 USHORT ClientAddress[CLIENTADDRESS_LENGTH + 1];
592 WCHAR ClientDirectory[MAX_PATH + 1];
593 ULONG ClientBuildNumber;
594 ULONG ClientHardwareId;
595 USHORT ClientProductId;
596 USHORT OutBufCountHost;
597 USHORT OutBufCountClient;
599 WCHAR DeviceId[MAX_PATH + 1];
604 CHAR ClientName[CLIENTNAME_LENGTH + 1];
605 CHAR Domain[DOMAIN_LENGTH + 1];
606 CHAR UserName[USERNAME_LENGTH + 1];
607 CHAR WorkDirectory[MAX_PATH + 1];
608 CHAR InitialProgram[MAX_PATH + 1];
609 BYTE EncryptionLevel;
610 ULONG ClientAddressFamily;
611 USHORT ClientAddress[CLIENTADDRESS_LENGTH + 1];
615 CHAR ClientDirectory[MAX_PATH + 1];
616 ULONG ClientBuildNumber;
617 ULONG ClientHardwareId;
618 USHORT ClientProductId;
619 USHORT OutBufCountHost;
620 USHORT OutBufCountClient;
622 CHAR DeviceId[MAX_PATH + 1];
625 #define PRODUCTINFO_COMPANYNAME_LENGTH 256
626 #define PRODUCTINFO_PRODUCTID_LENGTH 4
630 CHAR CompanyName[PRODUCTINFO_COMPANYNAME_LENGTH];
631 CHAR ProductID[PRODUCTINFO_PRODUCTID_LENGTH];
636 WCHAR CompanyName[PRODUCTINFO_COMPANYNAME_LENGTH];
637 WCHAR ProductID[PRODUCTINFO_PRODUCTID_LENGTH];
640 #define VALIDATIONINFORMATION_LICENSE_LENGTH 16384
641 #define VALIDATIONINFORMATION_HARDWAREID_LENGTH 20
646 BYTE License[VALIDATIONINFORMATION_LICENSE_LENGTH];
648 BYTE HardwareID[VALIDATIONINFORMATION_HARDWAREID_LENGTH];
649 DWORD HardwareIDLength;
655 BYTE License[VALIDATIONINFORMATION_LICENSE_LENGTH];
657 BYTE HardwareID[VALIDATIONINFORMATION_HARDWAREID_LENGTH];
658 DWORD HardwareIDLength;
669 DWORD HorizontalResolution;
670 DWORD VerticalResolution;
676 WTSUserConfigInitialProgram,
677 WTSUserConfigWorkingDirectory,
678 WTSUserConfigfInheritInitialProgram,
679 WTSUserConfigfAllowLogonTerminalServer,
680 WTSUserConfigTimeoutSettingsConnections,
681 WTSUserConfigTimeoutSettingsDisconnections,
682 WTSUserConfigTimeoutSettingsIdle,
683 WTSUserConfigfDeviceClientDrives,
684 WTSUserConfigfDeviceClientPrinters,
685 WTSUserConfigfDeviceClientDefaultPrinter,
686 WTSUserConfigBrokenTimeoutSettings,
687 WTSUserConfigReconnectSettings,
688 WTSUserConfigModemCallbackSettings,
689 WTSUserConfigModemCallbackPhoneNumber,
690 WTSUserConfigShadowingSettings,
691 WTSUserConfigTerminalServerProfilePath,
692 WTSUserConfigTerminalServerHomeDir,
693 WTSUserConfigTerminalServerHomeDirDrive,
694 WTSUserConfigfTerminalServerRemoteHomeDir,
700 WTSUserConfigSourceSAM
706 DWORD InheritInitialProgram;
707 DWORD AllowLogonTerminalServer;
708 DWORD TimeoutSettingsConnections;
709 DWORD TimeoutSettingsDisconnections;
710 DWORD TimeoutSettingsIdle;
711 DWORD DeviceClientDrives;
712 DWORD DeviceClientPrinters;
713 DWORD ClientDefaultPrinter;
714 DWORD BrokenTimeoutSettings;
715 DWORD ReconnectSettings;
716 DWORD ShadowingSettings;
717 DWORD TerminalServerRemoteHomeDir;
718 CHAR InitialProgram[MAX_PATH + 1];
719 CHAR WorkDirectory[MAX_PATH + 1];
720 CHAR TerminalServerProfilePath[MAX_PATH + 1];
721 CHAR TerminalServerHomeDir[MAX_PATH + 1];
722 CHAR TerminalServerHomeDirDrive[WTS_DRIVE_LENGTH + 1];
728 DWORD InheritInitialProgram;
729 DWORD AllowLogonTerminalServer;
730 DWORD TimeoutSettingsConnections;
731 DWORD TimeoutSettingsDisconnections;
732 DWORD TimeoutSettingsIdle;
733 DWORD DeviceClientDrives;
734 DWORD DeviceClientPrinters;
735 DWORD ClientDefaultPrinter;
736 DWORD BrokenTimeoutSettings;
737 DWORD ReconnectSettings;
738 DWORD ShadowingSettings;
739 DWORD TerminalServerRemoteHomeDir;
740 WCHAR InitialProgram[MAX_PATH + 1];
741 WCHAR WorkDirectory[MAX_PATH + 1];
742 WCHAR TerminalServerProfilePath[MAX_PATH + 1];
743 WCHAR TerminalServerHomeDir[MAX_PATH + 1];
744 WCHAR TerminalServerHomeDirDrive[WTS_DRIVE_LENGTH + 1];
747 #define WTS_EVENT_NONE 0x00000000
748 #define WTS_EVENT_CREATE 0x00000001
749 #define WTS_EVENT_DELETE 0x00000002
750 #define WTS_EVENT_RENAME 0x00000004
751 #define WTS_EVENT_CONNECT 0x00000008
752 #define WTS_EVENT_DISCONNECT 0x00000010
753 #define WTS_EVENT_LOGON 0x00000020
754 #define WTS_EVENT_LOGOFF 0x00000040
755 #define WTS_EVENT_STATECHANGE 0x00000080
756 #define WTS_EVENT_LICENSE 0x00000100
757 #define WTS_EVENT_ALL 0x7FFFFFFF
758 #define WTS_EVENT_FLUSH 0x80000000
760 #define REMOTECONTROL_KBDSHIFT_HOTKEY 0x1
761 #define REMOTECONTROL_KBDCTRL_HOTKEY 0x2
762 #define REMOTECONTROL_KBDALT_HOTKEY 0x4
766 WTSVirtualClientData,
767 WTSVirtualFileHandle,
768 WTSVirtualEventHandle,
769 WTSVirtualChannelReady,
770 WTSVirtualChannelOpenStatus
779 #define WTS_CHANNEL_OPTION_DYNAMIC 0x00000001
780 #define WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW 0x00000000
781 #define WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED 0x00000002
782 #define WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH 0x00000004
783 #define WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL 0x00000006
784 #define WTS_CHANNEL_OPTION_DYNAMIC_NO_COMPRESS 0x00000008
786 #define NOTIFY_FOR_ALL_SESSIONS 1
787 #define NOTIFY_FOR_THIS_SESSION 0
789 #define WTS_PROCESS_INFO_LEVEL_0 0
790 #define WTS_PROCESS_INFO_LEVEL_1 1
798 DWORD NumberOfThreads;
801 DWORD PeakPagefileUsage;
802 DWORD WorkingSetSize;
803 DWORD PeakWorkingSetSize;
804 LARGE_INTEGER UserTime;
805 LARGE_INTEGER KernelTime;
814 DWORD NumberOfThreads;
817 DWORD PeakPagefileUsage;
818 DWORD WorkingSetSize;
819 DWORD PeakWorkingSetSize;
820 LARGE_INTEGER UserTime;
821 LARGE_INTEGER KernelTime;
826 WTSTypeProcessInfoLevel0,
827 WTSTypeProcessInfoLevel1,
828 WTSTypeSessionInfoLevel1
831 typedef WCHAR WTSLISTENERNAMEW[WTS_LISTENER_NAME_LENGTH + 1];
832 typedef WTSLISTENERNAMEW* PWTSLISTENERNAMEW;
833 typedef CHAR WTSLISTENERNAMEA[WTS_LISTENER_NAME_LENGTH + 1];
834 typedef WTSLISTENERNAMEA* PWTSLISTENERNAMEA;
839 ULONG fEnableListener;
840 ULONG MaxConnectionCount;
841 ULONG fPromptForPassword;
842 ULONG fInheritColorDepth;
844 ULONG fInheritBrokenTimeoutSettings;
845 ULONG BrokenTimeoutSettings;
846 ULONG fDisablePrinterRedirection;
847 ULONG fDisableDriveRedirection;
848 ULONG fDisableComPortRedirection;
849 ULONG fDisableLPTPortRedirection;
850 ULONG fDisableClipboardRedirection;
851 ULONG fDisableAudioRedirection;
852 ULONG fDisablePNPRedirection;
853 ULONG fDisableDefaultMainClientPrinter;
856 ULONG fInheritShadowSettings;
857 ULONG ShadowSettings;
858 ULONG TimeoutSettingsConnection;
859 ULONG TimeoutSettingsDisconnection;
860 ULONG TimeoutSettingsIdle;
862 ULONG MinEncryptionLevel;
863 ULONG UserAuthentication;
864 WCHAR Comment[WTS_COMMENT_LENGTH + 1];
865 WCHAR LogonUserName[USERNAME_LENGTH + 1];
866 WCHAR LogonDomain[DOMAIN_LENGTH + 1];
867 WCHAR WorkDirectory[MAX_PATH + 1];
868 WCHAR InitialProgram[MAX_PATH + 1];
874 ULONG fEnableListener;
875 ULONG MaxConnectionCount;
876 ULONG fPromptForPassword;
877 ULONG fInheritColorDepth;
879 ULONG fInheritBrokenTimeoutSettings;
880 ULONG BrokenTimeoutSettings;
881 ULONG fDisablePrinterRedirection;
882 ULONG fDisableDriveRedirection;
883 ULONG fDisableComPortRedirection;
884 ULONG fDisableLPTPortRedirection;
885 ULONG fDisableClipboardRedirection;
886 ULONG fDisableAudioRedirection;
887 ULONG fDisablePNPRedirection;
888 ULONG fDisableDefaultMainClientPrinter;
891 ULONG fInheritShadowSettings;
892 ULONG ShadowSettings;
893 ULONG TimeoutSettingsConnection;
894 ULONG TimeoutSettingsDisconnection;
895 ULONG TimeoutSettingsIdle;
897 ULONG MinEncryptionLevel;
898 ULONG UserAuthentication;
899 CHAR Comment[WTS_COMMENT_LENGTH + 1];
900 CHAR LogonUserName[USERNAME_LENGTH + 1];
901 CHAR LogonDomain[DOMAIN_LENGTH + 1];
902 CHAR WorkDirectory[MAX_PATH + 1];
903 CHAR InitialProgram[MAX_PATH + 1];
907 #define WTS_SERVER_INFO WTS_SERVER_INFOW
908 #define PWTS_SERVER_INFO PWTS_SERVER_INFOW
909 #define WTS_SESSION_INFO WTS_SESSION_INFOW
910 #define PWTS_SESSION_INFO PWTS_SESSION_INFOW
911 #define WTS_SESSION_INFO_1 WTS_SESSION_INFO_1W
912 #define PWTS_SESSION_INFO_1 PWTS_SESSION_INFO_1W
913 #define WTS_PROCESS_INFO WTS_PROCESS_INFOW
914 #define PWTS_PROCESS_INFO PWTS_PROCESS_INFOW
915 #define WTSCONFIGINFO WTSCONFIGINFOW
916 #define PWTSCONFIGINFO PWTSCONFIGINFOW
917 #define WTSINFO WTSINFOW
918 #define PWTSINFO PWTSINFOW
919 #define WTSINFOEX WTSINFOEXW
920 #define PWTSINFOEX PWTSINFOEXW
921 #define WTSINFOEX_LEVEL WTSINFOEX_LEVEL_W
922 #define PWTSINFOEX_LEVEL PWTSINFOEX_LEVEL_W
923 #define WTSINFOEX_LEVEL1 WTSINFOEX_LEVEL1_W
924 #define PWTSINFOEX_LEVEL1 PWTSINFOEX_LEVEL1_W
925 #define WTSCLIENT WTSCLIENTW
926 #define PWTSCLIENT PWTSCLIENTW
927 #define PRODUCT_INFO PRODUCT_INFOW
928 #define WTS_VALIDATION_INFORMATION WTS_VALIDATION_INFORMATIONW
929 #define PWTS_VALIDATION_INFORMATION PWTS_VALIDATION_INFORMATIONW
930 #define WTSUSERCONFIG WTSUSERCONFIGW
931 #define PWTSUSERCONFIG PWTSUSERCONFIGW
932 #define WTS_PROCESS_INFO_EX WTS_PROCESS_INFO_EXW
933 #define PWTS_PROCESS_INFO_EX PWTS_PROCESS_INFO_EXW
934 #define WTSLISTENERNAME WTSLISTENERNAMEW
935 #define PWTSLISTENERNAME PWTSLISTENERNAMEW
936 #define WTSLISTENERCONFIG WTSLISTENERCONFIGW
937 #define PWTSLISTENERCONFIG PWTSLISTENERCONFIGW
939 #define WTS_SERVER_INFO WTS_SERVER_INFOA
940 #define PWTS_SERVER_INFO PWTS_SERVER_INFOA
941 #define WTS_SESSION_INFO WTS_SESSION_INFOA
942 #define PWTS_SESSION_INFO PWTS_SESSION_INFOA
943 #define WTS_SESSION_INFO_1 WTS_SESSION_INFO_1A
944 #define PWTS_SESSION_INFO_1 PWTS_SESSION_INFO_1A
945 #define WTS_PROCESS_INFO WTS_PROCESS_INFOA
946 #define PWTS_PROCESS_INFO PWTS_PROCESS_INFOA
947 #define WTSCONFIGINFO WTSCONFIGINFOA
948 #define PWTSCONFIGINFO PWTSCONFIGINFOA
949 #define WTSINFO WTSINFOA
950 #define PWTSINFO PWTSINFOA
951 #define WTSINFOEX WTSINFOEXA
952 #define PWTSINFOEX PWTSINFOEXA
953 #define WTSINFOEX_LEVEL WTSINFOEX_LEVEL_A
954 #define PWTSINFOEX_LEVEL PWTSINFOEX_LEVEL_A
955 #define WTSINFOEX_LEVEL1 WTSINFOEX_LEVEL1_A
956 #define PWTSINFOEX_LEVEL1 PWTSINFOEX_LEVEL1_A
957 #define WTSCLIENT WTSCLIENTA
958 #define PWTSCLIENT PWTSCLIENTA
959 #define PRODUCT_INFO PRODUCT_INFOA
960 #define WTS_VALIDATION_INFORMATION WTS_VALIDATION_INFORMATIONA
961 #define PWTS_VALIDATION_INFORMATION PWTS_VALIDATION_INFORMATIONA
962 #define WTSUSERCONFIG WTSUSERCONFIGA
963 #define PWTSUSERCONFIG PWTSUSERCONFIGA
964 #define WTS_PROCESS_INFO_EX WTS_PROCESS_INFO_EXA
965 #define PWTS_PROCESS_INFO_EX PWTS_PROCESS_INFO_EXA
966 #define WTSLISTENERNAME WTSLISTENERNAMEA
967 #define PWTSLISTENERNAME PWTSLISTENERNAMEA
968 #define WTSLISTENERCONFIG WTSLISTENERCONFIGA
969 #define PWTSLISTENERCONFIG PWTSLISTENERCONFIGA
972 #define REMOTECONTROL_FLAG_DISABLE_KEYBOARD 0x00000001
973 #define REMOTECONTROL_FLAG_DISABLE_MOUSE 0x00000002
974 #define REMOTECONTROL_FLAG_DISABLE_INPUT \
975 REMOTECONTROL_FLAG_DISABLE_KEYBOARD | REMOTECONTROL_FLAG_DISABLE_MOUSE
982 WINPR_API BOOL WINAPI WTSStopRemoteControlSession(ULONG LogonId);
984 WINPR_API BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName,
985 ULONG TargetLogonId, BYTE HotkeyVk,
986 USHORT HotkeyModifiers);
987 WINPR_API BOOL WINAPI WTSStartRemoteControlSessionA(LPSTR pTargetServerName,
988 ULONG TargetLogonId, BYTE HotkeyVk,
989 USHORT HotkeyModifiers);
991 WINPR_API BOOL WINAPI WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName,
992 ULONG TargetLogonId, BYTE HotkeyVk,
993 USHORT HotkeyModifiers, DWORD flags);
994 WINPR_API BOOL WINAPI WTSStartRemoteControlSessionExA(LPSTR pTargetServerName,
995 ULONG TargetLogonId, BYTE HotkeyVk,
996 USHORT HotkeyModifiers, DWORD flags);
998 WINPR_API BOOL WINAPI WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword,
1000 WINPR_API BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword,
1003 WINPR_API BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version,
1005 WINPR_API BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version,
1008 WINPR_API VOID WINAPI WTSCloseServer(HANDLE hServer);
1010 WINPR_ATTR_MALLOC(WTSCloseServer, 1)
1011 WINPR_API HANDLE WINAPI WTSOpenServerW(LPWSTR pServerName);
1013 WINPR_ATTR_MALLOC(WTSCloseServer, 1)
1014 WINPR_API HANDLE WINAPI WTSOpenServerA(LPSTR pServerName);
1016 WINPR_ATTR_MALLOC(WTSCloseServer, 1)
1017 WINPR_API HANDLE WINAPI WTSOpenServerExW(LPWSTR pServerName);
1019 WINPR_ATTR_MALLOC(WTSCloseServer, 1)
1020 WINPR_API HANDLE WINAPI WTSOpenServerExA(LPSTR pServerName);
1022 WINPR_API BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
1024 WINPR_API BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
1027 WINPR_API BOOL WINAPI WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel, DWORD Filter,
1030 WINPR_API BOOL WINAPI WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel, DWORD Filter,
1034 WINPR_API BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
1036 WINPR_API BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version,
1039 WINPR_API BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode);
1041 WINPR_API BOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId,
1042 WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer,
1043 DWORD* pBytesReturned);
1044 WINPR_API BOOL WINAPI WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId,
1045 WTS_INFO_CLASS WTSInfoClass, LPSTR* ppBuffer,
1046 DWORD* pBytesReturned);
1048 WINPR_API BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
1049 WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer,
1050 DWORD* pBytesReturned);
1051 WINPR_API BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName,
1052 WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer,
1053 DWORD* pBytesReturned);
1055 WINPR_API BOOL WINAPI WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
1056 WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer,
1058 WINPR_API BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName,
1059 WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer,
1062 WINPR_API BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle,
1063 DWORD TitleLength, LPWSTR pMessage, DWORD MessageLength,
1064 DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait);
1065 WINPR_API BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle,
1066 DWORD TitleLength, LPSTR pMessage, DWORD MessageLength,
1067 DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait);
1069 WINPR_API BOOL WINAPI WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait);
1071 WINPR_API BOOL WINAPI WTSLogoffSession(HANDLE hServer, DWORD SessionId, BOOL bWait);
1073 WINPR_API BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag);
1075 WINPR_API BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags);
1077 WINPR_API BOOL WINAPI WTSVirtualChannelClose(HANDLE hChannelHandle);
1079 WINPR_ATTR_MALLOC(WTSVirtualChannelClose, 1)
1080 WINPR_API HANDLE WINAPI WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId,
1081 LPSTR pVirtualName);
1083 WINPR_ATTR_MALLOC(WTSVirtualChannelClose, 1)
1084 WINPR_API HANDLE WINAPI WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName,
1087 WINPR_API BOOL WINAPI WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer,
1088 ULONG BufferSize, PULONG pBytesRead);
1090 WINPR_API BOOL WINAPI WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length,
1091 PULONG pBytesWritten);
1093 WINPR_API BOOL WINAPI WTSVirtualChannelPurgeInput(HANDLE hChannelHandle);
1095 WINPR_API BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle);
1097 WINPR_API BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle,
1098 WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer,
1099 DWORD* pBytesReturned);
1101 WINPR_API VOID WINAPI WTSFreeMemory(PVOID pMemory);
1103 WINPR_API BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags);
1105 WINPR_API BOOL WINAPI WTSUnRegisterSessionNotification(HWND hWnd);
1107 WINPR_API BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd,
1110 WINPR_API BOOL WINAPI WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd);
1112 WINPR_API BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE phToken);
1114 WINPR_API BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
1115 ULONG NumberOfEntries);
1116 WINPR_API BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
1117 ULONG NumberOfEntries);
1119 WINPR_API BOOL WINAPI WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel, DWORD SessionId,
1120 LPWSTR* ppProcessInfo, DWORD* pCount);
1121 WINPR_API BOOL WINAPI WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel, DWORD SessionId,
1122 LPSTR* ppProcessInfo, DWORD* pCount);
1124 WINPR_API BOOL WINAPI WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1125 PWTSLISTENERNAMEW pListeners, DWORD* pCount);
1126 WINPR_API BOOL WINAPI WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1127 PWTSLISTENERNAMEA pListeners, DWORD* pCount);
1129 WINPR_API BOOL WINAPI WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1130 LPWSTR pListenerName,
1132 WINPR_API BOOL WINAPI WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1135 WINPR_API BOOL WINAPI WTSCreateListenerW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1138 WINPR_API BOOL WINAPI WTSCreateListenerA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1142 WINPR_API BOOL WINAPI WTSSetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1143 LPWSTR pListenerName,
1144 SECURITY_INFORMATION SecurityInformation,
1145 PSECURITY_DESCRIPTOR pSecurityDescriptor);
1146 WINPR_API BOOL WINAPI WTSSetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1147 LPSTR pListenerName,
1148 SECURITY_INFORMATION SecurityInformation,
1149 PSECURITY_DESCRIPTOR pSecurityDescriptor);
1151 WINPR_API BOOL WINAPI WTSGetListenerSecurityW(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1152 LPWSTR pListenerName,
1153 SECURITY_INFORMATION SecurityInformation,
1154 PSECURITY_DESCRIPTOR pSecurityDescriptor,
1155 DWORD nLength, LPDWORD lpnLengthNeeded);
1156 WINPR_API BOOL WINAPI WTSGetListenerSecurityA(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1157 LPSTR pListenerName,
1158 SECURITY_INFORMATION SecurityInformation,
1159 PSECURITY_DESCRIPTOR pSecurityDescriptor,
1160 DWORD nLength, LPDWORD lpnLengthNeeded);
1168 WINPR_API BOOL CDECL WTSEnableChildSessions(BOOL bEnable);
1170 WINPR_API BOOL CDECL WTSIsChildSessionsEnabled(PBOOL pbEnabled);
1172 WINPR_API BOOL CDECL WTSGetChildSessionId(PULONG pSessionId);
1174 WINPR_API BOOL CDECL WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password,
1177 WINPR_API BOOL CDECL WTSLogoffUser(HANDLE hServer);
1184 #define WTSStartRemoteControlSession WTSStartRemoteControlSessionW
1185 #define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExW
1186 #define WTSConnectSession WTSConnectSessionW
1187 #define WTSEnumerateServers WTSEnumerateServersW
1188 #define WTSOpenServer WTSOpenServerW
1189 #define WTSOpenServerEx WTSOpenServerExW
1190 #define WTSEnumerateSessions WTSEnumerateSessionsW
1191 #define WTSEnumerateSessionsEx WTSEnumerateSessionsExW
1192 #define WTSEnumerateProcesses WTSEnumerateProcessesW
1193 #define WTSQuerySessionInformation WTSQuerySessionInformationW
1194 #define WTSQueryUserConfig WTSQueryUserConfigW
1195 #define WTSSetUserConfig WTSSetUserConfigW
1196 #define WTSSendMessage WTSSendMessageW
1197 #define WTSFreeMemoryEx WTSFreeMemoryExW
1198 #define WTSEnumerateProcessesEx WTSEnumerateProcessesExW
1199 #define WTSEnumerateListeners WTSEnumerateListenersW
1200 #define WTSQueryListenerConfig WTSQueryListenerConfigW
1201 #define WTSCreateListener WTSCreateListenerW
1202 #define WTSSetListenerSecurity WTSSetListenerSecurityW
1203 #define WTSGetListenerSecurity WTSGetListenerSecurityW
1205 #define WTSStartRemoteControlSession WTSStartRemoteControlSessionA
1206 #define WTSStartRemoteControlSessionEx WTSStartRemoteControlSessionExA
1207 #define WTSConnectSession WTSConnectSessionA
1208 #define WTSEnumerateServers WTSEnumerateServersA
1209 #define WTSOpenServer WTSOpenServerA
1210 #define WTSOpenServerEx WTSOpenServerExA
1211 #define WTSEnumerateSessions WTSEnumerateSessionsA
1212 #define WTSEnumerateSessionsEx WTSEnumerateSessionsExA
1213 #define WTSEnumerateProcesses WTSEnumerateProcessesA
1214 #define WTSQuerySessionInformation WTSQuerySessionInformationA
1215 #define WTSQueryUserConfig WTSQueryUserConfigA
1216 #define WTSSetUserConfig WTSSetUserConfigA
1217 #define WTSSendMessage WTSSendMessageA
1218 #define WTSFreeMemoryEx WTSFreeMemoryExA
1219 #define WTSEnumerateProcessesEx WTSEnumerateProcessesExA
1220 #define WTSEnumerateListeners WTSEnumerateListenersA
1221 #define WTSQueryListenerConfig WTSQueryListenerConfigA
1222 #define WTSCreateListener WTSCreateListenerA
1223 #define WTSSetListenerSecurity WTSSetListenerSecurityA
1224 #define WTSGetListenerSecurity WTSGetListenerSecurityA
1236 WINPR_API DWORD WINAPI WTSGetActiveConsoleSessionId(
void);
1240 typedef BOOL(WINAPI* WTS_STOP_REMOTE_CONTROL_SESSION_FN)(ULONG LogonId);
1242 typedef BOOL(WINAPI* WTS_START_REMOTE_CONTROL_SESSION_FN_W)(LPWSTR pTargetServerName,
1243 ULONG TargetLogonId, BYTE HotkeyVk,
1244 USHORT HotkeyModifiers);
1245 typedef BOOL(WINAPI* WTS_START_REMOTE_CONTROL_SESSION_FN_A)(LPSTR pTargetServerName,
1246 ULONG TargetLogonId, BYTE HotkeyVk,
1247 USHORT HotkeyModifiers);
1249 typedef BOOL(WINAPI* WTS_START_REMOTE_CONTROL_SESSION_EX_FN_W)(LPWSTR pTargetServerName,
1250 ULONG TargetLogonId, BYTE HotkeyVk,
1251 USHORT HotkeyModifiers, DWORD flags);
1252 typedef BOOL(WINAPI* WTS_START_REMOTE_CONTROL_SESSION_EX_FN_A)(LPSTR pTargetServerName,
1253 ULONG TargetLogonId, BYTE HotkeyVk,
1254 USHORT HotkeyModifiers, DWORD flags);
1256 typedef BOOL(WINAPI* WTS_CONNECT_SESSION_FN_W)(ULONG LogonId, ULONG TargetLogonId, PWSTR pPassword,
1258 typedef BOOL(WINAPI* WTS_CONNECT_SESSION_FN_A)(ULONG LogonId, ULONG TargetLogonId, PSTR pPassword,
1261 typedef BOOL(WINAPI* WTS_ENUMERATE_SERVERS_FN_W)(LPWSTR pDomainName, DWORD Reserved, DWORD Version,
1263 typedef BOOL(WINAPI* WTS_ENUMERATE_SERVERS_FN_A)(LPSTR pDomainName, DWORD Reserved, DWORD Version,
1266 typedef HANDLE(WINAPI* WTS_OPEN_SERVER_FN_W)(LPWSTR pServerName);
1267 typedef HANDLE(WINAPI* WTS_OPEN_SERVER_FN_A)(LPSTR pServerName);
1269 typedef HANDLE(WINAPI* WTS_OPEN_SERVER_EX_FN_W)(LPWSTR pServerName);
1270 typedef HANDLE(WINAPI* WTS_OPEN_SERVER_EX_FN_A)(LPSTR pServerName);
1272 typedef VOID(WINAPI* WTS_CLOSE_SERVER_FN)(HANDLE hServer);
1274 typedef BOOL(WINAPI* WTS_ENUMERATE_SESSIONS_FN_W)(HANDLE hServer, DWORD Reserved, DWORD Version,
1276 typedef BOOL(WINAPI* WTS_ENUMERATE_SESSIONS_FN_A)(HANDLE hServer, DWORD Reserved, DWORD Version,
1279 typedef BOOL(WINAPI* WTS_ENUMERATE_SESSIONS_EX_FN_W)(HANDLE hServer, DWORD* pLevel, DWORD Filter,
1282 typedef BOOL(WINAPI* WTS_ENUMERATE_SESSIONS_EX_FN_A)(HANDLE hServer, DWORD* pLevel, DWORD Filter,
1286 typedef BOOL(WINAPI* WTS_ENUMERATE_PROCESSES_FN_W)(HANDLE hServer, DWORD Reserved, DWORD Version,
1289 typedef BOOL(WINAPI* WTS_ENUMERATE_PROCESSES_FN_A)(HANDLE hServer, DWORD Reserved, DWORD Version,
1293 typedef BOOL(WINAPI* WTS_TERMINATE_PROCESS_FN)(HANDLE hServer, DWORD ProcessId, DWORD ExitCode);
1295 typedef BOOL(WINAPI* WTS_QUERY_SESSION_INFORMATION_FN_W)(HANDLE hServer, DWORD SessionId,
1296 WTS_INFO_CLASS WTSInfoClass,
1297 LPWSTR* ppBuffer, DWORD* pBytesReturned);
1298 typedef BOOL(WINAPI* WTS_QUERY_SESSION_INFORMATION_FN_A)(HANDLE hServer, DWORD SessionId,
1299 WTS_INFO_CLASS WTSInfoClass,
1300 LPSTR* ppBuffer, DWORD* pBytesReturned);
1302 typedef BOOL(WINAPI* WTS_QUERY_USER_CONFIG_FN_W)(LPWSTR pServerName, LPWSTR pUserName,
1303 WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer,
1304 DWORD* pBytesReturned);
1305 typedef BOOL(WINAPI* WTS_QUERY_USER_CONFIG_FN_A)(LPSTR pServerName, LPSTR pUserName,
1306 WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer,
1307 DWORD* pBytesReturned);
1309 typedef BOOL(WINAPI* WTS_SET_USER_CONFIG_FN_W)(LPWSTR pServerName, LPWSTR pUserName,
1310 WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer,
1312 typedef BOOL(WINAPI* WTS_SET_USER_CONFIG_FN_A)(LPSTR pServerName, LPSTR pUserName,
1313 WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer,
1316 typedef BOOL(WINAPI* WTS_SEND_MESSAGE_FN_W)(HANDLE hServer, DWORD SessionId, LPWSTR pTitle,
1317 DWORD TitleLength, LPWSTR pMessage, DWORD MessageLength,
1318 DWORD Style, DWORD Timeout, DWORD* pResponse,
1320 typedef BOOL(WINAPI* WTS_SEND_MESSAGE_FN_A)(HANDLE hServer, DWORD SessionId, LPSTR pTitle,
1321 DWORD TitleLength, LPSTR pMessage, DWORD MessageLength,
1322 DWORD Style, DWORD Timeout, DWORD* pResponse,
1325 typedef BOOL(WINAPI* WTS_DISCONNECT_SESSION_FN)(HANDLE hServer, DWORD SessionId, BOOL bWait);
1327 typedef BOOL(WINAPI* WTS_LOGOFF_SESSION_FN)(HANDLE hServer, DWORD SessionId, BOOL bWait);
1329 typedef BOOL(WINAPI* WTS_SHUTDOWN_SYSTEM_FN)(HANDLE hServer, DWORD ShutdownFlag);
1331 typedef BOOL(WINAPI* WTS_WAIT_SYSTEM_EVENT_FN)(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags);
1333 typedef HANDLE(WINAPI* WTS_VIRTUAL_CHANNEL_OPEN_FN)(HANDLE hServer, DWORD SessionId,
1334 LPSTR pVirtualName);
1336 typedef HANDLE(WINAPI* WTS_VIRTUAL_CHANNEL_OPEN_EX_FN)(DWORD SessionId, LPSTR pVirtualName,
1339 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_CLOSE_FN)(HANDLE hChannelHandle);
1341 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_READ_FN)(HANDLE hChannelHandle, ULONG TimeOut,
1342 PCHAR Buffer, ULONG BufferSize,
1345 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_WRITE_FN)(HANDLE hChannelHandle, PCHAR Buffer,
1346 ULONG Length, PULONG pBytesWritten);
1348 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_PURGE_INPUT_FN)(HANDLE hChannelHandle);
1350 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_PURGE_OUTPUT_FN)(HANDLE hChannelHandle);
1352 typedef BOOL(WINAPI* WTS_VIRTUAL_CHANNEL_QUERY_FN)(HANDLE hChannelHandle,
1353 WTS_VIRTUAL_CLASS WtsVirtualClass,
1354 PVOID* ppBuffer, DWORD* pBytesReturned);
1356 typedef VOID(WINAPI* WTS_FREE_MEMORY_FN)(PVOID pMemory);
1358 typedef BOOL(WINAPI* WTS_REGISTER_SESSION_NOTIFICATION_FN)(HWND hWnd, DWORD dwFlags);
1360 typedef BOOL(WINAPI* WTS_UNREGISTER_SESSION_NOTIFICATION_FN)(HWND hWnd);
1362 typedef BOOL(WINAPI* WTS_REGISTER_SESSION_NOTIFICATION_EX_FN)(HANDLE hServer, HWND hWnd,
1365 typedef BOOL(WINAPI* WTS_UNREGISTER_SESSION_NOTIFICATION_EX_FN)(HANDLE hServer, HWND hWnd);
1367 typedef BOOL(WINAPI* WTS_QUERY_USER_TOKEN_FN)(ULONG SessionId, PHANDLE phToken);
1369 typedef BOOL(WINAPI* WTS_FREE_MEMORY_EX_FN_W)(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
1370 ULONG NumberOfEntries);
1371 typedef BOOL(WINAPI* WTS_FREE_MEMORY_EX_FN_A)(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
1372 ULONG NumberOfEntries);
1374 typedef BOOL(WINAPI* WTS_ENUMERATE_PROCESSES_EX_FN_W)(HANDLE hServer, DWORD* pLevel,
1375 DWORD SessionId, LPWSTR* ppProcessInfo,
1377 typedef BOOL(WINAPI* WTS_ENUMERATE_PROCESSES_EX_FN_A)(HANDLE hServer, DWORD* pLevel,
1378 DWORD SessionId, LPSTR* ppProcessInfo,
1381 typedef BOOL(WINAPI* WTS_ENUMERATE_LISTENERS_FN_W)(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1382 PWTSLISTENERNAMEW pListeners, DWORD* pCount);
1383 typedef BOOL(WINAPI* WTS_ENUMERATE_LISTENERS_FN_A)(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1384 PWTSLISTENERNAMEA pListeners, DWORD* pCount);
1386 typedef BOOL(WINAPI* WTS_QUERY_LISTENER_CONFIG_FN_W)(HANDLE hServer, PVOID pReserved,
1387 DWORD Reserved, LPWSTR pListenerName,
1389 typedef BOOL(WINAPI* WTS_QUERY_LISTENER_CONFIG_FN_A)(HANDLE hServer, PVOID pReserved,
1390 DWORD Reserved, LPSTR pListenerName,
1393 typedef BOOL(WINAPI* WTS_CREATE_LISTENER_FN_W)(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1396 typedef BOOL(WINAPI* WTS_CREATE_LISTENER_FN_A)(HANDLE hServer, PVOID pReserved, DWORD Reserved,
1400 typedef BOOL(WINAPI* WTS_SET_LISTENER_SECURITY_FN_W)(HANDLE hServer, PVOID pReserved,
1401 DWORD Reserved, LPWSTR pListenerName,
1402 SECURITY_INFORMATION SecurityInformation,
1403 PSECURITY_DESCRIPTOR pSecurityDescriptor);
1404 typedef BOOL(WINAPI* WTS_SET_LISTENER_SECURITY_FN_A)(HANDLE hServer, PVOID pReserved,
1405 DWORD Reserved, LPSTR pListenerName,
1406 SECURITY_INFORMATION SecurityInformation,
1407 PSECURITY_DESCRIPTOR pSecurityDescriptor);
1409 typedef BOOL(WINAPI* WTS_GET_LISTENER_SECURITY_FN_W)(HANDLE hServer, PVOID pReserved,
1410 DWORD Reserved, LPWSTR pListenerName,
1411 SECURITY_INFORMATION SecurityInformation,
1412 PSECURITY_DESCRIPTOR pSecurityDescriptor,
1413 DWORD nLength, LPDWORD lpnLengthNeeded);
1414 typedef BOOL(WINAPI* WTS_GET_LISTENER_SECURITY_FN_A)(HANDLE hServer, PVOID pReserved,
1415 DWORD Reserved, LPSTR pListenerName,
1416 SECURITY_INFORMATION SecurityInformation,
1417 PSECURITY_DESCRIPTOR pSecurityDescriptor,
1418 DWORD nLength, LPDWORD lpnLengthNeeded);
1420 typedef BOOL(CDECL* WTS_ENABLE_CHILD_SESSIONS_FN)(BOOL bEnable);
1422 typedef BOOL(CDECL* WTS_IS_CHILD_SESSIONS_ENABLED_FN)(PBOOL pbEnabled);
1424 typedef BOOL(CDECL* WTS_GET_CHILD_SESSION_ID_FN)(PULONG pSessionId);
1426 typedef DWORD(WINAPI* WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN)(void);
1428 typedef BOOL(WINAPI* WTS_LOGON_USER_FN)(HANDLE hServer, LPCSTR username, LPCSTR password,
1431 typedef BOOL(WINAPI* WTS_LOGOFF_USER_FN)(HANDLE hServer);
1438 WTS_STOP_REMOTE_CONTROL_SESSION_FN pStopRemoteControlSession;
1439 WTS_START_REMOTE_CONTROL_SESSION_FN_W pStartRemoteControlSessionW;
1440 WTS_START_REMOTE_CONTROL_SESSION_FN_A pStartRemoteControlSessionA;
1441 WTS_CONNECT_SESSION_FN_W pConnectSessionW;
1442 WTS_CONNECT_SESSION_FN_A pConnectSessionA;
1443 WTS_ENUMERATE_SERVERS_FN_W pEnumerateServersW;
1444 WTS_ENUMERATE_SERVERS_FN_A pEnumerateServersA;
1445 WTS_OPEN_SERVER_FN_W pOpenServerW;
1446 WTS_OPEN_SERVER_FN_A pOpenServerA;
1447 WTS_OPEN_SERVER_EX_FN_W pOpenServerExW;
1448 WTS_OPEN_SERVER_EX_FN_A pOpenServerExA;
1449 WTS_CLOSE_SERVER_FN pCloseServer;
1450 WTS_ENUMERATE_SESSIONS_FN_W pEnumerateSessionsW;
1451 WTS_ENUMERATE_SESSIONS_FN_A pEnumerateSessionsA;
1452 WTS_ENUMERATE_SESSIONS_EX_FN_W pEnumerateSessionsExW;
1453 WTS_ENUMERATE_SESSIONS_EX_FN_A pEnumerateSessionsExA;
1454 WTS_ENUMERATE_PROCESSES_FN_W pEnumerateProcessesW;
1455 WTS_ENUMERATE_PROCESSES_FN_A pEnumerateProcessesA;
1456 WTS_TERMINATE_PROCESS_FN pTerminateProcess;
1457 WTS_QUERY_SESSION_INFORMATION_FN_W pQuerySessionInformationW;
1458 WTS_QUERY_SESSION_INFORMATION_FN_A pQuerySessionInformationA;
1459 WTS_QUERY_USER_CONFIG_FN_W pQueryUserConfigW;
1460 WTS_QUERY_USER_CONFIG_FN_A pQueryUserConfigA;
1461 WTS_SET_USER_CONFIG_FN_W pSetUserConfigW;
1462 WTS_SET_USER_CONFIG_FN_A pSetUserConfigA;
1463 WTS_SEND_MESSAGE_FN_W pSendMessageW;
1464 WTS_SEND_MESSAGE_FN_A pSendMessageA;
1465 WTS_DISCONNECT_SESSION_FN pDisconnectSession;
1466 WTS_LOGOFF_SESSION_FN pLogoffSession;
1467 WTS_SHUTDOWN_SYSTEM_FN pShutdownSystem;
1468 WTS_WAIT_SYSTEM_EVENT_FN pWaitSystemEvent;
1469 WTS_VIRTUAL_CHANNEL_OPEN_FN pVirtualChannelOpen;
1470 WTS_VIRTUAL_CHANNEL_OPEN_EX_FN pVirtualChannelOpenEx;
1471 WTS_VIRTUAL_CHANNEL_CLOSE_FN pVirtualChannelClose;
1472 WTS_VIRTUAL_CHANNEL_READ_FN pVirtualChannelRead;
1473 WTS_VIRTUAL_CHANNEL_WRITE_FN pVirtualChannelWrite;
1474 WTS_VIRTUAL_CHANNEL_PURGE_INPUT_FN pVirtualChannelPurgeInput;
1475 WTS_VIRTUAL_CHANNEL_PURGE_OUTPUT_FN pVirtualChannelPurgeOutput;
1476 WTS_VIRTUAL_CHANNEL_QUERY_FN pVirtualChannelQuery;
1477 WTS_FREE_MEMORY_FN pFreeMemory;
1478 WTS_REGISTER_SESSION_NOTIFICATION_FN pRegisterSessionNotification;
1479 WTS_UNREGISTER_SESSION_NOTIFICATION_FN pUnRegisterSessionNotification;
1480 WTS_REGISTER_SESSION_NOTIFICATION_EX_FN pRegisterSessionNotificationEx;
1481 WTS_UNREGISTER_SESSION_NOTIFICATION_EX_FN pUnRegisterSessionNotificationEx;
1482 WTS_QUERY_USER_TOKEN_FN pQueryUserToken;
1483 WTS_FREE_MEMORY_EX_FN_W pFreeMemoryExW;
1484 WTS_FREE_MEMORY_EX_FN_A pFreeMemoryExA;
1485 WTS_ENUMERATE_PROCESSES_EX_FN_W pEnumerateProcessesExW;
1486 WTS_ENUMERATE_PROCESSES_EX_FN_A pEnumerateProcessesExA;
1487 WTS_ENUMERATE_LISTENERS_FN_W pEnumerateListenersW;
1488 WTS_ENUMERATE_LISTENERS_FN_A pEnumerateListenersA;
1489 WTS_QUERY_LISTENER_CONFIG_FN_W pQueryListenerConfigW;
1490 WTS_QUERY_LISTENER_CONFIG_FN_A pQueryListenerConfigA;
1491 WTS_CREATE_LISTENER_FN_W pCreateListenerW;
1492 WTS_CREATE_LISTENER_FN_A pCreateListenerA;
1493 WTS_SET_LISTENER_SECURITY_FN_W pSetListenerSecurityW;
1494 WTS_SET_LISTENER_SECURITY_FN_A pSetListenerSecurityA;
1495 WTS_GET_LISTENER_SECURITY_FN_W pGetListenerSecurityW;
1496 WTS_GET_LISTENER_SECURITY_FN_A pGetListenerSecurityA;
1497 WTS_ENABLE_CHILD_SESSIONS_FN pEnableChildSessions;
1498 WTS_IS_CHILD_SESSIONS_ENABLED_FN pIsChildSessionsEnabled;
1499 WTS_GET_CHILD_SESSION_ID_FN pGetChildSessionId;
1500 WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN pGetActiveConsoleSessionId;
1501 WTS_LOGON_USER_FN pLogonUser;
1502 WTS_LOGOFF_USER_FN pLogoffUser;
1503 WTS_START_REMOTE_CONTROL_SESSION_EX_FN_W pStartRemoteControlSessionExW;
1504 WTS_START_REMOTE_CONTROL_SESSION_EX_FN_A pStartRemoteControlSessionExA;
1516 WINPR_API
const CHAR* WTSErrorToString(UINT error);
1517 WINPR_API
const CHAR* WTSSessionStateToString(WTS_CONNECTSTATE_CLASS state);
1523 WINPR_PRAGMA_DIAG_POP