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.

122 lines
3.3 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: PolicyInformation.h
  4. Content: Declaration of the CPolicyInformation.
  5. History: 06-15-2001 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __POLICYINFORMATION_H_
  8. #define __POLICYINFORMATION_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. //
  19. // Exported functions.
  20. //
  21. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  22. Function : CreatePolicyInformationObject
  23. Synopsis : Create a policy information object.
  24. Parameter: PCERT_POLICY_INFO pCertPolicyInfo - Pointer to CERT_POLICY_INFO.
  25. IPolicyInformation ** ppIPolicyInformation - Pointer to pointer
  26. IPolicyInformation
  27. object.
  28. Remark :
  29. ------------------------------------------------------------------------------*/
  30. HRESULT CreatePolicyInformationObject (PCERT_POLICY_INFO pCertPolicyInfo,
  31. IPolicyInformation ** ppIPolicyInformation);
  32. ////////////////////////////////////////////////////////////////////////////////
  33. //
  34. // CPolicyInformation
  35. //
  36. class ATL_NO_VTABLE CPolicyInformation :
  37. public CComObjectRootEx<CComMultiThreadModel>,
  38. public CComCoClass<CPolicyInformation, &CLSID_PolicyInformation>,
  39. public ICAPICOMError<CPolicyInformation, &IID_IPolicyInformation>,
  40. public IDispatchImpl<IPolicyInformation, &IID_IPolicyInformation, &LIBID_CAPICOM,
  41. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  42. {
  43. public:
  44. CPolicyInformation()
  45. {
  46. }
  47. HRESULT FinalConstruct()
  48. {
  49. HRESULT hr;
  50. if (FAILED(hr = m_Lock.Initialized()))
  51. {
  52. DebugTrace("Error [%#x]: Critical section could not be created for PolicyInformation object.\n", hr);
  53. return hr;
  54. }
  55. m_pIOID = NULL;
  56. m_pIQualifiers = NULL;
  57. return S_OK;
  58. }
  59. void FinalRelease()
  60. {
  61. m_pIOID.Release();
  62. m_pIQualifiers.Release();
  63. }
  64. DECLARE_NO_REGISTRY()
  65. DECLARE_PROTECT_FINAL_CONSTRUCT()
  66. BEGIN_COM_MAP(CPolicyInformation)
  67. COM_INTERFACE_ENTRY(IPolicyInformation)
  68. COM_INTERFACE_ENTRY(IDispatch)
  69. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  70. END_COM_MAP()
  71. BEGIN_CATEGORY_MAP(CPolicyInformation)
  72. END_CATEGORY_MAP()
  73. //
  74. // IPolicyInformation
  75. //
  76. public:
  77. STDMETHOD(get_OID)
  78. (/*[out, retval]*/ IOID ** pVal);
  79. STDMETHOD(get_Qualifiers)
  80. (/*[out, retval]*/ IQualifiers ** pVal);
  81. //
  82. // None COM functions.
  83. //
  84. STDMETHOD(Init)
  85. (PCERT_POLICY_INFO pCertPolicyInfo);
  86. private:
  87. CLock m_Lock;
  88. CComPtr<IOID> m_pIOID;
  89. CComPtr<IQualifiers> m_pIQualifiers;
  90. };
  91. #endif //__POLICYINFORMATION_H_