The Pointer Update PDU is sent from server to client and is used to convey pointer information, including pointers' bitmap images, use of system or hidden pointers, use of cached cursors and position updates.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_8_1_1_4.xml
Inheritance: RdpbcgrSlowPathUpdatePdu
        /// <summary>
        /// Parse Slow-Path Pointer Update PDU
        /// </summary>
        /// <param name="updateData">update data (decompressed if were compressed</param>
        /// <param name="shareDataHeader">share data header</param>
        /// <returns>Slow-Path Pointer Update PDU</returns>
        public TS_POINTER_PDU ParseTsPointerPdu(
            byte[] updateData,
            TS_SHAREDATAHEADER shareDataHeader)
        {
            // index of update data
            int index = 0;
            TS_POINTER_PDU pdu = new TS_POINTER_PDU();

            // TS_POINTER_PDU: shareDataHeader
            pdu.shareDataHeader = shareDataHeader;

            // TS_POINTER_PDU: messageType
            pdu.messageType = ParseUInt16(updateData, ref index, false);

            // TS_POINTER_PDU: pad2Octets
            pdu.pad2Octets = ParseUInt16(updateData, ref index, false);

            // TS_POINTER_PDU: pointerAttributeData
            int remainLength = updateData.Length - index;
            switch (pdu.messageType)
            {
                // TS_PTRMSGTYPE_SYSTEM: 4 bytes
                case (ushort)TS_POINTER_PDU_messageType_Values.TS_PTRMSGTYPE_SYSTEM:
                    pdu.pointerAttributeData = GetBytes(updateData, ref index,
                        ConstValue.TS_PTRMSGTYPE_SYSTEM_DATA_LENGTH);
                    break;

                // TS_PTRMSGTYPE_POSITION: 4 bytes
                case (ushort)TS_POINTER_PDU_messageType_Values.TS_PTRMSGTYPE_POSITION:
                    pdu.pointerAttributeData = GetBytes(updateData, ref index,
                        ConstValue.TS_PTRMSGTYPE_POSITION_DATA_LENGTH);
                    break;

                // TS_PTRMSGTYPE_COLOR: variable number of bytes
                case (ushort)TS_POINTER_PDU_messageType_Values.TS_PTRMSGTYPE_COLOR:
                    pdu.pointerAttributeData = GetBytes(updateData, ref index, remainLength);
                    break;

                // TS_PTRMSGTYPE_CACHED: 2 bytes
                case (ushort)TS_POINTER_PDU_messageType_Values.TS_PTRMSGTYPE_CACHED:
                    pdu.pointerAttributeData = GetBytes(updateData, ref index,
                        ConstValue.TS_PTRMSGTYPE_CACHED_DATA_LENGTH);
                    break;

                // TS_PTRMSGTYPE_POINTER: variable number of bytes
                case (ushort)TS_POINTER_PDU_messageType_Values.TS_PTRMSGTYPE_POINTER:
                    pdu.pointerAttributeData = GetBytes(updateData, ref index, remainLength);
                    break;

                default:
                    throw new FormatException(ConstValue.ERROR_MESSAGE_ENUM_UNRECOGNIZED);
            }

            // Check if data length exceeded expectation
            VerifyDataLength(updateData.Length, index, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
            return pdu;
        }
示例#2
0
        private byte[] EncodePtr(TS_POINTER_PDU ptrData)
        {
            List<byte> totalBuffer = new List<byte>();

            RdpbcgrEncoder.EncodeStructure(totalBuffer, ptrData.shareDataHeader);

            List<byte> buffer = new List<byte>();
            RdpbcgrEncoder.EncodeStructure(buffer, (ushort)ptrData.messageType);
            RdpbcgrEncoder.EncodeStructure(buffer, ptrData.pad2Octets);
            if (ptrData.pointerAttributeData.GetType() == typeof(byte[]))
            {
                RdpbcgrEncoder.EncodeBytes(buffer, (byte[])ptrData.pointerAttributeData);
            }
            else
            {
                RdpbcgrEncoder.EncodeStructure(buffer, ptrData.pointerAttributeData);
            }

            if (ptrData.shareDataHeader.compressedType != compressedType_Values.None)
            {
                RdpbcgrEncoder.EncodeBytes(
                    totalBuffer, serverSessionContext.Compress(ptrData.shareDataHeader.compressedType, buffer.ToArray()));
            }
            else
            {
                RdpbcgrEncoder.EncodeBytes(totalBuffer, buffer.ToArray());
            }
            return totalBuffer.ToArray();
        }