Source code of Windows XP (NT5)
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.

125 lines
2.9 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: WebInstallationUnit.cpp
  4. //
  5. // Synopsis: Defines a WebInstallationUnit
  6. // This object has the knowledge for installing the
  7. // IIS service
  8. //
  9. // History: 02/06/2001 JeffJon Created
  10. #include "pch.h"
  11. #include "resource.h"
  12. #include "WebInstallationUnit.h"
  13. // Finish page help
  14. static PCWSTR CYS_WEB_FINISH_PAGE_HELP = L"cys.chm::/cys_configuring_streaming_media_server.htm";
  15. WebInstallationUnit::WebInstallationUnit() :
  16. InstallationUnit(
  17. IDS_WEB_SERVER_TYPE,
  18. IDS_WEB_SERVER_DESCRIPTION,
  19. CYS_WEB_FINISH_PAGE_HELP,
  20. WEBSERVER_INSTALL)
  21. {
  22. LOG_CTOR(WebInstallationUnit);
  23. }
  24. WebInstallationUnit::~WebInstallationUnit()
  25. {
  26. LOG_DTOR(WebInstallationUnit);
  27. }
  28. InstallationReturnType
  29. WebInstallationUnit::InstallService(HANDLE logfileHandle, HWND /*hwnd*/)
  30. {
  31. LOG_FUNCTION(WebInstallationUnit::InstallService);
  32. InstallationReturnType result = INSTALL_SUCCESS;
  33. // Log heading
  34. CYS_APPEND_LOG(String::load(IDS_LOG_WEB_HEADING));
  35. String unattendFileText;
  36. String infFileText;
  37. unattendFileText += L"[Components]\n";
  38. unattendFileText += L"iis_common=ON\n";
  39. unattendFileText += L"iis_inetmgr=ON\n";
  40. unattendFileText += L"iis_www=ON\n";
  41. unattendFileText += L"iis_doc=ON\n";
  42. unattendFileText += L"iis_htmla=ON\n";
  43. unattendFileText += L"iis_www_vdir_msadc=ON\n";
  44. unattendFileText += L"iis_www_vdir_scripts=ON\n";
  45. unattendFileText += L"iis_www_vdir_printers=ON\n";
  46. unattendFileText += L"iis_smtp=ON\n";
  47. unattendFileText += L"iis_smtp_docs=ON\n";
  48. unattendFileText += L"fp_extensions=ON\n";
  49. bool ocmResult = InstallServiceWithOcManager(infFileText, unattendFileText);
  50. if (ocmResult &&
  51. IsServiceInstalled())
  52. {
  53. LOG(L"IIS was installed successfully");
  54. CYS_APPEND_LOG(String::load(IDS_LOG_INSTALL_IIS_SUCCESS));
  55. }
  56. else
  57. {
  58. LOG(L"IIS was failed to install");
  59. CYS_APPEND_LOG(String::load(IDS_LOG_INSTALL_IIS_FAILED));
  60. result = INSTALL_FAILURE;
  61. }
  62. LOG_INSTALL_RETURN(result);
  63. return result;
  64. }
  65. bool
  66. WebInstallationUnit::IsServiceInstalled()
  67. {
  68. LOG_FUNCTION(WebInstallationUnit::IsServiceInstalled);
  69. bool result = IsServiceInstalledHelper(CYS_WEB_SERVICE_NAME);
  70. LOG_BOOL(result);
  71. return result;
  72. }
  73. bool
  74. WebInstallationUnit::GetFinishText(String& message)
  75. {
  76. LOG_FUNCTION(WebInstallationUnit::GetFinishText);
  77. message = String::load(IDS_WEB_FINISH_TEXT);
  78. LOG_BOOL(true);
  79. return true;
  80. }
  81. String
  82. WebInstallationUnit::GetServiceDescription()
  83. {
  84. LOG_FUNCTION(WebInstallationUnit::GetServiceDescription);
  85. unsigned int resourceID = static_cast<unsigned int>(-1);
  86. if (IsServiceInstalled())
  87. {
  88. resourceID = IDS_WEB_DESCRIPTION_INSTALLED;
  89. }
  90. else
  91. {
  92. resourceID = descriptionID;
  93. }
  94. ASSERT(resourceID != static_cast<unsigned int>(-1));
  95. return String::load(resourceID);
  96. }