Author: hpoussin
Date: Mon Mar 5 02:26:30 2007
New Revision: 25992
URL:
http://svn.reactos.org/svn/reactos?rev=25992&view=rev
Log:
Convert text to multibyte before displaying it
Modified:
trunk/reactos/base/shell/cmd/console.c
Modified: trunk/reactos/base/shell/cmd/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/console.c?r…
==============================================================================
--- trunk/reactos/base/shell/cmd/console.c (original)
+++ trunk/reactos/base/shell/cmd/console.c Mon Mar 5 02:26:30 2007
@@ -240,7 +240,7 @@
INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
{
INT len;
- PTCHAR pBuf;
+ PCHAR pBuf;
CONSOLE_SCREEN_BUFFER_INFO csbi;
TCHAR szOut[OUTPUT_BUFFER_SIZE];
DWORD dwWritten;
@@ -281,12 +281,17 @@
//make sure they didnt make the screen to small
if(ScreenLines<4)
{
- ConPrintf(szFormat, arg_ptr, nStdHandle);
+ ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0;
}
len = _vstprintf (szOut, szFormat, arg_ptr);
+#ifdef _UNICODE
+ pBuf = malloc(len + 1);
+ len = WideCharToMultiByte( OutputCodePage, 0, szOut, len + 1, pBuf, len + 1, NULL, NULL)
- 1;
+#else
pBuf = szOut;
+#endif
for(i = 0; i < len; i++)
{
@@ -300,11 +305,14 @@
if(LineCount >= ScreenLines)
{
- if(_tcsnicmp(&pBuf[i], _T("\n"), 2)!=0)
+ if(_strnicmp(&pBuf[i], "\n", 2)!=0)
WriteFile (GetStdHandle
(nStdHandle),_T("\n"),sizeof(CHAR),&dwWritten,NULL);
if(PagePrompt() != PROMPT_YES)
{
+#ifdef _UNICODE
+ free(pBuf);
+#endif
return 1;
}
//reset the number of lines being printed