From de311c6bf15f7a978bc05a214488a55ea7a83a51 Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 7 Jun 2019 19:04:21 -0600 Subject: [PATCH] Added WinTrust.dll assembly and project. --- PInvoke/Cryptography/Crypt32/Wincrypt.cs | 42 +- PInvoke/Shared/Lib.cs | 3 + PInvoke/WinTrust/Vanara.PInvoke.WinTrust.csproj | 51 + PInvoke/WinTrust/WinTrust.cs | 2184 +++++++++++++++++++++++ Vanara.sln | 9 +- 5 files changed, 2273 insertions(+), 16 deletions(-) create mode 100644 PInvoke/WinTrust/Vanara.PInvoke.WinTrust.csproj create mode 100644 PInvoke/WinTrust/WinTrust.cs diff --git a/PInvoke/Cryptography/Crypt32/Wincrypt.cs b/PInvoke/Cryptography/Crypt32/Wincrypt.cs index 8956c170..19755e9b 100644 --- a/PInvoke/Cryptography/Crypt32/Wincrypt.cs +++ b/PInvoke/Cryptography/Crypt32/Wincrypt.cs @@ -200,27 +200,20 @@ namespace Vanara.PInvoke CALG_TLS1PRF = 0x0000800a, } - /// - /// A certificate encoding type. - /// + /// A certificate encoding type. [PInvokeData("wincrypt.h")] public enum CertEncodingType : uint { - /// - /// The crypt asn encoding - /// + /// The crypt asn encoding CRYPT_ASN_ENCODING = 0x00000001, - /// - /// The crypt NDR encoding - /// + + /// The crypt NDR encoding CRYPT_NDR_ENCODING = 0x00000002, - /// - /// The X509 asn encoding - /// + + /// The X509 asn encoding X509_ASN_ENCODING = 0x00000001, - /// - /// The X509 NDR encoding - /// + + /// The X509 NDR encoding X509_NDR_ENCODING = 0x00000002, } @@ -618,6 +611,25 @@ namespace Vanara.PInvoke public CRYPTOAPI_BLOB Parameters; } + /// + /// The CRYPT_ATTRIBUTE_TYPE_VALUE structure contains a single attribute value. The Value member's CRYPT_OBJID_BLOB is encoded. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wincrypt/ns-wincrypt-_crypt_attribute_type_value typedef struct + // _CRYPT_ATTRIBUTE_TYPE_VALUE { LPSTR pszObjId; CRYPT_OBJID_BLOB Value; } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE; + [PInvokeData("wincrypt.h", MSDNShortId = "84057581-d0a9-464a-9399-ba806e37516f")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_ATTRIBUTE_TYPE_VALUE + { + /// Object identifier (OID) that specifies the attribute type data contained in the Value BLOB. + public StrPtrAuto pszObjId; + + /// + /// A CRYPT_OBJID_BLOB that contains the encoded attribute. The cbData member of the CRYPT_OBJID_BLOB structure + /// indicates the length of the pbData member. The pbData member contains the attribute information. + /// + public CRYPTOAPI_BLOB Value; + } + /// /// The BLOB structure contains an arbitrary array of bytes. The structure definition includes aliases appropriate to the various /// functions that use it. diff --git a/PInvoke/Shared/Lib.cs b/PInvoke/Shared/Lib.cs index 83982412..46e10633 100644 --- a/PInvoke/Shared/Lib.cs +++ b/PInvoke/Shared/Lib.cs @@ -111,6 +111,9 @@ /// The win inet public const string WinInet = "wininet.dll"; + /// The wintrust.dll + public const string Wintrust = "wintrust.dll"; + /// The Winsock2 dll public const string Ws2_32 = "ws2_32.dll"; } diff --git a/PInvoke/WinTrust/Vanara.PInvoke.WinTrust.csproj b/PInvoke/WinTrust/Vanara.PInvoke.WinTrust.csproj new file mode 100644 index 00000000..6ede8643 --- /dev/null +++ b/PInvoke/WinTrust/Vanara.PInvoke.WinTrust.csproj @@ -0,0 +1,51 @@ + + + + PInvoke API (methods, structures and constants imported from Windows WinTrust.dll. + Copyright © 2017-2019 + $(AssemblyName) + 2.3.10 + net20;net35;net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1 + Vanara.PInvoke.WinTrust + $(AssemblyName) + Vanara.PInvoke + David Hall + https://github.com/dahall/vanara + MIT + https://raw.githubusercontent.com/dahall/Vanara/master/docs/icons/Vanara48x48.png + https://github.com/dahall/vanara + Git + pinvoke;vanara;net-extensions;interop + en-US + true + true + GitHub Community + Vanara + True + + latest + true + ..\..\Vanara.snk + + + true + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PInvoke/WinTrust/WinTrust.cs b/PInvoke/WinTrust/WinTrust.cs new file mode 100644 index 00000000..bb63a4aa --- /dev/null +++ b/PInvoke/WinTrust/WinTrust.cs @@ -0,0 +1,2184 @@ +using System; +using System.Runtime.InteropServices; +using Vanara.InteropServices; +using static Vanara.PInvoke.Crypt32; +using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; + +namespace Vanara.PInvoke +{ + public static partial class WinTrust + { + /// Action to perform. + [PInvokeData("wintrust.h", MSDNShortId = "B2ED5489-792F-4B00-A21E-EE1B1462D1C8")] + public enum DWACTION + { + /// Allocate memory and fill the CRYPT_PROVIDER_DEFUSAGE structure pointed to by the psUsage parameter. + DWACTION_ALLOCANDFILL = 1, + + /// + /// Free all memory allocated during a previous call to this function by specifying DWACTION_ALLOCANDFILL for this parameter. + /// + DWACTION_FREE = 2 + } + + /// Specifies the type of certificate. + [PInvokeData("wintrust.h", MSDNShortId = "AC666871-265B-4D09-B7A6-DEC48D4645FD")] + public enum WIN_CERT_TYPE : ushort + { + /// The bCertificate member contains an X.509 certificate. + WIN_CERT_TYPE_X509 = 0x0001, + + /// The bCertificate member contains a PKCS SignedData structure. + WIN_CERT_TYPE_PKCS_SIGNED_DATA = 0x0002, + + /// Reserved. + WIN_CERT_TYPE_RESERVED_1 = 0x0003, + + /// The bCertificate member contains PKCS1_MODULE_SIGN fields. + WIN_CERT_TYPE_TS_STACK_SIGNED = 0x0004, + } + + /// A set of flags that modify the behavior of this function. + [PInvokeData("wintrust.h", MSDNShortId = "5e4dbccd-4cd0-4525-85dc-3327a5b713a1")] + [Flags] + public enum WT_TRUSTDBDIALOG + { + WT_TRUSTDBDIALOG_NO_UI_FLAG = 0x00000001, + + /// + /// Only display the Trusted Publisher tab. By default, all of the user interface tabs are displayed and the Trusted Publisher + /// tab is initially selected. + /// + WT_TRUSTDBDIALOG_ONLY_PUB_TAB_FLAG = 0x00000002, + + WT_TRUSTDBDIALOG_WRITE_LEGACY_REG_FLAG = 0x00000100, + WT_TRUSTDBDIALOG_WRITE_IEAK_STORE_FLAG = 0x00000200, + } + + /// Specifies the union member to be used and, thus, the type of object for which trust will be verified. + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_CHOICE + { + /// Use the file pointed to by pFile. + WTD_CHOICE_FILE = 1, + + /// Use the catalog pointed to by pCatalog. + WTD_CHOICE_CATALOG = 2, + + /// Use the BLOB pointed to by pBlob. + WTD_CHOICE_BLOB = 3, + + /// Use the WINTRUST_SGNR_INFO structure pointed to by pSgnr. + WTD_CHOICE_SIGNER = 4, + + /// Use the certificate pointed to by pCert. + WTD_CHOICE_CERT = 5, + } + + /// + /// Certificate revocation check options. This member can be set to add revocation checking to that done by the selected policy provider. + /// + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_REVOKE + { + /// + /// No additional revocation checking will be done when the WTD_REVOKE_NONE flag is used in conjunction with the HTTPSPROV_ACTION + /// value set in the pgActionID parameter of the WinVerifyTrust function. To ensure the WinVerifyTrust function does not attempt + /// any network retrieval when verifying code signatures, WTD_CACHE_ONLY_URL_RETRIEVAL must be set in the dwProvFlags parameter. + /// + WTD_REVOKE_NONE = 0x00000000, + + /// Revocation checking will be done on the whole chain. + WTD_REVOKE_WHOLECHAIN = 0x00000001, + } + + /// Specifies the action to be taken. + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_STATEACTION + { + /// Ignore the hWVTStateData member. + WTD_STATEACTION_IGNORE = 0x00000000, + + /// + /// Verify the trust of the object (typically a file) that is specified by the dwUnionChoice member. The hWVTStateData member + /// will receive a handle to the state data. This handle must be freed by specifying the WTD_STATEACTION_CLOSE action in a + /// subsequent call. + /// + WTD_STATEACTION_VERIFY = 0x00000001, + + /// + /// Free the hWVTStateData member previously allocated with the WTD_STATEACTION_VERIFY action. This action must be specified for + /// every use of the WTD_STATEACTION_VERIFY action. + /// + WTD_STATEACTION_CLOSE = 0x00000002, + + /// + /// Write the catalog data to a WINTRUST_DATA structure and then cache that structure. This action only applies when the + /// dwUnionChoice member contains WTD_CHOICE_CATALOG. + /// + WTD_STATEACTION_AUTO_CACHE = 0x00000003, + + /// Flush any cached catalog data. This action only applies when the dwUnionChoice member contains WTD_CHOICE_CATALOG. + WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004, + } + + /// DWORD value that specifies trust provider settings. + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_TRUST + { + /// The trust is verified in the same manner as implemented by Internet Explorer 4.0. + WTD_USE_IE4_TRUST_FLAG = 0x00000001, + + /// The Internet Explorer 4.0 chain functionality is not used. + WTD_NO_IE4_CHAIN_FLAG = 0x00000002, + + /// + /// The default verification of the policy provider, such as code signing for Authenticode, is not performed, and the certificate + /// is assumed valid for all usages. + /// + WTD_NO_POLICY_USAGE_FLAG = 0x00000004, + + /// Revocation checking is not performed. + WTD_REVOCATION_CHECK_NONE = 0x00000010, + + /// Revocation checking is performed on the end certificate only. + WTD_REVOCATION_CHECK_END_CERT = 0x00000020, + + /// Revocation checking is performed on the entire certificate chain. + WTD_REVOCATION_CHECK_CHAIN = 0x00000040, + + /// Revocation checking is performed on the entire certificate chain, excluding the root certificate. + WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x00000080, + + /// Not supported. + WTD_SAFER_FLAG = 0x00000100, + + /// Only the hash is verified. + WTD_HASH_ONLY_FLAG = 0x00000200, + + /// + /// The default operating system version checking is performed. This flag is only used for verifying catalog-signed files. + /// + WTD_USE_DEFAULT_OSVER_CHECK = 0x00000400, + + /// + /// If this flag is not set, all time stamped signatures are considered valid forever. Setting this flag limits the valid + /// lifetime of the signature to the lifetime of the signing certificate. This allows time stamped signatures to expire. + /// + WTD_LIFETIME_SIGNING_FLAG = 0x00000800, + + /// + /// Use only the local cache for revocation checks. Prevents revocation checks over the network. + /// Windows XP: This value is not supported. + /// + WTD_CACHE_ONLY_URL_RETRIEVAL = 0x00001000, + + /// + /// Disable the use of MD2 and MD4 hashing algorithms. If a file is signed by using MD2 or MD4 and if this flag is set, an + /// NTE_BAD_ALGID error is returned. Note This flag is supported on Windows 7 with SP1 and later operating systems. + /// + WTD_DISABLE_MD2_MD4 = 0x00002000, + + /// + /// If this flag is specified it is assumed that the file being verified has been downloaded from the web and has the Mark of the + /// Web attribute. Policies that are meant to apply to Mark of the Web files will be enforced. Note This flag is supported + /// on Windows 8.1 and later operating systems or on systems that have installed KB2862966. + /// + WTD_MOTW = 0x00004000, + + /// Undocumented. + WTD_CODE_INTEGRITY_DRIVER_MODE = 0x00008000, + } + + /// Specifies the kind of user interface (UI) to be used. + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_UI + { + /// Display all UI. + WTD_UI_ALL = 1, + + /// Display no UI. + WTD_UI_NONE = 2, + + /// Do not display any negative UI. + WTD_UI_NOBAD = 3, + + /// Do not display any positive UI. + WTD_UI_NOGOOD = 4, + } + + /// + /// A DWORD value that specifies the user interface context for the WinVerifyTrust function. This causes the text in the Authenticode + /// dialog box to match the action taken on the file. + /// + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + public enum WTD_UICONTEXT + { + /// Use when calling WinVerifyTrust for a file that is to be run. This is the default value. + WTD_UICONTEXT_EXECUTE = 0, + + /// Use when calling WinVerifyTrust for a file that is to be installed. + WTD_UICONTEXT_INSTALL = 1, + } + + /// Flags for . + [Flags] + public enum WTPF + { + /// Trust any test certificate. + WTPF_TRUSTTEST = 0x00000020, + + /// Check any test certificate for validity. + WTPF_TESTCANBEVALID = 0x00000080, + + /// Use expiration date. + WTPF_IGNOREEXPIRATION = 0x00000100, + + /// Do revocation check. + WTPF_IGNOREREVOKATION = 0x00000200, + + /// If the source is offline, trust any individual certificates. + WTPF_OFFLINEOK_IND = 0x00000400, + + /// If the source is offline, trust any commercial certificates. + WTPF_OFFLINEOK_COM = 0x00000800, + + /// If the source is offline, trust any individual certificates. Do not use the user interface (UI). + WTPF_OFFLINEOKNBU_IND = 0x00001000, + + /// If the source is offline, trust any commercial certificates. Do not use the checking UI. + WTPF_OFFLINEOKNBU_COM = 0x00002000, + + /// Turn off verification of version 1.0 certificates. + WTPF_VERIFY_V1_OFF = 0x00010000, + + /// Ignore time stamp revocation checks. + WTPF_IGNOREREVOCATIONONTS = 0x00020000, + + /// Allow only items in personal trust database. + WTPF_ALLOWONLYPERTRUST = 0x00040000, + } + + /// + /// The OpenPersonalTrustDBDialog function displays the Certificates dialog box. + /// + /// Note This function has no associated header file or import library. You must define the function yourself and use the + /// LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// The handle of the parent window for the dialog box. If this parameter is NULL, the dialog box has no parent. + /// + /// Returns nonzero if the dialog box was opened successfully or zero otherwise. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-openpersonaltrustdbdialog BOOL + // OpenPersonalTrustDBDialog( HWND hwndParent ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "25f1d012-0c82-4992-b924-b539d4c6dc5f")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OpenPersonalTrustDBDialog(HWND hwndParent); + + /// + /// The OpenPersonalTrustDBDialogEx function displays the Certificates dialog box. + /// + /// Note This function has no associated header file or import library. You must define the function yourself and use the + /// LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// The handle of the parent window for the dialog box. If this parameter is NULL, the dialog box has no parent. + /// + /// + /// A set of flags that modify the behavior of this function. This can be zero or the following value. + /// + /// + /// Value + /// Meaning + /// + /// + /// WT_TRUSTDBDIALOG_ONLY_PUB_TAB_FLAG 2 (0x2) + /// + /// Only display the Trusted Publisher tab. By default, all of the user interface tabs are displayed and the Trusted Publisher tab is + /// initially selected. + /// + /// + /// + /// + /// Not used. Must be NULL. + /// Returns nonzero if the dialog box was opened successfully or zero otherwise. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-openpersonaltrustdbdialogex BOOL + // OpenPersonalTrustDBDialogEx( HWND hwndParent, DWORD dwFlags, PVOID *pvReserved ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "5e4dbccd-4cd0-4525-85dc-3327a5b713a1")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool OpenPersonalTrustDBDialogEx(HWND hwndParent, WT_TRUSTDBDIALOG dwFlags, IntPtr pvReserved = default); + + /// + /// + /// [The WintrustAddActionID function is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain and + /// CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WintrustAddActionID function adds a trust provider action to the user's system. This method should be called during + /// the DllRegisterServer implementation of the trust provider. This function has no associated import library. You must use the + /// LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// This method should be called only by a trust provider. + /// + /// + /// A pointer to a GUID structure that identifies the action to add and the trust provider that supports that action. + /// + /// The WinTrust service is designed to work with trust providers implemented by third parties. Each trust provider provides its own + /// unique set of action identifiers. For information about the action identifiers supported by a trust provider, see the + /// documentation for that trust provider. + /// + /// + /// For example, Microsoft provides a Software Publisher Trust Provider that can establish the trustworthiness of software being + /// downloaded from the Internet or some other public network. The Software Publisher Trust Provider supports the following action + /// identifiers. These constants are defined in Softpub.h. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY + /// Verify a certificate chain only. + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY_V2 + /// Verify a file or object using the Authenticode policy provider. + /// + /// + /// HTTPSPROV_ACTION + /// Verify an SSL/PCT connection through Internet Explorer. + /// + /// + /// + /// + /// a value that determines whether registry errors are reported by this function. If fdwFlags is zero and this function experiences + /// a registry error, the registry error will not be propagated to the GetLastError function. If fdwFlags is + /// WT_ADD_ACTION_ID_RET_RESULT_FLAG (0x1) and this function experiences a registry error, the registry error will be propagated to + /// the GetLastError function. + /// + /// A pointer to the CRYPT_REGISTER_ACTIONID structure that defines the information for the trust provider. + /// + /// The return value is TRUE if the function succeeds; FALSE if the function fails. If the function fails, call the + /// GetLastError function to determine the reason for failure. For information about any registry errors that this function may + /// encounter, see the description for fdwFlags. + /// + /// To remove an action that has been added by this function, call the WintrustRemoveActionID function. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustaddactionid BOOL WintrustAddActionID( GUID + // *pgActionID, DWORD fdwFlags, CRYPT_REGISTER_ACTIONID *psProvInfo ); + [DllImport(Lib.Wintrust, SetLastError = true, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "3b282342-9c86-42fa-b745-e5194d2885dc")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustAddActionID(in Guid pgActionID, uint fdwFlags, ref CRYPT_REGISTER_ACTIONID psProvInfo); + + /// + /// The WintrustAddDefaultForUsage function specifies the default usage identifier and callback information for a provider. + /// + /// Pointer to a string that contains the identifier. + /// Pointer to a CRYPT_PROVIDER_REGDEFUSAGE structure that contains callback information. + /// + /// The return value is TRUE if the function succeeds; FALSE if the function fails. If the function fails, call the + /// GetLastError function to determine the reason for failure. + /// + /// + /// + /// If the provider uses this function and requires any of the callback data, the provider must completely fill out the + /// CRYPT_PROVIDER_REGDEFUSAGE structure. + /// + /// The usage and callback information can be retrieved by calling the WintrustGetDefaultForUsage function. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustadddefaultforusage BOOL + // WintrustAddDefaultForUsage( const char *pszUsageOID, CRYPT_PROVIDER_REGDEFUSAGE *psDefUsage ); + [DllImport(Lib.Wintrust, SetLastError = true, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "511D05BD-0F8C-45B8-A1B0-D3C7AAFECCFC")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustAddDefaultForUsage([MarshalAs(UnmanagedType.LPStr)] string pszUsageOID, ref CRYPT_PROVIDER_REGDEFUSAGE psDefUsage); + + /// The WintrustGetDefaultForUsage function retrieves the default usage identifier and callback information. + /// + /// Action to perform. This can be one of the following values. For more information, see Remarks. + /// + /// + /// Value + /// Meaning + /// + /// + /// DWACTION_ALLOCANDFILL + /// Allocate memory and fill the CRYPT_PROVIDER_DEFUSAGE structure pointed to by the psUsage parameter. + /// + /// + /// DWACTION_FREE + /// Free all memory allocated during a previous call to this function by specifying DWACTION_ALLOCANDFILL for this parameter. + /// + /// + /// + /// Pointer to a string that contains the identifier. + /// Pointer to a CRYPT_PROVIDER_DEFUSAGE structure that contains callback information to be retrieved. + /// + /// The return value is TRUE if the function succeeds; FALSE if the function fails. If the function fails, call the + /// GetLastError function to determine the reason for failure. + /// + /// + /// + /// Call this function once with the dwAction parameter set to DWACTION_ALLOCANDFILL to allocate memory and fill a + /// CRYPT_PROVIDER_DEFUSAGE structure with information. Call this function again with the dwAction parameter set to + /// DWACTION_FREE to free the allocated memory. + /// + /// The default usage and callback information for a provider is registered by calling the WintrustAddDefaultForUsage function. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustgetdefaultforusage BOOL + // WintrustGetDefaultForUsage( DWORD dwAction, const char *pszUsageOID, CRYPT_PROVIDER_DEFUSAGE *psUsage ); + [DllImport(Lib.Wintrust, SetLastError = true, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "B2ED5489-792F-4B00-A21E-EE1B1462D1C8")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustGetDefaultForUsage(DWACTION dwAction, [MarshalAs(UnmanagedType.LPStr)] string pszUsageOID, ref CRYPT_PROVIDER_DEFUSAGE psUsage); + + /// + /// The WintrustGetRegPolicyFlags function retrieves policy flags for a policy provider. + /// + /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to + /// dynamically link to Wintrust.dll. + /// + /// + /// + /// This parameter can be a bitwise combination of one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// WTPF_TRUSTTEST + /// Trust any test certificate. + /// + /// + /// WTPF_TESTCANBEVALID + /// Check any test certificate for validity. + /// + /// + /// WTPF_IGNOREEXPIRATION + /// Use expiration date. + /// + /// + /// WTPF_IGNOREREVOKATION + /// Do revocation check. + /// + /// + /// WTPF_OFFLINEOK_IND + /// If the source is offline, trust any individual certificates. + /// + /// + /// WTPF_OFFLINEOK_COM + /// If the source is offline, trust any commercial certificates. + /// + /// + /// WTPF_OFFLINEOKNBU_IND + /// If the source is offline, trust any individual certificates. Do not use the user interface (UI). + /// + /// + /// WTPF_OFFLINEOKNBU_COM + /// If the source is offline, trust any commercial certificates. Do not use the checking UI. + /// + /// + /// WTPF_VERIFY_V1_OFF + /// Turn off verification of version 1.0 certificates. + /// + /// + /// WTPF_IGNOREREVOCATIONONTS + /// Ignore time stamp revocation checks. + /// + /// + /// WTPF_ALLOWONLYPERTRUST + /// Allow only items in personal trust database. + /// + /// + /// + /// This function does not return a value. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustgetregpolicyflags void + // WintrustGetRegPolicyFlags( DWORD *pdwPolicyFlags ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "f5e79ac8-9a70-4e79-ae4f-e128bd8c84de")] + public static extern void WintrustGetRegPolicyFlags(out WTPF pdwPolicyFlags); + + /// + /// + /// [The WintrustLoadFunctionPointers function is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain + /// and CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WintrustLoadFunctionPointers function loads function entry points for a specified action GUID. This function has no + /// associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// + /// A pointer to a GUID structure that identifies the action whose function pointers are being loaded and the trust provider + /// that supports that action. + /// + /// + /// The WinTrust service is designed to work with trust providers implemented by third parties. Each trust provider provides its own + /// unique set of action identifiers. For information about the action identifiers supported by a trust provider, see the + /// documentation for that trust provider. + /// + /// + /// For example, Microsoft provides a Software Publisher Trust Provider that can establish the trustworthiness of software being + /// downloaded from the Internet or some other public network. The Software Publisher Trust Provider supports the following action + /// identifiers. These constants are defined in Softpub.h. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY + /// Verify a certificate chain only. + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY_V2 + /// Verify a file or object using the Authenticode policy provider. + /// + /// + /// HTTPSPROV_ACTION + /// Verify an SSL/PCT connection through Internet Explorer. + /// + /// + /// + /// A pointer to the CRYPT_PROVIDER_FUNCTIONS structure that receives the addresses of the function pointers. + /// The return value is TRUE if the function succeeds; FALSE if the function fails. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustloadfunctionpointers BOOL + // WintrustLoadFunctionPointers( GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "c36db226-34b4-4a31-b8c6-b9d124acc669")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustLoadFunctionPointers(in Guid pgActionID, ref CRYPT_PROVIDER_FUNCTIONS pPfns); + + /// + /// + /// [The WintrustRemoveActionID function is available for use in the operating systems specified in the Requirements section. + /// It may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain and + /// CertVerifyCertificateChainPolicy functions. For Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WintrustRemoveActionID function removes an action added by the WintrustAddActionID function. This function has no + /// associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// A pointer to a GUID structure that identifies the action to remove and the trust provider that supports that action. + /// + /// The WinTrust service is designed to work with trust providers implemented by third parties. Each trust provider provides its own + /// unique set of action identifiers. For information about the action identifiers supported by a trust provider, see the + /// documentation for that trust provider. + /// + /// + /// For example, Microsoft provides a Software Publisher Trust Provider that can establish the trustworthiness of software being + /// downloaded from the Internet or some other public network. The Software Publisher Trust Provider supports the following action + /// identifiers. These constants are defined in Softpub.h. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY + /// Verify a certificate chain only. + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY_V2 + /// Verify a file or object using the Authenticode policy provider. + /// + /// + /// HTTPSPROV_ACTION + /// Verify an SSL/PCT connection through Internet Explorer. + /// + /// + /// + /// The return value is TRUE if the function succeeds; FALSE if the function fails. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustremoveactionid BOOL WintrustRemoveActionID( GUID + // *pgActionID ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "d1c84b69-4886-4cb4-99c5-294bd9d8228b")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustRemoveActionID(in Guid pgActionID); + + /// + /// + /// The WintrustSetDefaultIncludePEPageHashes function sets the default setting that determines whether page hashes are + /// included when creating subject interface package (SIP) indirect data for PE files. + /// + /// + /// This setting is only used if neither the SPC_EXC_PE_PAGE_HASHES_FLAG or the SPC_INC_PE_PAGE_HASHES_FLAG flag is + /// specified in the dwFlags parameter of the SignerSignEx function. + /// + /// + /// This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// Determines whether page hashes are included when creating SIP indirect data for PE files. If this parameter is nonzero, page + /// hashes are included. If this parameter is zero, page hashes are not included. The value is zero by default. + /// + /// This function does not return a value. + /// This setting applies to each instance of Wintrust.dll. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustsetdefaultincludepepagehashes void + // WintrustSetDefaultIncludePEPageHashes( BOOL fIncludePEPageHashes ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "af48e570-e71d-488f-831c-35834242db3c")] + public static extern void WintrustSetDefaultIncludePEPageHashes([MarshalAs(UnmanagedType.Bool)] bool fIncludePEPageHashes); + + /// + /// The WintrustSetRegPolicyFlags function sets policy flags for a policy provider. + /// + /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to + /// dynamically link to Wintrust.dll. + /// + /// + /// + /// This parameter can be a bitwise combination of one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// WTPF_TRUSTTEST + /// Trust any test certificate. + /// + /// + /// WTPF_TESTCANBEVALID + /// Check any test certificate for validity. + /// + /// + /// WTPF_IGNOREEXPIRATION + /// Do not check the expiration date. + /// + /// + /// WTPF_IGNOREREVOKATION + /// Do not check revocation. + /// + /// + /// WTPF_OFFLINEOK_IND + /// If the source is offline, trust any individual certificates. + /// + /// + /// WTPF_OFFLINEOK_COM + /// If the source is offline, trust any commercial certificates. + /// + /// + /// WTPF_OFFLINEOKNBU_IND + /// If the source is offline, trust any individual certificates. Do not use the user interface (UI). + /// + /// + /// WTPF_OFFLINEOKNBU_COM + /// If the source is offline, trust any commercial certificates. Do not use the checking UI. + /// + /// + /// WTPF_VERIFY_V1_OFF + /// Turn off verification of version 1.0 certificates. + /// + /// + /// WTPF_IGNOREREVOCATIONONTS + /// Ignore time stamp revocation checks. + /// + /// + /// WTPF_ALLOWONLYPERTRUST + /// Allow only items in personal trust database. + /// + /// + /// + /// Returns nonzero if the policy flags were set successfully or zero otherwise. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wintrustsetregpolicyflags BOOL + // WintrustSetRegPolicyFlags( DWORD dwPolicyFlags ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "8aaeecd0-3814-42a0-9e5b-82b0b220bc9a")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WintrustSetRegPolicyFlags(WTPF dwPolicyFlags); + + /// + /// + /// The WinVerifyTrust function performs a trust verification action on a specified object. The function passes the inquiry to + /// a trust provider that supports the action identifier, if one exists. + /// + /// For certificate verification, use the CertGetCertificateChain and CertVerifyCertificateChainPolicy functions. + /// + /// + /// + /// Optional handle to a caller window. A trust provider can use this value to determine whether it can interact with the user. + /// However, trust providers typically perform verification actions without input from the user. + /// + /// This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// INVALID_HANDLE_VALUE + /// There is no interactive user. The trust provider performs the verification action without the user's assistance. + /// + /// + /// Zero + /// The trust provider can use the interactive desktop to display its user interface. + /// + /// + /// A valid window handle + /// + /// A trust provider can treat any value other than INVALID_HANDLE_VALUE or zero as a valid window handle that it can use to interact + /// with the user. + /// + /// + /// + /// + /// + /// + /// A pointer to a GUID structure that identifies an action and the trust provider that supports that action. This value + /// indicates the type of verification action to be performed on the structure pointed to by pWinTrustData. + /// + /// + /// The WinTrust service is designed to work with trust providers implemented by third parties. Each trust provider provides its own + /// unique set of action identifiers. For information about the action identifiers supported by a trust provider, see the + /// documentation for that trust provider. + /// + /// + /// For example, Microsoft provides a Software Publisher Trust Provider that can establish the trustworthiness of software being + /// downloaded from the Internet or some other public network. The Software Publisher Trust Provider supports the following action + /// identifiers. These constants are defined in Softpub.h. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// DRIVER_ACTION_VERIFY + /// + /// Verify the authenticity of a Windows Hardware Quality Labs (WHQL) signed driver. This is an Authenticode add-on policy provider. + /// + /// + /// + /// HTTPSPROV_ACTION + /// Verify an SSL/TLS connection through Internet Explorer. + /// + /// + /// OFFICESIGN_ACTION_VERIFY + /// + /// This Action ID is not supported. Verify the authenticity of a structured storage file by using the Microsoft Office Authenticode + /// add-on policy provider. Windows Server 2003 and Windows XP: This Action ID is supported. + /// + /// + /// + /// WINTRUST_ACTION_GENERIC_CHAIN_VERIFY + /// + /// Verify certificate chains created from any object type. A callback is provided to implement the final chain policy by using the + /// chain context for each signer and counter signer. + /// + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY_V2 + /// Verify a file or object using the Authenticode policy provider. + /// + /// + /// WINTRUST_ACTION_TRUSTPROVIDER_TEST + /// Write the CRYPT_PROVIDER_DATA structure to a file after calling the Authenticode policy provider. + /// + /// + /// + /// + /// + /// A pointer that, when cast as a WINTRUST_DATA structure, contains information that the trust provider needs to process the + /// specified action identifier. Typically, the structure includes information that identifies the object that the trust provider + /// must evaluate. + /// + /// + /// The format of the structure depends on the action identifier. For information about the data required for a specific action + /// identifier, see the documentation for the trust provider that supports that action. + /// + /// + /// + /// + /// If the trust provider verifies that the subject is trusted for the specified action, the return value is zero. No other value + /// besides zero should be considered a successful return. + /// + /// + /// If the trust provider does not verify that the subject is trusted for the specified action, the function returns a status code + /// from the trust provider. + /// + /// + /// For example, a trust provider might indicate that the subject is not trusted, or is trusted but with limitations or warnings. The + /// return value can be a trust-provider-specific value described in the documentation for an individual trust provider, or it can be + /// one of the following error codes. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// TRUST_E_SUBJECT_NOT_TRUSTED + /// + /// The subject failed the specified verification action. Most trust providers return a more detailed error code that describes the + /// reason for the failure. + /// + /// + /// + /// TRUST_E_PROVIDER_UNKNOWN + /// The trust provider is not recognized on this system. + /// + /// + /// TRUST_E_ACTION_UNKNOWN + /// The trust provider does not support the specified action. + /// + /// + /// TRUST_E_SUBJECT_FORM_UNKNOWN + /// The trust provider does not support the form specified for the subject. + /// + /// + /// + /// + /// + /// The WinVerifyTrust function enables applications to invoke a trust provider to verify that a specified object satisfies + /// the criteria of a specified verification operation. The pgActionID parameter identifies the verification operation, and the + /// pWinTrustData parameter identifies the object whose trust is to be verified. A trust provider is a DLL registered with the + /// operating system. A call to WinVerifyTrust forwards that call to the registered trust provider, if there is one, that + /// supports that specified action identifier. + /// + /// + /// For example, the Software Publisher Trust Provider can verify that an executable image file comes from a trusted software + /// publisher and that the file has not been modified since it was published. In this case, the pWinTrustData parameter specifies the + /// name of the file and the type of file, such as a Microsoft Portable Executable image file. + /// + /// + /// Each trust provider supports a specific set of actions that it can evaluate. Each action has a GUID that identifies it. A trust + /// provider can support any number of action identifiers, but two trust providers cannot support the same action identifier. + /// + /// + /// For an example that demonstrates how to use this function to verify the signature of a portable executable (PE) file, see Example + /// C Program: Verifying the Signature of a PE File. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-winverifytrust LONG WinVerifyTrust( HWND hwnd, GUID + // *pgActionID, LPVOID pWVTData ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "b7efac6a-ac9f-477a-aada-63fe32208e6f")] + public static extern Win32Error WinVerifyTrust(HWND hwnd, in Guid pgActionID, IntPtr pWVTData); + + /// + /// + /// The WinVerifyTrustEx function performs a trust verification action on a specified object and takes a pointer to a + /// WINTRUST_DATA structure. The function passes the inquiry to a trust provider, if one exists, that supports the action identifier. + /// This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// For certificate verification, use the CertGetCertificateChain and CertVerifyCertificateChainPolicy functions. + /// + /// + /// + /// Optional handle to a caller window. A trust provider can use this value to determine whether it can interact with the user. + /// However, trust providers typically perform verification actions without input from the user. + /// + /// This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// INVALID_HANDLE_VALUE + /// There is no interactive user. The trust provider performs the verification action without the user's assistance. + /// + /// + /// Zero + /// The trust provider can use the interactive desktop to display its user interface. + /// + /// + /// A valid window handle + /// + /// A trust provider can treat any value other than INVALID_HANDLE_VALUE or zero as a valid window handle that it can use to interact + /// with the user. + /// + /// + /// + /// + /// + /// + /// A pointer to a GUID structure that identifies an action and the trust provider that supports that action. This value + /// indicates the type of verification action to be performed on the structure pointed to by pWinTrustData. + /// + /// + /// The WinTrust service is designed to work with trust providers implemented by third parties. Each trust provider provides its own + /// unique set of action identifiers. For information about the action identifiers supported by a trust provider, see the + /// documentation for that trust provider. + /// + /// + /// For example, Microsoft provides a Software Publisher Trust Provider that can establish the trustworthiness of software being + /// downloaded from the Internet or some other public network. The Software Publisher Trust Provider supports the following action + /// identifiers. These constants are defined in Softpub.h. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// DRIVER_ACTION_VERIFY + /// + /// Verify the authenticity of a Windows Hardware Quality Labs (WHQL) signed driver. This is an Authenticode add-on policy provider. + /// + /// + /// + /// HTTPSPROV_ACTION + /// Verify an SSL/TLS connection through Internet Explorer. + /// + /// + /// OFFICESIGN_ACTION_VERIFY + /// + /// This Action ID is not supported. Verify the authenticity of a structured storage file by using the Microsoft Office Authenticode + /// add-on policy provider. Windows Server 2003 and Windows XP: This Action ID is supported. + /// + /// + /// + /// WINTRUST_ACTION_GENERIC_CERT_VERIFY + /// + /// Verify a certificate chain only. This is only valid when passing in a certificate context in the WinVerifyTrust input structures. + /// + /// + /// + /// WINTRUST_ACTION_GENERIC_CHAIN_VERIFY + /// + /// Verify certificate chains created from any object type. A callback is provided to implement the final chain policy by using the + /// chain context for each signer and counter signer. + /// + /// + /// + /// WINTRUST_ACTION_GENERIC_VERIFY_V2 + /// Verify a file or object using the Authenticode policy provider. + /// + /// + /// WINTRUST_ACTION_TRUSTPROVIDER_TEST + /// Write the CRYPT_PROVIDER_DATA structure to a file after calling the Authenticode policy provider. + /// + /// + /// + /// + /// + /// A pointer to a WINTRUST_DATA structure that contains information that the trust provider needs to process the specified action + /// identifier. Typically, the structure includes information that identifies the object that the trust provider must evaluate. + /// + /// + /// The format of the structure depends on the action identifier. For information about the data required for a specific action + /// identifier, see the documentation for the trust provider that supports that action. + /// + /// + /// + /// + /// If the trust provider verifies that the subject is trusted for the specified action, the return value is ERROR_SUCCESS. + /// Otherwise, the function returns a status code from the trust provider. + /// + /// + /// For example, a trust provider might indicate that the subject is not trusted, or is trusted but with limitations or warnings. The + /// return value can be a trust provider–specific value described in the documentation for an individual trust provider, or it can be + /// one of the following error codes. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// TRUST_E_SUBJECT_NOT_TRUSTED + /// + /// The subject failed the specified verification action. Most trust providers return a more detailed error code that describes the + /// reason for the failure. + /// + /// + /// + /// TRUST_E_PROVIDER_UNKNOWN + /// The trust provider is not recognized on this system. + /// + /// + /// TRUST_E_ACTION_UNKNOWN + /// The trust provider does not support the specified action. + /// + /// + /// TRUST_E_SUBJECT_FORM_UNKNOWN + /// The trust provider does not support the form specified for the subject. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-winverifytrustex HRESULT WinVerifyTrustEx( HWND hwnd, + // GUID *pgActionID, WINTRUST_DATA *pWinTrustData ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "209c9953-a4a5-4ff0-961f-92e97ccce23d")] + public static extern HRESULT WinVerifyTrustEx(HWND hwnd, in Guid pgActionID, in WINTRUST_DATA pWinTrustData); + + /// + /// + /// [The WTHelperCertCheckValidSignature function is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain + /// and CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WTHelperCertCheckValidSignature function checks whether a signature is valid. It can be used by trust providers to get + /// an initial assessment of the validity of a signature before calling the function pointed to by the pfnFinalPolicy member + /// of a CRYPT_PROVIDER_FUNCTIONS structure. + /// + /// + /// A pointer to the CRYPT_PROVIDER_DATA structure that contains the signer and countersigner information. + /// + /// If the function succeeds, the function returns S_OK. + /// + /// If the function fails, it returns an HRESULT value that indicates the error. For a list of possible error values, see WinVerifyTrust. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wthelpercertcheckvalidsignature HRESULT + // WTHelperCertCheckValidSignature( CRYPT_PROVIDER_DATA *pProvData ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "d46eea18-03cb-4199-873e-0e9e13061598")] + public static extern HRESULT WTHelperCertCheckValidSignature(in CRYPT_PROVIDER_DATA pProvData); + + /// + /// + /// [The WTHelperCertIsSelfSigned function is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain + /// and CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WTHelperCertIsSelfSigned function checks whether a certificate is self-signed. This function has no associated import + /// library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// A DWORD value that specifies the encoding types of the certificate to check. For information about possible encoding + /// types, see Certificate and Message Encoding Types. + /// + /// A pointer to a CERT_INFO structure that contains information about the certificate to check. + /// + /// If the function succeeds, the function returns TRUE. + /// If the function fails, it returns FALSE. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wthelpercertisselfsigned BOOL WTHelperCertIsSelfSigned( + // DWORD dwEncoding, CERT_INFO *pCert ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "456b8c8c-6ca3-469a-a415-e72109696bf5")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WTHelperCertIsSelfSigned(uint dwEncoding, in CERT_INFO pCert); + + /// + /// + /// [The WTHelperGetProvCertFromChain function is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions. For certificate verification, use the CertGetCertificateChain + /// and CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature verification, use the .NET Framework.] + /// + /// + /// The WTHelperGetProvCertFromChain function retrieves a trust provider certificate from the certificate chain. This function + /// has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll. + /// + /// + /// + /// A pointer to a CRYPT_PROVIDER_SGNR structure that represents the signers. This pointer is retrieved by the + /// WTHelperGetProvSignerFromChain function. + /// + /// The index of the certificate. The index is zero based. + /// + /// + /// If the function succeeds, the function returns a pointer to a CRYPT_PROVIDER_CERT structure that represents the trust provider certificate. + /// + /// If the function fails, it returns NULL. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wthelpergetprovcertfromchain CRYPT_PROVIDER_CERT * + // WTHelperGetProvCertFromChain( CRYPT_PROVIDER_SGNR *pSgnr, DWORD idxCert ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "047278fe-37d5-4fd6-8b36-9e28ead0cc5a")] + public static extern IntPtr WTHelperGetProvCertFromChain(in CRYPT_PROVIDER_SGNR pSgnr, uint idxCert); + + /// + /// + /// [The WTHelperGetProvPrivateDataFromChain function is available for use in the operating systems specified in the + /// Requirements section. It may be altered or unavailable in subsequent versions. For certificate verification, use the + /// CertGetCertificateChain and CertVerifyCertificateChainPolicy functions. For Microsoft Authenticode technology signature + /// verification, use the .NET Framework.] + /// + /// + /// The WTHelperGetProvPrivateDataFromChain function receives a CRYPT_PROVIDER_PRIVDATA structure from the chain by using the + /// provider ID. This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to + /// dynamically link to Wintrust.dll. + /// + /// + /// A pointer to a CRYPT_PROVIDER_DATA structure that contains the provider's private information. + /// A pointer to a GUID structure that identifies the provider. + /// + /// + /// If the function succeeds, the function returns a pointer to a CRYPT_PROVIDER_PRIVDATA structure that represents the trust + /// provider's private information. + /// + /// If the function fails, the return value is NULL. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/nf-wintrust-wthelpergetprovprivatedatafromchain + // CRYPT_PROVIDER_PRIVDATA * WTHelperGetProvPrivateDataFromChain( CRYPT_PROVIDER_DATA *pProvData, GUID *pgProviderID ); + [DllImport(Lib.Wintrust, SetLastError = false, ExactSpelling = true)] + [PInvokeData("wintrust.h", MSDNShortId = "67a718a2-47ca-4c45-a939-99dd8311dc6d")] + public static extern IntPtr WTHelperGetProvPrivateDataFromChain(in CRYPT_PROVIDER_DATA pProvData, in Guid pgProviderID); + + /// + /// + /// [The CRYPT_PROVIDER_CERT structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// The CRYPT_PROVIDER_CERT structure provides information about a provider certificate. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_cert typedef struct _CRYPT_PROVIDER_CERT + // { DWORD cbStruct; PCCERT_CONTEXT pCert; BOOL fCommercial; BOOL fTrustedRoot; BOOL fSelfSigned; BOOL fTestCert; DWORD + // dwRevokedReason; DWORD dwConfidence; DWORD dwError; CTL_CONTEXT *pTrustListContext; BOOL fTrustListSignerCert; PCCTL_CONTEXT + // pCtlContext; DWORD dwCtlError; BOOL fIsCyclic; PCERT_CHAIN_ELEMENT pChainElement; } CRYPT_PROVIDER_CERT, *PCRYPT_PROVIDER_CERT; + [PInvokeData("wintrust.h", MSDNShortId = "622e7a72-445a-4820-b236-1c90dad08351")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_CERT + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// A pointer to the certificate context. + public IntPtr pCert; + + /// Boolean value that indicates whether the certificate is a commercial certificate. + [MarshalAs(UnmanagedType.Bool)] public bool fCommercial; + + /// Boolean value that indicates whether the certificate is a trusted root certificate. + [MarshalAs(UnmanagedType.Bool)] public bool fTrustedRoot; + + /// Boolean value that indicates whether the certificate is self-signed. + [MarshalAs(UnmanagedType.Bool)] public bool fSelfSigned; + + /// Boolean value that indicates whether the certificate is a test certificate. + [MarshalAs(UnmanagedType.Bool)] public bool fTestCert; + + /// Value that specifies the revocation reason, if applicable. + public uint dwRevokedReason; + + /// + /// Bitwise combination of zero or more of the following confidence values. + /// + /// + /// Value + /// Meaning + /// + /// + /// CERT_CONFIDENCE_SIG 0x10000000 + /// The signature of the certificate is valid. + /// + /// + /// CERT_CONFIDENCE_TIME 0x01000000 + /// The time of the certificate issuer is valid. + /// + /// + /// CERT_CONFIDENCE_TIMENEST 0x00100000 + /// The time of the certificate is valid. + /// + /// + /// CERT_CONFIDENCE_AUTHIDEXT 0x00010000 + /// The authority ID extension is valid. + /// + /// + /// CERT_CONFIDENCE_HYGIENE 0x00001000 + /// At a minimum, the signature of the certificate and authority ID extension are valid. + /// + /// + /// CERT_CONFIDENCE_HIGHEST 0x11111000 + /// Combination of all of the other confidence values. + /// + /// + /// + public uint dwConfidence; + + /// A pointer to a DWORD variable that contains the error value for this certificate, if applicable. + public uint dwError; + + /// A pointer to the CTL_CONTEXT that represents the certificate trust list (CTL). + public IntPtr pTrustListContext; + + /// Boolean value that specifies whether the certificate is a trust list signer certificate. + [MarshalAs(UnmanagedType.Bool)] public bool fTrustListSignerCert; + + /// A pointer to the CTL_CONTEXT that represents a CTL that contains a self-signed certificate, if applicable. + public IntPtr pCtlContext; + + /// + /// A pointer to a DWORD variable that contains the error value for a CTL that contains a self-signed certificate, if applicable. + /// + public uint dwCtlError; + + /// Boolean value that indicates whether the certificate trust is cyclical. + [MarshalAs(UnmanagedType.Bool)] public bool fIsCyclic; + + /// A pointer to the CERT_CHAIN_ELEMENT that represents the status of the certificate within a chain. + public IntPtr pChainElement; + } + + /// + /// [The CRYPT_PROVUI_DATA structure is available for use in the operating systems specified in the Requirements section. It may be + /// altered or unavailable in subsequent versions.] + /// + /// The CRYPT_PROVUI_DATA structure provides user interface (UI) data for a provider.This structure is used by the CRYPT_PROVUI_FUNCS structure. + /// + /// + [PInvokeData("wintrust.h", MSDNShortId = "86f819f0-c243-45ba-8b7b-97ed906e6e8a")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_DATA + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// Error code, if applicable. + public uint dwFinalError; + + /// A pointer to a null-terminated string for the Yes button text. If this parameter is NULL, then "&Yes" is used. + [MarshalAs(UnmanagedType.LPWStr)] + public string pYesButtonText; + + /// A pointer to a null-terminated string for the No button text. If this parameter is NULL, then "&No" is used. + [MarshalAs(UnmanagedType.LPWStr)] + public string pNoButtonText; + + /// A pointer to a null-terminated string for the More Info button text. If this parameter is NULL, then "&More Info" + /// is used. + [MarshalAs(UnmanagedType.LPWStr)] + public string pMoreInfoButtonText; + + /// A pointer to a null-terminated string for the Advanced button text. + [MarshalAs(UnmanagedType.LPWStr)] + public string pAdvancedLinkText; + + /// + /// A pointer to a null-terminated string for the text used when the trust is valid and a time stamp is used. If this parameter + /// is NULL, then "Do you want to install and run ""%1"" signed on %2 and distributed by:" is used. + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pCopyActionText; + + /// + /// A pointer to a null-terminated string for the text used when the trust is valid but a time stamp is not used. If this + /// parameter is NULL, then "Do you want to install and run ""%1"" signed on an unknown date/time and distributed by:" is used. + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pCopyActionTextNoTS; + + /// + /// A pointer to a null-terminated string for the text used when a signature is not provided. If this parameter is NULL, then "Do + /// you want to install and run ""%1""?" is used. + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pCopyActionTextNotSigned; + } + + /// + /// The CRYPT_PROVIDER_DEFUSAGE structure is used by the WintrustGetDefaultForUsage function to retrieve callback information + /// for a provider's default usage. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_defusage typedef struct + // _CRYPT_PROVIDER_DEFUSAGE { DWORD cbStruct; GUID gActionID; LPVOID pDefPolicyCallbackData; LPVOID pDefSIPClientData; } + // CRYPT_PROVIDER_DEFUSAGE, *PCRYPT_PROVIDER_DEFUSAGE; + [PInvokeData("wintrust.h", MSDNShortId = "28A93F39-0CBC-432C-841B-83B54A50EA14")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_DEFUSAGE + { + /// Size, in bytes, of the structure. + public uint cbStruct; + + /// GUID that specifies the provider's default action. + public Guid gActionID; + + /// Pointer to a data buffer used to pass policy-specific data to a policy provider. + public IntPtr pDefPolicyCallbackData; + + /// Pointer to a data buffer used to pass subject interface package (SIP) specific data to an SIP provider. + public IntPtr pDefSIPClientData; + } + + /// + /// + /// [The CRYPT_PROVIDER_FUNCTIONS structure is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_PROVIDER_FUNCTIONS structure defines the functions used by a cryptographic service provider (CSP) for WinTrust operations. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_functions typedef struct + // _CRYPT_PROVIDER_FUNCTIONS { DWORD cbStruct; PFN_CPD_MEM_ALLOC pfnAlloc; PFN_CPD_MEM_FREE pfnFree; PFN_CPD_ADD_STORE + // pfnAddStore2Chain; PFN_CPD_ADD_SGNR pfnAddSgnr2Chain; PFN_CPD_ADD_CERT pfnAddCert2Chain; PFN_CPD_ADD_PRIVDATA + // pfnAddPrivData2Chain; PFN_PROVIDER_INIT_CALL pfnInitialize; PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust; PFN_PROVIDER_SIGTRUST_CALL + // pfnSignatureTrust; PFN_PROVIDER_CERTTRUST_CALL pfnCertificateTrust; PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy; + // PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy; PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy; struct + // _CRYPT_PROVUI_FUNCS *psUIpfns; PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy; } CRYPT_PROVIDER_FUNCTIONS, *PCRYPT_PROVIDER_FUNCTIONS; + [PInvokeData("wintrust.h", MSDNShortId = "2c00f8ec-e262-4df8-8984-a2702a4162bf")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_FUNCTIONS + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// A pointer to the memory allocation function. + public IntPtr pfnAlloc; + + /// A pointer to the memory deallocation function. + public IntPtr pfnFree; + + /// A pointer to the function that adds a store to the chain. + public IntPtr pfnAddStore2Chain; + + /// A pointer to the function that adds a signer structure to a message structure in a chain. + public IntPtr pfnAddSgnr2Chain; + + /// A pointer to the function that adds a certificate structure to a signer structure in a chain. + public IntPtr pfnAddCert2Chain; + + /// A pointer to the function that adds private data to a structure. + public IntPtr pfnAddPrivData2Chain; + + /// A pointer to the function that initializes policy data. + public IntPtr pfnInitialize; + + /// A pointer to the function that builds information for the signer data. + public IntPtr pfnObjectTrust; + + /// A pointer to the function that builds information for the signing certificate. + public IntPtr pfnSignatureTrust; + + /// A pointer to the function that builds the chain. + public IntPtr pfnCertificateTrust; + + /// A pointer to the function that makes the final call to the policy. + public IntPtr pfnFinalPolicy; + + /// A pointer to the function that checks each certificate while building a chain. + public IntPtr pfnCertCheckPolicy; + + /// A pointer to the function that allows structures to be dumped to a file. + public IntPtr pfnTestFinalPolicy; + + /// A pointer to a CRYPT_PROVUI_FUNCS structure. + public IntPtr psUIpfns; + + /// A pointer to the function that cleans up private data. + public IntPtr pfnCleanupPolicy; + } + + /// + /// + /// [The CRYPT_PROVIDER_PRIVDATA structure is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_PROVIDER_PRIVDATA structure contains private data to be used by a provider. The structure is used by the + /// CRYPT_PROVIDER_DATA structure. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_privdata typedef struct + // _CRYPT_PROVIDER_PRIVDATA { DWORD cbStruct; GUID gProviderID; DWORD cbProvData; void *pvProvData; } CRYPT_PROVIDER_PRIVDATA, *PCRYPT_PROVIDER_PRIVDATA; + [PInvokeData("wintrust.h", MSDNShortId = "499e4d9b-991a-4317-bc74-a1dfb6609a70")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct CRYPT_PROVIDER_PRIVDATA + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// GUID that identifies the provider. + public Guid gProviderID; + + /// Number of bytes referenced by pvProvData. + public uint cbProvData; + + /// A pointer to a void that contains the private data. + public IntPtr pvProvData; + } + + /// + /// The CRYPT_PROVIDER_REGDEFUSAGE structure is used by the WintrustAddDefaultForUsage function to register callback + /// information about a provider's default usage. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_regdefusage typedef struct + // _CRYPT_PROVIDER_REGDEFUSAGE { DWORD cbStruct; GUID *pgActionID; WCHAR *pwszDllName; char *pwszLoadCallbackDataFunctionName; char + // *pwszFreeCallbackDataFunctionName; } CRYPT_PROVIDER_REGDEFUSAGE, *PCRYPT_PROVIDER_REGDEFUSAGE; + [PInvokeData("wintrust.h", MSDNShortId = "A6047CBA-E4BA-4A31-B700-C368CFB57895")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_REGDEFUSAGE + { + /// Size, in bytes, of this structure. + public uint cbStruct; + + /// GUID that specifies the provider's default action. + public IntPtr pgActionID; + + /// Pointer to the name of the provider DLL. + public StrPtrUni pwszDllName; + + /// + /// Pointer to the name of the function that loads the callback data to be returned when the WintrustGetDefaultForUsage function + /// is called with the dwAction parameter set to DWACTION_ALLOCANDFILL. This information also exists in the WINTRUST_DATA structure. + /// + public StrPtrUni pwszLoadCallbackDataFunctionName; + + /// + /// Pointer to the name of the function that frees allocated memory when the WintrustGetDefaultForUsage function is called with + /// the dwAction parameter set to DWACTION_FREE. This information also exists in the WINTRUST_DATA structure. + /// + public StrPtrUni pwszFreeCallbackDataFunctionName; + } + + /// + /// + /// [The CRYPT_PROVIDER_SGNR structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// The CRYPT_PROVIDER_SGNR structure provides information about a signer or countersigner. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_sgnr typedef struct _CRYPT_PROVIDER_SGNR + // { DWORD cbStruct; FILETIME sftVerifyAsOf; DWORD csCertChain; struct _CRYPT_PROVIDER_CERT *pasCertChain; DWORD dwSignerType; + // CMSG_SIGNER_INFO *psSigner; DWORD dwError; DWORD csCounterSigners; struct _CRYPT_PROVIDER_SGNR *pasCounterSigners; + // PCCERT_CHAIN_CONTEXT pChainContext; } CRYPT_PROVIDER_SGNR, *PCRYPT_PROVIDER_SGNR; + [PInvokeData("wintrust.h", MSDNShortId = "39cf9a03-768d-4ae0-a19d-17652181dbe4")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_SGNR + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// The current time, or the time stamp. + public FILETIME sftVerifyAsOf; + + /// Number of elements in the pasCertChain array. + public uint csCertChain; + + /// Array of CRYPT_PROVIDER_CERT structures. + public IntPtr pasCertChain; + + /// + /// Signer type, if known by the policy. This value is zero, if the signer type is unknown, or the following value. + /// + /// + /// Value + /// Meaning + /// + /// + /// SGNR_TYPE_TIMESTAMP 0x00000010 + /// Time stamp signer. + /// + /// + /// + public uint dwSignerType; + + /// A pointer to a CMSG_SIGNER_INFO structure. + public IntPtr psSigner; + + /// Error value, if any, while building or verifying the signer. + public uint dwError; + + /// Number of elements in the pasCounterSigners array. + public uint csCounterSigners; + + /// A pointer to an array of CRYPT_PROVIDER_SGNR structures that represent the countersigners. + public IntPtr pasCounterSigners; + + /// A pointer to a CERT_CHAIN_CONTEXT structure. + public IntPtr pChainContext; + } + + /// The CRYPT_PROVIDER_SIGSTATE structure is used to communicate between policy providers and Wintrust. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provider_sigstate typedef struct + // _CRYPT_PROVIDER_SIGSTATE { DWORD cbStruct; HCRYPTMSG *rhSecondarySigs; HCRYPTMSG hPrimarySig; BOOL fFirstAttemptMade; BOOL + // fNoMoreSigs; DWORD cSecondarySigs; DWORD dwCurrentIndex; BOOL fSupportMultiSig; DWORD dwCryptoPolicySupport; DWORD iAttemptCount; + // BOOL fCheckedSealing; struct _SEALING_SIGNATURE_ATTRIBUTE *pSealingSignature; } CRYPT_PROVIDER_SIGSTATE, *PCRYPT_PROVIDER_SIGSTATE; + [PInvokeData("wintrust.h", MSDNShortId = "B362A161-6B92-41B0-AE81-337EB42502D8")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVIDER_SIGSTATE + { + /// Size, in bytes, of this structure. + public uint cbStruct; + + /// Pointer to an array of secondary signature handles. + public IntPtr rhSecondarySigs; + + /// Handle of the primary signature. + public HCRYPTMSG hPrimarySig; + + /// Specifies whether the first attempt to verify a signature has been made. + [MarshalAs(UnmanagedType.Bool)] public bool fFirstAttemptMade; + + /// Specifies whether there exist further signatures that await verification. + [MarshalAs(UnmanagedType.Bool)] public bool fNoMoreSigs; + + /// Number of secondary signatures. + public uint cSecondarySigs; + + /// Index of the signature currently being verified. + public uint dwCurrentIndex; + + /// Specifies whether the policy provider supports multiple signatures. + [MarshalAs(UnmanagedType.Bool)] public bool fSupportMultiSig; + + /// + /// + /// Identifies the portion of the policy provider that supports cryptographic policy. This can be one of the following values: + /// + /// + /// + /// WSS_OBJTRUST_SUPPORT + /// + /// + /// WSS_SIGTRUST_SUPPORT + /// + /// + /// WSS_CERTTRUST_SUPPORT + /// + /// + /// + public uint dwCryptoPolicySupport; + + /// + public uint iAttemptCount; + + /// + [MarshalAs(UnmanagedType.Bool)] public bool fCheckedSealing; + + /// + public IntPtr pSealingSignature; + } + + /// + /// + /// [The CRYPT_PROVUI_DATA structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_PROVUI_DATA structure provides user interface (UI) data for a provider. This structure is used by the + /// CRYPT_PROVUI_FUNCS structure. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-crypt_provui_data typedef struct _CRYPT_PROVUI_DATA { + // DWORD cbStruct; DWORD dwFinalError; WCHAR *pYesButtonText; WCHAR *pNoButtonText; WCHAR *pMoreInfoButtonText; WCHAR + // *pAdvancedLinkText; WCHAR *pCopyActionText; WCHAR *pCopyActionTextNoTS; WCHAR *pCopyActionTextNotSigned; } CRYPT_PROVUI_DATA, *PCRYPT_PROVUI_DATA; + [PInvokeData("wintrust.h", MSDNShortId = "86f819f0-c243-45ba-8b7b-97ed906e6e8a")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVUI_DATA + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// Error code, if applicable. + public Win32Error dwFinalError; + + /// + /// A pointer to a null-terminated string for the Yes button text. If this parameter is NULL, then + /// "&Yes" is used. + /// + public StrPtrUni pYesButtonText; + + /// + /// A pointer to a null-terminated string for the No button text. If this parameter is NULL, then "&No" + /// is used. + /// + public StrPtrUni pNoButtonText; + + /// + /// A pointer to a null-terminated string for the More Info button text. If this parameter is NULL, then + /// "&More Info" is used. + /// + public StrPtrUni pMoreInfoButtonText; + + /// A pointer to a null-terminated string for the Advanced button text. + public StrPtrUni pAdvancedLinkText; + + /// + /// A pointer to a null-terminated string for the text used when the trust is valid and a time stamp is used. If this + /// parameter is NULL, then "Do you want to install and run ""%1"" signed on %2 and distributed by:" is used. + /// + public StrPtrUni pCopyActionText; + + /// + /// A pointer to a null-terminated string for the text used when the trust is valid but a time stamp is not used. If this + /// parameter is NULL, then "Do you want to install and run ""%1"" signed on an unknown date/time and distributed by:" is used. + /// + public StrPtrUni pCopyActionTextNoTS; + + /// + /// A pointer to a null-terminated string for the text used when a signature is not provided. If this parameter is + /// NULL, then "Do you want to install and run ""%1""?" is used. + /// + public StrPtrUni pCopyActionTextNotSigned; + } + + /// + /// + /// [The CRYPT_PROVUI_FUNCS structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_PROVUI_FUNCS structure provides information about the user interface (UI) functions of a provider. This + /// structure is used by the CRYPT_PROVIDER_FUNCTIONS structure. + /// + /// + /// The prototype for PFN_PROVUI_CALL is defined as: + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_provui_funcs typedef struct _CRYPT_PROVUI_FUNCS { + // DWORD cbStruct; struct _CRYPT_PROVUI_DATA *psUIData; PFN_PROVUI_CALL pfnOnMoreInfoClick; PFN_PROVUI_CALL + // pfnOnMoreInfoClickDefault; PFN_PROVUI_CALL pfnOnAdvancedClick; PFN_PROVUI_CALL pfnOnAdvancedClickDefault; } CRYPT_PROVUI_FUNCS, *PCRYPT_PROVUI_FUNCS; + [PInvokeData("wintrust.h", MSDNShortId = "7cdc32ea-b28a-400f-ad8a-984f86bb95fd")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_PROVUI_FUNCS + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// A pointer to a CRYPT_PROVUI_DATA structure. + public IntPtr psUIData; + + /// A pointer to the function called when the More Info button is clicked. + public IntPtr pfnOnMoreInfoClick; + + /// A pointer to the default function called when the More Info button is clicked. + public IntPtr pfnOnMoreInfoClickDefault; + + /// A pointer to the function called when the Advanced button is clicked. + public IntPtr pfnOnAdvancedClick; + + /// A pointer to the default function called when the Advanced button is clicked. + public IntPtr pfnOnAdvancedClickDefault; + } + + /// + /// + /// [The CRYPT_REGISTER_ACTIONID structure is available for use in the operating systems specified in the Requirements + /// section. It may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_REGISTER_ACTIONID structure provides information about the functions of a provider. This structure is used by + /// the WintrustAddActionID function. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_register_actionid typedef struct + // _CRYPT_REGISTER_ACTIONID { DWORD cbStruct; CRYPT_TRUST_REG_ENTRY sInitProvider; CRYPT_TRUST_REG_ENTRY sObjectProvider; + // CRYPT_TRUST_REG_ENTRY sSignatureProvider; CRYPT_TRUST_REG_ENTRY sCertificateProvider; CRYPT_TRUST_REG_ENTRY + // sCertificatePolicyProvider; CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider; CRYPT_TRUST_REG_ENTRY sTestPolicyProvider; + // CRYPT_TRUST_REG_ENTRY sCleanupProvider; } CRYPT_REGISTER_ACTIONID, *PCRYPT_REGISTER_ACTIONID; + [PInvokeData("wintrust.h", MSDNShortId = "0b2b482f-f087-4be7-b17f-91c287c3460d")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_REGISTER_ACTIONID + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the function that initializes the provider. + public CRYPT_TRUST_REG_ENTRY sInitProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the object provider function. + public CRYPT_TRUST_REG_ENTRY sObjectProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the signature provider function. + public CRYPT_TRUST_REG_ENTRY sSignatureProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the certificate provider function. + public CRYPT_TRUST_REG_ENTRY sCertificateProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the certificate policy provider function. + public CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the final policy provider function. + public CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the test policy provider function. + public CRYPT_TRUST_REG_ENTRY sTestPolicyProvider; + + /// CRYPT_TRUST_REG_ENTRY structure that identifies the cleanup provider function. + public CRYPT_TRUST_REG_ENTRY sCleanupProvider; + } + + /// + /// + /// [The CRYPT_TRUST_REG_ENTRY structure is available for use in the operating systems specified in the Requirements section. + /// It may be altered or unavailable in subsequent versions.] + /// + /// + /// The CRYPT_TRUST_REG_ENTRY structure identifies a provider function by DLL name and function name. This structure is used + /// by the CRYPT_REGISTER_ACTIONID structure when the WintrustAddActionID function is called. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_crypt_trust_reg_entry typedef struct + // _CRYPT_TRUST_REG_ENTRY { DWORD cbStruct; WCHAR *pwszDLLName; WCHAR *pwszFunctionName; } CRYPT_TRUST_REG_ENTRY, *PCRYPT_TRUST_REG_ENTRY; + [PInvokeData("wintrust.h", MSDNShortId = "1a531219-f254-4057-934b-af95bfe0bb83")] + [StructLayout(LayoutKind.Sequential)] + public struct CRYPT_TRUST_REG_ENTRY + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// A pointer to a null-terminated string for the DLL name. + public StrPtrUni pwszDLLName; + + /// A pointer to a null-terminated string for the function name. + public StrPtrUni pwszFunctionName; + } + + /// Provides a handle to a catalog administrator context. + [StructLayout(LayoutKind.Sequential)] + public struct HCATADMIN : IHandle + { + private IntPtr handle; + + /// Initializes a new instance of the struct. + /// An object that represents the pre-existing handle to use. + public HCATADMIN(IntPtr preexistingHandle) => handle = preexistingHandle; + + /// Returns an invalid handle by instantiating a object with . + public static HCATADMIN NULL => new HCATADMIN(IntPtr.Zero); + + /// Gets a value indicating whether this instance is a null handle. + public bool IsNull => handle == IntPtr.Zero; + + /// Performs an explicit conversion from to . + /// The handle. + /// The result of the conversion. + public static explicit operator IntPtr(HCATADMIN h) => h.handle; + + /// Performs an implicit conversion from to . + /// The pointer to a handle. + /// The result of the conversion. + public static implicit operator HCATADMIN(IntPtr h) => new HCATADMIN(h); + + /// Implements the operator !=. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator !=(HCATADMIN h1, HCATADMIN h2) => !(h1 == h2); + + /// Implements the operator ==. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator ==(HCATADMIN h1, HCATADMIN h2) => h1.Equals(h2); + + /// + public override bool Equals(object obj) => obj is HCATADMIN h ? handle == h.handle : false; + + /// + public override int GetHashCode() => handle.GetHashCode(); + + /// + public IntPtr DangerousGetHandle() => handle; + } + + /// Provides a handle to a cryptography message. + [StructLayout(LayoutKind.Sequential)] + public struct HCRYPTMSG : IHandle + { + private IntPtr handle; + + /// Initializes a new instance of the struct. + /// An object that represents the pre-existing handle to use. + public HCRYPTMSG(IntPtr preexistingHandle) => handle = preexistingHandle; + + /// Returns an invalid handle by instantiating a object with . + public static HCRYPTMSG NULL => new HCRYPTMSG(IntPtr.Zero); + + /// Gets a value indicating whether this instance is a null handle. + public bool IsNull => handle == IntPtr.Zero; + + /// Performs an explicit conversion from to . + /// The handle. + /// The result of the conversion. + public static explicit operator IntPtr(HCRYPTMSG h) => h.handle; + + /// Performs an implicit conversion from to . + /// The pointer to a handle. + /// The result of the conversion. + public static implicit operator HCRYPTMSG(IntPtr h) => new HCRYPTMSG(h); + + /// Implements the operator !=. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator !=(HCRYPTMSG h1, HCRYPTMSG h2) => !(h1 == h2); + + /// Implements the operator ==. + /// The first handle. + /// The second handle. + /// The result of the operator. + public static bool operator ==(HCRYPTMSG h1, HCRYPTMSG h2) => h1.Equals(h2); + + /// + public override bool Equals(object obj) => obj is HCRYPTMSG h ? handle == h.handle : false; + + /// + public override int GetHashCode() => handle.GetHashCode(); + + /// + public IntPtr DangerousGetHandle() => handle; + } + + /// + /// The SPC_INDIRECT_DATA_CONTENT structure is used in Authenticode signatures to store the digest and other attributes of the + /// signed file. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_spc_indirect_data_content typedef struct + // _SPC_INDIRECT_DATA_CONTENT { CRYPT_ATTRIBUTE_TYPE_VALUE Data; CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; CRYPT_HASH_BLOB Digest; + // } SPC_INDIRECT_DATA_CONTENT, *PSPC_INDIRECT_DATA_CONTENT; + [PInvokeData("wintrust.h", MSDNShortId = "BD790CA5-9C51-4483-93C1-5492154BF913")] + [StructLayout(LayoutKind.Sequential)] + public struct SPC_INDIRECT_DATA_CONTENT + { + /// A CRYPT_ATTRIBUTE_TYPE_VALUE that contains attributes of the digested file. + public CRYPT_ATTRIBUTE_TYPE_VALUE Data; + + /// Specifies the digest algorithm used to hash the file. + public CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; + + /// The Authenticode digest value of the file using the algorithm specified in the DigestAlgorithm parameter. + public CRYPTOAPI_BLOB Digest; + } + + /// This structure encapsulates a signature used in verifying executable files. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-_win_certificate typedef struct _WIN_CERTIFICATE { DWORD + // dwLength; WORD wRevision; WORD wCertificateType; BYTE bCertificate[ANYSIZE_ARRAY]; } WIN_CERTIFICATE, *LPWIN_CERTIFICATE; + [PInvokeData("wintrust.h", MSDNShortId = "AC666871-265B-4D09-B7A6-DEC48D4645FD")] + [StructLayout(LayoutKind.Sequential)] + public struct WIN_CERTIFICATE + { + /// Specifies the length, in bytes, of the signature. + public uint dwLength; + + /// + /// Specifies the certificate revision. + /// The only defined certificate revision is WIN_CERT_REVISION_1_0 (0x0100). + /// + public ushort wRevision; + + /// + /// Specifies the type of certificate. + /// + /// + /// Value + /// Description + /// + /// + /// WIN_CERT_TYPE_X509 (0x0001) + /// The bCertificate member contains an X.509 certificate. + /// + /// + /// WIN_CERT_TYPE_PKCS_SIGNED_DATA (0x0002) + /// The bCertificate member contains a PKCS SignedData structure. + /// + /// + /// WIN_CERT_TYPE_RESERVED_1 (0x0003) + /// Reserved. + /// + /// + /// WIN_CERT_TYPE_PKCS1_SIGN (0x0009) + /// The bCertificate member contains PKCS1_MODULE_SIGN fields. + /// + /// + /// + public WIN_CERT_TYPE wCertificateType; + + /// + /// An array of certificates. + /// The format of this member depends on the value of wCertificateType. + /// + public IntPtr bCertificate; + } + + /// + /// + /// [The WINTRUST_BLOB_INFO structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// The WINTRUST_BLOB_INFO structure is used when calling WinVerifyTrust to verify a memory BLOB. + /// + /// Note This structure is not currently supported for the following Inbox file formats. There may be other formats besides + /// these that are not supported. This structure is only supported by files formats with subject interface package (SIP) providers + /// that support this structure. + /// + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_blob_info_ typedef struct WINTRUST_BLOB_INFO_ { + // DWORD cbStruct; GUID gSubject; LPCWSTR pcwszDisplayName; DWORD cbMemObject; BYTE *pbMemObject; DWORD cbMemSignedMsg; BYTE + // *pbMemSignedMsg; } WINTRUST_BLOB_INFO, *PWINTRUST_BLOB_INFO; + [PInvokeData("wintrust.h", MSDNShortId = "8b13d355-4d24-4d8e-aae3-db16467999be")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_BLOB_INFO + { + /// The number of bytes in this structure. + public uint cbStruct; + + /// The GUID of the SIP to load. + public Guid gSubject; + + /// A string that contains the name of the memory object pointed to by pbMem. + public StrPtrUni pcwszDisplayName; + + /// The length, in bytes, of the memory BLOB to be verified. + public uint cbMemObject; + + /// A pointer to a memory BLOB to be verified. + public IntPtr pbMemObject; + + /// This member is reserved. Do not use it. + public uint cbMemSignedMsg; + + /// This member is reserved. Do not use it. + public IntPtr pbMemSignedMsg; + } + + /// + /// The WINTRUST_CATALOG_INFO structure is used when calling WinVerifyTrust to verify a member of a Microsoft catalog. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_catalog_info_ typedef struct + // WINTRUST_CATALOG_INFO_ { DWORD cbStruct; DWORD dwCatalogVersion; LPCWSTR pcwszCatalogFilePath; LPCWSTR pcwszMemberTag; LPCWSTR + // pcwszMemberFilePath; HANDLE hMemberFile; BYTE *pbCalculatedFileHash; DWORD cbCalculatedFileHash; PCCTL_CONTEXT pcCatalogContext; + // HCATADMIN hCatAdmin; } WINTRUST_CATALOG_INFO, *PWINTRUST_CATALOG_INFO; + [PInvokeData("wintrust.h", MSDNShortId = "5d095e0f-c8c9-4717-b23a-985737b78431")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_CATALOG_INFO + { + /// Size, in bytes, of this structure. + public uint cbStruct; + + /// Optional. Catalog version number. + public uint dwCatalogVersion; + + /// The full path and file name of the catalog file that contains the member to be verified. + public StrPtrUni pcwszCatalogFilePath; + + /// Tag of a member file to be verified. + public StrPtrUni pcwszMemberTag; + + /// The full path and file name of the catalog member file to be verified. + public StrPtrUni pcwszMemberFilePath; + + /// + /// Optional. Handle of the open catalog member file to be verified. The handle must be to a file with at least read permissions. + /// + public HFILE hMemberFile; + + /// Optional. The calculated hash of the file that contains the file to be verified. + public IntPtr pbCalculatedFileHash; + + /// + /// The size, in bytes, of the value passed in the pbCalculatedFileHash member. cbCalculatedFileHash is used only + /// if the calculated hash is being passed. + /// + public uint cbCalculatedFileHash; + + /// A pointer to a CTL_CONTEXT structure that represents a catalog context to be used instead of a catalog file. + public IntPtr pcCatalogContext; + + /// + /// Handle to the catalog administrator context that was used when calculating the hash of the file. This value can be zero only + /// for a SHA1 file hash. Windows 8 and Windows Server 2012: Support for this member begins. + /// + public HCATADMIN hCatAdmin; + } + + /// + /// + /// [The WINTRUST_CERT_INFO structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// The WINTRUST_CERT_INFO structure is used when calling WinVerifyTrust to verify a CERT_CONTEXT. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_cert_info_ typedef struct WINTRUST_CERT_INFO_ { + // DWORD cbStruct; LPCWSTR pcwszDisplayName; CERT_CONTEXT *psCertContext; DWORD chStores; HCERTSTORE *pahStores; DWORD dwFlags; + // FILETIME *psftVerifyAsOf; } WINTRUST_CERT_INFO, *PWINTRUST_CERT_INFO; + [PInvokeData("wintrust.h", MSDNShortId = "6522d1f0-3d96-4499-9220-23288122e0e6")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_CERT_INFO + { + /// Count of bytes in this structure. + public uint cbStruct; + + /// String with the name of the memory object pointed to by the pbMem member of the WINTRUST_BLOB_INFO structure. + public StrPtrUni pcwszDisplayName; + + /// A pointer to the CERT_CONTEXT to be verified. + public IntPtr psCertContext; + + /// The number of store handles in pahStores. + public uint chStores; + + /// + /// An array of open certificate stores to add to the list of stores that the policy provider looks in to find certificates while + /// building a trust chain. + /// + public IntPtr pahStores; + + /// + public uint dwFlags; + + /// + public IntPtr psftVerifyAsOf; + } + + /// + /// [The WINTRUST_DATA structure is available for use in the operating systems specified in the Requirements section. It may be + /// altered or unavailable in subsequent versions.] + /// The WINTRUST_DATA structure is used when calling WinVerifyTrust to pass necessary information into the trust providers. + /// + [PInvokeData("wintrust.h", MSDNShortId = "8fb68f44-6f69-4eac-90de-02689e3e86cf")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_DATA + { + /// The size, in bytes, of this structure. + public uint cbStruct; + + /// A pointer to a data buffer used to pass policy-specific data to a policy provider. This member can be NULL. + public IntPtr pPolicyCallbackData; + + /// + /// A pointer to a data buffer used to pass subject interface package (SIP)-specific data to a SIP provider. This member can be NULL. + /// + public IntPtr pSIPCallbackData; + + /// Specifies the kind of user interface (UI) to be used. + public WTD_UI dwUIChoice; + + /// + /// Certificate revocation check options. This member can be set to add revocation checking to that done by the selected policy provider. + /// + public WTD_REVOKE fdwRevocationChecks; + + /// Specifies the union member to be used and, thus, the type of object for which trust will be verified. + public WTD_CHOICE dwUnionChoice; + + /// Pointer to the structure specified by . + public IntPtr pInfoStruct; + + /// Specifies the action to be taken. + public WTD_STATEACTION dwStateAction; + + /// A handle to the state data. The contents of this member depends on the value of the dwStateAction member. + public HANDLE hWVTStateData; + + /// Reserved for future use. Set to NULL. + public StrPtrUni pwszURLReference; + + /// DWORD value that specifies trust provider settings. + public WTD_TRUST dwProvFlags; + + /// + /// A DWORD value that specifies the user interface context for the WinVerifyTrust function. This causes the text in the + /// Authenticode dialog box to match the action taken on the file. + /// + public WTD_UICONTEXT dwUIContext; + + /// + /// Pointer to a WINTRUST_SIGNATURE_SETTINGS structure. + /// Windows 8 and Windows Server 2012: Support for this member begins. + /// + public IntPtr pSignatureSettings; + } + + /// The WINTRUST_FILE_INFO structure is used when calling WinVerifyTrust to verify an individual file. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_file_info_ typedef struct WINTRUST_FILE_INFO_ { + // DWORD cbStruct; LPCWSTR pcwszFilePath; HANDLE hFile; GUID *pgKnownSubject; } WINTRUST_FILE_INFO, *PWINTRUST_FILE_INFO; + [PInvokeData("wintrust.h", MSDNShortId = "3c3bef86-a2ed-47d1-a726-90630433358a")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_FILE_INFO + { + /// Count of bytes in this structure. + public uint cbStruct; + + /// Full path and file name of the file to be verified. This parameter cannot be NULL. + public StrPtrUni pcwszFilePath; + + /// + /// Optional. File handle to the open file to be verified. This handle must be to a file that has at least read permission. This + /// member can be set to NULL. + /// + public HFILE hFile; + + /// Optional. Pointer to a GUID structure that specifies the subject type. This member can be set to NULL. + public IntPtr pgKnownSubject; + } + + /// + /// + /// [The WINTRUST_SGNR_INFO structure is available for use in the operating systems specified in the Requirements section. It + /// may be altered or unavailable in subsequent versions.] + /// + /// The WINTRUST_SGNR_INFO structure is used when calling WinVerifyTrust to verify a CMSG_SIGNER_INFO structure. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_sgnr_info typedef struct WINTRUST_SGNR_INFO_ { + // DWORD cbStruct; LPCWSTR pcwszDisplayName; CMSG_SIGNER_INFO *psSignerInfo; DWORD chStores; HCERTSTORE *pahStores; } + // WINTRUST_SGNR_INFO, *PWINTRUST_SGNR_INFO; + [PInvokeData("wintrust.h", MSDNShortId = "04e62bfa-efe4-428a-ae6b-58c2377fd5ba")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_SGNR_INFO + { + /// Count of bytes in this structure. + public uint cbStruct; + + /// String with the name representing the signer to be checked. + public StrPtrUni pcwszDisplayName; + + /// A pointer to a CMSG_SIGNER_INFO structure that includes the signature to be verified. + public IntPtr psSignerInfo; + + /// Number of store handles in pahStores. + public uint chStores; + + /// + /// An array of open certificate stores to be added to the list of stores that the policy provider uses to find certificates + /// while building a trust chain. + /// + public IntPtr pahStores; + } + + /// The WINTRUST_SIGNATURE_SETTINGS structure can be used to specify the signatures on a file. + // https://docs.microsoft.com/en-us/windows/desktop/api/wintrust/ns-wintrust-wintrust_signature_settings_ typedef struct + // WINTRUST_SIGNATURE_SETTINGS_ { DWORD cbStruct; DWORD dwIndex; DWORD dwFlags; DWORD cSecondarySigs; DWORD dwVerifiedSigIndex; + // PCERT_STRONG_SIGN_PARA pCryptoPolicy; } WINTRUST_SIGNATURE_SETTINGS, *PWINTRUST_SIGNATURE_SETTINGS; + [PInvokeData("wintrust.h", MSDNShortId = "E0F526B4-AFDE-4481-B49F-EE7467F97A46")] + [StructLayout(LayoutKind.Sequential)] + public struct WINTRUST_SIGNATURE_SETTINGS + { + /// Size, in bytes, of this structure. + public uint cbStruct; + + /// Contains the index of the signature to be validated if the dwFlags member is set to WSS_VERIFY_SPECIFIC. + public uint dwIndex; + + /// + /// Flags that can be used to refine behavior. This can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// WSS_VERIFY_SPECIFIC 0x00000001 + /// Set this value if you set the dwIndex parameter. + /// + /// + /// WSS_GET_SECONDARY_SIG_COUNT 0x00000002 + /// Set this value to return the number of secondary signatures found in the cSecondarySigs member. + /// + /// + /// + public uint dwFlags; + + /// Contains the number of secondary signatures found if the dwFlags member is set to WSS_GET_SECONDARY_SIG_COUNT. + public uint cSecondarySigs; + + /// The index used for verification. This member is set on return from Wintrust. + public uint dwVerifiedSigIndex; + + /// + /// Pointer to a CERT_STRONG_SIGN_PARA structure that contains the policy that a signature must pass to be considered valid. + /// + public IntPtr pCryptoPolicy; + } + } +} \ No newline at end of file diff --git a/Vanara.sln b/Vanara.sln index afc92bd8..eb14206f 100644 --- a/Vanara.sln +++ b/Vanara.sln @@ -157,7 +157,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ws2_32", "UnitTests\PInvoke EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.Accessibility", "PInvoke\Accessibility\Vanara.PInvoke.Accessibility.csproj", "{D5BD6ECE-B285-4CE8-ABFC-964AB1DEA464}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.SearchApi", "PInvoke\SearchApi\Vanara.PInvoke.SearchApi.csproj", "{07CD630D-A4BD-45CB-BF1B-90E981F4DE81}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.SearchApi", "PInvoke\SearchApi\Vanara.PInvoke.SearchApi.csproj", "{07CD630D-A4BD-45CB-BF1B-90E981F4DE81}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.WinTrust", "PInvoke\WinTrust\Vanara.PInvoke.WinTrust.csproj", "{3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -439,6 +441,10 @@ Global {07CD630D-A4BD-45CB-BF1B-90E981F4DE81}.Debug|Any CPU.Build.0 = Debug|Any CPU {07CD630D-A4BD-45CB-BF1B-90E981F4DE81}.Release|Any CPU.ActiveCfg = Release|Any CPU {07CD630D-A4BD-45CB-BF1B-90E981F4DE81}.Release|Any CPU.Build.0 = Release|Any CPU + {3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -508,6 +514,7 @@ Global {15DC485D-B379-4087-97A7-981ADB4D48F9} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} {D5BD6ECE-B285-4CE8-ABFC-964AB1DEA464} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} {07CD630D-A4BD-45CB-BF1B-90E981F4DE81} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {3EDE955E-50DE-4E1D-97E8-31E4E6A83E7D} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}