Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbhatman1441 <blackhat1441@protonmail.com>2023-12-14 19:17:57 +0300
committerbhatman1441 <blackhat1441@protonmail.com>2023-12-14 19:59:37 +0300
commit53e9af8fbeaa28a8065a328e546dd9e8164def76 (patch)
tree579ecce4f5fcb3cc520a5b3c2ec2c9d85de14ef4
parent4c3879e87578658a6bdf0ed30579f2fcbf0434d7 (diff)
[freerdp] update to build for stable-3.0
* Add Vitalii Kulikov's channels patch * Use ConvertUtf8NToWCharAlloc for utf-16 conversions in FreeRDP3 * Re-cast pointers to remove compiler warnings
-rw-r--r--plugins/rdp/rdp_cliprdr.c124
-rw-r--r--plugins/rdp/rdp_plugin.c3
2 files changed, 73 insertions, 54 deletions
diff --git a/plugins/rdp/rdp_cliprdr.c b/plugins/rdp/rdp_cliprdr.c
index 035d93a3f..4f85fe5a2 100644
--- a/plugins/rdp/rdp_cliprdr.c
+++ b/plugins/rdp/rdp_cliprdr.c
@@ -473,7 +473,6 @@ static UINT remmina_rdp_cliprdr_server_format_data_response(CliprdrClientContext
switch (rfi->clipboard.format) {
case CF_UNICODETEXT:
{
- size = 0;
output =
g_utf16_to_utf8((const WCHAR *)data, size / sizeof(WCHAR), NULL, NULL, NULL);
if (output) {
@@ -808,6 +807,9 @@ void remmina_rdp_cliprdr_get_clipboard_data(RemminaProtocolWidget *gp, RemminaPl
GtkClipboard *gtkClipboard;
UINT8 *inbuf = NULL;
UINT8 *outbuf = NULL;
+#if FREERDP_VERSION_MAJOR >= 3
+ WCHAR *outbuf_wchar = NULL;
+#endif
GdkPixbuf *image = NULL;
int size = 0;
rfContext *rfi = GET_PLUGIN_DATA(gp);
@@ -838,64 +840,78 @@ void remmina_rdp_cliprdr_get_clipboard_data(RemminaProtocolWidget *gp, RemminaPl
/* No data received, send nothing */
if (inbuf != NULL || image != NULL) {
switch (ui->clipboard.format) {
- case CF_TEXT:
- case CB_FORMAT_HTML:
- {
- size = strlen((char *)inbuf);
- outbuf = lf2crlf(inbuf, &size);
- break;
- }
- case CF_UNICODETEXT:
- {
- size = strlen((const char *)inbuf);
- inbuf = lf2crlf(inbuf, &size);
- outbuf = g_utf8_to_utf16((const char *)inbuf, size, NULL, NULL, NULL);
- size = 0;
- if (outbuf)
- size = _wcslen((const char*)outbuf);
- g_free(inbuf);
- break;
- }
- case CB_FORMAT_PNG:
- {
- gchar *data;
- gsize buffersize;
- gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "png", NULL, NULL);
- outbuf = (UINT8 *)malloc(buffersize);
- memcpy(outbuf, data, buffersize);
- size = buffersize;
- g_object_unref(image);
- break;
- }
- case CB_FORMAT_JPEG:
- {
- gchar *data;
- gsize buffersize;
- gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "jpeg", NULL, NULL);
- outbuf = (UINT8 *)malloc(buffersize);
- memcpy(outbuf, data, buffersize);
- size = buffersize;
- g_object_unref(image);
- break;
- }
- case CF_DIB:
- case CF_DIBV5:
- {
- gchar *data;
- gsize buffersize;
- gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "bmp", NULL, NULL);
- size = buffersize - 14;
- outbuf = (UINT8 *)malloc(size);
- memcpy(outbuf, data + 14, size);
- g_object_unref(image);
- break;
- }
+ case CF_TEXT:
+ case CB_FORMAT_HTML:
+ {
+ size = strlen((char *)inbuf);
+ outbuf = lf2crlf(inbuf, &size);
+ break;
+ }
+ case CF_UNICODETEXT:
+ {
+ size = strlen((const char *)inbuf);
+ inbuf = lf2crlf(inbuf, &size);
+#if FREERDP_VERSION_MAJOR >= 3
+ size *= sizeof(WCHAR);
+ outbuf_wchar = ConvertUtf8NToWCharAlloc((const char *)inbuf, (size_t)size, NULL);
+#else
+ size = (ConvertToUnicode(CP_UTF8, 0, (CHAR *)inbuf, -1, (WCHAR **)&outbuf, 0)) * sizeof(WCHAR);
+#endif
+ g_free(inbuf);
+ break;
+ }
+ case CB_FORMAT_PNG:
+ {
+ gchar *data;
+ gsize buffersize;
+ gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "png", NULL, NULL);
+ outbuf = (UINT8 *)malloc(buffersize);
+ memcpy(outbuf, data, buffersize);
+ size = buffersize;
+ g_object_unref(image);
+ break;
+ }
+ case CB_FORMAT_JPEG:
+ {
+ gchar *data;
+ gsize buffersize;
+ gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "jpeg", NULL, NULL);
+ outbuf = (UINT8 *)malloc(buffersize);
+ memcpy(outbuf, data, buffersize);
+ size = buffersize;
+ g_object_unref(image);
+ break;
+ }
+ case CF_DIB:
+ case CF_DIBV5:
+ {
+ gchar *data;
+ gsize buffersize;
+ gdk_pixbuf_save_to_buffer(image, &data, &buffersize, "bmp", NULL, NULL);
+ size = buffersize - 14;
+ outbuf = (UINT8 *)malloc(size);
+ memcpy(outbuf, data + 14, size);
+ g_object_unref(image);
+ break;
+ }
}
}
rdp_event.type = REMMINA_RDP_EVENT_TYPE_CLIPBOARD_SEND_CLIENT_FORMAT_DATA_RESPONSE;
- rdp_event.clipboard_formatdataresponse.data = outbuf;
rdp_event.clipboard_formatdataresponse.size = size;
+
+#if FREERDP_VERSION_MAJOR >= 3
+ // For unicode, use the wchar buffer
+ if (outbuf == NULL && outbuf_wchar != NULL) {
+ rdp_event.clipboard_formatdataresponse.data = (unsigned char *)outbuf_wchar;
+ }
+ else {
+ rdp_event.clipboard_formatdataresponse.data = (unsigned char *)outbuf;
+ }
+#else
+ rdp_event.clipboard_formatdataresponse.data = (unsigned char *)outbuf;
+#endif
+
remmina_rdp_event_event_push(gp, &rdp_event);
}
diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c
index c53c05445..0715f1837 100644
--- a/plugins/rdp/rdp_plugin.c
+++ b/plugins/rdp/rdp_plugin.c
@@ -2508,6 +2508,9 @@ static void remmina_rdp_init(RemminaProtocolWidget *gp)
instance->VerifyCertificateEx = remmina_rdp_verify_certificate_ex;
//instance->VerifyChangedCertificate = remmina_rdp_verify_changed_certificate;
instance->VerifyChangedCertificateEx = remmina_rdp_verify_changed_certificate_ex;
+#if FREERDP_VERSION_MAJOR >= 3
+ instance->LoadChannels = freerdp_client_load_channels;
+#endif
instance->ContextSize = sizeof(rfContext);
freerdp_context_new(instance);