Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. memavail.c
  5. Abstract:
  6. Program to display the size of physical RAM, and paging file space.
  7. Author:
  8. 03-Dec-1996 Steve Wood (stevewo)
  9. Revision History:
  10. --*/
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <windows.h>
  14. int
  15. __cdecl
  16. main(
  17. int argc,
  18. char *argv[]
  19. )
  20. {
  21. MEMORYSTATUS MemoryStatus;
  22. GlobalMemoryStatus( &MemoryStatus );
  23. MemoryStatus.dwTotalPhys /= 1024 * 1024;
  24. MemoryStatus.dwAvailPhys /= 1024 * 1024;
  25. MemoryStatus.dwTotalPageFile /= 1024 * 1024;
  26. MemoryStatus.dwAvailPageFile /= 1024 * 1024;
  27. MemoryStatus.dwTotalVirtual /= 1024 * 1024;
  28. MemoryStatus.dwAvailVirtual /= 1024 * 1024;
  29. printf( "Memory Availability (Numbers in MegaBytes)\n" );
  30. printf( "\n" );
  31. printf( " Total Available\n" );
  32. printf( "\n" );
  33. printf( "Physical: %5u %5u\n", MemoryStatus.dwTotalPhys, MemoryStatus.dwAvailPhys );
  34. printf( "PageFile: %5u %5u\n", MemoryStatus.dwTotalPageFile, MemoryStatus.dwAvailPageFile );
  35. printf( "Virtual: %5u %5u\n", MemoryStatus.dwTotalVirtual, MemoryStatus.dwAvailVirtual );
  36. return 0;
  37. }