Source code of Windows XP (NT5)
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.

262 lines
8.0 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. eSmHintStartQuery = 2,
  63. eSmHintStopQuery = 3,
  64. eSmHintModifyQuery = 4
  65. };
  66. enum eNodeType {
  67. eCounterLog = SLQ_COUNTER_LOG,
  68. eTraceLog = SLQ_TRACE_LOG,
  69. eAlert = SLQ_ALERT,
  70. eMonitor = SLQ_LAST_LOG_TYPE + 1
  71. };
  72. BEGIN_COM_MAP(CComponentData)
  73. COM_INTERFACE_ENTRY(IComponentData)
  74. COM_INTERFACE_ENTRY(IExtendContextMenu)
  75. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  76. COM_INTERFACE_ENTRY(ISnapinHelp)
  77. END_COM_MAP()
  78. // IComponentData methods
  79. public:
  80. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  81. STDMETHOD(GetDisplayInfo)(LPSCOPEDATAITEM pItem);
  82. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT * ppDataObject);
  83. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  84. STDMETHOD(CreateComponent)(LPCOMPONENT * ppComponent);
  85. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  86. STDMETHOD(Destroy)();
  87. // IExtendPropertySheet methods
  88. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK pCall, LONG_PTR handle, LPDATAOBJECT pDataObject);
  89. STDMETHOD(QueryPagesFor)(LPDATAOBJECT pDataObject);
  90. // ISnapinHelp interface members
  91. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompiledHelpFile);
  92. // IExtendContextMenu
  93. STDMETHOD(AddMenuItems)( LPDATAOBJECT pDataObject,
  94. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  95. long *pInsertionAllowed
  96. );
  97. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  98. // other helper methods
  99. public:
  100. BOOL IsLogService(MMC_COOKIE mmcCookie);
  101. BOOL IsScopeNode(MMC_COOKIE mmcCookie);
  102. BOOL IsAlertService (MMC_COOKIE mmcCookie);
  103. BOOL IsLogQuery(MMC_COOKIE mmcCookie);
  104. BOOL IsRunningQuery( CSmLogQuery* pQuery);
  105. LPCTSTR GetConceptsHTMLHelpFileName ( void );
  106. LPCTSTR GetSnapinHTMLHelpFileName ( void );
  107. LPCTSTR GetHTMLHelpTopic ( void );
  108. const CString& GetContextHelpFilePath ( void );
  109. IPropertySheetProvider * GetPropSheetProvider();
  110. BOOL LogTypeCheckNoMore (CLogWarnd* LogWarnd);
  111. // *** NOTE: Use of extension subclass not implemented.
  112. BOOL IsExtension(){ return m_bIsExtension; };
  113. void HandleTraceConnectError( HRESULT&, CString&, CString& );
  114. HRESULT CreateNewLogQuery( LPDATAOBJECT pDataObject, IPropertyBag* pPropBag = NULL);
  115. HRESULT CreateLogQueryFrom(LPDATAOBJECT pDataObject);
  116. // Methods to support IComponentData
  117. private:
  118. HRESULT OnExpand(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param);
  119. HRESULT OnRemoveChildren(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param );
  120. HRESULT ProcessCommandLine ( CString& rstrMachineName );
  121. HRESULT LoadFromFile ( LPTSTR pszFileName );
  122. LPRESULTDATA GetResultData ( void );
  123. void SetExtension( BOOL bExt ){ m_bIsExtension = bExt; };
  124. BOOL IsMyComputerNodetype (GUID& refguid);
  125. HRESULT InitPropertySheet ( CSmLogQuery*, MMC_COOKIE, LONG_PTR, CPropertySheet& );
  126. HRESULT NewTypedQuery( CSmLogService* pSvc, IPropertyBag* pPropBag ,LPDATAOBJECT pDataObject);
  127. CString m_strServerNamePersist;
  128. // *** override not implemented
  129. BOOL m_fAllowOverrideMachineName; // TRUE => Allow the machine name to be overriden by the command line
  130. LPCONSOLENAMESPACE m_ipConsoleNameSpace; // Pointer name space interface
  131. LPCONSOLE m_ipConsole; // Pointer to the console interface
  132. LPRESULTDATA m_ipResultData; // Pointer to the result data interface
  133. LPIMAGELIST m_ipScopeImage; // Caching the image list
  134. HINSTANCE m_hModule; // for load string operations
  135. IPropertySheetProvider *m_ipPrshtProvider;// from MMC
  136. // list of root nodes
  137. CTypedPtrList<CPtrList, CSmRootNode*> m_listpRootNode;
  138. CString m_strDisplayInfoName;
  139. BOOL m_bIsExtension;
  140. CString m_strWindowsDirectory;
  141. CString m_strContextHelpFilePath;
  142. };
  143. //+--------------------------------------------------------------------------
  144. //
  145. // Member: CComponentData::GetPropSheetProvider
  146. //
  147. // Synopsis: Access function for saved MMC IPropertySheetProvider
  148. // interface.
  149. //
  150. // History: 05-28-1999 a-akamal
  151. //
  152. //---------------------------------------------------------------------------
  153. inline IPropertySheetProvider *
  154. CComponentData::GetPropSheetProvider()
  155. {
  156. return m_ipPrshtProvider;
  157. }
  158. /////////////////////////////////////////////////////////////////////
  159. class CSmLogSnapin: public CComponentData,
  160. public CComCoClass<CSmLogSnapin, &CLSID_ComponentData>
  161. {
  162. public:
  163. CSmLogSnapin() : CComponentData () {};
  164. virtual ~CSmLogSnapin() {};
  165. DECLARE_REGISTRY_RESOURCEID(IDR_COMPONENTDATA)
  166. DECLARE_NOT_AGGREGATABLE(CSmLogSnapin)
  167. virtual BOOL IsExtension() { return FALSE; }
  168. // IPersistStream or IPersistStorage
  169. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  170. {
  171. *pClassID = CLSID_ComponentData;
  172. return S_OK;
  173. }
  174. };
  175. /////////////////////////////////////////////////////////////////////
  176. class CSmLogExtension: public CComponentData,
  177. public CComCoClass<CSmLogExtension, &CLSID_ComponentData>
  178. {
  179. public:
  180. CSmLogExtension() : CComponentData () {};
  181. virtual ~CSmLogExtension() {};
  182. DECLARE_REGISTRY_RESOURCEID(IDR_EXTENSION)
  183. DECLARE_NOT_AGGREGATABLE(CSmLogExtension)
  184. virtual BOOL IsExtension() { return TRUE; }
  185. // IPersistStream or IPersistStorage
  186. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  187. {
  188. *pClassID = CLSID_ComponentData;
  189. return S_OK;
  190. }
  191. };
  192. class CThemeContextActivator
  193. {
  194. public:
  195. CThemeContextActivator() : m_ulActivationCookie(0)
  196. { SHActivateContext (&m_ulActivationCookie); }
  197. ~CThemeContextActivator()
  198. { SHDeactivateContext (m_ulActivationCookie); }
  199. private:
  200. ULONG_PTR m_ulActivationCookie;
  201. };
  202. #endif //__COMPDATA_H_