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.

181 lines
5.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2002.
  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) // security review BryanWal 2/20/2002 ok
  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. CString m_szCertTemplatePath;
  101. int m_nSortColumn;
  102. void SetTextNotAvailable ();
  103. protected:
  104. virtual HRESULT OnNotifyRename(
  105. LPDATAOBJECT lpDataObject,
  106. LPARAM arg,
  107. LPARAM param);
  108. HRESULT EnumerateTemplates (IDirectoryObject* pTemplateContObj,
  109. const BSTR bszTemplateContainerPath);
  110. HRESULT AddEnterpriseTemplates ();
  111. HRESULT DeleteCertTemplateFromResultPane (
  112. CCertTemplate* pCertTemplate,
  113. LPDATAOBJECT pDataObject);
  114. HRESULT DeleteCookie (
  115. CCertTmplCookie* pCookie,
  116. LPDATAOBJECT pDataObject,
  117. bool bRequestConfirmation,
  118. bool bIsMultipleSelect);
  119. HRESULT RefreshResultItem (CCertTmplCookie* pCookie);
  120. CCertTmplCookie* ConvertCookie (LPDATAOBJECT pDataObject);
  121. HRESULT OnNotifyCutOrMove (LPARAM arg);
  122. HRESULT SaveWidths (CCertTmplCookie* pCookie);
  123. HRESULT LoadColumnsFromArrays (CertTmplObjectType objecttype);
  124. STDMETHOD(Initialize)(LPCONSOLE lpConsole);
  125. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, BSTR* ppViewType, long* pViewOptions);
  126. HRESULT OnNotifyQueryPaste (LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  127. HRESULT OnNotifyPaste (LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  128. STDMETHOD(Notify)(LPDATAOBJECT pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  129. virtual HRESULT OnNotifyDelete (LPDATAOBJECT pDataObject);
  130. virtual HRESULT OnNotifyRefresh (LPDATAOBJECT pDataObject);
  131. virtual HRESULT OnNotifySelect( LPDATAOBJECT pDataObject, BOOL fSelected);
  132. virtual HRESULT OnNotifySnapinHelp (LPDATAOBJECT pDataObject);
  133. virtual HRESULT OnNotifyDblClick( LPDATAOBJECT pDataObject );
  134. }; // class CCertTmplComponent
  135. // Enumeration for the icons used
  136. enum
  137. {
  138. iIconDefault = 0,
  139. iIconCertTemplateV1,
  140. iIconCertTemplateV2,
  141. iIconLast // Must be last
  142. };
  143. typedef enum _COLNUM_CERT_TEMPLATES {
  144. COLNUM_CERT_TEMPLATE_OBJECT = 0,
  145. COLNUM_CERT_TEMPLATE_TYPE,
  146. COLNUM_CERT_TEMPLATE_VERSION,
  147. COLNUM_CERT_TEMPLATE_AUTOENROLL_STATUS,
  148. CERT_TEMPLATES_NUM_COLS // always last
  149. } COLNUM_CERT_TEMPLATES;
  150. #endif // ~__CMPONENT_H_INCLUDED__