Index: /trunk/src/VBox/RDP/client-1.8.3/Makefile.in
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/Makefile.in	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/Makefile.in	(revision 55123)
@@ -17,6 +17,7 @@
 CC          = @CC@
 INSTALL     = @INSTALL@
-CFLAGS      = @CFLAGS@ @X_CFLAGS@ @DEFS@ -DKEYMAP_PATH=\"$(KEYMAP_PATH)\"
-LDFLAGS     = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
+CFLAGS      = @CFLAGS@ @X_CFLAGS@ @DEFS@ -Iinclude -DKEYMAP_PATH=\"$(KEYMAP_PATH)\" -DWITH_RDPUSB=1 -DRDESKTOP -DVBOX -DIN_RING3 -DRT_OS_LINUX -DLOG_DISABLED -DRTLOG_REL_DISABLED -DVBOX_USB_WITH_SYSFS
+CXXFLAGS    = @CXXFLAGS@ @DEFS@ -Iinclude -DKEYMAP_PATH=\"$(KEYMAP_PATH)\" -DWITH_RDPUSB=1 -DRDESKTOP -DVBOX -DIN_RING3 -DRT_OS_LINUX -DLOG_DISABLED -DRTLOG_REL_DISABLED -DVBOX_USB_WITH_SYSFS
+LDFLAGS     = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lpthread -ldl
 STRIP       = @STRIP@
 
@@ -29,5 +30,5 @@
 CREDSSPOBJ  = @CREDSSPOBJ@
 
-RDPOBJ   = tcp.o asn.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o ssl.o utils.o
+RDPOBJ   = tcp.o asn.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o ssl.o utils.o Runtime/common/alloc/alloc.o Runtime/common/err/errmsg.o Runtime/common/err/errmsgxpcom.o Runtime/common/err/RTErrConvertFromErrno.o Runtime/common/err/RTErrConvertToErrno.o Runtime/common/misc/sg.o Runtime/common/path/RTPathAppend.o Runtime/common/path/RTPathAppendEx.o Runtime/common/path/RTPathCountComponents.o Runtime/common/path/RTPathFilename.o Runtime/common/path/rtPathRootSpecLen.o Runtime/common/path/RTPathStripFilename.o Runtime/common/path/RTPathStripTrailingSlash.o Runtime/common/path/rtPathVolumeSpecLen.o Runtime/common/string/RTStrCmp.o Runtime/common/string/RTStrNCmp.o Runtime/common/string/RTStrCopy.o Runtime/common/string/RTStrNLen.o Runtime/common/string/straprintf.o Runtime/common/string/stringalloc.o Runtime/common/string/strformat.o Runtime/common/string/strformatrt.o Runtime/common/string/strformattype.o Runtime/common/string/strprintf.o Runtime/common/string/strstrip.o Runtime/common/string/strtonum.o Runtime/common/string/unidata-flags.o Runtime/common/string/unidata-upper.o Runtime/common/string/unidata-lower.o Runtime/common/string/utf-16.o Runtime/common/string/utf-8.o Runtime/common/string/utf-8-case.o Runtime/common/time/timesysalias.o Runtime/generic/pathhost-generic.o Runtime/generic/RTPathAbs-generic.o Runtime/r3/alloc.o Runtime/r3/dir.o Runtime/r3/fileio.o Runtime/r3/fs.o Runtime/r3/linux/sysfs.o Runtime/r3/linux/time-linux.o Runtime/r3/posix/dir-posix.o Runtime/r3/posix/env-posix.o Runtime/r3/posix/fileio-posix.o Runtime/r3/posix/fs2-posix.o Runtime/r3/posix/fs3-posix.o Runtime/r3/posix/path-posix.o Runtime/r3/posix/path2-posix.o Runtime/r3/posix/pipe-posix.o Runtime/r3/posix/thread2-posix.o Runtime/r3/posix/utf8-posix.o Runtime/r3/stream.o vrdp/rdpusb.o vrdp/USBGetDevices.o vrdp/USBLib.o vrdp/linux/USBProxyDevice-linux.o
 X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o ctrl.o
 VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
@@ -37,5 +38,5 @@
 
 rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(CREDSSPOBJ)
-	$(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(CREDSSPOBJ) $(LDFLAGS) -lX11
+	$(CXX) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(CREDSSPOBJ) $(LDFLAGS) -lX11
 
 rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(CREDSSPOBJ)
@@ -92,5 +93,5 @@
 .PHONY: clean
 clean:
-	rm -f *.o *~ vnc/*.o vnc/*~ rdesktop rdp2vnc
+	rm -f *.o *~ vnc/*.o vnc/*~ vrdp/*.o vrdp/*~ vrdp/linux/*.o vrdp/linux/*~ Runtime/common/*/*.o Runtime/common/*/*~ Runtime/generic/*.o Runtime/generic/*~ Runtime/r3/*.o Runtime/r3/*~ Runtime/r3/*/*.o Runtime/r3/*/*~ rdesktop rdp2vnc
 
 .PHONY: distclean
@@ -156,5 +157,5 @@
 
 .SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .c .cpp .o
 
 .c.o:
Index: /trunk/src/VBox/RDP/client-1.8.3/Makefile.kmk
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/Makefile.kmk	(revision 55123)
+++ /trunk/src/VBox/RDP/client-1.8.3/Makefile.kmk	(revision 55123)
@@ -0,0 +1,409 @@
+# $Id$
+## @file
+# VBox - rdesktop with VRDP enhancements sub-makefile.
+#
+
+#
+# Copyright (C) 2006-2012 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+# Globals
+VBOX_PATH_RDESKTOP_SRC := $(PATH_SUB_CURRENT)
+VBOX_PATH_DEVICES_USB  := $(PATH_ROOT)/src/VBox/Devices/USB
+VBOX_PATH_USB_LIB      := $(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB
+VBOX_PATH_MAIN_LINUX   := $(PATH_ROOT)/src/VBox/Main/src-server/linux
+VBOX_PATH_MAIN_INCLUDE := $(PATH_ROOT)/src/VBox/Main/include
+VBOX_RDESKTOP_SRC_SUBDIR = rdesktop-1.8.3-vrdp
+
+#
+# The rdesktop-vrdp program.
+#
+PROGRAMS += rdesktop-vrdp
+rdesktop-vrdp_TEMPLATE = VBOXR3NPEXE
+rdesktop-vrdp_SDKS = VBOX_OPENSSL2
+rdesktop-vrdp_DEFS = \
+	PACKAGE_NAME=\"rdesktop-vrdp\" PACKAGE_TARNAME=\"rdesktop-vrdp\" PACKAGE_VERSION=\"1.8.3\" \
+	PACKAGE_STRING=\"rdesktop\ 1.8.3\" PACKAGE_BUGREPORT=\"\" STDC_HEADERS=1 L_ENDIAN=1 \
+	HAVE_SYS_TYPES_H=1 HAVE_SYS_STAT_H=1 HAVE_STDLIB_H=1 HAVE_STRING_H=1 HAVE_MEMORY_H=1 \
+	HAVE_STRINGS_H=1 HAVE_INTTYPES_H=1 HAVE_STDINT_H=1 HAVE_UNISTD_H=1 HAVE_SYS_SELECT_H=1 \
+	HAVE_LOCALE_H=1 HAVE_LANGINFO_H=1 HAVE_ICONV_H=1 \
+	EGD_SOCKET=\"/var/run/egd-pool\" WITH_RDPSND=1 HAVE_DIRENT_H=1 \
+	HAVE_ICONV=1 HAVE_SYS_STATVFS_H=1 \
+	HAVE_SYS_PARAM_H=1 HAVE_SYS_MOUNT_H=1 HAVE_STRUCT_STATVFS_F_NAMEMAX=1 \
+	KEYMAP_PATH=$(if $(findstring RTPATH_APP_PRIVATE,$(CDEFS)),RTPATH_APP_PRIVATE,\"/opt/VirtualBox\")\"/rdesktop-vrdp-keymaps\" \
+	RDESKTOP=1
+ifdef WITH_BIRD_VD_HACKS
+ rdesktop-vrdp_DEFS += WITH_BIRD_VD_HACKS
+endif
+
+rdesktop-vrdp_DEFS.linux = \
+	HAVE_MNTENT_H=1 HAVE_SETMNTENT=1 STAT_STATVFS=1 HAVE_SYS_VFS_H=1 HAVE_STRUCT_STATFS_F_NAMELEN=1 \
+	ICONV_CONST= RDPSND_OSS=1 WITH_RDPUSB=1 HAVE_SYS_STATFS_H=1
+# Solaris 10 doesn't have dirfd(), and as thus we go for the low tech solution.
+rdesktop-vrdp_DEFS.linux += \
+	HAVE_DIRFD=1 HAVE_DECL_DIRFD=1 VBOX_USB_WITH_SYSFS=1
+ifdef VBOX_WITH_LINUX_COMPILER_H
+ rdesktop-vrdp_DEFS.linux += VBOX_WITH_LINUX_COMPILER_H
+endif
+# @todo once rdp proxy is available on Solaris, add WITH_RDPUSB=1
+# snv_166+ dirent.h: defines dd_fd only if __USE_LEGACY_PROTOTYPES__ is defined, otherwise uses d_fd, let's just
+# define __USE_LEGACY_PROTOTYPES__ until our buildbox is updated sufficiently
+rdesktop-vrdp_DEFS.solaris = \
+	HAVE_SYS_FILIO_H=1 RDPSND_SUN=1 HAVE_ICONV_H=1 ICONV_CONST= STAT_STATVFS64=1 _FILE_OFFSET_BITS=64 \
+	DIR_FD_MEMBER_NAME=dd_fd __USE_LEGACY_PROTOTYPES__ HAVE_SYS_VFS_H=1 HAVE_SYS_STATFS_H=1
+rdesktop-vrdp_DEFS.freebsd = \
+	RDPSND_OSS=1 HAVE_ICONV_H=1 ICONV_CONST=const HAVE_SYS_STATVFS_H=1 _FILE_OFFSET_BITS=64 HAVE_DIRFD=1
+
+rdesktop-vrdp_SOURCES = \
+	tcp.c \
+	asn.c \
+	iso.c \
+	mcs.c \
+	secure.c \
+	licence.c \
+	rdp.c \
+	orders.c \
+	bitmap.c \
+	cache.c \
+	rdp5.c \
+	channels.c \
+	rdpdr.c \
+	serial.c \
+	printer.c \
+	disk.c \
+	parallel.c \
+	printercache.c \
+	mppc.c \
+	pstcache.c \
+	lspci.c \
+	seamless.c \
+	ssl.c \
+	utils.c \
+	rdesktop.c \
+	xwin.c \
+	xkeymap.c \
+	ewmhints.c \
+	xclip.c \
+	cliprdr.c \
+	ctrl.c \
+	rdpsnd.c \
+	rdpsnd_dsp.c
+rdesktop-vrdp_SOURCES.linux = \
+	rdpsnd_oss.c \
+	vrdp/rdpusb.c \
+	$(VBOX_PATH_DEVICES_USB)/linux/USBProxyDevice-linux.cpp \
+	$(VBOX_PATH_MAIN_LINUX)/USBGetDevices.cpp \
+	$(VBOX_PATH_USB_LIB)/USBLib.cpp
+rdesktop-vrdp_INCS += \
+	$(VBOX_PATH_RDESKTOP_SRC) \
+	$(VBOX_PATH_RDESKTOP_SRC)/vrdp \
+	$(VBOX_PATH_DEVICES_USB) \
+	$(VBOX_PATH_MAIN_INCLUDE) \
+	$(PATH_ROOT)/include/VBox
+## @todo implement usb proxy for Solaris
+rdesktop-vrdp_SOURCES.solaris = \
+	rdpsnd_sun.c
+rdesktop-vrdp_SOURCES.freebsd = \
+	rdpsnd_oss.c
+rdesktop-vrdp_LIBPATH = \
+	/usr/lib \
+	$(VBOX_LIBPATH_X11)
+rdesktop-vrdp_LIBS = \
+	X11 \
+	$(LIB_RUNTIME)
+rdesktop-vrdp_LIBS.solaris = \
+	nsl
+rdesktop-vrdp_LIBS.freebsd = \
+	iconv
+
+#
+# The keymaps.
+#
+INSTALLS += rdesktop-vrdp-keymaps
+rdesktop-vrdp-keymaps_INST     = $(INST_BIN)rdesktop-vrdp-keymaps/
+rdesktop-vrdp-keymaps_MODE     = 644
+rdesktop-vrdp-keymaps_DEFPATH := $(PATH_SUB_CURRENT)/keymaps
+rdesktop-vrdp-keymaps_SOURCES  = \
+	$(notdir $(wildcard $(VBOX_PATH_RDESKTOP_SRC)/keymaps/*))
+rdesktop-vrdp-keymaps_convert-map_MODE = 755
+
+
+#
+# The source tarball (further down).
+#
+INSTALLS += rdesktop-src
+rdesktop-src_INSTTYPE = stage
+rdesktop-src_INST     = misc-staging/$(VBOX_RDESKTOP_SRC_SUBDIR)/
+rdesktop-src_EXEC_SOURCES = \
+	configure \
+	config.sub \
+	config.guess \
+	bootstrap \
+	install-sh \
+	keymaps/convert-map=>keymaps/convert-map
+rdesktop-src_SOURCES = \
+	asn.c=>asn.c \
+	bitmap.c=>bitmap.c \
+	cache.c=>cache.c \
+	channels.c=>channels.c \
+	cliprdr.c=>cliprdr.c \
+	configure.ac=>configure.ac \
+	constants.h=>constants.h \
+	COPYING=>COPYING \
+	cssp.c=>cssp.c \
+	disk.c=>disk.c \
+	disk.h=>disk.h \
+	doc/TODO=>doc/TODO \
+	doc/patches.txt=>doc/patches.txt \
+	doc/ipv6.txt=>doc/ipv6.txt \
+	doc/ChangeLog=>doc/ChangeLog \
+	doc/keymap-names.txt=>doc/keymap-names.txt \
+	doc/HACKING=>doc/HACKING \
+	doc/AUTHORS=>doc/AUTHORS \
+	doc/keymapping.txt=>doc/keymapping.txt \
+	doc/rdesktop.1=>doc/rdesktop.1 \
+	doc/licensing.txt=>doc/licensing.txt \
+	doc/redirection.txt=>doc/redirection.txt \
+	ewmhints.c=>ewmhints.c \
+	iso.c=>iso.c \
+	keymaps/fr-ch=>keymaps/fr-ch \
+	keymaps/lv=>keymaps/lv \
+	keymaps/fr=>keymaps/fr \
+	keymaps/nl=>keymaps/nl \
+	keymaps/no=>keymaps/no \
+	keymaps/da=>keymaps/da \
+	keymaps/lt=>keymaps/lt \
+	keymaps/pl=>keymaps/pl \
+	keymaps/hr=>keymaps/hr \
+	keymaps/he=>keymaps/he \
+	keymaps/ja=>keymaps/ja \
+	keymaps/tr=>keymaps/tr \
+	keymaps/fo=>keymaps/fo \
+	keymaps/de=>keymaps/de \
+	keymaps/fr-be=>keymaps/fr-be \
+	keymaps/is=>keymaps/is \
+	keymaps/ko=>keymaps/ko \
+	keymaps/common=>keymaps/common \
+	keymaps/fi=>keymaps/fi \
+	keymaps/ar=>keymaps/ar \
+	keymaps/cs=>keymaps/cs \
+	keymaps/pt=>keymaps/pt \
+	keymaps/fr-ca=>keymaps/fr-ca \
+	keymaps/en-us=>keymaps/en-us \
+	keymaps/et=>keymaps/et \
+	keymaps/en-dv=>keymaps/en-dv \
+	keymaps/mk=>keymaps/mk \
+	keymaps/nl-be=>keymaps/nl-be \
+	keymaps/th=>keymaps/th \
+	keymaps/pt-br=>keymaps/pt-br \
+	keymaps/ru=>keymaps/ru \
+	keymaps/sv=>keymaps/sv \
+	keymaps/es=>keymaps/es \
+	keymaps/hu=>keymaps/hu \
+	keymaps/modifiers=>keymaps/modifiers \
+	keymaps/en-gb=>keymaps/en-gb \
+	keymaps/de-ch=>keymaps/de-ch \
+	keymaps/sl=>keymaps/sl \
+	keymaps/it=>keymaps/it \
+	licence.c=>licence.c \
+	lspci.c=>lspci.c \
+	Makefile.in=>Makefile.in \
+	mcs.c=>mcs.c \
+	mppc.c=>mppc.c \
+	orders.c=>orders.c \
+	orders.h=>orders.h \
+	parallel.c=>parallel.c \
+	parse.h=>parse.h \
+	printer.c=>printer.c \
+	printercache.c=>printercache.c \
+	proto.h=>proto.h \
+	proto.head=>proto.head \
+	proto.tail=>proto.tail \
+	pstcache.c=>pstcache.c \
+	rdesktop.c=>rdesktop.c \
+	rdesktop.h=>rdesktop.h \
+	rdesktop.spec=>rdesktop.spec \
+	rdp5.c=>rdp5.c \
+	rdp.c=>rdp.c \
+	rdpdr.c=>rdpdr.c \
+	rdpsnd.c=>rdpsnd.c \
+	rdpsnd_dsp.c=>rdpsnd_dsp.c \
+	rdpsnd_dsp.h=>rdpsnd_dsp.h \
+	rdpsnd.h=>rdpsnd.h \
+	rdpsnd_libao.c=>rdpsnd_libao.c \
+	rdpsnd_alsa.c=>rdpsnd_alsa.c \
+	rdpsnd_oss.c=>rdpsnd_oss.c \
+	rdpsnd_sgi.c=>rdpsnd_sgi.c \
+	rdpsnd_sun.c=>rdpsnd_sun.c \
+	README=>README \
+	scancodes.h=>scancodes.h \
+	scard.c=>scard.c \
+	scard.h=>scard.h \
+	seamless.c=>seamless.c \
+	seamless.h=>seamless.h \
+	secure.c=>secure.c \
+	serial.c=>serial.c \
+	ssl.c=>ssl.c \
+	ssl.h=>ssl.h \
+	tcp.c=>tcp.c \
+	types.h=>types.h \
+	utils.c=>utils.c \
+	vrdp/vrdpusb.h=>vrdp/vrdpusb.h \
+	vrdp/rdpusb.c=>vrdp/rdpusb.c \
+	xclip.c=>xclip.c \
+	ctrl.c=>ctrl.c \
+	xkeymap.c=>xkeymap.c \
+	xproto.h=>xproto.h \
+	xwin.c=>xwin.c \
+	$(PATH_OUT)/product-generated.h=>include/product-generated.h \
+	$(PATH_OUT)/version-generated.h=>include/version-generated.h \
+	$(PATH_OUT)/obj/Runtime/errmsgdata.h=>include/errmsgdata.h \
+	$(PATH_OUT)/obj/Runtime/errmsgvboxcomdata.h=>include/errmsgvboxcomdata.h \
+	$(PATH_ROOT)/include/iprt/alloc.h=>include/iprt/alloc.h \
+	$(PATH_ROOT)/include/iprt/alloca.h=>include/iprt/alloca.h \
+	$(PATH_ROOT)/include/iprt/asm.h=>include/iprt/asm.h \
+	$(PATH_ROOT)/include/iprt/asm-amd64-x86.h=>include/iprt/asm-amd64-x86.h \
+	$(PATH_ROOT)/include/iprt/asm-math.h=>include/iprt/asm-math.h \
+	$(PATH_ROOT)/include/iprt/assert.h=>include/iprt/assert.h \
+	$(PATH_ROOT)/include/iprt/avl.h=>include/iprt/avl.h \
+	$(PATH_ROOT)/include/iprt/cdefs.h=>include/iprt/cdefs.h \
+	$(PATH_ROOT)/include/iprt/cpp/autores.h=>include/iprt/cpp/autores.h \
+	$(PATH_ROOT)/include/iprt/critsect.h=>include/iprt/critsect.h \
+	$(PATH_ROOT)/include/iprt/ctype.h=>include/iprt/ctype.h \
+	$(PATH_ROOT)/include/iprt/dir.h=>include/iprt/dir.h \
+	$(PATH_ROOT)/include/iprt/env.h=>include/iprt/env.h \
+	$(PATH_ROOT)/include/iprt/err.h=>include/iprt/err.h \
+	$(PATH_ROOT)/include/iprt/errno.h=>include/iprt/errno.h \
+	$(PATH_ROOT)/include/iprt/file.h=>include/iprt/file.h \
+	$(PATH_ROOT)/include/iprt/fs.h=>include/iprt/fs.h \
+	$(PATH_ROOT)/include/iprt/linux/sysfs.h=>include/iprt/linux/sysfs.h \
+	$(PATH_ROOT)/include/iprt/list.h=>include/iprt/list.h \
+	$(PATH_ROOT)/include/iprt/log.h=>include/iprt/log.h \
+	$(PATH_ROOT)/include/iprt/lockvalidator.h=>include/iprt/lockvalidator.h \
+	$(PATH_ROOT)/include/iprt/mem.h=>include/iprt/mem.h \
+	$(PATH_ROOT)/include/iprt/net.h=>include/iprt/net.h \
+	$(PATH_ROOT)/include/iprt/param.h=>include/iprt/param.h \
+	$(PATH_ROOT)/include/iprt/path.h=>include/iprt/path.h \
+	$(PATH_ROOT)/include/iprt/pipe.h=>include/iprt/pipe.h \
+	$(PATH_ROOT)/include/iprt/poll.h=>include/iprt/poll.h \
+	$(PATH_ROOT)/include/iprt/process.h=>include/iprt/process.h \
+	$(PATH_ROOT)/include/iprt/queueatomic.h=>include/iprt/queueatomic.h \
+	$(PATH_ROOT)/include/iprt/sg.h=>include/iprt/sg.h \
+	$(PATH_ROOT)/include/iprt/stdarg.h=>include/iprt/stdarg.h \
+	$(PATH_ROOT)/include/iprt/stdint.h=>include/iprt/stdint.h \
+	$(PATH_ROOT)/include/iprt/stream.h=>include/iprt/stream.h \
+	$(PATH_ROOT)/include/iprt/string.h=>include/iprt/string.h \
+	$(PATH_ROOT)/include/iprt/time.h=>include/iprt/time.h \
+	$(PATH_ROOT)/include/iprt/thread.h=>include/iprt/thread.h \
+	$(PATH_ROOT)/include/iprt/types.h=>include/iprt/types.h \
+	$(PATH_ROOT)/include/iprt/uni.h=>include/iprt/uni.h \
+	$(PATH_ROOT)/include/iprt/x86.h=>include/iprt/x86.h \
+	$(PATH_ROOT)/include/VBox/cdefs.h=>include/VBox/cdefs.h \
+	$(PATH_ROOT)/include/VBox/err.h=>include/VBox/err.h \
+	$(PATH_ROOT)/include/VBox/log.h=>include/VBox/log.h \
+	$(PATH_ROOT)/include/VBox/sup.h=>include/VBox/sup.h \
+	$(PATH_ROOT)/include/VBox/types.h=>include/VBox/types.h \
+	$(PATH_ROOT)/include/VBox/usb.h=>include/VBox/usb.h \
+	$(PATH_ROOT)/include/VBox/usbfilter.h=>include/VBox/usbfilter.h \
+	$(PATH_ROOT)/include/VBox/usblib.h=>include/VBox/usblib.h \
+	$(PATH_ROOT)/include/VBox/version.h=>include/VBox/version.h \
+	$(PATH_ROOT)/include/VBox/vusb.h=>include/VBox/vusb.h \
+	$(PATH_ROOT)/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp=>vrdp/linux/USBProxyDevice-linux.cpp \
+	$(PATH_ROOT)/src/VBox/Devices/USB/USBProxyDevice.h=>vrdp/USBProxyDevice.h \
+	$(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB/USBLib.cpp=>vrdp/USBLib.cpp \
+	$(PATH_ROOT)/src/VBox/Main/include/USBGetDevices.h=>vrdp/USBGetDevices.h \
+	$(PATH_ROOT)/src/VBox/Main/include/vector.h=>vrdp/vector.h \
+	$(PATH_ROOT)/src/VBox/Main/src-server/linux/USBGetDevices.cpp=>vrdp/USBGetDevices.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/alloc.cpp=>Runtime/common/alloc/alloc.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/err/errmsg.cpp=>Runtime/common/err/errmsg.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/err/errmsgxpcom.cpp=>Runtime/common/err/errmsgxpcom.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp=>Runtime/common/err/RTErrConvertFromErrno.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp=>Runtime/common/err/RTErrConvertToErrno.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/misc/sg.cpp=>Runtime/common/misc/sg.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathAppend.cpp=>Runtime/common/path/RTPathAppend.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathAppendEx.cpp=>Runtime/common/path/RTPathAppendEx.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathCountComponents.cpp=>Runtime/common/path/RTPathCountComponents.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathFilename.cpp=>Runtime/common/path/RTPathFilename.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp=>Runtime/common/path/rtPathRootSpecLen.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathStripFilename.cpp=>Runtime/common/path/RTPathStripFilename.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp=>Runtime/common/path/RTPathStripTrailingSlash.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp=>Runtime/common/path/rtPathVolumeSpecLen.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/RTStrCopy.cpp=>Runtime/common/string/RTStrCopy.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/RTStrNLen.cpp=>Runtime/common/string/RTStrNLen.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/RTStrCmp.cpp=>Runtime/common/string/RTStrCmp.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/RTStrNCmp.cpp=>Runtime/common/string/RTStrNCmp.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/straprintf.cpp=>Runtime/common/string/straprintf.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/stringalloc.cpp=>Runtime/common/string/stringalloc.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strformat.cpp=>Runtime/common/string/strformat.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strformatrt.cpp=>Runtime/common/string/strformatrt.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strformattype.cpp=>Runtime/common/string/strformattype.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strprintf.cpp=>Runtime/common/string/strprintf.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strstrip.cpp=>Runtime/common/string/strstrip.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/strtonum.cpp=>Runtime/common/string/strtonum.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/unidata-flags.cpp=>Runtime/common/string/unidata-flags.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/unidata-upper.cpp=>Runtime/common/string/unidata-upper.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/unidata-lower.cpp=>Runtime/common/string/unidata-lower.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/utf-16.cpp=>Runtime/common/string/utf-16.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/utf-8.cpp=>Runtime/common/string/utf-8.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/string/utf-8-case.cpp=>Runtime/common/string/utf-8-case.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/common/time/timesysalias.cpp=>Runtime/common/time/timesysalias.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/generic/pathhost-generic.cpp=>Runtime/generic/pathhost-generic.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/generic/RTPathAbs-generic.cpp=>Runtime/generic/RTPathAbs-generic.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/alignmentchecks.h=>include/internal/alignmentchecks.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/dir.h=>include/internal/dir.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/file.h=>include/internal/file.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/fs.h=>include/internal/fs.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/iprt.h=>include/internal/iprt.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/lockvalidator.h=>include/internal/lockvalidator.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/magics.h=>include/internal/magics.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/mem.h=>include/internal/mem.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/path.h=>include/internal/path.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/pipe.h=>include/internal/pipe.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/process.h=>include/internal/process.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/string.h=>include/internal/string.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/thread.h=>include/internal/thread.h \
+	$(PATH_ROOT)/src/VBox/Runtime/include/internal/time.h=>include/internal/time.h \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/alloc.cpp=>Runtime/r3/alloc.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/alloc-ef.h=>Runtime/r3/alloc-ef.h \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/dir.cpp=>Runtime/r3/dir.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/fileio.cpp=>Runtime/r3/fileio.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/fs.cpp=>Runtime/r3/fs.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/linux/sysfs.cpp=>Runtime/r3/linux/sysfs.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/linux/time-linux.cpp=>Runtime/r3/linux/time-linux.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/dir-posix.cpp=>Runtime/r3/posix/dir-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/env-posix.cpp=>Runtime/r3/posix/env-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/fileio-posix.cpp=>Runtime/r3/posix/fileio-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/fs2-posix.cpp=>Runtime/r3/posix/fs2-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/fs3-posix.cpp=>Runtime/r3/posix/fs3-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/path-posix.cpp=>Runtime/r3/posix/path-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/path2-posix.cpp=>Runtime/r3/posix/path2-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/pipe-posix.cpp=>Runtime/r3/posix/pipe-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/thread2-posix.cpp=>Runtime/r3/posix/thread2-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/posix/utf8-posix.cpp=>Runtime/r3/posix/utf8-posix.cpp \
+	$(PATH_ROOT)/src/VBox/Runtime/r3/stream.cpp=>Runtime/r3/stream.cpp
+
+INSTALLS += rdesktop-tarball
+rdesktop-tarball_INST    = $(INST_BIN)
+rdesktop-tarball_MODE    = a+r,u+w
+rdesktop-tarball_SOURCES = $(rdesktop-tarball_0_OUTDIR)/rdesktop-vrdp.tar.gz
+rdesktop-tarball_CLEAN   = $(rdesktop-tarball_0_OUTDIR)/rdesktop-vrdp.tar.gz
+$$(rdesktop-tarball_0_OUTDIR)/rdesktop-vrdp.tar.gz: \
+		$$(rdesktop-src_1_TARGET) \
+		| $$(dir $$@)
+	$(call MSG_TOOL,tar/gzip,,$@)
+	$(QUIET)cd $(PATH_STAGE)/$(rdesktop-src_INST).. && tar -cf - $(VBOX_RDESKTOP_SRC_SUBDIR)/ | gzip - > $@
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
Index: /trunk/src/VBox/RDP/client-1.8.3/asn.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/asn.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/asn.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/bitmap.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/bitmap.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/bitmap.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /* three seperate function for speed when decompressing the bitmaps
Index: /trunk/src/VBox/RDP/client-1.8.3/cache.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/cache.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/cache.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/channels.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/channels.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/channels.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/cliprdr.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/cliprdr.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/cliprdr.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/configure
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/configure	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/configure	(revision 55123)
@@ -658,4 +658,7 @@
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+ac_ct_CXX
+CXXFLAGS
+CXX
 OBJEXT
 EXEEXT
@@ -746,4 +749,7 @@
 LIBS
 CPPFLAGS
+CXX
+CXXFLAGS
+CCC
 CPP
 XMKMF
@@ -1416,4 +1422,6 @@
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   XMKMF       Path to xmkmf, Makefile generator for X Window System
@@ -1561,4 +1569,42 @@
 
 } # ac_fn_c_try_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
 
 # ac_fn_c_try_cpp LINENO
@@ -3276,4 +3322,261 @@
     CFLAGS="$CFLAGS -Wall"
 fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
 # Find a good install program.  We prefer a C program (faster),
@@ -4906,4 +5209,60 @@
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${ac_cv_search_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_clock_gettime+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_clock_gettime+:} false; then :
+
+else
+  ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
 
 ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default"
@@ -5690,4 +6049,33 @@
 fi
 
+
+#
+# linux/compiler.h
+#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if linux/compiler.h is required" >&5
+$as_echo_n "checking if linux/compiler.h is required... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <linux/compiler.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ $as_echo "#define VBOX_WITH_LINUX_COMPILER_H 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
@@ -7134,5 +7522,5 @@
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
@@ -7180,5 +7568,5 @@
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
@@ -7204,5 +7592,5 @@
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
@@ -7249,5 +7637,5 @@
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
@@ -7273,5 +7661,5 @@
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
Index: /trunk/src/VBox/RDP/client-1.8.3/configure.ac
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/configure.ac	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/configure.ac	(revision 55123)
@@ -9,4 +9,5 @@
     CFLAGS="$CFLAGS -Wall"
 fi
+AC_PROG_CXX
 
 AC_PROG_INSTALL
@@ -32,4 +33,5 @@
 AC_SEARCH_LIBS(socket, socket)
 AC_SEARCH_LIBS(inet_aton, resolv)
+AC_SEARCH_LIBS(clock_gettime, rt)
 
 AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
@@ -223,10 +225,21 @@
 	}
 	return 0;
-}], 
- [AC_MSG_RESULT(no)], 
- [AC_MSG_RESULT(yes) 
-  AC_DEFINE(NEED_ALIGN)], 
- [AC_MSG_RESULT(assuming yes) 
+}],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(yes)
+  AC_DEFINE(NEED_ALIGN)],
+ [AC_MSG_RESULT(assuming yes)
   AC_DEFINE(NEED_ALIGN)])
+
+#
+# linux/compiler.h
+#
+AC_MSG_CHECKING([if linux/compiler.h is required])
+AC_TRY_COMPILE([
+#include <linux/compiler.h>
+],[],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(VBOX_WITH_LINUX_COMPILER_H)],
+[AC_MSG_RESULT(no)])
 
 
@@ -252,5 +265,5 @@
 AC_ARG_WITH(libvncserver,
     [  --with-libvncserver     make rdp2vnc],
-    [ 
+    [
     VNCINC=`$vncserverconfig --cflags`
     AC_SUBST(VNCINC)
@@ -271,6 +284,6 @@
 AC_ARG_WITH(sound,
     [  --with-sound            select sound system ("oss", "sgi", "sun", "alsa" or "libao") ],
-    [ 
-    sound="$withval" 
+    [
+    sound="$withval"
     ])
 
@@ -279,7 +292,7 @@
 AC_CHECK_HEADER(sys/audioio.h, [HAVE_SUN=1], [HAVE_SUN=0])
 
-AC_ARG_ENABLE(static-libsamplerate, 
-    [  --enable-static-libsamplerate link libsamplerate statically], 
-    [static_libsamplerate=yes], 
+AC_ARG_ENABLE(static-libsamplerate,
+    [  --enable-static-libsamplerate link libsamplerate statically],
+    [static_libsamplerate=yes],
     [static_libsamplerate=no])
 
@@ -854,5 +867,5 @@
 AC_ARG_WITH(ipv6,
     [  --with-ipv6             enable IPv6-support],
-    [ 
+    [
         if test $withval != "no";
         then
@@ -869,5 +882,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG,1)
 	fi
@@ -878,5 +891,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_KBD,1)
 	fi
@@ -887,5 +900,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_RDP5,1)
 	fi
@@ -896,5 +909,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_CLIPBOARD,1)
 	fi
@@ -905,5 +918,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_SOUND,1)
 	fi
@@ -914,5 +927,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_CHANNEL,1)
 	fi
@@ -923,5 +936,5 @@
     [
         if test $withval != "no";
-        then 
+        then
             AC_DEFINE(WITH_DEBUG_SEAMLESS,1)
 	fi
Index: /trunk/src/VBox/RDP/client-1.8.3/constants.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/constants.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/constants.h	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /* TCP port for Remote Desktop Protocol */
@@ -227,4 +236,5 @@
 #define KBD_FLAG_RIGHT          0x0001
 #define KBD_FLAG_EXT            0x0100
+#define KBD_FLAG_EXT2           0x0200
 #define KBD_FLAG_QUIET          0x1000
 #define KBD_FLAG_DOWN           0x4000
Index: /trunk/src/VBox/RDP/client-1.8.3/cssp.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/cssp.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/cssp.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <gssapi/gssapi.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/ctrl.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/ctrl.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/ctrl.c	(revision 55123)
@@ -17,4 +17,14 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
+
 #include "rdesktop.h"
 #include "ssl.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/disk.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/disk.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/disk.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "disk.h"
@@ -358,5 +367,9 @@
 		filename[strlen(filename) - 1] = 0;
 
+#ifdef VBOX
+	snprintf(path, sizeof(path),  "%s%s", g_rdpdr_device[device_id].local_path, filename);
+#else
 	sprintf(path, "%s%s", g_rdpdr_device[device_id].local_path, filename ? filename : "");
+#endif
 
 	/* Protect against mailicous servers:
@@ -827,6 +840,11 @@
 			convert_to_unix_filename(newname);
 
+#ifdef VBOX
+			snprintf(fullpath, sizeof(fullpath), "%s%s", g_rdpdr_device[pfinfo->device_id].local_path,
+				newname);
+#else
 			sprintf(fullpath, "%s%s", g_rdpdr_device[pfinfo->device_id].local_path,
 				newname);
+#endif
 
 			free(newname);
@@ -1213,5 +1231,9 @@
 
 			/* Get information for directory entry */
+#ifdef VBOX
+			snprintf(fullpath, sizeof(fullpath), "%s/%s", dirname, pdirent->d_name);
+#else
 			sprintf(fullpath, "%s/%s", dirname, pdirent->d_name);
+#endif
 
 			if (stat(fullpath, &filestat))
@@ -1370,6 +1392,11 @@
 disk_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out)
 {
+#ifdef VBOX
+	if (((request >> 16) != 20) && ((request >> 16) != 9))
+		return RD_STATUS_INVALID_PARAMETER;
+#else
 	if (((request >> 16) != 20) || ((request >> 16) != 9))
 		return RD_STATUS_INVALID_PARAMETER;
+#endif
 
 	/* extract operation */
Index: /trunk/src/VBox/RDP/client-1.8.3/disk.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/disk.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/disk.h	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #define FILE_ATTRIBUTE_READONLY			0x00000001
Index: /trunk/src/VBox/RDP/client-1.8.3/ewmhints.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/ewmhints.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/ewmhints.c	(revision 55123)
@@ -21,4 +21,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <X11/Xlib.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/iso.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/iso.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/iso.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/licence.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/licence.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/licence.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/lspci.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/lspci.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/lspci.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/mcs.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/mcs.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/mcs.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/mppc.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/mppc.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/mppc.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <stdio.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/orders.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/orders.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/orders.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/orders.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/orders.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/orders.h	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #define RDP_ORDER_STANDARD   0x01
Index: /trunk/src/VBox/RDP/client-1.8.3/parallel.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/parallel.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/parallel.c	(revision 55123)
@@ -16,4 +16,14 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
+
 #define	MAX_PARALLEL_DEVICES		1
 
Index: /trunk/src/VBox/RDP/client-1.8.3/parse.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/parse.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/parse.h	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /* Parser state */
Index: /trunk/src/VBox/RDP/client-1.8.3/printer.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/printer.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/printer.c	(revision 55123)
@@ -16,4 +16,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
@@ -116,5 +125,9 @@
 	else
 	{
+#ifdef VBOX
+                snprintf(cmd, sizeof(cmd), "lpr -P %s", pprinter_data->printer);
+#else
 		sprintf(cmd, "lpr -P %s", pprinter_data->printer);
+#endif
 		pprinter_data->printer_fp = popen(cmd, "w");
 	}
Index: /trunk/src/VBox/RDP/client-1.8.3/printercache.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/printercache.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/printercache.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /* According to the W2K RDP Printer Redirection WhitePaper, a data
Index: /trunk/src/VBox/RDP/client-1.8.3/proto.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/proto.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/proto.h	(revision 55123)
@@ -16,4 +16,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #ifndef RDESKTOP_PROTO_H
@@ -355,4 +364,9 @@
 void scardSetInfo(uint32 epoch, uint32 device, uint32 id, uint32 bytes_out);
 void scard_reset_state();
+/* vrdp/rdpusb.c */
+RD_BOOL rdpusb_init(void);
+void rdpusb_close (void);
+void rdpusb_add_fds(int *n, fd_set * rfds, fd_set * wfds);
+void rdpusb_check_fds(fd_set * rfds, fd_set * wfds);
 
 /* *INDENT-OFF* */
Index: /trunk/src/VBox/RDP/client-1.8.3/pstcache.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/pstcache.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/pstcache.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/rdesktop.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdesktop.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdesktop.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <stdarg.h>		/* va_list va_start va_end */
@@ -33,4 +42,9 @@
 #include <signal.h>
 #include "rdesktop.h"
+
+#ifdef VBOX
+# include <VBox/version.h>
+# include <iprt/log.h>
+#endif
 
 #ifdef HAVE_LOCALE_H
@@ -102,5 +116,10 @@
 RD_BOOL g_rdpclip = True;
 RD_BOOL g_console_session = False;
+#ifndef VBOX
 RD_BOOL g_numlock_sync = False;
+#else /* VBOX */
+/* Always use numlock synchronization with VRDP. */
+RD_BOOL g_numlock_sync = True;
+#endif /* VBOX */
 RD_BOOL g_lspci_enabled = False;
 RD_BOOL g_owncolmap = False;
@@ -142,4 +161,12 @@
 #endif
 
+#ifdef WITH_RDPUSB
+RD_BOOL g_rdpusb = False;
+#endif
+
+#ifdef WITH_BIRD_VD_HACKS
+RD_BOOL g_keep_virtual_desktop_shortcuts = False;
+#endif
+
 #ifdef HAVE_ICONV
 char g_codepage[16] = "";
@@ -169,4 +196,7 @@
 	fprintf(stderr,
 		"Version " PACKAGE_VERSION ". Copyright (C) 1999-2011 Matthew Chapman et al.\n");
+#ifdef VBOX
+        fprintf(stderr, "Modified for VirtualBox by " VBOX_VENDOR "\n");
+#endif
 	fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
 
@@ -231,4 +261,8 @@
 	rdpsnd_show_help();
 #endif
+#ifdef WITH_RDPUSB
+        fprintf(stderr, 
+                "         '-r usb': enable USB redirection\n");
+#endif
 	fprintf(stderr,
 		"         '-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard\n");
@@ -256,4 +290,8 @@
 	fprintf(stderr, "   -4: use RDP version 4\n");
 	fprintf(stderr, "   -5: use RDP version 5 (default)\n");
+#ifdef WITH_BIRD_VD_HACKS
+    fprintf(stderr, "   -H keep-virtual-desktop-shortcuts: Keep keyboard shortcuts typical\n"
+                    "      for switching virtual desktops (C-A-Left/Right). \n");
+#endif
 #ifdef WITH_SCARD
 	fprintf(stderr, "   -o: name=value: Adds an additional option to rdesktop.\n");
@@ -516,4 +554,12 @@
 
 }
+
+#ifdef VBOX
+/* This disables iprt logging */
+DECLEXPORT(PRTLOGGER) RTLogDefaultInit(void)
+{
+    return NULL;
+}
+#endif
 
 /* Client program */
@@ -571,6 +617,12 @@
 #define VNCOPT
 #endif
+#ifdef WITH_BIRD_VD_HACKS
+#define VDHOPT "H:"
+#else
+#define VDHOPT
+#endif
+
 	while ((c = getopt(argc, argv,
-			   VNCOPT "A:u:L:d:s:c:p:n:k:g:o:fbBeEitmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
+			   VNCOPT VDHOPT "A:u:L:d:s:c:p:n:k:g:o:fbBeEitmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
 	{
 		switch (c)
@@ -853,4 +905,12 @@
 #endif
 					}
+				}
+				else if (str_startswith(optarg, "usb"))
+ 				{
+#ifdef WITH_RDPUSB
+					g_rdpusb = True;
+#else
+					warning("Not compiled with USB support\n");
+#endif
 				}
 				else if (str_startswith(optarg, "disk"))
@@ -950,4 +1010,14 @@
 				break;
 #endif
+
+#ifdef WITH_BIRD_VD_HACKS
+			case 'H': /* hacks */
+				if (!strcmp(optarg, "keep-virtual-desktop-shortcuts"))
+					g_keep_virtual_desktop_shortcuts = True;
+				else
+					error("Unknown -H argument\n\n\tPossible argument is: keep-virtual-desktop-shortcuts\n");
+				break;
+#endif
+
 			case 'h':
 			case '?':
@@ -1111,5 +1181,10 @@
 #endif
 
-	if (g_lspci_enabled)
+#ifdef WITH_RDPUSB
+	if (g_rdpusb)
+		rdpusb_init();
+#endif
+
+        if (g_lspci_enabled)
 		lspci_init();
 
@@ -1215,4 +1290,9 @@
 	cache_save_state();
 	ui_deinit();
+
+#ifdef WITH_RDPUSB
+        if (g_rdpusb)
+                rdpusb_close();
+#endif
 
 	if (g_user_quit)
@@ -1794,5 +1874,9 @@
 		return False;
 
+#ifdef VBOX
+	snprintf(bmpcache_dir, sizeof(bmpcache_dir), "%s/%s", home, ".rdesktop");
+#else
 	sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop");
+#endif
 
 	if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST)
@@ -1802,5 +1886,9 @@
 	}
 
+#ifdef VBOX
+	snprintf(bmpcache_dir, sizeof(bmpcache_dir), "%s/%s", home, ".rdesktop/cache");
+#else
 	sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop/cache");
+#endif
 
 	if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST)
@@ -1824,5 +1912,9 @@
 	if (home == NULL)
 		return -1;
+#ifdef VBOX
+	snprintf(fn, sizeof(fn), "%s/.rdesktop/%s", home, filename);
+#else
 	sprintf(fn, "%s/.rdesktop/%s", home, filename);
+#endif
 	fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
 	if (fd == -1)
Index: /trunk/src/VBox/RDP/client-1.8.3/rdesktop.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdesktop.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdesktop.h	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <stdlib.h>
@@ -121,4 +130,8 @@
 #define EXRD_UNKNOWN 63
 
+#ifdef VBOX
+#undef DEBUG
+#endif
+
 #ifdef WITH_DEBUG
 #define DEBUG(args)	printf args;
Index: /trunk/src/VBox/RDP/client-1.8.3/rdp.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdp.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdp.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <time.h>
@@ -30,9 +39,26 @@
 #ifdef HAVE_ICONV
 #ifdef HAVE_ICONV_H
+
+#if defined(RT_OS_SOLARIS) && !defined(_XPG6)
+# define VBOX_XPG6_TMP_DEF
+# define _XPG6
+#endif
+#if defined(RT_OS_SOLARIS) && defined(__USE_LEGACY_PROTOTYPES__)
+# define VBOX_LEGACY_PROTO_TMP_DEF
+# undef __USE_LEGACY_PROTOTYPES__
+#endif
 #include <iconv.h>
+#if defined(VBOX_XPG6_TMP_DEF)
+# undef _XPG6
+# undef VBOX_XPG6_TMP_DEF
+#endif
+#if defined(VBOX_LEGACY_PROTO_TMP_DEF)
+# define  __USE_LEGACY_PROTOTYPES__
+# undef VBOX_LEGACY_PROTO_TMP_DEF
 #endif
 
 #ifndef ICONV_CONST
 #define ICONV_CONST ""
+#endif
 #endif
 #endif
@@ -845,4 +871,5 @@
 }
 
+#ifndef VBOX
 /* Output new pointer capability set */
 static void
@@ -856,4 +883,5 @@
 	out_uint16_le(s, 20);	/* Cache size for new pointers */
 }
+#endif
 
 /* Output share capability set */
@@ -943,5 +971,9 @@
 	{
 		caplen += RDP_CAPLEN_BMPCACHE2;
+#ifdef VBOX
+		caplen += RDP_CAPLEN_POINTER;
+#else
 		caplen += RDP_CAPLEN_NEWPOINTER;
+#endif
 	}
 	else
@@ -972,5 +1004,9 @@
 	{
 		rdp_out_bmpcache2_caps(s);
+#ifdef VBOX
+		rdp_out_pointer_caps(s);
+#else
 		rdp_out_newpointer_caps(s);
+#endif
 	}
 	else
Index: /trunk/src/VBox/RDP/client-1.8.3/rdp5.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdp5.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdp5.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpdr.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpdr.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpdr.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /*
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <assert.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd.h	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 struct audio_packet
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_alsa.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_alsa.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_alsa.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <strings.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_dsp.h	(revision 55123)
@@ -18,4 +18,13 @@
 */
 
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
+
 /* Software volume control */
 void rdpsnd_dsp_softvol_set(uint16 left, uint16 right);
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_libao.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_libao.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_libao.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_oss.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_oss.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_oss.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 /* 
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sgi.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sgi.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sgi.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sun.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sun.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/rdpsnd_sun.c	(revision 55123)
@@ -22,4 +22,13 @@
 */
 
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
+
 #include "rdesktop.h"
 #include "rdpsnd.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/scard.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/scard.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/scard.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <stdio.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/scard.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/scard.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/scard.h	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <pthread.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/seamless.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/seamless.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/seamless.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/secure.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/secure.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/secure.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/serial.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/serial.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/serial.c	(revision 55123)
@@ -17,4 +17,14 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
+
 #include <unistd.h>
 #include <fcntl.h>
@@ -38,5 +48,5 @@
 #define DEBUG_SERIAL(args) printf args;
 #else
-#define DEBUG_SERIAL(args)
+#define DEBUG_SERIAL(args) do {} while (0)
 #endif
 
Index: /trunk/src/VBox/RDP/client-1.8.3/ssl.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/ssl.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/ssl.c	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include "rdesktop.h"
Index: /trunk/src/VBox/RDP/client-1.8.3/ssl.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/ssl.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/ssl.h	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #ifndef _RDSSL_H
Index: /trunk/src/VBox/RDP/client-1.8.3/tcp.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/tcp.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/tcp.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #ifndef _WIN32
Index: /trunk/src/VBox/RDP/client-1.8.3/types.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/types.h	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/types.h	(revision 55123)
@@ -18,4 +18,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 typedef int RD_BOOL;
Index: /trunk/src/VBox/RDP/client-1.8.3/utils.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/utils.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/utils.c	(revision 55123)
@@ -17,4 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <stdio.h>
Index: /trunk/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c	(revision 55123)
+++ /trunk/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c	(revision 55123)
@@ -0,0 +1,955 @@
+/** @file
+ *
+ * Remote Desktop Protocol client:
+ * USB Channel Process Functions
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/* DEBUG is defined in ../rdesktop.h */
+#ifdef DEBUG
+# define VBOX_DEBUG DEBUG
+#endif
+#include "../rdesktop.h"
+#undef DEBUG
+#ifdef VBOX_DEBUG
+# define DEBUG VBOX_DEBUG
+#endif
+
+#include "vrdpusb.h"
+#include "USBProxyDevice.h"
+#include "USBGetDevices.h"
+
+#include <iprt/cdefs.h>
+#include <iprt/types.h>
+#include <iprt/err.h>
+#include <iprt/log.h>
+
+#include <unistd.h>
+#include <ctype.h>
+#include <fcntl.h>
+
+
+#define RDPUSB_REQ_OPEN              (0)
+#define RDPUSB_REQ_CLOSE             (1)
+#define RDPUSB_REQ_RESET             (2)
+#define RDPUSB_REQ_SET_CONFIG        (3)
+#define RDPUSB_REQ_CLAIM_INTERFACE   (4)
+#define RDPUSB_REQ_RELEASE_INTERFACE (5)
+#define RDPUSB_REQ_INTERFACE_SETTING (6)
+#define RDPUSB_REQ_QUEUE_URB         (7)
+#define RDPUSB_REQ_REAP_URB          (8)
+#define RDPUSB_REQ_CLEAR_HALTED_EP   (9)
+#define RDPUSB_REQ_CANCEL_URB        (10)
+#define RDPUSB_REQ_DEVICE_LIST       (11)
+#define RDPUSB_REQ_NEGOTIATE         (12)
+
+static VCHANNEL *rdpusb_channel;
+
+/** Well-known locations for the Linux Usbfs virtual file system */
+static const struct
+{
+    /** Expected mount location for Usbfs */
+    const char *pcszRoot;
+    /** Expected location of the "devices" file */
+    const char *pcszDevices;
+} g_usbfsPaths[] =
+{
+    { "/proc/bus/usb", "/proc/bus/usb/devices" },
+    { "/dev/bus/usb",  "/dev/bus/usb/devices" }
+};
+
+/** Location at which the USB device tree was found.  NULL means not
+ * found. */
+static const char *g_pcszDevicesRoot = NULL;
+static bool g_fUseSysfs = false;
+
+static PUSBDEVICE g_pUsbDevices = NULL;
+
+/* A device list entry */
+#pragma pack (1)
+typedef struct _DevListEntry
+{
+	uint16_t oNext;                /* Offset of the next structure. 0 if last. */
+	uint32_t id;                   /* Identifier of the device assigned by the client. */
+	uint16_t bcdUSB;               /* USB verion number. */
+	uint8_t bDeviceClass;          /* Device class. */
+	uint8_t bDeviceSubClass;       /* Device subclass. */
+	uint8_t bDeviceProtocol;       /* Device protocol. */
+	uint16_t idVendor;             /* Vendor id. */
+	uint16_t idProduct;            /* Product id. */
+	uint16_t bcdRev;               /* Revision. */
+	uint16_t oManufacturer;        /* Offset of manufacturer string. */
+	uint16_t oProduct;             /* Offset of product string. */
+	uint16_t oSerialNumber;        /* Offset of serial string. */
+	uint16_t idPort;               /* Physical USB port the device is connected to. */
+} DevListEntry;
+#pragma pack ()
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_open(PUSBPROXYDEV p, const char *pszAddress)
+{
+     return g_USBProxyDeviceHost.pfnOpen (p, pszAddress, NULL);
+}
+
+static inline void op_usbproxy_back_close(PUSBPROXYDEV pDev)
+{
+     return g_USBProxyDeviceHost.pfnClose (pDev);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_reset(PUSBPROXYDEV pDev)
+{
+    return g_USBProxyDeviceHost.pfnReset (pDev, false);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_set_config(PUSBPROXYDEV pDev, int cfg)
+{
+    return g_USBProxyDeviceHost.pfnSetConfig (pDev, cfg);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_claim_interface(PUSBPROXYDEV pDev, int ifnum)
+{
+    return g_USBProxyDeviceHost.pfnClaimInterface (pDev, ifnum);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_release_interface(PUSBPROXYDEV pDev, int ifnum)
+{
+    return g_USBProxyDeviceHost.pfnReleaseInterface (pDev, ifnum);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_interface_setting(PUSBPROXYDEV pDev, int ifnum, int setting)
+{
+    return g_USBProxyDeviceHost.pfnSetInterface (pDev, ifnum, setting);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_queue_urb(PUSBPROXYDEV pDev, PVUSBURB pUrb)
+{
+    return g_USBProxyDeviceHost.pfnUrbQueue(pDev, pUrb);
+}
+
+static inline PVUSBURB op_usbproxy_back_reap_urb(PUSBPROXYDEV pDev, unsigned cMillies)
+{
+    return g_USBProxyDeviceHost.pfnUrbReap (pDev, cMillies);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_clear_halted_ep(PUSBPROXYDEV pDev, unsigned EndPoint)
+{
+    return g_USBProxyDeviceHost.pfnClearHaltedEndpoint (pDev, EndPoint);
+}
+
+/**
+ * @returns VBox status code.
+ */
+static inline int op_usbproxy_back_cancel_urb(PUSBPROXYDEV pDev, PVUSBURB pUrb)
+{
+    return g_USBProxyDeviceHost.pfnUrbCancel (pDev, pUrb);
+}
+
+
+/** Count the USB devices in a linked list of PUSBDEVICE structures. */
+unsigned countUSBDevices(PUSBDEVICE pDevices)
+{
+    unsigned i = 0;
+    for (; pDevices; pDevices = pDevices->pNext)
+        ++i;
+    return i;
+}
+
+
+enum {
+    /** The space we set aside for the USB strings.  Should always be enough,
+     * as a USB device contains up to 256 characters of UTF-16 string data. */
+    MAX_STRINGS_LEN = 1024,
+    /** The space we reserve for each wire format device entry */
+    DEV_ENTRY_SIZE = sizeof(DevListEntry) + MAX_STRINGS_LEN
+};
+
+
+/**
+ * Add a string to the end of a wire format device entry.
+ * @param pBuf      the start of the buffer containing the entry
+ * @param iBuf      the index into the buffer to add the string at
+ * @param pcsz      the string to add - optional
+ * @param piString  where to write back @a iBuf or zero if there is no string
+ * @param piNext    where to write back the index where the next string may
+ *                  start
+ */
+static void addStringToEntry(char *pBuf, uint16_t iBuf, const char *pcsz,
+                             uint16_t *piString, uint16_t *piNext)
+{
+    size_t cch;
+
+    *piString = 0;
+    *piNext = iBuf;
+    if (!pcsz)
+        return;
+    cch = strlen(pcsz) + 1;
+    if (cch > DEV_ENTRY_SIZE - iBuf)
+        return;
+    strcpy(pBuf + iBuf, pcsz);
+    *piString = iBuf;
+    *piNext = iBuf + cch;
+}
+
+
+/** Fill in a device list entry in wire format from a PUSBDEVICE and return an
+ * index to where the next string should start */
+static void fillWireListEntry(char *pBuf, PUSBDEVICE pDevice,
+                              uint16_t *piNext)
+{
+    DevListEntry *pEntry;
+    uint16_t iNextString = sizeof(DevListEntry);
+
+    pEntry = (DevListEntry *)pBuf;
+    pEntry->id              = (pDevice->bPort << 8) + pDevice->bBus;
+    pEntry->bcdUSB          = pDevice->bcdUSB;
+    pEntry->bDeviceClass    = pDevice->bDeviceClass;
+    pEntry->bDeviceSubClass = pDevice->bDeviceSubClass;
+    pEntry->idVendor        = pDevice->idVendor;
+    pEntry->idProduct       = pDevice->idProduct;
+    pEntry->bcdRev          = pDevice->bcdDevice;
+    pEntry->idPort          = pDevice->bPort;
+    addStringToEntry(pBuf, iNextString, pDevice->pszManufacturer,
+                     &pEntry->oManufacturer, &iNextString);
+    addStringToEntry(pBuf, iNextString, pDevice->pszProduct,
+                     &pEntry->oProduct, &iNextString);
+    addStringToEntry(pBuf, iNextString, pDevice->pszSerialNumber,
+                     &pEntry->oSerialNumber, &pEntry->oNext);
+    *piNext = pEntry->oNext;
+}
+
+
+/** Allocate (and return) a buffer for a device list in VRDP wire format,
+ * and populate from a PUSBDEVICE linked list.  @a pLen takes the length of
+ * the new list.
+ * See @a Console::processRemoteUSBDevices for the receiving end. */
+static void *buildWireListFromDevices(PUSBDEVICE pDevices, int *pLen)
+{
+    char *pBuf;
+    unsigned cDevs, cbBuf, iCurrent;
+    uint16_t iNext;
+    PUSBDEVICE pCurrent;
+
+    cDevs = countUSBDevices(pDevices);
+    cbBuf = cDevs * DEV_ENTRY_SIZE + 2;
+    pBuf = (char *)xmalloc(cbBuf);
+    memset(pBuf, 0, cbBuf);
+    for (pCurrent = pDevices, iCurrent = 0; pCurrent;
+         pCurrent = pCurrent->pNext, iCurrent += iNext, --cDevs)
+    {
+        unsigned i, cZeros;
+
+        AssertReturnStmt(iCurrent + DEV_ENTRY_SIZE + 2 <= cbBuf,
+                         free(pBuf), NULL);
+        fillWireListEntry(pBuf + iCurrent, pCurrent, &iNext);
+            DevListEntry *pEntry = (DevListEntry *)(pBuf + iCurrent);
+        /* Sanity tests */
+        for (i = iCurrent + sizeof(DevListEntry), cZeros = 0;
+             i < iCurrent + iNext; ++i)
+             if (pBuf[i] == 0)
+                 ++cZeros;
+        AssertReturnStmt(cZeros ==   RT_BOOL(pEntry->oManufacturer)
+                                   + RT_BOOL(pEntry->oProduct)
+                                   + RT_BOOL(pEntry->oSerialNumber),
+                         free(pBuf), NULL);
+        Assert(pEntry->oManufacturer == 0 || pBuf[iCurrent + pEntry->oManufacturer] != '\0');
+        Assert(pEntry->oProduct == 0 || pBuf[iCurrent + pEntry->oProduct] != '\0');
+        Assert(pEntry->oSerialNumber == 0 || pBuf[iCurrent + pEntry->oSerialNumber] != '\0');
+        AssertReturnStmt(cZeros == 0 || pBuf[iCurrent + iNext - 1] == '\0',
+                         free(pBuf), NULL);
+    }
+    *pLen = iCurrent + iNext + 2;
+    Assert(cDevs == 0);
+    Assert(*pLen <= cbBuf);
+    return pBuf;
+}
+
+
+/** Build a list of the usable USB devices currently connected to the client
+ * system using the VRDP wire protocol.  The structure returned must be freed
+ * using free(3) when it is no longer needed; returns NULL and sets *pLen to
+ * zero on failure. */
+static void *build_device_list (int *pLen)
+{
+    void *pvDeviceList;
+
+    Log(("RDPUSB build_device_list"));
+    *pLen = 0;
+    if (g_pUsbDevices)
+        deviceListFree(&g_pUsbDevices);
+    g_pUsbDevices = USBProxyLinuxGetDevices(g_pcszDevicesRoot, g_fUseSysfs);
+    if (!g_pUsbDevices)
+        return NULL;
+    pvDeviceList = buildWireListFromDevices(g_pUsbDevices, pLen);
+    return pvDeviceList;
+}
+
+
+static STREAM
+rdpusb_init_packet(uint32 len, uint8 code)
+{
+	STREAM s;
+
+	s = channel_init(rdpusb_channel, len + 5);
+	out_uint32_le (s, len + sizeof (code)); /* The length of data after the 'len' field. */
+	out_uint8(s, code);
+	return s;
+}
+
+static void
+rdpusb_send(STREAM s)
+{
+#ifdef RDPUSB_DEBUG
+	Log(("RDPUSB send:\n"));
+	hexdump(s->channel_hdr + 8, s->end - s->channel_hdr - 8);
+#endif
+
+	channel_send(s, rdpusb_channel);
+}
+
+static void
+rdpusb_send_reply (uint8_t code, uint8_t status, uint32_t devid)
+{
+	STREAM s = rdpusb_init_packet(5, code);
+	out_uint8(s, status);
+	out_uint32_le(s, devid);
+	s_mark_end(s);
+	rdpusb_send(s);
+}
+
+static void
+rdpusb_send_access_denied (uint8_t code, uint32_t devid)
+{
+    rdpusb_send_reply (code, VRDP_USB_STATUS_ACCESS_DENIED, devid);
+}
+
+static inline int
+vrdp_usb_status (int rc, VUSBDEV *pdev)
+{
+	if (!rc || usbProxyFromVusbDev(pdev)->fDetached)
+	{
+		return VRDP_USB_STATUS_DEVICE_REMOVED;
+	}
+
+	return VRDP_USB_STATUS_SUCCESS;
+}
+
+static PUSBPROXYDEV g_proxies = NULL;
+
+static PUSBPROXYDEV 
+devid2proxy (uint32_t devid)
+{
+	PUSBPROXYDEV proxy = g_proxies;
+
+	while (proxy && proxy->devid != devid)
+	{
+		proxy = proxy->pNext;
+	}
+
+	return proxy;
+}
+
+static void
+rdpusb_reap_urbs (void)
+{
+	STREAM s;
+
+	PVUSBURB pUrb = NULL;
+
+	PUSBPROXYDEV proxy = g_proxies;
+
+	while (proxy)
+	{
+		pUrb = op_usbproxy_back_reap_urb(proxy, 0);
+
+		if (pUrb)
+		{
+			int datalen = 0;
+
+			Log(("RDPUSB: rdpusb_reap_urbs: cbData = %d, enmStatus = %d\n", pUrb->cbData, pUrb->enmStatus));
+
+			if (pUrb->enmDir == VUSB_DIRECTION_IN)
+			{
+				datalen = pUrb->cbData;
+			}
+
+			s = rdpusb_init_packet(14 + datalen, RDPUSB_REQ_REAP_URB);
+			out_uint32_le(s, proxy->devid);
+			out_uint8(s, VRDP_USB_REAP_FLAG_LAST);
+			out_uint8(s, pUrb->enmStatus);
+			out_uint32_le(s, pUrb->handle);
+			out_uint32_le(s, pUrb->cbData);
+
+			if (datalen)
+			{
+				out_uint8a (s, pUrb->abData, datalen);
+			}
+
+			s_mark_end(s);
+			rdpusb_send(s);
+
+			if (pUrb->pPrev || pUrb->pNext || pUrb == proxy->pUrbs)
+			{
+				/* Remove the URB from list. */
+				if (pUrb->pPrev)
+				{
+					pUrb->pPrev->pNext = pUrb->pNext;
+				}
+				else
+				{
+					proxy->pUrbs = pUrb->pNext;
+				}
+
+				if (pUrb->pNext)
+				{
+					pUrb->pNext->pPrev = pUrb->pPrev;
+				}
+			}
+
+#ifdef RDPUSB_DEBUG
+			Log(("Going to free %p\n", pUrb));
+#endif
+			xfree (pUrb);
+#ifdef RDPUSB_DEBUG
+			Log(("freed %p\n", pUrb));
+#endif
+		}
+
+		proxy = proxy->pNext;
+	}
+
+	return;
+}
+
+static void
+rdpusb_process(STREAM s)
+{
+	int rc;
+
+	uint32 len;
+	uint8 code;
+	uint32 devid;
+
+	PUSBPROXYDEV proxy = NULL;
+
+#ifdef RDPUSB_DEBUG
+	Log(("RDPUSB recv:\n"));
+	hexdump(s->p, s->end - s->p);
+#endif
+
+	in_uint32_le (s, len);
+	if (len > s->end - s->p)
+	{
+		error("RDPUSB: not enough data len = %d, bytes left %d\n", len, s->end - s->p);
+		return;
+	}
+
+	in_uint8(s, code);
+
+	Log(("RDPUSB recv: len = %d, code = %d\n", len, code));
+
+	switch (code)
+	{
+		case RDPUSB_REQ_OPEN:
+		{
+			PUSBDEVICE pDevice;
+
+			in_uint32_le(s, devid);
+
+			proxy = (PUSBPROXYDEV )xmalloc (sizeof (USBPROXYDEV));
+			if (!proxy)
+			{
+				error("RDPUSB: Out of memory allocating proxy backend data\n");
+				return;
+			}
+
+			memset (proxy, 0, sizeof (USBPROXYDEV));
+
+			proxy->pvInstanceDataR3 = xmalloc(g_USBProxyDeviceHost.cbBackend);
+			if (!proxy->pvInstanceDataR3)
+			{
+				error("RDPUSB: Out of memory allocating proxy backend data\n");
+				return;
+			}
+
+			proxy->Dev.pszName = "Remote device";
+			proxy->devid = devid;
+
+			for (pDevice = g_pUsbDevices; pDevice; pDevice = pDevice->pNext)
+				if ((pDevice->bPort << 8) + pDevice->bBus == devid)
+					break;
+
+			rc = pDevice ? op_usbproxy_back_open(proxy, pDevice->pszAddress)
+			             : VERR_NOT_FOUND;
+
+			if (rc != VINF_SUCCESS)
+			{
+				rdpusb_send_access_denied (code, devid);
+				xfree (proxy);
+				proxy = NULL;
+			}
+			else
+			{
+				if (g_proxies)
+				{
+					g_proxies->pPrev = proxy;
+				}
+
+				proxy->pNext = g_proxies;
+				g_proxies = proxy;
+			}
+		} break;
+
+		case RDPUSB_REQ_CLOSE:
+		{
+			in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (proxy)
+			{
+				op_usbproxy_back_close(proxy);
+
+				if (proxy->pPrev)
+				{
+					proxy->pPrev->pNext = proxy->pNext;
+				}
+				else
+				{
+					g_proxies = proxy->pNext;
+				}
+
+				if (proxy->pNext)
+				{
+					proxy->pNext->pPrev = proxy->pPrev;
+				}
+
+				xfree (proxy->pvInstanceDataR3);
+				xfree (proxy);
+				proxy = NULL;
+			}
+
+			/* No reply. */
+		} break;
+
+		case RDPUSB_REQ_RESET:
+		{
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+			rc = op_usbproxy_back_reset(proxy);
+			if (rc != VINF_SUCCESS)
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (!rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_SET_CONFIG:
+		{
+			uint8 cfg;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint8(s, cfg);
+
+			rc = op_usbproxy_back_set_config(proxy, cfg);
+			if (RT_FAILURE(rc))
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_CLAIM_INTERFACE:
+		{
+			uint8 ifnum;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint8(s, ifnum);
+				in_uint8(s, ifnum);
+
+			rc = op_usbproxy_back_claim_interface(proxy, ifnum);
+			if (RT_FAILURE(rc))
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_RELEASE_INTERFACE:
+		{
+			uint8 ifnum;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint8(s, ifnum);
+
+			rc = op_usbproxy_back_release_interface(proxy, ifnum);
+			if (RT_FAILURE(rc))
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_INTERFACE_SETTING:
+		{
+			uint8 ifnum;
+			uint8 setting;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint8(s, ifnum);
+	        	in_uint8(s, setting);
+
+			rc = op_usbproxy_back_interface_setting(proxy, ifnum, setting);
+			if (RT_FAILURE(rc))
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_QUEUE_URB:
+		{
+			uint32 handle;
+			uint8 type;
+			uint8 ep;
+			uint8 dir;
+			uint32 urblen;
+			uint32 datalen;
+
+			PVUSBURB pUrb; // struct vusb_urb *urb;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				/* No reply. */
+				break;
+			}
+
+	        	in_uint32(s, handle);
+	        	in_uint8(s, type);
+	        	in_uint8(s, ep);
+	        	in_uint8(s, dir);
+	        	in_uint32(s, urblen);
+	        	in_uint32(s, datalen);
+
+			/* Allocate a single block for URB description and data buffer */
+			pUrb = (PVUSBURB)xmalloc (sizeof (VUSBURB) +
+			                          (urblen <= sizeof (pUrb->abData)? 0: urblen - sizeof (pUrb->abData))
+						 );
+			memset (pUrb, 0, sizeof (VUSBURB));
+			pUrb->pDev = &proxy->Dev;
+			pUrb->handle = handle;
+			pUrb->enmType = type;
+			pUrb->enmStatus = 0;
+			pUrb->EndPt = ep;
+			pUrb->enmDir = dir;
+			pUrb->cbData = urblen;
+
+			Log(("RDPUSB: queued URB handle = %d\n", handle));
+
+			if (datalen)
+			{
+				in_uint8a (s, pUrb->abData, datalen);
+			}
+
+			rc = op_usbproxy_back_queue_urb(proxy, pUrb);
+
+			/* No reply required. */
+
+			if (RT_SUCCESS(rc))
+			{
+				if (proxy->pUrbs)
+				{
+					proxy->pUrbs->pPrev = pUrb;
+				}
+
+				pUrb->pNext = proxy->pUrbs;
+				proxy->pUrbs = pUrb;
+			}
+			else
+			{
+				xfree (pUrb);
+			}
+		} break;
+
+		case RDPUSB_REQ_REAP_URB:
+		{
+			rdpusb_reap_urbs ();
+		} break;
+
+		case RDPUSB_REQ_CLEAR_HALTED_EP:
+		{
+			uint8 ep;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint8(s, ep);
+
+			rc = op_usbproxy_back_clear_halted_ep(proxy, ep);
+			if (RT_FAILURE(rc))
+			{
+				rdpusb_send_reply (code, vrdp_usb_status (rc, &proxy->Dev), devid);
+			}
+		} break;
+
+		case RDPUSB_REQ_CANCEL_URB:
+		{
+			uint32 handle;
+			PVUSBURB pUrb = NULL;
+
+	        	in_uint32_le(s, devid);
+			proxy = devid2proxy (devid);
+
+			if (!proxy)
+			{
+				rdpusb_send_access_denied (code, devid);
+				break;
+			}
+
+	        	in_uint32_le(s, handle);
+
+			pUrb = proxy->pUrbs;
+
+			while (pUrb && pUrb->handle != handle)
+			{
+				pUrb = pUrb->pNext;
+			}
+
+			if (pUrb)
+			{
+				op_usbproxy_back_cancel_urb(proxy, pUrb);
+
+				/* No reply required. */
+
+				/* Remove URB from list. */
+				if (pUrb->pPrev)
+				{
+					pUrb->pPrev->pNext = pUrb->pNext;
+				}
+				else
+				{
+					proxy->pUrbs = pUrb->pNext;
+				}
+
+				if (pUrb->pNext)
+				{
+					pUrb->pNext->pPrev = pUrb->pPrev;
+				}
+
+				pUrb->pNext = pUrb->pPrev = NULL;
+
+				Log(("Cancelled URB %p\n", pUrb));
+
+				// xfree (pUrb);
+			}
+		} break;
+
+		case RDPUSB_REQ_DEVICE_LIST:
+		{
+			void *buf = NULL;
+			int len = 0;
+
+			buf = build_device_list (&len);
+
+			s = rdpusb_init_packet(len? len: 2, code);
+			if (len)
+			{
+				out_uint8p (s, buf, len);
+			}
+			else
+			{
+				out_uint16_le(s, 0);
+			}
+			s_mark_end(s);
+			rdpusb_send(s);
+
+			if (buf)
+			{
+				free (buf);
+			}
+		} break;
+
+		case RDPUSB_REQ_NEGOTIATE:
+		{
+			s = rdpusb_init_packet(1, code);
+			out_uint8(s, VRDP_USB_CAPS_FLAG_ASYNC);
+			s_mark_end(s);
+			rdpusb_send(s);
+		} break;
+
+		default:
+			unimpl("RDPUSB code %d\n", code);
+			break;
+	}
+}
+
+void
+rdpusb_add_fds(int *n, fd_set * rfds, fd_set * wfds)
+{
+	PUSBPROXYDEV proxy = g_proxies;
+
+//	Log(("RDPUSB: rdpusb_add_fds: begin *n = %d\n", *n));
+
+	while (proxy)
+	{
+		int fd = USBProxyDeviceLinuxGetFD(proxy);
+
+		if (fd != -1)
+		{
+//		        Log(("RDPUSB: rdpusb_add_fds: adding %d\n", proxy->priv.File));
+
+			FD_SET(fd, rfds);
+			FD_SET(fd, wfds);
+			*n = MAX(*n, fd);
+		}
+
+		proxy = proxy->pNext;
+	}
+
+//	Log(("RDPUSB: rdpusb_add_fds: end *n = %d\n", *n));
+
+	return;
+}
+
+void
+rdpusb_check_fds(fd_set * rfds, fd_set * wfds)
+{
+	PUSBPROXYDEV proxy = g_proxies;
+	unsigned found = 0;
+
+	while (proxy)
+	{
+		int fd = USBProxyDeviceLinuxGetFD(proxy);
+
+		if (fd != -1)
+		{
+			if (FD_ISSET(fd, rfds))
+                found = 1;
+			if (FD_ISSET(fd, wfds))
+                found = 1;
+		}
+
+		proxy = proxy->pNext;
+	}
+
+//	Log(("RDPUSB: rdpusb_check_fds: begin\n"));
+
+	if (found)
+        rdpusb_reap_urbs ();
+
+//	Log(("RDPUSB: rdpusb_check_fds: end\n"));
+
+	return;
+}
+
+
+RD_BOOL
+rdpusb_init(void)
+{
+    bool fUseUsbfs;
+    if (RT_SUCCESS(USBProxyLinuxChooseMethod(&fUseUsbfs, &g_pcszDevicesRoot)))
+	{
+	    g_fUseSysfs = !fUseUsbfs;
+	    rdpusb_channel =
+		    channel_register("vrdpusb", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
+				     rdpusb_process);
+	    return (rdpusb_channel != NULL);
+	}
+	return false;
+}
+
+void
+rdpusb_close (void)
+{
+	PUSBPROXYDEV proxy = g_proxies;
+
+	while (proxy)
+	{
+		PUSBPROXYDEV pNext = proxy->pNext;
+
+		Log(("RDPUSB: closing proxy %p\n", proxy));
+
+		op_usbproxy_back_close(proxy);
+		xfree (proxy);
+
+		proxy = pNext;
+	}
+
+	return;
+}
Index: /trunk/src/VBox/RDP/client-1.8.3/vrdp/vrdpusb.h
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/vrdp/vrdpusb.h	(revision 55123)
+++ /trunk/src/VBox/RDP/client-1.8.3/vrdp/vrdpusb.h	(revision 55123)
@@ -0,0 +1,30 @@
+/** @file
+ *
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef __VRDPUSB__H
+#define __VRDPUSB__H
+
+#define VRDP_USB_STATUS_SUCCESS         0
+#define VRDP_USB_STATUS_ACCESS_DENIED   1
+#define VRDP_USB_STATUS_DEVICE_REMOVED  2
+
+#define VRDP_USB_REAP_FLAG_CONTINUED (0)
+#define VRDP_USB_REAP_FLAG_LAST      (1)
+
+#define VRDP_USB_CAPS_FLAG_ASYNC    (0)
+#define VRDP_USB_CAPS_FLAG_POLL     (1)
+
+#endif /* __VRDPUSB__H  */
Index: /trunk/src/VBox/RDP/client-1.8.3/xclip.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/xclip.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/xclip.c	(revision 55123)
@@ -19,4 +19,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <X11/Xlib.h>
@@ -37,5 +46,23 @@
 #ifdef HAVE_ICONV_H
 #include <langinfo.h>
+
+#if defined(RT_OS_SOLARIS) && !defined(_XPG6)
+# define VBOX_XPG6_TMP_DEF
+# define _XPG6
+#endif
+#if defined(RT_OS_SOLARIS) && defined(__USE_LEGACY_PROTOTYPES__)
+# define VBOX_LEGACY_PROTO_TMP_DEF
+# undef __USE_LEGACY_PROTOTYPES__
+# endif
 #include <iconv.h>
+#if defined(VBOX_XPG6_TMP_DEF)
+# undef _XPG6
+# undef VBOX_XPG6_TMP_DEF
+#endif
+#if defined(VBOX_LEGACY_PROTO_TMP_DEF)
+# define  __USE_LEGACY_PROTOTYPES__
+# undef VBOX_LEGACY_PROTO_TMP_DEF
+#endif
+
 #define USE_UNICODE_CLIPBOARD
 #endif
Index: /trunk/src/VBox/RDP/client-1.8.3/xkeymap.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/xkeymap.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/xkeymap.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #ifdef RDP2VNC
@@ -650,4 +659,5 @@
 
 		case XK_Break:
+#ifdef RDESKTOP_KBD_CODE
 			/* Send Break sequence E0 46 E0 C6 */
 			if (pressed)
@@ -660,7 +670,20 @@
 			/* No release sequence */
 			return True;
+#else
+			/* Send Break sequence E0 46 E0 C6 */
+			if (pressed)
+			{
+				/* VirtualBox code begin */
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_EXT, 0x46, 0);
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_EXT | KBD_FLAG_UP, 0x46, 0);
+				/* VirtualBox code end */
+			}
+			/* No release sequence */
+			return True;
+#endif /* RDESKTOP_KBD_CODE */
 			break;
 
 		case XK_Pause:
+#ifdef RDESKTOP_KBD_CODE
 			/* According to MS Keyboard Scan Code
 			   Specification, pressing Pause should result
@@ -687,4 +710,18 @@
 			}
 			return True;
+#else
+			/* Send Break sequence E1 1D 45 E1 9D C5 */
+			if (pressed)
+			{
+				/* VirtualBox code begin */
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_EXT2, 0x1d, 0);
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, RDP_KEYPRESS,  0x45, 0);
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_EXT2 | KBD_FLAG_UP, 0x1d, 0);
+				rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_UP,  0x45, 0);
+				/* VirtualBox code end */
+			}
+			/* No release sequence */
+			return True;
+#endif /* RDESKTOP_KBD_CODE */
 			break;
 
@@ -724,5 +761,29 @@
 				ui_seamless_toggle();
 			break;
-
+#ifdef WITH_BIRD_VD_HACKS
+		case XK_Left:
+		case XK_Right:
+		{
+			/* Check for typical virtual desktop switching hotkeys:
+			       Ctrl-Alt-Left and Ctrl-Alt-Right.
+			   Needs to be pressed twice to have any effect... */
+			extern RD_BOOL g_keep_virtual_desktop_shortcuts;
+			extern RD_BOOL g_fullscreen;
+			if (   g_keep_virtual_desktop_shortcuts
+			    && (   (   get_key_state(state, XK_Alt_L)
+			            || get_key_state(state, XK_Alt_R))
+			        && (   get_key_state(state, XK_Control_L)
+			            || get_key_state(state, XK_Control_R))
+			       )
+			   )
+			{
+				if (g_fullscreen)
+					xwin_toggle_fullscreen();
+				XUngrabKeyboard(g_display, CurrentTime);
+				return True;
+			}
+			break;
+		}
+#endif
 	}
 	return False;
Index: /trunk/src/VBox/RDP/client-1.8.3/xwin.c
===================================================================
--- /trunk/src/VBox/RDP/client-1.8.3/xwin.c	(revision 55122)
+++ /trunk/src/VBox/RDP/client-1.8.3/xwin.c	(revision 55123)
@@ -20,4 +20,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
+/*
+ * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
+ * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
+ * the General Public License version 2 (GPLv2) at this time for any software where
+ * a choice of GPL license versions is made available with the language indicating
+ * that GPLv2 or any later version may be used, or where a choice of which version
+ * of the GPL is applied is otherwise unspecified.
+ */
 
 #include <X11/Xlib.h>
@@ -647,11 +656,11 @@
 		   &num_children);
 
-	for (i = num_children - 1; i >= 0; i--)
-	{
-		if (child_list[i] == behind)
+	for (i = num_children; i > 0; i--)
+	{
+		if (child_list[i-1] == behind)
 		{
 			found_behind = True;
 		}
-		else if (child_list[i] == wnd)
+		else if (child_list[i-1] == wnd)
 		{
 			found_wnd = True;
@@ -2515,4 +2524,14 @@
 				g_mouse_in_wnd = False;
 				XUngrabKeyboard(g_display, CurrentTime);
+				/* VirtualBox code begin */
+				if (g_fullscreen)
+				{
+					/* If mouse pointer is outside the fullscreen client window,
+					 * release it to let the client on the other screen to continue
+					 * with the mouse processing.
+					 */
+					XUngrabPointer(g_display, CurrentTime);
+				}
+				/* VirtualBox code end */
 				break;
 
@@ -2683,4 +2702,8 @@
 #endif
 
+#ifdef WITH_RDPUSB
+		rdpusb_add_fds (&n, &rfds, &wfds);
+#endif
+
 		/* add redirection handles */
 		rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout);
@@ -2707,4 +2730,8 @@
 				continue;
 		}
+
+#ifdef WITH_RDPUSB
+		rdpusb_check_fds (&rfds, &wfds);
+#endif
 
 #ifdef WITH_RDPSND
Index: /trunk/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
===================================================================
--- /trunk/src/VBox/Runtime/VBox/VBoxRTDeps.cpp	(revision 55122)
+++ /trunk/src/VBox/Runtime/VBox/VBoxRTDeps.cpp	(revision 55123)
@@ -70,4 +70,5 @@
     (PFNRT)i2d_X509,
     (PFNRT)i2d_X509,
+    (PFNRT)i2d_PublicKey,
     (PFNRT)RSA_generate_key,
     (PFNRT)RSA_generate_key_ex,
