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.

220 lines
6.9 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusOCMApp.h
  7. //
  8. // Description:
  9. // ClusOCM.DLL is an Optional Components Manager DLL for installation of
  10. // Microsoft Cluster Server. This file contains the declaration of the
  11. // class ClusOCMApp, which is the main class of the ClusOCM DLL.
  12. //
  13. // Implementation Files:
  14. // CClusOCMApp.cpp
  15. // CClusOCMApp.inl
  16. //
  17. // Maintained By:
  18. // Vij Vasu (Vvasu) 03-MAR-2000
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. #pragma once
  22. //////////////////////////////////////////////////////////////////////////////
  23. // Include Files
  24. //////////////////////////////////////////////////////////////////////////////
  25. // Contains setup API function declarations
  26. #include <setupapi.h>
  27. // For OC Manager definitions, macros, etc.
  28. #include <ocmanage.h>
  29. // For the class CClusOCMTask
  30. #include "CClusOCMTask.h"
  31. // For the smart classes
  32. #include "SmartClasses.h"
  33. //////////////////////////////////////////////////////////////////////////////
  34. //++
  35. //
  36. // class CClusOCMApp
  37. //
  38. // Description:
  39. // This is the main class of the ClusOCM DLL. This class receives messages
  40. // from the OC Manager, takes high level decisions about the installation
  41. // and passes control appropriately to subobjects.
  42. //
  43. //--
  44. //////////////////////////////////////////////////////////////////////////////
  45. class CClusOCMApp
  46. {
  47. public:
  48. //////////////////////////////////////////////////////////////////////////
  49. // Constructors and Destructors
  50. //////////////////////////////////////////////////////////////////////////
  51. CClusOCMApp( void );
  52. ~CClusOCMApp( void );
  53. // Receives messages from the OC Manager and dispatches them.
  54. DWORD
  55. DwClusOcmSetupProc(
  56. IN LPCVOID pvComponentId
  57. , IN LPCVOID pvSubComponentId
  58. , IN UINT uiFunctionCode
  59. , IN UINT uiParam1
  60. , IN OUT PVOID pvParam2
  61. );
  62. //////////////////////////////////////////////////////////////////////////
  63. // Public Accessors
  64. //////////////////////////////////////////////////////////////////////////
  65. // Get the SETUP_INIT_COMPONENT passed in by OC Manager
  66. const SETUP_INIT_COMPONENT &
  67. RsicGetSetupInitComponent( void ) const { return m_sicSetupInitComponent; }
  68. //
  69. // Setup state functions
  70. //
  71. // Is this an unattended setup?
  72. bool
  73. FIsUnattendedSetup( void ) const { return m_fIsUnattendedSetup; }
  74. // Is this an upgrade?
  75. bool
  76. FIsUpgrade( void ) const { return m_fIsUpgrade; }
  77. // Is this GUI mode setup?
  78. bool
  79. FIsGUIModeSetup( void ) const { return m_fIsGUIModeSetup; }
  80. // Get the current installation state.
  81. eClusterInstallState
  82. CisGetClusterInstallState( void ) const { return m_cisCurrentInstallState; }
  83. // Get the error code of the first error that occurred
  84. DWORD
  85. DwGetError( void ) const
  86. {
  87. return m_dwFirstError;
  88. }
  89. // Report that an error occurred. If an error had already occurred, the new error code is not stored.
  90. DWORD
  91. DwSetError( DWORD dwError )
  92. {
  93. if ( m_dwFirstError == NO_ERROR )
  94. {
  95. m_dwFirstError = dwError;
  96. }
  97. return m_dwFirstError;
  98. }
  99. private:
  100. //////////////////////////////////////////////////////////////////////////
  101. // Forbidden methods
  102. //////////////////////////////////////////////////////////////////////////
  103. //
  104. // Copying an object of this class is not allowed.
  105. //
  106. // Private copy constructor.
  107. CClusOCMApp( const CClusOCMApp & );
  108. // Private assignment operator.
  109. const CClusOCMApp & operator =( const CClusOCMApp & );
  110. //////////////////////////////////////////////////////////////////////////
  111. // Private Utility Functions.
  112. //////////////////////////////////////////////////////////////////////////
  113. // Check if the cluster service exists as a registered service.
  114. DWORD
  115. DwIsClusterServiceRegistered( bool * pfIsRegisteredOut ) const;
  116. // Set the setup init component data and other setup state variables
  117. void
  118. SetSetupState( const SETUP_INIT_COMPONENT & sicSourceIn );
  119. // Store the current installation state.
  120. eClusterInstallState
  121. CisStoreClusterInstallState( eClusterInstallState cisNewStateIn );
  122. // Get a pointer to the current task object. Create it if necessary.
  123. DWORD
  124. DwGetCurrentTask( CClusOCMTask *& rpTaskOut );
  125. // Free the current task object.
  126. void
  127. ResetCurrentTask( void )
  128. {
  129. m_sptaskCurrentTask.Assign( NULL );
  130. }
  131. // Get the major version of the cluster service that we are upgrading.
  132. // This function call only be called during an upgrade.
  133. DWORD
  134. DwGetNodeClusterMajorVersion( DWORD & rdwNodeClusterMajorVersionOut );
  135. //////////////////////////////////////////////////////////////////////////
  136. // Private Message Handlers
  137. //////////////////////////////////////////////////////////////////////////
  138. // Handler for the OC_INIT_COMPONENT message.
  139. DWORD
  140. DwOcInitComponentHandler(
  141. PSETUP_INIT_COMPONENT pSetupInitComponentInout
  142. );
  143. // Handler for the OC_QUERY_STATE message.
  144. DWORD
  145. DwOcQueryStateHandler( UINT uiSelStateQueryTypeIn );
  146. //////////////////////////////////////////////////////////////////////////
  147. // Private Data
  148. //////////////////////////////////////////////////////////////////////////
  149. private:
  150. // Contains information about this setup session.
  151. SETUP_INIT_COMPONENT m_sicSetupInitComponent;
  152. // Setup state variables.
  153. bool m_fIsUnattendedSetup;
  154. bool m_fIsUpgrade;
  155. bool m_fIsGUIModeSetup;
  156. // The current installation state of the cluster service
  157. eClusterInstallState m_cisCurrentInstallState;
  158. // This variable stores the error code of the first error that occurred.
  159. DWORD m_dwFirstError;
  160. // A smart pointer holding a pointer to the current task being performed.
  161. CSmartGenericPtr< CPtrTrait< CClusOCMTask > > m_sptaskCurrentTask;
  162. // Indicates if the task object has been created or not.
  163. bool m_fAttemptedTaskCreation;
  164. }; //*** class CClusOCMApp
  165. //////////////////////////////////////////////////////////////////////////////
  166. // Inline Files
  167. //////////////////////////////////////////////////////////////////////////////
  168. #include "CClusOCMApp.inl"