diff options
author | Felix Geyer <debfx-pkg@fobos.de> | 2011-06-28 12:27:03 +0200 |
---|---|---|
committer | Felix Geyer <debfx-pkg@fobos.de> | 2011-06-28 12:27:03 +0200 |
commit | 6a16f6900dd884e07125b51c9625f6be0a1f9b70 (patch) | |
tree | ca3a5bca20c886411320d15508fbd741cba63545 | |
parent | 0056814bdb2f8a457b56803fd24c72347173250d (diff) | |
download | virtualbox-6a16f6900dd884e07125b51c9625f6be0a1f9b70.tar.gz |
Imported Upstream version 4.0.10-dfsgupstream/4.0.10-dfsg
211 files changed, 6531 insertions, 8646 deletions
diff --git a/Config.kmk b/Config.kmk index 165be6baf..a94a5da4e 100644 --- a/Config.kmk +++ b/Config.kmk @@ -157,7 +157,7 @@ VBOX_VERSION_MINOR = 0 # This is the current build number. It should be increased every time we publish a # new build. The define is available in every source file. Only even build numbers # will be published, odd numbers are set during development. -VBOX_VERSION_BUILD = 8 +VBOX_VERSION_BUILD = 10 # The raw version string. This *must not* contain any other information/fields than # major, minor and build revision (as it is now) -- also will be used for host/guest version # comparison. @@ -2587,7 +2587,7 @@ TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 -GS- -w TEMPLATE_VBoxR0_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -W3 -wd4244 $(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_WERR) endif TEMPLATE_VBoxR0_CFLAGS = $(TEMPLATE_VBoxR0_CXXFLAGS) -TEMPLATE_VBoxR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug +TEMPLATE_VBoxR0_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Debug TEMPLATE_VBoxR0_LIBS = \ $(PATH_LIB)/RuntimeR0Stub$(VBOX_SUFF_LIB) ifdef VBOX_USE_WINDDK @@ -2678,7 +2678,7 @@ ifeq ($(KBUILD_TARGET),win) TEMPLATE_VBOXR0DRV_CXXFLAGS = -Zi -Zl -GR- -EHs- -GF -Gz -W3 $(VBOX_VCC_OPT) $(VBOX_VCC_FP) endif TEMPLATE_VBOXR0DRV_CFLAGS = $(TEMPLATE_VBOXR0DRV_CXXFLAGS) - TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD -Debug + TEMPLATE_VBOXR0DRV_LDFLAGS = -Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Debug TEMPLATE_VBOXR0DRV_POST_CMDS = $(VBOX_SIGN_DRIVER_CMDS) ifdef VBOX_USE_VCC100 # HACK ALERT! TEMPLATE_VBOXR0DRV_CINCS = $(TOOL_$(VBOX_VCC_TOOL)_CINCS) @@ -4659,7 +4659,7 @@ endif SVN ?= svn$(HOSTSUFF_EXE) VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk ifndef VBOX_SVN_REV - VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 71778 $ ) + VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 72436 $ ) VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries) ifeq ($(which $(SVN)),) VBOX_SVN_DEP := diff --git a/doc/manual/en_US/user_Technical.xml b/doc/manual/en_US/user_Technical.xml index af97fc2d7..7b757e81d 100644 --- a/doc/manual/en_US/user_Technical.xml +++ b/doc/manual/en_US/user_Technical.xml @@ -884,7 +884,7 @@ (TLBs).</para> <para>To enable these features for a VM, you need to use the - <computeroutput>VBoxManage modifyvm --vtxvpids</computeroutput> and + <computeroutput>VBoxManage modifyvm --vtxvpid</computeroutput> and <computeroutput>--largepages</computeroutput> commands; see <xref linkend="vboxmanage-modifyvm" />.</para> </listitem> diff --git a/doc/manual/en_US/user_VBoxManage.xml b/doc/manual/en_US/user_VBoxManage.xml index 92b2e6003..821261889 100644 --- a/doc/manual/en_US/user_VBoxManage.xml +++ b/doc/manual/en_US/user_VBoxManage.xml @@ -1898,6 +1898,12 @@ Virtual system 0: "showvdiinfo" command is also supported and mapped internally to the "showhdinfo" command.</para> </note></para> + <para>The disk image must be specified either by its UUID (if the medium + is registered) or by its filename. Registered images can be listed by + <computeroutput>VBoxManage list hdds</computeroutput> (see <xref linkend="vboxmanage-list" /> + for more information). A filename must be specified as valid path, either + as an absolute path or as a relative path starting from the current + directory.</para> </sect1> <sect1 id="vboxmanage-createvdi"> @@ -1972,6 +1978,12 @@ Virtual system 0: mapped internally to the "modifyhd" command.</para> </note></para> + <para>The disk image to modify must be specified either by its UUID + (if the medium is registered) or by its filename. Registered images + can be listed by <computeroutput>VBoxManage list hdds</computeroutput> + (see <xref linkend="vboxmanage-list" /> for more information). + A filename must be specified as valid path, either as an absolute path + or as a relative path starting from the current directory.</para> <para>The following options are available:<itemizedlist> <listitem> <para>With the <computeroutput>--type</computeroutput> argument, you @@ -2041,7 +2053,13 @@ Virtual system 0: [--variant Standard,Fixed,Split2G,Stream,ESX] [--existing]</screen> - <para>where the parameters mean:<glosslist> + <para>The disk image to clone as well as the target image must be described + either by its UUIDs (if the mediums are registered) or by its filename. + Registered images can be listed by <computeroutput>VBoxManage list hdds</computeroutput> + (see <xref linkend="vboxmanage-list" /> for more information). + A filename must be specified as valid path, either as an absolute path or + as a relative path starting from the current directory.</para> + <para>The following options are available:<glosslist> <glossentry> <glossterm>format</glossterm> diff --git a/doc/manual/user_ChangeLogImpl.xml b/doc/manual/user_ChangeLogImpl.xml index 968d4feb1..34cc9a989 100644 --- a/doc/manual/user_ChangeLogImpl.xml +++ b/doc/manual/user_ChangeLogImpl.xml @@ -1,6 +1,111 @@ <?xml version="1.0" encoding="UTF-8"?> <sect1> + <title>Version 4.0.10 (2011-06-22)</title> + + <para>This is a maintenance release. The following items were fixed and/or + added:</para> + + <itemizedlist> + + <listitem> + <para>GUI: fixed disappearing settings widgets on KDE hosts (bug #6809)</para> + </listitem> + + <listitem> + <para>Storage: fixed hang under rare circumstances with flat VMDK images</para> + </listitem> + + <listitem> + <para>Storage: a saved VM could not be restored under certain circumstances + after the host kernel was updated (bug #8983)</para> + </listitem> + + <listitem> + <para>Storage: refuse to create a medium with an invalid variant + (for example Split2G with VDI; bug #7227)</para> + </listitem> + + <listitem> + <para>iSCSI: pause the VM if a request times out</para> + </listitem> + + <listitem> + <para>Snapshots: none of the hard disk attachments must be attached to + another VM in normal mode when creating a snapshot</para> + </listitem> + + <listitem> + <para>USB: fixed occasional VM hangs with SMP guests (bug #4580)</para> + </listitem> + + <listitem> + <para>USB: proper device detection on RHEL/OEL/CentOS 5 guests + (partial fix for bug #8978)</para> + </listitem> + + <listitem> + <para>ACPI: force the ACPI timer to return monotonic values for improve behavior + with SMP Linux guests (bug #8511 and others)</para> + </listitem> + + <listitem> + <para>RDP: fixed screen corruption under rare circumstances (bug #8977)</para> + </listitem> + + <listitem> + <para>rdesktop-vrdp: updated to version 1.7.0</para> + </listitem> + + <listitem> + <para>OVF: under rare circumstances some data at the end of a VMDK + file was not written during export</para> + </listitem> + + <listitem> + <para>Mac OS X hosts: Lion fixes</para> + </listitem> + + <listitem> + <para>Mac OS X hosts: GNOME 3 fix</para> + </listitem> + + <listitem> + <para>Linux hosts: fixed VT-x detection on Linux 3.0 hosts (bug #9071)</para> + </listitem> + + <listitem> + <para>Linux hosts: fixed Python 2.7 bindings in the universal Linux + binaries</para> + </listitem> + + <listitem> + <para>Windows hosts: fixed leak of thread and process handles</para> + </listitem> + + <listitem> + <para>Windows Additions: fixed bug when determining the extended version + of the Guest Additions (4.0.8 regression; bug #8948)</para> + </listitem> + + <listitem> + <para>Solaris Additions: fixed installation to 64-bit Solaris 10u9 guests + (4.0.8 regression)</para> + </listitem> + + <listitem> + <para>Linux Additions: RHEL6.1/OL6.1 compile fix</para> + </listitem> + + <listitem> + <para>Linux Additions: fixed a memory leak during <computeroutput>VBoxManage + guestcontrol execute</computeroutput> (bug #9068)</para> + </listitem> + + </itemizedlist> + </sect1> + + <sect1> <title>Version 4.0.8 (2011-05-16)</title> <para>This is a maintenance release. The following items were fixed and/or diff --git a/include/VBox/usblib-solaris.h b/include/VBox/usblib-solaris.h index c4bc8743a..ca92424d2 100644 --- a/include/VBox/usblib-solaris.h +++ b/include/VBox/usblib-solaris.h @@ -201,7 +201,6 @@ typedef struct /** USB driver name*/ #define VBOXUSB_DRIVER_NAME "vboxusb" -#define VBOXUSB_HELPER_NAME "VBoxUSBHelper" /* No automatic buffering, size limited to 255 bytes => use VBOXUSBREQ for everything. */ #define VBOXUSB_IOCTL_CODE(Function, Size) _IOWRN('V', (Function) | VBOXUSB_IOCTL_FLAG, sizeof(VBOXUSBREQ)) diff --git a/include/VBox/vmm/pdmdrv.h b/include/VBox/vmm/pdmdrv.h index 050146b82..c65851f7c 100644 --- a/include/VBox/vmm/pdmdrv.h +++ b/include/VBox/vmm/pdmdrv.h @@ -1763,7 +1763,7 @@ typedef struct PDMDRVREGCB */ typedef DECLCALLBACK(int) FNPDMVBOXDRIVERSREGISTER(PCPDMDRVREGCB pCallbacks, uint32_t u32Version); -VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback); +VMMR3DECL(int) PDMR3DrvStaticRegistration(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback); #endif /* IN_RING3 */ diff --git a/include/VBox/vmm/pdmusb.h b/include/VBox/vmm/pdmusb.h index a2517474a..18e49999e 100644 --- a/include/VBox/vmm/pdmusb.h +++ b/include/VBox/vmm/pdmusb.h @@ -902,6 +902,14 @@ DECLINLINE(void) PDMUsbHlpMMHeapFree(PPDMUSBINS pUsbIns, void *pv) MMR3HeapFree(pv); } +/** + * @copydoc PDMUSBHLP::pfnTMTimerCreate + */ +DECLINLINE(int) PDMUsbHlpTMTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser, + uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer) +{ + return pUsbIns->pHlpR3->pfnTMTimerCreate(pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer); +} #endif /* IN_RING3 */ diff --git a/include/VBox/vmm/tm.h b/include/VBox/vmm/tm.h index 9cca2f874..fd14bac19 100644 --- a/include/VBox/vmm/tm.h +++ b/include/VBox/vmm/tm.h @@ -156,7 +156,7 @@ typedef DECLCALLBACK(void) FNTMTIMERDEV(PPDMDEVINS pDevIns, PTMTIMER pTimer, voi typedef FNTMTIMERDEV *PFNTMTIMERDEV; /** - * Device timer callback function. + * USB device timer callback function. * * @param pUsbIns The USB device instance the timer is associated * with. @@ -250,11 +250,13 @@ VMM_INT_DECL(int) TMR3Term(PVM pVM); VMM_INT_DECL(void) TMR3Reset(PVM pVM); VMM_INT_DECL(int) TMR3GetImportRC(PVM pVM, const char *pszSymbol, PRTRCPTR pRCPtrValue); VMM_INT_DECL(int) TMR3TimerCreateDevice(PVM pVM, PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer); +VMM_INT_DECL(int) TMR3TimerCreateUsb(PVM pVM, PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer); VMM_INT_DECL(int) TMR3TimerCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer); VMMR3DECL(int) TMR3TimerCreateInternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMERINT pfnCallback, void *pvUser, const char *pszDesc, PPTMTIMERR3 ppTimer); VMMR3DECL(PTMTIMERR3) TMR3TimerCreateExternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMEREXT pfnCallback, void *pvUser, const char *pszDesc); VMMR3DECL(int) TMR3TimerDestroy(PTMTIMER pTimer); VMM_INT_DECL(int) TMR3TimerDestroyDevice(PVM pVM, PPDMDEVINS pDevIns); +VMM_INT_DECL(int) TMR3TimerDestroyUsb(PVM pVM, PPDMUSBINS pUsbIns); VMM_INT_DECL(int) TMR3TimerDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns); VMMR3DECL(int) TMR3TimerSave(PTMTIMERR3 pTimer, PSSMHANDLE pSSM); VMMR3DECL(int) TMR3TimerLoad(PTMTIMERR3 pTimer, PSSMHANDLE pSSM); diff --git a/include/iprt/darwin/machkernel.h b/include/iprt/darwin/machkernel.h new file mode 100644 index 000000000..4b4a8a830 --- /dev/null +++ b/include/iprt/darwin/machkernel.h @@ -0,0 +1,84 @@ +/* $Id: machkernel.h $ */ +/** @file + * IPRT - mach_kernel symbol resolving hack, R0 Driver, Darwin. + */ + +/* + * Copyright (C) 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. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + */ + +#ifndef ___iprt_darwin_machkernel_h +#define ___iprt_darwin_machkernel_h + +#include <iprt/types.h> + +RT_C_DECLS_BEGIN + +/** @defgroup grp_rt_darwin_machkernel Mach Kernel Symbols (Ring-0 only) + * @addtogroup grp_rt + * @{ + */ + +/** Handle to the mach kernel symbol database (darwin/r0 only). */ +typedef R3R0PTRTYPE(struct RTR0MACHKERNELINT *) RTR0MACHKERNEL; +/** Pointer to a mach kernel symbol database handle. */ +typedef RTR0MACHKERNEL *PRTR0MACHKERNEL; +/** Nil mach kernel symbol database handle. */ +#define NIL_RTR0MACHKERNEL ((RTR0MACHKERNEL)0) + + +/** + * Opens symbol table of the mach_kernel. + * + * @returns IPRT status code. + * @param pszMachKernel The path to the mach_kernel image. + * @param phKernel Where to return a mach kernel symbol database + * handle on success. Call RTR0MachKernelClose on it + * when done. + */ +RTDECL(int) RTR0MachKernelOpen(const char *pszMachKernel, PRTR0MACHKERNEL phKernel); + +/** + * Frees up the internal scratch data when done looking up symbols. + * + * @param pThis The internal scratch data. + */ +RTDECL(int) RTR0MachKernelClose(RTR0MACHKERNEL hKernel); + +/** + * Looks up a kernel symbol. + * + * @returns VINF_SUCCESS if found, *ppvValue set. + * @retval VERR_SYMBOL_NOT_FOUND if not found. + * @retval VERR_INVALID_HANDLE + * @retval VERR_INVALID_POINTER + * + * @param hKernel The mach kernel handle. + * @param pszSymbol The name of the symbol to look up, omitting the + * leading underscore. + * @param ppvValue Where to store the symbol address (optional). + */ +RTDECL(int) RTR0MachKernelGetSymbol(RTR0MACHKERNEL hKernel, const char *pszSymbol, void **ppvValue); + +/** @} */ +RT_C_DECLS_END + +#endif + diff --git a/include/iprt/file.h b/include/iprt/file.h index 178ed76e9..c5e055b2e 100644 --- a/include/iprt/file.h +++ b/include/iprt/file.h @@ -29,9 +29,7 @@ #include <iprt/cdefs.h> #include <iprt/types.h> #include <iprt/stdarg.h> -#ifdef IN_RING3 -# include <iprt/fs.h> -#endif +#include <iprt/fs.h> RT_C_DECLS_BEGIN @@ -70,8 +68,6 @@ RT_C_DECLS_BEGIN #endif -#ifdef IN_RING3 - /** * Checks if the specified file name exists and is a regular file. * @@ -235,6 +231,7 @@ RTDECL(int) RTFileQuerySize(const char *pszPath, uint64_t *pcbFile); /** @} */ +#ifdef IN_RING3 /** * Force the use of open flags for all files opened after the setting is * changed. The caller is responsible for not causing races with RTFileOpen(). @@ -245,6 +242,7 @@ RTDECL(int) RTFileQuerySize(const char *pszPath, uint64_t *pcbFile); * @param fMask Open flags to be masked out. */ RTR3DECL(int) RTFileSetForceFlags(unsigned fOpenForAccess, unsigned fSet, unsigned fMask); +#endif /* IN_RING3 */ /** * Open a file. @@ -255,7 +253,7 @@ RTR3DECL(int) RTFileSetForceFlags(unsigned fOpenForAccess, unsigned fSet, unsig * @param fOpen Open flags, i.e a combination of the RTFILE_O_* defines. * The ACCESS, ACTION and DENY flags are mandatory! */ -RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen); +RTDECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen); /** * Open a file given as a format string. @@ -268,7 +266,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen * be opened. (UTF-8) * @param ... Arguments to the format string. */ -RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...); +RTDECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...); /** * Open a file given as a format string. @@ -281,7 +279,7 @@ RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenam * be opened. (UTF-8) * @param va Arguments to the format string. */ -RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va); +RTDECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va); /** * Open the bit bucket (aka /dev/null or nul). @@ -290,7 +288,7 @@ RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenam * @param phFile Where to store the handle to the opened file. * @param fAccess The desired access only, i.e. read, write or both. */ -RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess); +RTDECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess); /** * Close a file opened by RTFileOpen(). @@ -298,7 +296,7 @@ RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess); * @returns iprt status code. * @param File The file handle to close. */ -RTR3DECL(int) RTFileClose(RTFILE File); +RTDECL(int) RTFileClose(RTFILE File); /** * Creates an IPRT file handle from a native one. @@ -307,7 +305,7 @@ RTR3DECL(int) RTFileClose(RTFILE File); * @param pFile Where to store the IPRT file handle. * @param uNative The native handle. */ -RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative); +RTDECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative); /** * Gets the native handle for an IPRT file handle. @@ -315,7 +313,7 @@ RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative); * @return The native handle. * @param File The IPRT file handle. */ -RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File); +RTDECL(RTHCINTPTR) RTFileToNative(RTFILE File); /** * Delete a file. @@ -324,7 +322,7 @@ RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File); * @param pszFilename Path to the file which is to be deleted. (UTF-8) * @todo This is a RTPath api! */ -RTR3DECL(int) RTFileDelete(const char *pszFilename); +RTDECL(int) RTFileDelete(const char *pszFilename); /** @name Seek flags. * @{ */ @@ -351,7 +349,7 @@ RTR3DECL(int) RTFileDelete(const char *pszFilename); * @param poffActual Where to store the new file position. * NULL is allowed. */ -RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual); +RTDECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual); /** * Read bytes from a file. @@ -363,7 +361,7 @@ RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64 * @param *pcbRead How much we actually read . * If NULL an error will be returned for a partial read. */ -RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead); +RTDECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead); /** * Read bytes from a file at a given offset. @@ -377,7 +375,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb * @param *pcbRead How much we actually read . * If NULL an error will be returned for a partial read. */ -RTR3DECL(int) RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead); +RTDECL(int) RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead); /** * Write bytes to a file. @@ -389,7 +387,7 @@ RTR3DECL(int) RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, size_t cbToRea * @param *pcbWritten How much we actually wrote. * If NULL an error will be returned for a partial write. */ -RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); +RTDECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); /** * Write bytes to a file at a given offset. @@ -403,7 +401,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz * @param *pcbWritten How much we actually wrote. * If NULL an error will be returned for a partial write. */ -RTR3DECL(int) RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); +RTDECL(int) RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten); /** * Flushes the buffers for the specified file. @@ -411,7 +409,7 @@ RTR3DECL(int) RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, size_t * @returns iprt status code. * @param File Handle to the file. */ -RTR3DECL(int) RTFileFlush(RTFILE File); +RTDECL(int) RTFileFlush(RTFILE File); /** * Set the size of the file. @@ -420,7 +418,7 @@ RTR3DECL(int) RTFileFlush(RTFILE File); * @param File Handle to the file. * @param cbSize The new file size. */ -RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize); +RTDECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize); /** * Query the size of the file. @@ -429,7 +427,7 @@ RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize); * @param File Handle to the file. * @param pcbSize Where to store the filesize. */ -RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize); +RTDECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize); /** * Determine the maximum file size. @@ -439,7 +437,7 @@ RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize); * @param File Handle to the file. * @see RTFileGetMaxSizeEx. */ -RTR3DECL(RTFOFF) RTFileGetMaxSize(RTFILE File); +RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File); /** * Determine the maximum file size. @@ -449,7 +447,7 @@ RTR3DECL(RTFOFF) RTFileGetMaxSize(RTFILE File); * @param pcbMax Where to store the max file size. * @see RTFileGetMaxSize. */ -RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax); +RTDECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax); /** * Determine the maximum file size depending on the file system the file is stored on. @@ -458,7 +456,7 @@ RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax); * -1 on failure. * @param File Handle to the file. */ -RTR3DECL(RTFOFF) RTFileGetMaxSize(RTFILE File); +RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File); /** * Gets the current file position. @@ -476,7 +474,7 @@ RTDECL(uint64_t) RTFileTell(RTFILE File); * @returns false if invalid. * @param File The file handle */ -RTR3DECL(bool) RTFileIsValid(RTFILE File); +RTDECL(bool) RTFileIsValid(RTFILE File); /** * Copies a file. @@ -640,7 +638,7 @@ RTDECL(int) RTFileMove(const char *pszSrc, const char *pszDst, unsigned fMove); * @param offLock Offset of lock start. * @param cbLock Length of region to lock, may overlap the end of file. */ -RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock); +RTDECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock); /** * Changes a lock type from read to write or from write to read. @@ -665,7 +663,7 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t * @param offLock Offset of lock start. * @param cbLock Length of region to lock, may overlap the end of file. */ -RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock); +RTDECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock); /** * Unlocks previously locked region of file. @@ -677,7 +675,7 @@ RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, ui * @param offLock Offset of lock start. * @param cbLock Length of region to unlock, may overlap the end of file. */ -RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock); +RTDECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock); /** @@ -690,7 +688,7 @@ RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock); * @param enmAdditionalAttribs Which set of additional attributes to request. * Use RTFSOBJATTRADD_NOTHING if this doesn't matter. */ -RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs); +RTDECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs); /** * Changes one or more of the timestamps associated of file system object. @@ -716,8 +714,8 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD * * @remark POSIX can only set Access & Modification and will always set both. */ -RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, - PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime); +RTDECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, + PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime); /** * Gets one or more of the timestamps associated of file system object. @@ -731,8 +729,8 @@ RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC * * @remark This is wrapper around RTFileQueryInfo() and exists to complement RTFileSetTimes(). */ -RTR3DECL(int) RTFileGetTimes(RTFILE File, PRTTIMESPEC pAccessTime, PRTTIMESPEC pModificationTime, - PRTTIMESPEC pChangeTime, PRTTIMESPEC pBirthTime); +RTDECL(int) RTFileGetTimes(RTFILE File, PRTTIMESPEC pAccessTime, PRTTIMESPEC pModificationTime, + PRTTIMESPEC pChangeTime, PRTTIMESPEC pBirthTime); /** * Changes the mode flags of an open file. @@ -744,7 +742,7 @@ RTR3DECL(int) RTFileGetTimes(RTFILE File, PRTTIMESPEC pAccessTime, PRTTIMESPEC p * @param File Handle to the file. * @param fMode The new file mode, see @ref grp_rt_fs for details. */ -RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode); +RTDECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode); /** * Gets the mode flags of an open file. @@ -756,7 +754,7 @@ RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode); * @remark This is wrapper around RTFileQueryInfo() * and exists to complement RTFileSetMode(). */ -RTR3DECL(int) RTFileGetMode(RTFILE File, uint32_t *pfMode); +RTDECL(int) RTFileGetMode(RTFILE File, uint32_t *pfMode); /** * Changes the owner and/or group of an open file. @@ -768,7 +766,7 @@ RTR3DECL(int) RTFileGetMode(RTFILE File, uint32_t *pfMode); * @param gid The new group id. Pass NIL_RTGID to leave this * unchanged. */ -RTR3DECL(int) RTFileSetOwner(RTFILE File, uint32_t uid, uint32_t gid); +RTDECL(int) RTFileSetOwner(RTFILE File, uint32_t uid, uint32_t gid); /** * Gets the owner and/or group of an open file. @@ -780,7 +778,7 @@ RTR3DECL(int) RTFileSetOwner(RTFILE File, uint32_t uid, uint32_t gid); * * @remark This is wrapper around RTFileQueryInfo() and exists to complement RTFileGetOwner(). */ -RTR3DECL(int) RTFileGetOwner(RTFILE File, uint32_t *pUid, uint32_t *pGid); +RTDECL(int) RTFileGetOwner(RTFILE File, uint32_t *pUid, uint32_t *pGid); /** * Executes an IOCTL on a file descriptor. @@ -799,7 +797,7 @@ RTR3DECL(int) RTFileGetOwner(RTFILE File, uint32_t *pUid, uint32_t *pGid); * @param cbData Size of the IOCTL data. * @param piRet Return value of the IOCTL request. */ -RTR3DECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet); +RTDECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet); /** * Query the sizes of a filesystem. @@ -816,8 +814,8 @@ RTR3DECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, un * * @sa RTFsQuerySizes */ -RTR3DECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree, - uint32_t *pcbBlock, uint32_t *pcbSector); +RTDECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree, + uint32_t *pcbBlock, uint32_t *pcbSector); /** * Reads the file into memory. @@ -912,6 +910,8 @@ RTDECL(void) RTFileReadAllFree(void *pvFile, size_t cbFile); /** @} */ +#ifdef IN_RING3 + /** @page pg_rt_asyncio RT File async I/O API * * File operations are usually blocking the calling thread until diff --git a/include/iprt/process.h b/include/iprt/process.h index 979f6499c..8a820f7bc 100644 --- a/include/iprt/process.h +++ b/include/iprt/process.h @@ -197,6 +197,9 @@ RTR3DECL(int) RTProcCreateEx(const char *pszExec, const char * const *papszArg * on Solaris. Without this flag the contract id is always changed, * as that's the more frequently used case. */ #define RTPROC_FLAGS_SAME_CONTRACT RT_BIT(3) +/** Do not load user profile data when executing a process. This bit + * at the moment only is used on Windows. */ +#define RTPROC_FLAGS_NO_PROFILE RT_BIT(4) /** @} */ diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp index 69ffcb308..8e2f8c0e7 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp @@ -240,9 +240,14 @@ NTSTATUS vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp) /* This IRP passed down to lower driver. */ pIrp->IoStatus.Status = STATUS_SUCCESS; - rc = vboxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE); + IoSkipCurrentIrpStackLocation(pIrp); - /* Do not complete the IRP. */ + rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); + Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); + + /* we must not do anything the IRP after doing IoSkip & CallDriver + * since the driver below us will complete (or already have completed) the IRP. + * I.e. just return the status we got from IoCallDriver */ return rc; } @@ -330,9 +335,14 @@ NTSTATUS vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp) /* This IRP passed down to lower driver. */ pIrp->IoStatus.Status = STATUS_SUCCESS; - rc = vboxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE); + IoSkipCurrentIrpStackLocation(pIrp); + + rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); + Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); - /* Do not complete the IRP. */ + /* we must not do anything with the IRP after doing IoSkip & CallDriver + * since the driver below us will complete (or already have completed) the IRP. + * I.e. just return the status we got from IoCallDriver */ return rc; } diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibAdditions.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibAdditions.cpp index b530f4316..0353f046a 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibAdditions.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibAdditions.cpp @@ -36,55 +36,58 @@ /** - * Fallback for vbglR3GetAdditionsVersion. + * Fallback for VbglR3GetAdditionsVersion. */ static int vbglR3GetAdditionsCompileTimeVersion(char **ppszVer, char **ppszVerEx, char **ppszRev) { - /* Raw version string: major.minor.build. */ + int rc = VINF_SUCCESS; if (ppszVer) + rc = RTStrDupEx(ppszVer, VBOX_VERSION_STRING_RAW); + if (RT_SUCCESS(rc)) { - *ppszVer = RTStrDup(VBOX_VERSION_STRING_RAW); - if (!*ppszVer) - return VERR_NO_STR_MEMORY; - } - - /* Extended version string: major.minor.build (+ vendor [suffix(es)]). */ - if (ppszVerEx) - { - *ppszVerEx = RTStrDup(VBOX_VERSION_STRING); - if (!*ppszVerEx) - return VERR_NO_STR_MEMORY; - } - - if (ppszRev) - { - char szRev[64]; - RTStrPrintf(szRev, sizeof(szRev), "%d", VBOX_SVN_REV); - *ppszRev = RTStrDup(szRev); - if (!*ppszRev) + if (ppszVerEx) + rc = RTStrDupEx(ppszVerEx, VBOX_VERSION_STRING); + if (RT_SUCCESS(rc)) { - if (ppszVer) + if (ppszRev) { - RTStrFree(*ppszVer); - *ppszVer = NULL; +#if 0 + char szRev[64]; + RTStrPrintf(szRev, sizeof(szRev), "%d", VBOX_SVN_REV); + rc = RTStrDupEx(ppszRev, szRev); +#else + rc = RTStrDupEx(ppszRev, RT_XSTR(VBOX_SVN_REV)); +#endif } - return VERR_NO_STR_MEMORY; + if (RT_SUCCESS(rc)) + return VINF_SUCCESS; + + /* bail out: */ + } + if (ppszVerEx) + { + RTStrFree(*ppszVerEx); + *ppszVerEx = NULL; } } - - return VINF_SUCCESS; + if (ppszVer) + { + RTStrFree(*ppszVer); + *ppszVer = NULL; + } + return rc; } #ifdef RT_OS_WINDOWS + /** * Looks up the storage path handle (registry). * * @returns IPRT status value - * @param hKey Receives pointer of allocated version string. NULL is - * accepted. The returned pointer must be closed by - * vbglR3CloseAdditionsWinStoragePath(). + * @param hKey Receives storage path handle on success. + * The returned handle must be closed by vbglR3CloseAdditionsWinStoragePath(). */ -static int vbglR3GetAdditionsWinStoragePath(PHKEY phKey) +static int vbglR3QueryAdditionsWinStoragePath(PHKEY phKey) { /* * Try get the *installed* version first. @@ -138,7 +141,7 @@ static int vbglR3GetAdditionsWinStoragePath(PHKEY phKey) * * @returns IPRT status value * @param hKey Handle to close, retrieved by - * vbglR3GetAdditionsWinStoragePath(). + * vbglR3QueryAdditionsWinStoragePath(). */ static int vbglR3CloseAdditionsWinStoragePath(HKEY hKey) { @@ -173,6 +176,36 @@ VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestStatusFacility enmFacility, return rc; } +#ifdef RT_OS_WINDOWS + +/** + * Queries a string value from a specified registry key. + * + * @return IPRT status code. + * @param hKey Handle of registry key to use. + * @param pszValName Value name to query value from. + * @param pszBuffer Pointer to buffer which the queried string value gets stored into. + * @param cchBuffer Size (in bytes) of buffer. + */ +static int vbglR3QueryRegistryString(HKEY hKey, const char *pszValName, char *pszBuffer, size_t cchBuffer) +{ + AssertReturn(pszValName, VERR_INVALID_PARAMETER); + AssertReturn(pszBuffer, VERR_INVALID_POINTER); + AssertReturn(cchBuffer, VERR_INVALID_PARAMETER); + + int rc; + DWORD dwType; + DWORD dwSize = (DWORD)cchBuffer; + LONG lRet = RegQueryValueEx(hKey, pszValName, NULL, &dwType, (BYTE *)pszBuffer, &dwSize); + if (lRet == ERROR_SUCCESS) + rc = dwType == REG_SZ ? VINF_SUCCESS : VERR_INVALID_PARAMETER; + else + rc = RTErrConvertFromWin32(lRet); + return rc; +} + +#endif /* RT_OS_WINDOWS */ + /** * Retrieves the installed Guest Additions version and/or revision. * @@ -180,7 +213,7 @@ VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestStatusFacility enmFacility, * @param ppszVer Receives pointer of allocated raw version string * (major.minor.build). NULL is accepted. The returned * pointer must be freed using RTStrFree().* - * @param ppszVerEx Receives pointer of allocated full version string + * @param ppszVerExt Receives pointer of allocated full version string * (raw version + vendor suffix(es)). NULL is * accepted. The returned pointer must be freed using * RTStrFree(). @@ -188,94 +221,67 @@ VBGLR3DECL(int) VbglR3ReportAdditionsStatus(VBoxGuestStatusFacility enmFacility, * accepted. The returned pointer must be freed using * RTStrFree(). */ -VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev) +VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerExt, char **ppszRev) { + /* + * Zap the return value up front. + */ + if (ppszVer) + *ppszVer = NULL; + if (ppszVerExt) + *ppszVerExt = NULL; + if (ppszRev) + *ppszRev = NULL; + #ifdef RT_OS_WINDOWS HKEY hKey; - int rc = vbglR3GetAdditionsWinStoragePath(&hKey); + int rc = vbglR3QueryAdditionsWinStoragePath(&hKey); if (RT_SUCCESS(rc)) { - /* Version. */ - LONG l; - DWORD dwType; - DWORD dwSize = 32; - char *pszTmp; + /* + * Version. + */ + char szTemp[32]; if (ppszVer) { - pszTmp = (char*)RTMemAlloc(dwSize); - if (pszTmp) - { - l = RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszTmp, &dwSize); - if (l == ERROR_SUCCESS) - { - if (dwType == REG_SZ) - rc = RTStrDupEx(ppszVer, pszTmp); - else - rc = VERR_INVALID_PARAMETER; - } - else - { - rc = RTErrConvertFromWin32(l); - } - RTMemFree(pszTmp); - } - else - rc = VERR_NO_MEMORY; + rc = vbglR3QueryRegistryString(hKey, "Version", szTemp, sizeof(szTemp)); + if (RT_SUCCESS(rc)) + rc = RTStrDupEx(ppszVer, szTemp); } - if (ppszVerEx) + + if ( RT_SUCCESS(rc) + && ppszVerExt) { - dwSize = 32; /* Reset */ - pszTmp = (char*)RTMemAlloc(dwSize); - if (pszTmp) - { - l = RegQueryValueEx(hKey, "VersionEx", NULL, &dwType, (BYTE*)(LPCTSTR)pszTmp, &dwSize); - if (l == ERROR_SUCCESS) - { - if (dwType == REG_SZ) - rc = RTStrDupEx(ppszVerEx, pszTmp); - else - rc = VERR_INVALID_PARAMETER; - } - else - { - rc = RTErrConvertFromWin32(l); - } - RTMemFree(pszTmp); - } - else - rc = VERR_NO_MEMORY; + rc = vbglR3QueryRegistryString(hKey, "VersionExt", szTemp, sizeof(szTemp)); + if (RT_SUCCESS(rc)) + rc = RTStrDupEx(ppszVerExt, szTemp); } - /* Revision. */ - if (ppszRev) + + /* + * Revision. + */ + if ( RT_SUCCESS(rc) + && ppszRev) { - dwSize = 32; /* Reset */ - pszTmp = (char*)RTMemAlloc(dwSize); - if (pszTmp) - { - l = RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszTmp, &dwSize); - if (l == ERROR_SUCCESS) - { - if (dwType == REG_SZ) - rc = RTStrDupEx(ppszRev, pszTmp); - else - rc = VERR_INVALID_PARAMETER; - } - else - { - rc = RTErrConvertFromWin32(l); - } - RTMemFree(pszTmp); - } - else - rc = VERR_NO_MEMORY; + rc = vbglR3QueryRegistryString(hKey, "Revision", szTemp, sizeof(szTemp)); + if (RT_SUCCESS(rc)) + rc = RTStrDupEx(ppszRev, szTemp); + } - if (RT_FAILURE(rc) && ppszVer) - { + int rc2 = vbglR3CloseAdditionsWinStoragePath(hKey); + if (RT_SUCCESS(rc)) + rc = rc2; + + /* Clean up allocated strings on error. */ + if (RT_FAILURE(rc)) + { + if (ppszVer) RTStrFree(*ppszVer); - *ppszVer = NULL; - } + if (ppszVerExt) + RTStrFree(*ppszVerExt); + if (ppszRev) + RTStrFree(*ppszRev); } - rc = vbglR3CloseAdditionsWinStoragePath(hKey); } else { @@ -283,7 +289,7 @@ VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char * No registry entries found, return the version string compiled * into this binary. */ - rc = vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerEx, ppszRev); + rc = vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerExt, ppszRev); } return rc; @@ -291,7 +297,7 @@ VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char /* * On non-Windows platforms just return the compile-time version string. */ - return vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerEx, ppszRev); + return vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerExt, ppszRev); #endif /* !RT_OS_WINDOWS */ } @@ -309,7 +315,7 @@ VBGLR3DECL(int) VbglR3GetAdditionsInstallationPath(char **ppszPath) int rc; #ifdef RT_OS_WINDOWS HKEY hKey; - rc = vbglR3GetAdditionsWinStoragePath(&hKey); + rc = vbglR3QueryAdditionsWinStoragePath(&hKey); if (RT_SUCCESS(rc)) { /* Installation directory. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp index d7b100ae0..c82ed08ca 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp @@ -144,6 +144,10 @@ VBGLR3DECL(int) VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects) if (!cRects || !pRects) return VINF_SUCCESS; + AssertMsgReturn(cRects <= _1M, ("%u\n", cRects), VERR_OUT_OF_RANGE); + AssertReturn(sizeof(VMMDevVideoSetVisibleRegion)+(cRects-1)*sizeof(RTRECT) + == sizeof(VMMDevVideoSetVisibleRegion)+(uint64_t)(cRects-1)*sizeof(RTRECT), VERR_INVALID_PARAMETER); + rc = vbglR3GRAlloc((VMMDevRequestHeader **)&pReq, sizeof(VMMDevVideoSetVisibleRegion) + (cRects - 1) * sizeof(RTRECT), VMMDevReq_VideoSetVisibleRegion); diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp index 136679fe8..0e5155ef5 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp @@ -864,6 +864,9 @@ static int VBoxServiceControlExecCreateProcess(const char *pszExec, const char * /* Process Main flag "ExecuteProcessFlag_Hidden". */ if (fFlags & RT_BIT(2)) uProcFlags = RTPROC_FLAGS_HIDDEN; + /* Process Main flag "ExecuteProcessFlag_NoProfile". */ + if (fFlags & RT_BIT(3)) + uProcFlags = RTPROC_FLAGS_NO_PROFILE; } /* If no user name specified run with current credentials (e.g. diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp index 59f24e72b..85f17e5ef 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp @@ -189,19 +189,19 @@ static void vboxserviceVMInfoWriteFixedProperties(void) * Retrieve version information about Guest Additions and installed files (components). */ char *pszAddVer; - char *pszAddVerEx; + char *pszAddVerExt; char *pszAddRev; - rc = VbglR3GetAdditionsVersion(&pszAddVer, &pszAddVerEx, &pszAddRev); + rc = VbglR3GetAdditionsVersion(&pszAddVer, &pszAddVerExt, &pszAddRev); VBoxServiceWritePropF(g_uVMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "%s", RT_FAILURE(rc) ? "" : pszAddVer); - VBoxServiceWritePropF(g_uVMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/VersionEx", - "%s", RT_FAILURE(rc) ? "" : pszAddVerEx); + VBoxServiceWritePropF(g_uVMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/VersionExt", + "%s", RT_FAILURE(rc) ? "" : pszAddVerExt); VBoxServiceWritePropF(g_uVMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", RT_FAILURE(rc) ? "" : pszAddRev); if (RT_SUCCESS(rc)) { RTStrFree(pszAddVer); - RTStrFree(pszAddVerEx); + RTStrFree(pszAddVerExt); RTStrFree(pszAddRev); } diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c index 8ac7896fc..b335f76eb 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c @@ -62,6 +62,14 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) +# ifdef RHEL_RELEASE_CODE +# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1) +# define DRM_RHEL61 +# endif +# endif +# endif + #include "drm/drmP.h" #include "vboxvideo_drm.h" @@ -83,8 +91,8 @@ static struct drm_driver driver = /* .driver_features = DRIVER_USE_MTRR, */ .load = vboxvideo_driver_load, .reclaim_buffers = drm_core_reclaim_buffers, - /* As of Linux 2.65.37, always the internal functions are used. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 37) + /* As of Linux 2.6.37, always the internal functions are used. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 37) && !defined(DRM_RHEL61) .get_map_ofs = drm_core_get_map_ofs, .get_reg_ofs = drm_core_get_reg_ofs, #endif diff --git a/src/VBox/Additions/solaris/Installer/VBox.sh b/src/VBox/Additions/solaris/Installer/VBox.sh index 842cbc1fd..5beedbc52 100755 --- a/src/VBox/Additions/solaris/Installer/VBox.sh +++ b/src/VBox/Additions/solaris/Installer/VBox.sh @@ -2,7 +2,7 @@ # # VirtualBox startup script for Solaris Guests Additions # -# Copyright (C) 2008-2010 Oracle Corporation +# Copyright (C) 2008-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; @@ -22,27 +22,27 @@ # terms and conditions of either the GPL or the CDDL or both. # -CPUTYPE=`isainfo -k` -ISADIR="" -if test "$CPUTYPE" = "amd64"; then - ISADIR="amd64" +CURRENT_ISA=`isainfo -k` +if test "$CURRENT_ISA" = "amd64"; then + INSTALL_DIR="/opt/VirtualBoxAdditions/amd64" +else + INSTALL_DIR="/opt/VirtualBoxAdditions" fi -INSTALL_DIR="/opt/VirtualBoxAdditions" -APP=`which $0` -APP=`basename $APP` +APP=`basename $0` case "$APP" in - VBoxClient) - exec "$INSTALL_DIR/$ISADIR/VBoxClient" "$@" - ;; - VBoxService) - exec "$INSTALL_DIR/$ISADIR/VBoxService" "$@" - ;; - VBoxControl) - exec "$INSTALL_DIR/$ISADIR/VBoxControl" "$@" - ;; - *) - echo "Unknown application - $APP" - ;; + VBoxClient) + exec "$INSTALL_DIR/VBoxClient" "$@" + ;; + VBoxService) + exec "$INSTALL_DIR/VBoxService" "$@" + ;; + VBoxControl) + exec "$INSTALL_DIR/VBoxControl" "$@" + ;; + *) + echo "Unknown application - $APP" + exit 1 + ;; esac - +exit 0 diff --git a/src/VBox/Additions/solaris/Installer/postinstall.sh b/src/VBox/Additions/solaris/Installer/postinstall.sh index 98d3ebfad..467605307 100755 --- a/src/VBox/Additions/solaris/Installer/postinstall.sh +++ b/src/VBox/Additions/solaris/Installer/postinstall.sh @@ -22,6 +22,9 @@ # terms and conditions of either the GPL or the CDDL or both. # +LANG=C +export LANG + # uncompress(directory, file) # Updates package metadata and uncompresses the file. uncompress_file() @@ -214,8 +217,15 @@ if test ! -z "$xorgbin"; then # snv_163 drops 32-bit support completely, and uses 32-bit locations for the 64-bit stuff. Ugly. # We try to detect this by looking at bitness of "mouse_drv.so", and adjust our destination paths accordingly. - bitsize=`file $vboxmouse32_dest_base/mouse_drv.so | grep "32-bit"` - skip32="no" + # We do not rely on using Xorg -version's ABI output because some builds (snv_162 iirc) have 64-bit ABI with + # 32-bit file locations. + if test -f "$vboxmouse32_dest_base/mouse_drv.so"; then + bitsize=`file "$vboxmouse32_dest_base/mouse_drv.so" | grep -i "32-bit"` + skip32="no" + else + echo "* Warning mouse_drv.so missing. Assuming Xorg ABI is 64-bit..." + fi + if test -z "$bitsize"; then skip32="yes" vboxmouse64_dest_base=$vboxmouse32_dest_base diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp index 3559771d2..7cf9bb460 100644 --- a/src/VBox/Devices/Graphics/DevVGA.cpp +++ b/src/VBox/Devices/Graphics/DevVGA.cpp @@ -5677,7 +5677,9 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF "CustomVideoMode13\0" "CustomVideoMode14\0" "CustomVideoMode15\0" - "CustomVideoMode16\0")) + "CustomVideoMode16\0" + "MaxBiosXRes\0" + "MaxBiosYRes\0")) return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, N_("Invalid configuration for vga device")); @@ -6055,6 +6057,14 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF AssertLogRelRCReturn(rc, rc); #ifdef VBE_NEW_DYN_LIST + + uint16_t maxBiosXRes; + rc = CFGMR3QueryU16Def(pCfg, "MaxBiosXRes", &maxBiosXRes, UINT16_MAX); + AssertLogRelRCReturn(rc, rc); + uint16_t maxBiosYRes; + rc = CFGMR3QueryU16Def(pCfg, "MaxBiosYRes", &maxBiosYRes, UINT16_MAX); + AssertLogRelRCReturn(rc, rc); + /* * Compute buffer size for the VBE BIOS Extra Data. */ @@ -6102,6 +6112,9 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF * pixelWidth; if (reqSize >= pThis->vram_size) continue; + if ( mode_info_list[i].info.XResolution > maxBiosXRes + || mode_info_list[i].info.YResolution > maxBiosYRes) + continue; *pCurMode = mode_info_list[i]; vgaAdjustModeInfo(pThis, pCurMode); pCurMode++; @@ -6133,6 +6146,9 @@ static DECLCALLBACK(int) vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF reqSize = pDefMode->info.XResolution * pDefMode->info.YResolution * pixelWidth; if (reqSize >= pThis->vram_size) continue; + if ( pDefMode->info.XResolution > maxBiosXRes + || pDefMode->info.YResolution - cyReduction > maxBiosYRes) + continue; *pCurMode = *pDefMode; pCurMode->mode += 0x30; pCurMode->info.YResolution -= cyReduction; diff --git a/src/VBox/Devices/Network/Pcap.cpp b/src/VBox/Devices/Network/Pcap.cpp index af8c357c3..2c33563d8 100644 --- a/src/VBox/Devices/Network/Pcap.cpp +++ b/src/VBox/Devices/Network/Pcap.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2008 Oracle Corporation + * 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; @@ -58,7 +58,6 @@ struct pcaprec_hdr_init { uint32_t u32Magic; struct pcap_hdr pcap; - struct pcaprec_hdr rec0; }; @@ -69,11 +68,9 @@ static pcaprec_hdr_init const s_Hdr = { PCAP_MAGIC, { 2, 4, 0, 0, 0xffff, 1 }, - /* force ethereal to start at 0.000000. */ - { 0, 1, 0, 60 } - }; +static const char s_szDummyData[] = { 0, 0, 0, 0 }; /** * Internal helper. @@ -108,9 +105,9 @@ static void pcapUpdateHeader(struct pcaprec_hdr *pHdr, size_t cbFrame, size_t cb */ int PcapStreamHdr(PRTSTREAM pStream, uint64_t StartNanoTS) { - pcaprec_hdr_init Hdr = s_Hdr; - pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0); - return RTStrmWrite(pStream, &Hdr, sizeof(Hdr)); + int rc1 = RTStrmWrite(pStream, &s_Hdr, sizeof(s_Hdr)); + int rc2 = PcapStreamFrame(pStream, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData)); + return RT_SUCCESS(rc1) ? rc2 : rc1; } @@ -188,9 +185,9 @@ int PcapStreamGsoFrame(PRTSTREAM pStream, uint64_t StartNanoTS, PCPDMNETWORKGSO */ int PcapFileHdr(RTFILE File, uint64_t StartNanoTS) { - pcaprec_hdr_init Hdr = s_Hdr; - pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0); - return RTFileWrite(File, &Hdr, sizeof(Hdr), NULL); + int rc1 = RTFileWrite(File, &s_Hdr, sizeof(s_Hdr), NULL); + int rc2 = PcapFileFrame(File, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData)); + return RT_SUCCESS(rc1) ? rc2 : rc1; } diff --git a/src/VBox/Devices/PC/DevACPI.cpp b/src/VBox/Devices/PC/DevACPI.cpp index 30d6775d3..f83d1f8f1 100644 --- a/src/VBox/Devices/PC/DevACPI.cpp +++ b/src/VBox/Devices/PC/DevACPI.cpp @@ -198,7 +198,8 @@ typedef struct ACPIState uint16_t pm1a_ctl; /** Number of logical CPUs in guest */ uint16_t cCpus; - int64_t pm_timer_initial; + uint64_t u64PmTimerInitial; + uint64_t u64PmTimerLastSeen; PTMTIMERR3 tsR3; PTMTIMERR0 tsR0; PTMTIMERRC tsRC; @@ -1888,10 +1889,17 @@ PDMBOTHCBDECL(int) acpiPMTmrRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port if (cb == 4) { ACPIState *s = PDMINS_2_DATA(pDevIns, ACPIState *); - int64_t now = TMTimerGet(s->CTX_SUFF(ts)); - int64_t elapsed = now - s->pm_timer_initial; + uint64_t u64Now = TMTimerGet(s->CTX_SUFF(ts)); + uint64_t u64Seen; + do + { + u64Seen = ASMAtomicReadU64(&s->u64PmTimerLastSeen); + if (u64Now < u64Seen) + u64Now = u64Seen + 1; + } while (!ASMAtomicCmpXchgU64(&s->u64PmTimerLastSeen, u64Now, u64Seen)); - *pu32 = ASMMultU64ByU32DivByU32(elapsed, PM_TMR_FREQ, TMTimerGetFreq(s->CTX_SUFF(ts))); + uint64_t u64Elapsed = u64Now - s->u64PmTimerInitial; + *pu32 = ASMMultU64ByU32DivByU32(u64Elapsed, PM_TMR_FREQ, TMTimerGetFreq(s->CTX_SUFF(ts))); Log(("acpi: acpiPMTmrRead -> %#x\n", *pu32)); return VINF_SUCCESS; } @@ -2090,7 +2098,7 @@ static const SSMFIELD g_AcpiSavedStateFields4[] = SSMFIELD_ENTRY(ACPIState, pm1a_en), SSMFIELD_ENTRY(ACPIState, pm1a_sts), SSMFIELD_ENTRY(ACPIState, pm1a_ctl), - SSMFIELD_ENTRY(ACPIState, pm_timer_initial), + SSMFIELD_ENTRY(ACPIState, u64PmTimerInitial), SSMFIELD_ENTRY(ACPIState, gpe0_en), SSMFIELD_ENTRY(ACPIState, gpe0_sts), SSMFIELD_ENTRY(ACPIState, uBatteryIndex), @@ -2110,7 +2118,7 @@ static const SSMFIELD g_AcpiSavedStateFields5[] = SSMFIELD_ENTRY(ACPIState, pm1a_en), SSMFIELD_ENTRY(ACPIState, pm1a_sts), SSMFIELD_ENTRY(ACPIState, pm1a_ctl), - SSMFIELD_ENTRY(ACPIState, pm_timer_initial), + SSMFIELD_ENTRY(ACPIState, u64PmTimerInitial), SSMFIELD_ENTRY(ACPIState, gpe0_en), SSMFIELD_ENTRY(ACPIState, gpe0_sts), SSMFIELD_ENTRY(ACPIState, uBatteryIndex), @@ -2129,7 +2137,7 @@ static const SSMFIELD g_AcpiSavedStateFields6[] = SSMFIELD_ENTRY(ACPIState, pm1a_en), SSMFIELD_ENTRY(ACPIState, pm1a_sts), SSMFIELD_ENTRY(ACPIState, pm1a_ctl), - SSMFIELD_ENTRY(ACPIState, pm_timer_initial), + SSMFIELD_ENTRY(ACPIState, u64PmTimerInitial), SSMFIELD_ENTRY(ACPIState, gpe0_en), SSMFIELD_ENTRY(ACPIState, gpe0_sts), SSMFIELD_ENTRY(ACPIState, uBatteryIndex), @@ -2548,7 +2556,7 @@ static DECLCALLBACK(void) acpiReset(PPDMDEVINS pDevIns) s->pm1a_en = 0; s->pm1a_sts = 0; s->pm1a_ctl = 0; - s->pm_timer_initial = TMTimerGet(s->CTX_SUFF(ts)); + s->u64PmTimerInitial = TMTimerGet(s->CTX_SUFF(ts)); acpiPMTimerReset(s); s->uBatteryIndex = 0; s->uSystemInfoIndex = 0; @@ -2832,7 +2840,7 @@ static DECLCALLBACK(int) acpiConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMN s->tsR0 = TMTimerR0Ptr(s->tsR3); s->tsRC = TMTimerRCPtr(s->tsR3); - s->pm_timer_initial = TMTimerGet(s->tsR3); + s->u64PmTimerInitial = TMTimerGet(s->tsR3); acpiPMTimerReset(s); PCIDevSetVendorId(dev, 0x8086); /* Intel */ diff --git a/src/VBox/Devices/Storage/DevAHCI.cpp b/src/VBox/Devices/Storage/DevAHCI.cpp index 6cf04fe57..da2c39cea 100644 --- a/src/VBox/Devices/Storage/DevAHCI.cpp +++ b/src/VBox/Devices/Storage/DevAHCI.cpp @@ -652,10 +652,8 @@ typedef struct AHCI /** Number of usable ports on this controller. */ uint32_t cPortsImpl; - -#if HC_ARCH_BITS == 64 - uint32_t Alignment9; -#endif + /** Number of usable command slots for each port. */ + uint32_t cCmdSlotsAvail; /** Flag whether we have written the first 4bytes in an 8byte MMIO write successfully. */ volatile bool f8ByteMMIO4BytesWrittenSuccessfully; @@ -1985,7 +1983,7 @@ static void ahciHBAReset(PAHCI pThis) AHCI_HBA_CAP_SNCQ | /* Support native command queuing */ AHCI_HBA_CAP_SSS | /* Staggered spin up */ AHCI_HBA_CAP_CCCS | /* Support command completion coalescing */ - AHCI_HBA_CAP_NCS_SET(AHCI_NR_COMMAND_SLOTS) | /* Number of command slots we support */ + AHCI_HBA_CAP_NCS_SET(pThis->cCmdSlotsAvail) | /* Number of command slots we support */ AHCI_HBA_CAP_NP_SET(pThis->cPortsImpl); /* Number of supported ports */ pThis->regHbaCtrl = AHCI_HBA_CTRL_AE; pThis->regHbaIs = 0; @@ -2873,7 +2871,7 @@ static int ahciIdentifySS(PAHCIPort pAhciPort, void *pvBuf) p[103] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 48); /* The following are SATA specific */ - p[75] = RT_H2LE_U16(31); /* We support 32 commands */ + p[75] = RT_H2LE_U16(pAhciPort->CTX_SUFF(pAhci)->cCmdSlotsAvail-1); /* Number of commands we support, 0's based */ p[76] = RT_H2LE_U16((1 << 8) | (1 << 2)); /* Native command queuing and Serial ATA Gen2 (3.0 Gbps) speed supported */ uint32_t uCsum = ataChecksum(p, 510); @@ -7740,7 +7738,8 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG "SecondarySlave\0" "PortCount\0" "UseAsyncInterfaceIfAvailable\0" - "Bootable\0")) + "Bootable\0" + "CmdSlotsAvail\0")) return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, N_("AHCI configuration error: unknown option specified")); @@ -7780,6 +7779,20 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG return PDMDEV_SET_ERROR(pDevIns, rc, N_("AHCI configuration error: failed to read Bootable as boolean")); + rc = CFGMR3QueryU32Def(pCfg, "CmdSlotsAvail", &pThis->cCmdSlotsAvail, AHCI_NR_COMMAND_SLOTS); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read CmdSlotsAvail as integer")); + Log(("%s: cCmdSlotsAvail=%u\n", __FUNCTION__, pThis->cCmdSlotsAvail)); + if (pThis->cCmdSlotsAvail > AHCI_NR_COMMAND_SLOTS) + return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, + N_("AHCI configuration error: CmdSlotsAvail=%u should not exceed %u"), + pThis->cPortsImpl, AHCI_NR_COMMAND_SLOTS); + if (pThis->cCmdSlotsAvail < 1) + return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, + N_("AHCI configuration error: CmdSlotsAvail=%u should be at least 1"), + pThis->cCmdSlotsAvail); + pThis->fR0Enabled = fR0Enabled; pThis->fGCEnabled = fGCEnabled; pThis->pDevInsR3 = pDevIns; diff --git a/src/VBox/Devices/USB/VUSBDevice.cpp b/src/VBox/Devices/USB/VUSBDevice.cpp index 1aa2fc1f2..49ffcb47f 100644 --- a/src/VBox/Devices/USB/VUSBDevice.cpp +++ b/src/VBox/Devices/USB/VUSBDevice.cpp @@ -57,8 +57,6 @@ typedef struct vusb_reset_args PFNVUSBRESETDONE pfnDone; /** User argument to pfnDone. */ void *pvUser; - /** The timer used to notify EMT. */ - PTMTIMER pTimer; } VUSBRESETARGS, *PVUSBRESETARGS; @@ -1167,8 +1165,6 @@ void vusbDevDestroy(PVUSBDEV pDev) { PVUSBRESETARGS pArgs = (PVUSBRESETARGS)pDev->pvResetArgs; Assert(pArgs->pDev == pDev); - TMR3TimerDestroy(pArgs->pTimer); - pArgs->pTimer = NULL; RTMemTmpFree(pArgs); pDev->hResetThread = NIL_RTTHREAD; @@ -1184,6 +1180,7 @@ void vusbDevDestroy(PVUSBDEV pDev) vusbDevDetach(pDev); RTMemFree(pDev->paIfStates); pDev->enmState = VUSB_DEVICE_STATE_DESTROYED; + TMR3TimerDestroy(pDev->pResetTimer); } @@ -1251,13 +1248,16 @@ static void vusbDevResetDone(PVUSBDEV pDev, int rc, PFNVUSBRESETDONE pfnDone, vo /** * Timer callback for doing reset completion. * + * @param pUsbIns The USB device instance. + * @param pTimer The timer instance. + * @param pvUser The VUSB device data. * @thread EMT */ -static DECLCALLBACK(void) vusbDevResetDoneTimer(void *pvUser) +static DECLCALLBACK(void) vusbDevResetDoneTimer(PPDMUSBINS pUsbIns, PTMTIMER pTimer, void *pvUser) { - PVUSBRESETARGS pArgs = (PVUSBRESETARGS)pvUser; - PVUSBDEV pDev = pArgs->pDev; - Assert(pDev->pvResetArgs == pArgs); + PVUSBDEV pDev = (PVUSBDEV)pvUser; + PVUSBRESETARGS pArgs = (PVUSBRESETARGS)pDev->pvResetArgs; + AssertPtr(pArgs); Assert(pArgs->pDev == pDev); Assert(pDev->pUsbIns == pUsbIns); /* * Release the thread and update the device structure. @@ -1265,14 +1265,13 @@ static DECLCALLBACK(void) vusbDevResetDoneTimer(void *pvUser) int rc = RTThreadWait(pDev->hResetThread, 2, NULL); AssertRC(rc); pDev->hResetThread = NIL_RTTHREAD; - pDev->pvResetArgs = NULL; + pDev->pvResetArgs = NULL; /* * Reset-done processing and cleanup. */ vusbDevResetDone(pArgs->pDev, pArgs->rc, pArgs->pfnDone, pArgs->pvUser); - TMR3TimerDestroy(pArgs->pTimer); RTMemTmpFree(pArgs); } @@ -1290,22 +1289,23 @@ static DECLCALLBACK(void) vusbDevResetDoneTimer(void *pvUser) static DECLCALLBACK(int) vusbDevResetThread(RTTHREAD Thread, void *pvUser) { PVUSBRESETARGS pArgs = (PVUSBRESETARGS)pvUser; + PVUSBDEV pDev = pArgs->pDev; LogFlow(("vusb: reset thread started\n")); /* * Tell EMT that we're in flow and then perform the reset. */ - uint64_t u64EndTS = TMTimerGet(pArgs->pTimer) + TMTimerFromMilli(pArgs->pTimer, 10); + uint64_t u64EndTS = TMTimerGet(pDev->pResetTimer) + TMTimerFromMilli(pDev->pResetTimer, 10); RTThreadUserSignal(Thread); - int rc = pArgs->rc = vusbDevResetWorker(pArgs->pDev, pArgs->fResetOnLinux); + int rc = pArgs->rc = vusbDevResetWorker(pDev, pArgs->fResetOnLinux); /* * We use a timer to communicate the result back to EMT. * This avoids suspend + poweroff issues, and it should give * us more accurate scheduling than making this thread sleep. */ - int rc2 = TMTimerSet(pArgs->pTimer, u64EndTS); + int rc2 = TMTimerSet(pDev->pResetTimer, u64EndTS); AssertReleaseRC(rc2); LogFlow(("vusb: reset thread exiting, rc=%Rrc\n", rc)); @@ -1317,7 +1317,7 @@ static DECLCALLBACK(int) vusbDevResetThread(RTTHREAD Thread, void *pvUser) * Resets a device. * * Since a device reset shall take at least 10ms from the guest point of view, - * it must be performed asynchronously. We create a thread which performs this + * it must be performed asynchronously. We create a thread which performs this * operation and ensures it will take at least 10ms. * * At times - like init - a synchronous reset is required, this can be done @@ -1370,27 +1370,22 @@ DECLCALLBACK(int) vusbDevReset(PVUSBIDEVICE pDevice, bool fResetOnLinux, PFNVUSB PVUSBRESETARGS pArgs = (PVUSBRESETARGS)RTMemTmpAlloc(sizeof(*pArgs)); if (pArgs) { - pArgs->pTimer = TMR3TimerCreateExternal(pVM, TMCLOCK_VIRTUAL, vusbDevResetDoneTimer, pArgs, "USB Device Reset Timer."); - if (pArgs->pTimer) + pDev->pvResetArgs = pArgs; + pArgs->pDev = pDev; + pArgs->fResetOnLinux = fResetOnLinux; + pArgs->rc = VERR_INTERNAL_ERROR; + pArgs->pfnDone = pfnDone; + pArgs->pvUser = pvUser; + int rc = RTThreadCreate(&pDev->hResetThread, vusbDevResetThread, pArgs, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "USBRESET"); + if (RT_SUCCESS(rc)) { - pDev->pvResetArgs = pArgs; - pArgs->pDev = pDev; - pArgs->fResetOnLinux = fResetOnLinux; - pArgs->rc = VERR_INTERNAL_ERROR; - pArgs->pfnDone = pfnDone; - pArgs->pvUser = pvUser; - int rc = RTThreadCreate(&pDev->hResetThread, vusbDevResetThread, pArgs, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "USBRESET"); - if (RT_SUCCESS(rc)) - { - /* give the thread a chance to get started. */ - RTThreadUserWait(pDev->hResetThread, 2); - return rc; - } - - pDev->pvResetArgs = NULL; - pDev->hResetThread = NIL_RTTHREAD; - TMR3TimerDestroy(pArgs->pTimer); + /* give the thread a chance to get started. */ + RTThreadUserWait(pDev->hResetThread, 2); + return rc; } + + pDev->pvResetArgs = NULL; + pDev->hResetThread = NIL_RTTHREAD; RTMemTmpFree(pArgs); } /* fall back to sync on failure */ @@ -1553,6 +1548,14 @@ int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns) memset(&pDev->aPipes[0], 0, sizeof(pDev->aPipes)); pDev->hResetThread = NIL_RTTHREAD; pDev->pvResetArgs = NULL; + pDev->pResetTimer = NULL; + + /* + * Create the reset timer. + */ + int rc = PDMUsbHlpTMTimerCreate(pUsbIns, TMCLOCK_VIRTUAL, vusbDevResetDoneTimer, pDev, 0 /*fFlags*/, + "USB Device Reset Timer", &pDev->pResetTimer); + AssertRCReturn(rc, rc); /* * Get the descriptor cache from the device. (shall cannot fail) diff --git a/src/VBox/Devices/USB/VUSBInternal.h b/src/VBox/Devices/USB/VUSBInternal.h index aeadca228..c325a7ab1 100644 --- a/src/VBox/Devices/USB/VUSBInternal.h +++ b/src/VBox/Devices/USB/VUSBInternal.h @@ -211,6 +211,8 @@ typedef struct VUSBDEV RTTHREAD hResetThread; /** Pointer to the reset thread arguments. */ void *pvResetArgs; + /** The reset timer handle. */ + PTMTIMER pResetTimer; } VUSBDEV; @@ -337,6 +339,9 @@ typedef struct VUSBROOTHUB /** The HUB. * @todo remove this? */ VUSBHUB Hub; +#if HC_ARCH_BITS == 32 + uint32_t Alignment0; +#endif /** Address hash table. */ PVUSBDEV apAddrHash[VUSB_ADDR_HASHSZ]; /** List of async URBs. */ @@ -353,9 +358,6 @@ typedef struct VUSBROOTHUB /** Chain of devices attached to this hub. */ PVUSBDEV pDevices; -#if HC_ARCH_BITS == 32 -// uint32_t Alignment0; -#endif /** Availability Bitmap. */ VUSBPORTBITMAP Bitmap; diff --git a/src/VBox/Devices/VMMDev/VMMDev.cpp b/src/VBox/Devices/VMMDev/VMMDev.cpp index bd9f65e81..a7ca0ca03 100644 --- a/src/VBox/Devices/VMMDev/VMMDev.cpp +++ b/src/VBox/Devices/VMMDev/VMMDev.cpp @@ -1489,10 +1489,11 @@ static DECLCALLBACK(int) vmmdevRequestHandler(PPDMDEVINS pDevIns, void *pvUser, Log(("VMMDevReq_VideoSetVisibleRegion no rectangles!!!\n")); pRequestHeader->rc = VERR_INVALID_PARAMETER; } - else - if (pRequestHeader->size != sizeof(VMMDevVideoSetVisibleRegion) + (ptr->cRect-1)*sizeof(RTRECT)) + else if ( ptr->cRect > _1M /* restrict to sane range */ + || pRequestHeader->size != sizeof(VMMDevVideoSetVisibleRegion) + ptr->cRect * sizeof(RTRECT) - sizeof(RTRECT)) { - Log(("VMMDevReq_VideoSetVisibleRegion request size too small!!!\n")); + Log(("VMMDevReq_VideoSetVisibleRegion: cRects=%#x doesn't match size=%#x or is out of bounds\n", + ptr->cRect, pRequestHeader->size)); pRequestHeader->rc = VERR_INVALID_PARAMETER; } else diff --git a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp index bfff101b7..1bee096f5 100644 --- a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp +++ b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp @@ -449,7 +449,7 @@ int main() GEN_CHECK_OFF(ACPIState, pm1a_en); GEN_CHECK_OFF(ACPIState, pm1a_sts); GEN_CHECK_OFF(ACPIState, pm1a_ctl); - GEN_CHECK_OFF(ACPIState, pm_timer_initial); + GEN_CHECK_OFF(ACPIState, u64PmTimerInitial); GEN_CHECK_OFF(ACPIState, tsR3); GEN_CHECK_OFF(ACPIState, tsR0); GEN_CHECK_OFF(ACPIState, tsRC); @@ -907,6 +907,9 @@ int main() GEN_CHECK_OFF(EHCIROOTHUB, pIDev); GEN_CHECK_OFF(EHCIROOTHUB, IBase); GEN_CHECK_OFF(EHCIROOTHUB, IRhPort); + GEN_CHECK_OFF(EHCIROOTHUB, Led); + GEN_CHECK_OFF(EHCIROOTHUB, ILeds); + GEN_CHECK_OFF(EHCIROOTHUB, pLedsConnector); GEN_CHECK_OFF(EHCIROOTHUB, status); GEN_CHECK_OFF(EHCIROOTHUB, desc_a); GEN_CHECK_OFF(EHCIROOTHUB, desc_b); @@ -924,11 +927,24 @@ int main() GEN_CHECK_OFF(EHCI, pDevInsR3); GEN_CHECK_OFF(EHCI, pDevInsR0); GEN_CHECK_OFF(EHCI, pDevInsRC); + GEN_CHECK_OFF(EHCI, MMIOBase); GEN_CHECK_OFF(EHCI, SofTime); GEN_CHECK_OFF(EHCI, RootHub); + GEN_CHECK_OFF(EHCI, cap_length); + GEN_CHECK_OFF(EHCI, hci_version); + GEN_CHECK_OFF(EHCI, hcs_params); + GEN_CHECK_OFF(EHCI, hcc_params); + GEN_CHECK_OFF(EHCI, cmd); GEN_CHECK_OFF(EHCI, intr_status); GEN_CHECK_OFF(EHCI, intr); + GEN_CHECK_OFF(EHCI, frame_idx); + GEN_CHECK_OFF(EHCI, ds_segment); + GEN_CHECK_OFF(EHCI, periodic_list_base); + GEN_CHECK_OFF(EHCI, async_list_base); + GEN_CHECK_OFF(EHCI, config); + GEN_CHECK_OFF(EHCI, uIrqInterval); GEN_CHECK_OFF(EHCI, HcFmNumber); + GEN_CHECK_OFF(EHCI, uFramesPerTimerCall); GEN_CHECK_OFF(EHCI, cTicksPerFrame); GEN_CHECK_OFF(EHCI, cTicksPerUsbTick); GEN_CHECK_OFF(EHCI, cInFlight); @@ -936,6 +952,7 @@ int main() GEN_CHECK_OFF(EHCI, aInFlight[0].GCPhysTD); GEN_CHECK_OFF(EHCI, aInFlight[0].pUrb); GEN_CHECK_OFF(EHCI, aInFlight[1]); + GEN_CHECK_OFF(EHCI, aInFlight[256]); GEN_CHECK_OFF(EHCI, pLoad); GEN_CHECK_OFF(EHCI, fAsyncTraversalTimerActive); # ifdef VBOX_WITH_STATISTICS @@ -944,6 +961,17 @@ int main() GEN_CHECK_OFF(EHCI, StatDroppedUrbs); GEN_CHECK_OFF(EHCI, StatTimer); # endif + GEN_CHECK_OFF(EHCI, SavedStateEnd); + GEN_CHECK_OFF(EHCI, u64TimerHz); + GEN_CHECK_OFF(EHCI, cIdleCycles); + GEN_CHECK_OFF(EHCI, uFrameRate); + GEN_CHECK_OFF(EHCI, fIdle); + GEN_CHECK_OFF(EHCI, pEOFTimerSyncR3); + GEN_CHECK_OFF(EHCI, pEOFTimerSyncR0); + GEN_CHECK_OFF(EHCI, pEOFTimerSyncRC); + GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncRC); + GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncR3); + GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncR0); # endif /* VBOX_WITH_EHCI */ #endif /* VBOX_WITH_USB */ @@ -1271,6 +1299,7 @@ int main() GEN_CHECK_OFF(AHCI, fSignalIdle); GEN_CHECK_OFF(AHCI, fBootable); GEN_CHECK_OFF(AHCI, cPortsImpl); + GEN_CHECK_OFF(AHCI, cCmdSlotsAvail); GEN_CHECK_OFF(AHCI, f8ByteMMIO4BytesWrittenSuccessfully); #endif /* VBOX_WITH_AHCI */ diff --git a/src/VBox/Frontends/Makefile.kmk b/src/VBox/Frontends/Makefile.kmk index bef60be9d..45c9f2b4f 100644 --- a/src/VBox/Frontends/Makefile.kmk +++ b/src/VBox/Frontends/Makefile.kmk @@ -23,7 +23,7 @@ ifdef VBOX_WITH_MAIN include $(PATH_SUB_CURRENT)/VBoxManage/Makefile.kmk endif ifndef VBOX_ONLY_DOCS - ifndef VBOX_OSE + ifdef VBOX_WITH_MAIN include $(PATH_SUB_CURRENT)/VBoxBalloonCtrl/Makefile.kmk endif ifdef VBOX_WITH_VBOXSDL diff --git a/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp b/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp index d798924dd..65ca87f29 100644 --- a/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp +++ b/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp @@ -1381,7 +1381,7 @@ static DECLCALLBACK(int) vboxbfeConfigConstructor(PVM pVM, void *pvUser) /* * PDM. */ - rc = PDMR3RegisterDrivers(pVM, VBoxDriversRegister); UPDATE_RC(); + rc = PDMR3DrvStaticRegistration(pVM, VBoxDriversRegister); UPDATE_RC(); /* * Devices diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp index 75fe0ae71..c42129fba 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp @@ -363,6 +363,8 @@ static int handleCtrlExecProgram(HandlerArg *a) /** @todo Add a hidden flag. */ if (!RTStrICmp(ValueUnion.psz, "ignoreorphanedprocesses")) uFlags |= ExecuteProcessFlag_IgnoreOrphanedProcesses; + else if (!RTStrICmp(ValueUnion.psz, "noprofile")) + uFlags |= ExecuteProcessFlag_NoProfile; else fUsageOK = false; break; diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp index cb77bbfd6..4c9344919 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp @@ -136,7 +136,7 @@ void printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm) "VBoxManage createvm --name <name>\n" " [--ostype <ostype>]\n" " [--register]\n" - " [--basefolder <path> | --settingsfile <path>]\n" + " [--basefolder <path>]\n" " [--uuid <uuid>]\n" "\n"); diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp index 04315d0ec..f999db8ec 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp @@ -889,7 +889,7 @@ int handleExtPack(HandlerArg *a) static const RTGETOPTDEF s_aUninstallOptions[] = { - { "--forced", 'f', RTGETOPT_REQ_NOTHING }, + { "--force", 'f', RTGETOPT_REQ_NOTHING }, }; RTGetOptInit(&GetState, a->argc, a->argv, s_aUninstallOptions, RT_ELEMENTS(s_aUninstallOptions), 1, 0); diff --git a/src/VBox/Frontends/VBoxShell/vboxshell.py b/src/VBox/Frontends/VBoxShell/vboxshell.py index 416330d4c..f1a658341 100755 --- a/src/VBox/Frontends/VBoxShell/vboxshell.py +++ b/src/VBox/Frontends/VBoxShell/vboxshell.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright (C) 2009-2010 Oracle Corporation +# Copyright (C) 2009-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; @@ -207,10 +207,10 @@ def colSize(ctx,m): def colSizeM(ctx,m): return colored(str(m)+'M', 'red') -def createVm(ctx,name,kind,base): +def createVm(ctx,name,kind): mgr = ctx['mgr'] vb = ctx['vb'] - mach = vb.createMachine(name, kind, base, "", False) + mach = vb.createMachine("", name, kind, "", False) mach.saveSettings() print "created machine with UUID",mach.id vb.registerMachine(mach) @@ -1033,21 +1033,17 @@ def startCmd(ctx, args): return 0 def createVmCmd(ctx, args): - if (len(args) < 3 or len(args) > 4): - print "usage: createvm name ostype <basefolder>" + if (len(args) != 3): + print "usage: createvm name ostype" return 0 name = args[1] oskind = args[2] - if len(args) == 4: - base = args[3] - else: - base = '' try: ctx['vb'].getGuestOSType(oskind) except Exception, e: print 'Unknown OS type:',oskind return 0 - createVm(ctx, name, oskind, base) + createVm(ctx, name, oskind) return 0 def ginfoCmd(ctx,args): diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp index 56aa83560..e03966a78 100644 --- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp +++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp @@ -29,6 +29,12 @@ QITreeWidget::QITreeWidget (QWidget *aParent) { } +void QITreeWidget::setSizeHintForItems(const QSize &sizeHint) +{ + for (int i = 0; i < topLevelItemCount(); ++i) + topLevelItem(i)->setSizeHint(0, sizeHint); +} + void QITreeWidget::paintEvent (QPaintEvent *aEvent) { /* Opens Items Painter */ @@ -59,13 +65,3 @@ void QITreeWidget::resizeEvent (QResizeEvent *aEvent) emit resized (aEvent->size(), aEvent->oldSize()); } -void QITreeWidget::addTopBottomMarginToItems (int aMargin) -{ - for (int i = 0; i < topLevelItemCount(); ++ i) - { - QTreeWidgetItem *item = topLevelItem (i); - QSize s = item->sizeHint (0); - item->setSizeHint (0, QSize (s.width(), s.height() + 2 * aMargin)); - } -} - diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h index 11f656ffe..88de169e0 100644 --- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h +++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h @@ -33,7 +33,7 @@ public: QITreeWidget (QWidget *aParent = 0); - void addTopBottomMarginToItems (int aMargin); + void setSizeHintForItems(const QSize &sizeHint); signals: diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp index 25b5be84a..001345e4d 100644 --- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp +++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp @@ -772,6 +772,14 @@ void VBoxProblemReporter::cannotDeleteMachine(const CMachine &machine) !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res)); } +void VBoxProblemReporter::cannotDeleteMachine(const CMachine &machine, const CProgress &progress) +{ + message(mainWindowShown(), + Error, + tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), + formatErrorInfo(progress.GetErrorInfo())); +} + void VBoxProblemReporter::cannotDiscardSavedState (const CConsole &console) { /* preserve the current error info before calling the object again */ diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h b/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h index 2fafd7364..8876017b3 100644 --- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h +++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h @@ -201,6 +201,7 @@ public: void cannotStopMachine (const CConsole &console); void cannotStopMachine (const CProgress &progress); void cannotDeleteMachine (const CMachine &machine); + void cannotDeleteMachine(const CMachine &machine, const CProgress &progress); void cannotDiscardSavedState (const CConsole &console); void cannotSendACPIToMachine(); diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp index a76c48745..b210fd4a9 100644 --- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp +++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp @@ -320,6 +320,7 @@ void UIMachineViewNormal::setGuestAutoresizeEnabled(bool fEnabled) void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition) { +#ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1 QWidget *pTopLevelWidget = window(); /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */ @@ -364,6 +365,10 @@ void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition) /* Finally, set the frame geometry */ pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db); + +#else /* !VBOX_GUI_WITH_CUSTOMIZATIONS1 */ + Q_UNUSED(bAdjustPosition); +#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */ } QRect UIMachineViewNormal::workingArea() diff --git a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp index 008f16b75..e240da2eb 100644 --- a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp +++ b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp @@ -785,7 +785,7 @@ void VBoxSelectorWnd::vmDelete(const QString &aUuid /* = QString::null */) { vboxProblem().showModalProgressDialog(progress, item->name(), ":/progress_delete_90px.png", 0, true); if (progress.GetResultCode() != 0) - vboxProblem().cannotDeleteMachine(machine); + vboxProblem().cannotDeleteMachine(machine, progress); } } if (!machine.isOk()) diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp index 8a7c1e862..c5032c97b 100644 --- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp +++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp @@ -208,6 +208,11 @@ void UISettingsDialog::retranslateUi() else if (!m_fSilent) m_pWarningPane->setWarningText(m_strWarningHint); +#ifndef VBOX_GUI_WITH_TOOLBAR_SETTINGS + /* Retranslate current page headline: */ + m_pLbTitle->setText(m_pSelector->itemText(m_pSelector->currentId())); +#endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */ + /* Get the list of validators: */ QList<QIWidgetValidator*> validatorsList = findChildren<QIWidgetValidator*>(); /* Retranslate all validators: */ diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp index 901fa8bca..5bd98ced4 100644 --- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp +++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp @@ -433,6 +433,9 @@ void UIGLSettingsDlg::putBackTo() void UIGLSettingsDlg::retranslateUi() { + /* Base-class UI translation: */ + UISettingsDialog::retranslateUi(); + /* Set dialog's name: */ setWindowTitle(title()); @@ -459,9 +462,6 @@ void UIGLSettingsDlg::retranslateUi() /* Translate the selector: */ m_pSelector->polish(); - - /* Base-class UI translation: */ - UISettingsDialog::retranslateUi(); } QString UIGLSettingsDlg::title() const @@ -767,13 +767,22 @@ void UIVMSettingsDlg::putBackTo() void UIVMSettingsDlg::retranslateUi() { - /* Set dialog's name: */ - setWindowTitle(title()); - - /* We have to make sure that the Serial & Network subpages are retranslated + /* We have to make sure that the Network, Serial & Parallel pages are retranslated * before they are revalidated. Cause: They do string comparing within - * vboxGlobal which is retranslated at that point already. */ + * vboxGlobal which is retranslated at that point already: */ QEvent event(QEvent::LanguageChange); + if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Network)) + qApp->sendEvent(pPage, &event); + if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Serial)) + qApp->sendEvent(pPage, &event); + if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Parallel)) + qApp->sendEvent(pPage, &event); + + /* Base-class UI translation: */ + UISettingsDialog::retranslateUi(); + + /* Set dialog's name: */ + setWindowTitle(title()); /* General page: */ m_pSelector->setItemText(VMSettingsPage_General, tr("General")); @@ -792,21 +801,15 @@ void UIVMSettingsDlg::retranslateUi() /* Network page: */ m_pSelector->setItemText(VMSettingsPage_Network, tr("Network")); - if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Network)) - qApp->sendEvent(pPage, &event); /* Ports page: */ m_pSelector->setItemText(VMSettingsPage_Ports, tr("Ports")); /* Serial page: */ m_pSelector->setItemText(VMSettingsPage_Serial, tr("Serial Ports")); - if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Serial)) - qApp->sendEvent(pPage, &event); /* Parallel page: */ m_pSelector->setItemText(VMSettingsPage_Parallel, tr("Parallel Ports")); - if (QWidget *pPage = m_pSelector->idToPage(VMSettingsPage_Parallel)) - qApp->sendEvent(pPage, &event); /* USB page: */ m_pSelector->setItemText(VMSettingsPage_USB, tr("USB")); @@ -816,18 +819,6 @@ void UIVMSettingsDlg::retranslateUi() /* Translate the selector: */ m_pSelector->polish(); - - /* Base-class UI translation: */ - UISettingsDialog::retranslateUi(); - - /* Revalidate all pages to retranslate the warning messages also: */ - QList<QIWidgetValidator*> validators = findChildren<QIWidgetValidator*>(); - for (int i = 0; i < validators.size(); ++i) - { - QIWidgetValidator *pValidator = validators[i]; - if (!pValidator->isValid()) - sltRevalidate(pValidator); - } } QString UIVMSettingsDlg::title() const diff --git a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp index 6457522b8..ed11fcae5 100644 --- a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp +++ b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp @@ -284,15 +284,22 @@ void VBoxSettingsTreeViewSelector::setVisibleById (int aId, bool aShow) void VBoxSettingsTreeViewSelector::polish() { - mTwSelector->setFixedWidth (static_cast<QAbstractItemView*> (mTwSelector) - ->sizeHintForColumn (treeWidget_Category) + 2 * mTwSelector->frameWidth()); - - /* Sort selector by the id column */ - mTwSelector->sortItems (treeWidget_Id, Qt::AscendingOrder); - mTwSelector->resizeColumnToContents (treeWidget_Category); - - /* Add some margin to every item in the tree */ - mTwSelector->addTopBottomMarginToItems (12); + /* Get recommended size hint: */ + int iItemWidth = static_cast<QAbstractItemView*>(mTwSelector)->sizeHintForColumn(treeWidget_Category); + int iItemHeight = qMax(16 /* icon height */, mTwSelector->fontMetrics().height() /* text height */); + /* Add some margin to every item in the tree: */ + iItemHeight += 4 /* margin itself */ * 2 /* margin count */; + /* Set final size hint for items: */ + mTwSelector->setSizeHintForItems(QSize(iItemWidth , iItemHeight)); + + /* Fix selector width to minimum possible: */ + mTwSelector->setFixedWidth(iItemWidth + 2 * mTwSelector->frameWidth()); + + /* Sort selector by the id column: */ + mTwSelector->sortItems(treeWidget_Id, Qt::AscendingOrder); + + /* Resize column(s) to content: */ + mTwSelector->resizeColumnToContents(treeWidget_Category); } void VBoxSettingsTreeViewSelector::settingsGroupChanged (QTreeWidgetItem *aItem, diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui index 8bbced3c3..b912b85d7 100644 --- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui +++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui @@ -60,9 +60,6 @@ <property name="whatsThis" > <string>Displays the name of the virtual machine.</string> </property> - <property name="text" > - <string/> - </property> </widget> </item> </layout> diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp index a0ad930cf..03aad59dd 100644 --- a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp +++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp @@ -247,7 +247,7 @@ void UIProgressDialog::timerEvent(QTimerEvent * /* pEvent */) else if (days > 0) m_pEtaLbl->setText(strOneComp.arg(strDays)); else if (hours > 2) - m_pEtaLbl->setText(strTwoComp.arg(strHours)); + m_pEtaLbl->setText(strOneComp.arg(strHours)); else if (hours > 0 && minutes > 0) m_pEtaLbl->setText(strTwoComp.arg(strHours).arg(strMinutes)); else if (hours > 0) diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp index 996cddc81..0cf29f758 100644 --- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp +++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp @@ -49,7 +49,7 @@ static const osTypePattern gs_OSTypePattern[] = { QRegExp("(Wi.*NT)|(NT4)", Qt::CaseInsensitive), "WindowsNT4" }, { QRegExp("((Wi.*XP)|(\\bXP\\b)).*64", Qt::CaseInsensitive), "WindowsXP_64" }, { QRegExp("(Wi.*XP)|(\\bXP\\b)", Qt::CaseInsensitive), "WindowsXP" }, - { QRegExp("((Wi.*2003)|(W2K3).*64", Qt::CaseInsensitive), "Windows2003_64" }, + { QRegExp("((Wi.*2003)|(W2K3)).*64", Qt::CaseInsensitive), "Windows2003_64" }, { QRegExp("(Wi.*2003)|(W2K3)", Qt::CaseInsensitive), "Windows2003" }, { QRegExp("((Wi.*V)|(Vista)).*64", Qt::CaseInsensitive), "WindowsVista_64" }, { QRegExp("(Wi.*V)|(Vista)", Qt::CaseInsensitive), "WindowsVista" }, diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp index f11412f5f..bd820bace 100644 --- a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp +++ b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp @@ -1187,6 +1187,11 @@ static int supR3HardenedVerifyFsObject(PCSUPR3HARDENEDFSOBJSTATE pFsObjState, bo permit grand parents and beyond to be group writable by admin. */ if (pFsObjState->Stat.st_gid != 80 /*admin*/) /** @todo dynamically resolve the admin group? */ #endif +#ifdef RT_OS_FREEBSD + /* PC-BSD 9 has group-writable application directory, similar to OSX and + their Applications directory */ + if (pFsObjState->Stat.st_gid != 5 /*operators*/) /* Allow operators group-writes */ +#endif return supR3HardenedSetError3(VERR_SUPLIB_WRITE_NON_SYS_GROUP, pErrInfo, "The group is not a system group and it has write access to '", pszPath, "'"); } diff --git a/src/VBox/HostDrivers/Support/freebsd/Makefile b/src/VBox/HostDrivers/Support/freebsd/Makefile index 4fda0f866..9b0050fc5 100644 --- a/src/VBox/HostDrivers/Support/freebsd/Makefile +++ b/src/VBox/HostDrivers/Support/freebsd/Makefile @@ -85,6 +85,8 @@ SRCS += \ .PATH: ${.CURDIR}/common/string SRCS += \ RTStrCopyP.c \ + RTStrCopy.c \ + RTStrNCmp.c \ strformat.c \ strformatrt.c \ strformattype.c \ diff --git a/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv b/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv index ae2c1dd82..aa585e176 100755 --- a/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv +++ b/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv @@ -110,6 +110,8 @@ FILES_VBOXDRV_NOBIN=" \ ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \ ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \ ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopyP.cpp=>common/string/RTStrCopyP.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopy.cpp=>common/string/RTStrCopy.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNCmp.cpp=>common/string/RTStrNCmp.c \ ${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>common/string/strformat.c \ ${PATH_ROOT}/src/VBox/Runtime/common/string/strformatrt.cpp=>common/string/strformatrt.c \ ${PATH_ROOT}/src/VBox/Runtime/common/string/strformattype.cpp=>common/string/strformattype.c \ diff --git a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp index 0d8f86518..9d31b7f58 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp +++ b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp @@ -266,11 +266,16 @@ int suplibOsQueryVTxSupported(void) rc = RTStrToUInt32Ex(szBuf, &pszNext, 10, &uA); if ( RT_SUCCESS(rc) - && *pszNext == '.') + && *pszNext == '.') { + /* + * new version number scheme starting with Linux 3.0 + */ + if (uA >= 3) + return VINF_SUCCESS; rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uB); if ( RT_SUCCESS(rc) - && *pszNext == '.') + && *pszNext == '.') { rc = RTStrToUInt32Ex(pszNext+1, &pszNext, 10, &uC); if (RT_SUCCESS(rc)) diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk b/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk index 5dec2d7fd..cfb87be6e 100644 --- a/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk +++ b/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk @@ -19,14 +19,6 @@ SUB_DEPTH = ../../../../.. include $(KBUILD_PATH)/subheader.kmk # -# VBoxUSBHelper - Setuid binary helper for updating driver alias. -# -PROGRAMS.solaris += VBoxUSBHelper -VBoxUSBHelper_TEMPLATE = VBOXR3EXE -VBoxUSBHelper_SOURCES = VBoxUSBHelper.cpp -VBoxUSBHelper_LIBS = nvpair device - -# # vboxusbmon - The Solaris USB Monitor Kernel module. # SYSMODS.solaris += vboxusbmon diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/USBLib-solaris.cpp b/src/VBox/HostDrivers/VBoxUSB/solaris/USBLib-solaris.cpp index d86eeaf50..d85fb3cb3 100644 --- a/src/VBox/HostDrivers/VBoxUSB/solaris/USBLib-solaris.cpp +++ b/src/VBox/HostDrivers/VBoxUSB/solaris/USBLib-solaris.cpp @@ -73,7 +73,6 @@ typedef enum USBHELPER_OP * Internal Functions * *******************************************************************************/ static int usblibDoIOCtl(unsigned iFunction, void *pvData, size_t cbData); -static int usblibRunHelper(USBHELPER_OP HelperOp, void *pvData); USBLIB_DECL(int) USBLibInit(void) @@ -219,7 +218,6 @@ USBLIB_DECL(int) USBLibGetClientInfo(char *pszDeviceIdent, char **ppszClientPath } -#if 1 USBLIB_DECL(int) USBLibResetDevice(char *pszDevicePath, bool fReattach) { LogFlow((USBLIBR3 ":USBLibResetDevice pszDevicePath=%s\n", pszDevicePath)); @@ -239,131 +237,6 @@ USBLIB_DECL(int) USBLibResetDevice(char *pszDevicePath, bool fReattach) RTMemFree(pReq); return rc; } -#else - -USBLIB_DECL(int) USBLibResetDevice(char *pszDevicePath, bool fReattach) -{ - VBOXUSBHELPERDATA_RESET Data; - Data.pszDevicePath = pszDevicePath; - Data.fHardReset = fReattach; - return usblibRunHelper(RESET, &Data); -} -#endif - -USBLIB_DECL(int) USBLibAddDeviceAlias(PUSBDEVICE pDevice) -{ - VBOXUSBHELPERDATA_ALIAS Data; - Data.idVendor = pDevice->idVendor; - Data.idProduct = pDevice->idProduct; - Data.bcdDevice = pDevice->bcdDevice; - Data.pszDevicePath = pDevice->pszDevicePath; - return usblibRunHelper(ADD_ALIAS, &Data); -} - - -USBLIB_DECL(int) USBLibRemoveDeviceAlias(PUSBDEVICE pDevice) -{ - VBOXUSBHELPERDATA_ALIAS Data; - Data.idVendor = pDevice->idVendor; - Data.idProduct = pDevice->idProduct; - Data.bcdDevice = pDevice->bcdDevice; - Data.pszDevicePath = pDevice->pszDevicePath; - return usblibRunHelper(DEL_ALIAS, &Data); -} - -#if 0 -USBLIB_DECL(int) USBLibConfigureDevice(PUSBDEVICE pDevice) -{ - return usblibRunHelper(pDevice, CONFIGURE); -} -#endif - -static int usblibRunHelper(USBHELPER_OP HelperOp, void *pvUsbHelperData) -{ - LogFlow((USBLIBR3 ":usblibRunHelper HelperOp=%d pvUSBHelperData=%p\n", HelperOp, pvUsbHelperData)); - - /* - * Find VBoxUSBHelper. - */ - char szDriverCtl[PATH_MAX]; - int rc = RTPathExecDir(szDriverCtl, sizeof(szDriverCtl) - sizeof("/" VBOXUSB_HELPER_NAME)); - if (RT_SUCCESS(rc)) - { - strcat(szDriverCtl, "/" VBOXUSB_HELPER_NAME); - if (!RTPathExists(szDriverCtl)) - { - LogRel(("USBProxy: path %s does not exist. Failed to run USB helper %s.\n", szDriverCtl, VBOXUSB_HELPER_NAME)); - return VERR_FILE_NOT_FOUND; - } - - /* - * Run VBoxUSBHelper task. - */ - const char *pszArgs[5]; - if (HelperOp == RESET) - { - PVBOXUSBHELPERDATA_RESET pData = (PVBOXUSBHELPERDATA_RESET)pvUsbHelperData; - pszArgs[0] = szDriverCtl; - pszArgs[1] = pData->fHardReset ? "hardreset" : "softreset"; - pszArgs[2] = pData->pszDevicePath; - pszArgs[3] = NULL; - } - else - { - PVBOXUSBHELPERDATA_ALIAS pData = (PVBOXUSBHELPERDATA_ALIAS)pvUsbHelperData; - char szDriverAlias[128]; - -#if 0 - /* - * USB vid.pid.rev driver binding alias. - */ - RTStrPrintf(szDriverAlias, sizeof(szDriverAlias), "usb%x,%x.%x", pData->idVendor, pData->idProduct, pData->bcdDevice); -#else - /* - * Path based driver binding alias. - */ - RTStrPrintf(szDriverAlias, sizeof(szDriverAlias), "%s", pData->pszDevicePath + sizeof("/devices")); -#endif - pszArgs[0] = szDriverCtl; - pszArgs[1] = HelperOp == ADD_ALIAS ? "add" : "del"; - pszArgs[2] = szDriverAlias; - pszArgs[3] = VBOXUSB_DRIVER_NAME; - } - pszArgs[4] = NULL; - RTPROCESS pid = NIL_RTPROCESS; - rc = RTProcCreate(pszArgs[0], pszArgs, RTENV_DEFAULT, 0, &pid); - if (RT_SUCCESS(rc)) - { - RTPROCSTATUS Status; - rc = RTProcWait(pid, 0, &Status); - if (RT_SUCCESS(rc)) - { - if (Status.enmReason == RTPROCEXITREASON_NORMAL) - { - switch (Status.iStatus) - { - case 0: return VINF_SUCCESS; /* @todo later maybe ignore -4 as well (see VBoxUSBHelper return codes). */ - case -1: return VERR_PERMISSION_DENIED; - case -2: return VERR_INVALID_PARAMETER; - case -3: return VERR_GENERAL_FAILURE; - default: return VERR_INTERNAL_ERROR; - } - } - else - LogRel((USBLIBR3 ":abnormal termination of USB Helper. enmReason=%d\n", Status.enmReason)); - rc = VERR_GENERAL_FAILURE; - } - else - LogRel((USBLIBR3 ":RTProcWait failed rc=%Rrc\n", rc)); - } - else - { - /* Bad. RTProcCreate() failed! */ - LogRel((USBLIBR3 ":Failed to fork() process for running USB helper for device %s: rc=%Rrc\n", rc)); - } - } - return rc; -} static int usblibDoIOCtl(unsigned iFunction, void *pvData, size_t cbData) @@ -393,4 +266,3 @@ static int usblibDoIOCtl(unsigned iFunction, void *pvData, size_t cbData) return rc; } - diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBHelper.cpp b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBHelper.cpp deleted file mode 100644 index fc61ef2af..000000000 --- a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBHelper.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/** $Id: VBoxUSBHelper.cpp $ */ -/** @file - * VBoxUSBHelper, setuid binary wrapper for dynamic driver alias updating. - */ - -/* - * Copyright (C) 2008-2009 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. - */ - -/* - * I think it is currently a security risk using VBoxUSBHelper. By that I mean - * here we have an application that can add/remove driver aliases in a generic - * fashion without requiring root privileges (well setuid). - * - * Later maybe we can change this to hardcode aliases to prefix "usb" and then - * hardcode the driver as "ugen". - */ - -/******************************************************************************* -* Header Files * -*******************************************************************************/ -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include <libdevice.h> -#include <errno.h> -#include <syslog.h> - -typedef enum AliasOp -{ - ADD_ALIAS = 12, - DEL_ALIAS -} AliasOp; - -/** - * Print usage to stdout. - */ -static void Usage(char *pszName) -{ - /* @todo Eventually remove the usage syntax display & only display the copyright and warning. */ - fprintf(stderr, "Oracle VM VirtualBox USB Helper\nCopyright (C) Oracle Corporation\n\n"); -#if 0 - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "Add: %s add <alias> <drivername>\n", pszName); - fprintf(stderr, "Delete: %s del <alias> <drivername>\n", pszName); - fprintf(stderr, "Config: %s cfg <device>\n\n", pszName); - fprintf(stderr, "Warning!! This program is internally used by VirtualBox and not meant to be used directly.\n"); -#endif - exit(-1); -} - -/** - * Return code legend: - * 0 - success. - * -1 - no root permission - * -2 - insufficient arguments - * -3 - abnormal termination of update_drv (not likely) - * -4 - update_drv failed (mostly trying to add already existing alias) - */ -static int UpdateDrv(AliasOp Op, char *pszAlias, char *pszDrv) -{ - char szAlias[256]; - sprintf(szAlias, "\"%s\"", pszAlias); - - /* Store current user ID and raise privilege. */ - uid_t userID = getuid(); - setuid(0); - - /* For adding alias add the driver once to make sure we can update alias, no error checking needed. */ - if (Op == ADD_ALIAS) - { - char szAddDrvCmd[512]; - sprintf(szAddDrvCmd, "/usr/sbin/add_drv %s\n", pszDrv); - system(szAddDrvCmd); - } - - /* Update the alias. */ - char *pszArgs[6]; - int rc = 0; - pszArgs[0] = "/usr/sbin/update_drv"; - pszArgs[1] = (char *)(Op == ADD_ALIAS ? "-a" : "-d"); - pszArgs[2] = "-i"; - pszArgs[3] = pszAlias; - pszArgs[4] = pszDrv; - pszArgs[5] = NULL; - pid_t processID = fork(); - if (processID < 0) - { - /* Bad. fork() failed! */ - rc = -2; - } - if (processID == 0) - { - /* Child process. */ - syslog(LOG_ERR, "VBoxUSBHelper: %s %s %s %s %s\n", pszArgs[0], pszArgs[1], pszArgs[2], pszArgs[3], pszArgs[4]); - execv(pszArgs[0], pszArgs); - _exit(1); - } - - /* Parent process. */ - int result; - while (waitpid(processID, &result, 0) < 0) - ; - if (!WIFEXITED(result)) /* abnormally terminated. */ - rc = -3; - if (WEXITSTATUS(result) != 0) /* non-zero exit status. */ - rc = -4; - - /* Restore user ID. */ - setuid(userID); - - fprintf(stdout, "rc=%d result=%d\n", rc, result); - return rc; -} - -/** - * Return code legend: - * 0 - success. - * -1 - no root permission - * -2 - invalid USB device path - * -3 - failed to acquire devctl_handle - * -4 - failed to reset - */ -static int ResetDev(char *pszDevicePath, bool fHardReset) -{ - /* Convert the di_node device path into a devctl compatible Ap-Id. */ - char szApId[PATH_MAX + 1]; - char *pszPort = NULL; - char *pszDir = NULL; - int rc = 0; - - syslog(LOG_ERR, "VBosUSBHelper: given path=%s\n", pszDevicePath); - - strcpy(szApId, "/devices"); - strcat(szApId, pszDevicePath); - pszPort = strrchr(pszDevicePath, '@'); - if (pszPort) - { - pszPort++; - pszDir = strrchr(szApId, '/'); - if (pszDir) - { - pszDir[0] = '\0'; - strcat(szApId, ":"); - strcat(szApId, pszPort); - - /* Acquire devctl handle. */ - devctl_hdl_t pDevHandle; - pDevHandle = devctl_ap_acquire(szApId, 0); - if (pDevHandle) - { - /* Prepare to configure. */ - nvlist_t *pValueList = NULL; - nvlist_alloc(&pValueList, NV_UNIQUE_NAME_TYPE, NULL); - nvlist_add_int32(pValueList, "port", atoi(pszPort)); - - /* Reset the device */ - rc = devctl_ap_unconfigure(pDevHandle, pValueList); - if (!rc) - { - if (fHardReset) - rc = devctl_ap_disconnect(pDevHandle, pValueList); - - if (!rc) - { - if (fHardReset) - rc = devctl_ap_connect(pDevHandle, pValueList); - - if (!rc) - { - rc = devctl_ap_configure(pDevHandle, pValueList); - if (rc) - syslog(LOG_ERR, "VBoxUSBHelper: Configuring %s failed. rc=%d errno=%d\n", szApId, rc, errno); - } - else - syslog(LOG_ERR, "VBoxUSBHelper: Connecting %s failed. rc=%d errno=%d\n", szApId, rc, errno); - } - else - syslog(LOG_ERR, "VBoxUSBHelper: Disconnecting for %s failed. rc=%d errno=%d\n", szApId, rc, errno); - } - else - syslog(LOG_ERR, "VBoxUSBHelper: Unconfigure for %s failed. rc=%d errno=%d\n", szApId, rc, errno); - - if (rc) - rc = -4; - - /* Free-up the name-value list and the obtained handle. */ - nvlist_free(pValueList); - devctl_release(pDevHandle); - } - else - { - syslog(LOG_ERR, "VBoxUSBHelper: devctl_ap_acquire for %s failed. errno=%d\n", szApId, errno); - rc = -3; - } - } - else - { - syslog(LOG_ERR, "VBoxUSBHelper: invalid device %s\n", pszDevicePath); - rc = -1; - } - } - else - { - syslog(LOG_ERR, "VBoxUSBHelper: invalid device %s\n", pszDevicePath); - rc = -1; - } - fprintf(stdout, "rc=%d\n", rc); - return rc; -} - -/** - * returns error code from UpdateDrv. See UpdateDrv error codes. - */ -int main(int argc, char *argv[]) -{ - /* Check root permissions. */ - if (geteuid() != 0) - { - fprintf(stderr, "This program needs administrator privileges.\n"); - return -1; - } - - if (argc < 3) - { - Usage(argv[0]); - return -2; - } - - AliasOp Operation = ADD_ALIAS; - char *pszOp = argv[1]; - if (!strcasecmp(pszOp, "hardreset")) - return ResetDev(argv[2], true); - else if (!strcasecmp(pszOp, "softreset")) - return ResetDev(argv[2], false); - else if (!strcasecmp(pszOp, "del")) - Operation = DEL_ALIAS; - else if (!strcasecmp(pszOp, "add")) - Operation = ADD_ALIAS; - else - { - Usage(argv[0]); - return -2; - } - - char *pszAlias = argv[2]; - char *pszDrv = argv[3]; - /* Return status from update_drv */ - return UpdateDrv(Operation, pszAlias, pszDrv); -} - diff --git a/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.cpp b/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.cpp index ac35fc1df..34564057e 100644 --- a/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.cpp +++ b/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.cpp @@ -755,6 +755,9 @@ NTSTATUS _stdcall VBoxUSBMonPnPHook(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) if (!pNewIrp) break; + /* The driver verifier claims all PNP irps must have Status preset to STATUS_NOT_SUPPORTED */ + pNewIrp->IoStatus.Status = STATUS_NOT_SUPPORTED; + /* Get the next stack location as that is used for the new irp */ newIrpStack = IoGetNextIrpStackLocation(pNewIrp); Assert(newIrpStack); @@ -797,6 +800,9 @@ NTSTATUS _stdcall VBoxUSBMonPnPHook(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) if (!pNewIrp) break; + /* The driver verifier claims all PNP irps must have Status preset to STATUS_NOT_SUPPORTED */ + pNewIrp->IoStatus.Status = STATUS_NOT_SUPPORTED; + /* Get the next stack location as that is used for the new irp */ newIrpStack = IoGetNextIrpStackLocation(pNewIrp); Assert(newIrpStack); diff --git a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk index ea72e77fd..3227dd557 100644 --- a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk +++ b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk @@ -249,6 +249,7 @@ VBoxOGLrenderspu_SOURCES.linux = render/renderspu_glx.c VBoxOGLrenderspu_SOURCES.solaris = render/renderspu_glx.c VBoxOGLrenderspu_SOURCES.freebsd = render/renderspu_glx.c ifdef VBOX_WITH_COCOA_QT + VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow VBoxOGLrenderspu_SOURCES.darwin = \ render/renderspu_cocoa.c \ render/renderspu_cocoa_helper.m diff --git a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp index 8ecbe8848..3d88fe267 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp +++ b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp @@ -347,6 +347,12 @@ static CRVBOXSVCBUFFER_t* svcGetBuffer(uint32_t iBuffer, uint32_t cbBufferSize) { if (pBuffer->uiId == iBuffer) { + if (pBuffer->uiSize!=cbBufferSize) + { + LogRel(("SHARED_CROPENGL svcGetBuffer: invalid buffer(%i) size %i instead of %i\n", + iBuffer, pBuffer->uiSize, cbBufferSize)); + return NULL; + } return pBuffer; } pBuffer = pBuffer->pNext; @@ -679,7 +685,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 /* Execute the function. */ CRVBOXSVCBUFFER_t *pSvcBuffer = svcGetBuffer(iBuffer, cbBufferSize); - if (!pSvcBuffer || ui32Offset+cbBuffer>cbBufferSize) + if (!pSvcBuffer || ((uint64_t)ui32Offset+cbBuffer)>cbBufferSize) { rc = VERR_INVALID_PARAMETER; } diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu.c index bc62a5166..a9d6b9d4b 100644 --- a/src/VBox/HostServices/SharedOpenGL/render/renderspu.c +++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu.c @@ -1076,6 +1076,26 @@ void renderspuBindFramebufferEXT(GLenum target, GLuint framebuffer) { renderspu_SystemBindFramebufferEXT(target, framebuffer); } + +void renderspuCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +{ + renderspu_SystemCopyPixels(x, y, width, height, type); +} + +void renderspuGetIntegerv(GLenum pname, GLint * params) +{ + renderspu_SystemGetIntegerv(pname, params); +} + +void renderspuDrawBuffer(GLenum mode) +{ + renderspu_SystemDrawBuffer(mode); +} + +void renderspuReadBuffer(GLenum mode) +{ + renderspu_SystemReadBuffer(mode); +} # endif #endif @@ -1120,6 +1140,10 @@ renderspuCreateFunctions(SPUNamedFunctionTable table[]) FILLIN( "Flush", renderspuFlush ); FILLIN( "Finish", renderspuFinish ); FILLIN( "BindFramebufferEXT", renderspuBindFramebufferEXT ); + FILLIN( "CopyPixels", renderspuCopyPixels ); + FILLIN( "GetIntegerv", renderspuGetIntegerv ); + FILLIN( "ReadBuffer", renderspuReadBuffer ); + FILLIN( "DrawBuffer", renderspuDrawBuffer ); # endif #endif return i; diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu.h b/src/VBox/HostServices/SharedOpenGL/render/renderspu.h index 1cecd3f0d..61e7662c1 100644 --- a/src/VBox/HostServices/SharedOpenGL/render/renderspu.h +++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu.h @@ -302,6 +302,10 @@ extern void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects); extern void renderspu_SystemFlush(); extern void renderspu_SystemFinish(); extern void renderspu_SystemBindFramebufferEXT(GLenum target, GLuint framebuffer); +extern void renderspu_SystemCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +extern void renderspu_SystemGetIntegerv(GLenum pname, GLint *params); +extern void renderspu_SystemReadBuffer(GLenum mode); +extern void renderspu_SystemDrawBuffer(GLenum mode); # endif #endif extern void renderspu_SystemShowWindow( WindowInfo *window, GLboolean showIt ); diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c index 9e17931c5..2fbe77d7b 100644 --- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c +++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c @@ -200,3 +200,23 @@ void renderspu_SystemBindFramebufferEXT(GLenum target, GLuint framebuffer) cocoaBindFramebufferEXT(target, framebuffer); } +void renderspu_SystemCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +{ + cocoaCopyPixels(x, y, width, height, type); +} + +void renderspu_SystemGetIntegerv(GLenum pname, GLint * params) +{ + cocoaGetIntegerv(pname, params); +} + +void renderspu_SystemReadBuffer(GLenum mode) +{ + cocoaReadBuffer(mode); +} + +void renderspu_SystemDrawBuffer(GLenum mode) +{ + cocoaDrawBuffer(mode); +} + diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h index 7edcaa194..32a5e3a41 100644 --- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h +++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h @@ -48,6 +48,10 @@ void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, GLint* paRec void cocoaFlush(void); void cocoaFinish(void); void cocoaBindFramebufferEXT(GLenum target, GLuint framebuffer); +void cocoaCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +void cocoaGetIntegerv(GLenum pname, GLint *params); +void cocoaReadBuffer(GLenum mode); +void cocoaDrawBuffer(GLenum mode); RT_C_DECLS_END diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m index 1943d1355..bd0c55827 100644 --- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m +++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m @@ -26,10 +26,56 @@ #include <iprt/mem.h> #include <iprt/time.h> +/* + * How this works: + * In general it is not so easy like on the other platforms, cause Cocoa + * doesn't support any clipping of already painted stuff. In Mac OS X there is + * the concept of translucent canvas's e.g. windows and there it is just + * painted what should be visible to the user. Unfortunately this isn't the + * concept of chromium. Therefor I reroute all OpenGL operation from the guest + * to a frame buffer object (FBO). This is a OpenGL extension, which is + * supported by all OS X versions we support (AFAIC tell). Of course the guest + * doesn't know that and we have to make sure that the OpenGL state always is + * in the right state to paint into the FBO and not to the front/back buffer. + * Several functions below (like cocoaBindFramebufferEXT, cocoaGetIntegerv, + * ...) doing this. When a swap or finish is triggered by the guest, the + * content (which is already bound to an texture) is painted on the screen + * within a separate OpenGL context. This allows the usage of the same + * resources (texture ids, buffers ...) but at the same time having an + * different internal OpenGL state. Another advantage is that we can paint a + * thumbnail of the current output in a much more smaller (GPU accelerated + * scale) version on a third context and use glReadPixels to get the actual + * data. glReadPixels is a very slow operation, but as we just use a much more + * smaller image, we can handle it (anyway this is only done 5 times per + * second). + * + * Other things to know: + * - If the guest request double buffering, we have to make sure there are two + * buffers. We use the same FBO with 2 color attachments. Also glDrawBuffer + * and glReadBuffer is intercepted to make sure it is painted/read to/from + * the correct buffers. On swap our buffers are swapped and not the + * front/back buffer. + * - If the guest request a depth/stencil buffer, a combined render buffer for + * this is created. + * - If the size of the guest OpenGL window changes, all FBO's, textures, ... + * need to be recreated. + * - We need to track any changes to the parent window + * (create/destroy/move/resize). The various classes like OverlayHelperView, + * OverlayWindow, ... are there for. + * - The HGCM service runs on a other thread than the Main GUI. Keeps this + * always in mind (see e.g. performSelectorOnMainThread in renderFBOToView) + * - We make heavy use of late binding. We can not be sure that the GUI (or any + * other third party GUI), overwrite our NSOpenGLContext. So we always ask if + * this is our own one, before use. Really neat concept of Objective-C/Cocoa + * ;) + */ + /* Debug macros */ #define FBO 1 /* Disable this to see how the output is without the FBO in the middle of the processing chain. */ -//#define SHOW_WINDOW_BACKGROUND 1 /* Define this to see the window background even if the window is clipped */ -//#define DEBUG_VERBOSE /* Define this could get some debug info about the messages flow. */ +#if 0 +#define SHOW_WINDOW_BACKGROUND 1 /* Define this to see the window background even if the window is clipped */ +#define DEBUG_VERBOSE /* Define this to get some debug info about the messages flow. */ +#endif #ifdef DEBUG_poetzsch #define DEBUG_MSG(text) \ @@ -62,14 +108,14 @@ char *errStr; switch (g) { - case GL_INVALID_ENUM: errStr = RTStrDup("GL_INVALID_ENUM"); break; - case GL_INVALID_VALUE: errStr = RTStrDup("GL_INVALID_VALUE"); break; + case GL_INVALID_ENUM: errStr = RTStrDup("GL_INVALID_ENUM"); break; + case GL_INVALID_VALUE: errStr = RTStrDup("GL_INVALID_VALUE"); break; case GL_INVALID_OPERATION: errStr = RTStrDup("GL_INVALID_OPERATION"); break; - case GL_STACK_OVERFLOW: errStr = RTStrDup("GL_STACK_OVERFLOW"); break; - case GL_STACK_UNDERFLOW: errStr = RTStrDup("GL_STACK_UNDERFLOW"); break; - case GL_OUT_OF_MEMORY: errStr = RTStrDup("GL_OUT_OF_MEMORY"); break; - case GL_TABLE_TOO_LARGE: errStr = RTStrDup("GL_TABLE_TOO_LARGE"); break; - default: errStr = RTStrDup("UNKNOWN"); break; + case GL_STACK_OVERFLOW: errStr = RTStrDup("GL_STACK_OVERFLOW"); break; + case GL_STACK_UNDERFLOW: errStr = RTStrDup("GL_STACK_UNDERFLOW"); break; + case GL_OUT_OF_MEMORY: errStr = RTStrDup("GL_OUT_OF_MEMORY"); break; + case GL_TABLE_TOO_LARGE: errStr = RTStrDup("GL_TABLE_TOO_LARGE"); break; + default: errStr = RTStrDup("UNKNOWN"); break; } DEBUG_MSG(("%s:%d: glError %d (%s)\n", file, line, g, errStr)); RTMemFree(errStr); @@ -143,15 +189,23 @@ while(0); NSOpenGLContext *m_pSharedGLCtx; RTTHREAD mThread; - /* FBO handling */ +#ifdef FBO GLuint m_FBOId; - GLuint m_FBOTexId; - NSSize m_FBOTexSize; + /* FBO handling */ + GLuint m_FBOTexBackId; + GLuint m_FBOTexFrontId; + GLuint m_FBOAttBackId; + GLuint m_FBOAttFrontId; GLuint m_FBODepthStencilPackedId; + NSSize m_FBOTexSize; + + bool m_fFrontDrawing; +#endif /* The corresponding dock tile view of this OpenGL view & all helper * members. */ DockOverlayView *m_DockTileView; + GLuint m_FBOThumbId; GLuint m_FBOThumbTexId; GLfloat m_FBOThumbScaleX; @@ -188,13 +242,17 @@ while(0); - (void)createFBO; - (void)deleteFBO; +- (bool)isCurrentFBO; - (void)updateFBO; - (void)makeCurrentFBO; - (void)swapFBO; - (void)flushFBO; +- (void)stateInfo:(GLenum)pname withParams:(GLint*)params; - (void)finishFBO; -- (void)bindFBO; +- (void)bindFBO:(GLenum)target withFrameBuffer:(GLuint)framebuffer; +- (void)tryDraw; - (void)renderFBOToView; +- (void)renderFBOToDockTile; - (void)clearVisibleRegions; - (void)setVisibleRegions:(GLint)cRects paRects:(GLint*)paRects; @@ -316,6 +374,7 @@ while(0); hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat:NSAlphaFirstBitmapFormat bytesPerRow:frame.size.width * 4 bitsPerPixel:8 * 4]; m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]]; @@ -331,11 +390,13 @@ while(0); - (void)drawRect:(NSRect)aRect { + NSRect frame; + [self lock]; #ifdef SHOW_WINDOW_BACKGROUND [[NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.7] set]; - NSRect frame = [self frame]; - [NSBezierPath fillRect:NSMakeRect(0, 0, frame.size.width, frame.size.height)]; + frame = [self frame]; + [NSBezierPath fillRect:NSMakeRect(0, 0, frame.size.width, frame.size.height)]; #endif /* SHOW_WINDOW_BACKGROUND */ if (m_ThumbImage != nil) [m_ThumbImage drawAtPoint:NSMakePoint(0, 0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; @@ -369,12 +430,14 @@ while(0); if (self) m_pPixelFormat = format; + DEBUG_MSG(("OCTX(%p): init OverlayOpenGLContext\n", (void*)self)); + return self; } - + - (void)dealloc { - DEBUG_MSG(("Dealloc context %X\n", (uint)self)); + DEBUG_MSG(("OCTX(%p): dealloc OverlayOpenGLContext\n", (void*)self)); [m_pPixelFormat release]; @@ -390,6 +453,8 @@ while(0); -(void)setView:(NSView*)view { + DEBUG_MSG(("OCTX(%p): setView: new view: %p\n", (void*)self, (void*)view)); + #ifdef FBO m_pView = view;; #else @@ -408,6 +473,8 @@ while(0); -(void)clearDrawable { + DEBUG_MSG(("OCTX(%p): clearDrawable\n", (void*)self)); + m_pView = NULL;; [super clearDrawable]; } @@ -417,7 +484,7 @@ while(0); return m_pPixelFormat; } -@end; +@end /******************************************************************************** * @@ -432,11 +499,15 @@ while(0); m_pOverlayWindow = pOverlayWindow; + DEBUG_MSG(("OHVW(%p): init OverlayHelperView\n", (void*)self)); + return self; } -(void)viewDidMoveToWindow { + DEBUG_MSG(("OHVW(%p): viewDidMoveToWindow: new win: %p\n", (void*)self, (void*)[self window])); + [m_pOverlayWindow parentWindowChanged:[self window]]; } @@ -451,7 +522,9 @@ while(0); - (id)initWithParentView:(NSView*)pParentView overlayView:(OverlayView*)pOverlayView { - if(self = [super initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) + NSWindow *pParentWin = nil; + + if((self = [super initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])) { m_pParentView = pParentView; m_pOverlayView = pOverlayView; @@ -475,7 +548,7 @@ while(0); /* Disable mouse events for this window */ [self setIgnoresMouseEvents:YES]; - NSWindow *pParentWin = [m_pParentView window]; + pParentWin = [m_pParentView window]; /* Initial set the position to the parents view top/left (Compiz fix). */ [self setFrameOrigin: @@ -487,15 +560,17 @@ while(0); /* Add ourself as a child to the parent views window. Note: this has to * be done last so that everything else is setup in - * parentWindowChanged. */ + * parentWindowChanged. */ [pParentWin addChildWindow:self ordered:NSWindowAbove]; } + DEBUG_MSG(("OWIN(%p): init OverlayWindow\n", (void*)self)); + return self; } - (void)dealloc { - DEBUG_MSG(("Dealloc window %X\n", (uint)self)); + DEBUG_MSG(("OWIN(%p): dealloc OverlayWindow\n", (void*)self)); [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -507,17 +582,23 @@ while(0); - (void)parentWindowFrameChanged:(NSNotification*)pNote { + DEBUG_MSG(("OWIN(%p): parentWindowFrameChanged\n", (void*)self)); + /* Reposition this window with the help of the OverlayView. Perform the * call in the OpenGL thread. */ -// [m_pOverlayView performSelector:@selector(reshape) onThread:m_Thread withObject:nil waitUntilDone:YES]; - DEBUG_MSG(("parentWindowFrameChanged\n")); + /* + [m_pOverlayView performSelector:@selector(reshape) onThread:m_Thread withObject:nil waitUntilDone:YES]; + */ + [m_pOverlayView reshape]; } - (void)parentWindowChanged:(NSWindow*)pWindow { + DEBUG_MSG(("OWIN(%p): parentWindowChanged\n", (void*)self)); + [[NSNotificationCenter defaultCenter] removeObserver:self]; - DEBUG_MSG(("parentWindowChanged\n")); + if(pWindow != nil) { /* Ask to get notifications when our parent window frame changes. */ @@ -530,8 +611,10 @@ while(0); [pWindow addChildWindow:self ordered:NSWindowAbove]; /* Reshape the overlay view after a short waiting time to let the main * window resize itself properly. */ -// [m_pOverlayView performSelector:@selector(reshape) withObject:nil afterDelay:0.2]; -// [NSTimer scheduledTimerWithTimeInterval:0.2 target:m_pOverlayView selector:@selector(reshape) userInfo:nil repeats:NO]; + /* + [m_pOverlayView performSelector:@selector(reshape) withObject:nil afterDelay:0.2]; + [NSTimer scheduledTimerWithTimeInterval:0.2 target:m_pOverlayView selector:@selector(reshape) userInfo:nil repeats:NO]; + */ [m_pOverlayView reshape]; } } @@ -547,44 +630,49 @@ while(0); - (id)initWithFrame:(NSRect)frame thread:(RTTHREAD)aThread parentView:(NSView*)pParentView { - m_pParentView = pParentView; + m_pParentView = pParentView; /* Make some reasonable defaults */ - m_pGLCtx = NULL; - m_pSharedGLCtx = NULL; - mThread = aThread; - m_FBOId = 0; - m_FBOTexId = 0; - m_FBOTexSize = NSZeroSize; + m_pGLCtx = nil; + m_pSharedGLCtx = nil; + mThread = aThread; +#ifdef FBO + m_FBOId = 0; + m_FBOTexBackId = 0; + m_FBOTexFrontId = 0; + m_FBOAttBackId = GL_COLOR_ATTACHMENT0_EXT; + m_FBOAttFrontId = GL_COLOR_ATTACHMENT1_EXT; m_FBODepthStencilPackedId = 0; - m_FBOThumbId = 0; - m_FBOThumbTexId = 0; - m_cClipRects = 0; - m_paClipRects = NULL; - m_Pos = NSZeroPoint; - m_Size = NSZeroSize; - m_RootShift = NSZeroPoint; + m_FBOTexSize = NSZeroSize; +#endif + m_FBOThumbId = 0; + m_FBOThumbTexId = 0; + m_cClipRects = 0; + m_paClipRects = NULL; + m_Pos = NSZeroPoint; + m_Size = NSMakeSize(1, 1); + m_RootShift = NSZeroPoint; - DEBUG_MSG(("Init view %X (%X)\n", (uint)self, (uint)mThread)); - self = [super initWithFrame:frame]; + DEBUG_MSG(("OVIW(%p): init OverlayView\n", (void*)self)); + return self; } - (void)dealloc { - DEBUG_MSG(("Dealloc view %X\n", (uint)self)); + DEBUG_MSG(("OVIW(%p): dealloc OverlayView\n", (void*)self)); [self deleteFBO]; if (m_pGLCtx) { - if ([m_pGLCtx view] == self) + if ([m_pGLCtx view] == self) [m_pGLCtx clearDrawable]; } if (m_pSharedGLCtx) { - if ([m_pSharedGLCtx view] == self) + if ([m_pSharedGLCtx view] == self) [m_pSharedGLCtx clearDrawable]; [m_pSharedGLCtx release]; @@ -597,21 +685,13 @@ while(0); - (void)drawRect:(NSRect)aRect { -// NSGraphicsContext*pC = [NSGraphicsContext currentContext]; -// [[NSColor blueColor] set]; -// NSBezierPath *p = [[NSBezierPath alloc] bezierPathWithOvalInRect:[self frame]]; -// [p fill]; -// [[NSColor greenColor] set]; -// [p stroke]; -// if ([self lockFocusIfCanDraw]) -// { -// [self renderFBOToView]; -// [self unlockFocus]; -// } + /* Do nothing */ } - (void)setGLCtx:(NSOpenGLContext*)pCtx { + DEBUG_MSG(("OVIW(%p): setGLCtx: new ctx: %p\n", (void*)self, (void*)pCtx)); + m_pGLCtx = pCtx; } @@ -625,14 +705,18 @@ while(0); return m_pParentView; } -- (void)setParentView: (NSView*)view +- (void)setParentView:(NSView*)pView { - m_pParentView = view; + DEBUG_MSG(("OVIW(%p): setParentView: new view: %p\n", (void*)self, (void*)pView)); + + m_pParentView = pView; } -- (void)setOverlayWin: (NSWindow*)win +- (void)setOverlayWin:(NSWindow*)pWin { - m_pOverlayWin = win; + DEBUG_MSG(("OVIW(%p): setOverlayWin: new win: %p\n", (void*)self, (void*)pWin)); + + m_pOverlayWin = pWin; } - (NSWindow*)overlayWin @@ -642,7 +726,10 @@ while(0); - (void)setPos:(NSPoint)pos { + DEBUG_MSG(("OVIW(%p): setPos: new pos: %d, %d\n", (void*)self, (int)pos.x, (int)pos.y)); + m_Pos = pos; + [self reshape]; } @@ -654,20 +741,22 @@ while(0); - (void)setSize:(NSSize)size { m_Size = size; - - if (!m_FBOId) + +#ifdef FBO + if (m_FBOId) { - DEBUG_MSG(("Set size (no fbo) %p\n", self)); + DEBUG_MSG(("OVIW(%p): setSize: new size: %dx%d\n", (void*)self, (int)size.width, (int)size.height)); [self reshape]; [self updateFBO]; + /* have to rebind GL_TEXTURE_RECTANGLE_ARB as m_FBOTexId could be changed in updateFBO call */ + [self updateViewport]; } else +#endif { - DEBUG_MSG(("Set size FBO %p\n", self)); + DEBUG_MSG(("OVIW(%p): setSize (no FBO): new size: %dx%d\n", (void*)self, (int)size.width, (int)size.height)); [self reshape]; [self updateFBO]; - /* have to rebind GL_TEXTURE_RECTANGLE_ARB as m_FBOTexId could be changed in updateFBO call */ - [self updateViewport]; } } @@ -678,62 +767,69 @@ while(0); - (void)updateViewport { - DEBUG_MSG(("updateViewport %p\n", self)); + NSRect r; + + DEBUG_MSG(("OVIW(%p): updateViewport\n", (void*)self)); + +#ifdef FBO if (m_pSharedGLCtx) { /* Update the viewport for our OpenGL view */ - DEBUG_MSG(("MakeCurrent (shared) %X\n", m_pSharedGLCtx)); + DEBUG_MSG(("OVIW(%p): makeCurrent (shared) %p\n", (void*)self, (void*)m_pSharedGLCtx)); [m_pSharedGLCtx makeCurrentContext]; [m_pSharedGLCtx update]; - NSRect r = [self frame]; + r = [self frame]; /* Setup all matrices */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, r.size.width, r.size.height); glOrtho(0, r.size.width, 0, r.size.height, -1, 1); - DEBUG_MSG_1(("frame[%i, %i, %i, %i]\n", (int)r.origin.x, (int)r.origin.x, (int)r.size.width, (int)r.size.height)); - DEBUG_MSG_1(("m_Pos(%i,%i) m_Size(%i,%i)\n", (int)m_Pos.x, (int)m_Pos.y, (int)m_Size.width, (int)m_Size.height)); - DEBUG_MSG_1(("m_RootShift(%i, %i)\n", (int)m_RootShift.x, (int)m_RootShift.y)); + DEBUG_MSG_1(("OVIW(%p): frame[%i, %i, %i, %i]\n", (void*)self, (int)r.origin.x, (int)r.origin.x, (int)r.size.width, (int)r.size.height)); + DEBUG_MSG_1(("OVIW(%p): m_Pos(%i,%i) m_Size(%i,%i)\n", (void*)self, (int)m_Pos.x, (int)m_Pos.y, (int)m_Size.width, (int)m_Size.height)); + DEBUG_MSG_1(("OVIW(%p): m_RootShift(%i, %i)\n", (void*)self, (int)m_RootShift.x, (int)m_RootShift.y)); glMatrixMode(GL_TEXTURE); glLoadIdentity(); - glTranslatef(0.0f, m_RootShift.y, 0.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef(-m_RootShift.x, 0.0f, 0.0f); /* Clear background to transparent */ glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glEnable(GL_TEXTURE_RECTANGLE_ARB); - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexId); - - DEBUG_MSG(("MakeCurrent %X\n", m_pGLCtx)); + DEBUG_MSG(("OVIW(%p): makeCurrent (non shared) %p\n", (void*)self, (void*)m_pGLCtx)); [m_pGLCtx makeCurrentContext]; } +#endif } - (void)reshape { - DEBUG_MSG(("(%p)reshape %p\n", RTThreadSelf(), self)); + NSRect parentFrame = NSZeroRect; + NSPoint parentPos = NSZeroPoint; + NSPoint childPos = NSZeroPoint; + NSRect childFrame = NSZeroRect; + NSRect newFrame = NSZeroRect; + + DEBUG_MSG(("OVIW(%p): reshape\n", (void*)self)); + /* Getting the right screen coordinates of the parents frame is a little bit * complicated. */ - NSRect parentFrame = [m_pParentView frame]; - NSPoint parentPos = [[m_pParentView window] convertBaseToScreen:[[m_pParentView superview] convertPointToBase:NSMakePoint(parentFrame.origin.x, parentFrame.origin.y + parentFrame.size.height)]]; + parentFrame = [m_pParentView frame]; + parentPos = [[m_pParentView window] convertBaseToScreen:[[m_pParentView superview] convertPointToBase:NSMakePoint(parentFrame.origin.x, parentFrame.origin.y + parentFrame.size.height)]]; parentFrame.origin.x = parentPos.x; parentFrame.origin.y = parentPos.y; /* Calculate the new screen coordinates of the overlay window. */ - NSPoint childPos = NSMakePoint(m_Pos.x, m_Pos.y + m_Size.height); + childPos = NSMakePoint(m_Pos.x, m_Pos.y + m_Size.height); childPos = [[m_pParentView window] convertBaseToScreen:[[m_pParentView superview] convertPointToBase:childPos]]; /* Make a frame out of it. */ - NSRect childFrame = NSMakeRect(childPos.x, childPos.y, m_Size.width, m_Size.height); + childFrame = NSMakeRect(childPos.x, childPos.y, m_Size.width, m_Size.height); /* We have to make sure that the overlay window will not be displayed out * of the parent window. So intersect both frames & use the result as the new * frame for the window. */ - NSRect newFrame = NSIntersectionRect(parentFrame, childFrame); + newFrame = NSIntersectionRect(parentFrame, childFrame); /* Later we have to correct the texture position in the case the window is * out of the parents window frame. So save the shift values for later use. */ @@ -746,17 +842,19 @@ while(0); else m_RootShift.y = 0; -// NSScrollView *pScrollView = [[[m_pParentView window] contentView] enclosingScrollView]; -// if (pScrollView) -// { -// NSRect scrollRect = [pScrollView documentVisibleRect]; -// NSRect scrollRect = [m_pParentView visibleRect]; -// printf ("sc rect: %d %d %d %d\n", (int) scrollRect.origin.x,(int) scrollRect.origin.y,(int) scrollRect.size.width,(int) scrollRect.size.height); -// NSRect b = [[m_pParentView superview] bounds]; -// printf ("bound rect: %d %d %d %d\n", (int) b.origin.x,(int) b.origin.y,(int) b.size.width,(int) b.size.height); -// newFrame.origin.x += scrollRect.origin.x; -// newFrame.origin.y += scrollRect.origin.y; -// } + /* + NSScrollView *pScrollView = [[[m_pParentView window] contentView] enclosingScrollView]; + if (pScrollView) + { + NSRect scrollRect = [pScrollView documentVisibleRect]; + NSRect scrollRect = [m_pParentView visibleRect]; + printf ("sc rect: %d %d %d %d\n", (int) scrollRect.origin.x,(int) scrollRect.origin.y,(int) scrollRect.size.width,(int) scrollRect.size.height); + NSRect b = [[m_pParentView superview] bounds]; + printf ("bound rect: %d %d %d %d\n", (int) b.origin.x,(int) b.origin.y,(int) b.size.width,(int) b.size.height); + newFrame.origin.x += scrollRect.origin.x; + newFrame.origin.y += scrollRect.origin.y; + } + */ /* Set the new frame. */ [[self window] setFrame:newFrame display:YES]; @@ -770,19 +868,17 @@ while(0); - (void)createFBO { - GLint oldTexId; - GLint oldFBId; - - DEBUG_MSG(("createFBO %p\n", self)); + GLint oldTexId = 0; + GLint oldFBId = 0; + NSView *pDockScreen = nil; + GLint maxTexSize = 0; + GLfloat imageAspectRatio = 0; + GLint filter = GL_NEAREST; + [self deleteFBO]; - //GL_SAVE_STATE; -#if 0 - CHECK_GL_ERROR(); - glPushAttrib(GL_ACCUM_BUFFER_BIT); - glPopAttrib(); - CHECK_GL_ERROR(); -#endif +#ifdef FBO + DEBUG_MSG(("OVIW(%p): createFBO\n", (void*)self)); glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &oldTexId); glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &oldFBId); @@ -799,14 +895,20 @@ while(0); isFBO = gluCheckExtension((const GLubyte*)"GL_EXT_framebuffer_object", strExt); if (!isFBO) { - DEBUG_MSG(("Your system does not support framebuffer extension\n")); + DEBUG_MSG(("Your system does not support the GL_EXT_framebuffer_object extension\n")); } - + isFBO = gluCheckExtension((const GLubyte*)"GL_EXT_framebuffer_blit", strExt); + if (!isFBO) + { + DEBUG_MSG(("Your system does not support the GL_EXT_framebuffer_blit extension\n")); + } + /* Create FBO object */ glGenFramebuffersEXT(1, &m_FBOId); /* & the texture as well the depth/stencil render buffer */ - glGenTextures(1, &m_FBOTexId); - DEBUG_MSG(("Create FBO %d %d\n", m_FBOId, m_FBOTexId)); + glGenTextures(1, &m_FBOTexBackId); + glGenTextures(1, &m_FBOTexFrontId); + DEBUG_MSG(("OVIW(%p): gen numbers: FBOId=%d FBOTexBackId=%d FBOTexFrontId=%d\n", (void*)self, m_FBOId, m_FBOTexBackId, m_FBOTexFrontId)); glGenRenderbuffersEXT(1, &m_FBODepthStencilPackedId); } @@ -815,62 +917,74 @@ while(0); /* Bind to FBO */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); - /*glEnable(GL_TEXTURE_RECTANGLE_ARB);*/ - - GLfloat imageAspectRatio = m_FBOTexSize.width / m_FBOTexSize.height; + /* + glEnable(GL_TEXTURE_RECTANGLE_ARB); + */ + + imageAspectRatio = m_FBOTexSize.width / m_FBOTexSize.height; /* Sanity check against maximum OpenGL texture size. If bigger adjust to * maximum possible size while maintain the aspect ratio. */ - GLint maxTexSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize); -// maxTexSize = 150; - GLint filter = GL_NEAREST; - if (m_FBOTexSize.width > maxTexSize || m_FBOTexSize.height > maxTexSize) + if (m_FBOTexSize.width > maxTexSize || m_FBOTexSize.height > maxTexSize) { filter = GL_LINEAR; if (imageAspectRatio > 1) { - m_FBOTexSize.width = maxTexSize; + m_FBOTexSize.width = maxTexSize; m_FBOTexSize.height = maxTexSize / imageAspectRatio; } else { m_FBOTexSize.width = maxTexSize * imageAspectRatio; - m_FBOTexSize.height = maxTexSize; + m_FBOTexSize.height = maxTexSize; } } - - /* Initialize FBO Texture */ - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexId); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, filter); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); - + + DEBUG_MSG(("OVIW(%p): tex size is: %dx%d\n", (void*)self, (int)m_FBOTexSize.width, (int)m_FBOTexSize.height)); + + /* Initialize FBO Textures */ /* The GPUs like the GL_BGRA / GL_UNSIGNED_INT_8_8_8_8_REV combination * others are also valid, but might incur a costly software translation. */ + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexBackId); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, m_FBOTexSize.width, m_FBOTexSize.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); - DEBUG_MSG(("m_FBOTexSize(%i,%i)\n", (int)m_FBOTexSize.width, (int)m_FBOTexSize.height)); - - /* Now attach texture to the FBO as its color destination */ - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, m_FBOTexId, 0); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexFrontId); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, m_FBOTexSize.width, m_FBOTexSize.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); + + /* Now attach the textures to the FBO as its color destinations */ + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, m_FBOAttBackId, GL_TEXTURE_RECTANGLE_ARB, m_FBOTexBackId, 0); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, m_FBOAttFrontId, GL_TEXTURE_RECTANGLE_ARB, m_FBOTexFrontId, 0); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_FBODepthStencilPackedId); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT, m_FBOTexSize.width, m_FBOTexSize.height); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_FBODepthStencilPackedId); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_FBODepthStencilPackedId); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_FBOTexSize.width, m_FBOTexSize.height); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_FBODepthStencilPackedId); + + /* Bind the FBOs for reading and drawing. */ + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_FBOId); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_FBOId); + + /* Explicitly clear the textures otherwise they would contain old memory stuff. */ + glDrawBuffer(m_FBOAttBackId); + glClear(GL_COLOR_BUFFER_BIT); + glDrawBuffer(m_FBOAttFrontId); + glClear(GL_COLOR_BUFFER_BIT); + + /* Now initially reading/drawing to the back buffer. */ + glReadBuffer(m_FBOAttBackId); + glDrawBuffer(m_FBOAttBackId); /* Make sure the FBO was created successfully. */ if (GL_FRAMEBUFFER_COMPLETE_EXT != glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)) - DEBUG_MSG(("Framebuffer Object creation or update failed!\n")); + DEBUG_MSG(("OVIW(%p): Framebuffer Object creation or update failed!\n", (void*)self)); +// glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, oldTexId); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFBId ? oldFBId:m_FBOId); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, (GLuint)oldFBId ? (GLuint)oldFBId : m_FBOId); /* Is there a dock tile preview enabled in the GUI? If so setup a * additional thumbnail view for the dock tile. */ - NSView *dockScreen = [self dockTileScreen]; - if (dockScreen) + pDockScreen = [self dockTileScreen]; + if (pDockScreen) { if (!m_FBOThumbId) { @@ -885,24 +999,24 @@ while(0); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); - + /* The GPUs like the GL_BGRA / GL_UNSIGNED_INT_8_8_8_8_REV combination * others are also valid, but might incur a costly software translation. */ - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, m_FBOTexSize.width * m_FBOThumbScaleX, m_FBOTexSize.height * m_FBOThumbScaleY, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, m_FBOTexSize.width * m_FBOThumbScaleX, m_FBOTexSize.height * m_FBOThumbScaleY, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); /* Now attach texture to the FBO as its color destination */ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, m_FBOThumbTexId, 0); /* Make sure the FBO was created successfully. */ if (GL_FRAMEBUFFER_COMPLETE_EXT != glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)) - DEBUG_MSG(("Framebuffer Thumb Object creation or update failed!\n")); + DEBUG_MSG(("OVIW(%p): Framebuffer \"Thumb\" Object creation or update failed!\n", (void*)self)); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, oldTexId); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFBId ? oldFBId:m_FBOId); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, (GLuint)oldFBId ? (GLuint)oldFBId : m_FBOId); m_DockTileView = [[DockOverlayView alloc] init]; [self reshapeDockTile]; - [dockScreen addSubview:m_DockTileView]; + [pDockScreen addSubview:m_DockTileView]; } /* Initialize with one big visual region over the full size */ @@ -913,16 +1027,16 @@ while(0); m_paClipRects[1] = 0; m_paClipRects[2] = m_FBOTexSize.width; m_paClipRects[3] = m_FBOTexSize.height; - - //GL_RESTORE_STATE; +#endif } - (void)deleteFBO { - DEBUG_MSG(("deleteFBO %p\n", self)); + DEBUG_MSG(("OVIW(%p): deleteFBO\n", (void*)self)); + if (m_pSharedGLCtx) { - DEBUG_MSG(("MakeCurrent (shared) %X\n", m_pSharedGLCtx)); + DEBUG_MSG(("OVIW(%p): makeCurrent (shared) %p\n", (void*)self, (void*)m_pSharedGLCtx)); [m_pSharedGLCtx makeCurrentContext]; [m_pSharedGLCtx update]; @@ -932,32 +1046,34 @@ while(0); if (m_pGLCtx) { - DEBUG_MSG(("MakeCurrent %X\n", m_pGLCtx)); + DEBUG_MSG(("OVIW(%p): makeCurrent (non shared) %p\n", (void*)self, (void*)m_pGLCtx)); [m_pGLCtx makeCurrentContext]; +#ifdef FBO if (m_FBODepthStencilPackedId > 0) { glDeleteRenderbuffersEXT(1, &m_FBODepthStencilPackedId); m_FBODepthStencilPackedId = 0; } - if (m_FBOTexId > 0) + if (m_FBOTexBackId > 0) + { + glDeleteTextures(1, &m_FBOTexBackId); + m_FBOTexBackId = 0; + } + if (m_FBOTexFrontId > 0) { - glDeleteTextures(1, &m_FBOTexId); - m_FBOTexId = 0; + glDeleteTextures(1, &m_FBOTexFrontId); + m_FBOTexFrontId = 0; } if (m_FBOId > 0) { - GLint tmpFB; - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &tmpFB); - - if (tmpFB == m_FBOId) - { + if ([self isCurrentFBO]) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - + glDeleteFramebuffersEXT(1, &m_FBOId); m_FBOId = 0; } +#endif } if (m_DockTileView != nil) @@ -970,9 +1086,10 @@ while(0); - (void)updateFBO { - DEBUG_MSG(("updateFBO %p\n", self)); + DEBUG_MSG(("OVIW(%p): updateFBO\n", (void*)self)); + [self makeCurrentFBO]; - + if (m_pGLCtx) { #ifdef FBO @@ -986,15 +1103,16 @@ while(0); - (void)makeCurrentFBO { - DEBUG_MSG_1(("MakeCurrent called %X\n", self)); + DEBUG_MSG(("OVIW(%p): makeCurrentFBO\n", (void*)self)); #ifdef FBO + DEBUG_MSG(("OVIW(%p): FBOId=%d CTX=%p\n", (void*)self, m_FBOId, (void*)m_pGLCtx)); if([NSOpenGLContext currentContext] != 0) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); #endif if (m_pGLCtx) { - if ([m_pGLCtx view] != self) + if ([m_pGLCtx view] != self) { /* We change the active view, so flush first */ if([NSOpenGLContext currentContext] != 0) @@ -1002,12 +1120,15 @@ while(0); [m_pGLCtx setView: self]; CHECK_GL_ERROR(); } -// if ([NSOpenGLContext currentContext] != m_pGLCtx) + /* + if ([NSOpenGLContext currentContext] != m_pGLCtx) + */ { - DEBUG_MSG(("MakeCurrent %X\n", m_pGLCtx)); [m_pGLCtx makeCurrentContext]; CHECK_GL_ERROR(); -// [m_pGLCtx update]; + /* + [m_pGLCtx update]; + */ } } #ifdef FBO @@ -1015,28 +1136,77 @@ while(0); #endif } +- (bool)isCurrentFBO +{ +#ifdef FBO + GLint curFBOId = 0; + + glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &curFBOId); + DEBUG_MSG_1(("OVIW(%p): isCurrentFBO: curFBOId=%d FBOId=%d\n", (void*)self, curFBOId, m_FBOId)); + return (GLuint)curFBOId == m_FBOId; +#else + return false; +#endif +} + +- (void)tryDraw +{ + if ([self lockFocusIfCanDraw]) + { + [self renderFBOToView]; + [self unlockFocus]; + } +} + - (void)swapFBO { - DEBUG_MSG_1(("SwapCurrent called %X\n", self)); + GLint sw = 0; + GLint readFBOId = 0; + GLint drawFBOId = 0; + GLint readId = 0; + GLint drawId = 0; + + DEBUG_MSG(("OVIW(%p): swapFBO\n", (void*)self)); #ifdef FBO - GLint tmpFB; - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &tmpFB); - DEBUG_MSG_1(("Swap GetINT %d\n", tmpFB)); - /* Don't use flush buffers cause we are using FBOs here */ -// [m_pGLCtx flushBuffer]; + /* Don't use flush buffers cause we are using FBOs here! */ + + /* Before we swap make sure everything is done (This is really + * important. Don't remove.) */ glFlush(); -// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - DEBUG_MSG_1(("swapFBO bound:%i, self:%i\n", tmpFB, m_FBOId)); - if (tmpFB == m_FBOId) + + /* Fetch the current used read and draw buffers. */ + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFBOId); + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFBOId); + glGetIntegerv(GL_READ_BUFFER, &readId); + glGetIntegerv(GL_DRAW_BUFFER, &drawId); + + /* Do the swapping of our internal ids */ + sw = m_FBOTexFrontId; + m_FBOTexFrontId = m_FBOTexBackId; + m_FBOTexBackId = sw; + sw = m_FBOAttFrontId; + m_FBOAttFrontId = m_FBOAttBackId; + m_FBOAttBackId = sw; + + DEBUG_MSG_1(("read FBO: %d draw FBO: %d readId: %d drawId: %d\n", readFBOId, drawFBOId, readId, drawId)); + /* We also have to swap the real ids on the current context. */ + if ((GLuint)readFBOId == m_FBOId) { - if ([self lockFocusIfCanDraw]) - { - [self renderFBOToView]; - [self unlockFocus]; - } + if ((GLuint)readId == m_FBOAttFrontId) + glReadBuffer(m_FBOAttBackId); + if ((GLuint)readId == m_FBOAttBackId) + glReadBuffer(m_FBOAttFrontId); + } + if ((GLuint)drawFBOId == m_FBOId) + { + if ((GLuint)drawId == m_FBOAttFrontId) + glDrawBuffer(m_FBOAttBackId); + if ((GLuint)drawId == m_FBOAttBackId) + glDrawBuffer(m_FBOAttFrontId); } -// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); + + [self tryDraw]; #else [m_pGLCtx flushBuffer]; #endif @@ -1044,58 +1214,183 @@ while(0); - (void)flushFBO { - GLint tmpFB; - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &tmpFB); + GLint drawId = 0; + GLint FBOId = 0; + + DEBUG_MSG(("OVIW(%p): flushFBO\n", (void*)self)); + glFlush(); -// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - DEBUG_MSG_1 (("Flush GetINT %d\n", tmpFB)); - if (tmpFB == m_FBOId) +#ifdef FBO + /* If at any time OpenGl operations where done in the front buffer, we need + * to reflect this in the FBO as well. This is something which on real + * hardware happens and unfortunately some applications rely on it (grrr ... Compiz). */ + if ( m_fFrontDrawing + && [self isCurrentFBO]) { - if ([self lockFocusIfCanDraw]) - { - [self renderFBOToView]; - [self unlockFocus]; - } + /* Only reset if we aren't currently front. */ + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &FBOId); + glGetIntegerv(GL_DRAW_BUFFER, &drawId); + if (!( (GLuint)FBOId == m_FBOId + && (GLuint)drawId == m_FBOAttFrontId)) + m_fFrontDrawing = false; + [self tryDraw]; } -// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); +#endif } - (void)finishFBO { - GLint tmpFB; - glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &tmpFB); + DEBUG_MSG(("OVIW(%p): finishFBO\n", (void*)self)); + glFinish(); - // glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - DEBUG_MSG_1 (("Finish GetINT %d\n", tmpFB)); - if (tmpFB == m_FBOId) +#ifdef FBO + if ([self isCurrentFBO]) + [self tryDraw]; +#endif +} + +- (void)stateInfo:(GLenum)pname withParams:(GLint*)params +{ + GLint test; +// DEBUG_MSG_1(("StateInfo requested: %d\n", pname)); + + glGetIntegerv(pname, params); +#ifdef FBO + switch(pname) { - if ([self lockFocusIfCanDraw]) + case GL_FRAMEBUFFER_BINDING_EXT: + case GL_READ_FRAMEBUFFER_BINDING: + case GL_READ_FRAMEBUFFER_EXT: + case GL_DRAW_FRAMEBUFFER_EXT: + { + if ((GLuint)*params == m_FBOId) + *params = 0; + break; + } + case GL_READ_BUFFER: + { + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &test); + if ((GLuint)test == m_FBOId) + { + if ((GLuint)*params == m_FBOAttFrontId) + *params = GL_FRONT; + else + if ((GLuint)*params == m_FBOAttBackId) + *params = GL_BACK; + } + break; + } + case GL_DRAW_BUFFER: { - [self renderFBOToView]; - [self unlockFocus]; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &test); + if ((GLuint)test == m_FBOId) + { + if ((GLuint)*params == m_FBOAttFrontId) + *params = GL_FRONT; + else + if ((GLuint)*params == m_FBOAttBackId) + *params = GL_BACK; + } + break; } } -// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); +#endif } -- (void)bindFBO +- (void)readBuffer:(GLenum)mode { - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOId); +#ifdef FBO + /* + if ([self isCurrentFBO]) + */ + { + if (mode == GL_FRONT) + { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_FBOId); + glReadBuffer(m_FBOAttFrontId); + } + else if (mode == GL_BACK) + { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_FBOId); + glReadBuffer(m_FBOAttBackId); + } + else + glReadBuffer(mode); + } +#else + glReadBuffer(mode); +#endif +} + +- (void)drawBuffer:(GLenum)mode +{ +#ifdef FBO + /* + if ([self isCurrentFBO]) + */ + { + if (mode == GL_FRONT) + { + DEBUG_MSG(("OVIW(%p): front\n", (void*)self)); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_FBOId); + glDrawBuffer(m_FBOAttFrontId); + m_fFrontDrawing = true; + } + else if (mode == GL_BACK) + { + DEBUG_MSG(("OVIW(%p): back\n", (void*)self)); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_FBOId); + glDrawBuffer(m_FBOAttBackId); + } + else + { + DEBUG_MSG(("OVIW(%p): other: %d\n", (void*)self, mode)); + glDrawBuffer(mode); + } + } +#else + glDrawBuffer(mode); +#endif +} + +- (void)bindFBO:(GLenum)target withFrameBuffer:(GLuint)framebuffer +{ +#ifdef FBO + if (framebuffer != 0) + glBindFramebufferEXT(target, framebuffer); + else + glBindFramebufferEXT(target, m_FBOId); +#else + glBindFramebufferEXT(target, framebuffer); +#endif } - (void)renderFBOToView { + GLint opaque = 0; + GLint i = 0; + GLint oldReadFBOId = 0; + GLint oldDrawFBOId = 0; + GLint oldReadId = 0; + GLint oldDrawId = 0; + + DEBUG_MSG(("OVIW(%p): renderFBOToView\n", (void*)self)); + +#ifdef FBO + + /* Fetch the current used read and draw buffers. */ + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &oldReadFBOId); + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &oldDrawFBOId); + glGetIntegerv(GL_READ_BUFFER, &oldReadId); + glGetIntegerv(GL_DRAW_BUFFER, &oldDrawId); + if (!m_pSharedGLCtx) { /* Create a shared context out of the main context. Use the same pixel format. */ m_pSharedGLCtx = [[NSOpenGLContext alloc] initWithFormat:[(OverlayOpenGLContext*)m_pGLCtx openGLPixelFormat] shareContext:m_pGLCtx]; /* Set the new context as non opaque */ - GLint opaque = 0; - [m_pSharedGLCtx setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; - /* Only swap on screen refresh */ -// GLint swap = 1; -// [m_pSharedGLCtx setValues:&swap forParameter:NSOpenGLCPSwapInterval]; + [m_pSharedGLCtx setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; /* Set this view as the drawable for the new context */ [m_pSharedGLCtx setView: self]; [self updateViewport]; @@ -1104,140 +1399,137 @@ while(0); if (m_pSharedGLCtx) { NSRect r = [self frame]; - DEBUG_MSG_1(("rF2V frame[%i, %i, %i, %i]\n", (int)r.origin.x, (int)r.origin.y, (int)r.size.width, (int)r.size.height)); + DEBUG_MSG(("OVIW(%p): rF2V frame: [%i, %i, %i, %i]\n", (void*)self, (int)r.origin.x, (int)r.origin.y, (int)r.size.width, (int)r.size.height)); - if (m_FBOTexId > 0) + if (m_FBOTexFrontId > 0) { if ([m_pSharedGLCtx view] != self) { - DEBUG_MSG(("renderFBOToView: not current view of shared ctx!")); + DEBUG_MSG(("OVIW(%p): not current view of shared ctx! Switching ...\n", (void*)self)); [m_pSharedGLCtx setView: self]; [self updateViewport]; } - //DEBUG_MSG(("MakeCurrent (shared) %X\n", m_pSharedGLCtx)); [m_pSharedGLCtx makeCurrentContext]; - - if (m_FBOThumbTexId > 0 && - [m_DockTileView thumbBitmap] != nil) + + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_FBOId); + glReadBuffer(m_FBOAttFrontId); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + glDrawBuffer(GL_BACK); + + /* Render FBO content to the dock tile when necessary. */ + [self renderFBOToDockTile]; + +#if 1 /* Set to 0 to see the docktile instead of the real output */ + /* Clear background to transparent */ + glClear(GL_COLOR_BUFFER_BIT); + + /* Blit the content of the FBO to the screen. */ + for (i = 0; i < m_cClipRects; ++i) { - /* Only update after at least 200 ms, cause glReadPixels is - * heavy performance wise. */ - uint64_t uiNewTime = RTTimeMilliTS(); - if (uiNewTime - m_uiDockUpdateTime > 200) - { - m_uiDockUpdateTime = uiNewTime; -#if 0 - /* todo: check this for optimization */ - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, myTextureName); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, - GL_STORAGE_SHARED_APPLE); - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, - sizex, sizey, 0, GL_BGRA, - GL_UNSIGNED_INT_8_8_8_8_REV, myImagePtr); - glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, - 0, 0, 0, 0, 0, image_width, image_height); - glFlush(); - // Do other work processing here, using a double or triple buffer - glGetTexImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, - GL_UNSIGNED_INT_8_8_8_8_REV, pixels); + GLint x1 = m_paClipRects[4*i]; + GLint y1 = r.size.height - m_paClipRects[4*i+1]; + GLint x2 = m_paClipRects[4*i+2]; + GLint y2 = r.size.height - m_paClipRects[4*i+3]; + glBlitFramebufferEXT(x1, y1 + m_RootShift.y, x2, y2 + m_RootShift.y, + x1 - m_RootShift.x, y1, x2 - m_RootShift.x, y2, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } #endif + /* + glFinish(); + */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + [m_pSharedGLCtx flushBuffer]; - GL_SAVE_STATE; - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FBOThumbId); - - /* We like to read from the primary color buffer */ - glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - - NSRect rr = [m_DockTileView frame]; - - /* Setup all matrices */ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glViewport(0, 0, rr.size.width, rr.size.height); - glOrtho(0, rr.size.width, 0, rr.size.height, -1, 1); - glScalef(m_FBOThumbScaleX, m_FBOThumbScaleY, 1.0f); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(0.0f, m_RootShift.y, 0.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - /* Clear background to transparent */ - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_TEXTURE_RECTANGLE_ARB); - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexId); - GLint i; - for (i = 0; i < m_cClipRects; ++i) - { - GLint x1 = m_paClipRects[4*i]; - GLint y1 = (r.size.height - m_paClipRects[4*i+1]); - GLint x2 = m_paClipRects[4*i+2]; - GLint y2 = (r.size.height - m_paClipRects[4*i+3]); - glBegin(GL_QUADS); - { - glTexCoord2i(x1, y1); glVertex2i(x1, y1); - glTexCoord2i(x1, y2); glVertex2i(x1, y2); - glTexCoord2i(x2, y2); glVertex2i(x2, y2); - glTexCoord2i(x2, y1); glVertex2i(x2, y1); - } - glEnd(); - } - glFinish(); - - /* Here the magic of reading the FBO content in our own buffer - * happens. We have to lock this access, in the case the dock - * is updated currently. */ - [m_DockTileView lock]; - glReadPixels(0, 0, rr.size.width, rr.size.height, - GL_RGBA, - GL_UNSIGNED_BYTE, - [[m_DockTileView thumbBitmap] bitmapData]); - [m_DockTileView unlock]; - - NSDockTile *pDT = [[NSApplication sharedApplication] dockTile]; - - /* Send a display message to the dock tile in the main thread */ - [[[NSApplication sharedApplication] dockTile] performSelectorOnMainThread:@selector(display) withObject:nil waitUntilDone:NO]; - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - GL_RESTORE_STATE; - } - } + [m_pGLCtx makeCurrentContext]; + /* Reset to previous buffer bindings. */ + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, oldReadFBOId); + glReadBuffer(oldReadId); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, oldDrawFBOId); + glDrawBuffer(oldDrawId); + } + } +#else + [m_pGLCtx flushBuffer]; +#endif +} + +- (void)renderFBOToDockTile +{ + NSRect r = [self frame]; + NSRect rr = NSZeroRect; + GLint i = 0; + NSDockTile *pDT = nil; +#ifdef FBO + if ( m_FBOThumbId + && m_FBOThumbTexId + && [m_DockTileView thumbBitmap] != nil) + { + /* Only update after at least 200 ms, cause glReadPixels is + * heavy performance wise. */ + uint64_t uiNewTime = RTTimeMilliTS(); + if (uiNewTime - m_uiDockUpdateTime > 200) + { + m_uiDockUpdateTime = uiNewTime; +#if 0 + /* todo: check this for optimization */ + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, myTextureName); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, + GL_STORAGE_SHARED_APPLE); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, + sizex, sizey, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, myImagePtr); + glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, + 0, 0, 0, 0, 0, image_width, image_height); + glFlush(); + /* Do other work processing here, using a double or triple buffer */ + glGetTexImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, pixels); +#endif /* Clear background to transparent */ glClear(GL_COLOR_BUFFER_BIT); - glEnable(GL_TEXTURE_RECTANGLE_ARB); - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_FBOTexId); + rr = [m_DockTileView frame]; - /* Blit the content of the FBO to the screen. todo: check for - * optimization with display lists. */ - GLint i; for (i = 0; i < m_cClipRects; ++i) { GLint x1 = m_paClipRects[4*i]; GLint y1 = r.size.height - m_paClipRects[4*i+1]; GLint x2 = m_paClipRects[4*i+2]; GLint y2 = r.size.height - m_paClipRects[4*i+3]; - glBegin(GL_QUADS); - { - glTexCoord2i(x1, y1); glVertex2i(x1, y1); - glTexCoord2i(x1, y2); glVertex2i(x1, y2); - glTexCoord2i(x2, y2); glVertex2i(x2, y2); - glTexCoord2i(x2, y1); glVertex2i(x2, y1); - } - glEnd(); + + glBlitFramebufferEXT(x1, y1 + m_RootShift.y, x2, y2 + m_RootShift.y, + x1 * m_FBOThumbScaleX, y1 * m_FBOThumbScaleY, x2 * m_FBOThumbScaleX, y2 * m_FBOThumbScaleY, + GL_COLOR_BUFFER_BIT, GL_LINEAR); } glFinish(); - [m_pSharedGLCtx flushBuffer]; - //DEBUG_MSG(("MakeCurrent %X\n", m_pGLCtx)); - [m_pGLCtx makeCurrentContext]; + + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0); + glReadBuffer(GL_BACK); + /* Here the magic of reading the FBO content in our own buffer + * happens. We have to lock this access, in the case the dock + * is updated currently. */ + [m_DockTileView lock]; + glReadPixels(0, 0, rr.size.width, rr.size.height, + GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8, + [[m_DockTileView thumbBitmap] bitmapData]); + [m_DockTileView unlock]; + + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_FBOId); + glReadBuffer(m_FBOAttFrontId); + + pDT = [[NSApplication sharedApplication] dockTile]; + + /* Send a display message to the dock tile in the main thread */ + [[[NSApplication sharedApplication] dockTile] performSelectorOnMainThread:@selector(display) withObject:nil waitUntilDone:NO]; + } } +#endif } - (void)clearVisibleRegions @@ -1252,11 +1544,11 @@ while(0); - (void)setVisibleRegions:(GLint)cRects paRects:(GLint*)paRects { - DEBUG_MSG_1(("New region received\n")); + DEBUG_MSG_1(("OVIW(%p): setVisibleRegions: cRects=%d\n", (void*)self, cRects)); [self clearVisibleRegions]; - if (cRects>0) + if (cRects > 0) { m_paClipRects = (GLint*)RTMemAlloc(sizeof(GLint) * 4 * cRects); m_cClipRects = cRects; @@ -1280,6 +1572,8 @@ while(0); - (void)reshapeDockTile { + NSRect newFrame = NSZeroRect; + NSView *pView = [self dockTileScreen]; if (pView != nil) { @@ -1288,10 +1582,12 @@ while(0); m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width; m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height; - NSRect newFrame = NSMakeRect ((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY)); -// NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY)); -// NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY)); -// printf ("%f %f %f %f - %f %f\n", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height, m_Size.height, m_FBOThumbScaleY); + newFrame = NSMakeRect((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY)); + /* + NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY)); + NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY)); + printf ("%f %f %f %f - %f %f\n", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height, m_Size.height, m_FBOThumbScaleY); + */ [m_DockTileView setFrame: newFrame]; } } @@ -1305,16 +1601,19 @@ while(0); ********************************************************************************/ void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams) { + NSOpenGLPixelFormat *pFmt = nil; + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; - NSOpenGLPixelFormatAttribute attribs[24] = + NSOpenGLPixelFormatAttribute attribs[24] = { NSOpenGLPFAWindow, NSOpenGLPFAAccelerated, NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)24 }; - + int i = 4; + if (fVisParams & CR_ALPHA_BIT) { DEBUG_MSG(("CR_ALPHA_BIT requested\n")); @@ -1333,7 +1632,7 @@ void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams) attribs[i++] = NSOpenGLPFAStencilSize; attribs[i++] = 8; } - if (fVisParams & CR_ACCUM_BIT) + if (fVisParams & CR_ACCUM_BIT) { DEBUG_MSG(("CR_ACCUM_BIT requested\n")); attribs[i++] = NSOpenGLPFAAccumSize; @@ -1342,7 +1641,7 @@ void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams) else attribs[i++] = 24; } - if (fVisParams & CR_MULTISAMPLE_BIT) + if (fVisParams & CR_MULTISAMPLE_BIT) { DEBUG_MSG(("CR_MULTISAMPLE_BIT requested\n")); attribs[i++] = NSOpenGLPFASampleBuffers; @@ -1357,26 +1656,30 @@ void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams) } if (fVisParams & CR_STEREO_BIT) { - DEBUG_MSG(("CR_DOUBLE_BIT requested\n")); + /* We don't support that. + DEBUG_MSG(("CR_STEREO_BIT requested\n")); attribs[i++] = NSOpenGLPFAStereo; + */ } - + /* Mark the end */ attribs[i++] = 0; /* Choose a pixel format */ - NSOpenGLPixelFormat* pFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - + pFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + if (pFmt) { *ppCtx = [[OverlayOpenGLContext alloc] initWithFormat:pFmt shareContext:nil]; /* Enable multi threaded OpenGL engine */ -// CGLContextObj cglCtx = [*ppCtx CGLContextObj]; -// CGLError err = CGLEnable(cglCtx, kCGLCEMPEngine); -// if (err != kCGLNoError) -// printf ("Couldn't enable MT OpenGL engine!\n"); - + /* + CGLContextObj cglCtx = [*ppCtx CGLContextObj]; + CGLError err = CGLEnable(cglCtx, kCGLCEMPEngine); + if (err != kCGLNoError) + printf ("Couldn't enable MT OpenGL engine!\n"); + */ + DEBUG_MSG(("New context %X\n", (uint)*ppCtx)); } @@ -1387,7 +1690,9 @@ void cocoaGLCtxDestroy(NativeNSOpenGLContextRef pCtx) { NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; -// [pCtx release]; + /* + [pCtx release]; + */ [pPool release]; } @@ -1445,29 +1750,39 @@ void cocoaViewReparent(NativeNSViewRef pView, NativeNSViewRef pParentView) void cocoaViewDestroy(NativeNSViewRef pView) { + NSWindow *pWin = nil; + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; /* Hide the view early */ [pView setHidden: YES]; - NSWindow *win = [pView window]; - [[NSNotificationCenter defaultCenter] removeObserver:win]; - [win setContentView: nil]; - [[win parentWindow] removeChildWindow: win]; - int b = [win retainCount]; -// for (; b > 1; --b) -// [win performSelector:@selector(release)] - [win performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:YES]; -// [win release]; + pWin = [pView window]; + [[NSNotificationCenter defaultCenter] removeObserver:pWin]; + [pWin setContentView: nil]; + [[pWin parentWindow] removeChildWindow: pWin]; + /* + a = [pWin retainCount]; + for (; a > 1; --a) + [pWin performSelector:@selector(release)] + */ + [pWin performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:YES]; + /* + [pWin release]; + */ /* There seems to be a bug in the performSelector method which is called in * parentWindowChanged above. The object is retained but not released. This * results in an unbalanced reference count, which is here manually * decremented. */ - int a = [pView retainCount]; -// for (; a > 1; --a) + /* + a = [pView retainCount]; + for (; a > 1; --a) + */ [pView performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:YES]; -// [pView release]; + /* + [pView release]; + */ [pPool release]; } @@ -1482,10 +1797,10 @@ void cocoaViewShow(NativeNSViewRef pView, GLboolean fShowIt) } void cocoaViewDisplay(NativeNSViewRef pView) -{ +{ NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; - DEBUG_MSG_1(("cocoaViewDisplay %p\n", pView)); + DEBUG_MSG_1(("cocoaViewDisplay %p\n", (void*)pView)); [(OverlayView*)pView swapFBO]; [pPool release]; @@ -1528,7 +1843,7 @@ void cocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; DEBUG_MSG(("cocoaViewMakeCurrentContext(%p, %p)\n", (void*)pView, (void*)pCtx)); - + [(OverlayView*)pView setGLCtx:pCtx]; [(OverlayView*)pView makeCurrentFBO]; @@ -1549,53 +1864,71 @@ void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, GLint* paRec * Additional OpenGL wrapper * ********************************************************************************/ -void cocoaFlush(void) +static void performSelectorOnView(SEL selector) { - NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; - -// glFlush(); -// return; - - DEBUG_MSG_1(("glFlush called\n")); - -#ifdef FBO NSOpenGLContext *pCtx = [NSOpenGLContext currentContext]; + if (pCtx) { NSView *pView = [pCtx view]; if (pView) { - if ([pView respondsToSelector:@selector(flushFBO)]) - [pView performSelector:@selector(flushFBO)]; + if ([pView respondsToSelector:selector]) + [pView performSelector:selector]; } } -#else - glFlush(); -#endif - - [pPool release]; } -void cocoaFinish(void) +static void performSelectorOnViewOneArg(SEL selector, id arg1) { - NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + NSOpenGLContext *pCtx = [NSOpenGLContext currentContext]; - DEBUG_MSG_1(("glFinish called\n")); + if (pCtx) + { + NSView *pView = [pCtx view]; + if (pView) + { + if ([pView respondsToSelector:selector]) + [pView performSelector:selector withObject:arg1]; + } + } +} -#ifdef FBO +static void performSelectorOnViewTwoArgs(SEL selector, id arg1, id arg2) +{ NSOpenGLContext *pCtx = [NSOpenGLContext currentContext]; + if (pCtx) { NSView *pView = [pCtx view]; if (pView) { - if ([pView respondsToSelector:@selector(finishFBO)]) - [pView performSelector:@selector(finishFBO)]; + if ([pView respondsToSelector:selector]) + [pView performSelector:selector withObject:arg1 withObject:arg2]; } } -#else - glFinish(); -#endif +} + +void cocoaFlush(void) +{ + NSOpenGLContext *pCtx = nil; + + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + + DEBUG_MSG_1(("glFlush called\n")); + + performSelectorOnView(@selector(flushFBO)); + + [pPool release]; +} + +void cocoaFinish(void) +{ + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + + DEBUG_MSG_1(("glFinish called\n")); + + performSelectorOnView(@selector(finishFBO)); [pPool release]; } @@ -1604,28 +1937,63 @@ void cocoaBindFramebufferEXT(GLenum target, GLuint framebuffer) { NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; - DEBUG_MSG(("glRenderspuBindFramebufferEXT called %d\n", framebuffer)); + DEBUG_MSG_1(("glBindFramebufferEXT called target: %d fb: %d\n", target, framebuffer)); + + performSelectorOnViewTwoArgs(@selector(bindFBO:withFrameBuffer:), (id)target, (id)framebuffer); + + [pPool release]; +} + +void cocoaCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +{ + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + GLbitfield mask = GL_COLOR_BUFFER_BIT; + + DEBUG_MSG_1(("glCopyPixels called: %d,%d-%dx%d type: %d\n", x, y, width, height, type)); #ifdef FBO - if (framebuffer != 0) - glBindFramebufferEXT(target, framebuffer); - else - { - NSOpenGLContext *pCtx = [NSOpenGLContext currentContext]; - if (pCtx) - { - NSView *pView = [pCtx view]; - if (pView) - { - if ([pView respondsToSelector:@selector(bindFBO)]) - [pView performSelector:@selector(bindFBO)]; - } - } - } + if (type == GL_DEPTH) + mask = GL_DEPTH_BUFFER_BIT; + else if (type == GL_STENCIL) + mask = GL_STENCIL_BUFFER_BIT; + glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, mask, GL_NEAREST); #else - glBindFramebufferEXT(target, framebuffer); + glCopyPixels(x, y, width, height, type); #endif [pPool release]; } +void cocoaGetIntegerv(GLenum pname, GLint *params) +{ + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + +// DEBUG_MSG_1(("getIntergerv called: %d\n", pname)); + + performSelectorOnViewTwoArgs(@selector(stateInfo:withParams:), (id)pname, (id)params); + + [pPool release]; +} + +void cocoaReadBuffer(GLenum mode) +{ + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + + DEBUG_MSG_1(("glReadBuffer called: %d\n", mode)); + + performSelectorOnViewOneArg(@selector(readBuffer:), (id)mode); + + [pPool release]; +} + +void cocoaDrawBuffer(GLenum mode) +{ + NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; + + DEBUG_MSG_1(("glDrawBuffer called: %d\n", mode)); + + performSelectorOnViewOneArg(@selector(drawBuffer:), (id)mode); + + [pPool release]; +} + diff --git a/src/VBox/HostServices/auth/Makefile.kmk b/src/VBox/HostServices/auth/Makefile.kmk index 74a740223..f23dcabf1 100644 --- a/src/VBox/HostServices/auth/Makefile.kmk +++ b/src/VBox/HostServices/auth/Makefile.kmk @@ -38,7 +38,9 @@ VBoxAuth_LDFLAGS.darwin = -framework DirectoryService # The simple plugin. ifndef VBOX_ONLY_SDK - DLLS += VBoxAuthSimple + if defined(VBOX_WITH_MAIN) + DLLS += VBoxAuthSimple + endif endif VBoxAuthSimple_TEMPLATE = VBOXMAINCLIENTDLL VBoxAuthSimple_SOURCES = simple/VBoxAuthSimple.cpp diff --git a/src/VBox/Installer/linux/VBox.sh b/src/VBox/Installer/linux/VBox.sh index 3de227978..e427872f6 100755 --- a/src/VBox/Installer/linux/VBox.sh +++ b/src/VBox/Installer/linux/VBox.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Oracle VM VirtualBox +# Oracle VM VirtualBox startup script, Linux hosts. # -# Copyright (C) 2006-2010 Oracle Corporation +# 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; @@ -77,29 +77,32 @@ if [ "$SHUTDOWN" = "true" ]; then exit 0 fi -APP=`which $0` -APP=`basename $APP` -APP=${APP##/*/} +APP=`basename $0` case "$APP" in - VirtualBox|virtualbox) - exec "$INSTALL_DIR/VirtualBox" "$@" - ;; - VBoxManage|vboxmanage) - exec "$INSTALL_DIR/VBoxManage" "$@" - ;; - VBoxSDL|vboxsdl) - exec "$INSTALL_DIR/VBoxSDL" "$@" - ;; - VBoxVRDP|VBoxHeadless|vboxheadless) - exec "$INSTALL_DIR/VBoxHeadless" "$@" - ;; - VBoxBalloonCtrl|vboxballoonctrl) - exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@" - ;; - vboxwebsrv) - exec "$INSTALL_DIR/vboxwebsrv" "$@" - ;; - *) - echo "Unknown application - $APP" - ;; + VirtualBox|virtualbox) + exec "$INSTALL_DIR/VirtualBox" "$@" + ;; + VBoxManage|vboxmanage) + exec "$INSTALL_DIR/VBoxManage" "$@" + ;; + VBoxSDL|vboxsdl) + exec "$INSTALL_DIR/VBoxSDL" "$@" + ;; + VBoxVRDP|VBoxHeadless|vboxheadless) + exec "$INSTALL_DIR/VBoxHeadless" "$@" + ;; + VBoxBalloonCtrl|vboxballoonctrl) + exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@" + ;; + vboxwebsrv) + exec "$INSTALL_DIR/vboxwebsrv" "$@" + ;; + VBoxBFE|vboxbfe) + exec "$INSTALL_DIR/VBoxBFE" "$@" + ;; + *) + echo "Unknown application - $APP" + exit 1 + ;; esac +exit 0 diff --git a/src/VBox/Installer/solaris/VBox.sh b/src/VBox/Installer/solaris/VBox.sh index a55f540a6..a2b21e622 100755 --- a/src/VBox/Installer/solaris/VBox.sh +++ b/src/VBox/Installer/solaris/VBox.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# VirtualBox startup script, Solaris hosts. +# Oracle VM VirtualBox startup script, Solaris hosts. # -# Copyright (C) 2007-2010 Oracle Corporation +# 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; @@ -19,32 +19,36 @@ if test "$CURRENT_ISA" = "amd64"; then else INSTALL_DIR="/opt/VirtualBox/i386" fi -APP=`which $0` -APP=`basename $APP` + +APP=`basename $0` case "$APP" in - VirtualBox) - exec "$INSTALL_DIR/VirtualBox" "$@" - ;; - VBoxManage) - exec "$INSTALL_DIR/VBoxManage" "$@" - ;; - VBoxSDL) - exec "$INSTALL_DIR/VBoxSDL" "$@" - ;; - VBoxVRDP) - exec "$INSTALL_DIR/VBoxHeadless" "$@" - ;; - VBoxHeadless) - exec "$INSTALL_DIR/VBoxHeadless" "$@" - ;; - VBoxQtconfig) - exec "$INSTALL_DIR/VBoxQtconfig" "$@" - ;; - VBoxBFE) - exec "$INSTALL_DIR/VBoxBFE" "$@" - ;; - *) - echo "Unknown application - $APP" - ;; + VirtualBox|virtualbox) + exec "$INSTALL_DIR/VirtualBox" "$@" + ;; + VBoxManage|vboxmanage) + exec "$INSTALL_DIR/VBoxManage" "$@" + ;; + VBoxSDL|vboxsdl) + exec "$INSTALL_DIR/VBoxSDL" "$@" + ;; + VBoxVRDP|VBoxHeadless|vboxheadless) + exec "$INSTALL_DIR/VBoxHeadless" "$@" + ;; + VBoxBalloonCtrl|vboxballoonctrl) + exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@" + ;; + vboxwebsrv) + exec "$INSTALL_DIR/vboxwebsrv" "$@" + ;; + VBoxBFE|vboxbfe) + exec "$INSTALL_DIR/VBoxBFE" "$@" + ;; + VBoxQtconfig) + exec "$INSTALL_DIR/VBoxQtconfig" "$@" + ;; + *) + echo "Unknown application - $APP" + exit 1 + ;; esac - +exit 0 diff --git a/src/VBox/Installer/solaris/makepackage.sh b/src/VBox/Installer/solaris/makepackage.sh index 0cf7ca3e1..9261f979c 100755 --- a/src/VBox/Installer/solaris/makepackage.sh +++ b/src/VBox/Installer/solaris/makepackage.sh @@ -203,9 +203,7 @@ fi # Other executables that need setuid root (hardened or otherwise) $VBOX_AWK 'NF == 6 \ - && ( $3 == "opt/VirtualBox/amd64/VBoxUSBHelper" \ - || $3 == "opt/VirtualBox/i386/VBoxUSBHelper" \ - || $3 == "opt/VirtualBox/amd64/VBoxNetAdpCtl" \ + && ( $3 == "opt/VirtualBox/amd64/VBoxNetAdpCtl" \ || $3 == "opt/VirtualBox/i386/VBoxNetAdpCtl" \ || $3 == "opt/VirtualBox/amd64/VBoxNetDHCP" \ || $3 == "opt/VirtualBox/i386/VBoxNetDHCP" \ diff --git a/src/VBox/Installer/solaris/vboxconfig.sh b/src/VBox/Installer/solaris/vboxconfig.sh index 1fd366606..e26875fdd 100755 --- a/src/VBox/Installer/solaris/vboxconfig.sh +++ b/src/VBox/Installer/solaris/vboxconfig.sh @@ -18,6 +18,9 @@ # Never use exit 2 or exit 20 etc., the return codes are used in # SRv4 postinstall procedures which carry special meaning. Just use exit 1 for failure. +LANG=C +export LANG + # S10 or OpenSoalris HOST_OS_MAJORVERSION=`uname -r` # Which OpenSolaris version (snv_xxx or oi_xxx)? @@ -751,6 +754,7 @@ cleanup_install() # !! failure is always fatal postinstall() { + infoprint "Detected Solaris $HOST_OS_MAJORVERSION Version $HOST_OS_MINORVERSION" infoprint "Loading VirtualBox kernel modules..." install_drivers diff --git a/src/VBox/Main/glue/glue-java.xsl b/src/VBox/Main/glue/glue-java.xsl index da6ee7d8e..18ed6f147 100644 --- a/src/VBox/Main/glue/glue-java.xsl +++ b/src/VBox/Main/glue/glue-java.xsl @@ -2451,7 +2451,7 @@ public class VirtualBoxManager this.vbox = new IVirtualBox((org.mozilla.interfaces.IVirtualBox) this.componentManager .createInstanceByContractID("@virtualbox.org/VirtualBox;1", null, - org.mozilla.interfaces.IVirtualBox.IVIRTUALBOX_IID)); + org.mozilla.interfaces.IVirtualBox.IVIRTUALBOX_IID)); } public void connect(String url, String username, String passwd) @@ -3216,7 +3216,7 @@ public class Helper { throw new AssertionError(e); } } - // temporary methods, will bo away soon + // temporary methods, will go away soon public static byte[] wrapBytes(List<Short> arr) { if (arr == null) @@ -3394,40 +3394,44 @@ public class VirtualBoxManager this.port = pool.getPort(); try { ((BindingProvider)port).getRequestContext(). - put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); - String handle = port.iWebsessionManagerLogon(username, passwd); - this.vbox = new IVirtualBox(handle, port); - } catch (Throwable t) { - if (this.port != null) + put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); + String handle = port.iWebsessionManagerLogon(username, passwd); + this.vbox = new IVirtualBox(handle, port); + } catch (Throwable t) { + if (this.port != null && pool != null) { pool.releasePort(this.port); - // we have to throw smth derived from RuntimeException - throw new VBoxException(t, t.getMessage()); - } + this.port = null; + } + // we have to throw smth derived from RuntimeException + throw new VBoxException(t, t.getMessage()); + } } public void connect(String url, String username, String passwd, Map<String, Object> requestContext, Map<String, Object> responseContext) { - this.port = pool.getPort(); + this.port = pool.getPort(); - try { - ((BindingProvider)port).getRequestContext(); - if (requestContext != null) - ((BindingProvider)port).getRequestContext().putAll(requestContext); + try { + ((BindingProvider)port).getRequestContext(); + if (requestContext != null) + ((BindingProvider)port).getRequestContext().putAll(requestContext); - if (responseContext != null) - ((BindingProvider)port).getResponseContext().putAll(responseContext); + if (responseContext != null) + ((BindingProvider)port).getResponseContext().putAll(responseContext); - ((BindingProvider)port).getRequestContext(). + ((BindingProvider)port).getRequestContext(). put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); String handle = port.iWebsessionManagerLogon(username, passwd); this.vbox = new IVirtualBox(handle, port); - } catch (Throwable t) { - if (this.port != null) - pool.releasePort(port); - // we have to throw smth derived from RuntimeException - throw new VBoxException(t, t.getMessage()); - } + } catch (Throwable t) { + if (this.port != null && pool != null) { + pool.releasePort(this.port); + this.port = null; + } + // we have to throw smth derived from RuntimeException + throw new VBoxException(t, t.getMessage()); + } } public void disconnect() @@ -3440,10 +3444,10 @@ public class VirtualBoxManager } catch (RuntimeFaultMsg e) { throw new VBoxException(e, e.getMessage()); } finally { - if (this.port != null) { - pool.releasePort(this.port); - this.port = null; - } + if (this.port != null) { + pool.releasePort(this.port); + this.port = null; + } } } diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl index e3d38f267..54b98d847 100644 --- a/src/VBox/Main/idl/VirtualBox.xidl +++ b/src/VBox/Main/idl/VirtualBox.xidl @@ -7913,6 +7913,9 @@ <const name="Hidden" value="4"> <desc>Don't show the started process according to the guest OS guidelines.</desc> </const> + <const name="NoProfile" value="8"> + <desc>Do not use the user's profile data when exeuting a process.</desc> + </const> </enum> <enum diff --git a/src/VBox/Main/src-client/DisplayImpl.cpp b/src/VBox/Main/src-client/DisplayImpl.cpp index 117dd6b53..8cc30e536 100644 --- a/src/VBox/Main/src-client/DisplayImpl.cpp +++ b/src/VBox/Main/src-client/DisplayImpl.cpp @@ -990,6 +990,8 @@ void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1, * will still work as it should. */ if (!(maFramebuffers[0].fDisabled)) { + x1 = (int32_t)maFramebuffers[0].xOrigin; + y1 = (int32_t)maFramebuffers[0].yOrigin; x2 = mpDrv->IConnector.cx + (int32_t)maFramebuffers[0].xOrigin; y2 = mpDrv->IConnector.cy + (int32_t)maFramebuffers[0].yOrigin; } diff --git a/src/VBox/Main/src-client/GuestCtrlImpl.cpp b/src/VBox/Main/src-client/GuestCtrlImpl.cpp index f98b52acc..b2343187b 100644 --- a/src/VBox/Main/src-client/GuestCtrlImpl.cpp +++ b/src/VBox/Main/src-client/GuestCtrlImpl.cpp @@ -1506,7 +1506,8 @@ HRESULT Guest::executeProcessInternal(IN_BSTR aCommand, ULONG aFlags, { if ( !(aFlags & ExecuteProcessFlag_IgnoreOrphanedProcesses) && !(aFlags & ExecuteProcessFlag_WaitForProcessStartOnly) - && !(aFlags & ExecuteProcessFlag_Hidden)) + && !(aFlags & ExecuteProcessFlag_Hidden) + && !(aFlags & ExecuteProcessFlag_NoProfile)) { if (pRC) *pRC = VERR_INVALID_PARAMETER; diff --git a/src/VBox/Main/src-server/HostImpl.cpp b/src/VBox/Main/src-server/HostImpl.cpp index 6bba2ac66..a2994f520 100644 --- a/src/VBox/Main/src-server/HostImpl.cpp +++ b/src/VBox/Main/src-server/HostImpl.cpp @@ -239,6 +239,7 @@ void Host::FinalRelease() */ HRESULT Host::init(VirtualBox *aParent) { + HRESULT hrc; LogFlowThisFunc(("aParent=%p\n", aParent)); /* Enclose the state transition NotReady->InInit->Ready */ @@ -268,7 +269,7 @@ HRESULT Host::init(VirtualBox *aParent) # else m->pUSBProxyService = new USBProxyService(this); # endif - HRESULT hrc = m->pUSBProxyService->init(); + hrc = m->pUSBProxyService->init(); AssertComRCReturn(hrc, hrc); #endif /* VBOX_WITH_USB */ @@ -1679,7 +1680,7 @@ HRESULT Host::getDrives(DeviceType_T mediumType, Medium *pNew = *itNew; const Utf8Str strLocationNew = pNew->getLocationFull(); bool fFound = false; - for (MediaList::iterator itCached = pllCached->begin(); + for (itCached = pllCached->begin(); itCached != pllCached->end(); ++itCached) { diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp index bb88c937b..ae2b4c76e 100644 --- a/src/VBox/Main/src-server/MachineImpl.cpp +++ b/src/VBox/Main/src-server/MachineImpl.cpp @@ -7757,6 +7757,8 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController, rc = medium->addBackReference(mData->mUuid, *puuidSnapshot); else rc = medium->addBackReference(mData->mUuid); + /* If the medium->addBackReference fails it sets an appropriate + * error message, so no need to do any guesswork here. */ if (puuidRegistry) // caller wants registry ID to be set on all attached media (OVF import case) @@ -9013,8 +9015,8 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress, { ErrorInfoKeeper eik; - rc = lockedMediaMap->Clear(); - AssertComRC(rc); + HRESULT rc1 = lockedMediaMap->Clear(); + AssertComRC(rc1); } if (FAILED(rc)) diff --git a/src/VBox/Main/src-server/MediumImpl.cpp b/src/VBox/Main/src-server/MediumImpl.cpp index 6e8322b4d..ab4daf457 100644 --- a/src/VBox/Main/src-server/MediumImpl.cpp +++ b/src/VBox/Main/src-server/MediumImpl.cpp @@ -238,7 +238,7 @@ public: PVDINTERFACE mVDOperationIfaces; - // Whether the caller needs to call VirtualBox::saveSettings() after + // Whether the caller needs to call VirtualBox::saveRegistries() after // the task function returns. Only used in synchronous (wait) mode; // otherwise the task will save the settings itself. GuidList *m_pllRegistriesThatNeedSaving; @@ -1307,8 +1307,6 @@ HRESULT Medium::init(VirtualBox *aVirtualBox, if (FAILED(rc)) return rc; m->strDescription = aDescription; -/// @todo generate uuid (similarly to host network interface uuid) from location and device type - autoInitSpan.setSucceeded(); return S_OK; } @@ -2252,11 +2250,11 @@ STDMETHODIMP Medium::Close() ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox); GuidList llRegistriesThatNeedSaving; - HRESULT rc = close(&llRegistriesThatNeedSaving, autoCaller); - - pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + MultiResult mrc = close(&llRegistriesThatNeedSaving, autoCaller); + /* Must save the registries, since an entry was most likely removed. */ + mrc = pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); - return rc; + return mrc; } STDMETHODIMP Medium::GetProperty(IN_BSTR aName, BSTR *aValue) @@ -2471,15 +2469,16 @@ STDMETHODIMP Medium::DeleteStorage(IProgress **aProgress) ComObjPtr<Progress> pProgress; GuidList llRegistriesThatNeedSaving; - HRESULT rc = deleteStorage(&pProgress, - false /* aWait */, - &llRegistriesThatNeedSaving); - m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + MultiResult mrc = deleteStorage(&pProgress, + false /* aWait */, + &llRegistriesThatNeedSaving); + /* Must save the registries in any case, since an entry was removed. */ + mrc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); - if (SUCCEEDED(rc)) + if (SUCCEEDED(mrc)) pProgress.queryInterfaceTo(aProgress); - return rc; + return mrc; } STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget, @@ -3302,7 +3301,12 @@ HRESULT Medium::addBackReference(const Guid &aMachineId, if (aSnapshotId.isEmpty()) { /* sanity: no duplicate attachments */ - AssertReturn(!it->fInCurState, E_FAIL); + if (it->fInCurState) + return setError(VBOX_E_OBJECT_IN_USE, + tr("Cannot attach medium '%s' {%RTuuid}: medium is already associated with the current state of machine uuid {%RTuuid}!"), + m->strLocationFull.c_str(), + m->id.raw(), + aMachineId.raw()); it->fInCurState = true; return S_OK; @@ -3326,8 +3330,7 @@ HRESULT Medium::addBackReference(const Guid &aMachineId, tr("Cannot attach medium '%s' {%RTuuid} from snapshot '%RTuuid': medium is already in use by this snapshot!"), m->strLocationFull.c_str(), m->id.raw(), - aSnapshotId.raw(), - idOldSnapshot.raw()); + aSnapshotId.raw()); } } @@ -3787,7 +3790,7 @@ HRESULT Medium::createMediumLockList(bool fFailIfInaccessible, * @param aWait @c true if this method should block instead of * creating an asynchronous thread. * @param pllRegistriesThatNeedSaving Optional pointer to a list of UUIDs that will receive the registry IDs that need saving. - * This only works in "wait" mode; otherwise saveSettings is called automatically by the thread that + * This only works in "wait" mode; otherwise saveRegistries is called automatically by the thread that * was created, and this parameter is ignored. * * @note Locks this object and @a aTarget for writing. @@ -3924,7 +3927,7 @@ Utf8Str Medium::getPreferredDiffFormat() /** * Implementation for the public Medium::Close() with the exception of calling - * VirtualBox::saveSettings(), in case someone wants to call this for several + * VirtualBox::saveRegistries(), in case someone wants to call this for several * media. * * After this returns with success, uninit() has been called on the medium, and @@ -4008,8 +4011,8 @@ HRESULT Medium::close(GuidList *pllRegistriesThatNeedSaving, * @param aWait @c true if this method should block instead of creating * an asynchronous thread. * @param pfNeedsGlobalSaveSettings Optional pointer to a bool that must have been initialized to false and that will be set to true - * by this function if the caller should invoke VirtualBox::saveSettings() because the global settings have changed. - * This only works in "wait" mode; otherwise saveSettings gets called automatically by the thread that was created, + * by this function if the caller should invoke VirtualBox::saveRegistries() because the global settings have changed. + * This only works in "wait" mode; otherwise saveRegistries gets called automatically by the thread that was created, * and this parameter is ignored. * * @note Locks mVirtualBox and this object for writing. Locks medium tree for @@ -4626,8 +4629,8 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget, * @param aWait @c true if this method should block instead of creating * an asynchronous thread. * @param pfNeedsGlobalSaveSettings Optional pointer to a bool that must have been initialized to false and that will be set to true - * by this function if the caller should invoke VirtualBox::saveSettings() because the global settings have changed. - * This only works in "wait" mode; otherwise saveSettings gets called automatically by the thread that was created, + * by this function if the caller should invoke VirtualBox::saveRegistries() because the global settings have changed. + * This only works in "wait" mode; otherwise saveRegistries gets called automatically by the thread that was created, * and this parameter is ignored. * * @note Locks the tree lock for writing. Locks the media from the chain @@ -4840,10 +4843,10 @@ HRESULT Medium::fixParentUuidOfChildren(const MediaList &childrenToReparent) catch (HRESULT aRC) { rc = aRC; } catch (int aVRC) { - throw setError(E_FAIL, - tr("Could not update medium UUID references to parent '%s' (%s)"), - m->strLocationFull.c_str(), - vdError(aVRC).c_str()); + rc = setError(E_FAIL, + tr("Could not update medium UUID references to parent '%s' (%s)"), + m->strLocationFull.c_str(), + vdError(aVRC).c_str()); } VDDestroy(hdd); @@ -6269,7 +6272,7 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task) */ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) { - HRESULT rc = S_OK; + HRESULT rcTmp = S_OK; const ComObjPtr<Medium> &pTarget = task.mTarget; @@ -6352,7 +6355,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) /* ensure the target directory exists */ if (capabilities & VD_CAP_FILE) { - rc = VirtualBox::ensureFilePathExists(targetLocation); + HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation); if (FAILED(rc)) throw rc; } @@ -6379,13 +6382,15 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) if (RT_SUCCESS(vrc)) variant = (MediumVariant_T)uImageFlags; } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } VDDestroy(hdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } - if (SUCCEEDED(rc)) + MultiResult mrc(rcTmp); + + if (SUCCEEDED(mrc)) { AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); @@ -6403,16 +6408,16 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) /* register with mVirtualBox as the last step and move to * Created state only on success (leaving an orphan file is * better than breaking media registry consistency) */ - rc = m->pVirtualBox->registerHardDisk(pTarget, &llRegistriesThatNeedSaving); + mrc = m->pVirtualBox->registerHardDisk(pTarget, &llRegistriesThatNeedSaving); - if (FAILED(rc)) + if (FAILED(mrc)) /* break the parent association on failure to register */ deparent(); } AutoMultiWriteLock2 mediaLock(this, pTarget COMMA_LOCKVAL_SRC_POS); - if (SUCCEEDED(rc)) + if (SUCCEEDED(mrc)) { pTarget->m->state = MediumState_Created; @@ -6439,7 +6444,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) if (task.isAsync()) { mediaLock.release(); - m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + mrc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); } else // synchronous mode: report save settings result to caller @@ -6449,7 +6454,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) /* Note that in sync mode, it's the caller's responsibility to * unlock the medium. */ - return rc; + return mrc; } /** @@ -6466,7 +6471,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task) */ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task) { - HRESULT rc = S_OK; + HRESULT rcTmp = S_OK; const ComObjPtr<Medium> &pTarget = task.mTarget; @@ -6593,23 +6598,25 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task) } } } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } catch (int aVRC) { - throw setError(VBOX_E_FILE_ERROR, - tr("Could not merge the medium '%s' to '%s'%s"), - m->strLocationFull.c_str(), - pTarget->m->strLocationFull.c_str(), - vdError(aVRC).c_str()); + rcTmp = setError(VBOX_E_FILE_ERROR, + tr("Could not merge the medium '%s' to '%s'%s"), + m->strLocationFull.c_str(), + pTarget->m->strLocationFull.c_str(), + vdError(aVRC).c_str()); } VDDestroy(hdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } + ErrorInfoKeeper eik; + MultiResult mrc(rcTmp); HRESULT rc2; - if (SUCCEEDED(rc)) + if (SUCCEEDED(mrc)) { /* all media but the target were successfully deleted by * VDMerge; reparent the last one and uninitialize deleted media. */ @@ -6726,19 +6733,22 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task) // in asynchronous mode, save settings now GuidList llRegistriesThatNeedSaving; addToRegistryIDList(llRegistriesThatNeedSaving); - rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + /* collect multiple errors */ + eik.restore(); + mrc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + eik.fetch(); } else // synchronous mode: report save settings result to caller if (task.m_pllRegistriesThatNeedSaving) pTarget->addToRegistryIDList(*task.m_pllRegistriesThatNeedSaving); - if (FAILED(rc)) + if (FAILED(mrc)) { /* Here we come if either VDMerge() failed (in which case we * assume that it tried to do everything to make a further * retry possible -- e.g. not deleted intermediate media - * and so on) or VirtualBox::saveSettings() failed (where we + * and so on) or VirtualBox::saveRegistries() failed (where we * should have the original tree but with intermediate storage * units deleted by VDMerge()). We have to only restore states * (through the MergeChain dtor) unless we are run synchronously @@ -6752,7 +6762,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task) } } - return rc; + return mrc; } /** @@ -6766,7 +6776,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task) */ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) { - HRESULT rc = S_OK; + HRESULT rcTmp = S_OK; const ComObjPtr<Medium> &pTarget = task.mTarget; const ComObjPtr<Medium> &pParent = task.mParent; @@ -6848,7 +6858,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) /* ensure the target directory exists */ if (capabilities & VD_CAP_FILE) { - rc = VirtualBox::ensureFilePathExists(targetLocation); + HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation); if (FAILED(rc)) throw rc; } @@ -6927,18 +6937,21 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) if (RT_SUCCESS(vrc)) variant = (MediumVariant_T)uImageFlags; } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } VDDestroy(targetHdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } VDDestroy(hdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } + + ErrorInfoKeeper eik; + MultiResult mrc(rcTmp); /* Only do the parent changes for newly created media. */ - if (SUCCEEDED(rc) && fCreatingTarget) + if (SUCCEEDED(mrc) && fCreatingTarget) { /* we set mParent & children() */ AutoWriteLock alock2(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); @@ -6955,16 +6968,20 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) /* register with mVirtualBox as the last step and move to * Created state only on success (leaving an orphan file is * better than breaking media registry consistency) */ - rc = pParent->m->pVirtualBox->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */); + eik.restore(); + mrc = pParent->m->pVirtualBox->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */); + eik.fetch(); - if (FAILED(rc)) + if (FAILED(mrc)) /* break parent association on failure to register */ pTarget->deparent(); // removes target from parent } else { /* just register */ - rc = m->pVirtualBox->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */); + eik.restore(); + mrc = m->pVirtualBox->registerHardDisk(pTarget, NULL /* pllRegistriesThatNeedSaving */); + eik.fetch(); } } @@ -6972,7 +6989,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) { AutoWriteLock mLock(pTarget COMMA_LOCKVAL_SRC_POS); - if (SUCCEEDED(rc)) + if (SUCCEEDED(mrc)) { pTarget->m->state = MediumState_Created; @@ -6996,7 +7013,10 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) // save the settings GuidList llRegistriesThatNeedSaving; addToRegistryIDList(llRegistriesThatNeedSaving); - rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + /* collect multiple errors */ + eik.restore(); + mrc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + eik.fetch(); } /* Everything is explicitly unlocked when the task exits, @@ -7007,7 +7027,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task) * is called & the source chain is released at the same time. */ task.mpSourceMediumLockList->Clear(); - return rc; + return mrc; } /** @@ -7507,7 +7527,7 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task) 0 /* cbSize */, task.mVariant, NULL /* pDstUuid */, - VD_OPEN_FLAGS_NORMAL, + VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_SEQUENTIAL, NULL /* pVDIfsOperation */, task.mVDImageIfaces, task.mVDOperationIfaces); @@ -7548,7 +7568,7 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task) */ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) { - HRESULT rc = S_OK; + HRESULT rcTmp = S_OK; const ComObjPtr<Medium> &pParent = task.mParent; @@ -7612,7 +7632,7 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) /* ensure the target directory exists */ if (capabilities & VD_CAP_FILE) { - rc = VirtualBox::ensureFilePathExists(targetLocation); + HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation); if (FAILED(rc)) throw rc; } @@ -7691,18 +7711,21 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) if (RT_SUCCESS(vrc)) variant = (MediumVariant_T)uImageFlags; } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } VDDestroy(targetHdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } VDDestroy(hdd); } - catch (HRESULT aRC) { rc = aRC; } + catch (HRESULT aRC) { rcTmp = aRC; } + + ErrorInfoKeeper eik; + MultiResult mrc(rcTmp); /* Only do the parent changes for newly created media. */ - if (SUCCEEDED(rc) && fCreatingTarget) + if (SUCCEEDED(mrc) && fCreatingTarget) { /* we set mParent & children() */ AutoWriteLock alock2(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); @@ -7719,16 +7742,20 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) /* register with mVirtualBox as the last step and move to * Created state only on success (leaving an orphan file is * better than breaking media registry consistency) */ - rc = pParent->m->pVirtualBox->registerHardDisk(this, NULL /* llRegistriesThatNeedSaving */); + eik.restore(); + mrc = pParent->m->pVirtualBox->registerHardDisk(this, NULL /* llRegistriesThatNeedSaving */); + eik.fetch(); - if (FAILED(rc)) + if (FAILED(mrc)) /* break parent association on failure to register */ this->deparent(); // removes target from parent } else { /* just register */ - rc = m->pVirtualBox->registerHardDisk(this, NULL /* pllRegistriesThatNeedSaving */); + eik.restore(); + mrc = m->pVirtualBox->registerHardDisk(this, NULL /* pllRegistriesThatNeedSaving */); + eik.fetch(); } } @@ -7736,7 +7763,7 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) { AutoWriteLock mLock(this COMMA_LOCKVAL_SRC_POS); - if (SUCCEEDED(rc)) + if (SUCCEEDED(mrc)) { m->state = MediumState_Created; @@ -7760,7 +7787,10 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) // save the settings GuidList llRegistriesThatNeedSaving; addToRegistryIDList(llRegistriesThatNeedSaving); - rc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + /* collect multiple errors */ + eik.restore(); + mrc = m->pVirtualBox->saveRegistries(llRegistriesThatNeedSaving); + eik.fetch(); } /* Everything is explicitly unlocked when the task exits, @@ -7770,7 +7800,7 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task) * lead to deadlocks with concurrent IAppliance activities. */ task.mpTargetMediumLockList->Clear(); - return rc; + return mrc; } /* vi: set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/src/VBox/Main/src-server/linux/USBGetDevices.cpp b/src/VBox/Main/src-server/linux/USBGetDevices.cpp index 02e684aa0..63b45f37f 100644 --- a/src/VBox/Main/src-server/linux/USBGetDevices.cpp +++ b/src/VBox/Main/src-server/linux/USBGetDevices.cpp @@ -824,26 +824,36 @@ static int USBDevInfoInit(USBDeviceInfo *pSelf, const char *aDevice, #define USBDEVICE_MAJOR 189 -/** Deduce the bus that a USB device is plugged into from the device node - * number. See drivers/usb/core/hub.c:usb_new_device as of Linux 2.6.20. */ -static unsigned usbBusFromDevNum(dev_t devNum) +/** Calculate the bus (a.k.a root hub) number of a USB device from it's sysfs + * path. sysfs nodes representing root hubs have file names of the form + * usb<n>, where n is the bus number; other devices start with that number. + * See [http://www.linux-usb.org/FAQ.html#i6] and + * [http://www.kernel.org/doc/Documentation/usb/proc_usb_info.txt] for + * equivalent information about usbfs. + * @returns a bus number greater than 0 on success or 0 on failure. + */ +static unsigned usbGetBusFromSysfsPath(const char *pcszPath) { - AssertReturn(devNum, 0); - AssertReturn(major(devNum) == USBDEVICE_MAJOR, 0); - return (minor(devNum) >> 7) + 1; + const char *pcszFile = strrchr(pcszPath, '/'); + if (!pcszFile) + return 0; + unsigned bus = RTStrToUInt32(pcszFile + 1); + if ( !bus + && pcszFile[1] == 'u' && pcszFile[2] == 's' && pcszFile[3] == 'b') + bus = RTStrToUInt32(pcszFile + 4); + return bus; } - -/** Deduce the device number of a USB device on the bus from the device node - * number. See drivers/usb/core/hub.c:usb_new_device as of Linux 2.6.20. */ -static unsigned usbDeviceFromDevNum(dev_t devNum) +/** Calculate the device number of a USB device. See + * drivers/usb/core/hub.c:usb_new_device as of Linux 2.6.20. */ +static dev_t usbMakeDevNum(unsigned bus, unsigned device) { - AssertReturn(devNum, 0); - AssertReturn(major(devNum) == USBDEVICE_MAJOR, 0); - return (minor(devNum) & 127) + 1; + AssertReturn(bus > 0, 0); + AssertReturn(((device - 1) & ~127) == 0, 0); + AssertReturn(device > 0, 0); + return makedev(USBDEVICE_MAJOR, ((bus - 1) << 7) + device - 1); } - /** * If a file @a pcszNode from /sys/bus/usb/devices is a device rather than an * interface add an element for the device to @a pvecDevInfo. @@ -853,12 +863,15 @@ static int addIfDevice(const char *pcszDevicesRoot, VECTOR_OBJ(USBDeviceInfo) *pvecDevInfo) { const char *pcszFile = strrchr(pcszNode, '/'); + if (!pcszFile) + return VERR_INVALID_PARAMETER; if (strchr(pcszFile, ':')) return VINF_SUCCESS; - dev_t devnum = RTLinuxSysFsReadDevNumFile("%s/dev", pcszNode); - /* Sanity test of our static helpers */ - Assert(usbBusFromDevNum(makedev(USBDEVICE_MAJOR, 517)) == 5); - Assert(usbDeviceFromDevNum(makedev(USBDEVICE_MAJOR, 517)) == 6); + unsigned bus = usbGetBusFromSysfsPath(pcszNode); + if (!bus) + return VINF_SUCCESS; + unsigned device = RTLinuxSysFsReadIntFile(10, "%s/devnum", pcszNode); + dev_t devnum = usbMakeDevNum(bus, device); if (!devnum) return VINF_SUCCESS; char szDevPath[RTPATH_MAX]; @@ -866,9 +879,7 @@ static int addIfDevice(const char *pcszDevicesRoot, cchDevPath = RTLinuxFindDevicePath(devnum, RTFS_TYPE_DEV_CHAR, szDevPath, sizeof(szDevPath), "%s/%.3d/%.3d", - pcszDevicesRoot, - usbBusFromDevNum(devnum), - usbDeviceFromDevNum(devnum)); + pcszDevicesRoot, bus, device); if (cchDevPath < 0) return VINF_SUCCESS; @@ -1225,7 +1236,7 @@ static void fillInDeviceFromSysfs(USBDEVICE *Dev, USBDeviceInfo *pInfo) /* Fill in the simple fields */ Dev->enmState = USBDEVICESTATE_UNUSED; - Dev->bBus = RTLinuxSysFsReadIntFile(10, "%s/busnum", pszSysfsPath); + Dev->bBus = usbGetBusFromSysfsPath(pszSysfsPath); Dev->bDeviceClass = RTLinuxSysFsReadIntFile(16, "%s/bDeviceClass", pszSysfsPath); Dev->bDeviceSubClass = RTLinuxSysFsReadIntFile(16, "%s/bDeviceSubClass", pszSysfsPath); Dev->bDeviceProtocol = RTLinuxSysFsReadIntFile(16, "%s/bDeviceProtocol", pszSysfsPath); diff --git a/src/VBox/Main/src-server/xpcom/server.cpp b/src/VBox/Main/src-server/xpcom/server.cpp index 2cc798a43..ee81e4fd9 100644 --- a/src/VBox/Main/src-server/xpcom/server.cpp +++ b/src/VBox/Main/src-server/xpcom/server.cpp @@ -712,15 +712,25 @@ static void signal_handler(int sig) } } -static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath) +static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath, bool fAutoShutdown, const char *pszPidFile) { PRFileDesc *readable = nsnull, *writable = nsnull; PRProcessAttr *attr = nsnull; nsresult rv = NS_ERROR_FAILURE; PRFileDesc *devNull; + unsigned args_index = 0; // The ugly casts are necessary because the PR_CreateProcessDetached has // a const array of writable strings as a parameter. It won't write. */ - char * const args[] = { (char *)pszPath, (char *)"--auto-shutdown", 0 }; + char * args[1 + 1 + 2 + 1]; + args[args_index++] = (char *)pszPath; + if (fAutoShutdown) + args[args_index++] = (char *)"--auto-shutdown"; + if (pszPidFile) + { + args[args_index++] = (char *)"--pidfile"; + args[args_index++] = (char *)pszPidFile; + } + args[args_index++] = 0; // Use a pipe to determine when the daemon process is in the position // to actually process requests. The daemon will write "READY" to the pipe. @@ -743,7 +753,7 @@ static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath) PR_ProcessAttrSetStdioRedirect(attr, PR_StandardOutput, devNull); PR_ProcessAttrSetStdioRedirect(attr, PR_StandardError, devNull); - if (PR_CreateProcessDetached(pszPath, args, nsnull, attr) != PR_SUCCESS) + if (PR_CreateProcessDetached(pszPath, (char * const *)args, nsnull, attr) != PR_SUCCESS) goto end; // Close /dev/null @@ -847,7 +857,7 @@ int main(int argc, char **argv) if (fDaemonize) { - vboxsvcSpawnDaemonByReExec(argv[0]); + vboxsvcSpawnDaemonByReExec(argv[0], gAutoShutdown, g_pszPidFile); exit(126); } diff --git a/src/VBox/Main/webservice/vboxweb.cpp b/src/VBox/Main/webservice/vboxweb.cpp index 6302a5ed1..e8036ed23 100644 --- a/src/VBox/Main/webservice/vboxweb.cpp +++ b/src/VBox/Main/webservice/vboxweb.cpp @@ -724,7 +724,7 @@ void doQueuesLoop() if (s < 0) { WebLogSoapError(&soap); - break; + continue; } // add the socket to the queue and tell worker threads to diff --git a/src/VBox/RDP/client/COPYING b/src/VBox/RDP/client/COPYING index 43d773001..443254047 100644 --- a/src/VBox/RDP/client/COPYING +++ b/src/VBox/RDP/client/COPYING @@ -1,292 +1,627 @@ -This software is released under the GNU General Public License -(reproduced below) with the additional exemption that compiling, -linking, and/or using OpenSSL together with this software is -allowed. - ---- GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -294,15 +629,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> + Copyright (C) <year> <name of author> - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -311,36 +646,31 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/src/VBox/RDP/client/Makefile.in b/src/VBox/RDP/client/Makefile.in index cc1de659f..78c43731d 100644 --- a/src/VBox/RDP/client/Makefile.in +++ b/src/VBox/RDP/client/Makefile.in @@ -94,7 +94,7 @@ clean: .PHONY: distclean distclean: clean - rm -rf autom4te.cache config.log config.status Makefile + rm -rf autom4te.cache config.log config.status Makefile rdesktop-$(VERSION).tar.gz .PHONY: dist dist: rdesktop-$(VERSION).tar.gz @@ -159,5 +159,6 @@ configure: configure.ac .c.o: $(CC) $(CFLAGS) -o $@ -c $< -.cpp.o: - $(CXX) $(CFLAGS) -o $@ -c $< +.PHONY: doc/AUTHORS +doc/AUTHORS: + ./genauthors *.c diff --git a/src/VBox/RDP/client/Makefile.kmk b/src/VBox/RDP/client/Makefile.kmk index e3516eeee..c191c25fc 100644 --- a/src/VBox/RDP/client/Makefile.kmk +++ b/src/VBox/RDP/client/Makefile.kmk @@ -24,7 +24,7 @@ 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.6.0-vrdp +VBOX_RDESKTOP_SRC_SUBDIR = rdesktop-1.7.0-vrdp # # The rdesktop-vrdp program. @@ -33,8 +33,8 @@ PROGRAMS += rdesktop-vrdp rdesktop-vrdp_TEMPLATE = VBOXR3NPEXE rdesktop-vrdp_SDKS = VBOX_OPENSSL rdesktop-vrdp_DEFS = \ - PACKAGE_NAME=\"rdesktop-vrdp\" PACKAGE_TARNAME=\"rdesktop-vrdp\" PACKAGE_VERSION=\"1.6.0\" \ - PACKAGE_STRING=\"rdesktop\ 1.6.0\" PACKAGE_BUGREPORT=\"\" STDC_HEADERS=1 L_ENDIAN=1 \ + PACKAGE_NAME=\"rdesktop-vrdp\" PACKAGE_TARNAME=\"rdesktop-vrdp\" PACKAGE_VERSION=\"1.7.0\" \ + PACKAGE_STRING=\"rdesktop\ 1.7.0\" 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 \ diff --git a/src/VBox/RDP/client/README b/src/VBox/RDP/client/README index 7e2c4c79a..13dd63509 100644 --- a/src/VBox/RDP/client/README +++ b/src/VBox/RDP/client/README @@ -1,16 +1,16 @@ -=========================================== -rdesktop: A Remote Desktop Protocol client. -=========================================== +========================================== +rdesktop: A Remote Desktop Protocol client +========================================== -rdesktop is a client for Microsoft Windows NT Terminal Server, Windows 2000 -Terminal Services, Windows 2003 Terminal Services/Remote Desktop, Windows XP -Remote Desktop, and possibly other Terminal Services products. -rdesktop currently implements the RDP version 4 and 5 protocols. +rdesktop is an open source client for Microsoft's RDP protocol. It is +known to work with Windows versions such as NT 4 Terminal Server, +2000, XP, 2003, 2003 R2, Vista, 2008, 7, and 2008 R2. rdesktop +currently implements the RDP version 4 and 5 protocols. Installation ------------ rdesktop uses a GNU-style build procedure. Typically all that is necessary -to install rdesktop is the following: +to install rdesktop is the following:: % ./configure % make @@ -19,15 +19,16 @@ to install rdesktop is the following: The default is to install under /usr/local. This can be changed by adding --prefix=directory to the configure line. -Note for CVS users ------------------- -If you have downloaded a snapshot of rdesktop using CVS, you will first need to -run ./bootstrap in order to generate the build infrastructure. This is not -necessary for release versions of rdesktop. +Note for Subversion users +------------------------- +If you have downloaded a snapshot of rdesktop using Subversion, you +will first need to run ./bootstrap in order to generate the build +infrastructure. This is not necessary for release versions of +rdesktop. Invocation ---------- -Simply run: +Simply run:: % rdesktop server diff --git a/src/VBox/RDP/client/bitmap.c b/src/VBox/RDP/client/bitmap.c index 7e5dff529..96cf2b858 100644 --- a/src/VBox/RDP/client/bitmap.c +++ b/src/VBox/RDP/client/bitmap.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Bitmap decompression routines - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/cache.c b/src/VBox/RDP/client/cache.c index f98c7a2d4..aa738a276 100644 --- a/src/VBox/RDP/client/cache.c +++ b/src/VBox/RDP/client/cache.c @@ -1,12 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Cache routines - Copyright (C) Matthew Chapman 1999-2007 - Copyright (C) Jeroen Meijer 2005 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) Jeroen Meijer <jeroen@oldambt7.com> 2005 + Copyright 2003-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -59,6 +59,7 @@ static RD_HBITMAP g_volatile_bc[3]; static int g_bmpcache_lru[3] = { NOT_SET, NOT_SET, NOT_SET }; static int g_bmpcache_mru[3] = { NOT_SET, NOT_SET, NOT_SET }; + static int g_bmpcache_count[3]; /* Setup the bitmap cache lru/mru linked list */ @@ -103,7 +104,7 @@ cache_rebuild_bmpcache_linked_list(uint8 id, sint16 * idx, int count) { error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c, g_bmpcache_count[id]); - exit(1); + exit(EX_SOFTWARE); } } @@ -185,7 +186,7 @@ cache_evict_bitmap(uint8 id) idx = g_bmpcache_lru[id]; n_idx = g_bmpcache[id][idx].next; - DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=0x%x\n", id, idx, n_idx, + DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=%p\n", id, idx, n_idx, g_bmpcache[id][idx].bitmap)); ui_destroy_bitmap(g_bmpcache[id][idx].bitmap); @@ -439,3 +440,43 @@ cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor) error("put cursor %d\n", cache_idx); } } + +/* BRUSH CACHE */ +/* index 0 is 2 colour brush, index 1 is muti colour brush */ +static BRUSHDATA g_brushcache[2][64]; + +/* Retrieve brush from cache */ +BRUSHDATA * +cache_get_brush_data(uint8 colour_code, uint8 idx) +{ + colour_code = colour_code == 1 ? 0 : 1; + if (idx < NUM_ELEMENTS(g_brushcache[0])) + { + return &g_brushcache[colour_code][idx]; + } + error("get brush %d %d\n", colour_code, idx); + return NULL; +} + +/* Store brush in cache */ +/* this function takes over the data pointer in struct, eg, caller gives it up */ +void +cache_put_brush_data(uint8 colour_code, uint8 idx, BRUSHDATA * brush_data) +{ + BRUSHDATA *bd; + + colour_code = colour_code == 1 ? 0 : 1; + if (idx < NUM_ELEMENTS(g_brushcache[0])) + { + bd = &g_brushcache[colour_code][idx]; + if (bd->data != 0) + { + xfree(bd->data); + } + memcpy(bd, brush_data, sizeof(BRUSHDATA)); + } + else + { + error("put brush %d %d\n", colour_code, idx); + } +} diff --git a/src/VBox/RDP/client/channels.c b/src/VBox/RDP/client/channels.c index f8f1c0671..1a6e1a320 100644 --- a/src/VBox/RDP/client/channels.c +++ b/src/VBox/RDP/client/channels.c @@ -2,11 +2,11 @@ rdesktop: A Remote Desktop Protocol client. Protocol services - Virtual channels Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 - Copyright (C) Matthew Chapman 2003-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/cliprdr.c b/src/VBox/RDP/client/cliprdr.c index 276115aa7..cbe478b9a 100644 --- a/src/VBox/RDP/client/cliprdr.c +++ b/src/VBox/RDP/client/cliprdr.c @@ -2,11 +2,11 @@ rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 - Copyright (C) Matthew Chapman 2003-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/configure b/src/VBox/RDP/client/configure index ddfcaaf19..4b93beff2 100755 --- a/src/VBox/RDP/client/configure +++ b/src/VBox/RDP/client/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for rdesktop 1.6.0. +# Generated by GNU Autoconf 2.68 for rdesktop 1.7.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -89,6 +89,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -214,11 +215,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -549,8 +557,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rdesktop' PACKAGE_TARNAME='rdesktop' -PACKAGE_VERSION='1.6.0' -PACKAGE_STRING='rdesktop 1.6.0' +PACKAGE_VERSION='1.7.0' +PACKAGE_STRING='rdesktop 1.7.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1111,7 +1119,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1249,7 +1257,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rdesktop 1.6.0 to adapt to many kinds of systems. +\`configure' configures rdesktop 1.7.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1318,7 +1326,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rdesktop 1.6.0:";; + short | recursive ) echo "Configuration of rdesktop 1.7.0:";; esac cat <<\_ACEOF @@ -1431,8 +1439,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rdesktop configure 1.6.0 -generated by GNU Autoconf 2.67 +rdesktop configure 1.7.0 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1478,7 +1486,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1516,7 +1524,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1553,7 +1561,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1595,7 +1603,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1609,7 +1617,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1627,7 +1635,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1672,7 +1680,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1685,7 +1693,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1740,7 +1748,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -1752,10 +1760,10 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1818,7 +1826,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1827,7 +1835,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1842,7 +1850,7 @@ ac_fn_c_check_decl () as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1873,7 +1881,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl @@ -1886,7 +1894,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1927,7 +1935,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1940,7 +1948,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1984,15 +1992,15 @@ fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rdesktop $as_me 1.6.0, which was -generated by GNU Autoconf 2.67. Invocation command line was +It was created by rdesktop $as_me 1.7.0, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2250,7 +2258,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2352,7 +2360,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2392,7 +2400,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2445,7 +2453,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2485,7 +2493,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2544,7 +2552,7 @@ if test -z "$CC"; then 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 test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2588,7 +2596,7 @@ do 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 test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2643,7 +2651,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2758,7 +2766,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -2801,7 +2809,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -2860,7 +2868,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -2871,7 +2879,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2912,7 +2920,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -2922,7 +2930,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $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 test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2959,7 +2967,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3037,7 +3045,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3151,7 +3159,7 @@ if test -z "$CXX"; then 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 test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -3195,7 +3203,7 @@ do 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 test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -3273,7 +3281,7 @@ 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 test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3310,7 +3318,7 @@ 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 test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -3439,7 +3447,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3534,7 +3542,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -3650,7 +3658,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3662,7 +3670,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -3725,7 +3733,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3792,7 +3800,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3921,7 +3929,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -4141,7 +4149,7 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 @@ -4159,8 +4167,8 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #( - *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. @@ -4437,7 +4445,7 @@ if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } -if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then : +if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4471,14 +4479,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then : +if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then : +if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4512,7 +4520,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then : +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi @@ -4531,14 +4539,14 @@ rm -f core conftest.err conftest.$ac_objext \ # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = x""yes; then : +if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4572,14 +4580,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then : +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then : +if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4613,7 +4621,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then : +if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -4628,14 +4636,14 @@ fi # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = x""yes; then : +if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_connect+set}" = set; then : +if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4669,7 +4677,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = x""yes; then : +if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -4677,14 +4685,14 @@ fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = x""yes; then : +if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } -if test "${ac_cv_lib_posix_remove+set}" = set; then : +if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4718,7 +4726,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = x""yes; then : +if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -4726,14 +4734,14 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = x""yes; then : +if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } -if test "${ac_cv_lib_ipc_shmat+set}" = set; then : +if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4767,7 +4775,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = x""yes; then : +if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -4785,7 +4793,7 @@ fi # John Interrante, Karl Berry { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } -if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then : +if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4819,7 +4827,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then : +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -4844,7 +4852,7 @@ fi set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -4883,7 +4891,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } -if test "${ac_cv_search_socket+set}" = set; then : +if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -4917,11 +4925,11 @@ for ac_lib in '' socket; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_socket+set}" = set; then : + if ${ac_cv_search_socket+:} false; then : break fi done -if test "${ac_cv_search_socket+set}" = set; then : +if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no @@ -4939,7 +4947,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 $as_echo_n "checking for library containing inet_aton... " >&6; } -if test "${ac_cv_search_inet_aton+set}" = set; then : +if ${ac_cv_search_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -4973,11 +4981,11 @@ for ac_lib in '' resolv; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_inet_aton+set}" = set; then : + if ${ac_cv_search_inet_aton+:} false; then : break fi done -if test "${ac_cv_search_inet_aton+set}" = set; then : +if ${ac_cv_search_inet_aton+:} false; then : else ac_cv_search_inet_aton=no @@ -4995,7 +5003,7 @@ 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 test "${ac_cv_search_clock_gettime+set}" = set; then : +if ${ac_cv_search_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -5029,11 +5037,11 @@ for ac_lib in '' rt; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_clock_gettime+set}" = set; then : + if ${ac_cv_search_clock_gettime+:} false; then : break fi done -if test "${ac_cv_search_clock_gettime+set}" = set; then : +if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no @@ -5051,54 +5059,61 @@ fi ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_select_h" = x""yes; then : +if test "x$ac_cv_header_sys_select_h" = xyes; then : $as_echo "#define HAVE_SYS_SELECT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/modem.h" "ac_cv_header_sys_modem_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_modem_h" = x""yes; then : +if test "x$ac_cv_header_sys_modem_h" = xyes; then : $as_echo "#define HAVE_SYS_MODEM_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_filio_h" = x""yes; then : +if test "x$ac_cv_header_sys_filio_h" = xyes; then : $as_echo "#define HAVE_SYS_FILIO_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/strtio.h" "ac_cv_header_sys_strtio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_strtio_h" = x""yes; then : +if test "x$ac_cv_header_sys_strtio_h" = xyes; then : $as_echo "#define HAVE_SYS_STRTIO_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" -if test "x$ac_cv_header_locale_h" = x""yes; then : +if test "x$ac_cv_header_locale_h" = xyes; then : $as_echo "#define HAVE_LOCALE_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default" -if test "x$ac_cv_header_langinfo_h" = x""yes; then : +if test "x$ac_cv_header_langinfo_h" = xyes; then : $as_echo "#define HAVE_LANGINFO_H 1" >>confdefs.h fi +ac_fn_c_check_header_mongrel "$LINENO" "sysexits.h" "ac_cv_header_sysexits_h" "$ac_includes_default" +if test "x$ac_cv_header_sysexits_h" = xyes; then : + $as_echo "#define HAVE_SYSEXITS_H 1" >>confdefs.h + +fi + + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -5138,7 +5153,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -5257,6 +5272,20 @@ rpath="$rpath:$ssldir/lib" fi +# xrandr +if test -n "$PKG_CONFIG"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not available, cannot check for xrandr" >&5 +$as_echo "$as_me: WARNING: pkg-config not available, cannot check for xrandr" >&2;} + HAVE_XRANDR=0 + +fi +if test x"$HAVE_XRANDR" = "x1"; then + CFLAGS="$CFLAGS $XRANDR_CFLAGS" + LIBS="$LIBS $XRANDR_LIBS" + $as_echo "#define HAVE_XRANDR 1" >>confdefs.h + +fi # Check whether --enable-smartcard was given. if test "${enable_smartcard+set}" = set; then : @@ -5264,7 +5293,7 @@ if test "${enable_smartcard+set}" = set; then : case "$OSTYPE" in darwin*) ac_fn_c_check_header_mongrel "$LINENO" "PCSC/pcsclite.h" "ac_cv_header_PCSC_pcsclite_h" "$ac_includes_default" -if test "x$ac_cv_header_PCSC_pcsclite_h" = x""yes; then : +if test "x$ac_cv_header_PCSC_pcsclite_h" = xyes; then : WITH_SCARD=1 else WITH_SCARD=0 @@ -5465,7 +5494,7 @@ fi ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_soundcard_h" = x""yes; then : +if test "x$ac_cv_header_sys_soundcard_h" = xyes; then : HAVE_OSS=1 else HAVE_OSS=0 @@ -5473,7 +5502,7 @@ fi ac_fn_c_check_header_mongrel "$LINENO" "dmedia/audio.h" "ac_cv_header_dmedia_audio_h" "$ac_includes_default" -if test "x$ac_cv_header_dmedia_audio_h" = x""yes; then : +if test "x$ac_cv_header_dmedia_audio_h" = xyes; then : HAVE_SGI=1 else HAVE_SGI=0 @@ -5481,7 +5510,7 @@ fi ac_fn_c_check_header_mongrel "$LINENO" "sys/audioio.h" "ac_cv_header_sys_audioio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_audioio_h" = x""yes; then : +if test "x$ac_cv_header_sys_audioio_h" = xyes; then : HAVE_SUN=1 else HAVE_SUN=0 @@ -5652,7 +5681,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval "test \"\${$as_ac_Header+set}\"" = set; then : +if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5692,7 +5721,7 @@ done if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -5726,11 +5755,11 @@ for ac_lib in '' dir; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -5749,7 +5778,7 @@ fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -5783,11 +5812,11 @@ for ac_lib in '' x; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -5824,7 +5853,7 @@ fi for ac_func in dirfd do : ac_fn_c_check_func "$LINENO" "dirfd" "ac_cv_func_dirfd" -if test "x$ac_cv_func_dirfd" = x""yes; then : +if test "x$ac_cv_func_dirfd" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DIRFD 1 _ACEOF @@ -5834,7 +5863,7 @@ done ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "$dirfd_headers " -if test "x$ac_cv_have_decl_dirfd" = x""yes; then : +if test "x$ac_cv_have_decl_dirfd" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -5847,7 +5876,7 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether dirfd is a macro" >&5 $as_echo_n "checking whether dirfd is a macro... " >&6; } -if test "${jm_cv_func_dirfd_macro+set}" = set; then : +if ${jm_cv_func_dirfd_macro+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5874,7 +5903,7 @@ $as_echo "$jm_cv_func_dirfd_macro" >&6; } if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ = no,no,no; then ac_fn_c_check_func "$LINENO" "dirfd" "ac_cv_func_dirfd" -if test "x$ac_cv_func_dirfd" = x""yes; then : +if test "x$ac_cv_func_dirfd" = xyes; then : $as_echo "#define HAVE_DIRFD 1" >>confdefs.h else @@ -5889,7 +5918,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get the file descriptor associated with an open DIR*" >&5 $as_echo_n "checking how to get the file descriptor associated with an open DIR*... " >&6; } -if test "${gl_cv_sys_dir_fd_member_name+set}" = set; then : +if ${gl_cv_sys_dir_fd_member_name+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5957,7 +5986,7 @@ if test "${with_libiconv_prefix+set}" = set; then : fi ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" -if test "x$ac_cv_header_iconv_h" = x""yes; then : +if test "x$ac_cv_header_iconv_h" = xyes; then : $as_echo "#define HAVE_ICONV_H 1" >>confdefs.h fi @@ -5966,7 +5995,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } -if test "${am_cv_func_iconv+set}" = set; then : +if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6026,7 +6055,7 @@ $as_echo "#define HAVE_ICONV 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 $as_echo_n "checking for iconv declaration... " >&6; } - if test "${am_cv_proto_iconv+set}" = set; then : + if ${am_cv_proto_iconv+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6091,19 +6120,19 @@ LIBS="$LIBS $LIBICONV" ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h> #include <sys/socket.h> " -if test "x$ac_cv_type_socklen_t" = x""yes; then : +if test "x$ac_cv_type_socklen_t" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 $as_echo_n "checking for socklen_t equivalent... " >&6; } - if test "${socklen_t_equiv+set}" = set; then : + if ${socklen_t_cv_equiv+:} false; then : $as_echo_n "(cached) " >&6 else # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername - socklen_t_equiv= + socklen_t_cv_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t unsigned long "unsigned long"; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6127,7 +6156,7 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - socklen_t_equiv="$t" + socklen_t_cv_equiv="$t" break fi @@ -6135,17 +6164,17 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done - if test "x$socklen_t_equiv" = x; then + if test "x$socklen_t_cv_equiv" = x; then as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $socklen_t_equiv" >&5 -$as_echo "$socklen_t_equiv" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $socklen_t_cv_equiv" >&5 +$as_echo "$socklen_t_cv_equiv" >&6; } cat >>confdefs.h <<_ACEOF -#define socklen_t $socklen_t_equiv +#define socklen_t $socklen_t_cv_equiv _ACEOF fi @@ -6158,7 +6187,7 @@ fi for ac_header in sys/vfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_vfs_h" = x""yes; then : +if test "x$ac_cv_header_sys_vfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_VFS_H 1 _ACEOF @@ -6170,7 +6199,7 @@ done for ac_header in sys/statvfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_statvfs_h" = x""yes; then : +if test "x$ac_cv_header_sys_statvfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STATVFS_H 1 _ACEOF @@ -6182,7 +6211,7 @@ done for ac_header in sys/statfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/statfs.h" "ac_cv_header_sys_statfs_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_statfs_h" = x""yes; then : +if test "x$ac_cv_header_sys_statfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STATFS_H 1 _ACEOF @@ -6194,7 +6223,7 @@ done for ac_header in sys/param.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = x""yes; then : +if test "x$ac_cv_header_sys_param_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_PARAM_H 1 _ACEOF @@ -6215,7 +6244,7 @@ for ac_header in sys/mount.h do : ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "$mount_includes " -if test "x$ac_cv_header_sys_mount_h" = x""yes; then : +if test "x$ac_cv_header_sys_mount_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_MOUNT_H 1 _ACEOF @@ -6236,7 +6265,7 @@ if test $space = no; then # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking statvfs64 function (SVR4)" >&5 $as_echo_n "checking statvfs64 function (SVR4)... " >&6; } -if test "${fu_cv_sys_stat_statvfs64+set}" = set; then : +if ${fu_cv_sys_stat_statvfs64+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6286,7 +6315,7 @@ if test $space = no; then # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking statvfs function (SVR4)" >&5 $as_echo_n "checking statvfs function (SVR4)... " >&6; } -if test "${fu_cv_sys_stat_statvfs+set}" = set; then : +if ${fu_cv_sys_stat_statvfs+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6323,7 +6352,7 @@ if test $space = no; then # DEC Alpha running OSF/1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 3-argument statfs function (DEC OSF/1)" >&5 $as_echo_n "checking for 3-argument statfs function (DEC OSF/1)... " >&6; } - if test "${fu_cv_sys_stat_statfs3_osf1+set}" = set; then : + if ${fu_cv_sys_stat_statfs3_osf1+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6368,7 +6397,7 @@ if test $space = no; then # AIX { $as_echo "$as_me:${as_lineno-$LINENO}: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 $as_echo_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)... " >&6; } - if test "${fu_cv_sys_stat_statfs2_bsize+set}" = set; then : + if ${fu_cv_sys_stat_statfs2_bsize+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6418,7 +6447,7 @@ if test $space = no; then # SVR3 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 $as_echo_n "checking for four-argument statfs (AIX-3.2.5, SVR3)... " >&6; } - if test "${fu_cv_sys_stat_statfs4+set}" = set; then : + if ${fu_cv_sys_stat_statfs4+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6459,7 +6488,7 @@ if test $space = no; then # 4.4BSD and NetBSD { $as_echo "$as_me:${as_lineno-$LINENO}: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 $as_echo_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)... " >&6; } - if test "${fu_cv_sys_stat_statfs2_fsize+set}" = set; then : + if ${fu_cv_sys_stat_statfs2_fsize+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6506,7 +6535,7 @@ if test $space = no; then # Ultrix { $as_echo "$as_me:${as_lineno-$LINENO}: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 $as_echo_n "checking for two-argument statfs with struct fs_data (Ultrix)... " >&6; } - if test "${fu_cv_sys_stat_fs_data+set}" = set; then : + if ${fu_cv_sys_stat_fs_data+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -6577,7 +6606,7 @@ $ac_includes_default ac_fn_c_check_member "$LINENO" "struct statfs" "f_namemax" "ac_cv_member_struct_statfs_f_namemax" "$statxfs_includes " -if test "x$ac_cv_member_struct_statfs_f_namemax" = x""yes; then : +if test "x$ac_cv_member_struct_statfs_f_namemax" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STATFS_F_NAMEMAX 1 @@ -6588,7 +6617,7 @@ fi ac_fn_c_check_member "$LINENO" "struct statvfs" "f_namemax" "ac_cv_member_struct_statvfs_f_namemax" "$statxfs_includes " -if test "x$ac_cv_member_struct_statvfs_f_namemax" = x""yes; then : +if test "x$ac_cv_member_struct_statvfs_f_namemax" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STATVFS_F_NAMEMAX 1 @@ -6599,7 +6628,7 @@ fi ac_fn_c_check_member "$LINENO" "struct statfs" "f_namelen" "ac_cv_member_struct_statfs_f_namelen" "$statxfs_includes " -if test "x$ac_cv_member_struct_statfs_f_namelen" = x""yes; then : +if test "x$ac_cv_member_struct_statfs_f_namelen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STATFS_F_NAMELEN 1 @@ -6610,7 +6639,7 @@ fi ac_fn_c_check_member "$LINENO" "struct statvfs" "f_namelen" "ac_cv_member_struct_statvfs_f_namelen" "$statxfs_includes " -if test "x$ac_cv_member_struct_statvfs_f_namelen" = x""yes; then : +if test "x$ac_cv_member_struct_statvfs_f_namelen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STATVFS_F_NAMELEN 1 @@ -6632,7 +6661,7 @@ if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_CC+set}" = set; then : +if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no @@ -6683,7 +6712,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test "${ac_cv_sys_file_offset_bits+set}" = set; then : +if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -6752,7 +6781,7 @@ rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if test "${ac_cv_sys_large_files+set}" = set; then : +if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -6826,7 +6855,7 @@ fi # mntent # ac_fn_c_check_header_mongrel "$LINENO" "mntent.h" "ac_cv_header_mntent_h" "$ac_includes_default" -if test "x$ac_cv_header_mntent_h" = x""yes; then : +if test "x$ac_cv_header_mntent_h" = xyes; then : $as_echo "#define HAVE_MNTENT_H 1" >>confdefs.h fi @@ -6835,7 +6864,7 @@ fi for ac_func in setmntent do : ac_fn_c_check_func "$LINENO" "setmntent" "ac_cv_func_setmntent" -if test "x$ac_cv_func_setmntent" = x""yes; then : +if test "x$ac_cv_func_setmntent" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETMNTENT 1 _ACEOF @@ -6981,7 +7010,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -6997,7 +7026,7 @@ fi $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -7015,7 +7044,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -7030,7 +7059,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -7129,10 +7158,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -7201,7 +7241,7 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -7302,6 +7342,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -7608,8 +7649,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rdesktop $as_me 1.6.0, which was -generated by GNU Autoconf 2.67. Invocation command line was +This file was extended by rdesktop $as_me 1.7.0, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7661,8 +7702,8 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rdesktop config.status 1.6.0 -configured by $0, generated by GNU Autoconf 2.67, +rdesktop config.status 1.7.0 +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -7774,7 +7815,7 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -7795,9 +7836,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -7805,12 +7847,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -7832,7 +7875,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -7860,7 +7903,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -7908,7 +7951,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -7940,7 +7983,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -7980,7 +8023,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -7999,7 +8042,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -8008,7 +8051,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -8034,8 +8077,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -8165,21 +8208,22 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; diff --git a/src/VBox/RDP/client/configure.ac b/src/VBox/RDP/client/configure.ac index c5056f525..2f7249a97 100644 --- a/src/VBox/RDP/client/configure.ac +++ b/src/VBox/RDP/client/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(rdesktop, 1.6.0) +AC_INIT(rdesktop, 1.7.0) AC_CONFIG_SRCDIR([rdesktop.c]) @@ -38,6 +38,7 @@ AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H)) AC_CHECK_HEADER(sys/strtio.h, AC_DEFINE(HAVE_SYS_STRTIO_H)) AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H)) AC_CHECK_HEADER(langinfo.h, AC_DEFINE(HAVE_LANGINFO_H)) +AC_CHECK_HEADER(sysexits.h, AC_DEFINE(HAVE_SYSEXITS_H)) AC_CHECK_TOOL(STRIP, strip, :) @@ -106,6 +107,15 @@ LIBS="$LIBS $ssldir/lib/libcrypto.a" LIBS="$LIBS -L$ssldir/lib -lcrypto" rpath="$rpath:$ssldir/lib" ]) +# xrandr +if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES(XRANDR, xrandr, [HAVE_XRANDR=1], [HAVE_XRANDR=0]) +fi +if test x"$HAVE_XRANDR" = "x1"; then + CFLAGS="$CFLAGS $XRANDR_CFLAGS" + LIBS="$LIBS $XRANDR_LIBS" + AC_DEFINE(HAVE_XRANDR) +fi AC_ARG_ENABLE(smartcard, [ --enable-smartcard Enables smart-card support. @@ -527,11 +537,11 @@ AC_DEFUN([TYPE_SOCKLEN_T], [ AC_CHECK_TYPE([socklen_t], ,[ AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([socklen_t_equiv], + AC_CACHE_VAL([socklen_t_cv_equiv], [ # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername - socklen_t_equiv= + socklen_t_cv_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t unsigned long "unsigned long"; do AC_TRY_COMPILE([ @@ -543,18 +553,18 @@ AC_DEFUN([TYPE_SOCKLEN_T], $t len; getpeername(0,0,&len); ],[ - socklen_t_equiv="$t" + socklen_t_cv_equiv="$t" break ]) done done - if test "x$socklen_t_equiv" = x; then + if test "x$socklen_t_cv_equiv" = x; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) fi ]) - AC_MSG_RESULT($socklen_t_equiv) - AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv, + AC_MSG_RESULT($socklen_t_cv_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_cv_equiv, [type to use in place of socklen_t if not defined])], [#include <sys/types.h> #include <sys/socket.h>]) diff --git a/src/VBox/RDP/client/constants.h b/src/VBox/RDP/client/constants.h index 560d92d5a..ee49c951a 100644 --- a/src/VBox/RDP/client/constants.h +++ b/src/VBox/RDP/client/constants.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Miscellaneous protocol constants - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -131,12 +130,26 @@ enum RDP_DATA_PDU_TYPE RDP_DATA_PDU_SYNCHRONISE = 31, RDP_DATA_PDU_BELL = 34, RDP_DATA_PDU_CLIENT_WINDOW_STATUS = 35, - RDP_DATA_PDU_LOGON = 38, + RDP_DATA_PDU_LOGON = 38, /* PDUTYPE2_SAVE_SESSION_INFO */ RDP_DATA_PDU_FONT2 = 39, RDP_DATA_PDU_KEYBOARD_INDICATORS = 41, RDP_DATA_PDU_DISCONNECT = 47 }; +enum RDP_SAVE_SESSION_PDU_TYPE +{ + INFOTYPE_LOGON = 0, + INFOTYPE_LOGON_LONG = 1, + INFOTYPE_LOGON_PLAINNOTIFY = 2, + INFOTYPE_LOGON_EXTENDED_INF = 3 +}; + +enum RDP_LOGON_INFO_EXTENDED_TYPE +{ + LOGON_EX_AUTORECONNECTCOOKIE = 1, + LOGON_EX_LOGONERRORS = 2 +}; + enum RDP_CONTROL_PDU_TYPE { RDP_CTL_REQUEST_CONTROL = 1, @@ -158,7 +171,8 @@ enum RDP_POINTER_PDU_TYPE RDP_POINTER_SYSTEM = 1, RDP_POINTER_MOVE = 3, RDP_POINTER_COLOR = 6, - RDP_POINTER_CACHED = 7 + RDP_POINTER_CACHED = 7, + RDP_POINTER_NEW = 8 }; enum RDP_SYSTEM_POINTER_TYPE @@ -254,6 +268,7 @@ enum RDP_INPUT_DEVICE #define RDP_CAPSET_POINTER 8 #define RDP_CAPLEN_POINTER 0x08 +#define RDP_CAPLEN_NEWPOINTER 0x0a #define RDP_CAPSET_SHARE 9 #define RDP_CAPLEN_SHARE 0x08 @@ -261,6 +276,9 @@ enum RDP_INPUT_DEVICE #define RDP_CAPSET_COLCACHE 10 #define RDP_CAPLEN_COLCACHE 0x08 +#define RDP_CAPSET_BRUSHCACHE 15 +#define RDP_CAPLEN_BRUSHCACHE 0x08 + #define RDP_CAPSET_BMPCACHE2 19 #define RDP_CAPLEN_BMPCACHE2 0x28 #define BMPCACHE2_FLAG_PERSIST ((uint32)1<<31) @@ -389,6 +407,7 @@ enum RDP_INPUT_DEVICE #define RD_STATUS_TIMEOUT 0xc0000102 #define RD_STATUS_NOTIFY_ENUM_DIR 0xc000010c #define RD_STATUS_CANCELLED 0xc0000120 +#define RD_STATUS_DIRECTORY_NOT_EMPTY 0xc0000101 /* RDPDR constants */ @@ -415,6 +434,7 @@ enum RDP_INPUT_DEVICE #define exDiscReasonOutOfMemory 0x0006 #define exDiscReasonServerDeniedConnection 0x0007 #define exDiscReasonServerDeniedConnectionFips 0x0008 +#define exDiscReasonWindows7Disconnect 0x000b /* unofficial */ #define exDiscReasonLicenseInternal 0x0100 #define exDiscReasonLicenseNoLicenseServer 0x0101 #define exDiscReasonLicenseNoLicense 0x0102 @@ -446,3 +466,20 @@ enum RDP_INPUT_DEVICE #define SCARD_LOCK_CHANNEL 2 #define SCARD_LOCK_RDPDR 3 #define SCARD_LOCK_LAST 4 + + +/* redirect flags, from [MS-RDPBCGR] 2.2.13.1 */ +enum RDP_PDU_REDIRECT_FLAGS +{ + PDU_REDIRECT_HAS_IP = 0x1, + PDU_REDIRECT_HAS_COOKIE = 0x2, + PDU_REDIRECT_HAS_USERNAME = 0x4, + PDU_REDIRECT_HAS_DOMAIN = 0x8, + PDU_REDIRECT_HAS_PASSWORD = 0x10, + PDU_REDIRECT_DONT_STORE_USERNAME = 0x20, + PDU_REDIRECT_USE_SMARTCARD = 0x40, + PDU_REDIRECT_INFORMATIONAL = 0x80, + PDU_REDIRECT_HAS_TARGET_FQDN = 0x100, + PDU_REDIRECT_HAS_TARGET_NETBIOS = 0x200, + PDU_REDIRECT_HAS_TARGET_IP_ARRAY = 0x800 +}; diff --git a/src/VBox/RDP/client/disk.c b/src/VBox/RDP/client/disk.c index ccf59d051..3f8bd083a 100644 --- a/src/VBox/RDP/client/disk.c +++ b/src/VBox/RDP/client/disk.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Disk Redirection - Copyright (C) Jeroen Meijer 2003-2007 + Copyright (C) Jeroen Meijer <jeroen@oldambt7.com> 2003-2008 + Copyright 2003-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -369,6 +369,19 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create sprintf(path, "%s%s", g_rdpdr_device[device_id].local_path, filename); #endif + /* Protect against mailicous servers: + somelongpath/.. not allowed + somelongpath/../b not allowed + somelongpath/..b in principle ok, but currently not allowed + somelongpath/b.. ok + somelongpath/b..b ok + somelongpath/b../c ok + */ + if (strstr(path, "/..")) + { + return RD_STATUS_ACCESS_DENIED; + } + switch (create_disposition) { case CREATE_ALWAYS: @@ -493,7 +506,7 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create { error("Maximum number of open files (%s) reached. Increase MAX_OPEN_FILES!\n", handle); - exit(1); + exit(EX_SOFTWARE); } if (dirp) @@ -713,7 +726,7 @@ disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) RD_NTSTATUS disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out) { - uint32 length, file_attributes, ft_high, ft_low, delete_on_close; + uint32 length, file_attributes, ft_high, ft_low; char newname[PATH_MAX], fullpath[PATH_MAX]; struct fileinfo *pfinfo; int mode; @@ -848,12 +861,45 @@ disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM ou the delete. See http://www.osronline.com/article.cfm?article=245. */ - in_uint32_le(in, delete_on_close); + /* FileDispositionInformation always sets delete_on_close to true. + "STREAM in" includes Length(4bytes) , Padding(24bytes) and SetBuffer(zero byte). + Length is always set to zero. + [MS-RDPEFS] http://msdn.microsoft.com/en-us/library/cc241305%28PROT.10%29.aspx + - 2.2.3.3.9 Server Drive Set Information Request + */ + in_uint8s(in, 4); /* length of SetBuffer */ + in_uint8s(in, 24); /* padding */ + - if (delete_on_close || - (pfinfo-> - accessmask & (FILE_DELETE_ON_CLOSE | FILE_COMPLETE_IF_OPLOCKED))) + if ((pfinfo->accessmask & + (FILE_DELETE_ON_CLOSE | FILE_COMPLETE_IF_OPLOCKED))) { + /* if file exists in directory , necessary to return RD_STATUS_DIRECTORY_NOT_EMPTY with win2008 + [MS-RDPEFS] http://msdn.microsoft.com/en-us/library/cc241305%28PROT.10%29.aspx + - 2.2.3.3.9 Server Drive Set Information Request + - 2.2.3.4.9 Client Drive Set Information Response + [MS-FSCC] http://msdn.microsoft.com/en-us/library/cc231987%28PROT.10%29.aspx + - 2.4.11 FileDispositionInformation + [FSBO] http://msdn.microsoft.com/en-us/library/cc246487%28PROT.13%29.aspx + - 4.3.2 Set Delete-on-close using FileDispositionInformation Information Class (IRP_MJ_SET_INFORMATION) + */ + if (pfinfo->pdir) + { + DIR *dp = opendir(pfinfo->path); + struct dirent *dir; + + while ((dir = readdir(dp)) != NULL) + { + if (strcmp(dir->d_name, ".") != 0 + && strcmp(dir->d_name, "..") != 0) + { + closedir(dp); + return RD_STATUS_DIRECTORY_NOT_EMPTY; + } + } + closedir(dp); + } + pfinfo->delete_on_close = True; } @@ -1105,6 +1151,18 @@ disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) out_uint32_le(out, 0x200); /* Bytes per sector */ break; + case FileFsFullSizeInformation: + + out_uint32_le(out, stat_fs.f_blocks); /* Total allocation units low */ + out_uint32_le(out, 0); /* Total allocation units high */ + out_uint32_le(out, stat_fs.f_blocks); /* Caller allocation units low */ + out_uint32_le(out, 0); /* Caller allocation units high */ + out_uint32_le(out, stat_fs.f_bfree); /* Available allocation units */ + out_uint32_le(out, 0); /* Available allowcation units */ + out_uint32_le(out, stat_fs.f_bsize / 0x200); /* Sectors per allocation unit */ + out_uint32_le(out, 0x200); /* Bytes per sector */ + break; + case FileFsAttributeInformation: out_uint32_le(out, FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED); /* fs attributes */ @@ -1117,7 +1175,6 @@ disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) case FileFsLabelInformation: case FileFsDeviceInformation: case FileFsControlInformation: - case FileFsFullSizeInformation: case FileFsObjectIdInformation: case FileFsMaximumInformation: @@ -1144,9 +1201,13 @@ disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREA dirname = pfinfo->path; file_attributes = 0; + switch (info_class) { case FileBothDirectoryInformation: + case FileDirectoryInformation: + case FileFullDirectoryInformation: + case FileNamesInformation: /* If a search pattern is received, remember this pattern, and restart search */ if (pattern[0] != 0) @@ -1199,7 +1260,82 @@ disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREA file_attributes |= FILE_ATTRIBUTE_READONLY; /* Return requested information */ - out_uint8s(out, 8); /* unknown zero */ + out_uint32_le(out, 0); /* NextEntryOffset */ + out_uint32_le(out, 0); /* FileIndex zero */ + break; + + default: + unimpl("IRP Query Directory sub: 0x%x\n", info_class); + return RD_STATUS_INVALID_PARAMETER; + } + + switch (info_class) + { + case FileBothDirectoryInformation: + + seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, + &ft_low); + out_uint32_le(out, ft_low); /* create time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* last_access_time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_mtime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* last_write_time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_ctime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* change_write_time */ + out_uint32_le(out, ft_high); + + out_uint32_le(out, filestat.st_size); /* filesize low */ + out_uint32_le(out, 0); /* filesize high */ + out_uint32_le(out, filestat.st_size); /* filesize low */ + out_uint32_le(out, 0); /* filesize high */ + out_uint32_le(out, file_attributes); /* FileAttributes */ + out_uint32_le(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ + out_uint32_le(out, 0); /* EaSize */ + out_uint8(out, 0); /* ShortNameLength */ + /* this should be correct according to MS-FSCC specification + but it only works when commented out... */ + /* out_uint8(out, 0); *//* Reserved/Padding */ + out_uint8s(out, 2 * 12); /* ShortName (8.3 name) */ + rdp_out_unistr(out, pdirent->d_name, 2 * strlen(pdirent->d_name)); + break; + + + case FileDirectoryInformation: + + seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, + &ft_low); + out_uint32_le(out, ft_low); /* create time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* last_access_time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_mtime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* last_write_time */ + out_uint32_le(out, ft_high); + + seconds_since_1970_to_filetime(filestat.st_ctime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* change_write_time */ + out_uint32_le(out, ft_high); + + out_uint32_le(out, filestat.st_size); /* filesize low */ + out_uint32_le(out, 0); /* filesize high */ + out_uint32_le(out, filestat.st_size); /* filesize low */ + out_uint32_le(out, 0); /* filesize high */ + out_uint32_le(out, file_attributes); + out_uint32_le(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ + rdp_out_unistr(out, pdirent->d_name, 2 * strlen(pdirent->d_name)); + break; + + + case FileFullDirectoryInformation: seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, &ft_low); @@ -1223,17 +1359,20 @@ disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREA out_uint32_le(out, filestat.st_size); /* filesize low */ out_uint32_le(out, 0); /* filesize high */ out_uint32_le(out, file_attributes); - out_uint8(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ - out_uint8s(out, 7); /* pad? */ - out_uint8(out, 0); /* 8.3 file length */ - out_uint8s(out, 2 * 12); /* 8.3 unicode length */ + out_uint32_le(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ + out_uint32_le(out, 0); /* EaSize */ rdp_out_unistr(out, pdirent->d_name, 2 * strlen(pdirent->d_name)); break; + + case FileNamesInformation: + + out_uint32_le(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ + rdp_out_unistr(out, pdirent->d_name, 2 * strlen(pdirent->d_name)); + break; + + default: - /* FIXME: Support FileDirectoryInformation, - FileFullDirectoryInformation, and - FileNamesInformation */ unimpl("IRP Query Directory sub: 0x%x\n", info_class); return RD_STATUS_INVALID_PARAMETER; diff --git a/src/VBox/RDP/client/disk.h b/src/VBox/RDP/client/disk.h index 7b7136295..93fed91a2 100644 --- a/src/VBox/RDP/client/disk.h +++ b/src/VBox/RDP/client/disk.h @@ -1,12 +1,12 @@ /* rdesktop: A Remote Desktop Protocol client. Disk Redirection definitions - Copyright (C) Jeroen Meijer 2003-2007 - Copyright (C) Peter Astrand 2004-2007 + Copyright (C) Jeroen Meijer 2003-2008 + Copyright (C) Peter Astrand 2004-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/doc/AUTHORS b/src/VBox/RDP/client/doc/AUTHORS deleted file mode 100644 index e3cef4664..000000000 --- a/src/VBox/RDP/client/doc/AUTHORS +++ /dev/null @@ -1,14 +0,0 @@ -This is an attempt at a list of people who have made significant -contributions to the code. If you have been unintentionally omitted -please let one of the team members know. - -Matt Chapman <matthewc@cse.unsw.edu.au> -Peter Kallden <peter.kallden@ub.oru.se> -Hugo Trippaers <spark@ision.nl> -Jay Sorg <j@american-data.com> -Peter Åstrand <astrand@cendio.se> -Michal Mihalik <mmihalik@sme.sk> -Norbert Federa <nob@thinstuff.com> -Erik Forsberg <forsberg@cendio.se> -Michael Gernoth <michael@gernoth.net> -Jeroen Meijer <jeroen@oldambt7.com> diff --git a/src/VBox/RDP/client/doc/ChangeLog b/src/VBox/RDP/client/doc/ChangeLog deleted file mode 100644 index ab05b3bc7..000000000 --- a/src/VBox/RDP/client/doc/ChangeLog +++ /dev/null @@ -1,103 +0,0 @@ -rdesktop (1.6.0) - * Fix for crash with recent versions of X.Org - * Fix for potential vulnerability against compromised/malicious servers (reported by iDefense) - * Fix for Windows 2008 Server - * ALSA driver added - * Sound drivers can now be selected at runtime - * Smartcard support (Alexi Volkov <alexi@myrealbox.com>) - * Send physical mouse buttons rather than logical ones - - -- Matthew Chapman <matthewc@cse.unsw.edu.au> Sat, 11 May 2008 16:12:20 +1100 (AEDT) - -rdesktop (1.5.0) - * SeamlessRDP - seamless windows support - * Keymap fixes - * Fix connection issues with Windows XP RTM - * Keyboard handling improvements and fixes - * SGI/Irix sound-driver fixes - * Support for clipboard INCR protocol - * Session Directory support (patch from Brian Chapeau <lheria@users.sourceforge.net>) - * Support for long filenames on redirected drives - * XOR ellipse drawing fix - * Clipboard unicode support (Ilya Konstantinov) - * Fix display issues with exotic color depths (30bpp, 32bpp, etc) (Ilya Konstantinov) - * Large file support - * The default color depth is now the depth of the root window - * Basic support for Windows Vista Beta 2 - * Fix high cpu-usage in OSS-driver - - -- Peter Astrand <astrand@cendio.se> Wed, 13 Sep 2006 15:11:39 +0200 (CEST) - -rdesktop (1.4.1) - * persistent bitmap cache optimisations - * support for more RDP-orders (ellipse, polygon) - * libao sound-driver (for Mac OSX and others) - * Unicode support for transmitted strings/filenames - * Added korean keymap - * Xembed fixes to work with krdc correctly - * Portability fixes - * Support for RDP-compression (all bpps) - * process RDP recv queue if send queue is full (Debian bug #246461) - * SGI/Irix sound-driver fixes - - -- Michael Gernoth <michael@gernoth.net> Sun, 8 May 2005 19:55:35 +0200 (CEST) - -rdesktop (1.4.0) - * Basic disk-, parallel-, printer- and serial-redirection - * Fix timezone-redirection - * Backing-store fixes - * Fix client-IP sent to TS - * XEmbed support for embedding rdesktop in other applications (KRDC) - * Support for setting the RDP5 experience - * Keyboard and keymap fixes - * Performance improvements - * Report disconnect-reason - * Support for RDP-compression (currently only for 8bpp) - * Support for persistent bitmap caching - * Sound-driver for SGI/Irix - - -- Michael Gernoth <michael@gernoth.net> Sun, 6 Mar 2005 22:09:55 +0100 (CET) - -rdesktop (1.3.1) - * Crypto fixes for RDP5 - * Keyboard and keymap fixes - * some endianess fixes for high color - * portability enhancements - - -- Matthew Chapman <matthewc@cse.unsw.edu.au> Tue, 21 Jan 2004 20:34 - -rdesktop (1.3.0) - - * RDP5 - * 15, 16 and 24 bit color depths - * Basic clipboard redirection - * Sound - * IPv6 - * Attaching to console on Windows 2003 - - -- Peter Astrand <astrand@cendio.se> Wed, 29 Oct 2003 16:40:58 +0100 (CET) - -rdesktop (1.2.0) - - * new - more portable - key mapping code - * support for "high" (128-bit) encryption - * toggling out of full-screen mode with Ctrl-Alt-Enter - * a few extra options including host:port syntax - * many, many bug fixes and optimisations - - -- Matthew Chapman <matthewc@cse.unsw.edu.au> Thu, 30 Jan 2003 04:29 - -rdesktop (1.1.0) - - * solves arith.c licensing issue by taking big number routines from - OpenSSL - * keyboard support not merged from unified patches yet - * still no manpage - - -- Matthew Chapman <matthewc@cse.unsw.edu.au> Mon, 17 Sep 2001 23:14:28 +1000 (AEST) - -rdesktop (1.0.0) - - * initial release - - -- Matthew Chapman <matthewc@cse.unsw.edu.au> diff --git a/src/VBox/RDP/client/doc/HACKING b/src/VBox/RDP/client/doc/HACKING deleted file mode 100644 index 27d8a33b8..000000000 --- a/src/VBox/RDP/client/doc/HACKING +++ /dev/null @@ -1,45 +0,0 @@ - -Code style / indentation ------------------------- -The file indent-all.sh contains information about the current code -style. Run this script before commits. - - -Variable argument macros ------------------------- -Variable argument macros are non-portable in general, and should be -avoided. Either use a second set of parentheses like DEBUG, or create -a variable argument function like error. - - -Structure ---------- -The core protocol stack should be system-independent (i.e. ANSI C89 -only) so that it is easy to port. This currently applies to the -following files: - -bitmap.c licence.c orders.c rdp.c rdp5.c cache.c iso.c mcs.c -secure.c mppc.c channels.c -rdesktop.c - - -Compiler support ----------------- - -The source code should be compatible with ANSI C89. One exception is -the SeamlessRDP ServerEXE and ClientDLL, which should be compatible -with ANSI C99. - - -RDP resources -------------- -http://dev.remotenetworktechnology.com/refdata.htm - - -Checking for out of memory conditions -------------------------------------- -Try to handle out of memory conditions gracefully. Use the xmalloc -routines from rdesktop.c, instead of calling malloc manually. Also, -remember that several Xlib functions can return NULL. This includes -XGetImage. Use exit_if_null to verify returned pointers. - diff --git a/src/VBox/RDP/client/doc/TODO b/src/VBox/RDP/client/doc/TODO deleted file mode 100644 index 65232b356..000000000 --- a/src/VBox/RDP/client/doc/TODO +++ /dev/null @@ -1,102 +0,0 @@ -* General - - * Rework main loop to a generic event handler (i.e. move select() to - the top of the stack, not the end). Also means rewriting the connect - procedure as a state machine. - - * Stop using static objects for packets and make it more clear when it - is in use (explicit allocation and free). - -* Clipboard: - - * Support other data types than plain text. - - * Conversion between different character sets. - - -* Drive Redirection: - - * Real support for file locking - - * Handle reconnections correctly. - - * Various deficiencies; see FIXMEs in source code. - - -* Serial Port Redirection: - - * More testing needed. - - -* Printer Redirection: - - * More testing needed. - - -* Keymapping: - - -* Sound redirection - - * Use timestamps in audio packets. - - * Add resampling to supported samplerates of audio-hardware. - - * Lower CPU-usage with an audio thread. - - -* Smartcard redirection - - * Merge patches currently implementing sc-redirection. - - -* Miscellaneous - - * Clean up header files. The current "proto.h" and "xproto.h" is far - from optimal. - - * Go through the many trackers (bugs/patches/RFEs) at SourceForge. - - * More fancy homepage. - - * Enhance documentation. Write a FAQ. - - -* SeamlessRDP mode - - * Add a client to server message for starting additional - applications. - - * Support cmd.exe. - - * Support for Input Contexts. - - * Enhanced support for WM_DELETE_WINDOW: Instead of terminating - rdesktop, close the window on the server side. - - * Systray support. - - * Better support for non-EWMH window managers. - - * Support for non-rectangular windows. - - * The focus handling of menus is a bit crude. - - * Support for sending focus information from client to server. - - * Implement something similiar to explhook.dll - support for running - explorer.exe in non-shell mode. - - * Better compatibility with Task Manager. - - * XINERAMA support. - - * When enumerating windows, make sure to send info about windows - that are transient for other windows after the referred window. - - * We support topmost windows at creating time, but we do not detect - when this property is added or removed. This can be verified with - task manager, which has an "Always on top" option. - - * Window icons are not set when reconnecting. get_icon/update_icon - needs to be called from enum_cb. diff --git a/src/VBox/RDP/client/doc/ipv6.txt b/src/VBox/RDP/client/doc/ipv6.txt deleted file mode 100644 index 1d3ef2341..000000000 --- a/src/VBox/RDP/client/doc/ipv6.txt +++ /dev/null @@ -1,29 +0,0 @@ - -IPv6 support in rdesktop -======================== -The IPv6 support was developed by Mike Dawson <mike@dexy.mine.nu>: - - Attached is a patch to tcp.c to enable IPv6 support. Build with - 'IPv6' defined to enable it. It's so far only been tested on - Linux 2.4.21 connecting to Windows XP SP1. - - Since terminal services doesn't seem to bind to the ipv6 interface - on XP I had to run 'netsh interface portproxy add v6tov4 - listenport=3389 connectport=3389' from the windows command prompt - to get it to work. - - -rdesktop now supports numeric IPv6 addresses: - - It checks for two or more colons in an address to decide what it's - dealing with so you can now do: - - rdesktop 2001:1:2:3::4 - - without it getting confused with an ipv4:port specification. I've - also followed the square bracket convention used by browsers - (http://www.ietf.org/rfc/rfc2732.txt) so if you want to specify a - non-standard port with an ipv6 address you can use the format: - - rdesktop [2001:1:2:3::4]:3390 - diff --git a/src/VBox/RDP/client/doc/keymap-names.txt b/src/VBox/RDP/client/doc/keymap-names.txt deleted file mode 100644 index 3da698b29..000000000 --- a/src/VBox/RDP/client/doc/keymap-names.txt +++ /dev/null @@ -1,124 +0,0 @@ - -0x0436 af Afrikaans -0x041C sq Albanian -0x0001 ar Arabic -0x0401 ar-sa Arabic (Saudi Arabia) -0x0801 ar-iq Arabic (Iraq) -0x0C01 ar-eg Arabic (Egypt) -0x1001 ar-ly Arabic (Libya) -0x1401 ar-dz Arabic (Algeria) -0x1801 ar-ma Arabic (Morocco) -0x1C01 ar-tn Arabic (Tunisia) -0x2001 ar-om Arabic (Oman) -0x2401 ar-ye Arabic (Yemen) -0x2801 ar-sy Arabic (Syria) -0x2C01 ar-jo Arabic (Jordan) -0x3001 ar-lb Arabic (Lebanon) -0x3401 ar-kw Arabic (Kuwait) -0x3801 ar-ae Arabic (U.A.E.) -0x3C01 ar-bh Arabic (Bahrain) -0x4001 ar-qa Arabic (Qatar) -0x042D eu Basque -0x0402 bg Bulgarian -0x0423 be Belarusian -0x0403 ca Catalan -0x0004 zh Chinese -0x0404 zh-tw Chinese (Taiwan) -0x0804 zh-cn Chinese (China) -0x0C04 zh-hk Chinese (Hong Kong SAR) -0x1004 zh-sg Chinese (Singapore) -0x041A hr Croatian -0x0405 cs Czech -0x0406 da Danish -0x0413 nl Dutch (Netherlands) -0x0813 nl-be Dutch (Belgium) -0x0009 en English -0x0409 en-us English (United States) -0x0809 en-gb English (United Kingdom) -0x0C09 en-au English (Australia) -0x1009 en-ca English (Canada) -0x1409 en-nz English (New Zealand) -0x1809 en-ie English (Ireland) -0x1C09 en-za English (South Africa) -0x2009 en-jm English (Jamaica) -0x2809 en-bz English (Belize) -0x2C09 en-tt English (Trinidad) -0x0425 et Estonian -0x0438 fo Faeroese -0x0429 fa Farsi -0x040B fi Finnish -0x040C fr French (France) -0x080C fr-be French (Belgium) -0x0C0C fr-ca French (Canada) -0x100C fr-ch French (Switzerland) -0x140C fr-lu French (Luxembourg) -0x043C gd Gaelic -0x0407 de German (Germany) -0x0807 de-ch German (Switzerland) -0x0C07 de-at German (Austria) -0x1007 de-lu German (Luxembourg) -0x1407 de-li German (Liechtenstein) -0x0408 el Greek -0x040D he Hebrew -0x0439 hi Hindi -0x040E hu Hungarian -0x040F is Icelandic -0x0421 in Indonesian -0x0410 it Italian (Italy) -0x0810 it-ch Italian (Switzerland) -0x0411 ja Japanese -0x0412 ko Korean -0x0426 lv Latvian -0x0427 lt Lithuanian -0x042F mk FYRO Macedonian -0x043E ms Malay (Malaysia) -0x043A mt Maltese -0x0414 no Norwegian (Bokmal) -0x0814 no Norwegian (Nynorsk) -0x0415 pl Polish -0x0416 pt-br Portuguese (Brazil) -0x0816 pt Portuguese (Portugal) -0x0417 rm Rhaeto-Romanic -0x0418 ro Romanian -0x0818 ro-mo Romanian (Moldova) -0x0419 ru Russian -0x0819 ru-mo Russian (Moldova) -0x0C1A sr Serbian (Cyrillic) -0x081A sr Serbian (Latin) -0x041B sk Slovak -0x0424 sl Slovenian -0x042E sb Sorbian -0x040A es Spanish (Traditional Sort) -0x080A es-mx Spanish (Mexico) -0x0C0A es Spanish (International Sort) -0x100A es-gt Spanish (Guatemala) -0x140A es-cr Spanish (Costa Rica) -0x180A es-pa Spanish (Panama) -0x1C0A es-do Spanish (Dominican Republic) -0x200A es-ve Spanish (Venezuela) -0x240A es-co Spanish (Colombia) -0x280A es-pe Spanish (Peru) -0x2C0A es-ar Spanish (Argentina) -0x300A es-ec Spanish (Ecuador) -0x340A es-cl Spanish (Chile) -0x380A es-uy Spanish (Uruguay) -0x3C0A es-py Spanish (Paraguay) -0x400A es-bo Spanish (Bolivia) -0x440A es-sv Spanish (El Salvador) -0x480A es-hn Spanish (Honduras) -0x4C0A es-ni Spanish (Nicaragua) -0x500A es-pr Spanish (Puerto Rico) -0x0430 sx Sutu -0x041D sv Swedish -0x081D sv-fi Swedish (Finland) -0x041E th Thai -0x0431 ts Tsonga -0x0432 tn Tswana -0x041F tr Turkish -0x0422 uk Ukrainian -0x0420 ur Urdu -0x042A vi Vietnamese -0x0434 xh Xhosa -0x043D ji Yiddish -0x0435 zu Zulu - diff --git a/src/VBox/RDP/client/doc/keymapping.txt b/src/VBox/RDP/client/doc/keymapping.txt deleted file mode 100644 index 7d5a8515d..000000000 --- a/src/VBox/RDP/client/doc/keymapping.txt +++ /dev/null @@ -1,259 +0,0 @@ -Keyboard mapping -================ -This release of rdesktop uses a new, portable keyboard mapping -implementation. It should hopefully work on all X11 systems. This new -implementation only looks at X11 keysyms: Not on (nonportable) -keycodes or modifier status. This means that rdesktop will obey your -local keyboard configuration. For example, if you have swapped -CapsLock and Control, rdesktop will use this mapping. - -XKB is currently not used. It seems like a good idea to me, but since -some X servers (like Xvnc) does not support XKB, we still need to use -the plain old interface as well, at least. - -There are still some small problems. - -* CapsLock: CapsLock changes are never sent to the RDP - server. rdesktop does not know which keys that are modified by - CapsLock and which are not. So, the CapsLock indicator in Wordpad - etc will always be off. - -Composing/Multi_key is supported. For more information, see: - - MIT: $SRC/xc/nls/X11/locale/Compose/iso8859-1 - XFree86: /usr/X11R6/lib/X11/locale/*/Compose - Solaris' Openwin: /usr/openwin/include/X11/Suncompose.h - /usr/openwin/lib/locale/*/Compose - Irix6: compose(5) - - -Keymap files -============ -The names of the keymaps follows RFC1766. - -(You can find a translation from Windows keyboard layout numbers to -keymap names by looking at -HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\RFC1766 in the -registry.) - - -Contents of keymap files -======================== -The keymaps are line based. There are four different types of lines: - -1) include lines -Syntax: -include <another-map-file> - -Example: -include common - - -2) map lines -Syntax: -map <hex-number> - -Example: -map 0x41d - -Map-lines specifies how the remote RDP server should interpret the -sent scancodes. - - -3) Translation lines -Syntax: -<keysym-name> <scancode> [flags..] - -Example: -onehalf 0x29 shift - -The scancode can be found in scancodes.h. Note: The scancode value for -extended keys can be calculated by OR:ing with 0x80. Example: The -Delete key have the scancode sequence 0xe0, 0x52. You can get the -scancode value to put into the map file by running: - -python -c "print hex(0x80 | 0x52)" - -If flags are "altgr", "shift", the scancode sent for this keysym will -be prefixed with AltGr, or Shift. - -If flags includes "addupper", a translation for this keysyms uppercase -name will be added as well, in addition to the non-uppercase -name. Example: - -x 2d addupper - -...will add an translation for "X" automatically, just like if you -would specify: - -X 2d shift - -If flags include "localstate", the modifier to send will be determined -by the local modifier state. - -If flags is "inhibit", nothing will be sent to the server. - -If flags is "numlock", rdesktop will make sure that the remote NumLock -state is on before generating the key event. Otherwise, it will make -sure NumLock is off. - - -4) enable_compose - -If any line starts with the keyword "enable_compose", rdesktop will -enable local Compose/Multi_key handling. Enabling this will often make -it impossible to compose characters with dead keys (on the remote -side). This is because when local compose support is enabled, dead -keys will not be sent to the remote side. - - -5) sequence lines -Syntax: -sequence <event-keysym-name> <keysym-name1> <keysym-name2> ... - -Examples: -sequence eacute dead_acute e -sequence F12 f o o at e x a m p l e period c o m - -Sequence lines allows you to specify that multiple scancodes should be -sent to the RDP server, in response to one X11 keyboard event. Note: -The sequence is sent at the X11 KeyPress event. Nothing is sent at -KeyRelease. - - -6) keyboard_type lines -Syntax: -keyboard_type <hex-number> - -keyboard_type lines specifies the keyboard type. Default value is 0x4 -(en-us 101/104 keys keyboard). - - -7) keyboard_subtype lines -Syntax: -keyboard_subtype <hex-number> - -keyboard_subtype lines specifies the keyboard subtype. Default value -is 0x0 (en-us 101/104 keys keyboard). - - -8) keyboard_functionkeys lines -Syntax: -keyboard_functionkeys <hex-number> - -keyboard_functionkeys specifies the number of keyboard function -keys. Default value is 0xc (12, for standard 101/104 keys keyboard). - - - - -Suggested X11 keysym mapping on PCs -=================================== -Unfortunately, there is no standard for which keysyms a given key -should generate. If you have a PC-keyboard with Windows keys, I suggest this mapping: - -Keyboard keys: -CtrlLeft WinLeft AltLeft Space AltGr WinRight Menu CtrlRight - -...should generate keysyms: -Control_L Super_L Alt_L space Mode_switch Super_R Menu Control_R - -Additionally: -Shift-Alt should produce Meta_L -Shift-AltGr should produce Multi_Key. - -Use a modifier-map like this: - -shift Shift_L (0x32), Shift_R (0x3e) -lock Caps_Lock (0x25) -control Control_L (0x42), Control_R (0x6d) -mod1 Alt_L (0x40) -mod2 Num_Lock (0x4d) -mod3 Mode_switch (0x71) -mod4 Super_L (0x73), Super_R (0x74) -mod5 Scroll_Lock (0x4e) - - -Updating / writing keymap files -=============================== -When writing new or updating keymap files, please use comments and -blanks, to increase readability. The "sv" keymap is a good template. - -When you need to add a translation to a keymap file, do: - - 1. Get the "key number" for this key, by looking at keynums.png. - - 2. Take a look at scancodes.h, and look for - SCANCODE_KEY_<my-key-number>. The scancode value is at the end of - the line. If the line contains (SCANCODE_EXTENDED | 0xsomething), - then you should OR 0x80 to this value. For example, you can do: - - python -c "print hex(0x80 | 0xsomething)" - - 3. Put the scancode (from step 2) and keysym name (found in the - error message) into the keymap file. - - -Special keys -============ - -* The combination Ctrl-Alt-Enter toggles between fullscreen and - non-fullscreen mode. - -* Meta, Hyper and Super are treated as windows keys. RDP4 does not - support the windows keys though, so if you are running RDP4, these - keys will translate to Ctrl-Esc. - - -Links -===== -http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html - - -Test cases -========== -When changing the keyboard code, make sure all these tests in Notepad -works: - -1. Ctrl+f should bring up Find dialog, with CapsLock both on and off. - -2. Ctrl+Shift+arrows should mark text, with CapsLock both on and off. - -3. Test a sequence, like egrave. - -4. Test a char generated with AltGr, such as @ on a swedish keyboard. - -5. Test Ctrl-Alt-Delete. - -6. Ctrl-Alt-Enter should toggle fullscreen. - -7. Test NumLock synchronization using the -N option. Excel is able to - indicate the current NumLock state. Verify that the status is - updated correctly on reconnects. - -8. Test the Windows keys, standalone as well as in combination with, - say, E. - -9. Make sure the system menu (via Alt-space) cannot be accessed in - single app mode. - -10. Make sure keymaps can be loaded from ~/.rdesktop/keymaps, - KEYMAP_PATH, $CWD/keymaps, and from an absolute path. - -11. Press Shift, then press a key modified by shift, the release - shift, then release the other key. Do this in a speedy fasion. - Make sure the shift state is not stuck down. - -12. Test all numpad keys, when not using the -N option. - -13. Map a single, un-shifted key (such as F1) to XK_A: - xmodmap -e "keycode 67 = A A" - - Perform in Notepad: - * Write some text - * Press F1 - * Press b - * Release b - * Release F1 - - Verify that shift is not stuck down, by clicking on the text. diff --git a/src/VBox/RDP/client/doc/licensing.txt b/src/VBox/RDP/client/doc/licensing.txt deleted file mode 100644 index 1bf6b0c33..000000000 --- a/src/VBox/RDP/client/doc/licensing.txt +++ /dev/null @@ -1,56 +0,0 @@ - -To be able to connect to Microsoft Windows 2000 Terminal Services (and -probably later versions), you'll need to deal with licensing. This is -complicated. This file is supposed to contain some information about -how rdesktop works with Microsofts license systems. - -There's a lot of information on the MS web site, for example, -http://support.microsoft.com/default.aspx?scid=kb;EN-US;287687. - -From the rdesktop mailing list: - -Peter Åstrand <astrand@cendio.se>, 2003-02-06 - -> We are running rdesktop 1.2 on machine A and connects to a Windows 2000 -> Server (machine B). The W2K machine has 5 real licenses installed ("Windows -> 2000 Terminal Services Client Access License", "Open" type). This can be -> verifier by using "Terminal Services Licensing". The problem is that all -> issued licenses have an expire-date. The expire date for the license issued -> to A was reached today, and no more connections could be made until we -> changed the client name (by using -n). -> -> We also have another similiar systems, with Linux machine C and W2K server -> D. This server has 200 licenses installed of the type "Select". On this -> server, the issued licenses seems to be permanent: The expire date is set -> to "-", and we have no problem with this system. -> -> The question of course is why the first system issues license with -> expiration date, while the second system issues permanent licenses. - - -Darryn Capes-Davis, 2003-02-07 - -> I have been through the problems and can tell you what is going -> on. The main difference of Machine B (Server 1) and Machine D (Server -> 2) is that from what I see Machine B has Service Pack 3 installed and -> Machine D does not. You see in Service Pack 3 there was a change made -> to TS Licencing in that Microsoft introduced a licence recovery -> mechanism. To cut to the point (I don't know the details) rdesktop 1.2 -> with SAVE_LICENCE defined works fine. In the new lic method the -> terminal server expects a valid licence to be presented to renew -> it. Otherwise it just expires it - and a day later you will see it -> actually gone (it does housekeeping once a day)! So if SAVE_LICENCE -> code is not enabled then it just expires and you can't use the licence -> until it cleans it away - and this is where a little gotcha is - if -> you move from using an rdesktop without SAVE_LICENCE to one with -> SAVE_LICENCE then it still won't recover an 'expired' licence. You -> have to wait for the daily housekeeping to clean it up - this really -> had me going for half a day or so! This is exactly what happened to -> you. -> -> The Server pre Spk 3 has the old model where licences never expire. To -> recover a licence that you never wanted to use again you have to call -> the Microsoft Clearing House. That's why they introduced the new -> method. And if you upgrade a Pre Spk3 server to Spk3 then the licences -> granted still stay with the old method - only new licences granted -> will use the new expiry method. diff --git a/src/VBox/RDP/client/doc/patches.txt b/src/VBox/RDP/client/doc/patches.txt deleted file mode 100644 index 08ffe59f7..000000000 --- a/src/VBox/RDP/client/doc/patches.txt +++ /dev/null @@ -1,340 +0,0 @@ -This file documents some of all patches for rdesktop, floating around -the net, and how they are related to the current (CVS) version of -rdesktop. Things left to do are marked with TBD (To Be Done). - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/Makefile.diff -Description: -Makefile changes which makes it possible to compile rdesktop on SunOS -and OSF1. -Status: -Applied (slightly modified) - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/assar_19-7-2.hostlen.patch -Description: -Fix for hostnames longer than 30 chars. -Status: -Applied (revision 1.11 of secure.c) - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/backingstore+privatecolormap-for-19-3-9.patch -Description: -This adds support for 1) Private color maps (useful for 8 bpp mode) -and 2) backingstore selection. -Status: -1) is not needed anymore; rdesktop automatically uses Private color -map in 8 bpp mode. 2) is, as far as I understand, also not -need. rdesktop automatically uses a software backing store if the -Xserver does not provide one. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/ben_xwin.c.diff -Description: -Fixes for CapsLock and NumLock. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/ctrl1nohang.diff -Description: -Fixes problem with ctrl1 hangs. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/downkeypatch.diff -Description: -Seems to keep track of the remote modifier status. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/fasttext2+nobackpixmap.patch -Description: -(From http://mail.rdesktop.org/archive/2001/msg00218.html): - -1) Added --no-backpixmap option to disable the ugly double drawing in -xwin.c (I have a very robust backing storage in my X, so I don't need -it ;) - -2) More optimizations to text draw (previous fast-text patch was -included in 192-3-6-2). In text drawing with solid background the -glyphs are drawn with stippled fill instead of XCopyPlane (runs faster -on my S3Trio64 with XFree 3.3.6, please test it on other -configurations to validate this). The WinTach not show any improvement -with this change, it seems to use all transparent background text -draws, but with a old PC Magazine Winbench (3.1) doing the scroll text -test the speed gain is significative. - -3) My Previous patch to disable backing storage in fullscreen - -Status: -1) is not relevant any more, since rdesktop only uses backing store if -the Xserver does not provide backing store. -Need to examine if 2) and 3) are still useful. TBD. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/francisco_fix_patblt.html -Description: -The colors in patterns drawn with "pattern blt" order was inverted (fg -& bg). (See the background of the yellow help banners) -Status: -Applied (in revision 1.29, 2002/07/14) - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/frank_1linerfix.html -Description: -ui_create_glyph was not called with ipattern. -Status: -Applied (in revision 1.29, 2002/07/14). - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/frank_fasttext.patch.txt -Description: -Some kind of performence improvements. -Status: -From what I can tell, this patch is no longer necessary. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/hostname-patch -Description: -(From http://mail.rdesktop.org/archive/2001/msg00163.html): - -rdesktop uses gethostname to figure out the hostname, but gethostname -under linux returns an error when the hostname is longer than the -buffer. This hack gives gethostname a 64 char buffer and then strips -the first 16 chars or upto the first '.' and puts the result in -hostname[16]. - -Status: -Applied in version 1.10 of rdesktop.c. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/hove-19-7-2endian.diff -Description: -Includes a program for testing endianness. -Status: -rdesktop determines endianness at runtime. This patch is not needed -anymore. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/mmihalik_19-7-3-keyfix-4.patch -Description: -Some kind of new alternative keyboard mapping imlementation. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_fullscreen.patch -Description: -Fullscreen mode. -Status: -Applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_percent.txt -Description: -Makes is possible to specify RDP geometry based a percent value of the -current desktop size. -Status: -Not applied. I don't think many people will need this. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_rdp_tcp_port.diff -Description: -Command line tcp port argument. -Status: -Applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/patch19-7-2.xyPos.emptyPassword.patch -Description: -This patch adds: -1) Support for empty passwords -2) Support for asking for password interactively -3) Support for +<xoff>+<yoff> geometry. - -Status: -1) and 2) can be solved by the -P parameter; patch not needed. -Functionality for 3) is currently missing. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-19-7-1-mmihalik-3.diff -Description: -Defines DO_GLYPH() etc. -Status: -As far as I understand, this patch is applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-mmihalik-1.diff -Description: -Misc drawing changes. -Status: -As far as I understand, this patch is applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-pl19-7-2-mmihalik-1.diff -Description: -Some kind of new alternative keyboard mapping implementation. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-gmp.patch -Description: -Use GMP for RSA crypto. -Status: -Not needed since rdesktop now use OpenSSL for all of the crypto. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-new_kb.patch -Description: -Modifies one of the old keyboard mapping implementations in some way. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-openssl.patch -Description: -Support for linking rdesktop with OpenSSL. -Status: -Not needed anymore, rdesktop can optionally use system -OpenSSL. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop.vncviewer_patch -Description: -Hack for making the old (broken) keyboard mapping implementation work -with the VNC Xserver. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop_keymap.patch -Description: -Some kind of new alternative keyboard mapping implementation. -Status: -Not needed anymore, with the new keyboard mapping implementation. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdp-srvr-19-6-6.diff -Description: -Basic RDP server. -Status: -Not applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/scroll-to-death-patch.txt -Description: -Fixes scroll-to-death problem in Excel and other applications. -Status: -Not needed; fixed in another way in recent versions of rdesktop. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark-manpage-patch-19.4 -Description: -Adds a manual page. -Status: -Not needed; rdesktop contains a manual page now. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark-manpage-patch-19.4-1 -Description: -Adds a manual page. -Status: -Not needed; rdesktop contains a manual page now. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark_xinerama-patch2 -Description: -Adds XINERAMA support to rdesktop. -Status: -Not applied yet. TBD. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/svenni_dis_wmkeybnds.patch -Description: -Commandline flag to disable keyboard grabbing. -Status: -Applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/svenni_disable_bs_in_x-tiny-patch -Description: -Disables backing store for TinyX. -Status: -As far as I understand, this patch is not need any longer. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-2.license.patch -Description: -TBD -Status: -Not yet examined. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-2.secure.patch -Description: -Fixes a problem during the connection to a French NT4 TSE (a French -NT4 TSE doesn't use encryptation). -Status: -Applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-3_excel.patch -Description: -Makes matrixes appear better, such as those found in Excel/toad etc. -Status: -Applied. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_8bpp.patch -Description: -Support a 8bpp display (256 colours). -Status: -An enhanced version is included in rdesktop; this patch is not needed any more. - - -URL: -http://bibl4.oru.se/projects/rdesktop/patch19/patches/vpypatch.txt -Description: -Various changes for one of the old keyboard stuff. -Status: -Not needed anymore, with the new keyboard mapping implementation. diff --git a/src/VBox/RDP/client/doc/rdesktop.1 b/src/VBox/RDP/client/doc/rdesktop.1 deleted file mode 100644 index 68f213968..000000000 --- a/src/VBox/RDP/client/doc/rdesktop.1 +++ /dev/null @@ -1,228 +0,0 @@ -.TH rdesktop 1 "November 2005" -.SH NAME -.I rdesktop -\- Remote Desktop Protocol client -.SH SYNOPSIS -.B rdesktop [options] server[:port] -.br -.SH DESCRIPTION -.I rdesktop -is a client for Remote Desktop Protocol (RDP), used in a number of Microsoft -products including Windows NT Terminal Server, Windows 2000 Server, Windows XP -and Windows 2003 Server. - -.SH OPTIONS -.TP -.BR "-u <username>" -Username for authentication on the server. -.TP -.BR "-d <domain>" -Domain for authentication. -.TP -.BR "-s <shell>" -Startup shell for the user - starts a specific application instead of Explorer. -.TP -.BR "-c <directory>" -The initial working directory for the user. Often used in combination with -s -to set up a fixed login environment. -.TP -.BR "-p <password>" -The password to authenticate with. Note that this may have no effect if -"Always prompt for password" is enabled on the server. WARNING: if you specify -a password on the command line it may be visible to other users when they use -tools like ps. Use -p - to make rdesktop request a password at startup (from -standard input). -.TP -.BR "-n <hostname>" -Client hostname. Normally rdesktop automatically obtains the hostname of the -client. -.TP -.BR "-k <keyboard-map>" -Keyboard layout to emulate. This requires a corresponding keymap file to be -installed. The standard keymaps provided with rdesktop follow the RFC1766 -naming scheme: a language code followed by a country code if necessary - e.g. -en-us, en-gb, de, fr, sv, etc. - -The default keyboard map depends on the current locale (LC_* and LANG -environment variables). If the current locale is unknown, the default -keyboard map is en-us (a US English keyboard). - -The keyboard maps are file names, which means that they are case -sensitive. The standard keymaps are all in lowercase. - -The keyboard maps are searched relative to the directories -$HOME/.rdesktop/keymaps, KEYMAP_PATH (specified at build time), and -$CWD/keymaps, in this order. The keyboard-map argument can also be an -absolute filename. - -The special value `none' can be used instead of a keyboard map. -In this case, rdesktop will guess the scancodes from the X11 event key -codes using an internal mapping method. This method only supports the -basic alphanumeric keys and may not work properly on all platforms -so its use is discouraged. -.TP -.BR "-g <geometry>" -Desktop geometry (WxH). If geometry is the special word "workarea", the geometry -will be fetched from the extended window manager hints property _NET_WORKAREA, from -the root window. The geometry can also be specified as a percentage of the whole -screen, e.g. "-g 80%". -.TP -.BR "-f" -Enable fullscreen mode. This overrides the window manager and causes the -rdesktop window to fully cover the current screen. Fullscreen mode can be -toggled at any time using Ctrl-Alt-Enter. -.TP -.BR "-b" -Force the server to send screen updates as bitmaps rather than using -higher-level drawing operations. -.TP -.BR "-A" -Enable SeamlessRDP. In this mode, rdesktop creates a X11 window for -each window on the server side. This mode requires the SeamlessRDP -server side component, which is available from -\fIhttp://www.cendio.com/seamlessrdp/\fR. -When using this option, you should specify a startup shell which -launches the desired application through SeamlessRDP. - -Example: rdesktop -A -s 'seamlessrdpshell notepad'. -.TP -.BR "-B" -Use the BackingStore of the Xserver instead of the integrated one in -rdesktop. -.TP -.BR "-e" -Disable encryption. This option is only needed (and will only work) if you -have a French version of NT TSE. -.TP -.BR "-E" -Disable encryption from client to server. This sends an encrypted login packet, -but everything after this is unencrypted (including interactive logins). -.TP -.BR "-m" -Do not send mouse motion events. This saves bandwidth, although some Windows -applications may rely on receiving mouse motion. -.TP -.BR "-C" -Use private colourmap. This will improve colour accuracy on an 8-bit display, -but rdesktop will appear in false colour when not focused. -.TP -.BR "-D" -Hide window manager decorations, by using MWM hints. -.TP -.BR "-K" -Do not override window manager key bindings. By default rdesktop attempts -to grab all keyboard input when it is in focus. -.TP -.BR "-S <button size>" -Enable single application mode. This option can be used when running a -single, maximized application (via -s). When the minimize button of -the windows application is pressed, the rdesktop window is minimized -instead of the remote application. The maximize/restore button is -disabled. For this to work, you must specify the correct button -size, in pixels. The special word "standard" means 18 pixels. -.TP -.BR "-T <title>" -Sets the window title. The title must be specified using an UTF-8 string. -.TP -.BR "-N" -Enable numlock syncronization between the Xserver and the remote RDP -session. This is useful with applications that looks at the numlock -state, but might cause problems with some Xservers like Xvnc. -.TP -.BR "-X <windowid>" -Embed rdesktop-window in another window. The windowid is expected to -be decimal or hexadecimal (prefixed by 0x). -.TP -.BR "-a <bpp>" -Sets the colour depth for the connection (8, 15, 16 or 24). -More than 8 bpp are only supported when connecting to Windows XP -(up to 16 bpp) or newer. Note that the colour depth may also be -limited by the server configuration. The default value is the depth -of the root window. -.TP -.BR "-z" -Enable compression of the RDP datastream. -.TP -.BR "-x <experience>" -Changes default bandwidth performance behaviour for RDP5. By default only -theming is enabled, and all other options are disabled (corresponding -to modem (56 Kbps)). Setting experience to b[roadband] enables menu -animations and full window dragging. Setting experience to l[an] will -also enable the desktop wallpaper. Setting experience to m[odem] -disables all (including themes). Experience can also be a hexidecimal -number containing the flags. -.TP -.BR "-P" -Enable caching of bitmaps to disk (persistent bitmap caching). This generally -improves performance (especially on low bandwidth connections) and reduces -network traffic at the cost of slightly longer startup and some disk space. -(10MB for 8-bit colour, 20MB for 15/16-bit colour and 30MB for 24-bit colour -sessions) -.TP -.BR "-r <device>" -Enable redirection of the specified device on the client, such -that it appears on the server. Note that the allowed -redirections may be restricted by the server configuration. - -Following devices are currently supported: -.TP -.BR "-r comport:<comport>=<device>,..." -Redirects serial devices on your client to the -server. Note that if you need to change any settings on the serial device(s), -do so with an appropriate tool before starting rdesktop. In most -OSes you would use stty. Bidirectional/Read support requires Windows XP or newer. -In Windows 2000 it will create a port, but it's not seamless, most -shell programs will not work with it. -.TP -.BR "-r disk:<sharename>=<path>,..." -Redirects a path to the share \\\\tsclient\\<sharename> on the server -(requires Windows XP or newer). The share name is limited to 8 -characters. -.TP -.BR "-r lptport:<lptport>=<device>,..." -Redirects parallel devices on your client to the server. -Bidirectional/Read support requires Windows XP or newer. In Windows 2000 -it will create a port, but it's not seamless, most shell programs will not work with -it. -.TP -.BR "-r printer:<printername>[=<driver>],..." -Redirects a printer queue on the client to the server. The <printername> -is the name of the queue in your local system. <driver> defaults to a -simple PS-driver unless you specify one. Keep in mind that you need a -100% match in the server environment, or the driver will fail. The first -printer on the command line will be set as your default printer. -.TP -.BR "-r sound:[local|off|remote]" -Redirects sound generated on the server to the client. "remote" only has -any effect when you connect to the console with the -0 option. (Requires -Windows XP or newer). -.TP -.BR "-r lspci" -Activates the lspci channel, which allows the server to enumerate the -clients PCI devices. See the file lspci-channel.txt in the -documentation for more information. -.TP -.BR "-r scard[:<Scard Name>=<Alias Name>[;<Vendor Name>][,...]]" -Enables redirection of one or more smart-cards. You can provide -static name binding between linux and windows. To do this you -can use optional parameters as described: <Scard Name> - device name in -Linux/Unix enviroment, <Alias Name> - device name shown in Windows enviroment -<Vendor Name> - optional device vendor name. For list of examples run -rdesktop without parameters. -.TP -.BR "-0" -Attach to the console of the server (requires Windows Server 2003 -or newer). -.TP -.BR "-4" -Use RDP version 4. -.TP -.BR "-5" -Use RDP version 5 (default). -.PP -.SH LINKS -Main website of rdesktop -.br -\fIhttp://www.rdesktop.org/ -.LP -.PP diff --git a/src/VBox/RDP/client/doc/redirection.txt b/src/VBox/RDP/client/doc/redirection.txt deleted file mode 100644 index 026504501..000000000 --- a/src/VBox/RDP/client/doc/redirection.txt +++ /dev/null @@ -1,74 +0,0 @@ - -Syntax for configuring RDP redirection modules -============================================== - -General -------- - -All redirection is configured using the -r option. The general syntax -is: - --r <module>:<string> - -<module> is the name of the redirection module. The following names -are valid: disk, printer, lptport, comport, clipboard, sound. - -<string> is interpreted by each redirection module. - -The redirection modules are described below. - - -disk mapping -------------- -Multiple mappings possible: yes -Default: no disk redirected -Syntax: -r disk:<sharename>=<path> -Example: -r disk:home=/home/johndoe - - -printer mapping ---------------- -Multiple mappings possible: yes -Default: no printers redirected -Syntax: -r printer:<printername> -Example: -r printer:mydeskjet - - - -LPT port mapping ----------------- -Multiple mappings possible: yes -Default: no LPT ports redirected -Syntax: -r lptport:<lptport>=<device> -Example: -r lptport:LPT1=/dev/lp0 - - -COM port mapping ----------------- -Multiple mappings possible: yes -Default: no COM ports redirected -Syntax: -r comport:<comport>=<device> -Example: -r comport:COM1=/dev/ttyS0 - - -clipboard mapping ------------------ -Multiple mappings possible: no -Default: yes -Syntax: -r clipboard:[yes|no] -Example: -r clipboard:no - - -sound mapping -------------- -Multiple mappings possible: no -Default: off -Syntax: -r sound:[local|off|remote] - -"local" means "Bring to this computer" -"off" means "Do not play" -"remote" means "Leave at remote computer" - -Example: -r sound:remote - - diff --git a/src/VBox/RDP/client/ewmhints.c b/src/VBox/RDP/client/ewmhints.c index 308c649a1..03f614010 100644 --- a/src/VBox/RDP/client/ewmhints.c +++ b/src/VBox/RDP/client/ewmhints.c @@ -4,22 +4,21 @@ Support functions for Extended Window Manager Hints, http://www.freedesktop.org/wiki/Standards_2fwm_2dspec - Copyright 2005 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -144,7 +143,7 @@ get_current_workarea(uint32 * x, uint32 * y, uint32 * width, uint32 * height) int current_desktop; unsigned long nitems_return; unsigned char *prop_return; - uint32 *return_words; + long *return_words; const uint32 net_workarea_x_offset = 0; const uint32 net_workarea_y_offset = 1; const uint32 net_workarea_width_offset = 2; @@ -167,7 +166,7 @@ get_current_workarea(uint32 * x, uint32 * y, uint32 * width, uint32 * height) if (current_desktop < 0) return -1; - return_words = (uint32 *) prop_return; + return_words = (long *) prop_return; *x = return_words[current_desktop * 4 + net_workarea_x_offset]; *y = return_words[current_desktop * 4 + net_workarea_y_offset]; @@ -441,15 +440,15 @@ ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) { unsigned long nitems, i; unsigned char *props; - uint32 *cur_set, *new_set; - uint32 *icon; + unsigned long *cur_set, *new_set; + unsigned long *icon; cur_set = NULL; new_set = NULL; if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) >= 0) { - cur_set = (uint32 *) props; + cur_set = (unsigned long *) props; for (i = 0; i < nitems;) { @@ -463,15 +462,15 @@ ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) icon = cur_set + i; else { - new_set = xmalloc((nitems + width * height + 2) * 4); - memcpy(new_set, cur_set, nitems * 4); + new_set = xmalloc((nitems + width * height + 2) * sizeof(unsigned long)); + memcpy(new_set, cur_set, nitems * sizeof(unsigned long)); icon = new_set + nitems; nitems += width * height + 2; } } else { - new_set = xmalloc((width * height + 2) * 4); + new_set = xmalloc((width * height + 2) * sizeof(unsigned long)); icon = new_set; nitems = width * height + 2; } @@ -503,7 +502,7 @@ ewmh_del_icon(Window wnd, int width, int height) { unsigned long nitems, i, icon_size; unsigned char *props; - uint32 *cur_set, *new_set; + unsigned long *cur_set, *new_set; cur_set = NULL; new_set = NULL; @@ -511,7 +510,7 @@ ewmh_del_icon(Window wnd, int width, int height) if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) < 0) return; - cur_set = (uint32 *) props; + cur_set = (unsigned long *) props; for (i = 0; i < nitems;) { @@ -525,12 +524,13 @@ ewmh_del_icon(Window wnd, int width, int height) goto out; icon_size = width * height + 2; - new_set = xmalloc((nitems - icon_size) * 4); + new_set = xmalloc((nitems - icon_size) * sizeof(unsigned long)); if (i != 0) - memcpy(new_set, cur_set, i * 4); + memcpy(new_set, cur_set, i * sizeof(unsigned long)); if (i != nitems - icon_size) - memcpy(new_set + i * 4, cur_set + i * 4 + icon_size, nitems - icon_size); + memcpy(new_set + i, cur_set + i + icon_size, + (nitems - (i + icon_size)) * sizeof(unsigned long)); nitems -= icon_size; diff --git a/src/VBox/RDP/client/iso.c b/src/VBox/RDP/client/iso.c index b945b8035..dfa05f6f2 100644 --- a/src/VBox/RDP/client/iso.c +++ b/src/VBox/RDP/client/iso.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - ISO layer - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -183,38 +183,21 @@ iso_recv(uint8 * rdpver) /* Establish a connection up to the ISO layer */ RD_BOOL -iso_connect(char *server, char *username) +iso_connect(char *server, char *username, RD_BOOL reconnect) { uint8 code = 0; if (!tcp_connect(server)) return False; - iso_send_connection_request(username); - - if (iso_recv_msg(&code, NULL) == NULL) - return False; - - if (code != ISO_PDU_CC) + if (reconnect) { - error("expected CC, got 0x%x\n", code); - tcp_disconnect(); - return False; + iso_send_msg(ISO_PDU_CR); + } + else + { + iso_send_connection_request(username); } - - return True; -} - -/* Establish a reconnection up to the ISO layer */ -RD_BOOL -iso_reconnect(char *server) -{ - uint8 code = 0; - - if (!tcp_connect(server)) - return False; - - iso_send_msg(ISO_PDU_CR); if (iso_recv_msg(&code, NULL) == NULL) return False; diff --git a/src/VBox/RDP/client/keymaps/ar b/src/VBox/RDP/client/keymaps/ar deleted file mode 100644 index c430c03bb..000000000 --- a/src/VBox/RDP/client/keymaps/ar +++ /dev/null @@ -1,98 +0,0 @@ -# generated from XKB map ar -include common -map 0x401 -exclam 0x02 shift -at 0x03 shift -numbersign 0x04 shift -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -Arabic_dad 0x10 altgr -Arabic_fatha 0x10 shift altgr -Arabic_sad 0x11 altgr -Arabic_fathatan 0x11 shift altgr -Arabic_theh 0x12 altgr -Arabic_damma 0x12 shift altgr -Arabic_qaf 0x13 altgr -Arabic_dammatan 0x13 shift altgr -Arabic_feh 0x14 altgr -UFEF9 0x14 shift altgr -Arabic_ghain 0x15 altgr -Arabic_hamzaunderalef 0x15 shift altgr -Arabic_ain 0x16 altgr -grave 0x16 shift altgr -Arabic_ha 0x17 altgr -division 0x17 shift altgr -Arabic_khah 0x18 altgr -multiply 0x18 shift altgr -Arabic_hah 0x19 altgr -Arabic_semicolon 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -Arabic_jeem 0x1a altgr -bracketright 0x1b -braceright 0x1b shift -Arabic_dal 0x1b altgr -Arabic_sheen 0x1e altgr -backslash 0x1e shift altgr -Arabic_seen 0x1f altgr -Arabic_yeh 0x20 altgr -bracketleft 0x20 shift altgr -Arabic_beh 0x21 altgr -bracketright 0x21 shift altgr -Arabic_lam 0x22 altgr -UFEF7 0x22 shift altgr -Arabic_alef 0x23 altgr -Arabic_hamzaonalef 0x23 shift altgr -Arabic_teh 0x24 altgr -Arabic_tatweel 0x24 shift altgr -Arabic_noon 0x25 altgr -Arabic_comma 0x25 shift altgr -Arabic_meem 0x26 altgr -slash 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -Arabic_kaf 0x27 altgr -apostrophe 0x28 -quotedbl 0x28 shift -Arabic_tah 0x28 altgr -grave 0x29 -asciitilde 0x29 shift -Arabic_thal 0x29 altgr -Arabic_shadda 0x29 shift altgr -backslash 0x2b -bar 0x2b shift -less 0x2b altgr -greater 0x2b shift altgr -Arabic_hamzaonyeh 0x2c altgr -asciitilde 0x2c shift altgr -Arabic_hamza 0x2d altgr -Arabic_sukun 0x2d shift altgr -Arabic_hamzaonwaw 0x2e altgr -Arabic_kasra 0x2e shift altgr -Arabic_ra 0x2f altgr -Arabic_kasratan 0x2f shift altgr -UFEFB 0x30 altgr -UFEF5 0x30 shift altgr -Arabic_alefmaksura 0x31 altgr -Arabic_maddaonalef 0x31 shift altgr -Arabic_tehmarbuta 0x32 altgr -apostrophe 0x32 shift altgr -comma 0x33 -less 0x33 shift -Arabic_waw 0x33 altgr -period 0x34 -greater 0x34 shift -Arabic_zain 0x34 altgr -slash 0x35 -question 0x35 shift -Arabic_zah 0x35 altgr -Arabic_question_mark 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/common b/src/VBox/RDP/client/keymaps/common deleted file mode 100644 index f767b7b01..000000000 --- a/src/VBox/RDP/client/keymaps/common +++ /dev/null @@ -1,229 +0,0 @@ -include modifiers - -# -# Top row -# -1 0x2 -2 0x3 -3 0x4 -4 0x5 -5 0x6 -6 0x7 -7 0x8 -8 0x9 -9 0xa -0 0xb -BackSpace 0xe - -# -# QWERTY first row -# -Tab 0xf localstate -ISO_Left_Tab 0xf shift -q 0x10 addupper -w 0x11 addupper -e 0x12 addupper -sequence egrave dead_grave e -sequence Egrave dead_grave E -sequence eacute dead_acute e -sequence Eacute dead_acute E -sequence ecircumflex dead_circumflex e -sequence Ecircumflex dead_circumflex E -sequence ediaeresis dead_diaeresis e -sequence Ediaeresis dead_diaeresis E -r 0x13 addupper -t 0x14 addupper -y 0x15 addupper -sequence ygrave dead_grave y -sequence Ygrave dead_grave Y -sequence yacute dead_acute y -sequence Yacute dead_acute Y -sequence ycircumflex dead_circumflex y -sequence Ycircumflex dead_circumflex Y -sequence ydiaeresis dead_diaeresis y -sequence Ydiaeresis dead_diaeresis Y -u 0x16 addupper -sequence ugrave dead_grave u -sequence Ugrave dead_grave U -sequence uacute dead_acute u -sequence Uacute dead_acute U -sequence ucircumflex dead_circumflex u -sequence Ucircumflex dead_circumflex U -sequence udiaeresis dead_diaeresis u -sequence Udiaeresis dead_diaeresis U -i 0x17 addupper -sequence igrave dead_grave i -sequence Igrave dead_grave I -sequence iacute dead_acute i -sequence Iacute dead_acute I -sequence icircumflex dead_circumflex i -sequence Icircumflex dead_circumflex I -sequence idiaeresis dead_diaeresis i -sequence Idiaeresis dead_diaeresis I -o 0x18 addupper -sequence ograve dead_grave o -sequence Ograve dead_grave O -sequence oacute dead_acute o -sequence Oacute dead_acute O -sequence ocircumflex dead_circumflex o -sequence Ocircumflex dead_circumflex O -sequence odiaeresis dead_diaeresis o -sequence Odiaeresis dead_diaeresis O -sequence otilde dead_tilde o -sequence Otilde dead_tilde O -p 0x19 addupper - -# -# QWERTY second row -# -a 0x1e addupper -sequence agrave dead_grave a -sequence Agrave dead_grave A -sequence aacute dead_acute a -sequence Aacute dead_acute A -sequence acircumflex dead_circumflex a -sequence Acircumflex dead_circumflex A -sequence adiaeresis dead_diaeresis a -sequence Adiaeresis dead_diaeresis A -sequence aring dead_abovering a -sequence Aring dead_abovering A -sequence atilde dead_tilde a -sequence Atilde dead_tilde A -s 0x1f addupper -d 0x20 addupper -f 0x21 addupper -g 0x22 addupper -h 0x23 addupper -j 0x24 addupper -k 0x25 addupper -l 0x26 addupper -Return 0x1c localstate - -# -# QWERTY third row -# -z 0x2c addupper -x 0x2d addupper -c 0x2e addupper -sequence ccedilla dead_cedilla c -sequence Ccedilla dead_cedilla C -v 0x2f addupper -b 0x30 addupper -n 0x31 addupper -sequence ntilde dead_tilde n -sequence Ntilde dead_tilde N -m 0x32 addupper - -space 0x39 localstate - -less 0x56 -greater 0x56 shift -bar 0x56 altgr -brokenbar 0x56 shift altgr - -# -# Translations for some other dead keys -# -sequence asciitilde dead_tilde space -sequence diaeresis dead_diaeresis space -sequence asciicircum dead_circumflex space -sequence apostrophe dead_acute space -sequence grave dead_grave space -sequence acute dead_acute space - -# -# Esc and Function keys -# -Escape 0x1 localstate -F1 0x3b localstate -F2 0x3c localstate -F3 0x3d localstate -F4 0x3e localstate -F5 0x3f localstate -F6 0x40 localstate -F7 0x41 localstate -F8 0x42 localstate -F9 0x43 localstate -F10 0x44 localstate -F11 0x57 localstate -SunF36 0x57 localstate -F12 0x58 localstate -SunF37 0x58 localstate - -# Printscreen, Scrollock and Pause -# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37), -# but (0xe0, 0x37) seems to work. -Print 0xb7 localstate -Sys_Req 0xb7 localstate -Execute 0xb7 localstate -F22 0xb7 localstate -Scroll_Lock 0x46 -F23 0x46 - -# -# Insert - PgDown -# -Insert 0xd2 localstate -Delete 0xd3 localstate -Home 0xc7 localstate -End 0xcf localstate -Page_Up 0xc9 localstate -Page_Down 0xd1 localstate - -# -# Arrow keys -# -Left 0xcb localstate -Up 0xc8 localstate -Down 0xd0 localstate -Right 0xcd localstate - -# -# Numpad -# -Num_Lock 0x45 -KP_Divide 0xb5 localstate -KP_Multiply 0x37 localstate -KP_Subtract 0x4a localstate -KP_Add 0x4e localstate -KP_Enter 0x9c localstate - -KP_Decimal 0x53 numlock -KP_Separator 0x53 numlock -KP_Delete 0x53 - -KP_0 0x52 numlock -KP_Insert 0x52 localstate - -KP_1 0x4f numlock -KP_End 0x4f localstate - -KP_2 0x50 numlock -KP_Down 0x50 localstate - -KP_3 0x51 numlock -KP_Next 0x51 localstate - -KP_4 0x4b numlock -KP_Left 0x4b localstate - -KP_5 0x4c numlock -KP_Begin 0x4c localstate - -KP_6 0x4d numlock -KP_Right 0x4d localstate - -KP_7 0x47 numlock -KP_Home 0x47 localstate - -KP_8 0x48 numlock -KP_Up 0x48 localstate - -KP_9 0x49 numlock -KP_Prior 0x49 localstate - -# -# Inhibited keys -# -Caps_Lock 0x0 inhibit -Multi_key 0x0 inhibit diff --git a/src/VBox/RDP/client/keymaps/convert-map b/src/VBox/RDP/client/keymaps/convert-map deleted file mode 100755 index c88c72db0..000000000 --- a/src/VBox/RDP/client/keymaps/convert-map +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python2 -# -*-Python-*- -# -# -# Copyright (C) 2001 Peter Åstrand <astrand@cendio.se> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -import sys - -def main(): - f = open(sys.argv[1]) - while 1: - line = f.readline() - if not line: break - - if line.startswith("#") or line.startswith("include"): - print line, - continue - - fields = line.split() - - if line.startswith("map"): - print "map 0x%s" % fields[1] - continue - - scancode = fields[0] - for pos in range(1, len(fields)): - keysym = fields[pos] - - if pos == 1: - modifiers = "" - elif pos == 2: - modifiers = "shift" - elif pos == 3: - modifiers = "altgr" - elif pos == 4: - modifiers = "shift altgr" - else: - raise("Invalid line: %s" % line) - - print "%s 0x%s %s" % (keysym, scancode, modifiers) - - - -if __name__ == "__main__": - if len(sys.argv) < 2: - print "Convert old-style keymaps to new style" - print "Usage: %s <old-style-keymap>" % sys.argv[0] - sys.exit(1) - else: - main() diff --git a/src/VBox/RDP/client/keymaps/cs b/src/VBox/RDP/client/keymaps/cs deleted file mode 100644 index 5c89b0096..000000000 --- a/src/VBox/RDP/client/keymaps/cs +++ /dev/null @@ -1,87 +0,0 @@ -# Czech keymap -include common -map 0x405 - -# AltGr -ISO_Level3_Shift 0xb8 - -# -# Top row -# - -# ` -grave 0x29 -asciitilde 0x29 shift -# 1 -exclam 0x2 shift -# 2 -at 0x3 shift -ecaron 0x3 altgr -# 3 -numbersign 0x4 shift -# 4 -dollar 0x5 shift -# 5 -percent 0x6 shift -# 6 -asciicircum 0x7 shift -# 7 -ampersand 0x8 shift -# 8 -asterisk 0x9 shift -# 9 -parenleft 0xa shift -# 0 -parenright 0xb shift -# - -minus 0xc -underscore 0xc shift -# = -equal 0xd -plus 0xd shift - - -# -# QWERTZ first row -# - -# q -q 0x10 altgr -# e -e 0x12 altgr -# [ -bracketleft 0x1a -braceleft 0x1a shift -# ] -bracketright 0x1b -braceright 0x1b shift - -# -# QWERTZ second row -# - -# ; -semicolon 0x27 -# ; -colon 0x27 shift -# ' -apostrophe 0x28 -# ' -quotedbl 0x28 shift - -# -# QWERTZ third row -# - -# v -v 0x2f altgr -# , -comma 0x33 -less 0x33 shift -# . -period 0x34 -greater 0x34 shift -# / -slash 0x35 -question 0x35 shift - diff --git a/src/VBox/RDP/client/keymaps/da b/src/VBox/RDP/client/keymaps/da deleted file mode 100644 index 3884dcf14..000000000 --- a/src/VBox/RDP/client/keymaps/da +++ /dev/null @@ -1,120 +0,0 @@ -# generated from XKB map dk -include common -map 0x406 -exclam 0x02 shift -exclamdown 0x02 altgr -onesuperior 0x02 shift altgr -quotedbl 0x03 shift -at 0x03 altgr -twosuperior 0x03 shift altgr -numbersign 0x04 shift -sterling 0x04 altgr -threesuperior 0x04 shift altgr -currency 0x05 shift -dollar 0x05 altgr -onequarter 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -cent 0x06 shift altgr -ampersand 0x07 shift -yen 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -division 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -guillemotleft 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -guillemotright 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -plus 0x0c -question 0x0c shift -plusminus 0x0c altgr -questiondown 0x0c shift altgr -dead_acute 0x0d -dead_grave 0x0d shift -bar 0x0d altgr -brokenbar 0x0d shift altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -registered 0x13 altgr -thorn 0x14 altgr -THORN 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oe 0x18 altgr -OE 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -aring 0x1a -Aring 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -dead_diaeresis 0x1b -dead_circumflex 0x1b shift -dead_tilde 0x1b altgr -dead_caron 0x1b shift altgr -ordfeminine 0x1e altgr -masculine 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -ae 0x27 -AE 0x27 shift -oslash 0x28 -Ooblique 0x28 shift -dead_caron 0x28 shift altgr -onehalf 0x29 -section 0x29 shift -threequarters 0x29 altgr -paragraph 0x29 shift altgr -apostrophe 0x2b -asterisk 0x2b shift -dead_doubleacute 0x2b altgr -multiply 0x2b shift altgr -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -copyright 0x2e altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -dead_cedilla 0x33 altgr -dead_ogonek 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -dead_abovedot 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -hyphen 0x35 altgr -macron 0x35 shift altgr -nobreakspace 0x39 altgr -less 0x56 -greater 0x56 shift -backslash 0x56 altgr -notsign 0x56 shift altgr diff --git a/src/VBox/RDP/client/keymaps/de b/src/VBox/RDP/client/keymaps/de deleted file mode 100644 index ed929c743..000000000 --- a/src/VBox/RDP/client/keymaps/de +++ /dev/null @@ -1,114 +0,0 @@ -# generated from XKB map de -include common -map 0x407 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -quotedbl 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -section 0x04 shift -threesuperior 0x04 altgr -sterling 0x04 shift altgr -dollar 0x05 shift -onequarter 0x05 altgr -currency 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -ampersand 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -ssharp 0x0c -question 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -acute 0x0d -dead_acute 0x0d -grave 0x0d shift -dead_grave 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -z 0x15 addupper -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -udiaeresis 0x1a -Udiaeresis 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -plus 0x1b -asterisk 0x1b shift -asciitilde 0x1b altgr -dead_tilde 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -odiaeresis 0x27 -Odiaeresis 0x27 shift -dead_doubleacute 0x27 altgr -adiaeresis 0x28 -Adiaeresis 0x28 shift -dead_caron 0x28 shift altgr -asciicircum 0x29 -dead_circumflex 0x29 -degree 0x29 shift -notsign 0x29 altgr -numbersign 0x2b -apostrophe 0x2b shift -dead_breve 0x2b shift altgr -y 0x2c addupper -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/de-ch b/src/VBox/RDP/client/keymaps/de-ch deleted file mode 100644 index f83837b44..000000000 --- a/src/VBox/RDP/client/keymaps/de-ch +++ /dev/null @@ -1,169 +0,0 @@ -# rdesktop Swiss-German (de-ch) keymap file -# 2003-06-03 by noldi@tristar.ch -# -include common -map 0x00000807 -# -# Scan Code 1 -section 0x29 -degree 0x29 shift -notsign 0x29 altgr inhibit -# -# Scan Code 2 -plus 0x2 shift -brokenbar 0x02 altgr -# -# Scan Code 3 -quotedbl 0x03 shift -at 0x03 altgr -# -# Scan Code 4 -asterisk 0x04 shift -numbersign 0x04 altgr -# -# Scan Code 5 -ccedilla 0x05 shift -onequarter 0x05 altgr inhibit -# -# Scan Code 6 -percent 0x06 shift -onehalf 0x06 altgr inhibit -# -# Scan Code 7 -ampersand 0x07 shift -notsign 0x07 altgr -# -# Scan Code 8 -slash 0x08 shift -bar 0x08 altgr -# -# Scan Code 9 -parenleft 0x09 shift -cent 0x09 altgr -# -# Scan Code 10 -parenright 0x0a shift -# -# Scan Code 11 -equal 0x0b shift -braceright 0x0b altgr inhibit -# -# Scan Code 12 -apostrophe 0x0c -question 0x0c shift -dead_acute 0x0c altgr -# -# Scan Code 13 -dead_circumflex 0x0d -dead_grave 0x0d shift -dead_tilde 0x0d altgr -# -# Scan Code 19 -EuroSign 0x12 altgr -# -# Scan Code 22 -z 0x15 addupper -# -# Scan Code 27 -udiaeresis 0x1a -egrave 0x1a shift -bracketleft 0x1a altgr -# -# Scan Code 28 -dead_diaeresis 0x1b -exclam 0x1b shift -bracketright 0x1b altgr -# -# Scan Code 40 -odiaeresis 0x27 -eacute 0x27 shift -# -# Scan Code 41 -adiaeresis 0x28 -agrave 0x28 shift -braceleft 0x28 altgr -# -# Scan Code 42 (only on international keyboards) -dollar 0x2b -sterling 0x2b shift -braceright 0x2b altgr -# -# Scan Code 45 (only on international keyboards) -backslash 0x56 altgr -# -# Scan Code 46 -y 0x2c addupper -# -# Scan Code 53 -comma 0x33 -semicolon 0x33 shift -# -# Scan Code 54 -period 0x34 -colon 0x34 shift -# -# Scan Code 55 -minus 0x35 -underscore 0x35 shift -# -# Suppress Windows unsupported AltGr keys -# -# Scan Code 17 -paragraph 0x10 altgr inhibit -# -# Scan Code 21 -tslash 0x14 altgr inhibit -# -# Scan Code 22 -leftarrow 0x15 altgr inhibit -# -# Scan Code 23 -downarrow 0x16 altgr inhibit -# -# Scan Code 24 -rightarrow 0x17 altgr inhibit -# -# Scan Code 25 -oslash 0x18 altgr inhibit -# -# Scan Code 26 -thorn 0x19 altgr inhibit -# -# Scan Code 31 -ae 0x1e altgr inhibit -# -# Scan Code 32 -ssharp 0x1f altgr inhibit -# -# Scan Code 33 -eth 0x20 altgr inhibit -# -# Scan Code 34 -dstroke 0x21 altgr inhibit -# -# Scan Code 35 -eng 0x22 altgr inhibit -# -# Scan Code 36 -hstroke 0x23 altgr inhibit -# -# Scan Code 38 -kra 0x25 altgr inhibit -# -# Scan Code 39 -lstroke 0x26 altgr inhibit -# -# Scan Code 46 -guillemotleft 0x2c altgr inhibit -# -# Scan Code 47 -guillemotright 0x2d altgr inhibit -# -# Scan Code 49 -leftdoublequotemark 0x2f altgr inhibit -# -# Scan Code 50 -rightdoublequotemark 0x30 altgr inhibit -# -# Scan Code 52 -mu 0x32 altgr inhibit diff --git a/src/VBox/RDP/client/keymaps/en-dv b/src/VBox/RDP/client/keymaps/en-dv deleted file mode 100644 index 720accf6d..000000000 --- a/src/VBox/RDP/client/keymaps/en-dv +++ /dev/null @@ -1,216 +0,0 @@ -# American Dvorak -map 0x10409 - -# Note: we are not including the common section -include modifiers - -# -# Top row -# -1 0x2 -2 0x3 -3 0x4 -4 0x5 -5 0x6 -6 0x7 -7 0x8 -8 0x9 -9 0xa -0 0xb -BackSpace 0xe - -# -# QWERTY first row - -# QWERTY: -# q w e r t y u i o p - -# Dvorak: -# ' , . p y f g c r l - -Tab 0xf localstate -ISO_Left_Tab 0xf shift -q 0x2d addupper -w 0x33 addupper -e 0x20 addupper -r 0x18 addupper -t 0x25 addupper -y 0x14 addupper -u 0x21 addupper -i 0x22 addupper -o 0x1f addupper -p 0x13 addupper - -# -# QWERTY second row - -# QUERTY: -# a s d f g h j k l - -# Dvorak: -# a o e u i d h t n - -a 0x1e addupper -s 0x27 addupper -d 0x23 addupper -f 0x15 addupper -g 0x16 addupper -h 0x24 addupper -j 0x2e addupper -k 0x2f addupper -l 0x19 addupper -Return 0x1c localstate - -# -# QWERTY third row - -# QUERTY: -# z x c v b n m - -# Dvorak: -# ; q j k x b m - -z 0x35 addupper -x 0x30 addupper -c 0x17 addupper -v 0x34 addupper -b 0x31 addupper -n 0x26 addupper -m 0x32 addupper - -space 0x39 localstate - -less 0x56 -greater 0x56 shift -bar 0x56 altgr -brokenbar 0x56 shift altgr - -# -# Esc and Function keys -# -Escape 0x1 localstate -F1 0x3b localstate -F2 0x3c localstate -F3 0x3d localstate -F4 0x3e localstate -F5 0x3f localstate -F6 0x40 localstate -F7 0x41 localstate -F8 0x42 localstate -F9 0x43 localstate -F10 0x44 localstate -F11 0x57 localstate -SunF36 0x57 localstate -F12 0x58 localstate -SunF37 0x58 localstate - -# Printscreen, Scrollock and Pause -# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37), -# but (0xe0, 0x37) seems to work. -Print 0xb7 localstate -Sys_Req 0xb7 localstate -Execute 0xb7 localstate -F22 0xb7 localstate -Scroll_Lock 0x46 -F23 0x46 - -# -# Insert - PgDown -# -Insert 0xd2 localstate -Delete 0xd3 localstate -Home 0xc7 localstate -End 0xcf localstate -Page_Up 0xc9 localstate -Page_Down 0xd1 localstate - -# -# Arrow keys -# -Left 0xcb localstate -Up 0xc8 localstate -Down 0xd0 localstate -Right 0xcd localstate - -# -# Numpad -# -Num_Lock 0x45 -KP_Divide 0xb5 -KP_Multiply 0x37 -KP_Subtract 0x4a -KP_Add 0x4e -KP_Enter 0x9c - -KP_Decimal 0x53 numlock -KP_Separator 0x53 numlock -KP_Delete 0x53 - -KP_0 0x52 numlock -KP_Insert 0x52 - -KP_1 0x4f numlock -KP_End 0x4f - -KP_2 0x50 numlock -KP_Down 0x50 - -KP_3 0x51 numlock -KP_Next 0x51 - -KP_4 0x4b numlock -KP_Left 0x4b - -KP_5 0x4c numlock -KP_Begin 0x4c - -KP_6 0x4d numlock -KP_Right 0x4d - -KP_7 0x47 numlock -KP_Home 0x47 - -KP_8 0x48 numlock -KP_Up 0x48 - -KP_9 0x49 numlock -KP_Prior 0x49 - -# -# Inhibited keys -# -Caps_Lock 0x0 inhibit -Multi_key 0x0 inhibit - -exclam 0x02 shift -at 0x03 shift -numbersign 0x04 shift -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x28 -underscore 0x28 shift -equal 0x1b -plus 0x1b shift -bracketleft 0x0c -braceleft 0x0c shift -bracketright 0x0d -braceright 0x0d shift -semicolon 0x2c -colon 0x2c shift -apostrophe 0x10 -quotedbl 0x10 shift -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -comma 0x11 -less 0x11 shift -period 0x12 -greater 0x12 shift -slash 0x1a -question 0x1a shift diff --git a/src/VBox/RDP/client/keymaps/en-gb b/src/VBox/RDP/client/keymaps/en-gb deleted file mode 100644 index b45f06c7c..000000000 --- a/src/VBox/RDP/client/keymaps/en-gb +++ /dev/null @@ -1,119 +0,0 @@ -# generated from XKB map gb -include common -map 0x809 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -quotedbl 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -sterling 0x04 shift -threesuperior 0x04 altgr -dollar 0x05 shift -EuroSign 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -asciicircum 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -ampersand 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -asterisk 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenleft 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -parenright 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -minus 0x0c -underscore 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -equal 0x0d -plus 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -dead_tilde 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -apostrophe 0x28 -at 0x28 shift -dead_circumflex 0x28 altgr -dead_caron 0x28 shift altgr -grave 0x29 -notsign 0x29 shift -bar 0x29 altgr -numbersign 0x2b -asciitilde 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -guillemotleft 0x2c altgr -less 0x2c shift altgr -guillemotright 0x2d altgr -greater 0x2d shift altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -less 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -greater 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -slash 0x35 -question 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr -backslash 0x56 -bar 0x56 shift diff --git a/src/VBox/RDP/client/keymaps/en-us b/src/VBox/RDP/client/keymaps/en-us deleted file mode 100644 index f5784bbb3..000000000 --- a/src/VBox/RDP/client/keymaps/en-us +++ /dev/null @@ -1,35 +0,0 @@ -# generated from XKB map us -include common -map 0x409 -exclam 0x02 shift -at 0x03 shift -numbersign 0x04 shift -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -bracketleft 0x1a -braceleft 0x1a shift -bracketright 0x1b -braceright 0x1b shift -semicolon 0x27 -colon 0x27 shift -apostrophe 0x28 -quotedbl 0x28 shift -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -comma 0x33 -less 0x33 shift -period 0x34 -greater 0x34 shift -slash 0x35 -question 0x35 shift diff --git a/src/VBox/RDP/client/keymaps/es b/src/VBox/RDP/client/keymaps/es deleted file mode 100644 index 0c29eec5a..000000000 --- a/src/VBox/RDP/client/keymaps/es +++ /dev/null @@ -1,105 +0,0 @@ -# generated from XKB map es -include common -map 0x40a -exclam 0x02 shift -bar 0x02 altgr -quotedbl 0x03 shift -at 0x03 altgr -oneeighth 0x03 shift altgr -periodcentered 0x04 shift -numbersign 0x04 altgr -sterling 0x04 shift altgr -dollar 0x05 shift -asciitilde 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -ampersand 0x07 shift -notsign 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -seveneighths 0x08 shift altgr -parenleft 0x09 shift -trademark 0x09 shift altgr -parenright 0x0a shift -plusminus 0x0a shift altgr -equal 0x0b shift -degree 0x0b shift altgr -apostrophe 0x0c -question 0x0c shift -exclamdown 0x0d -questiondown 0x0d shift -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -dead_grave 0x1a -dead_circumflex 0x1a shift -bracketleft 0x1a altgr -dead_abovering 0x1a shift altgr -plus 0x1b -asterisk 0x1b shift -bracketright 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -ntilde 0x27 -Ntilde 0x27 shift -dead_doubleacute 0x27 shift altgr -dead_acute 0x28 -dead_diaeresis 0x28 shift -braceleft 0x28 altgr -masculine 0x29 -ordfeminine 0x29 shift -backslash 0x29 altgr -ccedilla 0x2b -Ccedilla 0x2b shift -braceright 0x2b altgr -dead_breve 0x2b shift altgr -guillemotleft 0x2c altgr -less 0x56 -greater 0x56 shift -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -division 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/et b/src/VBox/RDP/client/keymaps/et deleted file mode 100644 index b5a73fef7..000000000 --- a/src/VBox/RDP/client/keymaps/et +++ /dev/null @@ -1,86 +0,0 @@ -map 0x00000425 -include common - -# -# Top row -# -dead_caron 0x29 -dead_tilde 0x29 shift - -# 1 -exclam 0x2 shift - -# 2 -quotedbl 0x3 shift -at 0x3 altgr - -# 3 -numbersign 0x4 shift -sterling 0x4 altgr -# 4 -currency 0x5 shift -dollar 0x5 altgr -# 5 -percent 0x6 shift -# 6 -ampersand 0x7 shift -# 7 -slash 0x8 shift -braceleft 0x8 altgr -# 8 -parenleft 0x9 shift -bracketleft 0x9 altgr -# 9 -parenright 0xa shift -bracketright 0xa altgr -# 0 -equal 0xb shift -braceright 0xb altgr - -plus 0xc -question 0xc shift -backslash 0xc altgr - -acute 0xd -dead_acute 0xd -grave 0xd shift -dead_grave 0xd shift - -# -# QWERTY first row -# -EuroSign 0x12 altgr -udiaeresis 0x1a -Udiaeresis 0x1a shift -otilde 0x1b -Otilde 0x1b shift -section 0x1b altgr - -# -# QWERTY second row -# -scaron 0x1f altgr -Scaron 0x1f altgr shift -odiaeresis 0x27 -Odiaeresis 0x27 shift -adiaeresis 0x28 -Adiaeresis 0x28 shift -asciicircum 0x28 altgr -apostrophe 0x2b -asterisk 0x2b shift -onehalf 0x2b altgr -# -# QWERTY third row -# -less 0x56 -greater 0x56 shift -bar 0x56 altgr -zcaron 0x2c altgr -Zcaron 0x2c altgr shift -comma 0x33 -semicolon 0x33 shift -period 0x34 -colon 0x34 shift -minus 0x35 -underscore 0x35 shift - diff --git a/src/VBox/RDP/client/keymaps/fi b/src/VBox/RDP/client/keymaps/fi deleted file mode 100644 index e08c69c2c..000000000 --- a/src/VBox/RDP/client/keymaps/fi +++ /dev/null @@ -1,122 +0,0 @@ -# Finnish keyboard layout -# Originally generated from XKB map se_FI (wrong!), modified afterwards. - -include common -map 0x40b - -exclam 0x02 shift -exclamdown 0x02 altgr -onesuperior 0x02 shift altgr -quotedbl 0x03 shift -at 0x03 altgr -twosuperior 0x03 shift altgr -numbersign 0x04 shift -sterling 0x04 altgr -threesuperior 0x04 shift altgr -currency 0x05 shift -dollar 0x05 altgr -onequarter 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -cent 0x06 shift altgr -ampersand 0x07 shift -yen 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -division 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -guillemotleft 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -guillemotright 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -plus 0x0c -question 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -dead_acute 0x0d -dead_grave 0x0d shift -plusminus 0x0d altgr -notsign 0x0d shift altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -registered 0x13 altgr -thorn 0x14 altgr -THORN 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oe 0x18 altgr -OE 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -aring 0x1a -Aring 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -dead_diaeresis 0x1b -dead_circumflex 0x1b shift -dead_tilde 0x1b altgr -dead_caron 0x1b shift altgr -ordfeminine 0x1e altgr -masculine 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -odiaeresis 0x27 -Odiaeresis 0x27 shift -oslash 0x27 altgr -Ooblique 0x27 shift altgr -adiaeresis 0x28 -Adiaeresis 0x28 shift -ae 0x28 altgr -AE 0x28 shift altgr -section 0x29 -onehalf 0x29 shift -paragraph 0x29 altgr -threequarters 0x29 shift altgr -apostrophe 0x2b -asterisk 0x2b shift -acute 0x2b altgr -multiply 0x2b shift altgr -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -copyright 0x2e altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -dead_cedilla 0x33 altgr -dead_ogonek 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -dead_abovedot 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -hyphen 0x35 altgr -macron 0x35 shift altgr -nobreakspace 0x39 altgr diff --git a/src/VBox/RDP/client/keymaps/fo b/src/VBox/RDP/client/keymaps/fo deleted file mode 100644 index 83add423c..000000000 --- a/src/VBox/RDP/client/keymaps/fo +++ /dev/null @@ -1,77 +0,0 @@ -map 0x438 -include common - -# -# Top row -# -onehalf 0x29 -section 0x29 shift - -# 1 -exclam 0x2 shift - -# 2 -quotedbl 0x3 shift -at 0x3 altgr - -# 3 -numbersign 0x4 shift -sterling 0x4 altgr -# 4 -currency 0x5 shift -dollar 0x5 altgr -# 5 -percent 0x6 shift -# 6 -ampersand 0x7 shift -# 7 -slash 0x8 shift -braceleft 0x8 altgr -# 8 -parenleft 0x9 shift -bracketleft 0x9 altgr -# 9 -parenright 0xa shift -bracketright 0xa altgr -# 0 -equal 0xb shift -braceright 0xb altgr - -plus 0xc -question 0xc shift -plusminus 0xc altgr - -bar 0xd altgr -dead_acute 0xd - -# -# QWERTY first row -# -EuroSign 0x12 altgr -aring 0x1a -Aring 0x1a shift -eth 0x1b addupper -asciitilde 0x1b altgr - -# -# QWERTY second row -# -ae 0x27 addupper -oslash 0x28 -Ooblique 0x28 shift -apostrophe 0x2b -asterisk 0x2b shift - -# -# QWERTY third row -# -less 0x56 -greater 0x56 shift -backslash 0x56 altgr -comma 0x33 -semicolon 0x33 shift -period 0x34 -colon 0x34 shift -minus 0x35 -underscore 0x35 shift - diff --git a/src/VBox/RDP/client/keymaps/fr b/src/VBox/RDP/client/keymaps/fr deleted file mode 100644 index cbb45910f..000000000 --- a/src/VBox/RDP/client/keymaps/fr +++ /dev/null @@ -1,181 +0,0 @@ -include common -map 0x40c -# -# Top row -# -twosuperior 0x29 -notsign 0x29 altgr - -ampersand 0x02 -1 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr - -eacute 0x03 -2 0x03 shift -asciitilde 0x03 altgr -oneeighth 0x03 shift altgr - -quotedbl 0x04 -3 0x04 shift -numbersign 0x04 altgr - -apostrophe 0x05 -4 0x05 shift -braceleft 0x05 altgr - -parenleft 0x06 -5 0x06 shift -bracketleft 0x06 altgr -threeeighths 0x06 shift altgr - -minus 0x07 -6 0x07 shift -bar 0x07 altgr -fiveeighths 0x07 shift altgr - -egrave 0x08 -7 0x08 shift -grave 0x08 altgr -seveneighths 0x08 shift altgr - -underscore 0x09 -8 0x09 shift -backslash 0x09 altgr -trademark 0x09 shift altgr - -ccedilla 0x0a -9 0x0a shift -asciicircum 0x0a altgr -plusminus 0x0a shift altgr - -agrave 0x0b -0 0x0b shift -at 0x0b altgr - -parenright 0x0c -degree 0x0c shift -bracketright 0x0c altgr -questiondown 0x0c shift altgr - -equal 0x0d -plus 0x0d shift -braceright 0x0d altgr -dead_ogonek 0x0d shift altgr - -# -# AZERTY first row -# - -a 0x10 addupper -ae 0x10 altgr -AE 0x10 shift altgr - -z 0x11 addupper -guillemotleft 0x11 altgr - -EuroSign 0x12 altgr - -paragraph 0x13 altgr -registered 0x13 shift altgr - -tslash 0x14 altgr -Tslash 0x14 shift altgr - -leftarrow 0x15 altgr -yen 0x15 shift altgr - -downarrow 0x16 altgr -uparrow 0x16 shift altgr - -rightarrow 0x17 altgr -idotless 0x17 shift altgr - -oslash 0x18 altgr -Ooblique 0x18 shift altgr - -thorn 0x19 altgr -THORN 0x19 shift altgr - -dead_circumflex 0x1a -dead_diaeresis 0x1a shift -dead_abovering 0x1a shift altgr - -dollar 0x1b -sterling 0x1b shift -currency 0x1b altgr -dead_macron 0x1b shift altgr - -# -# AZERTY second row -# -q 0x1e addupper -Greek_OMEGA 0x1e shift altgr - -ssharp 0x1f altgr - -eth 0x20 altgr -ETH 0x20 shift altgr - -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr - -eng 0x22 altgr -ENG 0x22 shift altgr - -hstroke 0x23 altgr -Hstroke 0x23 shift altgr - -kra 0x25 altgr - -lstroke 0x26 altgr -Lstroke 0x26 shift altgr - -m 0x27 addupper -masculine 0x27 shift altgr - -ugrave 0x28 -percent 0x28 shift -dead_caron 0x28 shift altgr - -asterisk 0x2b -mu 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr - -# -# AZERTY third row -# -less 0x56 -greater 0x56 shift - -w 0x2c addupper - -guillemotright 0x2d altgr - -cent 0x2e altgr -copyright 0x2e shift altgr - -leftdoublequotemark 0x2f altgr - -rightdoublequotemark 0x30 altgr - -comma 0x32 -question 0x32 shift -dead_acute 0x32 altgr -dead_doubleacute 0x32 shift altgr - -semicolon 0x33 -period 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr - -colon 0x34 -slash 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr - -exclam 0x35 -section 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/fr-be b/src/VBox/RDP/client/keymaps/fr-be deleted file mode 100644 index 89e038398..000000000 --- a/src/VBox/RDP/client/keymaps/fr-be +++ /dev/null @@ -1,135 +0,0 @@ -# generated from XKB map be -include common -map 0x80c -ampersand 0x02 -1 0x02 shift -bar 0x02 altgr -exclamdown 0x02 shift altgr -eacute 0x03 -2 0x03 shift -at 0x03 altgr -oneeighth 0x03 shift altgr -quotedbl 0x04 -3 0x04 shift -numbersign 0x04 altgr -sterling 0x04 shift altgr -apostrophe 0x05 -4 0x05 shift -onequarter 0x05 altgr -dollar 0x05 shift altgr -parenleft 0x06 -5 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -section 0x07 -6 0x07 shift -asciicircum 0x07 altgr -fiveeighths 0x07 shift altgr -egrave 0x08 -7 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -exclam 0x09 -8 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -ccedilla 0x0a -9 0x0a shift -braceleft 0x0a altgr -plusminus 0x0a shift altgr -agrave 0x0b -0 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -parenright 0x0c -degree 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -minus 0x0d -underscore 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -a 0x10 addupper -Greek_OMEGA 0x10 shift altgr -z 0x11 addupper -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -dead_circumflex 0x1a -dead_diaeresis 0x1a shift -bracketleft 0x1a altgr -dead_abovering 0x1a shift altgr -dollar 0x1b -asterisk 0x1b shift -bracketright 0x1b altgr -dead_macron 0x1b shift altgr -q 0x1e addupper -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -m 0x27 addupper -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -ugrave 0x28 -percent 0x28 shift -dead_acute 0x28 altgr -dead_caron 0x28 shift altgr -twosuperior 0x29 -threesuperior 0x29 shift -notsign 0x29 altgr -mu 0x2b -sterling 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -w 0x2c addupper -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -comma 0x32 -question 0x32 shift -dead_cedilla 0x32 altgr -masculine 0x32 shift altgr -semicolon 0x33 -period 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -colon 0x34 -slash 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -equal 0x35 -plus 0x35 shift -dead_tilde 0x35 altgr -dead_abovedot 0x35 shift altgr -backslash 0x56 altgr - diff --git a/src/VBox/RDP/client/keymaps/fr-ca b/src/VBox/RDP/client/keymaps/fr-ca deleted file mode 100644 index 83c5f3468..000000000 --- a/src/VBox/RDP/client/keymaps/fr-ca +++ /dev/null @@ -1,53 +0,0 @@ -# Canadian French -# By Simon Germain -include common -map 0xc0c - -backslash 0x29 altgr -plusminus 0x2 altgr -at 0x3 altgr -sterling 0x4 altgr -cent 0x5 altgr -currency 0x6 altgr -notsign 0x7 altgr -bar 0x29 shift -twosuperior 0x9 altgr -threesuperior 0xa altgr -onequarter 0xb altgr -onehalf 0xc altgr -threequarters 0xd altgr -section 0x18 altgr -paragraph 0x19 altgr -bracketleft 0x1a altgr -bracketright 0x1b altgr -asciitilde 0x27 altgr -braceleft 0x28 altgr -braceright 0x2b altgr -less 0x2b -greater 0x2b shift -guillemotleft 0x56 -guillemotright 0x56 shift -degree 0x56 altgr -mu 0x32 altgr -eacute 0x35 -dead_acute 0x35 altgr -dead_grave 0x28 -dead_circumflex 0x1a -dead_circumflex 0x1a shift -dead_cedilla 0x1b -dead_diaeresis 0x1b shift -exclam 0x2 shift -quotedbl 0x3 shift -comma 0x33 -apostrophe 0x33 shift -period 0x34 shift -slash 0x4 shift -dollar 0x5 shift -percent 0x6 shift -question 0x7 shift -ampersand 0x8 shift -asterisk 0x9 shift -parenleft 0xa shift -parenright 0xb shift -underscore 0xc shift -plus 0xd shift diff --git a/src/VBox/RDP/client/keymaps/fr-ch b/src/VBox/RDP/client/keymaps/fr-ch deleted file mode 100644 index 7b7d28cd6..000000000 --- a/src/VBox/RDP/client/keymaps/fr-ch +++ /dev/null @@ -1,169 +0,0 @@ -# rdesktop suisse-french keymap file -# -#map 0x00000807 -map 0x0000100C -include common -# -# Scan Code 1 -section 0x29 -degree 0x29 shift -notsign 0x29 altgr inhibit -# -# Scan Code 2 -plus 0x2 shift -brokenbar 0x02 altgr -# -# Scan Code 3 -quotedbl 0x03 shift -at 0x03 altgr -# -# Scan Code 4 -asterisk 0x04 shift -numbersign 0x04 altgr -# -# Scan Code 5 -ccedilla 0x05 shift -onequarter 0x05 altgr inhibit -# -# Scan Code 6 -percent 0x06 shift -onehalf 0x06 altgr inhibit -# -# Scan Code 7 -ampersand 0x07 shift -notsign 0x07 altgr -# -# Scan Code 8 -slash 0x08 shift -bar 0x08 altgr -# -# Scan Code 9 -parenleft 0x09 shift -cent 0x09 altgr -# -# Scan Code 10 -parenright 0x0a shift -# -# Scan Code 11 -equal 0x0b shift -braceright 0x0b altgr inhibit -# -# Scan Code 12 -apostrophe 0x0c -question 0x0c shift -dead_acute 0x0c altgr -# -# Scan Code 13 -dead_circumflex 0x0d -dead_grave 0x0d shift -dead_tilde 0x0d altgr -# -# Scan Code 19 -EuroSign 0x12 altgr -# -# Scan Code 22 -z 0x15 addupper -# -# Scan Code 27 -udiaeresis 0x1a shift -egrave 0x1a -bracketleft 0x1a altgr -# -# Scan Code 28 -dead_diaeresis 0x1b -exclam 0x1b shift -bracketright 0x1b altgr -# -# Scan Code 40 -odiaeresis 0x27 shift -eacute 0x27 -# -# Scan Code 41 -adiaeresis 0x28 shift -agrave 0x28 -braceleft 0x28 altgr -# -# Scan Code 42 (only on international keyboards) -dollar 0x2b -sterling 0x2b shift -braceright 0x2b altgr -# -# Scan Code 45 (only on international keyboards) -backslash 0x56 altgr -# -# Scan Code 46 -y 0x2c addupper -# -# Scan Code 53 -comma 0x33 -semicolon 0x33 shift -# -# Scan Code 54 -period 0x34 -colon 0x34 shift -# -# Scan Code 55 -minus 0x35 -underscore 0x35 shift -# -# Suppress Windows unsupported AltGr keys -# -# Scan Code 17 -paragraph 0x10 altgr inhibit -# -# Scan Code 21 -tslash 0x14 altgr inhibit -# -# Scan Code 22 -leftarrow 0x15 altgr inhibit -# -# Scan Code 23 -downarrow 0x16 altgr inhibit -# -# Scan Code 24 -rightarrow 0x17 altgr inhibit -# -# Scan Code 25 -oslash 0x18 altgr inhibit -# -# Scan Code 26 -thorn 0x19 altgr inhibit -# -# Scan Code 31 -ae 0x1e altgr inhibit -# -# Scan Code 32 -ssharp 0x1f altgr inhibit -# -# Scan Code 33 -eth 0x20 altgr inhibit -# -# Scan Code 34 -dstroke 0x21 altgr inhibit -# -# Scan Code 35 -eng 0x22 altgr inhibit -# -# Scan Code 36 -hstroke 0x23 altgr inhibit -# -# Scan Code 38 -kra 0x25 altgr inhibit -# -# Scan Code 39 -lstroke 0x26 altgr inhibit -# -# Scan Code 46 -guillemotleft 0x2c altgr inhibit -# -# Scan Code 47 -guillemotright 0x2d altgr inhibit -# -# Scan Code 49 -leftdoublequotemark 0x2f altgr inhibit -# -# Scan Code 50 -rightdoublequotemark 0x30 altgr inhibit -# -# Scan Code 52 -mu 0x32 altgr inhibit diff --git a/src/VBox/RDP/client/keymaps/he b/src/VBox/RDP/client/keymaps/he deleted file mode 100644 index 7e282887b..000000000 --- a/src/VBox/RDP/client/keymaps/he +++ /dev/null @@ -1,91 +0,0 @@ -# Generated by Shlomil -# Please send your comments and corrections to <shlomister@gmail.com> -include common -map 0x040D - - -# -# Top row -# - -slash 0x10 altgr -apostrophe 0x11 altgr -hebrew_qoph 0x12 altgr -hebrew_resh 0x13 altgr -hebrew_aleph 0x14 altgr -hebrew_tet 0x15 altgr -hebrew_waw 0x16 altgr -hebrew_finalnun 0x17 altgr -hebrew_finalmem 0x18 altgr -hebrew_pe 0x19 altgr - -# -# Second row -# - -hebrew_shin 0x1e altgr -hebrew_dalet 0x1f altgr -hebrew_gimel 0x20 altgr -hebrew_kaph 0x21 altgr -hebrew_ayin 0x22 altgr -hebrew_yod 0x23 altgr -hebrew_chet 0x24 altgr -hebrew_lamed 0x25 altgr -hebrew_finalkaph 0x26 altgr -hebrew_finalpe 0x27 altgr -comma 0x28 altgr - -# -# Third row -# - -hebrew_zain 0x2c altgr -hebrew_samech 0x2d altgr -hebrew_bet 0x2e altgr -hebrew_he 0x2f altgr -hebrew_nun 0x30 altgr -hebrew_mem 0x31 altgr -hebrew_zade 0x32 altgr - -hebrew_taw 0x33 altgr -hebrew_finalzade 0x34 altgr -period 0x35 altgr - - -# -# en-us -# - - -exclam 0x02 shift -at 0x03 shift -numbersign 0x04 shift -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -bracketleft 0x1a -braceleft 0x1a shift -bracketright 0x1b -braceright 0x1b shift -semicolon 0x27 -colon 0x27 shift -apostrophe 0x28 -quotedbl 0x28 shift -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -comma 0x33 -less 0x33 shift -period 0x34 -greater 0x34 shift -slash 0x35 -question 0x35 shift diff --git a/src/VBox/RDP/client/keymaps/hr b/src/VBox/RDP/client/keymaps/hr deleted file mode 100644 index 613aa6925..000000000 --- a/src/VBox/RDP/client/keymaps/hr +++ /dev/null @@ -1,125 +0,0 @@ -# generated from XKB map hr -include common -map 0x41a -exclam 0x02 shift -asciitilde 0x02 altgr -dead_tilde 0x02 shift altgr -quotedbl 0x03 shift -dead_caron 0x03 altgr -caron 0x03 shift altgr -numbersign 0x04 shift -asciicircum 0x04 altgr -dead_circumflex 0x04 shift altgr -dollar 0x05 shift -dead_breve 0x05 altgr -breve 0x05 shift altgr -percent 0x06 shift -degree 0x06 altgr -dead_abovering 0x06 shift altgr -ampersand 0x07 shift -dead_ogonek 0x07 altgr -ogonek 0x07 shift altgr -slash 0x08 shift -grave 0x08 altgr -dead_grave 0x08 shift altgr -parenleft 0x09 shift -dead_abovedot 0x09 altgr -abovedot 0x09 shift altgr -parenright 0x0a shift -dead_acute 0x0a altgr -apostrophe 0x0a shift altgr -equal 0x0b shift -dead_doubleacute 0x0b altgr -doubleacute 0x0b shift altgr -apostrophe 0x0c -question 0x0c shift -dead_diaeresis 0x0c altgr -diaeresis 0x0c shift altgr -plus 0x0d -asterisk 0x0d shift -dead_cedilla 0x0d altgr -cedilla 0x0d shift altgr -backslash 0x10 altgr -Greek_OMEGA 0x10 shift altgr -bar 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -z 0x15 addupper -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -scaron 0x1a -Scaron 0x1a shift -division 0x1a altgr -dead_abovering 0x1a shift altgr -dstroke 0x1b -Dstroke 0x1b shift -multiply 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -bracketleft 0x21 altgr -ordfeminine 0x21 shift altgr -bracketright 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -lstroke 0x25 altgr -ampersand 0x25 shift altgr -Lstroke 0x26 altgr -ccaron 0x27 -Ccaron 0x27 shift -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -cacute 0x28 -Cacute 0x28 shift -ssharp 0x28 altgr -dead_caron 0x28 shift altgr -dead_cedilla 0x29 -dead_diaeresis 0x29 shift -notsign 0x29 altgr -zcaron 0x2b -Zcaron 0x2b shift -currency 0x2b altgr -dead_breve 0x2b shift altgr -y 0x2c addupper -guillemotleft 0x2c altgr -less 0x2c shift altgr -guillemotright 0x2d altgr -greater 0x2d shift altgr -cent 0x2e altgr -copyright 0x2e shift altgr -at 0x2f altgr -grave 0x2f shift altgr -braceleft 0x30 altgr -apostrophe 0x30 shift altgr -braceright 0x31 altgr -section 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/hu b/src/VBox/RDP/client/keymaps/hu deleted file mode 100644 index 8aba44441..000000000 --- a/src/VBox/RDP/client/keymaps/hu +++ /dev/null @@ -1,115 +0,0 @@ -# Hungarian keyboard layout (QWERTZ) -# Created by: The NeverGone <never@delfin.klte.hu> - -include common -map 0x40e - - -# AltGr keys: -notsign 0x29 altgr -asciitilde 0x02 altgr -caron 0x03 altgr -asciicircum 0x04 altgr -breve 0x05 altgr -degree 0x06 altgr -ogonek 0x07 altgr -grave 0x08 altgr -abovedot 0x09 altgr -acute 0x0a altgr -doubleacute 0x0b altgr -diaeresis 0x0c altgr -cedilla 0x0d altgr -backslash 0x10 altgr -bar 0x11 altgr -EuroSign 0x12 altgr -Iacute 0x17 altgr -division 0x1a altgr -multiply 0x1b altgr -dstroke 0x1f altgr -Dstroke 0x20 altgr -bracketleft 0x21 altgr -bracketright 0x22 altgr -iacute 0x24 altgr -lstroke 0x25 altgr -Lstroke 0x26 altgr -dollar 0x27 altgr -ssharp 0x28 altgr -currency 0x2b altgr -less 0x56 altgr -greater 0x2c altgr -numbersign 0x2d altgr -ampersand 0x2e altgr -at 0x2f altgr -braceleft 0x30 altgr -braceright 0x31 altgr -semicolon 0x33 altgr -asterisk 0x35 altgr - - -# Shift keys: -section 0x29 shift -apostrophe 0x02 shift -quotedbl 0x03 shift -plus 0x04 shift -exclam 0x05 shift -percent 0x06 shift -slash 0x07 shift -equal 0x08 shift -parenleft 0x09 shift -parenright 0x0a shift -Odiaeresis 0x0b shift -Udiaeresis 0x0c shift -Oacute 0x0d shift -Z 0x15 shift -Odoubleacute 0x1a shift -Uacute 0x1b shift -Eacute 0x27 shift -Aacute 0x28 shift -Udoubleacute 0x2b shift -Y 0x2c shift -question 0x33 shift -colon 0x34 shift -underscore 0x35 shift -F13 0x3b shift -F14 0x3c shift -F15 0x3d shift -F16 0x3e shift -F17 0x3f shift -F18 0x40 shift -F19 0x41 shift -F20 0x42 shift -F21 0x43 shift -F22 0x44 shift -F23 0x57 shift -F24 0x58 shift - - -# Ctrl keys: -F25 0x3b ctrl -F26 0x3c ctrl -F27 0x3d ctrl -F28 0x3e ctrl -F29 0x3f ctrl -F30 0x40 ctrl -F31 0x41 ctrl -F32 0x42 ctrl -F33 0x43 ctrl -F34 0x44 ctrl -F35 0x57 ctrl -#NoSymbol 0x58 ctrl - - -0 0x29 -odiaeresis 0x0b -udiaeresis 0x0c -oacute 0x0d -z 0x15 -odoubleacute 0x1a -uacute 0x1b -eacute 0x27 -aacute 0x28 -udoubleacute 0x2b -y 0x2c -comma 0x33 -period 0x34 -minus 0x35 diff --git a/src/VBox/RDP/client/keymaps/is b/src/VBox/RDP/client/keymaps/is deleted file mode 100644 index eee01979b..000000000 --- a/src/VBox/RDP/client/keymaps/is +++ /dev/null @@ -1,140 +0,0 @@ -# 2004-03-16 Halldór Guðmundsson and Morten Lange -# Keyboard definition file for the Icelandic keyboard -# to be used in rdesktop 1.3.x ( See rdesktop.org) -# generated from XKB map de, and changed manually -# Location for example /usr/local/share/rdesktop/keymaps/is -include common -map 0x40f -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -quotedbl 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -#section 0x04 shift -numbersign 0x04 shift -threesuperior 0x04 altgr -sterling 0x04 shift altgr -dollar 0x05 shift -onequarter 0x05 altgr -currency 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -ampersand 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -#ssharp 0x0c -odiaeresis 0x0c -#question 0x0c shift -Odiaeresis 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -#acute 0x0d -minus 0x0d -#dead_acute 0x0d -#grave 0x0d shift -#dead_grave 0x0d shift -underscore 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -#z 0x15 addupper -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -#thorn 0x19 altgr -#THORN 0x19 shift altgr -#udiaeresis 0x1a -#Udiaeresis 0x1a shift -#dead_diaeresis 0x1a altgr -#dead_abovering 0x1a shift altgr -eth 0x1a -ETH 0x1a shift -apostrophe 0x1b -question 0x1b shift -#plus 0x1b -#asterisk 0x1b shift -asciitilde 0x1b altgr -#grave 0x1b altgr -#dead_tilde 0x1b altgr -#dead_macron 0x1b shift altgr -#ae 0x1e altgr -#AE 0x1e shift altgr -#eth 0x20 altgr -#eth 0x20 -#ETH 0x20 shift altgr -#ETH 0x20 shift -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -#adiaeresis 0x27 -#Adiaeresis 0x27 shift -ae 0x27 -AE 0x27 shift -dead_doubleacute 0x27 altgr -#adiaeresis 0x28 -#Adiaeresis 0x28 shift -#dead_caron 0x28 shift altgr -#asciicircum 0x29 -acute 0x28 -dead_acute 0x28 -#dead_circumflex 0x29 -#degree 0x29 shift -#notsign 0x29 altgr -plus 0x2b -asterisk 0x2b shift -grave 0x2b altgr -#numbersign 0x2b -#apostrophe 0x2b shift -#dead_breve 0x2b shift altgr -#y 0x2c addupper -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -#minus 0x35 -#underscore 0x35 shift -thorn 0x35 -THORN 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr - diff --git a/src/VBox/RDP/client/keymaps/it b/src/VBox/RDP/client/keymaps/it deleted file mode 100644 index 00ca73a3e..000000000 --- a/src/VBox/RDP/client/keymaps/it +++ /dev/null @@ -1,115 +0,0 @@ -# generated from XKB map it -include common -map 0x410 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -quotedbl 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -sterling 0x04 shift -threesuperior 0x04 altgr -dollar 0x05 shift -onequarter 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -ampersand 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -parenleft 0x09 shift -trademark 0x09 shift altgr -parenright 0x0a shift -plusminus 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -apostrophe 0x0c -question 0x0c shift -grave 0x0c altgr -questiondown 0x0c shift altgr -igrave 0x0d -asciicircum 0x0d shift -asciitilde 0x0d altgr -dead_ogonek 0x0d shift altgr -at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -egrave 0x1a -eacute 0x1a shift -bracketleft 0x1a altgr -dead_abovering 0x1a shift altgr -plus 0x1b -asterisk 0x1b shift -bracketright 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -ograve 0x27 -ccedilla 0x27 shift -at 0x27 altgr -dead_doubleacute 0x27 shift altgr -agrave 0x28 -degree 0x28 shift -numbersign 0x28 altgr -backslash 0x29 -bar 0x29 shift -notsign 0x29 altgr -ugrave 0x2b -section 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/ja b/src/VBox/RDP/client/keymaps/ja deleted file mode 100644 index 231121507..000000000 --- a/src/VBox/RDP/client/keymaps/ja +++ /dev/null @@ -1,107 +0,0 @@ -# generated from XKB map jp106 -include common -map 0xe0010411 -keyboard_type 0x7 -keyboard_subtype 0x2 -keyboard_functionkeys 0xc -exclam 0x02 shift -kana_NU 0x02 altgr -quotedbl 0x03 shift -kana_FU 0x03 altgr -numbersign 0x04 shift -kana_A 0x04 altgr -kana_a 0x04 shift altgr -dollar 0x05 shift -kana_U 0x05 altgr -kana_u 0x05 shift altgr -percent 0x06 shift -kana_E 0x06 altgr -kana_e 0x06 shift altgr -ampersand 0x07 shift -kana_O 0x07 altgr -kana_o 0x07 shift altgr -apostrophe 0x08 shift -kana_YA 0x08 altgr -kana_ya 0x08 shift altgr -parenleft 0x09 shift -kana_YU 0x09 altgr -kana_yu 0x09 shift altgr -parenright 0x0a shift -kana_YO 0x0a altgr -kana_yo 0x0a shift altgr -asciitilde 0x0b shift -kana_WA 0x0b altgr -kana_WO 0x0b shift altgr -minus 0x0c -equal 0x0c shift -kana_HO 0x0c altgr -asciicircum 0x0d -asciitilde 0x0d shift -kana_HE 0x0d altgr -kana_TA 0x10 altgr -kana_TE 0x11 altgr -kana_I 0x12 altgr -kana_i 0x12 shift altgr -kana_SU 0x13 altgr -kana_KA 0x14 altgr -kana_N 0x15 altgr -kana_NA 0x16 altgr -kana_NI 0x17 altgr -kana_RA 0x18 altgr -kana_SE 0x19 altgr -at 0x1a -grave 0x1a shift -voicedsound 0x1a altgr -bracketleft 0x1b -braceleft 0x1b shift -semivoicedsound 0x1b altgr -kana_openingbracket 0x1b shift altgr -kana_CHI 0x1e altgr -kana_TO 0x1f altgr -kana_SHI 0x20 altgr -kana_HA 0x21 altgr -kana_KI 0x22 altgr -kana_KU 0x23 altgr -kana_MA 0x24 altgr -kana_NO 0x25 altgr -kana_RI 0x26 altgr -semicolon 0x27 -plus 0x27 shift -kana_RE 0x27 altgr -colon 0x28 -asterisk 0x28 shift -kana_KE 0x28 altgr -Zenkaku_Hankaku 0x29 -bracketright 0x2b -braceright 0x2b shift -kana_MU 0x2b altgr -kana_closingbracket 0x2b shift altgr -kana_TSU 0x2c altgr -kana_tsu 0x2c shift altgr -kana_SA 0x2d altgr -kana_SO 0x2e altgr -kana_HI 0x2f altgr -kana_KO 0x30 altgr -kana_MI 0x31 altgr -kana_MO 0x32 altgr -comma 0x33 -less 0x33 shift -kana_NE 0x33 altgr -kana_comma 0x33 shift altgr -period 0x34 -greater 0x34 shift -kana_RU 0x34 altgr -kana_fullstop 0x34 shift altgr -slash 0x35 -question 0x35 shift -kana_ME 0x35 altgr -kana_conjunctive 0x35 shift altgr -Eisu_toggle 0x3a shift -Execute 0x54 shift -Kanji 0x70 -backslash 0x73 -bar 0x7d shift -underscore 0x73 shift -Henkan_Mode 0x79 -Katakana 0x70 -Muhenkan 0x7b diff --git a/src/VBox/RDP/client/keymaps/ko b/src/VBox/RDP/client/keymaps/ko deleted file mode 100644 index 89e92a509..000000000 --- a/src/VBox/RDP/client/keymaps/ko +++ /dev/null @@ -1,37 +0,0 @@ -# generated from XKB map ko -include common -map 0xe0010412 -exclam 0x02 shift -at 0x03 shift -numbersign 0x04 shift -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -bracketleft 0x1a -braceleft 0x1a shift -bracketright 0x1b -braceright 0x1b shift -semicolon 0x27 -colon 0x27 shift -apostrophe 0x28 -quotedbl 0x28 shift -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -comma 0x33 -less 0x33 shift -period 0x34 -greater 0x34 shift -slash 0x35 -question 0x35 shift -Hangul 0xf2 -Hangul_Hanja 0xf1 diff --git a/src/VBox/RDP/client/keymaps/lt b/src/VBox/RDP/client/keymaps/lt deleted file mode 100644 index 3d9d619ea..000000000 --- a/src/VBox/RDP/client/keymaps/lt +++ /dev/null @@ -1,57 +0,0 @@ -# generated from XKB map lt -include common -map 0x427 -exclam 0x02 shift -aogonek 0x02 altgr -Aogonek 0x02 shift altgr -at 0x03 shift -ccaron 0x03 altgr -Ccaron 0x03 shift altgr -numbersign 0x04 shift -eogonek 0x04 altgr -Eogonek 0x04 shift altgr -dollar 0x05 shift -eabovedot 0x05 altgr -Eabovedot 0x05 shift altgr -percent 0x06 shift -iogonek 0x06 altgr -Iogonek 0x06 shift altgr -asciicircum 0x07 shift -scaron 0x07 altgr -Scaron 0x07 shift altgr -ampersand 0x08 shift -uogonek 0x08 altgr -Uogonek 0x08 shift altgr -asterisk 0x09 shift -umacron 0x09 altgr -Umacron 0x09 shift altgr -parenleft 0x0a shift -doublelowquotemark 0x0a altgr -parenright 0x0b shift -leftdoublequotemark 0x0b altgr -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -zcaron 0x0d altgr -Zcaron 0x0d shift altgr -bracketleft 0x1a -braceleft 0x1a shift -bracketright 0x1b -braceright 0x1b shift -semicolon 0x27 -colon 0x27 shift -apostrophe 0x28 -quotedbl 0x28 shift -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -comma 0x33 -less 0x33 shift -period 0x34 -greater 0x34 shift -slash 0x35 -question 0x35 shift -endash 0x56 -EuroSign 0x56 shift diff --git a/src/VBox/RDP/client/keymaps/lv b/src/VBox/RDP/client/keymaps/lv deleted file mode 100644 index 1d9172791..000000000 --- a/src/VBox/RDP/client/keymaps/lv +++ /dev/null @@ -1,128 +0,0 @@ -# generated from XKB map lv -include common -map 0x426 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -at 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -numbersign 0x04 shift -threesuperior 0x04 altgr -sterling 0x04 shift altgr -dollar 0x05 shift -EuroSign 0x05 altgr -cent 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -asciicircum 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -ampersand 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -asterisk 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenleft 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -parenright 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -minus 0x0c -underscore 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -equal 0x0d -plus 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -emacron 0x12 altgr -Emacron 0x12 shift altgr -rcedilla 0x13 altgr -Rcedilla 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -umacron 0x16 altgr -Umacron 0x16 shift altgr -imacron 0x17 altgr -Imacron 0x17 shift altgr -omacron 0x18 altgr -Omacron 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -dead_tilde 0x1b altgr -dead_macron 0x1b shift altgr -ISO_Next_Group 0x1c shift -amacron 0x1e altgr -Amacron 0x1e shift altgr -scaron 0x1f altgr -Scaron 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -gcedilla 0x22 altgr -Gcedilla 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kcedilla 0x25 altgr -Kcedilla 0x25 shift altgr -lcedilla 0x26 altgr -Lcedilla 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -apostrophe 0x28 -quotedbl 0x28 shift -leftdoublequotemark 0x28 altgr -doublelowquotemark 0x28 shift altgr -grave 0x29 -asciitilde 0x29 shift -notsign 0x29 altgr -backslash 0x2b -bar 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -zcaron 0x2c altgr -Zcaron 0x2c shift altgr -guillemotright 0x2d altgr -greater 0x2d shift altgr -ccaron 0x2e altgr -Ccaron 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -apostrophe 0x30 shift altgr -ncedilla 0x31 altgr -Ncedilla 0x31 shift altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -less 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -greater 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -slash 0x35 -question 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr -nobreakspace 0x39 altgr diff --git a/src/VBox/RDP/client/keymaps/mk b/src/VBox/RDP/client/keymaps/mk deleted file mode 100644 index 18c150484..000000000 --- a/src/VBox/RDP/client/keymaps/mk +++ /dev/null @@ -1,101 +0,0 @@ -# generated from XKB map mk -include common -map 0x42f -exclam 0x02 shift -at 0x03 shift -doublelowquotemark 0x03 shift altgr -numbersign 0x04 shift -leftdoublequotemark 0x04 shift altgr -dollar 0x05 shift -percent 0x06 shift -asciicircum 0x07 shift -ampersand 0x08 shift -asterisk 0x09 shift -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -Cyrillic_lje 0x10 altgr -Cyrillic_LJE 0x10 shift altgr -Cyrillic_nje 0x11 altgr -Cyrillic_NJE 0x11 shift altgr -Cyrillic_ie 0x12 altgr -Cyrillic_IE 0x12 shift altgr -Cyrillic_er 0x13 altgr -Cyrillic_ER 0x13 shift altgr -Cyrillic_te 0x14 altgr -Cyrillic_TE 0x14 shift altgr -Macedonia_dse 0x15 altgr -Macedonia_DSE 0x15 shift altgr -Cyrillic_u 0x16 altgr -Cyrillic_U 0x16 shift altgr -Cyrillic_i 0x17 altgr -Cyrillic_I 0x17 shift altgr -Cyrillic_o 0x18 altgr -Cyrillic_O 0x18 shift altgr -Cyrillic_pe 0x19 altgr -Cyrillic_PE 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -Cyrillic_sha 0x1a altgr -Cyrillic_SHA 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -Macedonia_gje 0x1b altgr -Macedonia_GJE 0x1b shift altgr -Cyrillic_a 0x1e altgr -Cyrillic_A 0x1e shift altgr -Cyrillic_es 0x1f altgr -Cyrillic_ES 0x1f shift altgr -Cyrillic_de 0x20 altgr -Cyrillic_DE 0x20 shift altgr -Cyrillic_ef 0x21 altgr -Cyrillic_EF 0x21 shift altgr -Cyrillic_ghe 0x22 altgr -Cyrillic_GHE 0x22 shift altgr -Cyrillic_ha 0x23 altgr -Cyrillic_HA 0x23 shift altgr -Cyrillic_je 0x24 altgr -Cyrillic_JE 0x24 shift altgr -Cyrillic_ka 0x25 altgr -Cyrillic_KA 0x25 shift altgr -Cyrillic_el 0x26 altgr -Cyrillic_EL 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -Cyrillic_che 0x27 altgr -Cyrillic_CHE 0x27 shift altgr -apostrophe 0x28 -quotedbl 0x28 shift -Macedonia_kje 0x28 altgr -Macedonia_KJE 0x28 shift altgr -grave 0x29 -asciitilde 0x29 shift -backslash 0x2b -bar 0x2b shift -Cyrillic_zhe 0x2b altgr -Cyrillic_ZHE 0x2b shift altgr -Cyrillic_ze 0x2c altgr -Cyrillic_ZE 0x2c shift altgr -Cyrillic_dzhe 0x2d altgr -Cyrillic_DZHE 0x2d shift altgr -Cyrillic_tse 0x2e altgr -Cyrillic_TSE 0x2e shift altgr -Cyrillic_ve 0x2f altgr -Cyrillic_VE 0x2f shift altgr -Cyrillic_be 0x30 altgr -Cyrillic_BE 0x30 shift altgr -Cyrillic_en 0x31 altgr -Cyrillic_EN 0x31 shift altgr -Cyrillic_em 0x32 altgr -Cyrillic_EM 0x32 shift altgr -comma 0x33 -less 0x33 shift -semicolon 0x33 shift altgr -period 0x34 -greater 0x34 shift -colon 0x34 shift altgr -slash 0x35 -question 0x35 shift diff --git a/src/VBox/RDP/client/keymaps/modifiers b/src/VBox/RDP/client/keymaps/modifiers deleted file mode 100644 index c81d9fdef..000000000 --- a/src/VBox/RDP/client/keymaps/modifiers +++ /dev/null @@ -1,18 +0,0 @@ -Shift_R 0x36 -Shift_L 0x2a - -Alt_R 0xb8 -Mode_switch 0xb8 -ISO_Level3_Shift 0xb8 - -Alt_L 0x38 - -Control_R 0x9d -Control_L 0x1d - -# Translate Meta, Super and Hyper to Windows keys. -# This is hardcoded. See documentation for details. - -# Translate Menu to the Windows Application key. -# This one does not work either. -Menu 0xdd diff --git a/src/VBox/RDP/client/keymaps/nl b/src/VBox/RDP/client/keymaps/nl deleted file mode 100644 index bc823bd2f..000000000 --- a/src/VBox/RDP/client/keymaps/nl +++ /dev/null @@ -1,60 +0,0 @@ -# Dutch (Netherlands) -include common -map 0x413 - -exclam 0x02 shift -onesuperior 0x02 altgr -quotebl 0x03 shift -twosuperior 0x03 altgr -numbersign 0x04 shift -threesuperior 0x04 altgr -dollar 0x05 shift -onequarter 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -ampersand 0x07 shift -threequarters 0x07 altgr -underscore 0x08 shift -sterling 0x08 altgr -parenleft 0x09 shift -braceleft 0x09 altgr -parenright 0x0a shift -braceright 0x0a altgr -apostrophe 0x0b shift -slash 0x0c -question 0x0c shift -backslash 0x0c altgr -degree 0x0d -dead_tilde 0x0d shift -dead_cedilla 0x0d altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -dead_diaeresis 0x1a -dead_circumflex 0x1a shift -asterisk 0x1b -bar 0x1b shift -ssharp 0x1f altgr -plus 0x27 -plusminus 0x27 shift -dead_acute 0x28 -dead_grave 0x28 shift -at 0x29 -section 0x29 shift -notsign 0x29 altgr -less 0x2b -greater 0x2b shift -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -copyright 0x2e altgr -mu 0x32 altgr -comma 0x33 -semicolon 0x33 shift -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -hyphen 0x35 -equal 0x35 shift -bracketright 0x56 -bracketleft 0x56 shift -brokenbar 0x56 altgr - diff --git a/src/VBox/RDP/client/keymaps/nl-be b/src/VBox/RDP/client/keymaps/nl-be deleted file mode 100644 index 28bbafa41..000000000 --- a/src/VBox/RDP/client/keymaps/nl-be +++ /dev/null @@ -1,142 +0,0 @@ -# Dutch (Belgium) -map 0x813 -include common -ampersand 0x02 -1 0x02 shift -bar 0x02 altgr -exclamdown 0x02 shift altgr -eacute 0x03 -2 0x03 shift -at 0x03 altgr -oneeighth 0x03 shift altgr -quotedbl 0x04 -3 0x04 shift -numbersign 0x04 altgr -sterling 0x04 shift altgr -apostrophe 0x05 -4 0x05 shift -onequarter 0x05 altgr -dollar 0x05 shift altgr -parenleft 0x06 -5 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -section 0x07 -6 0x07 shift -asciicircum 0x07 altgr -fiveeighths 0x07 shift altgr -egrave 0x08 -7 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -exclam 0x09 -8 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -ccedilla 0x0a -9 0x0a shift -braceleft 0x0a altgr -plusminus 0x0a shift altgr -agrave 0x0b -0 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -parenright 0x0c -degree 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -minus 0x0d -underscore 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -a 0x10 addupper -# at 0x10 altgr -Greek_OMEGA 0x10 shift altgr -z 0x11 addupper -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -dead_circumflex 0x1a -dead_diaeresis 0x1a shift -bracketleft 0x1a altgr -dead_abovering 0x1a shift altgr -dollar 0x1b -asterisk 0x1b shift -bracketright 0x1b altgr -dead_macron 0x1b shift altgr -q 0x1e addupper -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -# ampersand 0x25 shift altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -m 0x27 addupper -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -ugrave 0x28 -percent 0x28 shift -dead_acute 0x28 altgr -dead_caron 0x28 shift altgr -twosuperior 0x29 -threesuperior 0x29 shift -notsign 0x29 altgr -mu 0x2b -sterling 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -w 0x2c addupper -guillemotleft 0x2c altgr -less 0x2c shift altgr -guillemotright 0x2d altgr -greater 0x2d shift altgr -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -# apostrophe 0x30 shift altgr -comma 0x32 -question 0x32 shift -dead_cedilla 0x32 altgr -masculine 0x32 shift altgr -semicolon 0x33 -period 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -colon 0x34 -slash 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -equal 0x35 -plus 0x35 shift -dead_tilde 0x35 altgr -dead_abovedot 0x35 shift altgr -backslash 0x56 altgr -less 0x56 -greater 0x56 shift diff --git a/src/VBox/RDP/client/keymaps/no b/src/VBox/RDP/client/keymaps/no deleted file mode 100644 index 40a64790d..000000000 --- a/src/VBox/RDP/client/keymaps/no +++ /dev/null @@ -1,119 +0,0 @@ -# generated from XKB map no -include common -map 0x414 -exclam 0x02 shift -exclamdown 0x02 altgr -onesuperior 0x02 shift altgr -quotedbl 0x03 shift -at 0x03 altgr -twosuperior 0x03 shift altgr -numbersign 0x04 shift -sterling 0x04 altgr -threesuperior 0x04 shift altgr -currency 0x05 shift -dollar 0x05 altgr -onequarter 0x05 shift altgr -percent 0x06 shift -onehalf 0x06 altgr -cent 0x06 shift altgr -ampersand 0x07 shift -yen 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -division 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -guillemotleft 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -guillemotright 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -plus 0x0c -question 0x0c shift -plusminus 0x0c altgr -questiondown 0x0c shift altgr -backslash 0x0d -dead_grave 0x0d shift -dead_acute 0x0d altgr -notsign 0x0d shift altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -registered 0x13 altgr -thorn 0x14 altgr -THORN 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oe 0x18 altgr -OE 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -aring 0x1a -Aring 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -dead_diaeresis 0x1b -dead_circumflex 0x1b shift -asciicircum 0x01b shift -dead_tilde 0x1b altgr -asciitilde 0x1b altgr -dead_caron 0x1b shift altgr -ordfeminine 0x1e altgr -masculine 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -oslash 0x27 -Ooblique 0x27 shift -dead_doubleacute 0x27 shift altgr -ae 0x28 -AE 0x28 shift -dead_caron 0x28 shift altgr -bar 0x29 -section 0x29 shift -brokenbar 0x29 altgr -paragraph 0x29 shift altgr -apostrophe 0x2b -asterisk 0x2b shift -multiply 0x2b shift altgr -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -copyright 0x2e altgr -leftdoublequotemark 0x2f altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -dead_cedilla 0x33 altgr -dead_ogonek 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -dead_abovedot 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -hyphen 0x35 altgr -macron 0x35 shift altgr -nobreakspace 0x39 altgr -onehalf 0x56 altgr -threequarters 0x56 shift altgr diff --git a/src/VBox/RDP/client/keymaps/pl b/src/VBox/RDP/client/keymaps/pl deleted file mode 100644 index 09c600d35..000000000 --- a/src/VBox/RDP/client/keymaps/pl +++ /dev/null @@ -1,122 +0,0 @@ -# generated from XKB map pl -include common -map 0x415 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -at 0x03 shift -twosuperior 0x03 altgr -oneeighth 0x03 shift altgr -numbersign 0x04 shift -threesuperior 0x04 altgr -sterling 0x04 shift altgr -dollar 0x05 shift -onequarter 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -asciicircum 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -ampersand 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -asterisk 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenleft 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -parenright 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -minus 0x0c -underscore 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -equal 0x0d -plus 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -eogonek 0x12 altgr -Eogonek 0x12 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -EuroSign 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oacute 0x18 altgr -Oacute 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -dead_tilde 0x1b altgr -dead_macron 0x1b shift altgr -aogonek 0x1e altgr -Aogonek 0x1e shift altgr -sacute 0x1f altgr -Sacute 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -dead_acute 0x27 altgr -dead_doubleacute 0x27 shift altgr -apostrophe 0x28 -quotedbl 0x28 shift -dead_circumflex 0x28 altgr -dead_caron 0x28 shift altgr -grave 0x29 -asciitilde 0x29 shift -notsign 0x29 altgr -backslash 0x2b -bar 0x2b shift -dead_grave 0x2b altgr -dead_breve 0x2b shift altgr -zabovedot 0x2c altgr -Zabovedot 0x2c shift altgr -zacute 0x2d altgr -Zacute 0x2d shift altgr -cacute 0x2e altgr -Cacute 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -nacute 0x31 altgr -Nacute 0x31 shift altgr -mu 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -less 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -greater 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -slash 0x35 -question 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/pt b/src/VBox/RDP/client/keymaps/pt deleted file mode 100644 index c6941f651..000000000 --- a/src/VBox/RDP/client/keymaps/pt +++ /dev/null @@ -1,113 +0,0 @@ -# generated from XKB map pt -include common -map 0x816 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -quotedbl 0x03 shift -at 0x03 altgr -oneeighth 0x03 shift altgr -numbersign 0x04 shift -sterling 0x04 altgr -dollar 0x05 shift -section 0x05 altgr -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr -ampersand 0x07 shift -threequarters 0x07 altgr -fiveeighths 0x07 shift altgr -slash 0x08 shift -braceleft 0x08 altgr -seveneighths 0x08 shift altgr -parenleft 0x09 shift -bracketleft 0x09 altgr -trademark 0x09 shift altgr -parenright 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr -apostrophe 0x0c -question 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr -guillemotleft 0x0d -guillemotright 0x0d shift -dead_cedilla 0x0d altgr -dead_ogonek 0x0d shift altgr -Greek_OMEGA 0x10 shift altgr -lstroke 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -cent 0x12 shift altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -plus 0x1a -asterisk 0x1a shift -dead_diaeresis 0x1a altgr -dead_abovering 0x1a shift altgr -dead_acute 0x1b -dead_grave 0x1b shift -dead_tilde 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -eth 0x20 altgr -ETH 0x20 shift altgr -dstroke 0x21 altgr -ordfeminine 0x21 shift altgr -eng 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -kra 0x25 altgr -lstroke 0x26 altgr -Lstroke 0x26 shift altgr -ccedilla 0x27 -Ccedilla 0x27 shift -dead_doubleacute 0x27 shift altgr -masculine 0x28 -ordfeminine 0x28 shift -dead_circumflex 0x28 altgr -dead_caron 0x28 shift altgr -backslash 0x29 -bar 0x29 shift -notsign 0x29 altgr -dead_tilde 0x2b -dead_circumflex 0x2b shift -dead_breve 0x2b shift altgr -less 0x56 -greater 0x56 shift -cent 0x2e altgr -copyright 0x2e shift altgr -leftdoublequotemark 0x2f altgr -grave 0x2f shift altgr -rightdoublequotemark 0x30 altgr -mu 0x32 altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -multiply 0x33 shift altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr -dead_abovedot 0x35 shift altgr diff --git a/src/VBox/RDP/client/keymaps/pt-br b/src/VBox/RDP/client/keymaps/pt-br deleted file mode 100644 index 54bafc5dc..000000000 --- a/src/VBox/RDP/client/keymaps/pt-br +++ /dev/null @@ -1,69 +0,0 @@ -# generated from XKB map br -include common -map 0x416 -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr -at 0x03 shift -twosuperior 0x03 altgr -onehalf 0x03 shift altgr -numbersign 0x04 shift -threesuperior 0x04 altgr -threequarters 0x04 shift altgr -dollar 0x05 shift -sterling 0x05 altgr -onequarter 0x05 shift altgr -percent 0x06 shift -cent 0x06 altgr -dead_diaeresis 0x07 shift -notsign 0x07 altgr -diaeresis 0x07 shift altgr -ampersand 0x08 shift -braceleft 0x08 altgr -asterisk 0x09 shift -bracketleft 0x09 altgr -parenleft 0x0a shift -bracketright 0x0a altgr -parenright 0x0b shift -braceright 0x0b altgr -minus 0x0c -underscore 0x0c shift -backslash 0x0c altgr -equal 0x0d -plus 0x0d shift -section 0x0d altgr -EuroSign 0x12 altgr -registered 0x13 altgr -dead_acute 0x1a -dead_grave 0x1a shift -acute 0x1a altgr -grave 0x1a shift altgr -bracketleft 0x1b -braceleft 0x1b shift -ordfeminine 0x1b altgr -ccedilla 0x27 -Ccedilla 0x27 shift -dead_tilde 0x28 -dead_circumflex 0x28 shift -asciitilde 0x28 altgr -asciicircum 0x28 shift altgr -apostrophe 0x29 -quotedbl 0x29 shift -bracketright 0x2b -braceright 0x2b shift -masculine 0x2b altgr -copyright 0x2e altgr -mu 0x32 altgr -comma 0x33 -less 0x33 shift -period 0x34 -greater 0x34 shift -semicolon 0x35 -colon 0x35 shift -comma 0x53 numlock -backslash 0x56 -bar 0x56 shift -slash 0x73 -question 0x73 shift -degree 0x73 altgr -KP_Decimal 0x34 diff --git a/src/VBox/RDP/client/keymaps/ru b/src/VBox/RDP/client/keymaps/ru deleted file mode 100644 index b3e7d24de..000000000 --- a/src/VBox/RDP/client/keymaps/ru +++ /dev/null @@ -1,109 +0,0 @@ -# generated from XKB map ru -include common -map 0x419 -exclam 0x02 shift -at 0x03 shift -quotedbl 0x03 shift altgr -numbersign 0x04 shift -dollar 0x05 shift -asterisk 0x05 shift altgr -percent 0x06 shift -colon 0x06 shift altgr -asciicircum 0x07 shift -comma 0x07 shift altgr -ampersand 0x08 shift -period 0x08 shift altgr -asterisk 0x09 shift -semicolon 0x09 shift altgr -parenleft 0x0a shift -parenright 0x0b shift -minus 0x0c -underscore 0x0c shift -equal 0x0d -plus 0x0d shift -Cyrillic_shorti 0x10 altgr -Cyrillic_SHORTI 0x10 shift altgr -Cyrillic_tse 0x11 altgr -Cyrillic_TSE 0x11 shift altgr -Cyrillic_u 0x12 altgr -Cyrillic_U 0x12 shift altgr -Cyrillic_ka 0x13 altgr -Cyrillic_KA 0x13 shift altgr -Cyrillic_ie 0x14 altgr -Cyrillic_IE 0x14 shift altgr -Cyrillic_en 0x15 altgr -Cyrillic_EN 0x15 shift altgr -Cyrillic_ghe 0x16 altgr -Cyrillic_GHE 0x16 shift altgr -Cyrillic_sha 0x17 altgr -Cyrillic_SHA 0x17 shift altgr -Cyrillic_shcha 0x18 altgr -Cyrillic_SHCHA 0x18 shift altgr -Cyrillic_ze 0x19 altgr -Cyrillic_ZE 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -Cyrillic_ha 0x1a altgr -Cyrillic_HA 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -Cyrillic_hardsign 0x1b altgr -Cyrillic_HARDSIGN 0x1b shift altgr -Cyrillic_ef 0x1e altgr -Cyrillic_EF 0x1e shift altgr -Cyrillic_yeru 0x1f altgr -Cyrillic_YERU 0x1f shift altgr -Cyrillic_ve 0x20 altgr -Cyrillic_VE 0x20 shift altgr -Cyrillic_a 0x21 altgr -Cyrillic_A 0x21 shift altgr -Cyrillic_pe 0x22 altgr -Cyrillic_PE 0x22 shift altgr -Cyrillic_er 0x23 altgr -Cyrillic_ER 0x23 shift altgr -Cyrillic_o 0x24 altgr -Cyrillic_O 0x24 shift altgr -Cyrillic_el 0x25 altgr -Cyrillic_EL 0x25 shift altgr -Cyrillic_de 0x26 altgr -Cyrillic_DE 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -Cyrillic_zhe 0x27 altgr -Cyrillic_ZHE 0x27 shift altgr -apostrophe 0x28 -quotedbl 0x28 shift -Cyrillic_e 0x28 altgr -Cyrillic_E 0x28 shift altgr -grave 0x29 -asciitilde 0x29 shift -Cyrillic_io 0x29 altgr -Cyrillic_IO 0x29 shift altgr -backslash 0x2b -bar 0x2b shift -Cyrillic_ya 0x2c altgr -Cyrillic_YA 0x2c shift altgr -Cyrillic_che 0x2d altgr -Cyrillic_CHE 0x2d shift altgr -Cyrillic_es 0x2e altgr -Cyrillic_ES 0x2e shift altgr -Cyrillic_em 0x2f altgr -Cyrillic_EM 0x2f shift altgr -Cyrillic_i 0x30 altgr -Cyrillic_I 0x30 shift altgr -Cyrillic_te 0x31 altgr -Cyrillic_TE 0x31 shift altgr -Cyrillic_softsign 0x32 altgr -Cyrillic_SOFTSIGN 0x32 shift altgr -comma 0x33 -less 0x33 shift -Cyrillic_be 0x33 altgr -Cyrillic_BE 0x33 shift altgr -period 0x34 -greater 0x34 shift -Cyrillic_yu 0x34 altgr -Cyrillic_YU 0x34 shift altgr -slash 0x35 -question 0x35 shift -slash 0x56 altgr -bar 0x56 shift altgr diff --git a/src/VBox/RDP/client/keymaps/sl b/src/VBox/RDP/client/keymaps/sl deleted file mode 100644 index 56835a92c..000000000 --- a/src/VBox/RDP/client/keymaps/sl +++ /dev/null @@ -1,110 +0,0 @@ -# generated from XKB map sl -include common -map 0x424 -exclam 0x02 shift -asciitilde 0x02 altgr -dead_tilde 0x02 shift altgr -quotedbl 0x03 shift -dead_caron 0x03 altgr -caron 0x03 shift altgr -numbersign 0x04 shift -asciicircum 0x04 altgr -dead_circumflex 0x04 shift altgr -dollar 0x05 shift -dead_breve 0x05 altgr -breve 0x05 shift altgr -percent 0x06 shift -degree 0x06 altgr -dead_abovering 0x06 shift altgr -ampersand 0x07 shift -dead_ogonek 0x07 altgr -ogonek 0x07 shift altgr -slash 0x08 shift -grave 0x08 altgr -dead_grave 0x08 shift altgr -parenleft 0x09 shift -dead_abovedot 0x09 altgr -abovedot 0x09 shift altgr -parenright 0x0a shift -dead_acute 0x0a altgr -equal 0x0b shift -dead_doubleacute 0x0b altgr -doubleacute 0x0b shift altgr -apostrophe 0x0c -question 0x0c shift -dead_diaeresis 0x0c altgr -diaeresis 0x0c shift altgr -plus 0x0d -asterisk 0x0d shift -dead_cedilla 0x0d altgr -cedilla 0x0d shift altgr -backslash 0x10 altgr -Greek_OMEGA 0x10 shift altgr -bar 0x11 altgr -Lstroke 0x11 shift altgr -EuroSign 0x12 altgr -paragraph 0x13 altgr -registered 0x13 shift altgr -tslash 0x14 altgr -Tslash 0x14 shift altgr -z 0x15 addupper -leftarrow 0x15 altgr -yen 0x15 shift altgr -downarrow 0x16 altgr -uparrow 0x16 shift altgr -rightarrow 0x17 altgr -idotless 0x17 shift altgr -oslash 0x18 altgr -Ooblique 0x18 shift altgr -thorn 0x19 altgr -THORN 0x19 shift altgr -scaron 0x1a -Scaron 0x1a shift -division 0x1a altgr -dstroke 0x1b -Dstroke 0x1b shift -multiply 0x1b altgr -dead_macron 0x1b shift altgr -ae 0x1e altgr -AE 0x1e shift altgr -ssharp 0x1f altgr -section 0x1f shift altgr -eth 0x20 altgr -ETH 0x20 shift altgr -bracketleft 0x21 altgr -ordfeminine 0x21 shift altgr -bracketright 0x22 altgr -ENG 0x22 shift altgr -hstroke 0x23 altgr -Hstroke 0x23 shift altgr -lstroke 0x25 altgr -Lstroke 0x26 altgr -ccaron 0x27 -Ccaron 0x27 shift -cacute 0x28 -Cacute 0x28 shift -ssharp 0x28 altgr -dead_cedilla 0x29 -notsign 0x29 altgr -zcaron 0x2b -Zcaron 0x2b shift -currency 0x2b altgr -y 0x2c addupper -guillemotleft 0x2c altgr -guillemotright 0x2d altgr -cent 0x2e altgr -copyright 0x2e shift altgr -at 0x2f altgr -braceleft 0x30 altgr -braceright 0x31 altgr -section 0x32 altgr -masculine 0x32 shift altgr -comma 0x33 -semicolon 0x33 shift -horizconnector 0x33 altgr -period 0x34 -colon 0x34 shift -periodcentered 0x34 altgr -minus 0x35 -underscore 0x35 shift -dead_belowdot 0x35 altgr diff --git a/src/VBox/RDP/client/keymaps/sv b/src/VBox/RDP/client/keymaps/sv deleted file mode 100644 index 0c6571f37..000000000 --- a/src/VBox/RDP/client/keymaps/sv +++ /dev/null @@ -1,80 +0,0 @@ -map 0x0000041d -include common - -# -# Top row -# -section 0x29 -onehalf 0x29 shift - -# 1 -exclam 0x2 shift - -# 2 -quotedbl 0x3 shift -at 0x3 altgr - -# 3 -numbersign 0x4 shift -sterling 0x4 altgr -# 4 -currency 0x5 shift -dollar 0x5 altgr -# 5 -percent 0x6 shift -# 6 -ampersand 0x7 shift -# 7 -slash 0x8 shift -braceleft 0x8 altgr -# 8 -parenleft 0x9 shift -bracketleft 0x9 altgr -# 9 -parenright 0xa shift -bracketright 0xa altgr -# 0 -equal 0xb shift -braceright 0xb altgr - -plus 0xc -question 0xc shift -backslash 0xc altgr - -dead_acute 0xd -dead_grave 0xd shift - -# -# QWERTY first row -# -EuroSign 0x12 altgr -aring 0x1a -Aring 0x1a shift -dead_diaeresis 0x1b -dead_circumflex 0x1b shift -dead_tilde 0x1b altgr - -# -# QWERTY second row -# -odiaeresis 0x27 -Odiaeresis 0x27 shift -adiaeresis 0x28 -Adiaeresis 0x28 shift -apostrophe 0x2b -asterisk 0x2b shift - -# -# QWERTY third row -# -less 0x56 -greater 0x56 shift -bar 0x56 altgr -mu 0x32 altgr -comma 0x33 -semicolon 0x33 shift -period 0x34 -colon 0x34 shift -minus 0x35 -underscore 0x35 shift - diff --git a/src/VBox/RDP/client/keymaps/th b/src/VBox/RDP/client/keymaps/th deleted file mode 100644 index b65b6da5d..000000000 --- a/src/VBox/RDP/client/keymaps/th +++ /dev/null @@ -1,131 +0,0 @@ -# generated from XKB map th -include common -map 0x41e -exclam 0x02 shift -Thai_lakkhangyao 0x02 altgr -plus 0x02 shift altgr -at 0x03 shift -slash 0x03 altgr -Thai_leknung 0x03 shift altgr -numbersign 0x04 shift -minus 0x04 altgr -Thai_leksong 0x04 shift altgr -dollar 0x05 shift -Thai_phosamphao 0x05 altgr -Thai_leksam 0x05 shift altgr -percent 0x06 shift -Thai_thothung 0x06 altgr -Thai_leksi 0x06 shift altgr -asciicircum 0x07 shift -Thai_sarau 0x07 altgr -Thai_sarauu 0x07 shift altgr -ampersand 0x08 shift -Thai_saraue 0x08 altgr -Thai_baht 0x08 shift altgr -asterisk 0x09 shift -Thai_khokhwai 0x09 altgr -Thai_lekha 0x09 shift altgr -parenleft 0x0a shift -Thai_totao 0x0a altgr -Thai_lekhok 0x0a shift altgr -parenright 0x0b shift -Thai_chochan 0x0b altgr -Thai_lekchet 0x0b shift altgr -minus 0x0c -underscore 0x0c shift -Thai_khokhai 0x0c altgr -Thai_lekpaet 0x0c shift altgr -equal 0x0d -plus 0x0d shift -Thai_chochang 0x0d altgr -Thai_lekkao 0x0d shift altgr -Thai_maiyamok 0x10 altgr -Thai_leksun 0x10 shift altgr -Thai_saraaimaimalai 0x11 altgr -quotedbl 0x11 shift altgr -Thai_saraam 0x12 altgr -Thai_dochada 0x12 shift altgr -Thai_phophan 0x13 altgr -Thai_thonangmontho 0x13 shift altgr -Thai_saraa 0x14 altgr -Thai_thothong 0x14 shift altgr -Thai_maihanakat 0x15 altgr -Thai_nikhahit 0x15 shift altgr -Thai_saraii 0x16 altgr -Thai_maitri 0x16 shift altgr -Thai_rorua 0x17 altgr -Thai_nonen 0x17 shift altgr -Thai_nonu 0x18 altgr -Thai_paiyannoi 0x18 shift altgr -Thai_yoyak 0x19 altgr -Thai_yoying 0x19 shift altgr -bracketleft 0x1a -braceleft 0x1a shift -Thai_bobaimai 0x1a altgr -Thai_thothan 0x1a shift altgr -bracketright 0x1b -braceright 0x1b shift -Thai_loling 0x1b altgr -comma 0x1b shift altgr -Thai_fofan 0x1e altgr -Thai_ru 0x1e shift altgr -Thai_hohip 0x1f altgr -Thai_khorakhang 0x1f shift altgr -Thai_kokai 0x20 altgr -Thai_topatak 0x20 shift altgr -Thai_dodek 0x21 altgr -Thai_sarao 0x21 shift altgr -Thai_sarae 0x22 altgr -Thai_chochoe 0x22 shift altgr -Thai_maitho 0x23 altgr -Thai_maitaikhu 0x23 shift altgr -Thai_maiek 0x24 altgr -Thai_maichattawa 0x24 shift altgr -Thai_saraaa 0x25 altgr -Thai_sorusi 0x25 shift altgr -Thai_sosua 0x26 altgr -Thai_sosala 0x26 shift altgr -semicolon 0x27 -colon 0x27 shift -Thai_wowaen 0x27 altgr -Thai_soso 0x27 shift altgr -apostrophe 0x28 -quotedbl 0x28 shift -Thai_ngongu 0x28 altgr -period 0x28 shift altgr -grave 0x29 -asciitilde 0x29 shift -underscore 0x29 altgr -percent 0x29 shift altgr -ISO_First_Group 0x2a shift -backslash 0x2b -bar 0x2b shift -Thai_khokhuat 0x2b altgr -Thai_khokhon 0x2b shift altgr -Thai_phophung 0x2c altgr -parenleft 0x2c shift altgr -Thai_popla 0x2d altgr -parenright 0x2d shift altgr -Thai_saraae 0x2e altgr -Thai_choching 0x2e shift altgr -Thai_oang 0x2f altgr -Thai_honokhuk 0x2f shift altgr -Thai_sarai 0x30 altgr -Thai_phinthu 0x30 shift altgr -Thai_sarauee 0x31 altgr -Thai_thanthakhat 0x31 shift altgr -Thai_thothahan 0x32 altgr -question 0x32 shift altgr -comma 0x33 -less 0x33 shift -Thai_moma 0x33 altgr -Thai_thophuthao 0x33 shift altgr -period 0x34 -greater 0x34 shift -Thai_saraaimaimuan 0x34 altgr -Thai_lochula 0x34 shift altgr -slash 0x35 -question 0x35 shift -Thai_fofa 0x35 altgr -Thai_lu 0x35 shift altgr -ISO_Last_Group 0x36 shift diff --git a/src/VBox/RDP/client/keymaps/tr b/src/VBox/RDP/client/keymaps/tr deleted file mode 100644 index 16b54c55e..000000000 --- a/src/VBox/RDP/client/keymaps/tr +++ /dev/null @@ -1,138 +0,0 @@ -# rdesktop Turkish Q Keyboard Layout -# -# Modified by Umit Oztosun <umit@liqia.com> 20040328 -# -# Modified from the original mapping file provided with rdesktop 1.3.1. -# This version works correctly with the right X settings. - -include common -map 0x41f - -# First row -quotedbl 0x29 -eacute 0x29 shift -backslash 0x29 altgr - -exclam 0x02 shift -onesuperior 0x02 altgr -exclamdown 0x02 shift altgr - -apostrophe 0x03 shift -sterling 0x03 altgr -twosuperior 0x03 shift altgr - -dead_circumflex 0x04 shift -numbersign 0x04 altgr -threesuperior 0x04 shift altgr - -plus 0x05 shift -dollar 0x05 altgr -onequarter 0x05 shift altgr - -percent 0x06 shift -onehalf 0x06 altgr -threeeighths 0x06 shift altgr - -ampersand 0x07 shift -threequarters 0x07 altgr - -slash 0x08 shift -braceleft 0x08 altgr - -parenleft 0x09 shift -bracketleft 0x09 altgr - -parenright 0x0a shift -bracketright 0x0a altgr -plusminus 0x0a shift altgr - -equal 0x0b shift -braceright 0x0b altgr -degree 0x0b shift altgr - -asterisk 0x0c -question 0x0c shift -backslash 0x0c altgr -questiondown 0x0c shift altgr - -minus 0x0d -underscore 0x0d shift -division 0x0d altgr - -at 0x10 altgr - -EuroSign 0x12 altgr - -trademark 0x14 altgr - -ucircumflex 0x16 altgr -Ucircumflex 0x16 shift altgr - -idotless 0x17 -I 0x17 shift -icircumflex 0x17 altgr -Icircumflex 0x17 altgr shift - -ocircumflex 0x18 altgr -Ocircumflex 0x18 shift altgr - -gbreve 0x1a -Gbreve 0x1a shift - -udiaeresis 0x1b -Udiaeresis 0x1b shift -asciitilde 0x1b altgr -dead_macron 0x1b shift altgr - -comma 0x2b -semicolon 0x2b shift -grave 0x2b altgr -dead_grave 0x2b altgr shift - -# Second row - -acircumflex 0x1e altgr -Acircumflex 0x1e shift altgr - -section 0x1f altgr - -ordfeminine 0x21 altgr - -scedilla 0x27 -Scedilla 0x27 shift -acute 0x27 altgr -dead_acute 0x27 shift altgr - -i 0x28 -Iabovedot 0x28 shift -dead_caron 0x28 shift altgr - -less 0x56 -greater 0x56 shift -bar 0x56 altgr -brokenbar 0x56 shift altgr - -cent 0x2e altgr -copyright 0x2e shift altgr - -leftdoublequotemark 0x2f altgr - -rightdoublequotemark 0x30 altgr - -mu 0x32 altgr -masculine 0x32 shift altgr - -odiaeresis 0x33 -Odiaeresis 0x33 shift -multiply 0x33 altgr - -ccedilla 0x34 -Ccedilla 0x34 shift -periodcentered 0x34 altgr -division 0x34 shift altgr - -period 0x35 -colon 0x35 shift -dead_abovedot 0x35 altgr -dead_abovedot 0x35 shift altgr - diff --git a/src/VBox/RDP/client/licence.c b/src/VBox/RDP/client/licence.c index 303d6c89f..12c640612 100644 --- a/src/VBox/RDP/client/licence.c +++ b/src/VBox/RDP/client/licence.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. RDP licensing negotiation - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -30,7 +29,7 @@ #include "rdesktop.h" #include "ssl.h" -extern char g_username[64]; +extern char *g_username; extern char g_hostname[16]; static uint8 g_licence_key[16]; diff --git a/src/VBox/RDP/client/lspci.c b/src/VBox/RDP/client/lspci.c index 3b754b4e7..de0c835b5 100644 --- a/src/VBox/RDP/client/lspci.c +++ b/src/VBox/RDP/client/lspci.c @@ -1,22 +1,21 @@ /* -*- c-basic-offset: 8 -*- -+ rdesktop: A Remote Desktop Protocol client. -+ Support for the Matrox "lspci" channel -+ Copyright (C) 2005 Matrox Graphics Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ + rdesktop: A Remote Desktop Protocol client. + Support for the Matrox "lspci" channel + Copyright (C) 2005 Matrox Graphics Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ /* * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice diff --git a/src/VBox/RDP/client/mcs.c b/src/VBox/RDP/client/mcs.c index cbf8391e0..0a104ded9 100644 --- a/src/VBox/RDP/client/mcs.c +++ b/src/VBox/RDP/client/mcs.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Multipoint Communications Service - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -381,54 +381,12 @@ mcs_recv(uint16 * channel, uint8 * rdpver) return s; } -/* Establish a connection up to the MCS layer */ RD_BOOL -mcs_connect(char *server, STREAM mcs_data, char *username) +mcs_connect(char *server, STREAM mcs_data, char *username, RD_BOOL reconnect) { unsigned int i; - if (!iso_connect(server, username)) - return False; - - mcs_send_connect_initial(mcs_data); - if (!mcs_recv_connect_response(mcs_data)) - goto error; - - mcs_send_edrq(); - - mcs_send_aurq(); - if (!mcs_recv_aucf(&g_mcs_userid)) - goto error; - - mcs_send_cjrq(g_mcs_userid + MCS_USERCHANNEL_BASE); - - if (!mcs_recv_cjcf()) - goto error; - - mcs_send_cjrq(MCS_GLOBAL_CHANNEL); - if (!mcs_recv_cjcf()) - goto error; - - for (i = 0; i < g_num_channels; i++) - { - mcs_send_cjrq(g_channels[i].mcs_id); - if (!mcs_recv_cjcf()) - goto error; - } - return True; - - error: - iso_disconnect(); - return False; -} - -/* Establish a connection up to the MCS layer */ -RD_BOOL -mcs_reconnect(char *server, STREAM mcs_data) -{ - unsigned int i; - - if (!iso_reconnect(server)) + if (!iso_connect(server, username, reconnect)) return False; mcs_send_connect_initial(mcs_data); diff --git a/src/VBox/RDP/client/mppc.c b/src/VBox/RDP/client/mppc.c index d35f7eb5e..c5b564bf7 100644 --- a/src/VBox/RDP/client/mppc.c +++ b/src/VBox/RDP/client/mppc.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP decompression - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/orders.c b/src/VBox/RDP/client/orders.c index ba796d188..3d71502a3 100644 --- a/src/VBox/RDP/client/orders.c +++ b/src/VBox/RDP/client/orders.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. RDP order processing - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -157,6 +156,33 @@ rdp_parse_pen(STREAM s, PEN * pen, uint32 present) return s_check(s); } +static void +setup_brush(BRUSH * out_brush, BRUSH * in_brush) +{ + BRUSHDATA *brush_data; + uint8 cache_idx; + uint8 colour_code; + + memcpy(out_brush, in_brush, sizeof(BRUSH)); + if (out_brush->style & 0x80) + { + colour_code = out_brush->style & 0x0f; + cache_idx = out_brush->pattern[0]; + brush_data = cache_get_brush_data(colour_code, cache_idx); + if ((brush_data == NULL) || (brush_data->data == NULL)) + { + error("error getting brush data, style %x\n", out_brush->style); + out_brush->bd = NULL; + memset(out_brush->pattern, 0, 8); + } + else + { + out_brush->bd = brush_data; + } + out_brush->style = 3; + } +} + /* Parse a brush */ static RD_BOOL rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) @@ -208,6 +234,8 @@ process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta) static void process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) { + BRUSH brush; + if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -234,8 +262,10 @@ process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x, os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour)); + setup_brush(&brush, &os->brush); + ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy, - &os->brush, os->bgcolour, os->fgcolour); + &brush, os->bgcolour, os->fgcolour); } /* Process a screen blt order */ @@ -435,6 +465,7 @@ static void process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) { RD_HBITMAP bitmap; + BRUSH brush; if (present & 0x000001) { @@ -485,8 +516,10 @@ process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) if (bitmap == NULL) return; + setup_brush(&brush, &os->brush); + ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, - bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour); + bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour); } /* Process a polygon order */ @@ -575,6 +608,7 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta) int index, data, next; uint8 flags = 0; RD_POINT *points; + BRUSH brush; if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -622,6 +656,8 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta) return; } + setup_brush(&brush, &os->brush); + points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); @@ -646,7 +682,7 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta) if (next - 1 == os->npoints) ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, - &os->brush, os->bgcolour, os->fgcolour); + &brush, os->bgcolour, os->fgcolour); else error("polygon2 parse error\n"); @@ -767,6 +803,8 @@ process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta) static void process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) { + BRUSH brush; + if (present & 0x0001) rdp_in_coord(s, &os->left, delta); @@ -797,8 +835,10 @@ process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) os->left, os->top, os->right, os->bottom, os->opcode, os->fillmode, os->brush.style, os->bgcolour, os->fgcolour)); + setup_brush(&brush, &os->brush); + ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left, - os->bottom - os->top, &os->brush, os->bgcolour, os->fgcolour); + os->bottom - os->top, &brush, os->bgcolour, os->fgcolour); } /* Process a text order */ @@ -806,6 +846,7 @@ static void process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) { int i; + BRUSH brush; if (present & 0x000001) in_uint8(s, os->font); @@ -872,11 +913,13 @@ process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) DEBUG(("\n")); + setup_brush(&brush, &os->brush); + ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y, os->clipleft, os->cliptop, os->clipright - os->clipleft, os->clipbottom - os->cliptop, os->boxleft, os->boxtop, os->boxright - os->boxleft, os->boxbottom - os->boxtop, - &os->brush, os->bgcolour, os->fgcolour, os->text, os->length); + &brush, os->bgcolour, os->fgcolour, os->text, os->length); } /* Process a raw bitmap cache order */ @@ -1113,6 +1156,108 @@ process_fontcache(STREAM s) } } +static void +process_compressed_8x8_brush_data(uint8 * in, uint8 * out, int Bpp) +{ + int x, y, pal_index, in_index, shift, do2, i; + uint8 *pal; + + in_index = 0; + pal = in + 16; + /* read it bottom up */ + for (y = 7; y >= 0; y--) + { + /* 2 bytes per row */ + x = 0; + for (do2 = 0; do2 < 2; do2++) + { + /* 4 pixels per byte */ + shift = 6; + while (shift >= 0) + { + pal_index = (in[in_index] >> shift) & 3; + /* size of palette entries depends on Bpp */ + for (i = 0; i < Bpp; i++) + { + out[(y * 8 + x) * Bpp + i] = pal[pal_index * Bpp + i]; + } + x++; + shift -= 2; + } + in_index++; + } + } +} + +/* Process a brush cache order */ +static void +process_brushcache(STREAM s, uint16 flags) +{ + BRUSHDATA brush_data; + uint8 cache_idx, colour_code, width, height, size, type; + uint8 *comp_brush; + int index; + int Bpp; + + in_uint8(s, cache_idx); + in_uint8(s, colour_code); + in_uint8(s, width); + in_uint8(s, height); + in_uint8(s, type); /* type, 0x8x = cached */ + in_uint8(s, size); + + DEBUG(("BRUSHCACHE(idx=%d,wd=%d,ht=%d,sz=%d)\n", cache_idx, width, height, size)); + + if ((width == 8) && (height == 8)) + { + if (colour_code == 1) + { + brush_data.colour_code = 1; + brush_data.data_size = 8; + brush_data.data = xmalloc(8); + if (size == 8) + { + /* read it bottom up */ + for (index = 7; index >= 0; index--) + { + in_uint8(s, brush_data.data[index]); + } + } + else + { + warning("incompatible brush, colour_code %d size %d\n", colour_code, + size); + } + cache_put_brush_data(1, cache_idx, &brush_data); + } + else if ((colour_code >= 3) && (colour_code <= 6)) + { + Bpp = colour_code - 2; + brush_data.colour_code = colour_code; + brush_data.data_size = 8 * 8 * Bpp; + brush_data.data = xmalloc(8 * 8 * Bpp); + if (size == 16 + 4 * Bpp) + { + in_uint8p(s, comp_brush, 16 + 4 * Bpp); + process_compressed_8x8_brush_data(comp_brush, brush_data.data, Bpp); + } + else + { + in_uint8a(s, brush_data.data, 8 * 8 * Bpp); + } + cache_put_brush_data(colour_code, cache_idx, &brush_data); + } + else + { + warning("incompatible brush, colour_code %d size %d\n", colour_code, size); + } + } + else + { + warning("incompatible brush, width height %d %d\n", width, height); + } +} + /* Process a secondary order */ static void process_secondary_order(STREAM s) @@ -1157,6 +1302,10 @@ process_secondary_order(STREAM s) process_bmpcache2(s, flags, True); /* compressed */ break; + case RDP_ORDER_BRUSHCACHE: + process_brushcache(s, flags); + break; + default: unimpl("secondary order %d\n", type); } diff --git a/src/VBox/RDP/client/orders.h b/src/VBox/RDP/client/orders.h index a6869649d..c8758a5f2 100644 --- a/src/VBox/RDP/client/orders.h +++ b/src/VBox/RDP/client/orders.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. RDP order processing - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/parallel.c b/src/VBox/RDP/client/parallel.c index 6124c6e1e..2e544e188 100644 --- a/src/VBox/RDP/client/parallel.c +++ b/src/VBox/RDP/client/parallel.c @@ -1,10 +1,10 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/parse.h b/src/VBox/RDP/client/parse.h index 0282b3059..a4b690dd3 100644 --- a/src/VBox/RDP/client/parse.h +++ b/src/VBox/RDP/client/parse.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Parsing primitives - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/printer.c b/src/VBox/RDP/client/printer.c index de4c29899..115a095d7 100644 --- a/src/VBox/RDP/client/printer.c +++ b/src/VBox/RDP/client/printer.c @@ -1,10 +1,10 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -119,14 +118,14 @@ printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 dispos pprinter_data = (PRINTER *) g_rdpdr_device[device_id].pdevice_data; /* default printer name use default printer queue as well in unix */ - if (!strcmp(pprinter_data->printer, "mydeskjet")) + if (strncmp(pprinter_data->printer, "mydeskjet", strlen(pprinter_data->printer)) == 0) { pprinter_data->printer_fp = popen("lpr", "w"); } else { #ifdef VBOX - snprintf(cmd, sizeof(cmd), "lpr -P %s", pprinter_data->printer); + snprintf(cmd, sizeof(cmd), "lpr -P %s", pprinter_data->printer); #else sprintf(cmd, "lpr -P %s", pprinter_data->printer); #endif diff --git a/src/VBox/RDP/client/printercache.c b/src/VBox/RDP/client/printercache.c index 00f8663d1..500a21ca6 100644 --- a/src/VBox/RDP/client/printercache.c +++ b/src/VBox/RDP/client/printercache.c @@ -1,23 +1,22 @@ /* -*- c-basic-offset: 8 -*- - * rdesktop: A Remote Desktop Protocol client. - * Entrypoint and utility functions - * Copyright (C) Matthew Chapman 1999-2007 - * Copyright (C) Jeroen Meijer 2003-2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ + rdesktop: A Remote Desktop Protocol client. + Entrypoint and utility functions + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) Jeroen Meijer <jeroen@oldambt7.com> 2003-2008 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ /* * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice diff --git a/src/VBox/RDP/client/proto.h b/src/VBox/RDP/client/proto.h index a27339d82..c1780681a 100644 --- a/src/VBox/RDP/client/proto.h +++ b/src/VBox/RDP/client/proto.h @@ -1,10 +1,10 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -53,6 +52,8 @@ void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_pe uint8 * data); RD_HCURSOR cache_get_cursor(uint16 cache_idx); void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor); +BRUSHDATA *cache_get_brush_data(uint8 colour_code, uint8 idx); +void cache_put_brush_data(uint8 colour_code, uint8 idx, BRUSHDATA * brush_data); /* channels.c */ VCHANNEL *channel_register(char *name, uint32 flags, void (*callback) (STREAM)); STREAM channel_init(VCHANNEL * channel, uint32 length); @@ -82,8 +83,7 @@ void ewmh_init(void); STREAM iso_init(int length); void iso_send(STREAM s); STREAM iso_recv(uint8 * rdpver); -RD_BOOL iso_connect(char *server, char *username); -RD_BOOL iso_reconnect(char *server); +RD_BOOL iso_connect(char *server, char *username, RD_BOOL reconnect); void iso_disconnect(void); void iso_reset_state(void); /* licence.c */ @@ -93,8 +93,7 @@ STREAM mcs_init(int length); void mcs_send_to_channel(STREAM s, uint16 channel); void mcs_send(STREAM s); STREAM mcs_recv(uint16 * channel, uint8 * rdpver); -RD_BOOL mcs_connect(char *server, STREAM mcs_data, char *username); -RD_BOOL mcs_reconnect(char *server, STREAM mcs_data); +RD_BOOL mcs_connect(char *server, STREAM mcs_data, char *username, RD_BOOL reconnect); void mcs_disconnect(void); void mcs_reset_state(void); /* orders.c */ @@ -151,6 +150,7 @@ void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint1 uint16 param2); void rdp_send_client_window_status(int status); void process_colour_pointer_pdu(STREAM s); +void process_new_pointer_pdu(STREAM s); void process_cached_pointer_pdu(STREAM s); void process_system_pointer_pdu(STREAM s); void process_bitmap_updates(STREAM s); @@ -159,9 +159,7 @@ void process_disconnect_pdu(STREAM s, uint32 * ext_disc_reason); void rdp_main_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason); RD_BOOL rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason); RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, - char *directory); -RD_BOOL rdp_reconnect(char *server, uint32 flags, char *domain, char *password, char *command, - char *directory, char *cookie); + char *directory, RD_BOOL reconnect); void rdp_reset_state(void); void rdp_disconnect(void); /* rdpdr.c */ @@ -169,7 +167,7 @@ int get_device_index(RD_NTHANDLE handle); void convert_to_unix_filename(char *filename); void rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer, uint32 length); -RD_BOOL rdpdr_init(void); +RD_BOOL rdpdr_init(); void rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, RD_BOOL * timeout); struct async_iorequest *rdpdr_remove_iorequest(struct async_iorequest *prev, struct async_iorequest *iorq); @@ -185,6 +183,7 @@ struct audio_packet *rdpsnd_queue_current_packet(void); RD_BOOL rdpsnd_queue_empty(void); void rdpsnd_queue_next(unsigned long completed_in_us); int rdpsnd_queue_next_tick(void); +void rdpsnd_reset_state(void); /* secure.c */ void sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, uint8 salt); void sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2); @@ -197,8 +196,7 @@ void sec_send_to_channel(STREAM s, uint32 flags, uint16 channel); void sec_send(STREAM s, uint32 flags); void sec_process_mcs_data(STREAM s); STREAM sec_recv(uint8 * rdpver); -RD_BOOL sec_connect(char *server, char *username); -RD_BOOL sec_reconnect(char *server); +RD_BOOL sec_connect(char *server, char *username, RD_BOOL reconnect); void sec_disconnect(void); void sec_reset_state(void); /* serial.c */ @@ -243,6 +241,7 @@ void rdp_send_scancode(uint32 time, uint16 flags, uint8 scancode); /* xwin.c */ RD_BOOL get_key_state(unsigned int state, uint32 keysym); RD_BOOL ui_init(void); +void ui_init_connection(void); void ui_deinit(void); RD_BOOL ui_create_window(void); void ui_resize_window(void); @@ -256,7 +255,7 @@ void ui_destroy_bitmap(RD_HBITMAP bmp); RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data); void ui_destroy_glyph(RD_HGLYPH glyph); RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask, - uint8 * xormask); + uint8 * xormask, int bpp); void ui_set_cursor(RD_HCURSOR cursor); void ui_destroy_cursor(RD_HCURSOR cursor); void ui_set_null_cursor(void); @@ -290,6 +289,7 @@ void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy); void ui_begin_update(void); void ui_end_update(void); void ui_seamless_begin(RD_BOOL hidden); +void ui_seamless_end(); void ui_seamless_hide_desktop(void); void ui_seamless_unhide_desktop(void); void ui_seamless_toggle(void); @@ -322,6 +322,9 @@ unsigned int seamless_send_destroy(unsigned long id); /* scard.c */ void scard_lock(int lock); void scard_unlock(int lock); +int scard_enum_devices(uint32 * id, char *optarg); +void scardSetInfo(uint32 device, uint32 id, uint32 bytes_out); +void scard_reset_state(); /* vrdp/rdpusb.c */ RD_BOOL rdpusb_init(void); void rdpusb_close (void); diff --git a/src/VBox/RDP/client/proto.head b/src/VBox/RDP/client/proto.head index 6b109e670..8e2a8b972 100644 --- a/src/VBox/RDP/client/proto.head +++ b/src/VBox/RDP/client/proto.head @@ -2,9 +2,9 @@ rdesktop: A Remote Desktop Protocol client. Copyright (C) Matthew Chapman 1999-2007 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RDESKTOP_PROTO_H diff --git a/src/VBox/RDP/client/pstcache.c b/src/VBox/RDP/client/pstcache.c index 4fa0e7680..cee314253 100644 --- a/src/VBox/RDP/client/pstcache.c +++ b/src/VBox/RDP/client/pstcache.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Persistent Bitmap Cache routines - Copyright (C) Jeroen Meijer 2004-2007 + Copyright (C) Jeroen Meijer <jeroen@oldambt7.com> 2004-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -80,7 +79,7 @@ pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx) rd_read_file(fd, celldata, cellhdr.length); bitmap = ui_create_bitmap(cellhdr.width, cellhdr.height, celldata); - DEBUG(("Load bitmap from disk: id=%d, idx=%d, bmp=0x%x)\n", cache_id, cache_idx, bitmap)); + DEBUG(("Load bitmap from disk: id=%d, idx=%d, bmp=%p)\n", cache_id, cache_idx, bitmap)); cache_put_bitmap(cache_id, cache_idx, bitmap); xfree(celldata); diff --git a/src/VBox/RDP/client/rdesktop.c b/src/VBox/RDP/client/rdesktop.c index d74c7700f..f8ee2211b 100644 --- a/src/VBox/RDP/client/rdesktop.c +++ b/src/VBox/RDP/client/rdesktop.c @@ -1,11 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Entrypoint and utility functions - Copyright (C) Matthew Chapman 1999-2008 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2002-2011 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2010-2011 Henrik Andersson <hean01@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -37,6 +38,7 @@ #include <sys/times.h> /* times */ #include <ctype.h> /* toupper */ #include <errno.h> +#include <signal.h> #include "rdesktop.h" #ifdef VBOX @@ -62,19 +64,18 @@ #include "ssl.h" char g_title[64] = ""; -char g_username[64]; +char *g_username; char g_hostname[16]; char g_keymapname[PATH_MAX] = ""; unsigned int g_keylayout = 0x409; /* Defaults to US keyboard layout */ int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ - -int g_width = 800; /* width is special: If 0, the - geometry will be fetched from - _NET_WORKAREA. If negative, - absolute value specifies the - percent of the whole screen. */ +int g_sizeopt = 0; /* If non-zero, a special size has been + requested. If 1, the geometry will be fetched + from _NET_WORKAREA. If negative, absolute value + specifies the percent of the whole screen. */ +int g_width = 800; int g_height = 600; int g_xpos = 0; int g_ypos = 0; @@ -110,6 +111,7 @@ RD_BOOL g_lspci_enabled = False; RD_BOOL g_owncolmap = False; RD_BOOL g_ownbackstore = True; /* We can't rely on external BackingStore */ RD_BOOL g_seamless_rdp = False; +RD_BOOL g_user_quit = False; uint32 g_embed_wnd; uint32 g_rdp5_performanceflags = RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; @@ -118,10 +120,16 @@ RD_BOOL g_redirect = False; char g_redirect_server[64]; char g_redirect_domain[16]; char g_redirect_password[64]; -char g_redirect_username[64]; +char *g_redirect_username; char g_redirect_cookie[128]; uint32 g_redirect_flags = 0; +uint32 g_reconnect_logonid = 0; +char g_reconnect_random[16]; +RD_BOOL g_has_reconnect_random = False; +uint8 g_client_random[SEC_RANDOM_SIZE]; +RD_BOOL g_pending_resize = False; + #ifdef WITH_RDPSND RD_BOOL g_rdpsnd = False; #endif @@ -150,9 +158,10 @@ static void usage(char *program) { fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); - fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2008 Matthew Chapman.\n"); + 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"); + fprintf(stderr, "Modified for VirtualBox by " VBOX_VENDOR "\n"); #endif fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); @@ -243,91 +252,116 @@ usage(char *program) fprintf(stderr, " -5: use RDP version 5 (default)\n"); } -static void -print_disconnect_reason(uint16 reason) +static int +handle_disconnect_reason(RD_BOOL deactivated, uint16 reason) { char *text; + int retval; switch (reason) { case exDiscReasonNoInfo: text = "No information available"; + if (deactivated) + retval = EX_OK; + else + retval = EXRD_UNKNOWN; break; case exDiscReasonAPIInitiatedDisconnect: + case exDiscReasonWindows7Disconnect: text = "Server initiated disconnect"; + retval = EXRD_API_DISCONNECT; break; case exDiscReasonAPIInitiatedLogoff: text = "Server initiated logoff"; + retval = EXRD_API_LOGOFF; break; case exDiscReasonServerIdleTimeout: text = "Server idle timeout reached"; + retval = EXRD_IDLE_TIMEOUT; break; case exDiscReasonServerLogonTimeout: text = "Server logon timeout reached"; + retval = EXRD_LOGON_TIMEOUT; break; case exDiscReasonReplacedByOtherConnection: text = "The session was replaced"; + retval = EXRD_REPLACED; break; case exDiscReasonOutOfMemory: text = "The server is out of memory"; + retval = EXRD_OUT_OF_MEM; break; case exDiscReasonServerDeniedConnection: text = "The server denied the connection"; + retval = EXRD_DENIED; break; case exDiscReasonServerDeniedConnectionFips: text = "The server denied the connection for security reason"; + retval = EXRD_DENIED_FIPS; break; case exDiscReasonLicenseInternal: text = "Internal licensing error"; + retval = EXRD_LIC_INTERNAL; break; case exDiscReasonLicenseNoLicenseServer: text = "No license server available"; + retval = EXRD_LIC_NOSERVER; break; case exDiscReasonLicenseNoLicense: text = "No valid license available"; + retval = EXRD_LIC_NOLICENSE; break; case exDiscReasonLicenseErrClientMsg: text = "Invalid licensing message"; + retval = EXRD_LIC_MSG; break; case exDiscReasonLicenseHwidDoesntMatchLicense: text = "Hardware id doesn't match software license"; + retval = EXRD_LIC_HWID; break; case exDiscReasonLicenseErrClientLicense: text = "Client license error"; + retval = EXRD_LIC_CLIENT; break; case exDiscReasonLicenseCantFinishProtocol: text = "Network error during licensing protocol"; + retval = EXRD_LIC_NET; break; case exDiscReasonLicenseClientEndedProtocol: text = "Licensing protocol was not completed"; + retval = EXRD_LIC_PROTO; break; case exDiscReasonLicenseErrClientEncryption: text = "Incorrect client license enryption"; + retval = EXRD_LIC_ENC; break; case exDiscReasonLicenseCantUpgradeLicense: text = "Can't upgrade license"; + retval = EXRD_LIC_UPGRADE; break; case exDiscReasonLicenseNoRemoteConnections: text = "The server is not licensed to accept remote connections"; + retval = EXRD_LIC_NOREMOTE; break; default: @@ -339,14 +373,24 @@ print_disconnect_reason(uint16 reason) { text = "Unknown reason"; } + retval = EXRD_UNKNOWN; } - fprintf(stderr, "disconnect: %s.\n", text); + if (reason != exDiscReasonNoInfo) + fprintf(stderr, "disconnect: %s.\n", text); + + return retval; } static void rdesktop_reset_state(void) { rdp_reset_state(); +#ifdef WITH_SCARD + scard_reset_state(); +#endif +#ifdef WITH_RDPSND + rdpsnd_reset_state(); +#endif } static RD_BOOL @@ -447,7 +491,7 @@ main(int argc, char *argv[]) { char server[64]; char fullhostname[64]; - char domain[16]; + char domain[256]; char password[64]; char shell[256]; char directory[256]; @@ -459,8 +503,6 @@ main(int argc, char *argv[]) char *locale = NULL; int username_option = 0; RD_BOOL geometry_option = False; - int run_count = 0; /* Session Directory support */ - RD_BOOL continue_connect = True; /* Session Directory support */ #ifdef WITH_RDPSND char *rdpsnd_optarg = NULL; #endif @@ -474,6 +516,15 @@ main(int argc, char *argv[]) } #endif + + /* Ignore SIGPIPE, since we are using popen() */ + struct sigaction act; + memset(&act, 0, sizeof(act)); + act.sa_handler = SIG_IGN; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGPIPE, &act, NULL); + flags = RDP_LOGON_NORMAL; prompt_password = False; domain[0] = password[0] = shell[0] = directory[0] = 0; @@ -511,7 +562,8 @@ main(int argc, char *argv[]) break; case 'u': - STRNCPY(g_username, optarg, sizeof(g_username)); + g_username = (char *) xmalloc(strlen(optarg) + 1); + STRNCPY(g_username, optarg, strlen(optarg) + 1); username_option = 1; break; @@ -564,7 +616,7 @@ main(int argc, char *argv[]) g_fullscreen = False; if (!strcmp(optarg, "workarea")) { - g_width = g_height = 0; + g_sizeopt = 1; break; } @@ -572,7 +624,7 @@ main(int argc, char *argv[]) if (g_width <= 0) { error("invalid geometry\n"); - return 1; + return EX_USAGE; } if (*p == 'x') @@ -581,12 +633,13 @@ main(int argc, char *argv[]) if (g_height <= 0) { error("invalid geometry\n"); - return 1; + return EX_USAGE; } if (*p == '%') { - g_width = -g_width; + g_sizeopt = -g_width; + g_width = 800; p++; } @@ -650,7 +703,7 @@ main(int argc, char *argv[]) if (*p) { error("invalid button size\n"); - return 1; + return EX_USAGE; } break; @@ -675,7 +728,7 @@ main(int argc, char *argv[]) && g_server_depth != 32) { error("Invalid server colour depth.\n"); - return 1; + return EX_USAGE; } break; @@ -834,14 +887,14 @@ main(int argc, char *argv[]) case '?': default: usage(argv[0]); - return 1; + return EX_USAGE; } } if (argc - optind != 1) { usage(argv[0]); - return 1; + return EX_USAGE; } STRNCPY(server, argv[optind], sizeof(server)); @@ -852,35 +905,35 @@ main(int argc, char *argv[]) if (g_win_button_size) { error("You cannot use -S and -A at the same time\n"); - return 1; + return EX_USAGE; } g_rdp5_performanceflags &= ~RDP5_NO_FULLWINDOWDRAG; if (geometry_option) { error("You cannot use -g and -A at the same time\n"); - return 1; + return EX_USAGE; } if (g_fullscreen) { error("You cannot use -f and -A at the same time\n"); - return 1; + return EX_USAGE; } if (g_hide_decorations) { error("You cannot use -D and -A at the same time\n"); - return 1; + return EX_USAGE; } if (g_embed_wnd) { error("You cannot use -X and -A at the same time\n"); - return 1; + return EX_USAGE; } if (!g_use_rdp5) { error("You cannot use -4 and -A at the same time\n"); - return 1; + return EX_USAGE; } - g_width = -100; + g_sizeopt = -100; g_grab_keyboard = False; } @@ -890,10 +943,12 @@ main(int argc, char *argv[]) if ((pw == NULL) || (pw->pw_name == NULL)) { error("could not determine username, use -u\n"); - return 1; + return EX_OSERR; } - - STRNCPY(g_username, pw->pw_name, sizeof(g_username)); + /* +1 for trailing \0 */ + int pwlen = strlen(pw->pw_name) + 1; + g_username = (char *) xmalloc(pwlen); + STRNCPY(g_username, pw->pw_name, pwlen); } #ifdef HAVE_ICONV @@ -915,7 +970,7 @@ main(int argc, char *argv[]) if (gethostname(fullhostname, sizeof(fullhostname)) == -1) { error("could not determine local hostname, use -n\n"); - return 1; + return EX_OSERR; } p = strchr(fullhostname, '.'); @@ -951,19 +1006,17 @@ main(int argc, char *argv[]) #ifdef RDP2VNC rdp2vnc_connect(server, flags, domain, password, shell, directory); - return 0; + return EX_OK; #else if (!ui_init()) - return 1; + return EX_OSERR; #ifdef WITH_RDPSND if (g_rdpsnd) { if (!rdpsnd_init(rdpsnd_optarg)) - { warning("Initializing sound-support failed!\n"); - } } #endif @@ -977,16 +1030,24 @@ main(int argc, char *argv[]) rdpdr_init(); - while (run_count < 2 && continue_connect) /* add support for Session Directory; only reconnect once */ + while (1) { - if (run_count == 0) + rdesktop_reset_state(); + + if (g_redirect) { - if (!rdp_connect(server, flags, domain, password, shell, directory)) - return 1; + STRNCPY(domain, g_redirect_domain, sizeof(domain)); + xfree(g_username); + g_username = (char *) xmalloc(strlen(g_redirect_username) + 1); + STRNCPY(g_username, g_redirect_username, sizeof(g_username)); + STRNCPY(password, g_redirect_password, sizeof(password)); + STRNCPY(server, g_redirect_server, sizeof(server)); + flags |= RDP_LOGON_AUTO; } - else if (!rdp_reconnect - (server, flags, domain, password, shell, directory, g_redirect_cookie)) - return 1; + + ui_init_connection(); + if (!rdp_connect(server, flags, domain, password, shell, directory, g_redirect)) + return EX_PROTOCOL; /* By setting encryption to False here, we have an encrypted login packet but unencrypted transfer of other packets */ @@ -997,72 +1058,48 @@ main(int argc, char *argv[]) DEBUG(("Connection successful.\n")); memset(password, 0, sizeof(password)); - if (run_count == 0) + if (!g_redirect) if (!ui_create_window()) - continue_connect = False; + return EX_OSERR; - if (continue_connect) - rdp_main_loop(&deactivated, &ext_disc_reason); + g_redirect = False; + rdp_main_loop(&deactivated, &ext_disc_reason); DEBUG(("Disconnecting...\n")); rdp_disconnect(); - if ((g_redirect == True) && (run_count == 0)) /* Support for Session Directory */ - { - /* reset state of major globals */ - rdesktop_reset_state(); - - STRNCPY(domain, g_redirect_domain, sizeof(domain)); - STRNCPY(g_username, g_redirect_username, sizeof(g_username)); - STRNCPY(password, g_redirect_password, sizeof(password)); - STRNCPY(server, g_redirect_server, sizeof(server)); - flags |= RDP_LOGON_AUTO; + if (g_redirect) + continue; - g_redirect = False; - } - else + ui_seamless_end(); + ui_destroy_window(); + if (g_pending_resize) { - continue_connect = False; - ui_destroy_window(); - break; + /* If we have a pending resize, reconnect using the new size, rather than exit */ + g_pending_resize = False; + continue; } - - run_count++; + break; } cache_save_state(); ui_deinit(); #ifdef WITH_RDPUSB - if (g_rdpusb) - rdpusb_close(); + if (g_rdpusb) + rdpusb_close(); #endif - if (ext_disc_reason >= 2) - print_disconnect_reason(ext_disc_reason); + if (g_user_quit) + return EXRD_WINDOW_CLOSED; - if (deactivated) - { - /* clean disconnect */ - return 0; - } - else - { - if (ext_disc_reason == exDiscReasonAPIInitiatedDisconnect - || ext_disc_reason == exDiscReasonAPIInitiatedLogoff) - { - /* not so clean disconnect, but nothing to worry about */ - return 0; - } - else - { - /* return error */ - return 2; - } - } + return handle_disconnect_reason(deactivated, ext_disc_reason); #endif + if (g_redirect_username) + xfree(g_redirect_username); + xfree(g_username); } #ifdef EGD_SOCKET @@ -1156,7 +1193,7 @@ xmalloc(int size) if (mem == NULL) { error("xmalloc %d\n", size); - exit(1); + exit(EX_UNAVAILABLE); } return mem; } @@ -1168,7 +1205,7 @@ exit_if_null(void *ptr) if (ptr == NULL) { error("unexpected null pointer. Out of memory?\n"); - exit(1); + exit(EX_UNAVAILABLE); } } @@ -1180,7 +1217,7 @@ xstrdup(const char *s) if (mem == NULL) { perror("strdup"); - exit(1); + exit(EX_UNAVAILABLE); } return mem; } @@ -1197,7 +1234,7 @@ xrealloc(void *oldmem, size_t size) if (mem == NULL) { error("xrealloc %ld\n", size); - exit(1); + exit(EX_UNAVAILABLE); } return mem; } diff --git a/src/VBox/RDP/client/rdesktop.h b/src/VBox/RDP/client/rdesktop.h index 1b59b3fa1..72f9da7ff 100644 --- a/src/VBox/RDP/client/rdesktop.h +++ b/src/VBox/RDP/client/rdesktop.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Master include file - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -47,8 +46,84 @@ #endif #endif #include <limits.h> /* PATH_MAX */ +#ifdef HAVE_SYSEXITS_H +#include <sysexits.h> +#endif + +/* standard exit codes */ +#ifndef EX_OK +#define EX_OK 0 +#endif +#ifndef EX_USAGE +#define EX_USAGE 64 +#endif +#ifndef EX_DATAERR +#define EX_DATAERR 65 +#endif +#ifndef EX_NOINPUT +#define EX_NOINPUT 66 +#endif +#ifndef EX_NOUSER +#define EX_NOUSER 67 +#endif +#ifndef EX_NOHOST +#define EX_NOHOST 68 +#endif +#ifndef EX_UNAVAILABLE +#define EX_UNAVAILABLE 69 +#endif +#ifndef EX_SOFTWARE +#define EX_SOFTWARE 70 +#endif +#ifndef EX_OSERR +#define EX_OSERR 71 +#endif +#ifndef EX_OSFILE +#define EX_OSFILE 72 +#endif +#ifndef EX_CANTCREAT +#define EX_CANTCREAT 73 +#endif +#ifndef EX_IOERR +#define EX_IOERR 74 +#endif +#ifndef EX_TEMPFAIL +#define EX_TEMPFAIL 75 +#endif +#ifndef EX_PROTOCOL +#define EX_PROTOCOL 76 +#endif +#ifndef EX_NOPERM +#define EX_NOPERM 77 +#endif +#ifndef EX_CONFIG +#define EX_CONFIG 78 +#endif + +/* rdesktop specific exit codes, lined up with disconnect PDU reasons */ +#define EXRD_API_DISCONNECT 1 +#define EXRD_API_LOGOFF 2 +#define EXRD_IDLE_TIMEOUT 3 +#define EXRD_LOGON_TIMEOUT 4 +#define EXRD_REPLACED 5 +#define EXRD_OUT_OF_MEM 6 +#define EXRD_DENIED 7 +#define EXRD_DENIED_FIPS 8 +#define EXRD_LIC_INTERNAL 16 +#define EXRD_LIC_NOSERVER 17 +#define EXRD_LIC_NOLICENSE 18 +#define EXRD_LIC_MSG 19 +#define EXRD_LIC_HWID 20 +#define EXRD_LIC_CLIENT 21 +#define EXRD_LIC_NET 22 +#define EXRD_LIC_PROTO 23 +#define EXRD_LIC_ENC 24 +#define EXRD_LIC_UPGRADE 25 +#define EXRD_LIC_NOREMOTE 26 -#define VERSION "1.6.0" +/* other exit codes */ +#define EXRD_WINDOW_CLOSED 62 +#define EXRD_UNKNOWN 63 #ifdef VBOX #undef DEBUG diff --git a/src/VBox/RDP/client/rdesktop.spec b/src/VBox/RDP/client/rdesktop.spec index 2e1e04a68..fc81d5430 100644 --- a/src/VBox/RDP/client/rdesktop.spec +++ b/src/VBox/RDP/client/rdesktop.spec @@ -1,6 +1,6 @@ Summary: Remote Desktop Protocol client Name: rdesktop -Version: 1.6.0 +Version: 1.7.0 Release: 1 License: GPL; see COPYING Group: Applications/Communications @@ -31,10 +31,6 @@ make install DESTDIR=$RPM_BUILD_ROOT %{_mandir}/man1/rdesktop.1* %{_datadir}/rdesktop/keymaps -%post - -%postun - %clean rm -rf $RPM_BUILD_ROOT diff --git a/src/VBox/RDP/client/rdp.c b/src/VBox/RDP/client/rdp.c index 08eaaceaf..2a2bc2cd7 100644 --- a/src/VBox/RDP/client/rdp.c +++ b/src/VBox/RDP/client/rdp.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP layer - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2003-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -33,6 +33,7 @@ #include <unistd.h> #endif #include "rdesktop.h" +#include "ssl.h" #ifdef HAVE_ICONV #ifdef HAVE_ICONV_H @@ -45,7 +46,7 @@ #endif extern uint16 g_mcs_userid; -extern char g_username[64]; +extern char *g_username; extern char g_codepage[16]; extern RD_BOOL g_bitmap_compression; extern RD_BOOL g_orders; @@ -61,6 +62,7 @@ extern int g_height; extern RD_BOOL g_bitmap_cache; extern RD_BOOL g_bitmap_cache_persist_enable; extern RD_BOOL g_numlock_sync; +extern RD_BOOL g_pending_resize; uint8 *g_next_packet; uint32 g_rdp_shareid; @@ -72,11 +74,16 @@ extern RD_BOOL g_redirect; extern char g_redirect_server[64]; extern char g_redirect_domain[16]; extern char g_redirect_password[64]; -extern char g_redirect_username[64]; +extern char *g_redirect_username; extern char g_redirect_cookie[128]; extern uint32 g_redirect_flags; /* END Session Directory support */ +extern uint32 g_reconnect_logonid; +extern char g_reconnect_random[16]; +extern RD_BOOL g_has_reconnect_random; +extern uint8 g_client_random[SEC_RANDOM_SIZE]; + #if WITH_DEBUG static uint32 g_packetno; #endif @@ -341,6 +348,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user, STREAM s; time_t t = time(NULL); time_t tzone; + uint8 security_verifier[16]; if (!g_use_rdp5 || 1 == g_server_rdp_version) { @@ -438,36 +446,51 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user, { out_uint16_le(s, 0); } - out_uint16_le(s, 2); - out_uint16_le(s, len_ip + 2); /* Length of client ip */ - rdp_out_unistr(s, ipaddr, len_ip); - out_uint16_le(s, len_dll + 2); - rdp_out_unistr(s, "C:\\WINNT\\System32\\mstscax.dll", len_dll); - + /* TS_EXTENDED_INFO_PACKET */ + out_uint16_le(s, 2); /* clientAddressFamily = AF_INET */ + out_uint16_le(s, len_ip + 2); /* cbClientAddress, Length of client ip */ + rdp_out_unistr(s, ipaddr, len_ip); /* clientAddress */ + out_uint16_le(s, len_dll + 2); /* cbClientDir */ + rdp_out_unistr(s, "C:\\WINNT\\System32\\mstscax.dll", len_dll); /* clientDir */ + + /* TS_TIME_ZONE_INFORMATION */ tzone = (mktime(gmtime(&t)) - mktime(localtime(&t))) / 60; out_uint32_le(s, tzone); - rdp_out_unistr(s, "GTB, normaltid", 2 * strlen("GTB, normaltid")); out_uint8s(s, 62 - 2 * strlen("GTB, normaltid")); - out_uint32_le(s, 0x0a0000); out_uint32_le(s, 0x050000); out_uint32_le(s, 3); out_uint32_le(s, 0); out_uint32_le(s, 0); - rdp_out_unistr(s, "GTB, sommartid", 2 * strlen("GTB, sommartid")); out_uint8s(s, 62 - 2 * strlen("GTB, sommartid")); - out_uint32_le(s, 0x30000); out_uint32_le(s, 0x050000); out_uint32_le(s, 2); out_uint32(s, 0); - out_uint32_le(s, 0xffffffc4); - out_uint32_le(s, 0xfffffffe); + out_uint32_le(s, 0xffffffc4); /* DaylightBias */ + + /* Rest of TS_EXTENDED_INFO_PACKET */ + out_uint32_le(s, 0xfffffffe); /* clientSessionId, consider changing to 0 */ out_uint32_le(s, g_rdp5_performanceflags); - out_uint16(s, 0); + /* Client Auto-Reconnect */ + if (g_has_reconnect_random) + { + out_uint16_le(s, 28); /* cbAutoReconnectLen */ + /* ARC_CS_PRIVATE_PACKET */ + out_uint32_le(s, 28); /* cbLen */ + out_uint32_le(s, 1); /* Version */ + out_uint32_le(s, g_reconnect_logonid); /* LogonId */ + ssl_hmac_md5(g_reconnect_random, sizeof(g_reconnect_random), + g_client_random, SEC_RANDOM_SIZE, security_verifier); + out_uint8a(s, security_verifier, sizeof(security_verifier)); + } + else + { + out_uint16_le(s, 0); /* cbAutoReconnectLen */ + } } s_mark_end(s); @@ -787,6 +810,18 @@ rdp_out_pointer_caps(STREAM s) out_uint16_le(s, 20); /* Cache size */ } +/* Output new pointer capability set */ +static void +rdp_out_newpointer_caps(STREAM s) +{ + out_uint16_le(s, RDP_CAPSET_POINTER); + out_uint16_le(s, RDP_CAPLEN_NEWPOINTER); + + out_uint16_le(s, 1); /* Colour pointer */ + out_uint16_le(s, 20); /* Cache size */ + out_uint16_le(s, 20); /* Cache size for new pointers */ +} + /* Output share capability set */ static void rdp_out_share_caps(STREAM s) @@ -809,6 +844,15 @@ rdp_out_colcache_caps(STREAM s) out_uint16(s, 0); /* pad */ } +/* Output brush cache capability set */ +static void +rdp_out_brushcache_caps(STREAM s) +{ + out_uint16_le(s, RDP_CAPSET_BRUSHCACHE); + out_uint16_le(s, RDP_CAPLEN_BRUSHCACHE); + out_uint32_le(s, 1); /* cache type */ +} + static uint8 caps_0x0d[] = { 0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -855,11 +899,22 @@ rdp_send_confirm_active(void) uint32 sec_flags = g_encryption ? (RDP5_FLAG | SEC_ENCRYPT) : RDP5_FLAG; uint16 caplen = RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER + - RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE + + RDP_CAPLEN_COLCACHE + RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL + - RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE + - 0x58 + 0x08 + 0x08 + 0x34 /* unknown caps */ + - 4 /* w2k fix, why? */ ; + RDP_CAPLEN_SHARE + + RDP_CAPLEN_BRUSHCACHE + 0x58 + 0x08 + 0x08 + 0x34 /* unknown caps */ + + 4 /* w2k fix, sessionid */ ; + + if (g_use_rdp5) + { + caplen += RDP_CAPLEN_BMPCACHE2; + caplen += RDP_CAPLEN_NEWPOINTER; + } + else + { + caplen += RDP_CAPLEN_BMPCACHE; + caplen += RDP_CAPLEN_POINTER; + } s = sec_init(sec_flags, 6 + 14 + caplen + sizeof(RDP_SOURCE)); @@ -873,23 +928,32 @@ rdp_send_confirm_active(void) out_uint16_le(s, caplen); out_uint8p(s, RDP_SOURCE, sizeof(RDP_SOURCE)); - out_uint16_le(s, 0xd); /* num_caps */ + out_uint16_le(s, 0xe); /* num_caps */ out_uint8s(s, 2); /* pad */ rdp_out_general_caps(s); rdp_out_bitmap_caps(s); rdp_out_order_caps(s); - g_use_rdp5 ? rdp_out_bmpcache2_caps(s) : rdp_out_bmpcache_caps(s); + if (g_use_rdp5) + { + rdp_out_bmpcache2_caps(s); + rdp_out_newpointer_caps(s); + } + else + { + rdp_out_bmpcache_caps(s); + rdp_out_pointer_caps(s); + } rdp_out_colcache_caps(s); rdp_out_activate_caps(s); rdp_out_control_caps(s); - rdp_out_pointer_caps(s); rdp_out_share_caps(s); + rdp_out_brushcache_caps(s); - rdp_out_unknown_caps(s, 0x0d, 0x58, caps_0x0d); /* international? */ - rdp_out_unknown_caps(s, 0x0c, 0x08, caps_0x0c); - rdp_out_unknown_caps(s, 0x0e, 0x08, caps_0x0e); - rdp_out_unknown_caps(s, 0x10, 0x34, caps_0x10); /* glyph cache? */ + rdp_out_unknown_caps(s, 0x0d, 0x58, caps_0x0d); /* CAPSTYPE_INPUT */ + rdp_out_unknown_caps(s, 0x0c, 0x08, caps_0x0c); /* CAPSTYPE_SOUND */ + rdp_out_unknown_caps(s, 0x0e, 0x08, caps_0x0e); /* CAPSTYPE_FONT */ + rdp_out_unknown_caps(s, 0x10, 0x34, caps_0x10); /* CAPSTYPE_GLYPHCACHE */ s_mark_end(s); sec_send(s, sec_flags); @@ -1021,11 +1085,13 @@ process_demand_active(STREAM s) } /* Process a colour pointer PDU */ -void -process_colour_pointer_pdu(STREAM s) +static void +process_colour_pointer_common(STREAM s, int bpp) { - uint16 x, y, width, height, cache_idx, masklen, datalen; - uint8 *mask, *data; + uint16 width, height, cache_idx, masklen, datalen; + sint16 x, y; + uint8 *mask; + uint8 *data; RD_HCURSOR cursor; in_uint16_le(s, cache_idx); @@ -1037,11 +1103,37 @@ process_colour_pointer_pdu(STREAM s) in_uint16_le(s, datalen); in_uint8p(s, data, datalen); in_uint8p(s, mask, masklen); - cursor = ui_create_cursor(x, y, width, height, mask, data); + if ((width != 32) || (height != 32)) + { + warning("process_colour_pointer_common: " "width %d height %d\n", width, height); + } + /* sometimes x or y is out of bounds */ + x = MAX(x, 0); + x = MIN(x, width - 1); + y = MAX(y, 0); + y = MIN(y, height - 1); + cursor = ui_create_cursor(x, y, width, height, mask, data, bpp); ui_set_cursor(cursor); cache_put_cursor(cache_idx, cursor); } +/* Process a colour pointer PDU */ +void +process_colour_pointer_pdu(STREAM s) +{ + process_colour_pointer_common(s, 24); +} + +/* Process a New Pointer PDU - these pointers have variable bit depth */ +void +process_new_pointer_pdu(STREAM s) +{ + int xor_bpp; + + in_uint16_le(s, xor_bpp); + process_colour_pointer_common(s, xor_bpp); +} + /* Process a cached pointer PDU */ void process_cached_pointer_pdu(STREAM s) @@ -1101,6 +1193,10 @@ process_pointer_pdu(STREAM s) process_system_pointer_pdu(s); break; + case RDP_POINTER_NEW: + process_new_pointer_pdu(s); + break; + default: unimpl("Pointer message 0x%x\n", message_type); } @@ -1243,6 +1339,51 @@ process_update_pdu(STREAM s) ui_end_update(); } + +/* Process a Save Session Info PDU */ +void +process_pdu_logon(STREAM s) +{ + uint32 infotype; + in_uint32_le(s, infotype); + if (infotype == INFOTYPE_LOGON_EXTENDED_INF) + { + uint32 fieldspresent; + + in_uint8s(s, 2); /* Length */ + in_uint32_le(s, fieldspresent); + if (fieldspresent & LOGON_EX_AUTORECONNECTCOOKIE) + { + uint32 len; + uint32 version; + + /* TS_LOGON_INFO_FIELD */ + in_uint8s(s, 4); /* cbFieldData */ + + /* ARC_SC_PRIVATE_PACKET */ + in_uint32_le(s, len); + if (len != 28) + { + warning("Invalid length in Auto-Reconnect packet\n"); + return; + } + + in_uint32_le(s, version); + if (version != 1) + { + warning("Unsupported version of Auto-Reconnect packet\n"); + return; + } + + in_uint32_le(s, g_reconnect_logonid); + in_uint8a(s, g_reconnect_random, 16); + g_has_reconnect_random = True; + DEBUG(("Saving auto-reconnect cookie, id=%u\n", g_reconnect_logonid)); + } + } +} + + /* Process a disconnect PDU */ void process_disconnect_pdu(STREAM s, uint32 * ext_disc_reason) @@ -1319,6 +1460,7 @@ process_data_pdu(STREAM s, uint32 * ext_disc_reason) case RDP_DATA_PDU_LOGON: DEBUG(("Received Logon PDU\n")); /* User logged on */ + process_pdu_logon(s); break; case RDP_DATA_PDU_DISCONNECT: @@ -1349,48 +1491,94 @@ process_redirect_pdu(STREAM s /*, uint32 * ext_disc_reason */ ) /* read connection flags */ in_uint32_le(s, g_redirect_flags); - /* read length of ip string */ - in_uint32_le(s, len); + if (g_redirect_flags & PDU_REDIRECT_HAS_IP) + { + /* read length of ip string */ + in_uint32_le(s, len); + + /* read ip string */ + rdp_in_unistr(s, g_redirect_server, sizeof(g_redirect_server), len); + } - /* read ip string */ - rdp_in_unistr(s, g_redirect_server, sizeof(g_redirect_server), len); + if (g_redirect_flags & PDU_REDIRECT_HAS_COOKIE) + { + /* read length of cookie string */ + in_uint32_le(s, len); - /* read length of cookie string */ - in_uint32_le(s, len); + /* read cookie string (plain ASCII) */ + if (len > sizeof(g_redirect_cookie) - 1) + { + uint32 rem = len - (sizeof(g_redirect_cookie) - 1); + len = sizeof(g_redirect_cookie) - 1; - /* read cookie string (plain ASCII) */ - if (len > sizeof(g_redirect_cookie) - 1) + warning("Unexpectedly large redirection cookie\n"); + in_uint8a(s, g_redirect_cookie, len); + in_uint8s(s, rem); + } + else + { + in_uint8a(s, g_redirect_cookie, len); + } + g_redirect_cookie[len] = 0; + } + + if (g_redirect_flags & PDU_REDIRECT_HAS_USERNAME) { - uint32 rem = len - (sizeof(g_redirect_cookie) - 1); - len = sizeof(g_redirect_cookie) - 1; + /* read length of username string */ + in_uint32_le(s, len); - warning("Unexpectedly large redirection cookie\n"); - in_uint8a(s, g_redirect_cookie, len); - in_uint8s(s, rem); + /* read username string */ + g_redirect_username = (char *) xmalloc(len + 1); + rdp_in_unistr(s, g_redirect_username, strlen(g_redirect_username), len); } - else + + if (g_redirect_flags & PDU_REDIRECT_HAS_DOMAIN) + { + /* read length of domain string */ + in_uint32_le(s, len); + + /* read domain string */ + rdp_in_unistr(s, g_redirect_domain, sizeof(g_redirect_domain), len); + } + + if (g_redirect_flags & PDU_REDIRECT_HAS_PASSWORD) { - in_uint8a(s, g_redirect_cookie, len); + /* read length of password string */ + in_uint32_le(s, len); + + /* read password string */ + rdp_in_unistr(s, g_redirect_password, sizeof(g_redirect_password), len); } - g_redirect_cookie[len] = 0; - /* read length of username string */ - in_uint32_le(s, len); + if (g_redirect_flags & PDU_REDIRECT_DONT_STORE_USERNAME) + { + warning("PDU_REDIRECT_DONT_STORE_USERNAME set\n"); + } - /* read username string */ - rdp_in_unistr(s, g_redirect_username, sizeof(g_redirect_username), len); + if (g_redirect_flags & PDU_REDIRECT_USE_SMARTCARD) + { + warning("PDU_REDIRECT_USE_SMARTCARD set\n"); + } - /* read length of domain string */ - in_uint32_le(s, len); + if (g_redirect_flags & PDU_REDIRECT_INFORMATIONAL) + { + warning("PDU_REDIRECT_INFORMATIONAL set\n"); + } - /* read domain string */ - rdp_in_unistr(s, g_redirect_domain, sizeof(g_redirect_domain), len); + if (g_redirect_flags & PDU_REDIRECT_HAS_TARGET_FQDN) + { + warning("PDU_REDIRECT_HAS_TARGET_FQDN set\n"); + } - /* read length of password string */ - in_uint32_le(s, len); + if (g_redirect_flags & PDU_REDIRECT_HAS_TARGET_NETBIOS) + { + warning("PDU_REDIRECT_HAS_TARGET_NETBIOS set\n"); + } - /* read password string */ - rdp_in_unistr(s, g_redirect_password, sizeof(g_redirect_password), len); + if (g_redirect_flags & PDU_REDIRECT_HAS_TARGET_IP_ARRAY) + { + warning("PDU_REDIRECT_HAS_TARGET_IP_ARRAY set\n"); + } g_redirect = True; @@ -1398,12 +1586,16 @@ process_redirect_pdu(STREAM s /*, uint32 * ext_disc_reason */ ) } /* Process incoming packets */ -/* nevers gets out of here till app is done */ void rdp_main_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) { while (rdp_loop(deactivated, ext_disc_reason)) - ; + { + if (g_pending_resize) + { + return; + } + } } /* used in uiports and rdp_main_loop, processes the rdp packets waiting */ @@ -1411,7 +1603,6 @@ RD_BOOL rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) { uint8 type; - RD_BOOL disc = False; /* True when a disconnect PDU was received */ RD_BOOL cont = True; STREAM s; @@ -1434,15 +1625,13 @@ rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) return process_redirect_pdu(s); break; case RDP_PDU_DATA: - disc = process_data_pdu(s, ext_disc_reason); + process_data_pdu(s, ext_disc_reason); break; case 0: break; default: unimpl("PDU %d\n", type); } - if (disc) - return False; cont = g_next_packet < s->end; } return True; @@ -1451,21 +1640,9 @@ rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) /* Establish a connection up to the RDP layer */ RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, - char *command, char *directory) -{ - if (!sec_connect(server, g_username)) - return False; - - rdp_send_logon_info(flags, domain, g_username, password, command, directory); - return True; -} - -/* Establish a reconnection up to the RDP layer */ -RD_BOOL -rdp_reconnect(char *server, uint32 flags, char *domain, char *password, - char *command, char *directory, char *cookie) + char *command, char *directory, RD_BOOL reconnect) { - if (!sec_reconnect(server)) + if (!sec_connect(server, g_username, reconnect)) return False; rdp_send_logon_info(flags, domain, g_username, password, command, directory); diff --git a/src/VBox/RDP/client/rdp5.c b/src/VBox/RDP/client/rdp5.c index 1cc166b6d..28b6c398d 100644 --- a/src/VBox/RDP/client/rdp5.c +++ b/src/VBox/RDP/client/rdp5.c @@ -1,12 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP5 short form PDU processing - Copyright (C) Matthew Chapman 1999-2007 - Copyright (C) Erik Forsberg 2003-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -120,6 +119,9 @@ rdp5_process(STREAM s) case 10: /* cached pointer */ process_cached_pointer_pdu(ts); break; + case 11: + process_new_pointer_pdu(ts); + break; default: unimpl("RDP5 opcode %d\n", type); } diff --git a/src/VBox/RDP/client/rdpdr.c b/src/VBox/RDP/client/rdpdr.c index 3f78a2f0e..ebc57f2ee 100644 --- a/src/VBox/RDP/client/rdpdr.c +++ b/src/VBox/RDP/client/rdpdr.c @@ -1,10 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2004-2011 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2010-2011 Henrik Andersson <hean01@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -13,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -750,7 +751,7 @@ rdpdr_process_irp(STREAM s) } static void -rdpdr_send_clientcapabilty(void) +rdpdr_send_clientcapability(void) { uint8 magic[4] = "rDPC"; STREAM s; @@ -817,7 +818,7 @@ rdpdr_process(STREAM s) if ((magic[2] == 'C') && (magic[3] == 'C')) { /* connect from server */ - rdpdr_send_clientcapabilty(); + rdpdr_send_clientcapability(); rdpdr_send_available(); return; } @@ -850,13 +851,10 @@ rdpdr_process(STREAM s) RD_BOOL rdpdr_init() { - if (g_num_devices > 0) - { - rdpdr_channel = - channel_register("rdpdr", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_COMPRESS_RDP, - rdpdr_process); - } + rdpdr_channel = + channel_register("rdpdr", + CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_COMPRESS_RDP, + rdpdr_process); return (rdpdr_channel != NULL); } diff --git a/src/VBox/RDP/client/rdpsnd.c b/src/VBox/RDP/client/rdpsnd.c index 81a4031a8..758b57062 100644 --- a/src/VBox/RDP/client/rdpsnd.c +++ b/src/VBox/RDP/client/rdpsnd.c @@ -1,13 +1,14 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 + Copyright 2006-2010 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2009-2011 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -59,6 +59,9 @@ static VCHANNEL *rdpsnddbg_channel; static struct audio_driver *drivers = NULL; struct audio_driver *current_driver = NULL; +static RD_BOOL rdpsnd_negotiated; +static RD_BOOL rdpsnd_rec_negotiated; + static RD_BOOL device_open; static RD_BOOL rec_device_open; @@ -83,6 +86,7 @@ void (*wave_out_play) (void); static void rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index); static void rdpsnd_queue_init(void); +static void rdpsnd_queue_clear(void); static void rdpsnd_queue_complete_pending(void); static long rdpsnd_queue_next_completion(void); @@ -160,6 +164,16 @@ rdpsnd_flush_record(void) record_buffer_size = 0; } +static void +rdpsnd_clear_record(void) +{ + /* + * Silently drop everything we have in the record buffer as + * we've somehow gotten a reset in regard to the server. + */ + record_buffer_size = 0; +} + void rdpsnd_record(const void *data, unsigned int size) { @@ -243,6 +257,13 @@ rdpsnd_process_negotiate(STREAM in) DEBUG_SOUND(("RDPSND: RDPSND_NEGOTIATE(formats: %d, pad: 0x%02x, version: %x)\n", (int) in_format_count, (unsigned) pad, (unsigned) version)); + if (rdpsnd_negotiated) + { + error("RDPSND: Extra RDPSND_NEGOTIATE in the middle of a session\n"); + /* Do a complete reset of the sound state */ + rdpsnd_reset_state(); + } + if (!current_driver) device_available = rdpsnd_auto_select(); @@ -316,6 +337,8 @@ rdpsnd_process_negotiate(STREAM in) DEBUG_SOUND(("RDPSND: -> RDPSND_NEGOTIATE(formats: %d)\n", (int) format_count)); rdpsnd_send(out); + + rdpsnd_negotiated = True; } static void @@ -355,6 +378,13 @@ rdpsnd_process_rec_negotiate(STREAM in) DEBUG_SOUND(("RDPSND: RDPSND_REC_NEGOTIATE(formats: %d, version: %x)\n", (int) in_format_count, (unsigned) version)); + if (rdpsnd_rec_negotiated) + { + error("RDPSND: Extra RDPSND_REC_NEGOTIATE in the middle of a session\n"); + /* Do a complete reset of the sound state */ + rdpsnd_reset_state(); + } + if (!current_driver) device_available = rdpsnd_auto_select(); @@ -425,6 +455,8 @@ rdpsnd_process_rec_negotiate(STREAM in) DEBUG_SOUND(("RDPSND: -> RDPSND_REC_NEGOTIATE(formats: %d)\n", (int) rec_format_count)); rdpsnd_send(out); + + rdpsnd_rec_negotiated = True; } static void @@ -737,6 +769,23 @@ rdpsnd_init(char *optarg) } void +rdpsnd_reset_state(void) +{ + if (device_open) + current_driver->wave_out_close(); + device_open = False; + rdpsnd_queue_clear(); + rdpsnd_negotiated = False; + + if (rec_device_open) + current_driver->wave_in_close(); + rec_device_open = False; + rdpsnd_clear_record(); + rdpsnd_rec_negotiated = False; +} + + +void rdpsnd_show_help(void) { struct audio_driver *pos; @@ -821,6 +870,23 @@ rdpsnd_queue_init(void) queue_pending = queue_lo = queue_hi = 0; } +static void +rdpsnd_queue_clear(void) +{ + struct audio_packet *packet; + + /* Go through everything, not just the pending packets */ + while (queue_pending != queue_hi) + { + packet = &packet_queue[queue_pending]; + xfree(packet->s.data); + queue_pending = (queue_pending + 1) % MAX_QUEUE; + } + + /* Reset everything back to the initial state */ + queue_pending = queue_lo = queue_hi = 0; +} + void rdpsnd_queue_next(unsigned long completed_in_us) { diff --git a/src/VBox/RDP/client/rdpsnd.h b/src/VBox/RDP/client/rdpsnd.h index d07af595b..664c53c69 100644 --- a/src/VBox/RDP/client/rdpsnd.h +++ b/src/VBox/RDP/client/rdpsnd.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Sound infrastructure - Copyright (C) Michael Gernoth 2006-2007 + Copyright (C) Michael Gernoth 2006-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_alsa.c b/src/VBox/RDP/client/rdpsnd_alsa.c index d4f8ebcc5..6a04a1419 100644 --- a/src/VBox/RDP/client/rdpsnd_alsa.c +++ b/src/VBox/RDP/client/rdpsnd_alsa.c @@ -1,14 +1,14 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - alsa-driver - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Michael Gernoth mike@zerfleddert.de 2006-2007 - Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 + Copyright (C) Michael Gernoth <mike@zerfleddert.de> 2006-2008 + Copyright 2006-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_dsp.c b/src/VBox/RDP/client/rdpsnd_dsp.c index 45d62599a..a15ea96ff 100644 --- a/src/VBox/RDP/client/rdpsnd_dsp.c +++ b/src/VBox/RDP/client/rdpsnd_dsp.c @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Sound DSP routines - Copyright (C) Michael Gernoth 2006-2007 + Copyright (C) Michael Gernoth <mike@zerfleddert.de> 2006-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_dsp.h b/src/VBox/RDP/client/rdpsnd_dsp.h index 346c4b28f..55af8f5db 100644 --- a/src/VBox/RDP/client/rdpsnd_dsp.h +++ b/src/VBox/RDP/client/rdpsnd_dsp.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Sound DSP routines - Copyright (C) Michael Gernoth 2006-2007 + Copyright (C) Michael Gernoth 2006-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_libao.c b/src/VBox/RDP/client/rdpsnd_libao.c index b6fa18ab3..419b61848 100644 --- a/src/VBox/RDP/client/rdpsnd_libao.c +++ b/src/VBox/RDP/client/rdpsnd_libao.c @@ -1,13 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - libao-driver - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Michael Gernoth mike@zerfleddert.de 2005-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 + Copyright (C) Michael Gernoth <mike@zerfleddert.de> 2005-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_oss.c b/src/VBox/RDP/client/rdpsnd_oss.c index c36dfee5f..b72d4b23b 100644 --- a/src/VBox/RDP/client/rdpsnd_oss.c +++ b/src/VBox/RDP/client/rdpsnd_oss.c @@ -1,13 +1,14 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Open Sound System - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 + Copyright 2006-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -37,6 +37,8 @@ #undef _FILE_OFFSET_BITS #endif +#include <assert.h> + #include "rdesktop.h" #include "rdpsnd.h" #include "rdpsnd_dsp.h" @@ -55,14 +57,10 @@ static int dsp_fd = -1; static int dsp_mode; -static int dsp_refs; static RD_BOOL dsp_configured; static RD_BOOL dsp_broken; -static RD_BOOL dsp_out; -static RD_BOOL dsp_in; - static int stereo; static int format; static uint32 snd_rate; @@ -73,24 +71,25 @@ static RD_BOOL in_esddsp; /* This is a just a forward declaration */ static struct audio_driver oss_driver; -void oss_play(void); -void oss_record(void); +static void oss_play(void); +static void oss_record(void); +static RD_BOOL oss_set_format(RD_WAVEFORMATEX * pwfx); -void +static void oss_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) { if (dsp_fd == -1) return; - if (dsp_out && !rdpsnd_queue_empty()) + if ((dsp_mode == O_WRONLY || dsp_mode == O_RDWR) && !rdpsnd_queue_empty()) FD_SET(dsp_fd, wfds); - if (dsp_in) + if (dsp_mode == O_RDONLY || dsp_mode == O_RDWR) FD_SET(dsp_fd, rfds); if (dsp_fd > *n) *n = dsp_fd; } -void +static void oss_check_fds(fd_set * rfds, fd_set * wfds) { if (FD_ISSET(dsp_fd, wfds)) @@ -121,115 +120,129 @@ detect_esddsp(void) return True; } -RD_BOOL -oss_open(int fallback) -{ - int caps; - if (dsp_fd != -1) +static void +oss_restore_format() +{ + RD_WAVEFORMATEX wfx; + memset(&wfx, 0, sizeof(RD_WAVEFORMATEX)); + switch (format) { - dsp_refs++; - - if (dsp_mode == O_RDWR) - return True; - - if (dsp_mode == fallback) - return True; - - dsp_refs--; - return False; + case AFMT_U8: + wfx.wBitsPerSample = 8; + break; + case AFMT_S16_LE: + wfx.wBitsPerSample = 16; + break; + default: + wfx.wBitsPerSample = 0; } + wfx.nChannels = stereo ? 2 : 1; + wfx.nSamplesPerSec = snd_rate; + oss_set_format(&wfx); +} - dsp_configured = False; - dsp_broken = False; - dsp_mode = O_RDWR; - dsp_fd = open(dsp_dev, O_RDWR | O_NONBLOCK); +static RD_BOOL +oss_open(int wanted) +{ if (dsp_fd != -1) { - ioctl(dsp_fd, SNDCTL_DSP_SETDUPLEX, 0); - - if ((ioctl(dsp_fd, SNDCTL_DSP_GETCAPS, &caps) < 0) || !(caps & DSP_CAP_DUPLEX)) + if (wanted == dsp_mode) + { + /* should probably not happen */ + return True; + } + else { + /* device open but not our mode. Before + reopening O_RDWR, verify that the device is + duplex capable */ + int caps; + ioctl(dsp_fd, SNDCTL_DSP_SETDUPLEX, 0); + if ((ioctl(dsp_fd, SNDCTL_DSP_GETCAPS, &caps) < 0) + || !(caps & DSP_CAP_DUPLEX)) + { + warning("This device is not capable of full duplex operation.\n"); + return False; + } close(dsp_fd); - dsp_fd = -1; + dsp_mode = O_RDWR; } } + else + { + dsp_mode = wanted; + } + + dsp_configured = False; + dsp_broken = False; + + dsp_fd = open(dsp_dev, dsp_mode | O_NONBLOCK); if (dsp_fd == -1) { - dsp_mode = fallback; - - dsp_fd = open(dsp_dev, dsp_mode | O_NONBLOCK); - if (dsp_fd == -1) - { - perror(dsp_dev); - return False; - } + perror(dsp_dev); + return False; } - dsp_refs++; - in_esddsp = detect_esddsp(); return True; } -void +static void oss_close(void) { - dsp_refs--; - - if (dsp_refs != 0) - return; - close(dsp_fd); dsp_fd = -1; } -RD_BOOL +static RD_BOOL oss_open_out(void) { if (!oss_open(O_WRONLY)) return False; - dsp_out = True; - return True; } -void +static void oss_close_out(void) { oss_close(); + if (dsp_mode == O_RDWR) + { + if (oss_open(O_RDONLY)) + oss_restore_format(); + } /* Ack all remaining packets */ while (!rdpsnd_queue_empty()) rdpsnd_queue_next(0); - - dsp_out = False; } -RD_BOOL +static RD_BOOL oss_open_in(void) { if (!oss_open(O_RDONLY)) return False; - dsp_in = True; - return True; } -void +static void oss_close_in(void) { oss_close(); - - dsp_in = False; + if (dsp_mode == O_RDWR) + { + if (oss_open(O_WRONLY)) + oss_restore_format(); + } } -RD_BOOL +static RD_BOOL oss_format_supported(RD_WAVEFORMATEX * pwfx) { if (pwfx->wFormatTag != WAVE_FORMAT_PCM) @@ -242,12 +255,14 @@ oss_format_supported(RD_WAVEFORMATEX * pwfx) return True; } -RD_BOOL +static RD_BOOL oss_set_format(RD_WAVEFORMATEX * pwfx) { int fragments; static RD_BOOL driver_broken = False; + assert(dsp_fd != -1); + if (dsp_configured) { if ((pwfx->wBitsPerSample == 8) && (format != AFMT_U8)) @@ -255,7 +270,7 @@ oss_set_format(RD_WAVEFORMATEX * pwfx) if ((pwfx->wBitsPerSample == 16) && (format != AFMT_S16_LE)) return False; - if ((pwfx->nChannels == 2) != !!stereo) + if ((pwfx->nChannels == 2) != ! !stereo) return False; if (pwfx->nSamplesPerSec != snd_rate) @@ -363,7 +378,7 @@ oss_set_format(RD_WAVEFORMATEX * pwfx) return True; } -void +static void oss_volume(uint16 left, uint16 right) { uint32 volume; @@ -380,13 +395,15 @@ oss_volume(uint16 left, uint16 right) } } -void +static void oss_play(void) { struct audio_packet *packet; ssize_t len; STREAM out; + assert(dsp_fd != -1); + /* We shouldn't be called if the queue is empty, but still */ if (rdpsnd_queue_empty()) return; @@ -449,12 +466,14 @@ oss_play(void) } } -void +static void oss_record(void) { char buffer[32768]; int len; + assert(dsp_fd != -1); + len = read(dsp_fd, buffer, sizeof(buffer)); if (len == -1) { diff --git a/src/VBox/RDP/client/rdpsnd_sgi.c b/src/VBox/RDP/client/rdpsnd_sgi.c index fea8a1f17..c0d65947a 100644 --- a/src/VBox/RDP/client/rdpsnd_sgi.c +++ b/src/VBox/RDP/client/rdpsnd_sgi.c @@ -1,13 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - SGI/IRIX - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Jeremy Meng void.foo@gmail.com 2004, 2005 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 + Copyright (C) Jeremy Meng <void.foo@gmail.com> 2004-2005 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/rdpsnd_sun.c b/src/VBox/RDP/client/rdpsnd_sun.c index 37fe13a7e..c37cc8c13 100644 --- a/src/VBox/RDP/client/rdpsnd_sun.c +++ b/src/VBox/RDP/client/rdpsnd_sun.c @@ -1,14 +1,15 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Sun - Copyright (C) Matthew Chapman 2003-2007 - Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Michael Gernoth mike@zerfleddert.de 2003-2007 - Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003 + Copyright (C) Michael Gernoth <mike@zerfleddert.de> 2003-2008 + Copyright 2007-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2008-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,8 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -313,7 +313,7 @@ sun_set_format(RD_WAVEFORMATEX * pwfx) if ((pwfx->wBitsPerSample == 16) && (format != AUDIO_ENCODING_LINEAR)) return False; - if ((pwfx->nChannels == 2) != !!stereo) + if ((pwfx->nChannels == 2) != ! !stereo) return False; if (pwfx->nSamplesPerSec != snd_rate) diff --git a/src/VBox/RDP/client/scard.c b/src/VBox/RDP/client/scard.c index 5a32a878d..521c90c91 100644 --- a/src/VBox/RDP/client/scard.c +++ b/src/VBox/RDP/client/scard.c @@ -2,10 +2,11 @@ rdesktop: A Remote Desktop Protocol client. Smart Card support Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 + Copyright 2010 Pierre Ossman <ossman@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -33,6 +33,7 @@ #include <strings.h> #include <sys/types.h> #include <time.h> +#include <arpa/inet.h> #ifndef MAKE_PROTO #ifdef __APPLE__ #include <PCSC/wintypes.h> @@ -42,6 +43,9 @@ #include <wintypes.h> #include <pcsclite.h> #include <winscard.h> +#ifdef PCSCLITE_VERSION_NUMBER +#include <reader.h> +#endif #endif /* PCSC_OSX */ #include "rdesktop.h" #include "scard.h" @@ -49,7 +53,9 @@ /* variable segment */ #define SCARD_MAX_MEM 102400 +#ifndef SCARD_AUTOALLOCATE #define SCARD_AUTOALLOCATE -1 +#endif #define OUT_STREAM_SIZE 4096 #ifdef B_ENDIAN @@ -943,6 +949,8 @@ TS_SCardDisconnect(STREAM in, STREAM out) return rv; } +/* Currently unused */ +#if 0 static int needStatusRecheck(MYPCSC_DWORD rv, MYPCSC_LPSCARD_READERSTATE_A rsArray, SERVER_DWORD dwCount) { @@ -969,21 +977,7 @@ mappedStatus(MYPCSC_DWORD code) code &= 0x0000FFFF; return (code % 2); } - -static MYPCSC_DWORD -incStatus(MYPCSC_DWORD code, RD_BOOL mapped) -{ - if (mapped || (code & SCARD_STATE_CHANGED)) - { - MYPCSC_DWORD count = (code >> 16) & 0x0000FFFF; - count++; - if (mapped && !(count % 2)) - count++; - return (code & 0x0000FFFF) | (count << 16); - } - else - return code; -} +#endif static void copyReaderState_MyPCSCToServer(MYPCSC_LPSCARD_READERSTATE_A src, SERVER_LPSCARD_READERSTATE_A dst, @@ -1032,13 +1026,9 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) SERVER_DWORD dwTimeout; SERVER_DWORD dwCount; SERVER_LPSCARD_READERSTATE_A rsArray, cur; - SERVER_DWORD *stateArray = NULL, *curState; MYPCSC_LPSCARD_READERSTATE_A myRsArray; long i; PMEM_HANDLE lcHandle = NULL; -#if 0 - RD_BOOL mapped = False; -#endif in->p += 0x18; in_uint32_le(in, dwTimeout); @@ -1056,9 +1046,6 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) if (!rsArray) return SC_returnNoMemoryError(&lcHandle, in, out); memset(rsArray, 0, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); - stateArray = SC_xmalloc(&lcHandle, dwCount * sizeof(MYPCSC_DWORD)); - if (!stateArray) - return SC_returnNoMemoryError(&lcHandle, in, out); /* skip two pointers at beginning of struct */ for (i = 0, cur = (SERVER_LPSCARD_READERSTATE_A) ((unsigned char **) rsArray + 2); i < dwCount; i++, cur++) @@ -1067,8 +1054,7 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) in_uint8a(in, cur, SERVER_SCARDSTATESIZE); } - for (i = 0, cur = rsArray, curState = stateArray; - i < dwCount; i++, cur++, curState++) + for (i = 0, cur = rsArray; i < dwCount; i++, cur++) { SERVER_DWORD dataLength; @@ -1077,31 +1063,6 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) cur->dwEventState = swap32(cur->dwEventState); cur->cbAtr = swap32(cur->cbAtr); - /* reset Current state hign bytes; */ - *curState = cur->dwCurrentState; - cur->dwCurrentState &= 0x0000FFFF; - cur->dwEventState &= 0x0000FFFF; - -#if 0 - if (cur->dwCurrentState == (SCARD_STATE_CHANGED | SCARD_STATE_PRESENT)) - { - cur->dwCurrentState = 0x00000000; - mapped = True; - } - - if (mappedStatus(*curState)) - { - cur->dwCurrentState &= ~SCARD_STATE_INUSE; - cur->dwEventState &= ~SCARD_STATE_INUSE; - - if (cur->dwCurrentState & SCARD_STATE_EMPTY) - { - cur->dwCurrentState &= ~SCARD_STATE_EMPTY; - cur->dwCurrentState |= SCARD_STATE_UNKNOWN; - } - } -#endif - in->p += 0x08; in_uint32_le(in, dataLength); inRepos(in, @@ -1115,14 +1076,11 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, (unsigned) cur->dwEventState)); - DEBUG_SCARD(("SCARD: current state: 0x%08x\n", - (unsigned) *curState)); } } else { rsArray = NULL; - stateArray = NULL; } myRsArray = SC_xmalloc(&lcHandle, dwCount * sizeof(MYPCSC_SCARD_READERSTATE_A)); @@ -1149,36 +1107,8 @@ TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) out_uint32_le(out, 0x00084dd8); out_uint32_le(out, dwCount); - for (i = 0, cur = rsArray, curState = stateArray; i < dwCount; i++, cur++, curState++) + for (i = 0, cur = rsArray; i < dwCount; i++, cur++) { - - cur->dwCurrentState = (*curState); - cur->dwEventState |= (*curState) & 0xFFFF0000; - -#if 0 - if (mapped && (cur->dwCurrentState & SCARD_STATE_PRESENT) - && (cur->dwCurrentState & SCARD_STATE_CHANGED) - && (cur->dwEventState & SCARD_STATE_PRESENT) - && (cur->dwEventState & SCARD_STATE_CHANGED)) - { - cur->dwEventState |= SCARD_STATE_INUSE; - } - else if (cur->dwEventState & SCARD_STATE_UNKNOWN) - { - cur->dwEventState &= ~SCARD_STATE_UNKNOWN; - cur->dwEventState |= SCARD_STATE_EMPTY; - mapped = True; - } - else if ((!mapped) && (cur->dwEventState & SCARD_STATE_INUSE)) - { - mapped = True; - cur->dwEventState &= ~SCARD_STATE_INUSE; - } - - cur->dwEventState = incStatus(cur->dwEventState, mapped); -#endif - cur->dwEventState = incStatus(cur->dwEventState, False); - DEBUG_SCARD(("SCARD: \"%s\"\n", cur->szReader ? cur->szReader : "NULL")); DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, @@ -1861,6 +1791,8 @@ TS_SCardState(STREAM in, STREAM out) #ifndef WITH_PCSC120 +/* Currently unused */ +#if 0 static MYPCSC_DWORD TS_SCardListReaderGroups(STREAM in, STREAM out) { @@ -1920,6 +1852,7 @@ TS_SCardListReaderGroups(STREAM in, STREAM out) SC_xfreeallmemory(&lcHandle); return rv; } +#endif static MYPCSC_DWORD TS_SCardGetAttrib(STREAM in, STREAM out) @@ -2016,6 +1949,8 @@ TS_SCardGetAttrib(STREAM in, STREAM out) return rv; } +/* Currently unused */ +#if 0 static MYPCSC_DWORD TS_SCardSetAttrib(STREAM in, STREAM out) { @@ -2069,6 +2004,7 @@ TS_SCardSetAttrib(STREAM in, STREAM out) SC_xfreeallmemory(&lcHandle); return rv; } +#endif #endif @@ -2106,10 +2042,27 @@ TS_SCardControl(STREAM in, STREAM out) { /* read real input size */ in_uint32_le(in, nInBufferSize); - pInBuffer = SC_xmalloc(&lcHandle, nInBufferSize); - if (!pInBuffer) - return SC_returnNoMemoryError(&lcHandle, in, out); - in_uint8a(in, pInBuffer, nInBufferSize); + if (nInBufferSize > 0) + { + pInBuffer = SC_xmalloc(&lcHandle, nInBufferSize); + if (!pInBuffer) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, pInBuffer, nInBufferSize); + } + } + + DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); + + /* Is this a proper Windows smart card ioctl? */ + if ((dwControlCode & 0xffff0000) == (49 << 16)) + { + /* Translate to local encoding */ + dwControlCode = (dwControlCode & 0x3ffc) >> 2; + dwControlCode = SCARD_CTL_CODE(dwControlCode); + } + else + { + warning("Bogus smart card control code 0x%08x\n", dwControlCode); } #if 0 @@ -2128,8 +2081,6 @@ TS_SCardControl(STREAM in, STREAM out) if (!pOutBuffer) return SC_returnNoMemoryError(&lcHandle, in, out); - DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); - sc_nBytesReturned = nBytesReturned; myHCard = scHandleToMyPCSC(hCard); #ifdef WITH_PCSC120 @@ -2152,6 +2103,24 @@ TS_SCardControl(STREAM in, STREAM out) DEBUG_SCARD(("SCARD: -> Success (out: %d bytes)\n", (int) nBytesReturned)); } +#ifdef PCSCLITE_VERSION_NUMBER + if (dwControlCode == SCARD_CTL_CODE(3400)) + { + int i; + SERVER_DWORD cc; + + for (i = 0; i < nBytesReturned / 6; i++) + { + memcpy(&cc, pOutBuffer + 2 + i * 6, 4); + cc = ntohl(cc); + cc = cc - 0x42000000; + cc = (49 << 16) | (cc << 2); + cc = htonl(cc); + memcpy(pOutBuffer + 2 + i * 6, &cc, 4); + } + } +#endif + out_uint32_le(out, nBytesReturned); out_uint32_le(out, 0x00000004); out_uint32_le(out, nBytesReturned); @@ -2383,6 +2352,8 @@ duplicateStream(PMEM_HANDLE * handle, STREAM s, uint32 buffer_size, RD_BOOL isIn return d; } +/* Currently unused */ +#if 0 static void freeStream(PMEM_HANDLE * handle, STREAM s) { @@ -2393,6 +2364,7 @@ freeStream(PMEM_HANDLE * handle, STREAM s) SC_xfree(handle, s); } } +#endif static PSCThreadData SC_addToQueue(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) @@ -2622,3 +2594,13 @@ scard_unlock(int lock) { pthread_mutex_unlock(scard_mutex[lock]); } + +void +scard_reset_state() +{ + curDevice = 0; + curId = 0; + curBytesOut = 0; + + queueFirst = queueLast = NULL; +} diff --git a/src/VBox/RDP/client/scard.h b/src/VBox/RDP/client/scard.h index 6263793cb..f5eac92c4 100644 --- a/src/VBox/RDP/client/scard.h +++ b/src/VBox/RDP/client/scard.h @@ -3,9 +3,9 @@ Smart Card support Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -181,5 +180,3 @@ typedef struct _TThreadListElement PSCThreadData data; struct _TThreadListElement *next; } TThreadListElement, *PThreadListElement; - -int scard_enum_devices(uint32 * id, char *optarg); diff --git a/src/VBox/RDP/client/seamless.c b/src/VBox/RDP/client/seamless.c index c97e30cbe..06038301a 100644 --- a/src/VBox/RDP/client/seamless.c +++ b/src/VBox/RDP/client/seamless.c @@ -1,12 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Seamless Windows support - Copyright 2005-2007 Peter Astrand <astrand@cendio.se> for Cendio AB - Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2005-2008 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2007-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -326,7 +325,7 @@ seamless_process_line(const char *line, void *data) if (*endptr) return False; - ui_seamless_begin(!!(flags & SEAMLESSRDP_HELLO_HIDDEN)); + ui_seamless_begin(! !(flags & SEAMLESSRDP_HELLO_HIDDEN)); } else if (!strcmp("ACK", tok1)) { diff --git a/src/VBox/RDP/client/seamless.h b/src/VBox/RDP/client/seamless.h index 7dc7ec8ee..425f606f7 100644 --- a/src/VBox/RDP/client/seamless.h +++ b/src/VBox/RDP/client/seamless.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Seamless Windows support - Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2007 + Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,6 +14,5 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ diff --git a/src/VBox/RDP/client/secure.c b/src/VBox/RDP/client/secure.c index aef1b78d7..c298243c7 100644 --- a/src/VBox/RDP/client/secure.c +++ b/src/VBox/RDP/client/secure.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP encryption and licensing - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -44,6 +44,7 @@ extern RD_BOOL g_console_session; extern int g_server_depth; extern VCHANNEL g_channels[]; extern unsigned int g_num_channels; +extern uint8 g_client_random[SEC_RANDOM_SIZE]; static int g_rc4_key_len; static SSL_RC4 g_rc4_decrypt_key; @@ -677,7 +678,6 @@ static void sec_process_crypt_info(STREAM s) { uint8 *server_random = NULL; - uint8 client_random[SEC_RANDOM_SIZE]; uint8 modulus[SEC_MAX_MODULUS_SIZE]; uint8 exponent[SEC_EXPONENT_SIZE]; uint32 rc4_key_size; @@ -690,10 +690,10 @@ sec_process_crypt_info(STREAM s) return; } DEBUG(("Generating client random\n")); - generate_random(client_random); - sec_rsa_encrypt(g_sec_crypted_random, client_random, SEC_RANDOM_SIZE, + generate_random(g_client_random); + sec_rsa_encrypt(g_sec_crypted_random, g_client_random, SEC_RANDOM_SIZE, g_server_public_key_len, modulus, exponent); - sec_generate_keys(client_random, server_random, rc4_key_size); + sec_generate_keys(g_client_random, server_random, rc4_key_size); } @@ -835,7 +835,8 @@ sec_recv(uint8 * rdpver) if (channel != MCS_GLOBAL_CHANNEL) { channel_process(s, channel); - *rdpver = 0xff; + if (rdpver != NULL) + *rdpver = 0xff; return s; } @@ -847,7 +848,7 @@ sec_recv(uint8 * rdpver) /* Establish a secure connection */ RD_BOOL -sec_connect(char *server, char *username) +sec_connect(char *server, char *username, RD_BOOL reconnect) { struct stream mcs_data; @@ -856,28 +857,7 @@ sec_connect(char *server, char *username) mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size); sec_out_mcs_data(&mcs_data); - if (!mcs_connect(server, &mcs_data, username)) - return False; - - /* sec_process_mcs_data(&mcs_data); */ - if (g_encryption) - sec_establish_key(); - xfree(mcs_data.data); - return True; -} - -/* Establish a secure connection */ -RD_BOOL -sec_reconnect(char *server) -{ - struct stream mcs_data; - - /* We exchange some RDP data during the MCS-Connect */ - mcs_data.size = 512; - mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size); - sec_out_mcs_data(&mcs_data); - - if (!mcs_reconnect(server, &mcs_data)) + if (!mcs_connect(server, &mcs_data, username, reconnect)) return False; /* sec_process_mcs_data(&mcs_data); */ diff --git a/src/VBox/RDP/client/serial.c b/src/VBox/RDP/client/serial.c index 266d29730..d8cbb82ab 100644 --- a/src/VBox/RDP/client/serial.c +++ b/src/VBox/RDP/client/serial.c @@ -1,11 +1,11 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -281,9 +280,8 @@ get_termios(SERIAL_DEVICE * pser_inf, RD_NTHANDLE serial_fd) pser_inf->stop_bits = (ptermios->c_cflag & CSTOPB) ? STOP_BITS_2 : STOP_BITS_1; pser_inf->parity = - (ptermios-> - c_cflag & PARENB) ? ((ptermios-> - c_cflag & PARODD) ? ODD_PARITY : EVEN_PARITY) : NO_PARITY; + (ptermios->c_cflag & PARENB) ? ((ptermios->c_cflag & PARODD) ? ODD_PARITY : + EVEN_PARITY) : NO_PARITY; switch (ptermios->c_cflag & CSIZE) { case CS5: diff --git a/src/VBox/RDP/client/ssl.c b/src/VBox/RDP/client/ssl.c index 07a40ca20..18ab67396 100644 --- a/src/VBox/RDP/client/ssl.c +++ b/src/VBox/RDP/client/ssl.c @@ -1,12 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Secure sockets abstraction layer - Copyright (C) Matthew Chapman 1999-2007 - Copyright (C) Jay Sorg 2006-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) Jay Sorg <j@american-data.com> 2006-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -170,7 +169,7 @@ ssl_cert_to_rkey(SSL_CERT * cert, uint32 * key_len) return NULL; } - lkey = RSAPublicKey_dup((RSA *) epk->pkey.ptr); + lkey = RSAPublicKey_dup(EVP_PKEY_get1_RSA(epk)); EVP_PKEY_free(epk); *key_len = RSA_size(lkey); return lkey; @@ -233,3 +232,13 @@ ssl_sig_ok(uint8 * exponent, uint32 exp_len, uint8 * modulus, uint32 mod_len, */ return True; } + + +void +ssl_hmac_md5(const void *key, int key_len, const unsigned char *msg, int msg_len, unsigned char *md) +{ + HMAC_CTX ctx; + HMAC_CTX_init(&ctx); + HMAC(EVP_md5(), key, key_len, msg, msg_len, md, NULL); + HMAC_CTX_cleanup(&ctx); +} diff --git a/src/VBox/RDP/client/ssl.h b/src/VBox/RDP/client/ssl.h index d6e82000c..23f49ee3a 100644 --- a/src/VBox/RDP/client/ssl.h +++ b/src/VBox/RDP/client/ssl.h @@ -1,12 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Secure sockets abstraction layer - Copyright (C) Matthew Chapman 1999-2007 - Copyright (C) Jay Sorg 2006-2007 + Copyright (C) Matthew Chapman 1999-2008 + Copyright (C) Jay Sorg 2006-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -36,6 +35,7 @@ #include <openssl/sha.h> #include <openssl/bn.h> #include <openssl/x509v3.h> +#include <openssl/hmac.h> #if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090800f) #define D2I_X509_CONST const @@ -70,4 +70,7 @@ int ssl_rkey_get_exp_mod(SSL_RKEY * rkey, uint8 * exponent, uint32 max_exp_len, RD_BOOL ssl_sig_ok(uint8 * exponent, uint32 exp_len, uint8 * modulus, uint32 mod_len, uint8 * signature, uint32 sig_len); +void ssl_hmac_md5(const void *key, int key_len, + const unsigned char *msg, int msg_len, unsigned char *md); + #endif diff --git a/src/VBox/RDP/client/tcp.c b/src/VBox/RDP/client/tcp.c index 96bfc96da..59e8eadbf 100644 --- a/src/VBox/RDP/client/tcp.c +++ b/src/VBox/RDP/client/tcp.c @@ -1,11 +1,12 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - TCP layer - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -65,6 +65,7 @@ static int g_sock; static struct stream g_in; static struct stream g_out[STREAM_COUNT]; int g_tcp_port_rdp = TCP_PORT_RDP; +extern RD_BOOL g_user_quit; /* wait till socket is ready to write or timeout */ static RD_BOOL @@ -182,8 +183,11 @@ tcp_recv(STREAM s, uint32 length) while (length > 0) { if (!ui_select(g_sock)) + { /* User quit */ + g_user_quit = True; return NULL; + } rcvd = recv(g_sock, s->end, length, 0); if (rcvd < 0) diff --git a/src/VBox/RDP/client/types.h b/src/VBox/RDP/client/types.h index c0d724f67..2db5808ae 100644 --- a/src/VBox/RDP/client/types.h +++ b/src/VBox/RDP/client/types.h @@ -1,11 +1,11 @@ /* rdesktop: A Remote Desktop Protocol client. Common data types - Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Matthew Chapman 1999-2008 - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -88,13 +87,22 @@ typedef struct _PEN } PEN; +/* this is whats in the brush cache */ +typedef struct _BRUSHDATA +{ + uint32 colour_code; + uint32 data_size; + uint8 *data; +} +BRUSHDATA; + typedef struct _BRUSH { uint8 xorigin; uint8 yorigin; uint8 style; uint8 pattern[8]; - + BRUSHDATA *bd; } BRUSH; diff --git a/src/VBox/RDP/client/vrdp/rdpusb.c b/src/VBox/RDP/client/vrdp/rdpusb.c index 1152cef76..b0b1aa22f 100644 --- a/src/VBox/RDP/client/vrdp/rdpusb.c +++ b/src/VBox/RDP/client/vrdp/rdpusb.c @@ -259,6 +259,9 @@ static void *buildWireListFromDevices(PUSBDEVICE pDevices, int *pLen) + 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); } @@ -314,7 +317,7 @@ rdpusb_send(STREAM s) static void rdpusb_send_reply (uint8_t code, uint8_t status, uint32_t devid) { - STREAM s = rdpusb_init_packet(1, code); + STREAM s = rdpusb_init_packet(5, code); out_uint8(s, status); out_uint32_le(s, devid); s_mark_end(s); diff --git a/src/VBox/RDP/client/xclip.c b/src/VBox/RDP/client/xclip.c index b7a93ffd2..a22fc07b7 100644 --- a/src/VBox/RDP/client/xclip.c +++ b/src/VBox/RDP/client/xclip.c @@ -1,12 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2007 - Copyright (C) Matthew Chapman 2003-2007 + Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2008 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008 + Copyright 2006-2011 Pierre Ossman <ossman@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* diff --git a/src/VBox/RDP/client/xkeymap.c b/src/VBox/RDP/client/xkeymap.c index 6bf648af1..a6213f86f 100644 --- a/src/VBox/RDP/client/xkeymap.c +++ b/src/VBox/RDP/client/xkeymap.c @@ -2,12 +2,12 @@ rdesktop: A Remote Desktop Protocol client. User interface services - X keyboard mapping - Copyright (C) Matthew Chapman 1999-2007 - Copyright (C) Peter Astrand <astrand@cendio.se> 2003-2007 + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright (C) 2003-2008 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -40,6 +39,7 @@ #include <limits.h> #include <time.h> #include <string.h> +#include <assert.h> #include "rdesktop.h" #include "scancodes.h" @@ -61,6 +61,7 @@ extern RD_BOOL g_numlock_sync; static RD_BOOL keymap_loaded; static key_translation *keymap[KEYMAP_SIZE]; +static KeySym keypress_keysyms[256]; static int min_keycode; static uint16 remote_modifier_state = 0; static uint16 saved_remote_modifier_state = 0; @@ -512,6 +513,36 @@ reset_winkey(uint32 ev_time) } } + +void +set_keypress_keysym(unsigned int keycode, KeySym keysym) +{ + if (keycode < 8 || keycode > 255) + return; + keypress_keysyms[keycode] = keysym; +} + + +KeySym +reset_keypress_keysym(unsigned int keycode, KeySym keysym) +{ + KeySym ks; + if (keycode < 8 || keycode > 255) + return keysym; + ks = keypress_keysyms[keycode]; + if (ks != 0) + { + keypress_keysyms[keycode] = 0; + } + else + { + ks = keysym; + } + + return ks; +} + + /* Handle special key combinations */ RD_BOOL handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed) @@ -826,7 +857,7 @@ save_remote_modifiers(uint8 scancode) void restore_remote_modifiers(uint32 ev_time, uint8 scancode) { - key_translation dummy; + key_translation dummy = { }; if (is_modifier(scancode)) return; diff --git a/src/VBox/RDP/client/xproto.h b/src/VBox/RDP/client/xproto.h index 69bea4d64..7d70140fa 100644 --- a/src/VBox/RDP/client/xproto.h +++ b/src/VBox/RDP/client/xproto.h @@ -12,3 +12,5 @@ int ewmh_set_window_modal(Window wnd); void ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data); void ewmh_del_icon(Window wnd, int width, int height); int ewmh_set_window_above(Window wnd); +void set_keypress_keysym(unsigned int keycode, KeySym keysym); +KeySym reset_keypress_keysym(unsigned int keycode, KeySym keysym); diff --git a/src/VBox/RDP/client/xwin.c b/src/VBox/RDP/client/xwin.c index 0797e5d30..a4d612e81 100644 --- a/src/VBox/RDP/client/xwin.c +++ b/src/VBox/RDP/client/xwin.c @@ -1,12 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. User interface services - X Window System - Copyright (C) Matthew Chapman 1999-2008 - Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008 + Copyright 2007-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2002-2011 Peter Astrand <astrand@cendio.se> for Cendio AB - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -38,7 +38,11 @@ #include <strings.h> #include "rdesktop.h" #include "xproto.h" +#ifdef HAVE_XRANDR +#include <X11/extensions/Xrandr.h> +#endif +extern int g_sizeopt; extern int g_width; extern int g_height; extern int g_xpos; @@ -48,6 +52,7 @@ extern RD_BOOL g_sendmotion; extern RD_BOOL g_fullscreen; extern RD_BOOL g_grab_keyboard; extern RD_BOOL g_hide_decorations; +extern RD_BOOL g_pending_resize; extern char g_title[]; /* Color depth of the RDP session. As of RDP 5.1, it may be 8, 15, 16 or 24. */ @@ -1828,6 +1833,7 @@ error_handler(Display * dpy, XErrorEvent * eev) return g_old_error_handler(dpy, eev); } +/* Initialize the UI. This is done once per process. */ RD_BOOL ui_init(void) { @@ -1884,6 +1890,33 @@ ui_init(void) g_ownbackstore = True; } + g_mod_map = XGetModifierMapping(g_display); + xwin_refresh_pointer_map(); + + xkeymap_init(); + + if (g_enable_compose) + g_IM = XOpenIM(g_display, NULL, NULL, NULL); + + xclip_init(); + ewmh_init(); + if (g_seamless_rdp) + { + seamless_init(); + } + + DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_depth, g_bpp, g_depth)); + + return True; +} + + +/* + Initialize connection specific data, such as session size. + */ +void +ui_init_connection(void) +{ /* * Determine desktop size */ @@ -1893,15 +1926,15 @@ ui_init(void) g_height = HeightOfScreen(g_screen); g_using_full_workarea = True; } - else if (g_width < 0) + else if (g_sizeopt < 0) { /* Percent of screen */ - if (-g_width >= 100) + if (-g_sizeopt >= 100) g_using_full_workarea = True; - g_height = HeightOfScreen(g_screen) * (-g_width) / 100; - g_width = WidthOfScreen(g_screen) * (-g_width) / 100; + g_height = HeightOfScreen(g_screen) * (-g_sizeopt) / 100; + g_width = WidthOfScreen(g_screen) * (-g_sizeopt) / 100; } - else if (g_width == 0) + else if (g_sizeopt == 1) { /* Fetch geometry from _NET_WORKAREA */ uint32 x, y, cx, cy; @@ -1921,36 +1954,12 @@ ui_init(void) /* make sure width is a multiple of 4 */ g_width = (g_width + 3) & ~3; - - g_mod_map = XGetModifierMapping(g_display); - xwin_refresh_pointer_map(); - - xkeymap_init(); - - if (g_enable_compose) - g_IM = XOpenIM(g_display, NULL, NULL, NULL); - - xclip_init(); - ewmh_init(); - if (g_seamless_rdp) - { - seamless_init(); - } - - DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_depth, g_bpp, g_depth)); - - return True; } + void ui_deinit(void) { - while (g_seamless_windows) - { - XDestroyWindow(g_display, g_seamless_windows->wnd); - sw_remove_window(g_seamless_windows); - } - xclip_deinit(); if (g_IM != NULL) @@ -1961,9 +1970,6 @@ ui_deinit(void) XFreeModifiermap(g_mod_map); - if (g_ownbackstore) - XFreePixmap(g_display, g_backstore); - XFreeGC(g_display, g_gc); XCloseDisplay(g_display); g_display = NULL; @@ -1974,7 +1980,6 @@ static void get_window_attribs(XSetWindowAttributes * attribs) { attribs->background_pixel = BlackPixelOfScreen(g_screen); - attribs->background_pixel = WhitePixelOfScreen(g_screen); attribs->border_pixel = WhitePixelOfScreen(g_screen); attribs->backing_store = g_ownbackstore ? NotUseful : Always; attribs->override_redirect = g_fullscreen; @@ -2088,6 +2093,9 @@ ui_create_window(void) } XSelectInput(g_display, g_wnd, input_mask); +#ifdef HAVE_XRANDR + XSelectInput(g_display, RootWindowOfScreen(g_screen), StructureNotifyMask); +#endif XMapWindow(g_display, g_wnd); /* wait for VisibilityNotify */ @@ -2108,7 +2116,8 @@ ui_create_window(void) /* create invisible 1x1 cursor to be used as null cursor */ if (g_null_cursor == NULL) - g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data); + g_null_cursor = + ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data, 24); if (g_seamless_rdp) { @@ -2158,6 +2167,13 @@ ui_destroy_window(void) XDestroyIC(g_IC); XDestroyWindow(g_display, g_wnd); + g_wnd = 0; + + if (g_backstore) + { + XFreePixmap(g_display, g_backstore); + g_backstore = 0; + } } void @@ -2294,6 +2310,15 @@ xwin_process_events(void) { XNextEvent(g_display, &xevent); + if (!g_wnd) + /* Ignore events between ui_destroy_window and ui_create_window */ + continue; + + /* Also ignore root window events except ConfigureNotify */ + if (xevent.type != ConfigureNotify + && xevent.xany.window == DefaultRootWindow(g_display)) + continue; + if ((g_IC != NULL) && (XFilterEvent(&xevent, None) == True)) { DEBUG_KBD(("Filtering event\n")); @@ -2350,6 +2375,7 @@ xwin_process_events(void) DEBUG_KBD(("KeyPress for keysym (0x%lx, %s)\n", keysym, get_ksname(keysym))); + set_keypress_keysym(xevent.xkey.keycode, keysym); ev_time = time(NULL); if (handle_special_keys(keysym, xevent.xkey.state, ev_time, True)) break; @@ -2366,6 +2392,7 @@ xwin_process_events(void) DEBUG_KBD(("\nKeyRelease for keysym (0x%lx, %s)\n", keysym, get_ksname(keysym))); + keysym = reset_keypress_keysym(xevent.xkey.keycode, keysym); ev_time = time(NULL); if (handle_special_keys(keysym, xevent.xkey.state, ev_time, False)) break; @@ -2574,6 +2601,20 @@ xwin_process_events(void) rdp_send_client_window_status(0); break; case ConfigureNotify: +#ifdef HAVE_XRANDR + if ((g_sizeopt || g_fullscreen) + && xevent.xconfigure.window == DefaultRootWindow(g_display)) + { + if (xevent.xconfigure.width != WidthOfScreen(g_screen) + || xevent.xconfigure.height != HeightOfScreen(g_screen)) + { + XRRUpdateConfiguration(&xevent); + XSync(g_display, False); + g_pending_resize = True; + } + + } +#endif if (!g_seamless_active) break; @@ -2797,9 +2838,62 @@ ui_destroy_glyph(RD_HGLYPH glyph) XFreePixmap(g_display, (Pixmap) glyph); } +/* convert next pixel to 32 bpp */ +static int +get_next_xor_pixel(uint8 * xormask, int bpp, int *k) +{ + int rv = 0; + PixelColour pc; + uint8 *s8; + uint16 *s16; + + switch (bpp) + { + case 1: + s8 = xormask + (*k) / 8; + rv = (*s8) & (0x80 >> ((*k) % 8)); + rv = rv ? 0xffffff : 0; + (*k) += 1; + break; + case 8: + s8 = xormask + *k; + /* should use colour map */ + rv = s8[0]; + rv = rv ? 0xffffff : 0; + (*k) += 1; + break; + case 15: + s16 = (uint16 *) xormask; + SPLITCOLOUR15(s16[*k], pc); + rv = (pc.red << 16) | (pc.green << 8) | pc.blue; + (*k) += 1; + break; + case 16: + s16 = (uint16 *) xormask; + SPLITCOLOUR16(s16[*k], pc); + rv = (pc.red << 16) | (pc.green << 8) | pc.blue; + (*k) += 1; + break; + case 24: + s8 = xormask + *k; + rv = (s8[0] << 16) | (s8[1] << 8) | s8[2]; + (*k) += 3; + break; + case 32: + s8 = xormask + *k; + rv = (s8[1] << 16) | (s8[2] << 8) | s8[3]; + (*k) += 4; + break; + default: + error("unknown bpp in get_next_xor_pixel %d\n", bpp); + break; + } + return rv; +} + RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, - uint8 * andmask, uint8 * xormask) + uint8 * andmask, uint8 * xormask, int bpp) { RD_HGLYPH maskglyph, cursorglyph; XColor bg, fg; @@ -2807,9 +2901,10 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *cursor, *pcursor; uint8 *mask, *pmask; uint8 nextbit; - int scanline, offset; - int i, j; + int scanline, offset, delta; + int i, j, k; + k = 0; scanline = (width + 7) / 8; offset = scanline * height; @@ -2818,11 +2913,19 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, mask = (uint8 *) xmalloc(offset); memset(mask, 0, offset); - + if (bpp == 1) + { + offset = 0; + delta = scanline; + } + else + { + offset = scanline * height - scanline; + delta = -scanline; + } /* approximate AND and XOR masks with a monochrome X pointer */ for (i = 0; i < height; i++) { - offset -= scanline; pcursor = &cursor[offset]; pmask = &mask[offset]; @@ -2830,7 +2933,7 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, { for (nextbit = 0x80; nextbit != 0; nextbit >>= 1) { - if (xormask[0] || xormask[1] || xormask[2]) + if (get_next_xor_pixel(xormask, bpp, &k)) { *pcursor |= (~(*andmask) & nextbit); *pmask |= nextbit; @@ -2840,14 +2943,13 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, *pcursor |= ((*andmask) & nextbit); *pmask |= (~(*andmask) & nextbit); } - - xormask += 3; } andmask++; pcursor++; pmask++; } + offset += delta; } fg.red = fg.blue = fg.green = 0xffff; @@ -3097,18 +3199,45 @@ ui_patblt(uint8 opcode, break; case 3: /* Pattern */ - for (i = 0; i != 8; i++) - ipattern[7 - i] = brush->pattern[i]; - fill = (Pixmap) ui_create_glyph(8, 8, ipattern); - SET_FOREGROUND(bgcolour); - SET_BACKGROUND(fgcolour); - XSetFillStyle(g_display, g_gc, FillOpaqueStippled); - XSetStipple(g_display, g_gc, fill); - XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); - FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); - XSetFillStyle(g_display, g_gc, FillSolid); - XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((RD_HGLYPH) fill); + if (brush->bd == 0) /* rdp4 brush */ + { + for (i = 0; i != 8; i++) + ipattern[7 - i] = brush->pattern[i]; + fill = (Pixmap) ui_create_glyph(8, 8, ipattern); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } + else if (brush->bd->colour_code > 1) /* > 1 bpp */ + { + fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data); + XSetFillStyle(g_display, g_gc, FillTiled); + XSetTile(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_bitmap((RD_HBITMAP) fill); + } + else + { + fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } break; default: @@ -3271,18 +3400,45 @@ ui_polygon(uint8 opcode, break; case 3: /* Pattern */ - for (i = 0; i != 8; i++) - ipattern[7 - i] = brush->pattern[i]; - fill = (Pixmap) ui_create_glyph(8, 8, ipattern); - SET_FOREGROUND(bgcolour); - SET_BACKGROUND(fgcolour); - XSetFillStyle(g_display, g_gc, FillOpaqueStippled); - XSetStipple(g_display, g_gc, fill); - XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); - FILL_POLYGON((XPoint *) point, npoints); - XSetFillStyle(g_display, g_gc, FillSolid); - XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((RD_HGLYPH) fill); + if (brush->bd == 0) /* rdp4 brush */ + { + for (i = 0; i != 8; i++) + ipattern[7 - i] = brush->pattern[i]; + fill = (Pixmap) ui_create_glyph(8, 8, ipattern); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_POLYGON((XPoint *) point, npoints); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } + else if (brush->bd->colour_code > 1) /* > 1 bpp */ + { + fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data); + XSetFillStyle(g_display, g_gc, FillTiled); + XSetTile(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_POLYGON((XPoint *) point, npoints); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_bitmap((RD_HBITMAP) fill); + } + else + { + fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + FILL_POLYGON((XPoint *) point, npoints); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } break; default: @@ -3349,18 +3505,45 @@ ui_ellipse(uint8 opcode, break; case 3: /* Pattern */ - for (i = 0; i != 8; i++) - ipattern[7 - i] = brush->pattern[i]; - fill = (Pixmap) ui_create_glyph(8, 8, ipattern); - SET_FOREGROUND(bgcolour); - SET_BACKGROUND(fgcolour); - XSetFillStyle(g_display, g_gc, FillOpaqueStippled); - XSetStipple(g_display, g_gc, fill); - XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); - DRAW_ELLIPSE(x, y, cx, cy, fillmode); - XSetFillStyle(g_display, g_gc, FillSolid); - XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((RD_HGLYPH) fill); + if (brush->bd == 0) /* rdp4 brush */ + { + for (i = 0; i != 8; i++) + ipattern[7 - i] = brush->pattern[i]; + fill = (Pixmap) ui_create_glyph(8, 8, ipattern); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + DRAW_ELLIPSE(x, y, cx, cy, fillmode); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } + else if (brush->bd->colour_code > 1) /* > 1 bpp */ + { + fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data); + XSetFillStyle(g_display, g_gc, FillTiled); + XSetTile(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + DRAW_ELLIPSE(x, y, cx, cy, fillmode); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_bitmap((RD_HBITMAP) fill); + } + else + { + fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(g_display, g_gc, FillOpaqueStippled); + XSetStipple(g_display, g_gc, fill); + XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); + DRAW_ELLIPSE(x, y, cx, cy, fillmode); + XSetFillStyle(g_display, g_gc, FillSolid); + XSetTSOrigin(g_display, g_gc, 0, 0); + ui_destroy_glyph((RD_HGLYPH) fill); + } break; default: @@ -3618,6 +3801,7 @@ ui_begin_update(void) void ui_end_update(void) { + XFlush(g_display); } @@ -3639,6 +3823,22 @@ ui_seamless_begin(RD_BOOL hidden) void +ui_seamless_end() +{ + /* Destroy all seamless windows */ + while (g_seamless_windows) + { + XDestroyWindow(g_display, g_seamless_windows->wnd); + sw_remove_window(g_seamless_windows); + } + + g_seamless_started = False; + g_seamless_active = False; + g_seamless_hidden = False; +} + + +void ui_seamless_hide_desktop() { if (!g_seamless_rdp) diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk index 33a535ff6..20fd05443 100644 --- a/src/VBox/Runtime/Makefile.kmk +++ b/src/VBox/Runtime/Makefile.kmk @@ -1694,6 +1694,7 @@ RuntimeR0Drv_SOURCES.darwin = \ r0drv/darwin/alloc-r0drv-darwin.cpp \ r0drv/darwin/assert-r0drv-darwin.cpp \ r0drv/darwin/initterm-r0drv-darwin.cpp \ + r0drv/darwin/mach_kernel-r0drv-darwin.cpp \ r0drv/darwin/memobj-r0drv-darwin.cpp \ r0drv/darwin/mp-r0drv-darwin.cpp \ r0drv/darwin/memuserkernel-r0drv-darwin.cpp \ diff --git a/src/VBox/Runtime/include/internal/ldrELF.h b/src/VBox/Runtime/include/internal/ldrELF.h index 6bcd25697..c52cd816a 100644 --- a/src/VBox/Runtime/include/internal/ldrELF.h +++ b/src/VBox/Runtime/include/internal/ldrELF.h @@ -82,5 +82,5 @@ typedef Elf32_Sym Elf_Sym; # error Unknown arch! #endif -#endif /* ___internal_ldrELF_h */ +#endif /* !___internal_ldrELF_h */ diff --git a/src/VBox/Runtime/include/internal/ldrELF32.h b/src/VBox/Runtime/include/internal/ldrELF32.h index 36dad8dc0..0873357ec 100644 --- a/src/VBox/Runtime/include/internal/ldrELF32.h +++ b/src/VBox/Runtime/include/internal/ldrELF32.h @@ -184,5 +184,5 @@ typedef struct #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) -#endif /* ___internal_ldrELF32_h */ +#endif /* !___internal_ldrELF32_h */ diff --git a/src/VBox/Runtime/include/internal/ldrELF64.h b/src/VBox/Runtime/include/internal/ldrELF64.h index 81ddebaea..8a60fd9c5 100644 --- a/src/VBox/Runtime/include/internal/ldrELF64.h +++ b/src/VBox/Runtime/include/internal/ldrELF64.h @@ -183,5 +183,5 @@ typedef struct #define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type)) -#endif /* ___internal_ldrELF64_h */ +#endif /* !___internal_ldrELF64_h */ diff --git a/src/VBox/Runtime/include/internal/ldrMach-O.h b/src/VBox/Runtime/include/internal/ldrMach-O.h new file mode 100644 index 000000000..c75ea6c3f --- /dev/null +++ b/src/VBox/Runtime/include/internal/ldrMach-O.h @@ -0,0 +1,601 @@ +/* $Id: ldrMach-O.h $ */ +/** @file + * IPRT - Mach-O Structures and Constants. + */ + +/* + * Copyright (C) 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. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + */ + +#ifndef ___internal_ldrMach_O_h +#define ___internal_ldrMach_O_h + +#include <iprt/types.h> + +#ifndef CPU_ARCH_MASK + +/* cputype */ +#define CPU_ARCH_MASK INT32_C(0xff000000) +#define CPU_ARCH_ABI64 INT32_C(0x01000000) +#define CPU_TYPE_ANY INT32_C(-1) +#define CPU_TYPE_VAX INT32_C(1) +#define CPU_TYPE_MC680x0 INT32_C(6) +#define CPU_TYPE_X86 INT32_C(7) +#define CPU_TYPE_I386 CPU_TYPE_X86 +#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64) +#define CPU_TYPE_MC98000 INT32_C(10) +#define CPU_TYPE_HPPA INT32_C(11) +#define CPU_TYPE_MC88000 INT32_C(13) +#define CPU_TYPE_SPARC INT32_C(14) +#define CPU_TYPE_I860 INT32_C(15) +#define CPU_TYPE_POWERPC INT32_C(18) +#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) + +/* cpusubtype */ +#define CPU_SUBTYPE_MULTIPLE INT32_C(-1) +#define CPU_SUBTYPE_LITTLE_ENDIAN INT32_C(0) +#define CPU_SUBTYPE_BIG_ENDIAN INT32_C(1) + +#define CPU_SUBTYPE_VAX_ALL INT32_C(0) +#define CPU_SUBTYPE_VAX780 INT32_C(1) +#define CPU_SUBTYPE_VAX785 INT32_C(2) +#define CPU_SUBTYPE_VAX750 INT32_C(3) +#define CPU_SUBTYPE_VAX730 INT32_C(4) +#define CPU_SUBTYPE_UVAXI INT32_C(5) +#define CPU_SUBTYPE_UVAXII INT32_C(6) +#define CPU_SUBTYPE_VAX8200 INT32_C(7) +#define CPU_SUBTYPE_VAX8500 INT32_C(8) +#define CPU_SUBTYPE_VAX8600 INT32_C(9) +#define CPU_SUBTYPE_VAX8650 INT32_C(10) +#define CPU_SUBTYPE_VAX8800 INT32_C(11) +#define CPU_SUBTYPE_UVAXIII INT32_C(12) + +#define CPU_SUBTYPE_MC680x0_ALL INT32_C(1) +#define CPU_SUBTYPE_MC68030 INT32_C(1) +#define CPU_SUBTYPE_MC68040 INT32_C(2) +#define CPU_SUBTYPE_MC68030_ONLY INT32_C(3) + +#define CPU_SUBTYPE_INTEL(fam, model) ( (int32_t )(((model) << 4) | (fam)) ) +#define CPU_SUBTYPE_INTEL_FAMILY(subtype) ( (subtype) & 0xf ) +#define CPU_SUBTYPE_INTEL_MODEL(subtype) ( (subtype) >> 4 ) +#define CPU_SUBTYPE_INTEL_FAMILY_MAX 0xf +#define CPU_SUBTYPE_INTEL_MODEL_ALL 0 + +#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0) +#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0) +#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0) +#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) +#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0) +#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0) +#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1) +#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3) +#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5) +#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6) +#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7) +#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0) +#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1) +#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2) +#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0) +#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0) +#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1) +#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0) +#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1) +#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0) +#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1) + +#define CPU_SUBTYPE_X86_ALL INT32_C(3) +#define CPU_SUBTYPE_X86_64_ALL INT32_C(3) +#define CPU_SUBTYPE_X86_ARCH1 INT32_C(4) + +#define CPU_SUBTYPE_MIPS_ALL INT32_C(0) +#define CPU_SUBTYPE_MIPS_R2300 INT32_C(1) +#define CPU_SUBTYPE_MIPS_R2600 INT32_C(2) +#define CPU_SUBTYPE_MIPS_R2800 INT32_C(3) +#define CPU_SUBTYPE_MIPS_R2000a INT32_C(4) +#define CPU_SUBTYPE_MIPS_R2000 INT32_C(5) +#define CPU_SUBTYPE_MIPS_R3000a INT32_C(6) +#define CPU_SUBTYPE_MIPS_R3000 INT32_C(7) + +#define CPU_SUBTYPE_MC98000_ALL INT32_C(0) +#define CPU_SUBTYPE_MC98601 INT32_C(1) + +#define CPU_SUBTYPE_HPPA_ALL INT32_C(0) +#define CPU_SUBTYPE_HPPA_7100 INT32_C(0) +#define CPU_SUBTYPE_HPPA_7100LC INT32_C(1) + +#define CPU_SUBTYPE_MC88000_ALL INT32_C(0) +#define CPU_SUBTYPE_MC88100 INT32_C(1) +#define CPU_SUBTYPE_MC88110 INT32_C(2) + +#define CPU_SUBTYPE_SPARC_ALL INT32_C(0) + +#define CPU_SUBTYPE_I860_ALL INT32_C(0) +#define CPU_SUBTYPE_I860_860 INT32_C(1) + +#define CPU_SUBTYPE_POWERPC_ALL INT32_C(0) +#define CPU_SUBTYPE_POWERPC_601 INT32_C(1) +#define CPU_SUBTYPE_POWERPC_602 INT32_C(2) +#define CPU_SUBTYPE_POWERPC_603 INT32_C(3) +#define CPU_SUBTYPE_POWERPC_603e INT32_C(4) +#define CPU_SUBTYPE_POWERPC_603ev INT32_C(5) +#define CPU_SUBTYPE_POWERPC_604 INT32_C(6) +#define CPU_SUBTYPE_POWERPC_604e INT32_C(7) +#define CPU_SUBTYPE_POWERPC_620 INT32_C(8) +#define CPU_SUBTYPE_POWERPC_750 INT32_C(9) +#define CPU_SUBTYPE_POWERPC_7400 INT32_C(10) +#define CPU_SUBTYPE_POWERPC_7450 INT32_C(11) +#define CPU_SUBTYPE_POWERPC_Max INT32_C(10) +#define CPU_SUBTYPE_POWERPC_SCVger INT32_C(11) +#define CPU_SUBTYPE_POWERPC_970 INT32_C(100) + +#define CPU_SUBTYPE_MASK UINT32_C(0xff000000) +#define CPU_SUBTYPE_LIB64 UINT32_C(0x80000000) + +#endif /* !CPU_ARCH_MASK */ + + +typedef struct fat_header +{ + uint32_t magic; + uint32_t nfat_arch; +} fat_header_t; + +#ifndef IMAGE_FAT_SIGNATURE +# define IMAGE_FAT_SIGNATURE UINT32_C(0xcafebabe) +#endif +#ifndef IMAGE_FAT_SIGNATURE_OE +# define IMAGE_FAT_SIGNATURE_OE UINT32_C(0xbebafeca) +#endif + +typedef struct fat_arch +{ + int32_t cputype; + int32_t cpusubtype; + uint32_t offset; + uint32_t size; + uint32_t align; +} fat_arch_t; + +typedef struct mach_header_32 +{ + uint32_t magic; + int32_t cputype; + int32_t cpusubtype; + uint32_t filetype; + uint32_t ncmds; + uint32_t sizeofcmds; + uint32_t flags; +} mach_header_32_t; + +/* magic */ +#ifndef IMAGE_MACHO32_SIGNATURE +# define IMAGE_MACHO32_SIGNATURE UINT32_C(0xfeedface) +#endif +#ifndef IMAGE_MACHO32_SIGNATURE_OE +# define IMAGE_MACHO32_SIGNATURE_OE UINT32_C(0xcefaedfe) +#endif +#define MH_MAGIC IMAGE_MACHO32_SIGNATURE +#define MH_CIGAM IMAGE_MACHO32_SIGNATURE_OE + +typedef struct mach_header_64 +{ + uint32_t magic; + int32_t cputype; + int32_t cpusubtype; + uint32_t filetype; + uint32_t ncmds; + uint32_t sizeofcmds; + uint32_t flags; + uint32_t reserved; +} mach_header_64_t; + +/* magic */ +#ifndef IMAGE_MACHO64_SIGNATURE +# define IMAGE_MACHO64_SIGNATURE UINT32_C(0xfeedfacf) +#endif +#ifndef IMAGE_MACHO64_SIGNATURE_OE +# define IMAGE_MACHO64_SIGNATURE_OE UINT32_C(0xfefaedfe) +#endif +#define MH_MAGIC_64 IMAGE_MACHO64_SIGNATURE +#define MH_CIGAM_64 IMAGE_MACHO64_SIGNATURE_OE + +/* mach_header_* filetype */ +#define MH_OBJECT UINT32_C(1) +#define MH_EXECUTE UINT32_C(2) +#define MH_FVMLIB UINT32_C(3) +#define MH_CORE UINT32_C(4) +#define MH_PRELOAD UINT32_C(5) +#define MH_DYLIB UINT32_C(6) +#define MH_DYLINKER UINT32_C(7) +#define MH_BUNDLE UINT32_C(8) +#define MH_DYLIB_STUB UINT32_C(9) +#define MH_DSYM UINT32_C(10) + +/* mach_header_* flags */ +#define MH_NOUNDEFS UINT32_C(0x00000001) +#define MH_INCRLINK UINT32_C(0x00000002) +#define MH_DYLDLINK UINT32_C(0x00000004) +#define MH_BINDATLOAD UINT32_C(0x00000008) +#define MH_PREBOUND UINT32_C(0x00000010) +#define MH_SPLIT_SEGS UINT32_C(0x00000020) +#define MH_LAZY_INIT UINT32_C(0x00000040) +#define MH_TWOLEVEL UINT32_C(0x00000080) +#define MH_FORCE_FLAT UINT32_C(0x00000100) +#define MH_NOMULTIDEFS UINT32_C(0x00000200) +#define MH_NOFIXPREBINDING UINT32_C(0x00000400) +#define MH_PREBINDABLE UINT32_C(0x00000800) +#define MH_ALLMODSBOUND UINT32_C(0x00001000) +#define MH_SUBSECTIONS_VIA_SYMBOLS UINT32_C(0x00002000) +#define MH_CANONICAL UINT32_C(0x00004000) +#define MH_WEAK_DEFINES UINT32_C(0x00008000) +#define MH_BINDS_TO_WEAK UINT32_C(0x00010000) +#define MH_ALLOW_STACK_EXECUTION UINT32_C(0x00020000) +#define MH_VALID_FLAGS UINT32_C(0x0003ffff) + + +typedef struct load_command +{ + uint32_t cmd; + uint32_t cmdsize; +} load_command_t; + +/* load cmd */ +#define LC_REQ_DYLD UINT32_C(0x80000000) +#define LC_SEGMENT_32 UINT32_C(0x01) +#define LC_SYMTAB UINT32_C(0x02) +#define LC_SYMSEG UINT32_C(0x03) +#define LC_THREAD UINT32_C(0x04) +#define LC_UNIXTHREAD UINT32_C(0x05) +#define LC_LOADFVMLIB UINT32_C(0x06) +#define LC_IDFVMLIB UINT32_C(0x07) +#define LC_IDENT UINT32_C(0x08) +#define LC_FVMFILE UINT32_C(0x09) +#define LC_PREPAGE UINT32_C(0x0a) +#define LC_DYSYMTAB UINT32_C(0x0b) +#define LC_LOAD_DYLIB UINT32_C(0x0c) +#define LC_ID_DYLIB UINT32_C(0x0d) +#define LC_LOAD_DYLINKER UINT32_C(0x0e) +#define LC_ID_DYLINKER UINT32_C(0x0f) +#define LC_PREBOUND_DYLIB UINT32_C(0x10) +#define LC_ROUTINES UINT32_C(0x11) +#define LC_SUB_FRAMEWORK UINT32_C(0x12) +#define LC_SUB_UMBRELLA UINT32_C(0x13) +#define LC_SUB_CLIENT UINT32_C(0x14) +#define LC_SUB_LIBRARY UINT32_C(0x15) +#define LC_TWOLEVEL_HINTS UINT32_C(0x16) +#define LC_PREBIND_CKSUM UINT32_C(0x17) +#define LC_LOAD_WEAK_DYLIB ( UINT32_C(0x18) | LC_REQ_DYLD) +#define LC_SEGMENT_64 UINT32_C(0x19) +#define LC_ROUTINES_64 UINT32_C(0x1a) +#define LC_UUID UINT32_C(0x1b) + + +typedef struct lc_str +{ + uint32_t offset; +} lc_str_t; + +typedef struct segment_command_32 +{ + uint32_t cmd; + uint32_t cmdsize; + char segname[16]; + uint32_t vmaddr; + uint32_t vmsize; + uint32_t fileoff; + uint32_t filesize; + uint32_t maxprot; + uint32_t initprot; + uint32_t nsects; + uint32_t flags; +} segment_command_32_t; + +typedef struct segment_command_64 +{ + uint32_t cmd; + uint32_t cmdsize; + char segname[16]; + uint64_t vmaddr; + uint64_t vmsize; + uint64_t fileoff; + uint64_t filesize; + uint32_t maxprot; + uint32_t initprot; + uint32_t nsects; + uint32_t flags; +} segment_command_64_t; + +/* segment flags */ +#define SG_HIGHVM UINT32_C(0x00000001) +#define SG_FVMLIB UINT32_C(0x00000002) +#define SG_NORELOC UINT32_C(0x00000004) +#define SG_PROTECTED_VERSION_1 UINT32_C(0x00000008) + +/* maxprot/initprot */ +#ifndef VM_PROT_NONE +# define VM_PROT_NONE UINT32_C(0x00000000) +# define VM_PROT_READ UINT32_C(0x00000001) +# define VM_PROT_WRITE UINT32_C(0x00000002) +# define VM_PROT_EXECUTE UINT32_C(0x00000004) +# define VM_PROT_ALL UINT32_C(0x00000007) +#endif + +typedef struct section_32 +{ + char sectname[16]; + char segname[16]; + uint32_t addr; + uint32_t size; + uint32_t offset; + uint32_t align; + uint32_t reloff; + uint32_t nreloc; + uint32_t flags; + uint32_t reserved1; + uint32_t reserved2; +} section_32_t; + +typedef struct section_64 +{ + char sectname[16]; + char segname[16]; + uint64_t addr; + uint64_t size; + uint32_t offset; + uint32_t align; + uint32_t reloff; + uint32_t nreloc; + uint32_t flags; + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; +} section_64_t; + +/* section flags */ +#define SECTION_TYPE UINT32_C(0x000000ff) +#define S_REGULAR 0x0 +#define S_ZEROFILL 0x1 +#define S_CSTRING_LITERALS 0x2 +#define S_4BYTE_LITERALS 0x3 +#define S_8BYTE_LITERALS 0x4 +#define S_LITERAL_POINTERS 0x5 +#define S_NON_LAZY_SYMBOL_POINTERS 0x6 +#define S_LAZY_SYMBOL_POINTERS 0x7 +#define S_SYMBOL_STUBS 0x8 +#define S_MOD_INIT_FUNC_POINTERS 0x9 +#define S_MOD_TERM_FUNC_POINTERS 0xa +#define S_COALESCED 0xb +#define S_GB_ZEROFILL 0xc +#define S_INTERPOSING 0xd +#define S_16BYTE_LITERALS 0xe +#define S_DTRACE_DOF 0xf +#define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10 + +#define SECTION_ATTRIBUTES UINT32_C(0xffffff00) +#define SECTION_ATTRIBUTES_USR UINT32_C(0xff000000) +#define S_ATTR_PURE_INSTRUCTIONS UINT32_C(0x80000000) +#define S_ATTR_NO_TOC UINT32_C(0x40000000) +#define S_ATTR_STRIP_STATIC_SYMS UINT32_C(0x20000000) +#define S_ATTR_NO_DEAD_STRIP UINT32_C(0x10000000) +#define S_ATTR_LIVE_SUPPORT UINT32_C(0x08000000) +#define S_ATTR_SELF_MODIFYING_CODE UINT32_C(0x04000000) +#define S_ATTR_DEBUG UINT32_C(0x02000000) +#define SECTION_ATTRIBUTES_SYS UINT32_C(0x00ffff00) +#define S_ATTR_SOME_INSTRUCTIONS UINT32_C(0x00000400) +#define S_ATTR_EXT_RELOC UINT32_C(0x00000200) +#define S_ATTR_LOC_RELOC UINT32_C(0x00000100) + +/* standard section names */ +#define SEG_PAGEZERO "__PAGEZERO" +#define SEG_TEXT "__TEXT" +#define SECT_TEXT "__text" +#define SECT_FVMLIB_INIT0 "__fvmlib_init0" +#define SECT_FVMLIB_INIT1 "__fvmlib_init1" +#define SEG_DATA "__DATA" +#define SECT_DATA "__data" +#define SECT_BSS "__bss" +#define SECT_COMMON "__common" +#define SEG_OBJC "__OBJC" +#define SECT_OBJC_SYMBOLS "__symbol_table" +#define SECT_OBJC_MODULES "__module_info" +#define SECT_OBJC_STRINGS "__selector_strs" +#define SECT_OBJC_REFS "__selector_refs" +#define SEG_ICON "__ICON" +#define SECT_ICON_HEADER "__header" +#define SECT_ICON_TIFF "__tiff" +#define SEG_LINKEDIT "__LINKEDIT" +#define SEG_UNIXSTACK "__UNIXSTACK" +#define SEG_IMPORT "__IMPORT" + +typedef struct thread_command +{ + uint32_t cmd; + uint32_t cmdsize; +} thread_command_t; + +typedef struct symtab_command +{ + uint32_t cmd; + uint32_t cmdsize; + uint32_t symoff; + uint32_t nsyms; + uint32_t stroff; + uint32_t strsize; +} symtab_command_t; + +typedef struct uuid_command +{ + uint32_t cmd; + uint32_t cmdsize; + uint8_t uuid[16]; +} uuid_command_t; + +typedef struct macho_nlist_32 +{ + union + { + int32_t n_strx; + } n_un; + uint8_t n_type; + uint8_t n_sect; + int16_t n_desc; + uint32_t n_value; +} macho_nlist_32_t; + + +typedef struct macho_nlist_64 +{ + union + { + uint32_t n_strx; + } n_un; + uint8_t n_type; + uint8_t n_sect; + int16_t n_desc; + uint64_t n_value; +} macho_nlist_64_t; + +#define MACHO_N_EXT UINT8_C(0x01) +#define MACHO_N_PEXT UINT8_C(0x10) + +#define MACHO_N_TYPE UINT8_C(0x0e) +#define MACHO_N_UNDF UINT8_C(0x00) +#define MACHO_N_ABS UINT8_C(0x02) +#define MACHO_N_INDR UINT8_C(0x0a) +#define MACHO_N_PBUD UINT8_C(0x0c) +#define MACHO_N_SECT UINT8_C(0x0e) + +#define MACHO_N_STAB UINT8_C(0xe0) +#define MACHO_N_GSYM UINT8_C(0x20) +#define MACHO_N_FNAME UINT8_C(0x22) +#define MACHO_N_FUN UINT8_C(0x24) +#define MACHO_N_STSYM UINT8_C(0x26) +#define MACHO_N_LCSYM UINT8_C(0x28) +#define MACHO_N_BNSYM UINT8_C(0x2e) +#define MACHO_N_PC UINT8_C(0x30) +#define MACHO_N_OPT UINT8_C(0x3c) +#define MACHO_N_RSYM UINT8_C(0x40) +#define MACHO_N_SLINE UINT8_C(0x44) +#define MACHO_N_ENSYM UINT8_C(0x4e) +#define MACHO_N_SSYM UINT8_C(0x60) +#define MACHO_N_SO UINT8_C(0x64) +#define MACHO_N_OSO UINT8_C(0x66) +#define MACHO_N_LSYM UINT8_C(0x80) +#define MACHO_N_BINCL UINT8_C(0x82) +#define MACHO_N_SOL UINT8_C(0x84) +#define MACHO_N_PARAMS UINT8_C(0x86) +#define MACHO_N_VERSION UINT8_C(0x88) +#define MACHO_N_OLEVEL UINT8_C(0x8A) +#define MACHO_N_PSYM UINT8_C(0xa0) +#define MACHO_N_EINCL UINT8_C(0xa2) +#define MACHO_N_ENTRY UINT8_C(0xa4) +#define MACHO_N_LBRAC UINT8_C(0xc0) +#define MACHO_N_EXCL UINT8_C(0xc2) +#define MACHO_N_RBRAC UINT8_C(0xe0) +#define MACHO_N_BCOMM UINT8_C(0xe2) +#define MACHO_N_ECOMM UINT8_C(0xe4) +#define MACHO_N_ECOML UINT8_C(0xe8) +#define MACHO_N_LENG UINT8_C(0xfe) + +#define MACHO_NO_SECT UINT8_C(0x00) +#define MACHO_MAX_SECT UINT8_C(0xff) + +#define REFERENCE_TYPE UINT16_C(0x000f) +#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 +#define REFERENCE_FLAG_UNDEFINED_LAZY 1 +#define REFERENCE_FLAG_DEFINED 2 +#define REFERENCE_FLAG_PRIVATE_DEFINED 3 +#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 +#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 +#define REFERENCED_DYNAMICALLY UINT16_C(0x0010) + +#define GET_LIBRARY_ORDINAL(a_n_desc) \ + RT_BYTE2(a_n_desc) +#define SET_LIBRARY_ORDINAL(a_n_desc, a_ordinal) \ + do { (a_n_desc) = RT_MAKE_U16(RT_BYTE1(a_n_desc), a_ordinal); } while (0) + +#define SELF_LIBRARY_ORDINAL 0x00 +#define MAX_LIBRARY_ORDINAL 0xfd +#define DYNAMIC_LOOKUP_ORDINAL 0xfe +#define EXECUTABLE_ORDINAL 0xff + +#define N_NO_DEAD_STRIP UINT16_C(0x0020) +#define N_DESC_DISCARDED UINT16_C(0x0020) +#define N_WEAK_REF UINT16_C(0x0040) +#define N_WEAK_DEF UINT16_C(0x0080) +#define N_REF_TO_WEAK UINT16_C(0x0080) + +typedef struct macho_relocation_info +{ + int32_t r_address; + uint32_t r_symbolnum : 24; + uint32_t r_pcrel : 1; + uint32_t r_length : 2; + uint32_t r_extern : 1; + uint32_t r_type : 4; +} macho_relocation_info_t; + +#define R_ABS 0 +#define R_SCATTERED UINT32_C(0x80000000) + +typedef struct scattered_relocation_info +{ +#ifdef RT_LITTLE_ENDIAN + uint32_t r_address : 24; + uint32_t r_type : 4; + uint32_t r_length : 2; + uint32_t r_pcrel : 1; + uint32_t r_scattered : 1; +#elif defined(RT_BIG_ENDIAN) + uint32_t r_scattered : 1; + uint32_t r_pcrel : 1; + uint32_t r_length : 2; + uint32_t r_type : 4; + uint32_t r_address : 24; +#else +# error "Neither K_ENDIAN isn't LITTLE or BIG!" +#endif + int32_t r_value; +} scattered_relocation_info_t; + +typedef enum reloc_type_generic +{ + GENERIC_RELOC_VANILLA = 0, + GENERIC_RELOC_PAIR, + GENERIC_RELOC_SECTDIFF, + GENERIC_RELOC_PB_LA_PTR, + GENERIC_RELOC_LOCAL_SECTDIFF +} reloc_type_generic_t; + +typedef enum reloc_type_x86_64 +{ + X86_64_RELOC_UNSIGNED = 0, + X86_64_RELOC_SIGNED, + X86_64_RELOC_BRANCH, + X86_64_RELOC_GOT_LOAD, + X86_64_RELOC_GOT, + X86_64_RELOC_SUBTRACTOR, + X86_64_RELOC_SIGNED_1, + X86_64_RELOC_SIGNED_2, + X86_64_RELOC_SIGNED_4 +} reloc_type_x86_64_t; + +#endif + diff --git a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp index eaa800a13..253adaf35 100644 --- a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp @@ -33,14 +33,20 @@ #include <iprt/err.h> #include <iprt/assert.h> +#include <iprt/darwin/machkernel.h> #include "internal/initterm.h" + /******************************************************************************* * Global Variables * *******************************************************************************/ /** Pointer to the lock group used by IPRT. */ -lck_grp_t *g_pDarwinLockGroup = NULL; +lck_grp_t *g_pDarwinLockGroup = NULL; +/** Pointer to the ast_pending function, if found. */ +PFNR0DARWINASTPENDING g_pfnR0DarwinAstPending = NULL; +/** Pointer to the cpu_interrupt function, if found. */ +PFNR0DARWINCPUINTERRUPT g_pfnR0DarwinCpuInterrupt = NULL; int rtR0InitNative(void) @@ -55,6 +61,27 @@ int rtR0InitNative(void) * Initialize the preemption hacks. */ int rc = rtThreadPreemptDarwinInit(); + if (RT_SUCCESS(rc)) + { + /* + * Try resolve kernel symbols we need but apple don't wish to give us. + */ + RTR0MACHKERNEL hKernel; + rc = RTR0MachKernelOpen("/mach_kernel", &hKernel); + if (RT_SUCCESS(rc)) + { + RTR0MachKernelGetSymbol(hKernel, "ast_pending", (void **)&g_pfnR0DarwinAstPending); + printf("ast_pending=%p\n", g_pfnR0DarwinAstPending); + RTR0MachKernelGetSymbol(hKernel, "cpu_interrupt", (void **)&g_pfnR0DarwinCpuInterrupt); + printf("cpu_interrupt=%p\n", g_pfnR0DarwinCpuInterrupt); + RTR0MachKernelClose(hKernel); + } + if (RT_FAILURE(rc)) + { + printf("rtR0InitNative: warning! failed to resolve special kernel symbols\n"); + rc = VINF_SUCCESS; + } + } if (RT_FAILURE(rc)) rtR0TermNative(); diff --git a/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp new file mode 100644 index 000000000..e69746daf --- /dev/null +++ b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp @@ -0,0 +1,1045 @@ +/* $Id: mach_kernel-r0drv-darwin.cpp $ */ +/** @file + * IPRT - mach_kernel symbol resolving hack, R0 Driver, Darwin. + */ + +/* + * Copyright (C) 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. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + */ + + +#define RTMEM_WRAP_TO_EF_APIS +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#ifdef IN_RING0 +# include "the-darwin-kernel.h" +# include <sys/kauth.h> +RT_C_DECLS_BEGIN /* Buggy 10.4 headers, fixed in 10.5. */ +# include <sys/kpi_mbuf.h> +# include <net/kpi_interfacefilter.h> +# include <sys/kpi_socket.h> +# include <sys/kpi_socketfilter.h> +RT_C_DECLS_END +# include <sys/buf.h> +# include <sys/vm.h> +# include <sys/vnode_if.h> +/*# include <sys/sysctl.h>*/ +# include <sys/systm.h> +# include <vfs/vfs_support.h> +/*# include <miscfs/specfs/specdev.h>*/ +#endif + +#include "internal/iprt.h" +#include <iprt/darwin/machkernel.h> + +#ifdef IN_RING0 /* till RTFILE is changed in types.h */ +# include <iprt/types.h> +typedef struct RTFILENEWINT *RTFILENEW; +typedef RTFILENEW *PRTFILENEW; +# undef NIL_RTFILE +# define RTFILE RTFILENEW +# define PRTFILE PRTFILENEW +# define NIL_RTFILE ((RTFILENEW)-1) +#endif + +#include <iprt/asm.h> +#include <iprt/assert.h> +#include <iprt/err.h> +#include <iprt/assert.h> +#include <iprt/file.h> +#include <iprt/log.h> +#include <iprt/mem.h> +#include <iprt/string.h> +#include "internal/ldrMach-O.h" + +/** @def MY_CPU_TYPE + * The CPU type targeted by the compiler. */ +/** @def MY_CPU_TYPE + * The "ALL" CPU subtype targeted by the compiler. */ +/** @def MY_MACHO_HEADER + * The Mach-O header targeted by the compiler. */ +/** @def MY_MACHO_MAGIC + * The Mach-O header magic we're targeting. */ +/** @def MY_SEGMENT_COMMAND + * The segment command targeted by the compiler. */ +/** @def MY_SECTION + * The section struture targeted by the compiler. */ +/** @def MY_NLIST + * The symbol table entry targeted by the compiler. */ +#ifdef RT_ARCH_X86 +# define MY_CPU_TYPE CPU_TYPE_I386 +# define MY_CPU_SUBTYPE_ALL CPU_SUBTYPE_I386_ALL +# define MY_MACHO_HEADER mach_header_32_t +# define MY_MACHO_MAGIC IMAGE_MACHO32_SIGNATURE +# define MY_SEGMENT_COMMAND segment_command_32_t +# define MY_SECTION section_32_t +# define MY_NLIST macho_nlist_32_t + +#elif defined(RT_ARCH_AMD64) +# define MY_CPU_TYPE CPU_TYPE_X86_64 +# define MY_CPU_SUBTYPE_ALL CPU_SUBTYPE_X86_64_ALL +# define MY_MACHO_HEADER mach_header_64_t +# define MY_MACHO_MAGIC IMAGE_MACHO64_SIGNATURE +# define MY_SEGMENT_COMMAND segment_command_64_t +# define MY_SECTION section_64_t +# define MY_NLIST macho_nlist_64_t + +#else +# error "Port me!" +#endif + +/** @name Return macros for make it simpler to track down too paranoid code. + * @{ + */ +#ifdef DEBUG +# define RETURN_VERR_BAD_EXE_FORMAT \ + do { Assert(!g_fBreakpointOnError); return VERR_BAD_EXE_FORMAT; } while (0) +# define RETURN_VERR_LDR_UNEXPECTED \ + do { Assert(!g_fBreakpointOnError); return VERR_LDR_UNEXPECTED; } while (0) +# define RETURN_VERR_LDR_ARCH_MISMATCH \ + do { Assert(!g_fBreakpointOnError); return VERR_LDR_ARCH_MISMATCH; } while (0) +#else +# define RETURN_VERR_BAD_EXE_FORMAT do { return VERR_BAD_EXE_FORMAT; } while (0) +# define RETURN_VERR_LDR_UNEXPECTED do { return VERR_LDR_UNEXPECTED; } while (0) +# define RETURN_VERR_LDR_ARCH_MISMATCH do { return VERR_LDR_ARCH_MISMATCH; } while (0) +#endif +/** @} */ + +#define VERR_LDR_UNEXPECTED (-641) + + +/******************************************************************************* +* Structures and Typedefs * +*******************************************************************************/ +/** + * Our internal representation of the mach_kernel after loading it's symbols + * and successfully resolving their addresses. + */ +typedef struct RTR0MACHKERNELINT +{ + /** @name Result. + * @{ */ + /** Pointer to the string table. */ + char *pachStrTab; + /** The size of the string table. */ + uint32_t cbStrTab; + /** The file offset of the string table. */ + uint32_t offStrTab; + /** Pointer to the symbol table. */ + MY_NLIST *paSyms; + /** The size of the symbol table. */ + uint32_t cSyms; + /** The file offset of the symbol table. */ + uint32_t offSyms; + /** @} */ + + /** @name Used during loading. + * @{ */ + /** The file handle. */ + RTFILE hFile; + /** The architecture image offset (fat_arch_t::offset). */ + uint64_t offArch; + /** The architecture image size (fat_arch_t::size). */ + uint32_t cbArch; + /** The number of load commands (mach_header_XX_t::ncmds). */ + uint32_t cLoadCmds; + /** The size of the load commands. */ + uint32_t cbLoadCmds; + /** The load commands. */ + load_command_t *pLoadCmds; + /** Section pointer table (points into the load commands). */ + MY_SECTION const *apSections[MACHO_MAX_SECT]; + /** The number of sections. */ + uint32_t cSections; + /** @} */ + + /** Buffer space. */ + char abBuf[_4K]; +} RTR0MACHKERNELINT; + + +/******************************************************************************* +* Structures and Typedefs * +*******************************************************************************/ +#ifdef DEBUG +static bool g_fBreakpointOnError = false; +#endif + + +#ifdef IN_RING0 + +/** Default file permissions for newly created files. */ +#if defined(S_IRUSR) && defined(S_IWUSR) +# define RT_FILE_PERMISSION (S_IRUSR | S_IWUSR) +#else +# define RT_FILE_PERMISSION (00600) +#endif + +/** + * Darwin kernel file handle data. + */ +typedef struct RTFILENEWINT +{ + /** Magic value (RTFILE_MAGIC). */ + uint32_t u32Magic; + /** The open mode flags passed to the kernel API. */ + int fOpenMode; + /** The open flags passed to RTFileOpen. */ + uint64_t fOpen; + /** The VFS context in which the file was opened. */ + vfs_context_t hVfsCtx; + /** The vnode returned by vnode_open. */ + vnode_t hVnode; +} RTFILENEWINT; +/** Magic number for RTFILENEWINT::u32Magic (To Be Determined). */ +#define RTFILE_MAGIC UINT32_C(0x01020304) + + +RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint32_t fOpen) +{ + RTFILENEWINT *pThis = (RTFILENEWINT *)RTMemAllocZ(sizeof(*pThis)); + if (!pThis) + return VERR_NO_MEMORY; + + errno_t rc; + pThis->u32Magic = RTFILE_MAGIC; + pThis->fOpen = fOpen; + pThis->hVfsCtx = vfs_context_current(); + if (pThis->hVfsCtx != NULL) + { + int fCMode = (fOpen & RTFILE_O_CREATE_MODE_MASK) + ? (fOpen & RTFILE_O_CREATE_MODE_MASK) >> RTFILE_O_CREATE_MODE_SHIFT + : RT_FILE_PERMISSION; + int fVnFlags = 0; /* VNODE_LOOKUP_XXX */ + int fOpenMode = 0; + if (fOpen & RTFILE_O_NON_BLOCK) + fOpenMode |= O_NONBLOCK; + if (fOpen & RTFILE_O_WRITE_THROUGH) + fOpenMode |= O_SYNC; + + /* create/truncate file */ + switch (fOpen & RTFILE_O_ACTION_MASK) + { + case RTFILE_O_OPEN: break; + case RTFILE_O_OPEN_CREATE: fOpenMode |= O_CREAT; break; + case RTFILE_O_CREATE: fOpenMode |= O_CREAT | O_EXCL; break; + case RTFILE_O_CREATE_REPLACE: fOpenMode |= O_CREAT | O_TRUNC; break; /** @todo replacing needs fixing, this is *not* a 1:1 mapping! */ + } + if (fOpen & RTFILE_O_TRUNCATE) + fOpenMode |= O_TRUNC; + + switch (fOpen & RTFILE_O_ACCESS_MASK) + { + case RTFILE_O_READ: + fOpenMode |= FREAD; + break; + case RTFILE_O_WRITE: + fOpenMode |= fOpen & RTFILE_O_APPEND ? O_APPEND | FWRITE : FWRITE; + break; + case RTFILE_O_READWRITE: + fOpenMode |= fOpen & RTFILE_O_APPEND ? O_APPEND | FWRITE | FREAD : FWRITE | FREAD; + break; + default: + AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#x\n", fOpen)); + return VERR_INVALID_PARAMETER; + } + + pThis->fOpenMode = fOpenMode; + rc = vnode_open(pszFilename, fOpenMode, fCMode, fVnFlags, &pThis->hVnode, pThis->hVfsCtx); + if (rc == 0) + { + *phFile = pThis; + return VINF_SUCCESS; + } + + rc = RTErrConvertFromErrno(rc); + } + else + rc = VERR_INTERNAL_ERROR_5; + RTMemFree(pThis); + + return rc; +} + + +RTDECL(int) RTFileClose(RTFILE hFile) +{ + if (hFile == NIL_RTFILE) + return VINF_SUCCESS; + + RTFILENEWINT *pThis = hFile; + AssertPtrReturn(pThis, VERR_INVALID_HANDLE); + AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); + pThis->u32Magic = ~RTFILE_MAGIC; + + errno_t rc = vnode_close(pThis->hVnode, pThis->fOpenMode & (FREAD | FWRITE), pThis->hVfsCtx); + + RTMemFree(pThis); + return RTErrConvertFromErrno(rc); +} + + +RTDECL(int) RTFileReadAt(RTFILE hFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead) +{ + RTFILENEWINT *pThis = hFile; + AssertPtrReturn(pThis, VERR_INVALID_HANDLE); + AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); + + off_t offNative = (off_t)off; + AssertReturn((RTFOFF)offNative == off, VERR_OUT_OF_RANGE); + +#if 0 /* Added in 10.6, grr. */ + errno_t rc; + if (!pcbRead) + rc = vn_rdwr(UIO_READ, pThis->hVnode, (char *)pvBuf, cbToRead, offNative, UIO_SYSSPACE, 0 /*ioflg*/, + vfs_context_ucred(pThis->hVfsCtx), NULL, vfs_context_proc(pThis->hVfsCtx)); + else + { + int cbLeft = 0; + rc = vn_rdwr(UIO_READ, pThis->hVnode, (char *)pvBuf, cbToRead, offNative, UIO_SYSSPACE, 0 /*ioflg*/, + vfs_context_ucred(pThis->hVfsCtx), &cbLeft, vfs_context_proc(pThis->hVfsCtx)); + *pcbRead = cbToRead - cbLeft; + } + return !rc ? VINF_SUCCESS : RTErrConvertFromErrno(rc); + +#else + uio_t hUio = uio_create(1, offNative, UIO_SYSSPACE, UIO_READ); + if (!hUio) + return VERR_NO_MEMORY; + errno_t rc; + if (uio_addiov(hUio, (user_addr_t)(uintptr_t)pvBuf, cbToRead) == 0) + { + rc = VNOP_READ(pThis->hVnode, hUio, 0 /*ioflg*/, pThis->hVfsCtx); + if (pcbRead) + *pcbRead = cbToRead - uio_resid(hUio); + else if (!rc && uio_resid(hUio)) + rc = VERR_FILE_IO_ERROR; + } + else + rc = VERR_INTERNAL_ERROR_3; + uio_free(hUio); + return rc; + +#endif +} + +#endif + + +/** + * Close and free up resources we no longer needs. + * + * @param pThis The internal scratch data. + */ +static void rtR0MachKernelLoadDone(RTR0MACHKERNELINT *pThis) +{ + RTFileClose(pThis->hFile); + pThis->hFile = NIL_RTFILE; + + RTMemFree(pThis->pLoadCmds); + pThis->pLoadCmds = NULL; + memset((void *)&pThis->apSections[0], 0, sizeof(pThis->apSections[0]) * MACHO_MAX_SECT); +} + + +/** + * Looks up a kernel symbol. + * + * + * @returns The symbol address on success, 0 on failure. + * @param pThis The internal scratch data. + * @param pszSymbol The symbol to resolve. Automatically prefixed + * with an underscore. + */ +static uintptr_t rtR0MachKernelLookup(RTR0MACHKERNELINT *pThis, const char *pszSymbol) +{ + uint32_t const cSyms = pThis->cSyms; + MY_NLIST const *pSym = pThis->paSyms; + +#if 1 + /* linear search. */ + for (uint32_t iSym = 0; iSym < cSyms; iSym++, pSym++) + { + if (pSym->n_type & MACHO_N_STAB) + continue; + + const char *pszTabName= &pThis->pachStrTab[(uint32_t)pSym->n_un.n_strx]; + if ( *pszTabName == '_' + && strcmp(pszTabName + 1, pszSymbol) == 0) + return pSym->n_value; + } +#else + /** @todo binary search. */ + +#endif + return 0; +} + + +/* Rainy day: Find the right headers for these symbols ... if there are any. */ +extern "C" void ev_try_lock(void); +extern "C" void OSMalloc(void); +extern "C" void OSlibkernInit(void); +extern "C" int osrelease; +extern "C" int ostype; +extern "C" void kdp_set_interface(void); + + +/** + * Check the symbol table against symbols we known symbols. + * + * This is done to detect whether the on disk image and the in + * memory images matches. Mismatches could stem from user + * replacing the default kernel image on disk. + * + * @returns IPRT status code. + * @param pThis The internal scratch data. + */ +static int rtR0MachKernelCheckStandardSymbols(RTR0MACHKERNELINT *pThis) +{ + static struct + { + const char *pszName; + uintptr_t uAddr; + } const s_aStandardCandles[] = + { +#ifdef IN_RING0 +# define KNOWN_ENTRY(a_Sym) { #a_Sym, (uintptr_t)&a_Sym } +#else +# define KNOWN_ENTRY(a_Sym) { #a_Sym, 0 } +#endif + /* IOKit: */ + KNOWN_ENTRY(IOMalloc), + KNOWN_ENTRY(IOFree), + KNOWN_ENTRY(IOSleep), + KNOWN_ENTRY(IORWLockAlloc), + KNOWN_ENTRY(IORecursiveLockLock), + KNOWN_ENTRY(IOSimpleLockAlloc), + KNOWN_ENTRY(PE_cpu_halt), + KNOWN_ENTRY(gIOKitDebug), + KNOWN_ENTRY(gIOServicePlane), + KNOWN_ENTRY(ev_try_lock), + + /* Libkern: */ + KNOWN_ENTRY(OSAddAtomic), + KNOWN_ENTRY(OSBitAndAtomic), + KNOWN_ENTRY(OSBitOrAtomic), + KNOWN_ENTRY(OSBitXorAtomic), + KNOWN_ENTRY(OSCompareAndSwap), + KNOWN_ENTRY(OSMalloc), + KNOWN_ENTRY(OSlibkernInit), + KNOWN_ENTRY(bcmp), + KNOWN_ENTRY(copyout), + KNOWN_ENTRY(copyin), + KNOWN_ENTRY(kprintf), + KNOWN_ENTRY(printf), + KNOWN_ENTRY(lck_grp_alloc_init), + KNOWN_ENTRY(lck_mtx_alloc_init), + KNOWN_ENTRY(lck_rw_alloc_init), + KNOWN_ENTRY(lck_spin_alloc_init), + KNOWN_ENTRY(osrelease), + KNOWN_ENTRY(ostype), + KNOWN_ENTRY(panic), + KNOWN_ENTRY(strprefix), + KNOWN_ENTRY(sysctlbyname), + KNOWN_ENTRY(vsscanf), + KNOWN_ENTRY(page_mask), + + /* Mach: */ + KNOWN_ENTRY(absolutetime_to_nanoseconds), + KNOWN_ENTRY(assert_wait), + KNOWN_ENTRY(clock_delay_until), + KNOWN_ENTRY(clock_get_uptime), + KNOWN_ENTRY(current_task), + KNOWN_ENTRY(current_thread), + KNOWN_ENTRY(kernel_task), + KNOWN_ENTRY(lck_mtx_sleep), + KNOWN_ENTRY(lck_rw_sleep), + KNOWN_ENTRY(lck_spin_sleep), + KNOWN_ENTRY(mach_absolute_time), + KNOWN_ENTRY(semaphore_create), + KNOWN_ENTRY(task_reference), + KNOWN_ENTRY(thread_block), + KNOWN_ENTRY(thread_reference), + KNOWN_ENTRY(thread_terminate), + KNOWN_ENTRY(thread_wakeup_prim), + + /* BSDKernel: */ + KNOWN_ENTRY(buf_size), + KNOWN_ENTRY(copystr), + KNOWN_ENTRY(current_proc), + KNOWN_ENTRY(ifnet_hdrlen), + KNOWN_ENTRY(ifnet_set_promiscuous), + KNOWN_ENTRY(kauth_getuid), +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + KNOWN_ENTRY(kauth_cred_unref), +#else + KNOWN_ENTRY(kauth_cred_rele), +#endif + KNOWN_ENTRY(mbuf_data), + KNOWN_ENTRY(msleep), + KNOWN_ENTRY(nanotime), + KNOWN_ENTRY(nop_close), + KNOWN_ENTRY(proc_pid), + KNOWN_ENTRY(sock_accept), + KNOWN_ENTRY(sockopt_name), + //KNOWN_ENTRY(spec_write), + KNOWN_ENTRY(suword), + //KNOWN_ENTRY(sysctl_int), + KNOWN_ENTRY(uio_rw), + KNOWN_ENTRY(vfs_flags), + KNOWN_ENTRY(vfs_name), + KNOWN_ENTRY(vfs_statfs), + KNOWN_ENTRY(VNOP_READ), + KNOWN_ENTRY(uio_create), + KNOWN_ENTRY(uio_addiov), + KNOWN_ENTRY(uio_free), + KNOWN_ENTRY(vnode_get), + KNOWN_ENTRY(vnode_open), + KNOWN_ENTRY(vnode_ref), + KNOWN_ENTRY(vnode_rele), + KNOWN_ENTRY(vnop_close_desc), + KNOWN_ENTRY(wakeup), + KNOWN_ENTRY(wakeup_one), + + /* Unsupported: */ + KNOWN_ENTRY(kdp_set_interface), + KNOWN_ENTRY(pmap_find_phys), + KNOWN_ENTRY(vm_map), + KNOWN_ENTRY(vm_protect), + KNOWN_ENTRY(vm_region), + KNOWN_ENTRY(vm_map_wire), + KNOWN_ENTRY(PE_kputc), + }; + + for (unsigned i = 0; i < RT_ELEMENTS(s_aStandardCandles); i++) + { + uintptr_t uAddr = rtR0MachKernelLookup(pThis, s_aStandardCandles[i].pszName); +#ifdef IN_RING0 + if (uAddr != s_aStandardCandles[i].uAddr) +#else + if (uAddr == 0) +#endif + { + AssertLogRelMsgFailed(("%s (%p != %p)\n", s_aStandardCandles[i].pszName, uAddr, s_aStandardCandles[i].uAddr)); + return VERR_INTERNAL_ERROR_2; + } + } + return VINF_SUCCESS; +} + + +/** + * Loads and validates the symbol and string tables. + * + * @returns IPRT status code. + * @param pThis The internal scratch data. + */ +static int rtR0MachKernelLoadSymTab(RTR0MACHKERNELINT *pThis) +{ + /* + * Load the tables. + */ + pThis->paSyms = (MY_NLIST *)RTMemAllocZ(pThis->cSyms * sizeof(MY_NLIST)); + if (!pThis->paSyms) + return VERR_NO_MEMORY; + + int rc = RTFileReadAt(pThis->hFile, pThis->offArch + pThis->offSyms, + pThis->paSyms, pThis->cSyms * sizeof(MY_NLIST), NULL); + if (RT_FAILURE(rc)) + return rc; + + pThis->pachStrTab = (char *)RTMemAllocZ(pThis->cbStrTab + 1); + if (!pThis->pachStrTab) + return VERR_NO_MEMORY; + + rc = RTFileReadAt(pThis->hFile, pThis->offArch + pThis->offStrTab, + pThis->pachStrTab, pThis->cbStrTab, NULL); + if (RT_FAILURE(rc)) + return rc; + + /* + * The first string table symbol must be a zero length name. + */ + if (pThis->pachStrTab[0] != '\0') + RETURN_VERR_BAD_EXE_FORMAT; + + /* + * Validate the symbol table. + */ + const char *pszPrev = ""; + uint32_t const cSyms = pThis->cSyms; + MY_NLIST const *pSym = pThis->paSyms; + for (uint32_t iSym = 0; iSym < cSyms; iSym++, pSym++) + { + if ((uint32_t)pSym->n_un.n_strx >= pThis->cbStrTab) + RETURN_VERR_BAD_EXE_FORMAT; + const char *pszSym = &pThis->pachStrTab[(uint32_t)pSym->n_un.n_strx]; +#ifdef IN_RING3 + RTAssertMsg2("%05i: %02x:%08x %02x %04x %s\n", iSym, pSym->n_sect, pSym->n_value, pSym->n_type, pSym->n_desc, pszSym); +#endif + + if (strcmp(pszSym, pszPrev) < 0) + RETURN_VERR_BAD_EXE_FORMAT; /* not sorted */ + + if (!(pSym->n_type & MACHO_N_STAB)) + { + switch (pSym->n_type & MACHO_N_TYPE) + { + case MACHO_N_SECT: + if (pSym->n_sect == MACHO_NO_SECT) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSym->n_sect > pThis->cSections) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSym->n_desc & ~(REFERENCED_DYNAMICALLY)) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSym->n_value < pThis->apSections[pSym->n_sect - 1]->addr) + RETURN_VERR_BAD_EXE_FORMAT; + if ( pSym->n_value - pThis->apSections[pSym->n_sect - 1]->addr + > pThis->apSections[pSym->n_sect - 1]->size) + RETURN_VERR_BAD_EXE_FORMAT; + break; + + case MACHO_N_ABS: +#if 0 /* Spec say MACHO_NO_SECT, __mh_execute_header has 1 with 10.7/amd64 */ + if (pSym->n_sect != MACHO_NO_SECT) +#else + if (pSym->n_sect > pThis->cSections) +#endif + RETURN_VERR_BAD_EXE_FORMAT; + if (pSym->n_desc & ~(REFERENCED_DYNAMICALLY)) + RETURN_VERR_BAD_EXE_FORMAT; + break; + + case MACHO_N_UNDF: + /* No undefined or common symbols in the kernel. */ + RETURN_VERR_BAD_EXE_FORMAT; + + case MACHO_N_INDR: + /* No indirect symbols in the kernel. */ + RETURN_VERR_BAD_EXE_FORMAT; + + case MACHO_N_PBUD: + /* No prebound symbols in the kernel. */ + RETURN_VERR_BAD_EXE_FORMAT; + + default: + RETURN_VERR_BAD_EXE_FORMAT; + } + } + /* else: Ignore debug symbols. */ + } + + return VINF_SUCCESS; +} + + +/** + * Loads the load commands and validates them. + * + * @returns IPRT status code. + * @param pThis The internal scratch data. + */ +static int rtR0MachKernelLoadCommands(RTR0MACHKERNELINT *pThis) +{ + pThis->offStrTab = 0; + pThis->cbStrTab = 0; + pThis->offSyms = 0; + pThis->cSyms = 0; + pThis->cSections = 0; + + pThis->pLoadCmds = (load_command_t *)RTMemAlloc(pThis->cbLoadCmds); + if (!pThis->pLoadCmds) + return VERR_NO_MEMORY; + + int rc = RTFileReadAt(pThis->hFile, pThis->offArch + sizeof(MY_MACHO_HEADER), + pThis->pLoadCmds, pThis->cbLoadCmds, NULL); + if (RT_FAILURE(rc)) + return rc; + + /* + * Validate the relevant commands, picking up sections and the symbol + * table location. + */ + load_command_t const *pCmd = pThis->pLoadCmds; + for (uint32_t iCmd = 0; ; iCmd++) + { + /* cmd index & offset. */ + uintptr_t offCmd = (uintptr_t)pCmd - (uintptr_t)pThis->pLoadCmds; + if (offCmd == pThis->cbLoadCmds && iCmd == pThis->cLoadCmds) + break; + if (offCmd + sizeof(*pCmd) > pThis->cbLoadCmds) + RETURN_VERR_BAD_EXE_FORMAT; + if (iCmd >= pThis->cLoadCmds) + RETURN_VERR_BAD_EXE_FORMAT; + + /* cmdsize */ + if (pCmd->cmdsize < sizeof(*pCmd)) + RETURN_VERR_BAD_EXE_FORMAT; + if (pCmd->cmdsize > pThis->cbLoadCmds) + RETURN_VERR_BAD_EXE_FORMAT; + if (RT_ALIGN_32(pCmd->cmdsize, 4) != pCmd->cmdsize) + RETURN_VERR_BAD_EXE_FORMAT; + + /* cmd */ + switch (pCmd->cmd & ~LC_REQ_DYLD) + { + /* Validate and store the symbol table details. */ + case LC_SYMTAB: + { + struct symtab_command const *pSymTab = (struct symtab_command const *)pCmd; + if (pSymTab->cmdsize != sizeof(*pSymTab)) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSymTab->nsyms > _1M) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSymTab->strsize > _2M) + RETURN_VERR_BAD_EXE_FORMAT; + + pThis->offStrTab = pSymTab->stroff; + pThis->cbStrTab = pSymTab->strsize; + pThis->offSyms = pSymTab->symoff; + pThis->cSyms = pSymTab->nsyms; + break; + } + + /* Validate the segment. */ +#if ARCH_BITS == 32 + case LC_SEGMENT_32: +#elif ARCH_BITS == 64 + case LC_SEGMENT_64: +#else +# error ARCH_BITS +#endif + { + MY_SEGMENT_COMMAND const *pSeg = (MY_SEGMENT_COMMAND const *)pCmd; + if (pSeg->cmdsize < sizeof(*pSeg)) + RETURN_VERR_BAD_EXE_FORMAT; + + if (pSeg->segname[0] == '\0') + RETURN_VERR_BAD_EXE_FORMAT; + + if (pSeg->nsects > MACHO_MAX_SECT) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSeg->nsects * sizeof(MY_SECTION) + sizeof(*pSeg) != pSeg->cmdsize) + RETURN_VERR_BAD_EXE_FORMAT; + + if (pSeg->flags & ~(SG_HIGHVM | SG_FVMLIB | SG_NORELOC | SG_PROTECTED_VERSION_1)) + RETURN_VERR_BAD_EXE_FORMAT; + + if (pSeg->vmaddr != 0) + { + if (pSeg->vmaddr + RT_ALIGN_Z(pSeg->vmsize, RT_BIT_32(12)) < pSeg->vmaddr) + RETURN_VERR_BAD_EXE_FORMAT; + } + else if (pSeg->vmsize) + RETURN_VERR_BAD_EXE_FORMAT; + + if (pSeg->maxprot & ~VM_PROT_ALL) + RETURN_VERR_BAD_EXE_FORMAT; + if (pSeg->initprot & ~VM_PROT_ALL) + RETURN_VERR_BAD_EXE_FORMAT; + + /* Validate the sections. */ + uint32_t uAlignment = 0; + uintptr_t uAddr = pSeg->vmaddr; + MY_SECTION const *paSects = (MY_SECTION const *)(pSeg + 1); + for (uint32_t i = 0; i < pSeg->nsects; i++) + { + if (paSects[i].sectname[0] == '\0') + RETURN_VERR_BAD_EXE_FORMAT; + if (memcmp(paSects[i].segname, pSeg->segname, sizeof(pSeg->segname))) + RETURN_VERR_BAD_EXE_FORMAT; + + switch (paSects[i].flags & SECTION_TYPE) + { + case S_REGULAR: + case S_CSTRING_LITERALS: + case S_NON_LAZY_SYMBOL_POINTERS: + case S_MOD_INIT_FUNC_POINTERS: + case S_MOD_TERM_FUNC_POINTERS: + case S_COALESCED: + if ( pSeg->filesize != 0 + ? paSects[i].offset - pSeg->fileoff >= pSeg->filesize + : paSects[i].offset - pSeg->fileoff != pSeg->filesize) + RETURN_VERR_BAD_EXE_FORMAT; + if ( paSects[i].addr != 0 + && paSects[i].offset - pSeg->fileoff != paSects[i].addr - pSeg->vmaddr) + RETURN_VERR_BAD_EXE_FORMAT; + break; + + case S_ZEROFILL: + if (paSects[i].offset != 0) + RETURN_VERR_BAD_EXE_FORMAT; + break; + + /* not observed */ + case S_SYMBOL_STUBS: + case S_INTERPOSING: + case S_4BYTE_LITERALS: + case S_8BYTE_LITERALS: + case S_16BYTE_LITERALS: + case S_DTRACE_DOF: + case S_LAZY_SYMBOL_POINTERS: + case S_LAZY_DYLIB_SYMBOL_POINTERS: + RETURN_VERR_LDR_UNEXPECTED; + case S_GB_ZEROFILL: + RETURN_VERR_LDR_UNEXPECTED; + default: + RETURN_VERR_BAD_EXE_FORMAT; + } + + if (paSects[i].align > 12) + RETURN_VERR_BAD_EXE_FORMAT; + if (paSects[i].align > uAlignment) + uAlignment = paSects[i].align; + + /* Add to the section table. */ + if (pThis->cSections == MACHO_MAX_SECT) + RETURN_VERR_BAD_EXE_FORMAT; + pThis->apSections[pThis->cSections++] = &paSects[i]; + } + + if (RT_ALIGN_Z(pSeg->vmaddr, RT_BIT_32(uAlignment)) != pSeg->vmaddr) + RETURN_VERR_BAD_EXE_FORMAT; + if ( pSeg->filesize > RT_ALIGN_Z(pSeg->vmsize, RT_BIT_32(uAlignment)) + && pSeg->vmsize != 0) + RETURN_VERR_BAD_EXE_FORMAT; + break; + } + + case LC_UUID: + if (pCmd->cmdsize != sizeof(uuid_command)) + RETURN_VERR_BAD_EXE_FORMAT; + break; + + case LC_DYSYMTAB: + case LC_UNIXTHREAD: + break; + + /* not observed */ + case LC_SYMSEG: +#if ARCH_BITS == 32 + case LC_SEGMENT_64: +#elif ARCH_BITS == 64 + case LC_SEGMENT_32: +#endif + case LC_ROUTINES_64: + case LC_ROUTINES: + case LC_THREAD: + case LC_LOADFVMLIB: + case LC_IDFVMLIB: + case LC_IDENT: + case LC_FVMFILE: + case LC_PREPAGE: + case LC_TWOLEVEL_HINTS: + case LC_PREBIND_CKSUM: + RETURN_VERR_LDR_UNEXPECTED; + + /* dylib */ + case LC_LOAD_DYLIB: + case LC_ID_DYLIB: + case LC_LOAD_DYLINKER: + case LC_ID_DYLINKER: + case LC_PREBOUND_DYLIB: + case LC_LOAD_WEAK_DYLIB & ~LC_REQ_DYLD: + case LC_SUB_FRAMEWORK: + case LC_SUB_UMBRELLA: + case LC_SUB_CLIENT: + case LC_SUB_LIBRARY: + RETURN_VERR_LDR_UNEXPECTED; + + default: + RETURN_VERR_BAD_EXE_FORMAT; + } + + /* next */ + pCmd = (load_command_t *)((uintptr_t)pCmd + pCmd->cmdsize); + } + + return VINF_SUCCESS; +} + + +/** + * Loads the FAT and MACHO headers, noting down the relevant info. + * + * @returns IPRT status code. + * @param pThis The internal scratch data. + */ +static int rtR0MachKernelLoadFileHeaders(RTR0MACHKERNELINT *pThis) +{ + uint32_t i; + + pThis->offArch = 0; + pThis->cbArch = 0; + + /* + * Read the first bit of the file, parse the FAT if found there. + */ + int rc = RTFileReadAt(pThis->hFile, 0, pThis->abBuf, sizeof(fat_header_t) + sizeof(fat_arch_t) * 16, NULL); + if (RT_FAILURE(rc)) + return rc; + + fat_header_t *pFat = (fat_header *)pThis->abBuf; + fat_arch_t *paFatArches = (fat_arch_t *)(pFat + 1); + + /* Correct FAT endian first. */ + if (pFat->magic == IMAGE_FAT_SIGNATURE_OE) + { + pFat->magic = RT_BSWAP_U32(pFat->magic); + pFat->nfat_arch = RT_BSWAP_U32(pFat->nfat_arch); + i = RT_MIN(pFat->nfat_arch, 16); + while (i-- > 0) + { + paFatArches[i].cputype = RT_BSWAP_U32(paFatArches[i].cputype); + paFatArches[i].cpusubtype = RT_BSWAP_U32(paFatArches[i].cpusubtype); + paFatArches[i].offset = RT_BSWAP_U32(paFatArches[i].offset); + paFatArches[i].size = RT_BSWAP_U32(paFatArches[i].size); + paFatArches[i].align = RT_BSWAP_U32(paFatArches[i].align); + } + } + + /* Lookup our architecture in the FAT. */ + if (pFat->magic == IMAGE_FAT_SIGNATURE) + { + if (pFat->nfat_arch > 16) + RETURN_VERR_BAD_EXE_FORMAT; + + for (i = 0; i < pFat->nfat_arch; i++) + { + if ( paFatArches[i].cputype == MY_CPU_TYPE + && paFatArches[i].cpusubtype == MY_CPU_SUBTYPE_ALL) + { + pThis->offArch = paFatArches[i].offset; + pThis->cbArch = paFatArches[i].size; + if (!pThis->cbArch) + RETURN_VERR_BAD_EXE_FORMAT; + if (pThis->offArch < sizeof(fat_header_t) + sizeof(fat_arch_t) * pFat->nfat_arch) + RETURN_VERR_BAD_EXE_FORMAT; + if (pThis->offArch + pThis->cbArch <= pThis->offArch) + RETURN_VERR_LDR_ARCH_MISMATCH; + break; + } + } + if (i >= pFat->nfat_arch) + RETURN_VERR_LDR_ARCH_MISMATCH; + } + + /* + * Read the Mach-O header and validate it. + */ + rc = RTFileReadAt(pThis->hFile, pThis->offArch, pThis->abBuf, sizeof(MY_MACHO_HEADER), NULL); + if (RT_FAILURE(rc)) + return rc; + MY_MACHO_HEADER const *pHdr = (MY_MACHO_HEADER const *)pThis->abBuf; + if (pHdr->magic != MY_MACHO_MAGIC) + { + if ( pHdr->magic == IMAGE_MACHO32_SIGNATURE + || pHdr->magic == IMAGE_MACHO32_SIGNATURE_OE + || pHdr->magic == IMAGE_MACHO64_SIGNATURE + || pHdr->magic == IMAGE_MACHO64_SIGNATURE_OE) + RETURN_VERR_LDR_ARCH_MISMATCH; + RETURN_VERR_BAD_EXE_FORMAT; + } + + if (pHdr->cputype != MY_CPU_TYPE) + RETURN_VERR_LDR_ARCH_MISMATCH; + if (pHdr->cpusubtype != MY_CPU_SUBTYPE_ALL) + RETURN_VERR_LDR_ARCH_MISMATCH; + if (pHdr->filetype != MH_EXECUTE) + RETURN_VERR_LDR_UNEXPECTED; + if (pHdr->ncmds < 4) + RETURN_VERR_LDR_UNEXPECTED; + if (pHdr->ncmds > 256) + RETURN_VERR_LDR_UNEXPECTED; + if (pHdr->sizeofcmds <= pHdr->ncmds * sizeof(load_command_t)) + RETURN_VERR_LDR_UNEXPECTED; + if (pHdr->sizeofcmds >= _1M) + RETURN_VERR_LDR_UNEXPECTED; + if (pHdr->flags & ~MH_VALID_FLAGS) + RETURN_VERR_LDR_UNEXPECTED; + + pThis->cLoadCmds = pHdr->ncmds; + pThis->cbLoadCmds = pHdr->sizeofcmds; + return VINF_SUCCESS; +} + + +RTDECL(int) RTR0MachKernelOpen(const char *pszMachKernel, PRTR0MACHKERNEL phKernel) +{ + *phKernel = NIL_RTR0MACHKERNEL; + + RTR0MACHKERNELINT *pThis = (RTR0MACHKERNELINT *)RTMemAllocZ(sizeof(*pThis)); + if (!pThis) + return VERR_NO_MEMORY; + pThis->hFile = NIL_RTFILE; + + int rc = RTFileOpen(&pThis->hFile, pszMachKernel, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); + if (RT_SUCCESS(rc)) + rc = rtR0MachKernelLoadFileHeaders(pThis); + if (RT_SUCCESS(rc)) + rc = rtR0MachKernelLoadCommands(pThis); + if (RT_SUCCESS(rc)) + rc = rtR0MachKernelLoadSymTab(pThis); + if (RT_SUCCESS(rc)) + rc = rtR0MachKernelCheckStandardSymbols(pThis); + + rtR0MachKernelLoadDone(pThis); + if (RT_SUCCESS(rc)) + *phKernel = pThis; + else + RTR0MachKernelClose(pThis); + return rc; +} + + +RTR0DECL(int) RTR0MachKernelGetSymbol(RTR0MACHKERNEL hKernel, const char *pszSymbol, void **ppvValue) +{ + RTR0MACHKERNELINT *pThis = hKernel; + AssertPtrReturn(pThis, VERR_INVALID_HANDLE); + + uintptr_t uValue = rtR0MachKernelLookup(pThis, pszSymbol); + if (ppvValue) + *ppvValue = (void *)uValue; + if (!uValue) + return VERR_SYMBOL_NOT_FOUND; + return VINF_SUCCESS; +} + + +RTR0DECL(int) RTR0MachKernelClose(RTR0MACHKERNEL hKernel) +{ + if (hKernel == NIL_RTR0MACHKERNEL) + return VINF_SUCCESS; + + RTR0MACHKERNELINT *pThis = hKernel; + AssertPtrReturn(pThis, VERR_INVALID_HANDLE); + + RTMemFree(pThis->pachStrTab); + pThis->pachStrTab = NULL; + + RTMemFree(pThis->paSyms); + pThis->paSyms = NULL; + + RTMemFree(pThis); + return VINF_SUCCESS; +} + diff --git a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp index 8ba0dd710..f5a731661 100644 --- a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp @@ -264,7 +264,9 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) { RT_ASSERT_INTS_ON(); - /* no unicast IPI */ - return VERR_NOT_SUPPORTED; + if (g_pfnR0DarwinCpuInterrupt == NULL) + return VERR_NOT_SUPPORTED; + g_pfnR0DarwinCpuInterrupt(idCpu); + return VINF_SUCCESS; } diff --git a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h index 9d6a9efe2..254b1468f 100644 --- a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h +++ b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * 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; @@ -67,6 +67,8 @@ #include <sys/ioccom.h> #include <sys/malloc.h> #include <sys/proc.h> +#include <sys/vnode.h> +#include <sys/fcntl.h> #include <IOKit/IOTypes.h> #include <IOKit/IOLib.h> #include <IOKit/IOMemoryDescriptor.h> @@ -149,11 +151,19 @@ RT_C_DECLS_END /* * Internals of the Darwin Ring-0 IPRT. */ - RT_C_DECLS_BEGIN -extern lck_grp_t *g_pDarwinLockGroup; + +/* initterm-r0drv-darwin.cpp. */ +typedef uint32_t * (*PFNR0DARWINASTPENDING)(void); +typedef void (*PFNR0DARWINCPUINTERRUPT)(int); +extern lck_grp_t *g_pDarwinLockGroup; +extern PFNR0DARWINASTPENDING g_pfnR0DarwinAstPending; +extern PFNR0DARWINCPUINTERRUPT g_pfnR0DarwinCpuInterrupt; + +/* threadpreempt-r0drv-darwin.cpp */ int rtThreadPreemptDarwinInit(void); void rtThreadPreemptDarwinTerm(void); + RT_C_DECLS_END diff --git a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp index 60d125584..23b28a100 100644 --- a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp @@ -104,26 +104,20 @@ RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread) RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread) { - Assert(hThread == NIL_RTTHREAD); + if (!g_pfnR0DarwinAstPending) + return false; + uint32_t volatile *pfAstPending = g_pfnR0DarwinAstPending(); AssertPtr(pfAstPending); + uint32_t const fAstPending = *pfAstPending; - /* HACK ALERT! This ASSUMES that the cpu_pending_ast member of cpu_data_t doesn't move. */ - uint32_t ast_pending; -#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) - __asm__ volatile("movl %%gs:%P1,%0\n\t" - : "=r" (ast_pending) - : "i" (__builtin_offsetof(struct my_cpu_data_x86, cpu_pending_ast)) ); -#else -# error "Port me" -#endif - AssertMsg(!(ast_pending & UINT32_C(0xfffff000)),("%#x\n", ast_pending)); - return (ast_pending & (AST_PREEMPT | AST_URGENT)) != 0; + AssertMsg(!(fAstPending & UINT32_C(0xfffff000)), ("%#x\n", fAstPending)); + return (fAstPending & (AST_PREEMPT | AST_URGENT)) != 0; } RTDECL(bool) RTThreadPreemptIsPendingTrusty(void) { /* yes, we think that RTThreadPreemptIsPending is reliable... */ - return true; + return g_pfnR0DarwinAstPending != NULL; } diff --git a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h index 10a39b601..89e12087b 100644 --- a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h +++ b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h @@ -313,7 +313,9 @@ DECLINLINE(void) rtR0SemBsdBroadcast(void *pvWaitChan) { sleepq_lock(pvWaitChan); sleepq_broadcast(pvWaitChan, SLEEPQ_CONDVAR, 0, 0); +#if __FreeBSD_version >= 800000 /* Broadcast releases the sleep queue lock on FreeBSD 7.x */ sleepq_release(pvWaitChan); +#endif } /** diff --git a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp index b79693b2e..6690baf58 100644 --- a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp +++ b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp @@ -105,9 +105,10 @@ static int rtCheckCredentials(const char *pszUser, const char *pszPasswd, gid_t /* be reentrant */ struct crypt_data *data = (struct crypt_data*)RTMemTmpAllocZ(sizeof(*data)); char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, data); - if (strcmp(pszEncPasswd, pw->pw_passwd)) - return VERR_PERMISSION_DENIED; + int fCorrect = !strcmp(pszEncPasswd, pw->pw_passwd); RTMemTmpFree(data); + if (!fCorrect) + return VERR_PERMISSION_DENIED; *gid = pw->pw_gid; *uid = pw->pw_uid; @@ -264,7 +265,7 @@ RTR3DECL(int) RTProcCreateEx(const char *pszExec, const char * const *papszArg */ AssertPtrReturn(pszExec, VERR_INVALID_POINTER); AssertReturn(*pszExec, VERR_INVALID_PARAMETER); - AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SERVICE)), VERR_INVALID_PARAMETER); + AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SERVICE | RTPROC_FLAGS_SAME_CONTRACT | RTPROC_FLAGS_NO_PROFILE)), VERR_INVALID_PARAMETER); AssertReturn(!(fFlags & RTPROC_FLAGS_DETACHED) || !phProcess, VERR_INVALID_PARAMETER); AssertReturn(hEnv != NIL_RTENV, VERR_INVALID_PARAMETER); const char * const *papszEnv = RTEnvGetExecEnvP(hEnv); diff --git a/src/VBox/Runtime/r3/win/process-win.cpp b/src/VBox/Runtime/r3/win/process-win.cpp index 5a4c7ea18..f616baf9f 100644 --- a/src/VBox/Runtime/r3/win/process-win.cpp +++ b/src/VBox/Runtime/r3/win/process-win.cpp @@ -203,7 +203,7 @@ static HANDLE rtProcWinFindPid(RTPROCESS pid) /** - * Removes a process from g_paProcesses. + * Removes a process from g_paProcesses and closes the process handle. * * @param pid The process to remove (pid). */ @@ -214,11 +214,16 @@ static void rtProcWinRemovePid(RTPROCESS pid) while (i-- > 0) if (g_paProcesses[i].pid == pid) { + HANDLE hProcess = g_paProcesses[i].hProcess; + g_cProcesses--; uint32_t cToMove = g_cProcesses - i; if (cToMove) memmove(&g_paProcesses[i], &g_paProcesses[i + 1], cToMove * sizeof(g_paProcesses[0])); - break; + + RTCritSectLeave(&g_CritSect); + CloseHandle(hProcess); + return; } RTCritSectLeave(&g_CritSect); } @@ -861,70 +866,83 @@ static int rtProcCreateAsUserHlp(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUT /* Nothing to do here right now. */ } - /* - * If we didn't find a matching VBoxTray, just use the token we got - * above from LogonUserW(). This enables us to at least run processes with - * desktop interaction without UI. - */ - phToken = fFound ? &hTokenUserDesktop : &hTokenLogon; + /** @todo Hmm, this function already is too big! We need to split + * it up into several small parts. */ - RTLDRMOD hUserenv; - int rc = RTLdrLoad("Userenv.dll", &hUserenv); - if (RT_SUCCESS(rc)) + /* If we got an error due to account lookup/loading above, don't + * continue here. */ + if (dwErr == NO_ERROR) { - PFNLOADUSERPROFILEW pfnLoadUserProfileW; - rc = RTLdrGetSymbol(hUserenv, "LoadUserProfileW", (void**)&pfnLoadUserProfileW); + /* + * If we didn't find a matching VBoxTray, just use the token we got + * above from LogonUserW(). This enables us to at least run processes with + * desktop interaction without UI. + */ + phToken = fFound ? &hTokenUserDesktop : &hTokenLogon; + RTLDRMOD hUserenv; + int rc = RTLdrLoad("Userenv.dll", &hUserenv); if (RT_SUCCESS(rc)) { - PFNUNLOADUSERPROFILE pfnUnloadUserProfile; - rc = RTLdrGetSymbol(hUserenv, "UnloadUserProfile", (void**)&pfnUnloadUserProfile); + PFNLOADUSERPROFILEW pfnLoadUserProfileW; + rc = RTLdrGetSymbol(hUserenv, "LoadUserProfileW", (void**)&pfnLoadUserProfileW); if (RT_SUCCESS(rc)) { - PROFILEINFOW profileInfo; - ZeroMemory(&profileInfo, sizeof(profileInfo)); - profileInfo.dwSize = sizeof(profileInfo); - profileInfo.lpUserName = pwszUser; - profileInfo.dwFlags = PI_NOUI; /* Prevents the display of profile error messages. */ - - if (pfnLoadUserProfileW(*phToken, &profileInfo)) + PFNUNLOADUSERPROFILE pfnUnloadUserProfile; + rc = RTLdrGetSymbol(hUserenv, "UnloadUserProfile", (void**)&pfnUnloadUserProfile); + if (RT_SUCCESS(rc)) { - PRTUTF16 pwszzBlock; - rc = rtProcEnvironmentCreateFromToken(*phToken, hEnv, &pwszzBlock); - if (RT_SUCCESS(rc)) + PROFILEINFOW profileInfo; + if (!(fFlags & RTPROC_FLAGS_NO_PROFILE)) + { + ZeroMemory(&profileInfo, sizeof(profileInfo)); + profileInfo.dwSize = sizeof(profileInfo); + profileInfo.lpUserName = pwszUser; + profileInfo.dwFlags = PI_NOUI; /* Prevents the display of profile error messages. */ + + if (!pfnLoadUserProfileW(*phToken, &profileInfo)) + dwErr = GetLastError(); + } + + if (dwErr == NO_ERROR) { - /* - * Useful KB articles: - * http://support.microsoft.com/kb/165194/ - * http://support.microsoft.com/kb/184802/ - * http://support.microsoft.com/kb/327618/ - */ - fRc = CreateProcessAsUserW(*phToken, - pwszExec, - pwszCmdLine, - NULL, /* pProcessAttributes */ - NULL, /* pThreadAttributes */ - TRUE, /* fInheritHandles */ - dwCreationFlags, - pwszzBlock, - NULL, /* pCurrentDirectory */ - pStartupInfo, - pProcInfo); - if (fRc) - dwErr = NO_ERROR; + PRTUTF16 pwszzBlock; + rc = rtProcEnvironmentCreateFromToken(*phToken, hEnv, &pwszzBlock); + if (RT_SUCCESS(rc)) + { + /* + * Useful KB articles: + * http://support.microsoft.com/kb/165194/ + * http://support.microsoft.com/kb/184802/ + * http://support.microsoft.com/kb/327618/ + */ + fRc = CreateProcessAsUserW(*phToken, + pwszExec, + pwszCmdLine, + NULL, /* pProcessAttributes */ + NULL, /* pThreadAttributes */ + TRUE, /* fInheritHandles */ + dwCreationFlags, + pwszzBlock, + NULL, /* pCurrentDirectory */ + pStartupInfo, + pProcInfo); + if (fRc) + dwErr = NO_ERROR; + else + dwErr = GetLastError(); /* CreateProcessAsUserW() failed. */ + rtProcEnvironmentDestroy(pwszzBlock); + } else - dwErr = GetLastError(); /* CreateProcessAsUserW() failed. */ - rtProcEnvironmentDestroy(pwszzBlock); + dwErr = rc; + + if (!(fFlags & RTPROC_FLAGS_NO_PROFILE)) + pfnUnloadUserProfile(*phToken, profileInfo.hProfile); } - else - dwErr = rc; - pfnUnloadUserProfile(*phToken, profileInfo.hProfile); } - else - dwErr = GetLastError(); /* LoadUserProfileW() failed. */ } - } - RTLdrClose(hUserenv); - } + RTLdrClose(hUserenv); + } /* Userenv.dll found/loaded? */ + } /* Account lookup succeeded? */ if (hTokenUserDesktop != INVALID_HANDLE_VALUE) CloseHandle(hTokenUserDesktop); rtProcUserLogoff(hTokenLogon); @@ -948,7 +966,7 @@ RTR3DECL(int) RTProcCreateEx(const char *pszExec, const char * const *papszArg */ AssertPtrReturn(pszExec, VERR_INVALID_POINTER); AssertReturn(*pszExec, VERR_INVALID_PARAMETER); - AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN |RTPROC_FLAGS_SERVICE)), VERR_INVALID_PARAMETER); + AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SERVICE | RTPROC_FLAGS_SAME_CONTRACT | RTPROC_FLAGS_NO_PROFILE)), VERR_INVALID_PARAMETER); AssertReturn(!(fFlags & RTPROC_FLAGS_DETACHED) || !phProcess, VERR_INVALID_PARAMETER); AssertReturn(hEnv != NIL_RTENV, VERR_INVALID_PARAMETER); AssertPtrReturn(papszArgs, VERR_INVALID_PARAMETER); @@ -1168,63 +1186,80 @@ RTR3DECL(int) RTProcWait(RTPROCESS Process, unsigned fFlags, PRTPROCSTATUS pProc * Try find the process among the ones we've spawned, otherwise, attempt * opening the specified process. */ + HANDLE hOpenedProc = NULL; HANDLE hProcess = rtProcWinFindPid(Process); if (hProcess == NULL) - hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, Process); - if (hProcess != NULL) + { + hProcess = hOpenedProc = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, Process); + if (hProcess == NULL) + { + DWORD dwErr = GetLastError(); + if (dwErr == ERROR_INVALID_PARAMETER) + return VERR_PROCESS_NOT_FOUND; + return RTErrConvertFromWin32(dwErr); + } + } + + /* + * Wait for it to terminate. + */ + DWORD Millies = fFlags == RTPROCWAIT_FLAGS_BLOCK ? INFINITE : 0; + DWORD WaitRc = WaitForSingleObjectEx(hProcess, Millies, TRUE); + while (WaitRc == WAIT_IO_COMPLETION) + WaitRc = WaitForSingleObjectEx(hProcess, Millies, TRUE); + switch (WaitRc) { /* - * Wait for it to terminate. + * It has terminated. */ - DWORD Millies = fFlags == RTPROCWAIT_FLAGS_BLOCK ? INFINITE : 0; - DWORD WaitRc = WaitForSingleObjectEx(hProcess, Millies, TRUE); - while (WaitRc == WAIT_IO_COMPLETION) - WaitRc = WaitForSingleObjectEx(hProcess, Millies, TRUE); - switch (WaitRc) + case WAIT_OBJECT_0: { - /* - * It has terminated. - */ - case WAIT_OBJECT_0: + DWORD dwExitCode; + if (GetExitCodeProcess(hProcess, &dwExitCode)) { - DWORD dwExitCode; - if (GetExitCodeProcess(hProcess, &dwExitCode)) + /** @todo the exit code can be special statuses. */ + if (pProcStatus) { - /** @todo the exit code can be special statuses. */ - if (pProcStatus) - { - pProcStatus->enmReason = RTPROCEXITREASON_NORMAL; - pProcStatus->iStatus = (int)dwExitCode; - } - rtProcWinRemovePid(Process); - return VINF_SUCCESS; + pProcStatus->enmReason = RTPROCEXITREASON_NORMAL; + pProcStatus->iStatus = (int)dwExitCode; } - break; + if (hOpenedProc == NULL) + rtProcWinRemovePid(Process); + rc = VINF_SUCCESS; } + else + rc = RTErrConvertFromWin32(GetLastError()); + break; + } - /* - * It hasn't terminated just yet. - */ - case WAIT_TIMEOUT: - return VERR_PROCESS_RUNNING; + /* + * It hasn't terminated just yet. + */ + case WAIT_TIMEOUT: + rc = VERR_PROCESS_RUNNING; + break; - /* - * Something went wrong... - */ - case WAIT_FAILED: - break; - case WAIT_ABANDONED: - AssertFailed(); - return VERR_GENERAL_FAILURE; - default: - AssertMsgFailed(("WaitRc=%RU32\n", WaitRc)); - return VERR_GENERAL_FAILURE; - } + /* + * Something went wrong... + */ + case WAIT_FAILED: + rc = RTErrConvertFromWin32(GetLastError()); + break; + + case WAIT_ABANDONED: + AssertFailed(); + rc = VERR_GENERAL_FAILURE; + break; + + default: + AssertMsgFailed(("WaitRc=%RU32\n", WaitRc)); + rc = VERR_GENERAL_FAILURE; + break; } - DWORD dwErr = GetLastError(); - if (dwErr == ERROR_INVALID_PARAMETER) - return VERR_PROCESS_NOT_FOUND; - return RTErrConvertFromWin32(dwErr); + + if (hOpenedProc != NULL) + CloseHandle(hOpenedProc); + return rc; } diff --git a/src/VBox/Runtime/r3/win/thread-win.cpp b/src/VBox/Runtime/r3/win/thread-win.cpp index 58bcbbe53..1d9c00163 100644 --- a/src/VBox/Runtime/r3/win/thread-win.cpp +++ b/src/VBox/Runtime/r3/win/thread-win.cpp @@ -84,6 +84,12 @@ void rtThreadNativeDestroy(PRTTHREADINT pThread) { if (pThread == (PRTTHREADINT)TlsGetValue(g_dwSelfTLS)) TlsSetValue(g_dwSelfTLS, NULL); + + if ((HANDLE)pThread->hThread != INVALID_HANDLE_VALUE) + { + CloseHandle((HANDLE)pThread->hThread); + pThread->hThread = (uintptr_t)INVALID_HANDLE_VALUE; + } } diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk index 76249a448..1aabc736f 100644 --- a/src/VBox/Runtime/testcase/Makefile.kmk +++ b/src/VBox/Runtime/testcase/Makefile.kmk @@ -138,7 +138,8 @@ PROGRAMS.solaris += \ PROGRAMS.l4 += \ tstIoCtl PROGRAMS.darwin += \ - tstDarwinSched + tstDarwinSched \ + tstRTDarwinMachKernel ifdef VBOX_WITH_LIBCURL PROGRAMS += \ tstRTS3 @@ -564,6 +565,12 @@ tstR0ThreadPreemptionDriver_SOURCES = tstR0ThreadPreemptionDriver.cpp tstDarwinSched_SOURCES = tstDarwinSched.cpp +tstRTDarwinMachKernel_TEMPLATE = VBOXR3TSTEXE +tstRTDarwinMachKernel_INCS = ../include +tstRTDarwinMachKernel_SOURCES = \ + tstRTDarwinMachKernel.cpp \ + ../r0drv/darwin/mach_kernel-r0drv-darwin.cpp + ntGetTimerResolution_SOURCES = ntGetTimerResolution.cpp ntGetTimerResolution_SDKS.win = WINPSDK W2K3DDK VBOX_NTDLL diff --git a/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp b/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp new file mode 100644 index 000000000..789578023 --- /dev/null +++ b/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp @@ -0,0 +1,77 @@ +/* $Id: tstRTDarwinMachKernel.cpp $ */ +/** @file + * IPRT Testcase - mach_kernel symbol resolving hack. + */ + +/* + * Copyright (C) 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. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + */ + + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <iprt/darwin/machkernel.h> +#include <iprt/err.h> +#include <iprt/string.h> +#include <iprt/test.h> + + + +static void dotest(const char *pszMachKernel) +{ + RTR0MACHKERNEL hKernel; + RTTESTI_CHECK_RC_RETV(RTR0MachKernelOpen(pszMachKernel, &hKernel), VINF_SUCCESS); + static const char * const s_apszSyms[] = + { + "ast_pending", + "cpu_interrupt", + "dtrace_register", + "dtrace_suspend", + }; + for (unsigned i = 0; i < RT_ELEMENTS(s_apszSyms); i++) + { + void *pvValue = NULL; + int rc = RTR0MachKernelGetSymbol(hKernel, s_apszSyms[i], &pvValue); + RTTestIPrintf(RTTESTLVL_ALWAYS, "%Rrc %p %s\n", rc, pvValue, s_apszSyms[i]); + RTTESTI_CHECK_RC(rc, VINF_SUCCESS); + if (RT_SUCCESS(rc)) + RTTESTI_CHECK_RC(RTR0MachKernelGetSymbol(hKernel, s_apszSyms[i], NULL), VINF_SUCCESS); + } + + RTTESTI_CHECK_RC(RTR0MachKernelGetSymbol(hKernel, "no_such_symbol_name_really", NULL), VERR_SYMBOL_NOT_FOUND); + RTTESTI_CHECK_RC(RTR0MachKernelClose(hKernel), VINF_SUCCESS); + RTTESTI_CHECK_RC(RTR0MachKernelClose(NIL_RTR0MACHKERNEL), VINF_SUCCESS); +} + + +int main(int argc, char **argv) +{ + RTTEST hTest; + RTEXITCODE rcExit = RTTestInitAndCreate("tstRTMachKernel", &hTest); + if (rcExit != RTEXITCODE_SUCCESS) + return rcExit; + RTTestBanner(hTest); + + dotest("/mach_kernel"); + + return RTTestSummaryAndDestroy(hTest); +} + diff --git a/src/VBox/Storage/VD.cpp b/src/VBox/Storage/VD.cpp index 2bf68d0c5..a4f95a10d 100644 --- a/src/VBox/Storage/VD.cpp +++ b/src/VBox/Storage/VD.cpp @@ -2618,12 +2618,14 @@ static int vdIoCtxContinue(PVDIOCTX pIoCtx, int rcReq) if ( rc == VINF_VD_ASYNC_IO_FINISHED && ASMAtomicCmpXchgBool(&pIoCtxParent->fComplete, true, false)) { + RTCritSectLeave(&pDisk->CritSect); LogFlowFunc(("Parent I/O context completed pIoCtxParent=%#p rcReq=%Rrc\n", pIoCtxParent, pIoCtxParent->rcReq)); pIoCtxParent->Type.Root.pfnComplete(pIoCtxParent->Type.Root.pvUser1, pIoCtxParent->Type.Root.pvUser2, pIoCtxParent->rcReq); vdThreadFinishWrite(pDisk); vdIoCtxFree(pDisk, pIoCtxParent); + RTCritSectEnter(&pDisk->CritSect); } /* Process any pending writes if the current request didn't caused another growing. */ @@ -2664,12 +2666,14 @@ static int vdIoCtxContinue(PVDIOCTX pIoCtx, int rcReq) if ( rc == VINF_VD_ASYNC_IO_FINISHED && ASMAtomicCmpXchgBool(&pIoCtxWait->fComplete, true, false)) { + RTCritSectLeave(&pDisk->CritSect); LogFlowFunc(("Waiting I/O context completed pIoCtxWait=%#p\n", pIoCtxWait)); vdThreadFinishWrite(pDisk); pIoCtxWait->Type.Root.pfnComplete(pIoCtxWait->Type.Root.pvUser1, pIoCtxWait->Type.Root.pvUser2, pIoCtxWait->rcReq); vdIoCtxFree(pDisk, pIoCtxWait); + RTCritSectEnter(&pDisk->CritSect); } } while (!RTListIsEmpty(&ListTmp)); } @@ -2692,9 +2696,11 @@ static int vdIoCtxContinue(PVDIOCTX pIoCtx, int rcReq) } LogFlowFunc(("I/O context completed pIoCtx=%#p rcReq=%Rrc\n", pIoCtx, pIoCtx->rcReq)); + RTCritSectLeave(&pDisk->CritSect); pIoCtx->Type.Root.pfnComplete(pIoCtx->Type.Root.pvUser1, pIoCtx->Type.Root.pvUser2, pIoCtx->rcReq); + RTCritSectEnter(&pDisk->CritSect); } vdIoCtxFree(pDisk, pIoCtx); @@ -2718,22 +2724,21 @@ static int vdUserXferCompleted(PVDIOSTORAGE pIoStorage, PVDIOCTX pIoCtx, LogFlowFunc(("pIoStorage=%#p pIoCtx=%#p pfnComplete=%#p pvUser=%#p cbTransfer=%zu rcReq=%Rrc\n", pIoStorage, pIoCtx, pfnComplete, pvUser, cbTransfer, rcReq)); + RTCritSectEnter(&pDisk->CritSect); Assert(pIoCtx->cbTransferLeft >= cbTransfer); ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbTransfer); ASMAtomicDecU32(&pIoCtx->cDataTransfersPending); if (pfnComplete) - { - RTCritSectEnter(&pDisk->CritSect); rc = pfnComplete(pIoStorage->pVDIo->pBackendData, pIoCtx, pvUser, rcReq); - RTCritSectLeave(&pDisk->CritSect); - } if (RT_SUCCESS(rc)) rc = vdIoCtxContinue(pIoCtx, rcReq); else if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) rc = VINF_SUCCESS; + RTCritSectLeave(&pDisk->CritSect); + return rc; } @@ -2774,7 +2779,6 @@ static int vdMetaXferCompleted(PVDIOSTORAGE pIoStorage, PFNVDXFERCOMPLETED pfnCo } else RTListMove(&ListIoCtxWaiting, &pMetaXfer->ListIoCtxWaiting); - RTCritSectLeave(&pDisk->CritSect); /* Go through the waiting list and continue the I/O contexts. */ while (!RTListIsEmpty(&ListIoCtxWaiting)) @@ -2789,11 +2793,7 @@ static int vdMetaXferCompleted(PVDIOSTORAGE pIoStorage, PFNVDXFERCOMPLETED pfnCo ASMAtomicDecU32(&pIoCtx->cMetaTransfersPending); if (pfnComplete) - { - RTCritSectEnter(&pDisk->CritSect); rc = pfnComplete(pIoStorage->pVDIo->pBackendData, pIoCtx, pvUser, rcReq); - RTCritSectLeave(&pDisk->CritSect); - } LogFlow(("Completion callback for I/O context %#p returned %Rrc\n", pIoCtx, rc)); @@ -2809,7 +2809,6 @@ static int vdMetaXferCompleted(PVDIOSTORAGE pIoStorage, PFNVDXFERCOMPLETED pfnCo /* Remove if not used anymore. */ if (RT_SUCCESS(rcReq) && !fFlush) { - RTCritSectEnter(&pDisk->CritSect); pMetaXfer->cRefs--; if (!pMetaXfer->cRefs && RTListIsEmpty(&pMetaXfer->ListIoCtxWaiting)) { @@ -2819,11 +2818,12 @@ static int vdMetaXferCompleted(PVDIOSTORAGE pIoStorage, PFNVDXFERCOMPLETED pfnCo Assert(fRemoved); RTMemFree(pMetaXfer); } - RTCritSectLeave(&pDisk->CritSect); } else if (fFlush) RTMemFree(pMetaXfer); + RTCritSectLeave(&pDisk->CritSect); + return VINF_SUCCESS; } @@ -3498,10 +3498,10 @@ static void vdIOIntIoCtxCompleted(void *pvUser, PVDIOCTX pIoCtx, int rcReq, if (!pIoCtx->cbTransferLeft) pIoCtx->pfnIoCtxTransfer = NULL; + vdIoCtxContinue(pIoCtx, rcReq); + rc = RTCritSectLeave(&pDisk->CritSect); AssertRC(rc); - - vdIoCtxContinue(pIoCtx, rcReq); } /** diff --git a/src/VBox/Storage/VDI.cpp b/src/VBox/Storage/VDI.cpp index 61fd96d70..c10508262 100644 --- a/src/VBox/Storage/VDI.cpp +++ b/src/VBox/Storage/VDI.cpp @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2006-2010 Oracle Corporation + * 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; @@ -771,7 +771,8 @@ static int vdiOpenImage(PVDIIMAGEDESC pImage, unsigned uOpenFlags) rc = vdiFileReadSync(pImage, 0, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL); if (RT_FAILURE(rc)) { - rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename); + vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename); + rc = VERR_VD_VDI_INVALID_HEADER; goto out; } rc = vdiValidatePreHeader(&pImage->PreHeader); @@ -1105,6 +1106,13 @@ static int vdiCreate(const char *pszFilename, uint64_t cbSize, pfnProgress = pCbProgress->pfnProgress; pvUser = pIfProgress->pvUser; } + + /* Check the image flags. */ + if ((uImageFlags & ~VD_VDI_IMAGE_FLAGS_MASK) != 0) + { + rc = VERR_VD_INVALID_TYPE; + goto out; + } /* Check open flags. All valid flags are supported. */ if (uOpenFlags & ~VD_OPEN_FLAGS_MASK) diff --git a/src/VBox/Storage/VMDK.cpp b/src/VBox/Storage/VMDK.cpp index 468f28315..59e86b6fb 100644 --- a/src/VBox/Storage/VMDK.cpp +++ b/src/VBox/Storage/VMDK.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2010 Oracle Corporation + * 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; @@ -2701,7 +2701,8 @@ static int vmdkReadBinaryMetaExtent(PVMDKIMAGE pImage, PVMDKEXTENT pExtent, AssertRC(rc); if (RT_FAILURE(rc)) { - rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent header in '%s'"), pExtent->pszFullname); + vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent header in '%s'"), pExtent->pszFullname); + rc = VERR_VD_VMDK_INVALID_HEADER; goto out; } rc = vmdkValidateHeader(pImage, pExtent, &Header); @@ -2739,7 +2740,8 @@ static int vmdkReadBinaryMetaExtent(PVMDKIMAGE pImage, PVMDKEXTENT pExtent, AssertRC(rc); if (RT_FAILURE(rc)) { - rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent footer in '%s'"), pExtent->pszFullname); + vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent footer in '%s'"), pExtent->pszFullname); + rc = VERR_VD_VMDK_INVALID_HEADER; goto out; } rc = vmdkValidateHeader(pImage, pExtent, &Header); @@ -3022,7 +3024,11 @@ static int vmdkReadMetaESXSparseExtent(PVMDKEXTENT pExtent) int rc = vmdkFileReadSync(pImage, pExtent->pFile, 0, &Header, sizeof(Header), NULL); AssertRC(rc); if (RT_FAILURE(rc)) + { + vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading ESX sparse extent header in '%s'"), pExtent->pszFullname); + rc = VERR_VD_VMDK_INVALID_HEADER; goto out; + } if ( RT_LE2H_U32(Header.magicNumber) != VMDK_ESX_SPARSE_MAGICNUMBER || RT_LE2H_U32(Header.version) != 1 || RT_LE2H_U32(Header.flags) != 3) @@ -3237,7 +3243,8 @@ static int vmdkOpenImage(PVMDKIMAGE pImage, unsigned uOpenFlags) rc = vmdkFileReadSync(pImage, pFile, 0, &u32Magic, sizeof(u32Magic), NULL); if (RT_FAILURE(rc)) { - rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename); + vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename); + rc = VERR_VD_VMDK_INVALID_HEADER; goto out; } @@ -4499,16 +4506,13 @@ static int vmdkFreeImage(PVMDKIMAGE pImage, bool fDelete) { PVMDKEXTENT pExtent = &pImage->pExtents[0]; uint32_t uLastGDEntry = pExtent->uLastGrainAccess / pExtent->cGTEntries; - if (uLastGDEntry != pExtent->cGDEntries - 1) + rc = vmdkStreamFlushGT(pImage, pExtent, uLastGDEntry); + AssertRC(rc); + vmdkStreamClearGT(pImage, pExtent); + for (uint32_t i = uLastGDEntry + 1; i < pExtent->cGDEntries; i++) { - rc = vmdkStreamFlushGT(pImage, pExtent, uLastGDEntry); + rc = vmdkStreamFlushGT(pImage, pExtent, i); AssertRC(rc); - vmdkStreamClearGT(pImage, pExtent); - for (uint32_t i = uLastGDEntry + 1; i < pExtent->cGDEntries; i++) - { - rc = vmdkStreamFlushGT(pImage, pExtent, i); - AssertRC(rc); - } } uint64_t uFileOffset = pExtent->uAppendPosition; @@ -5835,6 +5839,13 @@ static int vmdkCreate(const char *pszFilename, uint64_t cbSize, pvUser = pIfProgress->pvUser; } + /* Check the image flags. */ + if ((uImageFlags & ~VD_VMDK_IMAGE_FLAGS_MASK) != 0) + { + rc = VERR_VD_INVALID_TYPE; + goto out; + } + /* Check open flags. All valid flags are supported. */ if (uOpenFlags & ~VD_OPEN_FLAGS_MASK) { diff --git a/src/VBox/VMM/Makefile.kmk b/src/VBox/VMM/Makefile.kmk index 377162bb6..700ca3931 100644 --- a/src/VBox/VMM/Makefile.kmk +++ b/src/VBox/VMM/Makefile.kmk @@ -53,7 +53,7 @@ endif VMMR3_TEMPLATE = VBoxR3DllNoPic -VMMR3_DEFS = IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS) VBOX_SVN_REV=$(VBOX_SVN_REV) +VMMR3_DEFS = IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG $(VMM_COMMON_DEFS) ## @todo eliminate IN_GMM_R3 ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT VMMR3_DEFS += VBOX_WITH_PREALLOC_RAM_BY_DEFAULT diff --git a/src/VBox/VMM/VMMR3/PDMBlkCache.cpp b/src/VBox/VMM/VMMR3/PDMBlkCache.cpp index 895e48637..721864370 100644 --- a/src/VBox/VMM/VMMR3/PDMBlkCache.cpp +++ b/src/VBox/VMM/VMMR3/PDMBlkCache.cpp @@ -879,7 +879,14 @@ static DECLCALLBACK(int) pdmR3BlkCacheLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_ SSMR3GetU32(pSSM, &cRefs); - if (cRefs == pBlkCacheGlobal->cRefs) + /* + * Fewer users in the saved state than in the current VM are allowed + * because that means that there are only new ones which don't have any saved state + * which can get lost. + * More saved entries that current ones are not allowed because this could result in + * lost data. + */ + if (cRefs <= pBlkCacheGlobal->cRefs) { char *pszId = NULL; diff --git a/src/VBox/VMM/VMMR3/PDMDriver.cpp b/src/VBox/VMM/VMMR3/PDMDriver.cpp index 97b8436b0..1799be91d 100644 --- a/src/VBox/VMM/VMMR3/PDMDriver.cpp +++ b/src/VBox/VMM/VMMR3/PDMDriver.cpp @@ -71,15 +71,14 @@ static DECLCALLBACK(int) pdmR3DrvRegister(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG static int pdmR3DrvLoad(PVM pVM, PPDMDRVREGCBINT pRegCB, const char *pszFilename, const char *pszName); - /** - * Register external drivers + * Register drivers in a statically linked environment. * * @returns VBox status code. * @param pVM The VM to operate on. * @param pfnCallback Driver registration callback */ -VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback) +VMMR3DECL(int) PDMR3DrvStaticRegistration(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback) { /* * The registration callbacks. @@ -88,6 +87,7 @@ VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallbac RegCB.Core.u32Version = PDM_DRVREG_CB_VERSION; RegCB.Core.pfnRegister = pdmR3DrvRegister; RegCB.pVM = pVM; + RegCB.pCfgNode = NULL; int rc = pfnCallback(&RegCB.Core, VBOX_VERSION); if (RT_FAILURE(rc)) @@ -96,6 +96,7 @@ VMMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallbac return rc; } + /** * This function will initialize the drivers for this VM instance. * diff --git a/src/VBox/VMM/VMMR3/PDMUsb.cpp b/src/VBox/VMM/VMMR3/PDMUsb.cpp index 8c1c4ed01..968626a16 100644 --- a/src/VBox/VMM/VMMR3/PDMUsb.cpp +++ b/src/VBox/VMM/VMMR3/PDMUsb.cpp @@ -941,7 +941,7 @@ static void pdmR3UsbDestroyDevice(PVM pVM, PPDMUSBINS pUsbIns) Log(("PDM: Destructing USB device '%s' instance %d...\n", pUsbIns->pReg->szName, pUsbIns->iInstance)); pUsbIns->pReg->pfnDestruct(pUsbIns); } - //TMR3TimerDestroyUsb(pVM, pUsbIns); + TMR3TimerDestroyUsb(pVM, pUsbIns); //SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0); pdmR3ThreadDestroyUsb(pVM, pUsbIns); @@ -1324,9 +1324,7 @@ static DECLCALLBACK(int) pdmR3UsbHlp_TMTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK e pszDesc = pszDesc2; } - /** @todo - int rc = TMR3TimerCreateUsb(pVM, pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer); */ - int rc = VERR_NOT_IMPLEMENTED; AssertFailed(); + int rc = TMR3TimerCreateUsb(pVM, pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer); LogFlow(("pdmR3UsbHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc\n", pUsbIns->pReg->szName, pUsbIns->iInstance, rc)); return rc; diff --git a/src/VBox/VMM/VMMR3/PGMPhys.cpp b/src/VBox/VMM/VMMR3/PGMPhys.cpp index 5f5938705..371be9bd1 100644 --- a/src/VBox/VMM/VMMR3/PGMPhys.cpp +++ b/src/VBox/VMM/VMMR3/PGMPhys.cpp @@ -1007,14 +1007,14 @@ static DECLCALLBACK(VBOXSTRICTRC) pgmR3PhysWriteProtectRAMRendezvous(PVM pVM, PV /* Remember this dirty page for the next (memory) sync. */ PGM_PAGE_SET_FT_DIRTY(pPage); } - + pgmPhysPageWriteMonitor(pVM, pPage, pRam->GCPhys + ((RTGCPHYS)iPage << PAGE_SHIFT)); break; - + case PGM_PAGE_STATE_SHARED: AssertFailed(); break; - + case PGM_PAGE_STATE_WRITE_MONITORED: /* nothing to change. */ default: break; @@ -1878,10 +1878,12 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, AssertPtrReturn(pszDesc, VERR_INVALID_POINTER); AssertReturn(*pszDesc, VERR_INVALID_PARAMETER); + int rc = pgmLock(pVM); + AssertRCReturn(rc, rc); + /* * Make sure there's a RAM range structure for the region. */ - int rc; RTGCPHYS GCPhysLast = GCPhys + (cb - 1); bool fRamExists = false; PPGMRAMRANGE pRamPrev = NULL; @@ -1892,23 +1894,29 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, && GCPhys <= pRam->GCPhysLast) { /* Simplification: all within the same range. */ - AssertLogRelMsgReturn( GCPhys >= pRam->GCPhys - && GCPhysLast <= pRam->GCPhysLast, - ("%RGp-%RGp (MMIO/%s) falls partly outside %RGp-%RGp (%s)\n", - GCPhys, GCPhysLast, pszDesc, - pRam->GCPhys, pRam->GCPhysLast, pRam->pszDesc), - VERR_PGM_RAM_CONFLICT); + if (RT_UNLIKELY(!( GCPhys >= pRam->GCPhys + && GCPhysLast <= pRam->GCPhysLast))) + { + AssertLogRelMsgFailed(("%RGp-%RGp (MMIO/%s) falls partly outside %RGp-%RGp (%s)\n", + GCPhys, GCPhysLast, pszDesc, + pRam->GCPhys, pRam->GCPhysLast, pRam->pszDesc)); + pgmUnlock(pVM); + return VERR_PGM_RAM_CONFLICT; + } /* Check that it's all RAM or MMIO pages. */ PCPGMPAGE pPage = &pRam->aPages[(GCPhys - pRam->GCPhys) >> PAGE_SHIFT]; uint32_t cLeft = cb >> PAGE_SHIFT; while (cLeft-- > 0) { - AssertLogRelMsgReturn( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM - || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO, - ("%RGp-%RGp (MMIO/%s): %RGp is not a RAM or MMIO page - type=%d desc=%s\n", - GCPhys, GCPhysLast, pszDesc, PGM_PAGE_GET_TYPE(pPage), pRam->pszDesc), - VERR_PGM_RAM_CONFLICT); + if (RT_UNLIKELY(!( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM + || PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_MMIO))) + { + AssertLogRelMsgFailed(("%RGp-%RGp (MMIO/%s): %RGp is not a RAM or MMIO page - type=%d desc=%s\n", + GCPhys, GCPhysLast, pszDesc, PGM_PAGE_GET_TYPE(pPage), pRam->pszDesc)); + pgmUnlock(pVM); + return VERR_PGM_RAM_CONFLICT; + } pPage++; } @@ -1931,13 +1939,13 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, * RAM pages currently mapped here. This might not be 100% correct * for PCI memory, but we're doing the same thing for MMIO2 pages. */ - rc = pgmLock(pVM); - if (RT_SUCCESS(rc)) + rc = pgmR3PhysFreePageRange(pVM, pRam, GCPhys, GCPhysLast, PGMPAGETYPE_MMIO); + if (RT_FAILURE(rc)) { - rc = pgmR3PhysFreePageRange(pVM, pRam, GCPhys, GCPhysLast, PGMPAGETYPE_MMIO); + AssertRC(rc); pgmUnlock(pVM); + return rc; } - AssertRCReturn(rc, rc); /* Force a PGM pool flush as guest ram references have been changed. */ /** todo; not entirely SMP safe; assuming for now the guest takes care of this internally (not touch mapped mmio while changing the mapping). */ @@ -1947,8 +1955,6 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, } else { - pgmLock(pVM); - /* * No RAM range, insert an ad hoc one. * @@ -1960,7 +1966,12 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const uint32_t cPages = cb >> PAGE_SHIFT; const size_t cbRamRange = RT_OFFSETOF(PGMRAMRANGE, aPages[cPages]); rc = MMHyperAlloc(pVM, RT_OFFSETOF(PGMRAMRANGE, aPages[cPages]), 16, MM_TAG_PGM_PHYS, (void **)&pNew); - AssertLogRelMsgRCReturn(rc, ("cbRamRange=%zu\n", cbRamRange), rc); + if (RT_FAILURE(rc)) + { + AssertLogRelMsgFailed(("cbRamRange=%zu\n", cbRamRange)); + pgmUnlock(pVM); + return rc; + } /* Initialize the range. */ pNew->pSelfR0 = MMHyperCCToR0(pVM, pNew); @@ -1984,8 +1995,6 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, /* link it */ pgmR3PhysLinkRamRange(pVM, pNew, pRamPrev); - - pgmUnlock(pVM); } /* @@ -2008,6 +2017,7 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, } PGMPhysInvalidatePageMapTLB(pVM); + pgmUnlock(pVM); return rc; } @@ -2027,10 +2037,13 @@ VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb) { VM_ASSERT_EMT(pVM); + int rc = pgmLock(pVM); + AssertRCReturn(rc, rc); + /* * First deregister the handler, then check if we should remove the ram range. */ - int rc = PGMHandlerPhysicalDeregister(pVM, GCPhys); + rc = PGMHandlerPhysicalDeregister(pVM, GCPhys); if (RT_SUCCESS(rc)) { RTGCPHYS GCPhysLast = GCPhys + (cb - 1); @@ -2121,6 +2134,7 @@ VMMR3DECL(int) PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb) VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); PGMPhysInvalidatePageMapTLB(pVM); + pgmUnlock(pVM); return rc; } diff --git a/src/VBox/VMM/VMMR3/TM.cpp b/src/VBox/VMM/VMMR3/TM.cpp index 9d497efb7..9efc0c434 100644 --- a/src/VBox/VMM/VMMR3/TM.cpp +++ b/src/VBox/VMM/VMMR3/TM.cpp @@ -1342,6 +1342,52 @@ VMM_INT_DECL(int) TMR3TimerCreateDevice(PVM pVM, PPDMDEVINS pDevIns, TMCLOCK enm } + + +/** + * Creates a USB device timer. + * + * @returns VBox status. + * @param pVM The VM to create the timer in. + * @param pUsbIns The USB device instance. + * @param enmClock The clock to use on this timer. + * @param pfnCallback Callback function. + * @param pvUser The user argument to the callback. + * @param fFlags Timer creation flags, see grp_tm_timer_flags. + * @param pszDesc Pointer to description string which must stay around + * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()). + * @param ppTimer Where to store the timer on success. + */ +VMM_INT_DECL(int) TMR3TimerCreateUsb(PVM pVM, PPDMUSBINS pUsbIns, TMCLOCK enmClock, + PFNTMTIMERUSB pfnCallback, void *pvUser, + uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer) +{ + AssertReturn(!(fFlags & ~(TMTIMER_FLAGS_NO_CRIT_SECT)), VERR_INVALID_PARAMETER); + + /* + * Allocate and init stuff. + */ + int rc = tmr3TimerCreate(pVM, enmClock, pszDesc, ppTimer); + if (RT_SUCCESS(rc)) + { + (*ppTimer)->enmType = TMTIMERTYPE_USB; + (*ppTimer)->u.Usb.pfnTimer = pfnCallback; + (*ppTimer)->u.Usb.pUsbIns = pUsbIns; + (*ppTimer)->pvUser = pvUser; + //if (!(fFlags & TMTIMER_FLAGS_NO_CRIT_SECT)) + //{ + // if (pDevIns->pCritSectR3) + // (*ppTimer)->pCritSect = pUsbIns->pCritSectR3; + // else + // (*ppTimer)->pCritSect = IOMR3GetCritSect(pVM); + //} + Log(("TM: Created USB device timer %p clock %d callback %p '%s'\n", (*ppTimer), enmClock, pfnCallback, pszDesc)); + } + + return rc; +} + + /** * Creates a driver timer. * @@ -1639,6 +1685,39 @@ VMM_INT_DECL(int) TMR3TimerDestroyDevice(PVM pVM, PPDMDEVINS pDevIns) /** + * Destroy all timers owned by a USB device. + * + * @returns VBox status. + * @param pVM VM handle. + * @param pUsbIns USB device which timers should be destroyed. + */ +VMM_INT_DECL(int) TMR3TimerDestroyUsb(PVM pVM, PPDMUSBINS pUsbIns) +{ + LogFlow(("TMR3TimerDestroyUsb: pUsbIns=%p\n", pUsbIns)); + if (!pUsbIns) + return VERR_INVALID_PARAMETER; + + tmTimerLock(pVM); + PTMTIMER pCur = pVM->tm.s.pCreated; + while (pCur) + { + PTMTIMER pDestroy = pCur; + pCur = pDestroy->pBigNext; + if ( pDestroy->enmType == TMTIMERTYPE_USB + && pDestroy->u.Usb.pUsbIns == pUsbIns) + { + int rc = TMR3TimerDestroy(pDestroy); + AssertRC(rc); + } + } + tmTimerUnlock(pVM); + + LogFlow(("TMR3TimerDestroyUsb: returns VINF_SUCCESS\n")); + return VINF_SUCCESS; +} + + +/** * Destroy all timers owned by a driver. * * @returns VBox status. @@ -1928,6 +2007,7 @@ static void tmR3TimerQueueRun(PVM pVM, PTMTIMERQUEUE pQueue) switch (pTimer->enmType) { case TMTIMERTYPE_DEV: pTimer->u.Dev.pfnTimer(pTimer->u.Dev.pDevIns, pTimer, pTimer->pvUser); break; + case TMTIMERTYPE_USB: pTimer->u.Usb.pfnTimer(pTimer->u.Usb.pUsbIns, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_DRV: pTimer->u.Drv.pfnTimer(pTimer->u.Drv.pDrvIns, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_INTERNAL: pTimer->u.Internal.pfnTimer(pVM, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_EXTERNAL: pTimer->u.External.pfnTimer(pTimer->pvUser); break; @@ -2110,6 +2190,7 @@ static void tmR3TimerQueueRunVirtualSync(PVM pVM) switch (pTimer->enmType) { case TMTIMERTYPE_DEV: pTimer->u.Dev.pfnTimer(pTimer->u.Dev.pDevIns, pTimer, pTimer->pvUser); break; + case TMTIMERTYPE_USB: pTimer->u.Usb.pfnTimer(pTimer->u.Usb.pUsbIns, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_DRV: pTimer->u.Drv.pfnTimer(pTimer->u.Drv.pDrvIns, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_INTERNAL: pTimer->u.Internal.pfnTimer(pVM, pTimer, pTimer->pvUser); break; case TMTIMERTYPE_EXTERNAL: pTimer->u.External.pfnTimer(pTimer->pvUser); break; diff --git a/src/VBox/VMM/VMMR3/VMMR3.def b/src/VBox/VMM/VMMR3/VMMR3.def index 27f315294..aa9fce504 100644 --- a/src/VBox/VMM/VMMR3/VMMR3.def +++ b/src/VBox/VMM/VMMR3/VMMR3.def @@ -92,6 +92,8 @@ EXPORTS CFGMR3QueryString CFGMR3QueryStringAlloc + IOMR3GetCritSect + MMR3HeapFree MMR3HeapRealloc diff --git a/src/VBox/VMM/include/TMInternal.h b/src/VBox/VMM/include/TMInternal.h index ecdf5e862..30434a694 100644 --- a/src/VBox/VMM/include/TMInternal.h +++ b/src/VBox/VMM/include/TMInternal.h @@ -48,6 +48,8 @@ typedef enum TMTIMERTYPE { /** Device timer. */ TMTIMERTYPE_DEV = 1, + /** USB device timer. */ + TMTIMERTYPE_USB, /** Driver timer. */ TMTIMERTYPE_DRV, /** Internal timer . */ @@ -134,6 +136,15 @@ typedef struct TMTIMER PPDMDEVINSR3 pDevIns; } Dev; + /** TMTIMERTYPE_DEV. */ + struct + { + /** Callback. */ + R3PTRTYPE(PFNTMTIMERUSB) pfnTimer; + /** USB device instance. */ + PPDMUSBINS pUsbIns; + } Usb; + /** TMTIMERTYPE_DRV. */ struct { |