/// <summary> /// Queries the USB device's text from the client. /// </summary> /// <param name="device">The context of the device which is being operated.</param> /// <param name="textType">This value represents the type of text to query as described in [MSFT-W2KDDK], Volume 1, /// Part 1, Chapter 2.</param> /// <param name="localeId">This value represents the locale of the text to query as described in [MSFT-W2KDDK], /// Volume 1, Part 1, Chapter 2.</param> public void QueryDeviceText(EusbDeviceContext device, uint textType, uint localeId) { Site.Log.Add(LogEntryKind.Debug, "Sending QUERY_DEVICE_TEXT. Device: {0}, Text type: {1}, Locale ID: {2}.", device, textType, localeId); EusbQueryDeviceTextRequestPdu requestPdu = new EusbQueryDeviceTextRequestPdu(device.UsbDeviceInterfaceId); requestPdu.TextType = textType; requestPdu.LocaleId = localeId; SendPdu(requestPdu, device.VirtualChannel); Site.Log.Add(LogEntryKind.Debug, "Receiving EusbQueryDeviceTextResponsePdu."); EusbQueryDeviceTextResponsePdu responsePdu = this.rdpeusbServer.ExpectRdpeusbPdu <EusbQueryDeviceTextResponsePdu>(device.VirtualChannel.ChannelId, waitTime); #region Verify QUERY_DEVICE_TEXT_RSP Site.Assert.IsNotNull( responsePdu, "Expect that the response from the client is EusbQueryDeviceTextResponsePdu."); Site.Assert.AreEqual <uint>( requestPdu.InterfaceId, responsePdu.InterfaceId, "Expect that the InterfaceId in the response PDU equals the InterfaceId in the request. The actual value is 0x{0:x8}.", responsePdu.InterfaceId); Site.Assert.AreEqual <uint>( requestPdu.MessageId, responsePdu.MessageId, "Expect that the MessageId in the response PDU equals the MessageId in the request. The actual value is 0x{0:x8}.", responsePdu.MessageId); Site.Assert.AreEqual <Mask_Values>( Mask_Values.STREAM_ID_STUB, responsePdu.Mask, "Expect that the Mask in the response PDU is STREAM_ID_STUB."); Site.Assert.AreNotEqual <uint>( 0x00000000, responsePdu.cchDeviceDescription, "Expect that the cchDeviceDescription in the response PDU is not zero. The actual value is 0x{0:x8}.", responsePdu.cchDeviceDescription); Site.Assert.AreEqual <uint>( 0x00000000, responsePdu.HResult, "Expect that the HResult in the response PDU is zero. The actual value is 0x{0:x8}.", responsePdu.HResult); #endregion }
public override EusbPdu ParsePdu(byte[] data) { EusbPdu pdu; switch (GetPduType(data)) { case EusbType.RIM_EXCHANGE_CAPABILITY_REQUEST: pdu = new EusbRimExchangeCapResponsePdu(); break; case EusbType.ADD_VIRTUAL_CHANNEL: pdu = new EusbAddVirtualChannelPdu(); break; case EusbType.ADD_DEVICE: pdu = new EusbAddDevicePdu(); break; case EusbType.CHANNEL_CREATED: pdu = new EusbChannelCreatedPdu(false); break; case EusbType.QUERY_DEVICE_TEXT: pdu = new EusbQueryDeviceTextResponsePdu(); break; case EusbType.IOCONTROL_COMPLETION: pdu = new EusbIoControlCompletionPdu(); break; case EusbType.URB_COMPLETION: pdu = new EusbUrbCompletionPdu(); break; case EusbType.URB_COMPLETION_NO_DATA: pdu = new EusbUrbCompletionNoDataPdu(); break; default: return(base.ParsePdu(data)); } if (!PduMarshaler.Unmarshal(data, pdu)) { pdu = new EusbUnknownPdu(); PduMarshaler.Unmarshal(data, pdu); } return(pdu); }