From 864371fe84ce06dcc8bbb56d5e7467bea6c89df8 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Mon, 13 Apr 2009 17:13:35 +0000 Subject: [PATCH] - More correct fix of tests svn path=/trunk/; revision=40486 --- reactos/dll/win32/kernel32/misc/nls.c | 1 + .../subsystems/win32/csrss/win32csr/conio.c | 28 ++++++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/nls.c b/reactos/dll/win32/kernel32/misc/nls.c index 24a44e62d01..d100ad1bd1b 100644 --- a/reactos/dll/win32/kernel32/misc/nls.c +++ b/reactos/dll/win32/kernel32/misc/nls.c @@ -1252,6 +1252,7 @@ BOOL WINAPI IsValidCodePage(UINT CodePage) { + if (CodePage == 0) return FALSE; if (CodePage == CP_UTF8 || CodePage == CP_UTF7) return TRUE; if (IntGetLoadedCodePageEntry(CodePage)) diff --git a/reactos/subsystems/win32/csrss/win32csr/conio.c b/reactos/subsystems/win32/csrss/win32csr/conio.c index a72043b9fa8..a15af0dad57 100644 --- a/reactos/subsystems/win32/csrss/win32csr/conio.c +++ b/reactos/subsystems/win32/csrss/win32csr/conio.c @@ -2970,22 +2970,16 @@ CSR_API(CsrSetConsoleCodePage) Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); - if (Request->Data.SetConsoleCodePage.CodePage == 0) - { - ConioUnlockConsole(Console); - return STATUS_INVALID_PARAMETER; - } - else - { - if (IsValidCodePage(Request->Data.SetConsoleCodePage.CodePage)) + + if (IsValidCodePage(Request->Data.SetConsoleCodePage.CodePage)) { Console->CodePage = Request->Data.SetConsoleCodePage.CodePage; ConioUnlockConsole(Console); return STATUS_SUCCESS; } - } + ConioUnlockConsole(Console); - return STATUS_UNSUCCESSFUL; + return STATUS_INVALID_PARAMETER; } CSR_API(CsrGetConsoleOutputCodePage) @@ -3023,22 +3017,16 @@ CSR_API(CsrSetConsoleOutputCodePage) Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); - if (Request->Data.SetConsoleOutputCodePage.CodePage == 0) - { - ConioUnlockConsole(Console); - return STATUS_INVALID_PARAMETER; - } - else - { - if (IsValidCodePage(Request->Data.SetConsoleOutputCodePage.CodePage)) + + if (IsValidCodePage(Request->Data.SetConsoleOutputCodePage.CodePage)) { Console->OutputCodePage = Request->Data.SetConsoleOutputCodePage.CodePage; ConioUnlockConsole(Console); return STATUS_SUCCESS; } - } + ConioUnlockConsole(Console); - return STATUS_UNSUCCESSFUL; + return STATUS_INVALID_PARAMETER; } CSR_API(CsrGetProcessList)