From f2e14d68eb135a8dbfa7d77ff31e48260eda081d Mon Sep 17 00:00:00 2001 From: David PHAM-VAN Date: Fri, 3 Sep 2021 10:45:18 -0300 Subject: [PATCH] Replace backslashes with underscores in printer names --- channels/printer/client/printer_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index 799b02e53..08e57d751 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -300,6 +300,7 @@ static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* pr void* CachedPrinterConfigData = NULL; UINT32 CachedFieldsLen = 0; UINT32 PrinterNameLen = 0; + WCHAR* wptr = NULL; if (!settings || !printer) return FALSE; @@ -359,6 +360,8 @@ static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* pr if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, PrinterNameLen)) goto fail; + for (wptr = wname; (wptr = _wcschr(wptr, L'\\'));) + *wptr = L'_'; Stream_Write(printer_dev->device.data, wname, PrinterNameLen); if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, CachedFieldsLen))