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.

124 lines
3.4 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: Extensions.h
  4. Content: Declaration of CExtensions.
  5. History: 06-15-2001 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __EXTENSIONS_H_
  8. #define __EXTENSIONS_H_
  9. #include "Resource.h"
  10. #include "Lock.h"
  11. #include "Debug.h"
  12. #include "Error.h"
  13. #include "CopyItem.h"
  14. #include "Extension.h"
  15. //
  16. // typdefs to make life easier.
  17. //
  18. typedef std::map<CComBSTR, CComPtr<IExtension> > ExtensionMap;
  19. typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _CopyMapItem<IExtension>, ExtensionMap> ExtensionEnum;
  20. typedef ICollectionOnSTLImpl<IExtensions, ExtensionMap, VARIANT, _CopyMapItem<IExtension>, ExtensionEnum> IExtensionsCollection;
  21. ////////////////////////////////////////////////////////////////////////////////
  22. //
  23. // Exported functions.
  24. //
  25. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26. Function : CreateExtensionsObject
  27. Synopsis : Create an IExtensions collection object, and load the object with
  28. Extensions from the specified location.
  29. Parameter: PCCERT_CONTEXT pCertContext - Pointer to CERT_CONTEXT to be used
  30. to initialize the IExtensions object.
  31. IExtensions ** ppIExtensions - Pointer to pointer IExtensions
  32. to recieve the interface pointer.
  33. Remark :
  34. ------------------------------------------------------------------------------*/
  35. HRESULT CreateExtensionsObject (PCCERT_CONTEXT pCertContext,
  36. IExtensions ** ppIExtensions);
  37. ////////////////////////////////////////////////////////////////////////////////
  38. //
  39. // CExtensions
  40. //
  41. class ATL_NO_VTABLE CExtensions :
  42. public CComObjectRootEx<CComMultiThreadModel>,
  43. public CComCoClass<CExtensions, &CLSID_Extensions>,
  44. public ICAPICOMError<CExtensions, &IID_IExtensions>,
  45. public IDispatchImpl<IExtensionsCollection, &IID_IExtensions, &LIBID_CAPICOM,
  46. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  47. {
  48. public:
  49. CExtensions()
  50. {
  51. }
  52. HRESULT FinalConstruct()
  53. {
  54. HRESULT hr;
  55. if (FAILED(hr = m_Lock.Initialized()))
  56. {
  57. DebugTrace("Error [%#x]: Critical section could not be created for Extensions object.\n", hr);
  58. return hr;
  59. }
  60. return S_OK;
  61. }
  62. DECLARE_NO_REGISTRY()
  63. DECLARE_GET_CONTROLLING_UNKNOWN()
  64. DECLARE_PROTECT_FINAL_CONSTRUCT()
  65. BEGIN_COM_MAP(CExtensions)
  66. COM_INTERFACE_ENTRY(IExtensions)
  67. COM_INTERFACE_ENTRY(IDispatch)
  68. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  69. END_COM_MAP()
  70. BEGIN_CATEGORY_MAP(CExtensions)
  71. END_CATEGORY_MAP()
  72. //
  73. // IExtensions
  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(get_Item)
  81. (/*[in] */ VARIANT Index,
  82. /*[out, retval]*/ VARIANT * pVal);
  83. //
  84. // None COM functions.
  85. //
  86. STDMETHOD(Init)
  87. (DWORD cExtensions,
  88. PCERT_EXTENSION rgExtensions);
  89. private:
  90. CLock m_Lock;
  91. };
  92. #endif //__EXTENSIONS_H_