Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef WINTRUST_H
      7 #define WINTRUST_H
      8 
      9 #include <wincrypt.h>
     10 
     11 #ifdef __cplusplus
     12 extern "C"
     13 {
     14 #endif
     15 
     16 #ifndef WIN_CERT_REVISION_1_0
     17 #define WT_DEFINE_ALL_APIS
     18 #else
     19 #undef WT_DEFINE_ALL_APIS
     20 #endif
     21 
     22 #include <pshpack8.h>
     23 
     24 #define WTD_UI_ALL 1
     25 #define WTD_UI_NONE 2
     26 #define WTD_UI_NOBAD 3
     27 #define WTD_UI_NOGOOD 4
     28 
     29 #define WTD_REVOKE_NONE 0x00000000
     30 #define WTD_REVOKE_WHOLECHAIN 0x00000001
     31 
     32 #define WTD_CHOICE_FILE 1
     33 #define WTD_CHOICE_CATALOG 2
     34 #define WTD_CHOICE_BLOB 3
     35 #define WTD_CHOICE_SIGNER 4
     36 #define WTD_CHOICE_CERT 5
     37 
     38 #define WTD_STATEACTION_IGNORE 0x00000000
     39 #define WTD_STATEACTION_VERIFY 0x00000001
     40 #define WTD_STATEACTION_CLOSE 0x00000002
     41 #define WTD_STATEACTION_AUTO_CACHE 0x00000003
     42 #define WTD_STATEACTION_AUTO_CACHE_FLUSH 0x00000004
     43 
     44 #define WTD_PROV_FLAGS_MASK 0x0000FFFF
     45 #define WTD_USE_IE4_TRUST_FLAG 0x00000001
     46 #define WTD_NO_IE4_CHAIN_FLAG 0x00000002
     47 #define WTD_NO_POLICY_USAGE_FLAG 0x00000004
     48 #define WTD_REVOCATION_CHECK_NONE 0x00000010
     49 #define WTD_REVOCATION_CHECK_END_CERT 0x00000020
     50 #define WTD_REVOCATION_CHECK_CHAIN 0x00000040
     51 #define WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00000080
     52 #define WTD_SAFER_FLAG 0x00000100
     53 #define WTD_HASH_ONLY_FLAG 0x00000200
     54 #define WTD_USE_DEFAULT_OSVER_CHECK 0x00000400
     55 #define WTD_LIFETIME_SIGNING_FLAG 0x00000800
     56 #define WTD_CACHE_ONLY_URL_RETRIEVAL 0x00001000
     57 
     58 #define WTD_UICONTEXT_EXECUTE 0
     59 #define WTD_UICONTEXT_INSTALL 1
     60 
     61   typedef struct _WINTRUST_DATA {
     62     DWORD cbStruct;
     63     LPVOID pPolicyCallbackData;
     64     LPVOID pSIPClientData;
     65     DWORD dwUIChoice;
     66     DWORD fdwRevocationChecks;
     67     DWORD dwUnionChoice;
     68     __C89_NAMELESS union {
     69       struct WINTRUST_FILE_INFO_ *pFile;
     70       struct WINTRUST_CATALOG_INFO_ *pCatalog;
     71       struct WINTRUST_BLOB_INFO_ *pBlob;
     72       struct WINTRUST_SGNR_INFO_ *pSgnr;
     73       struct WINTRUST_CERT_INFO_ *pCert;
     74     };
     75     DWORD dwStateAction;
     76     HANDLE hWVTStateData;
     77     WCHAR *pwszURLReference;
     78     DWORD dwProvFlags;
     79     DWORD dwUIContext;
     80   } WINTRUST_DATA,*PWINTRUST_DATA;
     81 
     82   typedef struct WINTRUST_FILE_INFO_ {
     83     DWORD cbStruct;
     84     LPCWSTR pcwszFilePath;
     85     HANDLE hFile;
     86     GUID *pgKnownSubject;
     87   } WINTRUST_FILE_INFO,*PWINTRUST_FILE_INFO;
     88 
     89   typedef struct WINTRUST_CATALOG_INFO_ {
     90     DWORD cbStruct;
     91     DWORD dwCatalogVersion;
     92     LPCWSTR pcwszCatalogFilePath;
     93     LPCWSTR pcwszMemberTag;
     94     LPCWSTR pcwszMemberFilePath;
     95     HANDLE hMemberFile;
     96     BYTE *pbCalculatedFileHash;
     97     DWORD cbCalculatedFileHash;
     98     PCCTL_CONTEXT pcCatalogContext;
     99   } WINTRUST_CATALOG_INFO,*PWINTRUST_CATALOG_INFO;
    100 
    101   typedef struct WINTRUST_BLOB_INFO_ {
    102     DWORD cbStruct;
    103     GUID gSubject;
    104     LPCWSTR pcwszDisplayName;
    105     DWORD cbMemObject;
    106     BYTE *pbMemObject;
    107     DWORD cbMemSignedMsg;
    108     BYTE *pbMemSignedMsg;
    109   } WINTRUST_BLOB_INFO,*PWINTRUST_BLOB_INFO;
    110 
    111   typedef struct WINTRUST_SGNR_INFO_ {
    112     DWORD cbStruct;
    113     LPCWSTR pcwszDisplayName;
    114     CMSG_SIGNER_INFO *psSignerInfo;
    115     DWORD chStores;
    116     HCERTSTORE *pahStores;
    117   } WINTRUST_SGNR_INFO,*PWINTRUST_SGNR_INFO;
    118 
    119 #define WTCI_DONT_OPEN_STORES 0x00000001
    120 #define WTCI_OPEN_ONLY_ROOT 0x00000002
    121 
    122   typedef struct WINTRUST_CERT_INFO_ {
    123     DWORD cbStruct;
    124     LPCWSTR pcwszDisplayName;
    125     CERT_CONTEXT *psCertContext;
    126     DWORD chStores;
    127     HCERTSTORE *pahStores;
    128     DWORD dwFlags;
    129     FILETIME *psftVerifyAsOf;
    130   } WINTRUST_CERT_INFO,*PWINTRUST_CERT_INFO;
    131 
    132 #include <poppack.h>
    133 
    134   extern LONG WINAPI WinVerifyTrust(HWND hwnd,GUID *pgActionID,LPVOID pWVTData);
    135   extern HRESULT WINAPI WinVerifyTrustEx(HWND hwnd,GUID *pgActionID,WINTRUST_DATA *pWinTrustData);
    136 
    137 #define WTPF_TRUSTTEST 0x00000020
    138 #define WTPF_TESTCANBEVALID 0x00000080
    139 #define WTPF_IGNOREEXPIRATION 0x00000100
    140 #define WTPF_IGNOREREVOKATION 0x00000200
    141 #define WTPF_OFFLINEOK_IND 0x00000400
    142 #define WTPF_OFFLINEOK_COM 0x00000800
    143 #define WTPF_OFFLINEOKNBU_IND 0x00001000
    144 #define WTPF_OFFLINEOKNBU_COM 0x00002000
    145 #define WTPF_VERIFY_V1_OFF 0x00010000
    146 #define WTPF_IGNOREREVOCATIONONTS 0x00020000
    147 #define WTPF_ALLOWONLYPERTRUST 0x00040000
    148 
    149   extern void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags);
    150   extern WINBOOL WINAPI WintrustSetRegPolicyFlags(DWORD dwPolicyFlags);
    151 
    152 #define TRUSTERROR_STEP_WVTPARAMS 0
    153 #define TRUSTERROR_STEP_FILEIO 2
    154 #define TRUSTERROR_STEP_SIP 3
    155 #define TRUSTERROR_STEP_SIPSUBJINFO 5
    156 #define TRUSTERROR_STEP_CATALOGFILE 6
    157 #define TRUSTERROR_STEP_CERTSTORE 7
    158 #define TRUSTERROR_STEP_MESSAGE 8
    159 #define TRUSTERROR_STEP_MSG_SIGNERCOUNT 9
    160 #define TRUSTERROR_STEP_MSG_INNERCNTTYPE 10
    161 #define TRUSTERROR_STEP_MSG_INNERCNT 11
    162 #define TRUSTERROR_STEP_MSG_STORE 12
    163 #define TRUSTERROR_STEP_MSG_SIGNERINFO 13
    164 #define TRUSTERROR_STEP_MSG_SIGNERCERT 14
    165 #define TRUSTERROR_STEP_MSG_CERTCHAIN 15
    166 #define TRUSTERROR_STEP_MSG_COUNTERSIGINFO 16
    167 #define TRUSTERROR_STEP_MSG_COUNTERSIGCERT 17
    168 #define TRUSTERROR_STEP_VERIFY_MSGHASH 18
    169 #define TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA 19
    170 
    171 #define TRUSTERROR_STEP_FINAL_WVTINIT 30
    172 #define TRUSTERROR_STEP_FINAL_INITPROV 31
    173 #define TRUSTERROR_STEP_FINAL_OBJPROV 32
    174 #define TRUSTERROR_STEP_FINAL_SIGPROV 33
    175 #define TRUSTERROR_STEP_FINAL_CERTPROV 34
    176 #define TRUSTERROR_STEP_FINAL_CERTCHKPROV 35
    177 #define TRUSTERROR_STEP_FINAL_POLICYPROV 36
    178 #define TRUSTERROR_STEP_FINAL_UIPROV 37
    179 
    180 #define TRUSTERROR_MAX_STEPS 38
    181 
    182   typedef void *(*PFN_CPD_MEM_ALLOC)(DWORD cbSize);
    183   typedef void (*PFN_CPD_MEM_FREE)(void *pvMem2Free);
    184   typedef WINBOOL (*PFN_CPD_ADD_STORE)(struct _CRYPT_PROVIDER_DATA *pProvData,HCERTSTORE hStore2Add);
    185   typedef WINBOOL (*PFN_CPD_ADD_SGNR)(struct _CRYPT_PROVIDER_DATA *pProvData,WINBOOL fCounterSigner,DWORD idxSigner,struct _CRYPT_PROVIDER_SGNR *pSgnr2Add);
    186   typedef WINBOOL (*PFN_CPD_ADD_CERT)(struct _CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSigner,DWORD idxCounterSigner,PCCERT_CONTEXT pCert2Add);
    187   typedef WINBOOL (*PFN_CPD_ADD_PRIVDATA)(struct _CRYPT_PROVIDER_DATA *pProvData,struct _CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
    188   typedef HRESULT (*PFN_PROVIDER_INIT_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    189   typedef HRESULT (*PFN_PROVIDER_OBJTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    190   typedef HRESULT (*PFN_PROVIDER_SIGTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    191   typedef HRESULT (*PFN_PROVIDER_CERTTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    192   typedef HRESULT (*PFN_PROVIDER_FINALPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    193   typedef HRESULT (*PFN_PROVIDER_TESTFINALPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    194   typedef HRESULT (*PFN_PROVIDER_CLEANUP_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
    195   typedef WINBOOL (*PFN_PROVIDER_CERTCHKPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSignerChain,DWORD idxCounterSigner);
    196 
    197 #define WVT_OFFSETOF(t,f) ((ULONG)((ULONG_PTR)(&((t*)0)->f)))
    198 #define WVT_ISINSTRUCT(structtypedef,structpassedsize,member) ((WVT_OFFSETOF(structtypedef,member) < structpassedsize) ? TRUE : FALSE)
    199 #define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(structtypedef,structpassedsize,member) WVT_ISINSTRUCT(structtypedef,structpassedsize,member)
    200 
    201 #include <pshpack8.h>
    202 
    203 #define CPD_CHOICE_SIP 1
    204 
    205 #define CPD_USE_NT5_CHAIN_FLAG 0x80000000
    206 #define CPD_REVOCATION_CHECK_NONE 0x00010000
    207 #define CPD_REVOCATION_CHECK_END_CERT 0x00020000
    208 #define CPD_REVOCATION_CHECK_CHAIN 0x00040000
    209 #define CPD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00080000
    210 
    211 #define CPD_UISTATE_MODE_PROMPT 0x00000000
    212 #define CPD_UISTATE_MODE_BLOCK 0x00000001
    213 #define CPD_UISTATE_MODE_ALLOW 0x00000002
    214 #define CPD_UISTATE_MODE_MASK 0x00000003
    215 
    216   typedef struct _CRYPT_PROVIDER_DATA {
    217     DWORD cbStruct;
    218     WINTRUST_DATA *pWintrustData;
    219     WINBOOL fOpenedFile;
    220     HWND hWndParent;
    221     GUID *pgActionID;
    222     HCRYPTPROV hProv;
    223     DWORD dwError;
    224     DWORD dwRegSecuritySettings;
    225     DWORD dwRegPolicySettings;
    226     struct _CRYPT_PROVIDER_FUNCTIONS *psPfns;
    227     DWORD cdwTrustStepErrors;
    228     DWORD *padwTrustStepErrors;
    229     DWORD chStores;
    230     HCERTSTORE *pahStores;
    231     DWORD dwEncoding;
    232     HCRYPTMSG hMsg;
    233     DWORD csSigners;
    234     struct _CRYPT_PROVIDER_SGNR *pasSigners;
    235     DWORD csProvPrivData;
    236     struct _CRYPT_PROVIDER_PRIVDATA *pasProvPrivData;
    237     DWORD dwSubjectChoice;
    238     __C89_NAMELESS union {
    239       struct _PROVDATA_SIP *pPDSip;
    240     };
    241     char *pszUsageOID;
    242     WINBOOL fRecallWithState;
    243     FILETIME sftSystemTime;
    244     char *pszCTLSignerUsageOID;
    245     DWORD dwProvFlags;
    246     DWORD dwFinalError;
    247     PCERT_USAGE_MATCH pRequestUsage;
    248     DWORD dwTrustPubSettings;
    249     DWORD dwUIStateFlags;
    250   } CRYPT_PROVIDER_DATA,*PCRYPT_PROVIDER_DATA;
    251 
    252   typedef struct _CRYPT_PROVIDER_FUNCTIONS {
    253     DWORD cbStruct;
    254     PFN_CPD_MEM_ALLOC pfnAlloc;
    255     PFN_CPD_MEM_FREE pfnFree;
    256     PFN_CPD_ADD_STORE pfnAddStore2Chain;
    257     PFN_CPD_ADD_SGNR pfnAddSgnr2Chain;
    258     PFN_CPD_ADD_CERT pfnAddCert2Chain;
    259     PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain;
    260     PFN_PROVIDER_INIT_CALL pfnInitialize;
    261     PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust;
    262     PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust;
    263     PFN_PROVIDER_CERTTRUST_CALL pfnCertificateTrust;
    264     PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy;
    265     PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy;
    266     PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy;
    267     struct _CRYPT_PROVUI_FUNCS *psUIpfns;
    268     PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy;
    269   } CRYPT_PROVIDER_FUNCTIONS,*PCRYPT_PROVIDER_FUNCTIONS;
    270 
    271   typedef WINBOOL (*PFN_PROVUI_CALL)(HWND hWndSecurityDialog,struct _CRYPT_PROVIDER_DATA *pProvData);
    272 
    273   typedef struct _CRYPT_PROVUI_FUNCS {
    274     DWORD cbStruct;
    275     struct _CRYPT_PROVUI_DATA *psUIData;
    276     PFN_PROVUI_CALL pfnOnMoreInfoClick;
    277     PFN_PROVUI_CALL pfnOnMoreInfoClickDefault;
    278     PFN_PROVUI_CALL pfnOnAdvancedClick;
    279     PFN_PROVUI_CALL pfnOnAdvancedClickDefault;
    280   } CRYPT_PROVUI_FUNCS,*PCRYPT_PROVUI_FUNCS;
    281 
    282   typedef struct _CRYPT_PROVUI_DATA {
    283     DWORD cbStruct;
    284     DWORD dwFinalError;
    285     WCHAR *pYesButtonText;
    286     WCHAR *pNoButtonText;
    287     WCHAR *pMoreInfoButtonText;
    288     WCHAR *pAdvancedLinkText;
    289     WCHAR *pCopyActionText;
    290     WCHAR *pCopyActionTextNoTS;
    291     WCHAR *pCopyActionTextNotSigned;
    292   } CRYPT_PROVUI_DATA,*PCRYPT_PROVUI_DATA;
    293 
    294 #define SGNR_TYPE_TIMESTAMP 0x00000010
    295 
    296   typedef struct _CRYPT_PROVIDER_SGNR {
    297     DWORD cbStruct;
    298     FILETIME sftVerifyAsOf;
    299     DWORD csCertChain;
    300     struct _CRYPT_PROVIDER_CERT *pasCertChain;
    301     DWORD dwSignerType;
    302     CMSG_SIGNER_INFO *psSigner;
    303     DWORD dwError;
    304     DWORD csCounterSigners;
    305     struct _CRYPT_PROVIDER_SGNR *pasCounterSigners;
    306     PCCERT_CHAIN_CONTEXT pChainContext;
    307   } CRYPT_PROVIDER_SGNR,*PCRYPT_PROVIDER_SGNR;
    308 
    309 #define CERT_CONFIDENCE_SIG 0x10000000
    310 #define CERT_CONFIDENCE_TIME 0x01000000
    311 #define CERT_CONFIDENCE_TIMENEST 0x00100000
    312 #define CERT_CONFIDENCE_AUTHIDEXT 0x00010000
    313 #define CERT_CONFIDENCE_HYGIENE 0x00001000
    314 #define CERT_CONFIDENCE_HIGHEST 0x11111000
    315 
    316   typedef struct _CRYPT_PROVIDER_CERT {
    317     DWORD cbStruct;
    318     PCCERT_CONTEXT pCert;
    319     WINBOOL fCommercial;
    320     WINBOOL fTrustedRoot;
    321     WINBOOL fSelfSigned;
    322     WINBOOL fTestCert;
    323     DWORD dwRevokedReason;
    324     DWORD dwConfidence;
    325     DWORD dwError;
    326     CTL_CONTEXT *pTrustListContext;
    327     WINBOOL fTrustListSignerCert;
    328     PCCTL_CONTEXT pCtlContext;
    329     DWORD dwCtlError;
    330     WINBOOL fIsCyclic;
    331     PCERT_CHAIN_ELEMENT pChainElement;
    332   } CRYPT_PROVIDER_CERT,*PCRYPT_PROVIDER_CERT;
    333 
    334   typedef struct _CRYPT_PROVIDER_PRIVDATA {
    335     DWORD cbStruct;
    336     GUID gProviderID;
    337     DWORD cbProvData;
    338     void *pvProvData;
    339   } CRYPT_PROVIDER_PRIVDATA,*PCRYPT_PROVIDER_PRIVDATA;
    340 
    341   typedef struct _PROVDATA_SIP {
    342     DWORD cbStruct;
    343     GUID gSubject;
    344     struct SIP_DISPATCH_INFO_ *pSip;
    345     struct SIP_DISPATCH_INFO_ *pCATSip;
    346     struct SIP_SUBJECTINFO_ *psSipSubjectInfo;
    347     struct SIP_SUBJECTINFO_ *psSipCATSubjectInfo;
    348     struct SIP_INDIRECT_DATA_ *psIndirectData;
    349   } PROVDATA_SIP,*PPROVDATA_SIP;
    350 
    351 #define WT_CURRENT_VERSION 0x00000200
    352 
    353   typedef struct _CRYPT_TRUST_REG_ENTRY {
    354     DWORD cbStruct;
    355     WCHAR *pwszDLLName;
    356     WCHAR *pwszFunctionName;
    357   } CRYPT_TRUST_REG_ENTRY,*PCRYPT_TRUST_REG_ENTRY;
    358 
    359   typedef struct _CRYPT_REGISTER_ACTIONID {
    360     DWORD cbStruct;
    361     CRYPT_TRUST_REG_ENTRY sInitProvider;
    362     CRYPT_TRUST_REG_ENTRY sObjectProvider;
    363     CRYPT_TRUST_REG_ENTRY sSignatureProvider;
    364     CRYPT_TRUST_REG_ENTRY sCertificateProvider;
    365     CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider;
    366     CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider;
    367     CRYPT_TRUST_REG_ENTRY sTestPolicyProvider;
    368     CRYPT_TRUST_REG_ENTRY sCleanupProvider;
    369   } CRYPT_REGISTER_ACTIONID,*PCRYPT_REGISTER_ACTIONID;
    370 
    371   typedef WINBOOL (*PFN_ALLOCANDFILLDEFUSAGE)(const char *pszUsageOID,struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
    372   typedef WINBOOL (*PFN_FREEDEFUSAGE)(const char *pszUsageOID,struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
    373 
    374   typedef struct _CRYPT_PROVIDER_REGDEFUSAGE {
    375     DWORD cbStruct;
    376     GUID *pgActionID;
    377     WCHAR *pwszDllName;
    378     char *pwszLoadCallbackDataFunctionName;
    379     char *pwszFreeCallbackDataFunctionName;
    380   } CRYPT_PROVIDER_REGDEFUSAGE,*PCRYPT_PROVIDER_REGDEFUSAGE;
    381 
    382   typedef struct _CRYPT_PROVIDER_DEFUSAGE {
    383     DWORD cbStruct;
    384     GUID gActionID;
    385     LPVOID pDefPolicyCallbackData;
    386     LPVOID pDefSIPClientData;
    387   } CRYPT_PROVIDER_DEFUSAGE,*PCRYPT_PROVIDER_DEFUSAGE;
    388 
    389 #include <poppack.h>
    390 
    391 #define WT_PROVIDER_DLL_NAME L"WINTRUST.DLL"
    392 #define WT_PROVIDER_CERTTRUST_FUNCTION L"WintrustCertificateTrust"
    393 
    394   extern WINBOOL WINAPI WintrustAddActionID(GUID *pgActionID,DWORD fdwFlags,CRYPT_REGISTER_ACTIONID *psProvInfo);
    395 
    396 #define WT_ADD_ACTION_ID_RET_RESULT_FLAG 0x1
    397 
    398   extern WINBOOL WINAPI WintrustRemoveActionID(GUID *pgActionID);
    399   extern WINBOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID,CRYPT_PROVIDER_FUNCTIONS *pPfns);
    400   extern WINBOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID,CRYPT_PROVIDER_REGDEFUSAGE *psDefUsage);
    401 
    402 #define DWACTION_ALLOCANDFILL 1
    403 #define DWACTION_FREE 2
    404 
    405   extern WINBOOL WINAPI WintrustGetDefaultForUsage(DWORD dwAction,const char *pszUsageOID,CRYPT_PROVIDER_DEFUSAGE *psUsage);
    406   extern CRYPT_PROVIDER_SGNR *WINAPI WTHelperGetProvSignerFromChain(CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSigner,DWORD idxCounterSigner);
    407   extern CRYPT_PROVIDER_CERT *WINAPI WTHelperGetProvCertFromChain(CRYPT_PROVIDER_SGNR *pSgnr,DWORD idxCert);
    408   extern CRYPT_PROVIDER_DATA *WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
    409   extern CRYPT_PROVIDER_PRIVDATA *WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *pProvData,GUID *pgProviderID);
    410   extern WINBOOL WINAPI WTHelperCertIsSelfSigned(DWORD dwEncoding,CERT_INFO *pCert);
    411   extern HRESULT WINAPI WTHelperCertCheckValidSignature(CRYPT_PROVIDER_DATA *pProvData);
    412 
    413 #include <pshpack8.h>
    414 
    415 #define szOID_TRUSTED_CODESIGNING_CA_LIST "1.3.6.1.4.1.311.2.2.1"
    416 #define szOID_TRUSTED_CLIENT_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.2"
    417 #define szOID_TRUSTED_SERVER_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.3"
    418 
    419 #define SPC_COMMON_NAME_OBJID szOID_COMMON_NAME
    420 #define SPC_TIME_STAMP_REQUEST_OBJID "1.3.6.1.4.1.311.3.2.1"
    421 #define SPC_INDIRECT_DATA_OBJID "1.3.6.1.4.1.311.2.1.4"
    422 #define SPC_SP_AGENCY_INFO_OBJID "1.3.6.1.4.1.311.2.1.10"
    423 #define SPC_STATEMENT_TYPE_OBJID "1.3.6.1.4.1.311.2.1.11"
    424 #define SPC_SP_OPUS_INFO_OBJID "1.3.6.1.4.1.311.2.1.12"
    425 #define SPC_CERT_EXTENSIONS_OBJID "1.3.6.1.4.1.311.2.1.14"
    426 #define SPC_PE_IMAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.15"
    427 #define SPC_RAW_FILE_DATA_OBJID "1.3.6.1.4.1.311.2.1.18"
    428 #define SPC_STRUCTURED_STORAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.19"
    429 #define SPC_JAVA_CLASS_DATA_OBJID "1.3.6.1.4.1.311.2.1.20"
    430 #define SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.21"
    431 #define SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.22"
    432 #define SPC_CAB_DATA_OBJID "1.3.6.1.4.1.311.2.1.25"
    433 #define SPC_GLUE_RDN_OBJID "1.3.6.1.4.1.311.2.1.25"
    434 #define SPC_MINIMAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.26"
    435 #define SPC_FINANCIAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.27"
    436 #define SPC_LINK_OBJID "1.3.6.1.4.1.311.2.1.28"
    437 #define SPC_SIGINFO_OBJID "1.3.6.1.4.1.311.2.1.30"
    438 
    439 #define CAT_NAMEVALUE_OBJID "1.3.6.1.4.1.311.12.2.1"
    440 #define CAT_MEMBERINFO_OBJID "1.3.6.1.4.1.311.12.2.2"
    441 
    442 #define SPC_SP_AGENCY_INFO_STRUCT ((LPCSTR) 2000)
    443 #define SPC_MINIMAL_CRITERIA_STRUCT ((LPCSTR) 2001)
    444 #define SPC_FINANCIAL_CRITERIA_STRUCT ((LPCSTR) 2002)
    445 #define SPC_INDIRECT_DATA_CONTENT_STRUCT ((LPCSTR) 2003)
    446 #define SPC_PE_IMAGE_DATA_STRUCT ((LPCSTR) 2004)
    447 #define SPC_LINK_STRUCT ((LPCSTR) 2005)
    448 #define SPC_STATEMENT_TYPE_STRUCT ((LPCSTR) 2006)
    449 #define SPC_SP_OPUS_INFO_STRUCT ((LPCSTR) 2007)
    450 #define SPC_CAB_DATA_STRUCT ((LPCSTR) 2008)
    451 #define SPC_JAVA_CLASS_DATA_STRUCT ((LPCSTR) 2009)
    452 
    453 #define SPC_SIGINFO_STRUCT ((LPCSTR) 2130)
    454 
    455 #define CAT_NAMEVALUE_STRUCT ((LPCSTR) 2221)
    456 #define CAT_MEMBERINFO_STRUCT ((LPCSTR) 2222)
    457 
    458 #define SPC_UUID_LENGTH 16
    459 
    460   typedef BYTE SPC_UUID[SPC_UUID_LENGTH];
    461 
    462   typedef struct _SPC_SERIALIZED_OBJECT {
    463     SPC_UUID ClassId;
    464     CRYPT_DATA_BLOB SerializedData;
    465   } SPC_SERIALIZED_OBJECT,*PSPC_SERIALIZED_OBJECT;
    466 
    467   typedef struct SPC_SIGINFO_ {
    468     DWORD dwSipVersion;
    469     GUID gSIPGuid;
    470     DWORD dwReserved1;
    471     DWORD dwReserved2;
    472     DWORD dwReserved3;
    473     DWORD dwReserved4;
    474     DWORD dwReserved5;
    475   } SPC_SIGINFO,*PSPC_SIGINFO;
    476 
    477 #define SPC_URL_LINK_CHOICE 1
    478 #define SPC_MONIKER_LINK_CHOICE 2
    479 #define SPC_FILE_LINK_CHOICE 3
    480 
    481   typedef struct SPC_LINK_ {
    482     DWORD dwLinkChoice;
    483     __C89_NAMELESS union {
    484       LPWSTR pwszUrl;
    485       SPC_SERIALIZED_OBJECT Moniker;
    486       LPWSTR pwszFile;
    487     };
    488   } SPC_LINK,*PSPC_LINK;
    489 
    490   typedef struct _SPC_PE_IMAGE_DATA {
    491     CRYPT_BIT_BLOB Flags;
    492     PSPC_LINK pFile;
    493   } SPC_PE_IMAGE_DATA,*PSPC_PE_IMAGE_DATA;
    494 
    495   typedef struct _SPC_INDIRECT_DATA_CONTENT {
    496     CRYPT_ATTRIBUTE_TYPE_VALUE Data;
    497     CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
    498     CRYPT_HASH_BLOB Digest;
    499   } SPC_INDIRECT_DATA_CONTENT,*PSPC_INDIRECT_DATA_CONTENT;
    500 
    501   typedef struct _SPC_FINANCIAL_CRITERIA {
    502     WINBOOL fFinancialInfoAvailable;
    503     WINBOOL fMeetsCriteria;
    504   } SPC_FINANCIAL_CRITERIA,*PSPC_FINANCIAL_CRITERIA;
    505 
    506   typedef struct _SPC_IMAGE {
    507     struct SPC_LINK_ *pImageLink;
    508     CRYPT_DATA_BLOB Bitmap;
    509     CRYPT_DATA_BLOB Metafile;
    510     CRYPT_DATA_BLOB EnhancedMetafile;
    511     CRYPT_DATA_BLOB GifFile;
    512   } SPC_IMAGE,*PSPC_IMAGE;
    513 
    514   typedef struct _SPC_SP_AGENCY_INFO {
    515     struct SPC_LINK_ *pPolicyInformation;
    516     LPWSTR pwszPolicyDisplayText;
    517     PSPC_IMAGE pLogoImage;
    518     struct SPC_LINK_ *pLogoLink;
    519   } SPC_SP_AGENCY_INFO,*PSPC_SP_AGENCY_INFO;
    520 
    521   typedef struct _SPC_STATEMENT_TYPE {
    522     DWORD cKeyPurposeId;
    523     LPSTR *rgpszKeyPurposeId;
    524   } SPC_STATEMENT_TYPE,*PSPC_STATEMENT_TYPE;
    525 
    526   typedef struct _SPC_SP_OPUS_INFO {
    527     LPCWSTR pwszProgramName;
    528     struct SPC_LINK_ *pMoreInfo;
    529     struct SPC_LINK_ *pPublisherInfo;
    530   } SPC_SP_OPUS_INFO,*PSPC_SP_OPUS_INFO;
    531 
    532   typedef struct _CAT_NAMEVALUE {
    533     LPWSTR pwszTag;
    534     DWORD fdwFlags;
    535     CRYPT_DATA_BLOB Value;
    536   } CAT_NAMEVALUE,*PCAT_NAMEVALUE;
    537 
    538   typedef struct _CAT_MEMBERINFO {
    539     LPWSTR pwszSubjGuid;
    540     DWORD dwCertVersion;
    541   } CAT_MEMBERINFO,*PCAT_MEMBERINFO;
    542 
    543 #include <poppack.h>
    544 
    545 #ifdef WT_DEFINE_ALL_APIS
    546   typedef struct _WIN_CERTIFICATE {
    547     DWORD dwLength;
    548     WORD wRevision;
    549     WORD wCertificateType;
    550     BYTE bCertificate[ANYSIZE_ARRAY];
    551   } WIN_CERTIFICATE,*LPWIN_CERTIFICATE;
    552 
    553 #define WIN_CERT_REVISION_1_0 (0x0100)
    554 #define WIN_CERT_REVISION_2_0 (0x0200)
    555 #define WIN_CERT_TYPE_X509 (0x0001)
    556 #define WIN_CERT_TYPE_PKCS_SIGNED_DATA (0x0002)
    557 #define WIN_CERT_TYPE_RESERVED_1 (0x0003)
    558 #define WIN_CERT_TYPE_TS_STACK_SIGNED (0x0004)
    559 
    560   typedef LPVOID WIN_TRUST_SUBJECT;
    561 
    562   typedef struct _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT {
    563     HANDLE hClientToken;
    564     GUID *SubjectType;
    565     WIN_TRUST_SUBJECT Subject;
    566   } WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT,*LPWIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT;
    567 
    568   typedef struct _WIN_TRUST_ACTDATA_SUBJECT_ONLY {
    569     GUID *SubjectType;
    570     WIN_TRUST_SUBJECT Subject;
    571   } WIN_TRUST_ACTDATA_SUBJECT_ONLY,*LPWIN_TRUST_ACTDATA_SUBJECT_ONLY;
    572 
    573 #define WIN_TRUST_SUBJTYPE_RAW_FILE { 0x959dc450,0x8d9e,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    574 #define WIN_TRUST_SUBJTYPE_PE_IMAGE { 0x43c9a1e0,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    575 #define WIN_TRUST_SUBJTYPE_JAVA_CLASS { 0x08ad3990,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    576 #define WIN_TRUST_SUBJTYPE_CABINET { 0xd17c5374,0xa392,0x11cf,{ 0x9d,0xf5,0x0,0xaa,0x0,0xc1,0x84,0xe0 } }
    577 
    578   typedef struct _WIN_TRUST_SUBJECT_FILE {
    579     HANDLE hFile;
    580     LPCWSTR lpPath;
    581   } WIN_TRUST_SUBJECT_FILE,*LPWIN_TRUST_SUBJECT_FILE;
    582 
    583 #define WIN_TRUST_SUBJTYPE_RAW_FILEEX { 0x6f458110,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
    584 #define WIN_TRUST_SUBJTYPE_PE_IMAGEEX { 0x6f458111,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
    585 #define WIN_TRUST_SUBJTYPE_JAVA_CLASSEX { 0x6f458113,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
    586 #define WIN_TRUST_SUBJTYPE_CABINETEX { 0x6f458114,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
    587 
    588   typedef struct _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY {
    589     HANDLE hFile;
    590     LPCWSTR lpPath;
    591     LPCWSTR lpDisplayName;
    592   } WIN_TRUST_SUBJECT_FILE_AND_DISPLAY,*LPWIN_TRUST_SUBJECT_FILE_AND_DISPLAY;
    593 
    594 #define WIN_TRUST_SUBJTYPE_OLE_STORAGE { 0xc257e740,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    595 #define WIN_SPUB_ACTION_TRUSTED_PUBLISHER { 0x66426730,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    596 #define WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE { 0x8bc96b00,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    597 #define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE { 0x64b9d180,0x8da2,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
    598 
    599   typedef struct _WIN_SPUB_TRUSTED_PUBLISHER_DATA {
    600     HANDLE hClientToken;
    601     LPWIN_CERTIFICATE lpCertificate;
    602   } WIN_SPUB_TRUSTED_PUBLISHER_DATA,*LPWIN_SPUB_TRUSTED_PUBLISHER_DATA;
    603 
    604 #endif /* WT_DEFINE_ALL_APIS */
    605 
    606 #if (_WIN32_WINNT >= 0x0600)
    607 void WINAPI WintrustSetDefaultIncludePEPageHashes(WINBOOL fIncludePEPageHashes);
    608 #endif /*(_WIN32_WINNT >= 0x0600)*/
    609 
    610 #ifdef __cplusplus
    611 }
    612 #endif
    613 #endif
    614