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.

272 lines
8.6 KiB

  1. /*++
  2. Copyright (C) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. compdata.h
  5. Abstract:
  6. This class is the interface that handles anything to do with
  7. the scope pane. MMC calls the IComponentData interfaces.
  8. --*/
  9. #ifndef __COMPDATA_H_
  10. #define __COMPDATA_H_
  11. #include "smlogres.h" // Resource symbols
  12. #include "smlogcfg.h" // For CLSID_ComponentData
  13. #include "Globals.h"
  14. #include "common.h"
  15. #include "smctrsv.h"
  16. #include "smtracsv.h"
  17. #include "smalrtsv.h"
  18. #include "shfusion.h"
  19. // result pane column indices
  20. #define ROOT_COL_QUERY_NAME 0
  21. #define ROOT_COL_QUERY_NAME_SIZE 80
  22. #define ROOT_COL_COMMENT 1
  23. #define ROOT_COL_COMMENT_SIZE 166
  24. #define ROOT_COL_ALERT_COMMENT_XTRA 195
  25. #define ROOT_COL_LOG_TYPE 2
  26. #define ROOT_COL_LOG_TYPE_SIZE 75
  27. #define ROOT_COL_LOG_NAME 3
  28. #define ROOT_COL_LOG_NAME_SIZE 120
  29. #define MAIN_COL_NAME 0
  30. #define MAIN_COL_NAME_SIZE 120
  31. #define MAIN_COL_DESC 1
  32. #define MAIN_COL_DESC_SIZE 321
  33. #define EXTENSION_COL_NAME 0
  34. #define EXTENSION_COL_TYPE 1
  35. #define EXTENSION_COL_DESC 2
  36. class CSmLogQuery;
  37. class CSmRootNode;
  38. class CLogWarnd;
  39. class ATL_NO_VTABLE CComponentData :
  40. public CComObjectRootEx<CComSingleThreadModel>,
  41. public IComponentData,
  42. public IExtendContextMenu,
  43. public IExtendPropertySheet,
  44. public ISnapinHelp
  45. // *** CComObjectRoot is from framewrk\stdcdata.h
  46. //public CComObjectRoot
  47. {
  48. public:
  49. CComponentData();
  50. virtual ~CComponentData();
  51. //DECLARE_REGISTRY_RESOURCEID(IDR_COMPONENTDATA)
  52. //DECLARE_NOT_AGGREGATABLE(CComponentData)
  53. enum eBitmapIndex {
  54. eBmpQueryStarted = 0,
  55. eBmpQueryStopped = 1,
  56. eBmpLogType = 2,
  57. eBmpRootIcon = 3,
  58. eBmpAlertType = 4
  59. };
  60. enum eUpdateHint {
  61. eSmHintNewQuery = 1,
  62. eSmHintPreDeleteQuery = 2,
  63. eSmHintStartQuery = 3,
  64. eSmHintStopQuery = 4,
  65. eSmHintModifyQuery = 5,
  66. eSmHintPreRefresh = 6,
  67. eSmHintRefresh = 7
  68. };
  69. enum eNodeType {
  70. eCounterLog = SLQ_COUNTER_LOG,
  71. eTraceLog = SLQ_TRACE_LOG,
  72. eAlert = SLQ_ALERT,
  73. eMonitor = SLQ_LAST_LOG_TYPE + 1
  74. };
  75. BEGIN_COM_MAP(CComponentData)
  76. COM_INTERFACE_ENTRY(IComponentData)
  77. COM_INTERFACE_ENTRY(IExtendContextMenu)
  78. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  79. COM_INTERFACE_ENTRY(ISnapinHelp)
  80. END_COM_MAP()
  81. // IComponentData methods
  82. public:
  83. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  84. STDMETHOD(GetDisplayInfo)(LPSCOPEDATAITEM pItem);
  85. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT * ppDataObject);
  86. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  87. STDMETHOD(CreateComponent)(LPCOMPONENT * ppComponent);
  88. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  89. STDMETHOD(Destroy)();
  90. // IExtendPropertySheet methods
  91. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK pCall, LONG_PTR handle, LPDATAOBJECT pDataObject);
  92. STDMETHOD(QueryPagesFor)(LPDATAOBJECT pDataObject);
  93. // ISnapinHelp interface members
  94. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompiledHelpFile);
  95. // IExtendContextMenu
  96. STDMETHOD(AddMenuItems)( LPDATAOBJECT pDataObject,
  97. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  98. long *pInsertionAllowed
  99. );
  100. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  101. // other helper methods
  102. public:
  103. BOOL IsLogService(MMC_COOKIE mmcCookie);
  104. BOOL IsScopeNode(MMC_COOKIE mmcCookie);
  105. BOOL IsAlertService (MMC_COOKIE mmcCookie);
  106. BOOL IsLogQuery(MMC_COOKIE mmcCookie);
  107. BOOL IsRunningQuery( CSmLogQuery* pQuery);
  108. LPCWSTR GetConceptsHTMLHelpFileName ( void );
  109. LPCWSTR GetSnapinHTMLHelpFileName ( void );
  110. LPCWSTR GetHTMLHelpTopic ( void );
  111. const CString& GetContextHelpFilePath ( void );
  112. IPropertySheetProvider * GetPropSheetProvider();
  113. BOOL LogTypeCheckNoMore (CLogWarnd* LogWarnd);
  114. // *** NOTE: Use of extension subclass not implemented.
  115. BOOL IsExtension(){ return m_bIsExtension; };
  116. void HandleTraceConnectError( HRESULT&, CString&, CString& );
  117. HRESULT CreateNewLogQuery( LPDATAOBJECT pDataObject, IPropertyBag* pPropBag = NULL);
  118. HRESULT CreateLogQueryFrom(LPDATAOBJECT pDataObject);
  119. // Methods to support IComponentData
  120. private:
  121. HRESULT OnExpand(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param);
  122. HRESULT OnRemoveChildren(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param );
  123. HRESULT ProcessCommandLine ( CString& rstrMachineName );
  124. HRESULT LoadFromFile ( LPWSTR pszFileName );
  125. LPRESULTDATA GetResultData ( void );
  126. void SetExtension( BOOL bExt ){ m_bIsExtension = bExt; };
  127. BOOL IsMyComputerNodetype (GUID& refguid);
  128. HRESULT InitPropertySheet ( CSmLogQuery*, MMC_COOKIE, LONG_PTR, CPropertySheet* );
  129. HRESULT NewTypedQuery( CSmLogService* pSvc, IPropertyBag* pPropBag ,LPDATAOBJECT pDataObject);
  130. BOOL IsPreWindows2000Server ( const CString& rstrMachineName );
  131. CSmRootNode* GetOrphanedRootNode ( const CString& rstrMachineName );
  132. CString m_strServerNamePersist;
  133. // *** override not implemented
  134. BOOL m_fAllowOverrideMachineName; // TRUE => Allow the machine name to be overriden by the command line
  135. LPCONSOLENAMESPACE m_ipConsoleNameSpace; // Pointer name space interface
  136. LPCONSOLE m_ipConsole; // Pointer to the console interface
  137. LPRESULTDATA m_ipResultData; // Pointer to the result data interface
  138. LPIMAGELIST m_ipScopeImage; // Caching the image list
  139. HINSTANCE m_hModule; // for load string operations
  140. IPropertySheetProvider *m_ipPrshtProvider;// from MMC
  141. // list of root nodes
  142. CTypedPtrList<CPtrList, CSmRootNode*> m_listpRootNode;
  143. // list of orphaned root nodes, due to machine retargeting
  144. CTypedPtrList<CPtrList, CSmRootNode*> m_listpOrphanedRootNode;
  145. CString m_strDisplayInfoName;
  146. BOOL m_bIsExtension;
  147. CString m_strWindowsDirectory;
  148. CString m_strContextHelpFilePath;
  149. };
  150. //+--------------------------------------------------------------------------
  151. //
  152. // Member: CComponentData::GetPropSheetProvider
  153. //
  154. // Synopsis: Access function for saved MMC IPropertySheetProvider
  155. // interface.
  156. //
  157. // History: 05-28-1999 a-akamal
  158. //
  159. //---------------------------------------------------------------------------
  160. inline IPropertySheetProvider *
  161. CComponentData::GetPropSheetProvider()
  162. {
  163. return m_ipPrshtProvider;
  164. }
  165. /////////////////////////////////////////////////////////////////////
  166. class CSmLogSnapin: public CComponentData,
  167. public CComCoClass<CSmLogSnapin, &CLSID_ComponentData>
  168. {
  169. public:
  170. CSmLogSnapin() : CComponentData () {};
  171. virtual ~CSmLogSnapin() {};
  172. DECLARE_REGISTRY_RESOURCEID(IDR_COMPONENTDATA)
  173. DECLARE_NOT_AGGREGATABLE(CSmLogSnapin)
  174. virtual BOOL IsExtension() { return FALSE; }
  175. // IPersistStream or IPersistStorage
  176. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  177. {
  178. *pClassID = CLSID_ComponentData;
  179. return S_OK;
  180. }
  181. };
  182. /////////////////////////////////////////////////////////////////////
  183. class CSmLogExtension: public CComponentData,
  184. public CComCoClass<CSmLogExtension, &CLSID_ComponentData>
  185. {
  186. public:
  187. CSmLogExtension() : CComponentData () {};
  188. virtual ~CSmLogExtension() {};
  189. DECLARE_REGISTRY_RESOURCEID(IDR_EXTENSION)
  190. DECLARE_NOT_AGGREGATABLE(CSmLogExtension)
  191. virtual BOOL IsExtension() { return TRUE; }
  192. // IPersistStream or IPersistStorage
  193. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  194. {
  195. *pClassID = CLSID_ComponentData;
  196. return S_OK;
  197. }
  198. };
  199. class CThemeContextActivator
  200. {
  201. public:
  202. CThemeContextActivator() : m_ulActivationCookie(0)
  203. { SHActivateContext (&m_ulActivationCookie); }
  204. ~CThemeContextActivator()
  205. { SHDeactivateContext (m_ulActivationCookie); }
  206. private:
  207. ULONG_PTR m_ulActivationCookie;
  208. };
  209. #endif //__COMPDATA_H_