/// <summary>
        /// Creates an UpnDnsInfo instance using the specified flag, upn and dnsDomain.
        /// </summary>
        /// <param name="flag">U means The user account object does not have the
        /// userPrincipalName attribute ([MS-ADA3] section 2.348) set.</param>
        /// <param name="upn">The UPN information.</param>
        /// <param name="dnsDomain">The DNS information.</param>
        /// <returns>The created UpnDnsInfo instance.</returns>
        public static UpnDnsInfo CreateUpnDnsInfoBuffer(UPN_DNS_INFO_Flags_Values flag, string upn, string dnsDomain)
        {
            UpnDnsInfo upnDnsInfo = new UpnDnsInfo();

            upnDnsInfo.NativeUpnDnsInfo.Flags = flag;

            upnDnsInfo.Upn       = upn;
            upnDnsInfo.DnsDomain = dnsDomain;

            return(upnDnsInfo);
        }
        /// <summary>
        /// Create an instance of current class according to specified ulType_Values.
        /// </summary>
        /// <param name="ulType">The specified ulType_Values.</param>
        /// <returns>The created instance of current class.</returns>
        private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType)
        {
            PacInfoBuffer pacInfoBuffer;

            switch (ulType)
            {
            case PAC_INFO_BUFFER_Type_Values.LogonInformation:
                pacInfoBuffer = new KerbValidationInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.CredentialsInformation:
                pacInfoBuffer = new PacCredentialInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.ServerChecksum:
                pacInfoBuffer = new PacServerSignature();
                break;

            case PAC_INFO_BUFFER_Type_Values.KdcChecksum:
                pacInfoBuffer = new PacKdcSignature();
                break;

            case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation:
                pacInfoBuffer = new PacClientInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation:
                pacInfoBuffer = new S4uDelegationInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation:
                pacInfoBuffer = new UpnDnsInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation:
                pacInfoBuffer = new ClientClaimsInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo:
                pacInfoBuffer = new PacDeviceInfo();
                break;

            case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation:
                pacInfoBuffer = new DeviceClaimsInfo();
                break;

            default:
                throw new ArgumentOutOfRangeException("ulType");
            }
            return(pacInfoBuffer);
        }
        /// <summary>
        /// Create an instance of current class according to specified ulType_Values.
        /// </summary>
        /// <param name="ulType">The specified ulType_Values.</param>
        /// <returns>The created instance of current class.</returns>
        private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType)
        {
            PacInfoBuffer pacInfoBuffer;
            switch (ulType)
            {
                case PAC_INFO_BUFFER_Type_Values.LogonInformation:
                    pacInfoBuffer = new KerbValidationInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.CredentialsInformation:
                    pacInfoBuffer = new PacCredentialInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.ServerChecksum:
                    pacInfoBuffer = new PacServerSignature();
                    break;

                case PAC_INFO_BUFFER_Type_Values.KdcChecksum:
                    pacInfoBuffer = new PacKdcSignature();
                    break;

                case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation:
                    pacInfoBuffer = new PacClientInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation:
                    pacInfoBuffer = new S4uDelegationInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation:
                    pacInfoBuffer = new UpnDnsInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation:
                    pacInfoBuffer = new ClientClaimsInfo();
                    break;

                case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo:
                    pacInfoBuffer = new PacDeviceInfo();
                    break;
                case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation:
                    pacInfoBuffer = new DeviceClaimsInfo();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("ulType");
            }
            return pacInfoBuffer;
        }