Jacek Caban : kernelbase: Use IOCTL_CONDRV_GET_INPUT_INFO in GetConsoleOutputCP.
Alexandre Julliard
julliard at winehq.org
Fri Aug 14 16:39:31 CDT 2020
Module: wine
Branch: master
Commit: 3576258402f5e23ad059cf446eafef7fb2c10430
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3576258402f5e23ad059cf446eafef7fb2c10430
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Aug 14 13:27:00 2020 +0200
kernelbase: Use IOCTL_CONDRV_GET_INPUT_INFO in GetConsoleOutputCP.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/console.c | 5 +++++
dlls/kernelbase/console.c | 16 +++++-----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index d3ce6fb21c..ee050e887a 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3632,6 +3632,11 @@ static void test_FreeConsole(void)
ok(!cp, "cp = %x\n", cp);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
+ SetLastError(0xdeadbeef);
+ cp = GetConsoleOutputCP();
+ ok(!cp, "cp = %x\n", cp);
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
+
if (!skip_nt)
{
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index 94577a5806..8f4bde8d05 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -658,18 +658,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleMode( HANDLE handle, DWORD *mode )
*/
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
{
- UINT codepage = GetOEMCP(); /* default value */
+ struct condrv_input_info info;
- SERVER_START_REQ( get_console_input_info )
- {
- req->handle = 0;
- if (!wine_server_call_err( req ))
- {
- if (reply->output_cp) codepage = reply->output_cp;
- }
- }
- SERVER_END_REQ;
- return codepage;
+ if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
+ IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
+ return 0;
+ return info.output_cp ? info.output_cp : GetOEMCP();
}
More information about the wine-cvs
mailing list