2 * Copyright (C) 2004 Francois Gouget
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_WINTRUST_H
20 #define __WINE_WINTRUST_H
27 typedef struct WINTRUST_FILE_INFO_
30 LPCWSTR pcwszFilePath
;
33 } WINTRUST_FILE_INFO
, *PWINTRUST_FILE_INFO
;
35 typedef struct WINTRUST_CATALOG_INFO_
38 DWORD dwCatalogVersion
;
39 LPCWSTR pcwszCatalogFilePath
;
40 LPCWSTR pcwszMemberTag
;
41 LPCWSTR pcwszMemberFilePath
;
43 BYTE
* pbCalculatedFileHash
;
44 DWORD cbCalculatedFileHash
;
45 PCCTL_CONTEXT pcCatalogContext
;
46 } WINTRUST_CATALOG_INFO
, *PWINTRUST_CATALOG_INFO
;
48 typedef struct WINTRUST_BLOB_INFO_
52 LPCWSTR pcwszDisplayName
;
57 } WINTRUST_BLOB_INFO
, *PWINTRUST_BLOB_INFO
;
59 typedef struct WINTRUST_SGNR_INFO_
62 LPCWSTR pcwszDisplayName
;
63 CMSG_SIGNER_INFO
* psSignerInfo
;
65 HCERTSTORE
* pahStores
;
66 } WINTRUST_SGNR_INFO
, *PWINTRUST_SGNR_INFO
;
68 typedef struct WINTRUST_CERT_INFO_
71 LPCWSTR pcwszDisplayName
;
72 CERT_CONTEXT
* psCertContext
;
74 HCERTSTORE
* pahStores
;
76 FILETIME
* psftVerifyAsOf
;
77 } WINTRUST_CERT_INFO
, *PWINTRUST_CERT_INFO
;
80 typedef struct _WINTRUST_DATA
83 LPVOID pPolicyCallbackData
;
84 LPVOID pSIPClientData
;
86 DWORD fdwRevocationChecks
;
90 struct WINTRUST_FILE_INFO_
* pFile
;
91 struct WINTRUST_CATALOG_INFO_
* pCatalog
;
92 struct WINTRUST_BLOB_INFO_
* pBlob
;
93 struct WINTRUST_SGNR_INFO_
* pSgnr
;
94 struct WINTRUST_CERT_INFO_
* pCert
;
99 WCHAR
* pwszURLReference
;
102 } WINTRUST_DATA
, *PWINTRUST_DATA
;
104 typedef struct _CRYPT_TRUST_REG_ENTRY
108 WCHAR
*pwszFunctionName
;
109 } CRYPT_TRUST_REG_ENTRY
, *PCRYPT_TRUST_REG_ENTRY
;
111 typedef struct _CRYPT_REGISTER_ACTIONID
114 CRYPT_TRUST_REG_ENTRY sInitProvider
;
115 CRYPT_TRUST_REG_ENTRY sObjectProvider
;
116 CRYPT_TRUST_REG_ENTRY sSignatureProvider
;
117 CRYPT_TRUST_REG_ENTRY sCertificateProvider
;
118 CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider
;
119 CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider
;
120 CRYPT_TRUST_REG_ENTRY sTestPolicyProvider
;
121 CRYPT_TRUST_REG_ENTRY sCleanupProvider
;
122 } CRYPT_REGISTER_ACTIONID
, *PCRYPT_REGISTER_ACTIONID
;
124 typedef struct _CRYPT_PROVUI_DATA
{
127 WCHAR
*pYesButtonText
;
128 WCHAR
*pNoButtonText
;
129 WCHAR
*pMoreInfoButtonText
;
130 WCHAR
*pAdvancedLinkText
;
131 WCHAR
*pCopyActionText
;
132 WCHAR
*pCopyActionTextNoTS
;
133 WCHAR
*pCopyActionTextNotSigned
;
134 } CRYPT_PROVUI_DATA
, *PCRYPT_PROVUI_DATA
;
136 typedef struct _CRYPT_PROVIDER_CERT
{
138 PCCERT_CONTEXT pCert
;
143 DWORD dwRevokedReason
;
146 CTL_CONTEXT
*pTrustListContext
;
147 BOOL fTrustListSignerCert
;
148 PCCTL_CONTEXT pCtlContext
;
151 PCERT_CHAIN_ELEMENT pChainElement
;
152 } CRYPT_PROVIDER_CERT
, *PCRYPT_PROVIDER_CERT
;
154 typedef struct _CRYPT_PROVIDER_SGNR
{
156 FILETIME sftVerifyAsOf
;
158 CRYPT_PROVIDER_CERT
*pasCertChain
;
160 CMSG_SIGNER_INFO
*psSigner
;
162 DWORD csCounterSigners
;
163 struct _CRYPT_PROVIDER_SGNR
*pasCounterSigners
;
164 PCCERT_CHAIN_CONTEXT pChainContext
;
165 } CRYPT_PROVIDER_SGNR
, *PCRYPT_PROVIDER_SGNR
;
167 typedef struct _CRYPT_PROVIDER_PRIVDATA
{
172 } CRYPT_PROVIDER_PRIVDATA
, *PCRYPT_PROVIDER_PRIVDATA
;
174 struct _CRYPT_PROVIDER_DATA
;
176 typedef void * (*PFN_CPD_MEM_ALLOC
)(DWORD cbSize
);
177 typedef void (*PFN_CPD_MEM_FREE
)(void *pvMem2Free
);
178 typedef BOOL (*PFN_CPD_ADD_STORE
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
179 HCERTSTORE hStore2Add
);
180 typedef BOOL (*PFN_CPD_ADD_SGNR
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
181 BOOL fCounterSigner
, DWORD idxSigner
, struct _CRYPT_PROVIDER_SGNR
*pSgnr2Add
);
182 typedef BOOL (*PFN_CPD_ADD_CERT
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
183 DWORD idxSigner
, BOOL fCounterSigner
, DWORD idxCounterSigner
,
184 PCCERT_CONTEXT pCert2Add
);
185 typedef BOOL (*PFN_CPD_ADD_PRIVDATA
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
186 struct _CRYPT_PROVIDER_PRIVDATA
*pPrivData2Add
);
187 typedef HRESULT (*PFN_PROVIDER_INIT_CALL
)(
188 struct _CRYPT_PROVIDER_DATA
*pProvData
);
189 typedef HRESULT (*PFN_PROVIDER_OBJTRUST_CALL
)(
190 struct _CRYPT_PROVIDER_DATA
*pProvData
);
191 typedef HRESULT (*PFN_PROVIDER_SIGTRUST_CALL
)(
192 struct _CRYPT_PROVIDER_DATA
*pProvData
);
193 typedef HRESULT (*PFN_PROVIDER_CERTTTRUST_CALL
)(
194 struct _CRYPT_PROVIDER_DATA
*pProvData
);
195 typedef HRESULT (*PFN_PROVIDER_FINALPOLICY_CALL
)(
196 struct _CRYPT_PROVIDER_DATA
*pProvData
);
197 typedef HRESULT (*PFN_PROVIDER_TESTFINALPOLICY_CALL
)(
198 struct _CRYPT_PROVIDER_DATA
*pProvData
);
199 typedef HRESULT (*PFN_PROVIDER_CLEANUP_CALL
)(
200 struct _CRYPT_PROVIDER_DATA
*pProvData
);
201 typedef BOOL (*PFN_PROVIDER_CERTCHKPOLICY_CALL
)(
202 struct _CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
,
203 BOOL fCounterSignerChain
, DWORD idxCounterSigner
);
205 typedef struct _CRYPT_PROVIDER_FUNCTIONS
{
207 PFN_CPD_MEM_ALLOC pfnAlloc
;
208 PFN_CPD_MEM_FREE pfnFree
;
209 PFN_CPD_ADD_STORE pfnAddStore2Chain
;
210 PFN_CPD_ADD_SGNR pfnAddSgnr2Chain
;
211 PFN_CPD_ADD_CERT pfnAddCert2Chain
;
212 PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain
;
213 PFN_PROVIDER_INIT_CALL pfnInitialize
;
214 PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust
;
215 PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust
;
216 PFN_PROVIDER_CERTTTRUST_CALL pfnCertificateTrust
;
217 PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy
;
218 PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy
;
219 PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy
;
220 struct _CRYPT_PROVUI_FUNCS
*psUIpfns
;
221 PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy
;
222 } CRYPT_PROVIDER_FUNCTIONS
, *PCRYPT_PROVIDER_FUNCTIONS
;
224 struct SIP_DISPATCH_INFO_
;
225 struct SIP_SUBJECTINFO_
;
226 struct SIP_INDIRECT_DATA_
;
228 typedef struct _PROVDATA_SIP
{
231 struct SIP_DISPATCH_INFO_
*pSip
;
232 struct SIP_DISPATCH_INFO_
*pCATSip
;
233 struct SIP_SUBJECTINFO_
*psSipSubjectInfo
;
234 struct SIP_SUBJECTINFO_
*psSipCATSubjectInfo
;
235 struct SIP_INDIRECT_DATA_
*psIndirectData
;
236 } PROVDATA_SIP
, *PPROVDATA_SIP
;
238 typedef struct _CRYPT_PROVIDER_DATA
{
240 WINTRUST_DATA
*pWintrustData
;
246 DWORD dwRegSecuritySettings
;
247 DWORD dwRegPolicySettings
;
248 CRYPT_PROVIDER_FUNCTIONS
*psPfns
;
249 DWORD cdwTrustStepErrors
;
250 DWORD
*padwTrustStepErrors
;
252 HCERTSTORE
*pahStores
;
256 CRYPT_PROVIDER_SGNR
*pasSigners
;
257 DWORD dwSubjectChoice
;
259 struct _PROVDATA_SIP
*pPDSip
;
262 BOOL fRecallWithState
;
263 FILETIME sftSystemTime
;
264 char *pszCTLSignerUsageOID
;
267 PCERT_USAGE_MATCH pRequestUsage
;
268 DWORD dwTrustPubSettings
;
269 DWORD dwUIStateFlags
;
270 } CRYPT_PROVIDER_DATA
, *PCRYPT_PROVIDER_DATA
;
272 typedef BOOL (*PFN_PROVUI_CALL
)(HWND hWndSecurityDialog
,
273 struct _CRYPT_PROVIDER_DATA
*pProvData
);
275 typedef struct _CRYPT_PROVUI_FUNCS
{
277 CRYPT_PROVUI_DATA psUIData
;
278 PFN_PROVUI_CALL pfnOnMoreInfoClick
;
279 PFN_PROVUI_CALL pfnOnMoreInfoClickDefault
;
280 PFN_PROVUI_CALL pfnOnAdvancedClick
;
281 PFN_PROVUI_CALL pfnOnAdvancedClickDefault
;
282 } CRYPT_PROVUI_FUNCS
, *PCRYPT_PROVUI_FUNCS
;
291 BOOL WINAPI
WintrustAddActionID(GUID
*,DWORD
,CRYPT_REGISTER_ACTIONID
*);
292 void WINAPI
WintrustGetRegPolicyFlags(DWORD
*);
293 LONG WINAPI
WinVerifyTrust(HWND
,GUID
*,WINTRUST_DATA
*);
294 HRESULT WINAPI
WinVerifyTrustEx(HWND
,GUID
*,WINTRUST_DATA
*);
296 CRYPT_PROVIDER_SGNR
* WINAPI
WTHelperGetProvSignerFromChain(
297 CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
, BOOL fCounterSigner
,
298 DWORD idxCounterSigner
);
299 CRYPT_PROVIDER_DATA
* WINAPI
WTHelperProvDataFromStateData(HANDLE hStateData
);