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.

185 lines
4.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: AdditionalFuncPage.cxx
  9. //
  10. // History: 29-Oct-01 Yanggao created
  11. //
  12. //-----------------------------------------------------------------------------
  13. #include "pch.h"
  14. #include "resource.h"
  15. #include "misc.h"
  16. #include "state.h"
  17. #include "chklist.h"
  18. #include "AdditionalFuncPage.h"
  19. ////////////////////////////////////////////////////////////////////////////////
  20. //
  21. //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. AdditionalFuncPage::AdditionalFuncPage()
  24. :
  25. SecCfgWizardPage(
  26. IDD_ADDITIONAL_FUNC_SEL,
  27. IDS_ADDITIONAL_FUNC_SEL_PAGE_TITLE,
  28. IDS_ADDITIONAL_FUNC_SEL_PAGE_SUBTITLE)
  29. {
  30. LOG_CTOR(AdditionalFuncPage);
  31. }
  32. ////////////////////////////////////////////////////////////////////////////////
  33. //
  34. //
  35. ////////////////////////////////////////////////////////////////////////////////
  36. AdditionalFuncPage::~AdditionalFuncPage()
  37. {
  38. LOG_DTOR(AdditionalFuncPage);
  39. }
  40. void
  41. AdditionalFuncPage::OnInit()
  42. {
  43. LOG_FUNCTION(AdditionalFuncPage::OnInit);
  44. }
  45. static
  46. void
  47. enable(HWND dialog)
  48. {
  49. ASSERT(Win::IsWindow(dialog));
  50. /*int next = PSWIZB_NEXT;
  51. if (Win::IsDlgButtonChecked(dialog, IDC_EDIT_CFG_RADIO))
  52. {
  53. next = !Win::GetTrimmedDlgItemText(dialog, IDC_EXISTING_CFG_EDIT).empty()
  54. ? PSWIZB_NEXT : 0;
  55. }
  56. Win::PropSheet_SetWizButtons(
  57. Win::GetParent(dialog),
  58. PSWIZB_BACK | next);*/
  59. }
  60. bool
  61. AdditionalFuncPage::OnCommand(
  62. HWND /* windowFrom */ ,
  63. unsigned /* controlIDFrom */ ,
  64. unsigned /* code */ )
  65. {
  66. LOG_FUNCTION(AdditionalFuncPage::OnCommand);
  67. // State& state = State::GetInstance();
  68. /*switch (controlIDFrom)
  69. {
  70. }*/
  71. return false;
  72. }
  73. bool
  74. AdditionalFuncPage::OnSetActive()
  75. {
  76. LOG_FUNCTION(AdditionalFuncPage::OnSetActive);
  77. enable(hwnd);
  78. HWND hWnd = Win::GetDlgItem(hwnd, IDC_CHECKBOX);
  79. if (!hWnd) {
  80. return FALSE;
  81. }
  82. Win::SendMessage(hWnd, CLM_RESETCONTENT,0,0);
  83. State& state = State::GetInstance();
  84. //Add Roles
  85. HRESULT hr = S_OK;
  86. RoleObject * pRole;
  87. for (long i = 0; i < state.GetNumRoles(); i++)
  88. {
  89. pRole = NULL;
  90. //Get Question services from Main.XML
  91. //if it is a client role
  92. if (FAILED(hr) || !pRole)
  93. {
  94. return true;
  95. }
  96. int nIndex = (int) Win::SendMessage(hWnd,
  97. CLM_ADDITEM,
  98. (WPARAM)pRole->getDisplayName(),
  99. (LPARAM)0);
  100. if (nIndex != -1)
  101. {
  102. BOOL bSet;
  103. //First column setting
  104. bSet = CLST_CHECKED;
  105. Win::SendMessage(hWnd,
  106. CLM_SETSTATE,
  107. MAKELONG(nIndex,1),
  108. bSet ? CLST_CHECKED : CLST_UNCHECKED);
  109. // Second column setting if there is
  110. //bSet = CLST_UNCHECKED;
  111. //Win::SendMessage(hWnd,
  112. // CLM_SETSTATE,
  113. // MAKELONG(nIndex,2),
  114. // CLST_DISABLED | (bSet ? CLST_CHECKED : CLST_UNCHECKED));
  115. }
  116. // role objects should be saved as item data rather than being deleted here:
  117. delete pRole;
  118. }
  119. return true;
  120. }
  121. int
  122. AdditionalFuncPage::Validate()
  123. {
  124. LOG_FUNCTION(AdditionalFuncPage::Validate);
  125. int nextPage = IDD_SERVICEDISABLE_METHOD;
  126. // State& state = State::GetInstance();
  127. // HRESULT hr = S_OK;
  128. DWORD dw = 0;
  129. HWND hWnd = Win::GetDlgItem(hwnd, IDC_CHECKBOX);
  130. if (!hWnd) {
  131. ;//error
  132. }
  133. else
  134. {
  135. int nItems = (int) Win::SendMessage(hWnd,CLM_GETITEMCOUNT,0,0);
  136. for (int i=0;i<nItems;i++)
  137. {
  138. dw = (DWORD)Win::SendMessage(hWnd,CLM_GETSTATE,MAKELONG(i,1),0);
  139. if (CLST_CHECKED == dw)
  140. {
  141. ;//selected
  142. }
  143. }
  144. }
  145. return nextPage;
  146. }