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.

188 lines
4.6 KiB

  1. // policy.h: Declaration of CCertPolicyExchange
  2. #include "expolicy.h"
  3. #include "resource.h" // main symbols
  4. #ifndef __BSTRC__DEFINED__
  5. #define __BSTRC__DEFINED__
  6. typedef OLECHAR const *BSTRC;
  7. #endif
  8. extern const WCHAR g_wszDescription[];
  9. /////////////////////////////////////////////////////////////////////////////
  10. // certpol
  11. HRESULT
  12. GetServerCallbackInterface(
  13. OUT ICertServerPolicy **ppServer,
  14. IN LONG Context);
  15. HRESULT
  16. PopulateRegistryDefaults(
  17. OPTIONAL IN WCHAR const *pwszMachine,
  18. IN WCHAR const *pwszStorageLocation);
  19. class CCertPolicyExchange:
  20. public CComDualImpl<ICertPolicy2, &IID_ICertPolicy2, &LIBID_CERTPOLICYEXCHANGELib>,
  21. public ISupportErrorInfo,
  22. public CComObjectRoot,
  23. public CComCoClass<CCertPolicyExchange, &CLSID_CCertPolicyExchange>
  24. {
  25. public:
  26. CCertPolicyExchange()
  27. {
  28. // RevocationExtension variables:
  29. m_dwRevocationFlags = 0;
  30. m_cCDPRevocationURL = 0;
  31. m_ppwszCDPRevocationURL = NULL;
  32. m_pwszASPRevocationURL = NULL;
  33. // AuthorityInfoAccessExtension variables:
  34. m_dwIssuerCertURLFlags = 0;
  35. m_cIssuerCertURL = 0;
  36. m_ppwszIssuerCertURL = NULL;
  37. m_bstrMachineDNSName = NULL;
  38. m_bstrCASanitizedName = NULL;
  39. m_pwszRegStorageLoc = NULL;
  40. }
  41. ~CCertPolicyExchange();
  42. BEGIN_COM_MAP(CCertPolicyExchange)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. COM_INTERFACE_ENTRY(ICertPolicy)
  45. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  46. END_COM_MAP()
  47. DECLARE_NOT_AGGREGATABLE(CCertPolicyExchange)
  48. // Remove the comment from the line above if you don't want your object to
  49. // support aggregation. The default is to support it
  50. DECLARE_REGISTRY(
  51. CCertPolicyExchange,
  52. wszCLASS_CERTPOLICYEXCHANGE TEXT(".1"),
  53. wszCLASS_CERTPOLICYEXCHANGE,
  54. IDS_CERTPOLICY_DESC,
  55. THREADFLAGS_BOTH)
  56. // ISupportsErrorInfo
  57. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  58. // ICertPolicy
  59. public:
  60. STDMETHOD(Initialize)(
  61. /* [in] */ BSTR const strConfig);
  62. STDMETHOD(VerifyRequest)(
  63. /* [in] */ BSTR const strConfig,
  64. /* [in] */ LONG Context,
  65. /* [in] */ LONG bNewRequest,
  66. /* [in] */ LONG Flags,
  67. /* [out, retval] */ LONG __RPC_FAR *pDisposition);
  68. STDMETHOD(GetDescription)(
  69. /* [out, retval] */ BSTR __RPC_FAR *pstrDescription);
  70. STDMETHOD(ShutDown)();
  71. // ICertPolicy2
  72. public:
  73. STDMETHOD(GetManageModule)(
  74. /* [out, retval] */ ICertManageModule **ppManageModule);
  75. private:
  76. VOID _Cleanup();
  77. #if DBG_CERTSRV
  78. VOID _DumpStringArray(
  79. IN char const *pszType,
  80. IN DWORD cpwsz,
  81. IN WCHAR const * const *ppwsz);
  82. #else
  83. #define _DumpStringArray(pszType, cpwsz, ppwsz)
  84. #endif
  85. VOID _FreeStringArray(
  86. IN OUT DWORD *pcString,
  87. IN OUT WCHAR ***pppwsz);
  88. HRESULT _AddStringArray(
  89. IN WCHAR const *pwszzValue,
  90. IN BOOL fURL,
  91. IN OUT DWORD *pcStrings,
  92. IN OUT WCHAR ***pppwszRegValues);
  93. HRESULT _ReadRegistryString(
  94. IN HKEY hkey,
  95. IN BOOL fURL,
  96. IN WCHAR const *pwszRegName,
  97. IN WCHAR const *pwszSuffix,
  98. OUT WCHAR **pwszRegValue);
  99. HRESULT _ReadRegistryStringArray(
  100. IN HKEY hkey,
  101. IN BOOL fURL,
  102. IN DWORD dwFlags,
  103. IN DWORD cRegNames,
  104. IN DWORD *aFlags,
  105. IN WCHAR const * const *ppwszRegNames,
  106. IN OUT DWORD *pcStrings,
  107. IN OUT WCHAR ***pppwszRegValues);
  108. VOID _InitRevocationExtension(
  109. IN HKEY hkey);
  110. VOID _InitAuthorityInfoAccessExtension(
  111. IN HKEY hkey);
  112. HRESULT _AddIssuerAltName2Extension(
  113. IN ICertServerPolicy *pServer);
  114. HRESULT _AddSubjectAltName2Extension(
  115. IN ICertServerPolicy *pServer);
  116. HRESULT _AddRevocationExtension(
  117. IN ICertServerPolicy *pServer);
  118. HRESULT _AddAuthorityInfoAccessExtension(
  119. IN ICertServerPolicy *pServer);
  120. HRESULT _AddKeyUsageExtension(
  121. IN ICertServerPolicy *pServer);
  122. HRESULT _AddEnhancedKeyUsageExtension(
  123. IN ICertServerPolicy *pServer);
  124. HRESULT _AddSpecialAltNameExtension(
  125. IN ICertServerPolicy *pServer);
  126. HRESULT _AddBasicConstraintsExtension(
  127. IN ICertServerPolicy *pServer);
  128. private:
  129. // Add local variables here!
  130. // RevocationExtension variables:
  131. DWORD m_dwRevocationFlags;
  132. DWORD m_cCDPRevocationURL;
  133. WCHAR **m_ppwszCDPRevocationURL;
  134. WCHAR *m_pwszASPRevocationURL;
  135. // AuthorityInfoAccessExtension variables:
  136. DWORD m_dwIssuerCertURLFlags;
  137. DWORD m_cIssuerCertURL;
  138. WCHAR **m_ppwszIssuerCertURL;
  139. BSTR m_bstrMachineDNSName;
  140. BSTR m_bstrCASanitizedName;
  141. WCHAR *m_pwszRegStorageLoc;
  142. DWORD m_iCert;
  143. DWORD m_iCRL;
  144. };