file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_8_3_1_1_3.xml
        /// <summary>
        /// Parse TS_LOGON_INFO_EXTENDED
        /// (parser index is updated according to parsed length)
        /// </summary>
        /// <param name="data">data to be parsed</param>
        /// <param name="currentIndex">current parser index</param>
        /// <returns>TS_LOGON_INFO_EXTENDED</returns>
        private TS_LOGON_INFO_EXTENDED ParseTsLogonInfoExtended(byte[] data, ref int currentIndex)
        {
            TS_LOGON_INFO_EXTENDED info = new TS_LOGON_INFO_EXTENDED();

            // TS_LOGON_INFO_EXTENDED: Length
            info.Length = ParseUInt16(data, ref currentIndex, false);

            // TS_LOGON_INFO_EXTENDED: FieldsPresent
            info.FieldsPresent = (FieldsPresent_Values)ParseUInt32(data, ref currentIndex, false);

            // TS_LOGON_INFO_EXTENDED: LogonFields
            info.LogonFields = ParseTsLogonInfoFields(data, ref currentIndex, info.FieldsPresent);

            // TS_LOGON_INFO_EXTENDED: Pad
            info.Pad = GetBytes(data, ref currentIndex, ConstValue.TS_LOGON_INFO_EXTENDED_PAD_LENGTH);

            return info;
        }
示例#2
0
        private byte[] EncodeLogonExtended(TS_LOGON_INFO_EXTENDED logonInfo)
        {
            List<byte> dataBuffer = new List<byte>();
            RdpbcgrEncoder.EncodeStructure(dataBuffer, logonInfo.Length);
            RdpbcgrEncoder.EncodeStructure(dataBuffer, (uint)logonInfo.FieldsPresent);
            for (int i = 0; i < logonInfo.LogonFields.Length; ++i)
            {
                if (logonInfo.LogonFields[i].FieldData.GetType() == typeof(TS_LOGON_ERRORS_INFO))
                {
                    RdpbcgrEncoder.EncodeStructure(dataBuffer, logonInfo.LogonFields[i].cbFieldData);
                    RdpbcgrEncoder.EncodeStructure(dataBuffer,
                        (uint)((TS_LOGON_ERRORS_INFO)logonInfo.LogonFields[i].FieldData).ErrorNotificationType);
                    RdpbcgrEncoder.EncodeStructure(dataBuffer,
                        ((TS_LOGON_ERRORS_INFO)logonInfo.LogonFields[i].FieldData).ErrorNotificationData);
                }
                else if (logonInfo.LogonFields[i].FieldData.GetType() == typeof(ARC_SC_PRIVATE_PACKET))
                {
                    RdpbcgrEncoder.EncodeStructure(dataBuffer, logonInfo.LogonFields[i].cbFieldData);
                    RdpbcgrEncoder.EncodeStructure(dataBuffer,
                        (uint)((ARC_SC_PRIVATE_PACKET)logonInfo.LogonFields[i].FieldData).cbLen);
                    RdpbcgrEncoder.EncodeStructure(dataBuffer,
                        (uint)((ARC_SC_PRIVATE_PACKET)logonInfo.LogonFields[i].FieldData).Version);
                    RdpbcgrEncoder.EncodeStructure(dataBuffer,
                        ((ARC_SC_PRIVATE_PACKET)logonInfo.LogonFields[i].FieldData).LogonId);
                    RdpbcgrEncoder.EncodeBytes(dataBuffer,
                        ((ARC_SC_PRIVATE_PACKET)logonInfo.LogonFields[i].FieldData).ArcRandomBits);
                }
            }
            RdpbcgrEncoder.EncodeBytes(dataBuffer, logonInfo.Pad);

            return dataBuffer.ToArray();
        }