Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfree.c
Go to the documentation of this file.
00001 /* 00002 * FREE.C - internal command. 00003 * 00004 * 00005 * History: 00006 * 00007 * 01-Sep-1999 (Eric Kohl) 00008 * Started. 00009 * 00010 * 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>) 00011 * Remove all hardcode string to En.rc 00012 */ 00013 00014 #include <precomp.h> 00015 00016 #ifdef INCLUDE_CMD_FREE 00017 00018 static VOID 00019 PrintDiskInfo (LPTSTR szDisk) 00020 { 00021 TCHAR szMsg[RC_STRING_MAX_SIZE]; 00022 TCHAR szRootPath[4] = _T("A:\\"); 00023 TCHAR szDrive[2] = _T("A"); 00024 TCHAR szVolume[64]; 00025 TCHAR szSerial[10]; 00026 TCHAR szTotal[40]; 00027 TCHAR szUsed[40]; 00028 TCHAR szFree[40]; 00029 DWORD dwSerial; 00030 ULONGLONG uliSize; 00031 DWORD dwSecPerCl; 00032 DWORD dwBytPerSec; 00033 DWORD dwFreeCl; 00034 DWORD dwTotCl; 00035 00036 if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':')) 00037 { 00038 ConErrResPrintf(STRING_FREE_ERROR1); 00039 return; 00040 } 00041 00042 szRootPath[0] = szDisk[0]; 00043 szDrive[0] = _totupper (szRootPath[0]); 00044 00045 if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial, 00046 NULL, NULL, NULL, 0)) 00047 { 00048 LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE); 00049 ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive); 00050 return; 00051 } 00052 00053 if (szVolume[0] == _T('\0')) 00054 { 00055 00056 LoadString(CMD_ModuleHandle, STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE); 00057 _tcscpy (szVolume, szMsg); 00058 } 00059 00060 _stprintf (szSerial, 00061 _T("%04X-%04X"), 00062 HIWORD(dwSerial), 00063 LOWORD(dwSerial)); 00064 00065 if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl, 00066 &dwBytPerSec, &dwFreeCl, &dwTotCl)) 00067 { 00068 LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE); 00069 ConErrPrintf (_T("%s %s:\n"), szMsg, szDrive); 00070 return; 00071 } 00072 00073 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwTotCl; 00074 ConvertULargeInteger(uliSize, szTotal, 40, TRUE); 00075 00076 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)(dwTotCl - dwFreeCl); 00077 ConvertULargeInteger(uliSize, szUsed, 40, TRUE); 00078 00079 uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwFreeCl; 00080 ConvertULargeInteger(uliSize, szFree, 40, TRUE); 00081 00082 00083 ConOutResPrintf(STRING_FREE_HELP1, szDrive, szVolume, szSerial, szTotal, szUsed, szFree); 00084 } 00085 00086 00087 INT CommandFree (LPTSTR param) 00088 { 00089 LPTSTR szParam; 00090 TCHAR szDefPath[MAX_PATH]; 00091 INT argc, i; 00092 LPTSTR *arg; 00093 00094 if (!_tcsncmp (param, _T("/?"), 2)) 00095 { 00096 ConOutResPaging(TRUE,STRING_FREE_HELP2); 00097 return 0; 00098 } 00099 00100 if (!param || *param == _T('\0')) 00101 { 00102 GetCurrentDirectory (MAX_PATH, szDefPath); 00103 szDefPath[2] = _T('\0'); 00104 szParam = szDefPath; 00105 } 00106 else 00107 szParam = param; 00108 00109 arg = split (szParam, &argc, FALSE, FALSE); 00110 00111 for (i = 0; i < argc; i++) 00112 PrintDiskInfo (arg[i]); 00113 00114 freep (arg); 00115 00116 return 0; 00117 } 00118 00119 #endif /* INCLUDE_CMD_FREE */ 00120 00121 /* EOF */ Generated on Fri May 25 2012 04:16:30 for ReactOS by
1.7.6.1
|