FreeRDP
Loading...
Searching...
No Matches
client/cliprdr_main.c
1
23#include <freerdp/config.h>
24
25#include <winpr/wtypes.h>
26#include <winpr/assert.h>
27#include <winpr/crt.h>
28#include <winpr/print.h>
29#include <winpr/clipboard.h>
30
31#include <freerdp/types.h>
32#include <freerdp/constants.h>
33#include <freerdp/freerdp.h>
34#include <freerdp/client/cliprdr.h>
35
36#include "../../../channels/client/addin.h"
37
38#include "cliprdr_main.h"
39#include "cliprdr_format.h"
40#include "../cliprdr_common.h"
41
42const char type_FileGroupDescriptorW[] = "FileGroupDescriptorW";
43const char type_FileContents[] = "FileContents";
44
45CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr)
46{
47 CliprdrClientContext* pInterface = nullptr;
48
49 if (!cliprdr)
50 return nullptr;
51
52 pInterface = (CliprdrClientContext*)cliprdr->channelEntryPoints.pInterface;
53 return pInterface;
54}
55
61static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
62{
63 UINT status = ERROR_INVALID_DATA;
64
65 WINPR_ASSERT(cliprdr);
66 WINPR_ASSERT(s);
67
68 const size_t pos = Stream_GetPosition(s);
69 WINPR_ASSERT(pos >= 8ULL);
70 WINPR_ASSERT(pos <= UINT32_MAX - 8);
71
72 const uint32_t dataLen = WINPR_ASSERTING_INT_CAST(uint32_t, pos - 8UL);
73
74 if (!Stream_SetPosition(s, 4))
75 goto fail;
76 Stream_Write_UINT32(s, dataLen);
77 if (!Stream_SetPosition(s, pos))
78 goto fail;
79
80 WLog_Print(cliprdr->log, WLOG_DEBUG, "Cliprdr Sending (%" PRIuz " bytes)", pos);
81
82 if (!cliprdr)
83 status = CHANNEL_RC_BAD_INIT_HANDLE;
84 else
85 {
86 WINPR_ASSERT(cliprdr->channelEntryPoints.pVirtualChannelWriteEx);
87 status = cliprdr->channelEntryPoints.pVirtualChannelWriteEx(
88 cliprdr->InitHandle, cliprdr->OpenHandle, Stream_Buffer(s),
89 (UINT32)Stream_GetPosition(s), s);
90 }
91
92fail:
93 if (status != CHANNEL_RC_OK)
94 {
95 Stream_Free(s, TRUE);
96 WLog_Print(cliprdr->log, WLOG_ERROR, "VirtualChannelWrite failed with %s [%08" PRIX32 "]",
97 WTSErrorToString(status), status);
98 }
99
100 return status;
101}
102
103UINT cliprdr_send_error_response(cliprdrPlugin* cliprdr, UINT16 type)
104{
105 wStream* s = cliprdr_packet_new(type, CB_RESPONSE_FAIL, 0);
106 if (!s)
107 {
108 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
109 return ERROR_OUTOFMEMORY;
110 }
111
112 return cliprdr_packet_send(cliprdr, s);
113}
114
115static void cliprdr_print_general_capability_flags(wLog* log, UINT32 flags)
116{
117 WLog_Print(log, WLOG_DEBUG, "generalFlags (0x%08" PRIX32 ") {", flags);
118
119 if (flags & CB_USE_LONG_FORMAT_NAMES)
120 WLog_Print(log, WLOG_DEBUG, "\tCB_USE_LONG_FORMAT_NAMES");
121
122 if (flags & CB_STREAM_FILECLIP_ENABLED)
123 WLog_Print(log, WLOG_DEBUG, "\tCB_STREAM_FILECLIP_ENABLED");
124
125 if (flags & CB_FILECLIP_NO_FILE_PATHS)
126 WLog_Print(log, WLOG_DEBUG, "\tCB_FILECLIP_NO_FILE_PATHS");
127
128 if (flags & CB_CAN_LOCK_CLIPDATA)
129 WLog_Print(log, WLOG_DEBUG, "\tCB_CAN_LOCK_CLIPDATA");
130
131 if (flags & CB_HUGE_FILE_SUPPORT_ENABLED)
132 WLog_Print(log, WLOG_DEBUG, "\tCB_HUGE_FILE_SUPPORT_ENABLED");
133
134 WLog_Print(log, WLOG_DEBUG, "}");
135}
136
142static UINT cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream* s)
143{
144 UINT32 version = 0;
145 UINT32 generalFlags = 0;
146 CLIPRDR_CAPABILITIES capabilities = WINPR_C_ARRAY_INIT;
147 CLIPRDR_GENERAL_CAPABILITY_SET generalCapabilitySet = WINPR_C_ARRAY_INIT;
148 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
149 UINT error = CHANNEL_RC_OK;
150
151 WINPR_ASSERT(cliprdr);
152 WINPR_ASSERT(s);
153
154 if (!context)
155 {
156 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_get_client_interface failed!");
157 return ERROR_INTERNAL_ERROR;
158 }
159
160 if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, 8))
161 return ERROR_INVALID_DATA;
162
163 Stream_Read_UINT32(s, version); /* version (4 bytes) */
164 Stream_Read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */
165 WLog_Print(cliprdr->log, WLOG_DEBUG, "Version: %" PRIu32 "", version);
166
167 cliprdr_print_general_capability_flags(cliprdr->log, generalFlags);
168
169 cliprdr->useLongFormatNames = (generalFlags & CB_USE_LONG_FORMAT_NAMES) != 0;
170 cliprdr->streamFileClipEnabled = (generalFlags & CB_STREAM_FILECLIP_ENABLED) != 0;
171 cliprdr->fileClipNoFilePaths = (generalFlags & CB_FILECLIP_NO_FILE_PATHS) != 0;
172 cliprdr->canLockClipData = (generalFlags & CB_CAN_LOCK_CLIPDATA) != 0;
173 cliprdr->hasHugeFileSupport = (generalFlags & CB_HUGE_FILE_SUPPORT_ENABLED) != 0;
174 cliprdr->capabilitiesReceived = TRUE;
175
176 capabilities.common.msgType = CB_CLIP_CAPS;
177 capabilities.cCapabilitiesSets = 1;
178 capabilities.capabilitySets = (CLIPRDR_CAPABILITY_SET*)&(generalCapabilitySet);
179 generalCapabilitySet.capabilitySetType = CB_CAPSTYPE_GENERAL;
180 generalCapabilitySet.capabilitySetLength = 12;
181 generalCapabilitySet.version = version;
182 generalCapabilitySet.generalFlags = generalFlags;
183 IFCALLRET(context->ServerCapabilities, error, context, &capabilities);
184
185 if (error)
186 WLog_Print(cliprdr->log, WLOG_ERROR, "ServerCapabilities failed with error %" PRIu32 "!",
187 error);
188
189 return error;
190}
191
197static UINT cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s,
198 WINPR_ATTR_UNUSED UINT32 length,
199 WINPR_ATTR_UNUSED UINT16 flags)
200{
201 UINT16 lengthCapability = 0;
202 UINT16 cCapabilitiesSets = 0;
203 UINT16 capabilitySetType = 0;
204 UINT error = CHANNEL_RC_OK;
205
206 WINPR_ASSERT(cliprdr);
207 WINPR_ASSERT(s);
208
209 if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, 4))
210 return ERROR_INVALID_DATA;
211
212 Stream_Read_UINT16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
213 Stream_Seek_UINT16(s); /* pad1 (2 bytes) */
214 WLog_Print(cliprdr->log, WLOG_DEBUG, "ServerCapabilities");
215
216 for (UINT16 index = 0; index < cCapabilitiesSets; index++)
217 {
218 if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, 4))
219 return ERROR_INVALID_DATA;
220
221 Stream_Read_UINT16(s, capabilitySetType); /* capabilitySetType (2 bytes) */
222 Stream_Read_UINT16(s, lengthCapability); /* lengthCapability (2 bytes) */
223
224 if ((lengthCapability < 4) ||
225 (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, lengthCapability - 4U)))
226 return ERROR_INVALID_DATA;
227
228 switch (capabilitySetType)
229 {
230 case CB_CAPSTYPE_GENERAL:
231 if ((error = cliprdr_process_general_capability(cliprdr, s)))
232 {
233 WLog_Print(cliprdr->log, WLOG_ERROR,
234 "cliprdr_process_general_capability failed with error %" PRIu32 "!",
235 error);
236 return error;
237 }
238
239 break;
240
241 default:
242 WLog_Print(cliprdr->log, WLOG_ERROR, "unknown cliprdr capability set: %" PRIu16 "",
243 capabilitySetType);
244 return CHANNEL_RC_BAD_PROC;
245 }
246 }
247
248 return error;
249}
250
256static UINT cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, WINPR_ATTR_UNUSED wStream* s,
257 UINT32 length, UINT16 flags)
258{
259 CLIPRDR_MONITOR_READY monitorReady = WINPR_C_ARRAY_INIT;
260 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
261 UINT error = CHANNEL_RC_OK;
262
263 WINPR_ASSERT(cliprdr);
264 WINPR_ASSERT(s);
265
266 WLog_Print(cliprdr->log, WLOG_DEBUG, "MonitorReady");
267
268 if (!cliprdr->capabilitiesReceived)
269 {
276 cliprdr->useLongFormatNames = FALSE;
277 cliprdr->streamFileClipEnabled = FALSE;
278 cliprdr->fileClipNoFilePaths = TRUE;
279 cliprdr->canLockClipData = FALSE;
280 }
281
282 monitorReady.common.msgType = CB_MONITOR_READY;
283 monitorReady.common.msgFlags = flags;
284 monitorReady.common.dataLen = length;
285 IFCALLRET(context->MonitorReady, error, context, &monitorReady);
286
287 if (error)
288 WLog_Print(cliprdr->log, WLOG_ERROR, "MonitorReady failed with error %" PRIu32 "!", error);
289
290 return error;
291}
292
298static UINT cliprdr_process_filecontents_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 length,
299 UINT16 flags)
300{
301 CLIPRDR_FILE_CONTENTS_REQUEST request = WINPR_C_ARRAY_INIT;
302 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
303 UINT error = CHANNEL_RC_OK;
304
305 WINPR_ASSERT(cliprdr);
306 WINPR_ASSERT(s);
307
308 WLog_Print(cliprdr->log, WLOG_DEBUG, "FileContentsRequest");
309
310 request.common.msgType = CB_FILECONTENTS_REQUEST;
311 request.common.msgFlags = flags;
312 request.common.dataLen = length;
313
314 if ((error = cliprdr_read_file_contents_request(s, &request)))
315 return error;
316
317 const UINT32 mask =
318 freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
319 if ((mask & (CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES)) == 0)
320 {
321 WLog_Print(cliprdr->log, WLOG_WARN, "local -> remote file copy disabled, ignoring request");
322 return cliprdr_send_error_response(cliprdr, CB_FILECONTENTS_RESPONSE);
323 }
324 IFCALLRET(context->ServerFileContentsRequest, error, context, &request);
325
326 if (error)
327 WLog_Print(cliprdr->log, WLOG_ERROR,
328 "ServerFileContentsRequest failed with error %" PRIu32 "!", error);
329
330 return error;
331}
332
338static UINT cliprdr_process_filecontents_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 length,
339 UINT16 flags)
340{
341 CLIPRDR_FILE_CONTENTS_RESPONSE response = WINPR_C_ARRAY_INIT;
342 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
343 UINT error = CHANNEL_RC_OK;
344
345 WINPR_ASSERT(cliprdr);
346 WINPR_ASSERT(s);
347
348 WLog_Print(cliprdr->log, WLOG_DEBUG, "FileContentsResponse");
349
350 response.common.msgType = CB_FILECONTENTS_RESPONSE;
351 response.common.msgFlags = flags;
352 response.common.dataLen = length;
353
354 if ((error = cliprdr_read_file_contents_response(s, &response)))
355 return error;
356
357 IFCALLRET(context->ServerFileContentsResponse, error, context, &response);
358
359 if (error)
360 WLog_Print(cliprdr->log, WLOG_ERROR,
361 "ServerFileContentsResponse failed with error %" PRIu32 "!", error);
362
363 return error;
364}
365
371static UINT cliprdr_process_lock_clipdata(cliprdrPlugin* cliprdr, wStream* s, UINT32 length,
372 UINT16 flags)
373{
374 CLIPRDR_LOCK_CLIPBOARD_DATA lockClipboardData = WINPR_C_ARRAY_INIT;
375 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
376 UINT error = CHANNEL_RC_OK;
377
378 WINPR_ASSERT(cliprdr);
379 WINPR_ASSERT(s);
380
381 WLog_Print(cliprdr->log, WLOG_DEBUG, "LockClipData");
382
383 if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, 4))
384 return ERROR_INVALID_DATA;
385
386 lockClipboardData.common.msgType = CB_LOCK_CLIPDATA;
387 lockClipboardData.common.msgFlags = flags;
388 lockClipboardData.common.dataLen = length;
389 Stream_Read_UINT32(s, lockClipboardData.clipDataId); /* clipDataId (4 bytes) */
390 IFCALLRET(context->ServerLockClipboardData, error, context, &lockClipboardData);
391
392 if (error)
393 WLog_Print(cliprdr->log, WLOG_ERROR,
394 "ServerLockClipboardData failed with error %" PRIu32 "!", error);
395
396 return error;
397}
398
404static UINT cliprdr_process_unlock_clipdata(cliprdrPlugin* cliprdr, wStream* s, UINT32 length,
405 UINT16 flags)
406{
407 CLIPRDR_UNLOCK_CLIPBOARD_DATA unlockClipboardData = WINPR_C_ARRAY_INIT;
408 CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
409 UINT error = CHANNEL_RC_OK;
410
411 WINPR_ASSERT(cliprdr);
412 WINPR_ASSERT(s);
413
414 WLog_Print(cliprdr->log, WLOG_DEBUG, "UnlockClipData");
415
416 if ((error = cliprdr_read_unlock_clipdata(s, &unlockClipboardData)))
417 return error;
418
419 unlockClipboardData.common.msgType = CB_UNLOCK_CLIPDATA;
420 unlockClipboardData.common.msgFlags = flags;
421 unlockClipboardData.common.dataLen = length;
422
423 IFCALLRET(context->ServerUnlockClipboardData, error, context, &unlockClipboardData);
424
425 if (error)
426 WLog_Print(cliprdr->log, WLOG_ERROR,
427 "ServerUnlockClipboardData failed with error %" PRIu32 "!", error);
428
429 return error;
430}
431
437static UINT cliprdr_order_recv(LPVOID userdata, wStream* s)
438{
439 cliprdrPlugin* cliprdr = userdata;
440 UINT16 msgType = 0;
441 UINT16 msgFlags = 0;
442 UINT32 dataLen = 0;
443 UINT error = 0;
444
445 WINPR_ASSERT(cliprdr);
446 WINPR_ASSERT(s);
447
448 if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, 8))
449 return ERROR_INVALID_DATA;
450
451 Stream_Read_UINT16(s, msgType); /* msgType (2 bytes) */
452 Stream_Read_UINT16(s, msgFlags); /* msgFlags (2 bytes) */
453 Stream_Read_UINT32(s, dataLen); /* dataLen (4 bytes) */
454
455 const BOOL failedResponse =
456 (msgFlags & CB_RESPONSE_FAIL) &&
457 ((msgType == CB_FORMAT_DATA_RESPONSE) || (msgType == CB_FORMAT_LIST_RESPONSE) ||
458 (msgType == CB_FILECONTENTS_RESPONSE));
459 if (failedResponse)
460 {
461 /* A failed response carries no payload, MS-RDPECLIP defines dataLen == 0 for it. Not
462 * every server gets that right though: gnome-remote-desktop 50.x sends dataLen > 0
463 * with no data behind it after it could not produce the requested clipboard format.
464 * Insisting on dataLen bytes fails the channel, and a failed channel tears down the
465 * whole session - a clipboard problem must not kill the connection. Treat dataLen as a
466 * hint for a failed response and pass on what actually arrived; the message flag
467 * already tells the handler that there is nothing to read. */
468 const size_t available = Stream_GetRemainingLength(s);
469 if (dataLen > available)
470 {
471 WLog_Print(cliprdr->log, WLOG_WARN,
472 "failed response (msgType: %" PRIu16 ") claims dataLen: %" PRIu32
473 " but only %" PRIuz " bytes follow",
474 msgType, dataLen, available);
475 dataLen = WINPR_ASSERTING_INT_CAST(UINT32, available);
476 }
477 }
478 else if (!Stream_CheckAndLogRequiredLengthWLog(cliprdr->log, s, dataLen))
479 return ERROR_INVALID_DATA;
480
481 char buffer1[64] = WINPR_C_ARRAY_INIT;
482 char buffer2[64] = WINPR_C_ARRAY_INIT;
483 WLog_Print(cliprdr->log, WLOG_DEBUG,
484 "msgType: %s (%" PRIu16 "), msgFlags: %s dataLen: %" PRIu32 "",
485 CB_MSG_TYPE_STRING(msgType, buffer1, sizeof(buffer1)), msgType,
486 CB_MSG_FLAGS_STRING(msgFlags, buffer2, sizeof(buffer2)), dataLen);
487
488 switch (msgType)
489 {
490 case CB_CLIP_CAPS:
491 if ((error = cliprdr_process_clip_caps(cliprdr, s, dataLen, msgFlags)))
492 WLog_Print(cliprdr->log, WLOG_ERROR,
493 "cliprdr_process_clip_caps failed with error %" PRIu32 "!", error);
494
495 break;
496
497 case CB_MONITOR_READY:
498 if ((error = cliprdr_process_monitor_ready(cliprdr, s, dataLen, msgFlags)))
499 WLog_Print(cliprdr->log, WLOG_ERROR,
500 "cliprdr_process_monitor_ready failed with error %" PRIu32 "!", error);
501
502 break;
503
504 case CB_FORMAT_LIST:
505 if ((error = cliprdr_process_format_list(cliprdr, s, dataLen, msgFlags)))
506 WLog_Print(cliprdr->log, WLOG_ERROR,
507 "cliprdr_process_format_list failed with error %" PRIu32 "!", error);
508
509 break;
510
511 case CB_FORMAT_LIST_RESPONSE:
512 if ((error = cliprdr_process_format_list_response(cliprdr, s, dataLen, msgFlags)))
513 WLog_Print(cliprdr->log, WLOG_ERROR,
514 "cliprdr_process_format_list_response failed with error %" PRIu32 "!",
515 error);
516
517 break;
518
519 case CB_FORMAT_DATA_REQUEST:
520 if ((error = cliprdr_process_format_data_request(cliprdr, s, dataLen, msgFlags)))
521 WLog_Print(cliprdr->log, WLOG_ERROR,
522 "cliprdr_process_format_data_request failed with error %" PRIu32 "!",
523 error);
524
525 break;
526
527 case CB_FORMAT_DATA_RESPONSE:
528 if ((error = cliprdr_process_format_data_response(cliprdr, s, dataLen, msgFlags)))
529 WLog_Print(cliprdr->log, WLOG_ERROR,
530 "cliprdr_process_format_data_response failed with error %" PRIu32 "!",
531 error);
532
533 break;
534
535 case CB_FILECONTENTS_REQUEST:
536 if ((error = cliprdr_process_filecontents_request(cliprdr, s, dataLen, msgFlags)))
537 WLog_Print(cliprdr->log, WLOG_ERROR,
538 "cliprdr_process_filecontents_request failed with error %" PRIu32 "!",
539 error);
540
541 break;
542
543 case CB_FILECONTENTS_RESPONSE:
544 if ((error = cliprdr_process_filecontents_response(cliprdr, s, dataLen, msgFlags)))
545 WLog_Print(cliprdr->log, WLOG_ERROR,
546 "cliprdr_process_filecontents_response failed with error %" PRIu32 "!",
547 error);
548
549 break;
550
551 case CB_LOCK_CLIPDATA:
552 if ((error = cliprdr_process_lock_clipdata(cliprdr, s, dataLen, msgFlags)))
553 WLog_Print(cliprdr->log, WLOG_ERROR,
554 "cliprdr_process_lock_clipdata failed with error %" PRIu32 "!", error);
555
556 break;
557
558 case CB_UNLOCK_CLIPDATA:
559 if ((error = cliprdr_process_unlock_clipdata(cliprdr, s, dataLen, msgFlags)))
560 WLog_Print(cliprdr->log, WLOG_ERROR,
561 "cliprdr_process_unlock_clipdata failed with error %" PRIu32 "!", error);
562
563 break;
564
565 default:
566 error = CHANNEL_RC_BAD_PROC;
567 WLog_Print(cliprdr->log, WLOG_ERROR, "unknown msgType %" PRIu16 "", msgType);
568 break;
569 }
570
571 Stream_Free(s, TRUE);
572 return error;
573}
574
584static UINT cliprdr_client_capabilities(CliprdrClientContext* context,
585 const CLIPRDR_CAPABILITIES* capabilities)
586{
587 wStream* s = nullptr;
588 UINT32 flags = 0;
589 const CLIPRDR_GENERAL_CAPABILITY_SET* generalCapabilitySet = nullptr;
590 cliprdrPlugin* cliprdr = nullptr;
591
592 WINPR_ASSERT(context);
593
594 cliprdr = (cliprdrPlugin*)context->handle;
595 WINPR_ASSERT(cliprdr);
596
597 s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN);
598
599 if (!s)
600 {
601 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
602 return ERROR_INTERNAL_ERROR;
603 }
604
605 Stream_Write_UINT16(s, 1); /* cCapabilitiesSets */
606 Stream_Write_UINT16(s, 0); /* pad1 */
607 generalCapabilitySet = WINPR_PACKED_ALIGN_CAST(const CLIPRDR_GENERAL_CAPABILITY_SET*,
608 capabilities->capabilitySets);
609 Stream_Write_UINT16(s, generalCapabilitySet->capabilitySetType); /* capabilitySetType */
610 Stream_Write_UINT16(s, generalCapabilitySet->capabilitySetLength); /* lengthCapability */
611 Stream_Write_UINT32(s, generalCapabilitySet->version); /* version */
612 flags = generalCapabilitySet->generalFlags;
613
614 /* Client capabilities are sent in response to server capabilities.
615 * -> Do not request features the server does not support.
616 * -> Update clipboard context feature state to what was agreed upon.
617 */
618 if (!cliprdr->useLongFormatNames)
619 flags &= (uint32_t)~CB_USE_LONG_FORMAT_NAMES;
620 if (!cliprdr->streamFileClipEnabled)
621 flags &= (uint32_t)~CB_STREAM_FILECLIP_ENABLED;
622 if (!cliprdr->fileClipNoFilePaths)
623 flags &= (uint32_t)~CB_FILECLIP_NO_FILE_PATHS;
624 if (!cliprdr->canLockClipData)
625 flags &= (uint32_t)~CB_CAN_LOCK_CLIPDATA;
626 if (!cliprdr->hasHugeFileSupport)
627 flags &= (uint32_t)~CB_HUGE_FILE_SUPPORT_ENABLED;
628
629 cliprdr->useLongFormatNames = (flags & CB_USE_LONG_FORMAT_NAMES) != 0;
630 cliprdr->streamFileClipEnabled = (flags & CB_STREAM_FILECLIP_ENABLED) != 0;
631 cliprdr->fileClipNoFilePaths = (flags & CB_FILECLIP_NO_FILE_PATHS) != 0;
632 cliprdr->canLockClipData = (flags & CB_CAN_LOCK_CLIPDATA) != 0;
633 cliprdr->hasHugeFileSupport = (flags & CB_HUGE_FILE_SUPPORT_ENABLED) != 0;
634
635 Stream_Write_UINT32(s, flags); /* generalFlags */
636 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientCapabilities");
637
638 return cliprdr_packet_send(cliprdr, s);
639}
640
646static UINT cliprdr_temp_directory(CliprdrClientContext* context,
647 const CLIPRDR_TEMP_DIRECTORY* tempDirectory)
648{
649 wStream* s = nullptr;
650 cliprdrPlugin* cliprdr = nullptr;
651
652 WINPR_ASSERT(context);
653 WINPR_ASSERT(tempDirectory);
654
655 cliprdr = (cliprdrPlugin*)context->handle;
656 WINPR_ASSERT(cliprdr);
657
658 const size_t tmpDirCharLen = sizeof(tempDirectory->szTempDir) / sizeof(WCHAR);
659 s = cliprdr_packet_new(CB_TEMP_DIRECTORY, 0, tmpDirCharLen * sizeof(WCHAR));
660
661 if (!s)
662 {
663 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
664 return ERROR_INTERNAL_ERROR;
665 }
666
667 if (Stream_Write_UTF16_String_From_UTF8(s, tmpDirCharLen - 1, tempDirectory->szTempDir,
668 ARRAYSIZE(tempDirectory->szTempDir), TRUE) < 0)
669 {
670 Stream_Free(s, TRUE);
671 return ERROR_INTERNAL_ERROR;
672 }
673 /* Path must be 260 UTF16 characters with '\0' termination.
674 * ensure this here */
675 Stream_Write_UINT16(s, 0);
676
677 WLog_Print(cliprdr->log, WLOG_DEBUG, "TempDirectory: %s", tempDirectory->szTempDir);
678 return cliprdr_packet_send(cliprdr, s);
679}
680
686static UINT cliprdr_client_format_list(CliprdrClientContext* context,
687 const CLIPRDR_FORMAT_LIST* formatList)
688{
689 wStream* s = nullptr;
690 cliprdrPlugin* cliprdr = nullptr;
691
692 WINPR_ASSERT(context);
693 WINPR_ASSERT(formatList);
694
695 cliprdr = (cliprdrPlugin*)context->handle;
696 WINPR_ASSERT(cliprdr);
697
698 {
699 const UINT32 mask = CB_RESPONSE_OK | CB_RESPONSE_FAIL;
700 if ((formatList->common.msgFlags & mask) != 0)
701 WLog_Print(cliprdr->log, WLOG_WARN,
702 "Sending clipboard request with invalid flags msgFlags = 0x%08" PRIx32
703 ". Correct in your client!",
704 formatList->common.msgFlags & mask);
705 }
706
707 const UINT32 mask =
708 freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
709 CLIPRDR_FORMAT_LIST filterList = cliprdr_filter_format_list(
710 formatList, mask, CLIPRDR_FLAG_LOCAL_TO_REMOTE | CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES);
711
712 const uint32_t level = WLOG_DEBUG;
713 if (WLog_IsLevelActive(cliprdr->log, level))
714 {
715 WLog_Print(cliprdr->log, level, "ClientFormatList: numFormats: %" PRIu32 "",
716 formatList->numFormats);
717 for (size_t x = 0; x < filterList.numFormats; x++)
718 {
719 const CLIPRDR_FORMAT* format = &filterList.formats[x];
720 WLog_Print(cliprdr->log, level, "[%" PRIuz "]: id=0x%08" PRIx32 " [%s|%s]", x,
721 format->formatId, ClipboardGetFormatIdString(format->formatId),
722 format->formatName);
723 }
724 }
725
726 s = cliprdr_packet_format_list_new(&filterList, cliprdr->useLongFormatNames, FALSE);
727 cliprdr_free_format_list(&filterList);
728
729 if (!s)
730 {
731 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_format_list_new failed!");
732 return ERROR_INTERNAL_ERROR;
733 }
734
735 return cliprdr_packet_send(cliprdr, s);
736}
737
743static UINT
744cliprdr_client_format_list_response(CliprdrClientContext* context,
745 const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
746{
747 wStream* s = nullptr;
748 cliprdrPlugin* cliprdr = nullptr;
749
750 WINPR_ASSERT(context);
751 WINPR_ASSERT(formatListResponse);
752
753 cliprdr = (cliprdrPlugin*)context->handle;
754 WINPR_ASSERT(cliprdr);
755
756 s = cliprdr_packet_new(CB_FORMAT_LIST_RESPONSE, formatListResponse->common.msgFlags, 0);
757
758 if (!s)
759 {
760 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
761 return ERROR_INTERNAL_ERROR;
762 }
763
764 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatListResponse");
765 return cliprdr_packet_send(cliprdr, s);
766}
767
773static UINT cliprdr_client_lock_clipboard_data(CliprdrClientContext* context,
774 const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
775{
776 wStream* s = nullptr;
777 cliprdrPlugin* cliprdr = nullptr;
778
779 WINPR_ASSERT(context);
780 WINPR_ASSERT(lockClipboardData);
781
782 cliprdr = (cliprdrPlugin*)context->handle;
783 WINPR_ASSERT(cliprdr);
784
785 s = cliprdr_packet_lock_clipdata_new(lockClipboardData);
786
787 if (!s)
788 {
789 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_lock_clipdata_new failed!");
790 return ERROR_INTERNAL_ERROR;
791 }
792
793 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientLockClipboardData: clipDataId: 0x%08" PRIX32 "",
794 lockClipboardData->clipDataId);
795 return cliprdr_packet_send(cliprdr, s);
796}
797
803static UINT
804cliprdr_client_unlock_clipboard_data(CliprdrClientContext* context,
805 const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
806{
807 wStream* s = nullptr;
808 cliprdrPlugin* cliprdr = nullptr;
809
810 WINPR_ASSERT(context);
811 WINPR_ASSERT(unlockClipboardData);
812
813 cliprdr = (cliprdrPlugin*)context->handle;
814 WINPR_ASSERT(cliprdr);
815
816 s = cliprdr_packet_unlock_clipdata_new(unlockClipboardData);
817
818 if (!s)
819 {
820 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_unlock_clipdata_new failed!");
821 return ERROR_INTERNAL_ERROR;
822 }
823
824 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientUnlockClipboardData: clipDataId: 0x%08" PRIX32 "",
825 unlockClipboardData->clipDataId);
826 return cliprdr_packet_send(cliprdr, s);
827}
828
834static UINT cliprdr_client_format_data_request(CliprdrClientContext* context,
835 const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
836{
837 WINPR_ASSERT(context);
838 WINPR_ASSERT(formatDataRequest);
839
840 cliprdrPlugin* cliprdr = (cliprdrPlugin*)context->handle;
841 WINPR_ASSERT(cliprdr);
842
843 const UINT32 mask =
844 freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
845 if ((mask & (CLIPRDR_FLAG_REMOTE_TO_LOCAL | CLIPRDR_FLAG_REMOTE_TO_LOCAL_FILES)) == 0)
846 {
847 WLog_Print(cliprdr->log, WLOG_WARN, "remote -> local copy disabled, ignoring request");
848 return CHANNEL_RC_OK;
849 }
850
851 wStream* s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4);
852 if (!s)
853 {
854 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
855 return ERROR_INTERNAL_ERROR;
856 }
857
858 Stream_Write_UINT32(s, formatDataRequest->requestedFormatId); /* requestedFormatId (4 bytes) */
859 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataRequest(0x%08" PRIx32 " [%s])",
860 formatDataRequest->requestedFormatId,
861 ClipboardGetFormatIdString(formatDataRequest->requestedFormatId));
862 return cliprdr_packet_send(cliprdr, s);
863}
864
870static UINT
871cliprdr_client_format_data_response(CliprdrClientContext* context,
872 const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
873{
874 WINPR_ASSERT(context);
875 WINPR_ASSERT(formatDataResponse);
876
877 cliprdrPlugin* cliprdr = (cliprdrPlugin*)context->handle;
878 WINPR_ASSERT(cliprdr);
879
880 WINPR_ASSERT(
881 (freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask) &
882 (CLIPRDR_FLAG_LOCAL_TO_REMOTE | CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES)) != 0);
883
884 wStream* s = cliprdr_packet_new(CB_FORMAT_DATA_RESPONSE, formatDataResponse->common.msgFlags,
885 formatDataResponse->common.dataLen);
886
887 if (!s)
888 {
889 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_new failed!");
890 return ERROR_INTERNAL_ERROR;
891 }
892
893 Stream_Write(s, formatDataResponse->requestedFormatData, formatDataResponse->common.dataLen);
894 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataResponse");
895 return cliprdr_packet_send(cliprdr, s);
896}
897
903static UINT
904cliprdr_client_file_contents_request(CliprdrClientContext* context,
905 const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
906{
907 wStream* s = nullptr;
908
909 WINPR_ASSERT(context);
910 WINPR_ASSERT(fileContentsRequest);
911
912 cliprdrPlugin* cliprdr = (cliprdrPlugin*)context->handle;
913 if (!cliprdr)
914 return ERROR_INTERNAL_ERROR;
915
916 const UINT32 mask =
917 freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
918 if ((mask & CLIPRDR_FLAG_REMOTE_TO_LOCAL_FILES) == 0)
919 {
920 WLog_Print(cliprdr->log, WLOG_WARN, "remote -> local file copy disabled, ignoring request");
921 return CHANNEL_RC_OK;
922 }
923
924 if (!cliprdr->hasHugeFileSupport)
925 {
926 if (((UINT64)fileContentsRequest->cbRequested + fileContentsRequest->nPositionLow) >
927 UINT32_MAX)
928 return ERROR_INVALID_PARAMETER;
929 if (fileContentsRequest->nPositionHigh != 0)
930 return ERROR_INVALID_PARAMETER;
931 }
932
933 s = cliprdr_packet_file_contents_request_new(fileContentsRequest);
934
935 if (!s)
936 {
937 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_file_contents_request_new failed!");
938 return ERROR_INTERNAL_ERROR;
939 }
940
941 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFileContentsRequest: streamId: 0x%08" PRIX32 "",
942 fileContentsRequest->streamId);
943 return cliprdr_packet_send(cliprdr, s);
944}
945
951static UINT
952cliprdr_client_file_contents_response(CliprdrClientContext* context,
953 const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
954{
955 wStream* s = nullptr;
956 cliprdrPlugin* cliprdr = nullptr;
957
958 WINPR_ASSERT(context);
959 WINPR_ASSERT(fileContentsResponse);
960
961 cliprdr = (cliprdrPlugin*)context->handle;
962 WINPR_ASSERT(cliprdr);
963
964 const UINT32 mask =
965 freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
966 if ((mask & CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES) == 0)
967 return cliprdr_send_error_response(cliprdr, CB_FILECONTENTS_RESPONSE);
968
969 s = cliprdr_packet_file_contents_response_new(fileContentsResponse);
970
971 if (!s)
972 {
973 WLog_Print(cliprdr->log, WLOG_ERROR, "cliprdr_packet_file_contents_response_new failed!");
974 return ERROR_INTERNAL_ERROR;
975 }
976
977 WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFileContentsResponse: streamId: 0x%08" PRIX32 "",
978 fileContentsResponse->streamId);
979 return cliprdr_packet_send(cliprdr, s);
980}
981
982static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
983 UINT event, LPVOID pData,
984 UINT32 dataLength, UINT32 totalLength,
985 UINT32 dataFlags)
986{
987 UINT error = CHANNEL_RC_OK;
988 cliprdrPlugin* cliprdr = (cliprdrPlugin*)lpUserParam;
989 WINPR_ASSERT(cliprdr);
990
991 switch (event)
992 {
993 case CHANNEL_EVENT_DATA_RECEIVED:
994 if (cliprdr->OpenHandle != openHandle)
995 {
996 WLog_Print(cliprdr->log, WLOG_ERROR, "error no match");
997 return;
998 }
999 if ((error = channel_client_post_message(cliprdr->MsgsHandle, pData, dataLength,
1000 totalLength, dataFlags)))
1001 WLog_Print(cliprdr->log, WLOG_ERROR, "failed with error %" PRIu32 "", error);
1002
1003 break;
1004
1005 case CHANNEL_EVENT_WRITE_CANCELLED:
1006 case CHANNEL_EVENT_WRITE_COMPLETE:
1007 {
1008 wStream* s = (wStream*)pData;
1009 Stream_Free(s, TRUE);
1010 }
1011 break;
1012
1013 case CHANNEL_EVENT_USER:
1014 break;
1015 default:
1016 break;
1017 }
1018
1019 if (error && cliprdr->context->rdpcontext)
1020 setChannelError(cliprdr->context->rdpcontext, error,
1021 "cliprdr_virtual_channel_open_event_ex reported an error");
1022}
1023
1029static UINT cliprdr_virtual_channel_event_connected(cliprdrPlugin* cliprdr,
1030 WINPR_ATTR_UNUSED LPVOID pData,
1031 WINPR_ATTR_UNUSED UINT32 dataLength)
1032{
1033 DWORD status = 0;
1034 WINPR_ASSERT(cliprdr);
1035 WINPR_ASSERT(cliprdr->context);
1036
1037 WINPR_ASSERT(cliprdr->channelEntryPoints.pVirtualChannelOpenEx);
1038 status = cliprdr->channelEntryPoints.pVirtualChannelOpenEx(
1039 cliprdr->InitHandle, &cliprdr->OpenHandle, cliprdr->channelDef.name,
1040 cliprdr_virtual_channel_open_event_ex);
1041 if (status != CHANNEL_RC_OK)
1042 return status;
1043
1044 cliprdr->MsgsHandle = channel_client_create_handler(
1045 cliprdr->context->rdpcontext, cliprdr, cliprdr_order_recv, CLIPRDR_SVC_CHANNEL_NAME);
1046 if (!cliprdr->MsgsHandle)
1047 return ERROR_INTERNAL_ERROR;
1048
1049 return status;
1050}
1051
1057static UINT cliprdr_virtual_channel_event_disconnected(cliprdrPlugin* cliprdr)
1058{
1059 UINT rc = 0;
1060
1061 WINPR_ASSERT(cliprdr);
1062
1063 channel_client_quit_handler(cliprdr->MsgsHandle);
1064 cliprdr->MsgsHandle = nullptr;
1065
1066 if (cliprdr->OpenHandle == 0)
1067 return CHANNEL_RC_OK;
1068
1069 WINPR_ASSERT(cliprdr->channelEntryPoints.pVirtualChannelCloseEx);
1070 rc = cliprdr->channelEntryPoints.pVirtualChannelCloseEx(cliprdr->InitHandle,
1071 cliprdr->OpenHandle);
1072
1073 if (CHANNEL_RC_OK != rc)
1074 {
1075 WLog_Print(cliprdr->log, WLOG_ERROR, "pVirtualChannelClose failed with %s [%08" PRIX32 "]",
1076 WTSErrorToString(rc), rc);
1077 return rc;
1078 }
1079
1080 cliprdr->OpenHandle = 0;
1081
1082 return CHANNEL_RC_OK;
1083}
1084
1090static UINT cliprdr_virtual_channel_event_terminated(cliprdrPlugin* cliprdr)
1091{
1092 WINPR_ASSERT(cliprdr);
1093
1094 cliprdr->InitHandle = nullptr;
1095 free(cliprdr->context);
1096 free(cliprdr);
1097 return CHANNEL_RC_OK;
1098}
1099
1100static VOID VCAPITYPE cliprdr_virtual_channel_init_event_ex(LPVOID lpUserParam, LPVOID pInitHandle,
1101 UINT event, LPVOID pData,
1102 UINT dataLength)
1103{
1104 UINT error = CHANNEL_RC_OK;
1105 cliprdrPlugin* cliprdr = (cliprdrPlugin*)lpUserParam;
1106 WINPR_ASSERT(cliprdr);
1107
1108 if (cliprdr->InitHandle != pInitHandle)
1109 {
1110 WLog_Print(cliprdr->log, WLOG_ERROR, "error no match");
1111 return;
1112 }
1113
1114 switch (event)
1115 {
1116 case CHANNEL_EVENT_CONNECTED:
1117 if ((error = cliprdr_virtual_channel_event_connected(cliprdr, pData, dataLength)))
1118 WLog_Print(cliprdr->log, WLOG_ERROR,
1119 "cliprdr_virtual_channel_event_connected failed with error %" PRIu32 "!",
1120 error);
1121
1122 break;
1123
1124 case CHANNEL_EVENT_DISCONNECTED:
1125 if ((error = cliprdr_virtual_channel_event_disconnected(cliprdr)))
1126 WLog_Print(cliprdr->log, WLOG_ERROR,
1127 "cliprdr_virtual_channel_event_disconnected failed with error %" PRIu32
1128 "!",
1129 error);
1130
1131 break;
1132
1133 case CHANNEL_EVENT_TERMINATED:
1134 if ((error = cliprdr_virtual_channel_event_terminated(cliprdr)))
1135 WLog_Print(cliprdr->log, WLOG_ERROR,
1136 "cliprdr_virtual_channel_event_terminated failed with error %" PRIu32
1137 "!",
1138 error);
1139 break;
1140 default:
1141 break;
1142 }
1143
1144 if (error && cliprdr->context->rdpcontext)
1145 setChannelError(cliprdr->context->rdpcontext, error,
1146 "cliprdr_virtual_channel_init_event reported an error");
1147}
1148
1149/* cliprdr is always built-in */
1150#define VirtualChannelEntryEx cliprdr_VirtualChannelEntryEx
1151
1152FREERDP_ENTRY_POINT(BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints,
1153 PVOID pInitHandle))
1154{
1155 UINT rc = 0;
1156 CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx = nullptr;
1157 cliprdrPlugin* cliprdr = (cliprdrPlugin*)calloc(1, sizeof(cliprdrPlugin));
1158
1159 wLog* log = WLog_Get(CHANNELS_TAG("cliprdr.client"));
1160 WINPR_ASSERT(log);
1161
1162 if (!cliprdr)
1163 {
1164 WLog_Print(log, WLOG_ERROR, "calloc failed!");
1165 return FALSE;
1166 }
1167
1168 cliprdr->log = log;
1169 cliprdr->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
1170 CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
1171 (void)sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name),
1172 CLIPRDR_SVC_CHANNEL_NAME);
1173 pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
1174 WINPR_ASSERT(pEntryPointsEx);
1175
1176 if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
1177 (pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
1178 {
1179 CliprdrClientContext* context =
1180 (CliprdrClientContext*)calloc(1, sizeof(CliprdrClientContext));
1181
1182 if (!context)
1183 {
1184 WLog_Print(cliprdr->log, WLOG_ERROR, "calloc failed!");
1185 free(cliprdr);
1186 return FALSE;
1187 }
1188
1189 context->handle = (void*)cliprdr;
1190 context->custom = nullptr;
1191 context->ClientCapabilities = cliprdr_client_capabilities;
1192 context->TempDirectory = cliprdr_temp_directory;
1193 context->ClientFormatList = cliprdr_client_format_list;
1194 context->ClientFormatListResponse = cliprdr_client_format_list_response;
1195 context->ClientLockClipboardData = cliprdr_client_lock_clipboard_data;
1196 context->ClientUnlockClipboardData = cliprdr_client_unlock_clipboard_data;
1197 context->ClientFormatDataRequest = cliprdr_client_format_data_request;
1198 context->ClientFormatDataResponse = cliprdr_client_format_data_response;
1199 context->ClientFileContentsRequest = cliprdr_client_file_contents_request;
1200 context->ClientFileContentsResponse = cliprdr_client_file_contents_response;
1201 cliprdr->context = context;
1202 context->rdpcontext = pEntryPointsEx->context;
1203 }
1204
1205 WLog_Print(cliprdr->log, WLOG_DEBUG, "VirtualChannelEntryEx");
1206 CopyMemory(&(cliprdr->channelEntryPoints), pEntryPoints,
1208 cliprdr->InitHandle = pInitHandle;
1209 rc = cliprdr->channelEntryPoints.pVirtualChannelInitEx(
1210 cliprdr, cliprdr->context, pInitHandle, &cliprdr->channelDef, 1,
1211 VIRTUAL_CHANNEL_VERSION_WIN2000, cliprdr_virtual_channel_init_event_ex);
1212
1213 if (CHANNEL_RC_OK != rc)
1214 {
1215 WLog_Print(cliprdr->log, WLOG_ERROR, "pVirtualChannelInit failed with %s [%08" PRIX32 "]",
1216 WTSErrorToString(rc), rc);
1217 free(cliprdr->context);
1218 free(cliprdr);
1219 return FALSE;
1220 }
1221
1222 cliprdr->channelEntryPoints.pInterface = cliprdr->context;
1223 return TRUE;
1224}
WINPR_ATTR_NODISCARD FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
Definition svc.h:60