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.

129 lines
2.6 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: RRASInstallationUnit.cpp
  4. //
  5. // Synopsis: Defines a RRASInstallationUnit
  6. // This object has the knowledge for installing the
  7. // RRAS service
  8. //
  9. // History: 02/06/2001 JeffJon Created
  10. #include "pch.h"
  11. #include "resource.h"
  12. #include "RRASInstallationUnit.h"
  13. RRASInstallationUnit::RRASInstallationUnit() :
  14. NetworkServiceInstallationBase(
  15. IDS_RRAS_SERVER_TYPE,
  16. IDS_RRAS_SERVER_DESCRIPTION2,
  17. IDS_RRAS_SERVER_DESCRIPTION_INSTALLED,
  18. RRAS_INSTALL)
  19. {
  20. LOG_CTOR(RRASInstallationUnit);
  21. }
  22. RRASInstallationUnit::~RRASInstallationUnit()
  23. {
  24. LOG_DTOR(RRASInstallationUnit);
  25. }
  26. InstallationReturnType
  27. RRASInstallationUnit::InstallService(HANDLE logfileHandle, HWND /*hwnd*/)
  28. {
  29. LOG_FUNCTION(RRASInstallationUnit::InstallService);
  30. InstallationReturnType result = INSTALL_SUCCESS;
  31. // Run the RRAS Wizard
  32. do
  33. {
  34. String resultText;
  35. if (!ExecuteWizard(CYS_RRAS_SERVICE_NAME, resultText))
  36. {
  37. if (!resultText.empty())
  38. {
  39. CYS_APPEND_LOG(resultText);
  40. }
  41. result = INSTALL_FAILURE;
  42. break;
  43. }
  44. if (IsServiceInstalled())
  45. {
  46. // The Configure DNS Server Wizard completed successfully
  47. LOG(L"RRAS server wizard completed successfully");
  48. CYS_APPEND_LOG(String::load(IDS_LOG_RRAS_COMPLETED_SUCCESSFULLY));
  49. }
  50. else
  51. {
  52. // The Configure DHCP Server Wizard did not finish successfully
  53. LOG(L"The RRAS wizard failed to run");
  54. CYS_APPEND_LOG(String::load(IDS_LOG_RRAS_WIZARD_ERROR));
  55. result = INSTALL_FAILURE;
  56. }
  57. } while (false);
  58. LOG_INSTALL_RETURN(result);
  59. return result;
  60. }
  61. bool
  62. RRASInstallationUnit::IsServiceInstalled()
  63. {
  64. LOG_FUNCTION(RRASInstallationUnit::IsServiceInstalled);
  65. // The service is always installed so we really just
  66. // need to check to see if it is configured
  67. bool result = IsConfigured();
  68. LOG_BOOL(result);
  69. return result;
  70. }
  71. bool
  72. RRASInstallationUnit::IsConfigured()
  73. {
  74. LOG_FUNCTION(RRASInstallationUnit::IsConfigured);
  75. DWORD resultValue = 0;
  76. bool result = GetRegKeyValue(
  77. CYS_RRAS_CONFIGURED_REGKEY,
  78. CYS_RRAS_CONFIGURED_VALUE,
  79. resultValue);
  80. if (result)
  81. {
  82. result = (resultValue != 0);
  83. }
  84. LOG_BOOL(result);
  85. return result;
  86. }
  87. bool
  88. RRASInstallationUnit::GetFinishText(String& message)
  89. {
  90. LOG_FUNCTION(RRASInstallationUnit::GetFinishText);
  91. message = String::load(IDS_RRAS_FINISH_TEXT);
  92. LOG_BOOL(true);
  93. return true;
  94. }