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.

240 lines
7.0 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusApp.h
  7. //
  8. // Description:
  9. // Definition of CClusApplication and it's supporting classes.
  10. //
  11. // Implementation File:
  12. // ClusApp.cpp
  13. //
  14. // Author:
  15. // Galen Barbee (GalenB) 10-Dec-1998
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef _CLUSAPPLICATION_H_
  23. #define _CLUSAPPLICATION_H_
  24. #include "resource.h"
  25. /////////////////////////////////////////////////////////////////////////////
  26. // Forward Class Declarations
  27. /////////////////////////////////////////////////////////////////////////////
  28. class CClusApplication;
  29. class CClusterNames;
  30. class CDomainNames;
  31. /////////////////////////////////////////////////////////////////////////////
  32. //++
  33. //
  34. // class CClusterNames
  35. //
  36. // Description:
  37. // Cluster Names Collection Automation Class.
  38. //
  39. // Inheritance:
  40. // IDispatchImpl< ISClusterNames, &IID_ISClusterNames, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  41. // CSupportErrorInfo
  42. // CComObjectRootEx< CComSingleThreadModel >
  43. // CComCoClass< CClusterNames, &CLSID_ClusterNames >
  44. //
  45. //--
  46. /////////////////////////////////////////////////////////////////////////////
  47. class ATL_NO_VTABLE CClusterNames :
  48. public IDispatchImpl< ISClusterNames, &IID_ISClusterNames, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  49. public CSupportErrorInfo,
  50. public CComObjectRootEx< CComSingleThreadModel >,
  51. public CComCoClass< CClusterNames, &CLSID_ClusterNames >
  52. {
  53. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  54. public:
  55. CClusterNames( void );
  56. ~CClusterNames( void );
  57. BEGIN_COM_MAP(CClusterNames)
  58. COM_INTERFACE_ENTRY(IDispatch)
  59. COM_INTERFACE_ENTRY(ISClusterNames)
  60. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  61. END_COM_MAP()
  62. DECLARE_NOT_AGGREGATABLE(CClusterNames)
  63. DECLARE_NO_REGISTRY()
  64. HRESULT Create( IN BSTR bstrDomainName );
  65. private:
  66. typedef std::vector< CComBSTR * > ClusterNameList;
  67. ClusterNameList m_Clusters;
  68. CComBSTR m_bstrDomainName;
  69. void Clear( void );
  70. public:
  71. STDMETHODIMP get_DomainName( OUT BSTR * pbstrDomainName );
  72. STDMETHODIMP get_Count( OUT long * plCount );
  73. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT BSTR * bstrClusterName );
  74. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  75. STDMETHODIMP Refresh( void );
  76. // STDMETHODIMP get_Application( OUT ISClusApplication ** ppParentApplication );
  77. // STDMETHODIMP get_Parent( OUT ISClusApplication ** ppParent )
  78. // {
  79. // return get_Application( ppParent );
  80. // }
  81. protected:
  82. HRESULT GetIndex( IN VARIANT varIndex, OUT UINT * pnIndex );
  83. }; //*** CClusterNames
  84. /////////////////////////////////////////////////////////////////////////////
  85. //++
  86. //
  87. // class CDomainNames
  88. //
  89. // Description:
  90. // Cluster Domain Names Collection Automation Class.
  91. //
  92. // Inheritance:
  93. // IDispatchImpl< ISDomainNames, &IID_ISDomainNames, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  94. // CSupportErrorInfo
  95. // CComObjectRootEx< CComSingleThreadModel >
  96. // CComCoClass< CDomainNames, &CLSID_DomainNames >
  97. //
  98. //--
  99. /////////////////////////////////////////////////////////////////////////////
  100. class ATL_NO_VTABLE CDomainNames :
  101. public IDispatchImpl< ISDomainNames, &IID_ISDomainNames, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  102. public CSupportErrorInfo,
  103. public CComObjectRootEx< CComSingleThreadModel >,
  104. public CComCoClass< CDomainNames, &CLSID_DomainNames >
  105. {
  106. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  107. public:
  108. CDomainNames( void );
  109. ~CDomainNames( void );
  110. BEGIN_COM_MAP(CDomainNames)
  111. COM_INTERFACE_ENTRY(IDispatch)
  112. COM_INTERFACE_ENTRY(ISDomainNames)
  113. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  114. END_COM_MAP()
  115. DECLARE_NOT_AGGREGATABLE(CDomainNames)
  116. DECLARE_NO_REGISTRY()
  117. private:
  118. typedef std::vector< CComBSTR * > DomainList;
  119. DomainList m_DomainList;
  120. STDMETHODIMP ScBuildTrustList( IN LPWSTR pszTarget );
  121. DWORD ScOpenPolicy( IN LPWSTR ServerName, IN DWORD DesiredAccess, OUT PLSA_HANDLE PolicyHandle );
  122. void InitLsaString( OUT PLSA_UNICODE_STRING LsaString, IN LPWSTR String );
  123. DWORD ScIsDomainController( IN LPWSTR pszServer, OUT LPBOOL pbIsDC );
  124. DWORD ScEnumTrustedDomains( IN LSA_HANDLE PolicyHandle );
  125. DWORD ScAddTrustToList( IN PLSA_UNICODE_STRING UnicodeString );
  126. void Clear( void );
  127. public:
  128. STDMETHODIMP get_Count( OUT long * plCount );
  129. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT BSTR * bstrDomainName );
  130. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  131. STDMETHODIMP Refresh( void );
  132. // STDMETHODIMP get_Application( OUT ISClusApplication ** ppParentApplication );
  133. // STDMETHODIMP get_Parent( OUT ISClusApplication ** ppParent )
  134. // {
  135. // return get_Application( ppParent );
  136. // }
  137. protected:
  138. HRESULT GetIndex( IN VARIANT varIndex, OUT UINT * pnIndex );
  139. }; //*** Class CDomainNames
  140. /////////////////////////////////////////////////////////////////////////////
  141. //++
  142. //
  143. // class CClusApplication
  144. //
  145. // Description:
  146. // Cluster Application Automation Class.
  147. //
  148. // Inheritance:
  149. // IDispatchImpl< ISClusApplication, &IID_ISClusApplication, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  150. // CSupportErrorInfo
  151. // CComObjectRootEx< CComSingleThreadModel >
  152. // CComCoClass< CClusApplication, &CLSID_ClusApplication >
  153. //
  154. //--
  155. /////////////////////////////////////////////////////////////////////////////
  156. class ATL_NO_VTABLE CClusApplication :
  157. public IDispatchImpl< ISClusApplication, &IID_ISClusApplication, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  158. public CSupportErrorInfo,
  159. public CComObjectRootEx< CComSingleThreadModel >,
  160. public CComCoClass< CClusApplication, &CLSID_ClusApplication >
  161. {
  162. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  163. typedef CComCoClass< CClusApplication, &CLSID_ClusApplication > BaseCoClass;
  164. typedef IDispatchImpl< ISClusApplication, &IID_ISClusApplication, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER > BaseDispatchClass;
  165. public:
  166. CClusApplication( void );
  167. ~CClusApplication( void );
  168. BEGIN_COM_MAP(CClusApplication)
  169. COM_INTERFACE_ENTRY(IDispatch)
  170. COM_INTERFACE_ENTRY(ISClusApplication)
  171. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  172. END_COM_MAP()
  173. DECLARE_NOT_AGGREGATABLE(CClusApplication)
  174. DECLARE_REGISTRY_RESOURCEID(IDR_MSCLUS)
  175. public:
  176. STDMETHODIMP get_DomainNames( OUT ISDomainNames ** ppDomainNames );
  177. STDMETHODIMP OpenCluster( IN BSTR bstrClusterName, OUT ISCluster ** ppCluster );
  178. STDMETHODIMP get_ClusterNames( IN BSTR bstrDomainName, OUT ISClusterNames ** ppClusterNames );
  179. // STDMETHODIMP get_Application( OUT ISClusApplication ** ppParentApplication );
  180. // STDMETHODIMP get_Parent( OUT ISClusApplication ** ppParent )
  181. // {
  182. // return get_Application( ppParent );
  183. // }
  184. private:
  185. CComObject< CDomainNames > * m_pDomainNames;
  186. }; //*** Class CClusApplication
  187. #endif // _CLUSAPPLICATION_H_