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.

300 lines
6.1 KiB

  1. /*++
  2. Microsoft Confidential
  3. Copyright (c) 1992-1997 Microsoft Corporation
  4. All rights reserved
  5. Module Name:
  6. advanced.c
  7. Abstract:
  8. Implements the Advanced tab of the System Control Panel Applet.
  9. Author:
  10. Scott Hallock (scotthal) 15-Oct-1997
  11. --*/
  12. #include "sysdm.h"
  13. //
  14. // Help IDs
  15. //
  16. DWORD aAdvancedHelpIds[] = {
  17. IDC_ADV_PERF_TEXT, (IDH_ADVANCED + 0),
  18. IDC_ADV_PERF_BTN, (IDH_ADVANCED + 1),
  19. IDC_ADV_ENV_TEXT, (IDH_ADVANCED + 2),
  20. IDC_ADV_ENV_BTN, (IDH_ADVANCED + 3),
  21. IDC_ADV_RECOVERY_TEXT, (IDH_ADVANCED + 4),
  22. IDC_ADV_RECOVERY_BTN, (IDH_ADVANCED + 5),
  23. IDC_ADV_PROF_TEXT, (IDH_ADVANCED + 6),
  24. IDC_ADV_PROF_BTN, (IDH_ADVANCED + 7),
  25. IDC_ADV_PFR_BTN, (IDH_PFR + 99),
  26. 0, 0
  27. };
  28. //
  29. // Private function prototypes
  30. //
  31. BOOL
  32. AdvancedHandleCommand(
  33. IN HWND hDlg,
  34. IN WPARAM wParam,
  35. IN LPARAM lParam
  36. );
  37. BOOL
  38. AdvancedHandleNotify(
  39. IN HWND hDlg,
  40. IN WPARAM wParam,
  41. IN LPARAM lParam
  42. );
  43. INT_PTR
  44. APIENTRY
  45. AdvancedDlgProc(
  46. IN HWND hDlg,
  47. IN UINT uMsg,
  48. IN WPARAM wParam,
  49. IN LPARAM lParam
  50. )
  51. /*++
  52. Routine Description:
  53. Handles messages sent to the Advanced page
  54. Arguments:
  55. hDlg -
  56. Window handle
  57. uMsg -
  58. Message being sent
  59. wParam -
  60. Message parameter
  61. lParam -
  62. Message parameter
  63. Return Value:
  64. TRUE if message was handled
  65. FALSE if message was unhandled
  66. --*/
  67. {
  68. switch (uMsg) {
  69. case WM_COMMAND:
  70. return(AdvancedHandleCommand(hDlg, wParam, lParam));
  71. break;
  72. case WM_NOTIFY:
  73. return(AdvancedHandleNotify(hDlg, wParam, lParam));
  74. break;
  75. case WM_HELP: // F1
  76. WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, HELP_FILE, HELP_WM_HELP, (DWORD_PTR) (LPSTR) aAdvancedHelpIds);
  77. break;
  78. case WM_CONTEXTMENU: // right mouse click
  79. WinHelp((HWND) wParam, HELP_FILE, HELP_CONTEXTMENU, (DWORD_PTR) (LPSTR) aAdvancedHelpIds);
  80. break;
  81. default:
  82. return(FALSE);
  83. } // switch
  84. return(TRUE);
  85. }
  86. static const PSPINFO c_pspPerf[] =
  87. {
  88. { CreatePage, IDD_VISUALEFFECTS, VisualEffectsDlgProc },
  89. { CreatePage, IDD_ADVANCEDPERF, PerformanceDlgProc },
  90. };
  91. void DoPerformancePS(HWND hDlg)
  92. {
  93. PROPSHEETHEADER psh;
  94. HPROPSHEETPAGE rPages[ARRAYSIZE(c_pspPerf)];
  95. int i;
  96. //
  97. // Property sheet stuff.
  98. //
  99. psh.dwSize = sizeof(psh);
  100. psh.dwFlags = PSH_DEFAULT;
  101. psh.hInstance = hInstance;
  102. psh.hwndParent = hDlg;
  103. psh.pszCaption = MAKEINTRESOURCE(IDS_PERFOPTIONS);
  104. psh.nPages = 0;
  105. psh.nStartPage = 0;
  106. psh.phpage = rPages;
  107. for (i = 0; i < ARRAYSIZE(c_pspPerf); i++)
  108. {
  109. rPages[psh.nPages] = c_pspPerf[i].pfnCreatePage(c_pspPerf[i].idd, c_pspPerf[i].pfnDlgProc);
  110. if (rPages[psh.nPages] != NULL)
  111. {
  112. psh.nPages++;
  113. }
  114. }
  115. //
  116. // Display the property sheet.
  117. //
  118. PropertySheet(&psh);
  119. }
  120. BOOL
  121. AdvancedHandleCommand(
  122. IN HWND hDlg,
  123. IN WPARAM wParam,
  124. IN LPARAM lParam
  125. )
  126. /*++
  127. Routine Description:
  128. Handles WM_COMMAND messages sent to Advanced tab
  129. Arguments:
  130. hDlg -
  131. Supplies window handle
  132. wParam -
  133. Supplies message parameter
  134. lParam -
  135. Supplies message parameter
  136. Return Value:
  137. TRUE if message was handled
  138. FALSE if message was unhandled
  139. --*/
  140. {
  141. DWORD_PTR dwResult = 0;
  142. switch (LOWORD(wParam))
  143. {
  144. case IDC_ADV_PERF_BTN:
  145. DoPerformancePS(hDlg);
  146. break;
  147. case IDC_ADV_PROF_BTN:
  148. {
  149. dwResult = DialogBox(
  150. hInstance,
  151. (LPTSTR) MAKEINTRESOURCE(IDD_USERPROFILE),
  152. hDlg,
  153. UserProfileDlgProc);
  154. break;
  155. }
  156. case IDC_ADV_ENV_BTN:
  157. dwResult = DialogBox(
  158. hInstance,
  159. (LPTSTR) MAKEINTRESOURCE(IDD_ENVVARS),
  160. hDlg,
  161. EnvVarsDlgProc
  162. );
  163. break;
  164. case IDC_ADV_RECOVERY_BTN:
  165. dwResult = DialogBox(
  166. hInstance,
  167. (LPTSTR) MAKEINTRESOURCE(IDD_STARTUP),
  168. hDlg,
  169. StartupDlgProc
  170. );
  171. break;
  172. case IDC_ADV_PFR_BTN:
  173. {
  174. INITCOMMONCONTROLSEX icex;
  175. icex.dwSize = sizeof(icex);
  176. icex.dwICC = ICC_LISTVIEW_CLASSES;
  177. if (InitCommonControlsEx(&icex) == FALSE)
  178. MessageBoxW(NULL, L"ICEX failed.", NULL, MB_OK);
  179. dwResult = DialogBox(hInstance,
  180. MAKEINTRESOURCE(IsOS(OS_ANYSERVER) ? IDD_PFR_REPORTSRV : IDD_PFR_REPORT),
  181. hDlg,
  182. PFRDlgProc);
  183. break;
  184. }
  185. default:
  186. return(FALSE);
  187. } // switch
  188. return(TRUE);
  189. }
  190. BOOL
  191. AdvancedHandleNotify(
  192. IN HWND hDlg,
  193. IN WPARAM wParam,
  194. IN LPARAM lParam
  195. )
  196. /*++
  197. Routine Description:
  198. Handles WM_NOTIFY messages sent to Advanced tab
  199. Arguments:
  200. hDlg -
  201. Supplies window handle
  202. wParam -
  203. Supplies message parameter
  204. lParam -
  205. Supplies message parameter
  206. Return Value:
  207. TRUE if message was handled
  208. FALSE if message was unhandled
  209. --*/
  210. {
  211. LPNMHDR pnmh = (LPNMHDR) lParam;
  212. LPPSHNOTIFY psh = (LPPSHNOTIFY) lParam;
  213. switch (pnmh->code) {
  214. case PSN_APPLY:
  215. //
  216. // If the user is pressing "OK" and a reboot is required,
  217. // send the PSM_REBOOTSYSTEM message.
  218. //
  219. if ((psh->lParam) && g_fRebootRequired) {
  220. PropSheet_RebootSystem(GetParent(hDlg));
  221. } // if
  222. break;
  223. default:
  224. return(FALSE);
  225. } // switch
  226. return(TRUE);
  227. }