Source code of Windows XP (NT5)
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.

233 lines
5.9 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: admin.h
  7. //
  8. // Contents: Declaration of CCertAdmin
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "cscomres.h" // main symbols
  12. /////////////////////////////////////////////////////////////////////////////
  13. // certadm
  14. class ATL_NO_VTABLE CCertAdmin:
  15. public IDispatchImpl<ICertAdmin2, &IID_ICertAdmin2, &LIBID_CERTADMINLib>,
  16. public ISupportErrorInfoImpl<&IID_ICertAdmin2>,
  17. public CComObjectRoot,
  18. public CComCoClass<CCertAdmin, &CLSID_CCertAdmin>
  19. {
  20. public:
  21. CCertAdmin()
  22. {
  23. m_fRevocationReasonValid = FALSE;
  24. m_dwServerVersion = 0;
  25. m_pICertAdminD = NULL;
  26. m_pwszServerName = NULL;
  27. _InitCAPropInfo();
  28. _Cleanup();
  29. }
  30. ~CCertAdmin();
  31. BEGIN_COM_MAP(CCertAdmin)
  32. COM_INTERFACE_ENTRY(IDispatch)
  33. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  34. COM_INTERFACE_ENTRY(ICertAdmin)
  35. COM_INTERFACE_ENTRY(ICertAdmin2)
  36. END_COM_MAP()
  37. DECLARE_NOT_AGGREGATABLE(CCertAdmin)
  38. // Remove the comment from the line above if you don't want your object to
  39. // support aggregation. The default is to support it
  40. DECLARE_REGISTRY(
  41. CCertAdmin,
  42. wszCLASS_CERTADMIN TEXT(".1"),
  43. wszCLASS_CERTADMIN,
  44. IDS_CERTADMIN_DESC,
  45. THREADFLAGS_BOTH)
  46. // ICertAdmin
  47. public:
  48. STDMETHOD(IsValidCertificate)(
  49. /* [in] */ BSTR const strConfig,
  50. /* [in] */ BSTR const strSerialNumber,
  51. /* [out, retval] */ LONG *pDisposition);
  52. STDMETHOD(GetRevocationReason)(
  53. /* [out, retval] */ LONG *pReason);
  54. STDMETHOD(RevokeCertificate)(
  55. /* [in] */ BSTR const strConfig,
  56. /* [in] */ BSTR const strSerialNumber,
  57. /* [in] */ LONG Reason,
  58. /* [in] */ DATE Date);
  59. STDMETHOD(SetRequestAttributes)(
  60. /* [in] */ BSTR const strConfig,
  61. /* [in] */ LONG RequestId,
  62. /* [in] */ BSTR const strAttributes);
  63. STDMETHOD(SetCertificateExtension)(
  64. /* [in] */ BSTR const strConfig,
  65. /* [in] */ LONG RequestId,
  66. /* [in] */ BSTR const strExtensionName,
  67. /* [in] */ LONG Type,
  68. /* [in] */ LONG Flags,
  69. /* [in] */ VARIANT const *pvarValue);
  70. STDMETHOD(DenyRequest)(
  71. /* [in] */ BSTR const strConfig,
  72. /* [in] */ LONG RequestId);
  73. STDMETHOD(ResubmitRequest)(
  74. /* [in] */ BSTR const strConfig,
  75. /* [in] */ LONG RequestId,
  76. /* [out, retval] */ LONG __RPC_FAR *pDisposition);
  77. STDMETHOD(PublishCRL)(
  78. /* [in] */ BSTR const strConfig,
  79. /* [in] */ DATE Date);
  80. STDMETHOD(GetCRL)(
  81. /* [in] */ BSTR const strConfig,
  82. /* [in] */ LONG Flags,
  83. /* [out, retval] */ BSTR *pstrCRL);
  84. STDMETHOD(ImportCertificate)(
  85. /* [in] */ BSTR const strConfig,
  86. /* [in] */ BSTR const strCertificate,
  87. /* [in] */ LONG Flags,
  88. /* [out, retval] */ LONG *pRequestId);
  89. // ICertAdmin2
  90. public:
  91. STDMETHOD(PublishCRLs)(
  92. /* [in] */ BSTR const strConfig,
  93. /* [in] */ DATE Date,
  94. /* [in] */ LONG CRLFlags); // CA_CRL_*
  95. STDMETHOD(GetCAProperty)(
  96. /* [in] */ BSTR const strConfig,
  97. /* [in] */ LONG PropId, // CR_PROP_*
  98. /* [in] */ LONG PropIndex,
  99. /* [in] */ LONG PropType, // PROPTYPE_*
  100. /* [in] */ LONG Flags, // CR_OUT_*
  101. /* [out, retval] */ VARIANT *pvarPropertyValue);
  102. STDMETHOD(SetCAProperty)(
  103. /* [in] */ BSTR const strConfig,
  104. /* [in] */ LONG PropId, // CR_PROP_*
  105. /* [in] */ LONG PropIndex,
  106. /* [in] */ LONG PropType, // PROPTYPE_*
  107. /* [in] */ VARIANT *pvarPropertyValue);
  108. STDMETHOD(GetCAPropertyFlags)(
  109. /* [in] */ BSTR const strConfig,
  110. /* [in] */ LONG PropId, // CR_PROP_*
  111. /* [out, retval] */ LONG *pPropFlags);
  112. STDMETHOD(GetCAPropertyDisplayName)(
  113. /* [in] */ BSTR const strConfig,
  114. /* [in] */ LONG PropId, // CR_PROP_*
  115. /* [out, retval] */ BSTR *pstrDisplayName);
  116. STDMETHOD(GetArchivedKey)(
  117. /* [in] */ BSTR const strConfig,
  118. /* [in] */ LONG RequestId,
  119. /* [in] */ LONG Flags, // CR_OUT_*
  120. /* [out, retval] */ BSTR *pstrArchivedKey);
  121. STDMETHOD(GetConfigEntry)(
  122. /* [in] */ BSTR const strConfig,
  123. /* [in] */ BSTR const strNodePath,
  124. /* [in] */ BSTR const strEntryName,
  125. /* [out, retval] */ VARIANT *pvarEntry);
  126. STDMETHOD(SetConfigEntry)(
  127. /* [in] */ BSTR const strConfig,
  128. /* [in] */ BSTR const strNodePath,
  129. /* [in] */ BSTR const strEntryName,
  130. /* [in] */ VARIANT *pvarEntry);
  131. STDMETHOD(ImportKey)(
  132. /* [in] */ BSTR const strConfig,
  133. /* [in] */ LONG RequestId,
  134. /* [in] */ BSTR const strCertHash,
  135. /* [in] */ LONG Flags,
  136. /* [in] */ BSTR const strKey);
  137. STDMETHOD(GetMyRoles)(
  138. /* [in] */ BSTR const strConfig,
  139. /* [out, retval] */ LONG *pRoles);
  140. STDMETHOD(DeleteRow)(
  141. /* [in] */ BSTR const strConfig,
  142. /* [in] */ LONG Flags, // CDR_*
  143. /* [in] */ DATE Date,
  144. /* [in] */ LONG Table, // CVRC_TABLE_*
  145. /* [in] */ LONG RowId,
  146. /* [out, retval] */ LONG *pcDeleted);
  147. private:
  148. HRESULT _OpenConnection(
  149. IN WCHAR const *pwszConfig,
  150. IN DWORD RequiredVersion,
  151. OUT WCHAR const **ppwszAuthority);
  152. VOID _CloseConnection();
  153. VOID _InitCAPropInfo();
  154. VOID _CleanupCAPropInfo();
  155. VOID _Cleanup();
  156. VOID _CleanupOldConnection();
  157. HRESULT _FindCAPropInfo(
  158. IN BSTR const strConfig,
  159. IN LONG PropId,
  160. OUT CAPROP const **ppcap);
  161. HRESULT _SetErrorInfo(
  162. IN HRESULT hrError,
  163. IN WCHAR const *pwszDescription);
  164. HRESULT _GetConfigEntryFromRegistry(
  165. IN BSTR const strConfig,
  166. IN BSTR const strNodePath,
  167. IN BSTR const strEntryName,
  168. IN OUT VARIANT *pvarEntry);
  169. HRESULT _SetConfigEntryFromRegistry(
  170. IN BSTR const strConfig,
  171. IN BSTR const strNodePath,
  172. IN BSTR const strEntryName,
  173. IN const VARIANT *pvarEntry);
  174. DWORD m_dwServerVersion;
  175. ICertAdminD2 *m_pICertAdminD;
  176. LONG m_RevocationReason;
  177. BOOL m_fRevocationReasonValid;
  178. BYTE *m_pbCACertState;
  179. DWORD m_cbCACertState;
  180. BYTE *m_pbCRLState;
  181. DWORD m_cbCRLState;
  182. CAPROP *m_pCAPropInfo;
  183. LONG m_cCAPropInfo;
  184. CAINFO *m_pCAInfo;
  185. DWORD m_cbCAInfo;
  186. WCHAR *m_pwszServerName;
  187. BYTE *m_pbKRACertState;
  188. DWORD m_cbKRACertState;
  189. };