public override bool Decode(PduMarshaler marshaler) { try { byte actionFlags = marshaler.ReadByte(); this.Action = (RDP_TUNNEL_ACTION_Values)(byte)(actionFlags & 0xF); this.Flags = (byte)(actionFlags & 0xF0); this.PayloadLength = marshaler.ReadUInt16(); this.HeaderLength = marshaler.ReadByte(); if (this.HeaderLength > 4) { int subHdTotalLen = this.HeaderLength - 4; int curDecodedLen = 0; List <RDP_TUNNEL_SUBHEADER> subHds = new List <RDP_TUNNEL_SUBHEADER>(); while (subHdTotalLen > curDecodedLen) { byte subHdLen = marshaler.ReadByte(); byte subHdType = marshaler.ReadByte(); byte[] subHdData = null; if (subHdLen > 2) { subHdData = marshaler.ReadBytes(subHdLen - 2); } RDP_TUNNEL_SUBHEADER subHd = new RDP_TUNNEL_SUBHEADER(); subHd.SubHeaderLength = subHdLen; subHd.SubHeaderType = (RDP_TUNNEL_SUBHEADER_TYPE_Values)subHdType; subHd.SubHeaderData = subHdData; subHds.Add(subHd); curDecodedLen += subHdLen; } this.SubHeaders = subHds.ToArray(); } return(true); } catch { return(false);; } }
public override bool Decode(PduMarshaler marshaler) { try { byte actionFlags = marshaler.ReadByte(); this.Action = (RDP_TUNNEL_ACTION_Values)(byte)(actionFlags & 0xF); this.Flags = (byte)(actionFlags & 0xF0); this.PayloadLength = marshaler.ReadUInt16(); this.HeaderLength = marshaler.ReadByte(); if (this.HeaderLength > 4) { int subHdTotalLen = this.HeaderLength - 4; int curDecodedLen = 0; List<RDP_TUNNEL_SUBHEADER> subHds = new List<RDP_TUNNEL_SUBHEADER>(); while (subHdTotalLen > curDecodedLen) { byte subHdLen = marshaler.ReadByte(); byte subHdType = marshaler.ReadByte(); byte[] subHdData = null; if (subHdLen > 2) { subHdData = marshaler.ReadBytes(subHdLen - 2); } RDP_TUNNEL_SUBHEADER subHd = new RDP_TUNNEL_SUBHEADER(); subHd.SubHeaderLength = subHdLen; subHd.SubHeaderType = (RDP_TUNNEL_SUBHEADER_TYPE_Values)subHdType; subHd.SubHeaderData = subHdData; subHds.Add(subHd); curDecodedLen += subHdLen; } this.SubHeaders = subHds.ToArray(); } return true; } catch { return false; ; } }