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.

1241 lines
52 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996-1998
  6. //
  7. // File: wintrust.h
  8. //
  9. // Contents: Microsoft Internet Security Trust Provider Model
  10. //
  11. // History: 31-May-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef WINTRUST_H
  15. #define WINTRUST_H
  16. #include <wincrypt.h>
  17. #ifdef __cplusplus
  18. extern "C"
  19. {
  20. #endif
  21. #ifndef WIN_CERT_REVISION_1_0 // there were duplicate definitions in winbase.h
  22. # define WT_DEFINE_ALL_APIS
  23. #else
  24. # undef WT_DEFINE_ALL_APIS
  25. #endif
  26. //////////////////////////////////////////////////////////////////////////////
  27. //////////////////////////////////////////////////////////////////////////////
  28. //
  29. // Client definitions, typedefs, and prototypes
  30. //
  31. //////////////////////////////////////////////////////////////////////////////
  32. //////////////////////////////////////////////////////////////////////////////
  33. #include <pshpack8.h>
  34. //////////////////////////////////////////////////////////////////////////////
  35. //
  36. // WINTRUST_DATA Structure
  37. //----------------------------------------------------------------------------
  38. // Used when calling WinVerifyTrust to pass necessary information into
  39. // the Providers.
  40. //
  41. typedef struct _WINTRUST_DATA
  42. {
  43. DWORD cbStruct; // = sizeof(WINTRUST_DATA)
  44. LPVOID pPolicyCallbackData; // optional: used to pass data between the app and policy
  45. LPVOID pSIPClientData; // optional: used to pass data between the app and SIP.
  46. DWORD dwUIChoice; // required: UI choice. One of the following.
  47. # define WTD_UI_ALL 1
  48. # define WTD_UI_NONE 2
  49. # define WTD_UI_NOBAD 3
  50. # define WTD_UI_NOGOOD 4
  51. DWORD fdwRevocationChecks; // required: certificate revocation check options
  52. # define WTD_REVOKE_NONE 0x00000000
  53. # define WTD_REVOKE_WHOLECHAIN 0x00000001
  54. DWORD dwUnionChoice; // required: which structure is being passed in?
  55. # define WTD_CHOICE_FILE 1
  56. # define WTD_CHOICE_CATALOG 2
  57. # define WTD_CHOICE_BLOB 3
  58. # define WTD_CHOICE_SIGNER 4
  59. # define WTD_CHOICE_CERT 5
  60. union
  61. {
  62. struct WINTRUST_FILE_INFO_ *pFile; // individual file
  63. struct WINTRUST_CATALOG_INFO_ *pCatalog; // member of a Catalog File
  64. struct WINTRUST_BLOB_INFO_ *pBlob; // memory blob
  65. struct WINTRUST_SGNR_INFO_ *pSgnr; // signer structure only
  66. struct WINTRUST_CERT_INFO_ *pCert;
  67. };
  68. DWORD dwStateAction; // optional (Catalog File Processing)
  69. # define WTD_STATEACTION_IGNORE 0x00000000
  70. # define WTD_STATEACTION_VERIFY 0x00000001
  71. # define WTD_STATEACTION_CLOSE 0x00000002
  72. # define WTD_STATEACTION_AUTO_CACHE 0x00000003
  73. # define WTD_STATEACTION_AUTO_CACHE_FLUSH 0x00000004
  74. HANDLE hWVTStateData; // optional (Catalog File Processing)
  75. WCHAR *pwszURLReference; // optional: (future) used to determine zone.
  76. // 17-Feb-1998 philh: added
  77. DWORD dwProvFlags;
  78. # define WTD_PROV_FLAGS_MASK 0x0000FFFF
  79. # define WTD_USE_IE4_TRUST_FLAG 0x00000001
  80. # define WTD_NO_IE4_CHAIN_FLAG 0x00000002
  81. # define WTD_NO_POLICY_USAGE_FLAG 0x00000004
  82. } WINTRUST_DATA, *PWINTRUST_DATA;
  83. //////////////////////////////////////////////////////////////////////////////
  84. //
  85. // WINTRUST_FILE_INFO Structure
  86. //----------------------------------------------------------------------------
  87. // Used when calling WinVerifyTrust against an individual file.
  88. //
  89. typedef struct WINTRUST_FILE_INFO_
  90. {
  91. DWORD cbStruct; // = sizeof(WINTRUST_FILE_INFO)
  92. LPCWSTR pcwszFilePath; // required, file name to be verified
  93. HANDLE hFile; // optional, open handle to pcwszFilePath
  94. // 09-Dec-1997 pberkman: added
  95. GUID *pgKnownSubject; // optional: fill if the subject type is known.
  96. } WINTRUST_FILE_INFO, *PWINTRUST_FILE_INFO;
  97. //////////////////////////////////////////////////////////////////////////////
  98. //
  99. // WINTRUST_CATALOG_INFO Structure
  100. //----------------------------------------------------------------------------
  101. // Used when calling WinVerifyTrust against a member of a Microsoft Catalog
  102. // file.
  103. //
  104. typedef struct WINTRUST_CATALOG_INFO_
  105. {
  106. DWORD cbStruct; // = sizeof(WINTRUST_CATALOG_INFO)
  107. DWORD dwCatalogVersion; // optional: Catalog version number
  108. LPCWSTR pcwszCatalogFilePath; // required: path/name to Catalog file
  109. LPCWSTR pcwszMemberTag; // required: tag to member in Catalog
  110. LPCWSTR pcwszMemberFilePath; // required: path/name to member file
  111. HANDLE hMemberFile; // optional: open handle to pcwszMemberFilePath
  112. // 30-Oct-1997 pberkman: added
  113. BYTE *pbCalculatedFileHash; // optional: pass in the calculated hash
  114. DWORD cbCalculatedFileHash; // optional: pass in the count bytes of the calc hash
  115. // 15-Jan-1998 pberkman: added
  116. PCCTL_CONTEXT pcCatalogContext; // optional: pass in to use instead of CatalogFilePath.
  117. } WINTRUST_CATALOG_INFO, *PWINTRUST_CATALOG_INFO;
  118. //////////////////////////////////////////////////////////////////////////////
  119. //
  120. // WINTRUST_BLOB_INFO Structure
  121. //----------------------------------------------------------------------------
  122. // Used when calling WinVerifyTrust against a memory blob.
  123. //
  124. typedef struct WINTRUST_BLOB_INFO_
  125. {
  126. DWORD cbStruct; // = sizeof(WINTRUST_BLOB_INFO)
  127. GUID gSubject; // SIP to load
  128. LPCWSTR pcwszDisplayName; // display name of object
  129. DWORD cbMemObject;
  130. BYTE *pbMemObject;
  131. DWORD cbMemSignedMsg;
  132. BYTE *pbMemSignedMsg;
  133. } WINTRUST_BLOB_INFO, *PWINTRUST_BLOB_INFO;
  134. //////////////////////////////////////////////////////////////////////////////
  135. //
  136. // WINTRUST_SGNR_INFO Structure
  137. //----------------------------------------------------------------------------
  138. // Used when calling WinVerifyTrust against a CMSG_SIGNER_INFO Structure
  139. //
  140. typedef struct WINTRUST_SGNR_INFO_
  141. {
  142. DWORD cbStruct; // = sizeof(WINTRUST_SGNR_INFO)
  143. LPCWSTR pcwszDisplayName; // name of the "thing" the pbMem is pointing to.
  144. CMSG_SIGNER_INFO *psSignerInfo;
  145. DWORD chStores; // number of stores in pahStores
  146. HCERTSTORE *pahStores; // array of stores to add to internal list
  147. } WINTRUST_SGNR_INFO, *PWINTRUST_SGNR_INFO;
  148. //////////////////////////////////////////////////////////////////////////////
  149. //
  150. // WINTRUST_CERT_INFO Structure
  151. //----------------------------------------------------------------------------
  152. // Used when calling WinVerifyTrust against a CERT_CONTEXT Structure
  153. //
  154. typedef struct WINTRUST_CERT_INFO_
  155. {
  156. DWORD cbStruct; // = sizeof(WINTRUST_CERT_INFO)
  157. LPCWSTR pcwszDisplayName; // display name
  158. CERT_CONTEXT *psCertContext;
  159. DWORD chStores; // number of stores in pahStores
  160. HCERTSTORE *pahStores; // array of stores to add to internal list
  161. // 17-Nov-1997 pberkman: added
  162. DWORD dwFlags;
  163. # define WTCI_DONT_OPEN_STORES 0x00000001 // only open dummy "root" all other are in pahStores.
  164. # define WTCI_OPEN_ONLY_ROOT 0x00000002
  165. // 26-Nov-1997 pberkman: added
  166. FILETIME *psftVerifyAsOf; // if not null, each cert will be validated as of this time.
  167. } WINTRUST_CERT_INFO, *PWINTRUST_CERT_INFO;
  168. #include <poppack.h>
  169. //////////////////////////////////////////////////////////////////////////////
  170. //
  171. // WinVerifyTrust
  172. //----------------------------------------------------------------------------
  173. // Exported from WINTRUST.DLL.
  174. // Call this function to verify the trust based on a digital signer.
  175. //
  176. // Returns:
  177. // ERROR_SUCCESS If the trust is authenticated or
  178. // if the user accepted the risk.
  179. //
  180. // TRUST_E_PROVIDER_UNKNOWN there was an error loading one of the
  181. // required Providers.
  182. //
  183. // all error codes passed back are based on the Policy Provider used.
  184. //
  185. extern LONG WINAPI WinVerifyTrust(HWND hwnd, GUID *pgActionID,
  186. LPVOID pWVTData);
  187. //////////////////////////////////////////////////////////////////////////////
  188. //////////////////////////////////////////////////////////////////////////////
  189. //
  190. // Trust, Policy, and UI Provider definitions, typedefs, and prototypes
  191. //
  192. // Model:
  193. // A client wishing to validate trust through WinVerifyTrust will
  194. // select an appropriate Action ID guid for the call.
  195. // This guid is defined by each Policy Provider and represents the
  196. // functions called based on the policy for the given object.
  197. //
  198. // In this model, the Policy Provider determines which style of UI
  199. // will be shown to the user (this only applies to style, the
  200. // determination of whether UI is displayed is set by the calling client
  201. // in the UI flags member of WINTRUST_DATA).
  202. //
  203. // Since the function entry points are common (same return value and
  204. // parameters), it allows Policy Provider developers to take advantage
  205. // of existing, generic, code to fill the CRYPT_PROVIDER_DATA structure.
  206. //
  207. // This also allows the developer to simply add the specific policy they
  208. // need, then, call the generic Policy Provider - if appropriate.
  209. //
  210. //////////////////////////////////////////////////////////////////////////////
  211. //////////////////////////////////////////////////////////////////////////////
  212. //////////////////////////////////////////////////////////////////////////////
  213. //
  214. // Wintrust Policy Flags
  215. //----------------------------------------------------------------------------
  216. // These are set during install and can be modified by the user
  217. // through various means. The SETREG.EXE utility (found in the Authenticode
  218. // Tools Pack) will select/deselect each of them.
  219. //
  220. #define WTPF_TRUSTTEST 0x00000020 // trust any "TEST" certificate
  221. #define WTPF_TESTCANBEVALID 0x00000080
  222. #define WTPF_IGNOREEXPIRATION 0x00000100 // Use expiration date
  223. #define WTPF_IGNOREREVOKATION 0x00000200 // Do revocation check
  224. #define WTPF_OFFLINEOK_IND 0x00000400 // off-line is ok individual certs
  225. #define WTPF_OFFLINEOK_COM 0x00000800 // off-line is ok commercial certs
  226. #define WTPF_OFFLINEOKNBU_IND 0x00001000 // off-line is ok individual certs, no bad ui
  227. #define WTPF_OFFLINEOKNBU_COM 0x00002000 // off-line is ok commercial certs, no bad ui
  228. #define WTPF_VERIFY_V1_OFF 0x00010000 // turn verify of v1 certs off
  229. #define WTPF_IGNOREREVOCATIONONTS 0x00020000 // ignore TimeStamp revocation checks
  230. #define WTPF_ALLOWONLYPERTRUST 0x00040000 // allow only items in personal trust db.
  231. //////////////////////////////////////////////////////////////////////////////
  232. //
  233. // WintrustGetRegPolicyFlags
  234. //----------------------------------------------------------------------------
  235. // This API call is exported from WINTRUST.DLL and is the recommended method
  236. // of retrieving the DWORD representing the Policy Flags.
  237. //
  238. extern void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags);
  239. //////////////////////////////////////////////////////////////////////////////
  240. //
  241. // WintrustSetRegPolicyFlags
  242. //----------------------------------------------------------------------------
  243. // This API call is exported from WINTRUST.DLL and is the recommended method
  244. // of setting the DWORD representing the Policy Flags. MAKE SURE to call
  245. // WintrustGetRegPolicyFlags to get the current value and or/and the value
  246. // you need then call the set the flags.
  247. //
  248. extern BOOL WINAPI WintrustSetRegPolicyFlags(DWORD dwPolicyFlags);
  249. //////////////////////////////////////////////////////////////////////////////
  250. //
  251. // Trust Provider "Step" Error defines
  252. //----------------------------------------------------------------------------
  253. // Each "step" of the Trust process has an error "slot" associated with it.
  254. // If an error occurs, the "step" will assign its result to this "slot". These
  255. // errors can be any valid WINERROR.H HRESULT code.
  256. //
  257. //
  258. // step errors 0 through 20 are reserved for Authenticode specific. If
  259. // you are not calling any of the SOFTPUB.DLL (Authenticode) providers, you
  260. // may use these as needed.
  261. //
  262. #define TRUSTERROR_STEP_WVTPARAMS 0
  263. #define TRUSTERROR_STEP_FILEIO 2
  264. #define TRUSTERROR_STEP_SIP 3
  265. #define TRUSTERROR_STEP_SIPSUBJINFO 5
  266. #define TRUSTERROR_STEP_CATALOGFILE 6
  267. #define TRUSTERROR_STEP_CERTSTORE 7
  268. #define TRUSTERROR_STEP_MESSAGE 8
  269. #define TRUSTERROR_STEP_MSG_SIGNERCOUNT 9
  270. #define TRUSTERROR_STEP_MSG_INNERCNTTYPE 10
  271. #define TRUSTERROR_STEP_MSG_INNERCNT 11
  272. #define TRUSTERROR_STEP_MSG_STORE 12
  273. #define TRUSTERROR_STEP_MSG_SIGNERINFO 13
  274. #define TRUSTERROR_STEP_MSG_SIGNERCERT 14
  275. #define TRUSTERROR_STEP_MSG_CERTCHAIN 15
  276. #define TRUSTERROR_STEP_MSG_COUNTERSIGINFO 16
  277. #define TRUSTERROR_STEP_MSG_COUNTERSIGCERT 17
  278. #define TRUSTERROR_STEP_VERIFY_MSGHASH 18
  279. #define TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA 19
  280. //
  281. // step errors 30 through 37 are reserved for the ending error code for each
  282. // entry point in the Trust Model.
  283. //
  284. #define TRUSTERROR_STEP_FINAL_WVTINIT 30
  285. #define TRUSTERROR_STEP_FINAL_INITPROV 31
  286. #define TRUSTERROR_STEP_FINAL_OBJPROV 32
  287. #define TRUSTERROR_STEP_FINAL_SIGPROV 33
  288. #define TRUSTERROR_STEP_FINAL_CERTPROV 34
  289. #define TRUSTERROR_STEP_FINAL_CERTCHKPROV 35
  290. #define TRUSTERROR_STEP_FINAL_POLICYPROV 36
  291. #define TRUSTERROR_STEP_FINAL_UIPROV 37
  292. #define TRUSTERROR_MAX_STEPS 38
  293. //////////////////////////////////////////////////////////////////////////////
  294. //
  295. // allocation and free function prototypes
  296. //----------------------------------------------------------------------------
  297. //
  298. typedef void *(*PFN_CPD_MEM_ALLOC)(IN DWORD cbSize);
  299. typedef void (*PFN_CPD_MEM_FREE)(IN void *pvMem2Free);
  300. typedef BOOL (*PFN_CPD_ADD_STORE)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
  301. IN HCERTSTORE hStore2Add);
  302. typedef BOOL (*PFN_CPD_ADD_SGNR)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
  303. IN BOOL fCounterSigner,
  304. IN OPTIONAL DWORD idxSigner,
  305. IN struct _CRYPT_PROVIDER_SGNR *pSgnr2Add);
  306. typedef BOOL (*PFN_CPD_ADD_CERT)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
  307. IN DWORD idxSigner,
  308. IN BOOL fCounterSigner,
  309. IN OPTIONAL DWORD idxCounterSigner,
  310. IN PCCERT_CONTEXT pCert2Add);
  311. typedef BOOL (*PFN_CPD_ADD_PRIVDATA)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
  312. IN struct _CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
  313. //////////////////////////////////////////////////////////////////////////////
  314. //
  315. // Provider function prototypes
  316. //----------------------------------------------------------------------------
  317. //
  318. //
  319. // entry point for the object provider
  320. //
  321. typedef HRESULT (*PFN_PROVIDER_INIT_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  322. //
  323. // entry point for the object provider
  324. //
  325. typedef HRESULT (*PFN_PROVIDER_OBJTRUST_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  326. //
  327. // entry point for the Signature Provider
  328. //
  329. typedef HRESULT (*PFN_PROVIDER_SIGTRUST_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  330. //
  331. // entry point for the Certificate Provider
  332. //
  333. typedef HRESULT (*PFN_PROVIDER_CERTTRUST_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  334. //
  335. // entry point for the Policy Provider's final call (from the trust provider)
  336. //
  337. typedef HRESULT (*PFN_PROVIDER_FINALPOLICY_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  338. //
  339. // entry point for the Policy Provider's "dump structure" call
  340. //
  341. typedef HRESULT (*PFN_PROVIDER_TESTFINALPOLICY_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  342. //
  343. // entry point for the Policy Provider's clean up routine for any PRIVDATA allocated
  344. //
  345. typedef HRESULT (*PFN_PROVIDER_CLEANUP_CALL)(IN OUT struct _CRYPT_PROVIDER_DATA *pProvData);
  346. //
  347. // entry point for the Policy Provider's Cert Check call. This will return
  348. // true if the Trust Provider is to continue building the certificate chain.
  349. // If the PP returns FALSE, it is assumed that we have reached a "TRUSTED",
  350. // self-signed, root. it is also the CertCheck's responsibility to set the
  351. // fTrustedRoot flag in the certificate structure.
  352. //
  353. typedef BOOL (*PFN_PROVIDER_CERTCHKPOLICY_CALL)( IN struct _CRYPT_PROVIDER_DATA *pProvData,
  354. IN DWORD idxSigner,
  355. IN BOOL fCounterSignerChain,
  356. IN OPTIONAL DWORD idxCounterSigner);
  357. #define WVT_OFFSETOF(t,f) ((ULONG_PTR)(&((t*)0)->f))
  358. #define WVT_ISINSTRUCT(structtypedef, structpassedsize, member) \
  359. ((WVT_OFFSETOF(structtypedef, member) < structpassedsize) ? TRUE : FALSE)
  360. #define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(structtypedef, structpassedsize, member) \
  361. WVT_ISINSTRUCT(structtypedef, structpassedsize, member)
  362. #include <pshpack8.h>
  363. //////////////////////////////////////////////////////////////////////////////
  364. //
  365. // CRYPT_PROVIDER_DATA Structure
  366. //----------------------------------------------------------------------------
  367. // Used to pass information between WinVerifyTrust and all of the Provider
  368. // calls.
  369. //
  370. // IMPORTANT: 1. All dynamically allocated members MUST use the allocation
  371. // and Add2 functions provided.
  372. //
  373. typedef struct _CRYPT_PROVIDER_DATA
  374. {
  375. DWORD cbStruct; // = sizeof(TRUST_PROVIDER_DATA) (set in WVT)
  376. WINTRUST_DATA *pWintrustData; // NOT verified (set in WVT)
  377. BOOL fOpenedFile; // the provider opened the file handle (if applicable)
  378. HWND hWndParent; // if passed in, else, Desktop hWnd (set in WVT).
  379. GUID *pgActionID; // represents the Provider combination (set in WVT).
  380. HCRYPTPROV hProv; // set to NULL to let CryptoAPI to assign.
  381. DWORD dwError; // error if a low-level, system error was encountered
  382. DWORD dwRegSecuritySettings; // ie security settings (set in WVT)
  383. DWORD dwRegPolicySettings; // setreg settings (set in WVT)
  384. struct _CRYPT_PROVIDER_FUNCTIONS *psPfns; // set in WVT.
  385. DWORD cdwTrustStepErrors; // set in WVT.
  386. DWORD *padwTrustStepErrors; // allocated in WVT. filled in WVT & Trust Provider
  387. DWORD chStores; // number of stores in pahStores (root set in WVT)
  388. HCERTSTORE *pahStores; // array of known stores (root set in WVT) root is ALWAYS #0!!!
  389. DWORD dwEncoding; // message encoding type (set in WVT and Signature Prov)
  390. HCRYPTMSG hMsg; // set in Signature Prov.
  391. DWORD csSigners; // use Add2 and Get functions!
  392. struct _CRYPT_PROVIDER_SGNR *pasSigners; // use Add2 and Get functions!
  393. DWORD csProvPrivData; // use Add2 and Get functions!
  394. struct _CRYPT_PROVIDER_PRIVDATA *pasProvPrivData; // use Add2 and Get functions!
  395. DWORD dwSubjectChoice;
  396. # define CPD_CHOICE_SIP 1
  397. union
  398. {
  399. struct _PROVDATA_SIP *pPDSip;
  400. };
  401. char *pszUsageOID; // set in Init Provider
  402. // 03-Oct-1997 pberkman: added
  403. BOOL fRecallWithState; // state was maintained for Catalog Files.
  404. // 10-Nov-1997 pberkman: added
  405. FILETIME sftSystemTime;
  406. // 16-Jan-1998 pberkman: added
  407. char *pszCTLSignerUsageOID;
  408. // 17-Feb-1998 philh: added
  409. // LOWORD intialized from WINTRUST_DATA's dwProvFlags.
  410. //
  411. // Debug version reads "DEBUG_TRUST_PROV_FLAGS" environment variable
  412. // and OR's with WINTRUST_DATA's dwProvFlags to initialize the LOWORD.
  413. DWORD dwProvFlags;
  414. # define CPD_USE_NT5_CHAIN_FLAG 0x80000000
  415. // 24-Feb-1998 philh: added
  416. DWORD dwFinalError;
  417. // 20-May-1998 KeithV: added
  418. PCERT_USAGE_MATCH pRequestUsage;
  419. } CRYPT_PROVIDER_DATA, *PCRYPT_PROVIDER_DATA;
  420. //////////////////////////////////////////////////////////////////////////////
  421. //
  422. // CRYPT_PROVIDER_FUNCTIONS structure
  423. //----------------------------------------------------------------------------
  424. //
  425. typedef struct _CRYPT_PROVIDER_FUNCTIONS
  426. {
  427. DWORD cbStruct;
  428. PFN_CPD_MEM_ALLOC pfnAlloc; // set in WVT
  429. PFN_CPD_MEM_FREE pfnFree; // set in WVT
  430. PFN_CPD_ADD_STORE pfnAddStore2Chain; // call to add a store to the chain.
  431. PFN_CPD_ADD_SGNR pfnAddSgnr2Chain; // call to add a sgnr struct to a msg struct sgnr chain
  432. PFN_CPD_ADD_CERT pfnAddCert2Chain; // call to add a cert struct to a sgnr struct cert chain
  433. PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain; // call to add provider private data to struct.
  434. PFN_PROVIDER_INIT_CALL pfnInitialize; // initialize Policy data.
  435. PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust; // build info up to the signer info(s).
  436. PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust; // build info to the signing cert
  437. PFN_PROVIDER_CERTTRUST_CALL pfnCertificateTrust; // build the chain
  438. PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy; // final call to policy
  439. PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy; // check each cert will building chain
  440. PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy; // dump structures to a file (or whatever the policy chooses)
  441. struct _CRYPT_PROVUI_FUNCS *psUIpfns;
  442. // 23-Jul-1997 pberkman: added
  443. PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy; // PRIVDATA cleanup routine.
  444. } CRYPT_PROVIDER_FUNCTIONS, *PCRYPT_PROVIDER_FUNCTIONS;
  445. //////////////////////////////////////////////////////////////////////////////
  446. //
  447. // CRYPT_PROVUI_FUNCS structure
  448. //----------------------------------------------------------------------------
  449. //
  450. typedef BOOL (*PFN_PROVUI_CALL)(IN HWND hWndSecurityDialog, IN struct _CRYPT_PROVIDER_DATA *pProvData);
  451. typedef struct _CRYPT_PROVUI_FUNCS
  452. {
  453. DWORD cbStruct;
  454. struct _CRYPT_PROVUI_DATA *psUIData;
  455. PFN_PROVUI_CALL pfnOnMoreInfoClick;
  456. PFN_PROVUI_CALL pfnOnMoreInfoClickDefault;
  457. PFN_PROVUI_CALL pfnOnAdvancedClick;
  458. PFN_PROVUI_CALL pfnOnAdvancedClickDefault;
  459. } CRYPT_PROVUI_FUNCS, *PCRYPT_PROVUI_FUNCS;
  460. //////////////////////////////////////////////////////////////////////////////
  461. //
  462. // CRYPT_PROVUI_DATA
  463. //----------------------------------------------------------------------------
  464. //
  465. typedef struct _CRYPT_PROVUI_DATA
  466. {
  467. DWORD cbStruct;
  468. DWORD dwFinalError;
  469. WCHAR *pYesButtonText; // default: "&Yes"
  470. WCHAR *pNoButtonText; // default: "&No"
  471. WCHAR *pMoreInfoButtonText; // default: "&More Info"
  472. WCHAR *pAdvancedLinkText; // default: <none>
  473. // 15-Sep-1997 pberkman: added
  474. // good: default:
  475. // "Do you want to install and run ""%1"" signed on %2 and distributed by:"
  476. WCHAR *pCopyActionText;
  477. // good no time stamp: default:
  478. // "Do you want to install and run ""%1"" signed on an unknown date/time and distributed by:"
  479. WCHAR *pCopyActionTextNoTS;
  480. // bad: default:
  481. // "Do you want to install and run ""%1""?"
  482. WCHAR *pCopyActionTextNotSigned;
  483. } CRYPT_PROVUI_DATA, *PCRYPT_PROVUI_DATA;
  484. //////////////////////////////////////////////////////////////////////////////
  485. //
  486. // CRYPT_PROVIDER_SGNR structure
  487. //----------------------------------------------------------------------------
  488. // After the Signature Provider is finished there will be zero to many of these
  489. // filled out. One for each signer of the message. Also, there will be zero
  490. // to many of these filled out inside this structure. One for each counter
  491. // signer of the signer.
  492. //
  493. // IMPORTANT: 1. All dynamically allocated members MUST use allocation
  494. // and Add2 functions provided.
  495. //
  496. typedef struct _CRYPT_PROVIDER_SGNR
  497. {
  498. DWORD cbStruct;
  499. FILETIME sftVerifyAsOf; // either today's filetime or the timestamps
  500. DWORD csCertChain; // use Add2 and Get functions!
  501. struct _CRYPT_PROVIDER_CERT *pasCertChain; // use Add2 and Get functions!
  502. DWORD dwSignerType; // set if known by policy
  503. # define SGNR_TYPE_TIMESTAMP 0x00000010
  504. CMSG_SIGNER_INFO *psSigner; // must use the pfnAlloc allocator!
  505. DWORD dwError; // error encounted while building/verifying the signer.
  506. DWORD csCounterSigners; // use Add2 and Get functions!
  507. struct _CRYPT_PROVIDER_SGNR *pasCounterSigners; // use Add2 and Get functions!
  508. // 11-Feb-1998 philh: added
  509. PCCERT_CHAIN_CONTEXT pChainContext;
  510. } CRYPT_PROVIDER_SGNR, *PCRYPT_PROVIDER_SGNR;
  511. //////////////////////////////////////////////////////////////////////////////
  512. //
  513. // CRYPT_PROVIDER_CERT structure
  514. //----------------------------------------------------------------------------
  515. // After the Signature and Certificate Providers are finished there will
  516. // be zero to many of these filled out in the CRYPT_PROVIDER_SGNR
  517. // structure. One for each certificate in the chain.
  518. //
  519. //
  520. typedef struct _CRYPT_PROVIDER_CERT
  521. {
  522. DWORD cbStruct;
  523. PCCERT_CONTEXT pCert; // must have its own ref-count!
  524. BOOL fCommercial;
  525. BOOL fTrustedRoot; // certchk policy should set this.
  526. BOOL fSelfSigned; // set in cert provider
  527. BOOL fTestCert; // certchk policy will set
  528. DWORD dwRevokedReason;
  529. DWORD dwConfidence; // set in the Certificate Provider
  530. # define CERT_CONFIDENCE_SIG 0x10000000 // this cert
  531. # define CERT_CONFIDENCE_TIME 0x01000000 // issuer cert
  532. # define CERT_CONFIDENCE_TIMENEST 0x00100000 // this cert
  533. # define CERT_CONFIDENCE_AUTHIDEXT 0x00010000 // this cert
  534. # define CERT_CONFIDENCE_HYGIENE 0x00001000 // this cert
  535. # define CERT_CONFIDENCE_HIGHEST 0x11111000
  536. DWORD dwError;
  537. CTL_CONTEXT *pTrustListContext;
  538. // 16-Jan-1998 pberkman: added
  539. BOOL fTrustListSignerCert;
  540. // 25-Feb-1998 philh: added
  541. //
  542. // The following two are only applicable to Self Signed certificates
  543. // residing in a CTL.
  544. PCCTL_CONTEXT pCtlContext;
  545. DWORD dwCtlError;
  546. // 12-Mar-1998 philh: added
  547. BOOL fIsCyclic;
  548. // 12-Oct-2000 DSIE: added
  549. PCERT_CHAIN_ELEMENT pChainElement;
  550. } CRYPT_PROVIDER_CERT, *PCRYPT_PROVIDER_CERT;
  551. //////////////////////////////////////////////////////////////////////////////
  552. //
  553. // CRYPT_PROVIDER_PRIVDATA structure
  554. //----------------------------------------------------------------------------
  555. // This structure is to allow Policy Provider functions to share
  556. // POLICY SPECIFIC data between Policy Functions.
  557. // The Policy must use the pfnAddPrivateData2Chain function and
  558. // must free any data within the member before the Final Policy returns
  559. // to WVT.
  560. // To allow multiple providers to use this feature, each provider that
  561. // uses this member must set the provider ID to it's Action ID so that
  562. // the provider can find its data and ignore any other.
  563. //
  564. typedef struct _CRYPT_PROVIDER_PRIVDATA
  565. {
  566. DWORD cbStruct;
  567. GUID gProviderID;
  568. DWORD cbProvData;
  569. void *pvProvData;
  570. } CRYPT_PROVIDER_PRIVDATA, *PCRYPT_PROVIDER_PRIVDATA;
  571. //////////////////////////////////////////////////////////////////////////////
  572. //
  573. // PROVDATA_SIP
  574. //----------------------------------------------------------------------------
  575. //
  576. typedef struct _PROVDATA_SIP
  577. {
  578. DWORD cbStruct; // = sizeof(PROVDATA_SIP)
  579. GUID gSubject; // subject guid of file/member file. (set in Sig Prov)
  580. struct SIP_DISPATCH_INFO_ *pSip; // set in Sig Prov - defined in sipbase.h
  581. struct SIP_DISPATCH_INFO_ *pCATSip; // set in Sig Prov - defined in sipbase.h
  582. struct SIP_SUBJECTINFO_ *psSipSubjectInfo; // set in Sig Prov - defined in sipbase.h
  583. struct SIP_SUBJECTINFO_ *psSipCATSubjectInfo; // set in Sig Prov - defined in sipbase.h
  584. struct SIP_INDIRECT_DATA_ *psIndirectData; // set in Sig Prov - defined in sipbase.h
  585. } PROVDATA_SIP, *PPROVDATA_SIP;
  586. //////////////////////////////////////////////////////////////////////////////
  587. //
  588. // structures used to register action IDs
  589. //----------------------------------------------------------------------------
  590. //
  591. #define WT_CURRENT_VERSION 0x00000200
  592. typedef struct _CRYPT_TRUST_REG_ENTRY
  593. {
  594. DWORD cbStruct;
  595. WCHAR *pwszDLLName;
  596. WCHAR *pwszFunctionName; // no more than WT_MAX_FUNC_NAME!
  597. } CRYPT_TRUST_REG_ENTRY, *PCRYPT_TRUST_REG_ENTRY;
  598. typedef struct _CRYPT_REGISTER_ACTIONID
  599. {
  600. DWORD cbStruct;
  601. CRYPT_TRUST_REG_ENTRY sInitProvider;
  602. CRYPT_TRUST_REG_ENTRY sObjectProvider;
  603. CRYPT_TRUST_REG_ENTRY sSignatureProvider;
  604. CRYPT_TRUST_REG_ENTRY sCertificateProvider;
  605. CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider;
  606. CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider;
  607. CRYPT_TRUST_REG_ENTRY sTestPolicyProvider;
  608. // 23-Jul-1997 pberkman: added
  609. CRYPT_TRUST_REG_ENTRY sCleanupProvider;
  610. } CRYPT_REGISTER_ACTIONID, *PCRYPT_REGISTER_ACTIONID;
  611. typedef BOOL (*PFN_ALLOCANDFILLDEFUSAGE)(IN const char *pszUsageOID,
  612. IN struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
  613. typedef BOOL (*PFN_FREEDEFUSAGE)(IN const char *pszUsageOID,
  614. IN struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
  615. typedef struct _CRYPT_PROVIDER_REGDEFUSAGE
  616. {
  617. DWORD cbStruct; // = sizeof CRYPT_PROVIDER_REGDEFUSAGE
  618. GUID *pgActionID;
  619. WCHAR *pwszDllName;
  620. char *pwszLoadCallbackDataFunctionName;
  621. char *pwszFreeCallbackDataFunctionName;
  622. } CRYPT_PROVIDER_REGDEFUSAGE, *PCRYPT_PROVIDER_REGDEFUSAGE;
  623. typedef struct _CRYPT_PROVIDER_DEFUSAGE
  624. {
  625. DWORD cbStruct; // = sizeof CRYPT_PROVIDER_DEFUSAGE
  626. GUID gActionID; // ActionID of provider
  627. LPVOID pDefPolicyCallbackData; // normally filled in WINTRUST_DATA
  628. LPVOID pDefSIPClientData; // normally filled in WINTRUST_DATA
  629. } CRYPT_PROVIDER_DEFUSAGE, *PCRYPT_PROVIDER_DEFUSAGE;
  630. #include <poppack.h>
  631. //////////////////////////////////////////////////////////////////////////////
  632. //
  633. // WINTRUST.DLL Provider defines
  634. //----------------------------------------------------------------------------
  635. // The following are definitions of the Microsoft Generic Cert Provider
  636. //
  637. #define WT_PROVIDER_DLL_NAME L"WINTRUST.DLL"
  638. #define WT_PROVIDER_CERTTRUST_FUNCTION L"WintrustCertificateTrust"
  639. //////////////////////////////////////////////////////////////////////////////
  640. //
  641. // WintrustAddActionID
  642. //----------------------------------------------------------------------------
  643. // Adds a new Provider combination to the users'
  644. // system. Creates all necessary registry entries, etc. This should be done
  645. // during the Policy Provider's DllRegisterServer.
  646. //
  647. // *** THE ONLY ONE WHO SHOULD CALL THIS IS THE POLICY PROVIDER ***
  648. //
  649. // Returns:
  650. // TRUE: No fatal errors
  651. // FALSE: Errors occured. See GetLastError()
  652. //
  653. extern BOOL WINAPI WintrustAddActionID(IN GUID *pgActionID,
  654. IN DWORD fdwReserved, // future use.
  655. IN CRYPT_REGISTER_ACTIONID *psProvInfo);
  656. //////////////////////////////////////////////////////////////////////////////
  657. //
  658. // WintrustRemoveActionID
  659. //----------------------------------------------------------------------------
  660. // Removes the Provider action combination from the users'
  661. // system.
  662. //
  663. // Returns:
  664. // TRUE: No fatal errors
  665. // FALSE: Errors occured. See GetLastError()
  666. //
  667. extern BOOL WINAPI WintrustRemoveActionID(IN GUID *pgActionID);
  668. //////////////////////////////////////////////////////////////////////////////
  669. //
  670. // WintrustLoadFunctionPointers
  671. //----------------------------------------------------------------------------
  672. // Retrieves the function entry points based on the Action ID given.
  673. //
  674. // Returns:
  675. // TRUE success.
  676. // FALSE fail.
  677. //
  678. extern BOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns);
  679. //////////////////////////////////////////////////////////////////////////////
  680. //
  681. // WintrustAddDefaultForUsage
  682. //----------------------------------------------------------------------------
  683. // Sets the default Action ID for the usage. If the provider uses this
  684. // function, and the provider requires any of the "callback" data in
  685. // WINTRUST_DATA to be filled out, it MUST completely fill out the
  686. // CRYPT_PROVIDER_REGDEFUSAGE structure.
  687. //
  688. // Returns:
  689. // TRUE success.
  690. // FALSE fail.
  691. //
  692. extern BOOL WINAPI WintrustAddDefaultForUsage(IN const char *pszUsageOID,
  693. IN CRYPT_PROVIDER_REGDEFUSAGE *psDefUsage);
  694. //////////////////////////////////////////////////////////////////////////////
  695. //
  696. // WintrustGetDefaultForUsage
  697. //----------------------------------------------------------------------------
  698. // Retrieves the Action ID and default callback data for the specified usage
  699. //
  700. // this function must be called again with dwAction set to FREE to deallocate
  701. //
  702. //
  703. // Returns:
  704. // TRUE success.
  705. // FALSE fail.
  706. //
  707. #define DWACTION_ALLOCANDFILL 1
  708. #define DWACTION_FREE 2
  709. extern BOOL WINAPI WintrustGetDefaultForUsage(IN DWORD dwAction,
  710. IN const char *pszUsageOID,
  711. IN OUT CRYPT_PROVIDER_DEFUSAGE *psUsage);
  712. extern CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(CRYPT_PROVIDER_DATA *pProvData,
  713. DWORD idxSigner,
  714. BOOL fCounterSigner,
  715. DWORD idxCounterSigner);
  716. extern CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(CRYPT_PROVIDER_SGNR *pSgnr,
  717. DWORD idxCert);
  718. extern CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
  719. extern CRYPT_PROVIDER_PRIVDATA * WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *pProvData,
  720. GUID *pgProviderID);
  721. extern BOOL WINAPI WTHelperCertIsSelfSigned(DWORD dwEncoding, CERT_INFO *pCert);
  722. //////////////////////////////////////////////////////////////////////////////
  723. //
  724. // Supported ASN structures contained in WINTRUST.DLL
  725. //----------------------------------------------------------------------------
  726. //
  727. #include <pshpack8.h>
  728. //
  729. // CTL Trusted CA Lists
  730. //
  731. #define szOID_TRUSTED_CODESIGNING_CA_LIST "1.3.6.1.4.1.311.2.2.1"
  732. #define szOID_TRUSTED_CLIENT_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.2"
  733. #define szOID_TRUSTED_SERVER_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.3"
  734. //
  735. // encode/decode OID defines
  736. //
  737. #define SPC_COMMON_NAME_OBJID szOID_COMMON_NAME
  738. #define SPC_TIME_STAMP_REQUEST_OBJID "1.3.6.1.4.1.311.3.2.1"
  739. #define SPC_INDIRECT_DATA_OBJID "1.3.6.1.4.1.311.2.1.4"
  740. #define SPC_SP_AGENCY_INFO_OBJID "1.3.6.1.4.1.311.2.1.10"
  741. #define SPC_STATEMENT_TYPE_OBJID "1.3.6.1.4.1.311.2.1.11"
  742. #define SPC_SP_OPUS_INFO_OBJID "1.3.6.1.4.1.311.2.1.12"
  743. #define SPC_CERT_EXTENSIONS_OBJID "1.3.6.1.4.1.311.2.1.14"
  744. #define SPC_PE_IMAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.15"
  745. #define SPC_RAW_FILE_DATA_OBJID "1.3.6.1.4.1.311.2.1.18"
  746. #define SPC_STRUCTURED_STORAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.19"
  747. #define SPC_JAVA_CLASS_DATA_OBJID "1.3.6.1.4.1.311.2.1.20"
  748. #define SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.21"
  749. #define SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.22"
  750. #define SPC_CAB_DATA_OBJID "1.3.6.1.4.1.311.2.1.25"
  751. #define SPC_GLUE_RDN_OBJID "1.3.6.1.4.1.311.2.1.25" // obsolete!
  752. #define SPC_MINIMAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.26"
  753. #define SPC_FINANCIAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.27"
  754. #define SPC_LINK_OBJID "1.3.6.1.4.1.311.2.1.28"
  755. #define SPC_SIGINFO_OBJID "1.3.6.1.4.1.311.2.1.30"
  756. #define CAT_NAMEVALUE_OBJID "1.3.6.1.4.1.311.12.2.1"
  757. #define CAT_MEMBERINFO_OBJID "1.3.6.1.4.1.311.12.2.2"
  758. //
  759. // encode/decode internal defines
  760. //
  761. #define SPC_SP_AGENCY_INFO_STRUCT ((LPCSTR) 2000)
  762. #define SPC_MINIMAL_CRITERIA_STRUCT ((LPCSTR) 2001)
  763. #define SPC_FINANCIAL_CRITERIA_STRUCT ((LPCSTR) 2002)
  764. #define SPC_INDIRECT_DATA_CONTENT_STRUCT ((LPCSTR) 2003)
  765. #define SPC_PE_IMAGE_DATA_STRUCT ((LPCSTR) 2004)
  766. #define SPC_LINK_STRUCT ((LPCSTR) 2005)
  767. #define SPC_STATEMENT_TYPE_STRUCT ((LPCSTR) 2006)
  768. #define SPC_SP_OPUS_INFO_STRUCT ((LPCSTR) 2007)
  769. #define SPC_CAB_DATA_STRUCT ((LPCSTR) 2008)
  770. #define SPC_JAVA_CLASS_DATA_STRUCT ((LPCSTR) 2009)
  771. #define SPC_SIGINFO_STRUCT ((LPCSTR) 2130)
  772. #define CAT_NAMEVALUE_STRUCT ((LPCSTR) 2221)
  773. #define CAT_MEMBERINFO_STRUCT ((LPCSTR) 2222)
  774. #define SPC_UUID_LENGTH 16
  775. typedef BYTE SPC_UUID[SPC_UUID_LENGTH];
  776. typedef struct _SPC_SERIALIZED_OBJECT
  777. {
  778. SPC_UUID ClassId;
  779. CRYPT_DATA_BLOB SerializedData;
  780. } SPC_SERIALIZED_OBJECT, *PSPC_SERIALIZED_OBJECT;
  781. typedef struct SPC_SIGINFO_
  782. {
  783. DWORD dwSipVersion;
  784. GUID gSIPGuid;
  785. DWORD dwReserved1;
  786. DWORD dwReserved2;
  787. DWORD dwReserved3;
  788. DWORD dwReserved4;
  789. DWORD dwReserved5;
  790. } SPC_SIGINFO, *PSPC_SIGINFO;
  791. typedef struct SPC_LINK_
  792. {
  793. DWORD dwLinkChoice;
  794. # define SPC_URL_LINK_CHOICE 1
  795. # define SPC_MONIKER_LINK_CHOICE 2
  796. # define SPC_FILE_LINK_CHOICE 3
  797. union
  798. {
  799. LPWSTR pwszUrl;
  800. SPC_SERIALIZED_OBJECT Moniker;
  801. LPWSTR pwszFile;
  802. };
  803. } SPC_LINK, *PSPC_LINK;
  804. typedef struct _SPC_PE_IMAGE_DATA
  805. {
  806. CRYPT_BIT_BLOB Flags;
  807. PSPC_LINK pFile;
  808. } SPC_PE_IMAGE_DATA, *PSPC_PE_IMAGE_DATA;
  809. typedef struct _SPC_INDIRECT_DATA_CONTENT
  810. {
  811. CRYPT_ATTRIBUTE_TYPE_VALUE Data;
  812. CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
  813. CRYPT_HASH_BLOB Digest;
  814. } SPC_INDIRECT_DATA_CONTENT, *PSPC_INDIRECT_DATA_CONTENT;
  815. typedef struct _SPC_FINANCIAL_CRITERIA
  816. {
  817. BOOL fFinancialInfoAvailable;
  818. BOOL fMeetsCriteria;
  819. } SPC_FINANCIAL_CRITERIA, *PSPC_FINANCIAL_CRITERIA;
  820. typedef struct _SPC_IMAGE
  821. {
  822. struct SPC_LINK_ *pImageLink;
  823. CRYPT_DATA_BLOB Bitmap;
  824. CRYPT_DATA_BLOB Metafile;
  825. CRYPT_DATA_BLOB EnhancedMetafile;
  826. CRYPT_DATA_BLOB GifFile;
  827. } SPC_IMAGE, *PSPC_IMAGE;
  828. typedef struct _SPC_SP_AGENCY_INFO
  829. {
  830. struct SPC_LINK_ *pPolicyInformation;
  831. LPWSTR pwszPolicyDisplayText;
  832. PSPC_IMAGE pLogoImage;
  833. struct SPC_LINK_ *pLogoLink;
  834. } SPC_SP_AGENCY_INFO, *PSPC_SP_AGENCY_INFO;
  835. typedef struct _SPC_STATEMENT_TYPE
  836. {
  837. DWORD cKeyPurposeId;
  838. LPSTR *rgpszKeyPurposeId; // pszObjId
  839. } SPC_STATEMENT_TYPE, *PSPC_STATEMENT_TYPE;
  840. typedef struct _SPC_SP_OPUS_INFO
  841. {
  842. LPCWSTR pwszProgramName;
  843. struct SPC_LINK_ *pMoreInfo;
  844. struct SPC_LINK_ *pPublisherInfo;
  845. } SPC_SP_OPUS_INFO, *PSPC_SP_OPUS_INFO;
  846. typedef struct _CAT_NAMEVALUE
  847. {
  848. LPWSTR pwszTag;
  849. DWORD fdwFlags;
  850. CRYPT_DATA_BLOB Value;
  851. } CAT_NAMEVALUE, *PCAT_NAMEVALUE;
  852. typedef struct _CAT_MEMBERINFO
  853. {
  854. LPWSTR pwszSubjGuid;
  855. DWORD dwCertVersion;
  856. } CAT_MEMBERINFO, *PCAT_MEMBERINFO;
  857. #include <poppack.h>
  858. //////////////////////////////////////////////////////////////////////////////////
  859. //
  860. // support for old calling convention: *** DO NOT USE ***
  861. //
  862. #ifdef WT_DEFINE_ALL_APIS
  863. typedef struct _WIN_CERTIFICATE
  864. {
  865. DWORD dwLength;
  866. WORD wRevision;
  867. WORD wCertificateType; // WIN_CERT_TYPE_xxx
  868. BYTE bCertificate[ANYSIZE_ARRAY];
  869. } WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
  870. #define WIN_CERT_REVISION_1_0 (0x0100)
  871. #define WIN_CERT_REVISION_2_0 (0x0200)
  872. #define WIN_CERT_TYPE_X509 (0x0001) // bCertificate contains an X.509 Certificate
  873. #define WIN_CERT_TYPE_PKCS_SIGNED_DATA (0x0002) // bCertificate contains a PKCS SignedData structure
  874. #define WIN_CERT_TYPE_RESERVED_1 (0x0003) // Reserved
  875. typedef LPVOID WIN_TRUST_SUBJECT;
  876. typedef struct _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT
  877. {
  878. HANDLE hClientToken;
  879. GUID * SubjectType;
  880. WIN_TRUST_SUBJECT Subject;
  881. } WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT, *LPWIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT ;
  882. typedef struct _WIN_TRUST_ACTDATA_SUBJECT_ONLY
  883. {
  884. GUID * SubjectType;
  885. WIN_TRUST_SUBJECT Subject;
  886. } WIN_TRUST_ACTDATA_SUBJECT_ONLY, *LPWIN_TRUST_ACTDATA_SUBJECT_ONLY;
  887. /* RawFile == 959dc450-8d9e-11cf-8736-00aa00a485eb */
  888. #define WIN_TRUST_SUBJTYPE_RAW_FILE \
  889. { 0x959dc450, \
  890. 0x8d9e, \
  891. 0x11cf, \
  892. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  893. }
  894. /* PeImage == 43c9a1e0-8da0-11cf-8736-00aa00a485eb */
  895. #define WIN_TRUST_SUBJTYPE_PE_IMAGE \
  896. { 0x43c9a1e0, \
  897. 0x8da0, \
  898. 0x11cf, \
  899. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  900. }
  901. /* JavaClass = 08ad3990-8da1-11cf-8736-00aa00a485eb */
  902. #define WIN_TRUST_SUBJTYPE_JAVA_CLASS \
  903. { 0x08ad3990, \
  904. 0x8da1, \
  905. 0x11cf, \
  906. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  907. }
  908. /* Cabinet = d17c5374-a392-11cf-9df5-00aa00c184e0 */
  909. #define WIN_TRUST_SUBJTYPE_CABINET \
  910. { 0xd17c5374, \
  911. 0xa392, \
  912. 0x11cf, \
  913. { 0x9d, 0xf5, 0x0, 0xaa, 0x0, 0xc1, 0x84, 0xe0 } \
  914. }
  915. typedef struct _WIN_TRUST_SUBJECT_FILE
  916. {
  917. HANDLE hFile;
  918. LPCWSTR lpPath;
  919. } WIN_TRUST_SUBJECT_FILE, *LPWIN_TRUST_SUBJECT_FILE;
  920. #define WIN_TRUST_SUBJTYPE_RAW_FILEEX \
  921. { 0x6f458110, \
  922. 0xc2f1, \
  923. 0x11cf, \
  924. { 0x8a, 0x69, 0x0, 0xaa, 0x0, 0x6c, 0x37, 0x6 } \
  925. }
  926. #define WIN_TRUST_SUBJTYPE_PE_IMAGEEX \
  927. { 0x6f458111, \
  928. 0xc2f1, \
  929. 0x11cf, \
  930. { 0x8a, 0x69, 0x0, 0xaa, 0x0, 0x6c, 0x37, 0x6 } \
  931. }
  932. #define WIN_TRUST_SUBJTYPE_JAVA_CLASSEX \
  933. { 0x6f458113, \
  934. 0xc2f1, \
  935. 0x11cf, \
  936. { 0x8a, 0x69, 0x0, 0xaa, 0x0, 0x6c, 0x37, 0x6 } \
  937. }
  938. #define WIN_TRUST_SUBJTYPE_CABINETEX \
  939. { 0x6f458114, \
  940. 0xc2f1, \
  941. 0x11cf, \
  942. { 0x8a, 0x69, 0x0, 0xaa, 0x0, 0x6c, 0x37, 0x6 } \
  943. }
  944. typedef struct _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY
  945. {
  946. HANDLE hFile; // handle to the open file if you got it
  947. LPCWSTR lpPath; // the path to open if you don't
  948. LPCWSTR lpDisplayName; // (optional) display name to show to user
  949. } WIN_TRUST_SUBJECT_FILE_AND_DISPLAY, *LPWIN_TRUST_SUBJECT_FILE_AND_DISPLAY;
  950. /* OleStorage == c257e740-8da0-11cf-8736-00aa00a485eb */
  951. #define WIN_TRUST_SUBJTYPE_OLE_STORAGE \
  952. { 0xc257e740, \
  953. 0x8da0, \
  954. 0x11cf, \
  955. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  956. }
  957. /* TrustedPublisher == 66426730-8da1-11cf-8736-00aa00a485eb */
  958. #define WIN_SPUB_ACTION_TRUSTED_PUBLISHER \
  959. { 0x66426730, \
  960. 0x8da1, \
  961. 0x11cf, \
  962. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  963. }
  964. /* NtActivateImage == 8bc96b00-8da1-11cf-8736-00aa00a485eb */
  965. #define WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE \
  966. { 0x8bc96b00, \
  967. 0x8da1, \
  968. 0x11cf, \
  969. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  970. }
  971. /* PublishedSoftware == 64b9d180-8da2-11cf-8736-00aa00a485eb */
  972. #define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE \
  973. { 0x64b9d180, \
  974. 0x8da2, \
  975. 0x11cf, \
  976. {0x87, 0x36, 0x00, 0xaa, 0x00, 0xa4, 0x85, 0xeb} \
  977. }
  978. typedef struct _WIN_SPUB_TRUSTED_PUBLISHER_DATA
  979. {
  980. HANDLE hClientToken;
  981. LPWIN_CERTIFICATE lpCertificate;
  982. } WIN_SPUB_TRUSTED_PUBLISHER_DATA, *LPWIN_SPUB_TRUSTED_PUBLISHER_DATA;
  983. #endif
  984. #ifdef __cplusplus
  985. }
  986. #endif
  987. #endif // WINTRUST_H