home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / WINTRUST.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  11KB  |  325 lines

  1. /************************************************************************
  2. *                                                                       *
  3. *   wintrust.h -- This module defines the 32-Bit WinTrust definitions   *
  4. *                 needed to build Trust Providers and / Subject         *
  5. *                 Interface Packages.                                   *
  6. *                                                                       *
  7. *   Copyright (c) 1990-1996, Microsoft Corp. All rights reserved.       *
  8. *                                                                       *
  9. ************************************************************************/
  10. #ifndef _WINTRUST_
  11. #define _WINTRUST_
  12. #pragma option -b
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. #ifdef __BORLANDC__
  19. #pragma option -b.
  20.   #include <pshpack8.h>
  21. #pragma option -b
  22. #endif
  23.  
  24.  
  25. /***********************************************************************
  26. *                                                                      *
  27. * This section contains definitions related to:                        *
  28. *                                                                      *
  29. *                           WinTrust in general                        *
  30. *                                                                      *
  31. ************************************************************************/
  32.  
  33.  
  34. //
  35. // WinTrust Revisioning
  36. //
  37. #define WIN_TRUST_MAJOR_REVISION_MASK       0xFFFF0000
  38. #define WIN_TRUST_MINOR_REVISION_MASK       0x0000FFFF
  39. #define WIN_TRUST_REVISION_1_0              0x00010000
  40.  
  41.  
  42.  
  43.  
  44. /***********************************************************************
  45. *                                                                      *
  46. * This section contains definitions related to:                        *
  47. *                                                                      *
  48. *                           Subject Interface Packages                 *
  49. *                                                                      *
  50. ************************************************************************/
  51.  
  52. //
  53. // Allows passing of subject and type material.
  54. //
  55.  
  56. typedef struct _WIN_TRUST_SIP_SUBJECT {
  57.     GUID *                  SubjectType;
  58.     WIN_TRUST_SUBJECT       Subject;
  59. } WIN_TRUST_SIP_SUBJECT, *LPWIN_TRUST_SIP_SUBJECT;
  60.  
  61. //
  62. // Templates of services that must be EXPORTED by SIPs
  63. // FOR USE by Trust Providers (calling through WinTrust).
  64. //
  65.  
  66. typedef BOOL
  67. (WINAPI *LPWINTRUST_SUBJECT_CHECK_CONTENT_INFO)(
  68.     IN     LPWIN_TRUST_SIP_SUBJECT          lpSubject,          // pointer to subject info
  69.     IN     LPWIN_CERTIFICATE                lpSignedData       // PKCS #7 Signed Data
  70.     );
  71.  
  72. typedef BOOL
  73. (WINAPI *LPWINTRUST_SUBJECT_ENUM_CERTIFICATES)(
  74.     IN     LPWIN_TRUST_SIP_SUBJECT          lpSubject,          // pointer to subject info
  75.     IN     DWORD                            dwTypeFilter,       // 0 or WIN_CERT_TYPE_xxx
  76.     OUT    LPDWORD                          lpCertificateCount,
  77.     IN OUT LPDWORD                          lpIndices,          // Rcvs WIN_CERT_TYPE_
  78.     IN     DWORD                            dwIndexCount
  79.     );
  80.  
  81. typedef BOOL
  82. (WINAPI *LPWINTRUST_SUBJECT_GET_CERTIFICATE)(
  83.     IN     LPWIN_TRUST_SIP_SUBJECT          lpSubject,
  84.     IN     DWORD                            dwCertificateIndex,
  85.     OUT    LPWIN_CERTIFICATE                lpCertificate,
  86.     IN OUT LPDWORD                          lpRequiredLength
  87.     );
  88.  
  89. typedef BOOL
  90. (WINAPI *LPWINTRUST_SUBJECT_GET_CERT_HEADER)(
  91.     IN     LPWIN_TRUST_SIP_SUBJECT          lpSubject,
  92.     IN     DWORD                            dwCertificateIndex,
  93.     OUT    LPWIN_CERTIFICATE                lpCertificateHeader
  94.     );
  95.  
  96. typedef BOOL
  97. (WINAPI *LPWINTRUST_SUBJECT_GET_NAME)(
  98.     IN     LPWIN_TRUST_SIP_SUBJECT      lpSubject,
  99.     IN     LPWIN_CERTIFICATE            lpSignedData,
  100.     IN OUT LPWSTR                       lpBuffer,
  101.     IN OUT LPDWORD                      lpRequiredLength
  102.     );
  103.  
  104. typedef DWORD
  105. (WINAPI *LPWINTRUST_PROVIDER_PING) (
  106.     IN      LPWSTR              lpProviderName,
  107.     IN      DWORD               dwClientParameter,
  108.     OUT     LPDWORD             lpdwServerReturnValue
  109.     );
  110.  
  111.  
  112. typedef struct _WINTRUST_SIP_DISPATCH_TABLE
  113. {
  114.     LPWINTRUST_SUBJECT_CHECK_CONTENT_INFO   CheckSubjectContentInfo;
  115.     LPWINTRUST_SUBJECT_ENUM_CERTIFICATES    EnumSubjectCertificates;
  116.     LPWINTRUST_SUBJECT_GET_CERTIFICATE      GetSubjectCertificate;
  117.     LPWINTRUST_SUBJECT_GET_CERT_HEADER      GetSubjectCertHeader;
  118.     LPWINTRUST_SUBJECT_GET_NAME             GetSubjectName;
  119.  
  120. } WINTRUST_SIP_DISPATCH_TABLE, *LPWINTRUST_SIP_DISPATCH_TABLE;
  121.  
  122.  
  123.  
  124. //
  125. // Structure describing an individual SIP.
  126. //
  127. // This structure is passed back to WinTrust from a Subject Interface Package
  128. // initialization call.
  129. //
  130. typedef struct _WINTRUST_SIP_INFO {
  131.     DWORD                               dwRevision;
  132.     LPWINTRUST_SIP_DISPATCH_TABLE       lpServices;
  133.     DWORD                               dwSubjectTypeCount;
  134.     GUID *                              lpSubjectTypeArray;
  135. } WINTRUST_SIP_INFO, *LPWINTRUST_SIP_INFO;
  136.  
  137.  
  138.  
  139. //
  140. // SIP Intialization routine.
  141. // SIP DLLs are required to have a routine named:
  142. //
  143. //                          WinTrustSipInitialize.
  144. //
  145. // This initialization routine must have the following
  146. // definition:
  147. //
  148.  
  149. typedef BOOL
  150. (WINAPI *LPWINTRUST_SUBJECT_PACKAGE_INITIALIZE)(
  151.     IN     DWORD                            dwWinTrustRevision,
  152.     OUT    LPWINTRUST_SIP_INFO              *lpSipInfo
  153.     );
  154.  
  155.  
  156.  
  157.  
  158. /***********************************************************************
  159. *                                                                      *
  160. * This section contains definitions related to:                        *
  161. *                                                                      *
  162. *                           Trust Providers                            *
  163. *                                                                      *
  164. ************************************************************************/
  165.  
  166. //
  167. // Dispatch table of WinTrust services available to Trust Providers
  168. //
  169. // Client side...
  170.  
  171. typedef struct _WINTRUST_CLIENT_TP_DISPATCH_TABLE
  172. {
  173.     LPWINTRUST_PROVIDER_PING                ServerPing;
  174.     LPWINTRUST_SUBJECT_CHECK_CONTENT_INFO   CheckSubjectContentInfo;
  175.     LPWINTRUST_SUBJECT_ENUM_CERTIFICATES    EnumSubjectCertificates;
  176.     LPWINTRUST_SUBJECT_GET_CERTIFICATE      GetSubjectCertificate;
  177.     LPWINTRUST_SUBJECT_GET_CERT_HEADER      GetSubjectCertHeader;
  178.     LPWINTRUST_SUBJECT_GET_NAME             GetSubjectName;
  179.  
  180. } WINTRUST_CLIENT_TP_DISPATCH_TABLE, *LPWINTRUST_CLIENT_TP_DISPATCH_TABLE;
  181.  
  182.  
  183. // Server side...
  184.  
  185. typedef struct _WINTRUST_SERVER_TP_DISPATCH_TABLE
  186. {
  187.     LPWINTRUST_SUBJECT_CHECK_CONTENT_INFO   CheckSubjectContentInfo;
  188.     LPWINTRUST_SUBJECT_ENUM_CERTIFICATES    EnumSubectCertificates;
  189.     LPWINTRUST_SUBJECT_GET_CERTIFICATE      GetSubjectCertificate;
  190.     LPWINTRUST_SUBJECT_GET_CERT_HEADER      GetSubjectCertHeader;
  191.     LPWINTRUST_SUBJECT_GET_NAME             GetSubjectName;
  192.  
  193. } WINTRUST_SERVER_TP_DISPATCH_TABLE, *LPWINTRUST_SERVER_TP_DISPATCH_TABLE;
  194.  
  195.  
  196. //
  197. // The following structures are passed by WinTrust to a
  198. // Trust Provider being initialized.
  199. //
  200. // Client side...
  201.  
  202. typedef struct _WINTRUST_CLIENT_TP_INFO {
  203.     DWORD                                   dwRevision;
  204.     LPWINTRUST_CLIENT_TP_DISPATCH_TABLE     lpServices;
  205. } WINTRUST_CLIENT_TP_INFO,  *LPWINTRUST_CLIENT_TP_INFO;
  206.  
  207. // Server side
  208. typedef struct _WINTRUST_SERVER_TP_INFO {
  209.     DWORD                                   dwRevision;
  210.     LPWINTRUST_SERVER_TP_DISPATCH_TABLE     lpServices;
  211. } WINTRUST_SERVER_TP_INFO,  *LPWINTRUST_SERVER_TP_INFO;
  212.  
  213.  
  214. //
  215. // Templates of Trust Provider services available to WinTrust
  216. //
  217. typedef LONG
  218. (WINAPI *LPWINTRUST_PROVIDER_VERIFY_TRUST) (
  219.     IN     HWND                             hwnd,
  220.     IN     GUID *                           ActionID,
  221.     IN     LPVOID                           ActionData
  222.     );
  223.  
  224. typedef VOID
  225. (WINAPI *LPWINTRUST_PROVIDER_SUBMIT_CERTIFICATE) (
  226.     IN     LPWIN_CERTIFICATE                lpCertificate
  227.     );
  228.  
  229. typedef VOID
  230. (WINAPI *LPWINTRUST_PROVIDER_CLIENT_UNLOAD) (
  231.     IN     LPVOID                           lpTrustProviderInfo
  232.     );
  233.  
  234. typedef VOID
  235. (WINAPI *LPWINTRUST_PROVIDER_SERVER_UNLOAD) (
  236.     IN     LPVOID                           lpTrustProviderInfo
  237.     );
  238.  
  239. //
  240. // Dispatch table of Trust provider services available for use by WinTrust
  241. //
  242. //  Client side...
  243.  
  244. typedef struct _WINTRUST_PROVIDER_CLIENT_SERVICES
  245. {
  246.     LPWINTRUST_PROVIDER_CLIENT_UNLOAD       Unload;
  247.     LPWINTRUST_PROVIDER_VERIFY_TRUST        VerifyTrust;
  248.     LPWINTRUST_PROVIDER_SUBMIT_CERTIFICATE  SubmitCertificate;
  249.  
  250. } WINTRUST_PROVIDER_CLIENT_SERVICES, *LPWINTRUST_PROVIDER_CLIENT_SERVICES;
  251.  
  252.  
  253. typedef struct _WINTRUST_PROVIDER_SERVER_SERVICES
  254. {
  255.     LPWINTRUST_PROVIDER_SERVER_UNLOAD       Unload;
  256.     LPWINTRUST_PROVIDER_PING                Ping;
  257.  
  258. } WINTRUST_PROVIDER_SERVER_SERVICES, *LPWINTRUST_PROVIDER_SERVER_SERVICES;
  259.  
  260.  
  261. //
  262. // This structure is passed back from the client-side Trust Provider
  263. // following initialization of that Trust Provider.
  264. //
  265. typedef struct _WINTRUST_PROVIDER_CLIENT_INFO {
  266.     DWORD                                   dwRevision;
  267.     LPWINTRUST_PROVIDER_CLIENT_SERVICES     lpServices;
  268.     DWORD                                   dwActionIdCount;
  269.     GUID *                                  lpActionIdArray;
  270. } WINTRUST_PROVIDER_CLIENT_INFO, *LPWINTRUST_PROVIDER_CLIENT_INFO;
  271.  
  272. //
  273. // This structure is passed back from the server-side trust provider following
  274. // initialization of that trust provider.
  275. //
  276. typedef struct _WINTRUST_PROVIDER_SERVER_INFO {
  277.     DWORD                                   dwRevision;
  278.     LPWINTRUST_PROVIDER_SERVER_SERVICES     lpServices;
  279. } WINTRUST_PROVIDER_SERVER_INFO, *LPWINTRUST_PROVIDER_SERVER_INFO;
  280.  
  281.  
  282.  
  283.  
  284.  
  285. //
  286. // Trust Provider Initialization Routines
  287. // Each Trust Provider DLL must have a client and server side initialization
  288. // routine.  The routines must be named:
  289. //
  290. //              WinTrustProviderClientInitialize()
  291. //      and
  292. //              WinTrustProviderServerInitialize()
  293. //
  294. // and must be defined to match the following templates...
  295. //
  296. typedef BOOL
  297. (WINAPI *LPWINTRUST_PROVIDER_CLIENT_INITIALIZE)(
  298.     IN     DWORD                                dwWinTrustRevision,
  299.     IN     LPWINTRUST_CLIENT_TP_INFO            lpWinTrustInfo,
  300.     IN     LPWSTR                               lpProviderName,
  301.     OUT    LPWINTRUST_PROVIDER_CLIENT_INFO      *lpTrustProviderInfo
  302.     );
  303.  
  304. typedef BOOL
  305. (WINAPI *LPWINTRUST_PROVIDER_SERVER_INITIALIZE) (
  306.     IN     DWORD                            dwWinTrustRevision,
  307.     IN     LPWINTRUST_SERVER_TP_INFO        lpWinTrustInfo,
  308.     IN     LPWSTR                           lpProviderName,
  309.     OUT    LPWINTRUST_PROVIDER_SERVER_INFO  *lpTrustProviderInfo
  310.     );
  311.  
  312.  
  313. #ifdef __BORLANDC__
  314. #pragma option -b.
  315.   #include <poppack.h>
  316. #pragma option -b
  317. #endif
  318.  
  319. #ifdef __cplusplus
  320. }
  321. #endif
  322.  
  323. #pragma option -b.
  324. #endif // _WINTRUST_
  325.