Made cmd unicode compatible.
Modified: trunk/reactos/subsys/system/cmd/console.c
Modified: trunk/reactos/subsys/system/cmd/copy.c
Modified: trunk/reactos/subsys/system/cmd/main.c
Modified: trunk/reactos/subsys/system/cmd/move.c

Modified: trunk/reactos/subsys/system/cmd/console.c
--- trunk/reactos/subsys/system/cmd/console.c	2005-07-30 18:51:43 UTC (rev 16897)
+++ trunk/reactos/subsys/system/cmd/console.c	2005-07-30 18:52:33 UTC (rev 16898)
@@ -261,22 +261,27 @@
 		LineCount = 0;
 
   /* rest LineCount and return if no string have been given */
-  if (szFormat == NULL)
-     return;
+        if (szFormat == NULL)
+                return;
 
 
 	//get the size of the visual screen that can be printed too
-	GetConsoleScreenBufferInfo(hConsole, &csbi);
+	if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
+        {
+                // we assuming its a file handle
+                ConPrintf(szFormat, arg_ptr, nStdHandle);
+                return;
+        }
 	//subtract 2 to account for "press any key..." and for the blank line at the end of PagePrompt()
 	ScreenLines = (csbi.srWindow.Bottom  - csbi.srWindow.Top) - 4;
 	ScreenCol = (csbi.srWindow.Right - csbi.srWindow.Left) + 1;
 
-	//make sure they didnt make the screen to small
+	//make sure they didnt make the screen to small 
 	if(ScreenLines<4)
-  {
-	   ConPrintf(szFormat, arg_ptr, nStdHandle);
-     return ;
-  }
+        {
+	        ConPrintf(szFormat, arg_ptr, nStdHandle);
+                return ;
+        }
 	   
 	len = _vstprintf (szOut, szFormat, arg_ptr);
 #ifdef _UNICODE
@@ -286,44 +291,44 @@
 	pBuf = szOut;
 #endif
 	      
-		for(i = 0; i < len; i++)
-		{ 
+	for(i = 0; i < len; i++)
+	{ 
       
-      if(szOut[i] == _T('\n'))
-			{			        
-				LineCount++; 
-        CharEL=0;
-			}      
-      else
-      {      
-        CharEL++;           
-        if (CharEL>=ScreenCol)
-        {        
-          if (i+1<len)
-          {
-             if(szOut[i+1] != _T('\n')) LineCount++;          
-          }
-          CharEL=0;
-        }
-       }
+                if(pBuf[i] == '\n')
+		{			        
+			LineCount++; 
+                        CharEL=0;
+		}      
+                else
+                {      
+                        CharEL++;           
+                        if (CharEL>=ScreenCol)
+                        {        
+                                if (i+1<len)
+                                {
+                                        if(pBuf[i+1] != '\n') LineCount++;          
+                                }
+                                CharEL=0;
+                        }
+                }
 
-      /* FIXME : write more that one char at time */
-      WriteFile (GetStdHandle (nStdHandle),&pBuf[i],sizeof(TCHAR),&dwWritten,NULL);
-	    if(LineCount >= ScreenLines)
-	      {
-         if(_tcsncicmp(&szOut[i],_T("\n"),2)!=0)
-           WriteFile (GetStdHandle (nStdHandle),_T("\n"),sizeof(TCHAR),&dwWritten,NULL); 
+                /* FIXME : write more that one char at time */
+                WriteFile (GetStdHandle (nStdHandle),&pBuf[i],sizeof(CHAR),&dwWritten,NULL);
+	        if(LineCount >= ScreenLines)
+	        {
+                        if(strnicmp(&pBuf[i], "\n", 2)!=0)
+                        WriteFile (GetStdHandle (nStdHandle),"\n",sizeof(CHAR),&dwWritten,NULL); 
 
-		     if(PagePrompt() != PROMPT_YES)
-		     {
-			    return;
-		     }
-		     //reset the number of lines being printed         
-		     LineCount = 0;
-         CharEL=0;
-	       }
+		        if(PagePrompt() != PROMPT_YES)
+		        {
+			        return;
+		        }
+		        //reset the number of lines being printed         
+		        LineCount = 0;
+                        CharEL=0;
+	        }
       
-		}
+	}
 
 #ifdef UNICODE
 	free(pBuf);

Modified: trunk/reactos/subsys/system/cmd/copy.c
--- trunk/reactos/subsys/system/cmd/copy.c	2005-07-30 18:51:43 UTC (rev 16897)
+++ trunk/reactos/subsys/system/cmd/copy.c	2005-07-30 18:52:33 UTC (rev 16898)
@@ -321,7 +321,7 @@
 	INT res;
 	LoadString(CMD_ModuleHandle, STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE);
 	ConOutPrintf(szMsg,fn);
-	res = FilePromptYNA ("");
+	res = FilePromptYNA (_T(""));
 	return res;
 }
  
@@ -833,7 +833,7 @@
 				nFiles++;
 				/* only print source name when more then one file */
 				if(_tcschr (arg[nSrc], _T('+')) != NULL || _tcschr (arg[nSrc], _T('*')) != NULL)
-					ConOutPrintf("%s\n",findBuffer.cFileName);
+					ConOutPrintf(_T("%s\n"),findBuffer.cFileName);
 				//LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
 			}
 			else

Modified: trunk/reactos/subsys/system/cmd/main.c
--- trunk/reactos/subsys/system/cmd/main.c	2005-07-30 18:51:43 UTC (rev 16897)
+++ trunk/reactos/subsys/system/cmd/main.c	2005-07-30 18:52:33 UTC (rev 16898)
@@ -17,7 +17,7 @@
 #endif
 {
 #ifdef _UNICODE
-  return _main(void);
+  return _main();
 #else
   return _main(argc, argv);
 #endif

Modified: trunk/reactos/subsys/system/cmd/move.c
--- trunk/reactos/subsys/system/cmd/move.c	2005-07-30 18:51:43 UTC (rev 16897)
+++ trunk/reactos/subsys/system/cmd/move.c	2005-07-30 18:52:33 UTC (rev 16898)
@@ -60,7 +60,7 @@
 	INT res;
 	LoadString(CMD_ModuleHandle, STRING_MOVE_HELP1, szMsg, RC_STRING_MAX_SIZE);
 	ConOutPrintf(szMsg,fn);
-	res = FilePromptYNA ("");
+	res = FilePromptYNA (_T(""));
 	return res;
 }