advpack: Fix the documentation for the cmdline parameter of LaunchInfSection/Ex.
[wine] / include / wintrust.h
1 /*
2  * Copyright (C) 2004 Francois Gouget
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __WINE_WINTRUST_H
20 #define __WINE_WINTRUST_H
21
22 #include <wincrypt.h>
23
24
25 #include <pshpack8.h>
26
27 typedef struct WINTRUST_FILE_INFO_
28 {
29     DWORD   cbStruct;
30     LPCWSTR pcwszFilePath;
31     HANDLE  hFile;
32     GUID*   pgKnownSubject;
33 } WINTRUST_FILE_INFO, *PWINTRUST_FILE_INFO;
34
35 typedef struct WINTRUST_CATALOG_INFO_
36 {
37     DWORD         cbStruct;
38     DWORD         dwCatalogVersion;
39     LPCWSTR       pcwszCatalogFilePath;
40     LPCWSTR       pcwszMemberTag;
41     LPCWSTR       pcwszMemberFilePath;
42     HANDLE        hMemberFile;
43     BYTE*         pbCalculatedFileHash;
44     DWORD         cbCalculatedFileHash;
45     PCCTL_CONTEXT pcCatalogContext;
46 } WINTRUST_CATALOG_INFO, *PWINTRUST_CATALOG_INFO;
47
48 typedef struct WINTRUST_BLOB_INFO_
49 {
50     DWORD   cbStruct;
51     GUID    gSubject;
52     LPCWSTR pcwszDisplayName;
53     DWORD   cbMemObject;
54     BYTE*   pbMemObject;
55     DWORD   cbMemSignedMsg;
56     BYTE*   pbMemSignedMsg;
57 } WINTRUST_BLOB_INFO, *PWINTRUST_BLOB_INFO;
58
59 typedef struct WINTRUST_SGNR_INFO_
60 {
61     DWORD             cbStruct;
62     LPCWSTR           pcwszDisplayName;
63     CMSG_SIGNER_INFO* psSignerInfo;
64     DWORD             chStores;
65     HCERTSTORE*       pahStores;
66 } WINTRUST_SGNR_INFO, *PWINTRUST_SGNR_INFO;
67
68 typedef struct WINTRUST_CERT_INFO_
69 {
70     DWORD         cbStruct;
71     LPCWSTR       pcwszDisplayName;
72     CERT_CONTEXT* psCertContext;
73     DWORD         chStores;
74     HCERTSTORE*   pahStores;
75     DWORD         dwFlags;
76     FILETIME*     psftVerifyAsOf;
77 } WINTRUST_CERT_INFO, *PWINTRUST_CERT_INFO;
78
79
80 typedef struct _WINTRUST_DATA
81 {
82     DWORD  cbStruct;
83     LPVOID pPolicyCallbackData;
84     LPVOID pSIPClientData;
85     DWORD  dwUIChoice;
86     DWORD  fdwRevocationChecks;
87     DWORD  dwUnionChoice;
88     union
89     {
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;
95     } DUMMYUNIONNAME;
96
97     DWORD  dwStateAction;
98     HANDLE hWVTStateData;
99     WCHAR* pwszURLReference;
100     DWORD  dwProvFlags;
101     DWORD  dwUIContext;
102 } WINTRUST_DATA, *PWINTRUST_DATA;
103
104 typedef struct _CRYPT_TRUST_REG_ENTRY
105 {
106     DWORD cbStruct;
107     WCHAR *pwszDLLName;
108     WCHAR *pwszFunctionName;
109 } CRYPT_TRUST_REG_ENTRY, *PCRYPT_TRUST_REG_ENTRY;
110
111 typedef struct _CRYPT_REGISTER_ACTIONID
112 {
113     DWORD cbStruct;
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;
123
124 typedef struct _CRYPT_PROVUI_DATA {
125     DWORD cbStruct;
126     DWORD dwFinalError;
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;
135
136 typedef struct _CRYPT_PROVIDER_CERT {
137     DWORD               cbStruct;
138     PCCERT_CONTEXT      pCert;
139     BOOL                fCommercial;
140     BOOL                fTrustedRoot;
141     BOOL                fSelfSigned;
142     BOOL                fTestCert;
143     DWORD               dwRevokedReason;
144     DWORD               dwConfidence;
145     DWORD               dwError;
146     CTL_CONTEXT        *pTrustListContext;
147     BOOL                fTrustListSignerCert;
148     PCCTL_CONTEXT       pCtlContext;
149     DWORD               dwCtlError;
150     BOOL                fIsCyclic;
151     PCERT_CHAIN_ELEMENT pChainElement;
152 } CRYPT_PROVIDER_CERT, *PCRYPT_PROVIDER_CERT;
153
154 typedef struct _CRYPT_PROVIDER_SGNR {
155     DWORD                cbStruct;
156     FILETIME             sftVerifyAsOf;
157     DWORD                csCertChain;
158     CRYPT_PROVIDER_CERT *pasCertChain;
159     DWORD                dwSignerType;
160     CMSG_SIGNER_INFO    *psSigner;
161     DWORD                dwError;
162     DWORD                csCounterSigners;
163     struct _CRYPT_PROVIDER_SGNR *pasCounterSigners;
164     PCCERT_CHAIN_CONTEXT pChainContext;
165 } CRYPT_PROVIDER_SGNR, *PCRYPT_PROVIDER_SGNR;
166
167 typedef struct _CRYPT_PROVIDER_PRIVDATA {
168     DWORD cbStruct;
169     GUID  gProviderID;
170     DWORD cbProvData;
171     void *pvProvData;
172 } CRYPT_PROVIDER_PRIVDATA, *PCRYPT_PROVIDER_PRIVDATA;
173
174 struct _CRYPT_PROVIDER_DATA;
175
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);
204
205 typedef struct _CRYPT_PROVIDER_FUNCTIONS {
206     DWORD cbStruct;
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;
223
224 struct SIP_DISPATCH_INFO_;
225 struct SIP_SUBJECTINFO_;
226 struct SIP_INDIRECT_DATA_;
227
228 typedef struct _PROVDATA_SIP {
229     DWORD cbStruct;
230     GUID  gSubject;
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;
237
238 typedef struct _CRYPT_PROVIDER_DATA {
239     DWORD                     cbStruct;
240     WINTRUST_DATA            *pWintrustData;
241     BOOL                      fOpenedFile;
242     HWND                      hWndParent;
243     GUID                     *pgActionID;
244     HCRYPTPROV                hProv;
245     DWORD                     dwError;
246     DWORD                     dwRegSecuritySettings;
247     DWORD                     dwRegPolicySettings;
248     CRYPT_PROVIDER_FUNCTIONS *psPfns;
249     DWORD                     cdwTrustStepErrors;
250     DWORD                    *padwTrustStepErrors;
251     DWORD                     chStores;
252     HCERTSTORE               *pahStores;
253     DWORD                     dwEncoding;
254     HCRYPTMSG                 hMsg;
255     DWORD                     csSigners;
256     CRYPT_PROVIDER_SGNR      *pasSigners;
257     DWORD                     dwSubjectChoice;
258     union {
259         struct _PROVDATA_SIP        *pPDSip;
260     } DUMMYUNIONNAME;
261     char                     *pszUsageOID;
262     BOOL                      fRecallWithState;
263     FILETIME                  sftSystemTime;
264     char                      *pszCTLSignerUsageOID;
265     DWORD                     dwProvFlags;
266     DWORD                     dwFinalError;
267     PCERT_USAGE_MATCH         pRequestUsage;
268     DWORD                     dwTrustPubSettings;
269     DWORD                     dwUIStateFlags;
270 } CRYPT_PROVIDER_DATA, *PCRYPT_PROVIDER_DATA;
271
272 typedef BOOL (*PFN_PROVUI_CALL)(HWND hWndSecurityDialog,
273  struct _CRYPT_PROVIDER_DATA *pProvData);
274
275 typedef struct _CRYPT_PROVUI_FUNCS {
276     DWORD cbStruct;
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;
283
284 #include <poppack.h>
285
286
287 #ifdef __cplusplus
288 extern "C" {
289 #endif
290
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*);
295
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);
300
301 #ifdef __cplusplus
302 }
303 #endif
304
305 #endif