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.

166 lines
5.5 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1996
  4. *
  5. * TITLE: POWERCFG.H
  6. *
  7. * VERSION: 2.0
  8. *
  9. * AUTHOR: ReedB
  10. *
  11. * DATE: 17 Oct, 1996
  12. *
  13. *******************************************************************************/
  14. #include "powrprofp.h"
  15. #include "batmeter.h"
  16. // String constants and macros:
  17. #define MAX_UI_STR_LEN 256
  18. #define MAX_FRIENDLY_NAME_LEN 32 // Resource layout depends on this.
  19. #define FREE_STR TRUE
  20. #define NO_FREE_STR FALSE
  21. #define PWRMANHLP TEXT("PWRMN.HLP")
  22. // Policy settings
  23. #define POWER_POLICY_KEY TEXT("Software\\Policies\\Microsoft\\Windows\\System\\Power")
  24. #define LOCK_ON_RESUME TEXT("PromptPasswordOnResume")
  25. // Hard limits, many are overridden by machine capabilities
  26. // or registry settings:
  27. #define MAX_VIDEO_TIMEOUT 300
  28. #define MAX_SPINDOWN_TIMEOUT 300
  29. #define ARRAYSIZE(a) (sizeof(a)/sizeof((a)[0]))
  30. /*******************************************************************************
  31. *
  32. * Structures and constants to manage property pages in the applet.
  33. *
  34. *******************************************************************************/
  35. #define MAX_PAGES 16+2 // Max number pages + caption & sentinal.
  36. #define START_OF_PAGES 1 // Index to the property sheet pages.
  37. #define CAPTION_INDEX 0 // Index to the overall caption.
  38. typedef struct _POWER_PAGES
  39. {
  40. LPCTSTR pDlgTemplate;
  41. DLGPROC pfnDlgProc;
  42. HPROPSHEETPAGE hPropSheetPage;
  43. } POWER_PAGES, *PPOWER_PAGES;
  44. /*******************************************************************************
  45. *
  46. * Structures and constants which manage dialog control information.
  47. *
  48. *******************************************************************************/
  49. // Constants for MapXXXIndex functions:
  50. #define VALUE_TO_INDEX TRUE
  51. #define INDEX_TO_VALUE FALSE
  52. // Constants used by SetControls in GETSET.C:
  53. #define CONTROL_DISABLE 0
  54. #define CONTROL_HIDE 1
  55. #define CONTROL_ENABLE 2
  56. // Proto for MapXXXIndex functions
  57. typedef BOOL (*MAPFUNC)(LPVOID, PUINT, BOOL);
  58. // Structure to manage the spin control data:
  59. typedef struct _SPIN_DATA
  60. {
  61. UINT uiSpinId;
  62. PUINT puiRange;
  63. } SPIN_DATA, *PSPIN_DATA;
  64. // Structure to manage the dialog controls specification:
  65. typedef struct _POWER_CONTROLS
  66. {
  67. UINT uiID;
  68. UINT uiType;
  69. LPVOID lpvData;
  70. DWORD dwSize;
  71. LPDWORD lpdwParam;
  72. LPDWORD lpdwState;
  73. } POWER_CONTROLS, *PPOWER_CONTROLS;
  74. // Dialog control constants:
  75. #define CHECK_BOX 0
  76. #define CHECK_BOX_ENABLE 1
  77. #define SLIDER 2
  78. #define EDIT_UINT 3
  79. #define EDIT_TEXT 6
  80. #define EDIT_TEXT_RO 7
  81. #define COMBO_BOX 8
  82. #define PUSHBUTTON 9
  83. #define STATIC_TEXT 10
  84. #define GROUPBOX_TEXT 11
  85. /*******************************************************************************
  86. *
  87. * P u b l i c P r o t o t y p e s
  88. *
  89. *******************************************************************************/
  90. // Public functions implemented in ALARM.C
  91. INT_PTR CALLBACK AlarmDlgProc(HWND, UINT, WPARAM, LPARAM);
  92. INT_PTR CALLBACK AlarmActionsDlgProc(HWND, UINT, WPARAM, LPARAM);
  93. // Public functions implemented in BATMTRCF.C
  94. INT_PTR CALLBACK BatMeterCfgDlgProc(HWND, UINT, WPARAM, LPARAM);
  95. // Public functions implemented in APM.C
  96. INT_PTR CALLBACK APMDlgProc(HWND, UINT, WPARAM, LPARAM);
  97. BOOLEAN IsNtApmPresent(PSYSTEM_POWER_CAPABILITIES);
  98. // Public functions implemented in ups.lib
  99. INT_PTR CALLBACK UPSMainPageProc(HWND, UINT, WPARAM, LPARAM);
  100. BOOLEAN IsUpsPresent(PSYSTEM_POWER_CAPABILITIES);
  101. // Public functions implemented in GETSET.C
  102. DWORD SelToFromPowerAction(HWND, UINT, LPVOID, LPARAM, BOOL);
  103. DWORD PowerActionToStatus(HWND, UINT, LPVOID, LPARAM, BOOL);
  104. VOID DisableControls(HWND, UINT, PPOWER_CONTROLS);
  105. VOID HideControls(HWND, UINT, PPOWER_CONTROLS);
  106. BOOL SetControls(HWND, UINT, PPOWER_CONTROLS);
  107. BOOL GetControls(HWND, UINT, PPOWER_CONTROLS);
  108. VOID RangeLimitIDarray(PUINT, UINT, UINT);
  109. // Public functions implemented in HIBERNAT.C:
  110. void DoHibernateApply(void);
  111. INT_PTR CALLBACK HibernateDlgProc(HWND, UINT, WPARAM, LPARAM);
  112. BOOL MapPwrAct(PPOWER_ACTION, BOOL);
  113. // Public functions implemented in POWERCFG.C:
  114. LPTSTR CDECL LoadDynamicString(UINT StringID, ... );
  115. LPTSTR DisplayFreeStr(HWND, UINT, LPTSTR, BOOL);
  116. BOOLEAN ValidateUISchemeFields(PPOWER_POLICY);
  117. BOOLEAN GetGlobalPwrPolicy(PGLOBAL_POWER_POLICY);
  118. BOOLEAN WritePwrSchemeReport(HWND, PUINT, LPTSTR, LPTSTR, PPOWER_POLICY);
  119. BOOLEAN WriteGlobalPwrPolicyReport(HWND, PGLOBAL_POWER_POLICY, BOOL);
  120. BOOLEAN SetActivePwrSchemeReport(HWND, UINT, PGLOBAL_POWER_POLICY, PPOWER_POLICY);
  121. int ErrorMsgBox(HWND, DWORD, UINT);
  122. BOOL InitCapabilities(PSYSTEM_POWER_CAPABILITIES);
  123. // Public functions implemented in PRSHTHLP.C:
  124. BOOL AppendPropSheetPage(PPOWER_PAGES, UINT, DLGPROC);
  125. UINT GetNumPropSheetPages(PPOWER_PAGES);
  126. BOOL CALLBACK _AddPowerPropSheetPage(HPROPSHEETPAGE hpage, LPARAM lParam);
  127. BOOL PASCAL DoPropSheetPages(HWND, PPOWER_PAGES, LPTSTR);
  128. VOID MarkSheetDirty(HWND, PBOOL);
  129. // Public functions implemented in PWRSCHEM.C
  130. VOID InitSchemesList(VOID);
  131. INT_PTR CALLBACK PowerSchemeDlgProc(HWND, UINT, WPARAM, LPARAM);
  132. INT_PTR CALLBACK AdvPowerSchemeDlgProc(HWND, UINT, WPARAM, LPARAM);
  133. // Public functions implemented in PWRSWTCH.C
  134. INT_PTR CALLBACK AdvancedDlgProc(HWND, UINT, WPARAM, LPARAM);