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.

247 lines
7.1 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) Microsoft Corporation, 1995 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. // Compdata.h : Declaration of the CComponentDataImpl
  9. #ifndef _COMPDATA_H_
  10. #define _COMPDATA_H_
  11. #include "resource.h" // main symbols
  12. #ifndef __mmc_h__
  13. #include <mmc.h>
  14. #endif
  15. class CFolder;
  16. // Note - This is the offset in my image list that represents the folder
  17. enum IMAGE_INDEXES
  18. {
  19. IMGINDEX_FOLDER = 0,
  20. IMGINDEX_FOLDER_OPEN,
  21. IMGINDEX_CERTTYPE
  22. };
  23. // Event Values
  24. #define IDC_STOPSERVER 0x100
  25. #define IDC_STARTSERVER 0x101
  26. #ifdef DBX
  27. void DbxPrint(LPTSTR pszFmt, ...)
  28. {
  29. va_list va;
  30. va_start (va, pszFmt);
  31. TCHAR buf[250];
  32. wsprintf(buf, pszFmt, va);
  33. OutputDebugString(buf);
  34. va_end(va);
  35. }
  36. //#define DBX_PRINT DbxPrint
  37. inline void __DummyTrace(LPTSTR, ...) { }
  38. #define DBX_PRINT 1 ? (void)0 : ::__DummyTrace
  39. #else
  40. inline void __DummyTrace(LPTSTR, ...) { }
  41. #define DBX_PRINT 1 ? (void)0 : ::__DummyTrace
  42. #endif
  43. #define HTMLHELP_FILENAME L"cs.chm"
  44. #define HTMLHELP_COLLECTION_FILENAME L"\\help\\" HTMLHELP_FILENAME
  45. #define HTMLHELP_COLLECTIONLINK_FILENAME L"\\help\\csconcepts.chm"
  46. #define SZ_VERB_OPEN L"open"
  47. #define SZ_CERTTMPL_MSC L"certtmpl.msc"
  48. CONTEXTMENUITEM menuItems[];
  49. CONTEXTMENUITEM viewItems[];
  50. class CComponentDataImpl:
  51. public IComponentData,
  52. public IExtendPropertySheet,
  53. public IExtendContextMenu,
  54. public IPersistStream,
  55. public CComObjectRoot,
  56. public ISnapinHelp2
  57. {
  58. BEGIN_COM_MAP(CComponentDataImpl)
  59. COM_INTERFACE_ENTRY(IComponentData)
  60. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  61. COM_INTERFACE_ENTRY(IExtendContextMenu)
  62. COM_INTERFACE_ENTRY(IPersistStream)
  63. COM_INTERFACE_ENTRY(ISnapinHelp2)
  64. END_COM_MAP()
  65. friend class CSnapin;
  66. friend class CDataObject;
  67. CComponentDataImpl();
  68. ~CComponentDataImpl();
  69. public:
  70. virtual const CLSID& GetCoClassID() = 0;
  71. virtual const BOOL IsPrimaryImpl() = 0;
  72. public:
  73. // ISnapinHelp2 interface members
  74. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompiledHelpFile);
  75. STDMETHOD(GetLinkedTopics)(LPOLESTR* lpCompiledHelpFiles);
  76. // IComponentData interface members
  77. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  78. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  79. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  80. STDMETHOD(Destroy)();
  81. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  82. STDMETHOD(GetDisplayInfo)(SCOPEDATAITEM* pScopeDataItem);
  83. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  84. // IExtendPropertySheet interface
  85. public:
  86. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider,
  87. LONG_PTR handle,
  88. LPDATAOBJECT lpIDataObject);
  89. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  90. // IExtendContextMenu
  91. public:
  92. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK pCallbackUnknown,
  93. long *pInsertionAllowed);
  94. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  95. public:
  96. // IPersistStream interface members
  97. //STDMETHOD(GetClassID)(CLSID *pClassID);
  98. STDMETHOD(IsDirty)();
  99. STDMETHOD(Load)(IStream *pStm);
  100. STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty);
  101. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize);
  102. #if DBG
  103. bool m_bInitializedCD;
  104. bool m_bLoadedCD;
  105. bool m_bDestroyedCD;
  106. #endif
  107. // Notify handler declarations
  108. private:
  109. HRESULT OnDelete(MMC_COOKIE cookie);
  110. HRESULT OnRemoveChildren(LPARAM arg);
  111. HRESULT OnRename(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  112. HRESULT OnExpand(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param);
  113. HRESULT OnSelect(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  114. HRESULT OnProperties(LPARAM param);
  115. #if DBG==1
  116. public:
  117. ULONG InternalAddRef()
  118. {
  119. return CComObjectRoot::InternalAddRef();
  120. }
  121. ULONG InternalRelease()
  122. {
  123. return CComObjectRoot::InternalRelease();
  124. }
  125. #endif // DBG==1
  126. // Scope item creation helpers
  127. private:
  128. CFolder* FindObject(MMC_COOKIE cookie);
  129. void DeleteList();
  130. BOOL IsScopePaneNode(LPDATAOBJECT lpDataObject);
  131. private:
  132. LPCONSOLENAMESPACE m_pScope; // My interface pointer to the scope pane
  133. LPCONSOLE2 m_pConsole; // My interface pointer to the console
  134. HSCOPEITEM m_pStaticRoot;
  135. BOOL m_bIsDirty;
  136. void SetDirty(BOOL b = TRUE) { m_bIsDirty = b; }
  137. void ClearDirty() { m_bIsDirty = FALSE; }
  138. BOOL ThisIsDirty() { return m_bIsDirty; }
  139. void AddScopeItemToResultPane(MMC_COOKIE cookie);
  140. ////////
  141. // persist
  142. enum
  143. { // Bit fields for m_dwFlagsPersist
  144. mskfAllowOverrideMachineName = 0x0001
  145. };
  146. DWORD m_dwFlagsPersist; // General-purpose flags to be persisted into .msc file
  147. BOOL m_fAllowOverrideMachineName; // TRUE => Allow the machine name to be overriden by the command line
  148. void SetPersistentFlags(DWORD dwFlags)
  149. {
  150. m_dwFlagsPersist = dwFlags;
  151. m_fAllowOverrideMachineName = (m_dwFlagsPersist & mskfAllowOverrideMachineName);
  152. }
  153. DWORD GetPersistentFlags()
  154. {
  155. if (m_fAllowOverrideMachineName)
  156. m_dwFlagsPersist |= mskfAllowOverrideMachineName;
  157. else
  158. m_dwFlagsPersist &= ~mskfAllowOverrideMachineName;
  159. return m_dwFlagsPersist;
  160. }
  161. // end persist
  162. ///////////////
  163. HRESULT StartCertificateTemplatesSnapin();
  164. public:
  165. HRESULT GetCreateFolderHRESULT() { return m_hrCreateFolder; };
  166. private:
  167. CList<CFolder*, CFolder*> m_scopeItemList;
  168. bool m_fAdvancedServer;
  169. HRESULT m_hrCreateFolder;
  170. #ifdef _DEBUG
  171. friend class CDataObject;
  172. int m_cDataObjects;
  173. #endif
  174. };
  175. class CComponentDataPolicySettings : public CComponentDataImpl,
  176. public CComCoClass<CComponentDataPolicySettings, &CLSID_CAPolicyExtensionSnapIn>
  177. {
  178. public:
  179. DECLARE_REGISTRY(CSnapin, _T("Snapin.PolicySettings.1"), _T("Snapin.PolicySettings"), IDS_SNAPIN_DESC, THREADFLAGS_APARTMENT)
  180. virtual const CLSID & GetCoClassID() { return CLSID_CAPolicyExtensionSnapIn; }
  181. virtual const BOOL IsPrimaryImpl() { return TRUE; }
  182. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  183. {
  184. *pClassID = CLSID_CAPolicyExtensionSnapIn;
  185. return S_OK;
  186. }
  187. };
  188. class CComponentDataGPEExtension : public CComponentDataImpl,
  189. public CComCoClass<CComponentDataGPEExtension, &CLSID_CACertificateTemplateManager>
  190. {
  191. public:
  192. // reid fix - IDS_SNAPIN_DESC is not right here
  193. DECLARE_REGISTRY(CSnapin, _T("Snapin.CertTempMgr.1"), _T("Snapin.CertTempMgr"), IDS_SNAPIN_DESC, THREADFLAGS_APARTMENT)
  194. virtual const CLSID & GetCoClassID() { return CLSID_CACertificateTemplateManager; }
  195. virtual const BOOL IsPrimaryImpl() { return TRUE; }
  196. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  197. {
  198. *pClassID = CLSID_CACertificateTemplateManager;
  199. return S_OK;
  200. }
  201. };
  202. #endif // #define _COMPDATA_H_