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.

144 lines
3.6 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: Signers.h
  4. Content: Declaration of CSigners.
  5. History: 11-15-99 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __SIGNERS_H_
  8. #define __SIGNERS_H_
  9. #include "Resource.h"
  10. #include "Lock.h"
  11. #include "Debug.h"
  12. #include "CopyItem.h"
  13. ////////////////////
  14. //
  15. // Locals
  16. //
  17. //
  18. // typdefs to make life easier.
  19. //
  20. typedef std::map<CComBSTR, CComPtr<ISigner2> > SignerMap;
  21. typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _CopyMapItem<ISigner2>, SignerMap> SignerEnum;
  22. typedef ICollectionOnSTLImpl<ISigners, SignerMap, VARIANT, _CopyMapItem<ISigner2>, SignerEnum> ISignersCollection;
  23. ////////////////////////////////////////////////////////////////////////////////
  24. //
  25. // Exported functions.
  26. //
  27. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  28. Function : CreateSignersObject
  29. Synopsis : Create an ISigners collection object, and load the object with
  30. signers from the specified signed message for a specified level.
  31. Parameter: HCRYPTMSG hMsg - Message handle.
  32. DWORD dwLevel - Signature level (1 based).
  33. HCERTSTORE hStore - Additional store.
  34. DWORD dwCurrentSafety - Current safety setting.
  35. ISigners ** ppISigners - Pointer to pointer ISigners to receive
  36. interface pointer.
  37. Remark :
  38. ------------------------------------------------------------------------------*/
  39. HRESULT CreateSignersObject (HCRYPTMSG hMsg,
  40. DWORD dwLevel,
  41. HCERTSTORE hStore,
  42. DWORD dwCurrentSafety,
  43. ISigners ** ppISigners);
  44. ////////////////////////////////////////////////////////////////////////////////
  45. //
  46. // CSigners
  47. //
  48. class ATL_NO_VTABLE CSigners :
  49. public CComObjectRootEx<CComMultiThreadModel>,
  50. public CComCoClass<CSigners, &CLSID_Signers>,
  51. public IDispatchImpl<ISignersCollection, &IID_ISigners, &LIBID_CAPICOM,
  52. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  53. {
  54. public:
  55. CSigners()
  56. {
  57. }
  58. DECLARE_NO_REGISTRY()
  59. DECLARE_GET_CONTROLLING_UNKNOWN()
  60. DECLARE_PROTECT_FINAL_CONSTRUCT()
  61. BEGIN_COM_MAP(CSigners)
  62. COM_INTERFACE_ENTRY(ISigners)
  63. COM_INTERFACE_ENTRY(IDispatch)
  64. END_COM_MAP()
  65. BEGIN_CATEGORY_MAP(CSigners)
  66. END_CATEGORY_MAP()
  67. HRESULT FinalConstruct()
  68. {
  69. HRESULT hr;
  70. if (FAILED(hr = m_Lock.Initialized()))
  71. {
  72. DebugTrace("Error [%#x]: Critical section could not be created for Attributes object.\n", hr);
  73. return hr;
  74. }
  75. m_dwCurrentSafety = 0;
  76. return S_OK;
  77. }
  78. //
  79. // ISigners
  80. //
  81. public:
  82. //
  83. // These are the only ones that we need to implemented, others will be
  84. // handled by ATL ICollectionOnSTLImpl.
  85. //
  86. //
  87. // None COM functions.
  88. //
  89. STDMETHOD(Add)
  90. (PCCERT_CONTEXT pCertContext,
  91. CRYPT_ATTRIBUTES * pAuthAttrs,
  92. PCCERT_CHAIN_CONTEXT pChainContext);
  93. STDMETHOD(LoadMsgSigners)
  94. (HCRYPTMSG hMsg,
  95. DWORD dwLevel,
  96. HCERTSTORE hStore,
  97. DWORD dwCurrentSafety);
  98. #if (0)
  99. STDMETHOD(LoadCodeSigners)
  100. (CRYPT_PROVIDER_DATA * pProvData);
  101. #endif
  102. private:
  103. CLock m_Lock;
  104. DWORD m_dwCurrentSafety;
  105. };
  106. #endif //__SIGNERS_H_