private void SendStaticVirtualChannelTraffics(StaticVirtualChannel_InvalidType invalidType) { if (this.rdpefsAdapter == null) { this.rdpefsAdapter = this.TestSite.GetAdapter <IRdpefsAdapter>(); this.rdpefsAdapter.Reset(); this.rdpefsAdapter.AttachRdpbcgrAdapter(this.rdpbcgrAdapter); } this.TestSite.Log.Add(LogEntryKind.Comment, "Start to sending ref traffics."); this.rdpefsAdapter.GenerateStaticVirtualChannelTraffics(invalidType); }
/// <summary> /// Generate static virtual channel data messages for test. /// MS-RDPEFS is used to generated virtual channel traffics. /// </summary> /// <param name="invalidType">Invalid Type</param> public void GenerateStaticVirtualChannelTraffics(StaticVirtualChannel_InvalidType invalidType) { /* * MS-RDPEFS protocol Initialization. */ byte[] receivedData = null; uint clientId = 0; if (invalidType == StaticVirtualChannel_InvalidType.None) { //Sending Server Announce Request. byte[] data = RdpefsUtility.EncodeServerAnnounceRequest(RdpefsUtility.CreateServerAnnounceRequest()); SendVirtualChannelPDU(RDPDR_ChannelId, data, StaticVirtualChannel_InvalidType.None); //Expecting Client Announce Reply. WaitForVirtualChannelPdu(RDPDR_ChannelId, out receivedData, pduWaitTimeSpan); DR_CORE_SERVER_ANNOUNCE_RSP reply = RdpefsUtility.DecodeClientAnnounceReply(receivedData); clientId = reply.ClientId; //Expecting Client Name Request. WaitForVirtualChannelPdu(RDPDR_ChannelId, out receivedData, pduWaitTimeSpan); //Sending Server Core Capability Request. data = RdpefsUtility.EncodeServerCoreCapabilityRequest(RdpefsUtility.CreateServerCoreCapabilityRequest()); SendVirtualChannelPDU(RDPDR_ChannelId, data, StaticVirtualChannel_InvalidType.None); //Sending Server Client ID Confirm. data = RdpefsUtility.EncodeServerClientIDConfirm(RdpefsUtility.CreateServerClientIDConfirm(clientId)); SendVirtualChannelPDU(RDPDR_ChannelId, data, StaticVirtualChannel_InvalidType.None); //Expecting Client Core Capability Response. WaitForVirtualChannelPdu(RDPDR_ChannelId, out receivedData, pduWaitTimeSpan); DR_CORE_CAPABILITY_RSP capRsp = RdpefsUtility.DecodeClientCoreCapabilityRSP(receivedData); bool supportUserLogonPacket = false; foreach (CAPABILITY_SET capSet in capRsp.CapabilityMessage) { if (capSet is GENERAL_CAPS_SET) { if (((GENERAL_CAPS_SET)capSet).extendedPDU.HasFlag(extendedPDU_Values.RDPDR_USER_LOGGEDON_PDU)) { supportUserLogonPacket = true; } } } if (supportUserLogonPacket) { // Send Server User logged on packet data = RdpefsUtility.EncodeServerUserLoggedOn(RdpefsUtility.CreateServerUserLoggedOn()); SendVirtualChannelPDU(RDPDR_ChannelId, data, StaticVirtualChannel_InvalidType.None); } //Expecting Client Device List. WaitForVirtualChannelPdu(RDPDR_ChannelId, out receivedData, pduWaitTimeSpan); } else { //Sending Server Announce Request. byte[] data = RdpefsUtility.EncodeServerAnnounceRequest(RdpefsUtility.CreateServerAnnounceRequest()); SendVirtualChannelPDU(RDPDR_ChannelId, data, invalidType); //WaitForVirtualChannelPdu(RDPDR_ChannelId, out receivedData, timeout); } }
/// <summary> /// Generate static virtual channel data messages for test. /// MS-RDPEFS is used to generated virtual channel traffics. /// </summary> /// <param name="RDPDR_ChannelId">Static Channel Id for RDPDR</param> /// <param name="invalidType">Invalid Type</param> public void GenerateStaticVirtualChannelTraffics(StaticVirtualChannel_InvalidType invalidType = StaticVirtualChannel_InvalidType.None) { /* * MS-RDPEFS protocol Initialization. */ byte[] receivedData = null; uint clientId = 0; UInt16 channelId = this.rdpbcgrAdapter.RDPDRChannelId; if (invalidType == StaticVirtualChannel_InvalidType.None) { //Sending Server Announce Request. byte[] data = rdpefsServer.EncodeServerPdu <DR_CORE_SERVER_ANNOUNCE_REQ>(CreateServerAnnounceReqest()); this.rdpbcgrAdapter.SendVirtualChannelPDU(channelId, data, StaticVirtualChannel_InvalidType.None); //Expecting Client Announce Reply. this.rdpbcgrAdapter.WaitForVirtualChannelPdu(channelId, out receivedData, waitTime); DR_CORE_CLIENT_ANNOUNCE_RSP reply = new DR_CORE_CLIENT_ANNOUNCE_RSP(); bool fsuccess = rdpefsServer.DecodeClientPdu <DR_CORE_CLIENT_ANNOUNCE_RSP>(receivedData, reply); clientId = reply.ClientId; //Expecting Client Name Request. this.rdpbcgrAdapter.WaitForVirtualChannelPdu(channelId, out receivedData, waitTime); DR_CORE_CLIENT_NAME_REQ req = new DR_CORE_CLIENT_NAME_REQ(); fsuccess = rdpefsServer.DecodeClientPdu <DR_CORE_CLIENT_NAME_REQ>(receivedData, req); //Sending Server Core Capability Request. data = rdpefsServer.EncodeServerPdu <DR_CORE_CAPABILITY_REQ>(CreateServerCoreCapabilityRequest()); this.rdpbcgrAdapter.SendVirtualChannelPDU(channelId, data, StaticVirtualChannel_InvalidType.None); //Sending Server Client ID Confirm. data = rdpefsServer.EncodeServerPdu <DR_CORE_SERVER_CLIENTID_CONFIRM>(CreateServerClientIdConfirm(clientId)); this.rdpbcgrAdapter.SendVirtualChannelPDU(channelId, data, StaticVirtualChannel_InvalidType.None); //Expecting Client Core Capability Response. this.rdpbcgrAdapter.WaitForVirtualChannelPdu(channelId, out receivedData, waitTime); DR_CORE_CAPABILITY_RSP capRsp = new DR_CORE_CAPABILITY_RSP(); fsuccess = rdpefsServer.DecodeClientPdu <DR_CORE_CAPABILITY_RSP>(receivedData, capRsp); bool supportUserLogonPacket = false; foreach (CAPABILITY_SET capSet in capRsp.CapabilityMessage) { if (capSet is GENERAL_CAPS_SET) { if (((GENERAL_CAPS_SET)capSet).extendedPDU.HasFlag(extendedPDU_Values.RDPDR_USER_LOGGEDON_PDU)) { supportUserLogonPacket = true; } } } if (supportUserLogonPacket) { // Send Server User logged on packet data = rdpefsServer.EncodeServerPdu <DR_CORE_USER_LOGGEDON>(new DR_CORE_USER_LOGGEDON()); this.rdpbcgrAdapter.SendVirtualChannelPDU(channelId, data, StaticVirtualChannel_InvalidType.None); } //Expecting Client Device List. this.rdpbcgrAdapter.WaitForVirtualChannelPdu(channelId, out receivedData, waitTime); DR_CORE_DEVICELIST_ANNOUNCE_REQ announceReq = new DR_CORE_DEVICELIST_ANNOUNCE_REQ(); fsuccess = rdpefsServer.DecodeClientPdu <DR_CORE_DEVICELIST_ANNOUNCE_REQ>(receivedData, announceReq); } else { //Sending Server Announce Request. byte[] data = rdpefsServer.EncodeServerPdu <DR_CORE_SERVER_ANNOUNCE_REQ>(CreateServerAnnounceReqest()); this.rdpbcgrAdapter.SendVirtualChannelPDU(channelId, data, invalidType); //this.rdpbcgrAdapter.WaitForVirtualChannelPdu(channelId, out receivedData, timeout); } }
private void SendStaticVirtualChannelTraffics(StaticVirtualChannel_InvalidType invalidType) { if (this.rdpefsAdapter == null) { this.rdpefsAdapter = (IRdpefsAdapter)this.TestSite.GetAdapter(typeof(IRdpefsAdapter)); this.rdpefsAdapter.Reset(); this.rdpefsAdapter.AttachRdpbcgrAdapter(this.rdpbcgrAdapter); } this.TestSite.Log.Add(LogEntryKind.Comment, "Start to sending ref traffics."); this.rdpefsAdapter.GenerateStaticVirtualChannelTraffics(invalidType); }