21 #ifndef FREERDP_LIB_CORE_SERVER_H
22 #define FREERDP_LIB_CORE_SERVER_H
24 #include <freerdp/freerdp.h>
25 #include <freerdp/api.h>
26 #include <freerdp/channels/wtsvc.h>
28 #include <winpr/synch.h>
29 #include <winpr/stream.h>
30 #include <winpr/collections.h>
40 RDP_PEER_CHANNEL_TYPE_SVC = 0,
41 RDP_PEER_CHANNEL_TYPE_DVC = 1
46 DVC_OPEN_STATE_NONE = 0,
47 DVC_OPEN_STATE_SUCCEEDED = 1,
48 DVC_OPEN_STATE_FAILED = 2,
49 DVC_OPEN_STATE_CLOSED = 3
68 UINT32 dvc_total_length;
69 rdpMcsChannel* mcsChannel;
71 char channelName[128];
83 rdpPeerChannel* drdynvc_channel;
85 LONG dvc_channel_id_seq;
86 UINT16 dvc_spoken_version;
88 psDVCCreationStatusCallback dvc_creation_status;
89 void* dvc_creation_status_userdata;
91 wHashTable* dynamicVirtualChannels;
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,
103 USHORT HotkeyModifiers,
105 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSStartRemoteControlSessionExA(LPSTR pTargetServerName,
108 USHORT HotkeyModifiers,
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,
119 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved,
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,
132 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved,
136 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel,
140 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel,
144 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved,
148 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved,
152 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSTerminateProcess(HANDLE hServer, DWORD ProcessId,
154 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId,
155 WTS_INFO_CLASS WTSInfoClass,
157 DWORD* pBytesReturned);
158 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId,
159 WTS_INFO_CLASS WTSInfoClass,
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,
171 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName,
172 WTS_CONFIG_CLASS WTSConfigClass, LPSTR pBuffer,
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,
187 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId,
189 FREERDP_LOCAL HANDLE WINAPI FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName,
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,
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,
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,
216 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel,
217 DWORD SessionId, LPSTR* ppProcessInfo,
219 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved,
221 PWTSLISTENERNAMEW pListeners,
223 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved,
225 PWTSLISTENERNAMEA pListeners,
227 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryListenerConfigW(HANDLE hServer, PVOID pReserved,
228 DWORD Reserved, LPWSTR pListenerName,
230 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSQueryListenerConfigA(HANDLE hServer, PVOID pReserved,
231 DWORD Reserved, LPSTR pListenerName,
233 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSCreateListenerW(HANDLE hServer, PVOID pReserved,
234 DWORD Reserved, LPWSTR pListenerName,
236 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSCreateListenerA(HANDLE hServer, PVOID pReserved,
237 DWORD Reserved, LPSTR pListenerName,
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);
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);
262 FREERDP_LOCAL DWORD WINAPI FreeRDP_WTSGetActiveConsoleSessionId(
void);
264 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogoffUser(HANDLE hServer);
265 FREERDP_LOCAL BOOL WINAPI FreeRDP_WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password,
268 FREERDP_LOCAL
void server_channel_common_free(rdpPeerChannel*);
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);
This struct contains function pointer to initialize/free objects.