The Set Surface Bits Command is used to transport encoded bitmap data destined for a rectangular region of the current target surface from an RDP server to an RDP client.
Inheritance: TS_SURFCMD
        /// <summary>
        /// Parse TS_SURFCMD_SET_SURF_BITS
        /// (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_SURFCMD_SET_SURF_BITS</returns>
        private TS_SURFCMD_SET_SURF_BITS ParseTsSurfCmdSetSurfBits(byte[] data, ref int currentIndex)
        {
            TS_SURFCMD_SET_SURF_BITS bits = new TS_SURFCMD_SET_SURF_BITS();

            // TS_SURFCMD_SET_SURF_BITS: cmdType
            bits.cmdType = (cmdType_Values)ParseUInt32(data, ref currentIndex, false);

            // TS_SURFCMD_SET_SURF_BITS: destLeft
            bits.destLeft = ParseUInt16(data, ref currentIndex, false);

            // TS_SURFCMD_SET_SURF_BITS: destTop
            bits.destTop = ParseUInt16(data, ref currentIndex, false);

            // TS_SURFCMD_SET_SURF_BITS: destRight
            bits.destRight = ParseUInt16(data, ref currentIndex, false);

            // TS_SURFCMD_SET_SURF_BITS: destBottom
            bits.destBottom = ParseUInt16(data, ref currentIndex, false);

            // TS_SURFCMD_SET_SURF_BITS: bitmapData
            bits.bitmapData = ParseTsBitmapDataEx(data, ref currentIndex);

            return bits;
        }
Exemplo n.º 2
0
        private byte[] EncodeSurfBits(TS_SURFCMD_SET_SURF_BITS surfBitsData)
        {
            List<byte> buffer = new List<byte>();

            RdpbcgrEncoder.EncodeStructure(buffer, (ushort)surfBitsData.cmdType);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destLeft);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destTop);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destRight);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destBottom);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.bpp);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.reserved1);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.reserved2);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.codecID);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.width);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.height);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.bitmapDataLength);
            if (surfBitsData.bitmapData.bitmapData != null)
            {
                RdpbcgrEncoder.EncodeBytes(buffer, surfBitsData.bitmapData.bitmapData);
            }

            return buffer.ToArray();
        }
        public static TS_FP_SURFCMDS CreateFPSurfCmds(TS_SURFCMD_SET_SURF_BITS setSurfBits)
        {
            TS_FP_SURFCMDS surfCmds = new TS_FP_SURFCMDS();

            surfCmds.updateHeader = (byte)(((int)updateCode_Values.FASTPATH_UPDATETYPE_SURFCMDS & 0x0f)
                | (((int)fragmentation_Value.FASTPATH_FRAGMENT_SINGLE) << 4)
                | ((int)compressedType_Values.None << 6));
            surfCmds.compressionFlags = compressedType_Values.None;
            surfCmds.surfaceCommands = new TS_SURFCMD[1];
            surfCmds.surfaceCommands[0] = setSurfBits;
            surfCmds.size = (ushort)(22 + setSurfBits.bitmapData.bitmapDataLength);

            return surfCmds;
        }
        public static TS_SURFCMD_SET_SURF_BITS CreateSurfCmdSetSurfBits(ushort left, ushort top, ushort width, ushort height)
        {
            TS_SURFCMD_SET_SURF_BITS setSurfBits = new TS_SURFCMD_SET_SURF_BITS();

            setSurfBits.cmdType = cmdType_Values.CMDTYPE_SET_SURFACE_BITS;
            setSurfBits.destLeft = left;
            setSurfBits.destTop = top;
            setSurfBits.destRight = (ushort)(setSurfBits.destLeft + width-1);
            setSurfBits.destBottom = (ushort)(setSurfBits.destTop + height -1);
            setSurfBits.bitmapData.bpp = 16;
            setSurfBits.bitmapData.codecID = 0;
            setSurfBits.bitmapData.width = width;
            setSurfBits.bitmapData.height = height;
            setSurfBits.bitmapData.bitmapDataLength = (ushort)((width * 2 + 3) / 4 * 4 * height);
            setSurfBits.bitmapData.bitmapData = new byte[setSurfBits.bitmapData.bitmapDataLength];
            for (int i = 0; i < setSurfBits.bitmapData.bitmapDataLength; i++)
                setSurfBits.bitmapData.bitmapData[i] = 0x67;

            return setSurfBits;
        }
Exemplo n.º 5
0
        private byte[] EncodeSurfBits(TS_SURFCMD_SET_SURF_BITS surfBitsData)
        {
            List<byte> buffer = new List<byte>();

            RdpbcgrEncoder.EncodeStructure(buffer, (ushort)surfBitsData.cmdType);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destLeft);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destTop);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destRight);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.destBottom);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.bpp);
            RdpbcgrEncoder.EncodeStructure(buffer, (byte)surfBitsData.bitmapData.flags);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.reserved);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.codecID);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.width);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.height);
            RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.bitmapDataLength);
            if (surfBitsData.bitmapData.exBitmapDataHeader != null)
            {
                RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.exBitmapDataHeader.highUniqueId);
                RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.exBitmapDataHeader.lowUniqueId);
                RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.exBitmapDataHeader.tmMilliseconds);
                RdpbcgrEncoder.EncodeStructure(buffer, surfBitsData.bitmapData.exBitmapDataHeader.tmSeconds);
            }
            if (surfBitsData.bitmapData.bitmapData != null)
            {
                RdpbcgrEncoder.EncodeBytes(buffer, surfBitsData.bitmapData.bitmapData);
            }

            return buffer.ToArray();
        }