SoftPub.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:12k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //
  5. //  Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. //  File:       softpub.h
  8. //
  9. //  Contents:   Microsoft Internet Security Authenticode Policy Provider
  10. //
  11. //--------------------------------------------------------------------------
  12. #ifndef SOFTPUB_H
  13. #define SOFTPUB_H
  14. #include <wintrust.h>
  15. #ifdef __cplusplus
  16. extern "C"
  17. {
  18. #endif
  19. #include <pshpack8.h>
  20. //////////////////////////////////////////////////////////////////////////////
  21. //
  22. // Softpub Policy Provider defines
  23. //----------------------------------------------------------------------------
  24. //  The following are definitions of the Microsoft Authenticode Policy Provider
  25. //  (WINTRUST.DLL's Policy Provider)
  26. //
  27. #define SP_POLICY_PROVIDER_DLL_NAME         L"WINTRUST.DLL"
  28. //////////////////////////////////////////////////////////////////////////////
  29. //
  30. // WINTRUST_ACTION_GENERIC_VERIFY_V2 Guid  (Authenticode)
  31. //----------------------------------------------------------------------------
  32. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify the
  33. //  authenticity of a file/object using the Microsoft Authenticode
  34. //  Policy Provider,
  35. //
  36. //          {00AAC56B-CD44-11d0-8CC2-00C04FC295EE}
  37. //
  38. #define WINTRUST_ACTION_GENERIC_VERIFY_V2                       
  39.             { 0xaac56b,                                         
  40.               0xcd44,                                           
  41.               0x11d0,                                           
  42.               { 0x8c, 0xc2, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee } 
  43.             }
  44. #define SP_INIT_FUNCTION                    L"SoftpubInitialize"
  45. #define SP_OBJTRUST_FUNCTION                L"SoftpubLoadMessage"
  46. #define SP_SIGTRUST_FUNCTION                L"SoftpubLoadSignature"
  47. #define SP_CHKCERT_FUNCTION                 L"SoftpubCheckCert"
  48. #define SP_FINALPOLICY_FUNCTION             L"SoftpubAuthenticode"
  49. #define SP_CLEANUPPOLICY_FUNCTION           L"SoftpubCleanup"
  50. //////////////////////////////////////////////////////////////////////////////
  51. //
  52. // WINTRUST_ACTION_TRUSTPROVIDER_TEST (Authenticode TEST)
  53. //----------------------------------------------------------------------------
  54. //  Assigned to the pgActionID parameter of WinVerifyTrust to dump
  55. //  the CRYPT_PROVIDER_DATA structure to a file after calling the
  56. //  Authenticode Policy Provider.
  57. //
  58. //          {573E31F8-DDBA-11d0-8CCB-00C04FC295EE}
  59. //
  60. #define WINTRUST_ACTION_TRUSTPROVIDER_TEST                      
  61.             { 0x573e31f8,                                       
  62.               0xddba,                                           
  63.               0x11d0,                                           
  64.               { 0x8c, 0xcb, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee } 
  65.             }
  66. #define SP_TESTDUMPPOLICY_FUNCTION_TEST     L"SoftpubDumpStructure"
  67. //////////////////////////////////////////////////////////////////////////////
  68. //
  69. // WINTRUST_ACTION_GENERIC_CERT_VERIFY
  70. //----------------------------------------------------------------------------
  71. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify
  72. //  a certificate chain only.  This is only valid when passing in a
  73. //  certificate context in the WinVerifyTrust input structures.
  74. //
  75. //          {189A3842-3041-11d1-85E1-00C04FC295EE}
  76. //
  77. #define WINTRUST_ACTION_GENERIC_CERT_VERIFY                     
  78.             { 0x189a3842,                                       
  79.               0x3041,                                           
  80.               0x11d1,                                           
  81.               { 0x85, 0xe1, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee } 
  82.             }
  83. #define SP_GENERIC_CERT_INIT_FUNCTION       L"SoftpubDefCertInit"
  84. //////////////////////////////////////////////////////////////////////////////
  85. //
  86. // WINTRUST_ACTION_GENERIC_CHAIN_VERIFY
  87. //----------------------------------------------------------------------------
  88. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify
  89. //  certificate chains created from any object type: file, cert, signer, ...
  90. //  A callback is provided to implement the final chain policy using
  91. //  the chain context for each signer and counter signer.
  92. //
  93. //          {fc451c16-ac75-11d1-b4b8-00c04fb66ea0}
  94. //
  95. #define WINTRUST_ACTION_GENERIC_CHAIN_VERIFY                    
  96.             { 0xfc451c16,                                       
  97.               0xac75,                                           
  98.               0x11d1,                                           
  99.               { 0xb4, 0xb8, 0x00, 0xc0, 0x4f, 0xb6, 0x6e, 0xa0 }
  100.             }
  101. #define GENERIC_CHAIN_FINALPOLICY_FUNCTION      L"GenericChainFinalProv"
  102. #define GENERIC_CHAIN_CERTTRUST_FUNCTION        L"GenericChainCertificateTrust"
  103. typedef struct _WTD_GENERIC_CHAIN_POLICY_SIGNER_INFO
  104.     WTD_GENERIC_CHAIN_POLICY_SIGNER_INFO,
  105.         *PWTD_GENERIC_CHAIN_POLICY_SIGNER_INFO;
  106. struct _WTD_GENERIC_CHAIN_POLICY_SIGNER_INFO {
  107.     union {
  108.         DWORD                                   cbStruct;
  109.         DWORD                                   cbSize;
  110.     };
  111.     PCCERT_CHAIN_CONTEXT                    pChainContext;
  112.     // SGNR_TYPE_TIMESTAMP defined in wintrust.h
  113.     DWORD                                   dwSignerType;
  114.     PCMSG_SIGNER_INFO                       pMsgSignerInfo;
  115.     DWORD                                   dwError;
  116.     DWORD                                   cCounterSigner;
  117.     PWTD_GENERIC_CHAIN_POLICY_SIGNER_INFO   *rgpCounterSigner;
  118. };
  119. typedef HRESULT (WINAPI *PFN_WTD_GENERIC_CHAIN_POLICY_CALLBACK)(
  120.     IN PCRYPT_PROVIDER_DATA pProvData,
  121.     IN DWORD dwStepError,
  122.     IN DWORD dwRegPolicySettings,
  123.     IN DWORD cSigner,
  124.     IN PWTD_GENERIC_CHAIN_POLICY_SIGNER_INFO *rgpSigner,
  125.     IN void *pvPolicyArg
  126.     );
  127. // The fields in the following data structure are passed to
  128. // CertGetCertificateChain().
  129. typedef struct _WTD_GENERIC_CHAIN_POLICY_CREATE_INFO {
  130.     union {
  131.         DWORD                                   cbStruct;
  132.         DWORD                                   cbSize;
  133.     };
  134.     HCERTCHAINENGINE                        hChainEngine;
  135.     PCERT_CHAIN_PARA                        pChainPara;
  136.     DWORD                                   dwFlags;
  137.     void                                    *pvReserved;
  138. } WTD_GENERIC_CHAIN_POLICY_CREATE_INFO, *PWTD_GENERIC_CHAIN_POLICY_CREATE_INFO;
  139. typedef struct _WTD_GENERIC_CHAIN_POLICY_DATA {
  140.     union {
  141.         DWORD                                   cbStruct;
  142.         DWORD                                   cbSize;
  143.     };
  144.     PWTD_GENERIC_CHAIN_POLICY_CREATE_INFO   pSignerChainInfo;
  145.     PWTD_GENERIC_CHAIN_POLICY_CREATE_INFO   pCounterSignerChainInfo;
  146.     PFN_WTD_GENERIC_CHAIN_POLICY_CALLBACK   pfnPolicyCallback;
  147.     void                                    *pvPolicyArg;
  148. } WTD_GENERIC_CHAIN_POLICY_DATA, *PWTD_GENERIC_CHAIN_POLICY_DATA;
  149. //////////////////////////////////////////////////////////////////////////////
  150. //
  151. // HTTPSPROV_ACTION Guid  (Authenticode add-on)
  152. //----------------------------------------------------------------------------
  153. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify the
  154. //  SSL/PCT connections through IE.
  155. //
  156. //          {573E31F8-AABA-11d0-8CCB-00C04FC295EE}
  157. //
  158. #define HTTPSPROV_ACTION                                        
  159.             { 0x573e31f8,                                       
  160.               0xaaba,                                           
  161.               0x11d0,                                           
  162.               { 0x8c, 0xcb, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee } 
  163.             }
  164. #define HTTPS_FINALPOLICY_FUNCTION          L"HTTPSFinalProv"
  165. #define HTTPS_CHKCERT_FUNCTION              L"HTTPSCheckCertProv"
  166. #define HTTPS_CERTTRUST_FUNCTION            L"HTTPSCertificateTrust"
  167. //////////////////////////////////////////////////////////////////////////////
  168. //
  169. // OFFICESIGN_ACTION_VERIFY Guid  (Authenticode add-on)
  170. //----------------------------------------------------------------------------
  171. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify the
  172. //  authenticity of a Structured Storage file using the Microsoft Office
  173. //  Authenticode add-on Policy Provider,
  174. //
  175. //          {5555C2CD-17FB-11d1-85C4-00C04FC295EE}
  176. //
  177. #define     OFFICESIGN_ACTION_VERIFY                                    
  178.                 { 0x5555c2cd,                                           
  179.                   0x17fb,                                               
  180.                   0x11d1,                                               
  181.                   { 0x85, 0xc4, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee }     
  182.                 }
  183. #define     OFFICE_POLICY_PROVIDER_DLL_NAME             SP_POLICY_PROVIDER_DLL_NAME
  184. #define     OFFICE_INITPROV_FUNCTION                    L"OfficeInitializePolicy"
  185. #define     OFFICE_CLEANUPPOLICY_FUNCTION               L"OfficeCleanupPolicy"
  186. //////////////////////////////////////////////////////////////////////////////
  187. //
  188. // DRIVER_ACTION_VERIFY Guid  (Authenticode add-on)
  189. //----------------------------------------------------------------------------
  190. //  Assigned to the pgActionID parameter of WinVerifyTrust to verify the
  191. //  authenticity of a WHQL signed driver.  This is an Authenticode add-on
  192. //  Policy Provider,
  193. //
  194. //          {F750E6C3-38EE-11d1-85E5-00C04FC295EE}
  195. //
  196. #define     DRIVER_ACTION_VERIFY                                        
  197.                 { 0xf750e6c3,                                           
  198.                   0x38ee,                                               
  199.                   0x11d1,                                               
  200.                   { 0x85, 0xe5, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee }     
  201.                 }
  202. #define     DRIVER_INITPROV_FUNCTION                    L"DriverInitializePolicy"
  203. #define     DRIVER_FINALPOLPROV_FUNCTION                L"DriverFinalPolicy"
  204. #define     DRIVER_CLEANUPPOLICY_FUNCTION               L"DriverCleanupPolicy"
  205. typedef struct DRIVER_VER_MAJORMINOR_
  206. {
  207.     DWORD           dwMajor;
  208.     DWORD           dwMinor;
  209.     
  210. } DRIVER_VER_MAJORMINOR;
  211. typedef struct DRIVER_VER_INFO_
  212. {
  213.     DWORD                               cbStruct;               // IN - set to sizeof(DRIVER_VER_INFO)
  214.     ULONG_PTR                           dwReserved1;            // IN - set to NULL
  215.     ULONG_PTR                           dwReserved2;            // IN - set to NULL
  216.     DWORD                               dwPlatform;             // IN - OPTIONAL: platform to use
  217.     DWORD                               dwVersion;              // IN - OPTIONAL: major version to use (NOT USED!!!)
  218.     WCHAR                               wszVersion[MAX_PATH];   // OUT: version string from catalog file
  219.     WCHAR                               wszSignedBy[MAX_PATH];  // OUT: signer display name from certificate
  220.     PCCERT_CONTEXT                      pcSignerCertContext;    // OUT: client MUST free this!!!
  221.     DRIVER_VER_MAJORMINOR               sOSVersionLow;          // IN - OPTIONAL: lowest compatible version
  222.     DRIVER_VER_MAJORMINOR               sOSVersionHigh;         // IN - OPTIONAL: highest compatible version
  223.     DWORD                               dwBuildNumberLow;       // IN - OPTIONAL: added to sOSVersionLow as 
  224.                                                                 //      third node for finer version granularity
  225.     DWORD                               dwBuildNumberHigh;      // IN - OPTIONAL: added to sOSVersionHigh as 
  226.                                                                 //      third node for finer version granularity
  227.     //
  228.     // NOTES:
  229.     // 1. dwPlatform _must_ be set to a non-zero value in order for proper version checking to be done.
  230.     // 2. dwVersion is no longer used, sOSVersionLow and sOsVersionhigh have taken its place
  231.     // 3. If dwBuildNumberLow and dwBuildNumberHigh are 0, they are unused.  Otherwise, they are considered 
  232.     //    to be extensions of sOSVersionLow and sOSVersionHigh respectively.  Make special note of this when
  233.     //    reading note 4.
  234.     // 4. If you are validating against a single OS version, then set both sOSVersionLow and sOSVersion high,
  235.     //    to the version you are validating against.  If sOSVersionLow and sOSVersionHigh are different, then
  236.     //    the validation is done for the whole version range, from sOSVersionLow to sOSVersionHigh.
  237.     //
  238. } DRIVER_VER_INFO, *PDRIVER_VER_INFO;
  239. #include <poppack.h>
  240. #ifdef __cplusplus
  241. }
  242. #endif
  243. #endif // SOFTPUB_H