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.

300 lines
17 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // Dll.cpp
  7. //
  8. // Description:
  9. // DLL services/entry points.
  10. //
  11. // Maintained By:
  12. // David Potter (DavidP) 19-MAR-2001
  13. // Geoffrey Pease (GPease) 09-FEB-2000
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. #include "Pch.h"
  17. #include "Register.h"
  18. #include "DllResourceIDs.h"
  19. #include <PropList.h>
  20. #include <EncryptedBSTR.h>
  21. #include <DispatchHandler.h>
  22. //
  23. // Add object headers here
  24. //
  25. // Common
  26. #include "..\Common\CClusCfgCredentials.h"
  27. // Server
  28. #include "..\Server\CClusCfgServer.h"
  29. #include "..\Server\CClusCfgNodeInfo.h"
  30. #include "..\Server\CClusCfgClusterInfo.h"
  31. #include "..\Server\CClusCfgCallback.h"
  32. #include "..\Server\CEnumClusCfgManagedResources.h"
  33. #include "..\Server\CPhysicalDisk.h"
  34. #include "..\Server\CEnumPhysicalDisks.h"
  35. #include "..\Server\CEnumClusterResources.h"
  36. #include "..\Server\CClusterResource.h"
  37. #include "..\Server\CEnumClusCfgNetworks.h"
  38. #include "..\Server\CEnumClusCfgIPAddresses.h"
  39. #include "..\Server\CClusCfgNetworkInfo.h"
  40. #include "..\Server\CClusCfgIPAddressInfo.h"
  41. #include "..\Server\CClusCfgCapabilities.h"
  42. #include "..\Server\CLocalQuorum.h"
  43. #include "..\Server\CEnumLocalQuorum.h"
  44. #include "..\Server\CMajorityNodeSet.h"
  45. #include "..\Server\CEnumMajorityNodeSet.h"
  46. #include "..\Server\CUnknownQuorum.h"
  47. #include "..\Server\ServerStrings.h"
  48. // Middle Tier
  49. #include "..\MiddleTier\TaskManager.h"
  50. #include "..\MiddleTier\ConnectionManager.h"
  51. #include "..\MiddleTier\ObjectManager.h"
  52. #include "..\MiddleTier\NotificationManager.h"
  53. #include "..\MiddleTier\ServiceManager.h"
  54. #include "..\MiddleTier\LogManager.h"
  55. #include "..\MiddleTier\ClusterConfiguration.h"
  56. #include "..\MiddleTier\ManagedResource.h"
  57. #include "..\MiddleTier\ManagedNetwork.h"
  58. #include "..\MiddleTier\NodeInformation.h"
  59. #include "..\MiddleTier\TaskGatherNodeInfo.h"
  60. #include "..\MiddleTier\ConfigConnection.h"
  61. #include "..\MiddleTier\TaskAnalyzeCluster.h"
  62. #include "..\MiddleTier\TaskAnalyzeClusterMinConfig.h"
  63. #include "..\MiddleTier\TaskCommitClusterChanges.h"
  64. #include "..\MiddleTier\EnumNodeInformation.h"
  65. #include "..\MiddleTier\TaskGatherInformation.h"
  66. #include "..\MiddleTier\TaskCompareAndPushInformation.h"
  67. #include "..\MiddleTier\EnumManageableResources.h"
  68. #include "..\MiddleTier\EnumManageableNetworks.h"
  69. #include "..\MiddleTier\TaskGatherClusterInfo.h"
  70. #include "..\MiddleTier\EnumCookies.h"
  71. #include "..\MiddleTier\TaskPollingCallback.h"
  72. #include "..\MiddleTier\TaskCancelCleanup.h"
  73. #include "..\MiddleTier\TaskVerifyIPAddress.h"
  74. #include "..\MiddleTier\IPAddressInfo.h"
  75. #include "..\MiddleTier\EnumIPAddresses.h"
  76. // W2kProxy
  77. #include "..\W2kProxy\ConfigClusApi.h"
  78. // Wizard
  79. #include "..\Wizard\ClusCfg.h"
  80. #include "..\Wizard\AddNodesWizard.h"
  81. #include "..\Wizard\CreateClusterWizard.h"
  82. #include "..\MiddleTier\TaskGetDomains.h"
  83. // BaseCluster
  84. #include "..\BaseCluster\CBCAInterface.h"
  85. // Post Config
  86. #include "..\PostCfg\GroupHandle.h"
  87. #include "..\PostCfg\ResourceEntry.h"
  88. #include "..\PostCfg\IPostCfgManager.h"
  89. #include "..\PostCfg\IPrivatePostCfgResource.h"
  90. #include "..\PostCfg\PostCfgMgr.h"
  91. #include "..\PostCfg\ResTypeGenScript.h"
  92. #include "..\PostCfg\ResTypeMajorityNodeSet.h"
  93. #include "..\PostCfg\ResTypeServices.h"
  94. // EvictCleanup
  95. #include "..\EvictCleanup\EvictCleanup.h"
  96. #include "..\EvictCleanup\AsyncEvictCleanup.h"
  97. // Startup Notify
  98. #include "..\Startup\StartupNotify.h"
  99. // Evict Notify
  100. #include "..\EvictNotify\EvictNotify.h"
  101. // IISClusCfg
  102. #include "..\..\IISClusCfg\IISClusCfg.h"
  103. //
  104. // Define the debugging module name for this DLL.
  105. //
  106. DEFINE_MODULE( "ClusConfig" )
  107. BEGIN_APPIDS
  108. DEFINE_APPID( L"Cluster Configuration Server", APPID_ClusCfgServer, IDS_GENERIC_LAUNCH_PERMISSIONS, IDS_GENERIC_ACCESS_PERMISSIONS, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, airaiLaunchingUser )
  109. DEFINE_APPID( L"Cluster Node Eviction Processor", APPID_ClusCfgEvictCleanup, IDS_GENERIC_LAUNCH_PERMISSIONS, IDS_GENERIC_ACCESS_PERMISSIONS, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, airaiLaunchingUser )
  110. DEFINE_APPID( L"Cluster Node Eviction Asynchronous Processor", APPID_ClusCfgAsyncEvictCleanup, IDS_GENERIC_LAUNCH_PERMISSIONS, IDS_GENERIC_ACCESS_PERMISSIONS, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, airaiLaunchingUser )
  111. DEFINE_APPID( L"Cluster Service Startup Notifications", APPID_ClusCfgStartupNotify, IDS_GENERIC_LAUNCH_PERMISSIONS, IDS_GENERIC_ACCESS_PERMISSIONS, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, airaiLaunchingUser )
  112. DEFINE_APPID( L"Cluster Service Node Evict Notifications", APPID_ClusCfgEvictNotify, IDS_GENERIC_LAUNCH_PERMISSIONS, IDS_GENERIC_ACCESS_PERMISSIONS, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, airaiLaunchingUser )
  113. END_APPIDS
  114. //
  115. // Classes in this Component
  116. //
  117. // This table is used to create the objects supported in this DLL. It also is
  118. // used to map a name with a particular CLSID. HrCoCreateInternalInstance() uses
  119. // this table to shortcut COM.
  120. //
  121. BEGIN_DLL_PUBLIC_CLASSES
  122. CLASS_WITH_APPID( L"ClusCfg Server", CLSID_ClusCfgServer, CClusCfgServer::S_HrCreateInstance, ctmApartment, APPID_ClusCfgServer )
  123. CLASS_WITH_APPID( L"ClusCfg Evict Cleanup Processing", CLSID_ClusCfgEvictCleanup, CEvictCleanup::S_HrCreateInstance, ctmFree, APPID_ClusCfgEvictCleanup )
  124. CLASS_WITH_APPID( L"ClusCfg Asynchronous Evict Cleanup Processing", CLSID_ClusCfgAsyncEvictCleanup, CAsyncEvictCleanup::S_HrCreateInstance, ctmApartment, APPID_ClusCfgAsyncEvictCleanup )
  125. CLASS_WITH_APPID( L"ClusCfg Cluster Startup Notification", CLSID_ClusCfgStartupNotify, CStartupNotify::S_HrCreateInstance, ctmFree, APPID_ClusCfgStartupNotify )
  126. CLASS_WITH_APPID( L"ClusCfg Cluster Node Eviction Notification", CLSID_ClusCfgEvictNotify, CEvictNotify::S_HrCreateInstance, ctmFree, APPID_ClusCfgEvictNotify )
  127. CLASS_WITH_CATID( L"ClusCfg Physical Disk Enumeration", CLSID_EnumPhysicalDisks, CEnumPhysicalDisks::S_HrCreateInstance, ctmApartment, CEnumPhysicalDisks::S_RegisterCatIDSupport )
  128. CLASS_WITH_CATID( L"ClusCfg Generic Script Resource Type Configuration", CLSID_ClusCfgResTypeGenScript, CResTypeGenScript::S_HrCreateInstance, ctmApartment, CResTypeGenScript::S_RegisterCatIDSupport )
  129. CLASS_WITH_CATID( L"ClusCfg Majority Node Set Resource Type Configuration", CLSID_ClusCfgResTypeMajorityNodeSet, CResTypeMajorityNodeSet::S_HrCreateInstance, ctmApartment, CResTypeMajorityNodeSet::S_RegisterCatIDSupport )
  130. CLASS_WITH_CATID( L"ClusCfg Cluster Capabilities", CLSID_ClusCfgCapabilities, CClusCfgCapabilities::S_HrCreateInstance, ctmApartment, CClusCfgCapabilities::S_RegisterCatIDSupport )
  131. CLASS_WITH_CATID( L"ClusCfg Local Quorum Enumeration", CLSID_EnumLocalQuorum, CEnumLocalQuorum::S_HrCreateInstance, ctmApartment, CEnumLocalQuorum::S_RegisterCatIDSupport )
  132. CLASS_WITH_CATID( L"ClusCfg Majority Node Set Enumeration", CLSID_EnumMajorityNodeSet, CEnumMajorityNodeSet::S_HrCreateInstance, ctmApartment, CEnumMajorityNodeSet::S_RegisterCatIDSupport )
  133. CLASS_WITH_CATID( L"ClusCfg IIS Resource Types Cleanup", CLSID_IISClusCfg, CIISClusCfg::S_HrCreateInstance, ctmApartment, CIISClusCfg::S_HrRegisterCatIDSupport )
  134. CLASS_WITH_PROGID( L"ClusCfg Create Cluster Wizard", CLSID_ClusCfgCreateClusterWizard, CCreateClusterWizard::S_HrCreateInstance, ctmApartment, L"Microsoft.Clustering.CreateClusterWizard.1" )
  135. CLASS_WITH_PROGID( L"ClusCfg Add Nodes to Cluster Wizard", CLSID_ClusCfgAddNodesWizard, CAddNodesWizard::S_HrCreateInstance, ctmApartment, L"Microsoft.Clustering.ClusterAddNodesWizard.1" )
  136. PUBLIC_CLASS( L"ClusCfg Service Manager", CLSID_ServiceManager, CServiceManager::S_HrCreateInstance, ctmFree )
  137. PUBLIC_CLASS( L"ClusCfg Resource Type Services", CLSID_ClusCfgResTypeServices, CResTypeServices::S_HrCreateInstance, ctmFree )
  138. END_DLL_PUBLIC_CLASSES
  139. BEGIN_PRIVATE_CLASSES
  140. PRIVATE_CLASS( L"ClusCfg Node Information", CLSID_ClusCfgNodeInfo, CClusCfgNodeInfo::S_HrCreateInstance )
  141. PRIVATE_CLASS( L"ClusCfg Cluster Information", CLSID_ClusCfgClusterInfo, CClusCfgClusterInfo::S_HrCreateInstance )
  142. PRIVATE_CLASS( L"ClusCfg Managed Resources Enumeration", CLSID_EnumClusCfgManagedResources, CEnumClusCfgManagedResources::S_HrCreateInstance )
  143. PRIVATE_CLASS( L"ClusCfg Physical Disk Information", CLSID_PhysicalDisk, CPhysicalDisk::S_HrCreateInstance )
  144. PRIVATE_CLASS( L"ClusCfg Networks Enumeration", CLSID_EnumClusCfgNetworks, CEnumClusCfgNetworks::S_HrCreateInstance )
  145. PRIVATE_CLASS( L"ClusCfg Network Information", CLSID_ClusCfgNetworkInfo, CClusCfgNetworkInfo::S_HrCreateInstance )
  146. PRIVATE_CLASS( L"ClusCfg IP Address Enumeration", CLSID_EnumClusCfgIPAddresses, CEnumClusCfgIPAddresses::S_HrCreateInstance )
  147. PRIVATE_CLASS( L"ClusCfg IP Address Information", CLSID_ClusCfgIPAddressInfo, CClusCfgIPAddressInfo::S_HrCreateInstance )
  148. PRIVATE_CLASS( L"ClusCfg Task Manager", CLSID_TaskManager, CTaskManager::S_HrCreateInstance )
  149. PRIVATE_CLASS( L"ClusCfg Connection Manager", CLSID_ClusterConnectionManager, CConnectionManager::S_HrCreateInstance )
  150. PRIVATE_CLASS( L"ClusCfg Object Manager", CLSID_ObjectManager, CObjectManager::S_HrCreateInstance )
  151. PRIVATE_CLASS( L"ClusCfg Log Manager", CLSID_LogManager, CLogManager::S_HrCreateInstance )
  152. PRIVATE_CLASS( L"ClusCfg Notification Manager", CLSID_NotificationManager, CNotificationManager::S_HrCreateInstance )
  153. PRIVATE_CLASS( L"ClusCfg Node Information Data Format", DFGUID_NodeInformation, CNodeInformation::S_HrCreateInstance )
  154. PRIVATE_CLASS( L"ClusCfg Task Gather Node Information", TASK_GatherNodeInfo, CTaskGatherNodeInfo::S_HrCreateInstance )
  155. PRIVATE_CLASS( L"ClusCfg Configuration Connection", CLSID_ConfigurationConnection, CConfigurationConnection::S_HrCreateInstance )
  156. PRIVATE_CLASS( L"ClusCfg Task Analyze Cluster", TASK_AnalyzeCluster, CTaskAnalyzeCluster::S_HrCreateInstance )
  157. PRIVATE_CLASS( L"ClusCfg Task Analyze Cluster Minimal Config", TASK_AnalyzeClusterMinConfig, CTaskAnalyzeClusterMinConfig::S_HrCreateInstance )
  158. PRIVATE_CLASS( L"ClusCfg Task Commit Cluster Changes", TASK_CommitClusterChanges, CTaskCommitClusterChanges::S_HrCreateInstance )
  159. PRIVATE_CLASS( L"ClusCfg Enum Node Information Format", DFGUID_EnumNodes, CEnumNodeInformation::S_HrCreateInstance )
  160. PRIVATE_CLASS( L"ClusCfg Task Gather Information", TASK_GatherInformation, CTaskGatherInformation::S_HrCreateInstance )
  161. PRIVATE_CLASS( L"ClusCfg Managed Resource Data Format", DFGUID_ManagedResource, CManagedResource::S_HrCreateInstance )
  162. PRIVATE_CLASS( L"ClusCfg Managed Network Data Format", DFGUID_NetworkResource, CManagedNetwork::S_HrCreateInstance )
  163. PRIVATE_CLASS( L"ClusCfg Task Compare and Push Information", TASK_CompareAndPushInformation, CTaskCompareAndPushInformation::S_HrCreateInstance )
  164. PRIVATE_CLASS( L"ClusCfg Enum Manageable Resources Data Format",DFGUID_EnumManageableResources, CEnumManageableResources::S_HrCreateInstance )
  165. PRIVATE_CLASS( L"ClusCfg Enum Manageable Networks Data Format", DFGUID_EnumManageableNetworks, CEnumManageableNetworks::S_HrCreateInstance )
  166. PRIVATE_CLASS( L"ClusCfg Task Get Domains", TASK_GetDomains, CTaskGetDomains::S_HrCreateInstance )
  167. PRIVATE_CLASS( L"ClusCfg Task Polling Callback", TASK_PollingCallback, CTaskPollingCallback::S_HrCreateInstance )
  168. PRIVATE_CLASS( L"ClusCfg Base Cluster", CLSID_ClusCfgBaseCluster, CBCAInterface::S_HrCreateInstance )
  169. PRIVATE_CLASS( L"ClusCfg Cluster Configuration Data Format", DFGUID_ClusterConfigurationInfo, CClusterConfiguration::S_HrCreateInstance )
  170. PRIVATE_CLASS( L"ClusCfg Task Gather Cluster Info", TASK_GatherClusterInfo, CTaskGatherClusterInfo::S_HrCreateInstance )
  171. PRIVATE_CLASS( L"ClusCfg Enum Cookies", DFGUID_EnumCookies, CEnumCookies::S_HrCreateInstance )
  172. PRIVATE_CLASS( L"ClusCfg Credentials", CLSID_ClusCfgCredentials, CClusCfgCredentials::S_HrCreateInstance )
  173. PRIVATE_CLASS( L"ClusCfg Post Configuration Manager", CLSID_ClusCfgPostConfigManager, CPostCfgManager::S_HrCreateInstance )
  174. PRIVATE_CLASS( L"ClusCfg Task Verify IP Address", TASK_VerifyIPAddress, CTaskVerifyIPAddress::S_HrCreateInstance )
  175. PRIVATE_CLASS( L"ClusCfg Configure Cluster API Proxy Server", CLSID_ConfigClusApi, CConfigClusApi::S_HrCreateInstance )
  176. PRIVATE_CLASS( L"ClusCfg Task Cancel Cleanup", TASK_CancelCleanup, CTaskCancelCleanup::S_HrCreateInstance )
  177. PRIVATE_CLASS( L"ClusCfg IP Address Info Data Format", DFGUID_IPAddressInfo, CIPAddressInfo::S_HrCreateInstance )
  178. PRIVATE_CLASS( L"ClusCfg Enum IP Address Info Data Format", DFGUID_EnumIPAddressInfo, CEnumIPAddresses::S_HrCreateInstance )
  179. PRIVATE_CLASS( L"ClusCfg Local Quorum Information", CLSID_LocalQuorum, CLocalQuorum::S_HrCreateInstance )
  180. PRIVATE_CLASS( L"ClusCfg Majority Node Set Information", CLSID_MajorityNodeSet, CMajorityNodeSet::S_HrCreateInstance )
  181. PRIVATE_CLASS( L"ClusCfg Unknown Quorum", CLSID_UnknownQuorum, CUnknownQuorum::S_HrCreateInstance )
  182. END_PRIVATE_CLASSES
  183. //
  184. // Category IDs in this Component
  185. //
  186. // This table is used to register the Category IDs (CATIDs) used by this DLL.
  187. //
  188. BEGIN_CATIDTABLE
  189. DEFINE_CATID( CATID_ClusCfgCapabilities, L"Cluster Configuration Cluster Capabilities" )
  190. DEFINE_CATID( CATID_EnumClusCfgManagedResources, L"Cluster Configuration Managed Resource Enumerators" )
  191. DEFINE_CATID( CATID_ClusCfgResourceTypes, L"Cluster Configuration Resource Types" )
  192. DEFINE_CATID( CATID_ClusCfgMemberSetChangeListeners, L"Cluster Configuration Member Set Change Listeners" )
  193. DEFINE_CATID( CATID_ClusCfgStartupListeners, L"Cluster Configuration Service Startup Listeners" )
  194. DEFINE_CATID( CATID_ClusCfgEvictListeners, L"Cluster Configuration Node Eviction Listeners" )
  195. END_CATIDTABLE
  196. BEGIN_TYPELIBS
  197. DEFINE_TYPELIB( IDR_WIZARD_TYPELIB )
  198. DEFINE_TYPELIB( IDR_CLIENT_TYPELIB )
  199. END_TYPELIBS
  200. //
  201. // RPC Proxy/Stub entry points
  202. //
  203. extern "C" {
  204. HRESULT
  205. STDAPICALLTYPE
  206. ProxyStubDllGetClassObject(
  207. REFCLSID rclsid,
  208. REFIID riid,
  209. void ** ppv
  210. );
  211. HRESULT
  212. STDAPICALLTYPE
  213. ProxyStubDllCanUnloadNow( void );
  214. HRESULT
  215. STDAPICALLTYPE
  216. ProxyStubDllRegisterServer( void );
  217. HRESULT
  218. STDAPICALLTYPE
  219. ProxyStubDllUnregisterServer( void );
  220. } // extern "C"
  221. #define DO_MODULE_INIT
  222. HRESULT
  223. HrLocalProcessInit( void )
  224. {
  225. TraceFunc( "" );
  226. HRESULT hr = S_OK;
  227. hr = THR( CServiceManager::S_HrProcessInitialize() );
  228. if ( FAILED( hr ) )
  229. {
  230. goto Cleanup;
  231. } // if:
  232. Cleanup:
  233. HRETURN( hr );
  234. } //*** HrLocalProcessInit
  235. #define DO_MODULE_UNINIT
  236. HRESULT
  237. HrLocalProcessUninit( void )
  238. {
  239. TraceFunc( "" );
  240. HRESULT hr;
  241. HRESULT hrReturn = S_OK;
  242. //
  243. // Only want to return the last error if any should occur.
  244. //
  245. hr = THR( CServiceManager::S_HrProcessUninitialize() );
  246. if ( FAILED( hr ) )
  247. {
  248. hrReturn = hr;
  249. } // if:
  250. HRETURN( hrReturn );
  251. } //*** HrLocalProcessInit
  252. //
  253. // Indicate that we need to have Fusion initialized and uninitialized properly
  254. // on process attach and detach.
  255. //
  256. #define USE_FUSION
  257. #define IMPLEMENT_COM_SERVER_DLL
  258. #include "DllSrc.cpp"