From edd3bff950701e1f513a4d0efa51b3c1b7a00ddc Mon Sep 17 00:00:00 2001 From: Zhang Zhaolong Date: Tue, 4 Mar 2014 16:32:47 +0800 Subject: [PATCH] clipboard: implement file clipping on XP. add temp directory. use %TEMP% directory as file transfering temprorary directory. if %TEMP% directory is in C:\, driver C:\ should be redirected in order to enable file clipping on XP. --- channels/cliprdr/client/cliprdr_main.c | 7 +++++++ client/Windows/wf_cliprdr.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index e8a4d7c2f..13ae1724e 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -363,7 +363,14 @@ static void cliprdr_process_unlock_clipdata_event(cliprdrPlugin* plugin, RDP_CB_ static void cliprdr_process_tempdir_event(cliprdrPlugin* plugin, RDP_CB_TEMPDIR_EVENT * event) { + wStream* s; + DEBUG_CLIPRDR("Sending Temporary Directory."); + s = cliprdr_packet_new(CB_TEMP_DIRECTORY, 0, 520); + + Stream_Write(s, event->dirname, 520); + + cliprdr_packet_send(plugin, s); } static void cliprdr_process_event(rdpSvcPlugin* plugin, wMessage* event) diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index 75e65823b..3af83c3fd 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -118,6 +118,21 @@ static void clear_format_map(cliprdrContext *cliprdr) cliprdr->map_size= 0; } +int cliprdr_send_tempdir(cliprdrContext *cliprdr) +{ + RDP_CB_TEMPDIR_EVENT *cliprdr_event; + + cliprdr_event = (RDP_CB_TEMPDIR_EVENT *)freerdp_event_new(CliprdrChannel_Class, + CliprdrChannel_TemporaryDirectory, NULL, NULL); + + if (!cliprdr_event) + return -1; + + GetEnvironmentVariableW(L"TEMP", (LPWSTR)cliprdr_event->dirname, 260); + + return freerdp_channels_send_event(cliprdr->channels, (wMessage *)cliprdr_event); +} + static void cliprdr_send_format_list(cliprdrContext *cliprdr) { RDP_CB_FORMAT_LIST_EVENT *cliprdr_event; @@ -431,6 +446,8 @@ static void wf_cliprdr_process_cb_monitor_ready_event(wfContext *wfc, RDP_CB_MON { cliprdrContext *cliprdr = (cliprdrContext *)wfc->cliprdr_context; + cliprdr_send_tempdir(cliprdr); + cliprdr->channel_initialized = TRUE; cliprdr_send_format_list(wfc->cliprdr_context);