using System; using System.Runtime.InteropServices; using System.Text; using static Vanara.PInvoke.Crypt32; namespace Vanara.PInvoke { /// Methods and data types found in CryptDlg.dll. public static partial class CryptDlg { /// /// The PFNCMFILTERPROC function is a filter procedure that filters each certificate to determine whether it will appear in /// the certificate selection dialog box that is displayed by the CertSelectCertificate function. PFNCMFILTERPROC is an /// application-defined callback function that is specified in the CERT_SELECT_STRUCT structure. The CERT_SELECT_STRUCT /// structure is a parameter in the CertSelectCertificate function. The PFNCMFILTERPROC function must be implemented by the /// developer to suit each application. /// /// /// A pointer to a CERT_CONTEXT structure that contains a certificate to make a filtering determination on. /// /// The customer data. /// The flags. /// The display well. /// /// Return a nonzero value ( TRUE) to display the certificate. Return zero ( FALSE) to not display the certificate. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nc-cryptdlg-pfncmfilterproc PFNCMFILTERPROC Pfncmfilterproc; BOOL // Pfncmfilterproc( IN PCCERT_CONTEXT pCertContext, IN LPARAM, IN DWORD, IN DWORD ) {...} [PInvokeData("cryptdlg.h", MSDNShortId = "f870a8a7-c504-491a-b9ac-045766e46348")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool PFNCMFILTERPROC([In] PCCERT_CONTEXT pCertContext, [In] IntPtr lCustData, [In] uint dwFlags, [In] CertDisplayWell dwDisplayWell); /// /// The PFNCMHOOKPROC function is a hook procedure that is called before messages are processed by the certificate selection /// dialog box produced by the CertSelectCertificate function. The function allows the caller to customize the dialog box. /// PFNCMHOOKPROC is an application-defined callback function specified in the CERT_SELECT_STRUCT structure. The /// CERT_SELECT_STRUCT structure is a parameter in the CertSelectCertificate function. The PFNCMHOOKPROC function must /// be implemented by the developer to suit each application. /// /// A handle to a dialog box window. /// The message. /// Additional information about the message sent or posted. /// Additional information about the message sent or posted. /// /// Return a nonzero value ( TRUE) if this function processes the message. Return zero ( FALSE) if this function does /// not process the message. /// /// For information about hooks, see Hooks. // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nc-cryptdlg-pfncmhookproc PFNCMHOOKPROC Pfncmhookproc; UINT // Pfncmhookproc( IN HWND hwndDialog, IN UINT message, IN WPARAM wParam, IN LPARAM lParam ) {...} [PInvokeData("cryptdlg.h", MSDNShortId = "7172c995-a46b-437b-beaf-a0649cb8ec3d")] public delegate uint PFNCMHOOKPROC([In] HWND hwndDialog, [In] uint message, [In] IntPtr wParam, [In] IntPtr lParam); /// [PInvokeData("cryptdlg.h", MSDNShortId = "f870a8a7-c504-491a-b9ac-045766e46348")] public enum CertDisplayWell { /// CERT_DISPWELL_SELECT = 1, /// CERT_DISPWELL_TRUST_CA_CERT = 2, /// CERT_DISPWELL_TRUST_LEAF_CERT = 3, /// CERT_DISPWELL_TRUST_ADD_CA_CERT = 4, /// CERT_DISPWELL_TRUST_ADD_LEAF_CERT = 5, /// CERT_DISPWELL_DISTRUST_CA_CERT = 6, /// CERT_DISPWELL_DISTRUST_LEAF_CERT = 7, /// CERT_DISPWELL_DISTRUST_ADD_CA_CERT = 8, /// CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT = 9, } /// The operation to be performed. [PInvokeData("cryptdlg.h", MSDNShortId = "b8b5fd3e-a0db-4edd-84c7-48bae9adc3f8")] public enum CertModifyCertificatesOp : uint { /// Add the certificate to the Untrusted Certificates certificate store. The certificate is explicitly not trusted. CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED = 1, /// /// Remove the certificate from the CTL. The certificate is neither explicitly trusted nor untrusted. To be trusted, the /// certificate must have a trusted root certificate at the root of its certificate chain. /// CTL_MODIFY_REQUEST_REMOVE = 2, /// Add the certificate to the CTL. The certificate is explicitly trusted. CTL_MODIFY_REQUEST_ADD_TRUSTED = 3, } /// Flags for CERT_SELECT_STRUCT [PInvokeData("cryptdlg.h", MSDNShortId = "49184872-d636-4e55-8e32-0f38b49b5c21")] [Flags] public enum CertSelectFlags : uint { /// CSS_SELECTCERT_MASK = 0x00ffffff, /// Hide the Properties button. CSS_HIDE_PROPERTIES = 0x00000001, /// Pass a hook procedure in pfnHook. CSS_ENABLEHOOK = 0x00000002, /// Enable multi-selection of certificates. This option is not currently supported and is ignored. CSS_ALLOWMULTISELECT = 0x00000004, /// Show the Help button. CSS_SHOW_HELP = 0x00000010, /// /// Cause CertSelectCertificate function to call the DialogBoxIndirectParam function to create a dialog box. For more /// information, see pTemplateName. /// CSS_ENABLETEMPLATE = 0x00000020, /// /// Cause the CertSelectCertificate function to call the DialogBoxParam function to create a dialog box. For more information, /// see pTemplateName. /// CSS_ENABLETEMPLATEHANDLE = 0x00000040, } /// [PInvokeData("cryptdlg.h", MSDNShortId = "3d18526b-1052-4f0c-999b-881a74a94549")] [Flags] public enum ViewPropertiesFlags : uint { /// CM_VIEWFLAGS_MASK = 0x00ffffff, /// Specifies that a hook function is enabled. CM_ENABLEHOOK = 0x00000001, /// Specifies that a help file is used. CM_SHOW_HELP = 0x00000002, /// Specifies that a help icon is used. CM_SHOW_HELPICON = 0x00000004, /// Specifies that a template is enabled. CM_ENABLETEMPLATE = 0x00000008, /// Specifies that the Advance tab is not displayed. CM_HIDE_ADVANCEPAGE = 0x00000010, /// Specifies that the Trust tab is not displayed. CM_HIDE_TRUSTPAGE = 0x00000020, /// Specifies that the name cannot be changed. CM_NO_NAMECHANGE = 0x00000040, /// Specifies that the trust cannot be edited. CM_NO_EDITTRUST = 0x00000080, /// Specifies that the Detail tab is not displayed. CM_HIDE_DETAILPAGE = 0x00000100, /// Specifies that certificate stores are opened. CM_ADD_CERT_STORES = 0x00000200, /// CERTVIEW_CRYPTUI_LPARAM = 0x00800000, } /// /// /// The CertModifyCertificatesToTrust function modifies the set of certificates in a certificate trust list (CTL) for a given purpose. /// /// /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to /// dynamically link to CryptDlg.dll. /// /// /// The number of modification requests that are in the rgCerts parameter. /// A pointer to a CTL_MODIFY_REQUEST structure that contains an array of modification requests. /// /// A pointer to a null-terminated string that contains the string representation of an object identifier (OID). The OID specifies /// the enhanced key usage (EKU) of the CTL to be modified. /// /// A handle to the parent window of the dialog boxes that this function generates. /// /// A handle to the certificate store in which to modify the list of trusted certificates. If NULL, the Trusted People store /// is used with the Current User location. /// /// /// A pointer to a CERT_CONTEXT structure that contains a certificate. It is used to sign the trust list. The certificate also /// restricts the set of trust lists that may be modified. If NULL, the trust list is not signed. /// /// An HRESULT. A value of S_OK indicates success. // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nf-cryptdlg-certmodifycertificatestotrust CRYPTDLGAPI HRESULT // CertModifyCertificatesToTrust( int cCerts, PCTL_MODIFY_REQUEST rgCerts, LPCSTR szPurpose, HWND hwnd, HCERTSTORE hcertstoreTrust, // PCCERT_CONTEXT pccertSigner ); [DllImport(Lib.CryptDlg, SetLastError = false, ExactSpelling = true)] [PInvokeData("cryptdlg.h", MSDNShortId = "a23d968e-113f-470e-a629-18c22882c77f")] public static extern HRESULT CertModifyCertificatesToTrust(int cCerts, [MarshalAs(UnmanagedType.LPArray)] CTL_MODIFY_REQUEST[] rgCerts, SafeOID szPurpose, HWND hwnd, HCERTSTORE hcertstoreTrust, PCCERT_CONTEXT pccertSigner); /// /// /// The CertSelectCertificate function presents a dialog box that allows the user to select certificates from a set of /// certificates that match the given criteria. /// /// /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to /// dynamically link to CryptDlg.dll. /// /// /// /// A pointer to a CERT_SELECT_STRUCT structure that contains criteria that control the displayed certificates for selection and /// receives the selected certificate. /// /// /// If the function succeeds, the return value is TRUE. /// If the function fails, the return value is FALSE. For extended error information, call the GetLastError function. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nf-cryptdlg-certselectcertificatew CRYPTDLGAPI BOOL // CertSelectCertificateW( IN OUT PCERT_SELECT_STRUCT_W pCertSelectInfo ); [DllImport(Lib.CryptDlg, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("cryptdlg.h", MSDNShortId = "8160ea08-c7c0-40f5-8771-6603f768744b")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CertSelectCertificate(ref CERT_SELECT_STRUCT pCertSelectInfo); /// /// /// [The CertViewProperties function is available for use in the operating systems specified in the Requirements section. It /// may be altered or unavailable in subsequent versions. Instead, use the CryptUIDlgViewContext function.] /// /// /// The CertViewProperties function displays the properties for a certificate in a user interface (UI) dialog box. This /// function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to CryptDlg.dll. /// /// /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to /// dynamically link to CryptDlg.dll. /// /// /// /// A pointer to a CERT_VIEWPROPERTIES_STRUCT structure that contains the information about the certificate to view. /// /// The return value is TRUE if the function is successful; FALSE if the function fails. // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nf-cryptdlg-certviewpropertiesw CRYPTDLGAPI BOOL CertViewPropertiesW( // PCERT_VIEWPROPERTIES_STRUCT_W pCertViewInfo ); [DllImport(Lib.CryptDlg, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("cryptdlg.h", MSDNShortId = "5df840ab-fff6-4c7e-b799-51e4de4c644a")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CertViewProperties(ref CERT_VIEWPROPERTIES_STRUCT pCertViewInfo); /// /// /// [The GetFriendlyNameOfCert function is available for use in the operating systems specified in the Requirements section. /// It may be altered or unavailable in subsequent versions. Instead, use the CertGetNameString function with the /// CERT_NAME_FRIENDLY_DISPLAY_TYPE flag.] /// /// The GetFriendlyNameOfCert function retrieves the display name for a certificate. /// /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to /// dynamically link to CryptDlg.dll. /// /// /// A pointer to the certificate context whose display name is being retrieved. /// A pointer to a character string that receives the display name for the certificate. /// Number of characters allocated for pchBuffer, including the terminating NULL character. /// /// The return value is the number of characters, including the terminating NULL character, in the returned display name. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nf-cryptdlg-getfriendlynameofcerta CRYPTDLGAPI DWORD // GetFriendlyNameOfCertA( PCCERT_CONTEXT pccert, LPSTR pch, DWORD cch ); [DllImport(Lib.CryptDlg, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("cryptdlg.h", MSDNShortId = "a66a8573-b234-4d5d-bd38-72a3a44a0419")] public static extern uint GetFriendlyNameOfCert(PCCERT_CONTEXT pccert, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder pch, uint cch); /// /// /// [The GetFriendlyNameOfCert function is available for use in the operating systems specified in the Requirements section. /// It may be altered or unavailable in subsequent versions. Instead, use the CertGetNameString function with the /// CERT_NAME_FRIENDLY_DISPLAY_TYPE flag.] /// /// The GetFriendlyNameOfCert function retrieves the display name for a certificate. /// /// Note This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to /// dynamically link to CryptDlg.dll. /// /// /// A pointer to the certificate context whose display name is being retrieved. /// A pointer to a character string that receives the display name for the certificate. /// Number of characters allocated for pchBuffer, including the terminating NULL character. /// /// The return value is the number of characters, including the terminating NULL character, in the returned display name. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/nf-cryptdlg-getfriendlynameofcerta CRYPTDLGAPI DWORD // GetFriendlyNameOfCertA( PCCERT_CONTEXT pccert, LPSTR pch, DWORD cch ); [DllImport(Lib.CryptDlg, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("cryptdlg.h", MSDNShortId = "a66a8573-b234-4d5d-bd38-72a3a44a0419")] public static extern uint GetFriendlyNameOfCert(PCCERT_CONTEXT pccert, IntPtr pch, uint cch); /// /// The CERT_SELECT_STRUCT structure contains criteria upon which to select certificates that are presented in a certificate /// selection dialog box. This structure is used in the CertSelectCertificate function. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/ns-cryptdlg-cert_select_struct_w typedef struct tagCSSW { DWORD // dwSize; HWND hwndParent; HINSTANCE hInstance; LPCWSTR pTemplateName; DWORD dwFlags; LPCWSTR szTitle; DWORD cCertStore; HCERTSTORE // *arrayCertStore; LPCSTR szPurposeOid; DWORD cCertContext; PCCERT_CONTEXT *arrayCertContext; LPARAM lCustData; PFNCMHOOKPROC // pfnHook; PFNCMFILTERPROC pfnFilter; LPCWSTR szHelpFileName; DWORD dwHelpId; HCRYPTPROV hprov; } CERT_SELECT_STRUCT_W, *PCERT_SELECT_STRUCT_W; [PInvokeData("cryptdlg.h", MSDNShortId = "49184872-d636-4e55-8e32-0f38b49b5c21")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CERT_SELECT_STRUCT { /// The size, in bytes, of this structure. public uint dwSize; /// A handle to the parent window of any dialog boxes that CertSelectCertificate generates. public HWND hwndParent; /// A handle to the module whose executable file contains the dialog box template. public HINSTANCE hInstance; /// /// /// If the CSS_ENABLETEMPLATE flag is set in the dwFlags member, set pTemplateName to a pointer to a global /// memory object that contains the template that DialogBoxIndirectParam uses to create the dialog box. A dialog box template /// consists of a header that describes the dialog box. The header is followed by one or more additional blocks of data that /// describe each of the controls in the dialog box. The template can use either the standard format or the extended format. /// /// /// If the CSS_ENABLETEMPLATEHANDLE flag is set in dwFlags, pTemplateName specifies the dialog box /// template. pTemplateName is either the pointer to a null-terminated character string that specifies the name of the /// dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the specifies /// a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. One way to /// create this integer value is to use the MAKEINTRESOURCE macro. /// /// [MarshalAs(UnmanagedType.LPTStr)] public string pTemplateName; /// /// This member can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// CSS_HIDE_PROPERTIES /// Hide the Properties button. /// /// /// CSS_ENABLEHOOK /// Pass a hook procedure in pfnHook. /// /// /// CSS_ALLOWMULTISELECT /// Enable multi-selection of certificates. This option is not currently supported and is ignored. /// /// /// CSS_SHOW_HELP /// Show the Help button. /// /// /// CSS_ENABLETEMPLATE /// /// Cause CertSelectCertificate function to call the DialogBoxIndirectParam function to create a dialog box. For more /// information, see pTemplateName. /// /// /// /// CSS_ENABLETEMPLATEHANDLE /// /// Cause the CertSelectCertificate function to call the DialogBoxParam function to create a dialog box. For more information, /// see pTemplateName. /// /// /// /// public CertSelectFlags dwFlags; /// A pointer to a string that contains the text for the title of the dialog box. [MarshalAs(UnmanagedType.LPTStr)] public string szTitle; /// The number of elements in arrayCertStore array. public uint cCertStore; /// /// A pointer to the array of certificate stores that the dialog box enumerates and displays the certificates from. The /// cCertStore member contains the number of elements in this array. /// public IntPtr arrayCertStore; /// /// A pointer to a string representation of an object identifier (OID) for an enhanced key usage (EKU). If an OID is provided, /// only certificates that include this EKU will be displayed. /// public IntPtr szPurposeOid; /// /// The number of elements in the arrayCertContext array. After the CertSelectCertificate function returns, this member /// contains the number of certificates that were selected by the user. Currently, only one certificate can be selected by the user. /// public uint cCertContext; /// /// /// A pointer to an array of CERT_CONTEXT structures. The cCertContext member specifies the number of elements in this /// array. This array must contain at least one element. /// /// /// The certificates represented by these structures are selected when the dialog box displayed by the CertSelectCertificate /// function is initially displayed. Currently, only the first certificate in this array is used. The first certificate in this /// array will be released with the CertFreeCertificateContext function if the CertSelectCertificate function is /// successful. If the first element in this array is NULL, no certificates are initially selected in the dialog box. /// /// /// After the CertSelectCertificate function returns, this array contains the certificates that were selected by the user. /// Currently, only one certificate can be selected by the user. /// /// public IntPtr arrayCertContext; /// /// A pointer to an array of byte values that hold custom data that is passed through to the filter procedure referenced by /// pfnFilter. This custom data is not used by the CertSelectCertificate function. /// public IntPtr lCustData; /// /// A PFNCMHOOKPROC function pointer to the Hook callback function. This function is called before messages are processed by the /// dialog box. For more information, see Hooks. /// public PFNCMHOOKPROC pfnHook; /// /// A PFNCMFILTERPROC function pointer to the filter callback function. This is called to determine which certificates will be /// displayed by the dialog box. /// public PFNCMFILTERPROC pfnFilter; /// A pointer to a null-terminated string that contains the full path to the Help file. [MarshalAs(UnmanagedType.LPTStr)] public string szHelpFileName; /// The context identifier for the topic. For more information, see WinHelp. public uint dwHelpId; /// A handle to the Cryptographic Service Provider (CSP) to use for certificate verification. public HCRYPTPROV hprov; } /// /// /// [The CERT_VIEWPROPERTIES_STRUCT structure is available for use in the operating systems specified in the Requirements /// section. It may be altered or unavailable in subsequent versions.] /// /// /// The CERT_VIEWPROPERTIES_STRUCT structure defines information used when the CertViewProperties function is called to /// display a certificate's properties. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/ns-cryptdlg-cert_viewproperties_struct_a typedef struct // tagCERT_VIEWPROPERTIES_STRUCT_A { DWORD dwSize; HWND hwndParent; HINSTANCE hInstance; DWORD dwFlags; LPCSTR szTitle; // PCCERT_CONTEXT pCertContext; LPSTR *arrayPurposes; DWORD cArrayPurposes; DWORD cRootStores; HCERTSTORE *rghstoreRoots; DWORD // cStores; HCERTSTORE *rghstoreCAs; DWORD cTrustStores; HCERTSTORE *rghstoreTrust; HCRYPTPROV hprov; LPARAM lCustData; DWORD dwPad; // LPCSTR szHelpFileName; DWORD dwHelpId; DWORD nStartPage; DWORD cArrayPropSheetPages; PROPSHEETPAGE *arrayPropSheetPages; } // CERT_VIEWPROPERTIES_STRUCT_A, *PCERT_VIEWPROPERTIES_STRUCT_A; [PInvokeData("cryptdlg.h", MSDNShortId = "3d18526b-1052-4f0c-999b-881a74a94549")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CERT_VIEWPROPERTIES_STRUCT { /// The size, in bytes, of this structure. public uint dwSize; /// A handle to the parent window. public HWND hwndParent; /// A handle to the module instance. public HINSTANCE hInstance; /// /// Bitwise combination of zero or more of the following values. /// /// /// Value /// Meaning /// /// /// CM_ENABLEHOOK 1 (0x1) /// Specifies that a hook function is enabled. /// /// /// CM_SHOW_HELP 2 (0x2) /// Specifies that a help file is used. /// /// /// CM_SHOW_HELPICON 4 (0x4) /// Specifies that a help icon is used. /// /// /// CM_ENABLETEMPLATE 8 (0x8) /// Specifies that a template is enabled. /// /// /// CM_HIDE_ADVANCEPAGE 16 (0x10) /// Specifies that the Advance tab is not displayed. /// /// /// CM_HIDE_TRUSTPAGE 32 (0x20) /// Specifies that the Trust tab is not displayed. /// /// /// CM_NO_NAMECHANGE 64 (0x40) /// Specifies that the name cannot be changed. /// /// /// CM_NO_EDITTRUST 128 (0x80) /// Specifies that the trust cannot be edited. /// /// /// CM_HIDE_DETAILPAGE 256 (0x100) /// Specifies that the Detail tab is not displayed. /// /// /// CM_ADD_CERT_STORES 512 (0x200) /// Specifies that certificate stores are opened. /// /// /// public ViewPropertiesFlags dwFlags; /// A pointer to a null-terminated string for the title of the user interface. [MarshalAs(UnmanagedType.LPTStr)] public string szTitle; /// Certificate context for the certificate to be shown. public PCCERT_CONTEXT pCertContext; /// A pointer to an array of null-terminated strings that specify the certificate purposes. public IntPtr arrayPurposes; /// Number of elements in the arrayPurposes array. If this value is zero, then no trust status is displayed. public uint cArrayPurposes; /// Number of elements in the rghstoreRoots array. public uint cRootStores; /// Array of Root certificate store handles. public IntPtr rghstoreRoots; /// Number of elements in the rghstoreCAs array. public uint cStores; /// Array of other certificate store handles. public IntPtr rghstoreCAs; /// Number of elements in the rghstoreTrust array. public uint cTrustStores; /// Array of trust certificate store handles. public IntPtr rghstoreTrust; /// A handle to the cryptographic service provider (CSP) to use for verification. public HCRYPTPROV hprov; /// Value used for custom data. public IntPtr lCustData; /// Padding location. public uint dwPad; /// A pointer to a null-terminated string for the Help file name. [MarshalAs(UnmanagedType.LPTStr)] public string szHelpFileName; /// ID for the Help file topic. public uint dwHelpId; /// Number of the first property page. public uint nStartPage; /// Number of elements in the arrayPropSheetPages array. public uint cArrayPropSheetPages; /// A pointer to an array of PROPSHEETPAGE structures that specify the property pages. public IntPtr arrayPropSheetPages; } /// /// The CTL_MODIFY_REQUEST structure contains a request to modify a certificate trust list (CTL). This structure is used in /// the CertModifyCertificatesToTrust function. /// // https://docs.microsoft.com/en-us/windows/win32/api/cryptdlg/ns-cryptdlg-ctl_modify_request typedef struct _CTL_MODIFY_REQUEST { // PCCERT_CONTEXT pccert; DWORD dwOperation; DWORD dwError; } CTL_MODIFY_REQUEST, *PCTL_MODIFY_REQUEST; [PInvokeData("cryptdlg.h", MSDNShortId = "b8b5fd3e-a0db-4edd-84c7-48bae9adc3f8")] [StructLayout(LayoutKind.Sequential)] public struct CTL_MODIFY_REQUEST { /// A pointer to a CERT_CONTEXT structure that contains the certificate to change the trust on. public PCCERT_CONTEXT pccert; /// /// The operation to be performed. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// CTL_MODIFY_REQUEST_ADD_TRUSTED /// Add the certificate to the CTL. The certificate is explicitly trusted. /// /// /// CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED /// Add the certificate to the Untrusted Certificates certificate store. The certificate is explicitly not trusted. /// /// /// CTL_MODIFY_REQUEST_REMOVE /// /// Remove the certificate from the CTL. The certificate is neither explicitly trusted nor untrusted. To be trusted, the /// certificate must have a trusted root certificate at the root of its certificate chain. /// /// /// /// public CertModifyCertificatesOp dwOperation; /// The error code generated for this operation. public uint dwError; } } }