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.

141 lines
2.3 KiB

  1. // Copyright (c) 2001 Microsoft Corporation
  2. //
  3. // forced demotion page
  4. // NTRAID#NTBUG9-496409-2001/11/29-sburns
  5. //
  6. // 29 Nov 2001 sburns
  7. #include "headers.hxx"
  8. #include "page.hpp"
  9. #include "ForcedDemotionPage.hpp"
  10. #include "resource.h"
  11. #include "state.hpp"
  12. ForcedDemotionPage::ForcedDemotionPage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_FORCE_DEMOTE,
  16. IDS_FORCE_DEMOTE_PAGE_TITLE,
  17. IDS_FORCE_DEMOTE_PAGE_SUBTITLE)
  18. {
  19. LOG_CTOR(ForcedDemotionPage);
  20. }
  21. ForcedDemotionPage::~ForcedDemotionPage()
  22. {
  23. LOG_DTOR(ForcedDemotionPage);
  24. }
  25. void
  26. ForcedDemotionPage::OnInit()
  27. {
  28. LOG_FUNCTION(ForcedDemotionPage::OnInit);
  29. }
  30. bool
  31. ForcedDemotionPage::OnNotify(
  32. HWND /* windowFrom */ ,
  33. UINT_PTR controlIDFrom,
  34. UINT code,
  35. LPARAM /* lParam */ )
  36. {
  37. // LOG_FUNCTION(ForcedDemotionPage::OnNotify);
  38. bool result = false;
  39. if (controlIDFrom == IDC_JUMP)
  40. {
  41. switch (code)
  42. {
  43. case NM_CLICK:
  44. case NM_RETURN:
  45. {
  46. LOG(L"launching metadata help");
  47. Win::HtmlHelp(
  48. hwnd,
  49. L"adconcepts.chm::/sag_delservermetadata.htm",
  50. HH_DISPLAY_TOPIC,
  51. 0);
  52. result = true;
  53. }
  54. default:
  55. {
  56. // do nothing
  57. break;
  58. }
  59. }
  60. }
  61. return result;
  62. }
  63. bool
  64. ForcedDemotionPage::OnSetActive()
  65. {
  66. LOG_FUNCTION(ForcedDemotionPage::OnSetActive);
  67. State& state = State::GetInstance();
  68. ASSERT(state.IsForcedDemotion());
  69. if (state.RunHiddenUnattended())
  70. {
  71. int nextPage = ForcedDemotionPage::Validate();
  72. if (nextPage != -1)
  73. {
  74. GetWizard().SetNextPageID(hwnd, nextPage);
  75. }
  76. else
  77. {
  78. state.ClearHiddenWhileUnattended();
  79. }
  80. }
  81. Win::PropSheet_SetWizButtons(
  82. Win::GetParent(hwnd),
  83. PSWIZB_BACK | PSWIZB_NEXT);
  84. return true;
  85. }
  86. int
  87. ForcedDemotionPage::Validate()
  88. {
  89. LOG_FUNCTION(ForcedDemotionPage::Validate);
  90. State& state = State::GetInstance();
  91. ASSERT(state.GetOperation() == State::DEMOTE);
  92. return IDD_ADMIN_PASSWORD;
  93. }