X-Git-Url: https://git.sesse.net/?p=rdpsrv;a=blobdiff_plain;f=rdp5.c;fp=rdp5.c;h=0ac38076132bbcd5768c83df303537cbba25ccc7;hp=0000000000000000000000000000000000000000;hb=99f2e8c32508ab193c1d42221c86cb7fca4be9ab;hpb=baeaf1330ff12ff44eeb191b85430e3657ddb7ab diff --git a/rdp5.c b/rdp5.c new file mode 100644 index 0000000..0ac3807 --- /dev/null +++ b/rdp5.c @@ -0,0 +1,86 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Protocol services - Multipoint Communications Service + Copyright (C) Matthew Chapman 1999-2002 + Copyright (C) Erik Forsberg 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rdesktop.h" + +extern uint8 *g_next_packet; +extern int listen_on_vnc; + +void +rdp5_process(STREAM s, BOOL encryption) +{ + uint16 length, count, x, y; + uint8 type; + uint8 *next; + + if (encryption) + { + in_uint8s(s, 8); /* signature */ + sec_decrypt(s->p, s->end - s->p); + } + +#if 1 + printf("RDP5 data:\n"); + hexdump(s->p, s->end - s->p); +#endif + + while (s->p < s->end) + { + in_uint8(s, type); + + switch (type) + { + case 32: { // mouse + listen_on_vnc = 1; + uint16 device_flags, x, y; + static int mouse1_down = 0, mouse2_down = 0; + + in_uint16_le(s, device_flags); + in_uint16_le(s, x); + in_uint16_le(s, y); + + printf("- Type: Mouse\n"); + printf("- Device flags: %x\n", device_flags); + printf("- Position: (%u,%u)\n", x, y); + + if (device_flags & MOUSE_FLAG_BUTTON1) + mouse1_down = (device_flags & MOUSE_FLAG_DOWN) ? 0x01 : 0; + if (device_flags & MOUSE_FLAG_BUTTON2) + mouse2_down = (device_flags & MOUSE_FLAG_DOWN) ? 0x02 : 0; + + printf("button mask = %x\n", mouse1_down | mouse2_down); + + /* buf[0] = 5; // message type + buf[1] = mouse1_down | mouse2_down; // button mask + buf[2] = param1 >> 8; + buf[3] = param1 & 0xff; + buf[4] = param2 >> 8; + buf[5] = param2 & 0xff; + write(vnc_sock, buf, 6); */ + + break; + } + default: + printf("Unimplemented RDP5 opcode %d (len=%u)\n", type, length); + return; + } + } +}