示例#1
0
        // Input
        internal static void FastSendInput(List <Rdp.InputInfo> InputToSend)
        {
            if (Options.use_fastpath_input)
            {
                RdpPacket packet = new RdpPacket();
                ushort    num    = 1;
                int       count  = InputToSend.Count;

                if (count < 0x10)
                {
                    packet.WriteByte((byte)(count << 2));
                }
                else
                {
                    packet.WriteByte(0);
                    num = (ushort)(num + 1);
                }

                foreach (Rdp.InputInfo info in InputToSend)
                {
                    switch (info.Message_Type)
                    {
                    case Rdp.InputType.INPUT_EVENT_SCANCODE:
                        num = (ushort)(num + 2);
                        break;

                    case Rdp.InputType.INPUT_EVENT_UNICODE:
                        num = (ushort)(num + 3);
                        break;

                    case Rdp.InputType.INPUT_EVENT_MOUSE:
                        num = (ushort)(num + 7);
                        break;

                    case Rdp.InputType.INPUT_EVENT_SYNC:
                        num = (ushort)(num + 1);
                        break;
                    }
                }

                num = (ushort)(num + 1);

                if (num > 0x7f)
                {
                    num = (ushort)(num + 1);
                }

                packet.WriteEncodedUnsigned16(num);

                if (count >= 0x10)
                {
                    packet.WriteByte((byte)count);
                }

                foreach (Rdp.InputInfo info2 in InputToSend)
                {
                    int num3 = 0;

                    switch (info2.Message_Type)
                    {
                    case Rdp.InputType.INPUT_EVENT_SCANCODE:

                        if ((info2.Device_Flags & 0x8000) != 0)
                        {
                            num3 |= 0x01;
                        }

                        if ((info2.Device_Flags & 0x0100) != 0)
                        {
                            num3 |= 0x02;
                        }

                        packet.WriteByte((byte)num3);
                        packet.WriteByte((byte)info2.Param1);
                        break;

                    case Rdp.InputType.INPUT_EVENT_UNICODE:

                        if ((info2.Device_Flags & 0x8000) != 0)
                        {
                            num3 |= 1;
                        }

                        packet.WriteByte((byte)(0x80 | num3));
                        packet.WriteLittleEndian16((ushort)info2.Param1);
                        break;

                    case Rdp.InputType.INPUT_EVENT_MOUSE:
                        packet.WriteByte(0x20);
                        packet.WriteLittleEndian16((ushort)info2.Device_Flags);
                        packet.WriteLittleEndian16((ushort)info2.Param1);
                        packet.WriteLittleEndian16((ushort)info2.Param2);
                        break;

                    case Rdp.InputType.INPUT_EVENT_SYNC:
                        packet.WriteByte(0x60);
                        break;
                    }
                }

                Write(packet);
            }
            else
            {
                foreach (Rdp.InputInfo info3 in InputToSend)
                {
                    SlowSendInput(info3.Time, (int)info3.Message_Type, info3.Device_Flags, info3.Param1, info3.Param2);
                }
            }
        }