[PATCH] kernelbase: Fix the fallback value in GetConsole*CP

Martin Storsjo martin at martin.st
Tue Jan 26 06:55:58 CST 2021


This fixes a regression from 3576258402f5e23ad059cf446eafef7fb2c10430,
where the fallback value (if no console is available, e.g. if
stdin is piped from /dev/null) ends up as zero, instead of at OEM CP
(as it was before 3576258402f5e23ad059cf446eafef7fb2c10430).

Signed-off-by: Martin Storsjo <martin at martin.st>
---
 dlls/kernelbase/console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index 8d440c89296..5e9ef66c981 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -611,7 +611,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP(void)
 
     if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
                          IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
-        return 0;
+        return GetOEMCP();
     return info.input_cp;
 }
 
@@ -684,7 +684,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
 
     if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
                          IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
-        return 0;
+        return GetOEMCP();
     return info.output_cp;
 }
 
-- 
2.25.1




More information about the wine-devel mailing list