Use FileGetString instead of ReadFile, because ReadFile doesn't return a null termina...
authorHartmut Birr <osexpert@googlemail.com>
Sat, 30 Jul 2005 18:51:43 +0000 (18:51 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Sat, 30 Jul 2005 18:51:43 +0000 (18:51 +0000)
svn path=/trunk/; revision=16897

reactos/subsys/system/cmd/type.c

index 83f6799..877bf44 100644 (file)
@@ -37,7 +37,6 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
        TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR  buff[256];
        HANDLE hFile, hConsoleOut;
        TCHAR szMsg[RC_STRING_MAX_SIZE];
        TCHAR  buff[256];
        HANDLE hFile, hConsoleOut;
-       DWORD  dwRead;
        BOOL   bRet;
        INT    argc,i;
        LPTSTR *argv;
        BOOL   bRet;
        INT    argc,i;
        LPTSTR *argv;
@@ -105,21 +104,20 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
                
                do
                {
                
                do
                {
-                       bRet = ReadFile(hFile,buff,sizeof(buff),&dwRead,NULL);
-
+                        bRet = FileGetString (hFile, buff, sizeof(buff) / sizeof(TCHAR));
                        if(bPaging)
                        {
                        if(bPaging)
                        {
-                               if(dwRead>0 && bRet)
+                               if(bRet)
                                        ConOutPrintfPaging(bFirstTime, buff);
                        }
                        else
                        {                               
                                        ConOutPrintfPaging(bFirstTime, buff);
                        }
                        else
                        {                               
-                               if(dwRead>0 && bRet)
+                               if(bRet)
                                        ConOutPrintf(buff);
                        }
                        bFirstTime = FALSE;
 
                                        ConOutPrintf(buff);
                        }
                        bFirstTime = FALSE;
 
-               } while(dwRead>0 && bRet);
+               } while(bRet);
 
                CloseHandle(hFile);
        }
 
                CloseHandle(hFile);
        }