channels/printer: fix printer redirection and test with cups-pdf
This commit is contained in:
parent
8095bec3ec
commit
e9d362b58e
@ -141,6 +141,12 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
static void printer_process_irp_device_control(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
{
|
||||
Stream_Write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
static void printer_process_irp(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
{
|
||||
switch (irp->MajorFunction)
|
||||
@ -157,6 +163,10 @@ static void printer_process_irp(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
printer_process_irp_write(printer_dev, irp);
|
||||
break;
|
||||
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
printer_process_irp_device_control(printer_dev, irp);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("MajorFunction 0x%X not supported", irp->MajorFunction);
|
||||
irp->IoStatus = STATUS_NOT_SUPPORTED;
|
||||
|
@ -199,9 +199,10 @@ void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
|
||||
UINT16 wNumberOfFormats;
|
||||
AUDIO_FORMAT* clientFormat;
|
||||
|
||||
if (rdpsnd->device->GetVolume)
|
||||
if (rdpsnd->device)
|
||||
{
|
||||
dwVolume = rdpsnd->device->GetVolume(rdpsnd->device);
|
||||
if (rdpsnd->device->GetVolume)
|
||||
dwVolume = rdpsnd->device->GetVolume(rdpsnd->device);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
|
||||
{ "serial", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "tty", "Redirect serial device" },
|
||||
{ "parallel", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect parallel device" },
|
||||
{ "smartcard", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect smartcard device" },
|
||||
{ "printer", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect printer device" },
|
||||
{ "printer", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Redirect printer device" },
|
||||
{ "usb", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect USB device" },
|
||||
{ "multitouch", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect multitouch input" },
|
||||
{ "echo", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "echo", "Echo channel" },
|
||||
@ -291,14 +291,16 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p
|
||||
{
|
||||
RDPDR_PRINTER* printer;
|
||||
|
||||
if (count < 2)
|
||||
if (count < 1)
|
||||
return -1;
|
||||
|
||||
printer = (RDPDR_PRINTER*) malloc(sizeof(RDPDR_PRINTER));
|
||||
ZeroMemory(printer, sizeof(RDPDR_PRINTER));
|
||||
|
||||
printer->Type = RDPDR_DTYP_PRINT;
|
||||
printer->Name = _strdup(params[1]);
|
||||
|
||||
if (count > 1)
|
||||
printer->Name = _strdup(params[1]);
|
||||
|
||||
if (count > 2)
|
||||
printer->DriverName = _strdup(params[2]);
|
||||
@ -547,15 +549,28 @@ int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT
|
||||
}
|
||||
CommandLineSwitchCase(arg, "printer")
|
||||
{
|
||||
char** p;
|
||||
int count;
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
||||
{
|
||||
char** p;
|
||||
int count;
|
||||
|
||||
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
||||
p[0] = "printer";
|
||||
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
||||
p[0] = "printer";
|
||||
|
||||
freerdp_client_add_device_channel(settings, count, p);
|
||||
freerdp_client_add_device_channel(settings, count, p);
|
||||
|
||||
free(p);
|
||||
free(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* p[1];
|
||||
int count;
|
||||
|
||||
count = 1;
|
||||
p[0] = "printer";
|
||||
|
||||
freerdp_client_add_device_channel(settings, count, p);
|
||||
}
|
||||
}
|
||||
CommandLineSwitchCase(arg, "usb")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user