- More correct fix of tests
authorDmitry Chapyshev <dmitry@reactos.org>
Mon, 13 Apr 2009 17:13:35 +0000 (17:13 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Mon, 13 Apr 2009 17:13:35 +0000 (17:13 +0000)
svn path=/trunk/; revision=40486

reactos/dll/win32/kernel32/misc/nls.c
reactos/subsystems/win32/csrss/win32csr/conio.c

index 24a44e6..d100ad1 100644 (file)
@@ -1252,6 +1252,7 @@ BOOL
 WINAPI
 IsValidCodePage(UINT CodePage)
 {
 WINAPI
 IsValidCodePage(UINT CodePage)
 {
+    if (CodePage == 0) return FALSE;
     if (CodePage == CP_UTF8 || CodePage == CP_UTF7)
         return TRUE;
     if (IntGetLoadedCodePageEntry(CodePage))
     if (CodePage == CP_UTF8 || CodePage == CP_UTF7)
         return TRUE;
     if (IntGetLoadedCodePageEntry(CodePage))
index a72043b..a15af0d 100644 (file)
@@ -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);
 
   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;
     }
     {
       Console->CodePage = Request->Data.SetConsoleCodePage.CodePage;
       ConioUnlockConsole(Console);
       return STATUS_SUCCESS;
     }
-  }
+
   ConioUnlockConsole(Console);
   ConioUnlockConsole(Console);
-  return STATUS_UNSUCCESSFUL;
+  return STATUS_INVALID_PARAMETER;
 }
 
 CSR_API(CsrGetConsoleOutputCodePage)
 }
 
 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);
 
   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;
     }
     {
       Console->OutputCodePage = Request->Data.SetConsoleOutputCodePage.CodePage;
       ConioUnlockConsole(Console);
       return STATUS_SUCCESS;
     }
-  }
+
   ConioUnlockConsole(Console);
   ConioUnlockConsole(Console);
-  return STATUS_UNSUCCESSFUL;
+  return STATUS_INVALID_PARAMETER;
 }
 
 CSR_API(CsrGetProcessList)
 }
 
 CSR_API(CsrGetProcessList)