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.

115 lines
3.4 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #pragma once
  3. #include "..\common\WBEMPageHelper.h"
  4. // BUGBUG : Defining an NT-specific manifest just in case this compiles
  5. // for Win9x. I'll remove it when I discover the proper manifest
  6. // or if this is whistler and on only.
  7. //
  8. #define NTONLY
  9. class VirtualMemDlg : public WBEMPageHelper
  10. {
  11. private:
  12. // Swap file structure
  13. class PAGING_FILE
  14. {
  15. public:
  16. PAGING_FILE()
  17. {
  18. // for information and error checking.
  19. name = NULL;
  20. volume = NULL;
  21. desc = NULL;
  22. pszPageFile = NULL;
  23. objPath = NULL;
  24. freeSpace = 0;
  25. totalSize = 0;
  26. bootDrive = false;
  27. fRamBasedPagefile = false;
  28. // user-definable.
  29. nMinFileSize = 0;
  30. nMaxFileSize = 0;
  31. nMinFileSizePrev = 0;
  32. nMaxFileSizePrev = 0;
  33. nAllocatedFileSize = 0;
  34. }
  35. ~PAGING_FILE()
  36. {
  37. if(name) delete[] name;
  38. if(volume) delete[] volume;
  39. if(desc) delete[] desc;
  40. if(pszPageFile) delete[] pszPageFile;
  41. if(objPath) delete[] objPath;
  42. }
  43. LPTSTR name; // drive letter from Win32_LogicalDisk.
  44. LPTSTR volume; // volumeName from Win32_LogicalDisk.
  45. LPTSTR desc; // driveType string from Win32_LogicalDisk.
  46. LPTSTR filesystem; // filesystem string from Win32_LogicalDisk.
  47. LPTSTR pszPageFile; // Path to page file if it exists on that drv
  48. LPTSTR objPath; // the wbem object path.
  49. ULONG freeSpace; // freespace from Win32_LogicalDisk.
  50. ULONG totalSize; // totalSize from Win32_LogicalDisk.
  51. bool bootDrive;
  52. bool fRamBasedPagefile; // Inidicates computed page file min/max
  53. // sizes based on available RAM.
  54. int nMinFileSize; // Minimum size of pagefile in MB.
  55. int nMaxFileSize; // Max size of pagefile in MB.
  56. int nMinFileSizePrev; // Previous minimum size of pagefile in MB.
  57. int nMaxFileSizePrev; // Previous max size of pagefile in MB.
  58. int nAllocatedFileSize; // The actual size allocated
  59. };
  60. DWORD m_cxLBExtent;
  61. int m_cxExtra;
  62. // TRUE if user has write access
  63. // UNINITIALIZED UNTIL Init()
  64. BOOL m_VMWriteAccess;
  65. // Initialized in LoadVolumeList (called from Init())
  66. // with Win32_OperatingSystem.PAEEnabled property value
  67. BOOL m_PAEEnabled;
  68. IEnumWbemClassObject *m_pgEnumSettings;
  69. IEnumWbemClassObject *m_pgEnumUsage;
  70. CWbemClassObject m_memory;
  71. CWbemClassObject m_registry, m_recovery;
  72. bool EnsureEnumerator(const bstr_t bstrClass);
  73. int CheckForRSLChange(HWND hDlg);
  74. int ComputeTotalMax(void);
  75. void GetRecoveryFlags(bool &bWrite, bool &bLog, bool &bSend);
  76. void LoadVolumeList(void);
  77. BOOL Init(HWND hDlg);
  78. void SelChange(HWND hDlg);
  79. DWORD GetMaxPagefileSizeInMB(PAGING_FILE *iDrive);
  80. bool SetNewSize(HWND hDlg);
  81. int UpdateWBEM(void);
  82. int PromptForReboot(HWND hDlg);
  83. void GetCurrRSL( LPDWORD pcmRSL, LPDWORD pcmUsed, LPDWORD pcmPPLim );
  84. void BuildLBLine(LPTSTR pszBuf, const PAGING_FILE *pgVal);
  85. unsigned long RecomputeAllocated(void);
  86. void FindSwapfile(PAGING_FILE *pgVar);
  87. public:
  88. VirtualMemDlg(WbemServiceThread *serviceThread);
  89. ~VirtualMemDlg();
  90. bool ComputeAllocated(unsigned long *value);
  91. bool DlgProc(HWND hDlg,
  92. UINT message,
  93. WPARAM wParam,
  94. LPARAM lParam);
  95. int DoModal(HWND hDlg);
  96. };
  97. INT_PTR CALLBACK StaticVirtDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);