Use FileGetString instead of ReadFile, because ReadFile doesn't return a null termina...
[reactos.git] / reactos / subsys / system / cmd / free.c
index 44cf613..2eba7d1 100644 (file)
@@ -8,10 +8,10 @@
  *        Started.
  *
  *    28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- *        Remove all hardcode string to En.rc  
+ *        Remove all hardcode string to En.rc
  */
 
-#include "precomp.h"
+#include <precomp.h>
 #include "resource.h"
 
 #ifdef INCLUDE_CMD_FREE
@@ -75,7 +75,7 @@ PrintDiskInfo (LPTSTR szDisk)
 
        if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
        {
-               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
                ConErrPrintf(szMsg);
                return;
        }
@@ -86,15 +86,15 @@ PrintDiskInfo (LPTSTR szDisk)
        if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial,
                                   NULL, NULL, NULL, 0))
        {
-               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
                ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive);
                return;
        }
 
        if (szVolume[0] == _T('\0'))
        {
-               
-               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+
+               LoadString(CMD_ModuleHandle, STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
                _tcscpy (szVolume, szMsg);
        }
 
@@ -106,7 +106,7 @@ PrintDiskInfo (LPTSTR szDisk)
        if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl,
                               &dwBytPerSec, &dwFreeCl, &dwTotCl))
        {
-               LoadString(GetModuleHandle(NULL), STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+               LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
                ConErrPrintf (_T("%s %s:\n"), szMsg, szDrive);
                return;
        }
@@ -120,15 +120,14 @@ PrintDiskInfo (LPTSTR szDisk)
        uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
        ConvertULargeInteger (uliSize, szFree, 40);
 
-       
-       LoadString(GetModuleHandle(NULL), STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+
+       LoadString(CMD_ModuleHandle, STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
        ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
 }
 
 
 INT CommandFree (LPTSTR cmd, LPTSTR param)
 {
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
        LPTSTR szParam;
        TCHAR  szDefPath[MAX_PATH];
        INT argc, i;
@@ -136,8 +135,7 @@ INT CommandFree (LPTSTR cmd, LPTSTR param)
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString(GetModuleHandle(NULL), STRING_FREE_HELP2, szMsg, RC_STRING_MAX_SIZE);
-               ConOutPuts(szMsg);
+               ConOutResPaging(TRUE,STRING_FREE_HELP2);
                return 0;
        }