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.

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