[ros-diffs] [hbirr] 16897: Use FileGetString instead of ReadFile, because ReadFile doesn't return a null terminated string.

hbirr at svn.reactos.com hbirr at svn.reactos.com
Sat Jul 30 20:51:47 CEST 2005


Use FileGetString instead of ReadFile, because ReadFile doesn't return a
null terminated string.
Modified: trunk/reactos/subsys/system/cmd/type.c
  _____  

Modified: trunk/reactos/subsys/system/cmd/type.c
--- trunk/reactos/subsys/system/cmd/type.c	2005-07-30 18:32:18 UTC
(rev 16896)
+++ trunk/reactos/subsys/system/cmd/type.c	2005-07-30 18:51:43 UTC
(rev 16897)
@@ -37,7 +37,6 @@

 	TCHAR szMsg[RC_STRING_MAX_SIZE];
 	TCHAR  buff[256];
 	HANDLE hFile, hConsoleOut;
-	DWORD  dwRead;
 	BOOL   bRet;
 	INT    argc,i;
 	LPTSTR *argv;
@@ -105,21 +104,20 @@
 		
 		do
 		{
-			bRet =
ReadFile(hFile,buff,sizeof(buff),&dwRead,NULL);
-
+                        bRet = FileGetString (hFile, buff, sizeof(buff)
/ sizeof(TCHAR));
 			if(bPaging)
 			{
-				if(dwRead>0 && bRet)
+				if(bRet)
 					ConOutPrintfPaging(bFirstTime,
buff);
 			}
 			else
 			{				
-				if(dwRead>0 && bRet)
+				if(bRet)
 					ConOutPrintf(buff);
 			}
 			bFirstTime = FALSE;
 
-		} while(dwRead>0 && bRet);
+		} while(bRet);
 
 		CloseHandle(hFile);
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050730/ee9f4879/attachment.html


More information about the Ros-diffs mailing list