[PATCH 0/1] MR1546: programs/cmd: use OEM code page when reading a file
Calling GetConsoleCP() when ReadConsoleW() fails (potentially indicating that cmd.exe's instance isn't attached to a console) makes no sense. In details, since GetConsoleCP() returns 0 when not attached to a console to indicate error, we're in fact using CP_ACP. So fallback explicitely to OEM CP (which is the default for CUI programs). Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1546
From: Eric Pouech <eric.pouech(a)gmail.com> Calling GetConsoleCP() when ReadConsoleW() fails (potentially indicating that cmd.exe's instance isn't attached to a console) makes no sense. In details, since GetConsoleCP() returns 0 when not attached to a console to indicate error, we're in fact using CP_ACP. So fallback explicitely to OEM CP (which is the default for CUI programs). Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- programs/cmd/batch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 9a262c5fec5..beecccfe926 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -255,7 +255,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) UINT cp; const char *p; - cp = GetConsoleCP(); + cp = GetOEMCP(); bufA = heap_xalloc(noChars); /* Save current file position */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1546
participants (2)
-
Eric Pouech -
eric pouech (@epo)