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.

247 lines
8.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: scrdenr.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // SCrdEnr.h : Declaration of the CSCrdEnr
  11. #ifndef __SCRDENR_H_
  12. #define __SCRDENR_H_
  13. #include <certca.h>
  14. #include "xenroll.h"
  15. #include "resource.h" // main symbols
  16. #include "objsel.h"
  17. /////////////////////////////////////////////////////////////////////////////
  18. // SCrdEnroll_CSP_INFO
  19. typedef struct _SCrdEnroll_CSP_INFO
  20. {
  21. DWORD dwCSPType;
  22. LPWSTR pwszCSPName;
  23. }SCrdEnroll_CSP_INFO, *PSCrdEnroll_CSP_INFO;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // SCrdEnroll_CA_INFO
  26. typedef struct _SCrdEnroll_CA_INFO
  27. {
  28. LPWSTR pwszCAName;
  29. LPWSTR pwszCALocation;
  30. LPWSTR pwszCADisplayName;
  31. }SCrdEnroll_CA_INFO, *PSCrdEnroll_CA_INFO;
  32. /////////////////////////////////////////////////////////////////////////////
  33. // SCrdEnroll_CT_INFO
  34. typedef struct _SCrdEnroll_CT_INFO
  35. {
  36. LPWSTR pwszCTName;
  37. LPWSTR pwszCTDisplayName;
  38. PCERT_EXTENSIONS pCertTypeExtensions;
  39. DWORD dwKeySpec;
  40. DWORD dwGenKeyFlags;
  41. DWORD dwRASignature;
  42. BOOL fCAInfo;
  43. DWORD dwCAIndex;
  44. DWORD dwCACount;
  45. SCrdEnroll_CA_INFO *rgCAInfo;
  46. BOOL fMachine;
  47. DWORD dwEnrollmentFlags;
  48. DWORD dwSubjectNameFlags;
  49. DWORD dwPrivateKeyFlags;
  50. DWORD dwGeneralFlags;
  51. LPWSTR *rgpwszSupportedCSPs;
  52. DWORD dwCurrentCSP;
  53. } SCrdEnroll_CT_INFO, *PSCrdEnroll_CT_INFO;
  54. ////////////////////////////////////////////////////////////////////////
  55. //
  56. // Prototypes for functions loaded at runtime.
  57. //
  58. ////////////////////////////////////////////////////////////////////////
  59. HRESULT WINAPI MyCAGetCertTypeFlagsEx
  60. (IN HCERTTYPE hCertType,
  61. IN DWORD dwOption,
  62. OUT DWORD * pdwFlags);
  63. HRESULT WINAPI MyCAGetCertTypePropertyEx
  64. (IN HCERTTYPE hCertType,
  65. IN LPCWSTR wszPropertyName,
  66. OUT LPVOID pPropertyValue);
  67. IEnroll4 * WINAPI MyPIEnroll4GetNoCOM();
  68. void InitializeThunks();
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CSCrdEnr
  71. class ATL_NO_VTABLE CSCrdEnr :
  72. public CComObjectRootEx<CComSingleThreadModel>,
  73. public CComCoClass<CSCrdEnr, &CLSID_SCrdEnr>,
  74. public IDispatchImpl<ISCrdEnr, &IID_ISCrdEnr, &LIBID_SCRDENRLLib>
  75. {
  76. public:
  77. DECLARE_REGISTRY_RESOURCEID(IDR_SCRDENR)
  78. BEGIN_COM_MAP(CSCrdEnr)
  79. COM_INTERFACE_ENTRY(ISCrdEnr)
  80. COM_INTERFACE_ENTRY(IDispatch)
  81. END_COM_MAP()
  82. // ISCrdEnr
  83. public:
  84. CSCrdEnr();
  85. virtual ~CSCrdEnr();
  86. STDMETHOD(getCertTemplateCount)
  87. (/* [in] */ DWORD dwFlags,
  88. /* [retval][out] */ long *pdwCertTemplateCount);
  89. STDMETHOD(setCertTemplateName)
  90. (/* [in] */ DWORD dwFlags,
  91. /* [in] */ BSTR bstrCertTemplateName);
  92. STDMETHOD(getCertTemplateName)
  93. (/* [in] */ DWORD dwFlags,
  94. /* [retval][out] */ BSTR *pbstrCertTemplateName);
  95. STDMETHOD(enumCSPName)
  96. (/* [in] */ DWORD dwIndex,
  97. /* [in] */ DWORD dwFlags,
  98. /* [retval][out] */ BSTR *pbstrCSPName);
  99. STDMETHOD(enumCertTemplateName)
  100. (/* [in] */ DWORD dwIndex,
  101. /* [in] */ DWORD dwFlags,
  102. /* [retval][out] */ BSTR *pbstrCertTemplateName);
  103. STDMETHOD(getCertTemplateInfo)
  104. (/* [in] */ BSTR bstrCertTemplateName,
  105. /* [in] */ LONG lType,
  106. /* [retval][out] */ VARIANT *pvarCertTemplateInfo);
  107. STDMETHOD(setUserName)
  108. (/* [in] */ DWORD dwFlags,
  109. /* [in] */ BSTR bstrUserName);
  110. STDMETHOD(getUserName)
  111. (/* [in] */ DWORD dwFlags,
  112. /* [retval][out] */ BSTR *pbstrUserName);
  113. STDMETHOD(getCACount)
  114. (/* [in] */ BSTR bstrCertTemplateName,
  115. /* [retval][out] */ long *pdwCACount);
  116. STDMETHOD(setCAName)
  117. (/* [in] */ DWORD dwFlags,
  118. /* [in] */ BSTR bstrCertTemplateName,
  119. /* [in] */ BSTR bstrCAName);
  120. STDMETHOD(getCAName)
  121. (/* [in] */ DWORD dwFlags,
  122. /* [in] */ BSTR bstrCertTemplateName,
  123. /* [retval][out] */ BSTR *pbstrCAName);
  124. STDMETHOD(enumCAName)
  125. (/* [in] */ DWORD dwIndex,
  126. /* [in] */ DWORD dwFlags,
  127. /* [in] */ BSTR bstrCertTemplateName,
  128. /* [retval][out] */ BSTR *pbstrCAName);
  129. STDMETHOD(resetUser)();
  130. STDMETHOD(selectSigningCertificate)
  131. (/* [in] */ DWORD dwFlags,
  132. /* [in] */ BSTR bstrCertTemplateName);
  133. STDMETHOD(setSigningCertificate)
  134. (/* [in] */ DWORD dwFlags,
  135. /* [in] */ BSTR bstrCertTemplateName);
  136. STDMETHOD(getSigningCertificateName)
  137. (/* [in] */ DWORD dwFlags,
  138. /* [retval][out] */ BSTR *pbstrSigningCertName);
  139. STDMETHOD(getEnrolledCertificateName)
  140. (/*[in] */ DWORD dwFlags,
  141. /* [retval][out] */ BSTR *pBstrCertName);
  142. STDMETHOD(enroll)
  143. (/* [in] */ DWORD dwFlags);
  144. STDMETHOD(selectUserName)
  145. (/* [in] */ DWORD dwFlags);
  146. STDMETHOD(get_CSPName)
  147. (/*[out, retval]*/ BSTR *pVal);
  148. STDMETHOD(put_CSPName)
  149. (/*[in]*/ BSTR newVal);
  150. STDMETHOD(get_CSPCount)
  151. (/*[out, retval]*/ long *pVal);
  152. STDMETHOD(get_EnrollmentStatus)
  153. (/*[retval][out] */ LONG * plEnrollmentStatus);
  154. private:
  155. HRESULT GetCAExchangeCertificate(IN BSTR bstrCAQualifiedName, PCCERT_CONTEXT *ppCert);
  156. HRESULT _getCertTemplateExtensionInfo(
  157. IN CERT_EXTENSIONS *pCertTypeExtensions,
  158. IN LONG lType,
  159. OUT VOID *pExtInfo);
  160. HRESULT _getStrCertTemplateCSPList(
  161. IN DWORD dwIndex,
  162. IN DWORD dwFlag,
  163. OUT WCHAR **ppwszSupportedCSP);
  164. HRESULT CertTemplateCountOrName(
  165. IN DWORD dwIndex,
  166. IN DWORD dwFlags,
  167. OUT long *pdwCertTemplateCount,
  168. OUT BSTR *pbstrCertTemplateName);
  169. DWORD m_dwCTCount;
  170. DWORD m_dwCTIndex;
  171. SCrdEnroll_CT_INFO *m_rgCTInfo;
  172. DWORD m_dwCSPCount;
  173. DWORD m_dwCSPIndex;
  174. SCrdEnroll_CSP_INFO *m_rgCSPInfo;
  175. LPWSTR m_pwszUserUPN; //the UPN name of the user
  176. LPWSTR m_pwszUserSAM; //the SAM name of the user
  177. PCCERT_CONTEXT m_pSigningCert;
  178. PCCERT_CONTEXT m_pEnrolledCert;
  179. CRITICAL_SECTION m_cSection;
  180. BOOL m_fInitializedCriticalSection; // true if m_cSection is initialized, otherwise false
  181. BOOL m_fInitialize;
  182. LONG m_lEnrollmentStatus;
  183. BOOL m_fSCardSigningCert; //whether the signing certificate is on a smart card
  184. LPSTR m_pszCSPNameSigningCert; //the CSP name of the signing certificate
  185. DWORD m_dwCSPTypeSigningCert; //the CSP type of the signing certificate
  186. LPSTR m_pszContainerSigningCert; //the container name of the signing certificate
  187. IDsObjectPicker *m_pDsObjectPicker; //pointer to the object selection dialogue
  188. CERT_EXTENSIONS *m_pCachedCTEs; //point to cert extensions
  189. WCHAR *m_pwszCachedCTEOid;
  190. CERT_TEMPLATE_EXT *m_pCachedCTE;
  191. };
  192. #endif //__SCRDENR_H_