ReactOS 0.4.16-dev-329-g9223134
memory.c File Reference
#include "precomp.h"
Include dependency graph for memory.c:

Go to the source code of this file.

Functions

INT CommandMemory (LPTSTR param)
 

Function Documentation

◆ CommandMemory()

INT CommandMemory ( LPTSTR  param)

Definition at line 18 of file memory.c.

19{
20 MEMORYSTATUSEX msex;
21 TCHAR szMemoryLoad[20];
22 TCHAR szTotalPhys[40];
23 TCHAR szAvailPhys[40];
24 TCHAR szTotalPageFile[40];
25 TCHAR szAvailPageFile[40];
26 TCHAR szTotalVirtual[40];
27 TCHAR szAvailVirtual[40];
28 BOOL (WINAPI *GlobalMemoryStatusEx)(LPMEMORYSTATUSEX);
29
30 if (!_tcsncmp (param, _T("/?"), 2))
31 {
33 return 0;
34 }
35
37 = (BOOL (WINAPI *)(LPMEMORYSTATUSEX))GetProcAddress(GetModuleHandle(_T("KERNEL32")), "GlobalMemoryStatusEx");
39 {
40 msex.dwLength = sizeof(MEMORYSTATUSEX);
42 }
43 else
44 {
45 MEMORYSTATUS ms;
46 ms.dwLength = sizeof(MEMORYSTATUS);
48 msex.dwMemoryLoad = ms.dwMemoryLoad;
49 msex.ullTotalPhys = ms.dwTotalPhys;
50 msex.ullAvailPhys = ms.dwAvailPhys;
51 msex.ullTotalPageFile = ms.dwTotalPageFile;
52 msex.ullAvailPageFile = ms.dwAvailPageFile;
53 msex.ullTotalVirtual = ms.dwTotalVirtual;
54 msex.ullAvailVirtual = ms.dwAvailVirtual;
55 }
56
57 ConvertULargeInteger(msex.dwMemoryLoad, szMemoryLoad, 20, FALSE);
58 ConvertULargeInteger(msex.ullTotalPhys, szTotalPhys, 40, TRUE);
59 ConvertULargeInteger(msex.ullAvailPhys, szAvailPhys, 40, TRUE);
60 ConvertULargeInteger(msex.ullTotalPageFile, szTotalPageFile, 40, TRUE);
61 ConvertULargeInteger(msex.ullAvailPageFile, szAvailPageFile, 40, TRUE);
62 ConvertULargeInteger(msex.ullTotalVirtual, szTotalVirtual, 40, TRUE);
63 ConvertULargeInteger(msex.ullAvailVirtual, szAvailVirtual, 40, TRUE);
64
66 szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
67 szAvailPageFile, szTotalVirtual, szAvailVirtual);
68
69 return 0;
70}
INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeparator)
Definition: cmd.c:189
VOID ConOutResPaging(BOOL StartPaging, UINT resID)
Definition: console.c:178
#define STRING_MEMORY_HELP1
Definition: resource.h:143
#define STRING_MEMORY_HELP2
Definition: resource.h:144
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
GLfloat param
Definition: glext.h:5796
VOID NTAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
Definition: heapmem.c:1365
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
#define _tcsncmp
Definition: tchar.h:1428
#define BOOL
Definition: nt_native.h:43
#define ConOutResPrintf(uID,...)
Definition: replace.h:31
SIZE_T dwTotalPhys
Definition: winbase.h:1243
DWORD dwLength
Definition: winbase.h:1241
DWORD dwMemoryLoad
Definition: winbase.h:1242
SIZE_T dwAvailPageFile
Definition: winbase.h:1246
SIZE_T dwAvailVirtual
Definition: winbase.h:1248
SIZE_T dwAvailPhys
Definition: winbase.h:1244
SIZE_T dwTotalPageFile
Definition: winbase.h:1245
SIZE_T dwTotalVirtual
Definition: winbase.h:1247
#define _T(x)
Definition: vfdio.h:22
struct _MEMORYSTATUS MEMORYSTATUS
#define GetModuleHandle
Definition: winbase.h:3852
#define WINAPI
Definition: msvc.h:6
char TCHAR
Definition: xmlstorage.h:189