diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index ca57c791f..ce8694cc8 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -363,7 +363,15 @@ 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'\\'));) + union + { + char c[2]; + WCHAR w; + } backslash; + backslash.c[0] = '\\'; + backslash.c[1] = '\0'; + + for (wptr = wname; (wptr = _wcschr(wptr, backslash.w));) *wptr = L'_'; Stream_Write(printer_dev->device.data, wname, PrinterNameLen); diff --git a/winpr/libwinpr/clipboard/synthetic_file.c b/winpr/libwinpr/clipboard/synthetic_file.c index 6ca1915cd..c0275a3ae 100644 --- a/winpr/libwinpr/clipboard/synthetic_file.c +++ b/winpr/libwinpr/clipboard/synthetic_file.c @@ -692,7 +692,14 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32 const char* header, const char* lineprefix, const char* lineending, BOOL skip_last_lineending) { - const WCHAR backslash = '\\'; + union + { + char c[2]; + WCHAR w; + } backslash; + backslash.c[0] = '\\'; + backslash.c[1] = '\0'; + const FILEDESCRIPTORW* descriptors = NULL; UINT32 nrDescriptors = 0; size_t count, x, alloc, pos, baseLength = 0; @@ -740,7 +747,7 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32 { const FILEDESCRIPTORW* dsc = &descriptors[x]; - if (_wcschr(dsc->cFileName, backslash) == NULL) + if (_wcschr(dsc->cFileName, backslash.w) == NULL) { alloc += ARRAYSIZE(dsc->cFileName) * 8; /* Overallocate, just take the biggest value the result path can have */ @@ -766,7 +773,7 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32 { const FILEDESCRIPTORW* dsc = &descriptors[x]; BOOL fail = TRUE; - if (_wcschr(dsc->cFileName, backslash) != NULL) + if (_wcschr(dsc->cFileName, backslash.w) != NULL) { continue; }