From f07cd587079b3068c0c24e611abe4079bdb8a81b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 25 Jul 2013 12:05:15 -0700 Subject: [PATCH] Add drive-enabled option. --- src/protocols/rdp/client.c | 13 ++++-- src/protocols/rdp/guac_rdpdr/rdpdr_fs.c | 61 +++++++++++++++++++++++-- src/protocols/rdp/rdp_settings.h | 5 ++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 765e3b38..efc267f5 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -100,6 +100,7 @@ const char* GUAC_CLIENT_ARGS[] = { "color-depth", "disable-audio", "enable-printing", + "enable-drive", "console", "console-audio", "server-layout", @@ -122,6 +123,7 @@ enum RDP_ARGS_IDX { IDX_COLOR_DEPTH, IDX_DISABLE_AUDIO, IDX_ENABLE_PRINTING, + IDX_ENABLE_DRIVE, IDX_CONSOLE, IDX_CONSOLE_AUDIO, IDX_SERVER_LAYOUT, @@ -180,8 +182,9 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) { } /* end if audio enabled */ - /* If printing enabled, load rdpdr */ - if (guac_client_data->settings.printing_enabled) { + /* If RDPDR required, load it */ + if (guac_client_data->settings.printing_enabled + || guac_client_data->settings.drive_enabled) { /* Load RDPDR plugin */ if (freerdp_channels_load_plugin(channels, instance->settings, @@ -189,7 +192,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) { guac_client_log_error(client, "Failed to load guacdr plugin."); - } /* end if printing enabled */ + } /* Init color conversion structure */ clrconv = calloc(1, sizeof(CLRCONV)); @@ -532,6 +535,10 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_client_data->settings.printing_enabled = (strcmp(argv[IDX_ENABLE_PRINTING], "true") == 0); + /* Drive enable/disable */ + guac_client_data->settings.drive_enabled = + (strcmp(argv[IDX_ENABLE_DRIVE], "true") == 0); + /* Store client data */ guac_client_data->rdp_inst = rdp_inst; guac_client_data->bounded = FALSE; diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c index ee233be1..53677533 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c @@ -66,9 +66,64 @@ static void guac_rdpdr_device_fs_announce_handler(guac_rdpdr_device* device, static void guac_rdpdr_device_fs_iorequest_handler(guac_rdpdr_device* device, wStream* input_stream, int file_id, int completion_id, int major_func, int minor_func) { - guac_client_log_error(device->rdpdr->client, - "Unknown filesystem I/O request function: 0x%x/0x%x", - major_func, minor_func); + switch (major_func) { + + /* File open */ + case IRP_MJ_CREATE: + break; + + /* File close */ + case IRP_MJ_CLOSE: + break; + + /* File read */ + case IRP_MJ_READ: + break; + + /* File write */ + case IRP_MJ_WRITE: + break; + + case IRP_MJ_DEVICE_CONTROL: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_DEVICE_CONTROL unsupported"); + break; + + case IRP_MJ_QUERY_VOLUME_INFORMATION: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_QUERY_VOLUME_INFORMATION unsupported"); + break; + + case IRP_MJ_SET_VOLUME_INFORMATION: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_SET_VOLUME_INFORMATION unsupported"); + break; + + case IRP_MJ_QUERY_INFORMATION: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_QUERY_INFORMATION unsupported"); + break; + + case IRP_MJ_SET_INFORMATION: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_SET_INFORMATION unsupported"); + break; + + case IRP_MJ_DIRECTORY_CONTROL: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_DIRECTORY_CONTROL unsupported"); + break; + + case IRP_MJ_LOCK_CONTROL: + guac_client_log_error(device->rdpdr->client, + "IRP_MJ_LOCK_CONTROL unsupported"); + break; + + default: + guac_client_log_error(device->rdpdr->client, + "Unknown filesystem I/O request function: 0x%x/0x%x", + major_func, minor_func); + } } diff --git a/src/protocols/rdp/rdp_settings.h b/src/protocols/rdp/rdp_settings.h index e61a2ea2..ff7d7489 100644 --- a/src/protocols/rdp/rdp_settings.h +++ b/src/protocols/rdp/rdp_settings.h @@ -145,6 +145,11 @@ typedef struct guac_rdp_settings { */ int printing_enabled; + /** + * Whether the virtual drive is enabled. + */ + int drive_enabled; + /** * Whether this session is a console session. */