/// <summary> /// Method to do capability exchange with RDP client. /// This function is recommended to be called by other test cases to do capability exchange. /// </summary> private void RDPEGFX_CapabilityExchange(DynamicVC_TransportType transportType = DynamicVC_TransportType.RDP_TCP, bool isSoftSync = false) { this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ..."); StartRDPConnection(isSoftSync); this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ..."); bool bProtocolSupported = isSoftSync? InitializeForSoftSync(transportType) : this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer, transportType); TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol."); this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client."); RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise(); this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received."); this.isH264AVC420Supported = false; this.isH264AVC444Supported = false; this.isSmallCache = false; this.TestSite.Log.Add(LogEntryKind.Debug, "Sending capability confirm to client."); // Set first capset in capability advertise request, if no capdata in request, use default flag. CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT; CapsVersions version = CapsVersions.RDPGFX_CAPVERSION_8; if (capsAdv.capsSetCount > 0) { foreach (RDPGFX_CAPSET capSet in capsAdv.capsSets) { CapsFlags flag = (CapsFlags)BitConverter.ToUInt32(capSet.capsData, 0); if (capSet.version >= version) { version = capSet.version; capFlag = flag; } if (capSet.version == CapsVersions.RDPGFX_CAPVERSION_81 && (flag & CapsFlags.RDPGFX_CAPS_FLAG_AVC420_ENABLED) == CapsFlags.RDPGFX_CAPS_FLAG_AVC420_ENABLED) { this.isH264AVC420Supported = true; } else if (capSet.version >= CapsVersions.RDPGFX_CAPVERSION_10 && //RDPGFX_CAPVERSION_10 and RDPGFX_CAPVERSION_102 (flag & CapsFlags.RDPGFX_CAPS_FLAG_AVC_DISABLED) == 0) { this.isH264AVC420Supported = true; this.isH264AVC444Supported = true; } if ((flag & CapsFlags.RDPGFX_CAPS_FLAG_SMALL_CACHE) == CapsFlags.RDPGFX_CAPS_FLAG_SMALL_CACHE) { this.isSmallCache = true; } } } this.rdpegfxAdapter.SendCapabilityConfirm(capFlag, version); }
/// <summary> /// Method to send a Capability Confirm to client. /// </summary> /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param> /// <param name="version">version of the capability</param> public void SendCapabilityConfirm(CapsFlags capFlag, CapsVersions version = CapsVersions.RDPGFX_CAPVERSION_8) { MakeCapabilityConfirmPdu(capFlag, version); PackAndSendServerPdu(); }
/// <summary> /// Constructor, create a version 8 capability confirm message. /// </summary> /// <param name="v8flag"> this is used to specify the flag of capability.</param> /// <param name="version">version of the capability</param> public RDPGFX_CAPS_CONFIRM(CapsFlags v8flag, CapsVersions version) { Header.cmdId = PacketTypeValues.RDPGFX_CMDID_CAPSCONFIRM; Header.flags = 0x0; capsSet.version = version; capsSet.capsDataLength = 0x04; capsSet.capsData = new byte[capsSet.capsDataLength]; // Assign flag into the capsData structure(byte[]). capsSet.capsData = BitConverter.GetBytes((uint)v8flag); Header.pduLength = (uint)Marshal.SizeOf(Header) + 8 + capsSet.capsDataLength; }
/// <summary> /// Method to make a Capability Confirm PDU. /// </summary> /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param> /// <param name="version">version of the capability</param> void MakeCapabilityConfirmPdu(CapsFlags capFlag, CapsVersions version) { RDPGFX_CAPS_CONFIRM capsConfirm = egfxServer.CreateCapabilityConfirmPdu(capFlag, version); if (currentTestType == RdpegfxNegativeTypes.Capability_Incorrect_Version) capsConfirm.capsSet.version += 1; // Set to an invalid value 1 more than 0x00080004. else if (currentTestType == RdpegfxNegativeTypes.Capability_Incorrect_CapsDatalength) capsConfirm.capsSet.capsDataLength = 0x01; // Set to an invalid value 0x01. else if (currentTestType == RdpegfxNegativeTypes.SurfaceToScreen_Incorrect_PduLengthInHeader) capsConfirm.Header.pduLength = 0x00; // Set to an invalid value 0x00. else if (currentTestType == RdpegfxNegativeTypes.Capability_InvalidCapFlag) capsConfirm.capsSet.capsData = BitConverter.GetBytes((uint)(0x03)); // 0x03 is an invalid cap flag. AddPdusToBuffer(capsConfirm); }
/// <summary> /// Create a Capability Confirm PDU. /// </summary> /// <param name="capFlag">The valid rdpgfx_capset_version8 flag.</param> /// <param name="version">version of the capability</param> public RDPGFX_CAPS_CONFIRM CreateCapabilityConfirmPdu(CapsFlags capFlag, CapsVersions version) { RDPGFX_CAPS_CONFIRM capsConfirm = new RDPGFX_CAPS_CONFIRM(capFlag, version); return(capsConfirm); }