ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

memory.c
Go to the documentation of this file.
00001 /*
00002  *  MEMORY.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_MEMORY
00017 
00018 INT CommandMemory (LPTSTR param)
00019 {
00020     MEMORYSTATUSEX msex;
00021     TCHAR szMemoryLoad[20];
00022     TCHAR szTotalPhys[40];
00023     TCHAR szAvailPhys[40];
00024     TCHAR szTotalPageFile[40];
00025     TCHAR szAvailPageFile[40];
00026     TCHAR szTotalVirtual[40];
00027     TCHAR szAvailVirtual[40];
00028     BOOL (WINAPI *GlobalMemoryStatusEx)(LPMEMORYSTATUSEX);
00029 
00030     if (!_tcsncmp (param, _T("/?"), 2))
00031     {
00032         ConOutResPaging(TRUE,STRING_MEMMORY_HELP1);
00033         return 0;
00034     }
00035 
00036     GlobalMemoryStatusEx
00037         = (BOOL (WINAPI *)(LPMEMORYSTATUSEX))GetProcAddress(GetModuleHandle(_T("KERNEL32")), "GlobalMemoryStatusEx");
00038     if (GlobalMemoryStatusEx)
00039     {
00040         msex.dwLength = sizeof(MEMORYSTATUSEX);
00041         GlobalMemoryStatusEx(&msex);
00042     }
00043     else
00044     {
00045         MEMORYSTATUS ms;
00046         ms.dwLength = sizeof(MEMORYSTATUS);
00047         GlobalMemoryStatus(&ms);
00048         msex.dwMemoryLoad = ms.dwMemoryLoad;
00049         msex.ullTotalPhys = ms.dwTotalPhys;
00050         msex.ullAvailPhys = ms.dwAvailPhys;
00051         msex.ullTotalPageFile = ms.dwTotalPageFile;
00052         msex.ullAvailPageFile = ms.dwAvailPageFile;
00053         msex.ullTotalVirtual = ms.dwTotalVirtual;
00054         msex.ullAvailVirtual = ms.dwAvailVirtual;
00055     }
00056 
00057     ConvertULargeInteger(msex.dwMemoryLoad, szMemoryLoad, 20, FALSE);
00058     ConvertULargeInteger(msex.ullTotalPhys, szTotalPhys, 40, TRUE);
00059     ConvertULargeInteger(msex.ullAvailPhys, szAvailPhys, 40, TRUE);
00060     ConvertULargeInteger(msex.ullTotalPageFile, szTotalPageFile, 40, TRUE);
00061     ConvertULargeInteger(msex.ullAvailPageFile, szAvailPageFile, 40, TRUE);
00062     ConvertULargeInteger(msex.ullTotalVirtual, szTotalVirtual, 40, TRUE);
00063     ConvertULargeInteger(msex.ullAvailVirtual, szAvailVirtual, 40, TRUE);
00064 
00065     ConOutResPrintf(STRING_MEMMORY_HELP2,
00066                     szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
00067                     szAvailPageFile, szTotalVirtual, szAvailVirtual);
00068 
00069     return 0;
00070 }
00071 
00072 #endif /* INCLUDE_CMD_MEMORY */
00073 
00074 /* EOF */

Generated on Sun May 27 2012 04:18:13 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.