diff --git a/channels/rail/rail_main.c b/channels/rail/rail_main.c index 34dceb66e..58d1de40e 100644 --- a/channels/rail/rail_main.c +++ b/channels/rail/rail_main.c @@ -53,15 +53,17 @@ static void on_free_rail_channel_event(RDP_EVENT* event) void rail_send_channel_event(void* rail_object, uint16 event_type, void* param) { + void * payload = NULL; RDP_EVENT* out_event = NULL; railPlugin* plugin = (railPlugin*) rail_object; - void * payload = NULL; payload = rail_clone_order(event_type, param); + if (payload != NULL) { out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type, on_free_rail_channel_event, payload); + svc_plugin_send_event((rdpSvcPlugin*) plugin, out_event); } } @@ -89,9 +91,19 @@ static void rail_process_receive(rdpSvcPlugin* plugin, STREAM* s) static void rail_process_plugin_data(rdpRailOrder* rail_order, RDP_PLUGIN_DATA* data) { - rail_string_to_unicode_string(rail_order, (char*)data->data[0], &rail_order->exec.exeOrFile); - rail_string_to_unicode_string(rail_order, (char*)data->data[1], &rail_order->exec.workingDir); - rail_string_to_unicode_string(rail_order, (char*)data->data[2], &rail_order->exec.arguments); + char* exeOrFile; + + exeOrFile = (char*) data->data[0]; + + if (strlen(exeOrFile) >= 2) + { + if (strncmp(exeOrFile, "||", 2) != 0) + rail_order->exec.flags |= RAIL_EXEC_FLAG_FILE; + } + + rail_string_to_unicode_string(rail_order, (char*) data->data[0], &rail_order->exec.exeOrFile); + rail_string_to_unicode_string(rail_order, (char*) data->data[1], &rail_order->exec.workingDir); + rail_string_to_unicode_string(rail_order, (char*) data->data[2], &rail_order->exec.arguments); rail_send_client_exec_order(rail_order); } @@ -116,20 +128,20 @@ static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, RDP_EVENT* e while (data && data->size > 0) { rail_process_plugin_data(rail_order, data); - data = (RDP_PLUGIN_DATA*)(((void*)data) + data->size); + data = (RDP_PLUGIN_DATA*)(((void*) data) + data->size); } } static void rail_recv_exec_remote_app_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RDP_PLUGIN_DATA* data = (RDP_PLUGIN_DATA*)event->user_data; + RDP_PLUGIN_DATA* data = (RDP_PLUGIN_DATA*) event->user_data; rail_process_plugin_data(rail_order, data); } static void rail_recv_activate_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_ACTIVATE_ORDER* activate = (RAIL_ACTIVATE_ORDER*)event->user_data; + RAIL_ACTIVATE_ORDER* activate = (RAIL_ACTIVATE_ORDER*) event->user_data; memcpy(&rail_order->activate, activate, sizeof(RAIL_ACTIVATE_ORDER)); rail_send_client_activate_order(rail_order); @@ -137,7 +149,7 @@ static void rail_recv_activate_event(rdpRailOrder* rail_order, RDP_EVENT* event) static void rail_recv_sysmenu_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_SYSMENU_ORDER* sysmenu = (RAIL_SYSMENU_ORDER*)event->user_data; + RAIL_SYSMENU_ORDER* sysmenu = (RAIL_SYSMENU_ORDER*) event->user_data; memcpy(&rail_order->sysmenu, sysmenu, sizeof(RAIL_SYSMENU_ORDER)); rail_send_client_sysmenu_order(rail_order); @@ -145,7 +157,7 @@ static void rail_recv_sysmenu_event(rdpRailOrder* rail_order, RDP_EVENT* event) static void rail_recv_syscommand_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_SYSCOMMAND_ORDER* syscommand = (RAIL_SYSCOMMAND_ORDER*)event->user_data; + RAIL_SYSCOMMAND_ORDER* syscommand = (RAIL_SYSCOMMAND_ORDER*) event->user_data; memcpy(&rail_order->syscommand, syscommand, sizeof(RAIL_SYSCOMMAND_ORDER)); rail_send_client_syscommand_order(rail_order); @@ -153,7 +165,7 @@ static void rail_recv_syscommand_event(rdpRailOrder* rail_order, RDP_EVENT* even static void rail_recv_notify_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_NOTIFY_EVENT_ORDER* notify = (RAIL_NOTIFY_EVENT_ORDER*)event->user_data; + RAIL_NOTIFY_EVENT_ORDER* notify = (RAIL_NOTIFY_EVENT_ORDER*) event->user_data; memcpy(&rail_order->notify_event, notify, sizeof(RAIL_NOTIFY_EVENT_ORDER)); rail_send_client_notify_event_order(rail_order); @@ -161,7 +173,7 @@ static void rail_recv_notify_event(rdpRailOrder* rail_order, RDP_EVENT* event) static void rail_recv_window_move_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_WINDOW_MOVE_ORDER* window_move = (RAIL_WINDOW_MOVE_ORDER*)event->user_data; + RAIL_WINDOW_MOVE_ORDER* window_move = (RAIL_WINDOW_MOVE_ORDER*) event->user_data; memcpy(&rail_order->window_move, window_move, sizeof(RAIL_WINDOW_MOVE_ORDER)); rail_send_client_window_move_order(rail_order); @@ -169,7 +181,7 @@ static void rail_recv_window_move_event(rdpRailOrder* rail_order, RDP_EVENT* eve static void rail_recv_app_req_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_GET_APPID_REQ_ORDER* get_appid_req = (RAIL_GET_APPID_REQ_ORDER*)event->user_data; + RAIL_GET_APPID_REQ_ORDER* get_appid_req = (RAIL_GET_APPID_REQ_ORDER*) event->user_data; memcpy(&rail_order->get_appid_req, get_appid_req, sizeof(RAIL_GET_APPID_REQ_ORDER)); rail_send_client_get_appid_req_order(rail_order); @@ -177,7 +189,7 @@ static void rail_recv_app_req_event(rdpRailOrder* rail_order, RDP_EVENT* event) static void rail_recv_langbarinfo_event(rdpRailOrder* rail_order, RDP_EVENT* event) { - RAIL_LANGBAR_INFO_ORDER* langbar_info = (RAIL_LANGBAR_INFO_ORDER*)event->user_data; + RAIL_LANGBAR_INFO_ORDER* langbar_info = (RAIL_LANGBAR_INFO_ORDER*) event->user_data; memcpy(&rail_order->langbar_info, langbar_info, sizeof(RAIL_LANGBAR_INFO_ORDER)); rail_send_client_langbar_info_order(rail_order);