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.

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