/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { offset = marshaler.ReadUInt32(); length = marshaler.ReadUInt32(); status = (USBD_STATUS)marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU to the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to Decode the fields of this PDU.</param> /// <returns></returns> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); MaxNumMonitors = marshaler.ReadUInt32(); MaxMonitorAreaFactorA = marshaler.ReadUInt32(); MaxMonitorAreaFactorB = marshaler.ReadUInt32(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); frameNumber = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { if (!base.Decode(marshaler)) return false; this.magic = marshaler.ReadUInt32(); this.version = marshaler.ReadUInt16(); this.decodedLen += 6; return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
public override bool Decode(PduMarshaler marshaler) { try { fecHeader.snSourceAck = marshaler.ReadUInt32(); fecHeader.uReceiveWindowSize = marshaler.ReadUInt16(); fecHeader.uFlags = (RDPUDP_FLAG)marshaler.ReadUInt16(); if (fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_SYN)) { RDPUDP_SYNDATA_PAYLOAD synData = new RDPUDP_SYNDATA_PAYLOAD(); synData.snInitialSequenceNumber = marshaler.ReadUInt32(); synData.uUpStreamMtu = marshaler.ReadUInt16(); synData.uDownStreamMtu = marshaler.ReadUInt16(); // This datagram MUST be zero-padded to increase the size of this datagram to 1232 bytes. if (fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_CORRELATION_ID)) { RDPUDP_CORRELATION_ID_PAYLOAD correlationId = new RDPUDP_CORRELATION_ID_PAYLOAD(); correlationId.uCorrelationId = marshaler.ReadBytes(16); this.CorrelationId = correlationId; correlationId.uReserved = marshaler.ReadBytes(16); } this.padding = marshaler.ReadToEnd(); this.SynData = synData; return true; } if (fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_ACK)) { // ACK. RDPUDP_ACK_VECTOR_HEADER ackVector = new RDPUDP_ACK_VECTOR_HEADER(); ackVector.uAckVectorSize = marshaler.ReadUInt16(); ackVector.AckVectorElement = new AckVector[ackVector.uAckVectorSize]; List<byte> ackVecElementList = new List<byte>(marshaler.ReadBytes(ackVector.AckVectorElement.Length)); ackVecElementList.Reverse(); for (int i = 0; i < ackVector.AckVectorElement.Length; i++) { byte vecByte = ackVecElementList[i]; ackVector.AckVectorElement[i].Length = (byte)(0x3F & vecByte); ackVector.AckVectorElement[i].State = (VECTOR_ELEMENT_STATE)(vecByte >> 6); } this.ackVectorHeader = ackVector; // Padding (variable): A variable-sized array, of length zero or more, // such that this structure ends on a DWORD ([MS-DTYP] section 2.2.9) boundary. int padLen = 4 - (2 + ackVector.AckVectorElement.Length) % 4; if (padLen > 0 && padLen != 4) { this.padding = marshaler.ReadBytes(padLen); } // Ack of Acks. if (fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_ACK_OF_ACKS)) { RDPUDP_ACK_OF_ACKVECTOR_HEADER aoaHeader = new RDPUDP_ACK_OF_ACKVECTOR_HEADER(); aoaHeader.snAckOfAcksSeqNum = marshaler.ReadUInt32(); this.ackOfAckVector = aoaHeader; } } if (fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_DATA)) { if (!fecHeader.uFlags.HasFlag(RDPUDP_FLAG.RDPUDP_FLAG_FEC)) { // Source Data. RDPUDP_SOURCE_PAYLOAD_HEADER srcHeader = new RDPUDP_SOURCE_PAYLOAD_HEADER(); srcHeader.snCoded = marshaler.ReadUInt32(); srcHeader.snSourceStart = marshaler.ReadUInt32(); this.sourceHeader = srcHeader; } else { // FEC Data. RDPUDP_FEC_PAYLOAD_HEADER fecDataHeader = new RDPUDP_FEC_PAYLOAD_HEADER(); fecDataHeader.snCoded = marshaler.ReadUInt32(); fecDataHeader.snSourceStart = marshaler.ReadUInt32(); fecDataHeader.uRange = marshaler.ReadByte(); fecDataHeader.uFecIndex = marshaler.ReadByte(); fecDataHeader.uPadding = marshaler.ReadUInt16(); this.fecPayloadHeader = fecDataHeader; } this.payload = marshaler.ReadToEnd(); } return true; } catch { return false; } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.ResponseFlags = marshaler.ReadByte(); this.ResultFlags = marshaler.ReadUInt16(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); TextType = marshaler.ReadUInt32(); LocaleId = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { if (!base.Decode(marshaler)) { return false; } configurationHandle = marshaler.ReadUInt32(); numInterfaces = marshaler.ReadUInt32(); if (numInterfaces == 0) { interfaces = null; } else { interfaces = new TS_USBD_INTERFACE_INFORMATION_RESULT[numInterfaces]; for (int i = 0; i < numInterfaces; i++) { interfaces[i] = new TS_USBD_INTERFACE_INFORMATION_RESULT(); if (!interfaces[i].Decode(marshaler)) { return false; } } } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); NumRequestCompletion = marshaler.ReadUInt32(); if (NumRequestCompletion != 0x00000000) { RequestCompletion = marshaler.ReadUInt32(); } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); MajorVersion = marshaler.ReadUInt32(); MinorVersion = marshaler.ReadUInt32(); Capabilities = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); startFrame = marshaler.ReadUInt32(); numberOfPackets = marshaler.ReadUInt32(); errorCount = marshaler.ReadUInt32(); isoPacket = new USBD_ISO_PACKET_DESCRIPTOR[numberOfPackets]; for (int i = 0; i < isoPacket.Length; i++) { isoPacket[i].Decode(marshaler); } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); CbTsUrb = marshaler.ReadUInt32(); TsUrb = marshaler.ReadBytes((int)CbTsUrb); OutputBufferSize = marshaler.ReadUInt32(); // TODO: should fix ReadBytes method in the library if (OutputBufferSize > 0) { OutputBuffer = marshaler.ReadBytes((int)OutputBufferSize); } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); RequestId = marshaler.ReadUInt32(); CbTsUrbResult = marshaler.ReadUInt32(); TsUrbResult = marshaler.ReadBytes((int)CbTsUrbResult); HResult = marshaler.ReadUInt32(); OutputBufferSize = marshaler.ReadUInt32(); OutputBuffer = marshaler.ReadBytes((int)OutputBufferSize); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); CapabilityValue = marshaler.ReadUInt32(); Result = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); NumUsbDevice = marshaler.ReadUInt32(); UsbDevice = marshaler.ReadUInt32(); cchDeviceInstanceId = marshaler.ReadUInt32(); DeviceInstanceId = marshaler.ReadUnicodeString((int)cchDeviceInstanceId); cchHwIds = marshaler.ReadUInt32(); if (cchHwIds == 0) { HardwareIds = null; } else { HardwareIds = marshaler.ReadUnicodeString((int)cchHwIds); } cchCompatIds = marshaler.ReadUInt32(); if (cchCompatIds == 0) { CompatibilityIds = null; } else { CompatibilityIds = marshaler.ReadUnicodeString((int)cchCompatIds); } cchContainerId = marshaler.ReadUInt32(); ContainerId = marshaler.ReadUnicodeString((int)cchContainerId); UsbDeviceCapabilities = marshaler.ReadBytes(USB_DEVICE_CAPABILITIES.USB_DEVICE_CAPABILITIES_SIZE); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); Reason = (USB_RETRACT_REASON)marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { maximumPacketSize = marshaler.ReadUInt16(); padding = marshaler.ReadUInt16(); maximumTransferSize = marshaler.ReadUInt32(); pipeFlags = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); RequestId = marshaler.ReadUInt32(); HResult = marshaler.ReadUInt32(); if (HResult == (uint)HRESULT_FROM_WIN32.ERROR_SUCCESS) { Information = marshaler.ReadUInt32(); OutputBufferSize = marshaler.ReadUInt32(); OutputBuffer = marshaler.ReadBytes((int)OutputBufferSize); } else if (HResult == (uint)HRESULT_FROM_WIN32.ERROR_INSUFFICIENT_BUFFER) { Information = marshaler.ReadUInt32(); OutputBufferSize = marshaler.ReadUInt32(); OutputBuffer = marshaler.ReadBytes((int)Information); } else { Information = marshaler.ReadUInt32(); OutputBufferSize = marshaler.ReadUInt32(); OutputBuffer = marshaler.ReadBytes((int)OutputBufferSize); } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { maximumPacketSize = marshaler.ReadUInt16(); endpointAddress = marshaler.ReadByte(); interval = marshaler.ReadByte(); pipeType = marshaler.ReadUInt32(); pipeHandle = marshaler.ReadUInt32(); maximumTransferSize = marshaler.ReadUInt32(); pipeFlags = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { len = marshaler.ReadUInt16(); numberOfPipes = marshaler.ReadUInt16(); interfaceNumber = marshaler.ReadByte(); alternateSetting = marshaler.ReadByte(); padding = marshaler.ReadUInt16(); numberOfPipes = marshaler.ReadUInt32(); informations = new TS_USBD_PIPE_INFORMATION[numberOfPipes]; for (int i = 0; i < numberOfPipes; i++) { informations[i].Decode(marshaler); } } catch (Exception) { // TODO: All generic exceptions should be got rid of. return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { size = marshaler.ReadUInt16(); padding = marshaler.ReadUInt16(); usbdStatus = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU to the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to Decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { Header.cbSize = marshaler.ReadUInt32(); Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); IoControlCode = (UsbIoControlCode)marshaler.ReadUInt32(); InputBufferSize = marshaler.ReadUInt32(); InputBuffer = marshaler.ReadBytes((int)InputBufferSize); OutputBufferSize = marshaler.ReadUInt32(); RequestId = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); cchDeviceDescription = marshaler.ReadUInt32(); DeviceDescription = marshaler.ReadUnicodeString((int)cchDeviceDescription); HResult = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { length = marshaler.ReadUInt16(); interfaceNumber = marshaler.ReadByte(); alternateSetting = marshaler.ReadByte(); class_field = marshaler.ReadByte(); subClass = marshaler.ReadByte(); protocol = marshaler.ReadByte(); padding = marshaler.ReadByte(); interfaceHandle = marshaler.ReadUInt32(); numberOfPipes = marshaler.ReadUInt32(); if (numberOfPipes > 0) { pipes = new TS_USBD_PIPE_INFORMATION_RESULT[numberOfPipes]; for (int i = 0; i < pipes.Length; i++) { pipes[i] = new TS_USBD_PIPE_INFORMATION_RESULT(); pipes[i].Decode(marshaler); } } else { pipes = null; } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { uint id = marshaler.ReadUInt32(); InterfaceId = id & InterfaceIdBitmask; Mask = (Mask_Values)((id & MaskBitmask) >> 30); MessageId = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.Version = (RdpevorVersionValues)marshaler.ReadByte(); this.Command = (CommandValues)marshaler.ReadByte(); this.FrameRate = marshaler.ReadByte(); this.AverageBitrateKbps = marshaler.ReadUInt16(); this.Reserved = marshaler.ReadUInt16(); this.SourceWidth = marshaler.ReadUInt32(); this.SourceHeight = marshaler.ReadUInt32(); this.ScaledWidth = marshaler.ReadUInt32(); this.ScaledHeight = marshaler.ReadUInt32(); this.hnsTimestampOffset = marshaler.ReadUInt64(); this.GeometryMappingId = marshaler.ReadUInt64(); this.VideoSubtypeId = marshaler.ReadBytes(16); this.cbExtra = marshaler.ReadUInt32(); this.pExtraData = marshaler.ReadBytes((int)this.cbExtra); this.Reserved2 = marshaler.ReadByte(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.blockType = (RFXProgCodecBlockType) marshaler.ReadUInt16(); this.blockLen = marshaler.ReadUInt32(); this.decodedLen = 6; return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.Version = (RdpevorVersionValues)marshaler.ReadByte(); this.Flags = (TsmmVideoData_FlagsValues)marshaler.ReadByte(); this.Reserved = marshaler.ReadByte(); this.HnsTimestamp = marshaler.ReadUInt64(); this.HnsDuration = marshaler.ReadUInt64(); this.CurrentPacketIndex = marshaler.ReadUInt16(); this.PacketsInSample = marshaler.ReadUInt16(); this.SampleNumber = marshaler.ReadUInt32(); this.cbSample = marshaler.ReadUInt32(); this.pSample = marshaler.ReadBytes((int)this.cbSample); this.Reserved2 = marshaler.ReadByte(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { if (!base.Decode(marshaler)) return false; this.tileSize = marshaler.ReadByte(); this.numRects = marshaler.ReadUInt16(); this.numQuant = marshaler.ReadByte(); this.numProgQuant = marshaler.ReadByte(); this.flags = marshaler.ReadByte(); this.decodedLen += 6; this.numTiles = marshaler.ReadUInt16(); this.tileDataSize = marshaler.ReadUInt32(); this.decodedLen += 6; this.rects = new TS_RFX_RECT[this.numRects]; for (int i = 0; i < this.numRects; i++) { this.rects[i].x = marshaler.ReadUInt16(); this.rects[i].y = marshaler.ReadUInt16(); this.rects[i].width = marshaler.ReadUInt16(); this.rects[i].height = marshaler.ReadUInt16(); this.decodedLen += (uint)Marshal.SizeOf(this.rects[i]); } this.quantVals = new TS_RFX_CODEC_QUANT[this.numQuant]; for (int i = 0; i < this.numQuant; i++) { this.quantVals[i].LL3_LH3 = marshaler.ReadByte(); this.quantVals[i].HL3_HH3 = marshaler.ReadByte(); this.quantVals[i].LH2_HL2 = marshaler.ReadByte(); this.quantVals[i].HH2_LH1 = marshaler.ReadByte(); this.quantVals[i].HL1_HH1 = marshaler.ReadByte(); this.decodedLen += 5; } this.quantProgVals = new RFX_PROGRESSIVE_CODEC_QUANT[this.numProgQuant]; for (int i = 0; i < this.numProgQuant; i++) { int quantProgSize = Marshal.SizeOf(this.quantProgVals[i]); byte[] rawData = marshaler.ReadBytes(quantProgSize); GCHandle handle = GCHandle.Alloc(rawData, GCHandleType.Pinned); try { IntPtr rawDataPtr = handle.AddrOfPinnedObject(); this.quantProgVals[i] = (RFX_PROGRESSIVE_CODEC_QUANT)Marshal.PtrToStructure(rawDataPtr, typeof(RFX_PROGRESSIVE_CODEC_QUANT)); } finally { handle.Free(); } this.decodedLen += (uint)quantProgSize; } return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }