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.

180 lines
5.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: cmponent.h
  7. //
  8. // Contents: CCertTmplComponent
  9. //
  10. //----------------------------------------------------------------------------
  11. // cmponent.h : Declaration of CCertTmplComponent
  12. #ifndef __CMPONENT_H_INCLUDED__
  13. #define __CMPONENT_H_INCLUDED__
  14. #include "cookie.h" // CCertTmplCookie
  15. #include "CertTemplate.h" // CCertTemplate
  16. #define UPDATE_HINT_ENUM_CERT_TEMPLATES 0x01
  17. enum {
  18. IDM_CLONE_TEMPLATE = 101,
  19. IDM_REENROLL_ALL_CERTS,
  20. IDM_VIEW_OIDS
  21. };
  22. // forward declarations
  23. class CCertTmplComponentData;
  24. class CCertTmplComponent :
  25. public CComponent,
  26. public IExtendContextMenu,
  27. public ICertTemplatesSnapin,
  28. public IExtendPropertySheet,
  29. public IResultDataCompareEx,
  30. public PersistStream
  31. {
  32. public:
  33. CCertTmplComponent();
  34. virtual ~CCertTmplComponent();
  35. BEGIN_COM_MAP(CCertTmplComponent)
  36. COM_INTERFACE_ENTRY(ICertTemplatesSnapin)
  37. COM_INTERFACE_ENTRY(IExtendContextMenu)
  38. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  39. COM_INTERFACE_ENTRY(IResultDataCompareEx)
  40. COM_INTERFACE_ENTRY(IPersistStream)
  41. COM_INTERFACE_ENTRY_CHAIN(CComponent)
  42. END_COM_MAP()
  43. #if DBG==1
  44. ULONG InternalAddRef()
  45. {
  46. return CComObjectRoot::InternalAddRef();
  47. }
  48. ULONG InternalRelease()
  49. {
  50. return CComObjectRoot::InternalRelease();
  51. }
  52. int dbg_InstID;
  53. #endif // DBG==1
  54. // IExtendContextMenu
  55. public:
  56. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject,
  57. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  58. long *pInsertionAllowed);
  59. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  60. // IResultDataCompareEx
  61. STDMETHOD(Compare)(RDCOMPARE* prdc, int* pnResult);
  62. // IComponent implemented in CComponent
  63. // support methods for IComponent
  64. virtual HRESULT ReleaseAll();
  65. virtual HRESULT OnPropertyChange( LPARAM param );
  66. virtual HRESULT OnViewChange (LPDATAOBJECT pDataObject, LPARAM data, LPARAM hint);
  67. virtual HRESULT Show(CCookie* pcookie, LPARAM arg, HSCOPEITEM hScopeItem, LPDATAOBJECT pDataObject);
  68. virtual HRESULT Show(CCookie* pcookie, LPARAM arg, HSCOPEITEM hScopeItem);
  69. virtual HRESULT OnNotifyAddImages( LPDATAOBJECT pDataObject,
  70. LPIMAGELIST lpImageList,
  71. HSCOPEITEM hSelectedItem );
  72. virtual HRESULT OnNotifyColumnClick (LPDATAOBJECT pDataObject,
  73. LPARAM iColumn,
  74. LPARAM uFlags);
  75. HRESULT PopulateListbox(CCertTmplCookie* pcookie);
  76. HRESULT RefreshResultPane(const bool bSilent);
  77. static HRESULT LoadStrings();
  78. HRESULT LoadColumns( CCertTmplCookie* pcookie );
  79. CCertTmplComponentData& QueryComponentDataRef()
  80. {
  81. return (CCertTmplComponentData&)QueryBaseComponentDataRef();
  82. }
  83. public:
  84. STDMETHOD(GetDisplayInfo)(RESULTDATAITEM* pResultDataItem);
  85. CCertTmplCookie* m_pViewedCookie; // CODEWORK I hate to have to do this...
  86. inline CCertTmplCookie* ActiveCookie( CCookie* pBaseCookie )
  87. {
  88. return (CCertTmplCookie*)ActiveBaseCookie( pBaseCookie );
  89. }
  90. // IExtendPropertySheet
  91. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK pCall, LONG_PTR handle, LPDATAOBJECT pDataObject);
  92. STDMETHOD(QueryPagesFor)(LPDATAOBJECT pDataObject);
  93. // PersistStream
  94. HRESULT STDMETHODCALLTYPE Load(IStream __RPC_FAR *pStg);
  95. HRESULT STDMETHODCALLTYPE Save(IStream __RPC_FAR *pStgSave, BOOL fSameAsLoad);
  96. private:
  97. CertTmplObjectType m_currResultNodeType;
  98. CString m_szDisplayInfoResult;
  99. UINT* m_ColumnWidths[CERTTMPL_NUMTYPES];
  100. void SetTextNotAvailable ();
  101. protected:
  102. virtual HRESULT OnNotifyRename(
  103. LPDATAOBJECT lpDataObject,
  104. LPARAM arg,
  105. LPARAM param);
  106. HRESULT EnumerateTemplates (IDirectoryObject* pTemplateContObj,
  107. const BSTR bszTemplateContainerPath);
  108. HRESULT AddEnterpriseTemplates ();
  109. HRESULT DeleteCertTemplateFromResultPane (
  110. CCertTemplate* pCertTemplate,
  111. LPDATAOBJECT pDataObject);
  112. HRESULT DeleteCookie (
  113. CCertTmplCookie* pCookie,
  114. LPDATAOBJECT pDataObject,
  115. bool bRequestConfirmation,
  116. bool bIsMultipleSelect);
  117. HRESULT RefreshResultItem (CCertTmplCookie* pCookie);
  118. CCertTmplCookie* ConvertCookie (LPDATAOBJECT pDataObject);
  119. HRESULT OnNotifyCutOrMove (LPARAM arg);
  120. HRESULT SaveWidths (CCertTmplCookie* pCookie);
  121. HRESULT LoadColumnsFromArrays (CertTmplObjectType objecttype);
  122. STDMETHOD(Initialize)(LPCONSOLE lpConsole);
  123. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, BSTR* ppViewType, long* pViewOptions);
  124. HRESULT OnNotifyQueryPaste (LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  125. HRESULT OnNotifyPaste (LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  126. void DisplayAccessDenied();
  127. STDMETHOD(Notify)(LPDATAOBJECT pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  128. virtual HRESULT OnNotifyDelete (LPDATAOBJECT pDataObject);
  129. virtual HRESULT OnNotifyRefresh (LPDATAOBJECT pDataObject);
  130. virtual HRESULT OnNotifySelect( LPDATAOBJECT pDataObject, BOOL fSelected);
  131. virtual HRESULT OnNotifySnapinHelp (LPDATAOBJECT pDataObject);
  132. virtual HRESULT OnNotifyDblClick( LPDATAOBJECT pDataObject );
  133. }; // class CCertTmplComponent
  134. // Enumeration for the icons used
  135. enum
  136. {
  137. iIconDefault = 0,
  138. iIconCertTemplateV1,
  139. iIconCertTemplateV2,
  140. iIconLast // Must be last
  141. };
  142. typedef enum _COLNUM_CERT_TEMPLATES {
  143. COLNUM_CERT_TEMPLATE_OBJECT = 0,
  144. COLNUM_CERT_TEMPLATE_TYPE,
  145. COLNUM_CERT_TEMPLATE_VERSION,
  146. COLNUM_CERT_TEMPLATE_AUTOENROLL_STATUS,
  147. CERT_TEMPLATES_NUM_COLS // always last
  148. } COLNUM_CERT_TEMPLATES;
  149. #endif // ~__CMPONENT_H_INCLUDED__