Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <summary>
        /// Server MCS Connect Response PDU with GCC Conference Create Response
        /// Part 1.1
        /// </summary>
        private static void parseDomainParams(RdpPacket data)
        {
            int  num  = BER.berParseHeader(data, BER.BER_Header.TAG_DOMAIN_PARAMS);
            long num2 = data.Position + num;

            if (num2 > data.Length)
            {
                throw new RDFatalException("Bad domain param received");
            }

            data.Position += num;
        }
Exemple #3
0
        /// <summary>
        /// Server MCS Connect Response PDU with GCC Conference Create Response
        /// Part 1
        /// </summary>
        private static void receiveConnectResponse()
        {
            string[] strArray = new string[]
            {
                "Successful",
                "Domain Merging",
                "Domain not Hierarchical",
                "No Such Channel",
                "No Such Domain",
                "No Such User",
                "Not Admitted",
                "Other User ID",
                "Parameters Unacceptable",
                "Token Not Available",
                "Token Not Possessed",
                "Too Many Channels",
                "Too Many Tokens",
                "Too Many Users",
                "Unspecified Failure",
                "User Rejected"
            };

            RdpPacket data = ISO.Receive();

            data.ReadByte();
            int num = data.ReadByte();

            if (num != 240)
            {
                throw new RDFatalException("Bad connection response packet type " + num.ToString());
            }

            data.ReadByte();
            int index = 0;

            index = BER.berParseHeader(data, BER.BER_Header.CONNECT_RESPONSE);
            index = BER.berParseHeader(data, BER.BER_Header.BER_TAG_RESULT);
            index = data.ReadByte();

            if (index != 0)
            {
                throw new RDFatalException("MCS failed " + strArray[index].ToString());
            }

            index = BER.berParseHeader(data, BER.BER_Header.BER_TAG_INTEGER);
            index = data.ReadByte();
            parseDomainParams(data);
            index = BER.berParseHeader(data, BER.BER_Header.BER_TAG_OCTET_STRING);
            processMcsData(data);
        }
Exemple #4
0
        /// <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);
        }