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.1 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: Extension.h
  4. Content: Declaration of the CExtension.
  5. History: 06-15-2001 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __EXTENSION_H_
  8. #define __EXTENSION_H_
  9. #include "Resource.h"
  10. #include "Lock.h"
  11. #include "Error.h"
  12. #include "Debug.h"
  13. ////////////////////////////////////////////////////////////////////////////////
  14. //
  15. // Exported functions.
  16. //
  17. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  18. Function : CreateExtensionObject
  19. Synopsis : Create an IExtension object.
  20. Parameter: PCERT_EXTENSION pCertExtension - Pointer to CERT_EXTENSION to be
  21. used to initialize the IExtension
  22. object.
  23. IExtension ** ppIExtension - Pointer to pointer IExtension object.
  24. Remark :
  25. ------------------------------------------------------------------------------*/
  26. HRESULT CreateExtensionObject (PCERT_EXTENSION pCertExtension,
  27. IExtension ** ppIExtension);
  28. ////////////////////////////////////////////////////////////////////////////////
  29. //
  30. // CExtension
  31. //
  32. class ATL_NO_VTABLE CExtension :
  33. public CComObjectRootEx<CComMultiThreadModel>,
  34. public CComCoClass<CExtension, &CLSID_Extension>,
  35. public ICAPICOMError<CExtension, &IID_IExtension>,
  36. public IDispatchImpl<IExtension, &IID_IExtension, &LIBID_CAPICOM,
  37. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  38. {
  39. public:
  40. CExtension()
  41. {
  42. }
  43. HRESULT FinalConstruct()
  44. {
  45. HRESULT hr;
  46. if (FAILED(hr = m_Lock.Initialized()))
  47. {
  48. DebugTrace("Error [%#x]: Critical section could not be created for Extension object.\n", hr);
  49. return hr;
  50. }
  51. m_pIOID = NULL;
  52. m_pIEncodedData = NULL;
  53. m_bIsCritical = VARIANT_FALSE;
  54. return S_OK;
  55. }
  56. void FinalRelease()
  57. {
  58. m_pIOID.Release();
  59. m_pIEncodedData.Release();
  60. }
  61. DECLARE_NO_REGISTRY()
  62. DECLARE_PROTECT_FINAL_CONSTRUCT()
  63. BEGIN_COM_MAP(CExtension)
  64. COM_INTERFACE_ENTRY(IExtension)
  65. COM_INTERFACE_ENTRY(IDispatch)
  66. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  67. END_COM_MAP()
  68. BEGIN_CATEGORY_MAP(CExtension)
  69. END_CATEGORY_MAP()
  70. //
  71. // IExtension
  72. //
  73. public:
  74. STDMETHOD(get_OID)
  75. (/*[out, retval]*/ IOID ** pVal);
  76. STDMETHOD(get_IsCritical)
  77. (/*[out, retval]*/ VARIANT_BOOL * pVal);
  78. STDMETHOD(get_EncodedData)
  79. (/*[out, retval]*/ IEncodedData ** pVal);
  80. //
  81. // None COM functions.
  82. //
  83. STDMETHOD(Init)
  84. (PCERT_EXTENSION pCertExtension);
  85. private:
  86. CLock m_Lock;
  87. VARIANT_BOOL m_bIsCritical;
  88. CComPtr<IOID> m_pIOID;
  89. CComPtr<IEncodedData> m_pIEncodedData;
  90. };
  91. #endif //__EXTENSION_H_