2 * MEMORY.C - internal command.
7 * 01-Sep-1999 (Eric Kohl)
13 #ifdef INCLUDE_CMD_MEMORY
26 * insert commas into a number
29 ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator)
46 if (bSeparator && (((c + 1) % (nNumberGroups + 1)) == 0))
47 temp[30 - c++] = cThousandSeparator;
48 temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
52 for (n = 0; n <= c; n++)
53 des[n] = temp[31 - c + n];
60 INT CommandMemory (LPTSTR cmd, LPTSTR param)
63 TCHAR szMemoryLoad[20];
64 TCHAR szTotalPhys[20];
65 TCHAR szAvailPhys[20];
66 TCHAR szTotalPageFile[20];
67 TCHAR szAvailPageFile[20];
68 TCHAR szTotalVirtual[20];
69 TCHAR szAvailVirtual[20];
71 if (!_tcsncmp (param, _T("/?"), 2))
73 ConOutPuts (_T("Displays the amount of system memory.\n"
79 ms.dwLength = sizeof(MEMORYSTATUS);
81 GlobalMemoryStatus (&ms);
83 ConvertDWord (ms.dwMemoryLoad, szMemoryLoad, 20, FALSE);
84 ConvertDWord (ms.dwTotalPhys, szTotalPhys, 20, TRUE);
85 ConvertDWord (ms.dwAvailPhys, szAvailPhys, 20, TRUE);
86 ConvertDWord (ms.dwTotalPageFile, szTotalPageFile, 20, TRUE);
87 ConvertDWord (ms.dwAvailPageFile, szAvailPageFile, 20, TRUE);
88 ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE);
89 ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE);
92 " %12s%% memory load.\n"
94 " %13s bytes total physical RAM.\n"
95 " %13s bytes available physical RAM.\n"
97 " %13s bytes total page file.\n"
98 " %13s bytes available page file.\n"
100 " %13s bytes total virtual memory.\n"
101 " %13s bytes available virtual memory.\n"),
102 szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
103 szAvailPageFile, szTotalVirtual, szAvailVirtual);
108 #endif /* INCLUDE_CMD_MEMORY */