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.

298 lines
8.0 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_X()
  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. // Implemented : This is the method needed by MMC
  55. STDMETHOD(GetDataHere)(
  56. IN LPFORMATETC i_lpFormatetc,
  57. OUT LPSTGMEDIUM o_lpMedium
  58. );
  59. STDMETHOD(GetData)(
  60. IN LPFORMATETC lpFormatetcIn,
  61. OUT LPSTGMEDIUM lpMedium
  62. )
  63. {
  64. return E_NOTIMPL;
  65. }
  66. STDMETHOD(EnumFormatEtc)(
  67. DWORD dwDirection,
  68. LPENUMFORMATETC* ppEnumFormatEtc
  69. )
  70. {
  71. return E_NOTIMPL;
  72. }
  73. STDMETHOD(QueryGetData)(
  74. LPFORMATETC lpFormatetc
  75. )
  76. {
  77. return E_NOTIMPL;
  78. };
  79. STDMETHOD(GetCanonicalFormatEtc)(
  80. LPFORMATETC lpFormatetcIn,
  81. LPFORMATETC lpFormatetcOut
  82. )
  83. {
  84. return E_NOTIMPL;
  85. };
  86. STDMETHOD(SetData)(
  87. LPFORMATETC lpFormatetc,
  88. LPSTGMEDIUM lpMedium,
  89. BOOL bRelease
  90. )
  91. {
  92. return E_NOTIMPL;
  93. };
  94. STDMETHOD(DAdvise)(
  95. LPFORMATETC lpFormatetc,
  96. DWORD advf,
  97. LPADVISESINK pAdvSink,
  98. LPDWORD pdwConnection
  99. )
  100. {
  101. return E_NOTIMPL;
  102. };
  103. STDMETHOD(DUnadvise)(
  104. DWORD dwConnection
  105. )
  106. {
  107. return E_NOTIMPL;
  108. };
  109. STDMETHOD(EnumDAdvise)(
  110. LPENUMSTATDATA* ppEnumAdvise
  111. )
  112. {
  113. return E_NOTIMPL;
  114. };
  115. public:
  116. // To set Snapin CLSID.
  117. STDMETHOD(put_CoClassCLSID)(
  118. IN CLSID newVal
  119. );
  120. // For adding context menu items
  121. STDMETHOD(AddMenuItems)(
  122. IN LPCONTEXTMENUCALLBACK i_lpContextMenuCallback,
  123. IN LPLONG i_lpInsertionAllowed
  124. ) = 0;
  125. // For taking action on a context menu selection.
  126. STDMETHOD(Command)(
  127. IN LONG i_lCommandID
  128. ) = 0;
  129. // Set the headers for the listview (in the result pane) column
  130. STDMETHOD(SetColumnHeader)(
  131. IN LPHEADERCTRL2 i_piHeaderControl
  132. ) = 0;
  133. // Return the requested display information for the Result Pane
  134. STDMETHOD(GetResultDisplayInfo)(
  135. IN OUT LPRESULTDATAITEM io_pResultDataItem
  136. ) = 0;
  137. // Return the requested display information for the Scope Pane
  138. STDMETHOD(GetScopeDisplayInfo)(
  139. IN OUT LPSCOPEDATAITEM io_pScopeDataItem
  140. ) = 0;
  141. // Add items(or folders), if any to the Scope Pane
  142. STDMETHOD(EnumerateScopePane)(
  143. IN LPCONSOLENAMESPACE i_lpConsoleNameSpace,
  144. IN HSCOPEITEM i_hParent
  145. ) = 0;
  146. // Add items(or folders), if any to the Result Pane
  147. STDMETHOD(EnumerateResultPane)(
  148. IN OUT IResultData* io_pResultData
  149. ) = 0;
  150. // Set the console verb settings. Change the state, decide the default verb, etc
  151. STDMETHOD(SetConsoleVerbs)(
  152. IN LPCONSOLEVERB i_lpConsoleVerb
  153. ) = 0;
  154. // MMCN_DBLCLICK, return S_FALSE if you want MMC handle the default verb.
  155. STDMETHOD(DoDblClick)(
  156. ) = 0;
  157. // Delete the current item.
  158. STDMETHOD(DoDelete)(
  159. ) = 0;
  160. // Checks whether the object has pages to display
  161. STDMETHOD(QueryPagesFor)(
  162. ) = 0;
  163. // Creates and passes back the pages to be displayed
  164. STDMETHOD(CreatePropertyPages)(
  165. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  166. IN LONG_PTR i_lNotifyHandle
  167. ) = 0;
  168. // Used to notify the object that it's properties have changed
  169. STDMETHOD(PropertyChanged)(
  170. ) = 0;
  171. // Used to set the result view description bar text
  172. STDMETHOD(SetDescriptionBarText)(
  173. IN LPRESULTDATA i_lpResultData
  174. ) = 0;
  175. // Used to set the result view description bar text
  176. STDMETHOD(SetStatusText)(
  177. IN LPCONSOLE2 i_lpConsole
  178. ) = 0;
  179. // Handle a select event for the node. Handle only toolbar related
  180. // activities here
  181. STDMETHOD(ToolbarSelect)(
  182. IN const LONG i_lArg,
  183. IN IToolbar* i_pToolBar
  184. ) = 0;
  185. // Handle a click on the toolbar
  186. STDMETHOD(ToolbarClick)(
  187. IN const LPCONTROLBAR i_pControlbar,
  188. IN const LPARAM i_lParam
  189. ) = 0;
  190. STDMETHOD(RemoveFromMMC)() = 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_)