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.

418 lines
8.9 KiB

  1. /*++
  2. Copyright (c) 1994-1999 Microsoft Corporation
  3. Module Name :
  4. inetmgr.h
  5. Abstract:
  6. Main MMC snap-in code definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager (cluster edition)
  11. Revision History:
  12. --*/
  13. #ifndef __INETMGR_H_
  14. #define __INETMGR_H_
  15. #include "resource.h"
  16. #include "inetmgr.h"
  17. //#include "xatlsnap.h"
  18. #ifndef ATLASSERT
  19. #define ATLASSERT(expr) _ASSERTE(expr)
  20. #endif
  21. //
  22. // Icon background colour
  23. //
  24. #define RGB_BK_IMAGES (RGB(255,0,255)) // purple
  25. #include <debugafx.h>
  26. class CInetmgrApp : public CWinApp
  27. /*++
  28. Class Description:
  29. Main app object
  30. Public Interface:
  31. InitInstance : Instance initiation handler
  32. ExitInstance : Exit instance handler
  33. --*/
  34. {
  35. public:
  36. CInetmgrApp();
  37. virtual BOOL InitInstance();
  38. virtual int ExitInstance();
  39. //
  40. // Access
  41. //
  42. public:
  43. LPCTSTR QueryInetMgrHelpPath() const { return m_strInetMgrHelpPath; }
  44. protected:
  45. //{{AFX_MSG(CSnapinApp)
  46. afx_msg void OnHelp();
  47. //}}AFX_MSG
  48. DECLARE_MESSAGE_MAP()
  49. private:
  50. LPCTSTR m_lpOriginalHelpPath;
  51. LPCTSTR m_lpOriginalAppName;
  52. CString m_strInetMgrHelpPath;
  53. CString m_strInetMgrAppName;
  54. };
  55. class CInetMgr;
  56. class CInetMgrComponent
  57. : public CComObjectRootEx<CComSingleThreadModel>,
  58. public CSnapInObjectRoot<2, CInetMgr>,
  59. public IPersistStorage,
  60. public ISnapinHelp2,
  61. public IExtendContextMenuImpl<CInetMgrComponent>,
  62. public IExtendPropertySheetImpl<CInetMgrComponent>,
  63. public IExtendControlbar,
  64. public IResultDataCompareEx,
  65. public IComponentImpl<CInetMgrComponent>
  66. /*++
  67. Class Description:
  68. IComponentImpl implementation
  69. Public Interface:
  70. See IComponent, IPersistStorage, etc for documentation
  71. --*/
  72. {
  73. //
  74. // Constructor/Destructor
  75. //
  76. public:
  77. CInetMgrComponent();
  78. //
  79. // Interface:
  80. //
  81. public:
  82. BEGIN_COM_MAP(CInetMgrComponent)
  83. COM_INTERFACE_ENTRY(IComponent)
  84. COM_INTERFACE_ENTRY(IPersistStorage)
  85. COM_INTERFACE_ENTRY(ISnapinHelp2)
  86. COM_INTERFACE_ENTRY(IExtendContextMenu)
  87. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  88. COM_INTERFACE_ENTRY(IExtendControlbar)
  89. COM_INTERFACE_ENTRY(IResultDataCompareEx)
  90. END_COM_MAP()
  91. //
  92. // IComponent methods
  93. //
  94. STDMETHOD(Notify)(
  95. LPDATAOBJECT lpDataObject,
  96. MMC_NOTIFY_TYPE event,
  97. LPARAM arg,
  98. LPARAM param
  99. );
  100. STDMETHOD(CompareObjects)(
  101. IN LPDATAOBJECT lpDataObjectA,
  102. IN LPDATAOBJECT lpDataObjectB
  103. );
  104. //
  105. // IPersistStorage methods
  106. //
  107. STDMETHOD(GetClassID)(CLSID * pClassID);
  108. STDMETHOD(IsDirty)();
  109. STDMETHOD(InitNew)(IStorage * pStg);
  110. STDMETHOD(Load)(IStorage * pStg);
  111. virtual HRESULT STDMETHODCALLTYPE Save(IStorage * pStgSave, BOOL fSameAsLoad);
  112. virtual HRESULT STDMETHODCALLTYPE SaveCompleted(IStorage * pStgNew);
  113. virtual HRESULT STDMETHODCALLTYPE HandsOffStorage();
  114. // ISnapinHelp helper function
  115. STDMETHOD(GetHelpTopic)(LPOLESTR *pszHelpFile);
  116. STDMETHOD(GetLinkedTopics)(LPOLESTR *pszHelpFile);
  117. //
  118. // IExtendControlbar methods
  119. //
  120. STDMETHOD(SetControlbar)(LPCONTROLBAR lpControlbar);
  121. STDMETHOD(ControlbarNotify)(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  122. //
  123. // IResultDataCompareEx methods
  124. //
  125. STDMETHOD(Compare)(RDCOMPARE * prdc, int * pnResult);
  126. };
  127. #if 0
  128. class CIISMachine;
  129. class CCompMgrExtData : public CSnapInItemImpl<CCompMgrExtData, TRUE>
  130. {
  131. public:
  132. static const GUID * m_NODETYPE;
  133. static const OLECHAR * m_SZNODETYPE;
  134. static const OLECHAR * m_SZDISPLAY_NAME;
  135. static const CLSID * m_SNAPIN_CLASSID;
  136. CCompMgrExtData()
  137. {
  138. memset(&m_scopeDataItem, 0, sizeof(SCOPEDATAITEM));
  139. memset(&m_resultDataItem, 0, sizeof(RESULTDATAITEM));
  140. }
  141. ~CCompMgrExtData()
  142. {
  143. }
  144. // STDMETHOD(CreatePropertyPages)(
  145. // LPPROPERTYSHEETCALLBACK lpProvider,
  146. // LONG_PTR handle,
  147. // IUnknown* pUnk,
  148. // DATA_OBJECT_TYPES type);
  149. STDMETHOD(QueryPagesFor)(DATA_OBJECT_TYPES type)
  150. {
  151. if (type == CCT_SCOPE || type == CCT_RESULT)
  152. return S_OK;
  153. return S_FALSE;
  154. }
  155. STDMETHOD(Notify)( MMC_NOTIFY_TYPE event,
  156. LPARAM arg,
  157. LPARAM param,
  158. IComponentData* pComponentData,
  159. IComponent* pComponent,
  160. DATA_OBJECT_TYPES type);
  161. HRESULT EnumerateScopePane(HSCOPEITEM hParent, IConsoleNameSpace2 * pScope);
  162. IDataObject * m_pDataObject;
  163. virtual void
  164. InitDataClass(IDataObject* pDataObject, CSnapInItem* pDefault)
  165. {
  166. m_pDataObject = pDataObject;
  167. VERIFY(SUCCEEDED(Init(pDataObject)));
  168. }
  169. CSnapInItem *
  170. GetExtNodeObject(IDataObject* pDataObject, CSnapInItem* pDefault)
  171. {
  172. // Modify to return a different CSnapInItem* pointer.
  173. return pDefault;
  174. }
  175. protected:
  176. HRESULT Init(IDataObject * pDataObject);
  177. CString m_ExtMachineName;
  178. // CIISMachine * m_pMachine;
  179. HSCOPEITEM m_hScopeItem;
  180. };
  181. #endif
  182. class CIISRoot;
  183. class CInetMgr
  184. : public CComObjectRootEx<CComSingleThreadModel>,
  185. public CSnapInObjectRoot<1, CInetMgr>,
  186. public IComponentDataImpl<CInetMgr, CInetMgrComponent>,
  187. public IPersistStorage,
  188. public ISnapinHelp2,
  189. public IExtendContextMenuImpl<CInetMgr>,
  190. public IExtendPropertySheetImpl<CInetMgr>,
  191. public CComCoClass<CInetMgr, &CLSID_InetMgr>
  192. /*++
  193. Class Description:
  194. IComponentDataImpl implementation
  195. Public Interface:
  196. See IComponentData, IPersistStorage, IExtendContextMenu etc, for documentation
  197. --*/
  198. {
  199. //
  200. // Constructor/Destructor
  201. //
  202. public:
  203. CInetMgr();
  204. ~CInetMgr();
  205. //EXTENSION_SNAPIN_DATACLASS(CCompMgrExtData)
  206. //BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CInetMgr)
  207. // EXTENSION_SNAPIN_NODEINFO_ENTRY(CCompMgrExtData)
  208. //END_EXTENSION_SNAPIN_NODEINFO_MAP()
  209. //
  210. // Interface
  211. //
  212. public:
  213. BEGIN_COM_MAP(CInetMgr)
  214. COM_INTERFACE_ENTRY(IComponentData)
  215. COM_INTERFACE_ENTRY(IPersistStorage)
  216. COM_INTERFACE_ENTRY(IExtendContextMenu)
  217. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  218. COM_INTERFACE_ENTRY(ISnapinHelp2)
  219. END_COM_MAP()
  220. DECLARE_REGISTRY_RESOURCEID(IDR_INETMGR)
  221. DECLARE_NOT_AGGREGATABLE(CInetMgr)
  222. //
  223. // IPersistStorage methods
  224. //
  225. STDMETHOD(GetClassID)(CLSID * pClassID);
  226. STDMETHOD(IsDirty)();
  227. STDMETHOD(InitNew)(IStorage * pStg);
  228. STDMETHOD(Load)(IStorage * pStg);
  229. virtual HRESULT STDMETHODCALLTYPE Save(IStorage * pStgSave, BOOL fSameAsLoad);
  230. virtual HRESULT STDMETHODCALLTYPE SaveCompleted(IStorage * pStgNew);
  231. virtual HRESULT STDMETHODCALLTYPE HandsOffStorage();
  232. // ISnapinHelp helper function
  233. STDMETHOD(GetHelpTopic)(LPOLESTR *pszHelpFile);
  234. STDMETHOD(GetLinkedTopics)(LPOLESTR *pszHelpFile);
  235. HRESULT GetDataClass(
  236. IDataObject * pDataObject,
  237. CSnapInItem ** ppItem,
  238. DATA_OBJECT_TYPES * pType);
  239. //
  240. // IComponentData methods
  241. //
  242. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  243. STDMETHOD(CompareObjects)(
  244. LPDATAOBJECT lpDataObjectA,
  245. LPDATAOBJECT lpDataObjectB
  246. );
  247. STDMETHOD(Notify)(
  248. LPDATAOBJECT lpDataObject,
  249. MMC_NOTIFY_TYPE event,
  250. LPARAM arg,
  251. LPARAM param
  252. );
  253. HRESULT OnPropertyChange(LPARAM arg, LPARAM param);
  254. public:
  255. static void WINAPI ObjectMain(bool bStarting);
  256. protected:
  257. BOOL IsExtension();
  258. protected:
  259. static DWORD _dwSignature;
  260. static LPCTSTR _szStream;
  261. };
  262. class ATL_NO_VTABLE CInetMgrAbout
  263. : public ISnapinAbout,
  264. public CComObjectRoot,
  265. public CComCoClass<CInetMgrAbout, &CLSID_InetMgrAbout>
  266. /*++
  267. Class Description:
  268. About interface implementation. Called by MMC to display information
  269. about the snap-in.
  270. Public Interface:
  271. See ISnapinAbout for documentation
  272. --*/
  273. {
  274. //
  275. // Interface
  276. //
  277. public:
  278. CInetMgrAbout()
  279. {
  280. m_hSmallImage = m_hLargeImage = NULL;
  281. m_hSnapinIcon = NULL;
  282. }
  283. ~CInetMgrAbout();
  284. DECLARE_REGISTRY(CInetMgrAbout, _T("InetMgr5xAbout.1"), _T("InetMgr5xAbout.1"), IDS_INETMGR_DESC, THREADFLAGS_BOTH);
  285. BEGIN_COM_MAP(CInetMgrAbout)
  286. COM_INTERFACE_ENTRY(ISnapinAbout)
  287. END_COM_MAP()
  288. STDMETHOD(GetSnapinDescription)(LPOLESTR * lpDescription);
  289. STDMETHOD(GetProvider)(LPOLESTR * lpName);
  290. STDMETHOD(GetSnapinVersion)(LPOLESTR * lpVersion);
  291. STDMETHOD(GetSnapinImage)(HICON * hAppIcon);
  292. STDMETHOD(GetStaticFolderImage)(
  293. OUT HBITMAP * phSmallImage,
  294. OUT HBITMAP * phSmallImageOpen,
  295. OUT HBITMAP * phLargeImage,
  296. OUT COLORREF * prgbMask
  297. );
  298. //
  299. // Helpers
  300. //
  301. protected:
  302. HRESULT GetStringHelper(UINT nStringID, LPOLESTR * lpString);
  303. HBITMAP m_hSmallImage, m_hLargeImage;
  304. HICON m_hSnapinIcon;
  305. };
  306. //
  307. // Inline Expansion
  308. //
  309. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  310. inline HRESULT CInetMgrAbout::GetSnapinDescription(
  311. OUT LPOLESTR * lpDescription
  312. )
  313. {
  314. return GetStringHelper(IDS_INETMGR_DESC, lpDescription);
  315. }
  316. inline HRESULT CInetMgrAbout::GetProvider(
  317. OUT LPOLESTR * lpName
  318. )
  319. {
  320. return GetStringHelper(IDS_INETMGR_PROVIDER, lpName);
  321. }
  322. #endif // __INETMGR_H__