The TS_UD_CS_CORE data block contains core client connection-related information.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_1_3_2.xml
        /// <summary>
        /// Parse TS_UD_CS_CORE
        /// (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_UD_CS_CORE</returns>
        private TS_UD_CS_CORE ParseTsUdCsCore(byte[] data, ref int currentIndex, int length)
        {
            int endIndex = currentIndex + length - 1;

            TS_UD_CS_CORE coreData = new TS_UD_CS_CORE();
            coreData.header.type = (TS_UD_HEADER_type_Values)ParseUInt16(data, ref currentIndex, false);
            coreData.header.length = ParseUInt16(data, ref currentIndex, false);
            coreData.version = (version_Values)ParseUInt32(data, ref currentIndex, false);
            coreData.desktopWidth = ParseUInt16(data, ref currentIndex, false);
            coreData.desktopHeight = ParseUInt16(data, ref currentIndex, false);
            coreData.colorDepth = (colorDepth_Values)ParseUInt16(data, ref currentIndex, false);
            coreData.SASSequence = ParseUInt16(data, ref currentIndex, false);
            coreData.keyboardLayout = ParseUInt32(data, ref currentIndex, false);
            coreData.clientBuild = ParseUInt32(data, ref currentIndex, false);
            coreData.clientName = ParseString(data, ref currentIndex, 32);
            coreData.keyboardType = (keyboardType_Values)ParseUInt32(data, ref currentIndex, false);
            coreData.keyboardSubType = ParseUInt32(data, ref currentIndex, false);
            coreData.keyboardFunctionKey = ParseUInt32(data, ref currentIndex, false);
            coreData.imeFileName = ParseString(data, ref currentIndex, 64);
            //below fields are optional fields, verify the length before parsing.
            if(currentIndex < endIndex)
                coreData.postBeta2ColorDepth = new UInt16Class(ParseUInt16(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.clientProductId = new UInt16Class(ParseUInt16(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.serialNumber = new UInt32Class(ParseUInt32(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.highColorDepth = new UInt16Class(ParseUInt16(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.supportedColorDepths = new UInt16Class(ParseUInt16(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.earlyCapabilityFlags = new UInt16Class(ParseUInt16(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.clientDigProductId = ParseString(data, ref currentIndex, 64);
            if (currentIndex < endIndex)
                coreData.connnectionType = new ByteClass(ParseByte(data, ref currentIndex));
            if (currentIndex < endIndex)
                coreData.pad1octets = new ByteClass(ParseByte(data, ref currentIndex));
            if (currentIndex < endIndex)
                coreData.serverSelectedProtocol = new UInt32Class(ParseUInt32(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.desktopPhysicalWidth = new UInt32Class(ParseUInt32(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.desktopPhysicalHeight = new UInt32Class(ParseUInt32(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.desktopOrientation = (TS_UD_CS_CORE_desktopOrientation_values)ParseUInt16(data, ref currentIndex, false);
            if (currentIndex < endIndex)
                coreData.desktopScaleFactor = new UInt32Class(ParseUInt32(data, ref currentIndex, false));
            if (currentIndex < endIndex)
                coreData.deviceScaleFactor = new UInt32Class(ParseUInt32(data, ref currentIndex, false));

            return coreData;
        }
        public void VerifyStructure(TS_UD_CS_CORE core)
        {
            Site.CaptureRequirementIfIsTrue(core.header.type == TS_UD_HEADER_type_Values.CS_CORE,
                    93,
                    "In Client Core Data, The User Data Header type field MUST be set to CS_CORE (0xC001).");
            //<capture> also capture 97
            Site.CaptureRequirementIfIsTrue(core.version == version_Values.V1 || core.version == version_Values.V2 || core.version == version_Values.V3 || core.version == version_Values.V4 || core.version == version_Values.V5,
                98,
                "In Client Core Data, for RDP 4.0 clients, the major version number will be 0x00080001.");
            Site.CaptureRequirementIfIsTrue(core.desktopWidth >= 0,
                100,
                "In Client Core Data, desktopWidth must be positive.");
            Site.CaptureRequirementIfIsTrue(core.desktopHeight >= 0,
                103,
                "In Client Core Data, desktopHeight must be positive.");
            Site.CaptureRequirementIfIsTrue((int)core.colorDepth == 51712 || core.colorDepth == colorDepth_Values.RNS_UD_COLOR_8BPP,
                107,
                "In Client Core Data (TS_UD_CS_CORE), colorDepth (2 bytes): colorDepth field can have the following "
                + @"values :\r\n1.RNS_UD_COLOR_4BPP 0xCA00.\r\n2.RNS_UD_COLOR_8BPP 0xCA01.");
            Site.CaptureRequirementIfIsTrue(core.SASSequence == 0xAA03,
                111,
                "In Client Core Data, SASSequence SHOULD be set to RNS_UD_SAS_DEL (0xAA03).");
            Site.CaptureRequirementIfIsTrue(core.clientName.Length <= 15,
                118,
                "In Client Core Data,  clientName field contains up to 15 Unicode characters plus a null terminator.");
            Site.CaptureRequirementIfIsTrue(core.keyboardType >= keyboardType_Values.None && core.keyboardType <= keyboardType_Values.V7,
                120,
                "In Client Core Data,  keyboardType can take one of the following values:");
            Site.CaptureRequirementIfIsTrue(core.imeFileName.Length <= 31,
                133,
                "In Client Core Data, the imeFileName field contains up to 31 Unicode characters plus a null terminator.");
            bool isR136Satisfied = (postBeta2ColorDepth_Values)core.postBeta2ColorDepth.actualData == postBeta2ColorDepth_Values.RNS_UD_COLOR_4BPP || (postBeta2ColorDepth_Values)core.postBeta2ColorDepth.actualData == postBeta2ColorDepth_Values.RNS_UD_COLOR_8BPP
                || (postBeta2ColorDepth_Values)core.postBeta2ColorDepth.actualData == postBeta2ColorDepth_Values.RNS_UD_COLOR_16BPP_555 || (postBeta2ColorDepth_Values)core.postBeta2ColorDepth.actualData == postBeta2ColorDepth_Values.RNS_UD_COLOR_16BPP_565
                || (postBeta2ColorDepth_Values)core.postBeta2ColorDepth.actualData == postBeta2ColorDepth_Values.RNS_UD_COLOR_24BPP;
            site.CaptureRequirementIfIsTrue(isR136Satisfied, 136,
                @"In Client Core Data, postBeta2ColorDepth can take one of the following values: RNS_UD_COLOR_4BPP 0xCA00,"
                + @" RNS_UD_COLOR_8BPP 0xCA01, RNS_UD_COLOR_16BPP_555 0xCA02, RNS_UD_COLOR_16BPP_565 0xCA03, RNS_UD_COLOR_24BPP 0xCA04");
            Site.CaptureRequirementIfIsTrue((int)core.clientProductId.actualData == 1, 145,
                "In Client Core Data,  clientProductId SHOULD be initialized to 1.");
            Site.CaptureRequirementIfAreEqual<int>(0, (int)core.serialNumber.actualData, 149,
                "In Client Core Data, serialNumber SHOULD be initialized to 0. ");
            bool isR154Satisfied = (highColorDepth_Values)core.highColorDepth.actualData == highColorDepth_Values.V1 || (highColorDepth_Values)core.highColorDepth.actualData == highColorDepth_Values.V2
                || (highColorDepth_Values)core.highColorDepth.actualData == highColorDepth_Values.V3 || (highColorDepth_Values)core.highColorDepth.actualData == highColorDepth_Values.V4
                || (highColorDepth_Values)core.highColorDepth.actualData == highColorDepth_Values.V5;
            site.CaptureRequirementIfIsTrue(isR154Satisfied, 154,
                @"In Client Core Data, highColorDepth can have one of the following values 4,8,15,16,24");

            site.CaptureRequirementIfIsTrue(core.supportedColorDepths.actualData <= 15, 164,
                @"In Client Core Data, supportedColorDepths can have one of the following values RNS_UD_24BPP_SUPPORT 0x0001, "
                + @"RNS_UD_16BPP_SUPPORT 0x0002, RNS_UD_15BPP_SUPPORT 0x0004, RNS_UD_32BPP_SUPPORT 0x0008");

            ushort earlyCapabilityFlags = (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_ERRINFO_PDU | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_WANT_32BPP_SESSION
                | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_STATUSINFO_PDU | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_STRONG_ASYMMETRIC_KEYS | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_UNUSED | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_VALID_CONNECTION_TYPE | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU
                | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE | (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_HEARTBEAT_PDU;
            ushort negEarlyCapabilityFlags =  (ushort)~earlyCapabilityFlags;
            bool isR173Satisfy = ((ushort)core.earlyCapabilityFlags.actualData & negEarlyCapabilityFlags) == 0;

            site.CaptureRequirementIfIsTrue(isR173Satisfy, 173,
                    @"[In Client Core Data (TS_UD_CS_CORE)] earlyCapabilityFlags (2 bytes):In Client Core Data, the earlyCapabilityFlags"
                    + @" can be any of the following values: RNS_UD_CS_SUPPORT_ERRINFO_PDU 0x0001, RNS_UD_CS_WANT_32BPP_SESSION 0x0002, "
                    + @"RNS_UD_CS_SUPPORT_STATUSINFO_PDU 0x0004, RNS_UD_CS_STRONG_ASYMMETRIC_KEYS 0x0008, RNS_UD_CS_VALID_CONNECTION_TYPE"
                    + @" 0x0020, RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040");
        }
Esempio n. 3
0
 public ConnectGCC()
 {
     clientCoreData = new TS_UD_CS_CORE();
     clientSecurityData = new TS_UD_CS_SEC();
 }