diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c index 9919c0e9..44d0e88c 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c @@ -151,7 +151,8 @@ static void guac_rdpdr_send_client_device_list_announce_request(guac_rdpdrPlugin for (i=0; idevices_registered; i++) { guac_rdpdr_device* device = &(rdpdr->devices[i]); device->announce_handler(device, output_stream, i); - guac_client_log_info(rdpdr->client, "Registered device %i", i); + guac_client_log_info(rdpdr->client, "Registered device %i (%s)", + device->device_id, device->device_name); } svc_plugin_send((rdpSvcPlugin*) rdpdr, output_stream); @@ -205,11 +206,13 @@ void guac_rdpdr_process_device_reply(guac_rdpdrPlugin* rdpdr, wStream* input_str if (device_id >= 0 && device_id < rdpdr->devices_registered) { if (severity == 0x0) - guac_client_log_info(rdpdr->client, "Device %i connected successfully"); + guac_client_log_info(rdpdr->client, "Device %i (%s) connected successfully", + device_id, rdpdr->devices[device_id].device_name); else - guac_client_log_error(rdpdr->client, "Problem connecting device %i: " + guac_client_log_error(rdpdr->client, "Problem connecting device %i (%s): " "severity=0x%x, c=0x%x, n=0x%x, facility=0x%x, code=0x%x", + device_id, rdpdr->devices[device_id].device_name, severity, c, n, facility, code); } diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c b/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c index 6fc477ac..8d6e9f4f 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c @@ -153,7 +153,7 @@ void guac_rdpdr_process_print_job_create(guac_rdpdr_device* device, Stream_Write_UINT16(output_stream, PAKID_CORE_DEVICE_IOCOMPLETION); /* Write content */ - Stream_Write_UINT32(output_stream, GUAC_PRINTER_DEVICE_ID); + Stream_Write_UINT32(output_stream, device->device_id); Stream_Write_UINT32(output_stream, completion_id); Stream_Write_UINT32(output_stream, 0); /* Success */ Stream_Write_UINT32(output_stream, 0); /* fileId */ @@ -249,7 +249,7 @@ void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device, Stream_Write_UINT16(output_stream, PAKID_CORE_DEVICE_IOCOMPLETION); /* Write content */ - Stream_Write_UINT32(output_stream, GUAC_PRINTER_DEVICE_ID); + Stream_Write_UINT32(output_stream, device->device_id); Stream_Write_UINT32(output_stream, completion_id); Stream_Write_UINT32(output_stream, status); Stream_Write_UINT32(output_stream, length); @@ -281,7 +281,7 @@ void guac_rdpdr_process_print_job_close(guac_rdpdr_device* device, Stream_Write_UINT16(output_stream, PAKID_CORE_DEVICE_IOCOMPLETION); /* Write content */ - Stream_Write_UINT32(output_stream, GUAC_PRINTER_DEVICE_ID); + Stream_Write_UINT32(output_stream, device->device_id); Stream_Write_UINT32(output_stream, completion_id); Stream_Write_UINT32(output_stream, 0); /* NTSTATUS - success */ Stream_Write_UINT32(output_stream, 0); /* padding*/ @@ -351,11 +351,17 @@ static void guac_rdpdr_device_printer_free_handler(guac_rdpdr_device* device) { void guac_rdpdr_register_printer(guac_rdpdrPlugin* rdpdr) { + int id = rdpdr->devices_registered++; + /* Get new device */ - guac_rdpdr_device* device = &(rdpdr->devices[rdpdr->devices_registered++]); + guac_rdpdr_device* device = &(rdpdr->devices[id]); /* Init device */ - device->rdpdr = rdpdr; + device->rdpdr = rdpdr; + device->device_id = id; + device->device_name = "Guacamole Printer"; + + /* Set handlers */ device->announce_handler = guac_rdpdr_device_printer_announce_handler; device->iorequest_handler = guac_rdpdr_device_printer_iorequest_handler; device->free_handler = guac_rdpdr_device_printer_free_handler; diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_service.c b/src/protocols/rdp/guac_rdpdr/rdpdr_service.c index ede4edc8..87b3738c 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_service.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_service.c @@ -53,6 +53,7 @@ #include "rdpdr_service.h" #include "rdpdr_messages.h" +#include "rdpdr_printer.h" /** diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_service.h b/src/protocols/rdp/guac_rdpdr/rdpdr_service.h index b999441e..09a9a60e 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_service.h +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_service.h @@ -79,6 +79,11 @@ struct guac_rdpdr_device { */ guac_rdpdrPlugin* rdpdr; + /** + * The ID assigned to this device by the RDPDR plugin. + */ + int device_id; + /** * An arbitrary device name, used for logging purposes only. */