Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpbcgr.RdpbcgrDecoder.DecodeVirtualChannelPDU C# (CSharp) Method

DecodeVirtualChannelPDU() public method

Decode Virtual Channel PDU
public DecodeVirtualChannelPDU ( byte data, byte decryptedUserData, SecurityHeaderType type ) : StackPacket
data byte data to be parsed
decryptedUserData byte decrypted user data
type SecurityHeaderType security header type
return StackPacket
        public StackPacket DecodeVirtualChannelPDU(
            byte[] data,
            byte[] decryptedUserData,
            SecurityHeaderType type)
        {
            Virtual_Channel_RAW_Server_Pdu pdu = new Virtual_Channel_RAW_Server_Pdu();

            // data index
            int dataIndex = 0;

            // Virtual_Channel_RAW_Pdu: commonHeader
            pdu.commonHeader = ParseMcsCommonHeader(data, ref dataIndex, type);

            // user data index
            int userDataIndex = 0;

            // Virtual_Channel_RAW_PDU: channelPduHeader
            pdu.channelPduHeader = ParseChannelPduHeader(decryptedUserData, ref userDataIndex);

            // Virtual_Channel_RAW_PDU: virtualChannelData
            int remainLength = decryptedUserData.Length - Marshal.SizeOf(pdu.channelPduHeader);
            pdu.virtualChannelData = GetBytes(decryptedUserData, ref userDataIndex, remainLength);

            // Check if data length exceeded expectation
            VerifyDataLength(decryptedUserData.Length, userDataIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
            return pdu;
        }
RdpbcgrDecoder