Add switch to declare printer as default or not

This commit is contained in:
Simon Nivault 2022-09-20 10:36:45 +02:00 committed by akallabeth
parent 8d97215881
commit 82b58325a3
7 changed files with 13 additions and 7 deletions

View File

@ -378,12 +378,12 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
}
static rdpPrinter* printer_cups_get_printer(rdpPrinterDriver* driver, const char* name,
const char* driverName)
const char* driverName, BOOL isDefault)
{
rdpCupsPrinterDriver* cups_driver = (rdpCupsPrinterDriver*)driver;
WINPR_ASSERT(cups_driver);
return printer_cups_new_printer(cups_driver, name, driverName, FALSE);
return printer_cups_new_printer(cups_driver, name, driverName, isDefault);
}
static void printer_cups_add_ref_driver(rdpPrinterDriver* driver)

View File

@ -1072,7 +1072,7 @@ UINT printer_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
if (name && name[0])
{
WINPR_ASSERT(driver->GetPrinter);
rdpPrinter* printer = driver->GetPrinter(driver, name, driver_name);
rdpPrinter* printer = driver->GetPrinter(driver, name, driver_name, device->IsDefault);
if (!printer)
{

View File

@ -384,7 +384,7 @@ static rdpPrinter** printer_win_enum_printers(rdpPrinterDriver* driver)
}
static rdpPrinter* printer_win_get_printer(rdpPrinterDriver* driver, const char* name,
const char* driverName)
const char* driverName, BOOL isDefault)
{
WCHAR* driverNameW = NULL;
WCHAR* nameW = NULL;
@ -404,7 +404,7 @@ static rdpPrinter* printer_win_get_printer(rdpPrinterDriver* driver, const char*
return NULL;
}
myPrinter = printer_win_new_printer(win_driver, nameW, driverNameW, FALSE);
myPrinter = printer_win_new_printer(win_driver, nameW, driverNameW, isDefault);
free(driverNameW);
free(nameW);

View File

@ -502,7 +502,7 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
printf("Serial Port Redirection: /serial:<name>,<device>,[SerCx2|SerCx|Serial],[permissive]\n");
printf("Serial Port Redirection: /serial:COM1,/dev/ttyS0\n");
printf("Parallel Port Redirection: /parallel:<name>,<device>\n");
printf("Printer Redirection: /printer:<device>,<driver>\n");
printf("Printer Redirection: /printer:<device>,<driver>,[default]\n");
printf("TCP redirection: /rdp2tcp:/usr/bin/rdp2tcp\n");
printf("\n");
printf("Audio Output Redirection: /sound:sys:oss,dev:1,format:1\n");

View File

@ -34,7 +34,7 @@ typedef rdpPrinter** (*pcEnumPrinters)(rdpPrinterDriver* driver);
typedef void (*pcReleaseEnumPrinters)(rdpPrinter** printers);
typedef rdpPrinter* (*pcGetPrinter)(rdpPrinterDriver* driver, const char* name,
const char* driverName);
const char* driverName, BOOL isDefault);
typedef void (*pcReferencePrinter)(rdpPrinter* printer);
struct rdp_printer_driver

View File

@ -452,6 +452,7 @@ typedef struct
{
RDPDR_DEVICE device;
char* DriverName;
BOOL IsDefault;
} RDPDR_PRINTER;
typedef struct

View File

@ -334,6 +334,11 @@ RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[])
if (!device.printer->DriverName)
goto fail;
}
if (count > 2)
{
device.printer->IsDefault = _stricmp(args[2], "default") == 0;
}
break;
case RDPDR_DTYP_SERIAL:
if (count > 1)