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.

224 lines
7.4 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CluAdmin.h
  7. //
  8. // Abstract:
  9. // Definition of the CClusterAdminApp class, which is the main
  10. // application class for the CLUADMIN application.
  11. //
  12. // Author:
  13. // David Potter (davidp) May 1, 1996
  14. //
  15. // Revision History:
  16. //
  17. // Notes:
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #pragma once
  21. #ifndef _CLUADMIN_H_
  22. #define _CLUADMIN_H_
  23. #ifndef __AFXWIN_H__
  24. #error include 'stdafx.h' before including this file for PCH
  25. #endif
  26. #ifndef _UNICODE
  27. #error _UNICODE *must* be defined!
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Include Files
  31. /////////////////////////////////////////////////////////////////////////////
  32. #ifndef _RESOURCE_H_
  33. #include "resource.h" // main symbols
  34. #define _RESOURCE_H_
  35. #endif
  36. #ifndef _BARFCLUS_H_
  37. #include "BarfClus.h" // for BARF overrides of CLUSAPIs
  38. #endif
  39. #include "Notify.h" // for CClusterNotifyContext, CClusterNotifyKeyList
  40. /////////////////////////////////////////////////////////////////////////////
  41. // Forward Class Declarations
  42. /////////////////////////////////////////////////////////////////////////////
  43. class CClusterAdminApp;
  44. /////////////////////////////////////////////////////////////////////////////
  45. // External Class Declarations
  46. /////////////////////////////////////////////////////////////////////////////
  47. class CRecentClusterList;
  48. class CCluAdminCommandLineInfo;
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Type Definitions
  51. /////////////////////////////////////////////////////////////////////////////
  52. enum ImageListIndex
  53. {
  54. IMGLI_FOLDER = 0,
  55. IMGLI_CLUSTER,
  56. IMGLI_CLUSTER_UNKNOWN,
  57. IMGLI_NODE,
  58. IMGLI_NODE_DOWN,
  59. IMGLI_NODE_PAUSED,
  60. IMGLI_NODE_UNKNOWN,
  61. IMGLI_GROUP,
  62. IMGLI_GROUP_PARTIALLY_ONLINE,
  63. IMGLI_GROUP_PENDING,
  64. IMGLI_GROUP_OFFLINE,
  65. IMGLI_GROUP_FAILED,
  66. IMGLI_GROUP_UNKNOWN,
  67. IMGLI_RES,
  68. IMGLI_RES_OFFLINE,
  69. IMGLI_RES_PENDING,
  70. IMGLI_RES_FAILED,
  71. IMGLI_RES_UNKNOWN,
  72. IMGLI_RESTYPE,
  73. IMGLI_RESTYPE_UNKNOWN,
  74. IMGLI_NETWORK,
  75. IMGLI_NETWORK_PARTITIONED,
  76. IMGLI_NETWORK_DOWN,
  77. IMGLI_NETWORK_UNKNOWN,
  78. IMGLI_NETIFACE,
  79. IMGLI_NETIFACE_UNREACHABLE,
  80. IMGLI_NETIFACE_FAILED,
  81. IMGLI_NETIFACE_UNKNOWN,
  82. IMGLI_MAX
  83. };
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CClusterAdminApp:
  86. // See CluAdmin.cpp for the implementation of this class
  87. /////////////////////////////////////////////////////////////////////////////
  88. class CClusterAdminApp : public CWinApp
  89. {
  90. DECLARE_DYNAMIC( CClusterAdminApp );
  91. public:
  92. CClusterAdminApp( void );
  93. CRecentClusterList * PrclRecentClusterList( void) { return (CRecentClusterList *) m_pRecentFileList; }
  94. // Overrides
  95. // ClassWizard generated virtual function overrides
  96. //{{AFX_VIRTUAL(CClusterAdminApp)
  97. public:
  98. virtual BOOL InitInstance();
  99. virtual BOOL OnIdle(IN LONG lCount);
  100. virtual CDocument* OpenDocumentFile(LPCTSTR lpszFileName);
  101. virtual int ExitInstance();
  102. virtual void AddToRecentFileList(LPCTSTR lpszPathName);
  103. //}}AFX_VIRTUAL
  104. // Implementation
  105. #ifdef _CLUADMIN_USE_OLE_
  106. COleTemplateServer m_server;
  107. // Server object for document creation
  108. #endif
  109. protected:
  110. CMultiDocTemplate * m_pDocTemplate;
  111. CImageList m_ilSmallImages;
  112. CImageList m_ilLargeImages;
  113. HCHANGE m_hchangeNotifyPort;
  114. LCID m_lcid;
  115. CClusterNotifyKeyList m_cnkl;
  116. CClusterNotifyContext m_cnctx;
  117. CClusterNotifyList m_cnlNotifications;
  118. CWinThread * m_wtNotifyThread;
  119. HCLUSTER m_hOpenedCluster;
  120. ULONG m_nIdleCount;
  121. // Indices of images in the image list.
  122. UINT m_rgiimg[IMGLI_MAX];
  123. IUnknown * m_punkClusCfgClient;
  124. BOOL BInitNotifyThread(void);
  125. static UINT AFX_CDECL NotifyThreadProc(LPVOID pParam);
  126. CClusterNotifyContext * Pcnctx(void) { return &m_cnctx; }
  127. CWinThread * WtNotifyThread(void) const { return m_wtNotifyThread; }
  128. BOOL ProcessShellCommand(IN OUT CCluAdminCommandLineInfo & rCmdInfo);
  129. void InitGlobalImageList(void);
  130. public:
  131. CMultiDocTemplate * PdocTemplate(void) const { return m_pDocTemplate; }
  132. CImageList * PilSmallImages(void) { return &m_ilSmallImages; }
  133. CImageList * PilLargeImages(void) { return &m_ilLargeImages; }
  134. HCHANGE HchangeNotifyPort(void) const { return m_hchangeNotifyPort; }
  135. LCID Lcid(void) const { return m_lcid; }
  136. CClusterNotifyKeyList & Cnkl(void) { return m_cnkl; }
  137. CClusterNotifyList & Cnl( void ) { return m_cnlNotifications; }
  138. HCLUSTER HOpenedCluster(void) const { return m_hOpenedCluster; }
  139. // Indices of images in the image list.
  140. UINT Iimg(ImageListIndex imgli) { return m_rgiimg[imgli]; }
  141. void LoadImageIntoList(
  142. IN OUT CImageList * pil,
  143. IN ID idbImage,
  144. IN UINT imgli
  145. );
  146. static void LoadImageIntoList(
  147. IN OUT CImageList * pil,
  148. IN ID idbImage,
  149. OUT UINT * piimg = NULL
  150. );
  151. void SaveConnections(void);
  152. afx_msg LRESULT OnRestoreDesktop(WPARAM wparam, LPARAM lparam);
  153. afx_msg LRESULT OnClusterNotify(WPARAM wparam, LPARAM lparam);
  154. //{{AFX_MSG(CClusterAdminApp)
  155. afx_msg void OnAppAbout();
  156. afx_msg void OnFileOpen();
  157. afx_msg void OnFileNewCluster();
  158. afx_msg void OnWindowCloseAll();
  159. afx_msg void OnUpdateWindowCloseAll(CCmdUI* pCmdUI);
  160. //}}AFX_MSG
  161. #ifdef _DEBUG
  162. afx_msg void OnTraceSettings();
  163. afx_msg void OnBarfSettings();
  164. afx_msg void OnBarfAllSettings();
  165. #endif
  166. DECLARE_MESSAGE_MAP()
  167. }; //*** class CClusterAdminApp
  168. /////////////////////////////////////////////////////////////////////////////
  169. // Global Functions
  170. /////////////////////////////////////////////////////////////////////////////
  171. BOOL BCreateFont(OUT CFont & rfont, IN int nPoints, IN BOOL bBold);
  172. void NewNodeWizard( LPCTSTR pcszName, BOOL fIgnoreErrors = FALSE );
  173. void GetClusterInformation( HCLUSTER hClusterIn, CString& rstrNameOut, PCLUSTERVERSIONINFO pcviOut = NULL );
  174. CString StrGetClusterName( HCLUSTER hClusterIn );
  175. inline CClusterAdminApp * GetClusterAdminApp(void)
  176. {
  177. ASSERT_KINDOF(CClusterAdminApp, AfxGetApp());
  178. return (CClusterAdminApp *) AfxGetApp();
  179. }
  180. inline CFrameWnd * PframeMain(void)
  181. {
  182. return (CFrameWnd *) AfxGetMainWnd();
  183. }
  184. /////////////////////////////////////////////////////////////////////////////
  185. #endif // _CLUADMIN_H_