FreeRDP
server.h
1 
21 #ifndef FREERDP_LIB_CORE_SERVER_H
22 #define FREERDP_LIB_CORE_SERVER_H
23 
24 #include <freerdp/freerdp.h>
25 #include <freerdp/api.h>
26 #include <freerdp/channels/wtsvc.h>
27 
28 #include <winpr/synch.h>
29 #include <winpr/stream.h>
30 #include <winpr/collections.h>
31 
32 typedef struct rdp_peer_channel rdpPeerChannel;
34 
35 #include "rdp.h"
36 #include "mcs.h"
37 
38 enum
39 {
40  RDP_PEER_CHANNEL_TYPE_SVC = 0,
41  RDP_PEER_CHANNEL_TYPE_DVC = 1
42 };
43 
44 enum
45 {
46  DVC_OPEN_STATE_NONE = 0,
47  DVC_OPEN_STATE_SUCCEEDED = 1,
48  DVC_OPEN_STATE_FAILED = 2,
49  DVC_OPEN_STATE_CLOSED = 3
50 };
51 
53 {
55  freerdp_peer* client;
56 
57  void* extra;
58  UINT16 index;
59  UINT32 channelId;
60  UINT16 channelType;
61  UINT32 channelFlags;
62 
63  wStream* receiveData;
64  wMessageQueue* queue;
65 
66  BYTE dvc_open_state;
67  INT32 creationStatus;
68  UINT32 dvc_total_length;
69  rdpMcsChannel* mcsChannel;
70 
71  char channelName[128];
72  CRITICAL_SECTION writeLock;
73 };
74 
76 {
77  rdpRdp* rdp;
78  freerdp_peer* client;
79 
80  DWORD SessionId;
81  wMessageQueue* queue;
82 
83  rdpPeerChannel* drdynvc_channel;
84  BYTE drdynvc_state;
85  LONG dvc_channel_id_seq;
86  UINT16 dvc_spoken_version;
87 
88  psDVCCreationStatusCallback dvc_creation_status;
89  void* dvc_creation_status_userdata;
90 
91  wHashTable* dynamicVirtualChannels;
92 };
93 
94 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName,
95  ULONG TargetLogonId, BYTE HotkeyVk,
96  USHORT HotkeyModifiers);
97 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionA(LPSTR pTargetServerName,
98  ULONG TargetLogonId, BYTE HotkeyVk,
99  USHORT HotkeyModifiers);
100 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExW(LPWSTR pTargetServerName,
101  ULONG TargetLogonId,
102  BYTE HotkeyVk,
103  USHORT HotkeyModifiers,
104  DWORD flags);
105 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExA(LPSTR pTargetServerName,
106  ULONG TargetLogonId,
107  BYTE HotkeyVk,
108  USHORT HotkeyModifiers,
109  DWORD flags);
110 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStopRemoteControlSession(ULONG LogonId);
111 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSConnectSessionW(ULONG LogonId, ULONG TargetLogonId,
112  PWSTR pPassword, BOOL bWait);
113 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId,
114  PSTR pPassword, BOOL bWait);
115 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved,
116  DWORD Version,
117  PWTS_SERVER_INFOW* ppServerInfo,
118  DWORD* pCount);
119 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved,
120  DWORD Version,
121  PWTS_SERVER_INFOA* ppServerInfo,
122  DWORD* pCount);
123 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSOpenServerW(LPWSTR pServerName);
124 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSOpenServerA(LPSTR pServerName);
125 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSOpenServerExW(LPWSTR pServerName);
126 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSOpenServerExA(LPSTR pServerName);
127 FREERDP_LOCAL VOID WINAPI FreeRDP_WTSCloseServer(HANDLE hServer);
128 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved,
129  DWORD Version,
130  PWTS_SESSION_INFOW* ppSessionInfo,
131  DWORD* pCount);
132 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved,
133  DWORD Version,
134  PWTS_SESSION_INFOA* ppSessionInfo,
135  DWORD* pCount);
136 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel,
137  DWORD Filter,
138  PWTS_SESSION_INFO_1W* ppSessionInfo,
139  DWORD* pCount);
140 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel,
141  DWORD Filter,
142  PWTS_SESSION_INFO_1A* ppSessionInfo,
143  DWORD* pCount);
144 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved,
145  DWORD Version,
146  PWTS_PROCESS_INFOW* ppProcessInfo,
147  DWORD* pCount);
148 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved,
149  DWORD Version,
150  PWTS_PROCESS_INFOA* ppProcessInfo,
151  DWORD* pCount);
152 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSTerminateProcess(HANDLE hServer, DWORD ProcessId,
153  DWORD ExitCode);
154 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId,
155  WTS_INFO_CLASS WTSInfoClass,
156  LPWSTR* ppBuffer,
157  DWORD* pBytesReturned);
158 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId,
159  WTS_INFO_CLASS WTSInfoClass,
160  LPSTR* ppBuffer,
161  DWORD* pBytesReturned);
162 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
163  WTS_CONFIG_CLASS WTSConfigClass,
164  LPWSTR* ppBuffer, DWORD* pBytesReturned);
165 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName,
166  WTS_CONFIG_CLASS WTSConfigClass,
167  LPSTR* ppBuffer, DWORD* pBytesReturned);
168 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSetUserConfigW(LPWSTR pServerName, LPWSTR pUserName,
169  WTS_CONFIG_CLASS WTSConfigClass, LPWSTR pBuffer,
170  DWORD DataLength);
171 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName,
172  WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer,
173  DWORD DataLength);
174 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle,
175  DWORD TitleLength, LPWSTR pMessage,
176  DWORD MessageLength, DWORD Style, DWORD Timeout,
177  DWORD* pResponse, BOOL bWait);
178 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle,
179  DWORD TitleLength, LPSTR pMessage,
180  DWORD MessageLength, DWORD Style, DWORD Timeout,
181  DWORD* pResponse, BOOL bWait);
182 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSDisconnectSession(HANDLE hServer, DWORD SessionId, BOOL bWait);
183 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogoffSession(HANDLE hServer, DWORD SessionId, BOOL bWait);
184 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag);
185 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask,
186  DWORD* pEventFlags);
187 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId,
188  LPSTR pVirtualName);
189 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName,
190  DWORD flags);
191 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelClose(HANDLE hChannelHandle);
192 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut,
193  PCHAR Buffer, ULONG BufferSize,
194  PULONG pBytesRead);
195 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
196  ULONG Length, PULONG pBytesWritten);
197 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelPurgeInput(HANDLE hChannelHandle);
198 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle);
199 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle,
200  WTS_VIRTUAL_CLASS WtsVirtualClass,
201  PVOID* ppBuffer, DWORD* pBytesReturned);
202 FREERDP_LOCAL VOID WINAPI FreeRDP_WTSFreeMemory(PVOID pMemory);
203 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
204  ULONG NumberOfEntries);
205 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory,
206  ULONG NumberOfEntries);
207 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags);
208 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSUnRegisterSessionNotification(HWND hWnd);
209 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd,
210  DWORD dwFlags);
211 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSUnRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd);
212 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryUserToken(ULONG SessionId, PHANDLE phToken);
213 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel,
214  DWORD SessionId, LPWSTR* ppProcessInfo,
215  DWORD* pCount);
216 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel,
217  DWORD SessionId, LPSTR* ppProcessInfo,
218  DWORD* pCount);
219 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved,
220  DWORD Reserved,
221  PWTSLISTENERNAMEW pListeners,
222  DWORD* pCount);
223 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved,
224  DWORD Reserved,
225  PWTSLISTENERNAMEA pListeners,
226  DWORD* pCount);
227 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved,
228  DWORD Reserved, LPWSTR pListenerName,
229  PWTSLISTENERCONFIGW pBuffer);
230 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved,
231  DWORD Reserved, LPSTR pListenerName,
232  PWTSLISTENERCONFIGA pBuffer);
233 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSCreateListenerW(HANDLE hServer, PVOID pReserved,
234  DWORD Reserved, LPWSTR pListenerName,
235  PWTSLISTENERCONFIGW pBuffer, DWORD flag);
236 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSCreateListenerA(HANDLE hServer, PVOID pReserved,
237  DWORD Reserved, LPSTR pListenerName,
238  PWTSLISTENERCONFIGA pBuffer, DWORD flag);
239 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSetListenerSecurityW(HANDLE hServer, PVOID pReserved,
240  DWORD Reserved, LPWSTR pListenerName,
241  SECURITY_INFORMATION SecurityInformation,
242  PSECURITY_DESCRIPTOR pSecurityDescriptor);
243 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSetListenerSecurityA(HANDLE hServer, PVOID pReserved,
244  DWORD Reserved, LPSTR pListenerName,
245  SECURITY_INFORMATION SecurityInformation,
246  PSECURITY_DESCRIPTOR pSecurityDescriptor);
247 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSGetListenerSecurityW(HANDLE hServer, PVOID pReserved,
248  DWORD Reserved, LPWSTR pListenerName,
249  SECURITY_INFORMATION SecurityInformation,
250  PSECURITY_DESCRIPTOR pSecurityDescriptor,
251  DWORD nLength, LPDWORD lpnLengthNeeded);
252 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSGetListenerSecurityA(HANDLE hServer, PVOID pReserved,
253  DWORD Reserved, LPSTR pListenerName,
254  SECURITY_INFORMATION SecurityInformation,
255  PSECURITY_DESCRIPTOR pSecurityDescriptor,
256  DWORD nLength, LPDWORD lpnLengthNeeded);
257 
258 FREERDP_LOCAL BOOL CDECL FreeRDP_WTSEnableChildSessions(BOOL bEnable);
259 FREERDP_LOCAL BOOL CDECL FreeRDP_WTSIsChildSessionsEnabled(PBOOL pbEnabled);
260 FREERDP_LOCAL BOOL CDECL FreeRDP_WTSGetChildSessionId(PULONG pSessionId);
261 
262 FREERDP_LOCAL DWORD WINAPI FreeRDP_WTSGetActiveConsoleSessionId(void);
263 
264 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogoffUser(HANDLE hServer);
265 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password,
266  LPCSTR domain);
267 
268 FREERDP_LOCAL void server_channel_common_free(rdpPeerChannel*);
269 
270 WINPR_ATTR_MALLOC(server_channel_common_free, 1)
271 FREERDP_LOCAL rdpPeerChannel* server_channel_common_new(freerdp_peer* client, UINT16 index,
272  UINT32 channelId, size_t chunkSize,
273  const wObject* callback, const char* name);
274 
275 #endif /* FREERDP_LIB_CORE_SERVER_H */
This struct contains function pointer to initialize/free objects.
Definition: collections.h:57