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
6.0 KiB

  1. //
  2. // cmponent.h : Declaration of Component.
  3. //
  4. // This COM object is primarily concerned with
  5. // the result pane items.
  6. //
  7. // Cory West <[email protected]>
  8. // Copyright (c) Microsoft Corporation 1997
  9. //
  10. #ifndef __CMPONENT_H_INCLUDED__
  11. #define __CMPONENT_H_INCLUDED__
  12. #include "stdcmpnt.h" // CComponent
  13. #include "cookie.h" // Cookie
  14. class ComponentData;
  15. class AttributeGeneralPage;
  16. class Component
  17. :
  18. public CComponent,
  19. public IExtendPropertySheet,
  20. public IExtendContextMenu,
  21. public IResultDataCompare,
  22. public IPersistStream
  23. {
  24. public:
  25. friend class AttributeGeneralPage;
  26. Component();
  27. virtual ~Component();
  28. BEGIN_COM_MAP(Component)
  29. COM_INTERFACE_ENTRY(IExtendContextMenu)
  30. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  31. COM_INTERFACE_ENTRY(IResultDataCompare)
  32. COM_INTERFACE_ENTRY(IPersistStream)
  33. COM_INTERFACE_ENTRY_CHAIN(CComponent)
  34. END_COM_MAP()
  35. #if DBG==1
  36. ULONG InternalAddRef( ) {
  37. return CComObjectRoot::InternalAddRef();
  38. }
  39. ULONG InternalRelease( ) {
  40. return CComObjectRoot::InternalRelease();
  41. }
  42. int dbg_InstID;
  43. #endif
  44. inline
  45. Cookie* ActiveCookie( CCookie* pBaseCookie ) {
  46. return ( Cookie*)ActiveBaseCookie( pBaseCookie );
  47. }
  48. //
  49. // Support methods for IComponent.
  50. //
  51. // For Error handling, overide GetResultViewType()
  52. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, LPOLESTR* ppViewType, long* pViewOptions);
  53. virtual HRESULT ReleaseAll();
  54. virtual HRESULT OnViewChange( LPDATAOBJECT lpDataObject, LPARAM data, LPARAM hint );
  55. virtual HRESULT OnNotifySelect( LPDATAOBJECT lpDataObject, BOOL fSelected );
  56. virtual HRESULT OnNotifyRefresh(LPDATAOBJECT lpDataObject);
  57. virtual HRESULT Show( CCookie* pcookie,
  58. LPARAM arg,
  59. HSCOPEITEM hScopeItem);
  60. virtual HRESULT OnNotifyAddImages( LPDATAOBJECT lpDataObject,
  61. LPIMAGELIST lpImageList,
  62. HSCOPEITEM hSelectedItem );
  63. virtual HRESULT OnNotifyDelete(LPDATAOBJECT lpDataObject);
  64. HRESULT PopulateListbox( Cookie* pcookie );
  65. HRESULT EnumerateScopeChildren( Cookie* pParentCookie,
  66. HSCOPEITEM hParent );
  67. HRESULT LoadColumns( Cookie* pcookie );
  68. ComponentData& QueryComponentDataRef( ) {
  69. return ( ComponentData& )QueryBaseComponentDataRef();
  70. }
  71. //
  72. // IExtendPropertySheet
  73. //
  74. STDMETHOD(CreatePropertyPages)( LPPROPERTYSHEETCALLBACK pCall,
  75. LONG_PTR handle,
  76. LPDATAOBJECT pDataObject );
  77. STDMETHOD(QueryPagesFor)( LPDATAOBJECT pDataObject );
  78. //
  79. // IExtendContextMenu
  80. //
  81. STDMETHOD(AddMenuItems)( LPDATAOBJECT piDataObject,
  82. LPCONTEXTMENUCALLBACK piCallback,
  83. long *pInsertionAllowed );
  84. STDMETHOD(Command)( long lCommandID,
  85. LPDATAOBJECT piDataObject );
  86. //
  87. // IResultDataCompare
  88. //
  89. virtual
  90. HRESULT __stdcall
  91. Compare(
  92. LPARAM userParam,
  93. MMC_COOKIE cookieA,
  94. MMC_COOKIE cookieB,
  95. int* result);
  96. //
  97. // Creates result items for the Attributes folder.
  98. //
  99. HRESULT
  100. FastInsertAttributeResultCookies(
  101. Cookie* pParentCookie
  102. );
  103. //
  104. // Creates result items for a particular class.
  105. //
  106. HRESULT
  107. Component::FastInsertClassAttributesResults(
  108. Cookie* pClassCookie
  109. );
  110. HRESULT
  111. Component::RecursiveDisplayClassAttributesResults(
  112. Cookie *pParentCookie,
  113. SchemaObject* pObject,
  114. CStringList& szProcessedList
  115. );
  116. HRESULT
  117. Component::ProcessResultList(
  118. Cookie *pParentCookie,
  119. ListEntry *pList,
  120. BOOLEAN fOptional,
  121. BOOLEAN fSystem,
  122. SchemaObject* pSrcObject
  123. );
  124. virtual HRESULT OnNotifySnapinHelp (LPDATAOBJECT pDataObject);
  125. virtual HRESULT OnNotifyContextHelp (LPDATAOBJECT pDataObject);
  126. // IPersistStream interface members
  127. STDMETHOD(GetClassID)(CLSID *pClassID);
  128. STDMETHOD(IsDirty)();
  129. STDMETHOD(Load)(IStream *pStm);
  130. STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty);
  131. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize);
  132. private:
  133. HRESULT DeleteAttribute(Cookie* pcookie);
  134. //
  135. // These should use smart pointers.
  136. //
  137. LPCONTROLBAR m_pControlbar;
  138. LPTOOLBAR m_pSvcMgmtToolbar;
  139. LPTOOLBAR m_pSchmMgmtToolbar;
  140. Cookie* m_pViewedCookie;
  141. static const GUID m_ObjectTypeGUIDs[SCHMMGMT_NUMTYPES];
  142. static const BSTR m_ObjectTypeStrings[SCHMMGMT_NUMTYPES];
  143. bool m_bDirty;
  144. };
  145. //
  146. // Enumeration for the icons used. The icons are loaded into
  147. // MMC via ComponentData::LoadIcons.
  148. //
  149. enum {
  150. iIconGeneric = 0,
  151. iIconFolder,
  152. iIconClass,
  153. iIconAttribute,
  154. iIconDisplaySpecifier,
  155. iIconLast
  156. };
  157. //
  158. // These enums give us readable names for the column ordinals
  159. // of the columns in various result views.
  160. //
  161. typedef enum _COLNUM_CLASS {
  162. COLNUM_CLASS_NAME=0,
  163. COLNUM_CLASS_TYPE,
  164. COLNUM_CLASS_STATUS,
  165. COLNUM_CLASS_DESCRIPTION
  166. } COLNUM_CLASS;
  167. typedef enum _COLNUM_ATTRIBUTE {
  168. COLNUM_ATTRIBUTE_NAME=0,
  169. COLNUM_ATTRIBUTE_TYPE,
  170. COLNUM_ATTRIBUTE_STATUS,
  171. COLNUM_ATTRIBUTE_SYSTEM,
  172. COLNUM_ATTRIBUTE_DESCRIPTION,
  173. COLNUM_ATTRIBUTE_PARENT
  174. } COLNUM_ATTRIBUTE;
  175. typedef enum _COLNUM_CLASS_ATTRIBUTE {
  176. COLNUM_CLASS_ATTRIBUTE_NAME=0,
  177. COLNUM_CLASS_ATTRIBUTE_TYPE,
  178. COLNUM_CLASS_ATTRIBUTE_SYSTEM,
  179. COLNUM_CLASS_ATTRIBUTE_DESCRIPTION,
  180. COLNUM_CLASS_ATTRIBUTE_PARENT
  181. } COLNUM_CLASS_ATTRIBUTE;
  182. typedef enum _COLNUM_ROOT {
  183. COLNUM_SCHEMA_NAME = 0
  184. } COLNUM_ROOT;
  185. HRESULT LoadIconsIntoImageList(LPIMAGELIST pImageList, BOOL fLoadLargeIcons);
  186. #endif