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.

174 lines
3.6 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: SecWiz.cxx
  9. //
  10. // Contents: Security Configuration wizard.
  11. //
  12. // History: 13-Sep-01 EricB created
  13. //
  14. //-----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #include "resource.h"
  17. #include "misc.h"
  18. #include "state.h"
  19. #include "WelcomePage.h"
  20. #include "SelectInputCfgPage.h"
  21. #include "finish.h"
  22. #include "ServerRoleSelPage.h"
  23. #include "otherpages.h"
  24. #include "ClientRoleSelPage.h"
  25. #include "AdditionalFuncPage.h"
  26. HINSTANCE hResourceModuleHandle = 0;
  27. const wchar_t* HELPFILE_NAME = 0; // no context help available
  28. const wchar_t* RUNTIME_NAME = L"SecWiz";
  29. DWORD DEFAULT_LOGGING_OPTIONS =
  30. Log::OUTPUT_TO_FILE
  31. | Log::OUTPUT_FUNCCALLS
  32. | Log::OUTPUT_LOGS
  33. | Log::OUTPUT_ERRORS
  34. | Log::OUTPUT_HEADER;
  35. // a system modal popup thingy
  36. Popup popup(IDS_WIZARD_TITLE, true);
  37. BOOL RegisterCheckListWndClass(HINSTANCE hInstance); //in chklist.cxx
  38. // these are the valid exit codes returned from the ssrwiz.exe process
  39. enum ExitCode
  40. {
  41. // the operation failed.
  42. EXIT_CODE_UNSUCCESSFUL = 0,
  43. // the operation succeeded
  44. EXIT_CODE_SUCCESSFUL = 1,
  45. };
  46. ExitCode
  47. RunWizard()
  48. {
  49. LOG_FUNCTION(RunWizard);
  50. // this is necessary to use the hotlink-style static text control.
  51. // //
  52. // // BOOL b = LinkWindow_RegisterClass();
  53. // // ASSERT(b);
  54. Wizard wiz(
  55. IDS_WIZARD_TITLE,
  56. IDB_BANNER16,
  57. IDB_BANNER256,
  58. IDB_WATERMARK16,
  59. IDB_WATERMARK256);
  60. // Welcome must be first
  61. wiz.AddPage(new WelcomePage());
  62. // These are not in any particular order...
  63. wiz.AddPage(new SelectInputCfgPage());
  64. wiz.AddPage(new FinishPage());
  65. wiz.AddPage(new SecurityLevelPage());
  66. wiz.AddPage(new PreProcessPage());
  67. wiz.AddPage(new ServerRoleSelPage());
  68. wiz.AddPage(new ClientRoleSelPage());
  69. wiz.AddPage(new AdditionalFuncPage());
  70. wiz.AddPage(new ServiceDisableMethodPage());
  71. ExitCode exitCode = EXIT_CODE_UNSUCCESSFUL;
  72. switch (wiz.ModalExecute(Win::GetDesktopWindow()))
  73. {
  74. case -1:
  75. {
  76. popup.Error(
  77. Win::GetDesktopWindow(),
  78. E_FAIL,
  79. IDS_PROP_SHEET_FAILED);
  80. break;
  81. }
  82. default:
  83. {
  84. // do nothing.
  85. break;
  86. }
  87. }
  88. return exitCode;
  89. }
  90. void
  91. ShowCommandLineHelp()
  92. {
  93. // CODEWORK: replace this with WinHelp, someday
  94. popup.MessageBox(Win::GetDesktopWindow(), IDS_COMMAND_LINE_HELP, MB_OK);
  95. }
  96. int WINAPI
  97. WinMain(
  98. HINSTANCE hInstance,
  99. HINSTANCE /* hPrevInstance */ ,
  100. PSTR /* lpszCmdLine */ ,
  101. int /* nCmdShow */)
  102. {
  103. hResourceModuleHandle = hInstance;
  104. ExitCode exitCode = EXIT_CODE_UNSUCCESSFUL;
  105. HRESULT hr = S_OK;
  106. RegisterCheckListWndClass(hInstance);
  107. {
  108. hr = ::CoInitialize(0);
  109. ASSERT(SUCCEEDED(hr));
  110. INITCOMMONCONTROLSEX icc;
  111. icc.dwSize = sizeof(icc);
  112. icc.dwICC = ICC_ANIMATE_CLASS | ICC_USEREX_CLASSES;
  113. BOOL init = ::InitCommonControlsEx(&icc);
  114. ASSERT(init);
  115. State::Init();
  116. if (State::GetInstance().NeedsCommandLineHelp())
  117. {
  118. ShowCommandLineHelp();
  119. }
  120. else
  121. {
  122. exitCode = RunWizard();
  123. }
  124. State::Destroy();
  125. }
  126. return static_cast<int>(exitCode);
  127. }