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.

411 lines
8.2 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Windows NT Secure Server Roles Security Configuration Wizard
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 2002
  7. //
  8. // File: OtherPages.cxx
  9. // Comments: This file inlcudes Secuirty Level page and Pre-Process page.
  10. //
  11. // History: 22-Oct-01 Yanggao created
  12. //
  13. //-----------------------------------------------------------------------------
  14. ///////////////////////////////////////////////////////////////////////////////
  15. //Security Level Page
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #include "pch.h"
  19. #include "resource.h"
  20. #include "misc.h"
  21. #include "state.h"
  22. #include "otherpages.h"
  23. #include "chklist.h"
  24. #include "ServiceSelPage.h"
  25. SecurityLevelPage::SecurityLevelPage()
  26. :
  27. SecCfgWizardPage(
  28. IDD_SECURITY_LEVEL,
  29. IDS_SECURITY_LEVEL_PAGE_TITLE,
  30. IDS_SECURITY_LEVEL_PAGE_SUBTITLE)
  31. {
  32. LOG_CTOR(SecurityLevelPage);
  33. }
  34. SecurityLevelPage::~SecurityLevelPage()
  35. {
  36. LOG_DTOR(SecurityLevelPage);
  37. }
  38. void
  39. SecurityLevelPage::OnInit()
  40. {
  41. LOG_FUNCTION(SecurityLevelPage::OnInit);
  42. }
  43. static
  44. void
  45. enable(HWND dialog)
  46. {
  47. ASSERT(Win::IsWindow(dialog));
  48. /*int next = PSWIZB_NEXT;
  49. if (Win::IsDlgButtonChecked(dialog, IDC_EDIT_CFG_RADIO))
  50. {
  51. next = !Win::GetTrimmedDlgItemText(dialog, IDC_EXISTING_CFG_EDIT).empty()
  52. ? PSWIZB_NEXT : 0;
  53. }
  54. Win::PropSheet_SetWizButtons(
  55. Win::GetParent(dialog),
  56. PSWIZB_BACK | next);*/
  57. }
  58. bool
  59. SecurityLevelPage::OnCommand(
  60. HWND /* windowFrom */ ,
  61. unsigned /* controlIDFrom */ ,
  62. unsigned /* code */ )
  63. {
  64. LOG_FUNCTION(SecurityLevelPage::OnCommand);
  65. // State& state = State::GetInstance();
  66. /*switch (controlIDFrom)
  67. {
  68. }*/
  69. return false;
  70. }
  71. bool
  72. SecurityLevelPage::OnSetActive()
  73. {
  74. LOG_FUNCTION(SecurityLevelPage::OnSetActive);
  75. enable(hwnd);
  76. //get default security level.
  77. Win::CheckDlgButton(hwnd, IDC_MAXIMUM_LEVEL, BST_CHECKED);
  78. return true;
  79. }
  80. int
  81. SecurityLevelPage::Validate()
  82. {
  83. LOG_FUNCTION(SecurityLevelPage::Validate);
  84. int nextPage = IDD_PRE_PROCESSING; //IDD_SERVER_ROLE_SEL;
  85. // State& state = State::GetInstance();
  86. // get security level result here.
  87. if( Win::IsDlgButtonChecked(hwnd, IDC_MAXIMUM_LEVEL)==BST_CHECKED )
  88. {
  89. ;//level is Maximum
  90. }
  91. else
  92. {
  93. ;//level is typical
  94. }
  95. return nextPage;
  96. }
  97. //////////////////////////////////////////////////////////////////////////////////
  98. // Pre-Process Page
  99. //
  100. //////////////////////////////////////////////////////////////////////////////////
  101. PreProcessPage::PreProcessPage()
  102. :
  103. SecCfgWizardPage(
  104. IDD_PRE_PROCESSING,
  105. IDS_PRE_PROCESSING_PAGE_TITLE,
  106. IDS_PRE_PROCESSING_PAGE_SUBTITLE)
  107. {
  108. LOG_CTOR(PreProcessPage);
  109. }
  110. PreProcessPage::~PreProcessPage()
  111. {
  112. LOG_DTOR(PreProcessPage);
  113. }
  114. void
  115. PreProcessPage::OnInit()
  116. {
  117. LOG_FUNCTION(PreProcessPage::OnInit);
  118. }
  119. bool
  120. PreProcessPage::OnCommand(
  121. HWND /* windowFrom */ ,
  122. unsigned /* controlIDFrom */ ,
  123. unsigned /* code */ )
  124. {
  125. LOG_FUNCTION(PreProcessPage::OnCommand);
  126. // Interact with engine to get real time process info and display it.
  127. /*switch (controlIDFrom)
  128. {
  129. }*/
  130. return false;
  131. }
  132. bool
  133. PreProcessPage::OnSetActive()
  134. {
  135. LOG_FUNCTION(PreProcessPage::OnSetActive);
  136. enable(hwnd);
  137. // Set the range and increment of the progress bar.
  138. HWND hwndPB = Win::GetDlgItem(hwnd, IDC_PROGRESS_PROCESS);
  139. Win::SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
  140. Win::SendMessage(hwndPB, PBM_SETSTEP, (WPARAM) 1, 0);
  141. //get pre-process info sample
  142. String strDes = String::format(IDS_DESCRIPTION_PROCESS, L"ssrmain.xml",L"Microsoft",L"10/20/2001",L"Maximum",L"DC.XML");
  143. Win::SetDlgItemText(hwnd, IDC_DES_PROCESS, strDes);
  144. int i;
  145. for(i=0; i<100; i++)
  146. {
  147. // Advance the current position of the progress bar
  148. // by the increment.
  149. Win::SendMessage(hwndPB, PBM_STEPIT, 0, 0);
  150. }
  151. return true;
  152. }
  153. int
  154. PreProcessPage::Validate()
  155. {
  156. LOG_FUNCTION(PreProcessPage::Validate);
  157. int nextPage = IDD_SERVER_ROLE_SEL;
  158. // State& state = State::GetInstance();
  159. // get security level result here.
  160. return nextPage;
  161. }
  162. //////////////////////////////////////////////////////////////////////////////////
  163. // Additional Roles Page
  164. //
  165. //////////////////////////////////////////////////////////////////////////////////
  166. AdditionalRolesPage::AdditionalRolesPage()
  167. :
  168. Dialog(IDD_ADDITIONAL_ROLE_SEL, 0) //no help map
  169. {
  170. LOG_CTOR(AdditionalRolesPage);
  171. }
  172. AdditionalRolesPage::~AdditionalRolesPage()
  173. {
  174. LOG_DTOR(AdditionalRolesPage);
  175. }
  176. void
  177. AdditionalRolesPage::OnInit()
  178. {
  179. LOG_FUNCTION(AdditionalRolesPage::OnInit);
  180. HWND hWnd = Win::GetDlgItem(hwnd, IDC_CHECKBOX);
  181. if (!hWnd) {
  182. return;
  183. }
  184. Win::SendMessage(hWnd, CLM_RESETCONTENT,0,0);
  185. }
  186. bool
  187. AdditionalRolesPage::OnCommand(
  188. HWND /*windowFrom*/,
  189. unsigned controlIDFrom,
  190. unsigned /*code*/)
  191. {
  192. LOG_FUNCTION(AdditionalRolesPage::OnCommand);
  193. // State& state = State::GetInstance();
  194. switch (controlIDFrom)
  195. {
  196. case IDOK:
  197. Win::EndDialog(hwnd, IDOK);
  198. return true;
  199. case IDCANCEL:
  200. Win::EndDialog(hwnd, IDCANCEL);
  201. return true;
  202. default:
  203. break;
  204. }
  205. return false;
  206. }
  207. bool
  208. AdditionalRolesPage::OnMessage(
  209. UINT message,
  210. WPARAM /*wparam*/,
  211. LPARAM /*lparam*/)
  212. {
  213. LOG_FUNCTION(AdditionalRolesPage::OnMessage);
  214. switch (message)
  215. {
  216. case WM_COMMAND:
  217. default:
  218. {
  219. // do nothing
  220. break;
  221. }
  222. }
  223. return false;
  224. }
  225. /////////////////////////////////////////////////////////////////////////////////
  226. //
  227. // ServiceDisable Method Page
  228. //
  229. //////////////////////////////////////////////////////////////////////////////////
  230. ServiceDisableMethodPage::ServiceDisableMethodPage()
  231. :
  232. SecCfgWizardPage(
  233. IDD_SERVICEDISABLE_METHOD,
  234. IDD_SERVICEDISABLE_METHOD_PAGE_TITLE,
  235. IDD_SERVICEDISABLE_METHOD_PAGE_SUBTITLE)
  236. {
  237. LOG_CTOR(ServiceDisableMethodPage);
  238. }
  239. ServiceDisableMethodPage::~ServiceDisableMethodPage()
  240. {
  241. LOG_DTOR(ServiceDisableMethodPage);
  242. }
  243. void
  244. ServiceDisableMethodPage::OnInit()
  245. {
  246. LOG_FUNCTION(ServiceDisableMethodPage::OnInit);
  247. }
  248. bool
  249. ServiceDisableMethodPage::OnCommand(
  250. HWND /*windowFrom*/,
  251. unsigned /*controlIDFrom*/,
  252. unsigned /*code*/)
  253. {
  254. LOG_FUNCTION(ServiceDisableMethodPage::OnCommand);
  255. // State& state = State::GetInstance();
  256. /*switch (controlIDFrom)
  257. {
  258. ;
  259. }*/
  260. return false;
  261. }
  262. bool
  263. ServiceDisableMethodPage::OnNotify(
  264. HWND /*windowFrom*/,
  265. UINT_PTR controlIDFrom,
  266. UINT code,
  267. LPARAM /*lParam*/)
  268. {
  269. switch (controlIDFrom)
  270. {
  271. case IDC_ENABLED_SERVICES:
  272. {
  273. if (code == NM_CLICK || code == NM_RETURN )
  274. {
  275. ServiceEnabledPage* pDlg = new ServiceEnabledPage();
  276. if( IDOK == pDlg->ModalExecute(hwnd) )
  277. {
  278. ;
  279. }
  280. return true;
  281. }
  282. break;
  283. }
  284. case IDC_DISABLED_SERVICES:
  285. {
  286. ;
  287. }
  288. }
  289. return false;
  290. }
  291. bool
  292. ServiceDisableMethodPage::OnSetActive()
  293. {
  294. LOG_FUNCTION(ServiceDisableMethodPage::OnSetActive);
  295. enable(hwnd);
  296. //get service disablement method.
  297. Win::CheckDlgButton(hwnd, IDC_IMPLICIT_METHOD, BST_CHECKED);
  298. return true;
  299. }
  300. int
  301. ServiceDisableMethodPage::Validate()
  302. {
  303. LOG_FUNCTION(ServiceDisableMethodPage::Validate);
  304. int nextPage = IDD_FINISH; //IDD_SERVER_ROLE_SEL;
  305. // State& state = State::GetInstance();
  306. // get security level result here.
  307. if( Win::IsDlgButtonChecked(hwnd, IDC_IMPLICIT_METHOD)==BST_CHECKED )
  308. {
  309. ;//Method is Implicit
  310. }
  311. else
  312. {
  313. ;//Method is Explicit
  314. }
  315. return nextPage;
  316. }