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.

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