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.

218 lines
7.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2002.
  5. //
  6. // File: compdata.h
  7. //
  8. // Contents: CCertTmplComponentData
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __COMPDATA_H_INCLUDED__
  12. #define __COMPDATA_H_INCLUDED__
  13. #include "cmponent.h" // LoadIconsIntoImageList
  14. #include "cookie.h" // Added by ClassView
  15. #include "PolicyOID.h"
  16. class CCertTmplComponentData:
  17. public CComponentData,
  18. public IExtendContextMenu,
  19. public IExtendPropertySheet,
  20. public PersistStream,
  21. public CHasMachineName
  22. {
  23. friend CCertTmplComponent;
  24. public:
  25. CertTmplObjectType GetObjectType (LPDATAOBJECT pDataObject);
  26. // Use DECLARE_NOT_AGGREGATABLE(CCertTmplComponentData)
  27. // if you don't want your object to support aggregation
  28. //DECLARE_AGGREGATABLE(CCertTmplComponentData)
  29. //DECLARE_REGISTRY(CCertTmplComponentData, _T("CERTTMPL.CertTemplatesSnapinObject.1"), _T("CERTTMPL.CertTemplatesSnapinObject.1"), IDS_CERTTMPL_DESC , THREADFLAGS_BOTH)
  30. CCertTmplComponentData();
  31. virtual ~CCertTmplComponentData();
  32. BEGIN_COM_MAP(CCertTmplComponentData)
  33. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  34. COM_INTERFACE_ENTRY(IPersistStream) // security review BryanWal 2/20/2002 ok
  35. COM_INTERFACE_ENTRY_CHAIN(CComponentData)
  36. COM_INTERFACE_ENTRY(IExtendContextMenu)
  37. END_COM_MAP()
  38. #if DBG==1
  39. ULONG InternalAddRef()
  40. {
  41. return CComObjectRoot::InternalAddRef();
  42. }
  43. ULONG InternalRelease()
  44. {
  45. return CComObjectRoot::InternalRelease();
  46. }
  47. int dbg_InstID;
  48. #endif // DBG==1
  49. // IComponentData
  50. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  51. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  52. // IExtendPropertySheet
  53. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK pCall, LONG_PTR handle, LPDATAOBJECT pDataObject);
  54. STDMETHOD(QueryPagesFor)(LPDATAOBJECT pDataObject);
  55. // IExtendContextMenu
  56. public:
  57. CString m_szManagedDomain;
  58. CString m_szPreviousManagedDomain;
  59. CString m_szThisDomainDns;
  60. CString m_szThisDomainFlat;
  61. CString m_szManagedServerName;
  62. DWORD m_dwNumCertTemplates;
  63. bool m_fUseCache;
  64. HRESULT RefreshServer ();
  65. void RemoveResultCookies (LPRESULTDATA pResultData);
  66. CString GetThisComputer() const;
  67. void SetResultData (LPRESULTDATA pResultData);
  68. LPCONSOLENAMESPACE GetConsoleNameSpace () const;
  69. HRESULT RefreshScopePane (LPDATAOBJECT pDataObject);
  70. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject,
  71. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  72. long *pInsertionAllowed);
  73. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  74. HRESULT STDMETHODCALLTYPE Load(IStream __RPC_FAR *pStg);
  75. HRESULT STDMETHODCALLTYPE Save(IStream __RPC_FAR *pStgSave, BOOL fSameAsLoad);
  76. // needed for Initialize()
  77. virtual HRESULT LoadIcons(LPIMAGELIST pImageList, BOOL fLoadLargeIcons);
  78. // needed for Notify()
  79. virtual HRESULT OnNotifyExpand(LPDATAOBJECT pDataObject, BOOL bExpanding, HSCOPEITEM hParent);
  80. // needed for GetDisplayInfo(), must be defined by subclass
  81. virtual BSTR QueryResultColumnText(CCookie& basecookieref, int nCol );
  82. virtual int QueryImage(CCookie& basecookieref, BOOL fOpenImage);
  83. virtual CCookie& QueryBaseRootCookie();
  84. inline CCertTmplCookie* ActiveCookie( CCookie* pBaseCookie )
  85. {
  86. return (CCertTmplCookie*)ActiveBaseCookie( pBaseCookie );
  87. }
  88. inline CCertTmplCookie& QueryRootCookie()
  89. {
  90. return m_RootCookie;
  91. }
  92. virtual HRESULT OnNotifyRelease(LPDATAOBJECT pDataObject, HSCOPEITEM hItem);
  93. // CHasMachineName
  94. DECLARE_FORWARDS_MACHINE_NAME( (&m_RootCookie) )
  95. CStringList m_globalFriendlyNameList;
  96. CStringList m_globalTemplateNameList;
  97. protected:
  98. LPCONSOLE m_pComponentConsole;
  99. void OnViewOIDs ();
  100. HRESULT AddViewOIDsMenuItem (
  101. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  102. LONG lInsertionPointID);
  103. HRESULT ChangeRootNodeName();
  104. HRESULT AddCloneTemplateMenuItem(
  105. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  106. LONG lInsertionPointID);
  107. HRESULT AddReEnrollAllCertsMenuItem(
  108. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  109. LONG lInsertionPointID);
  110. HRESULT OnCloneTemplate (LPDATAOBJECT pDataObject);
  111. HRESULT OnReEnrollAllCerts (LPDATAOBJECT pDataObject);
  112. HRESULT AddCertTemplatePropPages (
  113. CCertTemplate* pCertTemplate,
  114. LPPROPERTYSHEETCALLBACK pCallback,
  115. LONG_PTR lNotifyHandle);
  116. HRESULT AddVersion1CertTemplatePropPages (CCertTemplate* pCertTemplate, LPPROPERTYSHEETCALLBACK pCallback);
  117. HRESULT AddVersion2CertTemplatePropPages (
  118. CCertTemplate* pCertTemplate,
  119. LPPROPERTYSHEETCALLBACK pCallback,
  120. LONG_PTR lNotifyHandle);
  121. HRESULT AddScopeNode (
  122. CCertTmplCookie* pCookie,
  123. HSCOPEITEM hParent);
  124. HRESULT AddSeparator (
  125. LPCONTEXTMENUCALLBACK pContextMenuCallback);
  126. CCertTmplCookie* ConvertCookie (
  127. LPDATAOBJECT pDataObject);
  128. HRESULT DeleteChildren (
  129. HSCOPEITEM hParent);
  130. HRESULT DeleteScopeItems ();
  131. void DisplaySystemError (
  132. DWORD dwErr);
  133. HRESULT ExpandScopeNodes (
  134. CCertTmplCookie* pParentCookie,
  135. HSCOPEITEM hParent,
  136. const GUID& guidObjectType,
  137. LPDATAOBJECT pDataObject = 0);
  138. HRESULT GetResultData (LPRESULTDATA* ppResultData);
  139. HRESULT IsUserAdministrator (
  140. BOOL& bIsAdministrator);
  141. virtual HRESULT OnPropertyChange (LPARAM param);
  142. HRESULT QueryMultiSelectDataObject(
  143. MMC_COOKIE cookie,
  144. DATA_OBJECT_TYPES type,
  145. LPDATAOBJECT* ppDataObject);
  146. HRESULT ReleaseResultCookie (
  147. CBaseCookieBlock * pResultCookie,
  148. CCookie& rootCookie,
  149. POSITION pos2);
  150. HRESULT OnNotifyPreload(
  151. LPDATAOBJECT pDataObject,
  152. HSCOPEITEM hRootScopeItem);
  153. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompiledHelpFile);
  154. HRESULT GetHtmlHelpFilePath( CString& strref ) const;
  155. LPHEADERCTRL m_pHeader;
  156. private:
  157. CString m_serverName;
  158. bool m_bMultipleObjectsSelected;
  159. BOOL m_bIsUserAdministrator;
  160. CString m_szThisComputer;
  161. CString m_szLoggedInUser;
  162. HSCOPEITEM m_hRootScopeItem;
  163. CCertTmplCookie m_RootCookie;
  164. LPRESULTDATA m_pResultData;
  165. bool m_bSchemaChecked;
  166. }; // CCertTmplComponentData
  167. /////////////////////////////////////////////////////////////////////
  168. class CCertTmplSnapin: public CCertTmplComponentData,
  169. public CComCoClass<CCertTmplSnapin, &CLSID_CertTemplatesSnapin>
  170. {
  171. public:
  172. CCertTmplSnapin() : CCertTmplComponentData () {};
  173. virtual ~CCertTmplSnapin() {};
  174. // Use DECLARE_NOT_AGGREGATABLE(CCertTmplSnapin) if you don't want your object
  175. // to support aggregation
  176. DECLARE_AGGREGATABLE(CCertTmplSnapin)
  177. DECLARE_REGISTRY(CCertTmplSnapin, _T("CERTTMPL.CertTemplatesSnapinObject.1"), _T("CERTTMPL.CertTemplatesSnapinObject.1"), IDS_CERTTMPL_DESC, THREADFLAGS_BOTH)
  178. virtual BOOL IsServiceSnapin() { return FALSE; }
  179. // IPersistStream or IPersistStorage
  180. STDMETHOD(GetClassID)(CLSID __RPC_FAR *pClassID)
  181. {
  182. *pClassID = CLSID_CertTemplatesSnapin;
  183. return S_OK;
  184. }
  185. };
  186. #endif // ~__COMPDATA_H_INCLUDED__