[WINSPOOL] Convert the returned Unicode string back to ANSI in GetDefaultPrinterA.
authorColin Finck <colin@reactos.org>
Sat, 9 Dec 2017 09:59:40 +0000 (10:59 +0100)
committerColin Finck <colin@reactos.org>
Sat, 9 Dec 2017 13:14:05 +0000 (14:14 +0100)
Thanks to Mark for the hint in CORE-14072!

win32ss/printing/base/winspool/printers.c

index 0441ff3..2abd5c3 100644 (file)
@@ -449,6 +449,9 @@ GetDefaultPrinterA(LPSTR pszBuffer, LPDWORD pcchBuffer)
         goto Cleanup;
     }
 
+    // We successfully got a string in pwszBuffer, so convert the Unicode string to ANSI.
+    WideCharToMultiByte(CP_ACP, 0, pwszBuffer, -1, pszBuffer, *pcchBuffer, NULL, NULL);
+
     dwErrorCode = ERROR_SUCCESS;
 
 Cleanup: