ntoskrnl.exe: Add stub for KeInitializeSemaphore.
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 #define WTCI_DONT_OPEN_STORES 0x00000001
80 #define WTCI_OPEN_ONLY_ROOT   0x00000002
81
82 /* dwUIChoice */
83 #define WTD_UI_ALL                1
84 #define WTD_UI_NONE               2
85 #define WTD_UI_NOBAD              3
86 #define WTD_UI_NOGOOD             4
87 /* fdwRevocationChecks */
88 #define WTD_REVOKE_NONE           0
89 #define WTD_REVOKE_WHOLECHAIN     1
90 /* dwUnionChoice */
91 #define WTD_CHOICE_FILE           1
92 #define WTD_CHOICE_CATALOG        2
93 #define WTD_CHOICE_BLOB           3
94 #define WTD_CHOICE_SIGNER         4
95 #define WTD_CHOICE_CERT           5
96
97 typedef struct _WINTRUST_DATA
98 {
99     DWORD  cbStruct;
100     LPVOID pPolicyCallbackData;
101     LPVOID pSIPClientData;
102     DWORD  dwUIChoice;
103     DWORD  fdwRevocationChecks;
104     DWORD  dwUnionChoice;
105     union
106     {
107         struct WINTRUST_FILE_INFO_*    pFile;
108         struct WINTRUST_CATALOG_INFO_* pCatalog;
109         struct WINTRUST_BLOB_INFO_*    pBlob;
110         struct WINTRUST_SGNR_INFO_*    pSgnr;
111         struct WINTRUST_CERT_INFO_*    pCert;
112     } DUMMYUNIONNAME;
113
114     DWORD  dwStateAction;
115     HANDLE hWVTStateData;
116     WCHAR* pwszURLReference;
117     DWORD  dwProvFlags;
118     DWORD  dwUIContext;
119 } WINTRUST_DATA, *PWINTRUST_DATA;
120
121 #define WTD_STATEACTION_IGNORE           0
122 #define WTD_STATEACTION_VERIFY           1
123 #define WTD_STATEACTION_CLOSE            2
124 #define WTD_STATEACTION_AUTO_CACHE       3
125 #define WTD_STATEACTION_AUTO_CACHE_FLUSH 4
126
127 #define WTD_PROV_FLAGS_MASK                     0x0000ffff
128 #define WTD_USE_IE4_TRUST_FLAG                  0x00000001
129 #define WTD_NO_IE4_CHAIN_FLAG                   0x00000002
130 #define WTD_NO_POLICY_USAGE_FLAG                0x00000004
131 #define WTD_REVOCATION_CHECK_NONE               0x00000010
132 #define WTD_REVOCATION_CHECK_END_CERT           0x00000020
133 #define WTD_REVOCATION_CHECK_CHAIN              0x00000040
134 #define WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00000080
135 #define WTD_SAFER_FLAG                          0x00000100
136 #define WTD_HASH_ONLY_FLAG                      0x00000200
137 #define WTD_USE_DEFAULT_OSVER_CHECK             0x00000400
138 #define WTD_LIFETIME_SIGNING_FLAG               0x00000800
139 #define WTD_CACHE_ONLY_URL_RETRIEVAL            0x00001000
140
141 #define WTD_UICONTEXT_EXECUTE 0
142 #define WTD_UICONTEXT_INSTALL 1
143
144 typedef struct _CRYPT_TRUST_REG_ENTRY
145 {
146     DWORD cbStruct;
147     WCHAR *pwszDLLName;
148     WCHAR *pwszFunctionName;
149 } CRYPT_TRUST_REG_ENTRY, *PCRYPT_TRUST_REG_ENTRY;
150
151 typedef struct _CRYPT_REGISTER_ACTIONID
152 {
153     DWORD cbStruct;
154     CRYPT_TRUST_REG_ENTRY sInitProvider;
155     CRYPT_TRUST_REG_ENTRY sObjectProvider;
156     CRYPT_TRUST_REG_ENTRY sSignatureProvider;
157     CRYPT_TRUST_REG_ENTRY sCertificateProvider;
158     CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider;
159     CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider;
160     CRYPT_TRUST_REG_ENTRY sTestPolicyProvider;
161     CRYPT_TRUST_REG_ENTRY sCleanupProvider;
162 } CRYPT_REGISTER_ACTIONID, *PCRYPT_REGISTER_ACTIONID;
163
164 typedef struct _CRYPT_PROVIDER_REGDEFUSAGE
165 {
166     DWORD cbStruct;
167     GUID  *pgActionID;
168     WCHAR *pwszDllName;
169     char  *pwszLoadCallbackDataFunctionName;
170     char  *pwszFreeCallbackDataFunctionName;
171 } CRYPT_PROVIDER_REGDEFUSAGE, *PCRYPT_PROVIDER_REGDEFUSAGE;
172
173 typedef struct _CRYPT_PROVUI_DATA {
174     DWORD cbStruct;
175     DWORD dwFinalError;
176     WCHAR *pYesButtonText;
177     WCHAR *pNoButtonText;
178     WCHAR *pMoreInfoButtonText;
179     WCHAR *pAdvancedLinkText;
180     WCHAR *pCopyActionText;
181     WCHAR *pCopyActionTextNoTS;
182     WCHAR *pCopyActionTextNotSigned;
183 } CRYPT_PROVUI_DATA, *PCRYPT_PROVUI_DATA;
184
185 typedef struct _CRYPT_PROVIDER_CERT {
186     DWORD               cbStruct;
187     PCCERT_CONTEXT      pCert;
188     BOOL                fCommercial;
189     BOOL                fTrustedRoot;
190     BOOL                fSelfSigned;
191     BOOL                fTestCert;
192     DWORD               dwRevokedReason;
193     DWORD               dwConfidence;
194     DWORD               dwError;
195     CTL_CONTEXT        *pTrustListContext;
196     BOOL                fTrustListSignerCert;
197     PCCTL_CONTEXT       pCtlContext;
198     DWORD               dwCtlError;
199     BOOL                fIsCyclic;
200     PCERT_CHAIN_ELEMENT pChainElement;
201 } CRYPT_PROVIDER_CERT, *PCRYPT_PROVIDER_CERT;
202
203 #define CERT_CONFIDENCE_SIG       0x10000000
204 #define CERT_CONFIDENCE_TIME      0x01000000
205 #define CERT_CONFIDENCE_TIMENEST  0x00100000
206 #define CERT_CONFIDENCE_AUTHIDEXT 0x00010000
207 #define CERT_CONFIDENCE_HYGIENE   0x00001000
208 #define CERT_CONFIDENCE_HIGHEST   0x11111000
209
210 typedef struct _CRYPT_PROVIDER_SGNR {
211     DWORD                cbStruct;
212     FILETIME             sftVerifyAsOf;
213     DWORD                csCertChain;
214     CRYPT_PROVIDER_CERT *pasCertChain;
215     DWORD                dwSignerType;
216     CMSG_SIGNER_INFO    *psSigner;
217     DWORD                dwError;
218     DWORD                csCounterSigners;
219     struct _CRYPT_PROVIDER_SGNR *pasCounterSigners;
220     PCCERT_CHAIN_CONTEXT pChainContext;
221 } CRYPT_PROVIDER_SGNR, *PCRYPT_PROVIDER_SGNR;
222
223 #define SGNR_TYPE_TIMESTAMP 0x00000010
224
225 typedef struct _CRYPT_PROVIDER_PRIVDATA {
226     DWORD cbStruct;
227     GUID  gProviderID;
228     DWORD cbProvData;
229     void *pvProvData;
230 } CRYPT_PROVIDER_PRIVDATA, *PCRYPT_PROVIDER_PRIVDATA;
231
232 struct _CRYPT_PROVIDER_DATA;
233
234 #define TRUSTERROR_STEP_WVTPARAMS               0
235 #define TRUSTERROR_STEP_FILEIO                  2
236 #define TRUSTERROR_STEP_SIP                     3
237 #define TRUSTERROR_STEP_SIPSUBJINFO             5
238 #define TRUSTERROR_STEP_CATALOGFILE             6
239 #define TRUSTERROR_STEP_CERTSTORE               7
240 #define TRUSTERROR_STEP_MESSAGE                 8
241 #define TRUSTERROR_STEP_MSG_SIGNERCOUNT         9
242 #define TRUSTERROR_STEP_MSG_INNERCNTTYPE       10
243 #define TRUSTERROR_STEP_MSG_INNERCNT           11
244 #define TRUSTERROR_STEP_MSG_STORE              12
245 #define TRUSTERROR_STEP_MSG_SIGNERINFO         13
246 #define TRUSTERROR_STEP_MSG_SIGNERCERT         14
247 #define TRUSTERROR_STEP_MSG_CERTCHAIN          15
248 #define TRUSTERROR_STEP_MSG_COUNTERSIGINFO     16
249 #define TRUSTERROR_STEP_MSG_COUNTERSIGCERT     17
250 #define TRUSTERROR_STEP_VERIFY_MSGHASH         18
251 #define TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA 19
252 #define TRUSTERROR_STEP_FINAL_WVTINIT          30
253 #define TRUSTERROR_STEP_FINAL_INITPROV         31
254 #define TRUSTERROR_STEP_FINAL_OBJPROV          32
255 #define TRUSTERROR_STEP_FINAL_SIGPROV          33
256 #define TRUSTERROR_STEP_FINAL_CERTPROV         34
257 #define TRUSTERROR_STEP_FINAL_CERTCHKPROV      35
258 #define TRUSTERROR_STEP_FINAL_POLICYPROV       36
259 #define TRUSTERROR_STEP_FINAL_UIPROV           37
260
261 #define TRUSTERROR_MAX_STEPS                   38
262
263 typedef void * (__WINE_ALLOC_SIZE(1) WINAPI *PFN_CPD_MEM_ALLOC)(DWORD cbSize);
264 typedef void (WINAPI *PFN_CPD_MEM_FREE)(void *pvMem2Free);
265 typedef BOOL (WINAPI *PFN_CPD_ADD_STORE)(struct _CRYPT_PROVIDER_DATA *pProvData,
266  HCERTSTORE hStore2Add);
267 typedef BOOL (WINAPI *PFN_CPD_ADD_SGNR)(struct _CRYPT_PROVIDER_DATA *pProvData,
268  BOOL fCounterSigner, DWORD idxSigner, struct _CRYPT_PROVIDER_SGNR *pSgnr2Add);
269 typedef BOOL (WINAPI *PFN_CPD_ADD_CERT)(struct _CRYPT_PROVIDER_DATA *pProvData,
270  DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner,
271  PCCERT_CONTEXT pCert2Add);
272 typedef BOOL (WINAPI *PFN_CPD_ADD_PRIVDATA)(struct _CRYPT_PROVIDER_DATA *pProvData,
273  struct _CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
274 typedef HRESULT (WINAPI *PFN_PROVIDER_INIT_CALL)(
275  struct _CRYPT_PROVIDER_DATA *pProvData);
276 typedef HRESULT (WINAPI *PFN_PROVIDER_OBJTRUST_CALL)(
277  struct _CRYPT_PROVIDER_DATA *pProvData);
278 typedef HRESULT (WINAPI *PFN_PROVIDER_SIGTRUST_CALL)(
279  struct _CRYPT_PROVIDER_DATA *pProvData);
280 typedef HRESULT (WINAPI *PFN_PROVIDER_CERTTRUST_CALL)(
281  struct _CRYPT_PROVIDER_DATA *pProvData);
282 typedef HRESULT (WINAPI *PFN_PROVIDER_FINALPOLICY_CALL)(
283  struct _CRYPT_PROVIDER_DATA *pProvData);
284 typedef HRESULT (WINAPI *PFN_PROVIDER_TESTFINALPOLICY_CALL)(
285  struct _CRYPT_PROVIDER_DATA *pProvData);
286 typedef HRESULT (WINAPI *PFN_PROVIDER_CLEANUP_CALL)(
287  struct _CRYPT_PROVIDER_DATA *pProvData);
288 typedef BOOL (WINAPI *PFN_PROVIDER_CERTCHKPOLICY_CALL)(
289  struct _CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner,
290  BOOL fCounterSignerChain, DWORD idxCounterSigner);
291
292 typedef struct _CRYPT_PROVIDER_FUNCTIONS {
293     DWORD cbStruct;
294     PFN_CPD_MEM_ALLOC    pfnAlloc;
295     PFN_CPD_MEM_FREE     pfnFree;
296     PFN_CPD_ADD_STORE    pfnAddStore2Chain;
297     PFN_CPD_ADD_SGNR     pfnAddSgnr2Chain;
298     PFN_CPD_ADD_CERT     pfnAddCert2Chain;
299     PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain;
300     PFN_PROVIDER_INIT_CALL            pfnInitialize;
301     PFN_PROVIDER_OBJTRUST_CALL        pfnObjectTrust;
302     PFN_PROVIDER_SIGTRUST_CALL        pfnSignatureTrust;
303     PFN_PROVIDER_CERTTRUST_CALL       pfnCertificateTrust;
304     PFN_PROVIDER_FINALPOLICY_CALL     pfnFinalPolicy;
305     PFN_PROVIDER_CERTCHKPOLICY_CALL   pfnCertCheckPolicy;
306     PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy;
307     struct _CRYPT_PROVUI_FUNCS       *psUIpfns;
308     PFN_PROVIDER_CLEANUP_CALL         pfnCleanupPolicy;
309 } CRYPT_PROVIDER_FUNCTIONS, *PCRYPT_PROVIDER_FUNCTIONS;
310
311 struct SIP_DISPATCH_INFO_;
312 struct SIP_SUBJECTINFO_;
313 struct SIP_INDIRECT_DATA_;
314
315 typedef struct _PROVDATA_SIP {
316     DWORD cbStruct;
317     GUID  gSubject;
318     struct SIP_DISPATCH_INFO_ *pSip;
319     struct SIP_DISPATCH_INFO_ *pCATSip;
320     struct SIP_SUBJECTINFO_   *psSipSubjectInfo;
321     struct SIP_SUBJECTINFO_   *psSipCATSubjectInfo;
322     struct SIP_INDIRECT_DATA_ *psIndirectData;
323 } PROVDATA_SIP, *PPROVDATA_SIP;
324
325 typedef struct _CRYPT_PROVIDER_DATA {
326     DWORD                     cbStruct;
327     WINTRUST_DATA            *pWintrustData;
328     BOOL                      fOpenedFile;
329     HWND                      hWndParent;
330     GUID                     *pgActionID;
331     HCRYPTPROV                hProv;
332     DWORD                     dwError;
333     DWORD                     dwRegSecuritySettings;
334     DWORD                     dwRegPolicySettings;
335     CRYPT_PROVIDER_FUNCTIONS *psPfns;
336     DWORD                     cdwTrustStepErrors;
337     DWORD                    *padwTrustStepErrors;
338     DWORD                     chStores;
339     HCERTSTORE               *pahStores;
340     DWORD                     dwEncoding;
341     HCRYPTMSG                 hMsg;
342     DWORD                     csSigners;
343     CRYPT_PROVIDER_SGNR      *pasSigners;
344     DWORD                     csProvPrivData;
345     CRYPT_PROVIDER_PRIVDATA  *pasProvPrivData;
346     DWORD                     dwSubjectChoice;
347     union {
348         struct _PROVDATA_SIP        *pPDSip;
349     } DUMMYUNIONNAME;
350     char                     *pszUsageOID;
351     BOOL                      fRecallWithState;
352     FILETIME                  sftSystemTime;
353     char                      *pszCTLSignerUsageOID;
354     DWORD                     dwProvFlags;
355     DWORD                     dwFinalError;
356     PCERT_USAGE_MATCH         pRequestUsage;
357     DWORD                     dwTrustPubSettings;
358     DWORD                     dwUIStateFlags;
359 } CRYPT_PROVIDER_DATA, *PCRYPT_PROVIDER_DATA;
360
361 #define CPD_CHOICE_SIP 1
362
363 #define CPD_USE_NT5_CHAIN_FLAG                  0x80000000
364 #define CPD_REVOCATION_CHECK_NONE               0x00010000
365 #define CPD_REVOCATION_CHECK_END_CERT           0x00020000
366 #define CPD_REVOCATION_CHECK_CHAIN              0x00040000
367 #define CPD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00080000
368
369 #define CPD_UISTATE_MODE_PROMPT 0x00000000
370 #define CPD_UISTATE_MODE_BLOCK  0x00000001
371 #define CPD_UISTATE_MODE_ALLOW  0x00000002
372 #define CPD_UISTATE_MODE_MASK   0x00000003
373
374 typedef BOOL (*PFN_PROVUI_CALL)(HWND hWndSecurityDialog,
375  struct _CRYPT_PROVIDER_DATA *pProvData);
376
377 typedef struct _CRYPT_PROVUI_FUNCS {
378     DWORD cbStruct;
379     CRYPT_PROVUI_DATA psUIData;
380     PFN_PROVUI_CALL pfnOnMoreInfoClick;
381     PFN_PROVUI_CALL pfnOnMoreInfoClickDefault;
382     PFN_PROVUI_CALL pfnOnAdvancedClick;
383     PFN_PROVUI_CALL pfnOnAdvancedClickDefault;
384 } CRYPT_PROVUI_FUNCS, *PCRYPT_PROVUI_FUNCS;
385
386 #include <poppack.h>
387
388 #define WVT_OFFSETOF(t,f)     ((ULONG)((ULONG_PTR)(&((t*)0)->f)))
389 #define WVT_ISINSTRUCT(t,s,f) (WVT_OFFSETOF(t,f) + sizeof(((t*)0)->f) <= (s))
390 #define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(t,s,f) WVT_ISINSTRUCT(t,s,f)
391
392 #define WTPF_TRUSTTEST            0x00000020
393 #define WTPF_TESTCANBEVALID       0x00000080
394 #define WTPF_IGNOREEXPIRATION     0x00000100
395 #define WTPF_IGNOREREVOKATION     0x00000200
396 #define WTPF_OFFLINEOK_IND        0x00000400
397 #define WTPF_OFFLINEOK_COM        0x00000800
398 #define WTPF_OFFLINEOKNBU_IND     0x00001000
399 #define WTPF_OFFLINEOKNBU_COM     0x00002000
400 #define WTPF_VERIFY_V1_OFF        0x00010000
401 #define WTPF_IGNOREREVOCATIONONTS 0x00020000
402 #define WTPF_ALLOWONLYPERTRUST    0x00040000
403
404 #define WT_ADD_ACTION_ID_RET_RESULT_FLAG 1
405
406 #ifdef __cplusplus
407 extern "C" {
408 #endif
409
410 #if defined(__GNUC__)
411 #define WT_PROVIDER_CERTTRUST_FUNCTION (const WCHAR []) \
412     {'W','i','n','t','r','u','s','t','C','e','r','t','i','f','i','c','a','t','e','T','r','u','s','t', 0}
413 #elif defined(_MSC_VER)
414 #define WT_PROVIDER_CERTTRUST_FUNCTION L"WintrustCertificateTrust"
415 #else
416 static const WCHAR WT_PROVIDER_CERTTRUST_FUNCTION[] =
417     {'W','i','n','t','r','u','s','t','C','e','r','t','i','f','i','c','a','t','e','T','r','u','s','t', 0};
418 #endif
419
420 BOOL      WINAPI WintrustAddActionID(GUID*,DWORD,CRYPT_REGISTER_ACTIONID*);
421 BOOL      WINAPI WintrustRemoveActionID(GUID*);
422 BOOL      WINAPI WintrustLoadFunctionPointers(GUID*,CRYPT_PROVIDER_FUNCTIONS*);
423 BOOL      WINAPI WintrustAddDefaultForUsage(const char*,CRYPT_PROVIDER_REGDEFUSAGE*);
424 void      WINAPI WintrustGetRegPolicyFlags(DWORD*);
425 BOOL      WINAPI WintrustSetRegPolicyFlags(DWORD);
426 LONG      WINAPI WinVerifyTrust(HWND,GUID*,LPVOID);
427 HRESULT   WINAPI WinVerifyTrustEx(HWND,GUID*,WINTRUST_DATA*);
428
429 CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(
430  CRYPT_PROVIDER_SGNR *pSgnr, DWORD idxCert);
431 CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(
432  CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner,
433  DWORD idxCounterSigner);
434 CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
435 CRYPT_PROVIDER_PRIVDATA * WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *,GUID *);
436
437 #define SPC_INDIRECT_DATA_OBJID      "1.3.6.1.4.1.311.2.1.4"
438 #define SPC_SP_AGENCY_INFO_OBJID     "1.3.6.1.4.1.311.2.1.10"
439 #define SPC_STATEMENT_TYPE_OBJID     "1.3.6.1.4.1.311.2.1.11"
440 #define SPC_SP_OPUS_INFO_OBJID       "1.3.6.1.4.1.311.2.1.12"
441 #define SPC_CERT_EXTENSIONS_OBJID    "1.3.6.1.4.1.311.2.1.14"
442 #define SPC_PE_IMAGE_DATA_OBJID      "1.3.6.1.4.1.311.2.1.15"
443 #define SPC_RAW_FILE_DATA_OBJID      "1.3.6.1.4.1.311.2.1.18"
444 #define SPC_STRUCTURED_STORAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.19"
445 #define SPC_JAVA_CLASS_DATA_OBJID    "1.3.6.1.4.1.311.2.1.20"
446 #define SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.21"
447 #define SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.22"
448 #define SPC_CAB_DATA_OBJID           "1.3.6.1.4.1.311.2.1.25"
449 #define SPC_GLUE_RDN_OBJID           "1.3.6.1.4.1.311.2.1.25"
450 #define SPC_MINIMAL_CRITERIA_OBJID   "1.3.6.1.4.1.311.2.1.26"
451 #define SPC_FINANCIAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.27"
452 #define SPC_LINK_OBJID               "1.3.6.1.4.1.311.2.1.28"
453 #define SPC_SIGINFO_OBJID            "1.3.6.1.4.1.311.2.1.30"
454 #define CAT_NAMEVALUE_OBJID          "1.3.6.1.4.1.311.12.2.1"
455 #define CAT_MEMBERINFO_OBJID         "1.3.6.1.4.1.311.12.2.2"
456
457 #define SPC_SP_AGENCY_INFO_STRUCT        ((LPCSTR) 2000)
458 #define SPC_MINIMAL_CRITERIA_STRUCT      ((LPCSTR) 2001)
459 #define SPC_FINANCIAL_CRITERIA_STRUCT    ((LPCSTR) 2002)
460 #define SPC_INDIRECT_DATA_CONTENT_STRUCT ((LPCSTR) 2003)
461 #define SPC_PE_IMAGE_DATA_STRUCT         ((LPCSTR) 2004)
462 #define SPC_LINK_STRUCT                  ((LPCSTR) 2005)
463 #define SPC_STATEMENT_TYPE_STRUCT        ((LPCSTR) 2006)
464 #define SPC_SP_OPUS_INFO_STRUCT          ((LPCSTR) 2007)
465 #define SPC_CAB_DATA_STRUCT              ((LPCSTR) 2008)
466 #define SPC_JAVA_CLASS_DATA_STRUCT       ((LPCSTR) 2009)
467 #define SPC_SIGINFO_STRUCT               ((LPCSTR) 2130)
468 #define CAT_NAMEVALUE_STRUCT             ((LPCSTR) 2221)
469 #define CAT_MEMBERINFO_STRUCT            ((LPCSTR) 2222)
470
471 #define SPC_UUID_LENGTH 16
472 typedef BYTE SPC_UUID[SPC_UUID_LENGTH];
473
474 typedef struct _SPC_SERIALIZED_OBJECT
475 {
476     SPC_UUID        ClassId;
477     CRYPT_DATA_BLOB SerializedData;
478 } SPC_SERIALIZED_OBJECT, *PSPC_SERIALIZED_OBJECT;
479
480 typedef struct SPC_SIGINFO_
481 {
482     DWORD dwSipVersion;
483     GUID  gSIPGuid;
484     DWORD dwReserved1;
485     DWORD dwReserved2;
486     DWORD dwReserved3;
487     DWORD dwReserved4;
488     DWORD dwReserved5;
489 } SPC_SIGINFO, *PSPC_SIGINFO;
490
491 #define SPC_URL_LINK_CHOICE     1
492 #define SPC_MONIKER_LINK_CHOICE 2
493 #define SPC_FILE_LINK_CHOICE    3
494
495 typedef struct SPC_LINK_
496 {
497     DWORD dwLinkChoice;
498     union
499     {
500         LPWSTR                pwszUrl;
501         SPC_SERIALIZED_OBJECT Moniker;
502         LPWSTR                pwszFile;
503     } DUMMYUNIONNAME;
504 } SPC_LINK, *PSPC_LINK;
505
506 typedef struct _SPC_PE_IMAGE_DATA
507 {
508     CRYPT_BIT_BLOB Flags;
509     PSPC_LINK      pFile;
510 } SPC_PE_IMAGE_DATA, *PSPC_PE_IMAGE_DATA;
511
512 typedef struct _SPC_INDIRECT_DATA_CONTENT
513 {
514     CRYPT_ATTRIBUTE_TYPE_VALUE Data;
515     CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
516     CRYPT_HASH_BLOB            Digest;
517 } SPC_INDIRECT_DATA_CONTENT, *PSPC_INDIRECT_DATA_CONTENT;
518
519 typedef struct _SPC_FINANCIAL_CRITERIA
520 {
521     BOOL fFinancialInfoAvailable;
522     BOOL fMeetsCriteria;
523 } SPC_FINANCIAL_CRITERIA, *PSPC_FINANCIAL_CRITERIA;
524
525 typedef struct _SPC_IMAGE
526 {
527     struct SPC_LINK_ *pImageLink;
528     CRYPT_DATA_BLOB   Bitmap;
529     CRYPT_DATA_BLOB   Metafile;
530     CRYPT_DATA_BLOB   EnhancedMetafile;
531     CRYPT_DATA_BLOB   GifFile;
532 } SPC_IMAGE, *PSPC_IMAGE;
533
534 typedef struct _SPC_SP_AGENCY_INFO
535 {
536     struct SPC_LINK_ *pPolicyInformation;
537     LPWSTR            pwszPolicyDisplayText;
538     PSPC_IMAGE        pLogoImage;
539     struct SPC_LINK_ *pLogoLink;
540 } SPC_SP_AGENCY_INFO, *PSPC_SP_AGENCY_INFO;
541
542 typedef struct _SPC_STATEMENT_TYPE
543 {
544     DWORD  cKeyPurposeId;
545     LPSTR *rgpszKeyPurposeId;
546 } SPC_STATEMENT_TYPE, *PSPC_STATEMENT_TYPE;
547
548 typedef struct _SPC_SP_OPUS_INFO
549 {
550     LPCWSTR           pwszProgramName;
551     struct SPC_LINK_ *pMoreInfo;
552     struct SPC_LINK_ *pPublisherInfo;
553 } SPC_SP_OPUS_INFO, *PSPC_SP_OPUS_INFO;
554
555 typedef struct _CAT_NAMEVALUE
556 {
557     LPWSTR          pwszTag;
558     DWORD           fdwFlags;
559     CRYPT_DATA_BLOB Value;
560 } CAT_NAMEVALUE, *PCAT_NAMEVALUE;
561
562 typedef struct _CAT_MEMBERINFO
563 {
564     LPWSTR pwszSubjGuid;
565     DWORD  dwCertVersion;
566 } CAT_MEMBERINFO, *PCAT_MEMBERINFO;
567
568 /* PSDK protects the remaining defines with WT_DEFINE_ALL_APIS, but it's
569  * defined by default.  No need to protect against bad headers from old PSDKs.
570  */
571
572 typedef struct _WIN_CERTIFICATE {
573   DWORD dwLength;
574   WORD  wRevision;                   /*  WIN_CERT_REVISION_xxx */
575   WORD  wCertificateType;            /*  WIN_CERT_TYPE_xxx */
576   BYTE  bCertificate[ANYSIZE_ARRAY];
577 } WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
578
579 #define WIN_CERT_REVISION_1_0 0x0100
580 #define WIN_CERT_REVISION_2_0 0x0200
581
582 #define WIN_CERT_TYPE_X509             0x0001 /* X.509 Certificate */
583 #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 /* PKCS SignedData */
584 #define WIN_CERT_TYPE_RESERVED_1       0x0003 /* Reserved */
585 #define WIN_CERT_TYPE_TS_STACK_SIGNED  0x0004
586
587 typedef LPVOID WIN_TRUST_SUBJECT;
588
589 typedef struct _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT
590 {
591     HANDLE            hClientToken;
592     GUID             *SubjectType;
593     WIN_TRUST_SUBJECT Subject;
594 } WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT,
595  *LPWIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT;
596
597 typedef struct _WIN_TRUST_ACTDATA_CONTEXT_SUBJECT_ONLY
598 {
599     GUID             *SubjectType;
600     WIN_TRUST_SUBJECT Subject;
601 } WIN_TRUST_ACTDATA_CONTEXT_SUBJECT_ONLY,
602  *LPWIN_TRUST_ACTDATA_CONTEXT_SUBJECT_ONLY;
603
604 typedef struct _WIN_TRUST_SUBJECT_FILE
605 {
606     HANDLE  hFile;
607     LPCWSTR lpPath;
608 } WIN_TRUST_SUBJECT_FILE, *LPWIN_TRUST_SUBJECT_FILE;
609
610 typedef struct _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY
611 {
612     HANDLE  hFile;
613     LPCWSTR lpPath;
614     LPCWSTR lpDisplayName;
615 } WIN_TRUST_SUBJECT_FILE_AND_DISPLAY, *LPWIN_TRUST_SUBJECT_FILE_AND_DISPLAY;
616
617 #define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE \
618      { 0x64b9d180, 0x8da2, 0x11cf, { 0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb }}
619
620 #ifdef __cplusplus
621 }
622 #endif
623
624 #endif