/// <summary> /// Client MCS Connect Initial PDU /// Part 1 /// /// BER Encode packet and send /// </summary> internal static RdpPacket sendConnectInitial(RdpPacket data) { int length = (int)data.Length; int num2 = ((((9 + BER.domainParamSize(0x22, 2, 0, 0xffff)) + BER.domainParamSize(1, 1, 1, 0x420)) + BER.domainParamSize(0xffff, 0xfc17, 0xffff, 0xffff)) + 4) + length; RdpPacket packet = new RdpPacket(); BER.sendBerHeader(packet, BER.BER_Header.CONNECT_INITIAL, num2); BER.sendBerHeader(packet, BER.BER_Header.BER_TAG_OCTET_STRING, 1); packet.WriteByte(1); BER.sendBerHeader(packet, BER.BER_Header.BER_TAG_OCTET_STRING, 1); packet.WriteByte(1); BER.sendBerHeader(packet, BER.BER_Header.BER_TAG_BOOLEAN, 1); packet.WriteByte(0xff); sendDomainParams(packet, 0x22, 2, 0, 0xffff); sendDomainParams(packet, 1, 1, 1, 0x420); sendDomainParams(packet, 0xffff, 0xffff, 0xffff, 0xffff); BER.sendBerHeader(packet, BER.BER_Header.BER_TAG_OCTET_STRING, length); packet.copyToByteArray(data); return(packet); }
/// <summary> /// Client MCS Connect Initial PDU /// Part 1.1 /// /// BER Encode packet /// </summary> private static void sendDomainParams(RdpPacket packet, int max_channels, int max_users, int max_tokens, int max_pdusize) { int num = ((((((BER.BERIntSize(max_channels) + BER.BERIntSize(max_users)) + BER.BERIntSize(max_tokens)) + BER.BERIntSize(1)) + BER.BERIntSize(0)) + BER.BERIntSize(1)) + BER.BERIntSize(max_pdusize)) + BER.BERIntSize(2); BER.sendBerHeader(packet, BER.BER_Header.TAG_DOMAIN_PARAMS, num); BER.sendBerInteger(packet, max_channels); BER.sendBerInteger(packet, max_users); BER.sendBerInteger(packet, max_tokens); BER.sendBerInteger(packet, 1); BER.sendBerInteger(packet, 0); BER.sendBerInteger(packet, 1); BER.sendBerInteger(packet, max_pdusize); BER.sendBerInteger(packet, 2); }