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.

129 lines
3.3 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows
  3. Copyright (C) Microsoft Corporation, 1995 - 1999.
  4. File: OIDs.h
  5. Content: Declaration of COIDs.
  6. History: 06-15-2001 dsie created
  7. ------------------------------------------------------------------------------*/
  8. #ifndef __OIDs_H_
  9. #define __OIDs_H_
  10. #include "Resource.h"
  11. #include "Lock.h"
  12. #include "Debug.h"
  13. #include "CopyItem.h"
  14. #include "OID.h"
  15. //
  16. // typdefs to make life easier.
  17. //
  18. typedef std::map<CComBSTR, CComPtr<IOID> > OIDMap;
  19. typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _CopyMapItem<IOID>, OIDMap> OIDEnum;
  20. typedef ICollectionOnSTLImpl<IOIDs, OIDMap, VARIANT, _CopyMapItem<IOID>, OIDEnum> IOIDsCollection;
  21. ////////////////////////////////////////////////////////////////////////////////
  22. //
  23. // Exported functions.
  24. //
  25. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26. Function : CreateOIDsObject
  27. Synopsis : Create and initialize an IOIDs collection object.
  28. Parameter: PCERT_ENHKEY_USAGE pUsages - Pointer to CERT_ENHKEY_USAGE used to
  29. initialize the OIDs collection.
  30. BOOL bCertPolicies - TRUE for certificate policies, else
  31. application policies is assumed.
  32. IOIDs ** ppIOIDs - Pointer to pointer to IOIDs to receive the
  33. interface pointer.
  34. Remark :
  35. ------------------------------------------------------------------------------*/
  36. HRESULT CreateOIDsObject (PCERT_ENHKEY_USAGE pUsages,
  37. BOOL bCertPolicies,
  38. IOIDs ** ppIOIDs);
  39. ////////////////////////////////////////////////////////////////////////////////
  40. //
  41. // COIDs
  42. //
  43. class ATL_NO_VTABLE COIDs :
  44. public CComObjectRootEx<CComMultiThreadModel>,
  45. public CComCoClass<COIDs, &CLSID_OIDs>,
  46. public ICAPICOMError<COIDs, &IID_IOIDs>,
  47. public IDispatchImpl<IOIDsCollection, &IID_IOIDs, &LIBID_CAPICOM,
  48. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  49. {
  50. public:
  51. COIDs()
  52. {
  53. }
  54. DECLARE_NO_REGISTRY()
  55. DECLARE_PROTECT_FINAL_CONSTRUCT()
  56. BEGIN_COM_MAP(COIDs)
  57. COM_INTERFACE_ENTRY(IOIDs)
  58. COM_INTERFACE_ENTRY(IDispatch)
  59. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  60. END_COM_MAP()
  61. BEGIN_CATEGORY_MAP(COIDs)
  62. END_CATEGORY_MAP()
  63. HRESULT FinalConstruct()
  64. {
  65. HRESULT hr;
  66. if (FAILED(hr = m_Lock.Initialized()))
  67. {
  68. DebugTrace("Error [%#x]: Critical section could not be created for OIDs object.\n", hr);
  69. return hr;
  70. }
  71. return S_OK;
  72. }
  73. //
  74. // IOIDs
  75. //
  76. public:
  77. //
  78. // These are the only ones that we need to implemented, others will be
  79. // handled by ATL ICollectionOnSTLImpl.
  80. //
  81. STDMETHOD(get_Item)
  82. (VARIANT Index, VARIANT * pVal);
  83. STDMETHOD(Add)
  84. (/*[in]*/ IOID * pVal);
  85. STDMETHOD(Remove)
  86. (/*[in]*/ VARIANT Index);
  87. STDMETHOD(Clear)
  88. (void);
  89. //
  90. // C++ member function needed to initialize the object.
  91. //
  92. STDMETHOD(Init)
  93. (PCERT_ENHKEY_USAGE pUsages, BOOL bCertPolicies);
  94. private:
  95. CLock m_Lock;
  96. };
  97. #endif //__OIDS_H_