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.

323 lines
7.8 KiB

  1. /*++
  2. Module Name:
  3. MmcDispl.h
  4. Abstract:
  5. This module contains the definition for CMmcDisplay class. This is an abstract class
  6. for MMC Display related calls
  7. --*/
  8. #if !defined(AFX_MMCDISPLAY_H__2CC64E53_3BF4_11D1_AA17_00C06C00392D__INCLUDED_)
  9. #define AFX_MMCDISPLAY_H__2CC64E53_3BF4_11D1_AA17_00C06C00392D__INCLUDED_
  10. #if _MSC_VER >= 1000
  11. #pragma once
  12. #endif // _MSC_VER >= 1000
  13. #include "resource.h" // main symbols
  14. #include "stdafx.h"
  15. #define CCF_DFS_SNAPIN_INTERNAL ( L"CCF_DFS_SNAPIN_INTERNAL" )
  16. #define MMC_DISP_CTOR_RETURN_INVALIDARG_IF_NULL(ptr) if(!(ptr)) {m_hrValueFromCtor = E_INVALIDARG; return;}
  17. #define MMC_DISP_CTOR_RETURN_HR_IF_FAILED(hr) if (FAILED(hr)) {m_hrValueFromCtor = hr; return;}
  18. #define MMC_DISP_CTOR_RETURN_OUTOFMEMORY_IF_NULL(ptr) if (!(ptr)) {m_hrValueFromCtor = E_OUTOFMEMORY; return;}
  19. typedef enum DISPLAY_OBJECT_TYPE
  20. {
  21. DISPLAY_OBJECT_TYPE_ADMIN = 0,
  22. DISPLAY_OBJECT_TYPE_ROOT,
  23. DISPLAY_OBJECT_TYPE_JUNCTION,
  24. DISPLAY_OBJECT_TYPE_REPLICA
  25. };
  26. class ATL_NO_VTABLE CMmcDisplay:
  27. public IDataObject,
  28. public CComObjectRootEx<CComSingleThreadModel>
  29. {
  30. public:
  31. CMmcDisplay();
  32. virtual ~CMmcDisplay();
  33. BEGIN_COM_MAP(CMmcDisplay)
  34. COM_INTERFACE_ENTRY(IDataObject)
  35. END_COM_MAP()
  36. // Clipboard formats that are required by the console
  37. public:
  38. // This stores the clipboard format identifier for CCF_NODETYPE.
  39. static CLIPFORMAT mMMC_CF_NodeType;
  40. // stores the clipboard format identifier for CCF_SZNODETYPE.
  41. static CLIPFORMAT mMMC_CF_NodeTypeString;
  42. // This stores the clipboard format identifier for CCF_DISPLAY_NAME.
  43. static CLIPFORMAT mMMC_CF_DisplayName;
  44. // This stores the clipboard format identifier for CCF_SNAPIN_CLASSID.
  45. static CLIPFORMAT mMMC_CF_CoClass;
  46. // This stores the clipboard format identifier for CCF_DFS_SNAPIN_INTERNAL.
  47. static CLIPFORMAT mMMC_CF_Dfs_Snapin_Internal;
  48. // IUnknown Interface
  49. STDMETHOD(QueryInterface)(const struct _GUID & i_refiid,
  50. void ** o_pUnk);
  51. unsigned long __stdcall AddRef(void);
  52. unsigned long __stdcall Release(void);
  53. // IDataObject interface
  54. public:
  55. // Implemented : This is the method needed by MMC
  56. STDMETHOD(GetDataHere)(
  57. IN LPFORMATETC i_lpFormatetc,
  58. OUT LPSTGMEDIUM o_lpMedium
  59. );
  60. STDMETHOD(GetData)(
  61. IN LPFORMATETC lpFormatetcIn,
  62. OUT LPSTGMEDIUM lpMedium
  63. )
  64. {
  65. return E_NOTIMPL;
  66. }
  67. STDMETHOD(EnumFormatEtc)(
  68. DWORD dwDirection,
  69. LPENUMFORMATETC* ppEnumFormatEtc
  70. )
  71. {
  72. return E_NOTIMPL;
  73. }
  74. STDMETHOD(QueryGetData)(
  75. LPFORMATETC lpFormatetc
  76. )
  77. {
  78. return E_NOTIMPL;
  79. };
  80. STDMETHOD(GetCanonicalFormatEtc)(
  81. LPFORMATETC lpFormatetcIn,
  82. LPFORMATETC lpFormatetcOut
  83. )
  84. {
  85. return E_NOTIMPL;
  86. };
  87. STDMETHOD(SetData)(
  88. LPFORMATETC lpFormatetc,
  89. LPSTGMEDIUM lpMedium,
  90. BOOL bRelease
  91. )
  92. {
  93. return E_NOTIMPL;
  94. };
  95. STDMETHOD(DAdvise)(
  96. LPFORMATETC lpFormatetc,
  97. DWORD advf,
  98. LPADVISESINK pAdvSink,
  99. LPDWORD pdwConnection
  100. )
  101. {
  102. return E_NOTIMPL;
  103. };
  104. STDMETHOD(DUnadvise)(
  105. DWORD dwConnection
  106. )
  107. {
  108. return E_NOTIMPL;
  109. };
  110. STDMETHOD(EnumDAdvise)(
  111. LPENUMSTATDATA* ppEnumAdvise
  112. )
  113. {
  114. return E_NOTIMPL;
  115. };
  116. public:
  117. // To set Snapin CLSID.
  118. STDMETHOD(put_CoClassCLSID)(
  119. IN CLSID newVal
  120. );
  121. // For adding context menu items
  122. STDMETHOD(AddMenuItems)(
  123. IN LPCONTEXTMENUCALLBACK i_lpContextMenuCallback,
  124. IN LPLONG i_lpInsertionAllowed
  125. ) = 0;
  126. // For taking action on a context menu selection.
  127. STDMETHOD(Command)(
  128. IN LONG i_lCommandID
  129. ) = 0;
  130. // Set the headers for the listview (in the result pane) column
  131. STDMETHOD(SetColumnHeader)(
  132. IN LPHEADERCTRL2 i_piHeaderControl
  133. ) = 0;
  134. // Return the requested display information for the Result Pane
  135. STDMETHOD(GetResultDisplayInfo)(
  136. IN OUT LPRESULTDATAITEM io_pResultDataItem
  137. ) = 0;
  138. // Return the requested display information for the Scope Pane
  139. STDMETHOD(GetScopeDisplayInfo)(
  140. IN OUT LPSCOPEDATAITEM io_pScopeDataItem
  141. ) = 0;
  142. // Add items(or folders), if any to the Scope Pane
  143. STDMETHOD(EnumerateScopePane)(
  144. IN LPCONSOLENAMESPACE i_lpConsoleNameSpace,
  145. IN HSCOPEITEM i_hParent
  146. ) = 0;
  147. // Add items(or folders), if any to the Result Pane
  148. STDMETHOD(EnumerateResultPane)(
  149. IN OUT IResultData* io_pResultData
  150. ) = 0;
  151. // Set the console verb settings. Change the state, decide the default verb, etc
  152. STDMETHOD(SetConsoleVerbs)(
  153. IN LPCONSOLEVERB i_lpConsoleVerb
  154. ) = 0;
  155. // MMCN_DBLCLICK, return S_FALSE if you want MMC handle the default verb.
  156. STDMETHOD(DoDblClick)(
  157. ) = 0;
  158. // Delete the current item.
  159. STDMETHOD(DoDelete)(
  160. ) = 0;
  161. // Checks whether the object has pages to display
  162. STDMETHOD(QueryPagesFor)(
  163. ) = 0;
  164. // Creates and passes back the pages to be displayed
  165. STDMETHOD(CreatePropertyPages)(
  166. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  167. IN LONG_PTR i_lNotifyHandle
  168. ) = 0;
  169. // Used to notify the object that it's properties have changed
  170. STDMETHOD(PropertyChanged)(
  171. ) = 0;
  172. // Used to set the result view description bar text
  173. STDMETHOD(SetDescriptionBarText)(
  174. IN LPRESULTDATA i_lpResultData
  175. ) = 0;
  176. // Used to set the result view description bar text
  177. STDMETHOD(SetStatusText)(
  178. IN LPCONSOLE2 i_lpConsole
  179. ) = 0;
  180. // Handle a select event for the node. Handle only toolbar related
  181. // activities here
  182. STDMETHOD(ToolbarSelect)(
  183. IN const LONG i_lArg,
  184. IN IToolbar* i_pToolBar
  185. ) = 0;
  186. // Handle a click on the toolbar
  187. STDMETHOD(ToolbarClick)(
  188. IN const LPCONTROLBAR i_pControlbar,
  189. IN const LPARAM i_lParam
  190. ) = 0;
  191. STDMETHOD(CleanScopeChildren)(
  192. VOID
  193. ) = 0;
  194. STDMETHOD(CleanResultChildren)(
  195. ) = 0;
  196. STDMETHOD(ViewChange)(
  197. IResultData* i_pResultData,
  198. LONG_PTR i_lHint
  199. ) = 0;
  200. STDMETHOD(GetEntryPath)(
  201. BSTR* o_pbstrEntryPath
  202. ) = 0;
  203. virtual DISPLAY_OBJECT_TYPE GetDisplayObjectType(
  204. ) = 0;
  205. virtual HRESULT CreateToolbar(
  206. IN const LPCONTROLBAR i_pControlbar,
  207. IN const LPEXTENDCONTROLBAR i_lExtendControlbar,
  208. OUT IToolbar** o_pToolBar
  209. ) = 0;
  210. virtual HRESULT OnRefresh(
  211. );
  212. virtual HRESULT OnAddImages(IImageList *pImageList, HSCOPEITEM hsi);
  213. // Helper Methods
  214. private:
  215. HRESULT WriteToStream(
  216. IN const void* i_pBuffer,
  217. IN int i_len,
  218. OUT LPSTGMEDIUM o_lpMedium
  219. );
  220. // Member variables.
  221. protected:
  222. CLSID m_CLSIDClass; // The CLSID of the object
  223. CLSID m_CLSIDNodeType; // The node type as a CLSID
  224. CComBSTR m_bstrDNodeType; // The node type as a CLSID
  225. DWORD m_dwRefCount; // Reference Count for dataobjects returned.
  226. public:
  227. HRESULT m_hrValueFromCtor;
  228. };
  229. #endif // !defined(AFX_MMCDISPLAY_H__2CC64E53_3BF4_11D1_AA17_00C06C00392D__INCLUDED_)