Source code of Windows XP (NT5)
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.

235 lines
8.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1997
  6. //
  7. // File: wintrustP.h
  8. //
  9. // Contents: Microsoft Internet Security Trust PRIVATE INCLUDE
  10. //
  11. // History: 20-Nov-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef WINTRUSTP_H
  15. #define WINTRUSTP_H
  16. #include <wincrypt.h>
  17. #ifdef __cplusplus
  18. extern "C"
  19. {
  20. #endif
  21. #pragma pack(8)
  22. typedef struct WINTRUST_PBCB_INFO_
  23. {
  24. DWORD cbStruct;
  25. LPCWSTR pcwszFileName;
  26. HANDLE hFile;
  27. DWORD cbContent;
  28. BYTE *pbContent;
  29. struct WINTRUST_ADV_INFO_ *psAdvanced; // optional
  30. } WINTRUST_PBCB_INFO, *PWINTRUST_PBCB_INFO;
  31. typedef struct WINTRUST_ADV_INFO_
  32. {
  33. DWORD cbStruct;
  34. DWORD dwStoreFlags;
  35. # define WTCI_DONT_OPEN_STORES 0x00000001 // only open dummy "root" all other are in pahStores.
  36. # define WTCI_OPEN_ONLY_ROOT 0x00000002
  37. DWORD chStores; // number of stores in pahStores
  38. HCERTSTORE *pahStores; // array of stores to add to internal list
  39. GUID *pgSubject; // Optional: SIP to load
  40. } WINTRUST_ADV_INFO, *PWINTRUST_ADV_INFO;
  41. #pragma pack()
  42. //////////////////////////////////////////////////////////////////////////////
  43. //
  44. // WinVerifyTrustEx
  45. //----------------------------------------------------------------------------
  46. // *** DO NOT USE ***
  47. //
  48. //
  49. extern HRESULT WINAPI WinVerifyTrustEx(HWND hwnd, GUID *pgActionID,
  50. WINTRUST_DATA *pWinTrustData);
  51. //////////////////////////////////////////////////////////////////////////////
  52. //
  53. // TrustFindIssuerCertificate
  54. //----------------------------------------------------------------------------
  55. //
  56. // Usage:
  57. //
  58. // Returns:
  59. //
  60. // Last Errors:
  61. //
  62. // Comments:
  63. // the dwFlags parameter is reserved for future use and MUST be set
  64. // to NULL.
  65. //
  66. extern PCCERT_CONTEXT WINAPI TrustFindIssuerCertificate(IN PCCERT_CONTEXT pChildContext,
  67. IN DWORD dwEncoding,
  68. IN DWORD chStores,
  69. IN HCERTSTORE *pahStores,
  70. IN FILETIME *psftVerifyAsOf,
  71. OUT OPTIONAL DWORD *pdwConfidence,
  72. OUT OPTIONAL DWORD *pdwError,
  73. IN DWORD dwFlags);
  74. //////////////////////////////////////////////////////////////////////////////
  75. //
  76. // TrustOpenStores
  77. //----------------------------------------------------------------------------
  78. //
  79. // Usage:
  80. //
  81. // Returns:
  82. //
  83. // Last Errors:
  84. //
  85. // Comments:
  86. // the dwFlags parameter is reserved for future use and MUST be set
  87. // to NULL.
  88. //
  89. extern BOOL WINAPI TrustOpenStores(IN HCRYPTPROV hProv,
  90. IN OUT DWORD *chStores,
  91. IN OUT OPTIONAL HCERTSTORE *pahStores,
  92. IN DWORD dwFlags);
  93. //////////////////////////////////////////////////////////////////////////////
  94. //
  95. // TrustIsCertificateSelfSigned
  96. //----------------------------------------------------------------------------
  97. //
  98. // Usage:
  99. //
  100. // Returns:
  101. //
  102. // Last Errors:
  103. //
  104. // Comments:
  105. // the dwFlags parameter is reserved for future use and MUST be set
  106. // to NULL.
  107. //
  108. extern BOOL WINAPI TrustIsCertificateSelfSigned(IN PCCERT_CONTEXT pContext,
  109. IN DWORD dwEncoding,
  110. IN DWORD dwFlags);
  111. //////////////////////////////////////////////////////////////////////////////
  112. //
  113. // Exported "helper" functions
  114. //----------------------------------------------------------------------------
  115. //
  116. extern BOOL WINAPI WTHelperOpenKnownStores(CRYPT_PROVIDER_DATA *pProvData);
  117. #define WTH_ALLOC 0x00000001
  118. #define WTH_FREE 0x00000002
  119. extern BOOL WINAPI WTHelperGetKnownUsages(DWORD fdwAction,
  120. PCCRYPT_OID_INFO **ppOidInfo);
  121. extern HANDLE WINAPI WTHelperGetFileHandle(WINTRUST_DATA *pWintrustData);
  122. extern WCHAR * WINAPI WTHelperGetFileName(WINTRUST_DATA *pWintrustData);
  123. extern BOOL WINAPI WTHelperCertIsSelfSignedEx(DWORD dwEncoding, PCCERT_CONTEXT pContext);
  124. extern BOOL WINAPI WTHelperOpenKnownStores(CRYPT_PROVIDER_DATA *pProvData);
  125. extern BOOL WINAPI WTHelperCheckCertUsage(PCCERT_CONTEXT pCertContext,
  126. LPCSTR pszRequestedUsageOID);
  127. extern BOOL WINAPI WTHelperIsInRootStore(CRYPT_PROVIDER_DATA *pProvData,
  128. PCCERT_CONTEXT pCertContext);
  129. extern BOOL WINAPI WTHelperGetAgencyInfo(PCCERT_CONTEXT pCert,
  130. DWORD *pcbAgencyInfo,
  131. struct _SPC_SP_AGENCY_INFO *psAgencyInfo);
  132. #define WVT_MODID_WINTRUST 0x00000001
  133. #define WVT_MODID_SOFTPUB 0x00010000
  134. #define WVT_MODID_MSSIP 0x00001000
  135. extern BOOL WINAPI TrustDecode(DWORD dwModuleId, BYTE **ppbRet, DWORD *pcbRet, DWORD cbHint,
  136. DWORD dwEncoding, const char *pcszOID, const BYTE *pbEncoded, DWORD cbEncoded,
  137. DWORD dwDecodeFlags);
  138. extern BOOL WINAPI TrustFreeDecode(DWORD dwModuleId, BYTE **pbAllocated);
  139. // Returns ERROR_SUCCESS and the hash if the file was signed and contains a
  140. // valid hash
  141. extern LONG WINAPI WTHelperGetFileHash(
  142. IN LPCWSTR pwszFilename,
  143. IN DWORD dwFlags,
  144. IN OUT OPTIONAL PVOID *pvReserved,
  145. OUT OPTIONAL BYTE *pbFileHash,
  146. IN OUT OPTIONAL DWORD *pcbFileHash,
  147. OUT OPTIONAL ALG_ID *pHashAlgid
  148. );
  149. // Open the cert manager UI dialog's TrustedPublisher Tab.
  150. //
  151. // The following flags may be set:
  152. // WT_TRUSTDBDIALOG_NO_UI_FLAG
  153. // Set this flag in conjunction with
  154. // WT_TRUSTDBDIALOG_WRITE_LEGACY_REG_FLAG and/or
  155. // WT_TRUSTDBDIALOG_WRITE_IEAK_STORE_FLAG to do the registry and/or
  156. // store write without any UI.
  157. // WT_TRUSTDBDIALOG_ONLY_PUB_TAB_FLAG
  158. // By default all of the UI tabs are displayed with TrustedPublisher
  159. // as the initial tab. Setting this flag only displays the
  160. // TrustedPublisher tab.
  161. // WT_TRUSTDBDIALOG_WRITE_LEGACY_REG_FLAG
  162. // Setting this flag causes the trusted publishers to be written to the
  163. // following legacy registry location:
  164. // "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
  165. // WinTrust\Trust Providers\Software Publishing\Trust Database\0"
  166. // The registry value names are constructed as ascii generated
  167. // representations of the md5 hash of the issuer name and the cert's serial
  168. // number. The string value is the subject display name.
  169. //
  170. // Note, the above registry key is initially deleted to force the removal
  171. // of any previous publisher values.
  172. // WT_TRUSTDBDIALOG_WRITE_IEAK_STORE_FLAG
  173. // Setting this flag causes all of the trusted publishers to be copied to
  174. // the "TrustedPublisher_IEAK" system registry store at the following
  175. // location:
  176. // "HKEY_CURRENT_USER\Software\Microsoft\SystemCertificates\
  177. // TrustedPublisher_IEAK\Certificates\..."
  178. // Note, the logical HKCU TrustedPublisher store inherits from HKLM and
  179. // GroupPolicy. The TrustedPublisher_IEAK will contain the entire set
  180. // under a single registry subkey.
  181. //
  182. // Note, initially all certs are removed from the above store.
  183. //
  184. extern BOOL WINAPI OpenPersonalTrustDBDialogEx(
  185. IN OPTIONAL HWND hwndParent,
  186. IN DWORD dwFlags,
  187. IN OUT OPTIONAL PVOID *pvReserved
  188. );
  189. #define WT_TRUSTDBDIALOG_NO_UI_FLAG 0x00000001
  190. #define WT_TRUSTDBDIALOG_ONLY_PUB_TAB_FLAG 0x00000002
  191. #define WT_TRUSTDBDIALOG_WRITE_LEGACY_REG_FLAG 0x00000100
  192. #define WT_TRUSTDBDIALOG_WRITE_IEAK_STORE_FLAG 0x00000200
  193. // Calls above with dwFlags = 0 and pvReserved = NULL
  194. extern BOOL WINAPI OpenPersonalTrustDBDialog(
  195. IN OPTIONAL HWND hwndParent
  196. );
  197. #ifdef __cplusplus
  198. }
  199. #endif
  200. #endif // WINTRUSTP_H