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.

125 lines
3.1 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: Recipients.h
  4. Content: Declaration of CRecipients.
  5. History: 11-15-99 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __RECIPIENTS_H_
  8. #define __RECIPIENTS_H_
  9. #include "Resource.h"
  10. #include "Lock.h"
  11. #include "Error.h"
  12. #include "Debug.h"
  13. #include "Certificate.h"
  14. ////////////////////
  15. //
  16. // Locals
  17. //
  18. //
  19. // typdefs to make life easier.
  20. //
  21. typedef std::map<CComBSTR, CComPtr<ICertificate> > RecipientMap;
  22. typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _CopyMapItem<ICertificate>, RecipientMap> RecipientEnum;
  23. typedef ICollectionOnSTLImpl<IRecipients, RecipientMap, VARIANT, _CopyMapItem<ICertificate>, RecipientEnum> IRecipientsCollection;
  24. ////////////////////////////////////////////////////////////////////////////////
  25. //
  26. // Exported functions.
  27. //
  28. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29. Function : CreateRecipientsObject
  30. Synopsis : Create and initialize an IRecipients collection object.
  31. Parameter: IRecipients ** ppIRecipients - Pointer to pointer to IRecipients
  32. to receive the interface pointer.
  33. Remark :
  34. ------------------------------------------------------------------------------*/
  35. HRESULT CreateRecipientsObject (IRecipients ** ppIRecipients);
  36. ////////////////////////////////////////////////////////////////////////////////
  37. //
  38. // CRecipients
  39. //
  40. class ATL_NO_VTABLE CRecipients :
  41. public CComObjectRootEx<CComMultiThreadModel>,
  42. public CComCoClass<CRecipients, &CLSID_Recipients>,
  43. public ICAPICOMError<CRecipients, &IID_IRecipients>,
  44. public IDispatchImpl<IRecipientsCollection, &IID_IRecipients, &LIBID_CAPICOM,
  45. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  46. {
  47. public:
  48. CRecipients()
  49. {
  50. }
  51. DECLARE_NO_REGISTRY()
  52. DECLARE_GET_CONTROLLING_UNKNOWN()
  53. DECLARE_PROTECT_FINAL_CONSTRUCT()
  54. BEGIN_COM_MAP(CRecipients)
  55. COM_INTERFACE_ENTRY(IRecipients)
  56. COM_INTERFACE_ENTRY(IDispatch)
  57. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  58. END_COM_MAP()
  59. BEGIN_CATEGORY_MAP(CRecipients)
  60. END_CATEGORY_MAP()
  61. HRESULT FinalConstruct()
  62. {
  63. HRESULT hr;
  64. if (FAILED(hr = m_Lock.Initialized()))
  65. {
  66. DebugTrace("Error [%#x]: Critical section could not be created for Recipients object.\n", hr);
  67. return hr;
  68. }
  69. m_dwNextIndex = 0;
  70. return S_OK;
  71. }
  72. //
  73. // IRecipients
  74. //
  75. public:
  76. //
  77. // These are the only ones that we need to implemented, others will be
  78. // handled by ATL ICollectionOnSTLImpl.
  79. //
  80. STDMETHOD(Clear)
  81. (void);
  82. STDMETHOD(Remove)
  83. (/*[in]*/ long Index);
  84. STDMETHOD(Add)
  85. (/*[in]*/ ICertificate * pVal);
  86. private:
  87. CLock m_Lock;
  88. DWORD m_dwNextIndex;
  89. };
  90. #endif //__RECIPIENTS_H_