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.

228 lines
6.0 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: request.h
  7. //
  8. // Contents: Declaration of CCertRequest
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "xelib.h"
  12. #include "cscomres.h" // main symbols
  13. /////////////////////////////////////////////////////////////////////////////
  14. // certcli
  15. class ATL_NO_VTABLE CCertRequest:
  16. public IDispatchImpl<ICertRequest2, &IID_ICertRequest2, &LIBID_CERTCLIENTLib>,
  17. public ISupportErrorInfoImpl<&IID_ICertRequest2>,
  18. public CComObjectRoot,
  19. public CComCoClass<CCertRequest, &CLSID_CCertRequest>
  20. {
  21. public:
  22. CCertRequest()
  23. {
  24. m_dwServerVersion = 0;
  25. m_pICertRequestD = NULL;
  26. m_hRPCCertServer = NULL;
  27. m_pwszDispositionMessage = NULL;
  28. m_pbRequest = NULL;
  29. m_pbCert = NULL;
  30. m_pbCertificateChain = NULL;
  31. m_pbFullResponse = NULL;
  32. m_pwszServerName = NULL;
  33. m_rpcAuthProtocol = 0;
  34. m_rgResponse = NULL;
  35. m_hStoreResponse = NULL;
  36. _InitCAPropInfo();
  37. _Cleanup();
  38. }
  39. ~CCertRequest();
  40. BEGIN_COM_MAP(CCertRequest)
  41. COM_INTERFACE_ENTRY(IDispatch)
  42. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  43. COM_INTERFACE_ENTRY(ICertRequest)
  44. COM_INTERFACE_ENTRY(ICertRequest2)
  45. END_COM_MAP()
  46. DECLARE_NOT_AGGREGATABLE(CCertRequest)
  47. // Remove the comment from the line above if you don't want your object to
  48. // support aggregation. The default is to support it
  49. DECLARE_REGISTRY(
  50. CCertRequest,
  51. wszCLASS_CERTREQUEST TEXT(".1"),
  52. wszCLASS_CERTREQUEST,
  53. IDS_CERTREQUEST_DESC,
  54. THREADFLAGS_BOTH)
  55. // ICertRequest
  56. public:
  57. STDMETHOD(Submit)(
  58. /* [in] */ LONG Flags,
  59. /* [in] */ BSTR const strRequest,
  60. /* [in] */ BSTR const strAttributes,
  61. /* [in] */ BSTR const strConfig,
  62. /* [out, retval] */ LONG __RPC_FAR *pDisposition);
  63. STDMETHOD(RetrievePending)(
  64. /* [in] */ LONG RequestId,
  65. /* [in] */ BSTR const strConfig,
  66. /* [out, retval] */ LONG __RPC_FAR *pDisposition);
  67. STDMETHOD(GetLastStatus)(
  68. /* [out, retval] */ LONG __RPC_FAR *pLastStatus);
  69. STDMETHOD(GetRequestId)(
  70. /* [out, retval] */ LONG __RPC_FAR *pRequestId);
  71. STDMETHOD(GetDispositionMessage)(
  72. /* [out, retval] */ BSTR __RPC_FAR *pstrDispositionMessage);
  73. STDMETHOD(GetCACertificate)(
  74. /* [in] */ LONG fExchangeCertificate,
  75. /* [in] */ BSTR const strConfig,
  76. /* [in] */ LONG Flags,
  77. /* [out, retval] */ BSTR __RPC_FAR *pstrCACertificate);
  78. STDMETHOD(GetCertificate)(
  79. /* [in] */ LONG Flags,
  80. /* [out, retval] */ BSTR __RPC_FAR *pstrCertificate);
  81. // ICertRequest2
  82. public:
  83. STDMETHOD(GetIssuedCertificate)(
  84. /* [in] */ const BSTR strConfig,
  85. /* [in] */ LONG RequestId,
  86. /* [in] */ const BSTR strSerialNumber,
  87. /* [out, retval] */ LONG __RPC_FAR *pDisposition);
  88. STDMETHOD(GetErrorMessageText)(
  89. /* [in] */ LONG hrMessage,
  90. /* [in] */ LONG Flags,
  91. /* [out, retval] */ BSTR __RPC_FAR *pstrErrorMessageText);
  92. STDMETHOD(GetCAProperty)(
  93. /* [in] */ BSTR const strConfig,
  94. /* [in] */ LONG PropId, // CR_PROP_*
  95. /* [in] */ LONG PropIndex,
  96. /* [in] */ LONG PropType, // PROPTYPE_*
  97. /* [in] */ LONG Flags, // CR_OUT_*
  98. /* [out, retval] */ VARIANT *pvarPropertyValue);
  99. STDMETHOD(GetCAPropertyFlags)(
  100. /* [in] */ BSTR const strConfig,
  101. /* [in] */ LONG PropId, // CR_PROP_*
  102. /* [out, retval] */ LONG *pPropFlags);
  103. STDMETHOD(GetCAPropertyDisplayName)(
  104. /* [in] */ BSTR const strConfig,
  105. /* [in] */ LONG PropId, // CR_PROP_*
  106. /* [out, retval] */ BSTR *pstrDisplayName);
  107. STDMETHOD(GetFullResponseProperty)(
  108. /* [in] */ LONG PropId, // FR_PROP_*
  109. /* [in] */ LONG PropIndex,
  110. /* [in] */ LONG PropType, // PROPTYPE_*
  111. /* [in] */ LONG Flags, // CR_OUT_*
  112. /* [out, retval] */ VARIANT *pvarPropertyValue);
  113. private:
  114. HRESULT _OpenRPCConnection(
  115. IN WCHAR const *pwszConfig,
  116. OUT BOOL *pfNewConnection,
  117. OUT WCHAR const **ppwszAuthority);
  118. HRESULT _OpenConnection(
  119. IN BOOL fRPC,
  120. IN WCHAR const *pwszConfig,
  121. IN DWORD RequiredVersion,
  122. OUT WCHAR const **ppwszAuthority);
  123. VOID _CloseConnection();
  124. VOID _InitCAPropInfo();
  125. VOID _CleanupCAPropInfo();
  126. VOID _Cleanup();
  127. VOID _CleanupOldConnection();
  128. HRESULT _FindCAPropInfo(
  129. IN BSTR const strConfig,
  130. IN LONG PropId,
  131. OUT CAPROP const **ppcap);
  132. HRESULT _RequestCertificate(
  133. IN LONG Flags,
  134. IN LONG RequestId,
  135. OPTIONAL IN BSTR const strRequest,
  136. OPTIONAL IN BSTR const strAttributes,
  137. OPTIONAL IN WCHAR const *pwszSerialNumber,
  138. IN BSTR const strConfig,
  139. IN DWORD RequiredVersion,
  140. OUT LONG *pDisposition);
  141. HRESULT _FindIssuedCertificate(
  142. OPTIONAL IN BYTE const *pbCertHash,
  143. IN DWORD cbCertHash,
  144. OUT CERT_CONTEXT const **ppccIssued);
  145. HRESULT _BuildIssuedCertificateChain(
  146. OPTIONAL IN BYTE const *pbCertHash,
  147. IN DWORD cbCertHash,
  148. IN BOOL fIncludeCRLs,
  149. OUT BYTE **ppbCertChain,
  150. OUT DWORD *pcbCertChain);
  151. HRESULT _SetErrorInfo(
  152. IN HRESULT hrError,
  153. IN WCHAR const *pwszDescription);
  154. DWORD m_dwServerVersion;
  155. ICertRequestD2 *m_pICertRequestD;
  156. handle_t m_hRPCCertServer;
  157. LONG m_LastStatus;
  158. LONG m_RequestId;
  159. LONG m_Disposition;
  160. WCHAR *m_pwszDispositionMessage;
  161. BYTE *m_pbRequest;
  162. LONG m_cbRequest;
  163. BYTE *m_pbCert;
  164. LONG m_cbCert;
  165. BYTE *m_pbCertificateChain;
  166. LONG m_cbCertificateChain;
  167. BYTE *m_pbFullResponse;
  168. LONG m_cbFullResponse;
  169. HCERTSTORE m_hStoreResponse;
  170. XCMCRESPONSE *m_rgResponse;
  171. DWORD m_cResponse;
  172. BYTE *m_pbCACertState;
  173. DWORD m_cbCACertState;
  174. BYTE *m_pbCRLState;
  175. DWORD m_cbCRLState;
  176. CAPROP *m_pCAPropInfo;
  177. LONG m_cCAPropInfo;
  178. CAINFO *m_pCAInfo;
  179. DWORD m_cbCAInfo;
  180. WCHAR *m_pwszServerName;
  181. INT m_rpcAuthProtocol;
  182. BYTE *m_pbKRACertState;
  183. DWORD m_cbKRACertState;
  184. };