Source code of Windows XP (NT5)
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.

443 lines
14 KiB

  1. /*======================================================================================//
  2. | Process Control //
  3. | //
  4. |Copyright (c) 1998 Sequent Computer Systems, Incorporated. All rights reserved. //
  5. | //
  6. |File Name: ManagementPages.h //
  7. | //
  8. |Description: Definition of Management Property pages //
  9. | //
  10. |Created: Paul Skoglund 09-1998 //
  11. | //
  12. |Rev History: //
  13. | //
  14. |=======================================================================================*/
  15. #ifndef __MANAGEMENTPAGES_H_
  16. #define __MANAGEMENTPAGES_H_
  17. #include "Globals.h"
  18. #include "ppage.h"
  19. #include "Container.h"
  20. const AFFINITY ProcessorBit = 1;
  21. const TIME_VALUE CNSperTenths = 1000 * 1000;
  22. const TIME_VALUE CNSperSec = CNSperTenths * 10;
  23. const TIME_VALUE CNSperMinute = CNSperSec * 60;
  24. const TIME_VALUE CNSperHour = CNSperMinute * 60;
  25. const TIME_VALUE CNSperDay = CNSperHour * 24;
  26. const TIME_VALUE CNSperYear = CNSperDay * 365;
  27. const TIME_VALUE SecondsperYear = 365 * 24 * 60 * 60;
  28. const TIME_VALUE MinutesperYear = 365 * 24 * 60;
  29. const TIME_VALUE HoursperYear = 365 * 24;
  30. void SetMGMTFlag(PC_MGMT_FLAGS &flag, PCMgmtFlags bit, BOOL bOn);
  31. // some formating helper functions
  32. LPCTSTR FormatMatchType (ITEM_STR str, const MATCH_TYPE matchType);
  33. LPCTSTR FormatAffinity (ITEM_STR str, const AFFINITY affinity);
  34. LPCTSTR FormatPriority (ITEM_STR str, const PRIORITY priority);
  35. LPCTSTR FormatSchedulingClass (ITEM_STR str, const SCHEDULING_CLASS schedClass);
  36. LPCTSTR FormatProcCount (ITEM_STR str, const PROC_COUNT procCount);
  37. LPCTSTR FormatPCUINT32 (ITEM_STR str, const PCUINT32 uInt);
  38. LPCTSTR FormatPCINT32 (ITEM_STR str, const PCINT32 aInt);
  39. LPCTSTR FormatPCUINT64 (ITEM_STR str, const PCUINT64 aUInt64);
  40. LPCTSTR FormatApplyFlag (ITEM_STR str, const BOOL applied);
  41. LPCTSTR FormatMemory (ITEM_STR str, const MEMORY_VALUE memory_value);
  42. LPCTSTR FormatTime (ITEM_STR str, const TIME_VALUE timevalue);
  43. LPCTSTR FormatTimeToms (ITEM_STR str, const TIME_VALUE time);
  44. LPCTSTR FormatCNSTime (ITEM_STR str, TIME_VALUE timevalue);
  45. LPCTSTR FormatCPUTIMELimitAction(ITEM_STR str, const BOOL bMsgOnLimit);
  46. LPCTSTR FormatSheetTitle(CComBSTR &Title, const CComBSTR &item_name, const COMPUTER_CONNECTION_INFO &Target);
  47. // some dialog helper functions
  48. int PriorityToID(PRIORITY p);
  49. PRIORITY IDToPriority(int id);
  50. int MatchTypeToID(MATCH_TYPE matchType);
  51. BOOL ValidateTimeField(HWND hDlg, WORD wID, TIME_VALUE &newtime);
  52. class CBaseNode;
  53. class CMGMTAffinityPage :
  54. public CMySnapInPropertyPageImpl<CMGMTAffinityPage>
  55. {
  56. public :
  57. CMGMTAffinityPage(int nTitle, CProcDetailContainer *pContainer, AFFINITY ProcessorMask = 0xFFffFFff);
  58. CMGMTAffinityPage(int nTitle, CJobDetailContainer *pContainer, AFFINITY ProcessorMask = 0xFFffFFff);
  59. ~CMGMTAffinityPage();
  60. enum { IDD = IDD_AFFINITY_PAGE };
  61. bool m_affinitychk;
  62. AFFINITY m_affinity;
  63. AFFINITY m_ProcessorMask;
  64. BEGIN_MSG_MAP(CMGMTAffinityPage)
  65. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  66. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  67. COMMAND_RANGE_HANDLER(IDC_AFFINITY1, IDC_AFFINITY64, OnAffinityEdit)
  68. COMMAND_HANDLER(IDC_AFFINITY_CHK, BN_CLICKED, OnChk)
  69. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTAffinityPage>)
  70. END_MSG_MAP()
  71. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  72. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  73. LRESULT OnAffinityEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  74. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  75. BOOL OnSetActive();
  76. BOOL OnHelp();
  77. BOOL OnKillActive() { return Validate(TRUE); }
  78. BOOL OnApply();
  79. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  80. BOOL Validate(BOOL bSave = FALSE);
  81. void SetReadOnly() { m_bReadOnly = TRUE;}
  82. private:
  83. HANDLE m_hIconImage;
  84. typedef enum _PageType
  85. {
  86. PROCESS_PAGE,
  87. JOB_PAGE,
  88. } PageType;
  89. CProcDetailContainer *m_pProcContainer;
  90. CJobDetailContainer *m_pJobContainer;
  91. BOOL m_bReadOnly;
  92. PageType m_PageType;
  93. union {
  94. struct
  95. {
  96. int affinitychk : 1;
  97. int affinity : 1;
  98. } Fields;
  99. int on;
  100. } PageFields;
  101. void Initialize();
  102. void ApplyControlEnableRules(BOOL bForceDisable);
  103. };
  104. class CMGMTPriorityPage :
  105. public CMySnapInPropertyPageImpl<CMGMTPriorityPage>
  106. {
  107. public :
  108. CMGMTPriorityPage(int nTitle, CProcDetailContainer *pContainer);
  109. CMGMTPriorityPage(int nTitle, CJobDetailContainer *pContainer);
  110. ~CMGMTPriorityPage();
  111. enum { IDD = IDD_PRIORITY_PAGE };
  112. bool m_prioritychk;
  113. PRIORITY m_priority;
  114. BEGIN_MSG_MAP(CMGMTPriorityPage)
  115. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  116. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  117. COMMAND_RANGE_HANDLER(IDC_LOW, IDC_REALTIME, OnPriorityEdit)
  118. COMMAND_HANDLER(IDC_PRIORITY_CHK, BN_CLICKED, OnChk)
  119. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTPriorityPage>)
  120. END_MSG_MAP()
  121. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  122. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  123. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  124. LRESULT OnPriorityEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  125. BOOL OnSetActive();
  126. BOOL OnHelp();
  127. BOOL OnKillActive() { return Validate(TRUE); }
  128. BOOL OnApply();
  129. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  130. BOOL Validate(BOOL bSave = FALSE);
  131. void SetReadOnly() { m_bReadOnly = TRUE;}
  132. private:
  133. HANDLE m_hIconImage;
  134. typedef enum _PageType
  135. {
  136. PROCESS_PAGE,
  137. JOB_PAGE
  138. } PageType;
  139. CProcDetailContainer *m_pProcContainer;
  140. CJobDetailContainer *m_pJobContainer;
  141. BOOL m_bReadOnly;
  142. PageType m_PageType;
  143. union {
  144. struct
  145. {
  146. int prioritychk : 1;
  147. int priority : 1;
  148. } Fields;
  149. int on;
  150. } PageFields;
  151. void Initialize();
  152. void ApplyControlEnableRules(BOOL bForceDisable);
  153. };
  154. class CMGMTSchedulingClassPage :
  155. public CMySnapInPropertyPageImpl<CMGMTSchedulingClassPage>
  156. {
  157. public :
  158. CMGMTSchedulingClassPage(int nTitle, CJobDetailContainer *pContainer);
  159. ~CMGMTSchedulingClassPage();
  160. enum { IDD = IDD_SCHEDULING_CLASS_PAGE };
  161. bool m_schedClasschk;
  162. SCHEDULING_CLASS m_schedClass;
  163. BEGIN_MSG_MAP(CMGMTSchedulingClassPage)
  164. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  165. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  166. COMMAND_HANDLER(IDC_SCLASS, EN_CHANGE, OnEditChange)
  167. COMMAND_HANDLER(IDC_SCHEDULING_CHK, BN_CLICKED, OnChk)
  168. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTSchedulingClassPage>)
  169. END_MSG_MAP()
  170. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  171. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  172. LRESULT OnEditChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  173. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  174. LRESULT OnPriorityEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  175. BOOL OnHelp();
  176. BOOL OnKillActive() { return Validate(TRUE); }
  177. BOOL OnApply();
  178. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  179. BOOL Validate(BOOL bSave = FALSE);
  180. void SetReadOnly() { m_bReadOnly = TRUE;}
  181. private:
  182. CJobDetailContainer *m_pJobContainer;
  183. BOOL m_bReadOnly;
  184. union {
  185. struct
  186. {
  187. int schedClasschk : 1;
  188. int schedClass : 1;
  189. } Fields;
  190. int on;
  191. } PageFields;
  192. }; // CMGMTSchedulingClassPage
  193. class CMGMTMemoryPage :
  194. public CMySnapInPropertyPageImpl<CMGMTMemoryPage>
  195. {
  196. public :
  197. CMGMTMemoryPage(int nTitle, CProcDetailContainer *pContainer);
  198. CMGMTMemoryPage(int nTitle, CJobDetailContainer *pContainer);
  199. ~CMGMTMemoryPage();
  200. enum { IDD = IDD_MEMORY_PAGE };
  201. bool m_WSchk;
  202. MEMORY_VALUE m_minWS;
  203. MEMORY_VALUE m_maxWS;
  204. bool m_procmemorylimitchk;
  205. MEMORY_VALUE m_procmemorylimit;
  206. bool m_jobmemorylimitchk;
  207. MEMORY_VALUE m_jobmemorylimit;
  208. BEGIN_MSG_MAP(CMGMTMemoryPage)
  209. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  210. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  211. NOTIFY_HANDLER (IDC_MINWS_SPIN, UDN_DELTAPOS, OnSpin)
  212. NOTIFY_HANDLER (IDC_MAXWS_SPIN, UDN_DELTAPOS, OnSpin)
  213. NOTIFY_HANDLER (IDC_PROC_SPIN, UDN_DELTAPOS, OnSpin)
  214. NOTIFY_HANDLER (IDC_JOB_SPIN, UDN_DELTAPOS, OnSpin)
  215. COMMAND_HANDLER(IDC_WORKINGSET_CHK, BN_CLICKED, OnChk)
  216. COMMAND_HANDLER(IDC_MINWS, EN_CHANGE, OnEditChange)
  217. COMMAND_HANDLER(IDC_MAXWS, EN_CHANGE, OnEditChange)
  218. COMMAND_HANDLER(IDC_PROCMEMORY_CHK, BN_CLICKED, OnChk)
  219. COMMAND_HANDLER(IDC_PROCMEMORY, EN_CHANGE, OnEditChange)
  220. COMMAND_HANDLER(IDC_JOBMEMORY_CHK, BN_CLICKED, OnChk)
  221. COMMAND_HANDLER(IDC_JOBMEMORY, EN_CHANGE, OnEditChange)
  222. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTMemoryPage>)
  223. END_MSG_MAP()
  224. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  225. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  226. LRESULT OnEditChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  227. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  228. LRESULT OnSpin(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  229. BOOL OnSetActive();
  230. BOOL OnHelp();
  231. BOOL OnKillActive() { return Validate(TRUE); }
  232. BOOL OnApply();
  233. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  234. BOOL Validate(BOOL bSave = FALSE);
  235. void SetReadOnly() { m_bReadOnly = TRUE;}
  236. private:
  237. HANDLE m_hIconImage;
  238. CProcDetailContainer *m_pProcContainer;
  239. CJobDetailContainer *m_pJobContainer;
  240. BOOL m_bReadOnly;
  241. union {
  242. struct
  243. {
  244. int WSchk : 1;
  245. int minWS : 1;
  246. int maxWS : 1;
  247. int procmemorylimitchk : 1;
  248. int procmemorylimit : 1;
  249. int jobmemorylimitchk : 1;
  250. int jobmemorylimit : 1;
  251. } Fields;
  252. int on;
  253. } PageFields;
  254. void Initialize();
  255. void ApplyControlEnableRules(BOOL bForceDisable);
  256. };
  257. class CMGMTTimePage :
  258. public CMySnapInPropertyPageImpl<CMGMTTimePage>
  259. {
  260. public :
  261. CMGMTTimePage(int Title, CJobDetailContainer *pContainer);
  262. ~CMGMTTimePage();
  263. enum { IDD = IDD_TIME_PAGE };
  264. bool m_procusertimechk;
  265. TIME_VALUE m_procusertime;
  266. bool m_jobusertimechk;
  267. TIME_VALUE m_jobusertime;
  268. bool m_jobmsgontimelimit;
  269. BEGIN_MSG_MAP(CMGMTMemoryPage)
  270. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  271. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  272. COMMAND_HANDLER(IDC_PROCUSERTIME_CHK, BN_CLICKED, OnChk)
  273. COMMAND_HANDLER(IDC_PROCUSERTIME, EN_CHANGE, OnEditChange)
  274. COMMAND_HANDLER(IDC_JOBUSERTIME_CHK, BN_CLICKED, OnChk)
  275. COMMAND_HANDLER(IDC_JOBUSERTIME, EN_CHANGE, OnEditChange)
  276. COMMAND_HANDLER(IDC_JOBTIMELIMIT_TERM,BN_CLICKED, OnChk)
  277. COMMAND_HANDLER(IDC_JOBTIMELIMIT_MSG, BN_CLICKED, OnChk)
  278. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTTimePage>)
  279. END_MSG_MAP()
  280. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  281. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  282. LRESULT OnEditChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  283. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  284. BOOL OnHelp();
  285. BOOL OnKillActive() { return Validate(TRUE); }
  286. BOOL OnApply();
  287. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  288. BOOL Validate(BOOL bSave = FALSE);
  289. void SetReadOnly() { m_bReadOnly = TRUE;}
  290. private:
  291. CJobDetailContainer *m_pJobContainer;
  292. BOOL m_bReadOnly;
  293. union {
  294. struct
  295. {
  296. int procusertimechk : 1;
  297. int procusertime : 1;
  298. int jobusertimechk : 1;
  299. int jobmsgontimelimit : 1;
  300. int jobusertime : 1;
  301. } Fields;
  302. int on;
  303. } PageFields;
  304. };
  305. class CMGMTAdvancedPage :
  306. public CMySnapInPropertyPageImpl<CMGMTAdvancedPage>
  307. {
  308. public :
  309. CMGMTAdvancedPage(int nTitle, CJobDetailContainer *pContainer);
  310. ~CMGMTAdvancedPage();
  311. enum { IDD = IDD_ADVANCED_PAGE };
  312. bool m_endjob;
  313. bool m_unhandledexcept;
  314. bool m_breakaway;
  315. bool m_silentbreakaway;
  316. BEGIN_MSG_MAP(CMGMTAdvancedPage)
  317. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  318. MESSAGE_HANDLER(WM_HELP, OnWMHelp)
  319. COMMAND_HANDLER(IDC_ENDJOB_CHK, BN_CLICKED, OnChk)
  320. COMMAND_HANDLER(IDC_UNHANDLEDEXCEPT_CHK, BN_CLICKED, OnChk)
  321. COMMAND_HANDLER(IDC_BREAKAWAY_CHK, BN_CLICKED, OnChk)
  322. COMMAND_HANDLER(IDC_SILENTBREAKAWAY_CHK, BN_CLICKED, OnChk)
  323. CHAIN_MSG_MAP(CMySnapInPropertyPageImpl<CMGMTAdvancedPage>)
  324. END_MSG_MAP()
  325. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  326. LRESULT OnWMHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  327. LRESULT OnChk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  328. BOOL OnHelp();
  329. BOOL OnKillActive() { return Validate(TRUE); }
  330. BOOL OnApply();
  331. BOOL UpdateData(BOOL bSaveAndValidate = TRUE);
  332. BOOL Validate(BOOL bSave = FALSE);
  333. void SetReadOnly() { m_bReadOnly = TRUE;}
  334. private:
  335. CJobDetailContainer *m_pJobContainer;
  336. BOOL m_bReadOnly;
  337. union {
  338. struct
  339. {
  340. int endjob : 1;
  341. int unhandledexcept : 1;
  342. int breakaway : 1;
  343. int silentbreakaway : 1;
  344. } Fields;
  345. int on;
  346. } PageFields;
  347. };
  348. #endif // __MANAGEMENTPAGES_H_