FreeRDP
Loading...
Searching...
No Matches
wts_services.h
Go to the documentation of this file.
1
19
20#ifndef FREERDP_WTS_SERVICES_H
21#define FREERDP_WTS_SERVICES_H
22
23#include <winpr/com.h>
24
65
66#ifdef __cplusplus
67extern "C"
68{
69#endif
70
77
78 /* ======================= IWTSPluginServiceProvider ======================= */
79
80 /* obtained by QueryInterface on the IWTSVirtualChannelManager given to IWTSPlugin::Initialize
81 */
82 WINPR_COM_DEFINE_GUID(IID_IWTSPluginServiceProvider, 0xd3e07363, 0x087c, 0x476c, 0x86, 0xa7,
83 0xdb, 0xb1, 0x5f, 0x46, 0xdd, 0xb4);
84
85#ifndef WINPR_COM_CXX
87 {
88 wIUnknownVtbl iunknown;
89
90 /* the service key is passed BY VALUE (SDK and mstscax agree; on x64 it ends up behind a
91 * pointer anyway, on x86 the 16 bytes are on the stack). The service returned is not
92 * necessarily of the type the key suggests: callers QueryInterface it */
93 HRESULT(WINPR_COM_CALL* GetService)
94 (IWTSPluginServiceProvider* This, GUID ServiceId, wIUnknown** ppunkObject);
96
98 {
100 };
101#endif
102
103#ifdef WINPR_COM_CXX
105 {
106 virtual HRESULT WINPR_COM_CALL GetService(GUID ServiceId, wIUnknown** ppunkObject) = 0;
107
109 };
110#endif
111
112 /* ======================= bitmap render service ======================= */
113
114 /* GetService key (SDK) */
115 WINPR_COM_DEFINE_GUID(RDCLIENT_BITMAP_RENDER_SERVICE, 0xe4cc08cb, 0x942e, 0x4b19, 0x85, 0x04,
116 0xbd, 0x5a, 0x89, 0xa7, 0x47, 0xf5);
117
118 WINPR_COM_DEFINE_GUID(IID_IWTSBitmapRenderService, 0xea326091, 0x05fe, 0x40c1, 0xb4, 0x9c, 0x3d,
119 0x2e, 0xf4, 0x62, 0x6a, 0x0e);
120 WINPR_COM_DEFINE_GUID(IID_IWTSBitmapRenderer, 0x5b7acc97, 0xf3c9, 0x46f7, 0x8c, 0x5b, 0xfa,
121 0x68, 0x5d, 0x34, 0x41, 0xb1);
122 WINPR_COM_DEFINE_GUID(IID_IWTSBitmapRendererCallback, 0xd782928e, 0xfe4e, 0x4e77, 0xae, 0x90,
123 0x9c, 0xd0, 0xb3, 0xe3, 0xb3, 0x53);
124
125 typedef struct
126 {
127 DWORD dwFramesDelivered;
128 DWORD dwFramesDropped;
130
132 typedef struct
133 {
134 LONG left;
135 LONG top;
136 LONG right;
137 LONG bottom;
138 } WTS_RECT;
139
140#ifndef WINPR_COM_CXX
142 {
143 wIUnknownVtbl iunknown;
144
145 /* imageFormat: a Media Foundation subtype; GUID_NULL for BGRA32 */
146 HRESULT(WINPR_COM_CALL* Render)
147 (IWTSBitmapRenderer* This, GUID imageFormat, DWORD dwWidth, DWORD dwHeight, LONG cbStride,
148 DWORD cbImageBuffer, BYTE* pImageBuffer);
149 HRESULT(WINPR_COM_CALL* GetRendererStatistics)
151 HRESULT(WINPR_COM_CALL* RemoveMapping)(IWTSBitmapRenderer* This);
153
155 {
156 const IWTSBitmapRendererVtbl* lpVtbl;
157 };
158#endif
159
160#ifdef WINPR_COM_CXX
161 struct IWTSBitmapRenderer : public wIUnknown
162 {
163 virtual HRESULT WINPR_COM_CALL Render(GUID imageFormat, DWORD dwWidth, DWORD dwHeight,
164 LONG cbStride, DWORD cbImageBuffer,
165 BYTE* pImageBuffer) = 0;
166 virtual HRESULT WINPR_COM_CALL
167 GetRendererStatistics(BITMAP_RENDERER_STATISTICS* pStatistics) = 0;
168 virtual HRESULT WINPR_COM_CALL RemoveMapping() = 0;
169
171 };
172#endif
173
174#ifndef WINPR_COM_CXX
176 {
177 wIUnknownVtbl iunknown;
178
179 /* RECT by value (SDK), left/top/right/bottom */
180 HRESULT(WINPR_COM_CALL* OnTargetSizeChanged)
181 (IWTSBitmapRendererCallback* This, WTS_RECT rcNewSize);
183
185 {
186 const IWTSBitmapRendererCallbackVtbl* lpVtbl;
187 };
188#endif
189
190#ifdef WINPR_COM_CXX
192 {
193 virtual HRESULT WINPR_COM_CALL OnTargetSizeChanged(WTS_RECT rcNewSize) = 0;
194
196 };
197#endif
198
199#ifndef WINPR_COM_CXX
201 {
202 wIUnknownVtbl iunknown;
203
204 /* mappingId: a MS-RDPEGT geometry mapping id, given by the server */
205 HRESULT(WINPR_COM_CALL* GetMappedRenderer)
206 (IWTSBitmapRenderService* This, UINT64 mappingId,
207 IWTSBitmapRendererCallback* pMappedRendererCallback,
208 IWTSBitmapRenderer** ppMappedRenderer);
210
212 {
213 const IWTSBitmapRenderServiceVtbl* lpVtbl;
214 };
215#endif
216
217#ifdef WINPR_COM_CXX
218 struct IWTSBitmapRenderService : public wIUnknown
219 {
220 virtual HRESULT WINPR_COM_CALL
221 GetMappedRenderer(UINT64 mappingId, IWTSBitmapRendererCallback* pMappedRendererCallback,
222 IWTSBitmapRenderer** ppMappedRenderer) = 0;
223
225 };
226#endif
227
228 /* ======================= window info service (rdclientax.dll only) =======================
229 *
230 * Implemented in rdclientax.dll (WTSWindowInfoService). Behaviour of Microsoft's
231 * implementation, which a compatible one should keep:
232 * - GetService creates a new service object on each call;
233 * - one subscriber per service object: a second Subscribe fails with
234 * HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), Unsubscribe without one with
235 * HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
236 * - Subscribe/Unsubscribe are synchronous (run on the client's core thread, waited for);
237 * - OnWindowChanged gets a copy of the new WTS_WINDOW_INFO, valid during the call only. */
238
239 /* GetService key (named by us, undocumented) */
240 WINPR_COM_DEFINE_GUID(RDCLIENT_WINDOW_INFO_SERVICE, 0xa9a17a6b, 0xcdb3, 0x4e81, 0xb5, 0xc8,
241 0xbd, 0x63, 0x82, 0x2a, 0x8d, 0x6c);
242 /* what the service is then queried for */
243 WINPR_COM_DEFINE_GUID(IID_IWTSWindowInfoService, 0x2a002c7b, 0x0120, 0x4d04, 0xbf, 0xb1, 0x3c,
244 0x73, 0x11, 0x0c, 0x85, 0x81);
245
246 typedef enum
247 {
248 WTS_RDP_SESSION_TYPE_DESKTOP = 0,
249 WTS_RDP_SESSION_TYPE_REMOTEAPP = 1, /* the client's "RailMode" property */
250 } WTS_RDP_SESSION_TYPE;
251
253 typedef struct
254 {
255 /* desktop: the client window showing the session; RemoteApp: the local window of the
256 * remote window asked for */
257 HWND hwnd;
258 /* desktop: size of the remote desktop; RemoteApp: client size of the local window */
259 INT32 remoteHeight;
260 INT32 remoteWidth;
261 /* client area of hwnd */
262 INT32 viewWidth;
263 INT32 viewHeight;
264 /* scrollbar positions (0 if none, always 0 in RemoteApp) */
265 INT32 scrollX;
266 INT32 scrollY;
267 /* desktop: viewWidth / remoteWidth, 1.0 when scrollbars are shown; RemoteApp: 0 */
268 float scale;
270
271#ifndef WINPR_COM_CXX
273 {
274 wIUnknownVtbl iunknown;
275
276 /* windowInfo: the new window info, valid during the call only */
277 HRESULT(WINPR_COM_CALL* OnWindowChanged)
278 (IWTSWindowChangedCallback* This, const WTS_WINDOW_INFO* windowInfo);
280
282 {
283 const IWTSWindowChangedCallbackVtbl* lpVtbl;
284 };
285#endif
286
287#ifdef WINPR_COM_CXX
289 {
290 virtual HRESULT WINPR_COM_CALL OnWindowChanged(const WTS_WINDOW_INFO* windowInfo) = 0;
291
293 };
294#endif
295
296#ifndef WINPR_COM_CXX
298 {
299 wIUnknownVtbl iunknown;
300
301 /* remoteHwnd: the remote window, only used in RemoteApp sessions */
302 HRESULT(WINPR_COM_CALL* GetWindowInfo)
303 (IWTSWindowInfoService* This, UINT64 remoteHwnd, WTS_WINDOW_INFO* windowInfo);
304 /* the client's own process id */
305 HRESULT(WINPR_COM_CALL* GetProcessId)(IWTSWindowInfoService* This, DWORD* processId);
306 /* a WTS_RDP_SESSION_TYPE */
307 HRESULT(WINPR_COM_CALL* GetRdpSessionType)
308 (IWTSWindowInfoService* This, UINT32* sessionType);
309 /* remoteHwnd (0 for a desktop session) is not used by Microsoft's client */
310 HRESULT(WINPR_COM_CALL* SubscribeWindowChanged)
311 (IWTSWindowInfoService* This, UINT64 remoteHwnd, IWTSWindowChangedCallback* callback);
312 HRESULT(WINPR_COM_CALL* UnsubscribeWindowChanged)(IWTSWindowInfoService* This);
314
316 {
317 const IWTSWindowInfoServiceVtbl* lpVtbl;
318 };
319#endif
320
321#ifdef WINPR_COM_CXX
322 struct IWTSWindowInfoService : public wIUnknown
323 {
324 virtual HRESULT WINPR_COM_CALL GetWindowInfo(UINT64 remoteHwnd,
325 WTS_WINDOW_INFO* windowInfo) = 0;
326 virtual HRESULT WINPR_COM_CALL GetProcessId(DWORD* processId) = 0;
327 virtual HRESULT WINPR_COM_CALL GetRdpSessionType(UINT32* sessionType) = 0;
328 virtual HRESULT WINPR_COM_CALL
329 SubscribeWindowChanged(UINT64 remoteHwnd, IWTSWindowChangedCallback* callback) = 0;
330 virtual HRESULT WINPR_COM_CALL UnsubscribeWindowChanged() = 0;
331
333 };
334#endif
335
336#ifdef __cplusplus
337}
338#endif
339
340#endif /* FREERDP_WTS_SERVICES_H */
#define WINPR_COM_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
defines a GUID constant visible in the including file only (nothing to link)
Definition com.h:158
#define WINPR_COM_CXX_INTERFACE(name)
ends the declaration of a C++ interface name: only an implementation creates it and Release() frees i...
Definition com.h:101
#define WINPR_COM_CALL
the calling convention of COM methods (STDMETHODCALLTYPE)
Definition com.h:82
IUnknown, C form.
Definition com.h:147
the vtable of IUnknown, the first entries of every COM vtable
Definition com.h:121
same layout as Win32's RECT, which winpr doesn't have on POSIX
40 bytes on x64