using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class Secur32 { /// The CREDSPP_SUBMIT_TYPE enumeration specifies the type of credentials specified by a CREDSSP_CRED structure. // https://docs.microsoft.com/en-us/windows/desktop/api/credssp/ne-credssp-_credssp_submit_type typedef enum _CREDSSP_SUBMIT_TYPE { // CredsspPasswordCreds, CredsspSchannelCreds, CredsspCertificateCreds, CredsspSubmitBufferBoth, CredsspSubmitBufferBothOld, // CredsspCredEx } CREDSPP_SUBMIT_TYPE; [PInvokeData("credssp.h", MSDNShortId = "d30e219b-ea39-41da-b714-3ceb13a5614d")] public enum CREDSSP_SUBMIT_TYPE { /// The credentials are a user name and password. CredsspPasswordCreds = 2, /// The credentials are Schannel credentials. CredsspSchannelCreds = 4, /// The credentials are in a certificate. CredsspCertificateCreds = 13, /// The credentials contain both certificate and Schannel credentials. CredsspSubmitBufferBoth = 50, /// CredsspSubmitBufferBothOld = 51, /// CredsspCredEx = 100, } /// The CREDSSP_CRED structure specifies authentication data for both Schannel and Negotiate security packages. // https://docs.microsoft.com/en-us/windows/desktop/api/credssp/ns-credssp-_credssp_cred typedef struct _CREDSSP_CRED { // CREDSPP_SUBMIT_TYPE Type; PVOID pSchannelCred; PVOID pSpnegoCred; } CREDSSP_CRED, *PCREDSSP_CRED; [PInvokeData("credssp.h", MSDNShortId = "b22bd22c-e6e1-4817-b5cf-ab49f574e75f")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CREDSSP_CRED { /// The CREDSPP_SUBMIT_TYPE enumeration value that specifies the type of credentials contained in this structure. public CREDSSP_SUBMIT_TYPE Type; /// A pointer to a set of Schannel credentials. public IntPtr pSchannelCred; /// A pointer to a set of Negotiate credentials. public IntPtr pSpnegoCred; } /// The CREDSSP_CRED_EX structure specifies authentication data for both Schannel and Negotiate security packages. // https://docs.microsoft.com/en-us/windows/desktop/api/credssp/ns-credssp-_credssp_cred typedef struct _CREDSSP_CRED { [PInvokeData("credssp.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CREDSSP_CRED_EX { /// The CREDSPP_SUBMIT_TYPE enumeration value that specifies the type of credentials contained in this structure. public CREDSSP_SUBMIT_TYPE Type; /// public uint Version; /// public uint Flags; /// public uint Reserved; /// public CREDSSP_CRED Cred; } /// /// /// The SecPkgContext_ClientCreds structure specifies client credentials when calling the QueryContextAttributes (CredSSP) function. /// /// This structure is supported only on the server. /// // https://docs.microsoft.com/en-us/windows/desktop/api/credssp/ns-credssp-_secpkgcontext_clientcreds typedef struct // _SecPkgContext_ClientCreds { ULONG AuthBufferLen; PUCHAR AuthBuffer; } SecPkgContext_ClientCreds, *PSecPkgContext_ClientCreds; [PInvokeData("credssp.h", MSDNShortId = "85ab1bf7-a4d9-4b0e-b1e3-cb938c3183d3")] [StructLayout(LayoutKind.Sequential)] public struct SecPkgContext_ClientCreds { /// The size, in characters, of the AuthBuffer buffer. public uint AuthBufferLen; /// A pointer to a buffer that represents the client credentials. public IntPtr AuthBuffer; } } }