[debian-edu-commits] debian-edu/ 11/32: Imported Upstream version 2.0.2+dfsg1

Mike Gabriel sunweaver at debian.org
Mon Aug 18 15:09:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to annotated tag debian/1_2.0.2+dfsg1-1
in repository italc.

commit 425455074b1048238fa25a6f997ca09127d8f590
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Aug 14 14:02:49 2014 +0200

    Imported Upstream version 2.0.2+dfsg1
---
 ica/win32/CMakeLists.txt                           |   39 -
 ica/win32/addon/logger/logmessages.dsw             |   29 -
 ica/win32/addon/logger/messages.h                  |   66 -
 ica/win32/addon/logger/messages.mc                 |   26 -
 ica/win32/addon/logger/messages.rc                 |    2 -
 ica/win32/addon/ms-logon/MSLogonACL/.cvsignore     |    4 -
 ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.cpp |  117 -
 ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.dsw |   29 -
 ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.h   |   28 -
 ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.rc  |  116 -
 ica/win32/addon/ms-logon/MSLogonACL/buildtime.h    |    3 -
 ica/win32/addon/ms-logon/MSLogonACL/buildtime.in   |    2 -
 ica/win32/addon/ms-logon/MSLogonACL/resource.h     |   15 -
 .../addon/ms-logon/MSLogonACL/vncExportACL.cpp     |  220 -
 ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.h |   56 -
 .../addon/ms-logon/MSLogonACL/vncImportACL.cpp     |  498 --
 ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.h |   87 -
 ica/win32/addon/ms-logon/authSSP/.cvsignore        |    4 -
 ica/win32/addon/ms-logon/authSSP/Auth_Seq.h        |   43 -
 ica/win32/addon/ms-logon/authSSP/EventLogging.cpp  |  158 -
 ica/win32/addon/ms-logon/authSSP/EventLogging.h    |   59 -
 .../ms-logon/authSSP/GenClientServerContext.cpp    |  370 --
 .../ms-logon/authSSP/GenClientServerContext.h      |   72 -
 ica/win32/addon/ms-logon/authSSP/Readme.txt        |   16 -
 ica/win32/addon/ms-logon/authSSP/authSSP.cpp       |  332 --
 ica/win32/addon/ms-logon/authSSP/authSSP.def       |    5 -
 ica/win32/addon/ms-logon/authSSP/authSSP.dsw       |   29 -
 ica/win32/addon/ms-logon/authSSP/authSSP.h         |   98 -
 ica/win32/addon/ms-logon/authSSP/authSSP.rc        |  116 -
 ica/win32/addon/ms-logon/authSSP/buildtime.in      |    2 -
 ica/win32/addon/ms-logon/authSSP/resource.h        |   15 -
 .../addon/ms-logon/authSSP/vncAccessControl.cpp    |  216 -
 .../addon/ms-logon/authSSP/vncAccessControl.h      |   45 -
 ica/win32/addon/ms-logon/authSSP/vncSSP.cpp        |  108 -
 ica/win32/addon/ms-logon/authSSP/vncSSP.h          |   52 -
 .../addon/ms-logon/authSSP/vncSecurityEditor.cpp   |  168 -
 .../addon/ms-logon/authSSP/vncSecurityEditor.h     |   71 -
 .../ms-logon/authSSP/vncSecurityEditorProps.h      |   66 -
 ica/win32/addon/ms-logon/authadm/authadmin.cpp     |  111 -
 ica/win32/addon/ms-logon/authadm/authadmin.def     |    4 -
 ica/win32/addon/ms-logon/authadm/authadmin.dsw     |   29 -
 ica/win32/addon/ms-logon/authadm/authadmin.h       |   23 -
 ica/win32/addon/ms-logon/authadm/authadmin.rc      |  112 -
 ica/win32/addon/ms-logon/authadm/resource.h        |   15 -
 ica/win32/addon/ms-logon/ldapauth/ldapAuth.cpp     |  638 --
 ica/win32/addon/ms-logon/ldapauth/ldapAuth.h       |   55 -
 ica/win32/addon/ms-logon/ldapauth/ldapAuth.rc      |  112 -
 ica/win32/addon/ms-logon/ldapauth/ldapauth.def     |    5 -
 ica/win32/addon/ms-logon/ldapauth/ldapauth.dsw     |   29 -
 ica/win32/addon/ms-logon/ldapauth/resource.h       |   15 -
 ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.cpp |  614 --
 ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.h   |   57 -
 ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.rc  |  112 -
 ica/win32/addon/ms-logon/ldapauth9x/ldapauth9x.def |    5 -
 ica/win32/addon/ms-logon/ldapauth9x/resource.h     |   15 -
 .../addon/ms-logon/ldapauthNT4/ldapAuthnt4.cpp     |  656 ---
 ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.h |   55 -
 .../addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc      |  112 -
 .../addon/ms-logon/ldapauthNT4/ldapauthnt4.def     |    5 -
 .../addon/ms-logon/ldapauthNT4/ldapauthnt4.dsw     |   29 -
 ica/win32/addon/ms-logon/ldapauthNT4/resource.h    |   15 -
 ica/win32/addon/ms-logon/logging/logging.cpp       |  314 -
 ica/win32/addon/ms-logon/logging/logging.def       |    8 -
 ica/win32/addon/ms-logon/logging/logging.dsw       |   29 -
 ica/win32/addon/ms-logon/logging/logging.h         |   38 -
 ica/win32/addon/ms-logon/logging/logging.rc        |  112 -
 ica/win32/addon/ms-logon/logging/resource.h        |   15 -
 ica/win32/addon/ms-logon/testauth/ntlogon.cpp      |  232 -
 ica/win32/addon/ms-logon/testauth/resource.h       |   15 -
 ica/win32/addon/ms-logon/testauth/testauth.dsw     |   53 -
 ica/win32/addon/ms-logon/testauth/testauth.rc      |  112 -
 ica/win32/addon/ms-logon/workgrpdomnt4/resource.h  |   15 -
 .../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.cpp |  886 ---
 .../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.def |    4 -
 .../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.dsw |   29 -
 .../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.h   |  100 -
 .../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc  |  112 -
 ica/win32/addon/versioninfo.h                      |   76 -
 ica/win32/common/Clipboard.cpp                     |  762 ---
 ica/win32/common/Clipboard.h                       |  168 -
 ica/win32/common/ScopeGuard.h                      |  320 -
 ica/win32/common/win32_helpers.cpp                 |   99 -
 ica/win32/common/win32_helpers.h                   |   72 -
 ica/win32/rdr/Exception.h                          |   71 -
 ica/win32/rdr/FdInStream.cxx                       |  387 --
 ica/win32/rdr/FdInStream.h                         |   89 -
 ica/win32/rdr/FdOutStream.cxx                      |  114 -
 ica/win32/rdr/FdOutStream.h                        |   53 -
 ica/win32/rdr/FixedMemOutStream.h                  |   52 -
 ica/win32/rdr/InStream.cxx                         |   35 -
 ica/win32/rdr/InStream.h                           |  145 -
 ica/win32/rdr/Makefile.bcc32                       |   33 -
 ica/win32/rdr/Makefile.in                          |   18 -
 ica/win32/rdr/MemInStream.h                        |   47 -
 ica/win32/rdr/MemOutStream.h                       |   82 -
 ica/win32/rdr/NullOutStream.cxx                    |   60 -
 ica/win32/rdr/NullOutStream.h                      |   42 -
 ica/win32/rdr/OutStream.h                          |  154 -
 ica/win32/rdr/ZlibInStream.cxx                     |  125 -
 ica/win32/rdr/ZlibInStream.h                       |   61 -
 ica/win32/rdr/ZlibOutStream.cxx                    |  145 -
 ica/win32/rdr/ZlibOutStream.h                      |   59 -
 ica/win32/rdr/types.h                              |   36 -
 ica/win32/ultravnc-italc.cpp                       |  277 -
 ica/win32/ultravnc.cpp                             |  236 -
 ica/win32/winvnc/DSMPlugin/DSMPlugin.cpp           |  525 --
 ica/win32/winvnc/DSMPlugin/DSMPlugin.h             |  194 -
 ica/win32/winvnc/Makefile.bcc32                    |  117 -
 ica/win32/winvnc/building.txt                      |   40 -
 ica/win32/winvnc/crtdbg.h                          |    2 -
 ica/win32/winvnc/history.txt                       |  740 ---
 ica/win32/winvnc/libjpeg-turbo-win/jpeglib.h       |    2 -
 ica/win32/winvnc/lzo/minilzo.h                     |    2 -
 ica/win32/winvnc/omnithread/nt.cpp                 |  965 ----
 ica/win32/winvnc/omnithread/nt.h                   |   82 -
 ica/win32/winvnc/omnithread/omnithread.h           |  659 ---
 ica/win32/winvnc/omnithread/threaddata.cpp         |   83 -
 ica/win32/winvnc/rfb/zrleEncode.h                  |  352 --
 ica/win32/winvnc/rfb/zywrletemplate.c              |  804 ---
 ica/win32/winvnc/vnchooks/Makefile.bcc32           |    9 -
 ica/win32/winvnc/vnchooks/SharedData.cpp           |   42 -
 ica/win32/winvnc/vnchooks/SharedData.h             |   33 -
 ica/win32/winvnc/vnchooks/VNCHooks-bcc32.def       |    7 -
 ica/win32/winvnc/vnchooks/VNCHooks-vc.def          |    7 -
 ica/win32/winvnc/vnchooks/VNCHooks.cpp             | 1180 ----
 ica/win32/winvnc/vnchooks/VNCHooks.def             |    7 -
 ica/win32/winvnc/vnchooks/VNCHooks.h               |   73 -
 ica/win32/winvnc/vnchooks/resource.h               |   15 -
 ica/win32/winvnc/vnchooks/vnchooks.dsp             |  123 -
 ica/win32/winvnc/vnchooks/vnchooks.rc              |  109 -
 ica/win32/winvnc/vnchooks/vnchooks.vcproj          |  717 ---
 ica/win32/winvnc/vnchooks/vnchooksVS2005.vcproj    |  505 --
 .../winvnc/vnchooks/vnchooks_vs90_Debug_Win32.lnt  |   12 -
 .../vnchooks/vnchooks_vs90_Release_Win32.lnt       |   12 -
 ica/win32/winvnc/winvnc.dsw                        |  260 -
 ica/win32/winvnc/winvnc.sln                        |  345 --
 ica/win32/winvnc/winvnc.sln.vloptions              |    2 -
 ica/win32/winvnc/winvnc/CpuUsage.cpp               |  215 -
 ica/win32/winvnc/winvnc/CpuUsage.h                 |   89 -
 ica/win32/winvnc/winvnc/Dtwinver.cpp               | 2074 -------
 ica/win32/winvnc/winvnc/Dtwinver.h                 |  363 --
 ica/win32/winvnc/winvnc/HideDesktop.cpp            |  425 --
 ica/win32/winvnc/winvnc/HideDesktop.h              |   56 -
 ica/win32/winvnc/winvnc/IPC.cpp                    |  200 -
 ica/win32/winvnc/winvnc/IPC.h                      |   62 -
 ica/win32/winvnc/winvnc/Localization.h             |  202 -
 ica/win32/winvnc/winvnc/TextChat.cpp               |  852 ---
 ica/win32/winvnc/winvnc/TextChat.h                 |   76 -
 ica/win32/winvnc/winvnc/Timer.cpp                  |   39 -
 ica/win32/winvnc/winvnc/Timer.h                    |  123 -
 ica/win32/winvnc/winvnc/WINVNC.DSW                 |   29 -
 ica/win32/winvnc/winvnc/benchmark.cpp              |  152 -
 ica/win32/winvnc/winvnc/black_layered.cpp          |  334 --
 ica/win32/winvnc/winvnc/buildtime.cpp              |   22 -
 ica/win32/winvnc/winvnc/d3des.c                    |  440 --
 ica/win32/winvnc/winvnc/d3des.h                    |   51 -
 ica/win32/winvnc/winvnc/getinfo.cpp                |  589 --
 ica/win32/winvnc/winvnc/helpers.cpp                |  611 --
 ica/win32/winvnc/winvnc/httpconnect.cpp            | 1479 -----
 ica/win32/winvnc/winvnc/httpconnect.h              |  230 -
 ica/win32/winvnc/winvnc/inifile.cpp                |  213 -
 ica/win32/winvnc/winvnc/inifile.h                  |   64 -
 ica/win32/winvnc/winvnc/initipp.cpp                |  186 -
 ica/win32/winvnc/winvnc/keysymdef.h                | 1595 -----
 ica/win32/winvnc/winvnc/minmax.h                   |   48 -
 ica/win32/winvnc/winvnc/read_write_ini.cpp         |  306 -
 ica/win32/winvnc/winvnc/res/AuthPanel.class        |  Bin 2916 -> 0 bytes
 ica/win32/winvnc/winvnc/res/ButtonPanel.class      |  Bin 3209 -> 0 bytes
 ica/win32/winvnc/winvnc/res/DH.class               |  Bin 2404 -> 0 bytes
 ica/win32/winvnc/winvnc/res/FTPFrame.class         |  Bin 20602 -> 0 bytes
 ica/win32/winvnc/winvnc/res/Finger.cur             |  Bin 326 -> 0 bytes
 ica/win32/winvnc/winvnc/res/RecordingFrame.class   |  Bin 5971 -> 0 bytes
 ica/win32/winvnc/winvnc/res/SessionRecorder.class  |  Bin 2642 -> 0 bytes
 ica/win32/winvnc/winvnc/res/clipboardframe.class   |  Bin 2591 -> 0 bytes
 ica/win32/winvnc/winvnc/res/descipher.class        |  Bin 8245 -> 0 bytes
 ica/win32/winvnc/winvnc/res/ding_dong.wav          |  Bin 118662 -> 0 bytes
 ica/win32/winvnc/winvnc/res/ftpframe$strcomp.class |  Bin 618 -> 0 bytes
 ica/win32/winvnc/winvnc/res/icon2.ico              |  Bin 297086 -> 0 bytes
 ica/win32/winvnc/winvnc/res/optionsframe.class     |  Bin 6870 -> 0 bytes
 ica/win32/winvnc/winvnc/res/rfbproto.class         |  Bin 25244 -> 0 bytes
 ica/win32/winvnc/winvnc/res/runas.bmp              |  Bin 124342 -> 0 bytes
 ica/win32/winvnc/winvnc/res/vnc-1.bmp              |  Bin 12342 -> 0 bytes
 ica/win32/winvnc/winvnc/res/vnccanvas.class        |  Bin 21431 -> 0 bytes
 ica/win32/winvnc/winvnc/res/vncviewer.class        |  Bin 16030 -> 0 bytes
 ica/win32/winvnc/winvnc/res/vncviewer.jar          |  Bin 65311 -> 0 bytes
 ica/win32/winvnc/winvnc/res/world3a.ico            |  Bin 297086 -> 0 bytes
 ica/win32/winvnc/winvnc/resource.h                 |  312 -
 ica/win32/winvnc/winvnc/rfb.h                      |   86 -
 ica/win32/winvnc/winvnc/rfbMisc.h                  |  124 -
 ica/win32/winvnc/winvnc/rfbRect.h                  |  117 -
 ica/win32/winvnc/winvnc/rfbRegion.h                |   31 -
 ica/win32/winvnc/winvnc/rfbRegion_X11.cxx          |  210 -
 ica/win32/winvnc/winvnc/rfbRegion_X11.h            |   87 -
 ica/win32/winvnc/winvnc/rfbRegion_win32.cpp        |  280 -
 ica/win32/winvnc/winvnc/rfbRegion_win32.h          |   93 -
 ica/win32/winvnc/winvnc/rfbUpdateTracker.cpp       |  224 -
 ica/win32/winvnc/winvnc/rfbUpdateTracker.h         |  112 -
 ica/win32/winvnc/winvnc/security.cpp               |  158 -
 ica/win32/winvnc/winvnc/service.cpp                | 1059 ----
 ica/win32/winvnc/winvnc/service_motor.cpp          |  898 ---
 ica/win32/winvnc/winvnc/stdhdrs.cpp                |   28 -
 ica/win32/winvnc/winvnc/stdhdrs.h                  |  104 -
 ica/win32/winvnc/winvnc/tableinitcmtemplate.cpp    |   96 -
 ica/win32/winvnc/winvnc/tableinittctemplate.cpp    |  122 -
 ica/win32/winvnc/winvnc/tabletranstemplate.cpp     |   96 -
 ica/win32/winvnc/winvnc/translate.cpp              |  184 -
 ica/win32/winvnc/winvnc/translate.h                |   81 -
 ica/win32/winvnc/winvnc/videodriver.cpp            |  974 ----
 ica/win32/winvnc/winvnc/videodriver.h              |  103 -
 ica/win32/winvnc/winvnc/videodrivercheck.cpp       |  177 -
 ica/win32/winvnc/winvnc/vistahook.cpp              |  481 --
 ica/win32/winvnc/winvnc/vncDesktopSW.cpp           |  226 -
 ica/win32/winvnc/winvnc/vncEncodeTight.cpp         | 1614 ------
 ica/win32/winvnc/winvnc/vncEncodeTight.h           |  199 -
 ica/win32/winvnc/winvnc/vncEncodeUltra.cpp         |  406 --
 ica/win32/winvnc/winvnc/vncEncodeUltra.h           |  107 -
 ica/win32/winvnc/winvnc/vncEncodeUltra2.cpp        |  319 -
 ica/win32/winvnc/winvnc/vncEncodeUltra2.h          |   74 -
 ica/win32/winvnc/winvnc/vncEncodeZlib.cpp          |  683 ---
 ica/win32/winvnc/winvnc/vncEncodeZlib.h            |  123 -
 ica/win32/winvnc/winvnc/vncEncodeZlibHex.cpp       |  645 ---
 ica/win32/winvnc/winvnc/vncEncodeZlibHex.h         |  114 -
 ica/win32/winvnc/winvnc/vncListDlg.cpp             |  169 -
 ica/win32/winvnc/winvnc/vncListDlg.h               |   47 -
 ica/win32/winvnc/winvnc/vncMultiMonitor.cpp        |  156 -
 ica/win32/winvnc/winvnc/vncOSVersion.cpp           |   63 -
 ica/win32/winvnc/winvnc/vncOSVersion.h             |   30 -
 ica/win32/winvnc/winvnc/vncabout.cpp               |  220 -
 ica/win32/winvnc/winvnc/vncabout.h                 |   58 -
 ica/win32/winvnc/winvnc/vncacceptdialog.cpp        |  204 -
 ica/win32/winvnc/winvnc/vncacceptdialog.h          |   73 -
 ica/win32/winvnc/winvnc/vncauth.c                  |  187 -
 ica/win32/winvnc/winvnc/vncauth.h                  |   48 -
 ica/win32/winvnc/winvnc/vncbuffer.cpp              | 1201 ----
 ica/win32/winvnc/winvnc/vncbuffer.h                |  158 -
 ica/win32/winvnc/winvnc/vncclient.cpp              | 6099 --------------------
 ica/win32/winvnc/winvnc/vncclient.h                |  605 --
 ica/win32/winvnc/winvnc/vncconndialog.cpp          |  402 --
 ica/win32/winvnc/winvnc/vncconndialog.h            |   69 -
 ica/win32/winvnc/winvnc/vncdesktop.cpp             | 2456 --------
 ica/win32/winvnc/winvnc/vncdesktop.h               |  537 --
 ica/win32/winvnc/winvnc/vncdesktopsink.cpp         |  748 ---
 ica/win32/winvnc/winvnc/vncdesktopthread.cpp       | 1334 -----
 ica/win32/winvnc/winvnc/vncdesktopthread.h         |  142 -
 ica/win32/winvnc/winvnc/vncencodecorre.cpp         |  522 --
 ica/win32/winvnc/winvnc/vncencodecorre.h           |   81 -
 ica/win32/winvnc/winvnc/vncencodehext.cpp          |  411 --
 ica/win32/winvnc/winvnc/vncencodehext.h            |   72 -
 ica/win32/winvnc/winvnc/vncencodemgr.h             |  926 ---
 ica/win32/winvnc/winvnc/vncencoder.cpp             |  445 --
 ica/win32/winvnc/winvnc/vncencoder.h               |  139 -
 ica/win32/winvnc/winvnc/vncencoderCursor.cpp       |  280 -
 ica/win32/winvnc/winvnc/vncencoderre.cpp           |  333 --
 ica/win32/winvnc/winvnc/vncencoderre.h             |   66 -
 ica/win32/winvnc/winvnc/vncencodezrle.cpp          |  221 -
 ica/win32/winvnc/winvnc/vncencodezrle.h            |   49 -
 ica/win32/winvnc/winvnc/vnchttpconnect.cpp         |  664 ---
 ica/win32/winvnc/winvnc/vnchttpconnect.h           |   70 -
 ica/win32/winvnc/winvnc/vncinsthandler.cpp         |   65 -
 ica/win32/winvnc/winvnc/vncinsthandler.h           |   52 -
 ica/win32/winvnc/winvnc/vnckeymap.cpp              |  832 ---
 ica/win32/winvnc/winvnc/vnckeymap.h                |   37 -
 ica/win32/winvnc/winvnc/vnclog.cpp                 |  303 -
 ica/win32/winvnc/winvnc/vnclog.h                   |  109 -
 ica/win32/winvnc/winvnc/vnclogon.cpp               |  143 -
 ica/win32/winvnc/winvnc/vnclogon.h                 |   29 -
 ica/win32/winvnc/winvnc/vncmemcpy.h                |   57 -
 ica/win32/winvnc/winvnc/vncmenu.cpp                | 2014 -------
 ica/win32/winvnc/winvnc/vncmenu.h                  |  140 -
 ica/win32/winvnc/winvnc/vncntlm.cpp                | 1127 ----
 ica/win32/winvnc/winvnc/vncpasswd.h                |  106 -
 ica/win32/winvnc/winvnc/vncproperties.cpp          | 2612 ---------
 ica/win32/winvnc/winvnc/vncproperties.h            |  185 -
 ica/win32/winvnc/winvnc/vncpropertiesPoll.cpp      | 1049 ----
 ica/win32/winvnc/winvnc/vncpropertiesPoll.h        |  119 -
 ica/win32/winvnc/winvnc/vncserver.cpp              | 2723 ---------
 ica/win32/winvnc/winvnc/vncserver.h                |  614 --
 ica/win32/winvnc/winvnc/vncservice.cpp             |  953 ---
 ica/win32/winvnc/winvnc/vncservice.h               |  122 -
 ica/win32/winvnc/winvnc/vncsetauth.cpp             |  685 ---
 ica/win32/winvnc/winvnc/vncsetauth.h               |   98 -
 ica/win32/winvnc/winvnc/vncsockconnect.cpp         |  227 -
 ica/win32/winvnc/winvnc/vncsockconnect.h           |   68 -
 ica/win32/winvnc/winvnc/vnctimedmsgbox.cpp         |   84 -
 ica/win32/winvnc/winvnc/vnctimedmsgbox.h           |   42 -
 ica/win32/winvnc/winvnc/vsocket.cpp                | 1144 ----
 ica/win32/winvnc/winvnc/vsocket.h                  |  224 -
 ica/win32/winvnc/winvnc/vtypes.h                   |   87 -
 ica/win32/winvnc/winvnc/winvnc.cpp                 | 1132 ----
 ica/win32/winvnc/winvnc/winvnc.dsp                 |  791 ---
 ica/win32/winvnc/winvnc/winvnc.exe.manifest        |   31 -
 ica/win32/winvnc/winvnc/winvnc.exe.x64.manifest    |   15 -
 ica/win32/winvnc/winvnc/winvnc.exe.x86.manifest    |   31 -
 ica/win32/winvnc/winvnc/winvnc.h                   |  104 -
 ica/win32/winvnc/winvnc/winvnc.rc                  |  708 ---
 ica/win32/winvnc/winvnc/winvnc.vcproj              | 4444 --------------
 ica/win32/winvnc/winvnc/winvncVS2005.vcproj        | 3213 -----------
 ica/win32/winvnc/winvnc/winvnc_fr.rc               |  686 ---
 .../winvnc/winvnc/winvnc_vs90_Release_Win32.lnt    |   80 -
 ica/win32/winvnc/winvncvs2005.sln                  |  681 ---
 ica/win32/winvnc/zlib/zlib.h                       |    1 -
 ica/x11/common/sha1.c                              |  411 --
 ica/x11/common/sha1.h                              |  101 -
 303 files changed, 89758 deletions(-)

diff --git a/ica/win32/CMakeLists.txt b/ica/win32/CMakeLists.txt
deleted file mode 100644
index f05e338..0000000
--- a/ica/win32/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-SET(CMAKE_MODULE_LINKER_FLAGS -Wl,-export-all-symbols)
-
-IF(ITALC_BUILD_WIN32)
-	LINK_LIBRARIES(-ladvapi32)
-ENDIF(ITALC_BUILD_WIN32)
-
-SET(VH_WINRC "${CMAKE_CURRENT_BINARY_DIR}/vnchooksrc.obj")
-ADD_CUSTOM_COMMAND(OUTPUT ${VH_WINRC}
-						COMMAND ${WINDRES}
-							-I${CMAKE_CURRENT_SOURCE_DIR}
-							-o${VH_WINRC}
-							-i${CMAKE_CURRENT_SOURCE_DIR}/winvnc/vnchooks/vnchooks.rc)
-
-ADD_LIBRARY(vnchooks MODULE
-				${CMAKE_CURRENT_SOURCE_DIR}/winvnc/vnchooks/VNCHooks.cpp
-				${CMAKE_CURRENT_SOURCE_DIR}/winvnc/vnchooks/SharedData.cpp
-				${VH_WINRC})
-SET_TARGET_PROPERTIES(vnchooks PROPERTIES PREFIX "")
-
-
-ADD_DEFINITIONS(-DAUTHSSP_EXPORTS -DULTRAVNC_ITALC_SUPPORT -D__USE_MINGW_ANSI_STDIO=1)
-SET(AUTHSSP_WINRC "${CMAKE_CURRENT_BINARY_DIR}/authssprc.obj")
-ADD_CUSTOM_COMMAND(OUTPUT ${AUTHSSP_WINRC}
-						COMMAND ${WINDRES}
-							-I${CMAKE_CURRENT_SOURCE_DIR}
-							-o${AUTHSSP_WINRC}
-							-i${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/authSSP.rc)
-
-ADD_LIBRARY(authSSP MODULE
-				${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/authSSP.cpp
-				${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/EventLogging.cpp
-				${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/GenClientServerContext.cpp
-				${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/vncAccessControl.cpp
-				${CMAKE_CURRENT_SOURCE_DIR}/addon/ms-logon/authSSP/vncSSP.cpp
-				${AUTHSSP_WINRC})
-TARGET_LINK_LIBRARIES(authSSP ItalcCore)
-SET_TARGET_PROPERTIES(authSSP PROPERTIES PREFIX "")
-
-
diff --git a/ica/win32/addon/logger/logmessages.dsw b/ica/win32/addon/logger/logmessages.dsw
deleted file mode 100644
index 3b312d3..0000000
--- a/ica/win32/addon/logger/logmessages.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "logmessages"=".\logmessages.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/logger/messages.h b/ica/win32/addon/logger/messages.h
deleted file mode 100644
index 1ffe922..0000000
--- a/ica/win32/addon/logger/messages.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-//  Values are 32 bit values laid out as follows:
-//
-//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
-//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
-//  +---+-+-+-----------------------+-------------------------------+
-//  |Sev|C|R|     Facility          |               Code            |
-//  +---+-+-+-----------------------+-------------------------------+
-//
-//  where
-//
-//      Sev - is the severity code
-//
-//          00 - Success
-//          01 - Informational
-//          10 - Warning
-//          11 - Error
-//
-//      C - is the Customer code flag
-//
-//      R - is a reserved bit
-//
-//      Facility - is the facility code
-//
-//      Code - is the facility's status code
-//
-//
-// Define the facility codes
-//
-
-
-//
-// Define the severity codes
-//
-
-
-//
-// MessageId: MY_MSG1
-//
-// MessageText:
-//
-// 
-// %1
-//
-#define MY_MSG1                          0x00640001L
-
-//
-// MessageId: MY_MSG2
-//
-// MessageText:
-//
-// 
-// %1
-//
-#define MY_MSG2                          0x00640002L
-
-//
-// MessageId: MY_MSG3
-//
-// MessageText:
-//
-// 
-// %1
-//
-#define MY_MSG3                          0x00640003L
-
diff --git a/ica/win32/addon/logger/messages.mc b/ica/win32/addon/logger/messages.mc
deleted file mode 100644
index 357479e..0000000
--- a/ica/win32/addon/logger/messages.mc
+++ /dev/null
@@ -1,26 +0,0 @@
-FacilityNames=( MY_PROGS=100 )
-MessageID=1
-Facility=MY_PROGS
-SymbolicName=MY_MSG1
-Language=English
-
-%1
-.
-
-FacilityNames=( MY_PROGS=100 )
-MessageID=2
-Facility=MY_PROGS
-SymbolicName=MY_MSG2
-Language=English
-
-%1
-.
-
-FacilityNames=( MY_PROGS=100 )
-MessageID=3
-Facility=MY_PROGS
-SymbolicName=MY_MSG3
-Language=English
-
-%1
-.
diff --git a/ica/win32/addon/logger/messages.rc b/ica/win32/addon/logger/messages.rc
deleted file mode 100644
index a928b13..0000000
--- a/ica/win32/addon/logger/messages.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-LANGUAGE 0x9,0x1
-1 11 "MSG00001.bin"
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/.cvsignore b/ica/win32/addon/ms-logon/MSLogonACL/.cvsignore
deleted file mode 100644
index 8567875..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-buildtime.h
-*.ncb
-*.opt
-*.plg
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.cpp b/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.cpp
deleted file mode 100644
index 6a33a4d..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-
-#include <locale.h>
-#include <wchar.h>
-#include <tchar.h>
-#include "MSLogonACL.h"
-#include "vncImportACL.h"
-#include "vncExportACL.h"
-
-
-int _tmain(int argc, TCHAR *argv[])
-{
-	setlocale( LC_ALL, "" );
-	bool append = false;
-	int rc = 1;
-
-	if (argc > 1) {
-		if (_tcsicmp(argv[1], _T("/i")) == 0 || _tcsicmp(argv[1], _T("-i")) == 0) {
-			if (argc < 4) {
-				return 1;
-			} else {
-				if (_tcsicmp(argv[2], _T("/a")) == 0 || _tcsicmp(argv[2], _T("-a")) == 0)
-					append = true;
-				else if (_tcsicmp(argv[2], _T("/o")) == 0 || _tcsicmp(argv[2], _T("-o")) == 0)
-					; //override
-				else {
-					usage_(argv[0]);
-					return 1;
-				}
-				if (!_tfreopen(argv[3], _T("r"), stdin)) {
-					_tprintf(_T("Error opening file %s"), argv[3]);
-					usage_(argv[0]);
-					return 1;
-				}
-			}
-			rc = import_(append);
-		} else if (_tcsicmp(argv[1], _T("/e")) == 0 || _tcsicmp(argv[1], _T("-e")) == 0) {
-			if (argc > 2)
-				if (!_tfreopen(argv[2], _T("w"), stdout)) {
-					_tprintf(_T("Error opening file %s"), argv[2]);
-					usage_(argv[0]);
-					return 1;
-				}
-			rc = export_();
-		} else {
-			usage_(argv[0]);
-		}
-	} else {
-		usage_(argv[0]);
-	}
-	return rc;
-}
-
-int 
-import_(bool append){
-	int rc = 0;
-	vncImportACL importAcl;
-	PACL pACL = NULL; //?
-
-
-		if (append)
-			importAcl.GetOldACL();
-		if (importAcl.ScanInput())
-			rc |= 2;
-		pACL = importAcl.BuildACL();
-		importAcl.SetACL(pACL);
-
-		HeapFree(GetProcessHeap(), 0, pACL);
-
-	return rc;
-}
-
-int
-export_()
-{
-	PACL pACL = NULL;
-
-	vncExportACL exportAcl;
-	exportAcl.GetACL(&pACL);
-	exportAcl.PrintAcl(pACL);
-	if (pACL)
-		LocalFree(pACL);
-
-	return 0;
-}
-
-
-void usage_(const TCHAR *appname){
-	_tprintf(_T("Usage:\n%s /e <file>\n\t for exporting an ACL to an (optional) file.\n"), appname);
-	_tprintf(_T("%s /i <mode> <file>\n\t for importing an ACL where mode is either\n"), appname);
-	_tprintf(_T("\t/o for override or /a for append and file holds the ACEs.\n"));
-	_tprintf(_T("For the format of the ACEs first configure some groups/users\n"));
-	_tprintf(_T("with the graphical VNC Properties and then export the ACL.\n"));
-	_tprintf(_T("The computer name can be replaced by a \".\" (a dot),\n"));
-	_tprintf(_T("the computer's domain name by \"..\" (two dots).\n"));
-}
-
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.dsw b/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.dsw
deleted file mode 100644
index 031dd50..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GEL�SCHT WERDEN!
-
-###############################################################################
-
-Project: "MSLogonACL"=".\MSLogonACL.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.h b/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.h
deleted file mode 100644
index e4e585b..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-/*
- *  MSLogonACL.h
- */
-
-void usage_(const TCHAR *appname);
-int export_();
-int import_(bool append);
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.rc b/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.rc
deleted file mode 100644
index a4dc1d7..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/MSLogonACL.rc
+++ /dev/null
@@ -1,116 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-#if isRC == 1
-#include "buildtime.h" // defines macro BUILDTIME
-            VALUE "Buildtime", BUILDTIME
-#endif
-            VALUE "Comments", "Imports/exports ACL for UltraVNC's MS-Logon II\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MSLogonACL\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "MSLogonACL\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "MSLogonACL.exe\0"
-            VALUE "ProductName", "UltraVNC MSLogonACL\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/buildtime.h b/ica/win32/addon/ms-logon/MSLogonACL/buildtime.h
deleted file mode 100644
index 71dc4e4..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/buildtime.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-#define BUILDTIME "Jan 10 2011" " " "21:27:14" "\0"
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/buildtime.in b/ica/win32/addon/ms-logon/MSLogonACL/buildtime.in
deleted file mode 100644
index 8df4748..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/buildtime.in
+++ /dev/null
@@ -1,2 +0,0 @@
-#define BUILDTIMEMACRO #define BUILDTIME __DATE__ " " __TIME__ "\0"
-BUILDTIMEMACRO
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/resource.h b/ica/win32/addon/ms-logon/MSLogonACL/resource.h
deleted file mode 100644
index e0c1b03..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by MSLogonACL.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
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.cpp b/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.cpp
deleted file mode 100644
index 9d8d08f..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. All Rights Reserved.
-//  Based on Felix Kasza's DumpACL (http://win32.mvps.org/security/dumpacl.html).
-//
-//  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://ultravnc.sourceforge.net/
-#include <wchar.h>
-#include <tchar.h>
-#include "vncExportACL.h"
-
-// Get ACL from regkey HKLM\Software\ORL\WinVNC3\ACL
-bool vncExportACL::GetACL(PACL *pACL){
-	HKEY hk = NULL; 
-	DWORD dwValueLength = SECURITY_DESCRIPTOR_MIN_LENGTH;
-	
-	_ftprintf(stderr, _T("== Entering GetACL\n"));
-	__try{
-		
-		if (ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE,
-			_T("Software\\ORL\\WinVNC3"),
-			0, KEY_QUERY_VALUE, &hk )){
-			_ftprintf(stderr, _T("== Error %d: RegOpenKeyEx\n"), GetLastError());
-			__leave;
-		}
-		// Read the ACL value from the VNC registry key
-		// First call to RegQueryValueEx just gets the buffer length.
-		if (ERROR_SUCCESS != RegQueryValueEx(hk,	// subkey handle 
-            _T("ACL"),				// value name 
-            0,                      // must be zero 
-            0,						// value type , not needed here
-			NULL,					// 
-            &dwValueLength)){       // length of value data 
-			_ftprintf(stderr, _T("== Error %d: RegQueryValueEx 1\tValueLength = %d\n"), 
-				GetLastError(), dwValueLength);
-			__leave;
-		}
-		*pACL = (PACL) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwValueLength);
-		
-		if (ERROR_SUCCESS != RegQueryValueEx(hk,	// subkey handle 
-            _T("ACL"),								// value name 
-            0,										// must be zero 
-            0,										// value type 
-			(LPBYTE) *pACL,
-            &dwValueLength)){						// length of value data 
-			_ftprintf(stderr, _T("== Error %d: RegQueryValueEx 2\n"), GetLastError());
-			__leave;
-		}
-		_ftprintf(stderr, _T("== RegQueryValueEx passed\tdwValueLength = %d\n"), dwValueLength);
-
-	} __finally {
-		if (hk)
-			RegCloseKey(hk); 
-	}
-	return true;
-}
-
-
-
-const TCHAR *vncExportACL::SidToText( PSID psid )
-{
-	// S-rev- + SIA + subauthlen*maxsubauth + terminator
-	static TCHAR buf[15 + 12 + 12*SID_MAX_SUB_AUTHORITIES + 1];
-	TCHAR *p = &buf[0];
-	PSID_IDENTIFIER_AUTHORITY psia;
-	DWORD numSubAuths, i;
-
-	// Validate the binary SID.
-
-	if (!IsValidSid(psid))
-		return FALSE;
-
-	psia = GetSidIdentifierAuthority(psid);
-
-	p = buf;
-	p += _sntprintf(p, &buf[sizeof buf] - p, _T("S-%lu-"), 0x0f & *((byte *)psid));
-
-	if ((psia->Value[0] != 0) || (psia->Value[1] != 0))
-		p += _sntprintf( p, &buf[sizeof buf] - p, _T("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
-			(USHORT) psia->Value[0], (USHORT) psia->Value[1],
-			(USHORT) psia->Value[2], (USHORT) psia->Value[3],
-			(USHORT) psia->Value[4], (USHORT) psia->Value[5] );
-	else
-		p += _sntprintf(p, &buf[sizeof buf] - p, _T("%lu"), (ULONG) (psia->Value[5]) +
-			(ULONG) (psia->Value[4] << 8) + (ULONG) (psia->Value[3] << 16) +
-			(ULONG) (psia->Value[2] << 24));
-
-	// Add SID subauthorities to the string.
-
-	numSubAuths = *GetSidSubAuthorityCount(psid);
-	for (i = 0; i < numSubAuths; ++ i)
-		p += _sntprintf(p, &buf[sizeof buf] - p, _T("-%lu"), *GetSidSubAuthority(psid, i));
-
-	return buf;
-}
-
-void vncExportACL::PrintSid(PSID psid)
-{
-	TCHAR name[256], domain[256];
-	DWORD cbname = sizeof name, cbdomain = sizeof domain, rc;
-	SID_NAME_USE sidUse;
-
-	//!! next line has hardcoded server name !!
-	// NULL server name is usually appropriate, though.
-	if (LookupAccountSid(NULL, psid, name, &cbname, domain, &cbdomain, &sidUse))
-	{
-		//Todo: Check if WellKnownSID and reserve special names for them.
-
-/*		switch ( sidUse )
-		{
-			case SidTypeWellKnownGroup:	type = "well-known group"; break;
-			default:					type = "bad sidUse value"; break;
-		}
-*/
-		LPWKSTA_INFO_100 wkstainfo = NULL;
-		NET_API_STATUS nStatus;
-		TCHAR langroup[MAXLEN];
-		TCHAR computername[MAXLEN];
-
-		nStatus = NetWkstaGetInfo( 0 , 100 , (LPBYTE *) &wkstainfo);
-		if (nStatus == NERR_Success){
-			_tcsncpy(langroup, wkstainfo->wki100_langroup, MAXLEN);
-			_tcsncpy(computername, wkstainfo->wki100_computername, MAXLEN);
-			langroup[MAXLEN - 1] = _T('\0');
-			computername[MAXLEN - 1] = _T('\0');
-			// replace computername with a dot
-			if (_tcsicmp(computername, domain) == 0)
-				_tcscpy(domain,_T("."));
-			else if (_tcsicmp(langroup, domain) == 0)
-				_tcscpy(domain, _T(".."));
-		}
-		else
-			_tprintf(_T("NetWkstaGetInfo() returned %lu \n"), wkstainfo);
-
-		NetApiBufferFree(wkstainfo);
-		wkstainfo = NULL;
-
-		// If domain or username contains whitespace, print enclosing quotes
-		if (_tcschr(domain, _T(' ')) || _tcschr(name, _T(' ')))
-			_tprintf(_T("\"%s%s%s\"\n"), domain, (domain == 0 || *domain == _T('\0'))? _T(""): _T("\\"), name);
-		else
-			_tprintf(_T("%s%s%s\n"), domain, (domain == 0 || *domain == _T('\0'))? _T(""): _T("\\"), name);
-	}
-	else
-	{
-		rc = GetLastError();
-		_tprintf(_T("[%s] *** error %lu\n"), SidToText( psid ), rc);
-	}
-}
-
-void vncExportACL::PrintAce(int index, PACL acl){
-
-	ACE_HEADER *ace;
-	TCHAR *type;
-	PSID psid;
-
-	if (!GetAce(acl, index, (void **) &ace)) {
-		_tprintf(_T("DACL, entry %d: GetAce() failed, gle == %lu\n"),
-			index, GetLastError());
-		return;
-	}
-
-	switch ( ace->AceType ) {
-		case ACCESS_ALLOWED_ACE_TYPE:
-			type = _T("allow");
-			psid = &((ACCESS_ALLOWED_ACE *) ace)->SidStart;
-			break;
-		case ACCESS_DENIED_ACE_TYPE:
-			type = _T("deny");
-			psid = &((ACCESS_DENIED_ACE *) ace)->SidStart;
-			break;
-		default:
-			type = _T("invalid");
-			psid = &((ACCESS_ALLOWED_ACE *) ace)->SidStart;
-			break;
-	}
-	_tprintf(_T("%s\t"), type);
-
-	_tprintf(_T("0x%08lX\t"), ((ACCESS_ALLOWED_ACE *) ace)->Mask);
-
-	PrintSid( psid );
-}
-
-
-
-void vncExportACL::PrintAcl(PACL acl)
-{
-	DWORD i;
-	ACL_SIZE_INFORMATION aci;
-
-	if ( acl == 0 )
-		return;
-
-	if (!GetAclInformation( acl, &aci, sizeof aci, AclSizeInformation))	{
-		_tprintf(_T("GAI(): gle == %lu\n"), GetLastError());
-		return;
-	}
-
-	for ( i = 0; i < aci.AceCount; ++ i )
-		PrintAce(i, acl);
-
-}
-
-
-
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.h b/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.h
deleted file mode 100644
index ebfd788..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/vncExportACL.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-/* 
- *  vncExportACL.h
- */
-
-#define _WIN32_WINNT	0x0500
-#define WINVER			0x0500
-
-#include <windows.h>
-#include <aclapi.h>
-#include <stdio.h>
-#include <string.h>
-#include <lm.h>
-
-#define MAXLEN 256
-#define lenof(a) (sizeof(a) / sizeof((a)[0]) )
-
-class vncExportACL{
-public:
-	// returns the address of a !!static!!, non-thread-local, buffer with
-	// the text representation of the SID that was passed in
-	const TCHAR *SidToText( PSID psid );
-	
-	// Translates a SID and terminates it with a linefeed. No provision is
-	// made to dump the SID in textual form if LookupAccountSid() fails.
-	void PrintSid( PSID psid );
-	
-	// Displays the index-th (0-based) ACE from ACL
-	void PrintAce(int index, PACL acl);
-	
-	// Dumps an entire ACL
-	void PrintAcl(PACL acl);
-	
-	bool GetACL(PACL *pACL);
-	
-};
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.cpp b/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.cpp
deleted file mode 100644
index 63c0d9d..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.cpp
+++ /dev/null
@@ -1,498 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-#include <wchar.h>
-#include <tchar.h>
-#include "vncImportACL.h"
-
-vncImportACL::vncImportACL(){
-	lastAllowACE = NULL;
-	lastDenyACE = NULL;
-}
-
-vncImportACL::~vncImportACL(){
-	_ftprintf(stderr, _T("deleting ACE_DATA linked lists\n"));
-	ACE_DATA *tmp = NULL;
-	for (ACE_DATA *i = lastDenyACE; i != NULL; i = tmp){
-		if (i->pSID)
-			delete i->pSID;
-		tmp = i->next;
-		delete i;
-	}
-	for (ACE_DATA *j = lastAllowACE; j != NULL; j = tmp){
-		if (j->pSID)
-			delete j->pSID;
-		tmp = j->next;
-		delete j;
-	}
-
-}
-
-void vncImportACL::GetOldACL(){
-	PACL pOldACL = NULL;
-	ACL_SIZE_INFORMATION asi;
-	HKEY hk = NULL; 
-	DWORD dwValueLength = SECURITY_DESCRIPTOR_MIN_LENGTH;
-	
-	__try{
-		
-		if (ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE,
-			_T("Software\\ORL\\WinVNC3"),
-			0, KEY_QUERY_VALUE, &hk )){
-			__leave;
-		}
-		// Read the ACL value from the VNC registry key
-		// First call to RegQueryValueEx just gets the buffer length.
-		if (ERROR_SUCCESS != RegQueryValueEx(hk,	// subkey handle 
-            _T("ACL"),					// value name 
-            0,                      // must be zero 
-            0,						// value type , not needed here
-			NULL,					// 
-            &dwValueLength)){       // length of value data 
-			__leave;
-		}
-		pOldACL = (PACL) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwValueLength);
-		
-		if (ERROR_SUCCESS != RegQueryValueEx(hk,	// subkey handle 
-            _T("ACL"),					// value name 
-            0,										// must be zero 
-            0,										// value type 
-			(LPBYTE) pOldACL,
-            &dwValueLength)){						// length of value data 
-			__leave;
-		}
-
-	} __finally {
-		if (hk)
-			RegCloseKey(hk); 
-	}
-
-	if ( pOldACL == NULL )
-		return;
-
-	if (!GetAclInformation( pOldACL, &asi, sizeof asi, AclSizeInformation))	{
-		_ftprintf(stderr, _T("GAI(): gle == %lu\n"), GetLastError());
-		return;
-	}
-
-	for (DWORD i = 0; i < asi.AceCount; ++ i)
-		ReadAce(i, pOldACL);
-
-	HeapFree(GetProcessHeap(), 0, pOldACL);
-}
-
-void vncImportACL::ReadAce(int index, PACL pACL){
-	ACE_HEADER *ace;
-	//char *type;
-	//PSID psid;
-	ACE_DATA * pACEdata;
-
-	if (!GetAce( pACL, index, (void **) &ace)) {
-		_ftprintf(stderr, _T("DACL, entry %d: GetAce() failed, gle == %lu\n"),
-			index, GetLastError());
-		return;
-	}
-
-	pACEdata = new ACE_DATA;
-	switch ( ace->AceType ) {
-		case ACCESS_ALLOWED_ACE_TYPE:
-			pACEdata->type = ACCESS_ALLOWED;
-			pACEdata->pSID = CopySID(&((ACCESS_ALLOWED_ACE *) ace)->SidStart);
-			pACEdata->mask = ((ACCESS_ALLOWED_ACE *) ace)->Mask;
-			pACEdata->next = lastAllowACE;
-			lastAllowACE   = pACEdata;
-			break;
-		case ACCESS_DENIED_ACE_TYPE:
-			pACEdata->type = ACCESS_DENIED;
-			pACEdata->pSID = CopySID(&((ACCESS_DENIED_ACE *) ace)->SidStart);
-			pACEdata->mask = ((ACCESS_DENIED_ACE *) ace)->Mask;
-			pACEdata->next = lastDenyACE;
-			lastDenyACE   = pACEdata;
-			break;
-		default:
-			_ftprintf(stderr, _T("Error: Unknown ACE type\n"));
-			delete pACEdata;
-			break;
-	}
-}
-
-PSID vncImportACL::CopySID(PSID pSID){
-	PSID pNewSID = NULL;
-	DWORD sidLength = 0;
-
-	if (IsValidSid(pSID)){
-		sidLength = GetLengthSid(pSID);
-		pNewSID = (PSID) new char[sidLength];
-		CopySid(sidLength, pNewSID, pSID);
-	}
-	return pNewSID;
-}
-
-int vncImportACL::ScanInput(){
-	int rc = 0;
-	vncScanInput scanInput;
-
-	do {
-		TCHAR linebuf[MAXLEN];
-		TCHAR *line = linebuf;
-		TCHAR *token[3];
-		TCHAR accesstype[MAXLEN];
-		TCHAR accessmaskstring[MAXLEN];
-		TCHAR domainaccount[MAXLEN];
-		DWORD accessmask = 0;
-		token[0] = accesstype;
-		token[1] = accessmaskstring;
-		token[2] = domainaccount;
-
-		if (!scanInput.GetLine(line)) {
-			rc |= 1;
-			break;
-		}
-		scanInput.RemoveNewline(line);
-		scanInput.RemoveComment(line);
-		if (scanInput.isEmptyLine(line))
-			continue;
-		if (scanInput.Tokenize(line, token)
-			&& _stscanf(accessmaskstring, _T("%x"), &accessmask) == 1) {
-			FillAceData(accesstype, accessmask, domainaccount);
-		} else {
-			_tprintf(_T("Error tokenizing line\n"));
-			rc |= 2;
-		}
-	} while(!feof(stdin));
-	return rc;
-}
-
-PACL vncImportACL::BuildACL(){
-	PACL pACL = NULL;
-	// Need canonical order and normalization??
-	// Solution canonical order: aceAllowStart and aceDenyStart?
-	// Solution normalization: Check for multiple occurrance of SID
-	// in allow list and deny list and merge them.
-	long aclSize = 8; // For ACL header
-
-	for (ACE_DATA *i = lastDenyACE; i != NULL; i = i->next){
-		aclSize += GetLengthSid(i->pSID) + sizeof(ACCESS_DENIED_ACE) - sizeof(DWORD);
-	}
-	for (ACE_DATA *j = lastAllowACE; j != NULL; j = j->next){
-		aclSize += GetLengthSid(j->pSID) + sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD);
-	}
-
-	pACL = (PACL) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,	aclSize);
-	
-	// Initialize the new ACL.
-	if (InitializeAcl(pACL, aclSize, ACL_REVISION)) {
-		// Add the access-denied ACEs to the ACL.
-		for (ACE_DATA *i = lastDenyACE; i != NULL; i = i->next){
-			//Todo: add error handling.
-			AddAccessDeniedAce(pACL, ACL_REVISION, i->mask, i->pSID);
-		}
-		for (ACE_DATA *j = lastAllowACE; j != NULL; j = j->next){
-			//Todo: add error handling.
-			AddAccessAllowedAce(pACL, ACL_REVISION, j->mask, j->pSID);
-		}
-	}
-	return pACL;
-}
-
-bool vncImportACL::SetACL(PACL pACL){
-	HKEY hk = NULL; 
-	bool isSaveOK = false;
-	DWORD  dwDisposition;
-
-    ACL_SIZE_INFORMATION AclInformation = {0, 0, 0};
-	DWORD nAclInformationLength = sizeof(AclInformation);
-
-	// Todo: Better error handling
-	if (pACL)
-		GetAclInformation(pACL, &AclInformation, nAclInformationLength, AclSizeInformation);
-
-	__try{
-		//if (ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE,
-		//	_T("Software\\ORL\\WinVNC3"),
-		//	0, KEY_SET_VALUE, &hk )){
-		//	_ftprintf(stderr, _T("Error %d: RegOpenKeyEx\n"), GetLastError());
-		//	__leave;
-		//}
-		
-		if (ERROR_SUCCESS != RegCreateKeyEx( HKEY_LOCAL_MACHINE,
-			_T("Software\\ORL\\WinVNC3"),
-			0, NULL, 0, KEY_SET_VALUE, NULL, &hk, &dwDisposition )){
-			_ftprintf(stderr, _T("Error %d: RegOpenKeyEx\n"), GetLastError());
-			__leave;
-		}
-
-		// Add the ACL value to the VNC registry key
-		if (ERROR_SUCCESS != RegSetValueEx(hk,
-            _T("ACL"),
-            0,
-            REG_BINARY,
-			(LPBYTE) pACL,
-            AclInformation.AclBytesInUse)){
-			_ftprintf(stderr, _T("Error %d: RegSetValueEx\n"), GetLastError());
-			__leave;
-		}
-		isSaveOK = true;
-		_ftprintf(stderr, _T("RegSetValueEx passed\n"));
-	} __finally {
-		if (hk)
-			RegCloseKey(hk); 
-	}
-	return isSaveOK;
-}
-
-bool vncImportACL::FillAceData(const TCHAR *type, 
-				 DWORD mask, 
-				 const TCHAR *user){
-	ACE_TYPE acetype;
-	TCHAR *domainaccount = NULL;
-	PSID pSID = NULL;
-
-	//type
-	if (_tcsicmp(type, _T("allow")) == 0)
-		acetype = ACCESS_ALLOWED;
-	else if (_tcsicmp(type, _T("deny")) == 0)
-		acetype = ACCESS_DENIED;
-	else {
-		_ftprintf(stderr, _T("error with ACE type, neither 'allow' nor 'deny'\n"));
-		return false;
-	}
-
-	//mask
-	mask &= ALL_RIGHTS;
-
-	// if name starts with ".\", replace the dot with the computername.
-	// if name starts with "..\", replace the dots with the domainname.
-	if (_tcsncmp(user, _T(".\\"), 2) == 0)
-		domainaccount = AddComputername(user);
-	else if  (_tcsncmp(user, _T("..\\"), 2) == 0)
-		domainaccount = AddDomainname(user);
-	else {
-		domainaccount = new TCHAR[_tcslen(user)+1];
-		_tcscpy(domainaccount,user);
-	}
-	pSID = GetSID(domainaccount);
-	if (!pSID)
-		return false;
-	_tprintf(_T("account: %s, mask: %x, type: %s\n"), 
-		domainaccount, mask, acetype == ACCESS_ALLOWED ? _T("allow") : _T("deny"));
-	ACE_DATA *ace = new ACE_DATA;
-	ace->type = acetype;
-	ace->mask = mask;
-	ace->pSID = pSID;
-	switch (acetype){
-	case ACCESS_ALLOWED:
-		ace->next = lastAllowACE;
-		lastAllowACE = ace;
-		break;
-	case ACCESS_DENIED:
-		ace->next = lastDenyACE;
-		lastDenyACE = ace;
-		break;
-	default:
-		break;
-	}
-
-	delete [] domainaccount;
-	domainaccount = NULL;
-
-	return true; // Needs better error signalling.
-}
-
-PSID vncImportACL::GetSID(const TCHAR *domainaccount){
-	PSID pSid = NULL;
-	unsigned long ulDomLen = 0;
-	unsigned long ulSidLen = 0;
-	SID_NAME_USE peUse;
-	TCHAR *domain = NULL;
-
-	// Get accounts's SID
-	// First call to LookupAccountName is expected to fail.
-	// Sets pSid and domain size
-	LookupAccountName(NULL, domainaccount, pSid, &ulSidLen,
-		domain, &ulDomLen, &peUse);
-	pSid = (PSID)new TCHAR[ulSidLen];
-	domain = new TCHAR[ulDomLen];
-	LookupAccountName(NULL, domainaccount,
-		pSid, &ulSidLen, domain, &ulDomLen, &peUse);
-	if (!IsValidSid(pSid)){
-		_ftprintf(stderr, _T("%s: SID not valid.\n"), domainaccount);
-		delete [] pSid;
-				pSid = NULL;
-	}
-	delete [] domain;
-
-	return pSid;
-}
-
-// SplitString splits a string 'input' on the first occurence of char 'separator'
-// into string 'head' and 'tail' (removing the separator).
-// If separator is not found, head = "" and tail = input.
-const TCHAR * vncImportACL::SplitString(const TCHAR *input, TCHAR separator, TCHAR *head){
-	const TCHAR * tail;
-	int l;
-
-	tail = _tcschr(input, separator);
-	if (tail){
-		l = tail - input;
-		// get rid of separator
-		tail = tail + 1; 
-		_tcsncpy(head, input, l);
-		head[l] = _T('\0');
-	} else {
-		tail   = input;
-		head[0] = _T('\0');
-	}
-	return tail;
-}
-
-TCHAR *vncImportACL::AddComputername(const TCHAR *user){
-	unsigned long buflen = MAXLEN;
-	TCHAR computername[MAXLEN];
-	if (!GetComputerName(computername, &buflen)){
-		_ftprintf(stderr, _T("GetComputerName error %i\n"), GetLastError());
-		return NULL;
-	}
-	_ftprintf(stderr, _T("Detected computername = %s\n"), computername);
-	// Length of computername and user minus beginning dot plus terminating '\0'.
-	TCHAR *domainaccount = new TCHAR[_tcslen(computername) + _tcslen(user)];
-	_tcscpy(domainaccount, computername);
-	_tcscat(domainaccount, user + 1);
-
-	return domainaccount;
-}
-
-TCHAR *vncImportACL::AddDomainname(const TCHAR *user){
-	unsigned long buflen = MAXLEN;
-	TCHAR domain[MAXLEN * sizeof(wchar_t)];
-	LPWKSTA_INFO_100 wkstainfo = NULL;
-	NET_API_STATUS nStatus;
-
-	nStatus = NetWkstaGetInfo( 0 , 100 , (LPBYTE *) &wkstainfo);
-	if (nStatus == NERR_Success)
-		_tcsncpy(domain, wkstainfo->wki100_langroup, MAXLEN);
-	else
-		_ftprintf(stderr, _T("NetWkstaGetInfo() returned %lu \n"), wkstainfo);
-	domain[MAXLEN - 1] = _T('\0');
-	_ftprintf(stderr, _T("Detected domain = %s\n"),domain);
-	NetApiBufferFree(wkstainfo);
-	wkstainfo = NULL;
-
-	// Length of domainname and user minus beginning dots plus terminating '\0'.
-	TCHAR *domainaccount = new TCHAR[_tcslen(domain) + _tcslen(user) - 1];
-	_tcscpy(domainaccount, domain);
-	_tcscat(domainaccount, user + 2);
-
-	return domainaccount;
-}
-
-// vncScanInput struct
-
-bool vncScanInput::GetLine(TCHAR *line){
-	line[0] = _T('\0');
-	_fgetts(line, MAXLEN, stdin);
-	return ferror(stdin) ? false : true;
-}
-
-bool vncScanInput::isEmptyLine(TCHAR *line){
-	for (unsigned int i = 0; i < _tcslen(line); i++)
-		if (line[i] != _T(' ') && line[i] != _T('\t'))
-			return false;
-	return true;
-}
-
-void vncScanInput::RemoveComment(TCHAR *line){
-	if (TCHAR *comment = _tcschr(line, _T(';')))
-		*comment = _T('\0');
-}
-
-void vncScanInput::RemoveNewline(TCHAR *line){
-	if (line[_tcslen(line)-1] == _T('\n'))
-		line[_tcslen(line)-1] = _T('\0');
-}
-
-bool vncScanInput::Tokenize(const TCHAR *line, TCHAR **token){
-	int tokenCount = 0;
-
-	// Loop until the end of line or until 4th token found
-	for (; _tcslen(line) > 0 && tokenCount < 4;) {
-		int len = 0;
-		switch (*line) {
-		case _T(' ') :
-		case _T('\t'): 
-			line++; // Eat whitespace
-			break;
-		case _T('"') : 
-			line++; // Eat opening quote
-			len = GetQuoteLength(line);
-			tokenCount = AddToken(token, tokenCount, &line, len);
-			line++; // Eat closing quote
-			break;
-		default:
-			len = GetWordLength(line);
-			tokenCount = AddToken(token, tokenCount, &line, len);
-			break;
-		}
-	}
-	return (tokenCount == 3 && _tcslen(line) == 0) ? true : false;
-}
-
-int vncScanInput::GetWordLength(const TCHAR *line){
-	int length = 0;
-	int blength = 0;
-	int tlength = 0;
-	
-	const TCHAR *nextblank = _tcschr(line, _T(' '));
-	const TCHAR *nexttab   = _tcschr(line, _T('\t'));
-	if (nextblank) 
-		blength = nextblank - line;
-	if (nexttab)
-		tlength = nexttab - line;
-	if (nextblank && nexttab) // Found blank and tab
-		length = __min(blength, tlength);
-	else if (nextblank) // Found only a blank
-		length = blength;
-	else if (nexttab) // Found only a tab
-		length = tlength;
-	if (!length) // Found neither blank nor tab
-		length = _tcslen(line);
-	return length;
-}
-
-int vncScanInput::GetQuoteLength(const TCHAR *line){
-	const TCHAR *eoq = _tcschr(line, _T('"'));
-	int len = 0;
-	if (eoq)
-		len = eoq - line;
-	return len;
-}
-
-int vncScanInput::AddToken(TCHAR **token, int tokenCount, const TCHAR **line, int len){
-	if (len) {
-		if (tokenCount < 3) {
-			_tcsncpy(token[tokenCount], *line, len);
-			token[tokenCount][len] = _T('\0');
-		}
-		*line += len; // Eat token
-		tokenCount++;
-	}
-	return tokenCount;
-}
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.h b/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.h
deleted file mode 100644
index 3058f7f..0000000
--- a/ica/win32/addon/ms-logon/MSLogonACL/vncImportACL.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-/*
- * vncImportACL.h: 
- */
-#define _WIN32_WINNT	0x0500	//??
-#define WINVER		0x0500	//??
-
-#include <windows.h>
-#include <aclapi.h>
-#include <stdio.h>
-#include <string.h>
-#include <lm.h>
-
-#define MAXLEN 256
-#define lenof(a) (sizeof(a) / sizeof((a)[0]) )
-
-
-#define ViewOnly	1
-#define Interact	2
-#define ALL_RIGHTS (ViewOnly | Interact)
-
-class vncImportACL {
-private:
-	enum ACE_TYPE {
-		ACCESS_ALLOWED,
-			ACCESS_DENIED
-	};
-	
-	typedef struct _ACE_DATA {
-		ACE_TYPE type;
-		DWORD mask;
-		PSID pSID;
-		struct _ACE_DATA *next;
-	} ACE_DATA;
-
-	ACE_DATA *lastAllowACE;
-	ACE_DATA *lastDenyACE;
-
-public:	
-	vncImportACL();
-	~vncImportACL();
-
-	void GetOldACL();
-	void ReadAce(int index, PACL pACL);
-	PSID CopySID(PSID pSID);
-	int ScanInput();
-	bool FillAceData(const TCHAR *accesstype, 
-		DWORD accessmask, 
-		const TCHAR *domainaccount);
-	PSID GetSID(const TCHAR *domainaccount);
-	PACL BuildACL(void);
-	bool SetACL(PACL pACL);
-	const TCHAR * SplitString(const TCHAR *input, TCHAR separator, TCHAR *head);
-	TCHAR *AddComputername(const TCHAR *user);
-	TCHAR *AddDomainname(const TCHAR *user);
-};
-
-struct vncScanInput{
-	bool isEmptyLine(TCHAR *line);
-	void RemoveComment(TCHAR *line);
-	void RemoveNewline(TCHAR *line);
-	int GetQuoteLength(const TCHAR *line);
-	int GetWordLength(const TCHAR *line);
-	bool GetLine(TCHAR *line);
-	bool Tokenize(const TCHAR *line, TCHAR **tokens);
-	int AddToken(TCHAR **token, int tokenCount, const TCHAR **line, int len);
-};
diff --git a/ica/win32/addon/ms-logon/authSSP/.cvsignore b/ica/win32/addon/ms-logon/authSSP/.cvsignore
deleted file mode 100644
index 8567875..0000000
--- a/ica/win32/addon/ms-logon/authSSP/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-buildtime.h
-*.ncb
-*.opt
-*.plg
diff --git a/ica/win32/addon/ms-logon/authSSP/Auth_Seq.h b/ica/win32/addon/ms-logon/authSSP/Auth_Seq.h
deleted file mode 100644
index 148e796..0000000
--- a/ica/win32/addon/ms-logon/authSSP/Auth_Seq.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. 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://ultravnc.sourceforge.net/
-
-typedef struct _AUTH_SEQ {
-   BOOL fInitialized;
-   BOOL fHaveCredHandle;
-   BOOL fHaveCtxtHandle;
-   CredHandle hcred;
-   struct _SecHandle hctxt;
-} AUTH_SEQ, *PAUTH_SEQ;
-
-typedef struct _Fn {
-ACCEPT_SECURITY_CONTEXT_FN       _AcceptSecurityContext;
-ACQUIRE_CREDENTIALS_HANDLE_FN    _AcquireCredentialsHandle;
-COMPLETE_AUTH_TOKEN_FN           _CompleteAuthToken;
-INITIALIZE_SECURITY_CONTEXT_FN   _InitializeSecurityContext;
-DELETE_SECURITY_CONTEXT_FN       _DeleteSecurityContext;
-FREE_CONTEXT_BUFFER_FN           _FreeContextBuffer;
-FREE_CREDENTIALS_HANDLE_FN       _FreeCredentialsHandle;
-QUERY_SECURITY_PACKAGE_INFO_FN   _QuerySecurityPackageInfo;
-IMPERSONATE_SECURITY_CONTEXT_FN  _ImpersonateSecurityContext;
-REVERT_SECURITY_CONTEXT_FN       _RevertSecurityContext;
-} Fn;
-
diff --git a/ica/win32/addon/ms-logon/authSSP/EventLogging.cpp b/ica/win32/addon/ms-logon/authSSP/EventLogging.cpp
deleted file mode 100644
index 12921a8..0000000
--- a/ica/win32/addon/ms-logon/authSSP/EventLogging.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//	Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-//
-#include "EventLogging.h"
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-#include "Logger.h"
-
-#else
-
-EventLogging::EventLogging()
-{
-	// returns a handle that links the source to the registry 
-	m_hEventLinker = RegisterEventSource(NULL,_T("UltraVnc"));
-
-}
-
-EventLogging::~EventLogging()
-{
-	// Releases the handle to the registry
-	DeregisterEventSource(m_hEventLinker);
-}
-
-
-
-void EventLogging::LogIt(WORD CategoryID, DWORD EventID, LPCTSTR *ArrayOfStrings,
-						 UINT NumOfArrayStr,LPVOID RawData,DWORD RawDataSize)
-{
-
-	// Writes data to the event log
-	ReportEvent(m_hEventLinker,EVENTLOG_INFORMATION_TYPE,CategoryID,
-		EventID,NULL,1,RawDataSize,ArrayOfStrings,RawData);	
-
-}
-
-
-void EventLogging::AddEventSourceToRegistry(LPCTSTR lpszSourceName)
-{
-    HKEY  hk;
-    DWORD dwData;
-    TCHAR szBuf[MAX_PATH];
-    TCHAR szKey[255] =_T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
-    TCHAR szServicePath[MAX_PATH];
-
-    lstrcat(szKey, _T("UltraVnc"));
-
-    if(RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hk) != ERROR_SUCCESS)
-    {
-        return;
-    }
-
-    if (GetModuleFileName(NULL, szServicePath, MAX_PATH))
-		{
-			TCHAR* p = _tcsrchr(szServicePath, '\\');
-			if (p == NULL) return;
-			*p = '\0';
-			_tcscat (szServicePath,_T("\\logmessages.dll"));
-		}
-    lstrcpy(szBuf, szServicePath);
-
-    // Add the name to the EventMessageFile subkey.
-    if(RegSetValueEx(hk,
-                     _T("EventMessageFile"),
-                     0,
-                     REG_EXPAND_SZ,
-                     (LPBYTE) szBuf,
-                     (lstrlen(szBuf) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hk);
-        return;
-    }
-
-    dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |EVENTLOG_INFORMATION_TYPE;
-    if(RegSetValueEx(hk,
-                     _T("TypesSupported"),
-                     0,
-                     REG_DWORD,
-                     (LPBYTE)&dwData,
-                     sizeof(DWORD)) != ERROR_SUCCESS)
-    {
-        
-    } RegCloseKey(hk);
-}
-
-#endif
-
-void LOG(long EventID, const TCHAR *format, ...) {
-    FILE *file;
-	TCHAR szMslogonLog[MAX_PATH];
-	LPCTSTR ps[3];
-	TCHAR textbuf[2 * MAXLEN] = _T("");
-	char texttowrite[2 * MAXLEN] = "";
-	TCHAR szTimestamp[MAXLEN] = _T("");
-	TCHAR szText[MAXLEN] = _T("");
-	SYSTEMTIME time;
-
-	va_list ap;
-	va_start(ap, format);
-	_vstprintf(szText, format, ap);
-	va_end(ap);
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	ilog( Info, szText );
-#else
-	ps[0] = szText;
-    EventLogging log;
-	log.AddEventSourceToRegistry(NULL);
-	log.LogIt(1,EventID, ps,1,NULL,0);
-	if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-	{
-		TCHAR *p = _tcsrchr(szMslogonLog, '\\');
-		if (p != NULL)
-		{
-			*p = '\0';
-			_tcscat (szMslogonLog,_T("\\mslogon.log"));
-		}
-	}
-	file = _tfopen(szMslogonLog, _T("a"));
-	if(file!=NULL) 
-	{
-		// Prepend timestamp to message
-		GetLocalTime(& time);
-		_stprintf(szTimestamp,_T("%.2d/%.2d/%d %.2d:%.2d:%.2d  "), 
-			time.wDay, time.wMonth, time.wYear, time.wHour, time.wMinute, time.wSecond);
-		_tcscpy(textbuf,szTimestamp);
-		_tcscat(textbuf,szText);
-
-		// Write ANSI
-#if defined UNICODE || defined _UNICODE
-		wcstombs(texttowrite, textbuf, 2 * MAXLEN);
-#else
-		strcpy(texttowrite, texttowrite);
-#endif
-		fwrite(texttowrite, sizeof(char), strlen(texttowrite),file);
-		fclose(file);
-	}
-#endif
-}
-  
diff --git a/ica/win32/addon/ms-logon/authSSP/EventLogging.h b/ica/win32/addon/ms-logon/authSSP/EventLogging.h
deleted file mode 100644
index b3e1261..0000000
--- a/ica/win32/addon/ms-logon/authSSP/EventLogging.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-
-#include <windows.h>
-#include <stdio.h>
-#include <lmcons.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <tchar.h>
-#include <lm.h>
-#include <stdio.h>
-#define SECURITY_WIN32
-#include <sspi.h>
-#ifndef SEC_I_COMPLETE_NEEDED
-#include <issperr.h>
-#include <time.h>
-#endif
-#ifndef __GNUC__
-#pragma hdrstop
-#endif
-#include <stdarg.h>
-
-#define MAXLEN 256
-#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-#define BUFSIZE 1024
-
-class EventLogging
-{
-public:
-	EventLogging();
-	virtual ~EventLogging();
-	virtual void LogIt(WORD CategoryID, DWORD EventID, LPCTSTR *ArrayOfStrings,
-		UINT NumOfArrayStr = 0,LPVOID RawData = NULL,DWORD RawDataSize = 0);
-	HANDLE m_hEventLinker;
-	void AddEventSourceToRegistry(LPCTSTR lpszSourceName);
-
-};
-
-void LOG(long EvenID, const TCHAR *format, ...);
diff --git a/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.cpp b/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.cpp
deleted file mode 100644
index 9009bb2..0000000
--- a/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//	Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-
-#include "GenClientServerContext.h"
-extern Fn fn;
-
-#define __try
-#define __leave goto cleanup
-#define __finally cleanup:
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 ) {
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-void UnloadSecurityDll(HMODULE hModule) {
-
-   if (hModule)
-      FreeLibrary(hModule);
-
-   fn._AcceptSecurityContext      = NULL;
-   fn._AcquireCredentialsHandle   = NULL;
-   fn._CompleteAuthToken          = NULL;
-   fn._DeleteSecurityContext      = NULL;
-   fn._FreeContextBuffer          = NULL;
-   fn._FreeCredentialsHandle      = NULL;
-   fn._InitializeSecurityContext  = NULL;
-   fn._QuerySecurityPackageInfo   = NULL;
-   fn._ImpersonateSecurityContext = NULL;
-   fn._RevertSecurityContext	  = NULL;
-}
-
-HMODULE LoadSecurityDll() {
-
-    HMODULE hModule;
-    BOOL    fAllFunctionsLoaded = FALSE; 
-	TCHAR   lpszDLL[MAXLEN];
-	OSVERSIONINFO VerInfo;
-
-	fn._AcceptSecurityContext      = NULL;
-	fn._AcquireCredentialsHandle   = NULL;
-	fn._CompleteAuthToken          = NULL;
-	fn._DeleteSecurityContext      = NULL;
-	fn._FreeContextBuffer          = NULL;
-	fn._FreeCredentialsHandle      = NULL;
-	fn._InitializeSecurityContext  = NULL;
-	fn._QuerySecurityPackageInfo   = NULL;
-	fn._ImpersonateSecurityContext = NULL;
-	fn._RevertSecurityContext	   = NULL;
-
-	// 
-	//  Find out which security DLL to use, depending on
-	//  whether we are on NT or Win95 or 2000 or XP or .NET Server
-	//  We have to use security.dll on Windows NT 4.0.
-	//  All other operating systems, we have to use Secur32.dll
-	// 
-	VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
-		return FALSE;
-
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-		VerInfo.dwMajorVersion == 4 &&
-		VerInfo.dwMinorVersion == 0){
-			lstrcpy (lpszDLL, _T("security.dll"));
-		} else {
-			lstrcpy (lpszDLL, _T("secur32.dll"));
-		}
-
-	hModule = LoadLibrary(lpszDLL);
-	if (!hModule)
-		return NULL;
-
-   __try {
-
-      fn._AcceptSecurityContext = (ACCEPT_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "AcceptSecurityContext");
-      if (!fn._AcceptSecurityContext)
-         __leave;
-
-#ifdef UNICODE
-      fn._AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN)
-            GetProcAddress(hModule, "AcquireCredentialsHandleW");
-#else
-      fn._AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN)
-            GetProcAddress(hModule, "AcquireCredentialsHandleA");
-#endif
-      if (!fn._AcquireCredentialsHandle)
-         __leave;
-
-      // CompleteAuthToken, ImpersonateSecurityContext and RevertSecurityContext
-	  // are not present on Windows 9x Secur32.dll
-      // Do not check for the availablity of the functions if it is NULL;
-      fn._CompleteAuthToken = (COMPLETE_AUTH_TOKEN_FN) 
-            GetProcAddress(hModule, "CompleteAuthToken");
-
-      fn._ImpersonateSecurityContext = (IMPERSONATE_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "ImpersonateSecurityContext");
-
-      fn._RevertSecurityContext = (REVERT_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "RevertSecurityContext");
-
-      fn._DeleteSecurityContext = (DELETE_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "DeleteSecurityContext");
-      if (!fn._DeleteSecurityContext)
-         __leave;
-
-      fn._FreeContextBuffer = (FREE_CONTEXT_BUFFER_FN) 
-            GetProcAddress(hModule, "FreeContextBuffer");
-      if (!fn._FreeContextBuffer)
-         __leave;
-
-      fn._FreeCredentialsHandle = (FREE_CREDENTIALS_HANDLE_FN) 
-            GetProcAddress(hModule, "FreeCredentialsHandle");
-      if (!fn._FreeCredentialsHandle)
-         __leave;
-
-#ifdef UNICODE
-      fn._InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN)
-            GetProcAddress(hModule, "InitializeSecurityContextW");
-#else
-      fn._InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "InitializeSecurityContextA");
-#endif
-      if (!fn._InitializeSecurityContext)
-         __leave;
-
-#ifdef UNICODE
-      fn._QuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN)
-            GetProcAddress(hModule, "QuerySecurityPackageInfoW");
-#else
-      fn._QuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN)
-            GetProcAddress(hModule, "QuerySecurityPackageInfoA");
-#endif
-      if (!fn._QuerySecurityPackageInfo)
-         __leave;
-
-      fAllFunctionsLoaded = TRUE;
-
-   } __finally {
-
-      if (!fAllFunctionsLoaded) {
-         UnloadSecurityDll(hModule);
-         hModule = NULL;
-      }
-
-   }
-   
-   return hModule;
-}
-
-BOOL GenClientContext(PAUTH_SEQ pAS, PSEC_WINNT_AUTH_IDENTITY pAuthIdentity,
-      PVOID pIn, DWORD cbIn, PVOID pOut, PDWORD pcbOut, PBOOL pfDone) {
-
-/*++
-
- Routine Description:
-
-   Optionally takes an input buffer coming from the server and returns
-   a buffer of information to send back to the server.  Also returns
-   an indication of whether or not the context is complete.
-
- Return Value:
-
-   Returns TRUE if successful; otherwise FALSE.
-
---*/ 
-
-   SECURITY_STATUS ss;
-   TimeStamp       tsExpiry;
-   SecBufferDesc   sbdOut;
-   SecBuffer       sbOut;
-   SecBufferDesc   sbdIn;
-   SecBuffer       sbIn;
-   ULONG           fContextAttr;
-
-   if (!pAS->fInitialized) {
-      ss = fn._AcquireCredentialsHandle(NULL, (SEC_CHAR *) _T("NTLM"), 
-            SECPKG_CRED_OUTBOUND, NULL, pAuthIdentity, NULL, NULL,
-            &pAS->hcred, &tsExpiry);
-      if (ss < 0) {
-         fprintf(stderr, "AcquireCredentialsHandle failed with %08X\n", (int) ss);
-         return FALSE;
-      }
-
-      pAS->fHaveCredHandle = TRUE;
-   }
-
-   // Prepare output buffer
-   sbdOut.ulVersion = 0;
-   sbdOut.cBuffers = 1;
-   sbdOut.pBuffers = &sbOut;
-
-   sbOut.cbBuffer = *pcbOut;
-   sbOut.BufferType = SECBUFFER_TOKEN;
-   sbOut.pvBuffer = pOut;
-
-   // Prepare input buffer
-   if (pAS->fInitialized)  {
-      sbdIn.ulVersion = 0;
-      sbdIn.cBuffers = 1;
-      sbdIn.pBuffers = &sbIn;
-
-      sbIn.cbBuffer = cbIn;
-      sbIn.BufferType = SECBUFFER_TOKEN;
-      sbIn.pvBuffer = pIn;
-   }
-
-   ss = fn._InitializeSecurityContext(&pAS->hcred, 
-         pAS->fInitialized ? &pAS->hctxt : NULL, NULL, 0, 0, 
-         SECURITY_NATIVE_DREP, pAS->fInitialized ? &sbdIn : NULL,
-         0, &pAS->hctxt, &sbdOut, &fContextAttr, &tsExpiry);
-   if (ss < 0)  { 
-      // Todo: Better error reporting.
-      return FALSE;
-   }
-
-   pAS->fHaveCtxtHandle = TRUE;
-
-   // If necessary, complete token
-   if (ss == SEC_I_COMPLETE_NEEDED || ss == SEC_I_COMPLETE_AND_CONTINUE) {
-
-      if (fn._CompleteAuthToken) {
-         ss = fn._CompleteAuthToken(&pAS->hctxt, &sbdOut);
-         if (ss < 0)  {
-            fprintf(stderr, "CompleteAuthToken failed with %08X\n", (int) ss);
-            return FALSE;
-         }
-      }
-      else {
-         fprintf (stderr, "CompleteAuthToken not supported.\n");
-         return FALSE;
-      }
-   }
-
-   *pcbOut = sbOut.cbBuffer;
-
-   if (!pAS->fInitialized)
-      pAS->fInitialized = TRUE;
-
-   *pfDone = !(ss == SEC_I_CONTINUE_NEEDED 
-         || ss == SEC_I_COMPLETE_AND_CONTINUE );
-
-   return TRUE;
-}
-
-BOOL GenServerContext(PAUTH_SEQ pAS, PVOID pIn, DWORD cbIn, PVOID pOut,
-      PDWORD pcbOut, PBOOL pfDone) {
-
-/*++
-
- Routine Description:
-
-    Takes an input buffer coming from the client and returns a buffer
-    to be sent to the client.  Also returns an indication of whether or
-    not the context is complete.
-
- Return Value:
-
-    Returns TRUE if successful; otherwise FALSE.
-
---*/ 
-
-   SECURITY_STATUS ss;
-   TimeStamp       tsExpiry;
-   SecBufferDesc   sbdOut;
-   SecBuffer       sbOut;
-   SecBufferDesc   sbdIn;
-   SecBuffer       sbIn;
-   ULONG           fContextAttr;
-
-   if (!pAS->fInitialized)  {
-      
-      ss = fn._AcquireCredentialsHandle(NULL, (SEC_CHAR *) _T("NTLM"), 
-            SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL, &pAS->hcred, 
-            &tsExpiry);
-      if (ss < 0) {
-         fprintf(stderr, "AcquireCredentialsHandle failed with %08X\n", (int) ss);
-         return FALSE;
-      }
-
-      pAS->fHaveCredHandle = TRUE;
-   }
-
-   // Prepare output buffer
-   sbdOut.ulVersion = 0;
-   sbdOut.cBuffers = 1;
-   sbdOut.pBuffers = &sbOut;
-
-   sbOut.cbBuffer = *pcbOut;
-   sbOut.BufferType = SECBUFFER_TOKEN;
-   sbOut.pvBuffer = pOut;
-
-   // Prepare input buffer
-   sbdIn.ulVersion = 0;
-   sbdIn.cBuffers = 1;
-   sbdIn.pBuffers = &sbIn;
-
-   sbIn.cbBuffer = cbIn;
-   sbIn.BufferType = SECBUFFER_TOKEN;
-   sbIn.pvBuffer = pIn;
-
-   ss = fn._AcceptSecurityContext(&pAS->hcred, 
-         pAS->fInitialized ? &pAS->hctxt : NULL, &sbdIn, 0, 
-         SECURITY_NATIVE_DREP, &pAS->hctxt, &sbdOut, &fContextAttr, 
-         &tsExpiry);
-   if (ss < 0)  {
-      fprintf(stderr, "AcceptSecurityContext failed with %08X\n", (int) ss);
-      return FALSE;
-   }
-
-   pAS->fHaveCtxtHandle = TRUE;
-
-   // If necessary, complete token
-   if (ss == SEC_I_COMPLETE_NEEDED || ss == SEC_I_COMPLETE_AND_CONTINUE) {
-      
-      if (fn._CompleteAuthToken) {
-         ss = fn._CompleteAuthToken(&pAS->hctxt, &sbdOut);
-         if (ss < 0)  {
-            fprintf(stderr, "CompleteAuthToken failed with %08X\n", (int) ss);
-            return FALSE;
-         }
-      }
-      else {
-         fprintf (stderr, "CompleteAuthToken not supported.\n");
-         return FALSE;
-      }
-   }
-
-   *pcbOut = sbOut.cbBuffer;
-
-   if (!pAS->fInitialized)
-      pAS->fInitialized = TRUE;
-
-   *pfDone = !(ss = SEC_I_CONTINUE_NEEDED 
-         || ss == SEC_I_COMPLETE_AND_CONTINUE);
-
-   return TRUE;
-}
-
diff --git a/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.h b/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.h
deleted file mode 100644
index 0525953..0000000
--- a/ica/win32/addon/ms-logon/authSSP/GenClientServerContext.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-
-#include <windows.h>
-#include <stdio.h>
-#include <lmcons.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <tchar.h>
-#include <lm.h>
-#include <stdio.h>
-#define SECURITY_WIN32
-#include <security.h>
-#include <sspi.h>
-#ifndef SEC_I_COMPLETE_NEEDED
-#include <issperr.h>
-#include <time.h>
-#endif
-#include <aclapi.h>
-#ifndef __GNUC__
-#pragma hdrstop
-#endif
-
-#define MAXLEN 256
-#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-#define BUFSIZE 1024
-
-typedef DWORD (__stdcall *NetApiBufferFree_t)( void *buf );
-
-typedef DWORD (__stdcall *NetWkstaGetInfoNT_t)( wchar_t *server, DWORD level, byte **buf );
-typedef DWORD (__stdcall *NetWkstaGetInfo95_t)( char *domain,DWORD level, byte **buf );
-
-#include "Auth_Seq.h"
-
-BOOL GenClientContext(PAUTH_SEQ pAS, 
-					  PSEC_WINNT_AUTH_IDENTITY pAuthIdentity,
-					  PVOID pIn, 
-					  DWORD cbIn, 
-					  PVOID pOut, 
-					  PDWORD pcbOut, 
-					  PBOOL pfDone);
-
-BOOL GenServerContext(PAUTH_SEQ pAS, 
-					  PVOID pIn, 
-					  DWORD cbIn, 
-					  PVOID pOut,
-					  PDWORD pcbOut, 
-					  PBOOL pfDone);
-
-void UnloadSecurityDll(HMODULE hModule);
-
-HMODULE LoadSecurityDll();
diff --git a/ica/win32/addon/ms-logon/authSSP/Readme.txt b/ica/win32/addon/ms-logon/authSSP/Readme.txt
deleted file mode 100644
index 473f889..0000000
--- a/ica/win32/addon/ms-logon/authSSP/Readme.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Idea for AuthSSP.dll:
-Authenticate user with SSPI
-Impersonate this user
-Check access rights against this user with the impersonation/access token.
-During logon/impersonation, group membership expansion (for the token) occurs:
-- Universal groups anywhere in the forest
-- Global groups
-- Domain local groups in the user's domain
-- Local groups
-- This expansion includes all nested groups
-
-Changing the CUPG (now CUPSD) interface: No longer passing one group after the other but pass a SecurityDescriptor for NT/W2k/XP. 
-This allows for just one Windows logon attempt to check authentication and authorization.
-
-AuthSSP.dll is only used if there's a DWORD regkey HKEY_LOCAL_MACHINE\SOFTWARE\ORL\WinVNC3\NewMSLogon set to 1.
-Then all other authentication methods are skipped.
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/authSSP/authSSP.cpp b/ica/win32/addon/ms-logon/authSSP/authSSP.cpp
deleted file mode 100644
index 54e9483..0000000
--- a/ica/win32/addon/ms-logon/authSSP/authSSP.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-#include "authSSP.h"
-
-/*
- *  AuthSSP.cpp: Domainuser could be 'domain\user', just 'user' or
- *  UPN-style 'user at domain'. Should work with Windows NT 4 and better.
- *  NT 4 does not support UPN-style names.
- */
-
-Fn fn;
-
-BOOL CUPSD2(const char * domainuser, 
-		  const char *password, 
-		  PSECURITY_DESCRIPTOR psdSD,
-		  PBOOL isAuthenticated,
-		  PDWORD pdwAccessGranted)	// returns bitmask with accessrights
-{
-	char domain[MAXLEN];
-	const char *user = 0;
-	domain[0] = '\0';
-	TCHAR user2[MAXLEN];
-	TCHAR domain2[MAXLEN];
-	TCHAR password2[MAXLEN];
-
-	user = SplitString(domainuser,'\\',domain);
-
-#if defined (_UNICODE) || defined (UNICODE)
-	mbstowcs(user2, user, MAXLEN);
-	mbstowcs(domain2, domain, MAXLEN);
-	mbstowcs(password2, password, MAXLEN);
-#else
-	strcpy(user2, user);
-	strcpy(domain2, domain);
-	strcpy(password2, password);
-#endif
-
-	// On NT4, prepend computer- or domainname if username is unqualified.
-	if (isNT4() && _tcscmp(domain2, _T("")) == 0) {
-		if (!QualifyName(user2, domain2)) {
-			_tcscpy(domain2, _T("\0"));
-		}
-	}
-	return SSPLogonUser(domain2, user2, password2, psdSD, isAuthenticated, pdwAccessGranted);
-}
-
-
-BOOL WINAPI SSPLogonUser(LPTSTR szDomain, 
-						 LPTSTR szUser, 
-						 LPTSTR szPassword, 
-						 PSECURITY_DESCRIPTOR psdSD,
-						 PBOOL isAuthenticated,
-						 PDWORD pdwAccessGranted)	// returns bitmask with accessrights
-{
-	AUTH_SEQ    asServer   = {0};
-	AUTH_SEQ    asClient   = {0};
-	BOOL        fDone      = FALSE;
-	BOOL        fResult    = FALSE;
-	DWORD       cbOut      = 0;
-	DWORD       cbIn       = 0;
-	DWORD       cbMaxToken = 0;
-	PVOID       pClientBuf = NULL;
-	PVOID       pServerBuf = NULL;
-	PSecPkgInfo pSPI       = NULL;
-	HMODULE     hModule    = NULL;
-	SEC_WINNT_AUTH_IDENTITY ai;
-
-#define __try
-#define __leave goto cleanup
-#define __finally cleanup:
-	__try {
-		
-		hModule = LoadSecurityDll();
-		if (!hModule)
-			__leave;
-		
-		// Get max token size
-		fn._QuerySecurityPackageInfo((SEC_CHAR *)_T("NTLM"), &pSPI);
-		cbMaxToken = pSPI->cbMaxToken;
-		
-		// Allocate buffers for client and server messages
-		pClientBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbMaxToken);
-		pServerBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbMaxToken);
-		
-		// Initialize auth identity structure
-		// Marscha 2004: Seems to work with szDomain = "" or even szDomain = "anyDomain", 
-		// but I found no MS documentation for this 'feature'.
-		ZeroMemory(&ai, sizeof(ai));
-#if defined(UNICODE) || defined(_UNICODE)
-		ai.Domain = (unsigned short *)szDomain;
-		ai.DomainLength = lstrlen(szDomain);
-		ai.User = (unsigned short *)szUser;
-		ai.UserLength = lstrlen(szUser);
-		ai.Password = (unsigned short *)szPassword;
-		ai.PasswordLength = lstrlen(szPassword);
-		ai.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
-#else      
-		ai.Domain = (unsigned char *)szDomain;
-		ai.DomainLength = lstrlen(szDomain);
-		ai.User = (unsigned char *)szUser;
-		ai.UserLength = lstrlen(szUser);
-		ai.Password = (unsigned char *)szPassword;
-		ai.PasswordLength = lstrlen(szPassword);
-		ai.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
-#endif
-
-		// Prepare client message (negotiate) .
-		cbOut = cbMaxToken;
-		if (!GenClientContext(&asClient, &ai, NULL, 0, pClientBuf, &cbOut, &fDone))
-			__leave;
-		
-		// Prepare server message (challenge) .
-		cbIn = cbOut;
-		cbOut = cbMaxToken;
-		if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, 
-            &fDone))
-			__leave;
-		// Most likely failure: AcceptServerContext fails with SEC_E_LOGON_DENIED
-		// in the case of bad szUser or szPassword.
-		// Unexpected Result: Logon will succeed if you pass in a bad szUser and 
-		// the guest account is enabled in the specified domain.
-		
-		// Prepare client message (authenticate) .
-		cbIn = cbOut;
-		cbOut = cbMaxToken;
-		if (!GenClientContext(&asClient, &ai, pServerBuf, cbIn, pClientBuf, &cbOut,
-            &fDone))
-			__leave;
-		
-		// Prepare server message (authentication) .
-		cbIn = cbOut;
-		cbOut = cbMaxToken;
-		if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, 
-            &fDone))
-			__leave;
-		
-		*isAuthenticated = TRUE;
-
-		// Check authorization
-		if (IsImpersonationAllowed()) {
-			if (ImpersonateAndCheckAccess(&(asServer.hctxt), psdSD, pdwAccessGranted))
-				fResult = TRUE;
-		} else {
-			// Todo: Make alternative access check
-			if (ImpersonateAndCheckAccess(&(asServer.hctxt), psdSD, pdwAccessGranted))
-				fResult = TRUE;
-		}
-
-	} __finally {
-
-		// Clean up resources
-		if (pSPI)
-			fn._FreeContextBuffer(pSPI);
-		
-		if (asClient.fHaveCtxtHandle)
-			fn._DeleteSecurityContext(&asClient.hctxt);
-		
-		if (asClient.fHaveCredHandle)
-			fn._FreeCredentialsHandle(&asClient.hcred);
-		
-		if (asServer.fHaveCtxtHandle)
-			fn._DeleteSecurityContext(&asServer.hctxt);
-		
-		if (asServer.fHaveCredHandle)
-			fn._FreeCredentialsHandle(&asServer.hcred);
-		
-		if (hModule)
-			UnloadSecurityDll(hModule);
-		
-		HeapFree(GetProcessHeap(), 0, pClientBuf);
-		HeapFree(GetProcessHeap(), 0, pServerBuf);
-		SecureZeroMemory(&ai, sizeof(ai));
-	}
-
-	return fResult;
-}
-
-BOOL ImpersonateAndCheckAccess(PCtxtHandle phContext, 
-							   PSECURITY_DESCRIPTOR psdSD, 
-							   PDWORD pdwAccessGranted) {
-	HANDLE hToken = NULL;
-	
-	// AccessCheck() variables
-	DWORD           dwAccessDesired = MAXIMUM_ALLOWED;
-	PRIVILEGE_SET   PrivilegeSet;
-	DWORD           dwPrivSetSize = sizeof(PRIVILEGE_SET);
-	BOOL            fAccessGranted = FALSE;
-	GENERIC_MAPPING GenericMapping = { vncGenericRead, vncGenericWrite, 
-									   vncGenericExecute, vncGenericAll };
-	
-	// This only does something if we want to use generic access
-	// rights, like GENERIC_ALL, in our call to AccessCheck().
-	MapGenericMask(&dwAccessDesired, &GenericMapping);
-	
-	// AccessCheck() requires an impersonation token.
-	if ((fn._ImpersonateSecurityContext(phContext) == SEC_E_OK)
-		&& OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken)
-		&& AccessCheck(psdSD, hToken, dwAccessDesired, &GenericMapping,
-		&PrivilegeSet, &dwPrivSetSize, pdwAccessGranted, &fAccessGranted)) {
-		// Restrict access to relevant rights only
-		fAccessGranted = AreAnyAccessesGranted(*pdwAccessGranted, ViewOnly | Interact);
-	}
-	
-	// End impersonation
-	fn._RevertSecurityContext(phContext);
-	
-	// Close handles
-	if (hToken)
-		CloseHandle(hToken);
-	
-	return fAccessGranted;
-}
-
-// SplitString splits a string 'input' on the first occurence of char 'separator'
-// into string 'head' and 'tail' (removing the separator).
-// If separator is not found, head = "" and tail = input.
-const char *SplitString(const char *input, char separator, char *head){
-	const char *tail;
-	int l;
-
-	tail = strchr(input, separator);
-	if (tail){
-		l = tail - input;
-		// get rid of separator
-		tail = tail + 1; 
-		strncpy(head, input, l);
-		head[l] = '\0';
-	} else {
-		tail   = input;
-		head[0] = '\0';
-	}
-	return tail;
-}
-
-bool IsImpersonationAllowed() {
-	bool isImpersonationAllowed = false;
-	HANDLE hToken = NULL;
-	DWORD dwReturnLength = 0;
-	LUID impersonatePrivilege;
-	TOKEN_PRIVILEGES *ptp = NULL;
-
-	if (!LookupPrivilegeValue(NULL, _T("SeImpersonatePrivilege"), &impersonatePrivilege)
-		&& GetLastError() == ERROR_NO_SUCH_PRIVILEGE) {
-		// Assume that SeImpersonatePrivilege is not implemented with this OS/SP.
-		isImpersonationAllowed = true;
-	} else {
-		if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)
-			&& !GetTokenInformation(hToken, TokenPrivileges, NULL, 0, &dwReturnLength)
-			&& GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-			ptp = (TOKEN_PRIVILEGES *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwReturnLength);
-			if (GetTokenInformation(hToken, TokenPrivileges, ptp, dwReturnLength, &dwReturnLength)) {
-				for (unsigned int i = 0; i < ptp->PrivilegeCount; i++) {
-					// Luid.LowPart/HighPart is ugly. To be improved/changed.
-					if ((ptp->Privileges[i].Luid.LowPart == impersonatePrivilege.LowPart)
-						&& (ptp->Privileges[i].Luid.HighPart == impersonatePrivilege.HighPart)
-						&& (ptp->Privileges[i].Attributes & SE_PRIVILEGE_ENABLED))
-						isImpersonationAllowed = true;
-				}
-			}
-		}
-	}
-	// Close handles
-	if (hToken)
-		CloseHandle(hToken);
-	if (ptp)
-		HeapFree(GetProcessHeap(), 0, ptp);
-
-	return isImpersonationAllowed;
-}
-
-bool QualifyName(const TCHAR *user, LPTSTR DomName) {
-	PSID pSid = NULL;
-	DWORD cbSid = 0;
-	DWORD cbDomName = MAXLEN;
-	SID_NAME_USE sidUse;
-	bool isNameQualified = false;
-
-	__try {
-		// Get Sid buffer size
-		LookupAccountName(NULL, user, pSid, &cbSid, DomName, &cbDomName, &sidUse);
-		if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
-			__leave;
-		if (!(pSid = (PSID) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbSid)))
-			__leave;
-		if (cbDomName > MAXLEN)
-			__leave;
-		// Get DomName
-		if (!LookupAccountName(NULL, user, pSid, &cbSid, DomName, &cbDomName, &sidUse))
-			__leave;
-		isNameQualified = true;
-	} __finally {
-		HeapFree(GetProcessHeap(), 0, pSid);
-	}
-
-	return isNameQualified;
-}
-
-bool isNT4() {
-	OSVERSIONINFO VerInfo;
-
-	VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
-		return false;
-	
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-		VerInfo.dwMajorVersion == 4 &&
-		VerInfo.dwMinorVersion == 0)
-		return true;
-	else
-		return false;
-}
diff --git a/ica/win32/addon/ms-logon/authSSP/authSSP.def b/ica/win32/addon/ms-logon/authSSP/authSSP.def
deleted file mode 100644
index 79341d3..0000000
--- a/ica/win32/addon/ms-logon/authSSP/authSSP.def
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY   AuthSSP
-
-             EXPORTS
- 			   CUPSD
-			   vncEditSecurity
diff --git a/ica/win32/addon/ms-logon/authSSP/authSSP.dsw b/ica/win32/addon/ms-logon/authSSP/authSSP.dsw
deleted file mode 100644
index e38e319..0000000
--- a/ica/win32/addon/ms-logon/authSSP/authSSP.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "authSSP"=".\authSSP.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/authSSP/authSSP.h b/ica/win32/addon/ms-logon/authSSP/authSSP.h
deleted file mode 100644
index cbfb924..0000000
--- a/ica/win32/addon/ms-logon/authSSP/authSSP.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-
-#include <windows.h>
-#include <stdio.h>
-#include <lmcons.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <tchar.h>
-#include <lm.h>
-#define SECURITY_WIN32
-#include <security.h>
-#include <sspi.h>
-#ifndef SEC_I_COMPLETE_NEEDED
-#include <issperr.h>
-#include <time.h>
-#endif
-#include <aclapi.h>
-#ifndef __GNUC__
-#pragma hdrstop
-#endif
-
-#include "Auth_Seq.h"
-
-#define MAXLEN 256
-
-BOOL CUPSD2(const char * domainuser, 
-					   const char *password, 
-					   PSECURITY_DESCRIPTOR psdSD,
-					   PBOOL isAuthenticated,
-					   PDWORD pdwAccessGranted);
-
-BOOL WINAPI SSPLogonUser(LPTSTR szDomain, 
-						 LPTSTR szUser, 
-						 LPTSTR szPassword, 
-						 PSECURITY_DESCRIPTOR psdSD, 
-						 PBOOL isAuthenticated,
-						 PDWORD pdwAccessGranted);
-
-BOOL ImpersonateAndCheckAccess(PCtxtHandle phContext, 
-							   PSECURITY_DESCRIPTOR psdSD, 
-							   PDWORD pdwAccessGranted);
-
-BOOL GenClientContext(PAUTH_SEQ pAS, 
-					  PSEC_WINNT_AUTH_IDENTITY pAuthIdentity,
-					  PVOID pIn, 
-					  DWORD cbIn, 
-					  PVOID pOut, 
-					  PDWORD pcbOut, 
-					  PBOOL pfDone);
-
-BOOL GenServerContext(PAUTH_SEQ pAS, 
-					  PVOID pIn, 
-					  DWORD cbIn, 
-					  PVOID pOut,
-					  PDWORD pcbOut, 
-					  PBOOL pfDone);
-
-void UnloadSecurityDll(HMODULE hModule);
-
-HMODULE LoadSecurityDll();
-
-const char * SplitString(const char *input, char separator, char *head);
-bool IsImpersonationAllowed();
- 
-#define ViewOnly 0x0001
-#define	Interact 0x0002
-#define vncGenericRead (STANDARD_RIGHTS_READ | ViewOnly)
-#define	vncGenericWrite	(STANDARD_RIGHTS_WRITE | Interact)
-#define	vncGenericExecute (STANDARD_RIGHTS_EXECUTE)
-#define	vncGenericAll (STANDARD_RIGHTS_ALL | ViewOnly | Interact)
-
-void LOG(long EvenID, const TCHAR *format, ...);
-
-bool QualifyName(const TCHAR *user, LPTSTR DomName);
-bool isNT4();
-
-
diff --git a/ica/win32/addon/ms-logon/authSSP/authSSP.rc b/ica/win32/addon/ms-logon/authSSP/authSSP.rc
deleted file mode 100644
index 220e480..0000000
--- a/ica/win32/addon/ms-logon/authSSP/authSSP.rc
+++ /dev/null
@@ -1,116 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-#if isRC == 1
-#include "buildtime.h" // Defines macro BUILDTIME
-            VALUE "Buildtime", BUILDTIME
-#endif
-            VALUE "Comments", "Cross-domain Windows authentication for UltraVNC\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon II for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "authSSP\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "authSSP.dll\0"
-            VALUE "ProductName", "UltraVNC authSSP\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/authSSP/buildtime.in b/ica/win32/addon/ms-logon/authSSP/buildtime.in
deleted file mode 100644
index 8df4748..0000000
--- a/ica/win32/addon/ms-logon/authSSP/buildtime.in
+++ /dev/null
@@ -1,2 +0,0 @@
-#define BUILDTIMEMACRO #define BUILDTIME __DATE__ " " __TIME__ "\0"
-BUILDTIMEMACRO
diff --git a/ica/win32/addon/ms-logon/authSSP/resource.h b/ica/win32/addon/ms-logon/authSSP/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/authSSP/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/authSSP/vncAccessControl.cpp b/ica/win32/addon/ms-logon/authSSP/vncAccessControl.cpp
deleted file mode 100644
index 97e416d..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncAccessControl.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-
-#include "vncAccessControl.h"
-
-#define __try
-#define __leave goto cleanup
-#define __finally cleanup:
-
-/*
- * GetACL: Gets ACL from reg and puts it in class variable pACL.
- */
-PACL
-vncAccessControl::GetACL(void){
-	HKEY hk = NULL; 
-	PACL pInitACL = NULL;
-	DWORD dwValueLength = 0;
-
-	__try{
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\iTALC Solutions\\iTALC\\Authentication"),
-			0, KEY_QUERY_VALUE, &hk) != ERROR_SUCCESS){
-			__leave;
-		}
-
-		// Read the ACL value from the VNC registry key
-		// First call to RegQueryValueEx just gets the buffer length.
-		if (RegQueryValueEx(hk, _T("LogonACL"), 0, 0, NULL, &dwValueLength) 
-			!= ERROR_SUCCESS){
-			__leave;
-		}
-		if (dwValueLength >= sizeof(ACL))
-			pInitACL = (PACL) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwValueLength);
-		else {
-			__leave;
-		}
-		if (RegQueryValueEx(hk, _T("LogonACL"), 0, 0, (LPBYTE) pInitACL, &dwValueLength)
-			!= ERROR_SUCCESS){
-			__leave;
-		}
-
-	} __finally {
-		if (hk)
-			RegCloseKey(hk); 
-	}
-	return pInitACL;
-}
-
-
-
-/*
- * GetSD: Accessor function for SecurityDescriptor
- *        Creates an (absolute) SD from the GetACL return value
- */
-PSECURITY_DESCRIPTOR
-vncAccessControl::GetSD(){
-	PSECURITY_DESCRIPTOR pSD;
-	PSECURITY_DESCRIPTOR pSelfRelativeSD;
-	PACL pACL = NULL;
-	DWORD dwBufferLength = 0;
-
-	// If we can't retrieve a valid ACL we create an empty one (i.e. no access).
-	if (!(pACL = GetACL()) || !IsValidAcl(pACL)) {
-		pACL = (PACL) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,	sizeof(ACL));
-		// Initialize the new ACL.
-		if (!InitializeAcl(pACL, sizeof(ACL), ACL_REVISION)) {
-			; // Todo: Report an error.
-		}
-	}
-
-	// Construct SD
-	pSD = HeapAlloc(GetProcessHeap(), 
-		HEAP_ZERO_MEMORY, SECURITY_DESCRIPTOR_MIN_LENGTH);
-	if(InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION) &&
-		// Set our ACL to the SD.
-		SetSecurityDescriptorDacl(pSD, TRUE, pACL, FALSE) &&
-		// AccessCheck() is picky about what is in the SD.
-		SetSecurityDescriptorOwner(pSD, GetOwnerSID(), FALSE) &&
-		SetSecurityDescriptorGroup(pSD, GetOwnerSID(), FALSE)) {
-	} else {
-		// Todo: Report an error.
-	}
-	// Make SD self-relative and use LocalAlloc
-	MakeSelfRelativeSD(pSD, NULL, &dwBufferLength);
-	pSelfRelativeSD = (PSECURITY_DESCRIPTOR) LocalAlloc(0, dwBufferLength);
-	MakeSelfRelativeSD(pSD, pSelfRelativeSD, &dwBufferLength);
-	FreeSD(pSD);
-	return pSelfRelativeSD;
-}
-
-/*
- * SetSD: Changes the class variable pACL and the reg key.
- *        The ACL is the DACL of the provided SD.
- */
-BOOL
-vncAccessControl::SetSD(PSECURITY_DESCRIPTOR pSD){
-	BOOL isOK = FALSE;
-	BOOL bDaclPresent = FALSE;
-	BOOL bDaclDefaulted = FALSE;
-	PACL pDACL = NULL;
-
-	GetSecurityDescriptorDacl(pSD, &bDaclPresent, &pDACL, &bDaclDefaulted);
-
-	if (bDaclPresent && pDACL && IsValidAcl(pDACL) && StoreACL(pDACL))
-		isOK = TRUE;
-	return isOK;
-}
-
-/*
- * GetOwnerSID: Helperfunction for SD creation
- */
-PSID
-vncAccessControl::GetOwnerSID(void){
-	PSID pAdminSid = NULL;
-	SID_IDENTIFIER_AUTHORITY SIDAuth = { SECURITY_NT_AUTHORITY };
-	// Create a SID for the BUILTIN\Administrators group.
-	AllocateAndInitializeSid( &SIDAuth, 2,
-		SECURITY_BUILTIN_DOMAIN_RID,
-		DOMAIN_ALIAS_RID_ADMINS,
-		0, 0, 0, 0, 0, 0, &pAdminSid);
-	return pAdminSid;
-}
-
-/*
- * StoreACL: Stores the value of the class variable pACL in the registry.
- * Returns TRUE if successful.
- */
-BOOL 
-vncAccessControl::StoreACL(PACL pACL){
-    HKEY hk = NULL; 
-	BOOL isSaveOK = FALSE;
-
-    ACL_SIZE_INFORMATION AclInfo = {0, 0, 0};
-	DWORD nAclInformationLength = sizeof(AclInfo);
-
-	// Todo: Better error handling
-	if (pACL)
-		GetAclInformation(pACL, &AclInfo, nAclInformationLength, AclSizeInformation);
-
-	__try{ if (RegCreateKey(HKEY_LOCAL_MACHINE, _T("Software\\iTALC Solutions\\iTALC\\Authentication"), &hk)
-			!= ERROR_SUCCESS){
-			__leave;
-		}
-		  if (hk)
-		  RegCloseKey(hk);
-
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\iTALC Solutions\\iTALC\\Authentication"), 0, KEY_SET_VALUE, &hk)
-			!= ERROR_SUCCESS){
-			__leave;
-		}
-		
-		if (RegSetValueEx(hk, _T("LogonACL"), 0, REG_BINARY, (LPBYTE) pACL, AclInfo.AclBytesInUse)
-			!= ERROR_SUCCESS){
-			__leave;
-		}
-		isSaveOK = TRUE;
-	} __finally {
-		if (hk)
-			RegCloseKey(hk); 
-	}
-	return isSaveOK;
-} 
-
-/*
- * FreeSD: Frees the memory of an absolute SD.
- */
-void
-vncAccessControl::FreeSD(PSECURITY_DESCRIPTOR pSD){
-	PSID pOwnerSID = NULL;
-	PSID pGroupSID = NULL;
-	PACL pDACL = NULL;
-	PACL pSACL = NULL;
-	BOOL bOwnerDefaulted = FALSE;
-	BOOL bGroupDefaulted = FALSE;
-	BOOL bDaclPresent = FALSE;
-	BOOL bDaclDefaulted = FALSE;
-	BOOL bSaclPresent = FALSE;
-	BOOL bSaclDefaulted = FALSE;
-	
-	if (pSD) {
-		GetSecurityDescriptorOwner(pSD, &pOwnerSID, &bOwnerDefaulted);
-		GetSecurityDescriptorGroup(pSD, &pGroupSID, &bGroupDefaulted);
-		GetSecurityDescriptorDacl(pSD, &bDaclPresent, &pDACL, &bDaclDefaulted);
-		GetSecurityDescriptorSacl(pSD, &bSaclPresent, &pSACL, &bSaclDefaulted);
-	}
-	// Clean up
-	if (pSD)
-		HeapFree(GetProcessHeap(), 0, pSD);
-	if (bDaclPresent && pDACL)
-		HeapFree(GetProcessHeap(), 0, pDACL);
-	if (bSaclPresent && pSACL)
-		HeapFree(GetProcessHeap(), 0, pSACL);
-	if (pOwnerSID)
-		HeapFree(GetProcessHeap(), 0, pOwnerSID);
-	if (pGroupSID)
-		HeapFree(GetProcessHeap(), 0, pGroupSID);
-
-}
diff --git a/ica/win32/addon/ms-logon/authSSP/vncAccessControl.h b/ica/win32/addon/ms-logon/authSSP/vncAccessControl.h
deleted file mode 100644
index c2a57b7..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncAccessControl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <tchar.h>
-
-#define ViewOnly 0x0001
-#define Interact 0x0002
-
-// 
-class vncAccessControl
-{
-public:
-	PSECURITY_DESCRIPTOR GetSD();
-	BOOL SetSD(PSECURITY_DESCRIPTOR pSD);
-
-protected:
-	void FreeSD(PSECURITY_DESCRIPTOR pSD);
-	PACL GetACL(void);
-	BOOL StoreACL(PACL pACL);
-	PSID GetOwnerSID(void);
-};
-
diff --git a/ica/win32/addon/ms-logon/authSSP/vncSSP.cpp b/ica/win32/addon/ms-logon/authSSP/vncSSP.cpp
deleted file mode 100644
index 404ef8b..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncSSP.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-//#include "..\..\winvnc\stdhdrs.h"
-#include <objbase.h> // for CoInitialize/CoUninitialize ???
-#include <time.h>
-#include "vncSSP.h"
-// From vncAccessControl.h
-#define ViewOnly 0x0001
-#define Interact 0x0002
-
-//#include "..\..\winvnc\localization.h" // Act : add localization on messages
-
-CheckUserPasswordSDFn CheckUserPasswordSD = 0;
-
-const TCHAR REGISTRY_KEY [] = _T("Software\\UltraVnc");
-
-AUTHSSP_API
-int CUPSD(const char * userin, const char *password, const char *machine)
-{
-	DWORD dwAccessGranted = 0;
-	BOOL isAccessOK = FALSE;
-	BOOL isAuthenticated = FALSE;
-	bool isViewOnly = false;
-	bool isInteract = false;
-	TCHAR machine2[MAXSTRING];
-	TCHAR user2[MAXSTRING];
-#if defined(UNICODE) || defined(_UNICODE)
-	mbstowcs(machine2, machine, MAXSTRING);
-	mbstowcs(user2, userin, MAXSTRING);
-#else
-	strcpy(machine2, machine);
-	strcpy(user2, userin);
-#endif
-
-	OSVERSIONINFO VerInfo;
-	VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	if (!GetVersionEx (&VerInfo)) {  // If this fails, something has gone wrong
-		return FALSE;
-	}
-	
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { // WinNT 3.51 or better 
-		vncAccessControl vncAC;
-		isAccessOK = CUPSD2(userin, password, vncAC.GetSD(), &isAuthenticated, &dwAccessGranted);
-		// This logging should be moved to LOGLOGONUSER etc.
-            time_t current;
-			time(&current);
-			char* timestr = ctime(&current);
-			timestr[24] = '\0'; // remove newline
-			LOG(0, "%s - CUPSD2: Access is %u, user %s is %sauthenticated, access granted is 0x%x\n",
-				timestr, isAccessOK, userin, isAuthenticated ? "" : "not ", (int) dwAccessGranted);
-	} else { // message text to be moved to localization.h
-		MessageBox(NULL, _T("New MS-Logon currently not supported on Win9x"), _T("Warning"), MB_OK);
-		return FALSE;
-	}
-
-	if (isAccessOK) {
-		if (dwAccessGranted & ViewOnly) isViewOnly = true;
-		if (dwAccessGranted & Interact) isInteract = true;
-	}
-	
-	//LookupAccountName(NULL, user2, Sid, cbSid, DomainName, cbDomainName, peUse);
-
-	if (isInteract)	{
-		LOG(0x00640001L, _T("Connection received from %s using %s account\n"), machine2, user2);
-	} else if (isViewOnly) {
-		LOG(0x00640001L, _T("Connection received from %s using %s account\n"), machine2, user2);
-		isAccessOK = 2;
-	} else {
-		LOG(0x00640002L, _T("Invalid attempt (not %s) from client %s using %s account\n"), 
-			isAuthenticated ? _T("authorized") : _T("authenticated"), machine2, user2);
-	}
-	return isAccessOK;
-}
-	
-
-TCHAR *AddToModuleDir(TCHAR *filename, int length){
-	TCHAR *szCurrentDir = new TCHAR[length];
-	if (GetModuleFileName(NULL, szCurrentDir, length))
-	{
-		TCHAR *p = _tcsrchr(szCurrentDir, '\\');
-		*p = '\0';
-		_tcscat(szCurrentDir,_T("\\"));
-		_tcscat(szCurrentDir, filename);
-	}
-	filename = szCurrentDir;
-	return filename;
-}
diff --git a/ica/win32/addon/ms-logon/authSSP/vncSSP.h b/ica/win32/addon/ms-logon/authSSP/vncSSP.h
deleted file mode 100644
index c23e895..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncSSP.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-//
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTHSSP_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTHSSP_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef AUTHSSP_EXPORTS
-#define AUTHSSP_API __declspec(dllexport)
-#else
-#define AUTHSSP_API __declspec(dllimport)
-#endif
-
-#include <tchar.h>
-#include "vncAccessControl.h"
-
-typedef BOOL (*CheckUserPasswordSDFn)(const char * domainuser,
-									  const char *password,
-									  PSECURITY_DESCRIPTOR psdSD,
-									  PBOOL isAuthenticated,
-									  PDWORD pdwAccessGranted);
-
-#define MAXSTRING 254
-
-extern "C" AUTHSSP_API int CUPSD(const char * userin, const char *password, const char *machine);
-void LOG(long EvenID, const TCHAR *format, ...);
-TCHAR * AddToModuleDir(TCHAR *filename, int length);
-
-extern BOOL CUPSD2(const char*userin, const char *password, PSECURITY_DESCRIPTOR psdSD, PBOOL pisAuthenticated, PDWORD pdwAccessGranted);
diff --git a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.cpp b/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.cpp
deleted file mode 100644
index d5d5219..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf. 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://ultravnc.sourceforge.net/
-#include "vncSecurityEditor.h"
-#include "vncSecurityEditorProps.h"
-#include "vncAccessControl.h"
-
-
-typedef PSECURITY_DESCRIPTOR (*vncGetSDFn)(void);
-typedef BOOL (*vncSetSDFn)(PSECURITY_DESCRIPTOR pSD);
-vncGetSDFn vncGetSDdll = NULL;
-vncSetSDFn vncSetSDdll = NULL;
-
-HINSTANCE g_hInst;
-
-STDMETHODIMP vncSecurityInfo::QueryInterface( REFIID iid, void** ppv )
-{
-	if ( IID_IUnknown == iid || IID_ISecurityInformation == iid )
-		*ppv = static_cast<ISecurityInformation*>(this);
-	else return (*ppv = 0), E_NOINTERFACE;
-	reinterpret_cast<IUnknown*>( *ppv )->AddRef();
-	return S_OK;
-}
-STDMETHODIMP_(ULONG) vncSecurityInfo::AddRef()
-{
-	return ++m_cRefs;
-}
-STDMETHODIMP_(ULONG) vncSecurityInfo::Release()
-{
-	ULONG n = --m_cRefs;
-	if ( 0 == n )
-		delete this;
-	return n;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::GetObjectInformation( SI_OBJECT_INFO* poi ){
-	// We want to edit the DACL (PERMS).
-	poi->dwFlags = SI_EDIT_PERMS | SI_NO_ACL_PROTECT;
-	
-	// this determines the module used to discover stringtable entries
-	poi->hInstance		= g_hInst;
-	poi->pszServerName	= L""; // Todo(?): Here we need the DC??
-	// then also set dwFlags |= SI_SERVER_IS_DC
-	poi->pszObjectName	= const_cast<wchar_t*>( m_pszObjectName );
-	poi->pszPageTitle	= const_cast<wchar_t*>( m_pszPageTitle );
-	
-	if ( m_pszPageTitle )
-		poi->dwFlags |= SI_PAGE_TITLE;
-	
-	return S_OK;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::GetSecurity(SECURITY_INFORMATION ri, 
-							 PSECURITY_DESCRIPTOR *ppsd, 
-							 BOOL bDefault){
-	vncAccessControl vncAC;
-	return (*ppsd = vncAC.GetSD()) ? S_OK : E_FAIL;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::SetSecurity(SECURITY_INFORMATION ri, void* psd){
-	vncAccessControl vncAC;
-	return vncAC.SetSD((PSECURITY_DESCRIPTOR) psd) ? S_OK : E_FAIL;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::PropertySheetPageCallback(HWND hwnd, UINT msg, SI_PAGE_TYPE pt){
-	// this is effectively a pass-through from the PropertySheet callback,
-	// which we don't care about here.
-	return S_OK;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::GetAccessRights(const GUID*,
-								 DWORD dwFlags,
-								 SI_ACCESS** ppAccess,
-								 ULONG* pcAccesses,
-								 ULONG* piDefaultAccess){
-	// here's where we hand back the permissions->strings mapping
-	*ppAccess = const_cast<SI_ACCESS*>( g_vncAccess );
-	*pcAccesses = sizeof g_vncAccess / sizeof *g_vncAccess;
-	*piDefaultAccess = 0;
-	return S_OK;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::MapGeneric(const GUID*, UCHAR* pAceFlags, ACCESS_MASK* pMask){
-	// here's where we hand back the generic permissions mapping
-	MapGenericMask(pMask, const_cast<GENERIC_MAPPING*>(&g_vncGenericMapping));
-	return S_OK;
-}
-
-STDMETHODIMP 
-vncSecurityInfo::GetInheritTypes(SI_INHERIT_TYPE** ppInheritTypes, ULONG* pcInheritTypes){
-	// We don't need inheritance here.
-	*ppInheritTypes = NULL;
-	*pcInheritTypes = 0;
-	return S_OK;
-}
-
-AUTHSSP_API void vncEditSecurity(HWND hwnd, HINSTANCE hInstance) {
-	if (CheckAclUI()) {
-		g_hInst = hInstance;
-		// Convert ISecurityInformation implementation into property pages
-		vncSecurityInfo* psi = 
-			new vncSecurityInfo(L"UltraVNC Server", L"UltraVNC Server");
-		psi->AddRef();
-		
-			HPROPSHEETPAGE hpsp[1];
-			hpsp[0] = CreateSecurityPage(psi);
-			psi->Release(); // does "delete this"!
-
-			// Wrap the property page in a modal dialog by calling PropertySheet
-			PROPSHEETHEADER psh;
-			ZeroMemory(&psh, sizeof psh);
-			psh.dwSize		= sizeof psh;
-			psh.hwndParent	= hwnd;
-			psh.pszCaption	= _T("UltraVNC Security Editor");
-			psh.nPages		= sizeof hpsp / sizeof *hpsp;
-			psh.phpage		= hpsp;
-			
-			PropertySheet(&psh);
-			
-	} else {
-		MessageBox(NULL, _T("aclui.dll (function EditSecurity()) not available\n")
-			_T("with this Operatingsystem/Servicepack.\n")
-			_T("Use ACL import/export utility instead."),
-			//sz_ID_WINVNC_ERROR,
-			_T("Error"),
-			MB_OK | MB_ICONEXCLAMATION);
-	}
-}
-
-bool CheckAclUI()
-{
-	HMODULE hModule = LoadLibrary(_T("aclui.dll"));
-	if (hModule)
-	{
-		FARPROC test=NULL;
-		test=GetProcAddress( hModule, "EditSecurity" );
-		FreeLibrary(hModule);
-		if (test) { 
-			return true;
-		}
-	}
-	return false;
-}
-
diff --git a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.h b/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.h
deleted file mode 100644
index 0ae614f..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditor.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. 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://ultravnc.sourceforge.net/
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTHSSP_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTHSSP_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef AUTHSSP_EXPORTS
-#define AUTHSSP_API __declspec(dllexport)
-#else
-#define AUTHSSP_API __declspec(dllimport)
-#endif
-
-#include <windows.h>
-#include <aclui.h>
-#include <aclapi.h>
-#include <stdio.h>
-
-struct vncSecurityInfo : ISecurityInformation
-{
-	long  m_cRefs;
-	const wchar_t* const m_pszObjectName;
-	const wchar_t* const m_pszPageTitle;
-	
-	vncSecurityInfo(const wchar_t* pszObjectName,
-		const wchar_t* pszPageTitle = 0 )
-		: m_cRefs(0),
-		m_pszObjectName(pszObjectName),
-		m_pszPageTitle(pszPageTitle) {}
-
-	STDMETHODIMP QueryInterface( REFIID iid, void** ppv );
-	STDMETHODIMP_(ULONG) AddRef();
-	STDMETHODIMP_(ULONG) Release();
-	STDMETHODIMP GetObjectInformation( SI_OBJECT_INFO* poi );
-	STDMETHODIMP GetSecurity(SECURITY_INFORMATION ri, PSECURITY_DESCRIPTOR * ppsd, BOOL bDefault);
-	STDMETHODIMP SetSecurity(SECURITY_INFORMATION ri, void* psd);
-	STDMETHODIMP PropertySheetPageCallback(HWND hwnd, UINT msg, SI_PAGE_TYPE pt);
-	STDMETHODIMP GetAccessRights(const GUID*,
-								 DWORD dwFlags,
-								 SI_ACCESS** ppAccess,
-								 ULONG* pcAccesses,
-								 ULONG* piDefaultAccess);
-	STDMETHODIMP MapGeneric(const GUID*, UCHAR* pAceFlags, ACCESS_MASK* pMask);
-	STDMETHODIMP GetInheritTypes(SI_INHERIT_TYPE** ppInheritTypes, ULONG* pcInheritTypes);
-};
-
-AUTHSSP_API void vncEditSecurity(HWND hwnd, HINSTANCE hInstance);
-
-bool CheckAclUI();
-extern TCHAR *AddToModuleDir(TCHAR *filename, int length);
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditorProps.h b/ica/win32/addon/ms-logon/authSSP/vncSecurityEditorProps.h
deleted file mode 100644
index 7507aae..0000000
--- a/ica/win32/addon/ms-logon/authSSP/vncSecurityEditorProps.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. 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://ultravnc.sourceforge.net/
-
-// This table maps permissions onto strings.
-// Notice the first entry, which includes all permissions; it maps to a string "Full Control".
-// I love this feature of being able to provide multiple permissions in one entry,
-// if you use it carefully, it's pretty powerful - the access control editor will
-// automatically keep the permission checkboxes synchronized, which makes it clear
-// to the user what is going on (if they pay close enough attention).
-//
-// Notice that I included standard permissions - don't forget them...
-// Notice that I left some of the more esoteric permissions for the Advanced dialog,
-// and that I only show "Full Control" in the basic permissions editor.
-// This is consistent with the way the file acl editor works.
-SI_ACCESS g_vncAccess[] = {	
-	// these are a easy-to-swallow listing of basic rights for VNC
-//	{ &GUID_NULL, 0x00000007, L"Full control", SI_ACCESS_GENERAL  },	// Full Control
-	{ &GUID_NULL, 0x00000003, L"Full control", SI_ACCESS_GENERAL  },	// Full Control
-	{ &GUID_NULL, 0x00000003, L"Interact",     SI_ACCESS_GENERAL  },	// Write
-	{ &GUID_NULL, 0x00000001, L"View",     SI_ACCESS_GENERAL  },	// Read
-//	{ &GUID_NULL, 0x00000004, L"Filetransfer",     SI_ACCESS_GENERAL  },	// ??
-};
-
-// Here's my crufted-up mapping for VNC generic rights
-GENERIC_MAPPING g_vncGenericMapping = {
-	STANDARD_RIGHTS_READ,
-	STANDARD_RIGHTS_WRITE,
-	STANDARD_RIGHTS_EXECUTE,
-	STANDARD_RIGHTS_REQUIRED
-};
-
-const DWORD ViewOnly	   = 0x0001;
-const DWORD Interact	   = 0x0002;
-
-const DWORD GenericRead    = STANDARD_RIGHTS_READ |
-							 ViewOnly;
-
-const DWORD GenericWrite   = STANDARD_RIGHTS_WRITE |
-							 Interact;
-
-const DWORD GenericExecute = STANDARD_RIGHTS_EXECUTE;
-
-const DWORD GenericAll     = STANDARD_RIGHTS_REQUIRED |
-							  GenericRead |
-							  GenericWrite |
-							  GenericExecute;
-
diff --git a/ica/win32/addon/ms-logon/authadm/authadmin.cpp b/ica/win32/addon/ms-logon/authadm/authadmin.cpp
deleted file mode 100644
index 926a58b..0000000
--- a/ica/win32/addon/ms-logon/authadm/authadmin.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-#include "authadmin.h"
-#include "lm.h"
-
-typedef struct _WKSTA_INFO_100_NT {
-  DWORD     wki100_platform_id;
-  wchar_t *    wki100_computername;
-  wchar_t *    wki100_langroup;
-  DWORD     wki100_ver_major;
-  DWORD     wki100_ver_minor;
-}WKSTA_INFO_100_NT;
-
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 )
-{
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-
-bool IsAdmin() { 
-       SC_HANDLE hSC;
-       hSC = OpenSCManager(
-             NULL,
-              NULL,
-              GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE
-              );
-    if( hSC == NULL ) {
-                  return FALSE;
-    }   
-         CloseServiceHandle( hSC );
-         return TRUE;
-}
-
-AUTHADMIN_API
-BOOL CUGP(char * userin,char *password,char *machine,char *groupin,int locdom)
-{
-	DWORD dwLogonType;
-	DWORD dwLogonProvider;
-	HANDLE hToken;
-	bool returnvalue=false;
-	dwLogonType     = LOGON32_LOGON_INTERACTIVE;
-	dwLogonProvider = LOGON32_PROVIDER_DEFAULT;
-
-	byte *buf = 0;
-	byte *buf2 = 0;
-	char domain[MAXLEN * sizeof(wchar_t)];
-	DWORD rcdomain = NetGetDCName( 0, 0, &buf );
-	NetApiBufferFree( buf );
-	printf("Logonuser: % s %s \n", userin, ".");
-			if (LogonUser(userin, ".", password, dwLogonType, dwLogonProvider, &hToken))
-					if (ImpersonateLoggedOnUser(hToken))
-				{
-					returnvalue=IsAdmin();
-					RevertToSelf();
-					CloseHandle(hToken);
-				}
-	if (returnvalue==true) return returnvalue;
-	if (!rcdomain)
-		{
-			DWORD result=NetWkstaGetInfo( 0 , 100 , &buf2 ) ;
-				if (!result)
-				{
-					wcstombs( domain, ((WKSTA_INFO_100_NT *) buf2)->wki100_langroup, MAXLEN );
-					NetApiBufferFree( buf2 );
-					printf("Logonuser: % s %s \n", userin, domain);
-					if (LogonUser(userin, domain, password, dwLogonType, dwLogonProvider, &hToken))
-						if (ImpersonateLoggedOnUser(hToken))
-							{
-								returnvalue=IsAdmin();
-								RevertToSelf();
-								CloseHandle(hToken);
-							}
-				}
-
-		}
-	
-	return returnvalue;
-	
-}
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/authadm/authadmin.def b/ica/win32/addon/ms-logon/authadm/authadmin.def
deleted file mode 100644
index 6c97f3b..0000000
--- a/ica/win32/addon/ms-logon/authadm/authadmin.def
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBRARY   Authadmin
-
-             EXPORTS
-               CUGP
diff --git a/ica/win32/addon/ms-logon/authadm/authadmin.dsw b/ica/win32/addon/ms-logon/authadm/authadmin.dsw
deleted file mode 100644
index 8194c6b..0000000
--- a/ica/win32/addon/ms-logon/authadm/authadmin.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "authadmin"=".\authadmin.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/authadm/authadmin.h b/ica/win32/addon/ms-logon/authadm/authadmin.h
deleted file mode 100644
index 15f9bb4..0000000
--- a/ica/win32/addon/ms-logon/authadm/authadmin.h
+++ /dev/null
@@ -1,23 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTHLOGONUSER_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTHLOGONUSER_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef AUTHADMIN_EXPORTS
-#define AUTHADMIN_API __declspec(dllexport)
-#else
-#define AUTHADMIN_API __declspec(dllimport)
-#endif
-#pragma comment( lib, "netapi32.lib" )
-#if defined( UNICODE ) || defined( _UNICODE )
-#error Sorry -- please compile as an ANSI program.
-#endif
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#define MAXLEN 256
-
-AUTHADMIN_API
-BOOL CUGP(char * userin,char *password,char *machine,char * group,int locdom);
diff --git a/ica/win32/addon/ms-logon/authadm/authadmin.rc b/ica/win32/addon/ms-logon/authadm/authadmin.rc
deleted file mode 100644
index e6aa3d3..0000000
--- a/ica/win32/addon/ms-logon/authadm/authadmin.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Local admin authentication for UltraVNC\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "authadmin\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "authadmin.dll\0"
-            VALUE "ProductName", "UltraVNC authadmin\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/authadm/resource.h b/ica/win32/addon/ms-logon/authadm/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/authadm/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.cpp b/ica/win32/addon/ms-logon/ldapauth/ldapAuth.cpp
deleted file mode 100644
index 180e246..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.cpp
+++ /dev/null
@@ -1,638 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-
-
-#include "ldapauth.h"
-
-/////////////////////////
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 )
-{
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-
-
-
-LDAPAUTH_API
-BOOL CUGP(char * userin,char *password,char *machine, char * groupin,int locdom)
-{
-	OSVERSIONINFO ovi = { sizeof ovi };
-	GetVersionEx( &ovi );
-	if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-      ovi.dwMajorVersion >= 5 )
-	{
-	//Handle the command line arguments.
-	LPOLESTR pszBuffer = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer2 = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer3 = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer4 = new OLECHAR[MAX_PATH*2];
-	mbstowcs( (wchar_t *) pszBuffer, userin, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer2, password, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer3, machine, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer4, groupin, MAX_PATH );
-	HRESULT hr = S_OK;
-	//Get rootDSE and the domain container's DN.
-	IADs *pObject = NULL;
-	IADs *pObjectUser = NULL;
-	IADs *pObjectGroup = NULL;
-	IDirectorySearch *pDS = NULL;
-	LPOLESTR szPath = new OLECHAR[MAX_PATH];
-	LPOLESTR myPath = new OLECHAR[MAX_PATH];
-	VARIANT var;
-	
-	wcscpy(szPath,L"LDAP://");
-	wcscat(szPath,L"rootDSE");
-	wprintf(szPath);
-	wprintf(L"\n");
-
-	hr = ADsOpenObject(szPath,
-					pszBuffer,
-					pszBuffer2,
-					ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-					IID_IADs,
-					(void**)&pObject);
-	if (FAILED(hr))
-		{
-			wprintf(L"Bind to domain failed %i\n",hr);
-
-			if (pObject) pObject->Release();
-			delete [] pszBuffer;
-			delete [] pszBuffer2;
-			delete [] pszBuffer3;
-			delete [] pszBuffer4;
-			delete [] szPath;
-			delete [] myPath;
-			return false;
-		}
-	hr = pObject->Get(L"defaultNamingContext",&var);
-
-	if (SUCCEEDED(hr))
-		{
-			wcscpy(szPath,L"LDAP://");
-			wcscat(szPath,var.bstrVal);
-			VariantClear(&var);
-			if (pObject)
-				{
-					pObject->Release();
-					pObject = NULL;
-				}
-			wprintf( szPath);
-			wprintf(L"\n");
-			//Bind to the root of the current domain.
-			hr = ADsOpenObject(szPath,pszBuffer,pszBuffer2,
-					 ADS_SECURE_AUTHENTICATION,IID_IDirectorySearch,(void**)&pDS);
-			if (SUCCEEDED(hr))
-				{
-					if (SUCCEEDED(hr))
-						{
-							hr =  FindUserByName(pDS, pszBuffer, &pObjectUser);
-							if (FAILED(hr))
-								{
-									wprintf(L"User not found %i\n",hr);
-									delete [] pszBuffer;
-									delete [] pszBuffer2;
-									delete [] pszBuffer3;
-									delete [] szPath;
-									delete [] myPath;
-									if (pDS) pDS->Release();
-									if (pObjectUser) pObjectUser->Release();
-									return false;
-								}
-							if (pObjectUser) pObjectUser->Release();
-							///////////////////// VNCACCESS
-							hr =  FindGroup(pDS, pszBuffer, &pObjectGroup,pszBuffer4);
-							if (pObjectGroup)
-										{
-											pObjectGroup->Release();
-											pObjectGroup = NULL;
-										}
-							if (FAILED(hr)) wprintf(L"group not found\n");
-							if (SUCCEEDED(hr))
-								{
-									wprintf(L"Group found OK\n");
-									IADsGroup *     pIADsG;
-									hr = ADsOpenObject( gbsGroup,pszBuffer, pszBuffer2, 
-											ADS_SECURE_AUTHENTICATION,IID_IADsGroup, (void**) &pIADsG);
-									if (SUCCEEDED(hr))
-										{
-											VARIANT_BOOL bMember = FALSE;  
-											hr = pIADsG->IsMember(gbsMember,&bMember);
-											if (SUCCEEDED(hr))
-												{
-													if (bMember == -1)
-														{
-															wprintf(L"Object \n\n%s\n\n IS a member of the following Group:\n\n%s\n\n",gbsMember,gbsGroup);
-															delete [] pszBuffer;
-															delete [] pszBuffer2;
-															delete [] pszBuffer3;
-															delete [] szPath;
-															delete [] myPath;
-															if (pDS) pDS->Release();
-															return true;
-														}
-													else
-														{
-															BSTR bsMemberGUID = NULL;
-															IDirectoryObject * pDOMember = NULL;
-															hr = ADsOpenObject( gbsMember,pszBuffer, pszBuffer2, 
-																	ADS_SECURE_AUTHENTICATION,IID_IDirectoryObject, (void**) &pDOMember);
-															if (SUCCEEDED(hr))
-																{
-																	hr = GetObjectGuid(pDOMember,bsMemberGUID);
-																	pDOMember->Release();
-																	pDOMember  = NULL;
-																	if (RecursiveIsMember(pIADsG,bsMemberGUID,gbsMember,true, pszBuffer, pszBuffer2))
-																		{
-																			delete [] pszBuffer;
-																			delete [] pszBuffer2;
-																			delete [] pszBuffer3;
-																			delete [] szPath;
-																			delete [] myPath;
-																			if (pDS) pDS->Release();
-																			return true;
-																		}
-																}
-													}//else bmember
-											}//ismember
-									}//iadsgroup 
-							}//Findgroup
-							wprintf(L"USER not found in group\n");
-							
-						}//user
-				}
-		if (pDS) pDS->Release();
-		}
-		/*LOGFAILED(pszBuffer3,pszBuffer);*/
-		delete [] pszBuffer;
-		delete [] pszBuffer2;
-		delete [] pszBuffer3;
-		delete [] szPath;
-		delete [] myPath;
-		return false;
-	}
-	return false;
-}
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-	if ((!pSearchBase)||(!szFindUser))
-		return E_INVALIDARG;
-	//Create search filter
-	LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-	LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-	wcscpy(pszSearchFilter, L"(&(objectCategory=person)(objectClass=user)(samAccountName=");
-	wcscat(pszSearchFilter, szFindUser);
-	wcscat(pszSearchFilter,	L"))");
-    //Search entire subtree from root.
-	ADS_SEARCHPREF_INFO SearchPrefs;
-	SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-	SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-	SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-	// COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-	// Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-	// Set attributes to return
-	CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-		                          pszAttribute,
-								  dwAttrNameSize,
-								  &hSearch
-								  );
-	if (SUCCEEDED(hr))
-	{    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-		{
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-			    // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-			    if ( SUCCEEDED(hr) )
-			    {
-				    // Print the data for the column and free the column
-					// Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-					hr = ADsOpenObject(szADsPath,
-									 NULL,
-									 NULL,
-									 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-									 IID_IADs,
-									 (void**)ppUser);
-					if (SUCCEEDED(hr))
-					{ 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-					   hrObj = S_OK;
-					   gbsMember=SysAllocString(col.pADsValues->CaseIgnoreString);
-					}
-				    pSearchBase->FreeColumn( &col );
-			    }
-			    else
-				    hr = E_FAIL;
-            }
-		}
-		// Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-	}
-	if (FAILED(hrObj))
-		hr = hrObj;
-    return hr;
-}
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser,LPOLESTR szGroup) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-	if ((!pSearchBase)||(!szFindUser))
-		return E_INVALIDARG;
-	//Create search filter
-	LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-	LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-	wcscpy(pszSearchFilter, L"(&(objectClass=group)(cn=");
-	wcscat(pszSearchFilter,szGroup);
-	wcscat(pszSearchFilter,	L"))");
-    //Search entire subtree from root.
-	ADS_SEARCHPREF_INFO SearchPrefs;
-	SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-	SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-	SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-	// COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-	// Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-	// Set attributes to return
-	CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-		                          pszAttribute,
-								  dwAttrNameSize,
-								  &hSearch
-								  );
-	if (SUCCEEDED(hr))
-	{    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-		{
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-			    // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-			    if ( SUCCEEDED(hr) )
-			    {
-				    // Print the data for the column and free the column
-					// Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-					hr = ADsOpenObject(szADsPath,
-									 NULL,
-									 NULL,
-									 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-									 IID_IADs,
-									 (void**)ppUser);
-					if (SUCCEEDED(hr))
-					{ 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-					   hrObj = S_OK;
-					   gbsGroup=SysAllocString(col.pADsValues->CaseIgnoreString);
-					}
-				    pSearchBase->FreeColumn( &col );
-			    }
-			    else
-				    hr = E_FAIL;
-            }
-		}
-		// Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-	}
-	if (FAILED(hrObj))
-		hr = hrObj;
-    return hr;
-}
-
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  RecursiveIsMember()                       - Recursively scans the members of passed IADsGroup ptr
-                                                and any groups that belong to the passed ptr- for membership
-                                                of Passed group.
-                                                Will return a TRUE if the member is found in the passed group,
-                                                or if the passed member is a member of any group which is a member
-                                                of the passed group.
-    Parameters
- 
-        IADsGroup *     pADsGroup       - Group from which to verify members.
-        LPWSTR          pwszMember      - LDAP path for object to verify membership.
-        BOOL            bVerbose        - IF TRUE, will output verbose information for the scan.
- 
-    OPTIONAL Parameters
- 
-       LPOLESTR  pwszUser           - User Name and Password, if the parameters are not passed, 
-       LPOLESTER pwszPassword       - binding will use ADsGetObject; if the parameters are
-                                    - specified, ADsOpenObject is used, passing user name and password.
-*/
- 
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword)
-{
-    HRESULT         hr                = S_OK;     // COM Result Code
-    IADsMembers *   pADsMembers       = NULL;     // Ptr to Members of the IADsGroup
-    BOOL            fContinue         = TRUE;     // Looping Variable
-    IEnumVARIANT *  pEnumVariant      = NULL;     // Ptr to the Enum variant
-    IUnknown *      pUnknown          = NULL;     // IUnknown for getting the ENUM initially
-    VARIANT         VariantArray[FETCH_NUM];      // Variant array for temp holding returned data
-    ULONG           ulElementsFetched = NULL;     // Number of elements retrieved
-    BSTR            bsGroupPath       = NULL;
-    BOOL            bRet              = FALSE;
-
-    if(!pADsGroup || !pwszMemberGUID || !pwszMemberPath)
-    {
-        return FALSE;
-    }
- 
-    // Get the path of the object passed in
-    hr = pADsGroup->get_ADsPath(&bsGroupPath);
- 
-    if (!SUCCEEDED(hr))
-        return hr;
- 
-    if (bVerbose)
-    {
-        WCHAR pwszOutput[2048];
-        wsprintf(pwszOutput,L"Checking the Group:\n\n%s\n\n for the member:\n\n%s\n\n",bsGroupPath,pwszMemberPath);
-        PrintBanner(pwszOutput);
-    }
- 
-    // Get an interface pointer to the IADsCollection of members
-    hr = pADsGroup->Members(&pADsMembers);
- 
-    if (SUCCEEDED(hr))
-    {
-        // Query the IADsCollection of members for a new ENUM Interface
-        // Be aware that the enum comes back as an IUnknown *
-        hr = pADsMembers->get__NewEnum(&pUnknown);
- 
-        if (SUCCEEDED(hr))
-        {
-            // QI the IUnknown * for an IEnumVARIANT interface
-            hr = pUnknown->QueryInterface(IID_IEnumVARIANT, (void **)&pEnumVariant);
- 
-            if (SUCCEEDED(hr))
-            {
-                // While have not hit errors or end of data....
-                while (fContinue) 
-                {
-                   ulElementsFetched = 0;
-                    // Get a "batch" number of group members-number of rows specified by FETCH_NUM
-                    hr = ADsEnumerateNext(pEnumVariant, FETCH_NUM, VariantArray, &ulElementsFetched);
- 
-                    if (ulElementsFetched )
-                    {
-                        // Loop through the current batch-printing the path for each member.
-                        for (ULONG i = 0; i < ulElementsFetched; i++ ) 
-                        {
-                            IDispatch * pDispatch         = NULL; // ptr for holding dispath of element
-                            BSTR        bstrCurrentPath   = NULL; // Holds path of object
-                            BSTR        bstrGuidCurrent   = NULL; // Holds path of object
-                            IDirectoryObject * pIDOCurrent = NULL;// Holds the current object          
- 
-                            // Get the dispatch ptr for the variant
-                            pDispatch = VariantArray[i].pdispVal;
-//                            assert(HAS_BIT_STYLE(VariantArray[i].vt,VT_DISPATCH));
- 
-                            // Get the IADs interface for the "member" of this group
-                            hr = pDispatch->QueryInterface(IID_IDirectoryObject,
-                                                           (VOID **) &pIDOCurrent ) ;
- 
-                            if (SUCCEEDED(hr))
-                            {
-                                // Get the GUID for the current object
-                                hr = GetObjectGuid(pIDOCurrent,bstrGuidCurrent);
- 
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                IADs * pIADsCurrent = NULL;
- 
-                                // Retrieve the IADs Interface for the current object
-                                hr = pIDOCurrent->QueryInterface(IID_IADs,(void**)&pIADsCurrent);
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                // Get the ADsPath property for this member
-                                hr = pIADsCurrent->get_ADsPath(&bstrCurrentPath);
- 
-                                if (SUCCEEDED(hr))
-                                {
-                                    if (bVerbose)
-                                        wprintf(L"Comparing:\n\n%s\nWITH:\n%s\n\n",bstrGuidCurrent,pwszMemberGUID);
-                                    
-                                    // Verify that the member of this group is Equal to passed.
-                                    if (_wcsicmp(bstrGuidCurrent,pwszMemberGUID)==0)
-                                    {
-                                        if (bVerbose)
-                                            wprintf(L"!!!!!Object:\n\n%s\n\nIs a member of\n\n%s\n\n",pwszMemberPath,bstrGuidCurrent);   
- 
-                                        bRet = TRUE;
-                                        break;
-                                    }
-                                    else // Otherwise, bind to this and see if it is a group.
-                                    {    // If is it a group then the QI to IADsGroup succeeds
-                                        
-                                        IADsGroup * pIADsGroupAsMember = NULL;
-                                        
-                                        if (pwszUser)
-                                            hr = ADsOpenObject( bstrCurrentPath,
-                                                                pwszUser, 
-                                                                pwszPassword, 
-                                                                ADS_SECURE_AUTHENTICATION,
-                                                                IID_IADsGroup, 
-                                                                (void**) &pIADsGroupAsMember);
-                                        else
-                                            hr = ADsGetObject( bstrCurrentPath, IID_IADsGroup,(void **)&pIADsGroupAsMember);
- 
-                                        // If bind was completed, then this is a group.
-                                        if (SUCCEEDED(hr))
-                                        {
-                                            // Recursively call this group to verify this group.
-                                            BOOL bRetRecurse;
-                                            bRetRecurse = RecursiveIsMember(pIADsGroupAsMember,pwszMemberGUID,pwszMemberPath,bVerbose,pwszUser ,pwszPassword );
-                                            
-                                            if (bRetRecurse)
-                                            {
-                                                bRet = TRUE;
-                                                break;
-                                            }
-                                            pIADsGroupAsMember->Release();
-                                            pIADsGroupAsMember = NULL;
-                                        }
-                                    }
-                                    SysFreeString(bstrCurrentPath);
-                                    bstrCurrentPath = NULL;
- 
-                                    SysFreeString(bstrGuidCurrent);
-                                    bstrGuidCurrent = NULL;
-                                }
-                                // Release
-                                pIDOCurrent->Release();
-                                pIDOCurrent = NULL;
-                                if (pIADsCurrent)
-                                {
-                                    pIADsCurrent->Release();
-                                    pIADsCurrent = NULL;
-                                }
-                            }
-                         }
-                        // Clear the variant array.
-                        memset(VariantArray, 0, sizeof(VARIANT)*FETCH_NUM);
-                    }
-                    else
-                        fContinue = FALSE;
-                }
-                pEnumVariant->Release();
-                pEnumVariant = NULL;
-            }
-            pUnknown->Release();
-            pUnknown = NULL;
-        }
-        pADsMembers ->Release();
-        pADsMembers  = NULL;
-    }
- 
-    // Free the group path if retrieved.
-    if (bsGroupPath)
-    {
-        SysFreeString(bsGroupPath);
-        bsGroupPath = NULL;
-    }
-    return bRet;
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  GetObjectGuid()    - Retrieves the GUID, in string form, from the passed Directory Object.
-                         Returns S_OK on success.
- 
-    Parameters
- 
-        IDirectoryObject *  pDO     -   Directory Object from where GUID is retrieved.
-        BSTR             &  bsGuid  -   Returned GUID            
-*/
- 
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid)
-{
- 
-    GUID *pObjectGUID   = NULL;
-    PADS_ATTR_INFO      pAttributeEntries;
-    LPWSTR              pAttributeName = L"objectGUID";  // Get the GUID for the object.
-    DWORD               dwAttributesReturned = 0;
-    HRESULT             hr;
-
-    if(!pDO)
-    {
-        return E_FAIL;
-    }
-
-    hr = pDO->GetObjectAttributes(  &pAttributeName, // objectGUID
-                                    1, //Only objectGUID
-                                    &pAttributeEntries, // Returned attributes
-                                    &dwAttributesReturned // Number of attributes returned
-                                    );
- 
-    if (SUCCEEDED(hr) && dwAttributesReturned>0)
-    {
-        // Be sure the right type was retrieved--objectGUID is ADSTYPE_OCTET_STRING
-        if (pAttributeEntries->dwADsType == ADSTYPE_OCTET_STRING)
-        {
-            // Get COM converted string version of the GUID
-            // lpvalue should be LPBYTE. Should be able to cast it to ptr to GUID.
-            pObjectGUID = (GUID*)(pAttributeEntries->pADsValues[0].OctetString.lpValue);
-            
-            // OLE str to fit a GUID
-            
-            LPOLESTR szGUID = new WCHAR [64];
-            szGUID[0]=NULL;
-            // Convert GUID to string.
-            ::StringFromGUID2(*pObjectGUID, szGUID, 39); 
-            bsGuid = SysAllocString(szGUID);
-            
-            delete [] szGUID;
-         }
-    }
- 
-    return hr;
- 
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  PrintBanner()   -       Prints a banner to the screen
- 
-    Parameters
- 
-                LPOLESTR pwszBanner   - String to print
-*/
-void PrintBanner(LPOLESTR pwszBanner)
-{
-    _putws(L"");
-    _putws(L"////////////////////////////////////////////////////");
-    wprintf(L"\t");
-    _putws(pwszBanner);
-    _putws(L"////////////////////////////////////////////////////\n");
-}
diff --git a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.h b/ica/win32/addon/ms-logon/ldapauth/ldapAuth.h
deleted file mode 100644
index 4dfd9db..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTH_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTH_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef LDAPAUTH_EXPORTS
-#define LDAPAUTH_API __declspec(dllexport)
-#else
-#define LDAPAUTH_API __declspec(dllimport)
-#endif
-
-#include <windows.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <wchar.h>
-#include <math.h>
-#include <objbase.h>
-#include <activeds.h>
-#include <Dsgetdc.h>
-#include <sddl.h>
-#include <assert.h>
-
-
-#define MAXLEN 256
-//#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-//#define NERR_Success            0
-//#define LG_INCLUDE_INDIRECT 1
-#define BUFSIZE 1024
-
-#define FETCH_NUM 100
-void PrintBanner(LPOLESTR pwszBanner);
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid);
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword);
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser); //Return a pointer to the user
-
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser,LPOLESTR szGroup); //Return a pointer to the user
-
-BSTR gbsGroup     = NULL; // <Group to check> This is the LDAP path for the group to check
-	BSTR gbsMember    = NULL; // <Member to check> 
-	BSTR gbsUSER      = NULL;
-	BSTR gbsPASS      = NULL; // <Password used for binding to the DC>
-
-
-
-LDAPAUTH_API BOOL CUGP(char * userin,char *password,char *machine,char *group,int locdom);
-
diff --git a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.rc b/ica/win32/addon/ms-logon/ldapauth/ldapAuth.rc
deleted file mode 100644
index c3d9193..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/ldapAuth.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Active Directory authentication for UltraVNC\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "ldapAuth\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "ldapAuth.dll\0"
-            VALUE "ProductName", "UltraVNC ldapAuth\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/ldapauth/ldapauth.def b/ica/win32/addon/ms-logon/ldapauth/ldapauth.def
deleted file mode 100644
index ae7ef10..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/ldapauth.def
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY   LDAPAuth
-
-             EXPORTS
-               CUGP
-			   
diff --git a/ica/win32/addon/ms-logon/ldapauth/ldapauth.dsw b/ica/win32/addon/ms-logon/ldapauth/ldapauth.dsw
deleted file mode 100644
index 8c28815..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/ldapauth.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "ldapauth"=".\ldapauth.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/ldapauth/resource.h b/ica/win32/addon/ms-logon/ldapauth/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/ldapauth/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.cpp b/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.cpp
deleted file mode 100644
index 7d2d3bb..0000000
--- a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.cpp
+++ /dev/null
@@ -1,614 +0,0 @@
-//ldapAuth9x.cpp
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-
-
-#include "ldapauth9x.h"
-
-/////////////////////////
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-                                         )
-{
-    switch (ul_reason_for_call)
-        {
-                case DLL_PROCESS_ATTACH:
-                case DLL_THREAD_ATTACH:
-                case DLL_THREAD_DETACH:
-                case DLL_PROCESS_DETACH:
-                        break;
-    }
-    return TRUE;
-}
-
-
-
-
-LDAPAUTH9X_API
-BOOL CUGP(char * userin,char *password,char *machine, char * groupin,int locdom)
-{
-        OSVERSIONINFO ovi = { sizeof ovi };
-        GetVersionEx( &ovi );
-        //if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-    //  ovi.dwMajorVersion >= 5 )
-        if ( 5 >= 5 )
-        {
-        //Handle the command line arguments.
-        LPOLESTR pszBuffer = new OLECHAR[MAX_PATH*2];
-        LPOLESTR pszBuffer2 = new OLECHAR[MAX_PATH*2];
-        LPOLESTR pszBuffer3 = new OLECHAR[MAX_PATH*2];
-        LPOLESTR pszBuffer4 = new OLECHAR[MAX_PATH*2];
-        mbstowcs( (wchar_t *) pszBuffer, userin, MAX_PATH );
-        mbstowcs( (wchar_t *) pszBuffer2, password, MAX_PATH );
-        mbstowcs( (wchar_t *) pszBuffer3, machine, MAX_PATH );
-        mbstowcs( (wchar_t *) pszBuffer4, groupin, MAX_PATH );
-        HRESULT hr = S_OK;
-        //Get rootDSE and the domain container's DN.
-        IADs *pObject = NULL;
-        IADs *pObjectUser = NULL;
-        IADs *pObjectGroup = NULL;
-        IDirectorySearch *pDS = NULL;
-        LPOLESTR szPath = new OLECHAR[MAX_PATH];
-        LPOLESTR myPath = new OLECHAR[MAX_PATH];
-        
-        wcscpy(szPath,L"LDAP://dc1.ad.local/dc=ad,dc=local"); //set to root of domain or search path
-        wprintf(szPath);
-        wprintf(L"\n");
-        //VariantClear(&var);
-        if (pObject)
-                {
-                        pObject->Release();
-                        pObject = NULL;
-                }
-        wprintf( szPath);
-        wprintf(L"\n");
-        //Bind to the root of the current domain.
-        hr = ADsOpenObject(szPath,pszBuffer,pszBuffer2,
-                         ADS_SECURE_AUTHENTICATION,IID_IDirectorySearch,(void**)&pDS);
-        if (SUCCEEDED(hr))
-                {
-                        if (SUCCEEDED(hr))
-                                {
-                                        hr =  FindUserByName(pDS, pszBuffer, pszBuffer, pszBuffer2, &pObjectUser);
-                                        if (FAILED(hr))
-                                                {
-                                                        wprintf(L"User not found %i\n",hr);
-                                                        delete [] pszBuffer;
-                                                        delete [] pszBuffer2;
-                                                        delete [] pszBuffer3;
-                                                        delete [] szPath;
-                                                        delete [] myPath;
-                                                        if (pDS) pDS->Release();
-                                                        if (pObjectUser) pObjectUser->Release();
-                                                        return false;
-                                                }
-                                        if (pObjectUser) pObjectUser->Release();
-                                        ///////////////////// VNCACCESS
-                                        hr =  FindGroup(pDS, pszBuffer, pszBuffer, pszBuffer2, &pObjectGroup,pszBuffer4);
-                                        if (pObjectGroup)
-                                                                {
-                                                                        pObjectGroup->Release();
-                                                                        pObjectGroup = NULL;
-                                                                }
-                                        if (FAILED(hr)) wprintf(L"group not found\n");
-                                        if (SUCCEEDED(hr))
-                                                {
-                                                        wprintf(L"Group found OK\n");
-                                                        IADsGroup *     pIADsG;
-                                                        hr = ADsOpenObject( gbsGroup,pszBuffer, pszBuffer2, 
-                                                                        ADS_SECURE_AUTHENTICATION,IID_IADsGroup, (void**) &pIADsG);
-                                                        if (SUCCEEDED(hr))
-                                                                {
-                                                                        VARIANT_BOOL bMember = FALSE;  
-                                                                        hr = pIADsG->IsMember(gbsMember,&bMember);
-                                                                        if (SUCCEEDED(hr))
-                                                                                {
-                                                                                        if (bMember == -1)
-                                                                                                {
-                                                                                                        wprintf(L"Object \n\n%s\n\n IS a member of the following Group:\n\n%s\n\n",gbsMember,gbsGroup);
-                                                                                                        delete [] pszBuffer;
-                                                                                                        delete [] pszBuffer2;
-                                                                                                        delete [] pszBuffer3;
-                                                                                                        delete [] szPath;
-                                                                                                        delete [] myPath;
-                                                                                                        if (pDS) pDS->Release();
-                                                                                                        return true;
-                                                                                                }
-                                                                                        else
-                                                                                                {
-                                                                                                        BSTR bsMemberGUID = NULL;
-                                                                                                        IDirectoryObject * pDOMember = NULL;
-                                                                                                        hr = ADsOpenObject( gbsMember,pszBuffer, pszBuffer2, 
-                                                                                                                        ADS_SECURE_AUTHENTICATION,IID_IDirectoryObject, (void**) &pDOMember);
-                                                                                                        if (SUCCEEDED(hr))
-                                                                                                                {
-                                                                                                                        hr = GetObjectGuid(pDOMember,bsMemberGUID);
-                                                                                                                        pDOMember->Release();
-                                                                                                                        pDOMember  = NULL;
-                                                                                                                        if (RecursiveIsMember(pIADsG,bsMemberGUID,gbsMember,true, pszBuffer, pszBuffer2))
-                                                                                                                                {
-                                                                                                                                        delete [] pszBuffer;
-                                                                                                                                        delete [] pszBuffer2;
-                                                                                                                                        delete [] pszBuffer3;
-                                                                                                                                        delete [] szPath;
-                                                                                                                                        delete [] myPath;
-                                                                                                                                        if (pDS) pDS->Release();
-                                                                                                                                        return true;
-                                                                                                                                }
-                                                                                                                }
-                                                                                        }//else bmember
-                                                                        }//ismember
-                                                        }//iadsgroup 
-                                        }//Findgroup
-                                        wprintf(L"USER not found in group\n");
-                                        
-                                }//user
-                }
-        if (pDS) pDS->Release();
-
-                /*LOGFAILED(pszBuffer3,pszBuffer);*/
-                delete [] pszBuffer;
-                delete [] pszBuffer2;
-                delete [] pszBuffer3;
-                delete [] szPath;
-                delete [] myPath;
-                return false;
-        }
-        return false;
-}
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-                                           LPOLESTR szFindUser, LPOLESTR  pwszUser, LPOLESTR pwszPassword, //Name of user to find.
-                                           IADs **ppUser) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-        if ((!pSearchBase)||(!szFindUser))
-                return E_INVALIDARG;
-        //Create search filter
-        LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-        LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-        wcscpy(pszSearchFilter, L"(&(objectClass=user)(samAccountName=");
-        wcscat(pszSearchFilter, szFindUser);
-        wcscat(pszSearchFilter, L"))");
-    //Search entire subtree from root.
-        ADS_SEARCHPREF_INFO SearchPrefs;
-        SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-        SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-        SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-        // COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-        // Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-        // Set attributes to return
-        CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-        wprintf(pszSearchFilter);
-        wprintf(L"\n");
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-                                          pszAttribute,
-                                                                  dwAttrNameSize,
-                                                                  &hSearch
-                                                                  );
-        if (SUCCEEDED(hr))
-        {    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-                {
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-                            // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-                            if ( SUCCEEDED(hr) )
-                            {
-                                    // Print the data for the column and free the column
-                                        // Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-                                        hr = ADsOpenObject(szADsPath,
-                                                                         pwszUser,
-                                                                         pwszPassword,
-                                                                         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-                                                                         IID_IADs,
-                                                                         (void**)ppUser);
-                                        if (SUCCEEDED(hr))
-                                        { 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-                                           hrObj = S_OK;
-                                           gbsMember=SysAllocString(col.pADsValues->CaseIgnoreString);
-                                        }
-                                    pSearchBase->FreeColumn( &col );
-                            }
-                            else
-                                    hr = E_FAIL;
-            }
-                }
-                // Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-        }
-        if (FAILED(hrObj))
-                hr = hrObj;
-    return hr;
-}
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-                                           LPOLESTR szFindUser, LPOLESTR  pwszUser, LPOLESTR pwszPassword, //Name of user to find.
-                                           IADs **ppUser,LPOLESTR szGroup) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-        if ((!pSearchBase)||(!szFindUser))
-                return E_INVALIDARG;
-        //Create search filter
-        LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-        LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-        wcscpy(pszSearchFilter, L"(&(objectClass=group)(cn=");
-        wcscat(pszSearchFilter,szGroup);
-        wcscat(pszSearchFilter, L"))");
-    //Search entire subtree from root.
-        ADS_SEARCHPREF_INFO SearchPrefs;
-        SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-        SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-        SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-        // COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-        // Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-        // Set attributes to return
-        CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-                                          pszAttribute,
-                                                                  dwAttrNameSize,
-                                                                  &hSearch
-                                                                  );
-        if (SUCCEEDED(hr))
-        {    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-                {
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-                            // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-                            if ( SUCCEEDED(hr) )
-                            {
-                                    // Print the data for the column and free the column
-                                        // Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-                                        hr = ADsOpenObject(szADsPath,
-                                                                         pwszUser,
-                                                                         pwszPassword,
-                                                                         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-                                                                         IID_IADs,
-                                                                         (void**)ppUser);
-                                        if (SUCCEEDED(hr))
-                                        { 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-                                           hrObj = S_OK;
-                                           gbsGroup=SysAllocString(col.pADsValues->CaseIgnoreString);
-                                        }
-                                    pSearchBase->FreeColumn( &col );
-                            }
-                            else
-                                    hr = E_FAIL;
-            }
-                }
-                // Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-        }
-        if (FAILED(hrObj))
-                hr = hrObj;
-    return hr;
-}
-
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  RecursiveIsMember()                       - Recursively scans the members of passed IADsGroup ptr
-                                                and any groups that belong to the passed ptr- for membership
-                                                of Passed group.
-                                                Will return a TRUE if the member is found in the passed group,
-                                                or if the passed member is a member of any group which is a member
-                                                of the passed group.
-    Parameters
- 
-        IADsGroup *     pADsGroup       - Group from which to verify members.
-        LPWSTR          pwszMember      - LDAP path for object to verify membership.
-        BOOL            bVerbose        - IF TRUE, will output verbose information for the scan.
- 
-    OPTIONAL Parameters
- 
-       LPOLESTR  pwszUser           - User Name and Password, if the parameters are not passed, 
-       LPOLESTER pwszPassword       - binding will use ADsGetObject; if the parameters are
-                                    - specified, ADsOpenObject is used, passing user name and password.
-*/
- 
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword)
-{
-    HRESULT         hr                = S_OK;     // COM Result Code
-    IADsMembers *   pADsMembers       = NULL;     // Ptr to Members of the IADsGroup
-    BOOL            fContinue         = TRUE;     // Looping Variable
-    IEnumVARIANT *  pEnumVariant      = NULL;     // Ptr to the Enum variant
-    IUnknown *      pUnknown          = NULL;     // IUnknown for getting the ENUM initially
-    VARIANT         VariantArray[FETCH_NUM];      // Variant array for temp holding returned data
-    ULONG           ulElementsFetched = NULL;     // Number of elements retrieved
-    BSTR            bsGroupPath       = NULL;
-    BOOL            bRet              = FALSE;
-
-    if(!pADsGroup || !pwszMemberGUID || !pwszMemberPath)
-    {
-        return FALSE;
-    }
- 
-    // Get the path of the object passed in
-    hr = pADsGroup->get_ADsPath(&bsGroupPath);
- 
-    if (!SUCCEEDED(hr))
-        return hr;
- 
-    if (bVerbose)
-    {
-        WCHAR pwszOutput[2048];
-        wsprintf(pwszOutput,L"Checking the Group:\n\n%s\n\n for the member:\n\n%s\n\n",bsGroupPath,pwszMemberPath);
-        PrintBanner(pwszOutput);
-    }
- 
-    // Get an interface pointer to the IADsCollection of members
-    hr = pADsGroup->Members(&pADsMembers);
- 
-    if (SUCCEEDED(hr))
-    {
-        // Query the IADsCollection of members for a new ENUM Interface
-        // Be aware that the enum comes back as an IUnknown *
-        hr = pADsMembers->get__NewEnum(&pUnknown);
- 
-        if (SUCCEEDED(hr))
-        {
-            // QI the IUnknown * for an IEnumVARIANT interface
-            hr = pUnknown->QueryInterface(IID_IEnumVARIANT, (void **)&pEnumVariant);
- 
-            if (SUCCEEDED(hr))
-            {
-                // While have not hit errors or end of data....
-                while (fContinue) 
-                {
-                   ulElementsFetched = 0;
-                    // Get a "batch" number of group members-number of rows specified by FETCH_NUM
-                    hr = ADsEnumerateNext(pEnumVariant, FETCH_NUM, VariantArray, &ulElementsFetched);
- 
-                    if (ulElementsFetched )
-                    {
-                        // Loop through the current batch-printing the path for each member.
-                        for (ULONG i = 0; i < ulElementsFetched; i++ ) 
-                        {
-                            IDispatch * pDispatch         = NULL; // ptr for holding dispath of element
-                            BSTR        bstrCurrentPath   = NULL; // Holds path of object
-                            BSTR        bstrGuidCurrent   = NULL; // Holds path of object
-                            IDirectoryObject * pIDOCurrent = NULL;// Holds the current object          
- 
-                            // Get the dispatch ptr for the variant
-                            pDispatch = VariantArray[i].pdispVal;
-//                            assert(HAS_BIT_STYLE(VariantArray[i].vt,VT_DISPATCH));
- 
-                            // Get the IADs interface for the "member" of this group
-                            hr = pDispatch->QueryInterface(IID_IDirectoryObject,
-                                                           (VOID **) &pIDOCurrent ) ;
- 
-                            if (SUCCEEDED(hr))
-                            {
-                                // Get the GUID for the current object
-                                hr = GetObjectGuid(pIDOCurrent,bstrGuidCurrent);
- 
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                IADs * pIADsCurrent = NULL;
- 
-                                // Retrieve the IADs Interface for the current object
-                                hr = pIDOCurrent->QueryInterface(IID_IADs,(void**)&pIADsCurrent);
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                // Get the ADsPath property for this member
-                                hr = pIADsCurrent->get_ADsPath(&bstrCurrentPath);
- 
-                                if (SUCCEEDED(hr))
-                                {
-                                    if (bVerbose)
-                                        wprintf(L"Comparing:\n\n%s\nWITH:\n%s\n\n",bstrGuidCurrent,pwszMemberGUID);
-                                    
-                                    // Verify that the member of this group is Equal to passed.
-                                    if (_wcsicmp(bstrGuidCurrent,pwszMemberGUID)==0)
-                                    {
-                                        if (bVerbose)
-                                            wprintf(L"!!!!!Object:\n\n%s\n\nIs a member of\n\n%s\n\n",pwszMemberPath,bstrGuidCurrent);   
- 
-                                        bRet = TRUE;
-                                        break;
-                                    }
-                                    else // Otherwise, bind to this and see if it is a group.
-                                    {    // If is it a group then the QI to IADsGroup succeeds
-                                        
-                                        IADsGroup * pIADsGroupAsMember = NULL;
-                                        
-                                        if (pwszUser)
-                                            hr = ADsOpenObject( bstrCurrentPath,
-                                                                pwszUser, 
-                                                                pwszPassword, 
-                                                                ADS_SECURE_AUTHENTICATION,
-                                                                IID_IADsGroup, 
-                                                                (void**) &pIADsGroupAsMember);
-                                        else
-                                            hr = ADsGetObject( bstrCurrentPath, IID_IADsGroup,(void **)&pIADsGroupAsMember);
- 
-                                        // If bind was completed, then this is a group.
-                                        if (SUCCEEDED(hr))
-                                        {
-                                            // Recursively call this group to verify this group.
-                                            BOOL bRetRecurse;
-                                            bRetRecurse = RecursiveIsMember(pIADsGroupAsMember,pwszMemberGUID,pwszMemberPath,bVerbose,pwszUser ,pwszPassword );
-                                            
-                                            if (bRetRecurse)
-                                            {
-                                                bRet = TRUE;
-                                                break;
-                                            }
-                                            pIADsGroupAsMember->Release();
-                                            pIADsGroupAsMember = NULL;
-                                        }
-                                    }
-                                    SysFreeString(bstrCurrentPath);
-                                    bstrCurrentPath = NULL;
- 
-                                    SysFreeString(bstrGuidCurrent);
-                                    bstrGuidCurrent = NULL;
-                                }
-                                // Release
-                                pIDOCurrent->Release();
-                                pIDOCurrent = NULL;
-                                if (pIADsCurrent)
-                                {
-                                    pIADsCurrent->Release();
-                                    pIADsCurrent = NULL;
-                                }
-                            }
-                         }
-                        // Clear the variant array.
-                        memset(VariantArray, 0, sizeof(VARIANT)*FETCH_NUM);
-                    }
-                    else
-                        fContinue = FALSE;
-                }
-                pEnumVariant->Release();
-                pEnumVariant = NULL;
-            }
-            pUnknown->Release();
-            pUnknown = NULL;
-        }
-        pADsMembers ->Release();
-        pADsMembers  = NULL;
-    }
- 
-    // Free the group path if retrieved.
-    if (bsGroupPath)
-    {
-        SysFreeString(bsGroupPath);
-        bsGroupPath = NULL;
-    }
-    return bRet;
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  GetObjectGuid()    - Retrieves the GUID, in string form, from the passed Directory Object.
-                         Returns S_OK on success.
- 
-    Parameters
- 
-        IDirectoryObject *  pDO     -   Directory Object from where GUID is retrieved.
-        BSTR             &  bsGuid  -   Returned GUID            
-*/
- 
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid)
-{
- 
-    GUID *pObjectGUID   = NULL;
-    PADS_ATTR_INFO      pAttributeEntries;
-    LPWSTR              pAttributeName = L"objectGUID";  // Get the GUID for the object.
-    DWORD               dwAttributesReturned = 0;
-    HRESULT             hr;
-
-    if(!pDO)
-    {
-        return E_FAIL;
-    }
-
-    hr = pDO->GetObjectAttributes(  &pAttributeName, // objectGUID
-                                    1, //Only objectGUID
-                                    &pAttributeEntries, // Returned attributes
-                                    &dwAttributesReturned // Number of attributes returned
-                                    );
- 
-    if (SUCCEEDED(hr) && dwAttributesReturned>0)
-    {
-        // Be sure the right type was retrieved--objectGUID is ADSTYPE_OCTET_STRING
-        if (pAttributeEntries->dwADsType == ADSTYPE_OCTET_STRING)
-        {
-            // Get COM converted string version of the GUID
-            // lpvalue should be LPBYTE. Should be able to cast it to ptr to GUID.
-            pObjectGUID = (GUID*)(pAttributeEntries->pADsValues[0].OctetString.lpValue);
-            
-            // OLE str to fit a GUID
-            
-            LPOLESTR szGUID = new WCHAR [64];
-            szGUID[0]=NULL;
-            // Convert GUID to string.
-            ::StringFromGUID2(*pObjectGUID, szGUID, 39); 
-            bsGuid = SysAllocString(szGUID);
-            
-            delete [] szGUID;
-         }
-    }
- 
-    return hr;
- 
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  PrintBanner()   -       Prints a banner to the screen
- 
-    Parameters
- 
-                LPOLESTR pwszBanner   - String to print
-*/
-void PrintBanner(LPOLESTR pwszBanner)
-{
-    _putws(L"");
-    _putws(L"////////////////////////////////////////////////////");
-    wprintf(L"\t");
-    _putws(pwszBanner);
-    _putws(L"////////////////////////////////////////////////////\n");
-}
\ No newline at end of file
diff --git a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.h b/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.h
deleted file mode 100644
index 22e251c..0000000
--- a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.h
+++ /dev/null
@@ -1,57 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTH_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTH_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef LDAPAUTH9X_EXPORTS
-#define LDAPAUTH9X_API __declspec(dllexport)
-#else
-#define LDAPAUTH9X_API __declspec(dllimport)
-#endif
-
-#include <windows.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <wchar.h>
-#include <math.h>
-#include <objbase.h>
-#include <activeds.h>
-#include <Dsgetdc.h>
-#include <sddl.h>
-#include <assert.h>
-
-
-#define MAXLEN 256
-//#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-//#define NERR_Success            0
-//#define LG_INCLUDE_INDIRECT 1
-#define BUFSIZE 1024
-
-#define FETCH_NUM 100
-void PrintBanner(LPOLESTR pwszBanner);
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid);
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword);
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-                                           LPOLESTR szFindUser, LPOLESTR  pwszUser, LPOLESTR pwszPassword, //Name of user to find.
-                                           IADs **ppUser,LPOLESTR szGroup); //Return a pointer to the user
-
-
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-                                           LPOLESTR szFindUser, LPOLESTR  pwszUser, LPOLESTR pwszPassword, //Name of user to find.
-                                           IADs **ppUser); //Return a pointer to the user
-
-
-BSTR gbsGroup     = NULL; // <Group to check> This is the LDAP path for the group to check
-	BSTR gbsMember    = NULL; // <Member to check> 
-	BSTR gbsUSER      = NULL;
-	BSTR gbsPASS      = NULL; // <Password used for binding to the DC>
-
-
-
-LDAPAUTH9X_API BOOL CUGP(char * userin,char *password,char *machine,char *group,int locdom);
-
diff --git a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.rc b/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.rc
deleted file mode 100644
index 3ede046..0000000
--- a/ica/win32/addon/ms-logon/ldapauth9x/ldapAuth9x.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Active Directory authentication for UltraVNC on Win9x\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "ldapAuth9x\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "ldapAuth9x.dll\0"
-            VALUE "ProductName", "UltraVNC ldapAuth9x\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/ldapauth9x/ldapauth9x.def b/ica/win32/addon/ms-logon/ldapauth9x/ldapauth9x.def
deleted file mode 100644
index 170b08b..0000000
--- a/ica/win32/addon/ms-logon/ldapauth9x/ldapauth9x.def
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY   LDAPAuth9x
-
-             EXPORTS
-               CUGP
-			   
diff --git a/ica/win32/addon/ms-logon/ldapauth9x/resource.h b/ica/win32/addon/ms-logon/ldapauth9x/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/ldapauth9x/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.cpp b/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.cpp
deleted file mode 100644
index 48c6f96..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.cpp
+++ /dev/null
@@ -1,656 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-
-
-#include "ldapauthnt4.h"
-
-/////////////////////////
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 )
-{
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-
-
-LDAPAUTHNT4_API
-BOOL CUGP(char * userin,char *password,char *machine,char *groupin,int locdom)
-{
-
-	{
-	//Handle the command line arguments.
-	LPOLESTR pszBuffer = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer2 = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer3 = new OLECHAR[MAX_PATH*2];
-	LPOLESTR pszBuffer4 = new OLECHAR[MAX_PATH*2];
-	mbstowcs( (wchar_t *) pszBuffer, userin, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer2, password, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer3, machine, MAX_PATH );
-	mbstowcs( (wchar_t *) pszBuffer4, groupin, MAX_PATH );
-	HRESULT hr = S_OK;
-	//Get rootDSE and the domain container's DN.
-	IADs *pObject = NULL;
-	IADs *pObjectUser = NULL;
-	IADs *pObjectGroup = NULL;
-	IDirectorySearch *pDS = NULL;
-	LPOLESTR szPath = new OLECHAR[MAX_PATH];
-	LPOLESTR myPath = new OLECHAR[MAX_PATH];
-	VARIANT var;
-	////////////FIND SERVER NEEDED FOR NT4
-	DWORD dwRet;
-	PDOMAIN_CONTROLLER_INFO pdci;
-	dwRet = DsGetDcName(NULL, NULL, NULL, NULL	, DS_PDC_REQUIRED, &pdci);
-	if (ERROR_SUCCESS!=dwRet) 
-		{
-			wprintf(L"PDC not found try a rediscover \n");
-			dwRet = DsGetDcName(NULL, NULL, NULL, NULL	, DS_DIRECTORY_SERVICE_REQUIRED|DS_FORCE_REDISCOVERY, &pdci);
-			if (ERROR_SUCCESS!=dwRet)
-			{
-				wprintf(L"PDC not found \n");
-				delete [] pszBuffer;
-				delete [] pszBuffer2;
-				delete [] pszBuffer3;
-				delete [] pszBuffer4;
-				delete [] szPath;
-				delete [] myPath;
-				return false;
-			}
-		}
-	//////////////////////////////////////////
-	wcscpy(szPath,L"LDAP://");
-	wcscat(szPath,pdci->DomainControllerName+2);
-	wcscat(szPath,L"/rootDSE");
-	wprintf(szPath);
-	wprintf(L"\n");
-
-	hr = ADsOpenObject(szPath,
-					pszBuffer,
-					pszBuffer2,
-					ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-					IID_IADs,
-					(void**)&pObject);
-	if (FAILED(hr))
-		{
-			bool result=false;
-			delete [] pszBuffer;
-			delete [] pszBuffer2;
-			delete [] pszBuffer3;
-			delete [] pszBuffer4;
-			delete [] szPath;
-			delete [] myPath;
-			return result;
-		}
-	hr = pObject->Get(L"defaultNamingContext",&var);
-
-	if (SUCCEEDED(hr))
-		{
-			wcscpy(szPath,L"LDAP://");
-			wcscat(szPath,pdci->DomainControllerName+2);
-			wcscat(szPath,L"/");
-			wcscat(szPath,var.bstrVal);
-			VariantClear(&var);
-			if (pObject)
-				{
-					pObject->Release();
-					pObject = NULL;
-				}
-			wprintf( szPath);
-			wprintf(L"\n");
-			//Bind to the root of the current domain.
-			hr = ADsOpenObject(szPath,pszBuffer,pszBuffer2,
-					 ADS_SECURE_AUTHENTICATION,IID_IDirectorySearch,(void**)&pDS);
-			if (SUCCEEDED(hr))
-				{
-					if (SUCCEEDED(hr))
-						{
-							hr =  FindUserByName(pDS, pszBuffer, &pObjectUser );
-							if (FAILED(hr))
-								{
-									delete [] pszBuffer;
-									delete [] pszBuffer2;
-									delete [] pszBuffer3;
-									delete [] pszBuffer4;
-									delete [] szPath;
-									delete [] myPath;
-									if (pDS) pDS->Release();
-									if (pObjectUser) pObjectUser->Release();
-									return false;
-								}
-							if (pObjectUser) pObjectUser->Release();
-							///////////////////// VNCACCESS
-							hr =  FindGroup(pDS, pszBuffer, &pObjectGroup,pszBuffer4);
-							if (pObjectGroup)
-										{
-											pObjectGroup->Release();
-											pObjectGroup = NULL;
-										}
-							if (SUCCEEDED(hr))
-								{
-									wprintf(L"FindGroup OK\n");
-									IADsGroup *     pIADsG;
-									hr = ADsOpenObject( gbsGroup,pszBuffer, pszBuffer2, 
-											ADS_SECURE_AUTHENTICATION,IID_IADsGroup, (void**) &pIADsG);
-									if (SUCCEEDED(hr))
-										{
-											VARIANT_BOOL bMember = FALSE;  
-											hr = pIADsG->IsMember(gbsMember,&bMember);
-											if (SUCCEEDED(hr))
-												{
-													if (bMember == -1)
-														{
-															wprintf(L"Object \n\n%s\n\n IS a member of the following Group:\n\n%s\n\n",gbsMember,gbsGroup);
-															delete [] pszBuffer;
-															delete [] pszBuffer2;
-															delete [] pszBuffer3;
-															delete [] pszBuffer4;
-															delete [] szPath;
-															delete [] myPath;
-															if (pDS) pDS->Release();
-															return true;
-														}
-													else
-														{
-															BSTR bsMemberGUID = NULL;
-															IDirectoryObject * pDOMember = NULL;
-															hr = ADsOpenObject( gbsMember,pszBuffer, pszBuffer2, 
-																	ADS_SECURE_AUTHENTICATION,IID_IDirectoryObject, (void**) &pDOMember);
-															if (SUCCEEDED(hr))
-																{
-																	hr = GetObjectGuid(pDOMember,bsMemberGUID);
-																	pDOMember->Release();
-																	pDOMember  = NULL;
-																	if (RecursiveIsMember(pIADsG,bsMemberGUID,gbsMember,true, pszBuffer, pszBuffer2))
-																		{
-																			delete [] pszBuffer;
-																			delete [] pszBuffer2;
-																			delete [] pszBuffer3;
-																			delete [] pszBuffer4;
-																			delete [] szPath;
-																			delete [] myPath;
-																			if (pDS) pDS->Release();
-																			return true;
-																		}
-																}
-													}//else bmember
-											}//ismember
-									}//iadsgroup 
-							}//Findgroup
-							
-						}//user
-				}
-		if (pDS) pDS->Release();
-		}
-	delete [] pszBuffer;
-	delete [] pszBuffer2;
-	delete [] pszBuffer3;
-	delete [] pszBuffer4;
-	delete [] szPath;
-	delete [] myPath;
-	return false;
-	}
-	return false;
-}
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-	if ((!pSearchBase)||(!szFindUser))
-		return E_INVALIDARG;
-	//Create search filter
-	LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-	LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-	wcscpy(pszSearchFilter, L"(&(objectCategory=person)(objectClass=user)(samAccountName=");
-	wcscat(pszSearchFilter, szFindUser);
-	wcscat(pszSearchFilter,	L"))");
-    //Search entire subtree from root.
-	ADS_SEARCHPREF_INFO SearchPrefs;
-	SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-	SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-	SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-	// COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-	// Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-	// Set attributes to return
-	CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-		                          pszAttribute,
-								  dwAttrNameSize,
-								  &hSearch
-								  );
-	if (SUCCEEDED(hr))
-	{    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-		{
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-			    // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-			    if ( SUCCEEDED(hr) )
-			    {
-				    // Print the data for the column and free the column
-					// Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-					hr = ADsOpenObject(szADsPath,
-									 NULL,
-									 NULL,
-									 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-									 IID_IADs,
-									 (void**)ppUser);
-					if (SUCCEEDED(hr))
-					{ 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-					   hrObj = S_OK;
-					   gbsMember=SysAllocString(col.pADsValues->CaseIgnoreString);
-					}
-				    pSearchBase->FreeColumn( &col );
-			    }
-			    else
-				    hr = E_FAIL;
-            }
-		}
-		// Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-	}
-	if (FAILED(hrObj))
-		hr = hrObj;
-    return hr;
-}
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser,LPOLESTR szGroup) //Return a pointer to the user
-{
-    HRESULT hrObj = E_FAIL;
-    HRESULT hr = E_FAIL;
-	if ((!pSearchBase)||(!szFindUser))
-		return E_INVALIDARG;
-	//Create search filter
-	LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
-	LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
-	wcscpy(pszSearchFilter, L"(&(objectClass=group)(cn=");
-	wcscat(pszSearchFilter,	szGroup);
-	wcscat(pszSearchFilter,	L"))");
-    //Search entire subtree from root.
-	ADS_SEARCHPREF_INFO SearchPrefs;
-	SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
-	SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
-	SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
-    DWORD dwNumPrefs = 1;
-	// COL for iterations
-    ADS_SEARCH_COLUMN col;
-    // Handle used for searching
-    ADS_SEARCH_HANDLE hSearch;
-	// Set the search preference
-    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
-    if (FAILED(hr))
-        return hr;
-	// Set attributes to return
-	CONST DWORD dwAttrNameSize = 1;
-    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};
-
-    // Execute the search
-    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
-		                          pszAttribute,
-								  dwAttrNameSize,
-								  &hSearch
-								  );
-	if (SUCCEEDED(hr))
-	{    
-
-    // Call IDirectorySearch::GetNextRow() to retrieve the next row 
-    //of data
-        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
-		{
-            // loop through the array of passed column names,
-            // print the data for each column
-            for (DWORD x = 0; x < dwAttrNameSize; x++)
-            {
-			    // Get the data for this column
-                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
-			    if ( SUCCEEDED(hr) )
-			    {
-				    // Print the data for the column and free the column
-					// Note the attribute we asked for is type CaseIgnoreString.
-                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString); 
-					hr = ADsOpenObject(szADsPath,
-									 NULL,
-									 NULL,
-									 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
-									 IID_IADs,
-									 (void**)ppUser);
-					if (SUCCEEDED(hr))
-					{ 
-                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString); 
-					   hrObj = S_OK;
-					   gbsGroup=SysAllocString(col.pADsValues->CaseIgnoreString);
-					}
-				    pSearchBase->FreeColumn( &col );
-			    }
-			    else
-				    hr = E_FAIL;
-            }
-		}
-		// Close the search handle to clean up
-        pSearchBase->CloseSearchHandle(hSearch);
-	}
-	if (FAILED(hrObj))
-		hr = hrObj;
-    return hr;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  RecursiveIsMember()                       - Recursively scans the members of passed IADsGroup ptr
-                                                and any groups that belong to the passed ptr- for membership
-                                                of Passed group.
-                                                Will return a TRUE if the member is found in the passed group,
-                                                or if the passed member is a member of any group which is a member
-                                                of the passed group.
-    Parameters
- 
-        IADsGroup *     pADsGroup       - Group from which to verify members.
-        LPWSTR          pwszMember      - LDAP path for object to verify membership.
-        BOOL            bVerbose        - IF TRUE, will output verbose information for the scan.
- 
-    OPTIONAL Parameters
- 
-       LPOLESTR  pwszUser           - User Name and Password, if the parameters are not passed, 
-       LPOLESTER pwszPassword       - binding will use ADsGetObject; if the parameters are
-                                    - specified, ADsOpenObject is used, passing user name and password.
-*/
- 
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword)
-{
-    HRESULT         hr                = S_OK;     // COM Result Code
-    IADsMembers *   pADsMembers       = NULL;     // Ptr to Members of the IADsGroup
-    BOOL            fContinue         = TRUE;     // Looping Variable
-    IEnumVARIANT *  pEnumVariant      = NULL;     // Ptr to the Enum variant
-    IUnknown *      pUnknown          = NULL;     // IUnknown for getting the ENUM initially
-    VARIANT         VariantArray[FETCH_NUM];      // Variant array for temp holding returned data
-    ULONG           ulElementsFetched = NULL;     // Number of elements retrieved
-    BSTR            bsGroupPath       = NULL;
-    BOOL            bRet              = FALSE;
-
-    if(!pADsGroup || !pwszMemberGUID || !pwszMemberPath)
-    {
-        return FALSE;
-    }
- 
-    // Get the path of the object passed in
-    hr = pADsGroup->get_ADsPath(&bsGroupPath);
- 
-    if (!SUCCEEDED(hr))
-        return hr;
- 
-    if (bVerbose)
-    {
-        WCHAR pwszOutput[2048];
-        wsprintf(pwszOutput,L"Checking the Group:\n\n%s\n\n for the member:\n\n%s\n\n",bsGroupPath,pwszMemberPath);
-        PrintBanner(pwszOutput);
-    }
- 
-    // Get an interface pointer to the IADsCollection of members
-    hr = pADsGroup->Members(&pADsMembers);
- 
-    if (SUCCEEDED(hr))
-    {
-        // Query the IADsCollection of members for a new ENUM Interface
-        // Be aware that the enum comes back as an IUnknown *
-        hr = pADsMembers->get__NewEnum(&pUnknown);
- 
-        if (SUCCEEDED(hr))
-        {
-            // QI the IUnknown * for an IEnumVARIANT interface
-            hr = pUnknown->QueryInterface(IID_IEnumVARIANT, (void **)&pEnumVariant);
- 
-            if (SUCCEEDED(hr))
-            {
-                // While have not hit errors or end of data....
-                while (fContinue) 
-                {
-                   ulElementsFetched = 0;
-                    // Get a "batch" number of group members-number of rows specified by FETCH_NUM
-                    hr = ADsEnumerateNext(pEnumVariant, FETCH_NUM, VariantArray, &ulElementsFetched);
- 
-                    if (ulElementsFetched )
-                    {
-                        // Loop through the current batch-printing the path for each member.
-                        for (ULONG i = 0; i < ulElementsFetched; i++ ) 
-                        {
-                            IDispatch * pDispatch         = NULL; // ptr for holding dispath of element
-                            BSTR        bstrCurrentPath   = NULL; // Holds path of object
-                            BSTR        bstrGuidCurrent   = NULL; // Holds path of object
-                            IDirectoryObject * pIDOCurrent = NULL;// Holds the current object          
- 
-                            // Get the dispatch ptr for the variant
-                            pDispatch = VariantArray[i].pdispVal;
-//                            assert(HAS_BIT_STYLE(VariantArray[i].vt,VT_DISPATCH));
- 
-                            // Get the IADs interface for the "member" of this group
-                            hr = pDispatch->QueryInterface(IID_IDirectoryObject,
-                                                           (VOID **) &pIDOCurrent ) ;
- 
-                            if (SUCCEEDED(hr))
-                            {
-                                // Get the GUID for the current object
-                                hr = GetObjectGuid(pIDOCurrent,bstrGuidCurrent);
- 
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                IADs * pIADsCurrent = NULL;
- 
-                                // Retrieve the IADs Interface for the current object
-                                hr = pIDOCurrent->QueryInterface(IID_IADs,(void**)&pIADsCurrent);
-                                if (FAILED(hr))
-                                    return hr;
- 
-                                // Get the ADsPath property for this member
-                                hr = pIADsCurrent->get_ADsPath(&bstrCurrentPath);
- 
-                                if (SUCCEEDED(hr))
-                                {
-                                    if (bVerbose)
-                                        wprintf(L"Comparing:\n\n%s\nWITH:\n%s\n\n",bstrGuidCurrent,pwszMemberGUID);
-                                    
-                                    // Verify that the member of this group is Equal to passed.
-                                    if (_wcsicmp(bstrGuidCurrent,pwszMemberGUID)==0)
-                                    {
-                                        if (bVerbose)
-                                            wprintf(L"!!!!!Object:\n\n%s\n\nIs a member of\n\n%s\n\n",pwszMemberPath,bstrGuidCurrent);   
- 
-                                        bRet = TRUE;
-                                        break;
-                                    }
-                                    else // Otherwise, bind to this and see if it is a group.
-                                    {    // If is it a group then the QI to IADsGroup succeeds
-                                        
-                                        IADsGroup * pIADsGroupAsMember = NULL;
-                                        
-                                        if (pwszUser)
-                                            hr = ADsOpenObject( bstrCurrentPath,
-                                                                pwszUser, 
-                                                                pwszPassword, 
-                                                                ADS_SECURE_AUTHENTICATION,
-                                                                IID_IADsGroup, 
-                                                                (void**) &pIADsGroupAsMember);
-                                        else
-                                            hr = ADsGetObject( bstrCurrentPath, IID_IADsGroup,(void **)&pIADsGroupAsMember);
- 
-                                        // If bind was completed, then this is a group.
-                                        if (SUCCEEDED(hr))
-                                        {
-                                            // Recursively call this group to verify this group.
-                                            BOOL bRetRecurse;
-                                            bRetRecurse = RecursiveIsMember(pIADsGroupAsMember,pwszMemberGUID,pwszMemberPath,bVerbose,pwszUser ,pwszPassword );
-                                            
-                                            if (bRetRecurse)
-                                            {
-                                                bRet = TRUE;
-                                                break;
-                                            }
-                                            pIADsGroupAsMember->Release();
-                                            pIADsGroupAsMember = NULL;
-                                        }
-                                    }
-                                    SysFreeString(bstrCurrentPath);
-                                    bstrCurrentPath = NULL;
- 
-                                    SysFreeString(bstrGuidCurrent);
-                                    bstrGuidCurrent = NULL;
-                                }
-                                // Release
-                                pIDOCurrent->Release();
-                                pIDOCurrent = NULL;
-                                if (pIADsCurrent)
-                                {
-                                    pIADsCurrent->Release();
-                                    pIADsCurrent = NULL;
-                                }
-                            }
-                         }
-                        // Clear the variant array.
-                        memset(VariantArray, 0, sizeof(VARIANT)*FETCH_NUM);
-                    }
-                    else
-                        fContinue = FALSE;
-                }
-                pEnumVariant->Release();
-                pEnumVariant = NULL;
-            }
-            pUnknown->Release();
-            pUnknown = NULL;
-        }
-        pADsMembers ->Release();
-        pADsMembers  = NULL;
-    }
- 
-    // Free the group path if retrieved.
-    if (bsGroupPath)
-    {
-        SysFreeString(bsGroupPath);
-        bsGroupPath = NULL;
-    }
-    return bRet;
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  GetObjectGuid()    - Retrieves the GUID, in string form, from the passed Directory Object.
-                         Returns S_OK on success.
- 
-    Parameters
- 
-        IDirectoryObject *  pDO     -   Directory Object from where GUID is retrieved.
-        BSTR             &  bsGuid  -   Returned GUID            
-*/
- 
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid)
-{
- 
-    GUID *pObjectGUID   = NULL;
-    PADS_ATTR_INFO      pAttributeEntries;
-    LPWSTR              pAttributeName = L"objectGUID";  // Get the GUID for the object.
-    DWORD               dwAttributesReturned = 0;
-    HRESULT             hr;
-
-    if(!pDO)
-    {
-        return E_FAIL;
-    }
-
-    hr = pDO->GetObjectAttributes(  &pAttributeName, // objectGUID
-                                    1, //Only objectGUID
-                                    &pAttributeEntries, // Returned attributes
-                                    &dwAttributesReturned // Number of attributes returned
-                                    );
- 
-    if (SUCCEEDED(hr) && dwAttributesReturned>0)
-    {
-        // Be sure the right type was retrieved--objectGUID is ADSTYPE_OCTET_STRING
-        if (pAttributeEntries->dwADsType == ADSTYPE_OCTET_STRING)
-        {
-            // Get COM converted string version of the GUID
-            // lpvalue should be LPBYTE. Should be able to cast it to ptr to GUID.
-            pObjectGUID = (GUID*)(pAttributeEntries->pADsValues[0].OctetString.lpValue);
-            
-            // OLE str to fit a GUID
-            
-            LPOLESTR szGUID = new WCHAR [64];
-            szGUID[0]=NULL;
-            // Convert GUID to string.
-            ::StringFromGUID2(*pObjectGUID, szGUID, 39); 
-            bsGuid = SysAllocString(szGUID);
-            
-            delete [] szGUID;
-         }
-    }
- 
-    return hr;
- 
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/*  PrintBanner()   -       Prints a banner to the screen
- 
-    Parameters
- 
-                LPOLESTR pwszBanner   - String to print
-*/
-void PrintBanner(LPOLESTR pwszBanner)
-{
-    _putws(L"");
-    _putws(L"////////////////////////////////////////////////////");
-    wprintf(L"\t");
-    _putws(pwszBanner);
-    _putws(L"////////////////////////////////////////////////////\n");
-}
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.h b/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.h
deleted file mode 100644
index a8eca66..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTH_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTH_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef LDAPAUTHNT4_EXPORTS
-#define LDAPAUTHNT4_API __declspec(dllexport)
-#else
-#define LDAPAUTHNT4_API __declspec(dllimport)
-#endif
-
-#include <windows.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <wchar.h>
-#include <math.h>
-#include <objbase.h>
-#include <activeds.h>
-#include <Dsgetdc.h>
-#include <sddl.h>
-#include <assert.h>
-
-
-#define MAXLEN 256
-//#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-//#define NERR_Success            0
-//#define LG_INCLUDE_INDIRECT 1
-#define BUFSIZE 1024
-
-#define FETCH_NUM 100
-void PrintBanner(LPOLESTR pwszBanner);
-HRESULT GetObjectGuid(IDirectoryObject * pDO,BSTR &bsGuid);
-BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
-                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword);
-
-HRESULT FindUserByName(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser); //Return a pointer to the user
-
-
-HRESULT FindGroup(IDirectorySearch *pSearchBase, //Container to search
-					   LPOLESTR szFindUser, //Name of user to find.
-					   IADs **ppUser,LPOLESTR szGroup); //Return a pointer to the user
-
-BSTR gbsGroup     = NULL; // <Group to check> This is the LDAP path for the group to check
-	BSTR gbsMember    = NULL; // <Member to check> 
-	BSTR gbsUSER      = NULL;
-	BSTR gbsPASS      = NULL; // <Password used for binding to the DC>
-
-
-
-LDAPAUTHNT4_API BOOL CUGP(char * userin,char *password,char *machine,char *group,int locdom);
-
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc b/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc
deleted file mode 100644
index bcb37a5..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Active Directory authentication for UltraVNC on WinNT4\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "ldapAuthnt4\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "ldapAuthnt4.dll\0"
-            VALUE "ProductName", "UltraVNC ldapAuthnt4\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.def b/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.def
deleted file mode 100644
index 3875c08..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.def
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY   LDAPAuthnt4
-
-             EXPORTS
-               CUGP
-			   
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.dsw b/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.dsw
deleted file mode 100644
index e990c2b..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/ldapauthnt4.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "ldapauthnt4"=".\ldapauthnt4.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/ldapauthNT4/resource.h b/ica/win32/addon/ms-logon/ldapauthNT4/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/ldapauthNT4/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/logging/logging.cpp b/ica/win32/addon/ms-logon/logging/logging.cpp
deleted file mode 100644
index 006367b..0000000
--- a/ica/win32/addon/ms-logon/logging/logging.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-#include "logging.h"
-
-/////////////////////////
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 )
-{
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-//////////////////////////////////////////////////////////////////////
-
-EventLogging::EventLogging()
-{
-	// returns a handle that links the source to the registry 
-	m_hEventLinker = RegisterEventSource(NULL,"UltraVnc");
-
-}
-
-EventLogging::~EventLogging()
-{
-	// Releases the handle to the registry
-	DeregisterEventSource(m_hEventLinker);
-}
-
-
-
-void EventLogging::LogIt(WORD CategoryID, DWORD EventID, LPCTSTR *ArrayOfStrings,
-						 UINT NumOfArrayStr,LPVOID RawData,DWORD RawDataSize)
-{
-
-	// Writes data to the event log
-	ReportEvent(m_hEventLinker,EVENTLOG_INFORMATION_TYPE,CategoryID,
-		EventID,NULL,1,RawDataSize,ArrayOfStrings,RawData);	
-
-}
-
-
-void EventLogging::AddEventSourceToRegistry(LPCTSTR lpszSourceName)
-{
-    HKEY  hk;
-    DWORD dwData;
-    TCHAR szBuf[MAX_PATH];
-    TCHAR szKey[255] =_T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
-    TCHAR szServicePath[MAX_PATH];
-
-    lstrcat(szKey, _T("UltraVnc"));
-
-    if(RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hk) != ERROR_SUCCESS)
-    {
-        return;
-    }
-
-    if (GetModuleFileName(NULL, szServicePath, MAX_PATH))
-		{
-			char* p = strrchr(szServicePath, '\\');
-			if (p == NULL) return;
-			*p = '\0';
-			strcat (szServicePath,"\\logmessages.dll");
-		}
-	//printf(szServicePath);
-    lstrcpy(szBuf, szServicePath);
-
-    // Add the name to the EventMessageFile subkey.
-    if(RegSetValueEx(hk,
-                     _T("EventMessageFile"),
-                     0,
-                     REG_EXPAND_SZ,
-                     (LPBYTE) szBuf,
-                     (lstrlen(szBuf) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hk);
-        return;
-    }
-
-    dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |EVENTLOG_INFORMATION_TYPE;
-    if(RegSetValueEx(hk,
-                     _T("TypesSupported"),
-                     0,
-                     REG_DWORD,
-                     (LPBYTE)&dwData,
-                     sizeof(DWORD)) != ERROR_SUCCESS)
-    {
-        
-    } RegCloseKey(hk);
-}
-
-
-
-/////////////////////////
-///////////////////////
-LOGGING_API
-void LOGEXIT(char *machine)
-{
-	    FILE *file;
-		const char* ps[3];
-		char texttowrite[512];
-		SYSTEMTIME time;
-		GetLocalTime(& time);
-		char			szText[256];
-		sprintf(szText,"%d/%d/%d %d:%.2d   ", time.wDay,time.wMonth,time.wYear,time.wHour,time.wMinute );
-		strcpy(texttowrite,szText);
-		strcat(texttowrite,"Client ");
-		strcat(texttowrite,machine);
-		strcat(texttowrite," disconnected");
-		strcat(texttowrite,"\n");
-		ps[0] = texttowrite;
-	    EventLogging log;
-		log.AddEventSourceToRegistry(NULL);
-		log.LogIt(1,0x00640003L, ps,1,NULL,0);
-
-		char szMslogonLog[MAX_PATH];
-		if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-		{
-			char* p = strrchr(szMslogonLog, '\\');
-			if (p != NULL)
-			{
-				*p = '\0';
-				strcat (szMslogonLog,"\\mslogon.log");
-			}
-		}
-		file = fopen(szMslogonLog, "a");
-		if(file!=NULL) 
-			{
-				fwrite( texttowrite, sizeof( char ), strlen(texttowrite),file);
-				fclose(file);
-			}
-}
-
-LOGGING_API
-void LOGLOGON(char *machine)
-{
-		FILE *file;
-		const char* ps[3];
-		char texttowrite[512];
-		SYSTEMTIME time;
-		GetLocalTime(& time);
-		char			szText[256];
-		sprintf(szText,"%d/%d/%d %d:%.2d   ", time.wDay,time.wMonth,time.wYear,time.wHour,time.wMinute );
-		strcpy(texttowrite,szText);
-		strcat(texttowrite,"Connection received from ");
-		strcat(texttowrite,machine);
-		strcat(texttowrite,"\n");
-		ps[0] = texttowrite;
-	    EventLogging log;
-		log.AddEventSourceToRegistry(NULL);
-		log.LogIt(1,0x00640001L, ps,1,NULL,0);
-		char szMslogonLog[MAX_PATH];
-		if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-		{
-			char* p = strrchr(szMslogonLog, '\\');
-			if (p != NULL)
-			{
-				*p = '\0';
-				strcat (szMslogonLog,"\\mslogon.log");
-			}
-		}
-		file = fopen(szMslogonLog, "a");
-		if(file!=NULL) 
-			{
-				fwrite( texttowrite, sizeof( char ), strlen(texttowrite),file);
-				fclose(file);
-			}
-}
-
-LOGGING_API
-void LOGFAILED(char *machine)
-{
-		FILE *file;
-		const char* ps[3];
-		char texttowrite[512];
-		SYSTEMTIME time;
-		GetLocalTime(& time);
-		char			szText[256];
-		sprintf(szText,"%d/%d/%d %d:%.2d   ", time.wDay,time.wMonth,time.wYear,time.wHour,time.wMinute );
-		strcpy(texttowrite,szText);
-		strcat(texttowrite,"Invalid attempt from client ");
-		strcat(texttowrite,machine);
-		strcat(texttowrite,"\n");
-		ps[0] = texttowrite;
-	    EventLogging log;
-		log.AddEventSourceToRegistry(NULL);
-		log.LogIt(1,0x00640002L, ps,1,NULL,0);
-		char szMslogonLog[MAX_PATH];
-		if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-		{
-			char* p = strrchr(szMslogonLog, '\\');
-			if (p != NULL)
-			{
-				*p = '\0';
-				strcat (szMslogonLog,"\\mslogon.log");
-			}
-		}
-		file = fopen(szMslogonLog, "a");
-		if(file!=NULL) 
-			{
-				fwrite( texttowrite, sizeof( char ), strlen(texttowrite),file);
-				fclose(file);
-			}
-}
-
-LOGGING_API
-void LOGLOGONUSER(char *machine,char *user)
-{
-		FILE *file;
-		const char* ps[3];
-		char texttowrite[512];
-		SYSTEMTIME time;
-		GetLocalTime(& time);
-		char			szText[256];
-		sprintf(szText,"%d/%d/%d %d:%.2d   ", time.wDay,time.wMonth,time.wYear,time.wHour,time.wMinute );
-		strcpy(texttowrite,szText);
-		strcat(texttowrite,"Connection received from ");
-		strcat(texttowrite,machine);
-		strcat(texttowrite," using ");
-		strcat(texttowrite,user);
-		strcat(texttowrite," account ");
-		strcat(texttowrite,"\n");
-		ps[0] = texttowrite;
-	    EventLogging log;
-		log.AddEventSourceToRegistry(NULL);
-		log.LogIt(1,0x00640001L, ps,1,NULL,0);
-		char szMslogonLog[MAX_PATH];
-		if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-		{
-			char* p = strrchr(szMslogonLog, '\\');
-			if (p != NULL)
-			{
-				*p = '\0';
-				strcat (szMslogonLog,"\\mslogon.log");
-			}
-		}
-		file = fopen(szMslogonLog, "a");
-		if(file!=NULL) 
-			{
-				fwrite( texttowrite, sizeof( char ), strlen(texttowrite),file);
-				fclose(file);
-			}
-}
-
-LOGGING_API
-void LOGFAILEDUSER(char *machine, char *user)
-{
-		FILE *file;
-		const char* ps[3];
-		char texttowrite[512];
-		SYSTEMTIME time;
-		GetLocalTime(& time);
-		char			szText[256];
-		sprintf(szText,"%d/%d/%d %d:%.2d   ", time.wDay,time.wMonth,time.wYear,time.wHour,time.wMinute );
-		strcpy(texttowrite,szText);
-		strcat(texttowrite,"Invalid attempt from client ");
-		strcat(texttowrite,machine);
-		strcat(texttowrite," using ");
-		strcat(texttowrite,user);
-		strcat(texttowrite," account ");
-		strcat(texttowrite,"\n");
-		ps[0] = texttowrite;
-	    EventLogging log;
-		log.AddEventSourceToRegistry(NULL);
-		log.LogIt(1,0x00640002L, ps,1,NULL,0);
-		char szMslogonLog[MAX_PATH];
-		if (GetModuleFileName(NULL, szMslogonLog, MAX_PATH))
-		{
-			char* p = strrchr(szMslogonLog, '\\');
-			if (p != NULL)
-			{
-				*p = '\0';
-				strcat (szMslogonLog,"\\mslogon.log");
-			}
-		}
-		file = fopen(szMslogonLog, "a");
-		if(file!=NULL) 
-			{
-				fwrite( texttowrite, sizeof( char ), strlen(texttowrite),file);
-				fclose(file);
-			}
-}
-
diff --git a/ica/win32/addon/ms-logon/logging/logging.def b/ica/win32/addon/ms-logon/logging/logging.def
deleted file mode 100644
index 8397053..0000000
--- a/ica/win32/addon/ms-logon/logging/logging.def
+++ /dev/null
@@ -1,8 +0,0 @@
-LIBRARY   Logging
-
-             EXPORTS
-			   LOGEXIT
-			   LOGLOGON
-			   LOGFAILED
-			   LOGLOGONUSER
-			   LOGFAILEDUSER
diff --git a/ica/win32/addon/ms-logon/logging/logging.dsw b/ica/win32/addon/ms-logon/logging/logging.dsw
deleted file mode 100644
index fca3661..0000000
--- a/ica/win32/addon/ms-logon/logging/logging.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "logging"=".\logging.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/logging/logging.h b/ica/win32/addon/ms-logon/logging/logging.h
deleted file mode 100644
index befd57c..0000000
--- a/ica/win32/addon/ms-logon/logging/logging.h
+++ /dev/null
@@ -1,38 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTH_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTH_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef LOGGING_EXPORTS
-#define LOGGING_API __declspec(dllexport)
-#else
-#define LOGGING_API __declspec(dllimport)
-#endif
-#if defined( UNICODE ) || defined( _UNICODE )
-#error Sorry -- please compile as an ANSI program.
-#endif
-#include <windows.h>
-#include <stdio.h>
-#include <lmcons.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <tchar.h>
-#include <lm.h>
-#include <stdio.h>
-#pragma hdrstop
-LOGGING_API void LOGEXIT(char *machine);
-
-class EventLogging
-{
-public:
-	EventLogging();
-	virtual ~EventLogging();
-	virtual void LogIt(WORD CategoryID, DWORD EventID, LPCTSTR *ArrayOfStrings,
-		UINT NumOfArrayStr = 0,LPVOID RawData = NULL,DWORD RawDataSize = 0);
-	HANDLE m_hEventLinker;
-	void AddEventSourceToRegistry(LPCTSTR lpszSourceName);
-
-};
-
diff --git a/ica/win32/addon/ms-logon/logging/logging.rc b/ica/win32/addon/ms-logon/logging/logging.rc
deleted file mode 100644
index 3dc9118..0000000
--- a/ica/win32/addon/ms-logon/logging/logging.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Logging for UltraVNC MS-Logon\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "Logging for UltraVNC MS-Logon\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "logging\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "logging.dll\0"
-            VALUE "ProductName", "UltraVNC logging\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/logging/resource.h b/ica/win32/addon/ms-logon/logging/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/logging/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/testauth/ntlogon.cpp b/ica/win32/addon/ms-logon/testauth/ntlogon.cpp
deleted file mode 100644
index 7cba6d7..0000000
--- a/ica/win32/addon/ms-logon/testauth/ntlogon.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-typedef BOOL (*CheckUserGroupPasswordFn)( char * userin,char *password,char *machine,char *group,int lodom);
-CheckUserGroupPasswordFn CheckUserGroupPassword = 0;
-bool CheckAD()
-{
-	HMODULE hModule = LoadLibrary("Activeds.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-bool CheckNetapi95()
-{
-	HMODULE hModule = LoadLibrary("netapi32.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-bool CheckDsGetDcNameW()
-{
-	HMODULE hModule = LoadLibrary("netapi32.dll");
-	if (hModule)
-	{
-		FARPROC test=NULL;
-		test=GetProcAddress( hModule, "DsGetDcNameW" );
-		FreeLibrary(hModule);
-		if (test) return true;
-	}
-	return false;
-}
-
-bool CheckNetApiNT()
-{
-	HMODULE hModule = LoadLibrary("radmin32.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-int main(int argc, char* argv[])
-{
-	char pszBuffer[256];
-	char pszBuffer2[256];
-	char pszBuffer3[256];
-	char pszBuffer4[256];
-	int locdom;
-	if (argc<5) 
-	{
-		printf("Enter user name : ");
-		gets(pszBuffer);
-		printf("\nEnter password : ");
-		gets(pszBuffer2);
-		printf("\n");
-		printf("Enter group : ");
-		gets(pszBuffer3);
-		printf("\n");
-		printf("loc=1 dom=3 local+domain=3 : ");
-		gets(pszBuffer4);
-		printf("\n");
-	if (0==strcmp("", pszBuffer)) 
-	{
-		return 0;
-	}
-	if (0==strcmp("", pszBuffer2)) 
-	{
-		return 0;
-	}
-	if (0==strcmp("", pszBuffer3)) 
-	{
-		return 0;
-	}
-	if (0==strcmp("", pszBuffer4)) 
-	{
-		return 0;
-	}
-	}
-	else
-	{
-		strcpy(pszBuffer,argv[1]);
-		strcpy(pszBuffer2,argv[2]);
-		strcpy(pszBuffer3,argv[3]);
-		strcpy(pszBuffer4,argv[4]);
-	}
-	locdom=atoi(pszBuffer4);
-	if (!CheckNetapi95() && !CheckNetApiNT())
-	{
-		printf("Netapi not found,radmin32.dll is missing \n");
-	}
-
-	///////////////////////////////////////
-	////// BASIC LOCAL GROUPS
-	BOOL returnvalue;
-	{
-	returnvalue=false;
-	printf("\nTrying authlogonuser.dll \n");
-		printf("This only works on XP> \n");
-		printf("test is runnning as application and not a service \n");
-		printf("------------------------ \n");
-		printf("------------------------ \n");
-		HMODULE hModule = LoadLibrary("authlogonuser.dll");
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				HRESULT hr = CoInitialize(NULL);
-				returnvalue=CheckUserGroupPassword(pszBuffer,pszBuffer2,"test",pszBuffer3,locdom);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else printf("authlogonuser.dll not found");
-	if (returnvalue==1) printf("based on auth.dll user has access ");
-	else printf("based on authlogonuser.dll user has NO access ");
-	}
-	if (returnvalue==1) printf("\n-------------------------\n");
-	if (returnvalue==1) printf("For testing we cont, but access was already granted\n");
-	if (returnvalue==1) printf("-------------------------\n");
-
-	returnvalue=false;
-	printf("\nTrying auth.dll \n");
-		printf("------------------------ \n");
-		printf("------------------------ \n");
-		HMODULE hModule = LoadLibrary("auth.dll");
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				HRESULT hr = CoInitialize(NULL);
-				returnvalue=CheckUserGroupPassword(pszBuffer,pszBuffer2,"test",pszBuffer3,locdom);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else printf("auth.dll not found");
-	if (returnvalue==1) printf("based on auth.dll user has access ");
-	else printf("based on auth.dll user has NO access ");
-	if (returnvalue==1) printf("\n-------------------------\n");
-	if (returnvalue==1) printf("For testing we cont, but access was already granted\n");
-	if (returnvalue==1) printf("-------------------------\n");
-	returnvalue=false;
-	if (CheckAD())
-	{
-		printf("\nTrying authaddll \n");
-		printf("------------------------ \n");
-		printf("------------------------ \n");
-		HMODULE hModule = LoadLibrary("authad.dll");
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				HRESULT hr = CoInitialize(NULL);
-				returnvalue=CheckUserGroupPassword(pszBuffer,pszBuffer2,"test",pszBuffer3,locdom);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else printf("authad.dll not found");
-		if (returnvalue==1) printf("based on authad.dll user has access ");
-		else printf("based on authad.dll user has NO access ");
-
-	}
-	if (returnvalue==1) printf("\n-------------------------\n");
-	if (returnvalue==1) printf("For testing we cont, but access was already granted\n");
-	if (returnvalue==1) printf("-------------------------\n");
-	if (locdom==2 || locdom==3)
-	{
-	returnvalue=false;
-	OSVERSIONINFO VerInfo;
-	VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
-	{
-		  return FALSE;
-	}
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && VerInfo.dwMajorVersion == 4)
-	{
-		if (CheckAD() && CheckDsGetDcNameW())
-		{
-			printf("\nTrying ldapauthNT4 .dll \n");
-		printf("------------------------ \n");
-		printf("------------------------ \n");
-		HMODULE hModule = LoadLibrary("ldapauthnt4.dll");
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				HRESULT hr = CoInitialize(NULL);
-				returnvalue=CheckUserGroupPassword(pszBuffer,pszBuffer2,"test",pszBuffer3,locdom);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else printf("ldapauthnt4.dll not found");
-		if (returnvalue==1) printf("based on ldapauthnt4.dll user has access ");
-		else printf("based on ldapauthnt4.dll user has NO access ");
-		}
-
-	}
-	if (returnvalue==1) printf("\n-------------------------\n");
-	if (returnvalue==1) printf("For testing we cont, but access was already granted\n");
-	if (returnvalue==1) printf("-------------------------\n");
-	returnvalue=false;
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && VerInfo.dwMajorVersion >= 5)
-	{
-		if (CheckAD())
-		{
-			printf("\nTrying ldapauth .dll \n");
-		printf("------------------------ \n");
-		printf("------------------------ \n");
-		HMODULE hModule = LoadLibrary("ldapauth.dll");
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				HRESULT hr = CoInitialize(NULL);
-				returnvalue=CheckUserGroupPassword(pszBuffer,pszBuffer2,"test",pszBuffer3,locdom);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else printf("ldapauth.dll not found");
-		if (returnvalue==1) printf("based on ldapauth.dll user has access ");
-		else printf("based on ldapauth.dll user has NO access ");
-		}
-	}
-	}
-	printf("Enter to quit ");
-	gets(pszBuffer);
-	return 0;
-}
diff --git a/ica/win32/addon/ms-logon/testauth/resource.h b/ica/win32/addon/ms-logon/testauth/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/testauth/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/testauth/testauth.dsw b/ica/win32/addon/ms-logon/testauth/testauth.dsw
deleted file mode 100644
index 44e72c5..0000000
--- a/ica/win32/addon/ms-logon/testauth/testauth.dsw
+++ /dev/null
@@ -1,53 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "auth"="..\auth\auth.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "authad"="..\authad\authad.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "testauth"=".\testauth.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/testauth/testauth.rc b/ica/win32/addon/ms-logon/testauth/testauth.rc
deleted file mode 100644
index 3cdefbf..0000000
--- a/ica/win32/addon/ms-logon/testauth/testauth.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Test utility for UltraVNC's MS-Logon I\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "testauth\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "testauth.dll\0"
-            VALUE "ProductName", "UltraVNC testauth\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/resource.h b/ica/win32/addon/ms-logon/workgrpdomnt4/resource.h
deleted file mode 100644
index decb8f5..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/resource.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by authSSP.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
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.cpp b/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.cpp
deleted file mode 100644
index efc1c9e..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.cpp
+++ /dev/null
@@ -1,886 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-// /macine-vnc Greg Wood (wood at agressiv.com)
-#include "workgrpdomnt4.h"
-
-/////////////////////////
-
-BOOL APIENTRY DllMain( HANDLE hModule, 
-                       DWORD  ul_reason_for_call, 
-                       LPVOID lpReserved
-					 )
-{
-    switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-		case DLL_THREAD_ATTACH:
-		case DLL_THREAD_DETACH:
-		case DLL_PROCESS_DETACH:
-			break;
-    }
-    return TRUE;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-
-void UnloadSecurityDll(HMODULE hModule) {
-
-   if (hModule)
-      FreeLibrary(hModule);
-
-   _AcceptSecurityContext      = NULL;
-   _AcquireCredentialsHandle   = NULL;
-   _CompleteAuthToken          = NULL;
-   _DeleteSecurityContext      = NULL;
-   _FreeContextBuffer          = NULL;
-   _FreeCredentialsHandle      = NULL;
-   _InitializeSecurityContext  = NULL;
-   _QuerySecurityPackageInfo   = NULL;
-}
-
-//////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-
-
-HMODULE LoadSecurityDll() {
-
-    HMODULE hModule;
-    BOOL    fAllFunctionsLoaded = FALSE; 
-	TCHAR   lpszDLL[MAX_PATH];
-	OSVERSIONINFO VerInfo;
-
-   _AcceptSecurityContext      = NULL;
-   _AcquireCredentialsHandle   = NULL;
-   _CompleteAuthToken          = NULL;
-   _DeleteSecurityContext      = NULL;
-   _FreeContextBuffer          = NULL;
-   _FreeCredentialsHandle      = NULL;
-   _InitializeSecurityContext  = NULL;
-   _QuerySecurityPackageInfo   = NULL;
-
-   // 
-   //  Find out which security DLL to use, depending on
-   //  whether we are on NT or Win95 or 2000 or XP or .NET Server
-   //  We have to use security.dll on Windows NT 4.0.
-   //  All other operating systems, we have to use Secur32.dll
-   // 
-   VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-   if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
-   {
-      return FALSE;
-   }
-
-   if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-      VerInfo.dwMajorVersion == 4 &&
-      VerInfo.dwMinorVersion == 0)
-   {
-      lstrcpy (lpszDLL, _T("security.dll"));
-   }
-   else
-   {
-      lstrcpy (lpszDLL, _T("secur32.dll"));
-   }
-
-
-   hModule = LoadLibrary(lpszDLL);
-   if (!hModule)
-      return NULL;
-
-   __try {
-
-      _AcceptSecurityContext = (ACCEPT_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "AcceptSecurityContext");
-      if (!_AcceptSecurityContext)
-         __leave;
-
-#ifdef UNICODE
-      _AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN)
-            GetProcAddress(hModule, "AcquireCredentialsHandleW");
-#else
-      _AcquireCredentialsHandle = (ACQUIRE_CREDENTIALS_HANDLE_FN)
-            GetProcAddress(hModule, "AcquireCredentialsHandleA");
-#endif
-      if (!_AcquireCredentialsHandle)
-         __leave;
-
-      // CompleteAuthToken is not present on Windows 9x Secur32.dll
-      // Do not check for the availablity of the function if it is NULL;
-      _CompleteAuthToken = (COMPLETE_AUTH_TOKEN_FN) 
-            GetProcAddress(hModule, "CompleteAuthToken");
-
-      _DeleteSecurityContext = (DELETE_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "DeleteSecurityContext");
-      if (!_DeleteSecurityContext)
-         __leave;
-
-      _FreeContextBuffer = (FREE_CONTEXT_BUFFER_FN) 
-            GetProcAddress(hModule, "FreeContextBuffer");
-      if (!_FreeContextBuffer)
-         __leave;
-
-      _FreeCredentialsHandle = (FREE_CREDENTIALS_HANDLE_FN) 
-            GetProcAddress(hModule, "FreeCredentialsHandle");
-      if (!_FreeCredentialsHandle)
-         __leave;
-
-#ifdef UNICODE
-      _InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN)
-            GetProcAddress(hModule, "InitializeSecurityContextW");
-#else
-      _InitializeSecurityContext = (INITIALIZE_SECURITY_CONTEXT_FN) 
-            GetProcAddress(hModule, "InitializeSecurityContextA");
-#endif
-      if (!_InitializeSecurityContext)
-         __leave;
-
-#ifdef UNICODE
-      _QuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN)
-            GetProcAddress(hModule, "QuerySecurityPackageInfoW");
-#else
-      _QuerySecurityPackageInfo = (QUERY_SECURITY_PACKAGE_INFO_FN)
-            GetProcAddress(hModule, "QuerySecurityPackageInfoA");
-#endif
-      if (!_QuerySecurityPackageInfo)
-         __leave;
-
-      fAllFunctionsLoaded = TRUE;
-
-   } __finally {
-
-      if (!fAllFunctionsLoaded) {
-         UnloadSecurityDll(hModule);
-         hModule = NULL;
-      }
-
-   }
-   
-   return hModule;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-
-BOOL GenClientContext(PAUTH_SEQ pAS, PSEC_WINNT_AUTH_IDENTITY pAuthIdentity,
-      PVOID pIn, DWORD cbIn, PVOID pOut, PDWORD pcbOut, PBOOL pfDone) {
-
-/*++
-
- Routine Description:
-
-   Optionally takes an input buffer coming from the server and returns
-   a buffer of information to send back to the server.  Also returns
-   an indication of whether or not the context is complete.
-
- Return Value:
-
-   Returns TRUE if successful; otherwise FALSE.
-
---*/ 
-
-   SECURITY_STATUS ss;
-   TimeStamp       tsExpiry;
-   SecBufferDesc   sbdOut;
-   SecBuffer       sbOut;
-   SecBufferDesc   sbdIn;
-   SecBuffer       sbIn;
-   ULONG           fContextAttr;
-
-   if (!pAS->fInitialized) {
-      
-      ss = _AcquireCredentialsHandle(NULL, _T("NTLM"), 
-            SECPKG_CRED_OUTBOUND, NULL, pAuthIdentity, NULL, NULL,
-            &pAS->hcred, &tsExpiry);
-      if (ss < 0) {
-         fprintf(stderr, "AcquireCredentialsHandle failed with %08X\n", ss);
-         return FALSE;
-      }
-
-      pAS->fHaveCredHandle = TRUE;
-   }
-
-   // Prepare output buffer
-   sbdOut.ulVersion = 0;
-   sbdOut.cBuffers = 1;
-   sbdOut.pBuffers = &sbOut;
-
-   sbOut.cbBuffer = *pcbOut;
-   sbOut.BufferType = SECBUFFER_TOKEN;
-   sbOut.pvBuffer = pOut;
-
-   // Prepare input buffer
-   if (pAS->fInitialized)  {
-      sbdIn.ulVersion = 0;
-      sbdIn.cBuffers = 1;
-      sbdIn.pBuffers = &sbIn;
-
-      sbIn.cbBuffer = cbIn;
-      sbIn.BufferType = SECBUFFER_TOKEN;
-      sbIn.pvBuffer = pIn;
-   }
-
-   ss = _InitializeSecurityContext(&pAS->hcred, 
-         pAS->fInitialized ? &pAS->hctxt : NULL, NULL, 0, 0, 
-         SECURITY_NATIVE_DREP, pAS->fInitialized ? &sbdIn : NULL,
-         0, &pAS->hctxt, &sbdOut, &fContextAttr, &tsExpiry);
-   if (ss < 0)  { 
-      // <winerror.h>
-      fprintf(stderr, "InitializeSecurityContext failed with %08X\n", ss);
-      return FALSE;
-   }
-
-   pAS->fHaveCtxtHandle = TRUE;
-
-   // If necessary, complete token
-   if (ss == SEC_I_COMPLETE_NEEDED || ss == SEC_I_COMPLETE_AND_CONTINUE) {
-
-      if (_CompleteAuthToken) {
-         ss = _CompleteAuthToken(&pAS->hctxt, &sbdOut);
-         if (ss < 0)  {
-            fprintf(stderr, "CompleteAuthToken failed with %08X\n", ss);
-            return FALSE;
-         }
-      }
-      else {
-         fprintf (stderr, "CompleteAuthToken not supported.\n");
-         return FALSE;
-      }
-   }
-
-   *pcbOut = sbOut.cbBuffer;
-
-   if (!pAS->fInitialized)
-      pAS->fInitialized = TRUE;
-
-   *pfDone = !(ss == SEC_I_CONTINUE_NEEDED 
-         || ss == SEC_I_COMPLETE_AND_CONTINUE );
-
-   return TRUE;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-
-BOOL GenServerContext(PAUTH_SEQ pAS, PVOID pIn, DWORD cbIn, PVOID pOut,
-      PDWORD pcbOut, PBOOL pfDone) {
-
-/*++
-
- Routine Description:
-
-    Takes an input buffer coming from the client and returns a buffer
-    to be sent to the client.  Also returns an indication of whether or
-    not the context is complete.
-
- Return Value:
-
-    Returns TRUE if successful; otherwise FALSE.
-
---*/ 
-
-   SECURITY_STATUS ss;
-   TimeStamp       tsExpiry;
-   SecBufferDesc   sbdOut;
-   SecBuffer       sbOut;
-   SecBufferDesc   sbdIn;
-   SecBuffer       sbIn;
-   ULONG           fContextAttr;
-
-   if (!pAS->fInitialized)  {
-      
-      ss = _AcquireCredentialsHandle(NULL, _T("NTLM"), 
-            SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL, &pAS->hcred, 
-            &tsExpiry);
-      if (ss < 0) {
-         fprintf(stderr, "AcquireCredentialsHandle failed with %08X\n", ss);
-         return FALSE;
-      }
-
-      pAS->fHaveCredHandle = TRUE;
-   }
-
-   // Prepare output buffer
-   sbdOut.ulVersion = 0;
-   sbdOut.cBuffers = 1;
-   sbdOut.pBuffers = &sbOut;
-
-   sbOut.cbBuffer = *pcbOut;
-   sbOut.BufferType = SECBUFFER_TOKEN;
-   sbOut.pvBuffer = pOut;
-
-   // Prepare input buffer
-   sbdIn.ulVersion = 0;
-   sbdIn.cBuffers = 1;
-   sbdIn.pBuffers = &sbIn;
-
-   sbIn.cbBuffer = cbIn;
-   sbIn.BufferType = SECBUFFER_TOKEN;
-   sbIn.pvBuffer = pIn;
-
-   ss = _AcceptSecurityContext(&pAS->hcred, 
-         pAS->fInitialized ? &pAS->hctxt : NULL, &sbdIn, 0, 
-         SECURITY_NATIVE_DREP, &pAS->hctxt, &sbdOut, &fContextAttr, 
-         &tsExpiry);
-   if (ss < 0)  {
-      fprintf(stderr, "AcceptSecurityContext failed with %08X\n", ss);
-      return FALSE;
-   }
-
-   pAS->fHaveCtxtHandle = TRUE;
-
-   // If necessary, complete token
-   if (ss == SEC_I_COMPLETE_NEEDED || ss == SEC_I_COMPLETE_AND_CONTINUE) {
-      
-      if (_CompleteAuthToken) {
-         ss = _CompleteAuthToken(&pAS->hctxt, &sbdOut);
-         if (ss < 0)  {
-            fprintf(stderr, "CompleteAuthToken failed with %08X\n", ss);
-            return FALSE;
-         }
-      }
-      else {
-         fprintf (stderr, "CompleteAuthToken not supported.\n");
-         return FALSE;
-      }
-   }
-
-   *pcbOut = sbOut.cbBuffer;
-
-   if (!pAS->fInitialized)
-      pAS->fInitialized = TRUE;
-
-   *pfDone = !(ss = SEC_I_CONTINUE_NEEDED 
-         || ss == SEC_I_COMPLETE_AND_CONTINUE);
-
-   return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////// 
-
-BOOL WINAPI SSPLogonUser(LPTSTR szDomain, LPTSTR szUser, LPTSTR szPassword) {
-
-   AUTH_SEQ    asServer   = {0};
-   AUTH_SEQ    asClient   = {0};
-   BOOL        fDone      = FALSE;
-   BOOL        fResult    = FALSE;
-   DWORD       cbOut      = 0;
-   DWORD       cbIn       = 0;
-   DWORD       cbMaxToken = 0;
-   PVOID       pClientBuf = NULL;
-   PVOID       pServerBuf = NULL;
-   PSecPkgInfo pSPI       = NULL;
-   HMODULE     hModule    = NULL;
-
-   SEC_WINNT_AUTH_IDENTITY ai;
-   __try {
-
-      hModule = LoadSecurityDll();
-      if (!hModule)
-         __leave;
-
-      // Get max token size
-      _QuerySecurityPackageInfo(_T("NTLM"), &pSPI);
-      cbMaxToken = pSPI->cbMaxToken;
-      _FreeContextBuffer(pSPI);
-
-      // Allocate buffers for client and server messages
-      pClientBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbMaxToken);
-      pServerBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbMaxToken);
-
-      // Initialize auth identity structure
-      ZeroMemory(&ai, sizeof(ai));
-#if defined(UNICODE) || defined(_UNICODE)
-      ai.Domain = szDomain;
-      ai.DomainLength = lstrlen(szDomain);
-      ai.User = szUser;
-      ai.UserLength = lstrlen(szUser);
-      ai.Password = szPassword;
-      ai.PasswordLength = lstrlen(szPassword);
-      ai.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
-#else      
-      ai.Domain = (unsigned char *)szDomain;
-      ai.DomainLength = lstrlen(szDomain);
-      ai.User = (unsigned char *)szUser;
-      ai.UserLength = lstrlen(szUser);
-      ai.Password = (unsigned char *)szPassword;
-      ai.PasswordLength = lstrlen(szPassword);
-      ai.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
-#endif
-
-      // Prepare client message (negotiate) .
-      cbOut = cbMaxToken;
-      if (!GenClientContext(&asClient, &ai, NULL, 0, pClientBuf, &cbOut, &fDone))
-         __leave;
-
-      // Prepare server message (challenge) .
-      cbIn = cbOut;
-      cbOut = cbMaxToken;
-      if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, 
-            &fDone))
-         __leave;
-         // Most likely failure: AcceptServerContext fails with SEC_E_LOGON_DENIED
-         // in the case of bad szUser or szPassword.
-         // Unexpected Result: Logon will succeed if you pass in a bad szUser and 
-         // the guest account is enabled in the specified domain.
-
-      // Prepare client message (authenticate) .
-      cbIn = cbOut;
-      cbOut = cbMaxToken;
-      if (!GenClientContext(&asClient, &ai, pServerBuf, cbIn, pClientBuf, &cbOut,
-            &fDone))
-         __leave;
-
-      // Prepare server message (authentication) .
-      cbIn = cbOut;
-      cbOut = cbMaxToken;
-      if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, 
-            &fDone))
-         __leave;
-
-      fResult = TRUE;
-
-   } __finally {
-
-      // Clean up resources
-      if (asClient.fHaveCtxtHandle)
-         _DeleteSecurityContext(&asClient.hctxt);
-
-      if (asClient.fHaveCredHandle)
-         _FreeCredentialsHandle(&asClient.hcred);
-
-      if (asServer.fHaveCtxtHandle)
-         _DeleteSecurityContext(&asServer.hctxt);
-
-      if (asServer.fHaveCredHandle)
-         _FreeCredentialsHandle(&asServer.hcred);
-
-      if (hModule)
-         UnloadSecurityDll(hModule);
-
-      HeapFree(GetProcessHeap(), 0, pClientBuf);
-      HeapFree(GetProcessHeap(), 0, pServerBuf);
-
-   }
-
-   return fResult;
-}
-
-/////////////////////////////////////////////////////////////////////////////// 
-WORKGRPDOMNT4_API
-BOOL CUGP(char * userin,char *password,char *machine, char *groupin, int locdom)
-{             
-//	FILE *file;
-	bool isNT = true;
-	bool isXP =false;
-	bool access_vnc=FALSE;
-	bool laccess_vnc=FALSE;
-	bool localdatabase=false;
-	ad_access=false;
-	OSVERSIONINFO ovi = { sizeof ovi };
-	// determine OS and load appropriate library
-
-	GetVersionEx( &ovi );
-	if ( ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
-		isNT = false;
-	if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-      ovi.dwMajorVersion == 5 &&
-      ovi.dwMinorVersion >= 1) isXP=true;
-
-	HINSTANCE hNet = 0, hLoc = 0;
-
-	if ( isNT )
-		{
-		hNet = LoadLibrary( "netapi32.dll" );
-		}
-	else
-		{
-		hLoc = LoadLibrary( "rlocal32.dll" );
-		hNet = LoadLibrary( "radmin32.dll" );
-		}
-
-	if ( hNet == 0 )
-	{
-		printf( "LoadLibrary( %s ) failed, gle = %lu\n",
-			isNT? "netapi32.dll": "radmin32.dll", GetLastError() );
-		return false;
-	}
-
-	// locate needed functions
-	NetApiBufferFree_t NetApiBufferFree = 0;
-	NetGetDCNameNT_t NetGetDCNameNT = 0;
-	NetGetDCName95_t NetGetDCName95 = 0;
-	NetUserGetGroupsNT_t NetUserGetGroupsNT = 0;
-	NetUserGetGroupsNT_t2 NetUserGetGroupsNT2 = 0;
-	NetUserGetGroups95_t NetUserGetGroups95 = 0;
-	NetWkstaGetInfoNT_t NetWkstaGetInfoNT = 0;
-	NetWkstaGetInfo95_t NetWkstaGetInfo95 = 0;
-
-	NetApiBufferFree = (NetApiBufferFree_t) GetProcAddress( hNet, "NetApiBufferFree" );
-	if ( NetApiBufferFree == 0 )
-	{
-		printf( "Oops! GetProcAddress() failed\n" );
-		return false;
-	}
-	
-	if ( isNT )
-	{
-		NetGetDCNameNT = (NetGetDCNameNT_t) GetProcAddress( hNet, "NetGetDCName" );
-		NetUserGetGroupsNT = (NetUserGetGroupsNT_t) GetProcAddress( hNet, "NetUserGetLocalGroups" );
-		NetUserGetGroupsNT2 = (NetUserGetGroupsNT_t2) GetProcAddress( hNet, "NetUserGetGroups" );
-		NetWkstaGetInfoNT = (NetWkstaGetInfoNT_t)GetProcAddress( hNet,"NetWkstaGetInfo" );
-		if ( NetGetDCNameNT == 0 || NetUserGetGroupsNT == 0 || NetWkstaGetInfoNT==0 ||NetUserGetGroupsNT2 == 0)
-		{
-			printf( "Oops! Some functions not found ...\n" );
-			return false;
-		}
-	}
-	else
-	{
-		NetGetDCName95 = (NetGetDCName95_t) GetProcAddress( hLoc, "LocalNetGetDCName" );
-		NetUserGetGroups95 = (NetUserGetGroups95_t) GetProcAddress( hNet, "NetUserGetGroupsA" );
-		NetWkstaGetInfo95 = (NetWkstaGetInfo95_t)GetProcAddress( hNet,"NetWkstaGetInfoA" );
-
-		if ( NetGetDCName95 == 0 || NetUserGetGroups95 == 0 ||NetWkstaGetInfo95 == 0)
-		{
-			printf( "Oops! Some functions not found ...\n" );
-			return false;
-		}
-	}
-	// find PDC if necessary; else set up server name for call
-
-
-	byte *buf = 0;
-	DWORD rc,rc2,read, total,i,rcdomain;
-	char server[MAXLEN * sizeof(wchar_t)];
-	char user[MAXLEN * sizeof(wchar_t)];
-	char group[MAXLEN * sizeof(wchar_t)];
-	char groupname[MAXLEN];
-	char domain[MAXLEN * sizeof(wchar_t)];
-
-	
-	if ( isNT )	mbstowcs( (wchar_t *) user, userin, MAXLEN );
-	else strcpy( user, userin );
-
-	if ( isNT )	mbstowcs( (wchar_t *) group, groupin, MAXLEN );
-	else strcpy( group, groupin );
-	////////////////////////////////////////////////////////////////////////////////////////////
-	////NT
-	////////////////////////////////////////////////////////////////////////////////////////////
-if ( isNT )
-		{
-
-			printf("Client NT4 or later \n");
-			///////////////// search DC ///////////////////////////////////
-			rcdomain = NetGetDCNameNT( 0, 0, &buf );
-			if (rcdomain==2453) printf( "No domain controler found\n");
-			if (!rcdomain)
-			{
-			printf("Domain controler found");
-			wcscpy( (wchar_t *) server, (wchar_t *) buf );
-			wprintf((wchar_t *)server);
-			printf("\n------------------------------\n");
-			}
-			printf("Checking Local groups for ");
-			printf("user: %S\n", _wcsupr((wchar_t *)user));
-			printf("group: %S\n", _wcsupr((wchar_t *)group));
-
-			//////////////////////////////////////////////////////////////////
-			///////////////// Local groups ///////////////////////////////////
-			//////////////////////////////////////////////////////////////////
-			//////////////////////////////////////////////////////////////////
-			if (locdom==1 || locdom==3){
-				LOCALGROUP_MEMBERS_INFO_2 *bufLMI, *cur;
-				DWORD read, total, resumeh, rc, i;
-				wchar_t	tempbuf[MAXLEN];
-				wchar_t seperator[MAXLEN];      
-				
-				netlocalgroupgetmembers_t netlocalgroupgetmembers;
-				HINSTANCE h = LoadLibrary ("netapi32.dll");
-				netlocalgroupgetmembers = (netlocalgroupgetmembers_t) GetProcAddress (h, "NetLocalGroupGetMembers");
-
-				////////////////////// GROUPS///////////////////////////////////////
-				mbstowcs( seperator,  "\\", 5 );
-				///////////////////////GROUP1/////////////////////////////////////
-				resumeh = 0;
-				do
-				{
-					bufLMI = NULL;
-					rc = netlocalgroupgetmembers( NULL, (wchar_t *)group, 2, (BYTE **) &bufLMI,BUFSIZE, &read, &total, &resumeh );
-					if ( rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS )
-						{
-							
-							for ( i = 0, cur = bufLMI; i < read; ++ i, ++ cur )
-								{
-									// Note: the capital S in the format string will expect Unicode
-									// strings, as this is a program written/compiled for ANSI.
-									_wcsupr(cur->lgrmi2_domainandname);
-									wcscpy(tempbuf,cur->lgrmi2_domainandname);
-									wchar_t *t=wcsstr(tempbuf,seperator);
-									t++;
-									printf( "%S\n", t );
-									if (wcscmp(_wcsupr(t), _wcsupr((wchar_t *)user))==0) 
-										{
-											laccess_vnc=TRUE;
-											printf( "Local: User found in group \n" );
-										}
-								}
-					if ( bufLMI != NULL )
-					NetApiBufferFree( bufLMI );
-						}
-				} while ( rc == ERROR_MORE_DATA );
-				
-				///////////////////////////////////////////////////////////////////////
-			if ( h != 0 )FreeLibrary( h);
-			}
-
-
-			if ( !rcdomain){
-				DWORD rc;
-				printf( "New added ----  just for testing \n");
-				wcscpy( (wchar_t *) server, (wchar_t *) buf );
-				byte *buf2 = 0;
-				rc2 = NetWkstaGetInfoNT( 0 , 100 , &buf2 ) ;
-				if( rc2 ) printf( "NetWkstaGetInfoA() returned %lu \n", rc2);
-				else wcstombs( domain, ((WKSTA_INFO_100_NT *) buf2)->wki100_langroup, MAXLEN );
-				NetApiBufferFree( buf2 );
-				domain[MAXLEN - 1] = '\0';
-				printf("Detected domain = %s\n",domain);
-				buf2 = 0;
-				char userdomain[MAXLEN * sizeof(wchar_t)];
-				char userdom[MAXLEN];
-				strcpy(userdom,domain);
-				strcat(userdom,"\\");
-				strcat(userdom,userin);
-				mbstowcs( (wchar_t *) userdomain, userdom, MAXLEN );
-				printf( "%S\n", userdomain);
-				rc = NetUserGetGroupsNT( NULL ,(wchar_t *) userdomain, 0, 1,&buf2, MAX_PREFERRED_LENGTH, &read, &total);
-				if ( rc == NERR_Success)
-					{
-						for ( i = 0; i < read; ++ i )
-							{
-								wcstombs( groupname, ((LPLOCALGROUP_USERS_INFO_0_NT *) buf2)[i].grui0_name, MAXLEN );	
-								groupname[MAXLEN - 1] = '\0'; // because strncpy won't do this if overflow
-#ifdef _MSC_VER
-								_strupr(groupname);
-								_strupr(groupin);
-#else
-								_strupr(groupname);
-								_strupr(groupin);
-#endif
-								printf( "compare %s %s\n", groupname, group);
-								if (strcmp(groupname, groupin)==0) 
-								{
-									printf( "match ...\n" );
-									laccess_vnc=TRUE;
-								}
-								else printf( "no match ...\n" );
-							}
-						if (laccess_vnc==TRUE) printf( "group found ...\n" );
-						else printf( "No group found \n" );
-
-					}
-				NetApiBufferFree( buf2 );
-				
-			}
-	
-
-			 if (locdom==2 || locdom==3) if ( !rcdomain){
-				DWORD rc;
-				printf( "New added ----  just for testing \n");
-				wcscpy( (wchar_t *) server, (wchar_t *) buf );
-				byte *buf2 = 0;
-				rc2 = NetWkstaGetInfoNT( 0 , 100 , &buf2 ) ;
-				if( rc2 ) printf( "NetWkstaGetInfoA() returned %lu \n", rc2);
-				else wcstombs( domain, ((WKSTA_INFO_100_NT *) buf2)->wki100_langroup, MAXLEN );
-				NetApiBufferFree( buf2 );
-				domain[MAXLEN - 1] = '\0';
-				printf("Detected domain = %s\n",domain);
-				buf2 = 0;
-				char userdomain[MAXLEN * sizeof(wchar_t)];
-				char userdom[MAXLEN];
-				//strcpy(userdom,domain);
-				//strcat(userdom,"\\");
-				strcpy(userdom,userin);
-				mbstowcs( (wchar_t *) userdomain, userdom, MAXLEN );
-				printf( "%S\n", userdomain);
-				rc = NetUserGetGroupsNT2( (wchar_t *)server,(wchar_t *) userdomain, 0,&buf2, MAX_PREFERRED_LENGTH, &read, &total);
-				if ( rc == NERR_Success)
-					{
-						for ( i = 0; i < read; ++ i )
-							{
-								wcstombs( groupname, ((LPLOCALGROUP_USERS_INFO_0_NT *) buf2)[i].grui0_name, MAXLEN );	
-								groupname[MAXLEN - 1] = '\0'; // because strncpy won't do this if overflow
-#ifdef _MSC_VER
-								_strupr(groupname);
-								_strupr(groupin);
-#else
-								_strupr(groupname);
-								_strupr(groupin);
-#endif
-								printf( "compare %s %s\n", groupname, group);
-								if (strcmp(groupname, groupin)==0) 
-								{
-									printf( "match ...\n" );
-									laccess_vnc=TRUE;
-								}
-								else printf( "no match ...\n" );
-							}
-						if (laccess_vnc==TRUE) printf( "group found ...\n" );
-						else printf( "No group found \n" );
-
-					}
-				NetApiBufferFree( buf2 );
-				
-			}
-		}
-	////////////////////////////////////////////////////////////////////////////////////////////
-	////9.X
-	////////////////////////////////////////////////////////////////////////////////////////////
-	if (locdom==2 || locdom==3) if ( !isNT )
-		{
-			rc = NetGetDCName95( 0, &buf );
-			if ( rc ) printf( "NetGetDCName95() returned %lu\n", rc );
-			if (rc==2453) 
-			{
-				printf( "No domain controler found\n");
-				return false;
-			}
-			if ( !rc )
-			{
-				strcpy( server, (char *) buf );
-				byte *buf2 = 0;
-				rc = NetWkstaGetInfo95( 0 , 100 , &buf2 ) ;
-				if( rc ) printf( "NetWkstaGetInfoA() returned %lu \n", rc);
-				else  strncpy( domain, ((WKSTA_INFO_100_95 *) buf2)->wki100_langroup, MAXLEN );
-				NetApiBufferFree( buf2 );
-				domain[MAXLEN - 1] = '\0';
-				NetApiBufferFree( buf );
-				buf = 0;
-				buf2 = 0;
-				////////////////////////////////////////////
-				rc = NetUserGetGroups95( server,user, 0, &buf2, 2024, &read, &total);
-				if ( rc == NERR_Success)
-					{
-						for ( i = 0; i < read; ++ i )
-							{ 
-								strncpy( groupname, ((LPLOCALGROUP_USERS_INFO_0_95 *) buf2)[i].grui0_name, MAXLEN );
-								groupname[MAXLEN - 1] = '\0'; // because strncpy won't do this if overflow
-#ifdef _MSC_VER
-							_strupr(groupname);
-#else
-							_strupr(groupname);
-#endif
-								printf( "%s\n", groupname);
-								if (strcmp(groupname, group)==0) laccess_vnc=TRUE;
-							}
-						if (access_vnc==TRUE) printf( "NT: Domain group found ...\n" );
-						else printf( "No Domain group found \n" );
-					}
-				NetApiBufferFree( buf2 );
-				buf2=0;
-			}
-		}
-		
-	
-	if (buf)NetApiBufferFree( buf );
-	if ( hNet != 0 )
-		FreeLibrary( hNet );
-	if ( hLoc != 0 )
-		FreeLibrary( hLoc );
-	//check user
-	if (isNT)
-	{
-
-#if _MSC_VER < 1400
-		wcstombs( user, (unsigned short *)user, MAXLEN);	
-#else
-		wcstombs( user, (const wchar_t *)user, MAXLEN);	
-#endif
-	}
-
-	BOOL logon_OK=false;
-	BOOL passwd_OK=false;
-#ifdef _MSC_VER
-	_strupr(user);
-#else
-	_strupr(user);
-#endif
-	passwd_OK=false;
-	if (isXP)
-		{
-			LOGONUSER LU=NULL;
-			HMODULE  shell1 = LoadLibrary("advapi32.dll");
-			if(shell1!=NULL) LU = (LOGONUSER)GetProcAddress((HINSTANCE)shell1,"LogonUserA");
-			if (LU!=NULL)
-			{
-			HANDLE token;
-			if (locdom==2 || locdom==3 ||locdom==1) 
-				if (LU(user,domain,password,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&token))
-				{	passwd_OK=true;
-					if (passwd_OK==TRUE) printf( "Domain password check OK \n" );
-					else printf( "Domain password check Failed \n" );
-				}
-			if (locdom==1 || locdom==3) 
-				if (LU(user,".",password,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&token))
-				{
-				passwd_OK=true;
-				if (passwd_OK==TRUE) printf( "Local password check OK \n" );
-				}
-			}
-			FreeLibrary(shell1);
-
-		}
-	else
-	{
-		if (locdom==2 || locdom==3 || locdom==1)
-		if (SSPLogonUser(domain,user, password))
-		{	passwd_OK=true;
-			if (passwd_OK==TRUE) printf( "Domain password check OK \n" );		
-		}
-		else printf( "Domain password check Failed \n" );
-
-		if (locdom==1 || locdom==3)
-		if (SSPLogonUser(".",user, password))
-		{
-			passwd_OK=true;
-			if (passwd_OK==TRUE) printf( "Local password check OK \n" );
-		}
-		else printf( "Local password check Failed \n" );
-		if (locdom==2 || locdom==3)if (SSPLogonUser(domain,"isdiua", "hegbfsa")) {passwd_OK=false;printf( "Guest account block \n" );}
-		if (locdom==1 || locdom==3)if (SSPLogonUser(".","isdiua", "hegbfsa")) {passwd_OK=false;printf( "Guest account block \n" );}
-	}
-	if (access_vnc==TRUE || laccess_vnc==TRUE || ad_access==TRUE)
-	{
-		if (passwd_OK) 
-		{
-		logon_OK=true;
-		printf( "Acces to vnc  OK \n" );
-		}
-	}
-	return logon_OK;
-	
-}
-
-
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.def b/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.def
deleted file mode 100644
index 016011b..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.def
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBRARY   workgrpdomnt4
-
-             EXPORTS
-               CUGP
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.dsw b/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.dsw
deleted file mode 100644
index 5104fee..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "workgrpdomnt4"=".\workgrpdomnt4.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.h b/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.h
deleted file mode 100644
index c4886e2..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.h
+++ /dev/null
@@ -1,100 +0,0 @@
-
-// The following ifdef block is the standard way of creating macros which make exporting 
-// from a DLL simpler. All files within this DLL are compiled with the AUTH_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see 
-// AUTH_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef WORKGRPDOMNT4_EXPORTS
-#define WORKGRPDOMNT4_API __declspec(dllexport)
-#else
-#define WORKGRPDOMNT4_API __declspec(dllimport)
-#endif
-#pragma comment( lib, "netapi32.lib" )
-#if defined( UNICODE ) || defined( _UNICODE )
-#error Sorry -- please compile as an ANSI program.
-#endif
-#include <windows.h>
-#include <stdio.h>
-#include <lmcons.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <tchar.h>
-#include <lm.h>
-#include <stdio.h>
-#define SECURITY_WIN32
-#include <sspi.h>
-#ifndef SEC_I_COMPLETE_NEEDED
-#include <issperr.h>
-#include <time.h>
-#endif
-#pragma hdrstop
-
-#define MAXLEN 256
-#define MAX_PREFERRED_LENGTH    ((DWORD) -1)
-#define NERR_Success            0
-//#define LG_INCLUDE_INDIRECT 1
-#define BUFSIZE 1024
-
-typedef DWORD (__stdcall *NetApiBufferFree_t)( void *buf );
-typedef DWORD (__stdcall *NetGetDCNameNT_t)( wchar_t *server, wchar_t *domain, byte **buf );
-typedef DWORD (__stdcall *NetGetDCName95_t)( char *domain, byte **buf );
-typedef DWORD (__stdcall *NetUserGetGroupsNT_t)( wchar_t *server,wchar_t *user, DWORD level,DWORD flags, byte **buf,DWORD prefmaxlen, DWORD *entriesread, DWORD *totalentries);
-typedef DWORD (__stdcall *NetUserGetGroupsNT_t2)( wchar_t *server,wchar_t *user, DWORD level, byte **buf,DWORD prefmaxlen, DWORD *entriesread, DWORD *totalentries);
-
-typedef DWORD (__stdcall *NetUserGetGroups95_t)( char *server,char *user, DWORD level, byte **buf,DWORD prefmaxlen, DWORD *entriesread, DWORD *totalentries);
-typedef DWORD (__stdcall *NetWkstaGetInfoNT_t)( wchar_t *server, DWORD level, byte **buf );
-typedef DWORD (__stdcall *NetWkstaGetInfo95_t)( char *domain,DWORD level, byte **buf );
-typedef DWORD (__stdcall *netlocalgroupgetmembers_t)(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-
-typedef struct _LPLOCALGROUP_USERS_INFO_0_NT
-{
-	wchar_t *grui0_name;
-}LPLOCALGROUP_USERS_INFO_0_NT;
-typedef struct _LPLOCALGROUP_USERS_INFO_0_95
-{
-	char *grui0_name;
-}LPLOCALGROUP_USERS_INFO_0_95;
-typedef struct _WKSTA_INFO_100_95 {
-  DWORD     wki100_platform_id;
-  char *    wki100_computername;
-  char *    wki100_langroup;
-  DWORD     wki100_ver_major;
-  DWORD     wki100_ver_minor;
-}WKSTA_INFO_100_95;
-typedef struct _WKSTA_INFO_100_NT {
-  DWORD     wki100_platform_id;
-  wchar_t *    wki100_computername;
-  wchar_t *    wki100_langroup;
-  DWORD     wki100_ver_major;
-  DWORD     wki100_ver_minor;
-}WKSTA_INFO_100_NT;
-typedef struct _AUTH_SEQ {
-   BOOL fInitialized;
-   BOOL fHaveCredHandle;
-   BOOL fHaveCtxtHandle;
-   CredHandle hcred;
-   struct _SecHandle hctxt;
-} AUTH_SEQ, *PAUTH_SEQ;
-
-typedef BOOL (WINAPI *LOGONUSER)(
-        LPTSTR lpszUsername,    // user name
-        LPTSTR lpszDomain,      // domain or server
-        LPTSTR lpszPassword,    // password
-        DWORD dwLogonType,      // type of logon operation
-        DWORD dwLogonProvider,  // logon provider
-        PHANDLE phToken );        // receive tokens handle
-
-
-ACCEPT_SECURITY_CONTEXT_FN       _AcceptSecurityContext;
-ACQUIRE_CREDENTIALS_HANDLE_FN    _AcquireCredentialsHandle;
-COMPLETE_AUTH_TOKEN_FN           _CompleteAuthToken;
-DELETE_SECURITY_CONTEXT_FN       _DeleteSecurityContext;
-FREE_CONTEXT_BUFFER_FN           _FreeContextBuffer;
-FREE_CREDENTIALS_HANDLE_FN       _FreeCredentialsHandle;
-INITIALIZE_SECURITY_CONTEXT_FN   _InitializeSecurityContext;
-QUERY_SECURITY_PACKAGE_INFO_FN   _QuerySecurityPackageInfo;
-
-bool ad_access;
-WORKGRPDOMNT4_API BOOL CUGP(char * userin,char *password,char *machine, char *group, int locdom);
-
diff --git a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc b/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc
deleted file mode 100644
index 53a2fc9..0000000
--- a/ica/win32/addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc
+++ /dev/null
@@ -1,112 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-// Defines STR_COMPANYNAME, STR_FILEVERSION, STR_PRODUCTVERSION, STR_COPYRIGHT,
-// STR_SPECIALBUILD, FILEVERSION, PRODUCTVERSION
-#include "../../versioninfo.h"
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION INT_FILEVERSION
- PRODUCTVERSION INT_PRODUCTVERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "Workgroup and NT4 domain authentication for UltraVNC\0"
-            VALUE "CompanyName", STR_COMPANYNAME
-            VALUE "FileDescription", "MS-Logon I for UltraVNC\0"
-            VALUE "FileVersion", STR_FILEVERSION
-            VALUE "InternalName", "workgrpdomnt4\0"
-            VALUE "LegalCopyright", STR_COPYRIGHT
-            VALUE "OriginalFilename", "workgrpdomnt4.dll\0"
-            VALUE "ProductName", "UltraVNC workgrpdomnt4\0"
-            VALUE "ProductVersion", STR_PRODUCTVERSION
-#if isRC == 1
-			VALUE "SpecialBuild", STR_SPECIALBUILD
-#endif
-			END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 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    // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/addon/versioninfo.h b/ica/win32/addon/versioninfo.h
deleted file mode 100644
index 1f4c7b2..0000000
--- a/ica/win32/addon/versioninfo.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2004 Martin Scharpf, B. Braun Melsungen AG. All Rights Reserved.
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-
-/* versioninfo.h: Defines 
-	STR_COMPANYNAME, 
-    STR_FILEVERSION,
-	STR_PRODUCTVERSION,
-	STR_COPYRIGHT,
-	STR_SPECIALBUILD,
-	INT_FILEVERSION,
-	INT_PRODUCTVERSION */
-
-#ifndef ULTRAVNC_VERSIONINFO_H
-#define ULTRAVNC_VERSIONINFO_H
-
-// ======================== Define Version here =======================
-#define MAJ 1
-#define MIN 0
-#define V3 90
-#define V4 0 // Used as ReleaseCandidate minor version in SpecialBuildDescription
-
-// Set to 1 if ReleaseCandidate (toggles visibility of SpecialBuildDescription)
-#define isRC 0
-
-// =========== No further configuration needed below this line =================
-
-// some helper macros (see http://http://gcc.gnu.org/onlinedocs/cpp/Stringification.html)
-#define XSTR(x) STR(x)
-#define STR(x) #x
-
-// Concatenate tokens
-#define CAT2(A,B) A.B
-#define CAT4(A,B,C,D) A.B.C.D
-
-#define INT_VERSION MAJ,MIN,V3,V4
-#define STR_VERSION CAT4(MAJ,MIN,V3,V4)
-#define STR_MAINVER CAT2(MAJ,MIN)
-#define STR_RC_VERSION CAT2(V3,V4)
-
-#define INT_FILEVERSION INT_VERSION
-#define INT_PRODUCTVERSION INT_VERSION
-
-#define STR_FILEVERSION XSTR(STR_VERSION) "\0"
-#define STR_PRODUCTVERSION XSTR(STR_VERSION) "\0"
-#define STR_COPYRIGHT "Copyright � 2002-2005 UltraVNC team members\0"
-#define STR_SPECIALBUILD "v" XSTR(STR_MAINVER) " ReleaseCandidate " XSTR(STR_RC_VERSION) "\0"
-#if isRC == 1
-#define STR_ABOUT_SERVER_VERSION XSTR(UltraVNC Win32 Server v STR_MAINVER RC STR_RC_VERSION)
-#define STR_ABOUT_VIEWER_VERSION XSTR(UltraVNC Win32 Viewer v STR_MAINVER RC STR_RC_VERSION)
-#else
-#define STR_ABOUT_SERVER_VERSION XSTR(UltraVNC Win32 Server v STR_VERSION)
-#define STR_ABOUT_VIEWER_VERSION XSTR(UltraVNC Win32 Viewer v STR_VERSION)
-#endif
-#define STR_COMPANYNAME "UltraVNC\0"
-
-#endif // ULTRAVNC_VERSIONINFO_H
diff --git a/ica/win32/common/Clipboard.cpp b/ica/win32/common/Clipboard.cpp
deleted file mode 100644
index 98fad1a..0000000
--- a/ica/win32/common/Clipboard.cpp
+++ /dev/null
@@ -1,762 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-
-// Clipboard.h
-
-// adzm - July 2010
-//
-// Common classes for dealing with the clipboard, including serializing and deserializing compressed data, hashing and comparing, etc.
-// Used by server and viewer.
-
-#include "Clipboard.h"
-
-
-#define VC_EXTRALEAN
-#include <windows.h>
-
-#include <string>
-
-#include <rdr/MemInStream.h>
-#include <rdr/ZlibOutStream.h>
-#include <rdr/ZlibInStream.h>
-#ifdef IPP
-#include "..\..\ipp_zlib\src\zlib\zlib.h"
-#else
-#include <zlib/zlib.h>
-#endif
-
-
-ExtendedClipboardDataMessage::ExtendedClipboardDataMessage()
-	: m_pExtendedData(NULL), m_nInternalLength(0), m_pCurrentPos(NULL), m_pData(NULL)
-{
-	EnsureBufferLength(sz_rfbExtendedClipboardData);
-	m_pCurrentPos += sz_rfbExtendedClipboardData;
-}
-
-ExtendedClipboardDataMessage::~ExtendedClipboardDataMessage()
-{
-	delete[] m_pData;
-}
-
-void ExtendedClipboardDataMessage::Reset()
-{
-	delete[] m_pData;
-	m_pData = NULL;
-	m_pCurrentPos = NULL;
-	m_pExtendedData = NULL;
-	m_pCurrentPos = NULL;
-	m_nInternalLength = 0;
-
-	EnsureBufferLength(sz_rfbExtendedClipboardData);
-	m_pCurrentPos += sz_rfbExtendedClipboardData;
-}
-
-void ExtendedClipboardDataMessage::AddFlag(CARD32 flag)
-{
-	m_pExtendedData->flags |= Swap32IfLE(flag);
-}
-
-bool ExtendedClipboardDataMessage::HasFlag(CARD32 flag)
-{
-	return (m_pExtendedData->flags & Swap32IfLE(flag)) ? true : false;
-}
-
-int ExtendedClipboardDataMessage::GetMessageLength()
-{
-	return GetDataLength() - sz_rfbExtendedClipboardData;
-}
-
-int ExtendedClipboardDataMessage::GetDataLength()
-{
-	return m_pCurrentPos - m_pData;
-}
-
-const BYTE* ExtendedClipboardDataMessage::GetData()
-{
-	return m_pData;
-}
-
-BYTE* ExtendedClipboardDataMessage::GetBuffer()
-{
-	return m_pData;
-}
-
-int ExtendedClipboardDataMessage::GetBufferLength()
-{
-	return m_nInternalLength;
-}
-
-const BYTE* ExtendedClipboardDataMessage::GetCurrentPos()
-{
-	return m_pCurrentPos;
-}
-
-void ExtendedClipboardDataMessage::AppendInt(CARD32 val)
-{
-	EnsureBufferLength(GetDataLength() + sizeof(val));
-
-	val = Swap32IfLE(val);
-
-	memcpy(m_pCurrentPos, &val, sizeof(val));
-	m_pCurrentPos += sizeof(val);
-}
-
-void ExtendedClipboardDataMessage::AppendBytes(BYTE* pData, int length)
-{
-	EnsureBufferLength(GetDataLength() + length, false);
-
-	memcpy(m_pCurrentPos, pData, length);
-	m_pCurrentPos += length;
-}
-
-void ExtendedClipboardDataMessage::Advance(int len)
-{
-	EnsureBufferLength(GetDataLength() + len, false);
-	m_pCurrentPos += len;
-}
-
-CARD32 ExtendedClipboardDataMessage::ReadInt()
-{
-	CARD32 val = 0;
-
-	memcpy(&val, m_pCurrentPos, sizeof(val));
-
-	m_pCurrentPos += sizeof(val);
-
-	return Swap32IfLE(val);
-}
-
-void ExtendedClipboardDataMessage::EnsureBufferLength(int len, bool bGrowBeyond)
-{
-	if (m_nInternalLength < len) {
-		int nCurrentOffset = GetDataLength();
-
-		int nNewLength = bGrowBeyond ? len * 2 : len;
-		BYTE* pNewBuffer = new BYTE[nNewLength];
-		::ZeroMemory(pNewBuffer, nNewLength);
-
-		if (m_pData) {
-			memcpy(pNewBuffer, m_pData, GetDataLength());
-			delete[] m_pData;
-		}
-
-		m_pData = pNewBuffer;
-		m_pExtendedData = (rfbExtendedClipboardData*)m_pData;
-		m_pCurrentPos = m_pData + nCurrentOffset;
-		m_nInternalLength = nNewLength;
-	}
-}
-
-int ExtendedClipboardDataMessage::CountFormats()
-{
-	CARD32 flags = GetFlags();
-
-	flags = flags & 0x0000FFFF;
-
-	// from Brian W. Kernighan
-	int c = 0;
-	for (c = 0; flags; c++) {
-		flags &= flags - 1;
-	}
-
-	return c;
-}
-
-CARD32 ExtendedClipboardDataMessage::GetFlags()
-{
-	return Swap32IfLE(m_pExtendedData->flags);
-}
-
-const UINT ClipboardSettings::formatUnicodeText =	CF_UNICODETEXT;
-const UINT ClipboardSettings::formatRTF =			RegisterClipboardFormat("Rich Text Format");
-const UINT ClipboardSettings::formatHTML =			RegisterClipboardFormat("HTML Format");
-const UINT ClipboardSettings::formatDIB =			CF_DIBV5;
-
-const int ClipboardSettings::defaultLimitText =		((int)0x00A00000); // 10 megabytes uncompressed. Pretty huge, but not a problem for a LAN. Better than the previous no limit, though.
-const int ClipboardSettings::defaultLimitRTF =		((int)0x00200000); // Limit these to 2 megabytes so they don't end up adding too much strain by being enabled by default
-const int ClipboardSettings::defaultLimitHTML =		((int)0x00200000); // besides, every 2mb rtf/html data I have seen will DEFLATE very well.
-const int ClipboardSettings::defaultLimitDIB =		((int)0x00000000); // no DIB by default
-
-const int ClipboardSettings::defaultLimit =			((int)0x00200000);
-
-ClipboardSettings::ClipboardSettings(CARD32 caps)
-	: m_bSupportsEx(false)
-	, m_nLimitText(defaultLimitText)
-	, m_nLimitRTF(defaultLimitRTF)
-	, m_nLimitHTML(defaultLimitHTML)
-	, m_nLimitDIB(defaultLimitDIB)
-	, m_nRequestedLimitText(m_nLimitText)
-	, m_nRequestedLimitRTF(m_nLimitRTF)
-	, m_nRequestedLimitHTML(m_nLimitHTML)
-	, m_nRequestedLimitDIB(m_nLimitDIB)
-	, m_myCaps(caps)
-	, m_remoteCaps(ClipboardSettings::defaultCaps)
-{
-}
-
-CARD32 ClipboardSettings::defaultCaps = 
-	(clipCaps | clipRequest | clipProvide)  // capabilities
-	| 
-	(clipText | clipRTF | clipHTML | clipDIB); // supports Unicode text, RTF, and HTML, and DIB
-CARD32 ClipboardSettings::defaultViewerCaps = defaultCaps | clipNotify;
-CARD32 ClipboardSettings::defaultServerCaps = defaultCaps | clipPeek;
-
-
-void ClipboardSettings::PrepareCapsPacket(ExtendedClipboardDataMessage& extendedDataMessage)
-{
-	// messages and formats that we can handle
-	extendedDataMessage.m_pExtendedData->flags = Swap32IfLE(m_myCaps);
-
-	// now include our limits in order of enum value
-	extendedDataMessage.AppendInt(m_nLimitText);
-	extendedDataMessage.AppendInt(m_nLimitRTF);
-	extendedDataMessage.AppendInt(m_nLimitHTML);
-	extendedDataMessage.AppendInt(m_nLimitDIB);
-}
-
-void ClipboardSettings::HandleCapsPacket(ExtendedClipboardDataMessage& extendedDataMessage, bool bSetLimits)
-{
-	int nCount = extendedDataMessage.CountFormats();
-
-	m_remoteCaps = extendedDataMessage.GetFlags();	
-
-	if (m_remoteCaps & clipText) {
-		m_nRequestedLimitText = (int)extendedDataMessage.ReadInt();		
-		nCount--;
-	} else {
-		m_nRequestedLimitText = 0;
-	}
-	if (m_remoteCaps & clipRTF) {
-		m_nRequestedLimitRTF = (int)extendedDataMessage.ReadInt();
-		nCount--;
-	} else {
-		m_nRequestedLimitRTF = 0;
-	}
-	if (m_remoteCaps & clipHTML) {
-		m_nRequestedLimitHTML = (int)extendedDataMessage.ReadInt();
-		nCount--;
-	} else {
-		m_nRequestedLimitHTML = 0;
-	}
-	if (m_remoteCaps & clipDIB) {
-		m_nRequestedLimitDIB = (int)extendedDataMessage.ReadInt();
-		nCount--;
-	} else {
-		m_nRequestedLimitDIB = 0;
-	}
-
-	if (bSetLimits) {
-		m_nLimitText = m_nRequestedLimitText;
-		m_nLimitRTF = m_nRequestedLimitRTF;
-		m_nLimitHTML = m_nRequestedLimitHTML;
-		m_nLimitDIB = m_nRequestedLimitDIB;
-	}
-
-	// read any unsupported values
-	while (nCount) {
-		extendedDataMessage.ReadInt();
-		nCount--;
-	}
-}
-
-ClipboardHolder::ClipboardHolder(HWND hwndOwner)
-{
-	m_bIsOpen = ::OpenClipboard(hwndOwner) ? true : false;
-}
-
-ClipboardHolder::~ClipboardHolder()
-{
-	if (m_bIsOpen) {
-		::CloseClipboard();
-	}
-}
-
-ClipboardData::ClipboardData()
-	: m_crc(0)
-	, m_lengthText(0)
-	, m_lengthRTF(0)
-	, m_lengthHTML(0)
-	, m_lengthDIB(0)
-	, m_pDataText(NULL)
-	, m_pDataRTF(NULL)
-	, m_pDataHTML(NULL)
-	, m_pDataDIB(NULL)
-{
-}
-
-ClipboardData::~ClipboardData()
-{
-	FreeData();
-}
-
-void ClipboardData::FreeData()
-{
-	delete[] m_pDataText;
-	delete[] m_pDataRTF;
-	delete[] m_pDataHTML;
-	delete[] m_pDataDIB;
-
-	m_pDataText = NULL;
-	m_pDataRTF = NULL;
-	m_pDataHTML = NULL;
-	m_pDataDIB = NULL;
-}
-
-bool ClipboardData::Load(HWND hwndOwner) // will return false on failure
-{
-	// This can be improved by not making copies of the clipboard data and simply keeping the handles open; however
-	// I seemed to notice some issues with having multiple clipboard format data handles open when an application 
-	// uses clipboard formats that it must render on demand. Regardless, I am not too concerned about this now.
-
-	ClipboardHolder holder(hwndOwner);
-
-	if (!holder.m_bIsOpen) {
-		return false;
-	}
-
-	m_crc = 0;
-	FreeData();
-	
-	m_crc = crc32(0L, Z_NULL, 0);
-
-	// text
-	{
-		m_lengthText = 0;
-
-		HANDLE hText = NULL;
-		if (IsClipboardFormatAvailable(ClipboardSettings::formatUnicodeText)) {
-			hText = ::GetClipboardData(ClipboardSettings::formatUnicodeText);
-		}
-
-		if (hText) {
-			BYTE* pData = (BYTE*)GlobalLock(hText);
-			int nLength = (int)GlobalSize(hText);
-
-			if (pData != NULL && nLength > 0) {
-
-				// Convert from UTF-16 to UTF-8
-				int nConvertedSize = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)pData, -1, NULL, 0, NULL, NULL);
-
-				if (nConvertedSize > 0) {				
-					m_pDataText = new BYTE[nConvertedSize];
-					//memcpy(m_pDataText, pData, nLength);
-
-					int nFinalConvertedSize = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)pData, -1, (LPSTR)m_pDataText, nConvertedSize, NULL, NULL);
-
-					if (nFinalConvertedSize > 0) {
-						m_lengthText = nFinalConvertedSize;
-
-						m_crc = crc32(m_crc, m_pDataText, nFinalConvertedSize);
-					} else {
-						delete[] m_pDataText;
-					}
-				}
-
-				GlobalUnlock(hText);
-			}
-		}
-	}
-
-	// RTF
-	{
-		m_lengthRTF = 0;
-
-		HANDLE hRTF = NULL;
-		if (IsClipboardFormatAvailable(ClipboardSettings::formatRTF)) {
-			hRTF = ::GetClipboardData(ClipboardSettings::formatRTF);
-		}
-
-		if (hRTF) {
-			BYTE* pData = (BYTE*)GlobalLock(hRTF);
-			int nLength = (int)GlobalSize(hRTF);
-
-			if (pData != NULL && nLength > 0) {
-				
-				m_pDataRTF = new BYTE[nLength];
-				memcpy(m_pDataRTF, pData, nLength);
-
-				m_lengthRTF = nLength;
-
-				GlobalUnlock(hRTF);
-			}
-		}
-	}
-
-	// HTML
-	{
-		m_lengthHTML = 0;
-
-		HANDLE hHTML = NULL;
-		if (IsClipboardFormatAvailable(ClipboardSettings::formatHTML)) {
-			hHTML = ::GetClipboardData(ClipboardSettings::formatHTML);
-		}
-
-		if (hHTML) {
-			BYTE* pData = (BYTE*)GlobalLock(hHTML);
-			int nLength = (int)GlobalSize(hHTML);
-
-			if (pData != NULL && nLength > 0) {
-				
-				m_pDataHTML = new BYTE[nLength];
-				memcpy(m_pDataHTML, pData, nLength);
-
-				m_lengthHTML = nLength;
-
-				GlobalUnlock(hHTML);
-			}
-		}
-	}
-
-	// DIB
-	{
-		m_lengthDIB = 0;
-
-		HANDLE hDIB = NULL;
-		if (IsClipboardFormatAvailable(ClipboardSettings::formatDIB)) {
-			hDIB = ::GetClipboardData(ClipboardSettings::formatDIB);
-		}
-
-		if (hDIB) {
-			BYTE* pData = (BYTE*)GlobalLock(hDIB);
-			int nLength = (int)GlobalSize(hDIB);
-
-			if (pData != NULL && nLength > 0) {
-				
-				m_pDataDIB = new BYTE[nLength];
-				memcpy(m_pDataDIB, pData, nLength);
-
-				m_lengthDIB = nLength;
-
-				GlobalUnlock(hDIB);
-			}
-		}
-	}
-
-	return m_lengthText + m_lengthRTF + m_lengthHTML + m_lengthDIB > 0;
-}
-
-bool ClipboardData::Restore(HWND hwndOwner, ExtendedClipboardDataMessage& extendedClipboardDataMessage)
-{
-	ClipboardHolder holder(hwndOwner);
-
-	if (!holder.m_bIsOpen) {
-		return false;
-	}
-
-	if (!::EmptyClipboard()) {
-		return false;
-	}
-
-	m_lengthText = m_lengthRTF = m_lengthHTML = m_lengthDIB = 0;
-
-	int nCompressedDataLength = extendedClipboardDataMessage.GetBufferLength() - extendedClipboardDataMessage.GetDataLength();
-
-	m_crc = crc32(0L, Z_NULL, 0);
-	if (nCompressedDataLength == 0) {
-		// no data beyond the flags
-		return true;
-	}
-
-	rdr::MemInStream inStream(extendedClipboardDataMessage.GetCurrentPos(), nCompressedDataLength);
-	rdr::ZlibInStream compressedStream;
-
-	compressedStream.setUnderlying(&inStream, nCompressedDataLength);
-
-	int length = 0;
-	bool bFailed = false;
-	if (extendedClipboardDataMessage.HasFlag(clipText)) {
-		length = (int)compressedStream.readU32();
-
-		if (length > 0) {
-			// get the incoming UTF-8 text
-			BYTE* pIncomingText = new BYTE[length];
-			compressedStream.readBytes(pIncomingText, length);
-
-			m_crc = crc32(m_crc, pIncomingText, length);
-
-			// now we have to translate to UTF-16
-			int nConvertedSize = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pIncomingText, length, NULL, 0);
-
-			if (nConvertedSize > 0) {
-				HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, nConvertedSize * sizeof(wchar_t));
-
-				if (hData) {
-					BYTE* pData = (BYTE*)GlobalLock(hData);
-
-					if (pData) {
-						int nFinalConvertedSize = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pIncomingText, length, (LPWSTR)pData, nConvertedSize);
-
-						GlobalUnlock(hData);
-
-						if (nFinalConvertedSize > 0) {
-							if (::SetClipboardData(ClipboardSettings::formatUnicodeText, hData)) {
-								hData = NULL;
-								m_lengthText = nConvertedSize * sizeof(wchar_t);
-							} else {
-								bFailed = true;
-							}
-						}
-					}
-				}
-
-				if (hData) {
-					GlobalFree(hData);
-				}
-			}
-			if (pIncomingText) {
-				delete[] pIncomingText;
-			}
-			if (bFailed) {
-				return false;
-			}
-		}
-	}
-
-	if (extendedClipboardDataMessage.HasFlag(clipRTF)) {
-		length = (int)compressedStream.readU32();
-
-		if (length > 0) {
-			HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, length);
-
-			if (!hData) return false;
-
-			BYTE* pData = (BYTE*)GlobalLock(hData);
-
-			if (pData) {
-				compressedStream.readBytes(pData, length);
-
-				GlobalUnlock(hData);
-
-				if (::SetClipboardData(ClipboardSettings::formatRTF, hData)) {
-					hData = NULL;
-					m_lengthRTF = length;
-				} else {
-					bFailed = true;
-				}
-			}
-
-			if (hData) {
-				GlobalFree(hData);
-			}
-		}
-	}
-	
-	if (extendedClipboardDataMessage.HasFlag(clipHTML)) {
-		length = (int)compressedStream.readU32();
-
-		if (length > 0) {
-			HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, length);
-
-			if (!hData) return false;
-
-			BYTE* pData = (BYTE*)GlobalLock(hData);
-
-			if (pData) {
-				compressedStream.readBytes(pData, length);
-
-				GlobalUnlock(hData);
-
-				if (!::SetClipboardData(ClipboardSettings::formatHTML, hData)) {
-					hData = NULL;
-					m_lengthHTML = length;
-				} else {
-					bFailed = true;
-				}
-			}
-
-			if (hData) {
-				GlobalFree(hData);
-			}
-		}
-	}
-
-	if (extendedClipboardDataMessage.HasFlag(clipDIB)) {
-		length = (int)compressedStream.readU32();
-
-		if (length > 0) {
-			HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, length);
-
-			if (!hData) return false;
-
-			BYTE* pData = (BYTE*)GlobalLock(hData);
-
-			if (pData) {
-				compressedStream.readBytes(pData, length);
-
-				GlobalUnlock(hData);
-
-				if (!::SetClipboardData(ClipboardSettings::formatDIB, hData)) {
-					hData = NULL;
-					m_lengthDIB = length;
-				} else {
-					bFailed = true;
-				}
-			}
-
-			if (hData) {
-				GlobalFree(hData);
-			}
-		}
-	}
-
-	// we can ignore everything else
-
-	return true;
-}
-
-Clipboard::Clipboard(CARD32 caps)
-	: settings(caps)
-	, m_crc(0)
-	, m_bNeedToProvide(false)
-	, m_bNeedToNotify(false)
-	, m_notifiedRemoteFormats(0)
-{
-}
-
-// returns true if something changed
-bool Clipboard::UpdateClipTextEx(ClipboardData& clipboardData, CARD32 overrideFlags)
-{
-	if (m_crc == clipboardData.m_crc && overrideFlags == 0) {
-		return false;
-	}
-
-	if (overrideFlags & clipPeek) {
-		// don't reset anything regarding providing new data, just 'include' any
-		// formats into the notify response.
-		if (clipboardData.m_lengthText != 0) {
-			extendedClipboardDataNotifyMessage.AddFlag(clipText);
-			m_bNeedToNotify = true;
-		}
-		if (clipboardData.m_lengthRTF != 0) {
-			extendedClipboardDataNotifyMessage.AddFlag(clipRTF);
-			m_bNeedToNotify = true;
-		}
-		if (clipboardData.m_lengthHTML != 0) {
-			extendedClipboardDataNotifyMessage.AddFlag(clipHTML);
-			m_bNeedToNotify = true;
-		}
-		if (clipboardData.m_lengthDIB != 0) {
-			extendedClipboardDataNotifyMessage.AddFlag(clipDIB);
-			m_bNeedToNotify = true;
-		}
-	} else {
-
-		m_bNeedToProvide = false;
-		m_bNeedToNotify = false;
-		extendedClipboardDataMessage.Reset();
-		extendedClipboardDataNotifyMessage.Reset();
-
-		extendedClipboardDataMessage.AddFlag(clipProvide);
-		extendedClipboardDataNotifyMessage.AddFlag(clipNotify);
-
-		rdr::MemOutStream memStream;
-		{
-			rdr::ZlibOutStream compressedStream(&memStream, 0, 9); //Z_BEST_COMPRESSION
-
-			if (clipboardData.m_lengthText != 0) {
-				extendedClipboardDataNotifyMessage.AddFlag(clipText);
-
-				if (clipboardData.m_lengthText <= settings.m_nLimitText || (overrideFlags & clipText)) {
-					compressedStream.writeU32(clipboardData.m_lengthText);
-					compressedStream.writeBytes(clipboardData.m_pDataText, clipboardData.m_lengthText);
-					extendedClipboardDataMessage.AddFlag(clipText);
-					m_bNeedToProvide = true;
-				} else {
-					m_bNeedToNotify = true;
-				}
-			}
-			if (clipboardData.m_lengthRTF != 0) {
-				extendedClipboardDataNotifyMessage.AddFlag(clipRTF);
-
-				if (clipboardData.m_lengthRTF <= settings.m_nLimitRTF || (overrideFlags & clipRTF)) {
-					compressedStream.writeU32(clipboardData.m_lengthRTF);
-					compressedStream.writeBytes(clipboardData.m_pDataRTF, clipboardData.m_lengthRTF);
-					extendedClipboardDataMessage.AddFlag(clipRTF);
-					m_bNeedToProvide = true;
-				} else {
-					m_bNeedToNotify = true;
-				}
-			}
-			if (clipboardData.m_lengthHTML != 0) {
-				extendedClipboardDataNotifyMessage.AddFlag(clipHTML);
-
-				if (clipboardData.m_lengthHTML <= settings.m_nLimitHTML || (overrideFlags & clipHTML)) {
-					compressedStream.writeU32(clipboardData.m_lengthHTML);
-					compressedStream.writeBytes(clipboardData.m_pDataHTML, clipboardData.m_lengthHTML);
-					extendedClipboardDataMessage.AddFlag(clipHTML);
-					m_bNeedToProvide = true;
-				} else {
-					m_bNeedToNotify = true;
-				}
-			}
-			if (clipboardData.m_lengthDIB != 0) {
-				extendedClipboardDataNotifyMessage.AddFlag(clipDIB);
-
-				if (clipboardData.m_lengthDIB <= settings.m_nLimitDIB || (overrideFlags & clipDIB)) {
-					compressedStream.writeU32(clipboardData.m_lengthDIB);
-					compressedStream.writeBytes(clipboardData.m_pDataDIB, clipboardData.m_lengthDIB);
-					extendedClipboardDataMessage.AddFlag(clipDIB);
-					m_bNeedToProvide = true;
-				} else {
-					m_bNeedToNotify = true;
-				}
-			}
-
-			compressedStream.flush();
-		}
-
-		if (m_bNeedToProvide) {
-			extendedClipboardDataMessage.AppendBytes((BYTE*)memStream.data(), memStream.length());
-			memStream.clear();
-		}
-
-		m_strLastCutText = "";
-		if (!settings.m_bSupportsEx && clipboardData.m_lengthText > 0 && clipboardData.m_lengthText < settings.m_nLimitText) {			
-			// now we have to translate to UTF-16
-			int nConvertedSize = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)clipboardData.m_pDataText, clipboardData.m_lengthText, NULL, 0);
-
-			if (nConvertedSize > 0) {
-				wchar_t* clipStr = new wchar_t[nConvertedSize];
-				int nFinalConvertedSize = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)clipboardData.m_pDataText, clipboardData.m_lengthText, (LPWSTR)clipStr, nConvertedSize);
-
-				if (nFinalConvertedSize > 0) {
-					std::wstring wstrClipboard(clipStr);
-					m_strLastCutText.assign(wstrClipboard.begin(), wstrClipboard.end());
-				}
-
-				delete[] clipStr;
-			}
-		}
-
-		m_crc = clipboardData.m_crc;
-
-		if ( (!(settings.m_remoteCaps & clipNotify)) || (overrideFlags != 0) ) {
-			m_bNeedToNotify = false;
-			extendedClipboardDataNotifyMessage.Reset();
-		}
-	}
-
-	return m_bNeedToProvide || m_bNeedToNotify;
-}
diff --git a/ica/win32/common/Clipboard.h b/ica/win32/common/Clipboard.h
deleted file mode 100644
index f7f930b..0000000
--- a/ica/win32/common/Clipboard.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-//
-////////////////////////////////////////////////////////////////////////////
-
-
-// Clipboard.h
-
-// adzm - July 2010
-//
-// Common classes for dealing with the clipboard, including serializing and deserializing compressed data, hashing and comparing, etc.
-// Used by server and viewer.
-
-#pragma once
-
-#define VC_EXTRALEAN
-#include <windows.h>
-#include <string>
-#include <rdr/MemOutStream.h>
-#include "rfb.h"
-
-struct ExtendedClipboardDataMessage {
-	ExtendedClipboardDataMessage();
-	~ExtendedClipboardDataMessage();
-
-	void Reset();
-	void AddFlag(CARD32 flag);
-	bool HasFlag(CARD32 flag);
-
-	int GetMessageLength();	// does not include rfbExtendedClipboardData
-	int GetDataLength();	// does include rfbExtendedClipboardData
-	const BYTE* GetData();
-
-	BYTE* GetBuffer();		// writable buffer
-	int GetBufferLength();	// does include rfbExtendedClipboardData
-
-	const BYTE* GetCurrentPos();
-
-	rfbExtendedClipboardData* m_pExtendedData;
-
-	void AppendInt(CARD32 val); // swaps if LE
-	void AppendBytes(BYTE* pData, int length);
-	void Advance(int len);
-	CARD32 ReadInt();
-
-	void EnsureBufferLength(int len, bool bGrowBeyond = true);
-
-	int CountFormats();
-	CARD32 GetFlags();
-
-protected:
-
-	int m_nInternalLength;
-	BYTE* m_pCurrentPos;
-	BYTE* m_pData;
-};
-
-struct ClipboardSettings {
-	ClipboardSettings(CARD32 caps);
-
-	static CARD32 defaultCaps;
-	static CARD32 defaultViewerCaps;
-	static CARD32 defaultServerCaps;
-
-	static const UINT formatDIB;
-	static const UINT formatHTML;
-	static const UINT formatRTF;
-	static const UINT formatUnicodeText;
-
-	static const int defaultLimitText;
-	static const int defaultLimitRTF;
-	static const int defaultLimitHTML;
-	static const int defaultLimitDIB;
-
-	static const int defaultLimit;
-
-	///////
-
-	bool m_bSupportsEx;
-
-	int m_nLimitText;
-	int m_nLimitRTF;
-	int m_nLimitHTML;
-	int m_nLimitDIB;
-
-	int m_nRequestedLimitText;
-	int m_nRequestedLimitRTF;
-	int m_nRequestedLimitHTML;
-	int m_nRequestedLimitDIB;
-
-	CARD32 m_myCaps;
-
-	CARD32 m_remoteCaps; // messages and formats that will be handled by the remote application
-
-	void PrepareCapsPacket(ExtendedClipboardDataMessage& extendedDataMessage);
-
-	void HandleCapsPacket(ExtendedClipboardDataMessage& extendedDataMessage, bool bSetLimits);
-};
-
-struct ClipboardHolder {
-	ClipboardHolder(HWND hwndOwner);
-
-	~ClipboardHolder();
-
-	bool m_bIsOpen;
-};
-
-struct ClipboardData {
-	ClipboardData();
-
-	~ClipboardData();
-
-	DWORD m_crc;
-
-	int m_lengthText;
-	int m_lengthRTF;
-	int m_lengthHTML;
-	int m_lengthDIB;
-
-	BYTE* m_pDataText;
-	BYTE* m_pDataRTF;
-	BYTE* m_pDataHTML;
-	BYTE* m_pDataDIB;
-
-	void FreeData();
-
-	bool Load(HWND hwndOwner); // will return false on failure
-
-	bool Restore(HWND hwndOwner, ExtendedClipboardDataMessage& extendedClipboardDataMessage);
-};
-
-struct Clipboard {
-	Clipboard(CARD32 caps);
-
-	bool UpdateClipTextEx(ClipboardData& clipboardData, CARD32 overrideFlags = 0); // returns true if something changed
-
-	ClipboardSettings settings;
-	DWORD m_crc;
-	std::string m_strLastCutText; // for non-extended clipboards
-
-	bool m_bNeedToProvide;
-	bool m_bNeedToNotify;
-
-	CARD32 m_notifiedRemoteFormats;
-
-	ExtendedClipboardDataMessage extendedClipboardDataMessage;
-	ExtendedClipboardDataMessage extendedClipboardDataNotifyMessage;
-};
-
diff --git a/ica/win32/common/ScopeGuard.h b/ica/win32/common/ScopeGuard.h
deleted file mode 100644
index da7a2e2..0000000
--- a/ica/win32/common/ScopeGuard.h
+++ /dev/null
@@ -1,320 +0,0 @@
-#ifndef SCOPEGUARD_H_
-#define SCOPEGUARD_H_
-
-/*
-  Scopeguard, by Andrei Alexandrescu and Petru Marginean, December 2000.
-  Modified by Joshua Lehrer, FactSet Research Systems, November 2005.
-*/
-
-template <class T>
-class RefHolder
-{
-	T& ref_;
-public:
-	RefHolder(T& ref) : ref_(ref) {}
-	operator T& () const 
-	{
-		return ref_;
-	}
-private:
-    // Disable assignment - not implemented
-    RefHolder& operator=(const RefHolder&);
-};
-
-template <class T>
-inline RefHolder<T> ByRef(T& t)
-{
-	return RefHolder<T>(t);
-}
-
-class ScopeGuardImplBase
-{
-	ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
-protected:
-	~ScopeGuardImplBase()
-	{
-	}
-	ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() 
-		: dismissed_(other.dismissed_)
-	{
-		other.Dismiss();
-	}
-	template <typename J>
-	static void SafeExecute(J& j) throw() 
-	{
-		if (!j.dismissed_)
-			try
-			{
-				j.Execute();
-			}
-			catch(...)
-			{
-			}
-	}
-	
-	mutable bool dismissed_;
-public:
-	ScopeGuardImplBase() throw() : dismissed_(false) 
-	{
-	}
-	void Dismiss() const throw() 
-	{
-		dismissed_ = true;
-	}
-};
-
-typedef const ScopeGuardImplBase& ScopeGuard;
-
-template <typename F>
-class ScopeGuardImpl0 : public ScopeGuardImplBase
-{
-public:
-	static ScopeGuardImpl0<F> MakeGuard(F fun)
-	{
-		return ScopeGuardImpl0<F>(fun);
-	}
-	~ScopeGuardImpl0() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute() 
-	{
-		fun_();
-	}
-protected:
-	ScopeGuardImpl0(F fun) : fun_(fun) 
-	{
-	}
-	F fun_;
-};
-
-template <typename F> 
-inline ScopeGuardImpl0<F> MakeGuard(F fun)
-{
-	return ScopeGuardImpl0<F>::MakeGuard(fun);
-}
-
-template <typename F, typename P1>
-class ScopeGuardImpl1 : public ScopeGuardImplBase
-{
-public:
-	static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
-	{
-		return ScopeGuardImpl1<F, P1>(fun, p1);
-	}
-	~ScopeGuardImpl1() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute()
-	{
-		fun_(p1_);
-	}
-protected:
-	ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) 
-	{
-	}
-	F fun_;
-	const P1 p1_;
-};
-
-template <typename F, typename P1> 
-inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
-{
-	return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
-}
-
-template <typename F, typename P1, typename P2>
-class ScopeGuardImpl2: public ScopeGuardImplBase
-{
-public:
-	static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
-	{
-		return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
-	}
-	~ScopeGuardImpl2() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute()
-	{
-		fun_(p1_, p2_);
-	}
-protected:
-	ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) 
-	{
-	}
-	F fun_;
-	const P1 p1_;
-	const P2 p2_;
-};
-
-template <typename F, typename P1, typename P2>
-inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
-{
-	return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
-}
-
-template <typename F, typename P1, typename P2, typename P3>
-class ScopeGuardImpl3 : public ScopeGuardImplBase
-{
-public:
-	static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
-	{
-		return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
-	}
-	~ScopeGuardImpl3() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute()
-	{
-		fun_(p1_, p2_, p3_);
-	}
-protected:
-	ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) 
-	{
-	}
-	F fun_;
-	const P1 p1_;
-	const P2 p2_;
-	const P3 p3_;
-};
-
-template <typename F, typename P1, typename P2, typename P3>
-inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
-{
-	return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
-}
-
-//************************************************************
-
-template <class Obj, typename MemFun>
-class ObjScopeGuardImpl0 : public ScopeGuardImplBase
-{
-public:
-	static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
-	{
-		return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
-	}
-	~ObjScopeGuardImpl0() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute() 
-	{
-		(obj_.*memFun_)();
-	}
-protected:
-	ObjScopeGuardImpl0(Obj& obj, MemFun memFun) 
-		: obj_(obj), memFun_(memFun) {}
-	Obj& obj_;
-	MemFun memFun_;
-};
-
-template <class Obj, typename MemFun>
-inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
-{
-	return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
-}
-
-template <typename Ret, class Obj1, class Obj2>
-inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj) {
-  return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
-}
-
-template <typename Ret, class Obj1, class Obj2>
-inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj) {
-  return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
-}
-
-template <class Obj, typename MemFun, typename P1>
-class ObjScopeGuardImpl1 : public ScopeGuardImplBase
-{
-public:
-	static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
-	{
-		return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
-	}
-	~ObjScopeGuardImpl1() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute() 
-	{
-		(obj_.*memFun_)(p1_);
-	}
-protected:
-	ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) 
-		: obj_(obj), memFun_(memFun), p1_(p1) {}
-	Obj& obj_;
-	MemFun memFun_;
-	const P1 p1_;
-};
-
-template <class Obj, typename MemFun, typename P1>
-inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
-{
-	return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
-}
-
-template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
-inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) {
-  return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
-}
-
-template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
-inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) {
-  return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
-}
-
-template <class Obj, typename MemFun, typename P1, typename P2>
-class ObjScopeGuardImpl2 : public ScopeGuardImplBase
-{
-public:
-	static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
-	{
-		return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
-	}
-	~ObjScopeGuardImpl2() throw() 
-	{
-		SafeExecute(*this);
-	}
-	void Execute() 
-	{
-		(obj_.*memFun_)(p1_, p2_);
-	}
-protected:
-	ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) 
-		: obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) {}
-	Obj& obj_;
-	MemFun memFun_;
-	const P1 p1_;
-	const P2 p2_;
-};
-
-template <class Obj, typename MemFun, typename P1, typename P2>
-inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
-{
-	return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
-}
-
-template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
-inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2) {
-  return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
-}
-
-template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
-inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2) {
-  return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
-}
-
-
-#define CONCATENATE_DIRECT(s1, s2) s1##s2
-#define CONCATENATE(s1, s2) CONCATENATE_DIRECT(s1, s2)
-#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __LINE__)
-
-#define ON_BLOCK_EXIT ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = MakeGuard
-#define ON_BLOCK_EXIT_OBJ ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = MakeObjGuard
-
-#endif //SCOPEGUARD_H_
diff --git a/ica/win32/common/win32_helpers.cpp b/ica/win32/common/win32_helpers.cpp
deleted file mode 100644
index 5e1d041..0000000
--- a/ica/win32/common/win32_helpers.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h>
-#include "win32_helpers.h"
-
-namespace helper {
-
-void SafeSetMsgResult(HWND hwnd, LPARAM result)
-{
-#ifndef _X64
-	SetWindowLong(hwnd, DWL_MSGRESULT, result);
-#else
-	SetWindowLongPtr(hwnd, DWLP_MSGRESULT, result);
-#endif
-}
-
-void SafeSetWindowUserData(HWND hwnd, LPARAM lParam)
-{
-#ifndef _X64
-	SetWindowLong(hwnd, GWL_USERDATA, lParam);
-#else
-	SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
-#endif
-}
-
-HINSTANCE SafeGetWindowInstance(HWND hWnd)
-{
-#ifndef _X64
-    HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE);
-#else
-    HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd,GWLP_HINSTANCE);
-#endif
-    return hInstance;
-}
-
-LONG SafeGetWindowProc(HWND hWnd)
-{
-#ifndef _X64
-    LONG pWndProc = GetWindowLong(hWnd, GWL_WNDPROC);
-#else
-    LONG pWndProc = GetWindowLongPtr(hWnd, GWLP_WNDPROC);
-#endif
-    return pWndProc;
-}
-
-void SafeSetWindowProc(HWND hWnd, LONG pWndProc)
-{
-#ifndef _X64
-    SetWindowLong(hWnd, GWL_WNDPROC, pWndProc);
-#else
-    SetWindowLongPtr(hWnd, GWLP_WNDPROC, pWndProc);
-#endif
-}
-
-void close_handle(HANDLE& h)
-{
-    if (h != INVALID_HANDLE_VALUE) 
-    {
-        ::CloseHandle(h);
-        h = INVALID_HANDLE_VALUE;
-    }
-}
-
-DynamicFnBase::DynamicFnBase(const TCHAR* dllName, const char* fnName) : fnPtr(0), dllHandle(0) {
-  dllHandle = LoadLibrary(dllName);
-  if (!dllHandle) {
-    return;
-  }
-  fnPtr = (void *) GetProcAddress(dllHandle, fnName);
-}
-
-DynamicFnBase::~DynamicFnBase() {
-  if (dllHandle)
-    FreeLibrary(dllHandle);
-}
-
-} // namespace helper
diff --git a/ica/win32/common/win32_helpers.h b/ica/win32/common/win32_helpers.h
deleted file mode 100644
index b3c91da..0000000
--- a/ica/win32/common/win32_helpers.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#if !defined(UVNC_COMMON_H)
-#define UVNC_COMMON_H
-
-namespace helper {
-
-template<typename T> inline T *SafeGetWindowUserData(HWND hwnd)
-{
-    T *pUserData;
-#ifndef _X64
-	pUserData = (T *) GetWindowLong(hwnd, GWL_USERDATA);
-#else
-	pUserData = (T *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#endif
-
-    return pUserData;
-}
-
-void SafeSetWindowUserData(HWND hwnd, LPARAM lParam);
-
-// DWL_MSGRESULT
-void SafeSetMsgResult(HWND hwnd, LPARAM result);
-// GWL_HINSTANCE
-HINSTANCE SafeGetWindowInstance(HWND hWnd);
-// GWL_WNDPROC
-LONG SafeGetWindowProc(HWND hWnd);
-void SafeSetWindowProc(HWND hWnd, LONG pWndProc);
-
-void close_handle(HANDLE& h);
-
-    class DynamicFnBase {
-    public:
-      DynamicFnBase(const TCHAR* dllName, const char* fnName);
-      ~DynamicFnBase();
-      bool isValid() const {return fnPtr != 0;}
-    protected:
-      void* fnPtr;
-      HMODULE dllHandle;
-    };
-
-    template<typename T> class DynamicFn : public DynamicFnBase {
-    public:
-      DynamicFn(const TCHAR* dllName, const char* fnName) : DynamicFnBase(dllName, fnName) {}
-      T operator *() const {return (T)fnPtr;};
-    };
-
-}
-
-#endif
diff --git a/ica/win32/rdr/Exception.h b/ica/win32/rdr/Exception.h
deleted file mode 100644
index 9413236..0000000
--- a/ica/win32/rdr/Exception.h
+++ /dev/null
@@ -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
diff --git a/ica/win32/rdr/FdInStream.cxx b/ica/win32/rdr/FdInStream.cxx
deleted file mode 100644
index 5e3285c..0000000
--- a/ica/win32/rdr/FdInStream.cxx
+++ /dev/null
@@ -1,387 +0,0 @@
-// Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-// 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
-// adzm 2010-08 - use winsock2
-#include <winsock2.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 "FdInStream.h"
-#include "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];
-
-	// sf at 2002
-	m_fDSMMode = false;
-	m_fReadFromNetRectBuf = false;
-	m_nNetRectBufOffset = 0;
-	m_nReadSize = 0;
-
-	m_nBytesRead = 0; // For stats
-}
-
-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];
-	
-	// sf at 2002
-	m_fDSMMode = false;
-	m_fReadFromNetRectBuf = false;
-	m_nNetRectBufOffset = 0;
-	m_nReadSize = 0;
-	
-}
-
-FdInStream::~FdInStream()
-{
-  delete [] start;
-}
-
-void
-FdInStream::Update_socket()
-{
-  // test, not used
-  //fd=INVALID_SOCKET;
-}
-
-
-int FdInStream::pos()
-{
-  return offset + ptr - start;
-}
-
-void FdInStream::readBytes(void* data, int length)
-{
-	// sf at 2003 - Seems to fix the ZRLE+DSM bug... 
-	if (!m_fDSMMode)
-	{
-		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::Check_if_buffer_has_data()
-{
- InStream::setptr(InStream::getend());
- return checkReadable(fd, 500);
-}
-
-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;
-  counts.QuadPart=0;
-  if (QueryPerformanceCounter(&counts)) {
-    if (usecPerCount == 0.0) {
-      QueryPerformanceFrequency(&countsPerSec);
-	  if (countsPerSec.QuadPart!=0)
-      usecPerCount = 1000000.0 / countsPerSec.QuadPart;
-	  else usecPerCount = 200;
-    }
-
-    LONGLONG usecs = (LONGLONG)(counts.QuadPart * usecPerCount);
-	
-    tv->tv_usec = (long)((LONGLONG)usecs % (LONGLONG)1000000);
-    tv->tv_sec = (long)(usecs / 1000000);
-
-  } else {
-    struct timeb tb;
-    ftime(&tb);
-    tv->tv_sec = (long)tb.time;
-    tv->tv_usec = tb.millitm * 1000;
-  }
-}
-#endif*/
-
-#ifdef _WIN32
-LONGLONG 
-Passedusecs()
-{
-  LARGE_INTEGER counts, countsPerSec;
-  static LONGLONG usecPerCount = 0;
-  LONGLONG usecs=0;
-
-  if (QueryPerformanceCounter(&counts)) {
-    if (usecPerCount == 0) {
-      QueryPerformanceFrequency(&countsPerSec);
-      usecPerCount = 1000000000000000000 / countsPerSec.QuadPart;
-    }
-    usecs = (LONGLONG)(counts.QuadPart * usecPerCount /1000000000000);
-
-  } else {
-    struct timeb tb;
-    ftime(&tb);
-	usecs=tb.time*1000000+tb.millitm * 1000;
-  }
-  return usecs;
-}
-#endif
-
-int FdInStream::readWithTimeoutOrCallback(void* buf, int len)
-{
-  /*struct timeval before = {0, 0}, after; // before will not get initialized if the condition is false
-  if (timing)
-    gettimeofday_(&before, NULL);*/
-  LONGLONG before =0, after; // before will not get initialized if the condition is false
-  if (timing)
-    before=Passedusecs();
-
-  if (fd==INVALID_SOCKET) 
-	  throw SystemException("read",errno);
-
-  int n=0;
-  if (!m_fReadFromNetRectBuf)
-  {
-	  n = checkReadable(fd, timeout);
-	  
-	  if (n < 0) throw SystemException("select",errno);
-	  
-	  if (n == 0)
-	  {
-		  if (timeout) throw TimedOut();
-		  if (blockCallback) (*blockCallback)(blockCallbackArg);
-	  }
-  }
-	if (fd==INVALID_SOCKET) 
-		throw SystemException("read",errno);
-  bool fAlreadyCounted = false; // sf at 2004 - Avoid to count the plugin processed bytes twice...
-
-  while (true)
-  {
-	  if (fd==INVALID_SOCKET) 
-		throw SystemException("read",errno);
-	// sf at 2002 - DSM Plugin hack - Only necessary for ZRLE encoding
-	// If we must read already restored data from DSMPLugin memory  
-	if (m_fReadFromNetRectBuf)
-	{
-		int nRem = m_nReadSize - m_nNetRectBufOffset;
-		int nRead = (len <= nRem) ? len : nRem;
-		memcpy(buf, m_pNetRectBuf + m_nNetRectBufOffset, nRead);
-		m_nNetRectBufOffset += nRead;
-		if (m_nNetRectBufOffset == m_nReadSize)
-		{
-			// Next read calls should read the socket
-			m_fReadFromNetRectBuf = false;
-			m_nNetRectBufOffset = 0;
-			m_nReadSize = 0;
-		}
-		n = nRead;
-		fAlreadyCounted = true;
-	}
-	else
-	{
-		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("read");
-
-  if (fAlreadyCounted)
-	  return n; 
-
-  // sf at 2002 - stats
-  m_nBytesRead += n;
-
-  if (timing)
-  {
-    after=Passedusecs();
-
-    LONGLONG newTimeWaited = (after- before)/100;
-    int newKbits = n * 8 / 1000;
-    if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;
-    if (newTimeWaited < newKbits/4)    newTimeWaited = newKbits/4;
-
-    timeWaitedIn100us += (unsigned int)newTimeWaited;
-    timedKbits += newKbits;
-  }
-
-
-  /*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;
-}
-
-
-//
-// sf at 2002 - DSMPlugin - This hack is necessary because
-// the ZRLE encoder/decoder does not use the SendExact/ReadExact functions
-// like ALL the others encoders...
-// 
-void FdInStream::SetReadFromMemoryBuffer(int nReadSize, char* pMemBuffer)
-{
-	m_nReadSize = nReadSize; // Nb of bytes to read from buffer instead of socket
-	m_pNetRectBuf = pMemBuffer; // The memory buffer containing restored data
-	m_nNetRectBufOffset = 0;   // Initial offset
-
-	m_fReadFromNetRectBuf = true; // Order to read from the buffer
-}
-
-
-
diff --git a/ica/win32/rdr/FdInStream.h b/ica/win32/rdr/FdInStream.h
deleted file mode 100644
index 4631904..0000000
--- a/ica/win32/rdr/FdInStream.h
+++ /dev/null
@@ -1,89 +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__
-
-#pragma once
-
-#include "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 Update_socket();
-    void startTiming();
-    void stopTiming();
-    unsigned int kbitsPerSecond();
-    unsigned int timeWaited() { return timeWaitedIn100us; }
-
-	void SetDSMMode(bool fDSMMode){m_fDSMMode = fDSMMode;}; // sf at 2002 
-	void SetReadFromMemoryBuffer(int nReadSize, char* pMemBuffer); // sf at 2002 
-	bool GetReadFromMemoryBuffer(void) {return m_fReadFromNetRectBuf;}; // sf at 2002 
-	__int64 GetBytesRead() {return m_nBytesRead;};
-	int Check_if_buffer_has_data();
-
-  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;
-
-	// sf at 2002 - DSMPlugin hack
-	bool m_fDSMMode;
-	char* m_pNetRectBuf;
-	bool m_fReadFromNetRectBuf; 
-	int m_nNetRectBufOffset;
-	int m_nReadSize;
-	__int64 m_nBytesRead;
-  };
-
-} // end of namespace rdr
-
-#endif
diff --git a/ica/win32/rdr/FdOutStream.cxx b/ica/win32/rdr/FdOutStream.cxx
deleted file mode 100644
index f93e8d7..0000000
--- a/ica/win32/rdr/FdOutStream.cxx
+++ /dev/null
@@ -1,114 +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
-// adzm 2010-08 - use winsock2
-#include <winsock2.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 "FdOutStream.h"
-#include "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;
-}
diff --git a/ica/win32/rdr/FdOutStream.h b/ica/win32/rdr/FdOutStream.h
deleted file mode 100644
index 108aba5..0000000
--- a/ica/win32/rdr/FdOutStream.h
+++ /dev/null
@@ -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 "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
diff --git a/ica/win32/rdr/FixedMemOutStream.h b/ica/win32/rdr/FixedMemOutStream.h
deleted file mode 100644
index 2d3c263..0000000
--- a/ica/win32/rdr/FixedMemOutStream.h
+++ /dev/null
@@ -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 "OutStream.h
-#include "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("overrun"); }
-    U8* start;
-  };
-
-}
-
-#endif
diff --git a/ica/win32/rdr/InStream.cxx b/ica/win32/rdr/InStream.cxx
deleted file mode 100644
index 879b379..0000000
--- a/ica/win32/rdr/InStream.cxx
+++ /dev/null
@@ -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 "InStream.h"
-#include "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;
-}
diff --git a/ica/win32/rdr/InStream.h b/ica/win32/rdr/InStream.h
deleted file mode 100644
index d3e0fde..0000000
--- a/ica/win32/rdr/InStream.h
+++ /dev/null
@@ -1,145 +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__
-
-#pragma once 
-
-#include "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
diff --git a/ica/win32/rdr/Makefile.bcc32 b/ica/win32/rdr/Makefile.bcc32
deleted file mode 100644
index 3606dae..0000000
--- a/ica/win32/rdr/Makefile.bcc32
+++ /dev/null
@@ -1,33 +0,0 @@
-# ------------- Borland C++ 5.5 (Win32) -------------
-
-CC=bcc32
-LIB=tlib
-
-CFLAGS= -v- -O2 -3 -tWM -q -P -xd- -w-8004 -w-8057
-LIBFLAGS= /C
-
-OBJS=FdInStream.obj FdOutStream.obj InStream.obj NullOutStream.obj \
-       ZlibInStream.obj ZlibOutStream.obj
-
-pOBJS=+FdInStream.obj+FdOutStream.obj+InStream.obj+NullOutStream.obj \
-       +ZlibInStream.obj+ZlibOutStream.obj
-
-LIBS=..\zlib\zlib.lib
-
-.autodepend
-.cxx.obj:
-	$(CC) -c $(CFLAGS) $<
-
-rdr.lib: $(OBJS) $(LIBS)
-	 @if exist $@ del $@
-	 $(LIB) $@ $(LIBFLAGS) $(pOBJS)
-
-..\zlib\zlib.lib:
-	cd ..
-	cd zlib
-	make -fMakefile.bcc32 -l -s
-	cd ..
-
-clean:
-	del *.obj *.lib
-
diff --git a/ica/win32/rdr/Makefile.in b/ica/win32/rdr/Makefile.in
deleted file mode 100644
index 6b4c2ef..0000000
--- a/ica/win32/rdr/Makefile.in
+++ /dev/null
@@ -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
diff --git a/ica/win32/rdr/MemInStream.h b/ica/win32/rdr/MemInStream.h
deleted file mode 100644
index 03d5817..0000000
--- a/ica/win32/rdr/MemInStream.h
+++ /dev/null
@@ -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 "InStream.h"
-#include "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("overrun"); }
-    const U8* start;
-  };
-
-}
-
-#endif
diff --git a/ica/win32/rdr/MemOutStream.h b/ica/win32/rdr/MemOutStream.h
deleted file mode 100644
index 3cb8a49..0000000
--- a/ica/win32/rdr/MemOutStream.h
+++ /dev/null
@@ -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 "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
diff --git a/ica/win32/rdr/NullOutStream.cxx b/ica/win32/rdr/NullOutStream.cxx
deleted file mode 100644
index afb9c7b..0000000
--- a/ica/win32/rdr/NullOutStream.cxx
+++ /dev/null
@@ -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 "NullOutStream.h"
-#include "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;
-}
diff --git a/ica/win32/rdr/NullOutStream.h b/ica/win32/rdr/NullOutStream.h
deleted file mode 100644
index 810c89b..0000000
--- a/ica/win32/rdr/NullOutStream.h
+++ /dev/null
@@ -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 "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
diff --git a/ica/win32/rdr/OutStream.h b/ica/win32/rdr/OutStream.h
deleted file mode 100644
index 4b3f4d1..0000000
--- a/ica/win32/rdr/OutStream.h
+++ /dev/null
@@ -1,154 +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__
-
-#pragma once 
-
-#include "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
diff --git a/ica/win32/rdr/ZlibInStream.cxx b/ica/win32/rdr/ZlibInStream.cxx
deleted file mode 100644
index be4eab4..0000000
--- a/ica/win32/rdr/ZlibInStream.cxx
+++ /dev/null
@@ -1,125 +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 "ZlibInStream.h"
-#include "Exception.h"
-#ifdef IPP
-#include "../ipp_zlib/src/zlib/zlib.h"
-#else
-#include "../zlib/zlib.h"
-#endif
-
-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);
-}
diff --git a/ica/win32/rdr/ZlibInStream.h b/ica/win32/rdr/ZlibInStream.h
deleted file mode 100644
index 121ba78..0000000
--- a/ica/win32/rdr/ZlibInStream.h
+++ /dev/null
@@ -1,61 +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__
-
-#pragma once
-
-#include "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
diff --git a/ica/win32/rdr/ZlibOutStream.cxx b/ica/win32/rdr/ZlibOutStream.cxx
deleted file mode 100644
index 41c3ef0..0000000
--- a/ica/win32/rdr/ZlibOutStream.cxx
+++ /dev/null
@@ -1,145 +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 "ZlibOutStream.h"
-#include "Exception.h"
-#ifdef IPP
-#include "../ipp_zlib/src/zlib/zlib.h"
-#else
-#include "../zlib/zlib.h"
-#endif
-
-using namespace rdr;
-
-enum { DEFAULT_BUF_SIZE = 16384 };
-
-// adzm - 2010-07 - Custom compression level
-ZlibOutStream::ZlibOutStream(OutStream* os, int bufSize_, int compressionLevel)
-  : 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, compressionLevel) != 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;
-}
diff --git a/ica/win32/rdr/ZlibOutStream.h b/ica/win32/rdr/ZlibOutStream.h
deleted file mode 100644
index 175baca..0000000
--- a/ica/win32/rdr/ZlibOutStream.h
+++ /dev/null
@@ -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.
-
-
-//
-// ZlibOutStream streams to a compressed data stream (underlying), compressing
-// with zlib on the fly.
-//
-
-#ifndef __RDR_ZLIBOUTSTREAM_H__
-#define __RDR_ZLIBOUTSTREAM_H__
-
-#include "OutStream.h"
-
-struct z_stream_s;
-
-namespace rdr {
-
-  class ZlibOutStream : public OutStream {
-
-  public:
-
-    // adzm - 2010-07 - Custom compression level
-    ZlibOutStream(OutStream* os=0, int bufSize=0, int compressionLevel=-1); // Z_DEFAULT_COMPRESSION
-    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
diff --git a/ica/win32/rdr/types.h b/ica/win32/rdr/types.h
deleted file mode 100644
index fe4b121..0000000
--- a/ica/win32/rdr/types.h
+++ /dev/null
@@ -1,36 +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__
-
-#pragma once
-
-
-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
diff --git a/ica/win32/ultravnc-italc.cpp b/ica/win32/ultravnc-italc.cpp
deleted file mode 100644
index 5da1bf5..0000000
--- a/ica/win32/ultravnc-italc.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-#include <windows.h>
-
-#include <QtCore/QSettings>
-
-#include "DesktopAccessPermission.h"
-#include "ItalcCore.h"
-#include "ItalcCoreServer.h"
-#include "ItalcConfiguration.h"
-#include "Configuration/LocalStore.h"
-
-static QSettings *__italcSettings = NULL;
-
-
-BOOL ultravnc_italc_load_int( LPCSTR valname, LONG *out )
-{
-	if( strcmp( valname, "LocalConnectOnly" ) == 0 )
-	{
-		if( __italcSettings == NULL )
-		{
-			__italcSettings = Configuration::LocalStore( Configuration::Store::System ).createSettingsObject();
-			__italcSettings->beginGroup( "Network" );
-		}
-
-		*out = __italcSettings->value( valname ).toInt();
-		return true;
-	}
-	if( strcmp( valname, "DisableTrayIcon" ) == 0 )
-	{
-		*out = 1;
-		return true;
-	}
-	if( strcmp( valname, "AuthRequired" ) == 0 )
-	{
-		*out = 1;
-		return true;
-	}
-	if( strcmp( valname, "CaptureAlphaBlending" ) == 0 )
-	{
-		*out = ItalcCore::config->vncCaptureLayeredWindows() ? 1 : 0;
-		return true;
-	}
-	if( strcmp( valname, "PollFullScreen" ) == 0 )
-	{
-		*out = ItalcCore::config->vncPollFullScreen() ? 1 : 0;
-		return true;
-	}
-	if( strcmp( valname, "TurboMode" ) == 0 )
-	{
-		*out = ItalcCore::config->vncLowAccuracy() ? 1 : 0;
-		return true;
-	}
-	if( strcmp( valname, "NewMSLogon" ) == 0 )
-	{
-		*out = 1;
-		return true;
-	}
-	if( strcmp( valname, "MSLogonRequired" ) == 0 )
-	{
-		*out = ItalcCore::config->isLogonAuthenticationEnabled() ? 1 : 0;
-		return true;
-	}
-	if( strcmp( valname, "RemoveWallpaper" ) == 0 )
-	{
-		*out = 0;
-		return true;
-	}
-	if( strcmp( valname, "FileTransferEnabled" ) == 0 )
-	{
-		*out = 0;
-		return true;
-	}
-	if( strcmp( valname, "AllowLoopback" ) == 0 )
-	{
-		*out = 1;
-		return true;
-	}
-	if( strcmp( valname, "AutoPortSelect" ) == 0 )
-	{
-		*out = 0;
-		return true;
-	}
-
-	if( strcmp( valname, "HTTPConnect" ) == 0 )
-	{
-		*out = ItalcCore::config->isHttpServerEnabled() ? 1 : 0;
-		return true;
-	}
-
-	if( strcmp( valname, "PortNumber" ) == 0 )
-	{
-		*out = ItalcCore::config->coreServerPort();
-		return true;
-	}
-
-	if( strcmp( valname, "HTTPPortNumber" ) == 0 )
-	{
-		*out = ItalcCore::config->httpServerPort();
-		return true;
-	}
-
-	return false;
-}
-
-
-BOOL ultravnc_italc_ask_permission( const char *username, const char *host )
-{
-	return DesktopAccessPermission(
-				DesktopAccessPermission::LogonAuthentication ).
-														ask( username, host );
-}
-
-
-
-/*
- * MSVCRT string functions
- *
- * Copyright 1996,1998 Marcus Meissner
- * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
- * Copyright 2000 Jon Griffiths
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-
-#define CHECK_PMT(x) (x)
-#define SIZE_T_MAX	((size_t)-1)
-
-
-errno_t strcat_s( char* dst, size_t elem, const char* src )
-{
-    size_t i, j;
-    if(!dst) return EINVAL;
-    if(elem == 0) return EINVAL;
-    if(!src)
-    {
-        dst[0] = '\0';
-        return EINVAL;
-    }
-
-    for(i = 0; i < elem; i++)
-    {
-        if(dst[i] == '\0')
-        {
-            for(j = 0; (j + i) < elem; j++)
-            {
-                if((dst[j + i] = src[j]) == '\0') return 0;
-            }
-        }
-    }
-    /* Set the first element to 0, not the first element after the skipped part */
-    dst[0] = '\0';
-    return ERANGE;
-}
-
-errno_t strncat_s( char* dst, size_t elem, const char* src, size_t count )
-{
-    size_t i, j;
-    if(!CHECK_PMT(dst != 0) || !CHECK_PMT(elem != 0))
-        return EINVAL;
-    if(!CHECK_PMT(src != 0))
-    {
-        dst[0] = '\0';
-        return EINVAL;
-    }
-
-    for(i = 0; i < elem; i++)
-    {
-        if(dst[i] == '\0')
-        {
-            for(j = 0; (j + i) < elem; j++)
-            {
-                if(count == SIZE_T_MAX && j + i == elem - 1)
-                {
-                    dst[j + i] = '\0';
-                    return STRUNCATE;
-                }
-                if(j == count || (dst[j + i] = src[j]) == '\0')
-                {
-                    dst[j + i] = '\0';
-                    return 0;
-                }
-            }
-        }
-    }
-    /* Set the first element to 0, not the first element after the skipped part */
-    dst[0] = '\0';
-    return ERANGE;
-}
-
-
-errno_t strcpy_s(char* dst, size_t elem, const char* src)
-{
-    size_t i;
-    if(!elem) return EINVAL;
-    if(!dst) return EINVAL;
-    if(!src)
-    {
-        dst[0] = '\0';
-        return EINVAL;
-    }
-
-    for(i = 0; i < elem; i++)
-    {
-        if((dst[i] = src[i]) == '\0') return 0;
-    }
-    dst[0] = '\0';
-    return ERANGE;
-}
-
-
-
-/*
- * msvcrt.dll heap functions
- *
- * Copyright 2000 Jon Griffiths
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- *
- * Note: Win32 heap operations are MT safe. We only lock the new
- *       handler and non atomic heap operations
- */
-
-
-errno_t strncpy_s(char* dst, size_t numberOfElements, const char* src, size_t count)
-{
-    size_t i, end;
-
-    if(!count)
-        return 0;
-
-    if (!CHECK_PMT(dst != NULL) || !CHECK_PMT(src != NULL) || !CHECK_PMT(numberOfElements != 0)) {
-        *_errno() = EINVAL;
-        return EINVAL;
-    }
-
-    if(count!=SIZE_T_MAX && count<numberOfElements)
-        end = count;
-    else
-        end = numberOfElements-1;
-
-    for(i=0; i<end && src[i]; i++)
-        dst[i] = src[i];
-
-    if(!src[i] || end==count || count==SIZE_T_MAX) {
-        dst[i] = '\0';
-        return 0;
-    }
-
-    dst[0] = '\0';
-    *_errno() = EINVAL;
-    return EINVAL;
-}
diff --git a/ica/win32/ultravnc.cpp b/ica/win32/ultravnc.cpp
deleted file mode 100644
index d9d55a1..0000000
--- a/ica/win32/ultravnc.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-#include <algorithm>
-
-#include "stdhdrs.h"
-#include "ItalcRfbExt.h"
-#include "ItalcCoreServer.h"
-#include "vsocket.cpp"
-
-// adzm 2010-09
-typedef enum {
-	clientInitShared       = 0x01,
-} rfbClientInitMsgFlags;
-
-/*-----------------------------------------------------------------------------
- * 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:
- */
-
-// adzm 2010-09
-/*
- pre-RFB 3.8 -- rfbUltraVNC_SecureVNCPlugin extension
-
- If using SecureVNCPlugin (or any plugin that uses the integrated plugin architecture) the unofficial 1.0.8.2 version sends
- the auth type rfbUltraVNC_SecureVNCPlugin.
-
- The intention of this auth type is to act as a 'master' and once complete, allow other authentication types to occur
- over the now-encrypted communication channel.
-
- So, server sends 32-bit network order int for rfbUltraVNC_SecureVNCPlugin and the loop begins:
-   server sends 16-bit little-endian challenge length, followed by the challenge
-   viewer responds with 16-bit little-endian response length, followed by the response
-   this continues until the plugin says to stop the loop. Currently the SecureVNC plugin only
-     does one loop, but this functionality exists in order to implement more complicated handshakes.
- 
- If there was a failure, and an error message is available, rfbVncAuthFailedEx (3) is sent followed by the length of the
-   error string and then the error string
- If there was a failure, and no error message is available, simply send rfbVncAuthFailed (1)
- otherwise, if using mslogon, send rfbMsLogon, and if not using mslogon, send rfbVncAuthOK(0)
-
- at this point the handshake is 'complete' and all further communication is encrypted.
-
- if using mslogon, mslogon authentication will now occur (since the rfbMsLogon packet was sent)
-
- RFB 3.8 changes
-
- Now we send a byte for # of supported auth types, and then a byte for each auth type.
-
- rfbUltraVNC is not being used for anything, although rfbUltraVNC_SecureVNCPlugin has been established somewhat.
- Like a lot of these things, most of the values in the authentication range will end up going unused.
- 
- Rather than complicate things further, I hereby declare this scheme: the top 4 bits will define the 'owner'
- of that set of values, and the bottom 4 bits will define the type. All of the values in the RFB 3.8 spec
- can then be covered by 0x0 and 0x1 for the top 4 bits.
-
-                              mask
- RealVNC-approved values:     0x0F
- RealVNC-approved values:     0x1F
- reserved:                    0x2F
- reserved:                    0x3F
- reserved:                    0x4F
- reserved:                    0x5F
- reserved:                    0x6F
- UltraVNC:                    0x7F
- TightVNC:                    0x8F
- reserved:                    0x9F
- reserved:                    0xAF
- reserved:                    0xBF
- reserved:                    0xCF
- reserved:                    0xDF
- reserved:                    0xEF
- reserved:                    0xFF
-*/
-
-#define rfbConnFailed 0
-#define rfbInvalidAuth 0
-#define rfbNoAuth 1
-#define rfbVncAuth 2
-#define rfbUltraVNC 17
-// adzm 2010-09 - After rfbUltraVNC, auth repeats via rfbVncAuthContinue
-
-#define rfbUltraVNC_SCPrompt 0x68
-#define rfbUltraVNC_SessionSelect 0x69
-// adzm 2010-09 - Ultra subtypes
-#define rfbUltraVNC_MsLogonIAuth 0x70
-
-	// mslogonI never seems to be used anymore -- the old code would say if (m_ms_logon) AuthMsLogon (II) else AuthVnc
-	// and within AuthVnc would be if (m_ms_logon) { /* mslogon code */ }. That could never be hit since the first case
-	// would always match!
-
-#define rfbUltraVNC_MsLogonIIAuth 0x71
-#define rfbUltraVNC_SecureVNCPluginAuth 0x72
-
-//adzm 2010-05-10 - for backwards compatibility with pre-3.8
-#define rfbLegacy_SecureVNCPlugin 17
-#define rfbLegacy_MsLogon 0xfffffffa // UltraVNC's MS-Logon with (hopefully) better security
-
-// please see ABOVE these definitions for more discussion on authentication
-
-
-/*
- * 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
-// neither of these are used any longer in RFB 3.8
-#define rfbVncAuthTooMany 2
-#define rfbVncAuthFailedEx 3 //adzm 2010-05-11 - Send an explanatory message for the failure (if any)
-
-// adzm 2010-09 - rfbUltraVNC or other auths may send this to restart authentication (perhaps over a now-secure channel)
-#define rfbVncAuthContinue 0xFFFFFFFF
-
-
-
-// UltraVNC specific extensions of RFB protocol
-//
-#define rfbServerState 0xAD // 26 March 2008 jdp
-
-#define rfbKeepAlive 13 // 16 July 2008 jdp -- bidirectional
-// adzm 2010-09 - Notify streaming DSM plugin support
-#define rfbNotifyPluginStreaming 0x50
-
-#define rfbRequestSession 20
-#define rfbSetSession 21
-
-  
-// adzm 2010-09 - Notify streaming DSM plugin support
-#define rfbEncodingPluginStreaming       0xC0A1E5CF
-
-// viewer requests server state updates
-#define rfbEncodingServerState              0xFFFF8000
-#define rfbEncodingEnableKeepAlive          0xFFFF8001
-#define rfbEncodingFTProtocolVersion           0xFFFF8002
-#define rfbEncodingpseudoSession    		0xFFFF8003
-
-// adzm 2010-09 - Notify streaming DSM plugin support
-typedef struct {
-    uint8_t type;			/* always rfbServerCutText */
-    uint8_t pad1;
-    uint16_t flags; // reserved - always 0
-} rfbNotifyPluginStreamingMsg;
-
-#define sz_rfbNotifyPluginStreamingMsg	4
-
-
-
-#define rfbFileTransferSessionStart 15 // indicates a client has the FT gui open
-#define rfbFileTransferSessionEnd   16 // indicates a client has closed the ft gui.
-#define rfbFileTransferProtocolVersion 17 // indicates ft protocol version understood by sender. contentParam is version #
-
-
-#define rfbPartialFilePrefix   "!UVNCPFT-\0" // Files are transferred with this prefix, until complete. Must end with "-", does not apply to directory transfers
-#define sz_rfbPartialFilePrefix 9 
-
-// new message for sending server state to client
-
-#define rfbServerState_Disabled     0
-#define rfbServerState_Enabled      1
-
-#define rfbServerRemoteInputsState  1
-#define rfbKeepAliveInterval        2
-
-typedef struct {
-    uint8_t   type;          /* always rfbServerState */
-    uint8_t pad1;
-    uint8_t pad2;
-    uint8_t pad3;
-    uint32_t  state;         /* state id*/
-    uint32_t  value;         /* state value */ 
-} rfbServerStateMsg;
-
-
-#define sz_rfbServerStateMsg 12
-
-
-typedef struct {
-	uint8_t type;
-} rfbKeepAliveMsg;
-
-typedef struct {
-	uint8_t type;
-} rfbRequestSessionMsg;
-
-typedef struct {
-	uint8_t type;
-	uint8_t number;
-} rfbSetSessionMsg;
-
-#define sz_rfbKeepAliveMsg 1
-#define sz_rfbRequestSessionMsg 1
-#define sz_rfbSetSessionMsg 2
-
-
-qint64 vsocketDispatcher( char * _buf, const qint64 _len,
-                                const SocketOpCodes _op_code, void * _user )
-{
-	VSocket * sock = static_cast<VSocket *>( _user );
-	switch( _op_code )
-	{
-		case SocketRead: return( sock->ReadExact( _buf, _len ) ?
-								_len : 0 );
-		case SocketWrite: return( sock->SendExact( _buf, _len ) ?
-								_len : 0 );
-		case SocketGetPeerAddress:
-			strncpy( _buf, sock->GetPeerName(), _len );
-			return( 0 );
-	}
-	return( 0 );
-
-}
-
-
-#include "vncclient.cpp"
-#include "vncdesktop.cpp"
-
diff --git a/ica/win32/winvnc/DSMPlugin/DSMPlugin.cpp b/ica/win32/winvnc/DSMPlugin/DSMPlugin.cpp
deleted file mode 100644
index 1efd6e7..0000000
--- a/ica/win32/winvnc/DSMPlugin/DSMPlugin.cpp
+++ /dev/null
@@ -1,525 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-//
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// DSMPlugin.cpp: implementation of the CDSMPlugin class.
-//
-//////////////////////////////////////////////////////////////////////
-//
-// This class is the interface between UltraVNC and plugins 
-// (third party dlls) that may be developed (written, exported and 
-// provided by authorized individuals - according to the law of their 
-// country) to alter/modify/process/encrypt rfb data streams between 
-// vnc viewer and vnc server.
-//
-// The goal here is not to design and develop an extensive, versatile
-// and powerfull plugin system but to provide people a way
-// to easely customize the VNC communication data between client and server.
-//
-// It handles the following tasks:
-// 
-// - Listing of all plugins found in the vnc directory (dlls, with ".dsm" extension)
-//
-// - Loading of a given plugin
-//
-// - Interface between vnc and the plugin functions: 
-//   - Init()               Initialize the plugin
-//   - SetParams()          Set Password, or key or other. If more than one param, uses ',' as separator
-//   - GetParams()          Give Password, or key or other. If more than one param, uses ',' as separator
-//   - DescribePlugin()     Give the Plugin ID string (Name, Author, Date, Version, FileName)
-//   - TransformBuffer()    Tell the plugin to do it's transformation against the data in the buffer
-//   - RestoreBuffer()      Tell the plugin to restore data to its original state   
-//   - Shutdown()           Cleanup and shutdown the plugin
-//   - FreeBuffer()         Free a buffer used in the plugin
-//	 - Reset()
-//
-// - Unloading of the current loaded plugin
-//
-//  (2009)
-//  Multithreaded DSM plugin framework created by Adam D. Walling aka adzm
-// - Creating a new (threadsafe) instance of a DSM plugin encryptor/decryptor
-//   - CreatePluginInterface -- returns a pointer to a new IPlugin-derived class,
-//       which is then used to transform and restore buffers in a threadsafe manner.
-// 
-// WARNING: For the moment, only ONE instance of this class must exist in Vncviewer and WinVNC
-// Consequently, WinVNc will impose all its clients to use the same plugin. Maybe we'll 
-// improve that soon. It depends on the demand/production of DSM plugins.
-
-
-#include <memory.h>
-#include <stdio.h>
-#include <string.h>
-#include "stdhdrs.h"
-#include "DSMPlugin.h"
-
-
-//
-// Utils
-//
-BOOL MyStrToken(LPSTR szToken, LPSTR lpString, int nTokenNum, char cSep)
-{
-	int i = 1;
-	while (i < nTokenNum)
-	{
-		while ( *lpString && (*lpString != cSep) &&(*lpString != '\0'))
-		{
-			lpString++;
-		}
-		i++;
-		lpString++;
-	}
-	while ((*lpString != cSep) && (*lpString != '\0'))
-	{
-		*szToken = *lpString;
-		szToken++;
-		lpString++;
-	}
-	*szToken = '\0' ;
-	if (( ! *lpString ) || (! *szToken)) return FALSE;
-	return FALSE;
-}
-
-
-
-//
-//
-//
-CDSMPlugin::CDSMPlugin()
-{
-	m_fLoaded = false;
-	m_fEnabled = false;
-	m_lPassLen = 0;
-
-	m_pTransBuffer = NULL;
-	m_pRestBuffer = NULL;
-
-	sprintf(m_szPluginName, "Unknown");
-	sprintf(m_szPluginVersion, "0.0.0");
-	sprintf(m_szPluginDate, "12-12-2002");
-	sprintf(m_szPluginAuthor, "Someone");
-	sprintf(m_szPluginFileName, "Plugin.dsm"); // No path, just the filename
-
-	m_hPDll = NULL;
-
-	// Plugin's functions pointers init
-	/*
-	STARTUP			m_PStartup = NULL;
-	SHUTDOWN		m_PShutdown = NULL;
-	SETPARAMS		m_PSetParams = NULL;
-	GETPARAMS		m_PGetParams = NULL;
-	TRANSFORMBUFFER m_PTransformBuffer = NULL;
-	RESTOREBUFFER	m_PRestoreBuffer = NULL;
-	TRANSFORMBUFFER	m_PFreeBuffer = NULL;
-	RESET			m_PReset = NULL;
-	//adzm - 2009-06-21
-	CREATEPLUGININTERFACE	m_PCreatePluginInterface = NULL;
-	*/
-
-	//adzm - 2009-07-05
-	// Plugin's functions pointers init
-	m_PDescription = NULL;
-	m_PStartup = NULL;
-	m_PShutdown = NULL;
-	m_PSetParams = NULL;
-	m_PGetParams = NULL;
-	m_PTransformBuffer = NULL;
-	m_PRestoreBuffer = NULL;
-	m_PFreeBuffer = NULL;
-	m_PReset = NULL;
-	//adzm - 2009-06-21
-	m_PCreatePluginInterface = NULL;
-	//adzm 2010-05-10
-	m_PCreateIntegratedPluginInterface = NULL;
-	//adzm 2010-05-12 - dsmplugin config
-	m_PConfig = NULL;
-}
-
-//
-//
-//
-CDSMPlugin::~CDSMPlugin()
-{
-	// TODO: Log events
-	if (IsLoaded())
-		UnloadPlugin();
-}
-
-
-//
-//
-//
-void CDSMPlugin::SetEnabled(bool fEnable)
-{
-	m_fEnabled =  fEnable;
-}
-
-
-//
-//
-//
-void CDSMPlugin::SetLoaded(bool fEnable)
-{
-	m_fLoaded =  fEnable;
-}
-
-
-//
-//
-//
-char* CDSMPlugin::DescribePlugin(void)
-{
-	// TODO: Log events
-	char* szDescription = NULL;
-	if (m_PDescription)
-	{
-		 szDescription = (*m_PDescription)();
-		 if (szDescription != NULL)
-		 {
-			 //adzm 2010-05-10 - this was inconsistent with the way the plugins are written
-			MyStrToken(m_szPluginName, szDescription, 1, ',');
-			MyStrToken(m_szPluginVersion, szDescription, 2, ',');
-			MyStrToken(m_szPluginDate, szDescription, 3, ',');
-			MyStrToken(m_szPluginAuthor, szDescription, 4, ',');
-			MyStrToken(m_szPluginFileName, szDescription, 5, ',');
-		 }
-		 return szDescription;
-	}
-
-	else 
-		return "No Plugin loaded";
-}
-
-
-//
-// Init the DSMPlugin system
-//
-bool CDSMPlugin::InitPlugin(void)
-{
-	// TODO: Log events
-	int nRes = (*m_PStartup)();
-	if (nRes < 0) return false;
-	else return true;
-}
-
-//
-// Reset the DSMPlugin
-//
-bool CDSMPlugin::ResetPlugin(void)
-{
-	// TODO: Log events
-	int nRes = (*m_PReset)();
-	if (nRes < 0) return false;
-	else return true;
-}
-
-
-//
-// szParams is the key (or password) that is transmitted to the loaded DSMplugin
-//
-bool CDSMPlugin::SetPluginParams(HWND hWnd, char* szParams, char* szConfig, char** pszNewConfig)
-{
-	// TODO: Log events
-
-	//adzm 2010-05-12 - dsmplugin config
-	if (m_PConfig) {
-		//char* szNewConfig = NULL;
-		int nRes = (*m_PConfig)(hWnd, szParams, szConfig, pszNewConfig);		
-		if (nRes > 0) return true; else return false;
-	} else {
-		int nRes = (*m_PSetParams)(hWnd, szParams);
-		if (nRes > 0) return true; else return false;
-	}
-}
-
-
-//
-// Return the loaded DSMplugin current param(s)
-//
-char* CDSMPlugin::GetPluginParams(void)
-{
-	// 
-	return (*m_PGetParams)();
-
-}
-
-
-//
-// List all the plugins is the current APP directory in the given ComboBox
-//
-int CDSMPlugin::ListPlugins(HWND hComboBox)
-{
-	// TODO: Log events
-	WIN32_FIND_DATA fd;
-	HANDLE ff;
-	int fRet = 1;
-	int nFiles = 0;
-	char szCurrentDir[MAX_PATH];
-
-	if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-	{
-		char* p = strrchr(szCurrentDir, '\\');
-		if (p == NULL)
-			return 0;
-		*p = '\0';
-	}
-	else
-		return 0;
-	// MessageBoxSecure(NULL, szCurrentDir, "Current directory", MB_OK);
-
-    if (szCurrentDir[strlen(szCurrentDir) - 1] != '\\') strcat(szCurrentDir, "\\");
-	strcat(szCurrentDir, "*.dsm"); // The DSMplugin dlls must have this extension
-	
-	ff = FindFirstFile(szCurrentDir, &fd);
-	if (ff == INVALID_HANDLE_VALUE)
-	{
-		// Todo: Log error here
-		return 0;
-	}
-
-	while (fRet != 0)
-	{
-		SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)(fd.cFileName)); 
-		nFiles++;
-		fRet = FindNextFile(ff, &fd);
-	}
-
-	FindClose(ff);
-
-	return nFiles;
-}
-
-
-
-//
-// Load the given DSMplugin and map its functions
-//
-bool CDSMPlugin::LoadPlugin(char* szPlugin, bool fAllowMulti)
-{
-	// sf at 2003 - Multi dll trick 
-	// I really don't like doing this kind of dirty workaround but I have no time to do
-	// better for now. Used only by a listening viewer.
-	// Create a numbered temporary copy of the original plugin dll and load it (viewer only, for now)
-	if (fAllowMulti)
-	{
-		bool fDllCopyCreated = false;
-		int i = 1;
-		char szDllCopyName[MAX_PATH];
-		char szCurrentDir[MAX_PATH];
-		char szCurrentDir_szPlugin[MAX_PATH];
-		char szCurrentDir_szDllCopyName[MAX_PATH];
-		while (!fDllCopyCreated)
-		{
-			/*strcpy_s(szDllCopyName, 260,szPlugin);
-			szDllCopyName[strlen(szPlugin) - 4] = '\0'; //remove the ".dsm" extension
-			sprintf(szDllCopyName, "%s-tmp.d%d", szDllCopyName, i++);*/
-			//fDllCopyCreated = (FALSE != CopyFile(szPlugin, szDllCopyName, false));
-			// Note: Let's be really dirty; Overwrite if it's possible only (dll not loaded). 
-			// This way if for some reason (abnormal process termination) the dll wasn't previously 
-			// normally deleted we overwrite/clean it with the new one at the same time.
-			//strcpy (szCurrentDir_szDllCopyName,szDllCopyName);
-			//DWORD error=GetLastError();
-			//if (error==2)
-			{
-				if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-					{
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-					}
-				char lpPathBuffer[MAX_PATH];
-				DWORD dwBufSize=MAX_PATH;
-				DWORD dwRetVal;
-				dwRetVal = GetTempPath(dwBufSize,lpPathBuffer);
-				if (dwRetVal > dwBufSize || (dwRetVal == 0))
-				{
-					strcpy (lpPathBuffer,szCurrentDir);
-				}
-				else
-				{
-					
-				}
-				
-				strcpy (szCurrentDir_szPlugin,szCurrentDir);
-				strcat (szCurrentDir_szPlugin,"\\");
-				strcat (szCurrentDir_szPlugin,szPlugin);
-
-				strcpy (szCurrentDir_szDllCopyName,lpPathBuffer);
-				//strcat (szCurrentDir_szDllCopyName,"\\");
-				strcat (szCurrentDir_szDllCopyName,szDllCopyName);
-				fDllCopyCreated = (FALSE != CopyFile(szCurrentDir_szPlugin, szCurrentDir_szDllCopyName, false));
-			}
-			if (i > 99) break; // Just in case...
-		}
-		strcpy(m_szDllName, szCurrentDir_szDllCopyName);
-		m_hPDll = LoadLibrary(m_szDllName);
-	}
-	else // Use the original plugin dll
-	{
-		ZeroMemory(m_szDllName, strlen(m_szDllName));
-		m_hPDll = LoadLibrary(szPlugin);
-		//Try current PATH
-		if (m_hPDll==NULL)
-		{
-			char szCurrentDir[MAX_PATH];
-			char szCurrentDir_szPlugin[MAX_PATH];
-			if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-				{
-					char* p = strrchr(szCurrentDir, '\\');
-					*p = '\0';
-				}
-			strcpy (szCurrentDir_szPlugin,szCurrentDir);
-			strcat (szCurrentDir_szPlugin,"\\");
-			strcat (szCurrentDir_szPlugin,szPlugin);
-			m_hPDll = LoadLibrary(szCurrentDir_szPlugin);
-		}
-	}
-
-	if (m_hPDll == NULL) return false;
-
-	m_PDescription     = (DESCRIPTION)     GetProcAddress(m_hPDll, "Description");
-	m_PStartup         = (STARTUP)         GetProcAddress(m_hPDll, "Startup");
-	m_PShutdown        = (SHUTDOWN)        GetProcAddress(m_hPDll, "Shutdown");
-	m_PSetParams       = (SETPARAMS)       GetProcAddress(m_hPDll, "SetParams");
-	m_PGetParams       = (GETPARAMS)       GetProcAddress(m_hPDll, "GetParams");
-	m_PTransformBuffer = (TRANSFORMBUFFER) GetProcAddress(m_hPDll, "TransformBuffer");
-	m_PRestoreBuffer   = (RESTOREBUFFER)   GetProcAddress(m_hPDll, "RestoreBuffer");
-	m_PFreeBuffer      = (FREEBUFFER)      GetProcAddress(m_hPDll, "FreeBuffer");
-	m_PReset           = (RESET)           GetProcAddress(m_hPDll, "Reset");
-	//adzm - 2009-06-21
-	m_PCreatePluginInterface	= (CREATEPLUGININTERFACE)	GetProcAddress(m_hPDll, "CreatePluginInterface");
-	//adzm 2010-05-10
-	m_PCreateIntegratedPluginInterface	= (CREATEINTEGRATEDPLUGININTERFACE)	GetProcAddress(m_hPDll, "CreateIntegratedPluginInterface");
-	//adzm 2010-05-12 - dsmplugin config
-	m_PConfig         = (CONFIG)           GetProcAddress(m_hPDll, "Config");
-
-	if (m_PStartup == NULL || m_PShutdown == NULL || m_PSetParams == NULL || m_PGetParams == NULL
-		|| m_PTransformBuffer == NULL || m_PRestoreBuffer == NULL || m_PFreeBuffer == NULL)
-	{
-		FreeLibrary(m_hPDll); 
-		if (*m_szDllName) DeleteFile(m_szDllName);
-		return false;
-	}
-
-	// return ((*m_PStartup)());
-	SetLoaded(true);
-	return true;
-}
-
-
-//
-// Unload the current DSMPlugin from memory
-//
-bool CDSMPlugin::UnloadPlugin(void)
-{
-	// TODO: Log events
-	// Force the DSMplugin to free the buffers it allocated
-	if (m_pTransBuffer != NULL) (*m_PFreeBuffer)(m_pTransBuffer);
-	if (m_pRestBuffer != NULL) (*m_PFreeBuffer)(m_pRestBuffer);
-	
-	m_pTransBuffer = NULL;
-	m_pRestBuffer = NULL;
-
-	SetLoaded(false);
-
-	if ((*m_PShutdown)())
-	{
-		bool fFreed = false;
-		fFreed = (FALSE != FreeLibrary(m_hPDll));
-		if (*m_szDllName) DeleteFile(m_szDllName);
-		return fFreed;
-	}
-	else
-		return false;
-	
-}
-
-//adzm - 2009-06-21
-IPlugin* CDSMPlugin::CreatePluginInterface()
-{
-	if (m_PCreatePluginInterface) {
-		return m_PCreatePluginInterface();
-	} else {
-		return NULL;
-	}
-}
-
-bool CDSMPlugin::SupportsMultithreaded()
-{
-	//adzm 2010-05-10
-	return m_PCreatePluginInterface != NULL || m_PCreateIntegratedPluginInterface != NULL;
-}
-
-//adzm 2010-05-10
-IIntegratedPlugin* CDSMPlugin::CreateIntegratedPluginInterface()
-{
-	if (m_PCreateIntegratedPluginInterface) {
-		return m_PCreateIntegratedPluginInterface();
-	} else {
-		return NULL;
-	}
-}
-
-bool CDSMPlugin::SupportsIntegrated()
-{
-	return m_PCreateIntegratedPluginInterface != NULL;
-}
-
-
-//
-// Tell the plugin to do its transformation on the source data buffer
-// Return: pointer on the new transformed buffer (allocated by the plugin)
-// nTransformedDataLen is the number of bytes contained in the transformed buffer
-//
-BYTE* CDSMPlugin::TransformBuffer(BYTE* pDataBuffer, int nDataLen, int* pnTransformedDataLen)
-{
-	// FixME: possible pb with this mutex in WinVNC
-	omni_mutex_lock l(m_TransMutex);
-
-	m_pTransBuffer = (*m_PTransformBuffer)(pDataBuffer, nDataLen, pnTransformedDataLen);
-
-	return m_pTransBuffer;
-}
-
-
-// - If pRestoredDataBuffer = NULL, the plugin check its local buffer and return the pointer
-// - Otherwise, restore data contained in its rest. buffer and put the result in pRestoredDataBuffer
-//   pnRestoredDataLen is the number bytes put in pRestoredDataBuffers
-BYTE* CDSMPlugin::RestoreBufferStep1(BYTE* pRestoredDataBuffer, int nDataLen, int* pnRestoredDataLen)
-{
-	//m_RestMutex.lock();
-	m_pRestBuffer = (*m_PRestoreBuffer)(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	return m_pRestBuffer;
-}
-
-BYTE* CDSMPlugin::RestoreBufferStep2(BYTE* pRestoredDataBuffer, int nDataLen, int* pnRestoredDataLen)
-{
-	m_pRestBuffer = (*m_PRestoreBuffer)(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	//m_RestMutex.unlock();
-	return NULL;
-}
-
-void CDSMPlugin::RestoreBufferUnlock()
-{
-	//m_RestMutex.unlock();
-}
-
diff --git a/ica/win32/winvnc/DSMPlugin/DSMPlugin.h b/ica/win32/winvnc/DSMPlugin/DSMPlugin.h
deleted file mode 100644
index db6c134..0000000
--- a/ica/win32/winvnc/DSMPlugin/DSMPlugin.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at Vnc Team Members. 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://ultravnc.sourceforge.net/
-////////////////////////////////////////////////////////////////////////////
-//
-// DSMPlugin.h: interface for the CDSMPlugin class.
-//
-//////////////////////////////////////////////////////////////////////
-//
-//  (2009)
-//  Multithreaded DSM plugin framework created by Adam D. Walling aka adzm
-
-#if !defined(CDSMPlugin_H)
-#define CDSMPlugin_H
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-
-#ifdef UNDER_CE
-#include "omnithreadce.h"
-#else
-#include "omnithread.h"
-#endif
-
-#include "windows.h"
-
-//adzm - 2009-06-21
-class IPlugin
-{
-public:
-	virtual ~IPlugin() {};
-
-	virtual BYTE* TransformBuffer(BYTE* pDataBuffer, int nDataLen, int* pnTransformedDataLen) = 0;
-	virtual BYTE* RestoreBuffer(BYTE* pTransBuffer, int nTransDataLen, int* pnRestoredDataLen) = 0;
-};
-
-class IIntegratedPlugin : public IPlugin
-{
-public:
-	virtual ~IIntegratedPlugin() {};
-
-	// Free memory allocated by the plugin
-	virtual void FreeMemory(void* pMemory) = 0;
-
-	// Get the last error string
-	virtual LPCSTR GetLastErrorString() = 0; // volatile, must be copied or may be invalidated
-
-	// Describe the current encryption settings
-	virtual LPCSTR DescribeCurrentSettings() = 0; // volatile, must be copied or may be invalidated
-
-	// Set handshake complete and start to transform/restore buffers
-	virtual void SetHandshakeComplete() = 0;
-
-	// Helper methods to decrypt or encrypt an arbitrary array of bytes with a given passphrase
-	virtual bool EncryptBytesWithKey(const BYTE* pPlainData, int nPlainDataLength, const BYTE* pPassphrase, int nPassphraseLength, BYTE*& pEncryptedData, int& nEncryptedDataLength, bool bIncludeHash) = 0;
-	virtual bool DecryptBytesWithKey(const BYTE* pEncryptedData, int nEncryptedDataLength, const BYTE* pPassphrase, int nPassphraseLength, BYTE*& pPlainData, int& nPlainDataLength, bool bIncludeHash) = 0;
-
-	// server
-	virtual void SetServerIdentification(const BYTE* pIdentification, int nLength) = 0;
-	virtual void SetServerOptions(LPCSTR szOptions) = 0;
-	virtual void SetPasswordData(const BYTE* pPasswordData, int nLength) = 0;
-	virtual bool GetChallenge(BYTE*& pChallenge, int& nChallengeLength, int nSequenceNumber) = 0;
-	virtual bool HandleResponse(const BYTE* pResponse, int nResponseLength, int nSequenceNumber, bool& bSendChallenge) = 0;
-
-	// client
-	virtual void SetViewerOptions(LPCSTR szOptions) = 0;
-	virtual bool HandleChallenge(const BYTE* pChallenge, int nChallengeLength, int nSequenceNumber, bool& bPasswordOK, bool& bPassphraseRequired) = 0;
-	virtual bool GetResponse(BYTE*& pResponse, int& nResponseLength, int nSequenceNumber, bool& bExpectChallenge) = 0;
-
-};
-
-// A plugin dll must export the following functions (with same convention)
-typedef char* (__cdecl  *DESCRIPTION)(void);
-typedef int   (__cdecl  *STARTUP)(void);
-typedef int   (__cdecl  *SHUTDOWN)(void);
-typedef int   (__cdecl  *SETPARAMS)(HWND, char*);
-typedef char* (__cdecl  *GETPARAMS)(void);
-typedef BYTE* (__cdecl  *TRANSFORMBUFFER)(BYTE*, int, int*);
-typedef BYTE* (__cdecl  *RESTOREBUFFER)(BYTE*, int, int*);
-typedef void  (__cdecl  *FREEBUFFER)(BYTE*);
-typedef int   (__cdecl  *RESET)(void);
-//adzm - 2009-06-21
-typedef IPlugin* (__cdecl  *CREATEPLUGININTERFACE)(void);
-//adzm 2010-05-10
-typedef IIntegratedPlugin* (__cdecl  *CREATEINTEGRATEDPLUGININTERFACE)(void);
-//adzm 2010-05-12 - dsmplugin config
-typedef int   (__cdecl  *CONFIG)(HWND, char*, char*, char**);
-
-//
-//
-//
-class CDSMPlugin  
-{
-public:
-	void SetLoaded(bool fEnable);
-	bool IsLoaded(void) { return m_fLoaded; };
-	void SetEnabled(bool fEnable);
-	bool IsEnabled(void) { return m_fEnabled; };
-	bool InitPlugin(void);
-	//adzm 2010-05-12 - dsmplugin config
-	bool SetPluginParams(HWND hWnd, char* szParams, char* szConfig = NULL, char** szNewConfig = NULL);
-	char* GetPluginParams(void);
-	char* DescribePlugin(void);
-	int  ListPlugins(HWND hComboBox);
-	bool LoadPlugin(char* szPlugin, bool fAllowMulti);
-	bool UnloadPlugin(void); // Could be private
-	BYTE* TransformBuffer(BYTE* pDataBuffer, int nDataLen, int* nTransformedDataLen);
-	BYTE* RestoreBufferStep1(BYTE* pDataBuffer, int nDataLen, int* nRestoredDataLen);
-	BYTE* RestoreBufferStep2(BYTE* pDataBuffer, int nDataLen, int* nRestoredDataLen);
-	void RestoreBufferUnlock();
-	char* GetPluginName(void) { return m_szPluginName;} ;
-	char* GetPluginVersion(void)  {  return m_szPluginVersion;} ;
-	char* GetPluginDate(void) { return m_szPluginDate; } ;
-	char* GetPluginAuthor(void) { return m_szPluginAuthor;} ;
-	char* GetPluginFileName(void) { return m_szPluginFileName;} ;
-
-	//adzm - 2009-06-21
-	IPlugin* CreatePluginInterface();
-	bool SupportsMultithreaded();
-
-	//adzm 2010-05-10
-	IIntegratedPlugin* CreateIntegratedPluginInterface();
-	bool SupportsIntegrated();
-
-	CDSMPlugin();
-	virtual ~CDSMPlugin();
-	bool ResetPlugin(void);
-
-	long m_lPassLen; 
-
-	omni_mutex m_RestMutex;
-
-private:
-	bool m_fLoaded;
-	bool m_fEnabled;
-
-	char szPassword[64];
-
-	char m_szPluginName[128]; // Name of the plugin and very short description
-	char m_szPluginVersion[16];
-	char m_szPluginDate[16];
-	char m_szPluginAuthor[64];
-	char m_szPluginFileName[128]; // No path, just the filename and possible comment
-
-	HMODULE m_hPDll;
-	char m_szDllName[MAX_PATH];
-
-	// Plugin's functions pointers when loaded
-	DESCRIPTION     m_PDescription;
-	SHUTDOWN		m_PShutdown;
-	STARTUP			m_PStartup;
-	SETPARAMS		m_PSetParams;
-	GETPARAMS		m_PGetParams;
-	TRANSFORMBUFFER m_PTransformBuffer;
-	RESTOREBUFFER	m_PRestoreBuffer;
-	FREEBUFFER		m_PFreeBuffer;
-	RESET			m_PReset;
-	//adzm - 2009-06-21
-	CREATEPLUGININTERFACE m_PCreatePluginInterface;
-	//adzm 2010-05-10
-	CREATEINTEGRATEDPLUGININTERFACE m_PCreateIntegratedPluginInterface;
-	//adzm 2010-05-12 - dsmplugin config
-	CONFIG m_PConfig;
-
-
-	//adzm - 2009-06-21 - Please do not use these! Deprecated with multithreaded DSM
-	BYTE* m_pTransBuffer;
-	BYTE* m_pRestBuffer;
-
-	omni_mutex m_TransMutex;
-	// omni_mutex m_RestMutex;
-};
-
-#endif
diff --git a/ica/win32/winvnc/Makefile.bcc32 b/ica/win32/winvnc/Makefile.bcc32
deleted file mode 100644
index 1034471..0000000
--- a/ica/win32/winvnc/Makefile.bcc32
+++ /dev/null
@@ -1,117 +0,0 @@
-# This makefile is for command-line Borland C++ 5.5 compiler (Win32).
-# It builds winvnc.exe (and .\VNCHooks\VNCHooks.dll).
-
-CC=bcc32
-RC=brc32
-LD=ilink32
-
-CFLAGS= -v- -Od -3 -tWM -xd- -q -P -Iomnithread -I".." -I..\..\rfb\ -w-8057 -w-8004 -w-8066 -w-8027 -w-8012 -w-8022 -DXMD_H -DWIN32
-LDFLAGS= /c /Tpe /aa /Gn /B:0x400000
-
-OBJS=winvnc\d3des.obj \
-     winvnc\vncLog.obj \
-     winvnc\stdhdrs.obj \
-     winvnc\translate.obj \
-     winvnc\vncAbout.obj \
-     winvnc\vncAcceptDialog.obj \
-     winvnc\vncauth.obj \
-     winvnc\vncBuffer.obj \
-     winvnc\vncClient.obj \
-     winvnc\vncConnDialog.obj \
-     winvnc\vncDesktop.obj \
-     winvnc\vncEncodeCoRRE.obj \
-     winvnc\vncEncodeHexT.obj \
-     winvnc\vncEncoder.obj \
-     winvnc\vncEncodeRRE.obj \
-     winvnc\vncEncodeTight.obj \
-     winvnc\vncEncodeZlib.obj \
-     winvnc\vncEncodeZlibHex.obj \
-     winvnc\vncHTTPConnect.obj \
-     winvnc\vncInstHandler.obj \
-     winvnc\vncKeymap.obj \
-     winvnc\vncMenu.obj \
-     winvnc\vncProperties.obj \
-#     winvnc\rfbRegion_win32.obj \
-     winvnc\Region.obj \
-     winvnc\rfbRegion_X11.obj \
-     winvnc\vncServer.obj \
-     winvnc\vncService.obj \
-     winvnc\vncSockConnect.obj \
-     winvnc\vncTimedMsgBox.obj \
-     winvnc\VSocket.obj \
-     winvnc\WinVNC.obj \
-     winvnc\buildtime.obj \
-     winvnc\TextChat.obj \
-     winvnc\vncDesktopSW.obj \
-     winvnc\vncEncoderCursor.obj \
-     winvnc\vncEncodeZRLE.obj \
-     winvnc\vncListDlg.obj \
-     winvnc\rfbUpdateTracker.obj \
-#     winvnc\vncLogonntml.obj \
-#     winvnc\vncLogonntlm2.obj \
-#     winvnc\vncMasterPasswd.obj \
-#     winvnc\vncPropPath.obj \
-     omnithread\omnithread.obj \
-     ..\DSMPlugin\DSMPlugin.obj \
-     winvnc\vncOSVersion.obj \
-     winvnc\videodriver.obj \
-     winvnc\vncmemcpy.obj \
-     winvnc\vncEncodeUltra.obj \
-     ..\lzo\minilzo.obj \
-     winvnc\vncntlm.obj \
-     ..\zipunzip32\zipunzip32.obj
-
-LIBS=..\zlib\zlib.lib ..\rdr\rdr.lib ..\libjpeg\libjpeg.lib VNCHooks\VNCHooks.lib
-
-RES=winvnc\winvnc.res
-
-.autodepend
-.c.obj:
-	$(CC) -c $(CFLAGS) $<
-.cpp.obj:
-	$(CC) -c $(CFLAGS) $<
-.cxx.obj:
-	$(CC) -c $(CFLAGS) $< 
-
-.rc.res:
-	echo:>afxres.h
-	$(RC) -r $<
-	del afxres.h
-
-winvnc.exe: $(OBJS) $(LIBS) $(RES)
-	$(LD) $(LDFLAGS) c0w32 $(OBJS), $@, , $(LIBS) import32 cw32mt, , $(RES)
-
-..\zlib\zlib.lib:
-	cd ..
-	cd zlib
-	make -fMakefile.bcc32 -l -s
-	cd ..
-	cd winvnc
-
-..\rdr\rdr.lib:
-	cd ..
-	cd rdr
-	make -fMakefile.bcc32 -l -s
-	cd ..
-	cd winvnc
-
-..\libjpeg\libjpeg.lib:
-	cd ..
-	cd libjpeg
-	make -fMakefile.bcc32 -l -s
-	cd ..
-	cd winvnc
-
-VNCHooks\VNCHooks.lib:
-	cd VNCHooks
-	make -fMakefile.bcc32 -l -s
-	cd ..
-
-omnithread\omnithread.obj:
-	cd omnithread
-	build-bcc32.bat
-	cd ..
-
-clean:
-	del *.obj winvnc.exe
-
diff --git a/ica/win32/winvnc/building.txt b/ica/win32/winvnc/building.txt
deleted file mode 100644
index 567230d..0000000
--- a/ica/win32/winvnc/building.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-NOTES ON BUILDING WINVNC:
-
-The WinVNC project file (WinVNC.dsp) contains four sets of project
-settings.  The settings required to re-build the publicly released
-executable are stored in the Release configuration.
-
-The public configurations are:
-
-///////////////////////////////////////////////////////////////////////////
-
-Release -	This is the intended build configuration for external use
-			and is used directly to create the distributed executables.
-			This configuration is identical to the Release (CORBA) configuration,
-			barring the use of the definition NCORBA rather than the
-			definition _CORBA.
-
-**>		Use this release when building WinVNC for general distribution.	<**
-
-Debug -		The public debug build.  This builds debug executables and
-			libraries, equivalent in all other respects to the release builds.  
-
-///////////////////////////////////////////////////////////////////////////
-
-Internally, AT&T Labs and the Laboratory for Communications Engineering use
-CORBA-based session-management.  Within the labs, the following builds are used
-in place of the public builds above.
-
-Release (CORBA) -
-			Release build providing session management interface.
-			This build assumes the presence of CORBA session-control code
-			in the vncCorbaConnect files.  These are not supplied
-			as part of the public release distribution because
-			they are dependent upon AT&T infrastructure.
-
-Debug (CORBA) -
-			Debug build providing session management.  This build
-			also assumes the presence of the CORBA session-control
-			routines.
-
-///////////////////////////////////////////////////////////////////////////
diff --git a/ica/win32/winvnc/crtdbg.h b/ica/win32/winvnc/crtdbg.h
deleted file mode 100644
index 139597f..0000000
--- a/ica/win32/winvnc/crtdbg.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/ica/win32/winvnc/history.txt b/ica/win32/winvnc/history.txt
deleted file mode 100644
index 68025c0..0000000
--- a/ica/win32/winvnc/history.txt
+++ /dev/null
@@ -1,740 +0,0 @@
-WinVNC Version History
-
-	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
-
-
diff --git a/ica/win32/winvnc/libjpeg-turbo-win/jpeglib.h b/ica/win32/winvnc/libjpeg-turbo-win/jpeglib.h
deleted file mode 100644
index 79cdbd1..0000000
--- a/ica/win32/winvnc/libjpeg-turbo-win/jpeglib.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <jpeglib.h>
-
diff --git a/ica/win32/winvnc/lzo/minilzo.h b/ica/win32/winvnc/lzo/minilzo.h
deleted file mode 100644
index e6e472a..0000000
--- a/ica/win32/winvnc/lzo/minilzo.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <minilzo.h>
-
diff --git a/ica/win32/winvnc/omnithread/nt.cpp b/ica/win32/winvnc/omnithread/nt.cpp
deleted file mode 100644
index 5531d5c..0000000
--- a/ica/win32/winvnc/omnithread/nt.cpp
+++ /dev/null
@@ -1,965 +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(&crit);
-}
-
-omni_mutex::~omni_mutex(void)
-{
-    DeleteCriticalSection(&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
-//
-
-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).
-//
-
-static int& count() {
-  static int the_count = 0;
-  return the_count;
-}
-
-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());
-}
-
-omni_thread::init_t::~init_t(void)
-{
-    if (--count() != 0) return;
-
-    omni_thread* self = omni_thread::self();
-    if (!self) return;
-
-    TlsSetValue(self_tls_index, (LPVOID)0);
-    delete self;
-
-    delete next_id_mutex;
-
-    TlsFree(self_tls_index);
-}
-
-//
-// 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;
-
-    _dummy       = 0;
-    _values      = 0;
-    _value_alloc = 0;
-}
-
-
-//
-// Destructor for omni_thread.
-//
-
-omni_thread::~omni_thread(void)
-{
-    DB(cerr << "destructor called for thread " << id() << endl);
-    if (_values) {
-        for (key_t i=0; i < _value_alloc; i++) {
-	    if (_values[i]) {
-	        delete _values[i];
-	    }
-        }
-	delete [] _values;
-    }
-// sf@ - _endthread() that is used for BCC already does a CloseHandle (that's not the case for _endthreadEx())
-// #ifndef __BCPLUSPLUS__
-    if (handle && !CloseHandle(handle))
-	throw omni_thread_fatal(GetLastError());
-// #endif
-    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=0;
-    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. sf@: Excepted for BCC compiler, otherwise -> crash 
-    _endthreadex(0);
-/*
-#else
-    // Borland C++
-    //   _endthread() DOES automatically closes the thread handle. // sf@
-    //   _endthreadex() is only available if __MFC_COMPAT__ is defined and
-    //   all it does is to call _endthread().
-	// sf@ - Actually _endthreadex(0) doesn't cause any pb when compiling with BCC55...
-    _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;
-}
-
-//
-// Dummy thread
-//
-
-class omni_thread_dummy : public omni_thread {
-public:
-  inline omni_thread_dummy() : omni_thread()
-  {
-    _dummy = 1;
-    _state = STATE_RUNNING;
-
-    if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
-			 GetCurrentProcess(), &handle,
-			 0, FALSE, DUPLICATE_SAME_ACCESS))
-      throw omni_thread_fatal(GetLastError());
-
-    nt_id = GetCurrentThreadId();
-
-    if (!TlsSetValue(self_tls_index, (LPVOID)this))
-      throw omni_thread_fatal(GetLastError());
-  }
-  inline ~omni_thread_dummy()
-  {
-    if (!TlsSetValue(self_tls_index, (LPVOID)0))
-      throw omni_thread_fatal(GetLastError());
-  }
-};
-
-omni_thread*
-omni_thread::create_dummy()
-{
-  if (omni_thread::self())
-    throw omni_thread_invalid();
-
-  return new omni_thread_dummy;
-}
-
-void
-omni_thread::release_dummy()
-{
-  omni_thread* self = omni_thread::self();
-  if (!self || !self->_dummy)
-    throw omni_thread_invalid();
-
-  omni_thread_dummy* dummy = (omni_thread_dummy*)self;
-  delete dummy;
-}
-
-
-#if defined(__DMC__) && defined(_WINDLL)
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-  return TRUE;
-}
-#endif
-
-
-#define INSIDE_THREAD_IMPL_CC
-#include "threaddata.cpp"
-#undef INSIDE_THREAD_IMPL_CC
diff --git a/ica/win32/winvnc/omnithread/nt.h b/ica/win32/winvnc/omnithread/nt.h
deleted file mode 100644
index e1ee2ab..0000000
--- a/ica/win32/winvnc/omnithread/nt.h
+++ /dev/null
@@ -1,82 +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_
-
-#ifndef WIN32_LEAN_AND_MEAN
-#  define WIN32_LEAN_AND_MEAN
-#  define OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#ifdef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#  undef WIN32_LEAN_AND_MEAN
-#  undef OMNI_DEFINED_WIN32_LEAN_AND_MEAN
-#endif
-
-
-#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_MUTEX_LOCK_IMPLEMENTATION                  \
-    EnterCriticalSection(&crit);
-
-#define OMNI_MUTEX_UNLOCK_IMPLEMENTATION                \
-    LeaveCriticalSection(&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
diff --git a/ica/win32/winvnc/omnithread/omnithread.h b/ica/win32/winvnc/omnithread/omnithread.h
deleted file mode 100644
index 7454264..0000000
--- a/ica/win32/winvnc/omnithread/omnithread.h
+++ /dev/null
@@ -1,659 +0,0 @@
-// -*- Mode: C++; -*-
-//				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 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(__osf1__)
-#include <omnithread/posix.h>
-
-#elif defined(__aix__)
-#include <omnithread/posix.h>
-
-#elif defined(__hpux__)
-#include <omnithread/posix.h>
-
-#elif defined(__vxWorks__)
-#include <omnithread/VxThread.h>
-
-#elif defined(__WIN32__)
-
-#if defined(__POSIX_NT__)
-#include <omnithread/posix.h>
-#else
-#include "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 UseSolarisThreads
-#include <omnithread/solaris.h>
-#else
-#include <omnithread/posix.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>
-
-#elif defined(__darwin__)
-#include <omnithread/posix.h>
-
-#elif defined(__macos__)
-#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_MUTEX_LOCK_IMPLEMENTATION)   || \
-     !defined(OMNI_MUTEX_UNLOCK_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);
-
-    inline void lock(void)    { OMNI_MUTEX_LOCK_IMPLEMENTATION   }
-    inline void unlock(void)  { OMNI_MUTEX_UNLOCK_IMPLEMENTATION }
-    inline void acquire(void) { lock(); }
-    inline 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&);
-};
-
-
-//adzm 2009-06-21 - only locks/unlocks if conditional is true
-class _OMNITHREAD_NTDLL_ omni_mutex_conditional_lock {
-    omni_mutex& mutex;
-	bool conditional;
-public:
-	omni_mutex_conditional_lock(omni_mutex& m, bool c) : mutex(m), conditional(c) { if (conditional) {mutex.lock();} }
-	~omni_mutex_conditional_lock(void) { if (conditional) {mutex.unlock();} }
-private:
-    // dummy copy constructor and operator= to prevent copying
-    omni_mutex_conditional_lock(const omni_mutex_conditional_lock&);
-    omni_mutex_conditional_lock& operator=(const omni_mutex_conditional_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. (But see create_dummy()
-	// below.)
-
-    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.
-
-
-    // Per-thread data
-    //
-    // These functions allow you to attach additional data to an
-    // omni_thread. First allocate a key for yourself with
-    // allocate_key(). Then you can store any object whose class is
-    // derived from value_t. Any values still stored in the
-    // omni_thread when the thread exits are deleted.
-    //
-    // These functions are NOT thread safe, so you should be very
-    // careful about setting/getting data in a different thread to the
-    // current thread.
-
-    typedef unsigned int key_t;
-    static key_t allocate_key();
-
-    class value_t {
-    public:
-      virtual ~value_t() {}
-    };
-
-    value_t* set_value(key_t k, value_t* v);
-        // Sets a value associated with the given key. The key must
-        // have been allocated with allocate_key(). If a value has
-        // already been set with the specified key, the old value_t
-        // object is deleted and replaced. Returns the value which was
-        // set, or zero if the key is invalid.
-
-    value_t* get_value(key_t k);
-        // Returns the value associated with the key. If the key is
-        // invalid, or there is no value for the key, returns zero.
-
-    value_t* remove_value(key_t k);
-        // Removes the value associated with the key and returns it.
-        // If the key is invalid, or there is no value for the key,
-        // returns zero.
-
-
-    // Dummy omni_thread
-    //
-    // Sometimes, an application finds itself with threads created
-    // outside of omnithread which must interact with omnithread
-    // features such as the per-thread data. In this situation,
-    // omni_thread::self() would normally return 0. These functions
-    // allow the application to create a suitable dummy omni_thread
-    // object.
-
-    static omni_thread* create_dummy(void);
-        // creates a dummy omni_thread for the calling thread. Future
-        // calls to self() will return the dummy omni_thread. Throws
-        // omni_thread_invalid if this thread already has an
-        // associated omni_thread (real or dummy).
-
-    static void release_dummy();
-        // release the dummy omni_thread for this thread. This
-        // function MUST be called before the thread exits. Throws
-        // omni_thread_invalid if the calling thread does not have a
-        // dummy omni_thread.
-
-    // class ensure_self should be created on the stack. If created in
-    // a thread without an associated omni_thread, it creates a dummy
-    // thread which is released when the ensure_self object is deleted.
-
-    class ensure_self {
-    public:
-      inline ensure_self() : _dummy(0)
-      {
-	_self = omni_thread::self();
-	if (!_self) {
-	  _dummy = 1;
-	  _self  = omni_thread::create_dummy();
-	}
-      }
-      inline ~ensure_self()
-      {
-	if (_dummy)
-	  omni_thread::release_dummy();
-      }
-      inline omni_thread* self() { return _self; }
-    private:
-      omni_thread* _self;
-      int          _dummy;
-    };
-
-
-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;
-    int _dummy;
-    value_t**     _values;
-    unsigned long _value_alloc;
-
-    omni_thread(const omni_thread&);
-    omni_thread& operator=(const omni_thread&);
-    // Not implemented
-
-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 {
-    public:
-	init_t(void);
-        ~init_t(void);
-    };
-
-    friend class init_t;
-    friend class omni_thread_dummy;
-
-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
diff --git a/ica/win32/winvnc/omnithread/threaddata.cpp b/ica/win32/winvnc/omnithread/threaddata.cpp
deleted file mode 100644
index 39860e7..0000000
--- a/ica/win32/winvnc/omnithread/threaddata.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//				Package : omnithread
-// omnithread/threaddata.cc	Created : 10/2000 dpg1
-//
-//    Copyright (C) 2000 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 per-thread data
-
-#ifndef INSIDE_THREAD_IMPL_CC
-#error "threaddata.cc must be #included by a thread implementation."
-#endif
-
-
-static omni_thread::key_t allocated_keys = 0;
-
-omni_thread::key_t
-omni_thread::allocate_key()
-{
-  omni_mutex_lock l(*next_id_mutex);
-  return ++allocated_keys;
-}
-
-omni_thread::value_t*
-omni_thread::set_value(key_t k, value_t* v)
-{
-  if (k == 0) return 0;
-  if (k > _value_alloc) {
-    next_id_mutex->lock();
-    key_t alloc = allocated_keys;
-    next_id_mutex->unlock();
-
-    if (k > alloc) return 0;
-
-    value_t** nv = new value_t*[alloc];
-    key_t i = 0;
-    if (_values) {
-      for (; i < _value_alloc; i++)
-	nv[i] = _values[i];
-      delete [] _values;
-    }
-    for (; i < alloc; i++)
-      nv[i] = 0;
-
-    _values = nv;
-    _value_alloc = alloc;
-  }
-  if (_values[k-1]) delete _values[k-1];
-  _values[k-1] = v;
-  return v;
-}
-
-omni_thread::value_t*
-omni_thread::get_value(key_t k)
-{
-  if (k > _value_alloc) return 0;
-  return _values[k-1];
-}
-
-omni_thread::value_t*
-omni_thread::remove_value(key_t k)
-{
-  if (k > _value_alloc) return 0;
-  value_t* v = _values[k-1];
-  _values[k-1] = 0;
-  return v;
-}
diff --git a/ica/win32/winvnc/rfb/zrleEncode.h b/ica/win32/winvnc/rfb/zrleEncode.h
deleted file mode 100644
index f07b8cd..0000000
--- a/ica/win32/winvnc/rfb/zrleEncode.h
+++ /dev/null
@@ -1,352 +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
-
-#ifndef __RFB_CONCAT3E
-#define __RFB_CONCAT3(a,b,c) a##b##c
-#define __RFB_CONCAT3E(a,b,c) __RFB_CONCAT3(a,b,c)
-#endif
-
-#undef END_FIX
-#if ZYWRLE_ENDIAN == ENDIAN_LITTLE
-#  define END_FIX LE
-#elif ZYWRLE_ENDIAN == ENDIAN_BIG
-#  define END_FIX BE
-#else
-#  define END_FIX NE
-#endif
-
-#ifdef CPIXEL
-#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
-#define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,CPIXEL)
-#define ZRLE_ENCODE __RFB_CONCAT3E(zrleEncode,CPIXEL,END_FIX)
-#define ZRLE_ENCODE_TILE __RFB_CONCAT3E(zrleEncodeTile,CPIXEL,END_FIX)
-#define BPPOUT 24
-#elif BPP==15
-#define PIXEL_T __RFB_CONCAT2E(rdr::U,16)
-#define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,16)
-#define ZRLE_ENCODE __RFB_CONCAT3E(zrleEncode,BPP,END_FIX)
-#define ZRLE_ENCODE_TILE __RFB_CONCAT3E(zrleEncodeTile,BPP,END_FIX)
-#define BPPOUT 16
-#else
-#define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP)
-#define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,BPP)
-#define ZRLE_ENCODE __RFB_CONCAT3E(zrleEncode,BPP,END_FIX)
-#define ZRLE_ENCODE_TILE __RFB_CONCAT3E(zrleEncodeTile,BPP,END_FIX)
-#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
-};
-
-int zywrle_level = 1;
-int zywrleBuf[rfbZRLETileWidth*rfbZRLETileHeight];
-
-// 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);
-
-#if BPP!=8
-#define ZYWRLE_ENCODE
-#include <rfb/zywrletemplate.c>
-#endif
-
-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
-
-#if BPP!=8
-  if( (zywrle_level>0)&& !(zywrle_level & 0x80) ){
-	  estimatedBytes >>= zywrle_level;
-  }
-#endif
-
-  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
-
-#if BPP!=8
-      if( (zywrle_level>0)&& !(zywrle_level & 0x80) ){
-		  ZYWRLE_ANALYZE( data, data, w, h, w, zywrle_level, zywrleBuf );
-		  zywrle_level |= 0x80;
-		  ZRLE_ENCODE_TILE( data, w, h, os );
-		  zywrle_level &= 0x7F;
-	  }else
-#endif
-#ifdef CPIXEL
-      for (PIXEL_T* ptr = data; ptr < data+w*h; ptr++) {
-        os->WRITE_PIXEL(*ptr);
-      }
-#else
-      os->writeBytes(data, w*h*(BPPOUT/8));
-#endif
-    }
-  }
-}
-
-#undef PIXEL_T
-#undef WRITE_PIXEL
-#undef ZRLE_ENCODE
-#undef ZRLE_ENCODE_TILE
-#undef BPPOUT
diff --git a/ica/win32/winvnc/rfb/zywrletemplate.c b/ica/win32/winvnc/rfb/zywrletemplate.c
deleted file mode 100644
index 3eadb59..0000000
--- a/ica/win32/winvnc/rfb/zywrletemplate.c
+++ /dev/null
@@ -1,804 +0,0 @@
-
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE 'ZYWRLE' VNC CODEC SOURCE CODE.         *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A FOLLOWING BSD-STYLE SOURCE LICENSE.                *
- * PLEASE READ THESE TERMS BEFORE DISTRIBUTING.                     *
- *                                                                  *
- * THE 'ZYWRLE' VNC CODEC SOURCE CODE IS (C) COPYRIGHT 2006         *
- * BY Hitachi Systems & Services, Ltd.                              *
- * (Noriaki Yamazaki, Research & Developement Center)               *                                                                 *
- *                                                                  *
- ********************************************************************
-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 the Hitachi Systems & Services, Ltd. 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 FOUNDATION
-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.
- ********************************************************************/
-
-//#define ZYWRLE_ENCODE
-//#define ZYWRLE_DECODE
-#define ZYWRLE_QUANTIZE
-
-//[References]
-// PLHarr:
-//   Senecal, J. G., P. Lindstrom, M. A. Duchaineau, and K. I. Joy, "An Improved N-Bit to N-Bit Reversible Haar-Like Transform," Pacific Graphics 2004, October 2004, pp. 371-380.
-// EZW:
-//   Shapiro, JM: Embedded Image Coding Using Zerotrees of Wavelet Coefficients, IEEE Trans. Signal. Process., Vol.41, pp.3445-3462 (1993). 
-
-
-// Template Macro stuffs.
-#undef ZYWRLE_ANALYZE
-#undef ZYWRLE_SYNTHESIZE
-#define ZYWRLE_ANALYZE __RFB_CONCAT3E(zywrleAnalyze,BPP,END_FIX)
-#define ZYWRLE_SYNTHESIZE __RFB_CONCAT3E(zywrleSynthesize,BPP,END_FIX)
-
-#define ZYWRLE_RGBYUV __RFB_CONCAT3E(zywrleRGBYUV,BPP,END_FIX)
-#define ZYWRLE_YUVRGB __RFB_CONCAT3E(zywrleYUVRGB,BPP,END_FIX)
-#define ZYWRLE_YMASK __RFB_CONCAT2E(ZYWRLE_YMASK,BPP)
-#define ZYWRLE_UVMASK __RFB_CONCAT2E(ZYWRLE_UVMASK,BPP)
-#define ZYWRLE_LOAD_PIXEL __RFB_CONCAT2E(ZYWRLE_LOAD_PIXEL,BPP)
-#define ZYWRLE_SAVE_PIXEL __RFB_CONCAT2E(ZYWRLE_SAVE_PIXEL,BPP)
-
-// Packing/Unpacking pixel stuffs.
-//   Endian conversion stuffs.
-#undef S_0
-#undef S_1
-#undef L_0
-#undef L_1
-#undef L_2
-#if ZYWRLE_ENDIAN == ENDIAN_BIG
-#  define S_0	1
-#  define S_1	0
-#  define L_0	3
-#  define L_1	2
-#  define L_2	1
-#else
-#  define S_0	0
-#  define S_1	1
-#  define L_0	0
-#  define L_1	1
-#  define L_2	2
-#endif
-
-//   Load/Save pixel stuffs.
-#define ZYWRLE_YMASK15  0xFFFFFFF8
-#define ZYWRLE_UVMASK15 0xFFFFFFF8
-#define ZYWRLE_LOAD_PIXEL15(pSrc,R,G,B) { \
-	R =  (((unsigned char*)pSrc)[S_1]<< 1)& 0xF8;	\
-	G = ((((unsigned char*)pSrc)[S_1]<< 6)|(((unsigned char*)pSrc)[S_0]>> 2))& 0xF8;	\
-	B =  (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8;	\
-}
-#define ZYWRLE_SAVE_PIXEL15(pDst,R,G,B) { \
-	R &= 0xF8;	\
-	G &= 0xF8;	\
-	B &= 0xF8;	\
-	((unsigned char*)pDst)[S_1] = (unsigned char)( (R>>1)|(G>>6)       );	\
-	((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<2))& 0xFF);	\
-}
-#define ZYWRLE_YMASK16  0xFFFFFFFC
-#define ZYWRLE_UVMASK16 0xFFFFFFF8
-#define ZYWRLE_LOAD_PIXEL16(pSrc,R,G,B) { \
-	R =   ((unsigned char*)pSrc)[S_1]     & 0xF8;	\
-	G = ((((unsigned char*)pSrc)[S_1]<< 5)|(((unsigned char*)pSrc)[S_0]>> 3))& 0xFC;	\
-	B =  (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8;	\
-}
-#define ZYWRLE_SAVE_PIXEL16(pDst,R,G,B) { \
-	R &= 0xF8;	\
-	G &= 0xFC;	\
-	B &= 0xF8;	\
-	((unsigned char*)pDst)[S_1] = (unsigned char)(  R    |(G>>5)       );	\
-	((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<3))& 0xFF);	\
-}
-#define ZYWRLE_YMASK32  0xFFFFFFFF
-#define ZYWRLE_UVMASK32 0xFFFFFFFF
-#define ZYWRLE_LOAD_PIXEL32(pSrc,R,G,B) { \
-	R = ((unsigned char*)pSrc)[L_2];	\
-	G = ((unsigned char*)pSrc)[L_1];	\
-	B = ((unsigned char*)pSrc)[L_0];	\
-}
-#define ZYWRLE_SAVE_PIXEL32(pDst,R,G,B) { \
-	((unsigned char*)pDst)[L_2] = (unsigned char)R;	\
-	((unsigned char*)pDst)[L_1] = (unsigned char)G;	\
-	((unsigned char*)pDst)[L_0] = (unsigned char)B;	\
-}
-
-#ifndef ZYWRLE_ONCE
-#define ZYWRLE_ONCE
-
-#ifdef WIN32
-#define InlineX __inline
-#else
-#define InlineX inline
-#endif
-
-#ifdef ZYWRLE_ENCODE
-// Tables for Coefficients filtering.
-#  ifndef ZYWRLE_QUANTIZE
-// Type A:lower bit omitting of EZW style.
-const static unsigned int zywrleParam[3][3]={
-	{0x0000F000,0x00000000,0x00000000},
-	{0x0000C000,0x00F0F0F0,0x00000000},
-	{0x0000C000,0x00C0C0C0,0x00F0F0F0},
-//	{0x0000FF00,0x00000000,0x00000000},
-//	{0x0000FF00,0x00FFFFFF,0x00000000},
-//	{0x0000FF00,0x00FFFFFF,0x00FFFFFF},
-};
-#  else
-// Type B:Non liner quantization filter.
-static const signed char zywrleConv[4][256]={
-{	// bi=5, bo=5 r=0.0:PSNR=24.849
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-},
-{	// bi=5, bo=5 r=2.0:PSNR=74.031
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 32, 
-	32, 32, 32, 32, 32, 32, 32, 32, 
-	32, 32, 32, 32, 32, 32, 32, 32, 
-	48, 48, 48, 48, 48, 48, 48, 48, 
-	48, 48, 48, 56, 56, 56, 56, 56, 
-	56, 56, 56, 56, 64, 64, 64, 64, 
-	64, 64, 64, 64, 72, 72, 72, 72, 
-	72, 72, 72, 72, 80, 80, 80, 80, 
-	80, 80, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 96, 96, 
-	96, 96, 96, 104, 104, 104, 104, 104, 
-	104, 104, 104, 104, 104, 112, 112, 112, 
-	112, 112, 112, 112, 112, 112, 120, 120, 
-	120, 120, 120, 120, 120, 120, 120, 120, 
-	0, -120, -120, -120, -120, -120, -120, -120, 
-	-120, -120, -120, -112, -112, -112, -112, -112, 
-	-112, -112, -112, -112, -104, -104, -104, -104, 
-	-104, -104, -104, -104, -104, -104, -96, -96, 
-	-96, -96, -96, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -80, 
-	-80, -80, -80, -80, -80, -72, -72, -72, 
-	-72, -72, -72, -72, -72, -64, -64, -64, 
-	-64, -64, -64, -64, -64, -56, -56, -56, 
-	-56, -56, -56, -56, -56, -56, -48, -48, 
-	-48, -48, -48, -48, -48, -48, -48, -48, 
-	-48, -32, -32, -32, -32, -32, -32, -32, 
-	-32, -32, -32, -32, -32, -32, -32, -32, 
-	-32, -32, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-},
-{	// bi=5, bo=4 r=2.0:PSNR=64.441
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	48, 48, 48, 48, 48, 48, 48, 48, 
-	48, 48, 48, 48, 48, 48, 48, 48, 
-	48, 48, 48, 48, 48, 48, 48, 48, 
-	64, 64, 64, 64, 64, 64, 64, 64, 
-	64, 64, 64, 64, 64, 64, 64, 64, 
-	80, 80, 80, 80, 80, 80, 80, 80, 
-	80, 80, 80, 80, 80, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	104, 104, 104, 104, 104, 104, 104, 104, 
-	104, 104, 104, 112, 112, 112, 112, 112, 
-	112, 112, 112, 112, 120, 120, 120, 120, 
-	120, 120, 120, 120, 120, 120, 120, 120, 
-	0, -120, -120, -120, -120, -120, -120, -120, 
-	-120, -120, -120, -120, -120, -112, -112, -112, 
-	-112, -112, -112, -112, -112, -112, -104, -104, 
-	-104, -104, -104, -104, -104, -104, -104, -104, 
-	-104, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -80, -80, -80, -80, 
-	-80, -80, -80, -80, -80, -80, -80, -80, 
-	-80, -64, -64, -64, -64, -64, -64, -64, 
-	-64, -64, -64, -64, -64, -64, -64, -64, 
-	-64, -48, -48, -48, -48, -48, -48, -48, 
-	-48, -48, -48, -48, -48, -48, -48, -48, 
-	-48, -48, -48, -48, -48, -48, -48, -48, 
-	-48, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-},
-{	// bi=5, bo=2 r=2.0:PSNR=43.175
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	88, 88, 88, 88, 88, 88, 88, 88, 
-	0, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, -88, -88, -88, -88, -88, -88, -88, 
-	-88, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-	0, 0, 0, 0, 0, 0, 0, 0, 
-}
-};
-const static signed char* zywrleParam[3][3][3]={
-	{{zywrleConv[0],zywrleConv[2],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
-	{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
-	{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[2],zywrleConv[2],zywrleConv[2]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]}},
-};
-#  endif
-#endif
-
-static InlineX void Harr( signed char* pX0, signed char* pX1 ){
-	// Piecewise-Linear Harr(PLHarr)
-	int X0=(int)*pX0, X1=(int)*pX1;
-	int orgX0=X0, orgX1=X1;
-	if( (X0^X1)&0x80 ){
-		// differ sign
-		X1 += X0;
-		if( ((X1^orgX1)&0x80)==0 ){
-			// |X1| > |X0|
-			X0 -= X1;	// H = -B
-		}
-	}else{
-		// same sign
-		X0 -= X1;
-		if( ((X0^orgX0)&0x80)==0 ){
-			// |X0| > |X1|
-			X1 += X0;	// L = A
-		}
-	}
-	*pX0 = (signed char)X1;
-	*pX1 = (signed char)X0;
-}
-// 1D-Wavelet transform.
-//
-// In coefficients array, the famous 'pyramid' decomposition is well used.
-//
-// 1D Model:
-//   |L0L0L0L0|L0L0L0L0|H0H0H0H0|H0H0H0H0| : level 0
-//   |L1L1L1L1|H1H1H1H1|H0H0H0H0|H0H0H0H0| : level 1
-//
-// But this method needs line buffer because H/L is different position from X0/X1.
-// So, I used 'interleave' decomposition instead of it.
-//
-// 1D Model:
-//   |L0H0L0H0|L0H0L0H0|L0H0L0H0|L0H0L0H0| : level 0
-//   |L1H0H1H0|L1H0H1H0|L1H0H1H0|L1H0H1H0| : level 1
-//
-// In this method, H/L and X0/X1 is always same position.
-// This lead us to more speed and less memory.
-// Of cause, the result of both method is quite same
-// because it's only difference that coefficient position.
-
-static InlineX void WaveletLevel( int* data, int size, int l, int SkipPixel ){
-	int s, ofs;
-	signed char* pX0;
-	signed char* end;
-
-	pX0 = (signed char*)data;
-	s = (8<<l)*SkipPixel;
-	end = pX0+(size>>(l+1))*s;
-	s -= 2;
-	ofs = (4<<l)*SkipPixel;
-	while( pX0 < end ){
-		Harr( pX0, pX0+ofs );
-		pX0++;
-		Harr( pX0, pX0+ofs );
-		pX0++;
-		Harr( pX0, pX0+ofs );
-		pX0 += s;
-	}
-}
-#define InvWaveletLevel(d,s,l,pix) WaveletLevel(d,s,l,pix)
-
-#ifdef ZYWRLE_ENCODE
-#  ifndef ZYWRLE_QUANTIZE
-// Type A:lower bit omitting of EZW style.
-static InlineX void FilterWaveletSquare( int* pBuf, int width, int height, int level, int l ){
-	int r, s;
-	int x, y;
-	int* pH;
-	const unsigned int* pM;
-
-	pM = &(zywrleParam[level-1][l]);
-	s = 2<<l;
-	for( r=1; r<4; r++ ){
-		pH   = pBuf;
-		if( r & 0x01 ){
-			pH +=  s>>1;
-		}
-		if( r & 0x02 ){
-			pH += (s>>1)*width;
-		}
-		for( y=0; y<height/s; y++ ){
-			for( x=0; x<width/s; x++ ){
-				// these are same following code.
-				//     pH[x] = pH[x] / (~pM[x]+1) * (~pM[x]+1);
-				//     ( round pH[x] with pM[x] bit )
-				// '&' operator isn't 'round' but is 'floor'.
-				// So, we must offset when pH[x] is negative.
-				if( ((signed char*)pH)[0] & 0x80 ){
-					((signed char*)pH)[0] += ~((signed char*)pM)[0];
-				}
-				if( ((signed char*)pH)[1] & 0x80 ){
-					((signed char*)pH)[1] += ~((signed char*)pM)[1];
-				}
-				if( ((signed char*)pH)[2] & 0x80 ){
-					((signed char*)pH)[2] += ~((signed char*)pM)[2];
-				}
-				*pH &= *pM;
-				pH += s;
-			}
-			pH += (s-1)*width;
-		}
-	}
-}
-#  else
-// Type B:Non liner quantization filter.
-//
-// Coefficients have Gaussian curve and smaller value which is 
-// large part of coefficients isn't more important than larger value.
-// So, I use filter of Non liner quantize/dequantize table.
-// In general, Non liner quantize formula is explained as following.
-//
-//    y=f(x)   = sign(x)*round( ((abs(x)/(2^7))^ r   )* 2^(bo-1) )*2^(8-bo)
-//    x=f-1(y) = sign(y)*round( ((abs(y)/(2^7))^(1/r))* 2^(bi-1) )*2^(8-bi)
-// ( r:power coefficient  bi:effective MSB in input  bo:effective MSB in output )
-//
-//   r < 1.0 : Smaller value is more important than larger value.
-//   r > 1.0 : Larger value is more important than smaller value.
-//   r = 1.0 : Liner quantization which is same with EZW style.
-//
-// r = 0.75 is famous non liner quantization used in MP3 audio codec.
-// In contrast to audio data, larger value is important in wavelet coefficients.
-// So, I select r = 2.0 table( quantize is x^2, dequantize sqrt(x) ).
-//
-// As compared with EZW style liner quantization, this filter tended to be 
-// more sharp edge and be more compression rate but be more blocking noise and be less quality.
-// Especially, the surface of graphic objects has distinguishable noise in middle quality mode.
-//
-// We need only quantized-dequantized(filtered) value rather than quantized value itself
-// because all values are packed or palette-lized in later ZRLE section.
-// This lead us not to need to modify client decoder when we change
-// the filtering procedure in future.
-// Client only decodes coefficients given by encoder.
-static InlineX void FilterWaveletSquare( int* pBuf, int width, int height, int level, int l ){
-	int r, s;
-	int x, y;
-	int* pH;
-	const signed char** pM;
-
-	pM = zywrleParam[level-1][l];
-	s = 2<<l;
-	for( r=1; r<4; r++ ){
-		pH   = pBuf;
-		if( r & 0x01 ){
-			pH +=  s>>1;
-		}
-		if( r & 0x02 ){
-			pH += (s>>1)*width;
-		}
-		for( y=0; y<height/s; y++ ){
-			for( x=0; x<width/s; x++ ){
-				((signed char*)pH)[0] = pM[0][((unsigned char*)pH)[0]];
-				((signed char*)pH)[1] = pM[1][((unsigned char*)pH)[1]];
-				((signed char*)pH)[2] = pM[2][((unsigned char*)pH)[2]];
-				pH += s;
-			}
-			pH += (s-1)*width;
-		}
-	}
-}
-#  endif
-
-static InlineX void Wavelet( int* pBuf, int width, int height, int level ){
-	int l, s;
-	int* pTop;
-	int* pEnd;
-
-	for( l=0; l<level; l++ ){
-		pTop = pBuf;
-		pEnd = pBuf+height*width;
-		s = width<<l;
-		while( pTop < pEnd ){
-			WaveletLevel( pTop, width, l, 1 );
-			pTop += s;
-		}
-		pTop = pBuf;
-		pEnd = pBuf+width;
-		s = 1<<l;
-		while( pTop < pEnd ){
-			WaveletLevel( pTop, height,l, width );
-			pTop += s;
-		}
-		FilterWaveletSquare( pBuf, width, height, level, l );
-	}
-}
-#endif
-#ifdef ZYWRLE_DECODE
-static InlineX void InvWavelet( int* pBuf, int width, int height, int level ){
-	int l, s;
-	int* pTop;
-	int* pEnd;
-
-	for( l=level-1; l>=0; l-- ){
-		pTop = pBuf;
-		pEnd = pBuf+width;
-		s = 1<<l;
-		while( pTop < pEnd ){
-			InvWaveletLevel( pTop, height,l, width );
-			pTop += s;
-		}
-		pTop = pBuf;
-		pEnd = pBuf+height*width;
-		s = width<<l;
-		while( pTop < pEnd ){
-			InvWaveletLevel( pTop, width, l, 1 );
-			pTop += s;
-		}
-	}
-}
-#endif
-
-// Load/Save coefficients stuffs.
-// Coefficients manages as 24 bits little-endian pixel.
-#define ZYWRLE_LOAD_COEFF(pSrc,R,G,B) { \
-	R = ((signed char*)pSrc)[2];	\
-	G = ((signed char*)pSrc)[1];	\
-	B = ((signed char*)pSrc)[0];	\
-}
-#define ZYWRLE_SAVE_COEFF(pDst,R,G,B) { \
-	((signed char*)pDst)[2] = (signed char)R;	\
-	((signed char*)pDst)[1] = (signed char)G;	\
-	((signed char*)pDst)[0] = (signed char)B;	\
-}
-
-// RGB <=> YUV conversion stuffs.
-// YUV coversion is explained as following formula in strict meaning:
-//   Y =  0.299R + 0.587G + 0.114B (   0<=Y<=255)
-//   U = -0.169R - 0.331G + 0.500B (-128<=U<=127)
-//   V =  0.500R - 0.419G - 0.081B (-128<=V<=127)
-// 
-// I use simple conversion RCT(reversible color transform) which is described 
-// in JPEG-2000 specification.
-//   Y = (R + 2G + B)/4 (   0<=Y<=255)
-//   U = B-G (-256<=U<=255)
-//   V = R-G (-256<=V<=255)
-
-#define ROUND(x) (((x)<0)?0:(((x)>255)?255:(x)))
-	// RCT is N-bit RGB to N-bit Y and N+1-bit UV.
-	// For make Same N-bit, UV is lossy.
-	// More exact PLHarr, we reduce to odd range(-127<=x<=127).
-#define ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ymask,uvmask) { \
-	Y = (R+(G<<1)+B)>>2;	\
-	U =  B-G;	\
-	V =  R-G;	\
-	Y -= 128;	\
-	U >>= 1;	\
-	V >>= 1;	\
-	Y &= ymask;	\
-	U &= uvmask;	\
-	V &= uvmask;	\
-	if( Y == -128 ){	\
-		Y += (0xFFFFFFFF-ymask+1);	\
-	}	\
-	if( U == -128 ){	\
-		U += (0xFFFFFFFF-uvmask+1);	\
-	}	\
-	if( V == -128 ){	\
-		V += (0xFFFFFFFF-uvmask+1);	\
-	}	\
-}
-#define ZYWRLE_YUVRGB1(R,G,B,Y,U,V) { \
-	Y += 128;	\
-	U <<= 1;	\
-	V <<= 1;	\
-	G = Y-((U+V)>>2);	\
-	B = U+G;	\
-	R = V+G;	\
-	G = ROUND(G);	\
-	B = ROUND(B);	\
-	R = ROUND(R);	\
-}
-
-// coefficient packing/unpacking stuffs.
-// Wavelet transform makes 4 sub coefficient image from 1 original image.
-//
-// model with pyramid decomposition:
-//   +------+------+
-//   |      |      |
-//   |  L   |  Hx  |
-//   |      |      |
-//   +------+------+
-//   |      |      |
-//   |  H   |  Hxy |
-//   |      |      |
-//   +------+------+
-//
-// So, we must transfer each sub images individually in strict meaning.
-// But at least ZRLE meaning, following one decompositon image is same as
-// avobe individual sub image. I use this format.
-// (Strictly saying, transfer order is reverse(Hxy->Hy->Hx->L)
-//  for simplified procedure for any wavelet level.)
-//
-//   +------+------+
-//   |      L      |
-//   +------+------+
-//   |      Hx     |
-//   +------+------+
-//   |      Hy     |
-//   +------+------+
-//   |      Hxy    |
-//   +------+------+
-
-#define ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,level,TRANS)	\
-	pH = pBuf;	\
-	s = 2<<level;	\
-	if( r & 0x01 ){	\
-		pH +=  s>>1;	\
-	}	\
-	if( r & 0x02 ){	\
-		pH += (s>>1)*width;	\
-	}	\
-	pEnd = pH+height*width;	\
-	while( pH < pEnd ){	\
-		pLine = pH+width;	\
-		while( pH < pLine ){	\
-			TRANS	\
-			data++;	\
-			pH += s;	\
-		}	\
-		pH += (s-1)*width;	\
-	}
-
-#define ZYWRLE_PACK_COEFF(pBuf,data,r,width,height,level)	\
-	ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,level,ZYWRLE_LOAD_COEFF(pH,R,G,B);ZYWRLE_SAVE_PIXEL(data,R,G,B);)
-
-#define ZYWRLE_UNPACK_COEFF(pBuf,data,r,width,height,level)	\
-	ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,level,ZYWRLE_LOAD_PIXEL(data,R,G,B);ZYWRLE_SAVE_COEFF(pH,R,G,B);)
-
-#define ZYWRLE_SAVE_UNALIGN(data,TRANS)	\
-	pTop = pBuf+w*h;	\
-	pEnd = pTop + (w+uw)*(h+uh)-w*h;	\
-	while( pTop < pEnd ){	\
-		TRANS	\
-		data++;	\
-		pTop++;	\
-	}
-
-#define ZYWRLE_LOAD_UNALIGN(data,pData,TRANS)	\
-	pTop = pBuf+w*h;	\
-	if( uw ){	\
-		pData=         data + w;	\
-		pEnd = (int*)(pData+ h*scanline);	\
-		while( pData < (PIXEL_T*)pEnd ){	\
-			pLine = (int*)(pData + uw);	\
-			while( pData < (PIXEL_T*)pLine ){	\
-				TRANS	\
-				pData++;	\
-				pTop++;	\
-			}	\
-			pData += scanline-uw;	\
-		}	\
-	}	\
-	if( uh ){	\
-		pData=         data +  h*scanline;	\
-		pEnd = (int*)(pData+ uh*scanline);	\
-		while( pData < (PIXEL_T*)pEnd ){	\
-			pLine = (int*)(pData + w);	\
-			while( pData < (PIXEL_T*)pLine ){	\
-				TRANS	\
-				pData++;	\
-				pTop++;	\
-			}	\
-			pData += scanline-w;	\
-		}	\
-	}	\
-	if( uw && uh ){	\
-		pData=         data + w+ h*scanline;	\
-		pEnd = (int*)(pData+   uh*scanline);	\
-		while( pData < (PIXEL_T*)pEnd ){	\
-			pLine = (int*)(pData + uw);	\
-			while( pData < (PIXEL_T*)pLine ){	\
-				TRANS	\
-				pData++;	\
-				pTop++;	\
-			}	\
-			pData += scanline-uw;	\
-		}	\
-	}
-
-static InlineX void zywrleCalcSize( int* pW, int* pH, int level ){
-	*pW &= ~((1<<level)-1);
-	*pH &= ~((1<<level)-1);
-}
-
-#endif // ZYWRLE_ONCE
-
-#ifndef CPIXEL
-#ifdef ZYWRLE_ENCODE
-static InlineX void ZYWRLE_RGBYUV( int* pBuf, PIXEL_T* data, int width, int height, int scanline ){
-	int R, G, B;
-	int Y, U, V;
-	int* pLine;
-	int* pEnd;
-	pEnd = pBuf+height*width;
-	while( pBuf < pEnd ){
-		pLine = pBuf+width;
-		while( pBuf < pLine ){
-			ZYWRLE_LOAD_PIXEL(data,R,G,B);
-			ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ZYWRLE_YMASK,ZYWRLE_UVMASK);
-			ZYWRLE_SAVE_COEFF(pBuf,V,Y,U);
-			pBuf++;
-			data++;
-		}
-		data += scanline-width;
-	}
-}
-#endif
-#ifdef ZYWRLE_DECODE
-static InlineX void ZYWRLE_YUVRGB( int* pBuf, PIXEL_T* data, int width, int height, int scanline ){
-	int R, G, B;
-	int Y, U, V;
-	int* pLine;
-	int* pEnd;
-	pEnd = pBuf+height*width;
-	while( pBuf < pEnd ){
-		pLine = pBuf+width;
-		while( pBuf < pLine ){
-			ZYWRLE_LOAD_COEFF(pBuf,V,Y,U);
-			ZYWRLE_YUVRGB1(R,G,B,Y,U,V);
-			ZYWRLE_SAVE_PIXEL(data,R,G,B);
-			pBuf++;
-			data++;
-		}
-		data += scanline-width;
-	}
-}
-#endif
-
-#ifdef ZYWRLE_ENCODE
-PIXEL_T* ZYWRLE_ANALYZE ( PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf ){
-	int l;
-	int uw = w;
-	int uh = h;
-	int* pTop;
-	int* pEnd;
-	int* pLine;
-	PIXEL_T* pSrc;
-	int R, G, B;
-	int s;
-	int* pH;
-
-	zywrleCalcSize( &w, &h, level );
-	if( (w==0)||(h==0) ){
-		return NULL;
-	}
-	uw -= w;
-	uh -= h;
-
-	ZYWRLE_LOAD_UNALIGN(src,pSrc,*(PIXEL_T*)pTop=*pSrc;)
-	ZYWRLE_RGBYUV( pBuf, src, w, h, scanline );
-	Wavelet( pBuf, w, h, level );
-	for( l=0; l<level; l++ ){
-		ZYWRLE_PACK_COEFF( pBuf, dst, 3, w, h, l );
-		ZYWRLE_PACK_COEFF( pBuf, dst, 2, w, h, l );
-		ZYWRLE_PACK_COEFF( pBuf, dst, 1, w, h, l );
-		if( l == level-1 ){
-			ZYWRLE_PACK_COEFF( pBuf, dst, 0, w, h, l );
-		}
-	}
-	ZYWRLE_SAVE_UNALIGN(dst,*dst=*(PIXEL_T*)pTop;)
-	return dst;
-}
-#endif
-#ifdef ZYWRLE_DECODE
-PIXEL_T* ZYWRLE_SYNTHESIZE ( PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf ){
-	int l;
-	int uw = w;
-	int uh = h;
-	int* pTop;
-	int* pEnd;
-	int* pLine;
-	PIXEL_T* pDst;
-	int R, G, B;
-	int s;
-	int* pH;
-
-	zywrleCalcSize( &w, &h, level );
-	if( (w==0)||(h==0) ){
-		return NULL;
-	}
-	uw -= w;
-	uh -= h;
-
-	for( l=0; l<level; l++ ){
-		ZYWRLE_UNPACK_COEFF( pBuf, src, 3, w, h, l );
-		ZYWRLE_UNPACK_COEFF( pBuf, src, 2, w, h, l );
-		ZYWRLE_UNPACK_COEFF( pBuf, src, 1, w, h, l );
-		if( l == level-1 ){
-			ZYWRLE_UNPACK_COEFF( pBuf, src, 0, w, h, l );
-		}
-	}
-	ZYWRLE_SAVE_UNALIGN(src,*(PIXEL_T*)pTop=*src;)
-	InvWavelet( pBuf, w, h, level );
-	ZYWRLE_YUVRGB( pBuf, dst, w, h, scanline );
-	ZYWRLE_LOAD_UNALIGN(dst,pDst,*pDst=*(PIXEL_T*)pTop;)
-	return src;
-}
-#endif
-#endif  // CPIXEL
-
-#undef ZYWRLE_RGBYUV
-#undef ZYWRLE_YUVRGB
-#undef ZYWRLE_LOAD_PIXEL
-#undef ZYWRLE_SAVE_PIXEL
diff --git a/ica/win32/winvnc/vnchooks/Makefile.bcc32 b/ica/win32/winvnc/vnchooks/Makefile.bcc32
deleted file mode 100644
index 72227c8..0000000
--- a/ica/win32/winvnc/vnchooks/Makefile.bcc32
+++ /dev/null
@@ -1,9 +0,0 @@
-CFLAGS=-v- -O2 -3 -tWD -xd- -q -w-8057 -w-8027
-
-VNCHooks.lib: VNCHooks.dll
-	implib.exe VNCHooks.lib VNCHooks.dll
-
-VNCHooks.dll: VNCHooks.cpp SharedData.cpp VNCHooks.h SharedData.h
-	copy /b VNCHooks-bcc32.def VNCHooks.def
-	bcc32.exe $(CFLAGS) VNCHooks.cpp SharedData.cpp
-	copy /b VNCHooks-vc.def VNCHooks.def
diff --git a/ica/win32/winvnc/vnchooks/SharedData.cpp b/ica/win32/winvnc/vnchooks/SharedData.cpp
deleted file mode 100644
index 48a5a0e..0000000
--- a/ica/win32/winvnc/vnchooks/SharedData.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//  Copyright (C) 2001 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
-//
-//  This file is part of the VNC system.
-//
-//  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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-
-// SharedData.cpp : Storage for the global data in the DLL
-// This file is used only when your compiler is Borland C++.
-
-// Change default data segment and data class names
-#ifndef __GNUC__
-#pragma option -zRSHSEG
-#pragma option -zTSHCLASS
-#endif
-
-#include "windows.h"
-
-DWORD vnc_thread_id = 0;
-UINT UpdateRectMessage = 0;
-UINT CopyRectMessage = 0;
-UINT MouseMoveMessage = 0;
-HHOOK hCallWndHook = NULL;							// Handle to the CallWnd hook
-HHOOK hGetMsgHook = NULL;							// Handle to the GetMsg hook
-HHOOK hDialogMsgHook = NULL;						// Handle to the DialogMsg hook
-HHOOK hLLKeyboardHook = NULL;						// Handle to LowLevel kbd hook
-HHOOK hLLMouseHook = NULL;							// Handle to LowLevel mouse hook
diff --git a/ica/win32/winvnc/vnchooks/SharedData.h b/ica/win32/winvnc/vnchooks/SharedData.h
deleted file mode 100644
index c90acc1..0000000
--- a/ica/win32/winvnc/vnchooks/SharedData.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//  Copyright (C) 2001 Const Kaplinsky. All Rights Reserved.
-//
-//  This file is part of the VNC system.
-//
-//  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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-
-// SharedData.h : Declarations for the global data in the DLL
-// This file is used only when your compiler is Borland C++.
-
-extern DWORD vnc_thread_id;
-extern UINT UpdateRectMessage;
-extern UINT CopyRectMessage;
-extern UINT MouseMoveMessage;
-extern HHOOK hCallWndHook;
-extern HHOOK hGetMsgHook;
-extern HHOOK hDialogMsgHook;
-extern HHOOK hLLKeyboardHook;
-extern HHOOK hLLMouseHook;
diff --git a/ica/win32/winvnc/vnchooks/VNCHooks-bcc32.def b/ica/win32/winvnc/vnchooks/VNCHooks-bcc32.def
deleted file mode 100644
index 65f9727..0000000
--- a/ica/win32/winvnc/vnchooks/VNCHooks-bcc32.def
+++ /dev/null
@@ -1,7 +0,0 @@
-; VNCHooks.def : Declares the module parameters for the DLL.
-
-LIBRARY      "VNCHooks"
-DESCRIPTION  'WinVNC 3.0 Hook Library'
-
-SEGMENTS
-	SHSEG CLASS 'SHCLASS' SHARED
diff --git a/ica/win32/winvnc/vnchooks/VNCHooks-vc.def b/ica/win32/winvnc/vnchooks/VNCHooks-vc.def
deleted file mode 100644
index efd1154..0000000
--- a/ica/win32/winvnc/vnchooks/VNCHooks-vc.def
+++ /dev/null
@@ -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
diff --git a/ica/win32/winvnc/vnchooks/VNCHooks.cpp b/ica/win32/winvnc/vnchooks/VNCHooks.cpp
deleted file mode 100644
index abbd363..0000000
--- a/ica/win32/winvnc/vnchooks/VNCHooks.cpp
+++ /dev/null
@@ -1,1180 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-// VNC update hook implementation.
-//
-
-#include "VNCHooks.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <crtdbg.h>
-
-/////////////////////////////////////////////////////////////////////////////
-// Storage for the global data in the DLL
-
-// MSVC is bugged - if a default value is missed off from one of the following
-// variables then that variable is process-specific for some reason!
-
-/////////////////////////////////////////////////////////////////////////////
-// Storage for the global data in the DLL
-// Note: For Borland C++ compilers, this data segment is defined in a
-//       separate file, SharedData.cpp.
-
-#ifdef _MSC_VER
-
-// MSVC is bugged - if a default value is missed off from one of the following
-// variables then that variable is process-specific for some reason!
-
-#pragma data_seg(".SharedData")
-DWORD vnc_thread_id = 0;
-UINT UpdateRectMessage = 0;
-UINT CopyRectMessage = 0;
-UINT MouseMoveMessage = 0;
-HHOOK hCallWndHook = NULL;							// Handle to the CallWnd hook
-HHOOK hGetMsgHook = NULL;							// Handle to the GetMsg hook
-HHOOK hDialogMsgHook = NULL;						// Handle to the DialogMsg hook
-HHOOK hLLKeyboardHook = NULL;						// Handle to LowLevel kbd hook
-HHOOK hLLMouseHook = NULL;							// Handle to LowLevel mouse hook
-#pragma data_seg( )
-
-
-#else
-
-#include "SharedData.h"
-
-
-#endif // _MSC_VER
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Per-instance DLL variables
-
-const char sPrefSegment[] = "Application_Prefs";
-char *sModulePrefs = NULL;							// Name of the module that created us
-BOOL prf_use_GetUpdateRect = FALSE;					// Use the GetUpdateRect paint mode
-BOOL prf_use_Timer = FALSE;							// Use Timer events to trigger updates
-BOOL prf_use_KeyPress = FALSE;						// Use keyboard events
-BOOL prf_use_LButtonUp = TRUE;						// Use left mouse button up events
-BOOL prf_use_MButtonUp = FALSE;						// Use middle mouse button up events
-BOOL prf_use_RButtonUp = FALSE;						// Use right mouse button up events
-BOOL prf_use_Deferral = FALSE;						// Use deferred updates
-
-HINSTANCE hInstance = NULL;							// This instance of the DLL
-BOOL HookMaster = FALSE;							// Is this instance WinVNC itself?
-
-BOOL appHookedOK = FALSE;							// Did InitInstance succeed?
-
-HICON old_cursor = NULL;							// Current Cursor icon handle
-
-BOOL m_ddihook;
-
-/////////////////////////////////////////////////////////////////////////////
-// Registered messages & atoms to be used by VNCHooks.DLL
-
-// Messages
-const UINT VNC_DEFERRED_UPDATE = RegisterWindowMessage("VNCHooks.Deferred.UpdateMessage");
-
-// Atoms
-const char *VNC_POPUPSELN_ATOMNAME = "VNCHooks.PopUpMenu.Selected";
-ATOM VNC_POPUPSELN_ATOM = INVALID_ATOM;
-
-/////////////////////////////////////////////////////////////////////////////
-// The DLL functions
-
-// Forward definition of hook procedures
-
-BOOL HookHandle(UINT msg, HWND hWnd, WPARAM wParam, LPARAM lParam);
-LRESULT CALLBACK CallWndProc (int nCode, WPARAM wParam, LPARAM lParam);
-LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam);
-LRESULT CALLBACK DialogMessageProc(int nCode, WPARAM wParam, LPARAM lParam);
-LRESULT CALLBACK LowLevelKeyboardFilterProc(int nCode, WPARAM wParam, LPARAM lParam);
-LRESULT CALLBACK LowLevelMouseFilterProc(int nCode, WPARAM wParam, LPARAM lParam);
-
-// Forward definition of setup and shutdown procedures
-BOOL InitInstance();
-BOOL ExitInstance();
-
-// The DLL's main procedure
-extern "C" BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
-{
-	// Find out why we're being called
-	switch (ul_reason_for_call)
-	{
-
-	case DLL_PROCESS_ATTACH:
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : Hook DLL loaded\n");
-#endif
-
-		// Save the instance handle
-		hInstance = (HINSTANCE)hInst;
-
-		// Call the initialisation function
-		appHookedOK = InitInstance();
-
-		// ALWAYS return TRUE to avoid breaking unhookable applications!!!
-		return TRUE;
-
-	case DLL_PROCESS_DETACH:
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : Hook DLL unloaded\n");
-#endif
-		
-		// Call the exit function
-		// If the app failed to hook OK, ExitInstance will still operate OK (hopefully...)
-		ExitInstance();
-
-		return TRUE;
-
-	default:
-		return TRUE;
-	}
-}
-
-// Function used to find out whether VNCHooks uses "reliable" or "hint" hooks
-// Currently is always zero to indicate unreliable, hint hooks.
-DllExport DWORD HooksType()
-{
-	// Unreliable "hint" hooks
-	return 0;
-}
-
-// Add the new hook
-
-DllExport BOOL SetHooks(DWORD thread_id, UINT UpdateMsg, UINT CopyMsg, UINT MouseMsg,BOOL ddihook)
-{
-
-	// Don't add the hook if the thread id is NULL
-	if (!thread_id)
-		return FALSE;
-	m_ddihook=ddihook;
-	
-	// Don't add a hook if there is already one added
-	if (vnc_thread_id)
-		return FALSE;
-	// Add the CallWnd hook
-	hCallWndHook = SetWindowsHookEx(
-					WH_CALLWNDPROC,					// Hook in before msg reaches app
-					(HOOKPROC) CallWndProc,			// Hook procedure
-					hInstance,						// This DLL instance
-					0L								// Hook in to all apps
-//					GetCurrentThreadId()			// DEBUG : HOOK ONLY WinVNC
-					);
-
-	// Add the GetMessage hook
-	hGetMsgHook = SetWindowsHookEx(
-					WH_GETMESSAGE,					// Hook in before msg reaches app
-					(HOOKPROC) GetMessageProc,			// Hook procedure
-					hInstance,						// This DLL instance
-					0L								// Hook in to all apps
-//					GetCurrentThreadId()			// DEBUG : HOOK ONLY WinVNC
-					);
-
-		// Add the GetMessage hook
-	hDialogMsgHook = SetWindowsHookEx(
-					WH_SYSMSGFILTER,				// Hook in dialogs, menus and scrollbars
-					(HOOKPROC) DialogMessageProc,	// Hook procedure
-					hInstance,						// This DLL instance
-					0L								// Hook in to all apps
-					);
-
-	// Check that it worked
-	if ((hCallWndHook != NULL) && (hGetMsgHook != NULL) && (hDialogMsgHook != NULL))
-	{
-		vnc_thread_id = thread_id;			// Save the WinVNC thread id
-		UpdateRectMessage = UpdateMsg;		// Save the message ID to use for rectangle updates
-		CopyRectMessage = CopyMsg;			// Save the message ID to use for copyrect
-		MouseMoveMessage = MouseMsg;		// Save the message ID to send when mouse moves
-		HookMaster = TRUE;					// Set the HookMaster flag for this instance
-		return TRUE;
-	}
-	else
-	{
-		// Stop the keyboard hook
-		SetKeyboardFilterHook(FALSE);
-		SetMouseFilterHook(FALSE);
-
-		// Kill the main hooks
-		if (hCallWndHook != NULL)
-			UnhookWindowsHookEx(hCallWndHook);
-		if (hGetMsgHook != NULL)
-			UnhookWindowsHookEx(hGetMsgHook);
-		if (hDialogMsgHook != NULL)
-			UnhookWindowsHookEx(hDialogMsgHook);
-		hCallWndHook = NULL;
-		hGetMsgHook = NULL;
-		hDialogMsgHook = NULL;
-	}
-	if (ddihook)
-	{
-		if (hCallWndHook != NULL)
-			UnhookWindowsHookEx(hCallWndHook);
-		if (hDialogMsgHook != NULL)
-			UnhookWindowsHookEx(hDialogMsgHook);
-		hCallWndHook = NULL;
-		hDialogMsgHook = NULL;
-	}
-	// The hook failed, so return an error code
-	return FALSE;
-
-}
-
-// EnumWindows procedure to remove the extra property we added
-
-BOOL CALLBACK
-KillPropsProc(HWND hwnd, LPARAM lParam)
-{
-	// Remove our custom property...
-	RemoveProp(hwnd, (LPCTSTR) MAKELONG(VNC_POPUPSELN_ATOM, 0));
-	return TRUE;
-}
-
-// Remove the hook from the system
-
-DllExport BOOL UnSetHooks(DWORD thread_id)
-{
-
-	BOOL unHooked = TRUE;
-	
-	// Remove the extra property value from all local windows
-	EnumWindows((WNDENUMPROC) &KillPropsProc, 0);
-
-	// Stop the keyboard & mouse hooks
-	unHooked = unHooked && SetKeyboardFilterHook(FALSE);
-	unHooked = unHooked && SetMouseFilterHook(FALSE);
-
-	// Is the window handle valid?
-	if (thread_id != vnc_thread_id)
-		return FALSE;
-
-	// Unhook the procs
-	if (hCallWndHook != NULL)
-	{
-		unHooked = unHooked && UnhookWindowsHookEx(hCallWndHook);
-		hCallWndHook = NULL;
-	}
-
-	if (hGetMsgHook != NULL)
-	{
-		unHooked = unHooked && UnhookWindowsHookEx(hGetMsgHook);
-		hGetMsgHook = NULL;
-	}
-
-	if (hDialogMsgHook != NULL)
-	{
-		unHooked = unHooked && UnhookWindowsHookEx(hDialogMsgHook);
-		hDialogMsgHook = NULL;
-	}
-
-	// If we managed to unhook then reset
-	if (unHooked)
-	{
-		vnc_thread_id = 0;
-		HookMaster = FALSE;
-	}
-
-	return unHooked;
-
-}
-
-// Routine to start and stop local keyboard message filtering
-DllExport BOOL SetKeyboardFilterHook(BOOL activate)
-{
-	if (activate)
-	{
-#ifdef WH_KEYBOARD_LL
-		if (hLLKeyboardHook == NULL)
-		{
-			// Start up the hook...
-			hLLKeyboardHook = SetWindowsHookEx(
-					WH_KEYBOARD_LL,					// Hook in before msg reaches app
-					(HOOKPROC) LowLevelKeyboardFilterProc,			// Hook procedure
-					hInstance,						// This DLL instance
-					0L								// Hook in to all apps
-					);
-			if (hLLKeyboardHook == NULL)
-				return FALSE;
-		}
-		return TRUE;
-#else
-#pragma message("warning:Low-Level Keyboard hook code omitted.")
-		return FALSE;
-#endif
-	} else {
-		if (hLLKeyboardHook != NULL)
-		{
-			// Stop the hook...
-			if (!UnhookWindowsHookEx(hLLKeyboardHook))
-				return FALSE;
-			hLLKeyboardHook = NULL;
-		}
-		return TRUE;
-	}
-}
-
-// Routine to start and stop local mouse message filtering
-DllExport BOOL SetMouseFilterHook(BOOL activate)
-{
-	if (activate)
-	{
-#ifdef WH_MOUSE_LL
-		if (hLLMouseHook == NULL)
-		{
-			// Start up the hook...
-			hLLMouseHook = SetWindowsHookEx(
-					WH_MOUSE_LL,					// Hook in before msg reaches app
-					(HOOKPROC) LowLevelMouseFilterProc,			// Hook procedure
-					hInstance,						// This DLL instance
-					0L								// Hook in to all apps
-					);
-			if (hLLMouseHook == NULL)
-				return FALSE;
-		}
-		return TRUE;
-#else
-#pragma message("warning:Low-Level Mouse hook code omitted.")
-		return FALSE;
-#endif
-	} else {
-		if (hLLMouseHook != NULL)
-		{
-			// Stop the hook...
-			if (!UnhookWindowsHookEx(hLLMouseHook))
-				return FALSE;
-			hLLMouseHook = NULL;
-		}
-		return TRUE;
-	}
-}
-
-// Routine to get the window's client rectangle, in screen coordinates
-inline BOOL GetAbsoluteClientRect(HWND hwnd, RECT *rect)
-{
-	POINT topleft;
-	topleft.x = 0;
-	topleft.y = 0;
-
-	// Get the client rectangle size
-	if (!GetClientRect(hwnd, rect))
-		return FALSE;
-
-	// Get the client rectangle position
-	if (!ClientToScreen(hwnd, &topleft))
-		return FALSE;
-
-	// Now adjust the window rectangle
-	rect->left += topleft.x;
-	rect->top += topleft.y;
-	rect->right += topleft.x;
-	rect->bottom += topleft.y;
-
-	return TRUE;
-}
-
-// Routine to send an UpdateRect message to WinVNC
-inline void SendUpdateRect(SHORT x, SHORT y, SHORT x2, SHORT y2)
-{
-	WPARAM vwParam;
-	LPARAM vlParam;
-
-	vwParam = MAKELONG(x, y);
-	vlParam = MAKELONG(x2, y2);
-
-	// Send the update to WinVNC
-	PostThreadMessage(
-		vnc_thread_id,
-		UpdateRectMessage,
-		vwParam,
-		vlParam
-		);
-	HWND hWndRemote=FindWindow("WinVNC desktop sink", "WinVNC");
-	if (hWndRemote==NULL) UnSetHooks(vnc_thread_id);
-}
-
-// Send a window's position to WinVNC
-
-inline void SendWindowRect(HWND hWnd)
-{
-	RECT wrect;
-
-	// Get the rectangle position
-	if (IsWindowVisible(hWnd) && GetWindowRect(hWnd, &wrect))
-	{
-		// Send the position
-		SendUpdateRect(
-			(SHORT) wrect.left,
-			(SHORT) wrect.top,
-			(SHORT) wrect.right,
-			(SHORT) wrect.bottom
-			);
-	}
-}
-
-// Send a deferred message into this Window's message queue, so that
-// we'll intercept it again only after the message that triggered it has been
-// handled
-
-inline void SendDeferredUpdateRect(HWND hWnd, SHORT x, SHORT y, SHORT x2, SHORT y2)
-{
-	WPARAM vwParam;
-	LPARAM vlParam;
-
-	vwParam = MAKELONG(x, y);
-	vlParam = MAKELONG(x2, y2);
-
-	if (prf_use_Deferral)
-	{
-		// Send the update back to the window
-		PostMessage(
-			hWnd,
-			VNC_DEFERRED_UPDATE,
-			vwParam,
-			vlParam
-			);
-	}
-	else
-	{
-		// Send the update to WinVNC
-		PostThreadMessage(
-			vnc_thread_id,
-			UpdateRectMessage,
-			vwParam,
-			vlParam
-			);
-	}
-}
-
-inline void SendDeferredWindowRect(HWND hWnd)
-{
-	RECT wrect;
-
-	// Get the rectangle position
-	if (IsWindowVisible(hWnd) && GetWindowRect(hWnd, &wrect))
-	{
-		// Send the position
-		SendDeferredUpdateRect(
-			hWnd,
-			(SHORT) wrect.left,
-			(SHORT) wrect.top,
-			(SHORT) wrect.right,
-			(SHORT) wrect.bottom
-			);
-	}
-}
-
-inline void SendDeferredBorderRect(HWND hWnd)
-{
-	RECT wrect;
-	RECT crect;
-
-	// Get the rectangle position
-	if (IsWindowVisible(hWnd) && GetWindowRect(hWnd, &wrect))
-	{
-		// Get the client rectangle position
-		if (GetAbsoluteClientRect(hWnd, &crect))
-		{
-			// Send the four border rectangles
-			SendDeferredUpdateRect(hWnd, (SHORT) wrect.left, (SHORT) wrect.top, (SHORT) wrect.right, (SHORT) crect.top);
-			SendDeferredUpdateRect(hWnd, (SHORT) wrect.left, (SHORT) wrect.top, (SHORT) crect.left, (SHORT) wrect.bottom);
-			SendDeferredUpdateRect(hWnd, (SHORT) wrect.left, (SHORT) crect.bottom, (SHORT) wrect.right, (SHORT) wrect.bottom);
-			SendDeferredUpdateRect(hWnd, (SHORT) crect.right, (SHORT) wrect.top, (SHORT) wrect.right, (SHORT) wrect.bottom);
-		}
-	}
-}
-// ddihook, we only need the mouse info
-inline BOOL HookHandleddi(UINT MessageId, HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
-	switch (MessageId)
-	{
-	case WM_NCMOUSEMOVE:
-	case WM_MOUSEMOVE:
-		// Inform WinVNC that the mouse has moved and pass it the current cursor handle
-		{
-			HICON new_cursor = GetCursor();
-			if (new_cursor != old_cursor) {
-				PostThreadMessage(
-					vnc_thread_id,
-					MouseMoveMessage,
-					(ULONG_PTR)new_cursor, 0);
-				old_cursor=new_cursor;
-			}
-		}
-		break;
-	}
-	return TRUE;
-}
-// Generic hook-handler
-
-inline BOOL HookHandle(UINT MessageId, HWND hWnd, WPARAM wParam, LPARAM lParam)
-{
-	////////////////////////////////////////////////////////////////
-	// HANDLE DEFERRED UPDATES
-
-	// Is this a deferred-update message?
-	if (MessageId == VNC_DEFERRED_UPDATE)
-	{
-
-		// NOTE : NEVER use the SendDeferred- routines to send updates
-		//		from here, or you'll get an infinite loop....!
-
-		// NB : The format of DEFERRED_UPDATE matches that of UpdateRectMessage,
-		//		so just send the exact same message data to WinVNC
-
-		PostThreadMessage(
-			vnc_thread_id,
-			UpdateRectMessage,
-			wParam,
-			lParam
-			);
-
-		return FALSE;
-	}
-
-	// *** Could use WM_COPYDATA to send data to WinVNC
-
-/*
-	if (GetClassLong(hWnd, GCW_ATOM) == 32768)
-	{
-		_RPT4(_CRT_WARN, "DBG : popup menu message (hwnd=%d, msg=%d, l=%d, w=%d)\n",
-		hWnd, MessageId, lParam, wParam);
-	}
-*/
-
-	////////////////////////////////////////////////////////////////
-	// UPDATE-TRIGGERING MESSAGES
-
-	// Do something dependent upon message type
-	switch (MessageId)
-	{
-		
-		////////////////////////////////////////////////////////////////
-		// Messages indicating only a border repaint.
-	case WM_NCPAINT:
-	case WM_NCACTIVATE:
-		SendDeferredBorderRect(hWnd);
-		old_cursor = NULL;
-		break;
-
-		////////////////////////////////////////////////////////////////
-		// Messages indicating a client area repaint
-	case WM_CHAR:
-	case WM_KEYUP:							// Handle key-presses
-		if (prf_use_KeyPress)
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case WM_LBUTTONUP:						// Handle LMB clicks
-		if (prf_use_LButtonUp)
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case WM_MBUTTONUP:						// Handle MMB clicks
-		if (prf_use_MButtonUp)
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case WM_RBUTTONUP:						// Handle RMB clicks
-		if (prf_use_RButtonUp)
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case WM_TIMER:
-		if (prf_use_Timer)
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case WM_HSCROLL:
-	case WM_VSCROLL:
-		if (((int) LOWORD(wParam) == SB_THUMBTRACK) || ((int) LOWORD(wParam) == SB_ENDSCROLL))
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	case 485:  // HACK to handle popup menus
-		{
-			// Get the old popup menu selection value
-			HANDLE prop = GetProp(hWnd, (LPCTSTR) MAKELONG(VNC_POPUPSELN_ATOM, 0));
-			if (prop != (HANDLE) wParam)
-			{
-				// It did, so update the menu & the selection value
-				SendDeferredWindowRect(hWnd);
-				SetProp(hWnd,
-					(LPCTSTR) MAKELONG(VNC_POPUPSELN_ATOM, 0),
-					(HANDLE) wParam);
-			}
-		}
-		break;
-
-		////////////////////////////////////////////////////////////////
-		// Messages indicating a full window update
-	case WM_SYSCOLORCHANGE:
-	case WM_PALETTECHANGED:
-	case WM_SETTEXT:
-	case WM_ENABLE:
-	case BM_SETCHECK:
-	case BM_SETSTATE:
-	case EM_SETSEL:
-	//case WM_MENUSELECT:
-		SendDeferredWindowRect(hWnd);
-		break;
-
-		////////////////////////////////////////////////////////////////
-		// Messages indicating that an area of the window needs updating
-		// Uses GetUpdateRect to find out which
-	case WM_PAINT:
-		if (prf_use_GetUpdateRect)
-		{
-			HRGN region;
-			region = CreateRectRgn(0, 0, 0, 0);
-
-			// Get the affected region
-			if (GetUpdateRgn(hWnd, region, FALSE) != ERROR)
-			{
-				int buffsize;
-				UINT x;
-				RGNDATA *buff;
-				POINT TopLeft;
-
-				// Get the top-left point of the client area
-				TopLeft.x = 0;
-				TopLeft.y = 0;
-				if (!ClientToScreen(hWnd, &TopLeft))
-					break;
-
-				// Get the size of buffer required
-				buffsize = GetRegionData(region, 0, 0);
-				if (buffsize != 0)
-				{
-					buff = (RGNDATA *) new BYTE [buffsize];
-					if (buff == NULL)
-						break;
-
-					// Now get the region data
-					if(GetRegionData(region, buffsize, buff))
-					{
-						for (x=0; x<(buff->rdh.nCount); x++)
-						{
-							// Obtain the rectangles from the list
-							RECT *urect = (RECT *) (((BYTE *) buff) + sizeof(RGNDATAHEADER) + (x * sizeof(RECT)));
-							SendDeferredUpdateRect(
-								hWnd,
-								(SHORT) (TopLeft.x + urect->left),
-								(SHORT) (TopLeft.y + urect->top),
-								(SHORT) (TopLeft.x + urect->right),
-								(SHORT) (TopLeft.y + urect->bottom)
-								);
-
-							// Modified by mws for VNC ver. 3.3.6
-							// We yield this thread so our PostMessages and socket commands
-							// can complete, otherwise this hook can suck up too many
-							// timeslices before it returns
-							Sleep (0);
-						}
-					}
-
-					delete [] buff;
-				}
-			}
-
-			// Now free the region
-			if (region != NULL)
-				DeleteObject(region);
-		}
-		else
-			SendDeferredWindowRect(hWnd);
-		break;
-
-		////////////////////////////////////////////////////////////////
-		// Messages indicating full repaint of this and a different window
-		// Send the new position of the window
-	case WM_WINDOWPOSCHANGING:
-		if (IsWindowVisible(hWnd))
-			SendWindowRect(hWnd);
-		break;
-
-	case WM_WINDOWPOSCHANGED:
-		if (IsWindowVisible(hWnd))
-			SendDeferredWindowRect(hWnd);
-		break;
-
-	////////////////////////////////////////////////////////////////
-	// WinVNC also wants to know about mouse movement
-	case WM_NCMOUSEMOVE:
-	case WM_MOUSEMOVE:
-		// Inform WinVNC that the mouse has moved and pass it the current cursor handle
-		{
-			HICON new_cursor = GetCursor();
-			if (new_cursor != old_cursor) {
-				PostThreadMessage(
-					vnc_thread_id,
-					MouseMoveMessage,
-					(ULONG_PTR)new_cursor, 0);
-				old_cursor=new_cursor;
-			}
-		}
-		break;
-
-    // RealVNC 335
-    case WM_MOUSEWHEEL:           // Handle mousewheel events
-       SendDeferredWindowRect(hWnd);
-       break;
-		////////////////////////////////////////////////////////////////
-		// VNCHOOKS PROPERTIES HANDLING WINDOWS
-	case WM_DESTROY:
-		RemoveProp(hWnd, (LPCTSTR) MAKELONG(VNC_POPUPSELN_ATOM, 0));
-		break;
-
-	}
-
-	return TRUE;
-}
-
-// Hook procedure for CallWindow hook
-
-LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
-	// Do we have to handle this message?
-	if (nCode == HC_ACTION)
-	{
-		// Process the hook if the WinVNC thread ID is valid
-		if (vnc_thread_id)
-		{
-			CWPSTRUCT *cwpStruct = (CWPSTRUCT *) lParam;
-			HookHandle(cwpStruct->message, cwpStruct->hwnd, cwpStruct->wParam, cwpStruct->lParam);
-		}
-	}
-
-	// Call the next handler in the chain
-    return CallNextHookEx (hCallWndHook, nCode, wParam, lParam);
-}
-
-// Hook procedure for GetMessageProc hook
-
-LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
-	// Do we have to handle this message?
-	if (nCode == HC_ACTION)
-	{
-		// Process the hook only if the WinVNC thread id is valid
-		if (vnc_thread_id)
-		{
-			MSG *msg = (MSG *) lParam;
-
-			// Only handle application messages if they're being removed:
-			if (wParam & PM_REMOVE)
-			{
-				// Handle the message
-				if (m_ddihook)
-				HookHandleddi(msg->message, msg->hwnd, msg->wParam, msg->lParam);
-				else HookHandle(msg->message, msg->hwnd, msg->wParam, msg->lParam);
-			}
-		}
-	}
-
-	// Call the next handler in the chain
-    return CallNextHookEx (hGetMsgHook, nCode, wParam, lParam);
-}
-
-
-// Hook procedure for DialogMessageProc hook
-
-LRESULT CALLBACK DialogMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
-	// Do we have to handle this message?
-	if (nCode >= 0)
-	{
-		// Process the hook only if the WinVNC thread ID is valid
-		if (vnc_thread_id)
-		{
-			MSG *msg = (MSG *) lParam;
-
-			// Handle the message
-			HookHandle(msg->message, msg->hwnd, msg->wParam, msg->lParam);
-		}
-	}
-
-	// Call the next handler in the chain
-    return CallNextHookEx (hGetMsgHook, nCode, wParam, lParam);
-}
-
-// Hook procedure for LowLevel Keyboard filtering
-
-#ifdef WH_KEYBOARD_LL
-LRESULT CALLBACK LowLevelKeyboardFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
-	// Are we expected to handle this callback?
-	if (nCode == HC_ACTION)
-	{
-		// Is this keyboard event "real" or "injected"
-		// i.e. hardware or software-produced?
-		KBDLLHOOKSTRUCT *hookStruct = (KBDLLHOOKSTRUCT*)lParam;
-		if (!(hookStruct->flags & LLKHF_INJECTED)) {
-			// Message was not injected - reject it!
-			return TRUE;
-		}
-	}
-
-	// Otherwise, pass on the message
-	return CallNextHookEx(hLLKeyboardHook, nCode, wParam, lParam);
-}
-#endif
-
-// Hook procedure for LowLevel Mouse filtering
-
-#ifdef WH_MOUSE_LL
-LRESULT CALLBACK LowLevelMouseFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
-{
-	// Are we expected to handle this callback?
-	if (nCode == HC_ACTION)
-	{
-		// Is this mouse event "real" or "injected"
-		// i.e. hardware or software-produced?
-		MSLLHOOKSTRUCT *hookStruct = (MSLLHOOKSTRUCT*)lParam;
-		if (!(hookStruct->flags & LLMHF_INJECTED)) {
-			// Message was not injected - reject it!
-			return TRUE;
-		}
-	}
-
-	// Otherwise, pass on the message
-	return CallNextHookEx(hLLMouseHook, nCode, wParam, lParam);
-}
-#endif
-
-char * NameFromPath(const char *path)
-{
-	int x;
-	int l = strlen(path);
-	char *temp = NULL;
-	
-	// Find the file part of a filename
-	for (x=l-1; x>0; x--)
-	{
-		if (path[x] == '\\')
-		{
-			temp = _strdup(&(path[x+1]));
-			break;
-		}
-	}
-
-	// If we didn't fine a \ then just return a copy of the original
-	if (temp == NULL)
-		temp = _strdup(path);
-
-	return temp;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Initialise / Exit routines.
-// These functions handle the update settings for any apps used with WinVNC.
-
-static const TCHAR szSoftware[] = "Software";
-static const TCHAR szCompany[] = "ORL";
-static const TCHAR szProfile[] = "VNCHooks";
-
-HKEY hModuleKey = NULL;
-
-HKEY OpenKey(HKEY basekey, const char* path[], bool writable, bool create) {
-	HKEY key = basekey;
-	DWORD flags = KEY_READ;
-	if (writable) flags |= KEY_WRITE;
-	if (create) flags |= KEY_CREATE_SUB_KEY;
-	unsigned int i = 0;
-	while (path[i]) {
-		HKEY newkey;
-		DWORD result, dw;
-		if (create) {
-#ifdef _MSC_VER 
-			_RPT2(_CRT_WARN, "vncHooks : creating %s from %x\n", path[i], key);
-#endif
-			result = RegCreateKeyEx(key, path[i], 0, REG_NONE,
-				REG_OPTION_NON_VOLATILE, flags, NULL,
-				&newkey, &dw);
-		} else {
-#ifdef _MSC_VER 
-			_RPT2(_CRT_WARN, "vncHooks : opening %s from %x\n", path[i], key);
-#endif
-			result = RegOpenKeyEx(key, path[i], 0, flags, &newkey);
-		}
-		if (key && (key != basekey)) RegCloseKey(key);
-		key = newkey;
-		if (result != ERROR_SUCCESS) {
-#ifdef _MSC_VER 
-			_RPT2(_CRT_WARN, "vncHooks : failed to open %s(%lu)\n", path[i], result);
-#endif
-			return NULL;
-		} else {
-#ifdef _MSC_VER 
-			_RPT2(_CRT_WARN, "vncHooks : opened %s (%x)\n", path[i], key);
-#endif
-		}
-		i++;
-	}
-	return key;
-}
-
-HKEY GetModuleKey(HKEY basekey, const char* proc_name, bool writable, bool create) {
-	// Work out the registry key to save this under
-	if (!sModulePrefs) {
-		sModulePrefs = (char *) malloc(strlen(proc_name) + 1);
-		if (sModulePrefs == NULL)
-			return FALSE;
-		strcpy(sModulePrefs, proc_name);
-	}
-	
-	// Check whether the library's entry exists!
-	const char* appPath[] = {szSoftware, szCompany, szProfile, 0};
-	HKEY appKey = OpenKey(basekey, appPath, writable, create);
-	if (!appKey)
-		return NULL;
-	
-	// Attempt to open the registry section for the application
-	const char* modPath[] = {sPrefSegment, sModulePrefs, 0};
-	HKEY modKey = OpenKey(appKey, modPath, writable, false);
-	if (!modKey) {
-		// Cut off the app directory and just use the name
-		char *file_name = NameFromPath(proc_name);
-		
-		if (!file_name)
-		{
-			RegCloseKey(appKey);
-			return NULL;
-		}
-		
-		// Adjust the moduleprefs name
-		strcpy(sModulePrefs, file_name);
-		free(file_name);
-		
-		// Now get the module key again
-		const char* modPath2[] = {sPrefSegment, sModulePrefs, 0};
-		modKey = OpenKey(appKey, modPath2, writable, create);
-	}
-	
-	RegCloseKey(appKey);
-	
-	return modKey;
-}
-
-int GetProfileInt(LPTSTR key, int def)
-{
-	DWORD type;
-	DWORD value;
-	ULONG size = sizeof(value);
-
-	if (RegQueryValueEx(
-		hModuleKey,
-		key,
-		NULL,
-		&type,
-		(unsigned char *)&value,
-		&size) == ERROR_SUCCESS)
-	{
-		// Is the value of the right type?
-		if (type != REG_DWORD)
-		{
-			return def;
-		}
-		else
-		{
-			return value;
-		}
-	}
-	else
-	{
-		return def;
-	}
-}
-
-void WriteProfileInt(LPTSTR key, int value)
-{
-	RegSetValueEx(
-		hModuleKey,
-		key,
-		0,
-		REG_DWORD,
-		(unsigned char *)&value,
-		sizeof(value));
-}
-
-void ReadSettings() {
-  // Read in the prefs
-	prf_use_GetUpdateRect = GetProfileInt(
-		(CHAR *) "use_GetUpdateRect",
-		TRUE
-		);
-
-	prf_use_Timer = GetProfileInt(
-		(CHAR *) "use_Timer",
-		FALSE
-		);
-	prf_use_KeyPress = GetProfileInt(
-		(CHAR *) "use_KeyPress",
-		TRUE
-		);
-	prf_use_LButtonUp = GetProfileInt(
-		(CHAR *) "use_LButtonUp",
-		TRUE
-		);
-	prf_use_MButtonUp = GetProfileInt(
-		(CHAR *) "use_MButtonUp",
-		TRUE
-		);
-	prf_use_RButtonUp = GetProfileInt(
-		(CHAR *) "use_RButtonUp",
-		TRUE
-		);
-	prf_use_Deferral = GetProfileInt(
-		(CHAR *) "use_Deferral",
-		TRUE
-		);
-}
-
-BOOL InitInstance() 
-{
-	// Create the global atoms
-	if (VNC_POPUPSELN_ATOM == INVALID_ATOM)
-    	VNC_POPUPSELN_ATOM = GlobalAddAtom(VNC_POPUPSELN_ATOMNAME);
-	if (VNC_POPUPSELN_ATOM == INVALID_ATOM)
-		return FALSE;
-
-	// Get the module name
-	char proc_name[_MAX_PATH];
-	DWORD size;
-
-	// Attempt to get the program/module name
-	if ((size = GetModuleFileName(
-		GetModuleHandle(NULL),
-		(char *) &proc_name,
-		_MAX_PATH
-		)) == 0)
-		return FALSE;
-
-  // Get the default system key for the module
-	hModuleKey = GetModuleKey(HKEY_LOCAL_MACHINE, proc_name, false, false);
-  if (hModuleKey != NULL) {
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : loading machine prefs\n");
-#endif
-    ReadSettings();
-		RegCloseKey(hModuleKey);
-    hModuleKey = NULL;
-  }
-
-	// Get the key for the module
-	hModuleKey = GetModuleKey(HKEY_CURRENT_USER, proc_name, false, false);
-  if (hModuleKey != NULL) {
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : loading user prefs\n");
-#endif
-    ReadSettings();
-		RegCloseKey(hModuleKey);
-    hModuleKey = NULL;
-  }
-
-	return TRUE;
-}
-
-BOOL ExitInstance() 
-{
-	// Free the created atoms
-	if (VNC_POPUPSELN_ATOM != INVALID_ATOM)
-	{
-		GlobalDeleteAtom(VNC_POPUPSELN_ATOM);
-		VNC_POPUPSELN_ATOM = INVALID_ATOM;
-	}
-
-	// Write the module settings to disk
-	if (sModulePrefs != NULL)
-	{
-	  // Get the module name
-	  char proc_name[_MAX_PATH];
-	  DWORD size;
-
-	  // Attempt to get the program/module name
-	  if ((size = GetModuleFileName(
-		  GetModuleHandle(NULL),
-		  (char *) &proc_name,
-		  _MAX_PATH
-		  )) == 0)
-		  return FALSE;
-
-	  // Get the key for the module
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : locating user prefs\n");
-#endif
-	  hModuleKey = GetModuleKey(HKEY_CURRENT_USER, proc_name, true, true);
-	  if (hModuleKey == NULL)
-		  return FALSE;
-#ifdef _MSC_VER 
-		_RPT0(_CRT_WARN, "vncHooks : writing user prefs\n");
-#endif
-
-		WriteProfileInt(
-			(CHAR *) "use_GetUpdateRect",
-			prf_use_GetUpdateRect
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_Timer",
-			prf_use_Timer
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_KeyPress",
-			prf_use_KeyPress
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_LButtonUp",
-			prf_use_LButtonUp
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_MButtonUp",
-			prf_use_MButtonUp
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_RButtonUp",
-			prf_use_RButtonUp
-			);
-
-		WriteProfileInt(
-			(CHAR *) "use_Deferral",
-			prf_use_Deferral
-			);
-
-		free(sModulePrefs);
-		sModulePrefs = NULL;
-	}
-
-	// Close the registry key for this module
-  if (hModuleKey != NULL) {
-		RegCloseKey(hModuleKey);
-    hModuleKey = NULL;
-  }
-
-	return TRUE;
-}
diff --git a/ica/win32/winvnc/vnchooks/VNCHooks.def b/ica/win32/winvnc/vnchooks/VNCHooks.def
deleted file mode 100644
index efd1154..0000000
--- a/ica/win32/winvnc/vnchooks/VNCHooks.def
+++ /dev/null
@@ -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
diff --git a/ica/win32/winvnc/vnchooks/VNCHooks.h b/ica/win32/winvnc/vnchooks/VNCHooks.h
deleted file mode 100644
index 7487982..0000000
--- a/ica/win32/winvnc/vnchooks/VNCHooks.h
+++ /dev/null
@@ -1,73 +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 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 at 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,
-		BOOL ddihook
-		);											// 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_)
diff --git a/ica/win32/winvnc/vnchooks/resource.h b/ica/win32/winvnc/vnchooks/resource.h
deleted file mode 100644
index 3063d86..0000000
--- a/ica/win32/winvnc/vnchooks/resource.h
+++ /dev/null
@@ -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
diff --git a/ica/win32/winvnc/vnchooks/vnchooks.dsp b/ica/win32/winvnc/vnchooks/vnchooks.dsp
deleted file mode 100644
index 0121ddf..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooks.dsp
+++ /dev/null
@@ -1,123 +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 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=xicl6.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 "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VNCHOOKS_EXPORTS" /D _WIN32_WINNT=0x400 /YX /FD /O3 /QaxM /Qip /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=xilink6.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 /debug /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=xilink6.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
-
-!ENDIF 
-
-# Begin Target
-
-# Name "vnchooks - Win32 Release"
-# Name "vnchooks - Win32 Debug"
-# 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
diff --git a/ica/win32/winvnc/vnchooks/vnchooks.rc b/ica/win32/winvnc/vnchooks/vnchooks.rc
deleted file mode 100644
index 35c33b7..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooks.rc
+++ /dev/null
@@ -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 1,1,0,0
- PRODUCTVERSION 1,1,0,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", "UltraVNC\0"
-            VALUE "FileDescription", "VNC hooks DLL for Win32\0"
-            VALUE "FileVersion", "1, 1, 0, 0\0"
-            VALUE "InternalName", "VNCHooks\0"
-            VALUE "LegalCopyright", "Copyright (C) 2002 UltraVNC, Copyright RealVNC Ltd.� 2002, AT&T Research Labs Cambridge� 1996-2001\0"
-            VALUE "LegalTrademarks", "\0"
-            VALUE "OriginalFilename", "VNCHooks.dll\0"
-            VALUE "PrivateBuild", "\0"
-            VALUE "ProductName", "UltraVNC - VNCHooks\0"
-            VALUE "ProductVersion", "1, 1, 0, 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
-
diff --git a/ica/win32/winvnc/vnchooks/vnchooks.vcproj b/ica/win32/winvnc/vnchooks/vnchooks.vcproj
deleted file mode 100644
index 4f48d74..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooks.vcproj
+++ /dev/null
@@ -1,717 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="vnchooks"
-	ProjectGUID="{1D18E045-6B72-43F4-ACBD-3E679A3DE349}"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\..\Debug"
-			IntermediateDirectory=".\..\Debug"
-			ConfigurationType="2"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\..\Debug/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\..\Debug/vnchooks.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\..\Debug/vnchooks.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/vnchooks.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Debug/vnchooks.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\Debug/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\..\Debug/vnchooks.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\..\Debug/vnchooks.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/vnchooks.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Debug/vnchooks.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\..\Release"
-			IntermediateDirectory=".\..\Release"
-			ConfigurationType="2"
-			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/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				OptimizeReferences="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			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="3"
-				TypeLibraryName=".\..\Release/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="IPP|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			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/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="IPP|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			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="3"
-				TypeLibraryName=".\..\Release/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<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="VNCHooks.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="VNCHooks.def"
-				>
-			</File>
-			<File
-				RelativePath="VNCHooks.rc"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</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>
diff --git a/ica/win32/winvnc/vnchooks/vnchooksVS2005.vcproj b/ica/win32/winvnc/vnchooks/vnchooksVS2005.vcproj
deleted file mode 100644
index 463345f..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooksVS2005.vcproj
+++ /dev/null
@@ -1,505 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8,00"
-	Name="vnchooks"
-	ProjectGUID="{1D18E045-6B72-43F4-ACBD-3E679A3DE349}"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\..\Debug"
-			IntermediateDirectory=".\..\Debug"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\..\Debug/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\..\Debug/vnchooks.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\..\Debug/vnchooks.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/vnchooks.pdb"
-				ImportLibrary=".\..\Debug/vnchooks.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\..\Release"
-			IntermediateDirectory=".\..\Release"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.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/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\Debug/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\..\Debug/vnchooks.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\..\Debug/vnchooks.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/vnchooks.pdb"
-				ImportLibrary=".\..\Debug/vnchooks.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.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="3"
-				TypeLibraryName=".\..\Release/vnchooks.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/vnchooks.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="VCLinkerTool"
-				OutputFile=".\..\Release/vnchooks.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\VNCHooks.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/vnchooks.pdb"
-				ImportLibrary=".\..\Release/vnchooks.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/vnchooks.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<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="VNCHooks.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="VNCHooks.def"
-				>
-			</File>
-			<File
-				RelativePath="VNCHooks.rc"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</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>
diff --git a/ica/win32/winvnc/vnchooks/vnchooks_vs90_Debug_Win32.lnt b/ica/win32/winvnc/vnchooks/vnchooks_vs90_Debug_Win32.lnt
deleted file mode 100644
index 4edbd8f..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooks_vs90_Debug_Win32.lnt
+++ /dev/null
@@ -1,12 +0,0 @@
-
-// Generated by Visual Lint 1.5.8.77 from file: D:\UltraVNC-src\UltraVNC Project Root\UltraVNC\winvnc\vnchooks\vnchooks.vcproj
-// -dConfiguration=Debug|Win32
-//
--D_WINDLL                       // ConfigurationType = "2"
--D_MBCS                         // CharacterSet = "2"
--D_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS
-                                // PreprocessorDefinitions = "_DEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
--D_NATIVE_WCHAR_T_DEFINED       // TreatWChar_tAsBuiltInType = "TRUE"
--D_MT;_DEBUG;_DLL               // RuntimeLibrary = "3"
-
-VNCHooks.cpp                    // RelativePath = "VNCHooks.cpp"
diff --git a/ica/win32/winvnc/vnchooks/vnchooks_vs90_Release_Win32.lnt b/ica/win32/winvnc/vnchooks/vnchooks_vs90_Release_Win32.lnt
deleted file mode 100644
index 1ac3abc..0000000
--- a/ica/win32/winvnc/vnchooks/vnchooks_vs90_Release_Win32.lnt
+++ /dev/null
@@ -1,12 +0,0 @@
-
-// Generated by Visual Lint 1.5.8.77 from file: D:\UltraVNC-src\UltraVNC Project Root\UltraVNC\winvnc\vnchooks\vnchooks.vcproj
-// -dConfiguration=Release|Win32
-//
--D_WINDLL                       // ConfigurationType = "2"
--D_MBCS                         // CharacterSet = "2"
--DNDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS
-                                // PreprocessorDefinitions = "NDEBUG;__WIN32__;WIN32;_WINDOWS;_USRDLL;VNCHOOKS_EXPORTS;_WIN32_WINNT=0x400;_CRT_SECURE_NO_WARNINGS"
--D_NATIVE_WCHAR_T_DEFINED       // TreatWChar_tAsBuiltInType = "TRUE"
--D_MT                           // RuntimeLibrary = "0"
-
-VNCHooks.cpp                    // RelativePath = "VNCHooks.cpp"
diff --git a/ica/win32/winvnc/winvnc.dsw b/ica/win32/winvnc/winvnc.dsw
deleted file mode 100644
index 2ae82c5..0000000
--- a/ica/win32/winvnc/winvnc.dsw
+++ /dev/null
@@ -1,260 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "MSLogonACL"=".\ms-logon\MSLogonACL\MSLogonACL.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Xregion"="..\Xregion\Xregion.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "authSSP"=".\ms-logon\authSSP\authSSP.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "authadmin"=".\ms-logon\authadmin\authadmin.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldapauth"=".\ms-logon\ldapauth\ldapauth.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldapauth9x"=".\ms-logon\ldapauth9x\ldapauth9x.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldapauthnt4"=".\ms-logon\ldapauthNT4\ldapauthnt4.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libjpeg"="..\libjpeg\libjpeg.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "logging"=".\ms-logon\logging\logging.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "logmessages"=".\logger\logmessages.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "omnithread"=".\omnithread\omnithread.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "rdr"="..\rdr\rdr.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "testauth"=".\ms-logon\testauth\testauth.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-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 omnithread
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name zlib
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name pointstat
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name libjpeg
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name Xregion
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name authadmin
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name ldapauth
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name ldapauth9x
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name ldapauthnt4
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name logging
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name testauth
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name workgrpdomnt4
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name rdr
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "workgrpdomnt4"=".\ms-logon\workgrpdomnt4\workgrpdomnt4.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "zlib"="..\zlib\zlib.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/winvnc/winvnc.sln b/ica/win32/winvnc/winvnc.sln
deleted file mode 100644
index b8245e0..0000000
--- a/ica/win32/winvnc/winvnc.sln
+++ /dev/null
@@ -1,345 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "omnithread", "omnithread\omnithread.vcxproj", "{E52B9956-FE67-47F7-BC4F-67CC5A64B708}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdr", "..\rdr\rdr.vcxproj", "{F5244002-0FFF-4F19-A941-FCCE1861F132}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnchooks", "vnchooks\vnchooks.vcxproj", "{1D18E045-6B72-43F4-ACBD-3E679A3DE349}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winvnc", "winvnc\winvnc.vcxproj", "{C05AE605-1250-4F58-911B-EC99AE2C25AF}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avilog", "..\avilog\avilog\avilog.vcxproj", "{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unz32lib", "..\zipunzip_src\unzip\windll\vc6\lib\unz32lib.vcxproj", "{F9321962-FBED-4581-BF7D-D0EBC303D891}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip32", "..\zipunzip_src\zip20\windll\visualc\lib\zip32.vcxproj", "{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg-turbo-win", "..\libjpeg-turbo-win\libjpeg-turbo-win.vcxproj", "{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "..\zlib-1.2.5\contrib\vstudio\vc10\zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		ASM Debug|Itanium = ASM Debug|Itanium
-		ASM Debug|Win32 = ASM Debug|Win32
-		ASM Debug|x64 = ASM Debug|x64
-		ASM Release|Itanium = ASM Release|Itanium
-		ASM Release|Win32 = ASM Release|Win32
-		ASM Release|x64 = ASM Release|x64
-		Debug|Itanium = Debug|Itanium
-		Debug|Win32 = Debug|Win32
-		Debug|x64 = Debug|x64
-		Http|Itanium = Http|Itanium
-		Http|Win32 = Http|Win32
-		Http|x64 = Http|x64
-		IPP|Itanium = IPP|Itanium
-		IPP|Win32 = IPP|Win32
-		IPP|x64 = IPP|x64
-		Release|Itanium = Release|Itanium
-		Release|Win32 = Release|Win32
-		Release|x64 = Release|x64
-		ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium
-		ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32
-		ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|x64.Build.0 = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|Itanium.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|Win32.Build.0 = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|x64.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|x64.Build.0 = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|Itanium.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.IPP|Itanium.ActiveCfg = IPP|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.IPP|Win32.ActiveCfg = IPP|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.IPP|Win32.Build.0 = IPP|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.IPP|x64.ActiveCfg = IPP|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.IPP|x64.Build.0 = IPP|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|Itanium.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|Win32.Build.0 = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|Itanium.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|Win32.Build.0 = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|Itanium.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|Win32.ActiveCfg = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|Win32.Build.0 = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.IPP|Itanium.ActiveCfg = IPP|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.IPP|Win32.ActiveCfg = IPP|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.IPP|Win32.Build.0 = IPP|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.IPP|x64.ActiveCfg = IPP|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.IPP|x64.Build.0 = IPP|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|Itanium.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|Win32.ActiveCfg = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|Win32.Build.0 = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|x64.Build.0 = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|Itanium.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|Win32.Build.0 = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|x64.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|x64.Build.0 = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|Itanium.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.IPP|Itanium.ActiveCfg = IPP|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.IPP|Win32.ActiveCfg = IPP|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.IPP|Win32.Build.0 = IPP|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.IPP|x64.ActiveCfg = IPP|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.IPP|x64.Build.0 = IPP|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|Itanium.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|x64.Build.0 = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|Itanium.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|Win32.Build.0 = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|x64.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|x64.Build.0 = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|Itanium.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.IPP|Itanium.ActiveCfg = IPP|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.IPP|Win32.ActiveCfg = IPP|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.IPP|Win32.Build.0 = IPP|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.IPP|x64.ActiveCfg = IPP|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.IPP|x64.Build.0 = IPP|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|Itanium.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|x64.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|Itanium.ActiveCfg = Debug|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|Win32.Build.0 = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|x64.ActiveCfg = Debug|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|Itanium.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.IPP|Itanium.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.IPP|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.IPP|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.IPP|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|Itanium.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|x64.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|x64.Build.0 = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Debug|Itanium.ActiveCfg = ASM Debug|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Debug|Win32.ActiveCfg = ASM Debug|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Debug|Win32.Build.0 = ASM Debug|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Debug|x64.ActiveCfg = ASM Debug|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Release|Itanium.ActiveCfg = ASM Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Release|Win32.ActiveCfg = ASM Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Release|Win32.Build.0 = ASM Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ASM Release|x64.ActiveCfg = ASM Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Debug|Itanium.ActiveCfg = Debug|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Debug|Win32.Build.0 = Debug|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Debug|x64.ActiveCfg = Debug|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Debug|x64.Build.0 = Debug|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Http|Itanium.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Http|Win32.ActiveCfg = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Http|Win32.Build.0 = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Http|x64.ActiveCfg = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.IPP|Itanium.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.IPP|Win32.ActiveCfg = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.IPP|Win32.Build.0 = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.IPP|x64.ActiveCfg = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Release|Itanium.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Release|Win32.ActiveCfg = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Release|Win32.Build.0 = Release|Win32
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Release|x64.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.Release|x64.Build.0 = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{F9321962-FBED-4581-BF7D-D0EBC303D891}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Debug|x64.ActiveCfg = Debug|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Release|Win32.Build.0 = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ASM Release|x64.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Debug|Itanium.ActiveCfg = Debug|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Debug|Win32.Build.0 = Debug|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Debug|x64.ActiveCfg = Debug|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Debug|x64.Build.0 = Debug|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Http|Itanium.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Http|Win32.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Http|Win32.Build.0 = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Http|x64.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.IPP|Itanium.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.IPP|Win32.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.IPP|Win32.Build.0 = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.IPP|x64.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Release|Itanium.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Release|Win32.ActiveCfg = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Release|Win32.Build.0 = Release|Win32
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Release|x64.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.Release|x64.Build.0 = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{E8BA959F-B652-4BAB-9EA7-8E9FC8D7F39C}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Debug|Itanium.ActiveCfg = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Debug|x64.Build.0 = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Release|Itanium.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Release|Win32.Build.0 = Release|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Release|x64.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ASM Release|x64.Build.0 = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Debug|Itanium.ActiveCfg = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Debug|Win32.ActiveCfg = Debug|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Debug|Win32.Build.0 = Debug|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Debug|x64.ActiveCfg = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Debug|x64.Build.0 = Debug|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Http|Itanium.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Http|Win32.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Http|x64.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Http|x64.Build.0 = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.IPP|Itanium.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.IPP|Win32.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.IPP|x64.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.IPP|x64.Build.0 = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Release|Itanium.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Release|Win32.ActiveCfg = Release|Win32
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Release|x64.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.Release|x64.Build.0 = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64
-		{04F91FA4-2D94-4803-BA3B-B61FBEF0ABE3}.ReleaseWithoutAsm|x64.Build.0 = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|Itanium.ActiveCfg = Debug|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|Itanium.Build.0 = Debug|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Debug|x64.Build.0 = Debug|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|Itanium.ActiveCfg = Release|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|Itanium.Build.0 = Release|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|Win32.Build.0 = Release|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|x64.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ASM Release|x64.Build.0 = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Http|Itanium.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Http|Win32.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Http|x64.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Http|x64.Build.0 = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.IPP|Itanium.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.IPP|Win32.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.IPP|x64.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.IPP|x64.Build.0 = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
-		{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/ica/win32/winvnc/winvnc.sln.vloptions b/ica/win32/winvnc/winvnc.sln.vloptions
deleted file mode 100644
index 2f6c55e..0000000
--- a/ica/win32/winvnc/winvnc.sln.vloptions
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<Solution><LintConfiguration><ConfigFile Source="Default"/><PolicyFile Source="Default"/><AdditionalParameters Source="Default"/></LintConfiguration><Projects><Project Name="Xregion" Analyse="1"><LintConfiguration><ConfigFile Source="Default"/><PolicyFile Source="Default"/><AdditionalParameters Source="Default"/></LintConfiguration><Files/></Project><Project Name="libjpeg" Analyse="0"><LintConfiguration><ConfigFile Source="Default"/><PolicyFile Source="Default"/><AdditionalParameters Sou [...]
diff --git a/ica/win32/winvnc/winvnc/CpuUsage.cpp b/ica/win32/winvnc/winvnc/CpuUsage.cpp
deleted file mode 100644
index dd2827f..0000000
--- a/ica/win32/winvnc/winvnc/CpuUsage.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <tchar.h>
-#include <time.h>
-#include <windows.h>
-#include "CpuUsage.h"
-
-DWORD CProcessorUsage::s_TickMark = 0;
-__int64  CProcessorUsage::s_time = 0;
-__int64 CProcessorUsage::s_idleTime = 0;
-__int64 CProcessorUsage::s_kernelTime = 0;
-__int64 CProcessorUsage::s_userTime = 0;
-__int64 CProcessorUsage::s_kernelTimeProcess = 0;
-__int64 CProcessorUsage::s_userTimeProcess = 0;
-int CProcessorUsage::s_count = 0;
-int CProcessorUsage::s_index = 0;
-int CProcessorUsage::s_lastCpu = 0;
-int CProcessorUsage::s_cpu[5] = {0, 0, 0, 0, 0};
-int CProcessorUsage::s_cpuProcess[5] = {0, 0, 0, 0, 0};
-
-CProcessorUsage::CProcessorUsage()
-{
-   ::InitializeCriticalSection(&m_cs);
-	m_bLocked = false;
-   s_pfnNtQuerySystemInformation = NULL;
-   s_pfnGetSystemTimes = NULL;
-
-   m_pInfo = NULL;
-   m_uInfoLength = sizeof(PROC_PERF_INFO);
-
-   HMODULE hModule  = ::GetModuleHandle(_T("kernel32.dll"));
-   if(hModule)
-      s_pfnGetSystemTimes = (pfnGetSystemTimes)::GetProcAddress(hModule, "GetSystemTimes");
-
-   if(!s_pfnGetSystemTimes)
-   {
-      hModule = ::GetModuleHandle(_T("ntdll.dll"));
-      if(hModule)
-      {
-         s_pfnNtQuerySystemInformation = (pfnNtQuerySystemInformation)::GetProcAddress(hModule, "NtQuerySystemInformation");
-         if(s_pfnNtQuerySystemInformation)
-         {
-            PROC_PERF_INFO tmp;
-            s_pfnNtQuerySystemInformation(8, &tmp, m_uInfoLength, &m_uInfoLength);
-            m_pInfo = new PROC_PERF_INFO[m_uInfoLength / sizeof(PROC_PERF_INFO)];
-         }
-      }
-   }
-   s_TickMark = ::GetTickCount();
-}
-
-CProcessorUsage::~CProcessorUsage()
-{
-   if(m_pInfo)
-      delete m_pInfo;
-     //Critical Section Over-Released or Corrupted
-	//::LeaveCriticalSection( &m_cs );
-	if (m_bLocked) m_bLocked = false;
-    ::DeleteCriticalSection(&m_cs);
-}
-
-void CProcessorUsage::GetSysTimes(__int64 & idleTime, __int64 & kernelTime, __int64 & userTime)
-{
-   if(s_pfnGetSystemTimes)
-      s_pfnGetSystemTimes((LPFILETIME)&idleTime, (LPFILETIME)&kernelTime, (LPFILETIME)&userTime);
-   else
-   {
-      idleTime = 0;
-      kernelTime = 0;
-      userTime = 0;
-      if(s_pfnNtQuerySystemInformation && m_uInfoLength && !s_pfnNtQuerySystemInformation(0x08, m_pInfo, m_uInfoLength, &m_uInfoLength))
-      {
-         // NtQuerySystemInformation returns information for all
-         // CPU cores in the system, so we take the average here:
-         int nCores = m_uInfoLength / sizeof(PROC_PERF_INFO);
-         for(int i = 0;i < nCores;i ++)
-         {
-            idleTime += m_pInfo[i].IdleTime.QuadPart;
-            kernelTime += m_pInfo[i].KernelTime.QuadPart;
-            userTime += m_pInfo[i].UserTime.QuadPart;
-         }
-         idleTime /= nCores;
-         kernelTime /= nCores;
-         userTime /= nCores;
-      }
-   }
-}
-
-short CProcessorUsage::GetUsage()
-{
-    __int64 sTime;
-    int sLastCpu;
-
-   if (m_bLocked) return s_lastCpu;
-   ::EnterCriticalSection( &m_cs );
-   m_bLocked = true;
-   sTime = s_time;
-   sLastCpu = s_lastCpu;
-
-    if(((::GetTickCount() - s_TickMark) & 0x7FFFFFFF) <= 200)
-	{
-	  if (m_bLocked) ::LeaveCriticalSection( &m_cs );
-	  m_bLocked = false;
-      return sLastCpu;
-	}
-
-   __int64 time;
-   __int64 idleTime;
-   __int64 kernelTime;
-   __int64 userTime;
-   __int64 kernelTimeProcess;
-   __int64 userTimeProcess;
-
-   ::GetSystemTimeAsFileTime((LPFILETIME)&time);
-
-    if(!sTime)
-    {
-      GetSysTimes(idleTime, kernelTime, userTime);
-      FILETIME createTime;
-      FILETIME exitTime;
-      ::GetProcessTimes(::GetCurrentProcess(), &createTime, &exitTime, (LPFILETIME)&kernelTimeProcess, (LPFILETIME)&userTimeProcess);
-
-      s_time = time;
-      s_idleTime = idleTime;
-      s_kernelTime = kernelTime;
-      s_userTime = userTime;
-      s_kernelTimeProcess = kernelTimeProcess;
-      s_userTimeProcess = userTimeProcess;
-      s_lastCpu = 0;
-      s_TickMark = ::GetTickCount();
-	  if (m_bLocked) ::LeaveCriticalSection( &m_cs );
-	  m_bLocked = false;
-      return 0;
-   }
-
-    __int64 div = (time - sTime);
-
-   GetSysTimes(idleTime, kernelTime, userTime);
-
-   FILETIME createTime;
-   FILETIME exitTime;
-   ::GetProcessTimes(::GetCurrentProcess(), &createTime, &exitTime, (LPFILETIME)&kernelTimeProcess, (LPFILETIME)&userTimeProcess);
-
-    int cpu;
-    int cpuProcess;
-
-     __int64 usr = userTime   - s_userTime;
-     __int64 ker = kernelTime - s_kernelTime;
-     __int64 idl = idleTime   - s_idleTime;
-     __int64 sys = (usr + ker);
-
-   if(sys)
-      cpu = int((sys - idl) * 100 / sys); // System Idle take 100 % of cpu;
-   else
-      cpu = 0;
-
-   cpuProcess = int((((userTimeProcess - s_userTimeProcess) + (kernelTimeProcess - s_kernelTimeProcess)) * 100 ) / div);
-
-   s_time = time;
-   s_idleTime = idleTime;
-   s_kernelTime = kernelTime;
-   s_userTime = userTime;
-   s_kernelTimeProcess = kernelTimeProcess;
-   s_userTimeProcess = userTimeProcess;
-   s_cpu[s_index] = cpu;
-	s_cpuProcess[s_index] = cpuProcess;
-	s_index++;
-	s_index%=5;
-
-   s_count ++;
-
-   if(s_count > 5)
-      s_count = 5;
-
-   cpu = 0;
-   int i;
-   for(i = 0; i < s_count; i++ )
-      cpu += s_cpu[i];
-
-   cpuProcess = 0;
-   for(i = 0; i < s_count; i++ )
-      cpuProcess += s_cpuProcess[i];
-
-   cpu /= s_count;
-   cpuProcess /= s_count;
-   s_lastCpu = cpuProcess;
-   sLastCpu = s_lastCpu;
-   s_TickMark = ::GetTickCount();
-   if (m_bLocked) ::LeaveCriticalSection( &m_cs );
-   m_bLocked = false;
-   return sLastCpu;
-}
diff --git a/ica/win32/winvnc/winvnc/CpuUsage.h b/ica/win32/winvnc/winvnc/CpuUsage.h
deleted file mode 100644
index 69ce457..0000000
--- a/ica/win32/winvnc/winvnc/CpuUsage.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-
-////////////////////////////////////////
-// class CProcessorUsage;
-//
-// Calculates overal processor usage at
-// any given time.
-//
-// The usage value is updated every 200
-// milliseconds;
-//
-// The class is fully thread-safe;
-//
-class CProcessorUsage
-{
-   typedef BOOL (WINAPI * pfnGetSystemTimes)(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime );
-   typedef LONG (WINAPI * pfnNtQuerySystemInformation)(ULONG SystemInformationClass, PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength);
-
-   struct PROC_PERF_INFO
-   {
-      LARGE_INTEGER IdleTime;
-      LARGE_INTEGER KernelTime;
-      LARGE_INTEGER UserTime;
-      LARGE_INTEGER Reserved1[2];
-      ULONG Reserved2;
-   };
-
-public:
-
-    CProcessorUsage();
-    ~CProcessorUsage();
-
-    short GetUsage();
-	bool m_bLocked;
-
-private:
-
-   void GetSysTimes(__int64 & idleTime, __int64 & kernelTime, __int64 & userTime);
-
-   ////////////////////////////////////////////////
-   // Set of static variables to be accessed from
-   // within critical section by multiple threads:
-   //
-   static DWORD s_TickMark;
-   static __int64 s_time;
-   static __int64 s_idleTime;
-   static __int64 s_kernelTime;
-   static __int64 s_userTime;
-   static int s_lastCpu;
-   static int s_cpu[5];
-   static __int64 s_kernelTimeProcess;
-   static __int64 s_userTimeProcess;
-   static int s_cpuProcess[5];
-    static int s_count;
-    static int s_index;
-   //
-   /////////////////////////////////////////////////
-
-   pfnGetSystemTimes s_pfnGetSystemTimes;
-   pfnNtQuerySystemInformation s_pfnNtQuerySystemInformation;
-   CRITICAL_SECTION m_cs;
-   PROC_PERF_INFO * m_pInfo;
-   ULONG m_uInfoLength;
-};
diff --git a/ica/win32/winvnc/winvnc/Dtwinver.cpp b/ica/win32/winvnc/winvnc/Dtwinver.cpp
deleted file mode 100644
index ef43635..0000000
--- a/ica/win32/winvnc/winvnc/Dtwinver.cpp
+++ /dev/null
@@ -1,2074 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-/*
-Module : Dtwinver.cpp
-Purpose: Implementation of a comprehensive function to perform OS version detection
-Created: PJN / 11-05-1996
-History: PJN / 24-02-1997 A number of updates including support for NT 3.1, 
-                          single mode dos in Windows 95 and better Windows
-                          version detecion under real mode dos.
-         PJN / 13-09-1998 1.  Added explicit support for Windows 98 
-                          2.  Updated documentation to use HTML. 
-                          3.  Minor update to the web page describing it. 
-         PJN / 22-06-1999 1.  UNICODE enabled the code.
-                          2.  Removed need for the dwOSVersionInfoSize variable
-                          3.  Added support for detecting Build Number of 95 and 98 from DOS code path.
-                          4.  Now ships as standard with VC 5 workspace files
-                          5.  Added explicit support for Windows 95 SP 1
-                          6.  Added explicit support for Windows 95 OSR 2
-                          7.  Added explicit support for Windows 98 Second Edition
-                          8.  Added explicit support for Windows 2000
-                          9.  Added explicit support for Windows CE
-                          10. Added explicit support for Windows Terminal Server's
-                          11. Added explicit support for NT Stand Alone Server's.
-                          12. Added explicit support for NT Primary Domain Controller's
-                          13. Added explicit support for NT Backup Domain Controller's
-         PJN / 23-07-1999 Tested out support for Windows 98 SE, minor changes required
-         PJN / 26-07-1999 Added explicit support for Windows 98 SP 1
-         PJN / 28-07-1999 1. Fixed a problem when application is build in non-huge/large 
-                          memory model in Win16
-                          2. Added explicit support for returning NT and Win9x service pack information 
-                          from Win32 and Win16 code paths
-                          3. Updated test program to not bother reporting on any info which does not 
-                          exist. e.g. if there is no service pack installed, then we don't bother 
-                          displaying any info about service packs
-                          4. Added explicit support for NT Enterprise Edition
-         PJN / 30-06-2000 1. Added explicit support for Windows Millennium Edition
-         PJN / 29-01-2001 1. Added explicit support for Windows XP (Whistler) Personal
-                          2. Added explicit support for Windows XP (Whistler) Professional
-                          3. Added explicit support for Windows XP (Whistler) Server
-                          4. Added explicit support for Windows XP (Whistler) Advanced Server
-                          5. Added explicit support for Windows XP (Whistler) Datacenter
-                          6. Added explicit support for Windows XP (Whistler) 64 bit (all flavours)
-                          7. Made all the code into a C++ class called COSVersion
-                          8. Rewrote all the generic thunk code to be easier to follow
-                          9. Generic think code now uses CallProcEx32W
-                          10. Added explicit support for BackOffice Small Business Edition
-                          11. Added explicit support for Terminal Services
-                          12. 16 bit code path now can determine ProductSuite and ProductType type
-                          thro additional generic thunk code
-                          13. Provided a 64 bit test binary and make batch file (make64.bat) for 
-                          those lucky enough to have an Itanium processor and a beta of 64 bit Windows XP (Whistler).
-                          14. Provided a Embedded C++ workspace and X86 Release binary.
-                          15. Updated copyright information           
-         PJN / 10-02-2001 1. Updated function names etc following MS decision to call Whistler "Windows XP"
-         PJN / 10-10-2001 1. Added code to 32 bit code path to detect if we are being run under 64 bit Windows. Also
-                          updated the sample app to distinguish between emulated 64 bit and underlying 
-                          64 bit.
-                          2. Updated the sample app to call XP Server its proper name which will be "Windows.NET Server"
-         PJN / 13-12-2001 1. Major upgrade. Now 16 bit DOS path can return as much information as native Win32 code. 
-                          This is achieved by spawning off the Win32 utility WriteVer with a special command line option.
-                          Please note that if you intend deploying dtwinver then you must now ship the writever.exe file
-                          in addition to linking in the dtwinver code into your application. Also this utilty needs
-                          to be in the path or current directory when the dtwinver code is executing. Thanks to Chaz Angell
-                          for prompted me into finding a solution for this last major item missing in dtwinver.
-         PJN / 30-12-2002 1. Provided an update CE workspace to work correctly in eMbedded Visual C++ v3. All build configurations
-                          for eVC 3 have also been provided.
-                          2. Optimized the usage of _tcscat and _tcscpy in the test app which comes with Dtwinver.cpp
-                          3. OEM Info string and Platform Type string is now returned for CE code path
-                          4. Fixed display of minor version number for example Windows .NET is version number v5.20 but
-                          should be shown as 5.2 to be consistent with what the native ver command displays
-                          5. Provided a new CE workspace to work correctly in eMbedded Visual C++ v4. All build configurations
-                          for eVC 4 have also been provided.
-         PJN / 08-10-2002 1. Now uses OSVERSIONINFOEX it possible in the Win32 or Win64 code paths. This provides for
-                          more reliably detection of Windows XP Home Edition.
-                          2. Renamed the functions which detect Windows .NET Server 2003. Also updated the test code which
-                          prints out these names
-                          3. Provided explicit support for Windows .NET Web Server
-                          4. Fixed a bug in the display of the minor OS version number on Windows .NET Server.
-                          5. Made the project for WriteVer a VC 5 project instead of VC 6 which it was up until now.
-                          6. Reworked the internal function WhichNTProduct to use a constant input string parameter
-                          7. Added explicit support for Windows NT / 2000 / XP Embedded
-                          8. Added explicit support for detecting Terminal Services in remote admin mode
-         PJN / 10-10-2002 1.  Fixed a problem where on Windows XP, the test program will include the text "(Standard Edition)"
-                          2.  Added two variables to the OS_VERSION_INFO structure to report the minor service pack number
-                          3.  Removed the OS_VERSION_INFO structure from the global namespace
-                          4.  Removed all static member variables from the class
-                          5.  Added a member variable to the OS_VERSION_INFO to return the various "suites" installed
-                          6.  reduced the number of calls to WriteVer to 1 when called from dos code path.
-                          7.  Completely reworked the internal WhichNTProduct method
-                          8.  General tidy up of the header file
-                          9.  Completely reworked the ValidateProductSuite method
-                          10. Now only 1 call is made to WhichNTProduct throughout a single call to COSVersion::GetVersion
-                          11. Now only 1 call is made to ValidateProductSuite throughout a single call to COSVersion::GetVersion
-                          12. Fixed an unitialized variable problem in COSVersion::IsUnderlying64Bit
-                          13. Changed "WhichNTProduct" method to "GetNTOSTypeFromRegistry"
-                          14. Changed "ValidateProductSuite" method to "GetProductSuiteDetailsFromRegistry".
-                          15. Now correctly reports on Terminal Services being in Remote Admin Mode on OS which do not
-                          support calling GetVersionEx using an OSVERSIONINFOEX structure i.e any NT 4 install prior to SP6.
-                          16. 16 bit Windows code path now reports as much NT information as the Win32 code path 
-                          17. Fixed a bug in COSVersion::GetInfoBySpawingWriteVer which was failing if it encountered 
-                          an empty CSD string. This was spotted on Windows .NET Server which since it is in beta still
-                          (as of October 2002) does not have any service pack!.
-         PJN / 10-01-2003 1. Update to support MS deciding to change the name of their Whistler Server product. The product 
-                          will now be called "Windows Server 2003".
-         PJN / 30-01-2003 1. Added explicit support for detecting NT Service Pack 6a
-         PJN / 08-02-2003 1. Added explicit support for detecting Windows XP Service Pack 1a
-                          2. Added support to determine the HAL on NT Kernels.
-         PJN / 12-02-2003 1. Fixed a compiler warning in GetNTServicePackFromRegistry which occurs when the code is compiled
-                          with the Watcom compiler. Thanks to Christian Kaiser for reporting this.
-         PJN / 08-03-2003 1. Updated a comment in COSVersion::GetProductSuiteDetailsFromRegistry re NT Embedded.
-                          2. A comment from John A. Vorchak: On NTe (NT Embedded) and XPE (XP Embedded), all of the versions 
-                          (of DTWinver) work just fine so long as the components to support them are included in the images, 
-                          which itself is kind of a crap shoot.  I think that you would probably find that most images will 
-                          not support the DOS or Win16 versions however most will support the Win32.  Many of the images that 
-                          folks build either do not include the DOS subsystem and some of them do not include Explorer, so it 
-                          really can't be said that all builds will support them however it is not difficult for a developer 
-                          to understand which version would work for them as they understand their target systems better than 
-                          anyone and at least one version would certainly work for almost all images. 
-                          As far as Win2k (Server Appliance Kit), I haven't done enough testing with that platform, nor do I 
-                          currently have any built images with the SAK to say positively or otherwise. More than likely you 
-                          would find no problems with the SAK images since they typically follow W2k much more than NTe or 
-                          XPE do.
-                          Author: If you are writing for an embedded OS, then there is little use for DTWinver!!, since the
-                          developer has very tight control over the runtime environment. Also if you do use DTWinver on an 
-                          embedded version of Windows, you will probably compile in the dtwinver code rather than ship the 
-                          sample binaries I include in the dtwinver download.
-         PJN / 09-04-2004 1. Removed a number of unreferrenced variable warnings when you compile the code on on VS.NET 2003.
-                          Thanks to Edward Livingston for reporting these issues.
-                          2. Now includes support for Windows XP Media Center Edition. Please note that if you want to do
-                          specific version checking of what version of Media Center you have installed then you should use
-                          my CVersionInfo classes at http://www.naughter.com/versioninfo.html in conjunction with the following 
-                          information which I culled from http://www.mvps.org/marksxp/MediaCenter/2004/version.php which
-                          describes the various version numbers of ehshell.exe in \Windows\ehome to the corresponding versions
-                          of XP Media Center Edition.
-                         
-                          Windows XP Media Center Edition: 2002    5.1.2600.1106 First released version of Windows Media Center  
-                                                                   5.1.2600.1142 Highest released build of Media Center 2002 
-                                                                                 (provided via Q815487) 
-                          Windows XP Media Center Edition: 2004    5.1.2600.1217 Release build of Windows Media Center 2004 
-                                                                                 (upgrade over previous MCE 2002 build).  
-                                                                   5.1.2600.1321 December 2003 Hotfix for Media Center 2004 version 
-                                                                                 (provided via Q830786) 
-                                                                   5.1.2600.2096 Media Center Version included with Windows XP 
-                                                                                 Service Pack 2 Release Candidate 1. This version can 
-                                                                                 be installed over a current MCE 2002 or 2004 using 
-                                                                                 the Windows XP Service Pack 2 installer. If you have 
-                                                                                 any build between 1322 and 2095 assume this to be 
-                                                                                 a beta version.  
-                          3. dtwinver now returns the processor architecture via a call to GetSystemInfo or GetNativeSystemInfo. 
-                          This is used to differentiate between 64 Bit Windows on Itanium and AMD64 processors.
-                          4. Renamed the global preprocesor defines used by dtwinver to use more unique names
-                          5. Added make files and binaries for AMD64 processors
-
-Copyright (c) 1997 - 2004 by PJ Naughter.  (Web: www.naughter.com, Email: pjna at naughter.com)
-
-All rights reserved.
-
-Copyright / Usage Details:
-
-You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
-when your product is released in binary form. You are allowed to modify the source code in any way you want 
-except you cannot modify the copyright details at the top of each module. If you want to distribute source 
-code with your application, then you are only allowed to distribute versions released by the author. This is 
-to maintain a single distribution point for the source code. 
-*/
-
-
-/////////////////////////////////  Includes  //////////////////////////////////
-#include <windows.h> 
-#include <ctype.h>
-#if defined(_WIN32) || defined(_WIN64)
-#include <tchar.h>
-#else
-#include <stdlib.h>
-#include <shellapi.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include "Dtwinver.h"
-
-
-/////////////////////////////////  Local function / variables /////////////////
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_NT_WORKSTATION
-#define VER_NT_WORKSTATION              0x0000001
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_NT_DOMAIN_CONTROLLER
-#define VER_NT_DOMAIN_CONTROLLER        0x0000002
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_NT_SERVER
-#define VER_NT_SERVER                   0x0000003
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_SHX
-#define PROCESSOR_ARCHITECTURE_SHX    4
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_ARM
-#define PROCESSOR_ARCHITECTURE_ARM    5
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_IA64
-#define PROCESSOR_ARCHITECTURE_IA64    6
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_ALPHA64
-#define PROCESSOR_ARCHITECTURE_ALPHA64    7
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_MSIL
-#define PROCESSOR_ARCHITECTURE_MSIL    8
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_AMD64
-#define PROCESSOR_ARCHITECTURE_AMD64    9
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
-#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64    10
-#endif
-
-
-
-//OS_VERSION_INFO::wSuiteMask can any of the following bit masks
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_SMALLBUSINESS
-#define VER_SUITE_SMALLBUSINESS             0x00000001
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_ENTERPRISE
-#define VER_SUITE_ENTERPRISE                0x00000002
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_TERMINAL
-#define VER_SUITE_TERMINAL                  0x00000010
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_DATACENTER
-#define VER_SUITE_DATACENTER                0x00000080
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_PERSONAL
-#define VER_SUITE_PERSONAL                  0x00000200
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_BLADE
-#define VER_SUITE_BLADE                     0x00000400
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_EMBEDDEDNT
-#define VER_SUITE_EMBEDDEDNT                0x00000040
-#endif
-
-//Taken from Platform SDK's WinNT.h file
-#ifndef VER_SUITE_SINGLEUSERTS
-#define VER_SUITE_SINGLEUSERTS              0x00000100
-#endif
-
-
-#if defined(_WIN32)
-
-//Taken from Windows CE winbase.h file
-#ifndef VER_PLATFORM_WIN32_CE
-  #define VER_PLATFORM_WIN32_CE         3
-#endif
-
-#endif //defined(_WIN32) 
-
-#ifdef _DOS
-  WORD WinVer;
-  BYTE bRunningWindows;
-#endif //ifdef _DOS
-
-
-////////////////////////////////// Implementation /////////////////////////////
-COSVersion::COSVersion()
-{
-#if defined(_WINDOWS) && !defined(_WIN32) && !defined(_WIN64)
-  //Initialize the values to sane defaults
-  m_lpfnLoadLibraryEx32W = NULL;
-  m_lpfnFreeLibrary32W = NULL;
-  m_lpfnGetProcAddress32W = NULL;
-  m_lpfnCallProcEx32W = NULL;
-  m_hAdvApi32 = 0;    
-  m_hKernel32 = 0;
-  m_lpfnRegQueryValueExA= 0;
-  m_lpfnGetVersionExA = 0;
-  m_lpfnGetVersion = 0;
-  m_lpfnGetSystemInfo = 0;
-  m_lpfnGetNativeSystemInfo = 0;
-
-  //Get Kernel dll handle
-  HMODULE hKernel = GetModuleHandle("KERNEL");
-  if (hKernel)
-  {
-    //Dynamically link to the functions we want
-    m_lpfnLoadLibraryEx32W  = (lpfnLoadLibraryEx32W)  GetProcAddress(hKernel, "LoadLibraryEx32W");
-    m_lpfnFreeLibrary32W    = (lpfnFreeLibrary32W)    GetProcAddress(hKernel, "FreeLibrary32W");
-    m_lpfnGetProcAddress32W = (lpfnGetProcAddress32W) GetProcAddress(hKernel, "GetProcAddress32W");
-    m_lpfnCallProcEx32W     = (lpfnCallProcEx32W)     GetProcAddress(hKernel, "_CallProcEx32W");
-    if (m_lpfnLoadLibraryEx32W && m_lpfnFreeLibrary32W)
-    {
-      m_hAdvApi32 = m_lpfnLoadLibraryEx32W("ADVAPI32.DLL", NULL, 0);
-      if (m_hAdvApi32)                                                   
-        m_lpfnRegQueryValueExA = m_lpfnGetProcAddress32W(m_hAdvApi32, "RegQueryValueExA"); 
-      m_hKernel32 = m_lpfnLoadLibraryEx32W("KERNEL32.DLL", NULL, 0);
-      if (m_hKernel32)
-      {                                                               
-        m_lpfnGetVersionExA = m_lpfnGetProcAddress32W(m_hKernel32, "GetVersionExA");
-        m_lpfnGetVersion = m_lpfnGetProcAddress32W(m_hKernel32, "GetVersion");
-        m_lpfnGetSystemInfo = m_lpfnGetProcAddress32W(m_hKernel32, "GetSystemInfo");
-        m_lpfnGetNativeSystemInfo = m_lpfnGetProcAddress32W(m_hKernel32, "GetNativeSystemInfo");
-      }
-    }
-  }
-#endif
-}
-
-COSVersion::~COSVersion()
-{
-#if defined(_WINDOWS) && !defined(_WIN32) && !defined(_WIN64)
-  if (m_lpfnFreeLibrary32W)
-  {           
-    if (m_hAdvApi32)
-      m_lpfnFreeLibrary32W(m_hAdvApi32);
-    if (m_hKernel32)
-      m_lpfnFreeLibrary32W(m_hKernel32);
-  }
-#endif
-}
-
-#if defined(_WINDOWS) && (!defined(_WIN32) && !defined(_WIN64))
-BOOL COSVersion::WFWLoaded()
-{
-  const WORD WNNC_NET_MultiNet         = 0x8000;
-  const WORD WNNC_SUBNET_WinWorkgroups = 0x0004;
-  const WORD WNNC_NET_TYPE             = 0x0002;
-  BOOL rVal;
-   
-  HINSTANCE hUserInst = LoadLibrary("USER.EXE");
-  lpfnWNetGetCaps lpWNetGetCaps = (lpfnWNetGetCaps) GetProcAddress(hUserInst, "WNetGetCaps");
-  if (lpWNetGetCaps != NULL)
-  {
-    // Get the network type
-    WORD wNetType = lpWNetGetCaps(WNNC_NET_TYPE);
-    if (wNetType & WNNC_NET_MultiNet)
-    {
-      // a multinet driver is installed
-      if (LOBYTE(wNetType) & WNNC_SUBNET_WinWorkgroups) // It is WFW
-        rVal = TRUE;
-      else // It is not WFW
-        rVal = FALSE;
-    }
-    else
-     rVal = FALSE;
-  }
-  else
-    rVal = FALSE;
-   
-  //Clean up the module instance
-  if (hUserInst)
-    FreeLibrary(hUserInst);
-    
-  return rVal;  
-}
-
-LONG COSVersion::RegQueryValueEx(HKEY32 hKey, LPSTR  lpszValueName, LPDWORD lpdwReserved, LPDWORD lpdwType, LPBYTE  lpbData, LPDWORD lpcbData)
-{                                             
-  //Assume the worst
-  DWORD dwResult = ERROR_CALL_NOT_IMPLEMENTED;
-
-  if (m_lpfnRegQueryValueExA)
-    dwResult = m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 6, 0x3e, m_lpfnRegQueryValueExA, hKey, lpszValueName, lpdwReserved, lpdwType, lpbData, lpcbData);
-
-  return dwResult;
-}                 
-
-BOOL COSVersion::GetVersionEx(LPOSVERSIONINFO lpVersionInfo)
-{
-  //Assume the worst
-  BOOL bSuccess = FALSE;
-
-  if (m_lpfnGetVersionExA)
-    bSuccess = (BOOL) m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 1, 1, m_lpfnGetVersionExA, lpVersionInfo, 0);
-
-  return bSuccess;
-}
-
-void COSVersion::GetProcessorType(LPOS_VERSION_INFO lpVersionInformation)
-{
-  //Get the processor details
-  SYSTEM_INFO EmulatedSI;
-  EmulatedSI.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_UNKNOWN;
-  SYSTEM_INFO UnderlyingSI;
-  UnderlyingSI.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_UNKNOWN;
-
-  if (m_lpfnGetNativeSystemInfo)
-  {
-    m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 1, 1, m_lpfnGetNativeSystemInfo, &UnderlyingSI, 0);
-  
-    if (m_lpfnGetSystemInfo)
-      m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 1, 1, m_lpfnGetSystemInfo, &EmulatedSI, 0);
-  }
-  else
-  {
-    if (m_lpfnGetSystemInfo)
-      m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 1, 1, m_lpfnGetSystemInfo, &EmulatedSI, 0);
-
-    memcpy(&EmulatedSI, &UnderlyingSI, sizeof(SYSTEM_INFO));
-  }
-
-  //Map from the SYTEM_INFO wProcessorArchitecture defines to our equivalents
-  switch (UnderlyingSI.wProcessorArchitecture)
-  {
-    case PROCESSOR_ARCHITECTURE_INTEL: //deliberate fallthrough
-    case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
-    {
-      lpVersionInformation->UnderlyingProcessorType = INTEL_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_MSIL:
-    {
-      lpVersionInformation->UnderlyingProcessorType = MSIL_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_MIPS:
-    {
-      lpVersionInformation->UnderlyingProcessorType = MIPS_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ARM:
-    {
-      lpVersionInformation->UnderlyingProcessorType = ARM_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_SHX:
-    {
-      lpVersionInformation->UnderlyingProcessorType = SHX_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ALPHA:
-    {
-      lpVersionInformation->UnderlyingProcessorType = ALPHA_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ALPHA64:
-    {
-      lpVersionInformation->UnderlyingProcessorType = ALPHA64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_PPC:
-    {
-      lpVersionInformation->UnderlyingProcessorType = PPC_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_IA64:
-    {
-      lpVersionInformation->UnderlyingProcessorType = IA64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_AMD64:
-    {
-      lpVersionInformation->UnderlyingProcessorType = AMD64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_UNKNOWN: //Deliberate fallthrough
-    default:
-    {
-      lpVersionInformation->UnderlyingProcessorType = UNKNOWN_PROCESSOR;
-      break;
-    }
-  }
-  switch (EmulatedSI.wProcessorArchitecture)
-  {
-    case PROCESSOR_ARCHITECTURE_INTEL: //deliberate fallthrough
-    case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
-    {
-      lpVersionInformation->EmulatedProcessorType = INTEL_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_MSIL:
-    {
-      lpVersionInformation->EmulatedProcessorType = MSIL_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_MIPS:
-    {
-      lpVersionInformation->EmulatedProcessorType = MIPS_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ARM:
-    {
-      lpVersionInformation->EmulatedProcessorType = ARM_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_SHX:
-    {
-      lpVersionInformation->EmulatedProcessorType = SHX_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ALPHA:
-    {
-      lpVersionInformation->EmulatedProcessorType = ALPHA_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_ALPHA64:
-    {
-      lpVersionInformation->EmulatedProcessorType = ALPHA64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_PPC:
-    {
-      lpVersionInformation->EmulatedProcessorType = PPC_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_IA64:
-    {
-      lpVersionInformation->EmulatedProcessorType = IA64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_AMD64:
-    {
-      lpVersionInformation->EmulatedProcessorType = AMD64_PROCESSOR;
-      break;
-    }
-    case PROCESSOR_ARCHITECTURE_UNKNOWN: //Deliberate fallthrough
-    default:
-    {
-      lpVersionInformation->EmulatedProcessorType = UNKNOWN_PROCESSOR;
-      break;
-    }
-  }
-}
-
-DWORD COSVersion::GetVersion()
-{
-  //Assume the worst
-  DWORD dwVersion = 0;
-
-  if (m_lpfnGetVersion)
-    dwVersion = (BOOL) m_lpfnCallProcEx32W(CPEX_DEST_STDCALL | 0, 0, m_lpfnGetVersion, 0);
-
-  return dwVersion;
-}
-#endif //defined(_WINDOWS) && !defined(_WIN32)
-
-BOOL COSVersion::GetVersion(LPOS_VERSION_INFO lpVersionInformation)
-{
-  //Zero out everything in the structure
-  memset(lpVersionInformation, 0, sizeof(*lpVersionInformation));
-                
-  #ifdef UNDER_CE
-    OSVERSIONINFO osvi;
-    memset(&osvi, 0, sizeof(OSVERSIONINFO));
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-    if (!GetVersionEx(&osvi))
-      return FALSE;
-
-    //Basic OS info
-    lpVersionInformation->dwUnderlyingMajorVersion = osvi.dwMajorVersion; 
-    lpVersionInformation->dwUnderlyingMinorVersion = osvi.dwMinorVersion; 
-    lpVersionInformation->dwUnderlyingBuildNumber = LOWORD(osvi.dwBuildNumber); //ignore HIWORD
-    lpVersionInformation->UnderlyingPlatform = WindowsCE;
-    _tcscpy(lpVersionInformation->szUnderlyingCSDVersion, osvi.szCSDVersion);
-
-    //OEM Info
-    _tcscpy(lpVersionInformation->szOEMInfo, _T(""));
-    SystemParametersInfo(SPI_GETOEMINFO, 256, lpVersionInformation->szOEMInfo, 0);
-
-    //Platform Type
-    _tcscpy(lpVersionInformation->szPlatformType, _T(""));
-    SystemParametersInfo(SPI_GETPLATFORMTYPE, 256, lpVersionInformation->szPlatformType, 0);
-
-    //Always set the OSType to Workstation on CE. The variable itself does not make 
-    //much sense on CE, but we do not conditionally compile it out on CE as then we
-    //would have to put in loadsa ifdefs UNDER_CE in the COSVersion::Is... methods
-    lpVersionInformation->OSType = Workstation;
-
-  #elif defined(_WIN32) || defined(_WIN64)
-    //determine dynamically if GetVersionEx is available, if 
-    //not then drop back to using GetVersion
-
-    // Get Kernel handle
-    HMODULE hKernel32 = GetModuleHandle(_T("KERNEL32.DLL"));
-    if (hKernel32 == NULL)
-      return FALSE;
-
-    #ifdef _UNICODE
-      lpfnGetVersionEx lpGetVersionEx = (lpfnGetVersionEx) GetProcAddress(hKernel32, "GetVersionExW");
-    #else
-      lpfnGetVersionEx lpGetVersionEx = (lpfnGetVersionEx) GetProcAddress(hKernel32, "GetVersionExA");
-    #endif
-
-    if (lpGetVersionEx)
-    {
-      OSVERSIONINFOEX osviex;
-      memset(&osviex, 0, sizeof(OSVERSIONINFOEX));
-      osviex.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
-      OSVERSIONINFO osvi;
-      memset(&osvi, 0, sizeof(OSVERSIONINFO));
-      osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
-      BOOL bGotOSviEx = lpGetVersionEx((LPOSVERSIONINFO) &osviex);
-      if (!bGotOSviEx)
-      {
-        if (!lpGetVersionEx(&osvi))
-          return FALSE;
-      }
-
-      if (bGotOSviEx)
-      {
-        lpVersionInformation->dwEmulatedMajorVersion = osviex.dwMajorVersion;
-        lpVersionInformation->dwEmulatedMinorVersion = osviex.dwMinorVersion;
-        lpVersionInformation->dwEmulatedBuildNumber = LOWORD(osviex.dwBuildNumber);
-        _tcscpy(lpVersionInformation->szEmulatedCSDVersion, osviex.szCSDVersion);
-        lpVersionInformation->wEmulatedServicePackMajor = osviex.wServicePackMajor;
-        lpVersionInformation->wEmulatedServicePackMinor = osviex.wServicePackMinor;
-        
-        //Explicitly map the Win32 wSuiteMask to our own values
-        if (osviex.wSuiteMask & VER_SUITE_SMALLBUSINESS)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_SMALLBUSINESS;
-        if (osviex.wSuiteMask & VER_SUITE_ENTERPRISE)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_ENTERPRISE;
-        if (osviex.wSuiteMask & VER_SUITE_TERMINAL)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_TERMINAL;
-        if (osviex.wSuiteMask & VER_SUITE_DATACENTER)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_DATACENTER;
-        if (osviex.wSuiteMask & VER_SUITE_PERSONAL)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_PERSONAL;
-        if (osviex.wSuiteMask & VER_SUITE_BLADE)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_WEBEDITION;
-        if (osviex.wSuiteMask & VER_SUITE_EMBEDDEDNT)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_EMBEDDEDNT;
-        if (osviex.wSuiteMask & VER_SUITE_SINGLEUSERTS)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_REMOTEADMINMODE_TERMINAL;
-
-        //Explicitely map the Win32 wProductType to our own values
-        switch (osviex.wProductType)
-        {
-          case VER_NT_WORKSTATION:
-          {
-            lpVersionInformation->OSType = Workstation;
-            break;
-          }
-          case VER_NT_DOMAIN_CONTROLLER:
-          {
-            lpVersionInformation->OSType = DomainController;
-            break;
-          }
-          case VER_NT_SERVER:
-          {
-            lpVersionInformation->OSType = Server;
-            break;
-          }
-          default:
-          {
-            break;
-          }
-        }
-
-        //Determine the Domain Controller Type
-        GetNTOSTypeFromRegistry(lpVersionInformation, TRUE);
-
-        //Get the media center details
-        GetMediaCenterDetailsFromRegistry(lpVersionInformation);
-
-        //Explicitly map the win32 dwPlatformId to our own values 
-        switch (osviex.dwPlatformId)
-        {
-          case VER_PLATFORM_WIN32_WINDOWS:
-          {
-            lpVersionInformation->EmulatedPlatform = Windows9x;
-            break;
-          }
-          case VER_PLATFORM_WIN32_NT:
-          {
-            lpVersionInformation->EmulatedPlatform = WindowsNT;
-            break;
-          }
-          case VER_PLATFORM_WIN32_CE:
-          {
-            lpVersionInformation->EmulatedPlatform = WindowsCE;
-            break;
-          }
-          default:
-          {
-            break;
-          }
-        }
-
-        lpVersionInformation->dwUnderlyingMajorVersion = lpVersionInformation->dwEmulatedMajorVersion; 
-        lpVersionInformation->dwUnderlyingMinorVersion = lpVersionInformation->dwEmulatedMinorVersion; 
-        lpVersionInformation->dwUnderlyingBuildNumber = lpVersionInformation->dwEmulatedBuildNumber;
-        lpVersionInformation->UnderlyingPlatform = lpVersionInformation->EmulatedPlatform;
-        _tcscpy(lpVersionInformation->szUnderlyingCSDVersion, lpVersionInformation->szEmulatedCSDVersion);
-        lpVersionInformation->wUnderlyingServicePackMajor = lpVersionInformation->wEmulatedServicePackMajor;
-        lpVersionInformation->wUnderlyingServicePackMinor = lpVersionInformation->wEmulatedServicePackMinor;
-
-      #ifndef UNDER_CE
-        //Determine if it is NT SP6a Vs SP6
-        GetNTSP6aDetailsFromRegistry(lpVersionInformation, TRUE);
-
-        //Determine if it is XP SP1a Vs SP1
-        GetXPSP1aDetailsFromRegistry(lpVersionInformation, TRUE);
-
-        //Determine the HAL details
-        GetNTHALDetailsFromRegistry(lpVersionInformation);
-	    #endif
-      }
-      else
-      {
-        lpVersionInformation->dwEmulatedMajorVersion = osvi.dwMajorVersion; 
-        lpVersionInformation->dwEmulatedMinorVersion = osvi.dwMinorVersion; 
-        lpVersionInformation->dwEmulatedBuildNumber = LOWORD(osvi.dwBuildNumber); //ignore HIWORD
-        _tcscpy(lpVersionInformation->szEmulatedCSDVersion, osvi.szCSDVersion);
-    
-        //Explicitely map the win32 dwPlatformId to our own values 
-        //Also work out the various service packs which are installed
-        if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
-        {
-          lpVersionInformation->EmulatedPlatform = Windows9x;
-          lpVersionInformation->OSType = Workstation;
-
-          //Deterine the Win9x Service pack installed
-          if (IsWindows95SP1(lpVersionInformation))
-          {
-            lpVersionInformation->wEmulatedServicePackMajor = 1;
-            lpVersionInformation->wUnderlyingServicePackMajor = 1;
-          }
-          else if (IsWindows95OSR2(lpVersionInformation))
-          {
-            lpVersionInformation->wEmulatedServicePackMajor = 2;
-            lpVersionInformation->wUnderlyingServicePackMajor = 2;
-          }
-          else if (IsWindows98SP1(lpVersionInformation))
-          {
-            lpVersionInformation->wEmulatedServicePackMajor = 1;
-            lpVersionInformation->wUnderlyingServicePackMajor = 1;
-          }
-        }
-        else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
-        {
-          lpVersionInformation->EmulatedPlatform = WindowsNT;
-
-          //Determine the NT Service pack
-          lpVersionInformation->wEmulatedServicePackMajor = GetNTServicePackFromCSDString(osvi.szCSDVersion);
-          lpVersionInformation->wUnderlyingServicePackMajor = lpVersionInformation->wEmulatedServicePackMajor;
-
-          //Determine the OS Type
-          GetNTOSTypeFromRegistry(lpVersionInformation, FALSE);
-
-          //Get the Product Suites installed
-          GetProductSuiteDetailsFromRegistry(lpVersionInformation);
-          GetTerminalServicesRemoteAdminModeDetailsFromRegistry(lpVersionInformation);
-        }
-        else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_CE)
-        {
-          lpVersionInformation->EmulatedPlatform = WindowsCE;
-
-          //Always set the OSType to Workstation on CE. The variable itself does not make 
-          //much sense on CE, but we do not conditionally compile it out on CE as then we
-          //would have to put in loadsa ifdefs UNDER_CE in the COSVersion::Is... methods
-          lpVersionInformation->OSType = Workstation;
-        }
-
-        if (osvi.dwPlatformId == VER_PLATFORM_WIN32s)  //32 bit app running on Windows 3.x
-        {
-          lpVersionInformation->EmulatedPlatform = Windows9x;
-
-          lpVersionInformation->dwUnderlyingMajorVersion = 3; 
-          lpVersionInformation->dwUnderlyingMinorVersion = 10; 
-          lpVersionInformation->dwUnderlyingBuildNumber = 0;
-          lpVersionInformation->UnderlyingPlatform = Windows3x;
-          _tcscpy(lpVersionInformation->szUnderlyingCSDVersion, _T(""));
-        }
-        else
-        {
-          lpVersionInformation->dwUnderlyingMajorVersion = lpVersionInformation->dwEmulatedMajorVersion; 
-          lpVersionInformation->dwUnderlyingMinorVersion = lpVersionInformation->dwEmulatedMinorVersion; 
-          lpVersionInformation->dwUnderlyingBuildNumber = lpVersionInformation->dwEmulatedBuildNumber;
-          lpVersionInformation->UnderlyingPlatform = lpVersionInformation->EmulatedPlatform;
-          _tcscpy(lpVersionInformation->szUnderlyingCSDVersion, lpVersionInformation->szEmulatedCSDVersion);
-        }
-
-        if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
-        {
-          //Determine if it is NT SP6a Vs SP6
-          GetNTSP6aDetailsFromRegistry(lpVersionInformation, TRUE);
-
-          //Determine if it is XP SP1a Vs SP1
-          GetXPSP1aDetailsFromRegistry(lpVersionInformation, TRUE);
-
-          //Determine the HAL details
-          GetNTHALDetailsFromRegistry(lpVersionInformation);
-        }
-      }
-    }
-    else
-    {
-      //Since GetVersionEx is not available we need to fall back on plain
-      //old GetVersion. Because GetVersionEx is available on all but v3.1 of NT
-      //we can fill in some of the parameters ourselves.
-      DWORD dwVersion = ::GetVersion();
-
-      lpVersionInformation->dwEmulatedMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
-      lpVersionInformation->dwEmulatedMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
-      lpVersionInformation->dwEmulatedBuildNumber = 0;
-      lpVersionInformation->EmulatedPlatform   = WindowsNT;   
-      lpVersionInformation->dwUnderlyingMajorVersion = lpVersionInformation->dwEmulatedMajorVersion;
-      lpVersionInformation->dwUnderlyingMinorVersion = lpVersionInformation->dwEmulatedMinorVersion;
-      lpVersionInformation->dwUnderlyingBuildNumber  = lpVersionInformation->dwEmulatedBuildNumber;
-      lpVersionInformation->UnderlyingPlatform   = lpVersionInformation->EmulatedPlatform;   
-      _tcscpy(lpVersionInformation->szUnderlyingCSDVersion, lpVersionInformation->szEmulatedCSDVersion);
-
-      //Need to determine the NT Service pack by querying the registry directory.
-      lpVersionInformation->wEmulatedServicePackMajor = GetNTServicePackFromRegistry();
-      lpVersionInformation->wUnderlyingServicePackMajor = lpVersionInformation->wEmulatedServicePackMajor;
-    }
-
-  #ifndef UNDER_CE
-    //Get the processor details
-    if (hKernel32)
-    {
-      SYSTEM_INFO EmulatedSI;
-      SYSTEM_INFO UnderlyingSI;
-
-      lpfnGetNativeSystemInfo pGetNativeSystemInfo = (lpfnGetNativeSystemInfo) GetProcAddress(hKernel32, "GetNativeSystemInfo"); 
-      if (pGetNativeSystemInfo)
-      {
-        pGetNativeSystemInfo(&UnderlyingSI);
-        GetSystemInfo(&EmulatedSI);
-      }
-      else
-      {
-        GetSystemInfo(&UnderlyingSI);
-        CopyMemory(&EmulatedSI, &UnderlyingSI, sizeof(SYSTEM_INFO));
-      }
-
-      //Map from the SYTEM_INFO wProcessorArchitecture defines to our equivalents
-      switch (UnderlyingSI.wProcessorArchitecture)
-      {
-        case PROCESSOR_ARCHITECTURE_INTEL: //deliberate fallthrough
-        case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
-        {
-          lpVersionInformation->UnderlyingProcessorType = INTEL_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_MSIL:
-        {
-          lpVersionInformation->UnderlyingProcessorType = MSIL_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_MIPS:
-        {
-          lpVersionInformation->UnderlyingProcessorType = MIPS_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ARM:
-        {
-          lpVersionInformation->UnderlyingProcessorType = ARM_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_SHX:
-        {
-          lpVersionInformation->UnderlyingProcessorType = SHX_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ALPHA:
-        {
-          lpVersionInformation->UnderlyingProcessorType = ALPHA_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ALPHA64:
-        {
-          lpVersionInformation->UnderlyingProcessorType = ALPHA64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_PPC:
-        {
-          lpVersionInformation->UnderlyingProcessorType = PPC_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_IA64:
-        {
-          lpVersionInformation->UnderlyingProcessorType = IA64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_AMD64:
-        {
-          lpVersionInformation->UnderlyingProcessorType = AMD64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_UNKNOWN: //Deliberate fallthrough
-        default:
-        {
-          lpVersionInformation->UnderlyingProcessorType = UNKNOWN_PROCESSOR;
-          break;
-        }
-      }
-
-      switch (EmulatedSI.wProcessorArchitecture)
-      {
-        case PROCESSOR_ARCHITECTURE_INTEL: //deliberate fallthrough
-        case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
-        {
-          lpVersionInformation->EmulatedProcessorType = INTEL_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_MSIL:
-        {
-          lpVersionInformation->EmulatedProcessorType = MSIL_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_MIPS:
-        {
-          lpVersionInformation->EmulatedProcessorType = MIPS_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ARM:
-        {
-          lpVersionInformation->EmulatedProcessorType = ARM_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_SHX:
-        {
-          lpVersionInformation->EmulatedProcessorType = SHX_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ALPHA:
-        {
-          lpVersionInformation->EmulatedProcessorType = ALPHA_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_ALPHA64:
-        {
-          lpVersionInformation->EmulatedProcessorType = ALPHA64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_PPC:
-        {
-          lpVersionInformation->EmulatedProcessorType = PPC_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_IA64:
-        {
-          lpVersionInformation->EmulatedProcessorType = IA64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_AMD64:
-        {
-          lpVersionInformation->EmulatedProcessorType = AMD64_PROCESSOR;
-          break;
-        }
-        case PROCESSOR_ARCHITECTURE_UNKNOWN: //Deliberate fallthrough
-        default:
-        {
-          lpVersionInformation->EmulatedProcessorType = UNKNOWN_PROCESSOR;
-          break;
-        }
-      }
-    }
-  #endif
-  
-  #else //We must be runing on an emulated or real version of Win16 or DOS
-    lpVersionInformation->EmulatedProcessorType = INTEL_PROCESSOR; //We can only be running Intel(x86) code from Win16 or DOS
-
-    #ifdef _WINDOWS //Running on some version of Windows                   
-      DWORD dwVersion = GetVersion();
-      // GetVersion does not differentiate between Windows 3.1 and Windows 3.11
-      
-      lpVersionInformation->dwEmulatedMajorVersion = LOBYTE(LOWORD(dwVersion)); 
-      lpVersionInformation->dwEmulatedMinorVersion = HIBYTE(LOWORD(dwVersion));
-      lpVersionInformation->dwEmulatedBuildNumber  = 0; //no build number with Win3.1x
-      lpVersionInformation->EmulatedPlatform       = Windows3x;
-      
-      //Call to get the underlying OS here through 16 -> 32 bit Generic Thunk
-      BOOL bFoundUnderlyingOS = FALSE;
-      OSVERSIONINFO osvi;                      
-      memset(&osvi, 0, sizeof(OSVERSIONINFO));
-      osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-      if (GetVersionEx(&osvi))
-      {
-        lpVersionInformation->dwUnderlyingMajorVersion = osvi.dwMajorVersion; 
-        lpVersionInformation->dwUnderlyingMinorVersion = osvi.dwMinorVersion; 
-        lpVersionInformation->dwUnderlyingBuildNumber = LOWORD(osvi.dwBuildNumber); //ignore HIWORD
-        _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, osvi.szCSDVersion);
-       
-        //Explicitely map the win32 dwPlatformId to our own values
-        if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
-        {
-          lpVersionInformation->UnderlyingPlatform = Windows9x;
-
-          //Deterine the Win9x Service pack installed
-          if (IsWindows95SP1(lpVersionInformation))
-            lpVersionInformation->wUnderlyingServicePackMajor = 1;
-          else if (IsWindows95OSR2(lpVersionInformation))
-            lpVersionInformation->wUnderlyingServicePackMajor = 2;
-          else if (IsWindows98SP1(lpVersionInformation))
-            lpVersionInformation->wUnderlyingServicePackMajor = 1;
-        }
-        else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
-        {
-          lpVersionInformation->UnderlyingPlatform = WindowsNT;
-
-          //Determine the NT Service pack
-          lpVersionInformation->wEmulatedServicePackMajor = 0; //Win16 does not have a concept of a service pack
-          lpVersionInformation->wUnderlyingServicePackMajor = GetNTServicePackFromCSDString(osvi.szCSDVersion);
-
-          //Determine the OS Type
-          GetNTOSTypeFromRegistry(lpVersionInformation, FALSE);
-
-		#ifndef UNDER_CE
-          //Determine if it is NT SP6a Vs SP6
-          GetNTSP6aDetailsFromRegistry(lpVersionInformation, FALSE);
-
-          //Determine if it is XP SP1a Vs SP1
-          GetXPSP1aDetailsFromRegistry(lpVersionInformation, FALSE);
-
-          //Determine the HAL details
-          GetNTHALDetailsFromRegistry(lpVersionInformation);
-		#endif
-
-          //Get the Product Suites installed
-          GetProductSuiteDetailsFromRegistry(lpVersionInformation);
-          GetTerminalServicesRemoteAdminModeDetailsFromRegistry(lpVersionInformation);
-          GetMediaCenterDetailsFromRegistry(lpVersionInformation);
-        }
-        else
-          return FALSE;
-       
-        bFoundUnderlyingOS = TRUE;
-      }
-      else
-      {
-        //We failed to get GetVersionEx so try to GetVersion instead. We known that we must be on
-        //Windows NT 3.5 or earlier since anything released later by MS had this function.
-        DWORD dwVersion = GetVersion();
-        if (dwVersion)
-        {              
-          lpVersionInformation->dwUnderlyingMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
-          lpVersionInformation->dwUnderlyingMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-          lpVersionInformation->dwUnderlyingBuildNumber  = 0;
-          lpVersionInformation->UnderlyingPlatform   = WindowsNT; 
-          _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, "");
-   
-          bFoundUnderlyingOS = TRUE;
-        }
-      }
-                                             
-      //Get the processor details                                       
-	  GetProcessorType(lpVersionInformation);
-
-      if (!bFoundUnderlyingOS)
-      {
-        //must be running on a real version of 16 bit Windows whose underlying OS is DOS
-        lpVersionInformation->dwUnderlyingMajorVersion = HIBYTE(HIWORD(dwVersion)); 
-        lpVersionInformation->dwUnderlyingMinorVersion = LOBYTE(HIWORD(dwVersion)); 
-        lpVersionInformation->dwUnderlyingBuildNumber = 0; 
-        lpVersionInformation->UnderlyingPlatform = Dos;
-        _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, "");
-      }
-    #else //Must be some version of real or emulated DOS
-      //Retreive the current version of emulated DOS
-      BYTE DosMinor;
-      BYTE DosMajor;
-      _asm
-      {
-        mov ax, 3306h
-        int 21h
-        mov byte ptr [DosMajor], bl
-        mov byte ptr [DosMinor], bh
-      }
-      lpVersionInformation->EmulatedPlatform = Dos;
-      lpVersionInformation->dwEmulatedMajorVersion = (DWORD) DosMajor; 
-      lpVersionInformation->dwEmulatedMinorVersion = (DWORD) DosMinor;                
-      lpVersionInformation->dwEmulatedBuildNumber = 0; //no build number with DOS
-      
-      //See can we get the underlying OS info by calling WriteVer
-      if (!GetInfoBySpawingWriteVer(lpVersionInformation))
-      {
-        //We can detect if NT is running as it reports DOS v5.5
-        if ((lpVersionInformation->dwEmulatedMajorVersion == 5) &&
-            (lpVersionInformation->dwEmulatedMinorVersion == 50))    //NT reports DOS v5.5
-        {
-          _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, "");    
-          //could not find method of determing version of NT from DOS,
-          //so assume 3.50
-          lpVersionInformation->dwUnderlyingMajorVersion = 3; 
-          lpVersionInformation->dwUnderlyingMinorVersion = 50; 
-          lpVersionInformation->dwUnderlyingBuildNumber = 0;  //cannot get access to build number from DOS
-          lpVersionInformation->UnderlyingPlatform = WindowsNT;
-        }            
-        else
-        {
-          //Get the underlying OS here via the int 2FH interface of Windows
-          GetWinInfo();
-          if (bRunningWindows)
-          { 
-            if (lpVersionInformation->dwEmulatedMajorVersion >= 7)  //Windows 9x marks itself as DOS 7 or DOS 8
-              lpVersionInformation->UnderlyingPlatform = Windows9x;
-            else                                                              
-            {
-              //Could not find method of differentiating between WFW & Win3.1 under DOS,
-              //so assume Win3.1                                     
-              lpVersionInformation->UnderlyingPlatform = Windows3x;      
-            }  
-            _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, "");
-            lpVersionInformation->dwUnderlyingMajorVersion = (WinVer & 0xFF00) >> 8; 
-            lpVersionInformation->dwUnderlyingMinorVersion = WinVer & 0x00FF; 
-  
-            if (lpVersionInformation->dwEmulatedMajorVersion >= 8)  //Windows Me reports itself as DOS v8.0
-              lpVersionInformation->dwUnderlyingBuildNumber = 3000; //This is the build number for Windows ME.
-            else
-            {
-              if (lpVersionInformation->dwEmulatedMinorVersion == 0)
-                lpVersionInformation->dwUnderlyingBuildNumber = 950; //Windows 95 Gold reports DOS v7.0                      
-              else if (lpVersionInformation->dwUnderlyingMinorVersion > 0 && 
-                       lpVersionInformation->dwUnderlyingMinorVersion < 3) 
-              {                                                            
-                //Testing for 95 SP1 has not been done, so the above check
-                //may or may not work
-                lpVersionInformation->dwUnderlyingBuildNumber = 1080; 
-              }
-              else if (lpVersionInformation->dwUnderlyingMinorVersion == 3)
-                lpVersionInformation->dwUnderlyingBuildNumber = 1212; //Windows 95 OSR2 reports DOS 7.03 from 16 bit code
-              else
-                lpVersionInformation->dwUnderlyingBuildNumber = 1998; //Windows 98 or SE. There is no way to differentiate from real mode
-                                                                      //between the two of them
-            }
-          }
-          else //must be on a real version of DOS
-          {                               
-            lpVersionInformation->dwUnderlyingMajorVersion = (DWORD) DosMajor; 
-            lpVersionInformation->dwUnderlyingMinorVersion = (DWORD) DosMinor;                
-            lpVersionInformation->dwUnderlyingBuildNumber = 0; //no build number with DOS
-            lpVersionInformation->UnderlyingPlatform = Dos;
-            _fstrcpy(lpVersionInformation->szUnderlyingCSDVersion, "");
-          }
-        }   
-      }
-    #endif  
-  #endif
-
-  return TRUE;
-}
-
-#ifndef _DOS
-void COSVersion::GetNTSP6aDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bUpdateEmulatedAlso)
-{
-#ifndef UNDER_CE
-  if ((lpVersionInformation->dwUnderlyingMajorVersion == 4) && (lpVersionInformation->wUnderlyingServicePackMajor == 6))
-  {
-    //Test for SP6 versus SP6a.
-    HKEY hKey;
-#if (defined(_WIN32) || defined(_WIN64))
-    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
-#else                                  
-	if (RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), &hKey) == ERROR_SUCCESS)
-#endif    
-    {
-      lpVersionInformation->wUnderlyingServicePackMinor = 1;         
-      if (bUpdateEmulatedAlso)
-        lpVersionInformation->wEmulatedServicePackMinor = 1;
-    }
-
-    RegCloseKey(hKey);
-  }
-#endif
-}
-#endif
-
-#ifndef _DOS
-void COSVersion::GetXPSP1aDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bUpdateEmulatedAlso)
-{
-#ifndef UNDER_CE
-  if ((lpVersionInformation->dwUnderlyingMajorVersion == 5) && (lpVersionInformation->dwUnderlyingMinorVersion != 0) && (lpVersionInformation->wUnderlyingServicePackMajor == 1))
-  {
-    //Test for SP1a versus SP1.
-    HKEY hKey;
-#if (defined(_WIN32) || defined(_WIN64))
-    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
-#else                                  
-	if (RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), &hKey) == ERROR_SUCCESS)
-#endif    
-    {
-      TCHAR sTemp[1024];
-      DWORD dwBufLen = 1024 * sizeof(TCHAR);
-
-  #if (defined(_WIN32) || defined(_WIN64))
-      if (::RegQueryValueEx(hKey, _T("SubVersionNumber"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-  #else
-      if (RegQueryValueEx(hKey, _T("SubVersionNumber"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-  #endif
-      {
-        if (_tcsicmp(sTemp, _T("a")) == 0)
-        {
-          lpVersionInformation->wUnderlyingServicePackMinor = 1;         
-          if (bUpdateEmulatedAlso)
-            lpVersionInformation->wEmulatedServicePackMinor = 1;
-        }
-      }
-    }
-
-    RegCloseKey(hKey);
-  }
-#endif
-}
-#endif
-
-#ifndef _DOS
-void COSVersion::GetNTHALDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation)
-{
-#ifndef UNDER_CE
-  HKEY hKey;
-#if (defined(_WIN32) || defined(_WIN64))
-  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
-#else                                  
-  if (RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), &hKey) == ERROR_SUCCESS)
-#endif    
-  {
-    TCHAR sTemp[1024];
-    DWORD dwBufLen = 1024 * sizeof(TCHAR);
-
-#if (defined(_WIN32) || defined(_WIN64))
-    if (::RegQueryValueEx(hKey, _T("CurrentType"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-#else
-    if (RegQueryValueEx(hKey, _T("CurrentType"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-#endif
-    {
-      if (_tcsicmp(sTemp, _T("Uniprocessor Free")) == 0)
-        lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_UNIPROCESSOR_FREE;         
-      else if (_tcsicmp(sTemp, _T("Uniprocessor Checked")) == 0)
-        lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_UNIPROCESSOR_CHECKED;         
-      else if (_tcsicmp(sTemp, _T("Multiprocessor Free")) == 0)
-        lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_MULTIPROCESSOR_FREE;         
-      else if (_tcsicmp(sTemp, _T("Multiprocessor Checked")) == 0)
-        lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_MULTIPROCESSOR_CHECKED;         
-    }
-  }
-
-  RegCloseKey(hKey);
-#endif
-}
-#endif
-      
-#ifndef _DOS
-void COSVersion::GetNTOSTypeFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bOnlyUpdateDCDetails)
-{
-  //Open and the product options key
-  HKEY hKey;
-#if (defined(_WIN32) || defined(_WIN64))
-  if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\ProductOptions"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
-#else                                                                                                                               
-  if (RegOpenKey(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\ProductOptions"), &hKey) == ERROR_SUCCESS)
-#endif
-  {
-    TCHAR sTemp[1024];
-    DWORD dwBufLen = 1024 * sizeof(TCHAR);
-
-#if (defined(_WIN32) || defined(_WIN64))
-    if (::RegQueryValueEx(hKey, _T("ProductType"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-#else
-    if (RegQueryValueEx(hKey, _T("ProductType"), NULL, NULL, (LPBYTE) sTemp, &dwBufLen) == ERROR_SUCCESS)
-#endif
-    {
-      if (bOnlyUpdateDCDetails)
-      {
-        if (_tcsicmp(sTemp, _T("LANMANNT")) == 0)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_PRIMARY_DOMAIN_CONTROLLER;
-        else if (_tcsicmp(sTemp, _T("LANSECNT")) == 0)
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_BACKUP_DOMAIN_CONTROLLER;
-      }
-      else
-      {
-        if (_tcsicmp(sTemp, _T("LANMANNT")) == 0)
-        {
-          lpVersionInformation->OSType = DomainController;
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_PRIMARY_DOMAIN_CONTROLLER;
-        }
-        else if (_tcsicmp(sTemp, _T("SERVERNT")) == 0)
-        {
-          lpVersionInformation->OSType = Server;
-        }
-        else if (_tcsicmp(sTemp, _T("LANSECNT")) == 0)
-        {
-          lpVersionInformation->OSType = DomainController;
-          lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_BACKUP_DOMAIN_CONTROLLER;
-        }
-        else if (_tcsicmp(sTemp, _T("WinNT")) == 0)
-        {
-          lpVersionInformation->OSType = Workstation;
-        }
-      }
-    }
-
-    RegCloseKey(hKey);
-  }
-}
-#endif //#ifndef _DOS
-                                   
-#ifdef _DOS             
-BOOL COSVersion::GetInfoBySpawingWriteVer(COSVersion::LPOS_VERSION_INFO lpVersionInformation)
-{
-  //Assume the worst
-  BOOL bSuccess = FALSE;
-
-  //Form the command line we need  
-  char pszCommandLine[256];      
-  char* pszTempFilename = tmpnam(NULL);
-  sprintf(pszCommandLine, "WriteVer.exe %s", pszTempFilename);
-
-  //Try to spawn out writever utilty
-  if (system(pszCommandLine) != -1)
-  {           
-    //Open the file we need                 
-    FILE* pOSFile = fopen(pszTempFilename, "r");
-    if (pOSFile == NULL)
-      return bSuccess;
-        
-    //Read in the OS version info from file
-    char pszLine[1024];
-    size_t nRead = fread(pszLine, 1, 1024, pOSFile);
-    if (nRead)
-    {
-      pszLine[nRead] = '\0'; //Don't forget to NULL terminate
-
-      //Parse the input string                               
-      char* pszSeparators = "\t";                               
-      char* pszToken = strtok(pszLine, pszSeparators);
-      if (pszToken)
-      {
-        lpVersionInformation->dwUnderlyingMajorVersion = atoi(pszToken);      
-        pszToken = strtok(NULL, pszSeparators);         
-        if (pszToken)
-        {
-          lpVersionInformation->dwUnderlyingMinorVersion = atoi(pszToken);      
-          pszToken = strtok(NULL, pszSeparators);         
-          if (pszToken)
-          {
-            lpVersionInformation->dwUnderlyingBuildNumber = atoi(pszToken);       
-            pszToken = strtok(NULL, pszSeparators);         
-            if (pszToken)
-            {
-              lpVersionInformation->UnderlyingPlatform = (COSVersion::OS_PLATFORM) atoi(pszToken);       
-              pszToken = strtok(NULL, pszSeparators);         
-              if (pszToken)                                       
-              {                                                   
-                lpVersionInformation->wUnderlyingServicePackMajor = (WORD) atoi(pszToken);       
-                pszToken = strtok(NULL, pszSeparators);             
-                if (pszToken)
-                {
-                  lpVersionInformation->wUnderlyingServicePackMinor = (WORD) atoi(pszToken);       
-                  pszToken = strtok(NULL, pszSeparators);             
-                  if (pszToken)
-                  {
-                    lpVersionInformation->dwSuiteMask = (DWORD) atoi(pszToken);       
-                    pszToken = strtok(NULL, pszSeparators);
-                    if (pszToken)
-                    {
-                      lpVersionInformation->OSType = (COSVersion::OS_TYPE) atoi(pszToken);       
-
-                      pszToken = strtok(NULL, pszSeparators);             
-                      if (pszToken)
-                      {
-                        lpVersionInformation->UnderlyingProcessorType = (COSVersion::PROCESSOR_TYPE) atoi(pszToken);       
-
-                        //CSDVersion string is optional so consider it successful if we got as far as here
-                        bSuccess = TRUE;
-
-                        pszToken = strtok(NULL, pszSeparators);
-                        if (pszToken)
-                          strcpy(lpVersionInformation->szUnderlyingCSDVersion, pszToken);                                    
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-   
-    //Don't forget to close the file
-    fclose(pOSFile);
-
-    //and remove it now that we are finished with it
-    remove(pszTempFilename);
-  }
-  else
-  {
-    printf("writever command failed, Errno:%d\n", errno);
-  }     
-
-  return bSuccess;
-}
-
-void COSVersion::GetWinInfo()
-{ 
-  BYTE MajorVer;
-  BYTE MinorVer;
-
-  //use some inline assembly to determine if Windows if
-  //running and what version is active
-  _asm
-  {
-  ; check for Windows 3.1
-    mov     ax,160ah                ; WIN31CHECK
-    int     2fh                     ; check if running under Win 3.1.
-    or      ax,ax
-    jz      RunningUnderWin31       ; can check if running in standard
-                                    ; or enhanced mode
-   
-  ; check for Windows 3.0 enhanced mode
-    mov     ax,1600h                ; WIN386CHECK
-    int     2fh
-    test    al,7fh
-    jnz     RunningUnderWin30Enh    ; enhanced mode
-   
-  ; check for 3.0 WINOLDAP
-    mov     ax,4680h                ; IS_WINOLDAP_ACTIVE
-    int     2fh
-    or      ax,ax                   ; running under 3.0 derivative?
-    jnz     NotRunningUnderWin
-   
-  ; rule out MS-DOS 5.0 task switcher
-    mov     ax,4b02h                ; detect switcher
-    push    bx
-    push    es
-    push    di
-    xor     bx,bx
-    mov     di,bx
-    mov     es,bx
-    int     2fh
-    pop     di
-    pop     es
-    pop     bx
-    or      ax,ax
-    jz      NotRunningUnderWin      ; MS-DOS 5.0 task switcher found
-   
-  ; check for standard mode Windows 3.0
-    mov     ax,1605h                ; PMODE_START
-    int     2fh
-    cmp     cx,-1
-    jz      RunningUnderWin30Std
-   
-  ; check for real mode Windows 3.0
-    mov     ax,1606h                ; PMODE_STOP
-    int     2fh                     ; in case someone is counting
-    ; Real mode Windows 3.0 is running
-    mov     byte ptr [bRunningWindows], 1
-    mov     byte ptr [MajorVer], 3h    
-    mov     byte ptr [MinorVer], 0h        
-    jmp     ExitLabel
-   
-  RunningUnderWin30Std:
-    ; Standard mode Windows 3.0 is running
-    mov     byte ptr [bRunningWindows], 1
-    mov     byte ptr [MajorVer], 3h    
-    mov     byte ptr [MinorVer], 0h        
-    jmp     ExitLabel
-   
-  RunningUnderWin31:
-    ; At this point: CX == 3 means Windows 3.1 enhanced mode
-    ;                CX == 2 means Windows 3.1 standard mode
-    mov     byte ptr [bRunningWindows], 1
-    
-    ; Get the version of Windows 
-    mov     ax, 1600h   ; Get Enhanced-Mode Windows Installed State
-    int     2Fh
-    mov     byte ptr [MajorVer], al
-    mov     byte ptr [MinorVer], ah
-    jmp     ExitLabel
-   
-  RunningUnderWin30Enh:
-    ; Enhanced mode Windows 3.0 is running
-    mov     byte ptr [bRunningWindows], 1    
-    mov     byte ptr [MajorVer], 3h    
-    mov     byte ptr [MinorVer], 0h        
-    jmp     ExitLabel
-   
-  NotRunningUnderWin:                    
-    mov     byte ptr [bRunningWindows], 0
-    
-  ExitLabel:
-  }             
-  
-  WinVer = (WORD) ((MajorVer << 8) + MinorVer);
-} 
-#endif //_DOS 
-
-BOOL COSVersion::IsWindowsCE(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsCE);
-}
-
-BOOL COSVersion::IsWindows95(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 0 &&
-          lpVersionInformation->dwUnderlyingBuildNumber == 950);
-}
-
-BOOL COSVersion::IsWindows95SP1(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingBuildNumber > 950 && 
-          lpVersionInformation->dwUnderlyingBuildNumber <= 1080);
-}
-
-BOOL COSVersion::IsWindows95OSR2(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingMinorVersion < 10 &&
-          lpVersionInformation->dwUnderlyingBuildNumber > 1080);
-}
-
-BOOL COSVersion::IsWindows98(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 10 &&
-          lpVersionInformation->dwUnderlyingBuildNumber == 1998);
-}
-
-BOOL COSVersion::IsWindows98SP1(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 10 &&
-          lpVersionInformation->dwUnderlyingBuildNumber > 1998 &&
-          lpVersionInformation->dwUnderlyingBuildNumber < 2183);
-}
-
-BOOL COSVersion::IsWindows98SE(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 10 &&
-          lpVersionInformation->dwUnderlyingBuildNumber >= 2183);
-}
-
-BOOL COSVersion::IsWindowsME(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == Windows9x &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4 &&
-          lpVersionInformation->dwUnderlyingMinorVersion == 90);
-}
-
-BOOL COSVersion::IsWindowsNT31(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 3 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 10);
-}
-
-BOOL COSVersion::IsWindowsNT35(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 3 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 50);
-}
-
-BOOL COSVersion::IsWindowsNT351(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 3 && 
-          lpVersionInformation->dwUnderlyingMinorVersion == 51);
-}
-
-BOOL COSVersion::IsWindowsNT4(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 4);
-}
-
-BOOL COSVersion::IsWindows2000(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 5 &&
-          lpVersionInformation->dwUnderlyingMinorVersion == 0);
-}
-
-BOOL COSVersion::IsWindowsXPOrWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion == 5 &&
-          lpVersionInformation->dwUnderlyingMinorVersion != 0);
-}
-
-BOOL COSVersion::IsWindowsXP(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsXPPersonal(lpVersionInformation) || IsXPProfessional(lpVersionInformation);
-}
-
-WORD COSVersion::GetNTServicePackFromCSDString(LPCTSTR pszCSDVersion)
-{
-  WORD wServicePack = 0;
-  if (_tcslen(pszCSDVersion))
-  {
-    //Parse out the CSDVersion string
-    int i=0;      
-    while (pszCSDVersion[i] != _T('\0') && !_istdigit(pszCSDVersion[i]))
-      i++;
-    wServicePack = (WORD) (_ttoi(&pszCSDVersion[i]));
-  }
-
-  return wServicePack;
-}
-
-#if defined(_WIN32) || defined(_WIN64)
-WORD COSVersion::GetNTServicePackFromRegistry()
-{
-  //By default assume no service pack
-  WORD wServicePack = 0;
-
-  HKEY hCurrentVersion;
-  #ifdef _WIN32
-  if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_READ, &hCurrentVersion) == ERROR_SUCCESS)
-  #else                                                                                                                                       
-  if (RegOpenKey(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion"), &hCurrentVersion) == ERROR_SUCCESS)
-  #endif
-  {
-    BYTE byData[128];
-    DWORD dwType;
-    DWORD dwSize = 128;
-    if (RegQueryValueEx(hCurrentVersion, _T("CSDVersion"), NULL, &dwType, byData, &dwSize) == ERROR_SUCCESS)
-    {
-      if (dwType == REG_SZ)
-      {
-        //Stored as a string on all other versions of NT
-        wServicePack = GetNTServicePackFromCSDString((TCHAR*) byData);
-      }
-      else if (dwType == REG_DWORD)
-      {
-        //Handle the service pack number being stored as a DWORD which happens on NT 3.1
-        wServicePack = HIBYTE((WORD) *((DWORD*) byData));
-      }
-    }
-
-    //Don't forget to close the registry key we were using      
-    RegCloseKey(hCurrentVersion);
-  }
-
-  return wServicePack;
-}
-#endif //#if defined(_WIN32) || defined(_WIN64)
-
-#if defined(_WIN32) || defined(_WIN64) || defined (_WINDOWS)
-void COSVersion::GetTerminalServicesRemoteAdminModeDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation)
-{
-  //Lookup the TSAppCompat registry value
-  HKEY hKey = NULL;        
-  #ifdef _WIN32
-  LONG lResult = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\Terminal Server"), 0, KEY_READ, &hKey);
-  #else                                                                                                                         
-  LONG lResult = RegOpenKey(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\Terminal Server"), &hKey);
-  #endif
-  if (lResult != ERROR_SUCCESS)
-    return;
-
-  DWORD dwTSAppCompat = 1;
-  DWORD dwType;
-  DWORD dwSize = sizeof(DWORD);
-#if defined(_WIN32) || defined(_WIN64)    
-  lResult = ::RegQueryValueEx(hKey, _T("TSAppCompat"), NULL, &dwType, (LPBYTE) &dwTSAppCompat, &dwSize);
-#else                                                                                                     
-  lResult = RegQueryValueEx(hKey, _T("TSAppCompat"), NULL, &dwType, (LPBYTE) &dwTSAppCompat, &dwSize);
-#endif  
-  if (lResult == ERROR_SUCCESS)
-  {
-    if (dwTSAppCompat == 0)
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_REMOTEADMINMODE_TERMINAL;
-  }
-
-  //Don't forget to free up the resource we used
-  RegCloseKey(hKey);
-}
-
-void COSVersion::GetMediaCenterDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation)
-{
-  //Lookup the WPA\MediaCenter\Installed registry value
-  HKEY hKey = NULL;        
-  #ifdef _WIN32
-  LONG lResult = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\WPA\\MediaCenter"), 0, KEY_READ, &hKey);
-  #else                                                                                                                         
-  LONG lResult = RegOpenKey(HKEY_LOCAL_MACHINE, _T("System\\WPA\\MediaCenter"), &hKey);
-  #endif
-  if (lResult != ERROR_SUCCESS)
-    return;
-
-  DWORD dwMCE = 0;
-  DWORD dwType;
-  DWORD dwSize = sizeof(DWORD);
-#if defined(_WIN32) || defined(_WIN64)    
-  lResult = ::RegQueryValueEx(hKey, _T("Installed"), NULL, &dwType, (LPBYTE) &dwMCE, &dwSize);
-#else                                                                                                     
-  lResult = RegQueryValueEx(hKey, _T("Installed"), NULL, &dwType, (LPBYTE) &dwMCE, &dwSize);
-#endif  
-  if (lResult == ERROR_SUCCESS)
-  {
-    if (dwMCE)
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_MEDIACENTER;
-  }
-
-  //Don't forget to free up the resource we used
-  RegCloseKey(hKey);
-}
-
-void COSVersion::GetProductSuiteDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation) 
-{
-  //Lookup the ProductOptions registry key
-  HKEY hKey = NULL;        
-  #ifdef _WIN32
-  LONG lResult = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\ProductOptions"), 0, KEY_READ, &hKey);
-  #else                                                                                                                         
-  LONG lResult = RegOpenKey(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Control\\ProductOptions"), &hKey);
-  #endif
-  if (lResult != ERROR_SUCCESS)
-    return;
-
-  // Determine required size of ProductSuite buffer.
-  DWORD dwType = 0;
-  DWORD dwSize = 0;                   
-#if defined(_WIN32) || defined(_WIN64)  
-  lResult = ::RegQueryValueEx(hKey, _T("ProductSuite"), NULL, &dwType, NULL, &dwSize);
-#else
-  lResult = RegQueryValueEx(hKey, _T("ProductSuite"), NULL, &dwType, NULL, &dwSize);
-#endif  
-  if (lResult != ERROR_SUCCESS || !dwSize)
-  {
-    RegCloseKey(hKey);
-    return;
-  }
-
-  // Allocate buffer.
-  LPTSTR lpszProductSuites = (LPTSTR) new BYTE[dwSize];
-
-  // Retrieve array of product suite strings.
-#if defined(_WIN32) || defined(_WIN64)    
-  lResult = ::RegQueryValueEx(hKey, _T("ProductSuite"), NULL, &dwType, (LPBYTE) lpszProductSuites, &dwSize);
-#else                                                                                                     
-  lResult = RegQueryValueEx(hKey, _T("ProductSuite"), NULL, &dwType, (LPBYTE) lpszProductSuites, &dwSize);
-#endif  
-  if (lResult != ERROR_SUCCESS || dwType != REG_MULTI_SZ)
-  {
-    //Don't forget to free up the resource we used
-    delete [] lpszProductSuites;
-    RegCloseKey(hKey);
-
-    return;
-  }
-
-  //Search for suite name in array of strings.
-  LPTSTR lpszSuite = lpszProductSuites;
-  while (*lpszSuite) 
-  {
-    //Note we do not need to implement checks for COSVERSION_SUITE_WEBEDITION
-    //as Windows Server 2003 Web Edition which supports GetVersionEx
-    //using a OSVERSIONINFOEX structure.
-
-    //NT Embedded and subsequent version of Embedded Windows supports
-    //GetVersionEx using a OSVERSIONINFOEX structure, so no check for 
-    //it here either
-
-    //Also I was unable to find any documentation on what Windows NT Datacenter Server
-    //puts in the ProductSuite. In Windows 2000 Datacenter it does not matter as it
-    //supports GetVersionEx using a OSVERSIONINFOEX structure.
-
-    //Turn on appropiate fields in the "wSuiteMask" bit field
-    if (_tcsicmp(lpszSuite, _T("Terminal Server")) == 0) 
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_TERMINAL;
-    else if ((_tcsicmp(lpszSuite, _T("SBS")) == 0) || (_tcsicmp(lpszSuite, _T("Small Business")) == 0))
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_SMALLBUSINESS;
-    else if (_tcsicmp(lpszSuite, _T("Enterprise")) == 0) 
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_ENTERPRISE;
-    else if (_tcsicmp(lpszSuite, _T("Personal")) == 0) 
-      lpVersionInformation->dwSuiteMask |= COSVERSION_SUITE_PERSONAL;
-
-    lpszSuite += (lstrlen(lpszSuite) + 1);
-  }
-
-  //Don't forget to free up the resource we used
-  delete [] lpszProductSuites;
-  RegCloseKey(hKey);
-}
-#endif //#if defined(_WIN32) || defined(_WIN64)  || defined (_WINDOWS)
-             
-#if defined(_WIN64) || defined(_WIN32)             
-BOOL COSVersion::IsWindows30(LPOS_VERSION_INFO /*lpVersionInformation*/)
-#else
-BOOL COSVersion::IsWindows30(LPOS_VERSION_INFO lpVersionInformation)
-#endif //#if defined(_WIN64) || defined(_Win32             
-{
-#ifdef _WIN64
-  return FALSE;
-#elif _WIN32
-  return FALSE;
-#else
-  return (lpVersionInformation->UnderlyingPlatform == Windows3x &&
-          lpVersionInformation->dwUnderlyingMinorVersion == 0);
-#endif
-}
-
-#if defined(_WIN64) || defined(_WIN32)             
-BOOL COSVersion::IsWindows31(LPOS_VERSION_INFO /*lpVersionInformation*/)
-#else
-BOOL COSVersion::IsWindows31(LPOS_VERSION_INFO lpVersionInformation)
-#endif //#if defined(_WIN64) || defined(_Win32             
-{
-#ifdef _WIN64
-  return FALSE;
-#elif _WIN32
-  return FALSE;
-#else
-  return (lpVersionInformation->UnderlyingPlatform == Windows3x &&
-          lpVersionInformation->dwUnderlyingMinorVersion == 10);
-#endif
-}
-
-#if defined(_WIN64) || defined(_WIN32)            
-BOOL COSVersion::IsWindows311(LPOS_VERSION_INFO /*lpVersionInformation*/)
-#else
-BOOL COSVersion::IsWindows311(LPOS_VERSION_INFO lpVersionInformation)
-#endif //#if defined(_WIN64) || defined(_Win32             
-{
-#ifdef _WIN64
-  return FALSE;
-#elif _WIN32
-  return FALSE;
-#else
-  return (lpVersionInformation->UnderlyingPlatform == Windows3x &&
-          lpVersionInformation->dwUnderlyingMinorVersion == 11);
-#endif
-}
-
-#if defined(_WINDOWS) && (!defined(_WIN32) && !defined(_WIN64))  
-BOOL COSVersion::IsWindowsForWorkgroups(LPOS_VERSION_INFO lpVersionInformation)
-#else
-BOOL COSVersion::IsWindowsForWorkgroups(LPOS_VERSION_INFO /*lpVersionInformation*/)
-#endif //#if defined(_WINDOWS) && (defined(_WIN32) || defined(_WIN64))  
-{
-#if defined(_WINDOWS) && (!defined(_WIN32) && !defined(_WIN64))  
-  return (lpVersionInformation->UnderlyingPlatform == Windows3x &&
-          WFWLoaded());
-#else
-  return FALSE;          
-#endif //#if defined(_WINDOWS) && (!defined(_WIN32) && !defined(_WIN64))  
-}
-
-
-#if defined(_WIN32)
-BOOL COSVersion::IsWin32sInstalled(LPOS_VERSION_INFO lpVersionInformation)
-#else
-BOOL COSVersion::IsWin32sInstalled(LPOS_VERSION_INFO /*lpVersionInformation*/)
-#endif //#if defined(_WIN64) || defined(_Win32             
-{
-#ifdef _WIN64
-  return FALSE;
-#elif _WIN32
-  return (lpVersionInformation->UnderlyingPlatform == Windows3x);
-#else
-  return FALSE;
-#endif
-}
-
-BOOL COSVersion::IsNTPreWin2k(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (lpVersionInformation->UnderlyingPlatform == WindowsNT &&
-          lpVersionInformation->dwUnderlyingMajorVersion <= 4);
-}
-
-BOOL COSVersion::IsNTPDC(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (IsNTPreWin2k(lpVersionInformation)) && 
-         (lpVersionInformation->OSType == DomainController) &&
-         ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_PRIMARY_DOMAIN_CONTROLLER) != 0);
-}
-
-BOOL COSVersion::IsNTStandAloneServer(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsNTPreWin2k(lpVersionInformation) && (lpVersionInformation->OSType == Server);
-}
-
-BOOL COSVersion::IsNTBDC(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsNTPreWin2k(lpVersionInformation) && 
-         (lpVersionInformation->OSType == DomainController) && 
-         ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_BACKUP_DOMAIN_CONTROLLER) != 0);
-}
-
-BOOL COSVersion::IsNTWorkstation(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsNTPreWin2k(lpVersionInformation) && (lpVersionInformation->OSType == Workstation);
-}
-
-BOOL COSVersion::IsTerminalServicesInstalled(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_TERMINAL) != 0);
-}
-
-BOOL COSVersion::IsEmbedded(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_EMBEDDEDNT) != 0);
-}
-
-BOOL COSVersion::IsTerminalServicesInRemoteAdminMode(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_REMOTEADMINMODE_TERMINAL) != 0);
-}
-
-BOOL COSVersion::ISSmallBusinessEditionInstalled(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_SMALLBUSINESS) != 0);
-}
-
-BOOL COSVersion::IsNTEnterpriseServer(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (IsNTPreWin2k(lpVersionInformation) && (lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_ENTERPRISE) != 0);
-}
-
-BOOL COSVersion::IsNTDatacenterServer(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsNTPreWin2k(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_DATACENTER) != 0);
-}
-
-BOOL COSVersion::IsWin2000Professional(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindows2000(lpVersionInformation) && (lpVersionInformation->OSType == Workstation);
-}
-
-BOOL COSVersion::IsWin2000Server(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindows2000(lpVersionInformation) && (lpVersionInformation->OSType == Server);
-}
-
-BOOL COSVersion::IsWin2000AdvancedServer(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindows2000(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_ENTERPRISE) != 0);
-}
-
-BOOL COSVersion::IsWin2000DatacenterServer(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return (IsWindows2000(lpVersionInformation) && (lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_DATACENTER) != 0);
-}
-
-BOOL COSVersion::IsWin2000DomainController(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindows2000(lpVersionInformation) && (lpVersionInformation->OSType == DomainController);
-}
-
-BOOL COSVersion::IsXPPersonal(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_PERSONAL) != 0);
-}
-
-BOOL COSVersion::IsXPProfessional(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && (lpVersionInformation->OSType == Workstation) && !IsXPPersonal(lpVersionInformation);
-}
-
-BOOL COSVersion::IsWebWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_WEBEDITION) != 0);
-}
-
-BOOL COSVersion::IsWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && (lpVersionInformation->OSType == Server);
-}
-
-BOOL COSVersion::IsEnterpriseWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_ENTERPRISE) != 0);
-}
-
-BOOL COSVersion::IsDatacenterWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_DATACENTER) != 0);
-}
-
-BOOL COSVersion::IsDomainControllerWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return IsWindowsXPOrWindowsServer2003(lpVersionInformation) && (lpVersionInformation->OSType == DomainController);
-}
-
-BOOL COSVersion::IsMediaCenterInstalled(LPOS_VERSION_INFO lpVersionInformation)
-{
-  return ((lpVersionInformation->dwSuiteMask & COSVERSION_SUITE_MEDIACENTER) != 0);
-}
-
-BOOL COSVersion::IsEmulated64Bit(LPOS_VERSION_INFO /*lpVersionInformation*/)
-{
-#ifdef _WIN64
-  return TRUE;
-#else
-  return FALSE;
-#endif
-}
-
-BOOL COSVersion::IsUnderlying64Bit(LPOS_VERSION_INFO /*lpVersionInformation*/)
-{
-#ifdef _WIN64
-  return TRUE;
-#elif UNDER_CE
-  return FALSE;
-#elif _WIN32
-  //Assume the worst
-  BOOL bSuccess = FALSE;  
-  
-  //Check to see if we are running on 64 bit Windows thro WOW64
-  HMODULE hKernel32 = GetModuleHandle(_T("KERNEL32.DLL"));
-  if (hKernel32)
-  {
-    lpfnIsWow64Process pIsWow64Process = (lpfnIsWow64Process) GetProcAddress(hKernel32, "IsWow64Process"); 
-    if (pIsWow64Process)
-    {
-      BOOL bWow64 = FALSE;
-      if (pIsWow64Process(GetCurrentProcess(), &bWow64))
-        bSuccess = bWow64;
-    }
-  }
-  return bSuccess;
-#else
-  return FALSE;
-#endif
-}
-
diff --git a/ica/win32/winvnc/winvnc/Dtwinver.h b/ica/win32/winvnc/winvnc/Dtwinver.h
deleted file mode 100644
index 4542e2b..0000000
--- a/ica/win32/winvnc/winvnc/Dtwinver.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-/*
-Module : DTWINVER.H
-Purpose: Interface of a function to perform
-         version detection on OS
-Created: PJN / 11-05-1996
-
-
-Copyright (c) 1997 - 2004 by PJ Naughter.  (Web: www.naughter.com, Email: pjna at naughter.com)
-
-All rights reserved.
-
-Copyright / Usage Details:
-
-You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
-when your product is released in binary form. You are allowed to modify the source code in any way you want 
-except you cannot modify the copyright details at the top of each module. If you want to distribute source 
-code with your application, then you are only allowed to distribute versions released by the author. This is 
-to maintain a single distribution point for the source code. 
-
-*/
-
-#ifndef __DTWINVER_H__                                          
-
-
-////////////////////////////////// Defines ////////////////////////////////////
-
-#define COSVERSION_SUITE_SMALLBUSINESS             0x00000001
-#define COSVERSION_SUITE_ENTERPRISE                0x00000002
-#define COSVERSION_SUITE_PRIMARY_DOMAIN_CONTROLLER 0x00000004
-#define COSVERSION_SUITE_BACKUP_DOMAIN_CONTROLLER  0x00000008
-#define COSVERSION_SUITE_TERMINAL                  0x00000010
-#define COSVERSION_SUITE_DATACENTER                0x00000020
-#define COSVERSION_SUITE_PERSONAL                  0x00000040
-#define COSVERSION_SUITE_WEBEDITION                0x00000080
-#define COSVERSION_SUITE_EMBEDDEDNT                0x00000100
-#define COSVERSION_SUITE_REMOTEADMINMODE_TERMINAL  0x00000200
-#define COSVERSION_SUITE_UNIPROCESSOR_FREE         0x00000400
-#define COSVERSION_SUITE_UNIPROCESSOR_CHECKED      0x00000800
-#define COSVERSION_SUITE_MULTIPROCESSOR_FREE       0x00001000
-#define COSVERSION_SUITE_MULTIPROCESSOR_CHECKED    0x00002000
-#define COSVERSION_SUITE_MEDIACENTER               0x00004000
-
-
-
-////////////////////////////////// Classes ////////////////////////////////////
-
-class COSVersion
-{
-public:
-//Enums
-  enum OS_PLATFORM
-  {
-    Dos = 0,
-    Windows3x = 1,
-    Windows9x = 2,
-    WindowsNT = 3,
-    WindowsCE = 4,
-  };
-
-  enum OS_TYPE
-  {
-    Workstation = 0,
-    Server = 1,
-    DomainController = 2,
-  };
-
-  enum PROCESSOR_TYPE
-  {
-    UNKNOWN_PROCESSOR = 0,
-    INTEL_PROCESSOR = 1,
-    MIPS_PROCESSOR = 2,
-    ALPHA_PROCESSOR = 3,
-    PPC_PROCESSOR = 4,
-    IA64_PROCESSOR = 5,
-    AMD64_PROCESSOR = 6,
-    ALPHA64_PROCESSOR = 7,
-    MSIL_PROCESSOR = 8,
-    ARM_PROCESSOR = 9,
-    SHX_PROCESSOR = 10,
-  };
-
-//defines
-  typedef struct _OS_VERSION_INFO
-  {
-  #ifndef UNDER_CE
-    //What version of OS is being emulated
-    DWORD          dwEmulatedMajorVersion;
-    DWORD          dwEmulatedMinorVersion;
-    DWORD          dwEmulatedBuildNumber;
-    OS_PLATFORM    EmulatedPlatform;
-    PROCESSOR_TYPE EmulatedProcessorType; //The emulated processor type
-  #ifdef _WIN32                    
-    TCHAR          szEmulatedCSDVersion[128];
-  #else
-    char           szEmulatedCSDVersion[128];
-  #endif  
-    WORD           wEmulatedServicePackMajor;
-    WORD           wEmulatedServicePackMinor;
-  #endif
-
-    //What version of OS is really running                 
-    DWORD       dwUnderlyingMajorVersion;
-    DWORD       dwUnderlyingMinorVersion;
-    DWORD       dwUnderlyingBuildNumber;
-    OS_PLATFORM UnderlyingPlatform;   
-  #ifdef _WIN32                      
-    TCHAR       szUnderlyingCSDVersion[128];
-  #else  
-    char        szUnderlyingCSDVersion[128];
-  #endif  
-    WORD    wUnderlyingServicePackMajor;
-    WORD    wUnderlyingServicePackMinor;
-
-    DWORD          dwSuiteMask;             //Bitmask of various OS suites
-    OS_TYPE        OSType;                  //The basic OS type
-  #ifndef UNDER_CE
-    PROCESSOR_TYPE UnderlyingProcessorType; //The underlying processor type
-  #endif
-
-  #ifdef UNDER_CE
-    TCHAR szOEMInfo[256];
-    TCHAR szPlatformType[256];
-  #endif
-  } OS_VERSION_INFO, *POS_VERSION_INFO, FAR *LPOS_VERSION_INFO;
-
-//Constructors / Destructors
-  COSVersion(); 
-  ~COSVersion();
-
-//Methods:
-  BOOL GetVersion(LPOS_VERSION_INFO lpVersionInformation);
-                                 
-//Please note that the return values for all the following functions 
-//are mutually exclusive for example if you are running on 
-//95 OSR2 then IsWindows95 will return FALSE
-  BOOL IsWindows30(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows31(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows311(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsForWorkgroups(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsCE(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows95(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows95SP1(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows95OSR2(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows98(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows98SP1(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows98SE(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsME(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsNT31(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsNT35(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsNT351(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsNT4(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindows2000(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsXPOrWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-
-//Returns the various flavours of the "os" that is installed. Note that these
-//functions are not completely mutually exlusive
-  BOOL IsWin32sInstalled(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTPreWin2k(LPOS_VERSION_INFO lpVersionInformation);
-
-  BOOL IsNTWorkstation(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTStandAloneServer(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTPDC(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTBDC(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTEnterpriseServer(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsNTDatacenterServer(LPOS_VERSION_INFO lpVersionInformation);
-
-  BOOL IsWin2000Professional(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWin2000Server(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWin2000AdvancedServer(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWin2000DatacenterServer(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWin2000DomainController(LPOS_VERSION_INFO lpVersionInformation);
-
-  BOOL IsXPPersonal(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsXPProfessional(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsXP(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWebWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsEnterpriseWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsDatacenterWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsDomainControllerWindowsServer2003(LPOS_VERSION_INFO lpVersionInformation);
-
-  BOOL IsTerminalServicesInstalled(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL ISSmallBusinessEditionInstalled(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsEmulated64Bit(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsUnderlying64Bit(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsEmbedded(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsTerminalServicesInRemoteAdminMode(LPOS_VERSION_INFO lpVersionInformation);
-  BOOL IsMediaCenterInstalled(LPOS_VERSION_INFO lpVersionInformation);
-
-protected:
-//Defines / typedefs
-#if (defined(_WINDOWS) || defined(_DOS)) && (!defined(_WIN32) && !defined(_WIN64))  
-  #define CPEX_DEST_STDCALL        0x00000000L
-  #define HKEY32                   DWORD                                                               
-  #define HKEY_LOCAL_MACHINE       (( HKEY32 ) 0x80000002 )    
-  #define TCHAR                    char
-  #define _T
-  #define _tcsicmp                 strcmpi
-  #define _tcscpy                  strcpy
-  #define _tcslen                  strlen
-  #define _istdigit                isdigit
-  #define _ttoi                    atoi
-  #define _tcsupr                  strupr
-  #define _tcsstr                  strstr
-  #define LPCTSTR                  LPCSTR
-  #define ERROR_CALL_NOT_IMPLEMENTED  120
-  #define REG_DWORD                ( 4 )                                                               
-  #define REG_MULTI_SZ             ( 7 )
-  #define VER_PLATFORM_WIN32s             0
-  #define VER_PLATFORM_WIN32_WINDOWS      1
-  #define VER_PLATFORM_WIN32_NT           2
-  #define VER_PLATFORM_WIN32_CE           3
-#endif                      
-                      
-#if defined(_WINDOWS) && !defined(_WIN32) && !defined(_WIN64)  
-//Defines / Macros
-  #define LPTSTR LPSTR
-
-  typedef struct OSVERSIONINFO
-  { 
-    DWORD dwOSVersionInfoSize; 
-    DWORD dwMajorVersion; 
-    DWORD dwMinorVersion; 
-    DWORD dwBuildNumber; 
-    DWORD dwPlatformId; 
-    char szCSDVersion[128]; 
-  } OSVERSIONINFO, *POSVERSIONINFO, FAR *LPOSVERSIONINFO; 
-
-  typedef struct _SYSTEM_INFO 
-  {
-    union 
-    {
-      DWORD dwOemId;          // Obsolete field...do not use
-      struct 
-      {
-        WORD wProcessorArchitecture;
-        WORD wReserved;
-      };
-    };
-    DWORD dwPageSize;
-    LPVOID lpMinimumApplicationAddress;
-    LPVOID lpMaximumApplicationAddress;
-    DWORD dwActiveProcessorMask;
-    DWORD dwNumberOfProcessors;
-    DWORD dwProcessorType;
-    DWORD dwAllocationGranularity;
-    WORD wProcessorLevel;
-    WORD wProcessorRevision;
-  } SYSTEM_INFO, *LPSYSTEM_INFO;
-
-  #define PROCESSOR_ARCHITECTURE_INTEL            0
-  #define PROCESSOR_ARCHITECTURE_MIPS             1
-  #define PROCESSOR_ARCHITECTURE_ALPHA            2
-  #define PROCESSOR_ARCHITECTURE_PPC              3
-  #define PROCESSOR_ARCHITECTURE_SHX              4
-  #define PROCESSOR_ARCHITECTURE_ARM              5
-  #define PROCESSOR_ARCHITECTURE_IA64             6
-  #define PROCESSOR_ARCHITECTURE_ALPHA64          7
-  #define PROCESSOR_ARCHITECTURE_MSIL             8
-  #define PROCESSOR_ARCHITECTURE_AMD64            9
-  #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64    10
-  #define PROCESSOR_ARCHITECTURE_UNKNOWN          0xFFFF
-  
-//Methods
-  DWORD GetVersion();
-  BOOL GetVersionEx(LPOSVERSIONINFO lpVersionInfo);
-  void GetProcessorType(LPOS_VERSION_INFO lpVersionInformation);
-  LONG RegQueryValueEx(HKEY32 hKey, LPSTR  lpszValueName, LPDWORD lpdwReserved, LPDWORD lpdwType, LPBYTE  lpbData, LPDWORD lpcbData);
-  static BOOL WFWLoaded();                                     
-
-//Function Prototypes
-  typedef DWORD (FAR PASCAL  *lpfnLoadLibraryEx32W) (LPCSTR, DWORD, DWORD);
-  typedef BOOL  (FAR PASCAL  *lpfnFreeLibrary32W)   (DWORD);
-  typedef DWORD (FAR PASCAL  *lpfnGetProcAddress32W)(DWORD, LPCSTR);
-  typedef DWORD (FAR __cdecl *lpfnCallProcEx32W)    (DWORD, DWORD, DWORD, DWORD, ...);
-  typedef WORD  (FAR PASCAL  *lpfnWNetGetCaps)      (WORD);
-
-//Member variables
-  lpfnLoadLibraryEx32W  m_lpfnLoadLibraryEx32W;
-  lpfnFreeLibrary32W    m_lpfnFreeLibrary32W;
-  lpfnGetProcAddress32W m_lpfnGetProcAddress32W;
-  lpfnCallProcEx32W     m_lpfnCallProcEx32W;
-  DWORD                 m_hAdvApi32;    
-  DWORD                 m_hKernel32;
-  DWORD                 m_lpfnRegQueryValueExA;
-  DWORD                 m_lpfnGetVersionExA;
-  DWORD                 m_lpfnGetVersion;
-  DWORD                 m_lpfnGetSystemInfo;
-  DWORD                 m_lpfnGetNativeSystemInfo;
-#endif //defined(_WINDOWS) && (!defined(_WIN32) && !defined(_WIN64))
-
-#ifdef _WIN32
-//Function Prototypes
-  typedef BOOL (WINAPI *lpfnIsWow64Process)(HANDLE, PBOOL);  
-  typedef void (WINAPI *lpfnGetNativeSystemInfo)(LPSYSTEM_INFO);
-#endif
-
-#if defined(_WIN32) || defined(_WINDOWS)
-//Defines / Macros
-  typedef struct OSVERSIONINFOEX 
-  {  
-    DWORD dwOSVersionInfoSize;  
-    DWORD dwMajorVersion;  
-    DWORD dwMinorVersion;  
-    DWORD dwBuildNumber;  
-    DWORD dwPlatformId;  
-    TCHAR szCSDVersion[128];  
-    WORD wServicePackMajor;  
-    WORD wServicePackMinor;  
-    WORD wSuiteMask;  
-    BYTE wProductType;  
-    BYTE wReserved;
-  } OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;
-                  
-//Function Prototypes                  
-  typedef BOOL (WINAPI *lpfnGetVersionEx) (LPOSVERSIONINFO);  
-#endif  
-
-#ifndef _DOS         
-//Methods
-  void GetNTOSTypeFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bOnlyUpdateDCDetails);
-  void GetProductSuiteDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation) ;
-  void GetTerminalServicesRemoteAdminModeDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation);
-  void GetMediaCenterDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation);
-  void GetNTSP6aDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bUpdateEmulatedAlso);
-  void GetXPSP1aDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation, BOOL bUpdateEmulatedAlso);
-  void GetNTHALDetailsFromRegistry(LPOS_VERSION_INFO lpVersionInformation);
-#else
-  BOOL GetInfoBySpawingWriteVer(COSVersion::LPOS_VERSION_INFO lpVersionInformation);
-  void GetWinInfo();
-#endif
-
-#if defined(_WIN32) || defined(_WIN64)
-  WORD GetNTServicePackFromRegistry();
-#endif    
-  WORD GetNTServicePackFromCSDString(LPCTSTR pszCSDVersion);
-};
-
-#endif //__DTWINVER_H__
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/HideDesktop.cpp b/ica/win32/winvnc/winvnc/HideDesktop.cpp
deleted file mode 100644
index 1fcd0e4..0000000
--- a/ica/win32/winvnc/winvnc/HideDesktop.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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.
-//
-// Functions to hide the Windows Desktop
-//
-// This hides three variants:
-//	- Desktop Patterns  (WIN.INI [Desktop] Pattern=)
-//	- Desktop Wallpaper (.bmp [and JPEG on Windows XP])
-//	- Active Desktop
-//
-// Written by Ed Hardebeck - Glance Networks, Inc.
-// With some code from Paul DiLascia, MSDN Magazine - May 2001
-//
-//	HideDesktop()		- hides the desktop
-//	RestoreDesktop()	- restore the desktop
-//
-
-#define WIN32_LEAN_AND_MEAN
-#include <shlwapi.h>
-#include <windows.h>
-#include <wininet.h> // Shell object uses INTERNET_MAX_URL_LENGTH (go figure)
-#if !__GNUC__ && _MSC_VER < 1400
-#define _WIN32_IE 0x0400
-#endif
-#include <tchar.h>
-#include <shlguid.h> // shell GUIDs
-#include <shlobj.h>  // IActiveDesktop
-#include "stdhdrs.h"
-
-struct __declspec(uuid("F490EB00-1240-11D1-9888-006097DEACF9")) IActiveDesktop;
-
-#define PACKVERSION(major,minor) MAKELONG(minor,major)
-
-DWORD GetDllVersion(LPCTSTR lpszDllName)
-{
-    HINSTANCE hinstDll;
-    DWORD dwVersion = 0;
-
-    hinstDll = LoadLibrary(lpszDllName);
-	
-    if(hinstDll)
-    {
-        DLLGETVERSIONPROC pDllGetVersion;
-
-        pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
-
-		// Because some DLLs might not implement this function,
-		// test for it explicitly. Depending on the particular 
-		// DLL, the lack of a DllGetVersion function can be an
-		// indicator of the version.
-		
-        if (pDllGetVersion)
-        {
-            DLLVERSIONINFO	dvi;
-            HRESULT			hr;
-
-            ZeroMemory(&dvi, sizeof(dvi));
-            dvi.cbSize = sizeof(dvi);
-
-            hr = (*pDllGetVersion)(&dvi);
-
-            if(SUCCEEDED(hr))
-            {
-                dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
-            }
-        }
-        
-        FreeLibrary(hinstDll);
-    }
-    return dwVersion;
-}
-
-typedef void (CALLBACK * P_SHGetSettings)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
-
-BOOL SHDesktopHTML()
-{
-   // Determine if Active Desktop is enabled. SHGetSettings is apparently
-   // more reliable than IActiveDesktop::GetDesktopItemOptions, which can
-   // report incorrectly during the middle of ApplyChanges!
-   // Dynamically link to SHGetVersion so this can load on Windows with pre 4.71 shell
-
-	HINSTANCE	hinstDll;
-    BOOL		enabled = FALSE;
-
-    hinstDll = LoadLibrary("shell32.dll");
-	
-    if (hinstDll)
-    {
-	  P_SHGetSettings	pSHGetSettings;
-
-	  if ((pSHGetSettings = (P_SHGetSettings)GetProcAddress(hinstDll, "SHGetSettings")))
-	  {
-		SHELLFLAGSTATE	shfs;
-
-		(*pSHGetSettings)(&shfs, SSF_DESKTOPHTML);
-		enabled = shfs.fDesktopHTML;
-	  }
-
-	  FreeLibrary(hinstDll);
-	}
-
-	return enabled;
-}
-
-static 
-HRESULT EnableActiveDesktop(bool enable)
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	CoInitialize(NULL);
-	CComQIPtr<IActiveDesktop, &IID_IActiveDesktop>	pIActiveDesktop;
-	
-	HRESULT		hr;
-
-	hr = pIActiveDesktop.CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER);
-	if (!SUCCEEDED(hr))
-		return hr;
-
-	COMPONENTSOPT	opt;
-
-	opt.dwSize = sizeof(opt);
-	opt.fActiveDesktop = opt.fEnableComponents = enable;
-    hr = pIActiveDesktop->SetDesktopItemOptions(&opt, 0);
-    if (!SUCCEEDED(hr))
-	{
-		CoUninitialize();
-		return hr;
-	}
-
-	hr = pIActiveDesktop->ApplyChanges(AD_APPLY_REFRESH);
-	CoUninitialize();
-	return hr;
-#else
-	return 0;
-#endif
-}
-
-bool HideActiveDesktop()
-{
-	// returns true if the Active Desktop was enabled and has been hidden
-
-	if (GetDllVersion(TEXT("shell32.dll")) >= PACKVERSION(4,71))
-		if (SHDesktopHTML())
-			return SUCCEEDED(EnableActiveDesktop(false));
-
-	return false;
-}
-
-void ShowActiveDesktop()
-{
-	if (GetDllVersion(TEXT("shell32.dll")) >= PACKVERSION(4,71))
-		EnableActiveDesktop(true);
-}
-		
-// OK, so this doesn't work in multiple threads or nest...
-static BOOL		ADWasEnabled = false;
-static BOOL		ISWallPaperHided = false;
-static TCHAR SCREENNAME[1024];
-
-// Added Jef Fix - 4 March 2008 jpaquette (paquette at atnetsend.net)
-static unsigned char WallpaperStyle[10] = {0}; // string "0" centered, "1" tiled, "2" stretched
-
-static const TCHAR * const DESKTOP_KEYNAME = _T("Control Panel\\Desktop");
-static const TCHAR * const DESKTOP_WALLPAPER_STYLE_KEYNAME = _T("WallpaperStyle");
-
-void SaveWallpaperStyle()
-{
-    HKEY hKey;
-
-    if (::RegOpenKeyEx(HKEY_CURRENT_USER, DESKTOP_KEYNAME, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
-    {
-        DWORD sz = sizeof WallpaperStyle;
-        ::RegQueryValueEx(hKey, DESKTOP_WALLPAPER_STYLE_KEYNAME, 0, 0, WallpaperStyle, &sz);
-        ::RegCloseKey(hKey);
-    }
-}
-
-void RestoreWallpaperStyle()
-{
-    HKEY hKey;
-
-    if (::RegOpenKeyEx(HKEY_CURRENT_USER, DESKTOP_KEYNAME, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
-    {
-        DWORD sz = strlen((const char *)WallpaperStyle);
-        ::RegSetValueEx(hKey, DESKTOP_WALLPAPER_STYLE_KEYNAME, 0, REG_SZ, WallpaperStyle, sz);
-        ::RegCloseKey(hKey);
-    }
-}
-// -- end jdp
-
-
-void HideDesktop()
-{
-	// @@@efh Setting the desktop pattern via pvParam works, but is undocumented (except by www.winehq.com)
-	//SystemParametersInfo(SPI_SETDESKPATTERN, 0, "0 0 0 0 0 0 0 0", SPIF_SENDCHANGE);
-
-	// Tell all applications that there is no wallpaper
-	// Note that this doesn't change the wallpaper registry setting!
-	// @@@efh On Win98 and Win95 this returns an error in the debug build (but not in release)...
-	vnclog.Print(LL_INTWARN, VNCLOG("Killwallpaper %i\n"),ISWallPaperHided);
-	if (!ISWallPaperHided)
-	{
-		SaveWallpaperStyle(); // Added Jef Fix
-		SystemParametersInfo(SPI_GETDESKWALLPAPER,1024,SCREENNAME,0 );
-		SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID)"", SPIF_SENDCHANGE);
-		ADWasEnabled = HideActiveDesktop();
-		ISWallPaperHided=true;
-		vnclog.Print(LL_INTWARN, VNCLOG("Killwallpaper %i %i\n"),ISWallPaperHided,ADWasEnabled);
-	}
-	
-}
-
-void RestoreDesktop()
-{
-	vnclog.Print(LL_INTWARN, VNCLOG("Restorewallpaper %i\n"),ISWallPaperHided);
-	if (ISWallPaperHided)
-	{
-		vnclog.Print(LL_INTWARN, VNCLOG("Restorewallpaper %i %i\n"),ISWallPaperHided,ADWasEnabled);
-		if (ADWasEnabled)
-			ShowActiveDesktop();
-
-		SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, SCREENNAME, SPIF_SENDCHANGE);
-		RestoreWallpaperStyle(); // Added Jef Fix
-	}
-
-	ISWallPaperHided=false;
-}
-
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-// SPI_GETUIEFFECTS can enable/disable everything in one shot, but I'm sure we'll want finer control over this eventually.
-
-UINT spiParams[] = {
-	0x1024, //SPI_GETDROPSHADOW, 
-	SPI_GETCOMBOBOXANIMATION, 
-	SPI_GETMENUANIMATION, 
-	SPI_GETTOOLTIPANIMATION, 
-	SPI_GETSELECTIONFADE, 
-	SPI_GETLISTBOXSMOOTHSCROLLING, 
-	SPI_GETHOTTRACKING,
-	SPI_GETGRADIENTCAPTIONS,
-	0x1042, //SPI_GETCLIENTAREAANIMATION
-	0x1043, //SPI_GETDISABLEOVERLAPPEDCONTENT
-};
-
-
-UINT spiSuggested[] = {
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-	FALSE,
-};
-
-BOOL spiValues[(sizeof(spiParams) / sizeof(spiParams[0]))];
-
-static bool g_bEffectsDisabled = false;
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-void DisableEffects()
-{
-	if (!g_bEffectsDisabled) {
-		g_bEffectsDisabled = true;
-
-		::ZeroMemory(spiValues, sizeof(spiValues));
-
-		for (size_t iParam = 0; iParam < (sizeof(spiParams) / sizeof(spiParams[0])); iParam++) {
-			if (!SystemParametersInfo(spiParams[iParam], 0, &(spiValues[iParam]), 0)) {
-				vnclog.Print(LL_INTWARN, VNCLOG("Failed to get SPI value for 0x%04x (0x%08x)\n"), spiParams[iParam], GetLastError());
-			} else {
-				vnclog.Print(LL_INTINFO, VNCLOG("Retrieved SPI value for 0x%04x: 0x%08x\n"), spiParams[iParam], spiValues[iParam]);
-			}
-		}
-		for (size_t iParam = 0; iParam < (sizeof(spiParams) / sizeof(spiParams[0])); iParam++) {
-			if (spiValues[iParam] != (BOOL) spiSuggested[iParam]) {
-				if (!SystemParametersInfo(spiParams[iParam]+1, 0, (PVOID)spiSuggested[iParam], SPIF_SENDCHANGE)) {				
-					vnclog.Print(LL_INTWARN, VNCLOG("Failed to set SPI value for 0x%04x to 0x%08x (0x%08x)\n"), spiParams[iParam]+1, spiSuggested[iParam], GetLastError());
-				} else {
-					vnclog.Print(LL_INTINFO, VNCLOG("Set SPI value for 0x%04x to 0x%08x\n"), spiParams[iParam]+1, spiSuggested[iParam]);
-				}
-			}
-		}
-	}
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-void EnableEffects()
-{
-	if (g_bEffectsDisabled) {
-		for (size_t iParam = 0; iParam < (sizeof(spiParams) / sizeof(spiParams[0])); iParam++) {
-			if (spiValues[iParam] != (BOOL) spiSuggested[iParam]) {
-				if (!SystemParametersInfo(spiParams[iParam]+1, 0, (PVOID)spiValues[iParam], SPIF_SENDCHANGE)) {
-					vnclog.Print(LL_INTWARN, VNCLOG("Failed to restore SPI value for 0x%04x (0x%08x)\n"), spiParams[iParam]+1, GetLastError());
-				} else {
-					vnclog.Print(LL_INTINFO, VNCLOG("Restored SPI value for 0x%04x to 0x%08x\n"), spiParams[iParam]+1, spiValues[iParam]);
-				}
-			}
-		}
-
-		::ZeroMemory(spiValues, sizeof(spiValues));
-	}
-
-	g_bEffectsDisabled = false;
-}
-
-
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-//
-bool g_bDisabledFontSmoothing = false;
-
-bool g_bGotOldFontSmoothingValue = false;
-bool g_bGotFontSmoothingType = false;
-bool g_bGotClearType = false;
-BOOL g_bOldClearTypeValue = TRUE;
-BOOL g_bOldFontSmoothingValue = TRUE;
-UINT g_nOldFontSmoothingType = 0x0001; // FE_FONTSMOOTHINGSTANDARD
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-void DisableFontSmoothing()
-{
-	if (!g_bDisabledFontSmoothing) {
-		
-		if (!g_bGotOldFontSmoothingValue) {
-			// there appears to be a delay between setting the SPI_SETFONTSMOOTHING value and SPI_GETFONTSMOOTHING returning that up-to-date value.
-			if (!SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &g_bOldFontSmoothingValue, 0)) {
-				vnclog.Print(LL_INTWARN, VNCLOG("Failed to get SPI value for SPI_GETFONTSMOOTHING (0x%08x)\n"), GetLastError());
-				g_bGotOldFontSmoothingValue = false;
-			} else {
-				vnclog.Print(LL_INTINFO, VNCLOG("Retrieved SPI value for SPI_GETFONTSMOOTHING: 0x%08x\n"), g_bOldFontSmoothingValue);
-				g_bGotOldFontSmoothingValue = true;
-				
-				if (!SystemParametersInfo(0x200A /*SPI_GETFONTSMOOTHINGTYPE*/, 0, &g_nOldFontSmoothingType, 0)) {
-					vnclog.Print(LL_INTWARN, VNCLOG("Failed to get SPI value for SPI_GETFONTSMOOTHINGTYPE (0x%08x)\n"), GetLastError());
-					g_bGotFontSmoothingType = false;
-				} else {
-					vnclog.Print(LL_INTINFO, VNCLOG("Retrieved SPI value for SPI_GETFONTSMOOTHINGTYPE: 0x%08x\n"), g_nOldFontSmoothingType);
-					g_bGotFontSmoothingType = true;
-				}
-				
-				if (!SystemParametersInfo(0x1048 /*SPI_GETCLEARTYPE*/, 0, &g_bOldClearTypeValue, 0)) {
-					vnclog.Print(LL_INTWARN, VNCLOG("Failed to get SPI value for SPI_GETCLEARTYPE (0x%08x)\n"), GetLastError());
-					g_bGotClearType = false;
-				} else {
-					vnclog.Print(LL_INTINFO, VNCLOG("Retrieved SPI value for SPI_GETCLEARTYPE: 0x%08x\n"), g_bOldClearTypeValue);
-					g_bGotClearType = true;
-				}
-			}
-		}
-
-
-		if (g_bGotOldFontSmoothingValue && g_bOldFontSmoothingValue != FALSE) {
-			
-			if (g_bGotClearType && g_bOldClearTypeValue != FALSE) {
-				if (!SystemParametersInfo(0x1049 /*SPI_SETCLEARTYPE*/, 0, (PVOID)FALSE, SPIF_SENDCHANGE)) {				
-					vnclog.Print(LL_INTWARN, VNCLOG("Failed to set SPI value for SPI_SETCLEARTYPE (0x%08x)\n"), GetLastError());
-				} else {
-					g_bDisabledFontSmoothing = true; // ensure we reset even if SPI_SETFONTSMOOTHING fails for some reason
-					vnclog.Print(LL_INTINFO, VNCLOG("Set SPI value for SPI_SETCLEARTYPE: 0x%08x\n"), FALSE);
-				}
-			}
-
-			if (!SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, NULL, SPIF_SENDCHANGE)) {				
-				vnclog.Print(LL_INTWARN, VNCLOG("Failed to set SPI value for SPI_SETFONTSMOOTHING (0x%08x)\n"), GetLastError());
-			} else {
-				g_bDisabledFontSmoothing = true;
-				vnclog.Print(LL_INTINFO, VNCLOG("Set SPI value for SPI_SETFONTSMOOTHING: 0x%08x\n"), FALSE);
-			}
-		}
-	}
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-void EnableFontSmoothing()
-{
-	if (g_bDisabledFontSmoothing && g_bGotOldFontSmoothingValue) {
-		if (g_bOldFontSmoothingValue != FALSE) {
-			if (!SystemParametersInfo(SPI_SETFONTSMOOTHING, g_bOldFontSmoothingValue, NULL, SPIF_SENDCHANGE)) {				
-				vnclog.Print(LL_INTWARN, VNCLOG("Failed to restore SPI value for SPI_SETFONTSMOOTHING (0x%08x)\n"), GetLastError());
-			} else {
-				vnclog.Print(LL_INTINFO, VNCLOG("Restored SPI value for SPI_SETFONTSMOOTHING: 0x%08x\n"), g_bOldFontSmoothingValue);
-
-				if (g_bGotClearType) {
-					if (!SystemParametersInfo(0x1049 /*SPI_SETCLEARTYPE*/, 0, (PVOID)g_bOldClearTypeValue, SPIF_SENDCHANGE)) {				
-						vnclog.Print(LL_INTWARN, VNCLOG("Failed to restore SPI value for SPI_SETCLEARTYPE (0x%08x)\n"), GetLastError());
-					} else {
-						vnclog.Print(LL_INTINFO, VNCLOG("Restored SPI value for SPI_SETCLEARTYPE: 0x%08x\n"), g_bOldClearTypeValue);
-					}
-				}
-
-				if (g_bGotFontSmoothingType) {
-					if (!SystemParametersInfo(0x200B /*SPI_SETFONTSMOOTHINGTYPE*/, 0, (PVOID)g_nOldFontSmoothingType, SPIF_SENDCHANGE)) {				
-						vnclog.Print(LL_INTWARN, VNCLOG("Failed to restore SPI value for SPI_SETFONTSMOOTHINGTYPE (0x%08x)\n"), GetLastError());
-					} else {
-						vnclog.Print(LL_INTINFO, VNCLOG("Restored SPI value for SPI_SETFONTSMOOTHINGTYPE: 0x%08x\n"), g_nOldFontSmoothingType);
-					}
-				}
-			}
-		}
-	}
-
-	g_bDisabledFontSmoothing = false;
-}
diff --git a/ica/win32/winvnc/winvnc/HideDesktop.h b/ica/win32/winvnc/winvnc/HideDesktop.h
deleted file mode 100644
index 1744289..0000000
--- a/ica/win32/winvnc/winvnc/HideDesktop.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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.
-//
-//
-// Functions to hide the Windows Desktop
-//
-// This hides three variants:
-//	- Desktop Patterns  (WIN.INI [Desktop] Pattern=)
-//	- Desktop Wallpaper (.bmp [and JPEG on Windows XP])
-//	- Active Desktop
-//
-// Written by Ed Hardebeck - Glance Networks, Inc.
-// With some code from Paul DiLascia, MSDN Magazine - May 2001
-//
-
-#ifndef _G_HIDEDESKTOP_H_
-#define _G_HIDEDESKTOP_H_
-
-// Everything
-
-void HideDesktop();				// hide it
-void RestoreDesktop();			// restore it  (warning: uses some global state set by HideDesktop)
-
-// Just the Active Desktop
-
-bool HideActiveDesktop();		// returns true if the Active Desktop was enabled and has been hidden
-void ShowActiveDesktop();		// show it always (if Shell version >= 4.71)
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-// UI Effects
-
-void DisableEffects();
-void EnableEffects();
-
-void DisableFontSmoothing();
-void EnableFontSmoothing();
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/IPC.cpp b/ica/win32/winvnc/winvnc/IPC.cpp
deleted file mode 100644
index ad75180..0000000
--- a/ica/win32/winvnc/winvnc/IPC.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h>
-#include <tchar.h>
-#include <crtdbg.h>
-
-#include "IPC.h"
-
-const static LPCTSTR g_szIPCSharedMMF = _T("{34F673E0-878F-11D5-B98A-00B0D07B8C7C}");
-const static LPCTSTR g_szIPCMutex = _T("{34F673E1-878F-11D5-B98A-00B0D07B8C7C}");
-int oldcounter=0;
-
-
-
-//***********************************************
-CIPC::CIPC() : m_hFileMap(NULL), m_hMutex(NULL)
-{
-	plist=NULL;
-	m_FileView=0;
-	CreateIPCMMF();
-	OpenIPCMMF();
-}
-
-//***********************************************
-CIPC::~CIPC()
-{
-	CloseIPCMMF();
-	Unlock();
-}
-
-//***********************************************
-bool CIPC::CreateIPCMMF(void)
-{
-	bool bCreated = false;
-
-	try
-	{
-		if(m_hFileMap != NULL)
-			return false;	// Already created
-
-		// Create an in-memory 4KB memory mapped file to share data
-		m_hFileMap = CreateFileMapping((HANDLE)0xFFFFFFFF,
-			NULL,
-			PAGE_READWRITE,
-			0,
-			sizeof(list),
-			g_szIPCSharedMMF);
-		if(m_hFileMap != NULL)
-			bCreated = true;
-	}
-	catch(...) {}
-
-	return bCreated;
-}
-
-//***********************************************
-bool CIPC::OpenIPCMMF(void)
-{
-	bool bOpened = false;
-
-	try
-	{
-		if(m_hFileMap == NULL)
-		{
-
-		m_hFileMap = OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE,
-			FALSE,
-			g_szIPCSharedMMF);
-		}
-
-		if(m_hFileMap != NULL)
-		{
-			bOpened = true;
-			m_FileView = MapViewOfFile(m_hFileMap,
-			FILE_MAP_READ | FILE_MAP_WRITE,
-			0, 0, 0);
-			if (m_FileView==0) bOpened = false;
-			plist=(mystruct*) m_FileView;
-
-		}
-	}
-	catch(...) {}
-
-	return bOpened;
-}
-
-//***********************************************
-void CIPC::CloseIPCMMF(void)
-{
-	try
-	{
-		if (m_FileView) UnmapViewOfFile(m_FileView);
-		if(m_hFileMap != NULL)
-			CloseHandle(m_hFileMap), m_hFileMap = NULL;
-	}
-	catch(...) {}
-}
-
-//***********************************************
-void CIPC::Addrect(int type, int x1, int y1, int x2, int y2,int x11,int y11, int x22,int y22)
-{
-	if (plist==NULL) return;
-	if (plist->locked==1) 
-	{
-		return;
-	}
-	int counter=plist->counter;
-	plist->locked=1;
-	counter++;
-	if (counter>1999) counter=1;
-	plist->rect1[counter].left=x1;
-	plist->rect1[counter].right=x2;
-	plist->rect1[counter].top=y1;
-	plist->rect1[counter].bottom=y2;
-	plist->rect2[counter].left=x11;
-	plist->rect2[counter].right=x22;
-	plist->rect2[counter].top=y11;
-	plist->rect2[counter].bottom=y22;
-	plist->type[counter]=type;
-	plist->locked=0;
-	plist->counter=counter;
-}
-
-void CIPC::Addcursor(ULONG cursor)
-{
-	if (plist==NULL) return;
-	if (plist->locked==1) 
-	{
-		return;
-	}
-	int counter=plist->counter;
-	plist->locked=1;
-	counter++;
-	if (counter>1999) counter=1;
-	plist->type[counter]=1;
-	plist->locked=0;
-	plist->counter=counter;
-}
-
-mystruct* CIPC::listall()
-{
-	return plist;
-}
-//***********************************************
-bool CIPC::Lock(void)
-{
-	bool bLocked = false;
-
-	try
-	{
-		// First get the handle to the mutex
-		m_hMutex = CreateMutex(NULL, FALSE, g_szIPCMutex);
-		if(m_hMutex != NULL)
-		{
-			// Wait to get the lock on the mutex
-			if(WaitForSingleObject(m_hMutex, INFINITE) == WAIT_OBJECT_0)
-				bLocked = true;
-		}
-	}
-	catch(...) {}
-
-	return bLocked;
-}
-
-//***********************************************
-void CIPC::Unlock(void)
-{
-	try
-	{
-		if(m_hMutex != NULL)
-		{
-			ReleaseMutex(m_hMutex);
-			CloseHandle(m_hMutex);
-			m_hMutex = NULL;
-		}
-	}
-	catch(...) {}
-}
diff --git a/ica/win32/winvnc/winvnc/IPC.h b/ica/win32/winvnc/winvnc/IPC.h
deleted file mode 100644
index c8ce6de..0000000
--- a/ica/win32/winvnc/winvnc/IPC.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-struct mystruct
-{
-	short counter;
-	short locked;
-	RECT rect1[2000];
-	RECT rect2[2000];
-	short type[2000];
-//	ULONG cursor[2000];
-};
-
-// Class for Inter Process Communication using Memory Mapped Files
-class CIPC
-{
-public:
-	CIPC();
-	virtual ~CIPC();
-
-	bool CreateIPCMMF(void);
-	bool OpenIPCMMF(void);
-	void CloseIPCMMF(void);
-	mystruct*  listall();
-
-	bool IsOpen(void) const {return (m_hFileMap != NULL);}
-
-	bool Lock(void);
-	void Unlock(void);
-	void Addrect(int type, int x1, int y1, int x2, int y2,int x11,int y11, int x22,int y22);
-	void Addcursor(ULONG cursor);
-
-protected:
-	HANDLE m_hFileMap;
-	HANDLE m_hMutex;
-	LPVOID m_FileView;
-	mystruct list;
-	mystruct *plist;
-};
diff --git a/ica/win32/winvnc/winvnc/Localization.h b/ica/win32/winvnc/winvnc/Localization.h
deleted file mode 100644
index e72fa62..0000000
--- a/ica/win32/winvnc/winvnc/Localization.h
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-// For translating all messages
-// find and translate all MessageBox                          -- done
-// find and translate all MsgBox                              -- done
-// find and translate all sendMessage with strings            -- done
-// find and copy here and delete all messages string const    -- done
-// find and translate all SetWindowText                       -- done
-// find and translate all SetDlgItemText                      -- done
-
-// All VNCLOG messages are NOT translated for now
-
-
-#ifdef LOCALIZATION_MESSAGES
-
-// LOCALIZATION_MESSAGES is only declare in winvnc.cpp
-
-char sz_ID_FAILED_INIT[64];  //    "Failed to initialise the socket system"
-char sz_ID_WINVNC_USAGE[64];  //   "WinVNC Usage"
-char sz_ID_ANOTHER_INST[64];  //   "Another instance of WinVNC is already running"
-char sz_ID_NO_EXIST_INST[64];  // "No existing instance of WinVNC could be contacted"
-char sz_ID_UNABLE_INST[64];  //    "Unable to install WinVNC service"
-char sz_ID_SCM_NOT_HERE[128];  // "The SCM could not be contacted - the WinVNC service was not installed"
-char sz_ID_SERV_NOT_REG[64];   // "The WinVNC service could not be registered"
-char sz_ID_SERV_FAIL_ST[64];  //   "The WinVNC service failed to start"
-char sz_ID_SERV_CT_MISS[128];  // "The Service Control Manager could not be contacted - the WinVNC service was not registered"
-char sz_ID_SERV_OLD_REG[64];  //   "The WinVNC service is already registered"
-char sz_ID_SERVHELP_UNAB[128]; // "WARNING:Unable to install the ServiceHelper hook\nGlobal user-specific registry settings will not be loaded"
-char sz_ID_SERV_CT_UNREG[128]; // "The Service Control Manager could not be contacted - the WinVNC service was not unregistered"
-char sz_ID_SERV_NOT_UNRG[64];  //  "The WinVNC service could not be unregistered"
-char sz_ID_SERV_NCONTACT[64];  //  "The WinVNC service could not be contacted"
-char sz_ID_SERVHELP_NREM[126]; // "WARNING:The ServiceHelper hook entry could not be removed from the registry"
-char sz_ID_SERV_NOT_STOP[64];  //  "The WinVNC service could not be stopped"
-char sz_ID_SERV_MK_UNREG[64];  // "The WinVNC service is already marked to be unregistered"
-char sz_ID_SERV_NT_FOUND[64];
-char sz_ID_WINVNC_ERROR[64];
-char sz_ID_WINVNC_WARNIN[64];  //  "WinVNC Warning"
-char sz_ID_PLUGIN_LOADIN[64];  //  "Plugin Loading"
-char sz_ID_NO_PASSWD_NO_OVERRIDE_ERR[200];
-char sz_ID_NO_PASSWD_NO_OVERRIDE_WARN[160];
-char sz_ID_NO_PASSWD_NO_LOGON_WARN [140]; // "WARNING : This machine has no default password set.  WinVNC will present the Default Properties dialog now to allow one to be entered.";
-char sz_ID_NO_OVERRIDE_ERR [200];
-char sz_ID_NO_CURRENT_USER_ERR [128]; // = "The WinVNC settings for the current user are unavailable at present.";
-char sz_ID_CANNOT_EDIT_DEFAULT_PREFS [128]; // = "You do not have sufficient priviliges to edit the default local WinVNC settings.";
-char sz_ID_NO_PASSWORD_WARN [200]; 
-char sz_ID_PLUGIN_NOT_LOAD [200]; //  "The Plugin cannot be loaded.\n\rPlease check its integrity.";
-char sz_ID_MB1 [10]; //  "MB1";
-char sz_ID_WVNC [10]; //  "WVNC";
-char sz_ID_AUTHAD_NOT_FO [128]; //  "You selected ms-logon, but the authad.dll\nwas not found.Check you installation"
-char sz_ID_WARNING [64] ; //  "WARNING";
-char sz_ID_AUTH_NOT_FO [128]; //    "You selected ms-logon, but the auth.dll\nwas not found.Check you installation";
-char sz_ID_DESKTOP_BITBLT_ROOT [128]; //   "vncDesktop : root device doesn't support BitBlt\n"       "WinVNC cannot be used with this graphic device driver";
-char sz_ID_DESKTOP_BITBLT_MEM [128];  //   "vncDesktop : memory device doesn't support GetDIBits\n"  "WinVNC cannot be used with this graphics device driver";
-char sz_ID_DESKTOP_PLANAR_NOTC [128]; //   "vncDesktop : current display is PLANAR, not CHUNKY!\n"   "WinVNC cannot be used with this graphics device driver";
-char sz_ID_FAILED_CONNECT_LISTING_VIEW [64]; //  "Failed to connect to listening VNC viewer";
-char sz_ID_OUTGOING_CONNECTION [64] ; //  "Outgoing Connection";
-char sz_ID_UNABLE_PROC_MSLOGON [64]; //  "Unable to process MS logon";
-char sz_ID_RICHED32_UNLOAD [64]; //  "Unable to load the Rich Edit (RICHED32.DLL) control!";
-char sz_ID_RICHED32_DLL_LD [64]; //  "Rich Edit Dll Loading";
-char sz_ID_SERV_SUCCESS_INST[200];
-char sz_ID_SERV_SUCCESS_REG[200];
-char sz_ID_SERV_SUCCESS_UNREG[64]; //    "The WinVNC service has been unregistered";
-char sz_ID_ULTRAVNC_TEXTCHAT[128]; // "The selected client is not an Ultr at VNC Viewer !\n"	"It presumably does not support TextChat\n";
-char sz_ID_ULTRAVNC_WARNING [64]; //     "Ultr at VNC Warning";
-char sz_ID_NO_PLUGIN_DETECT [64]; // "No Plugin detected..."
-
-char sz_ID_CHAT_WITH_S_ULTRAVNC [64]; //   " Chat with <%s> - Ultr at VNC"
-char sz_ID_CURRENT_USER_PROP [64]; //   "WinVNC: Current User Properties"
-char sz_ID_DEFAULT_SYST_PROP [64]; //  "WinVNC: Default Local System Properties"
-char sz_ID_AUTOREJECT_U [64] ; //  "AutoReject:%u"
-char sz_ID_AUTOACCEPT_U [64] ; //  "AutoAccept:%u"
-char sz_ID_CADERROR [128];
-char sz_ID_CADERRORFILE [128];
-char sz_ID_CADPERMISSION [128];
-
-
-int Load_Localization(HINSTANCE hInstance) 
-{
-
-   LoadString(hInstance, ID_FAILED_INIT, sz_ID_FAILED_INIT, 64 -1); 
-   LoadString(hInstance, ID_WINVNC_USAGE, sz_ID_WINVNC_USAGE, 64 -1); 
-   LoadString(hInstance, ID_ANOTHER_INST, sz_ID_ANOTHER_INST, 64 -1); 
-   LoadString(hInstance, ID_NO_EXIST_INST, sz_ID_NO_EXIST_INST, 64 -1);
-   LoadString(hInstance, ID_UNABLE_INST, sz_ID_UNABLE_INST, 64 -1); 
-   LoadString(hInstance, ID_SCM_NOT_HERE, sz_ID_SCM_NOT_HERE, 128 -1); 
-   LoadString(hInstance, ID_SERV_NOT_REG, sz_ID_SERV_NOT_REG, 64 -1); 
-   LoadString(hInstance, ID_SERV_FAIL_ST, sz_ID_SERV_FAIL_ST, 64 -1); 
-   LoadString(hInstance, ID_SERV_CT_MISS, sz_ID_SERV_CT_MISS, 128 -1); 
-   LoadString(hInstance, ID_SERV_OLD_REG, sz_ID_SERV_OLD_REG, 64 -1); 
-   LoadString(hInstance, ID_SERVHELP_UNAB, sz_ID_SERVHELP_UNAB, 128 -1); 
-   LoadString(hInstance, ID_SERV_CT_UNREG, sz_ID_SERV_CT_UNREG, 128 -1); 
-   LoadString(hInstance, ID_SERV_NOT_UNRG, sz_ID_SERV_NOT_UNRG, 64 -1);  
-   LoadString(hInstance, ID_SERV_NCONTACT, sz_ID_SERV_NCONTACT, 64 -1); 
-   LoadString(hInstance, ID_SERVHELP_NREM, sz_ID_SERVHELP_NREM, 126 -1); 
-   LoadString(hInstance, ID_SERV_NOT_STOP, sz_ID_SERV_NOT_STOP, 64 -1);  
-   LoadString(hInstance, ID_SERV_MK_UNREG, sz_ID_SERV_MK_UNREG, 64 -1); 
-   LoadString(hInstance, ID_SERV_NT_FOUND, sz_ID_SERV_NT_FOUND, 64 -1);
-   LoadString(hInstance, ID_WINVNC_ERROR, sz_ID_WINVNC_ERROR, 64 -1);
-   LoadString(hInstance, ID_WINVNC_WARNIN, sz_ID_WINVNC_WARNIN, 64 -1); 
-   LoadString(hInstance, ID_PLUGIN_LOADIN, sz_ID_PLUGIN_LOADIN, 64 -1); 
-   LoadString(hInstance, ID_NO_PASSWD_NO_OVERRIDE_ERR, sz_ID_NO_PASSWD_NO_OVERRIDE_ERR, 200 -1);
-   LoadString(hInstance, ID_NO_PASSWD_NO_OVERRIDE_WARN, sz_ID_NO_PASSWD_NO_OVERRIDE_WARN, 160 -1);
-   LoadString(hInstance, ID_NO_PASSWD_NO_LOGON_WARN, sz_ID_NO_PASSWD_NO_LOGON_WARN , 140 -1); 
-   LoadString(hInstance, ID_NO_OVERRIDE_ERR, sz_ID_NO_OVERRIDE_ERR , 200 -1);
-   LoadString(hInstance, ID_NO_CURRENT_USER_ERR, sz_ID_NO_CURRENT_USER_ERR , 128 -1);
-   LoadString(hInstance, ID_CANNOT_EDIT_DEFAULT_PREFS, sz_ID_CANNOT_EDIT_DEFAULT_PREFS , 128 -1); 
-   LoadString(hInstance, ID_NO_PASSWORD_WARN, sz_ID_NO_PASSWORD_WARN , 200 -1); 
-   LoadString(hInstance, ID_PLUGIN_NOT_LOAD, sz_ID_PLUGIN_NOT_LOAD , 200 -1);
-   LoadString(hInstance, ID_MB1, sz_ID_MB1 , 10 -1); 
-   LoadString(hInstance, ID_WVNC, sz_ID_WVNC , 10 -1); 
-   LoadString(hInstance, ID_AUTHAD_NOT_FO, sz_ID_AUTHAD_NOT_FO , 128 -1); 
-   LoadString(hInstance, ID_WARNING, sz_ID_WARNING , 64 -1) ; 
-   LoadString(hInstance, ID_AUTH_NOT_FO, sz_ID_AUTH_NOT_FO , 128 -1);
-   LoadString(hInstance, ID_DESKTOP_BITBLT_ROOT, sz_ID_DESKTOP_BITBLT_ROOT , 128 -1);
-   LoadString(hInstance, ID_DESKTOP_BITBLT_MEM, sz_ID_DESKTOP_BITBLT_MEM , 128 -1);
-   LoadString(hInstance, ID_DESKTOP_PLANAR_NOTC, sz_ID_DESKTOP_PLANAR_NOTC , 128 -1); 
-   LoadString(hInstance, ID_FAILED_CONNECT_LISTING_VIEW, sz_ID_FAILED_CONNECT_LISTING_VIEW , 64 -1);
-   LoadString(hInstance, ID_OUTGOING_CONNECTION, sz_ID_OUTGOING_CONNECTION , 64 -1); 
-   LoadString(hInstance, ID_UNABLE_PROC_MSLOGON, sz_ID_UNABLE_PROC_MSLOGON , 64 -1);
-   LoadString(hInstance, ID_RICHED32_UNLOAD, sz_ID_RICHED32_UNLOAD , 64 -1); 
-   LoadString(hInstance, ID_RICHED32_DLL_LD, sz_ID_RICHED32_DLL_LD , 64 -1); 
-   LoadString(hInstance, ID_SERV_SUCCESS_INST, sz_ID_SERV_SUCCESS_INST, 200 -1);
-   LoadString(hInstance, ID_SERV_SUCCESS_REG, sz_ID_SERV_SUCCESS_REG, 200 -1);
-   LoadString(hInstance, ID_SERV_SUCCESS_UNREG, sz_ID_SERV_SUCCESS_UNREG, 64 -1); 
-   LoadString(hInstance, ID_ULTRAVNC_TEXTCHAT, sz_ID_ULTRAVNC_TEXTCHAT, 128 -1); 
-   LoadString(hInstance, ID_ULTRAVNC_WARNING, sz_ID_ULTRAVNC_WARNING , 64 -1); 
-   LoadString(hInstance, ID_NO_PLUGIN_DETECT, sz_ID_NO_PLUGIN_DETECT , 64 -1); 
-   LoadString(hInstance, ID_CHAT_WITH_S_ULTRAVNC, sz_ID_CHAT_WITH_S_ULTRAVNC, 64 -1);
-   LoadString(hInstance, ID_CURRENT_USER_PROP, sz_ID_CURRENT_USER_PROP, 64 -1); 
-   LoadString(hInstance, ID_DEFAULT_SYST_PROP, sz_ID_DEFAULT_SYST_PROP, 64 -1); 
-   LoadString(hInstance, ID_AUTOREJECT_U, sz_ID_AUTOREJECT_U, 64 -1);
-   LoadString(hInstance, ID_AUTOACCEPT_U, sz_ID_AUTOACCEPT_U, 64 -1);
-   LoadString(hInstance, ID_CADERROR, sz_ID_CADERROR , 128 -1);
-   LoadString(hInstance, ID_CADERROR, sz_ID_CADERRORFILE , 128 -1);
-   LoadString(hInstance, ID_CADERROR, sz_ID_CADPERMISSION , 128 -1);
-
-
-  return 0;
-}
-
-#else
-
-extern char sz_ID_FAILED_INIT[64];  //    "Failed to initialise the socket system"
-extern char sz_ID_WINVNC_USAGE[64];  //   "WinVNC Usage"
-extern char sz_ID_ANOTHER_INST[64];  //   "Another instance of WinVNC is already running"
-extern char sz_ID_NO_EXIST_INST[64];  // "No existing instance of WinVNC could be contacted"
-extern char sz_ID_UNABLE_INST[64];  //    "Unable to install WinVNC service"
-extern char sz_ID_SCM_NOT_HERE[128];  // "The SCM could not be contacted - the WinVNC service was not installed"
-extern char sz_ID_SERV_NOT_REG[64];   // "The WinVNC service could not be registered"
-extern char sz_ID_SERV_FAIL_ST[64];  //   "The WinVNC service failed to start"
-extern char sz_ID_SERV_CT_MISS[128];  // "The Service Control Manager could not be contacted - the WinVNC service was not registered"
-extern char sz_ID_SERV_OLD_REG[64];  //   "The WinVNC service is already registered"
-extern char sz_ID_SERVHELP_UNAB[128]; // "WARNING:Unable to install the ServiceHelper hook\nGlobal user-specific registry settings will not be loaded"
-extern char sz_ID_SERV_CT_UNREG[128]; // "The Service Control Manager could not be contacted - the WinVNC service was not unregistered"
-extern char sz_ID_SERV_NOT_UNRG[64];  //  "The WinVNC service could not be unregistered"
-extern char sz_ID_SERV_NCONTACT[64];  //  "The WinVNC service could not be contacted"
-extern char sz_ID_SERVHELP_NREM[126]; // "WARNING:The ServiceHelper hook entry could not be removed from the registry"
-extern char sz_ID_SERV_NOT_STOP[64];  //  "The WinVNC service could not be stopped"
-extern char sz_ID_SERV_MK_UNREG[64];  // "The WinVNC service is already marked to be unregistered"
-extern char sz_ID_SERV_NT_FOUND[64];
-extern char sz_ID_WINVNC_ERROR[64];
-extern char sz_ID_WINVNC_WARNIN[64];  //  "WinVNC Warning"
-extern char sz_ID_PLUGIN_LOADIN[64];  //  "Plugin Loading"
-extern char sz_ID_NO_PASSWD_NO_OVERRIDE_ERR[200];
-extern char sz_ID_NO_PASSWD_NO_OVERRIDE_WARN[160];
-extern char sz_ID_NO_PASSWD_NO_LOGON_WARN [140]; // "WARNING : This machine has no default password set.  WinVNC will present the Default Properties dialog now to allow one to be entered.";
-extern char sz_ID_NO_OVERRIDE_ERR [200];
-extern char sz_ID_NO_CURRENT_USER_ERR [128]; // = "The WinVNC settings for the current user are unavailable at present.";
-extern char sz_ID_CANNOT_EDIT_DEFAULT_PREFS [128]; // = "You do not have sufficient priviliges to edit the default local WinVNC settings.";
-extern char sz_ID_NO_PASSWORD_WARN [200]; 
-extern char sz_ID_PLUGIN_NOT_LOAD [200]; //  "The Plugin cannot be loaded.\n\rPlease check its integrity.";
-extern char sz_ID_MB1 [10]; //  "MB1";
-extern char sz_ID_WVNC [10]; //  "WVNC";
-extern char sz_ID_AUTHAD_NOT_FO [128]; //  "You selected ms-logon, but the authad.dll\nwas not found.Check you installation"
-extern char sz_ID_WARNING [64] ; //  "WARNING";
-extern char sz_ID_AUTH_NOT_FO [128]; //    "You selected ms-logon, but the auth.dll\nwas not found.Check you installation";
-extern char sz_ID_DESKTOP_BITBLT_ROOT [128]; //   "vncDesktop : root device doesn't support BitBlt\n"       "WinVNC cannot be used with this graphic device driver";
-extern char sz_ID_DESKTOP_BITBLT_MEM [128];  //   "vncDesktop : memory device doesn't support GetDIBits\n"  "WinVNC cannot be used with this graphics device driver";
-extern char sz_ID_DESKTOP_PLANAR_NOTC [128]; //   "vncDesktop : current display is PLANAR, not CHUNKY!\n"   "WinVNC cannot be used with this graphics device driver";
-extern char sz_ID_FAILED_CONNECT_LISTING_VIEW [64]; //  "Failed to connect to listening VNC viewer";
-extern char sz_ID_OUTGOING_CONNECTION [64] ; //  "Outgoing Connection";
-extern char sz_ID_UNABLE_PROC_MSLOGON [64]; //  "Unable to process MS logon";
-extern char sz_ID_RICHED32_UNLOAD [64]; //  "Unable to load the Rich Edit (RICHED32.DLL) control!";
-extern char sz_ID_RICHED32_DLL_LD [64]; //  "Rich Edit Dll Loading";
-extern char sz_ID_SERV_SUCCESS_INST[200];
-extern char sz_ID_SERV_SUCCESS_REG[200];
-extern char sz_ID_SERV_SUCCESS_UNREG[64]; //    "The WinVNC service has been unregistered";
-extern char sz_ID_ULTRAVNC_TEXTCHAT[128]; // "The selected client is not an Ultr at VNC Viewer !\n"	"It presumably does not support TextChat\n";
-extern char sz_ID_ULTRAVNC_WARNING [64]; //     "Ultr at VNC Warning";
-
-extern char sz_ID_NO_PLUGIN_DETECT [64]; // "No Plugin detected..."
-
-extern char sz_ID_CHAT_WITH_S_ULTRAVNC [64]; //   " Chat with <%s> - Ultr at VNC"
-extern char sz_ID_CURRENT_USER_PROP [64]; //   "WinVNC: Current User Properties"
-extern char sz_ID_DEFAULT_SYST_PROP [64]; //  "WinVNC: Default Local System Properties"
-extern char sz_ID_AUTOREJECT_U [64] ; //  "AutoReject:%u"
-extern char sz_ID_AUTOACCEPT_U [64] ; //  "AutoReject:%u"
-extern char sz_ID_CADERROR [128];
-extern char sz_ID_CADERRORFILE [128];
-extern char sz_ID_CADPERMISSION [128];
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/TextChat.cpp b/ica/win32/winvnc/winvnc/TextChat.cpp
deleted file mode 100644
index 183e003..0000000
--- a/ica/win32/winvnc/winvnc/TextChat.cpp
+++ /dev/null
@@ -1,852 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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.uvnc.com/
-
-#include "stdhdrs.h"
-#include "resource.h"
-#include "vncclient.h"
-#include "vncserver.h"
-#include "TextChat.h"
-#include "commctrl.h"
-#include "richedit.h"
-#include "common/win32_helpers.h"
-
-#include "Localization.h" // Act : add localization on messages
-
-#define TEXTMAXSIZE 16384
-#define MAXNAMESIZE	128 // MAX_COMPUTERNAME_LENGTH+1 (32)
-#define CHAT_OPEN  -1  // Todo; put these codes in rfbproto.h
-#define CHAT_CLOSE -2
-#define CHAT_FINISHED -3
-
-//	[v1.0.2-jp1 fix]
-LRESULT CALLBACK SBProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-LONG pDefSBProc=NULL;
-extern HINSTANCE	hInstResDLL;
-
-extern HINSTANCE	hAppInstance;
-
-//
-//
-//
-#include <mmsystem.h>
-BOOL PlayResource(LPSTR lpName)
-{
-    /*BOOL bRtn;
-    LPSTR lpRes;
-    HANDLE hRes;
-    HRSRC hResInfo;
-
-    // Find the WAVE resource. 
-    hResInfo= FindResource(hAppInstance,MAKEINTRESOURCE(IDR_WAVE1),"WAVE");
-    if(hResInfo == NULL)
-       return FALSE;
-    // Load the WAVE resource. 
-
-    hRes = LoadResource(hAppInstance,hResInfo);
-    if (hRes == NULL)
-      return FALSE;
-
-    // Lock the WAVE resource and play it. 
-    lpRes=(LPSTR)LockResource(hRes);
-    if(lpRes==NULL)
-      return FALSE;
-
-    bRtn = sndPlaySound(lpRes, SND_MEMORY | SND_SYNC);
-    if(bRtn == NULL)
-      return FALSE;
-
-    // Free the WAVE resource and return success or failure. 
-    FreeResource(hRes);
-    return TRUE;*/
-
-	char szWavFile[MAX_PATH]; //PGM 
-
-	if (GetModuleFileName(NULL, szWavFile, MAX_PATH)) //PGM 
-
-	{ // PGM 
-
-		char* p = strrchr(szWavFile, '\\'); //PGM 
-
-		*p = '\0'; //PGM 
-
-		strcat(szWavFile,"\\"); //PGM 
-
-	} //PGM 
-
-	strcat(szWavFile,"ding_dong.wav"); //PGM 
-
-	if(::PlaySound(szWavFile, NULL, SND_APPLICATION | SND_FILENAME | SND_ASYNC | SND_NOWAIT)!= ERROR_SUCCESS) //PGM
-
-		return FALSE; //PGM 
-
-	else //PGM 
-
-		return TRUE; //PGM 
-
-}
-
-///////////////////////////////////////////////////////
-TextChat::TextChat(vncClient *pCC)
-{
-	m_hDlg=NULL;
-	m_pCC = pCC;
-	m_fTextChatRunning = false;
-	
-	m_fPersistentTexts = false;
-	m_szLocalText = new char [TEXTMAXSIZE]; // Text (message) entered by local user
-	memset(m_szLocalText, 0, TEXTMAXSIZE);
-	m_szLastLocalText = new char [TEXTMAXSIZE]; // Last local text (no more necessary)
-	memset(m_szLastLocalText, 0, TEXTMAXSIZE);
-	m_szRemoteText = new char [TEXTMAXSIZE]; // Incoming remote text (remote message)
-	memset(m_szRemoteText, 0, TEXTMAXSIZE);
-	m_szRemoteName = new char[MAXNAMESIZE]; // Name of remote machine
-	memset(m_szRemoteName,0,MAXNAMESIZE);
-	m_szLocalName =  new char[MAXNAMESIZE]; // Name of local machine
-	memset(m_szLocalName,0,MAXNAMESIZE);
-
-	m_szTextBoxBuffer = new char[TEXTMAXSIZE]; // History Text (containing all chat messages from everybody)
-	memset(m_szTextBoxBuffer,0,TEXTMAXSIZE);
-
-	// memset(m_szUserID, 0, 16);	// Short User ID (name, pseudo...whatever) that replace 
-								// the local computer name/IP
-
-	unsigned long pcSize=MAXNAMESIZE;
-	if (GetComputerName(m_szLocalName, &pcSize))
-	{
-		if( pcSize >= MAXNAMESIZE)
-		{
-			m_szLocalName[MAXNAMESIZE-4]='.';
-			m_szLocalName[MAXNAMESIZE-3]='.';
-			m_szLocalName[MAXNAMESIZE-2]='.';
-			m_szLocalName[MAXNAMESIZE-1]=0x00;
-		}
-	}
-	
-	//  Load the Rich Edit control DLL
-	m_hRichEdit = LoadLibrary( "RICHED32.DLL" );
-	if (!m_hRichEdit)
-	{  
-		MessageBoxSecure( NULL, sz_ID_RICHED32_UNLOAD,
-					sz_ID_RICHED32_DLL_LD, MB_OK | MB_ICONEXCLAMATION );
-		// Todo: do normal edit instead (no colors)
-	}
-    m_Thread = INVALID_HANDLE_VALUE;
-}
-
-
-//
-//
-//
-TextChat::~TextChat()
-{
-	if (m_szLocalText != NULL) delete [] m_szLocalText;
-	if (m_szLastLocalText != NULL) delete [] m_szLastLocalText;
-	if (m_szRemoteText != NULL) delete [] m_szRemoteText;
-	if (m_szRemoteName != NULL) delete [] m_szRemoteName;
-	if (m_szLocalName != NULL) delete [] m_szLocalName;
-	if (m_szTextBoxBuffer != NULL) delete [] m_szTextBoxBuffer;
-
-	m_fTextChatRunning = false;
-	if (m_hDlg!=NULL) SendMessage(m_hDlg, WM_COMMAND, IDCANCEL, 0L);
-
-	if (m_hRichEdit != NULL) FreeLibrary(m_hRichEdit);
-}
-
-
-//
-//
-//
-void TextChat::ShowChatWindow(bool fVisible)
-{
-	ShowWindow(m_hDlg, fVisible ? SW_RESTORE : SW_MINIMIZE);
-	SetForegroundWindow(m_hDlg);
-	//SetFocus(GetDlgItem(m_hDlg, IDC_INPUTAREA_EDIT));
-}
-
-
-//
-// Set text format to a selection in the Chat area
-//
-void TextChat::SetTextFormat(bool bBold /* = false */, bool bItalic /* = false*/
-	, long nSize /* = 0x75*/, const char* szFaceName /* = "MS Sans Serif"*/, DWORD dwColor /* = BLACK*/)
-{
-	if ( GetDlgItem( m_hDlg, IDC_CHATAREA_EDIT ) )  //  Sanity Check
-	{		
-		CHARFORMAT cf;
-		memset( &cf, 0, sizeof(CHARFORMAT) ); //  Initialize structure
-
-		cf.cbSize = sizeof(CHARFORMAT);             
-		cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE;
-		if (bBold) {
-			cf.dwMask |= CFM_BOLD;
-			cf.dwEffects |= CFE_BOLD;
-		}
-		if (bItalic) {
-			cf.dwMask |= CFM_ITALIC;  
-			cf.dwEffects |= CFE_ITALIC;
-		}
-		cf.crTextColor = dwColor;					// set color in AABBGGRR mode (alpha-RGB)
-		cf.yHeight = nSize;							// set size in points
-		strcpy_s( cf.szFaceName, 32, szFaceName);
-													
-		SendDlgItemMessage( m_hDlg, IDC_CHATAREA_EDIT, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-	}
-}
-
-//
-//
-//
-void TextChat::ProcessTextChatMsg(int nTO)
-{
-	rfbTextChatMsg tcm;
-	m_pCC->m_socket->ReadExact(((char *) &tcm) + nTO, sz_rfbTextChatMsg - nTO);
-	int len = Swap32IfLE(tcm.length);
-	
-	if (len == CHAT_OPEN)
-	{
-		PlayResource("IDR_WAVE1");
-		if (m_fTextChatRunning) return;
-		// PostMessage(m_pCC->m_server->GetDesktopPointer()->Window(), WM_USER+888, 0, (LPARAM)this);
-		DisplayTextChat();
-		return;
-	}
-	else if (len == CHAT_CLOSE)
-	{
-		// Close TextChat Dialog
-		if (!m_fTextChatRunning) return;
-		PostMessage(m_hDlg, WM_COMMAND, IDOK, 0);
-		return;
-	}
-	else if (len == CHAT_FINISHED)
-	{
-		// Close TextChat Dialog
-		if (!m_fTextChatRunning) return;
-		// m_fTextChatRunning = false;
-		// PostMessage(m_hDlg, WM_COMMAND, IDCANCEL, 0);
-		return;
-	}
-	else
-	{
-		// Read the incoming text
-		if (len > TEXTMAXSIZE) return; // Todo: Improve this...
-		if (len == 0)
-		{
-			SetDlgItemText(m_hDlg, IDC_CHATAREA_EDIT, "");
-			memset(m_szRemoteText, 0, TEXTMAXSIZE);
-		}
-		else
-		{
-			memset(m_szRemoteText, 0, TEXTMAXSIZE);
-			m_pCC->m_socket->ReadExact(m_szRemoteText, len);
-			ShowChatWindow(true); // Show the chat window on new message reception
-			PrintMessage(m_szRemoteText, m_szRemoteName, RED);
-		}
-	}
-}
-
-
-//
-// Tell the client to initiate a TextChat
-//
-void TextChat::OrderTextChat()
-{
-	SendTextChatRequest(CHAT_OPEN);
-	return;
-}
-
-
-//
-//
-//
-void TextChat::SendTextChatRequest(int nMsg)
-{
-	if (m_pCC->m_fFileTransferRunning) return; // Don't break a running file transfer please...
-    rfbTextChatMsg tcm;
-    tcm.type = rfbTextChat;
-	tcm.length = Swap32IfLE(nMsg);
-    m_pCC->m_socket->SendExact((char *)&tcm, sz_rfbTextChatMsg, rfbTextChat);
-	return;
-}
-
-
-//
-// Output messages in the chat area 
-//
-//
-void TextChat::PrintMessage(const char* szMessage,const char* szSender,DWORD dwColor /* = BLACK*/)
-{
-	// char szTextBoxBuffer[TEXTMAXSIZE];			
-	// memset(szTextBoxBuffer,0,TEXTMAXSIZE);			
-	CHARRANGE cr;	
-	
-	// sf at 2005 - Empty the RichEdit control when it's close to the TEXTMAXSIZE limit
-	// In worst case, the RichEdit can contains 2*TEXTMAXSIZE + NAMEMAXSIZE + 4 - 32 bytes
-	GETTEXTLENGTHEX lpG;
-	lpG.flags = GTL_NUMBYTES;
-	lpG.codepage = CP_ACP; // ANSI
-
-	int nLen = SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT, EM_GETTEXTLENGTHEX, (WPARAM)&lpG, 0L);
-	if (nLen + 32 > TEXTMAXSIZE )
-	{
-		memset(m_szTextBoxBuffer, 0, TEXTMAXSIZE);
-		strcpy(m_szTextBoxBuffer, "------------------------------------------------------------------------------------------------------------------------\n");
-		SetDlgItemText(m_hDlg, IDC_CHATAREA_EDIT, m_szTextBoxBuffer);
-	}
-
-	// Todo: test if chat text + sender + message > TEXTMAXSIZE -> Modulo display
-	if (szSender != NULL && strlen(szSender) > 0) //print the sender's name
-	{
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,WM_GETTEXT, TEXTMAXSIZE-1,(LONG)m_szTextBoxBuffer);
-		cr.cpMax = nLen; //strlen(m_szTextBoxBuffer);	 // Select the last caracter to make the text insertion
-		cr.cpMin  = cr.cpMax;
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,EM_EXSETSEL,0,(LONG) &cr);
-
-		//	[v1.0.2-jp1 fix]
-		//SetTextFormat(false,false,0x75,"MS Sans Serif",dwColor);
-		if(!hInstResDLL){
-			SetTextFormat(false,false,0x75,"MS Sans Serif",dwColor);
-		}
-		else{
-			SetTextFormat(false, false, 0xb4, "�l�r �o�S�V�b�N", dwColor);
-		}
-
-		_snprintf(m_szTextBoxBuffer, MAXNAMESIZE-1 + 4, "<%s>: ", szSender);		
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,EM_REPLACESEL,FALSE,(LONG)m_szTextBoxBuffer); // Replace the selection with the message
-	}
-
-	nLen = SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT, EM_GETTEXTLENGTHEX, (WPARAM)&lpG, 0L);
-	if (szMessage != NULL) //print the sender's message
-	{	
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,WM_GETTEXT, TEXTMAXSIZE-1,(LONG)m_szTextBoxBuffer);
-		cr.cpMax = nLen; //strlen(m_szTextBoxBuffer);	 // Select the last caracter to make the text insertion
-		cr.cpMin  = cr.cpMax;
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,EM_EXSETSEL,0,(LONG) &cr);
-
-		//	[v1.0.2-jp1 fix]
-		//SetTextFormat(false, false, 0x75, "MS Sans Serif", dwColor != GREY ? BLACK : GREY);	
-		if(!hInstResDLL){
-			SetTextFormat(false, false, 0x75, "MS Sans Serif", dwColor != GREY ? BLACK : GREY);
-		}
-		else{
-			SetTextFormat(false, false, 0xb4, "�l�r �o�S�V�b�N", dwColor != GREY ? BLACK : GREY);
-		}
-
-		_snprintf(m_szTextBoxBuffer, TEXTMAXSIZE-1, "%s", szMessage);		
-		SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT,EM_REPLACESEL,FALSE,(LONG)m_szTextBoxBuffer); 
-	}
-
-	// Scroll down the chat window
-	// The following seems necessary under W9x & Me if we want the Edit to scroll to bottom...
-	SCROLLINFO si;
-    ZeroMemory(&si, sizeof(SCROLLINFO));
-    si.cbSize = sizeof(SCROLLINFO);
-    si.fMask = SIF_RANGE|SIF_PAGE;
-    GetScrollInfo(GetDlgItem(m_hDlg, IDC_CHATAREA_EDIT), SB_VERT, &si);
-	si.nPos = si.nMax - max(si.nPage - 1, 0);
-	SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT, WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, si.nPos), 0L);	// Scroll down the ch
-
-	// This line does the bottom scrolling correctly under NT4,W2K, XP...
-	// SendDlgItemMessage(m_hDlg, IDC_CHATAREA_EDIT, WM_VSCROLL, SB_BOTTOM, 0L);
-
-}
-
-//
-// Send local text content
-//
-void TextChat::SendLocalText(void)
-{
-	if (m_pCC->m_fFileTransferRunning) return; // Don't break a running file transfer please...
-
-	// We keep it because we could use it
-	// for future retype functionality. (F3)
-	memcpy(m_szLastLocalText, m_szLocalText, strlen(m_szLocalText));
-
-	PrintMessage(m_szLocalText, m_szLocalName, BLUE);
-
-    rfbTextChatMsg tcm;
-    tcm.type = rfbTextChat;
-	tcm.length = Swap32IfLE(strlen(m_szLocalText));
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-    m_pCC->m_socket->SendExactQueue((char *)&tcm, sz_rfbTextChatMsg, rfbTextChat);
-	m_pCC->m_socket->SendExact((char *)m_szLocalText, strlen(m_szLocalText));
-
-	//and we clear the input box
-	SetDlgItemText(m_hDlg, IDC_INPUTAREA_EDIT, "");
-	return;
-}
-
-
-
-LRESULT CALLBACK TextChat::DoDialogThread(LPVOID lpParameter)
-{
-	TextChat* _this = (TextChat*)lpParameter;
-
-	_this->m_fTextChatRunning = true;
-	// TODO: Place code here.
-	HDESK desktop;
-	desktop = OpenInputDesktop(0, FALSE,
-								DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-								DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-								DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-								DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-								);
-
-	if (desktop == NULL)
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n"));
-	else 
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n"));
-
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-
-	char new_name[256];
-	if (desktop)
-	{
-		if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
-		}
-
-		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop);
-
-		if (!SetThreadDesktop(desktop))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
-		}
-	}
-
-	 //	[v1.0.2-jp1 fix]
- 	 //DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_TEXTCHAT_DLG), 
-	 //						NULL, (DLGPROC) TextChatDlgProc, (LONG) _this);
- 	 DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_TEXTCHAT_DLG), 
-	 						NULL, (DLGPROC) TextChatDlgProc, (LPARAM) _this);
-	 SetThreadDesktop(old_desktop);
-	 if (desktop) CloseDesktop(desktop);
-	 return 0;
-}
-
-
-/*int TextChat::DoDialog()
-{
-	m_fTextChatRunning = true; // Here.Important.
-
-	//	[v1.0.2-jp1 fix]
-	//return DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_TEXTCHAT_DLG), 
-	//						NULL, (DLGPROC) TextChatDlgProc, (LONG) this);
-	return DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_TEXTCHAT_DLG), 
-							NULL, (DLGPROC) TextChatDlgProc, (LONG) this);
-}*/
-
-HWND TextChat::DisplayTextChat()
-{
-	DWORD threadID;
-	m_Thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(TextChat::DoDialogThread),(LPVOID)this, 0, &threadID);
-	if (m_Thread) ResumeThread(m_Thread);
-	return (HWND)0;
-
-}
-
-//
-//
-//
-void TextChat::KillDialog()
-{
-	m_fTextChatRunning = false;
-    if (m_Thread != INVALID_HANDLE_VALUE)
-    {
-	    SendMessage(m_hDlg, WM_COMMAND, IDCANCEL, 0);
-        ::WaitForSingleObject(m_Thread, INFINITE); // wait for thread to exit
-        m_hDlg=NULL;
-    }
-}
-
-
-//
-//
-//
-void TextChat::RefuseTextChat()
-{
-	SendTextChatRequest(CHAT_CLOSE);
-	SendTextChatRequest(CHAT_FINISHED);
-}
-
-
-//	[v1.0.2-jp1 fix-->]
-void AdjustLeft(LPRECT lprc)
-{
-	int cx = lprc->right - lprc->left - GetSystemMetrics(SM_CXSIZEFRAME) * 2;
-
-	if(cx < 240){
-		lprc->left = lprc->right - 240 - GetSystemMetrics(SM_CXSIZEFRAME) * 2;
-	}
-}
-
-void AdjustTop(LPRECT lprc)
-{
-	int cy = lprc->bottom - lprc->top - GetSystemMetrics(SM_CYSIZEFRAME) * 2;
-
-	if(cy < 179){
-		lprc->top = lprc->bottom - 179 - GetSystemMetrics(SM_CYSIZEFRAME) * 2;
-	}
-}
-
-void AdjustRight(LPRECT lprc)
-{
-	int cx = lprc->right - lprc->left - GetSystemMetrics(SM_CXSIZEFRAME) * 2;
-
-	if(cx < 240){
-		lprc->right = lprc->left + 240 + GetSystemMetrics(SM_CXSIZEFRAME) * 2;
-	}
-}
-
-void AdjustBottom(LPRECT lprc)
-{
-	int cy = lprc->bottom - lprc->top - GetSystemMetrics(SM_CYSIZEFRAME) * 2;
-
-	if(cy < 179){
-		lprc->bottom = lprc->top + 179 + GetSystemMetrics(SM_CYSIZEFRAME) * 2;
-	}
-}
-//	[<--v1.0.2-jp1 fix]
-
-
-//
-//
-//
-INT_PTR CALLBACK TextChat::TextChatDlgProc(  HWND hWnd,  UINT uMsg,  WPARAM wParam, LPARAM lParam ) {
-
-    TextChat *_this = helper::SafeGetWindowUserData<TextChat>(hWnd);
-#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++ uMsg %i\n",uMsg);
-					OutputDebugString(szText);		
-#endif
-	switch (uMsg)
-	{
-	case WM_INITDIALOG:
-		{
-            helper::SafeSetWindowUserData(hWnd, lParam);
-            TextChat *_this = (TextChat *) lParam;
-
-			if (_this->m_szLocalText == NULL || _this->m_szRemoteText == NULL)
-				EndDialog(hWnd, FALSE);
-
-			_this->m_hWnd = hWnd;
-			_this->m_hDlg = hWnd;
-
-			if (_snprintf(_this->m_szRemoteName,MAXNAMESIZE-1,"%s", _this->m_pCC->GetClientName()) < 0 )
-			{
-				_this->m_szRemoteName[MAXNAMESIZE-4]='.';
-				_this->m_szRemoteName[MAXNAMESIZE-3]='.';
-				_this->m_szRemoteName[MAXNAMESIZE-2]='.';
-				_this->m_szRemoteName[MAXNAMESIZE-1]=0x00;
-			}	
-
-			const long lTitleBufSize = 256;			
-			char szTitle[lTitleBufSize];
-			
-			_snprintf(szTitle,lTitleBufSize-1, sz_ID_CHAT_WITH_S_ULTRAVNC,_this->m_szRemoteName);
-			SetWindowText(hWnd, szTitle);			
-
-			memset(_this->m_szLocalText, 0, TEXTMAXSIZE);
-
-			// Local message box	
-			SetDlgItemText(hWnd, IDC_INPUTAREA_EDIT, _this->m_szLocalText); 
-			
-			//  Chat area			
-			_this->SetTextFormat(); //  Set character formatting and background color
-			SendDlgItemMessage( hWnd, IDC_CHATAREA_EDIT, EM_SETBKGNDCOLOR, FALSE, 0xFFFFFF ); 
-
-			memset(_this->m_szLastLocalText, 0, TEXTMAXSIZE); // Future retype functionnality
-			memset(_this->m_szTextBoxBuffer, 0, TEXTMAXSIZE); // Clear Chat area 
-				//  Load and display diclaimer message
-				// sf at 2005 - Only if the DSMplugin is used
-			if (!_this->m_pCC->m_server->GetDSMPluginPointer()->IsEnabled())
-				{
-					//	[v1.0.2-jp1 fix]
-					if (LoadString(hInstResDLL,IDS_WARNING,_this->m_szRemoteText, TEXTMAXSIZE -1) )
-						_this->PrintMessage(_this->m_szRemoteText, NULL ,GREY);
-				}
-
-
-			
-			// Scroll down the chat window
-			// The following seems necessary under W9x & Me if we want the Edit to scroll to bottom...
-
-
-			SCROLLINFO si;
-			ZeroMemory(&si, sizeof(SCROLLINFO));
-			si.cbSize = sizeof(SCROLLINFO);
-			si.fMask = SIF_RANGE|SIF_PAGE;
-			GetScrollInfo(GetDlgItem(hWnd, IDC_CHATAREA_EDIT), SB_VERT, &si);
-			si.nPos = si.nMax - max(si.nPage - 1, 0);
-			SendDlgItemMessage(hWnd, IDC_CHATAREA_EDIT, WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, si.nPos), 0L);	
-			
-			SetForegroundWindow(hWnd);
-
-			//	[v1.0.2-jp1 fix] SUBCLASS Split bar
-            pDefSBProc = helper::SafeGetWindowProc(GetDlgItem(hWnd, IDC_STATIC_SPLIT));
-			// CRAsh X64 fixed
-            helper::SafeSetWindowProc(GetDlgItem(hWnd, IDC_STATIC_SPLIT), pDefSBProc);
-
-            return TRUE;
-		}
-		break;
-
-	case WM_COMMAND:
-#ifdef _DEBUG
-					//char			szText[256];
-					sprintf(szText," ++++++ wm_command %i\n",LOWORD(wParam));
-					OutputDebugString(szText);		
-	#endif
-		switch (LOWORD(wParam))
-		{
-		/*
-		case IDC_PERSISTENT_CHECK:
-			  _this->m_fPersistentTexts = (SendDlgItemMessage(hWnd, IDC_PERSISTENT_CHECK, BM_GETCHECK, 0, 0) == BST_CHECKED);
-			return TRUE;
-		*/
-
-		case IDOK:
-			// Client order to close TextChat 			
-
-			//	[v1.0.2-jp1 fix] UNSUBCLASS Split bar
-            helper::SafeSetWindowProc(GetDlgItem(hWnd, IDC_STATIC_SPLIT), pDefSBProc);
-			EndDialog(hWnd, FALSE);
-			_this->m_fTextChatRunning = false;
-			_this->SendTextChatRequest(CHAT_FINISHED);
-			return TRUE;
-
-		case IDCANCEL:			
-			_this->SendTextChatRequest(CHAT_CLOSE); // Client must close TextChat
-
-			//	[v1.0.2-jp1 fix] UNSUBCLASS Split bar
-            helper::SafeSetWindowProc(GetDlgItem(hWnd, IDC_STATIC_SPLIT), pDefSBProc);
-			EndDialog(hWnd, FALSE);
-			_this->m_fTextChatRunning = false;
-			_this->SendTextChatRequest(CHAT_FINISHED);
-			return TRUE;
-
-		case IDC_SEND_B:
-			{
-			memset(_this->m_szLocalText,0,TEXTMAXSIZE);
-			UINT nRes = GetDlgItemText( hWnd, IDC_LOCALTEXT_EDIT, _this->m_szLocalText, TEXTMAXSIZE-1);
-			strcat(_this->m_szLocalText, "\n");
-			_this->SendLocalText();	
-			SetFocus(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT));
-			}
-			return TRUE;
-
-		case IDC_INPUTAREA_EDIT:
-			if(HIWORD(wParam) == EN_UPDATE)			
-			{
-				UINT nRes = GetDlgItemText( hWnd, IDC_INPUTAREA_EDIT, _this->m_szLocalText, TEXTMAXSIZE);
-				if (strstr(_this->m_szLocalText, "\n") > 0 ) // Enter triggers the message transmission
-				{
-					// nRes = GetDlgItemText( hWnd, IDC_USERID_EDIT, _this->m_szUserID, 16);
-					_this->SendLocalText();
-				}								
-			}
-			return TRUE;
-
-		case IDC_HIDE_B:
-			_this->ShowChatWindow(false);
-			return TRUE;
-
-		default:
-			return TRUE;
-			break;
-		}
-		break;
-
-	case WM_SYSCOMMAND:
-		switch (LOWORD(wParam))
-		{
-		case SC_RESTORE:
-			_this->ShowChatWindow(true);
-			//SetFocus(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT));
-			return TRUE;
-		}
-		break;
-
-	//	[v1.0.2-jp1 fix-->]
-	case WM_SIZING:
-		LPRECT lprc;
-		lprc = (LPRECT)lParam;
-		switch(wParam){
-		case WMSZ_TOPLEFT:
-			AdjustTop(lprc);
-			AdjustLeft(lprc);
-		case WMSZ_TOP:
-			AdjustTop(lprc);
-		case WMSZ_TOPRIGHT:
-			AdjustTop(lprc);
-			AdjustRight(lprc);
-		case WMSZ_LEFT:
-			AdjustLeft(lprc);
-		case WMSZ_RIGHT:
-			AdjustRight(lprc);
-		case WMSZ_BOTTOMLEFT:
-			AdjustBottom(lprc);
-			AdjustLeft(lprc);
-		case WMSZ_BOTTOM:
-			AdjustBottom(lprc);
-		case WMSZ_BOTTOMRIGHT:
-			AdjustBottom(lprc);
-			AdjustRight(lprc);
-		}
-		return TRUE;
-
-	case WM_SIZE:
-		int cx;
-		int cy;
-		int icy;
-		RECT rc;
-
-		if(wParam == SIZE_MINIMIZED){
-			break;
-		}
-
-		cx = LOWORD(lParam);
-		cy = HIWORD(lParam);
-		GetWindowRect(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT), &rc);
-		icy = rc.bottom - rc.top;
-		if(cy - icy - 12 < 80){
-			icy = cy - 92;
-		}
-		MoveWindow(GetDlgItem(hWnd, IDC_CHATAREA_EDIT),  4,             4, cx -  8, cy - icy - 16, TRUE); 
-		MoveWindow(GetDlgItem(hWnd, IDC_STATIC_SPLIT),   4, cy - icy - 12, cx -  8,             8, TRUE); 
-		MoveWindow(GetDlgItem(hWnd, IDC_INPUTAREA_EDIT), 4, cy - icy -  4, cx - 88,           icy, TRUE);
-
-		MoveWindow(GetDlgItem(hWnd, IDC_SEND_B), cx - 76, cy - 64, 72, 20, TRUE); 
-		MoveWindow(GetDlgItem(hWnd, IDC_HIDE_B), cx - 76, cy - 40, 72, 18, TRUE); 
-		MoveWindow(GetDlgItem(hWnd, IDCANCEL),   cx - 76, cy - 22, 72, 18, TRUE);
-
-		InvalidateRect(hWnd, NULL, FALSE);
-		return TRUE;
-	//	[<--v1.0.2-jp1 fix]
-
-	case WM_DESTROY:
-		// _this->m_fTextChatRunning = false;
-		// _this->SendTextChatRequest(CHAT_FINISHED);
-		EndDialog(hWnd, FALSE);
-		return TRUE;
-	}
-	return 0;
-}
-
-//	[v1.0.2-jp1 fix-->] Split bar
-void DrawResizeLine(HWND hWnd, int y)
-{
-	HWND hParent;
-	RECT rc;
-	HDC hDC;
-
-	hParent = GetParent(hWnd);
-	GetClientRect(hParent, &rc);
-
-	if(y < 80){
-		y = 80;
-	}
-	else if(y > rc.bottom - 80){
-		y = rc.bottom - 80;
-	}
-	
-	hDC = GetDC(hParent);
-	SetROP2(hDC, R2_NOTXORPEN);
-	MoveToEx(hDC, rc.left, y, NULL);
-	LineTo(hDC, rc.right, y);
-	MoveToEx(hDC, rc.left, y+1, NULL);
-	LineTo(hDC, rc.right, y+1);
-	MoveToEx(hDC, rc.left, y+2, NULL);
-	LineTo(hDC, rc.right, y+2);
-	MoveToEx(hDC, rc.left, y+3, NULL);
-	LineTo(hDC, rc.right, y+3);
-	ReleaseDC(hParent, hDC);
-}
-//	[<--v1.0.2-jp1 fix]
-
-//	[v1.0.2-jp1 fix-->] Split bar proc
-LRESULT CALLBACK SBProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-	static BOOL bCapture;
-	static UINT u;
-	static int oldy;
-	HWND hParent;
-	RECT rc;
-	POINT cp;
-	int y;
-	int cx;
-	int cy;
-
-	switch(uMsg){
-	case WM_SETCURSOR:
-		SetCursor(LoadCursor(NULL, IDC_SIZENS));
-		return TRUE;
-	case WM_LBUTTONDOWN:
-		SetCapture(hWnd);
-		bCapture = TRUE;
-		u = GetCaretBlinkTime();
-		SetCaretBlinkTime(0x7fffffff);
-		GetCursorPos(&cp);
-		hParent = GetParent(hWnd);
-		ScreenToClient(hParent, &cp);
-		DrawResizeLine(hWnd, cp.y);
-		oldy = cp.y;
-		break;
-	case WM_MOUSEMOVE:
-		if(bCapture){
-			GetCursorPos(&cp);
-			hParent = GetParent(hWnd);
-			ScreenToClient(hParent, &cp);
-			DrawResizeLine(hWnd, oldy);
-			DrawResizeLine(hWnd, cp.y);
-			oldy = cp.y;
-		}
-		break;
-	case WM_LBUTTONUP:
-		ReleaseCapture();
-		bCapture = FALSE;
-		SetCaretBlinkTime(u);
-		GetCursorPos(&cp);
-		hParent = GetParent(hWnd);
-		GetClientRect(hParent, &rc);
-		cx = rc.right - rc.left;
-		cy = rc.bottom - rc.top;
-		ScreenToClient(hParent, &cp);
-		DrawResizeLine(hWnd, cp.y);
-		y = cp.y;
-		if(y < 80){
-			y = 80;
-		}
-		else if(y > cy - 80){
-			y = cy - 80;
-		}
-		MoveWindow(GetDlgItem(hParent, IDC_CHATAREA_EDIT),  4,         4, cx -  8,       y - 4, TRUE); 
-		MoveWindow(GetDlgItem(hParent, IDC_STATIC_SPLIT),   4,         y, cx -  8,           8, TRUE); 
-		MoveWindow(GetDlgItem(hParent, IDC_INPUTAREA_EDIT), 4,     y + 8, cx - 88, cy - y - 12, TRUE);
-		break;
-	}
-
-	return CallWindowProc((WNDPROC)pDefSBProc, hWnd, uMsg, wParam, lParam);
-}
-//	[<--v1.0.2-jp1 fix]
diff --git a/ica/win32/winvnc/winvnc/TextChat.h b/ica/win32/winvnc/winvnc/TextChat.h
deleted file mode 100644
index fc24c92..0000000
--- a/ica/win32/winvnc/winvnc/TextChat.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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.uvnc.com/
-
-
-#ifndef TEXTCHAT_H__
-#define TEXTCHAT_H__
-#pragma once
-
-#define BLACK	0x00000000
-#define RED		0x000000FF
-#define GREEN	0x0000FF00
-#define BLUE	0x00FF0000
-#define GREY	0x00888888
-
-class vncClient;
-
-class TextChat  
-{
-public:
-	// Props
-	vncClient			*m_pCC;
-	HWND				m_hWnd;
-	HWND				m_hDlg;
-	bool				m_fTextChatRunning;
-	char*				m_szLocalText;
-	char*				m_szLastLocalText;
-	char*				m_szRemoteText;	
-	char*				m_szRemoteName;
-	char*				m_szLocalName;
-	char*				m_szTextBoxBuffer;
-	HMODULE				m_hRichEdit;
-	bool				m_fPersistentTexts;
-	// char				m_szUserID[16];
-    HANDLE              m_Thread;
-
-	// Methods
-	TextChat(vncClient *pCC);
-//	int DoDialog();
-	HWND DisplayTextChat();
-	void KillDialog();
-	void OrderTextChat();
-	void RefuseTextChat();
-	void ProcessTextChatMsg(int nTO);
-   	virtual ~TextChat();
-	static LRESULT CALLBACK DoDialogThread(LPVOID lpParameter);
-	static INT_PTR CALLBACK TextChatDlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
-	void SendTextChatRequest(int Msg);
-	void SendLocalText(void);
-	void PrintMessage(const char* szMessage, const char* szSender, DWORD color = BLACK);
-	void SetTextFormat(bool bBold = false, bool bItalic = false, long nSize = 0x75, const char* szFaceName = "MS Sans Serif", DWORD dwColor = BLACK);
-	void ShowChatWindow(bool fVisible);
-};
-
-#endif 
-
-
-
diff --git a/ica/win32/winvnc/winvnc/Timer.cpp b/ica/win32/winvnc/winvnc/Timer.cpp
deleted file mode 100644
index 431f0ba..0000000
--- a/ica/win32/winvnc/winvnc/Timer.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-// Class was copied from another project...but can find it back
-// If someone find it please message me to add it..
-
-#include "Timer.h"
-Timer :: Timer()
-{
-  total = 0.0;
-  endT.tv_sec = startT.tv_sec = 0;
-  endT.tv_usec = startT.tv_usec = 0;
-  tScale = 1.0 / CLOCKS_PER_SEC;
-  start();
-  stop();
-  reset();
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/Timer.h b/ica/win32/winvnc/winvnc/Timer.h
deleted file mode 100644
index 7a0c734..0000000
--- a/ica/win32/winvnc/winvnc/Timer.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-// Class was copied from another project...but can find it back
-// If someone find it please message me to add it..
-
-#ifndef _TIMER_H
-
-#include <stdio.h>
-#include <winsock.h>
-#include <time.h>
-
-inline void gettimeofday( struct timeval *t, void* )
-{
-  t->tv_sec = 0;
-  t->tv_usec = clock();
-}
-
-
-class Timer
-{
-
- public:
-
-  Timer();
-  virtual ~Timer(){};
-
-  inline double frame()
-    {
-      if( !stopped )
-        gettimeofday( &endT, 0 );
-      else
-	{
-	  frameT.tv_sec = endT.tv_sec;
-	  frameT.tv_usec = endT.tv_usec;
-	}
-
-      secs  = endT.tv_sec - frameT.tv_sec;
-      usecs = endT.tv_usec - frameT.tv_usec;
-
-      frameT.tv_sec = endT.tv_sec;
-      frameT.tv_usec = endT.tv_usec;
-
-      return( secs + ( usecs * tScale ) );
-    }
-
-  //! Reset the timer to \b newVal.
-  inline void reset( float newVal = 0.0f )
-    {
-      total = newVal;
-      if( !stopped )
-	gettimeofday( &startT, 0 );
-    }
-
-  //! Read the current elapsed time (in seconds).
-  inline double read()
-    {
-      if( !stopped )
-	gettimeofday( &endT, 0 );
-      else
-	{
-	  endT.tv_sec = startT.tv_sec;
-	  endT.tv_usec = startT.tv_usec;
-	}
-
-      secs  = endT.tv_sec - startT.tv_sec;
-      usecs = endT.tv_usec - startT.tv_usec;
-      return( secs + ( usecs * tScale ) + total );
-    }
-
-  //! Start the timer.
-  inline void start()
-    {
-      stopped = false;
-      gettimeofday( &startT, 0 );
-      frameT.tv_sec = startT.tv_sec;
-      frameT.tv_usec = startT.tv_usec;
-    }
-
-  //! Stop the timer.
-  inline void stop()
-    {
-      gettimeofday( &endT, 0 );
-      secs  = endT.tv_sec - startT.tv_sec;
-      usecs = endT.tv_usec - startT.tv_usec;
-      total += ( secs + ( usecs * tScale) );
-      frameT.tv_sec = endT.tv_sec;
-      frameT.tv_usec = endT.tv_usec;
-      stopped = true;
-    }
-
- private:
-
-  timeval endT, frameT, startT;
-  double secs, usecs, tScale, total;
-  bool stopped;
-
-}; /* end class Timer */
-
-#define _TIMER_H
-#endif
diff --git a/ica/win32/winvnc/winvnc/WINVNC.DSW b/ica/win32/winvnc/winvnc/WINVNC.DSW
deleted file mode 100644
index f66df05..0000000
--- a/ica/win32/winvnc/winvnc/WINVNC.DSW
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "winvnc"=".\WINVNC.DSP" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ica/win32/winvnc/winvnc/benchmark.cpp b/ica/win32/winvnc/winvnc/benchmark.cpp
deleted file mode 100644
index eb557fb..0000000
--- a/ica/win32/winvnc/winvnc/benchmark.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "windows.h"
-#include <stdio.h>
-#include <string.h>
-#include "vnclog.h"
-bool G_USE_PIXEL=false;
-extern VNCLog vnclog;
-#define VNCLOG(s)	(__FILE__ " : " s)
-
-struct _BMInfo {
-		BOOL			truecolour;
-		BITMAPINFO		bmi;
-		// Colormap info - comes straight after BITMAPINFO - **HACK**
-		RGBQUAD			cmap[256];
-	} m_bminfo;
-
-void testBench()
-{
-	HDC			m_hrootdc=NULL;
-	HDC			m_hmemdc=NULL;
-	HBITMAP		m_membitmap=NULL;
-	HBITMAP		m_oldbitmap=NULL;
-	void		*m_DIBbits=NULL;
-
-	m_hrootdc = GetDC(NULL);
-	if (m_hrootdc == NULL) {
-		return ;
-	}
-	m_hmemdc = CreateCompatibleDC(m_hrootdc);
-	if (m_hmemdc == NULL) {
-		return ;
-	}
-	m_membitmap = CreateCompatibleBitmap(m_hrootdc,1,1);
-	if (m_membitmap == NULL) {
-		return ;
-	}
-
-
-	int result;
-	memset(&m_bminfo, 0, sizeof(m_bminfo));
-	m_bminfo.bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	m_bminfo.bmi.bmiHeader.biBitCount = 0;
-	result = ::GetDIBits(m_hmemdc, m_membitmap, 0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-	if (result == 0) {
-		return;
-	}
-	result = ::GetDIBits(m_hmemdc, m_membitmap,  0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-	if (result == 0) {
-		return;
-	}
-	RECT m_bmrect;
-	m_bmrect.left=0;
-	m_bmrect.top=0;
-	m_bmrect.right=GetDeviceCaps(m_hrootdc, HORZRES);
-	m_bmrect.bottom=GetDeviceCaps(m_hrootdc, VERTRES);
-	// Henceforth we want to use a top-down scanning representation
-    m_bminfo.bmi.bmiHeader.biWidth = m_bmrect.right;
-    m_bminfo.bmi.bmiHeader.biHeight = m_bmrect.bottom;
-    m_bminfo.bmi.bmiHeader.biSizeImage = abs((m_bminfo.bmi.bmiHeader.biWidth *
-				m_bminfo.bmi.bmiHeader.biHeight *
-				m_bminfo.bmi.bmiHeader.biBitCount)/ 8);
-	m_bminfo.bmi.bmiHeader.biHeight = - abs(m_bminfo.bmi.bmiHeader.biHeight);
-
-	// Is the bitmap palette-based or truecolour?
-	m_bminfo.truecolour = (GetDeviceCaps(m_hmemdc, RASTERCAPS) & RC_PALETTE) == 0;
-
-	int m_bytesPerRow = m_bminfo.bmi.bmiHeader.biWidth * m_bminfo.bmi.bmiHeader.biBitCount / 8;
-	int m_bytesPerPixel= m_bminfo.bmi.bmiHeader.biBitCount / 8;
-
-	HBITMAP tempbitmap = CreateDIBSection(m_hmemdc, &m_bminfo.bmi, DIB_RGB_COLORS, &m_DIBbits, NULL, 0);
-	if (tempbitmap == NULL) {
-		m_DIBbits = NULL;
-        tempbitmap = CreateCompatibleBitmap(m_hrootdc, m_bmrect.right, m_bmrect.bottom);
-	    if (tempbitmap == NULL) {
-		    return;
-	    }
-	}
-
-	// Delete the old memory bitmap
-	if (m_membitmap != NULL) {
-		DeleteObject(m_membitmap);
-		m_membitmap = NULL;
-	}
-
-	// Replace old membitmap with DIB section
-	m_membitmap = tempbitmap;
-	DWORD time1,time2;
-///---------------------------------------
-	{
-	DWORD start= timeGetTime();
-	
-	{
-	if ((m_oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-					return;
-	BOOL blitok = BitBlt(m_hmemdc, 0, 0, m_bmrect.right, m_bmrect.bottom, m_hrootdc, 0, 0, CAPTUREBLT | SRCCOPY);
-	SelectObject(m_hmemdc, m_oldbitmap);
-	}
-	COLORREF cr = 0;
-	for (int xx=0;xx<m_bmrect.right/32;xx++)
-		for (int yy=0;yy<m_bmrect.bottom/32;yy++)
-		{
-			unsigned int index = (m_bytesPerRow * yy) + (m_bytesPerPixel * xx);
-				memcpy(&cr, ((char*)m_DIBbits)+index, m_bytesPerPixel);
-		}
-
-
-	DWORD stop= timeGetTime();
-	time1=stop-start;
-	}
-	
-///---------------------------------------
-	{
-	DWORD start= timeGetTime();
-	
-	{
-	COLORREF cr = 0;
-	for (int xx=0;xx<m_bmrect.right*m_bmrect.bottom/32/32/200;xx++)
-		{
-			cr=GetPixel(m_hrootdc, 1, 1);
-		}
-	}
-	DWORD stop= timeGetTime();
-	time2=(stop-start)*200;
-	}
-///---------------------------------------
-
-	if (time2<time1) G_USE_PIXEL=true;
-	else G_USE_PIXEL=false;
-
-	vnclog.Print(9, VNCLOG("Blit time %i  Getpixeltime %i  Use getpixel= %i\n"), time1,time2,G_USE_PIXEL);
-
-	if (m_hrootdc != NULL)
-	{
-		if (!DeleteDC(m_hrootdc))
-		m_hrootdc = NULL;
-	}
-	if (m_hmemdc != NULL)
-	{
-		// Release our device context
-		if (!DeleteDC(m_hmemdc))
-		{
-		}
-		m_hmemdc = NULL;
-	}
-	if (m_membitmap != NULL)
-	{
-		// Release the custom bitmap, if any
-		if (!DeleteObject(m_membitmap))
-		{
-		}
-		m_membitmap = NULL;
-	}
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/black_layered.cpp b/ica/win32/winvnc/winvnc/black_layered.cpp
deleted file mode 100644
index e9cfa42..0000000
--- a/ica/win32/winvnc/winvnc/black_layered.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
-#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
-#include <windows.h>
-#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
-#include <time.h>
-HWND hwnd;
-HINSTANCE hInst;
-#ifndef LWA_COLORKEY
-# define LWA_COLORKEY 1
-#endif
-#ifndef LWA_ALPHA 
-# define LWA_ALPHA 2
-#endif
-#ifndef WS_EX_LAYERED
-# define WS_EX_LAYERED 0x80000
-#endif
-#include "stdhdrs.h"
-#include "resource.h"
-#include "vncservice.h"
-
-
-int wd=0;
-int ht=0;
-
-HBITMAP
-    DoGetBkGndBitmap2(
-        IN CONST UINT uBmpResId
-      )
-    {
-        static HBITMAP hbmBkGnd = NULL;
-        if (NULL == hbmBkGnd)
-        {
-			char WORKDIR[MAX_PATH];
-			char mycommand[MAX_PATH];
-			if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-				{
-				char* p = strrchr(WORKDIR, '\\');
-				if (p == NULL) return 0;
-				*p = '\0';
-			}
-			strcpy(mycommand,WORKDIR);
-			strcat(mycommand,"\\background.bmp");
-
-			hbmBkGnd = (HBITMAP)LoadImage(NULL, mycommand, IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE);
-			if (hbmBkGnd ==NULL)
-			{
-				 hbmBkGnd = (HBITMAP)LoadImage(
-                GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_LOGO64),
-                    IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
-			}
-			BITMAPINFOHEADER h2;
-			h2.biSize=sizeof(h2);
-			h2.biBitCount=0;
-			// h2.biWidth=11; h2.biHeight=22; h2.biPlanes=1;
-			HDC hxdc=CreateDC("DISPLAY",NULL,NULL,NULL);  
-			GetDIBits(hxdc, hbmBkGnd, 0, 0, NULL, (BITMAPINFO*)&h2, DIB_RGB_COLORS);
-			wd=h2.biWidth; ht=h2.biHeight;
-			DeleteDC(hxdc);
-
-            if (NULL == hbmBkGnd)
-                hbmBkGnd = (HBITMAP)-1;
-        }
-        return (hbmBkGnd == (HBITMAP)-1)
-            ? NULL : hbmBkGnd;
-    }
-BOOL
-    DoSDKEraseBkGnd2(
-        IN CONST HDC hDC,
-        IN CONST COLORREF crBkGndFill
-      )
-    {
-        HBITMAP hbmBkGnd = DoGetBkGndBitmap2(0);
-        if (hDC && hbmBkGnd)
-        {
-            RECT rc;
-            if ((ERROR != GetClipBox(hDC, &rc)) && !IsRectEmpty(&rc))
-            {
-                HDC hdcMem = CreateCompatibleDC(hDC);
-                if (hdcMem)
-                {
-                    HBRUSH hbrBkGnd = CreateSolidBrush(crBkGndFill);
-                    if (hbrBkGnd)
-                    {
-                        HGDIOBJ hbrOld = SelectObject(hDC, hbrBkGnd);
-                        if (hbrOld)
-                        {
-                            SIZE size = {
-                                (rc.right-rc.left), (rc.bottom-rc.top)
-                            };
-
-                            if (PatBlt(hDC, rc.left, rc.top, size.cx, size.cy, PATCOPY))
-                            {
-                                HGDIOBJ hbmOld = SelectObject(hdcMem, hbmBkGnd);
-                                if (hbmOld)
-                                {
-									StretchBlt(hDC,
-										0,
-										0,
-										size.cx,
-										size.cy,
-                                        hdcMem,
-										0,
-										0,
-										wd,
-										ht,
-										SRCCOPY);
-
-
-
-  /*                                  BitBlt(hDC, rc.left, rc.top, size.cx, size.cy,
-                                        hdcMem, rc.left, rc.top, SRCCOPY);*/
-                                    SelectObject(hdcMem, hbmOld);
-                                }
-                            }
-                            SelectObject(hDC, hbrOld);
-                        }
-                        DeleteObject(hbrBkGnd);
-                    }
-                    DeleteDC(hdcMem);
-                }
-            }
-        }
-        return TRUE;
-    }
-
-
-static LRESULT CALLBACK WndProc(
-    HWND hwnd,        // handle to window
-    UINT uMsg,        // message identifier
-    WPARAM wParam,    // first message parameter
-    LPARAM lParam)    // second message parameter
-{
-    switch (uMsg)
-    {
-						case WM_CREATE:
-//							SetTimer(hwnd,10,30000,NULL);
-							SetTimer(hwnd,100,20,NULL);
-							break;
-						case WM_TIMER:
-							if (wParam==100) 
-							{
-                                SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
-							
-							}
-//							if (wParam==10) DestroyWindow(hwnd);
-                         
-						 case WM_ERASEBKGND:
-							{
-									DoSDKEraseBkGnd2((HDC)wParam, RGB(0,0,0));
-									return true;
-							}
-						case WM_CTLCOLORSTATIC:
-							{
-									SetBkMode((HDC) wParam, TRANSPARENT);
-									return (LONG_PTR) GetStockObject(NULL_BRUSH);
-							}
-                         case WM_DESTROY:
-								KillTimer(hwnd,100);
-                                PostQuitMessage (0);
-                                break;
-        default:
-            return DefWindowProc(hwnd, uMsg, wParam, lParam);
-    }
-    return 0;
-}
-
-bool
-create_window(void)
-{
-	WNDCLASSEX wndClass;
-	ZeroMemory (&wndClass, sizeof (wndClass));
-    wndClass.cbSize        = sizeof (wndClass);
-    wndClass.style         = CS_HREDRAW | CS_VREDRAW;
-    wndClass.lpfnWndProc   = WndProc;
-    wndClass.cbClsExtra    = 0;
-    wndClass.cbWndExtra    = 0;
-    wndClass.hInstance     = hInst;
-    wndClass.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
-    wndClass.hIconSm       = NULL;
-    wndClass.hCursor       = LoadCursor (NULL, IDC_ARROW);
-    wndClass.hbrBackground = (HBRUSH) GetStockObject(GRAY_BRUSH);
-    wndClass.lpszMenuName  = NULL;
-    wndClass.lpszClassName = "blackscreen";
-
-        if (!RegisterClassEx(&wndClass)) {
- //               return false;
-        }
-
-        RECT clientRect;
-        clientRect.left = 0;
-        clientRect.top = 0;
-        clientRect.right = GetSystemMetrics(SM_CXSCREEN);
-        clientRect.bottom = GetSystemMetrics(SM_CYSCREEN);
-
-        UINT x(GetSystemMetrics(SM_XVIRTUALSCREEN));
-        UINT y(GetSystemMetrics(SM_YVIRTUALSCREEN));
-        UINT cx(GetSystemMetrics(SM_CXVIRTUALSCREEN));
-        UINT cy(GetSystemMetrics(SM_CYVIRTUALSCREEN));
-
-        clientRect.left = x;
-        clientRect.top = y;
-        clientRect.right = x + cx;
-        clientRect.bottom = y + cy;
-
-        AdjustWindowRect (&clientRect, WS_CAPTION, FALSE);
-        hwnd = CreateWindowEx (0,
-                               "blackscreen",
-                               "blackscreen",
-                               WS_POPUP  | WS_CLIPSIBLINGS | WS_CLIPCHILDREN|WS_BORDER,
-                               CW_USEDEFAULT,
-                               CW_USEDEFAULT,
-                               cx,
-                               cy,
-                               NULL,
-                               NULL,
-                               hInst,
-                               NULL);
-		typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD);
-
-	PSLWA pSetLayeredWindowAttributes=NULL;
-	/*
-	* Code that follows allows the program to run in 
-	* environment other than windows 2000
-	* without crashing only difference being that 
-	* there will be no transparency as 
-	* the SetLayeredAttributes function is available only in
-	* windows 2000
-	*/
-	HMODULE hDLL = LoadLibrary ("user32");
-	if (hDLL) pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
-	/*
-	* Make the windows a layered window
-	*/
-	LONG style = GetWindowLong(hwnd, GWL_STYLE);
-	style = GetWindowLong(hwnd, GWL_STYLE);
-	style &= ~(WS_DLGFRAME | WS_THICKFRAME);
-	SetWindowLong(hwnd, GWL_STYLE, style);
-
-	if (pSetLayeredWindowAttributes != NULL) {
-		SetWindowLong (hwnd, GWL_EXSTYLE, GetWindowLong
-		(hwnd, GWL_EXSTYLE) |WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOPMOST);
-	    ShowWindow (hwnd, SW_SHOWNORMAL);
-	}
-	if (pSetLayeredWindowAttributes != NULL) {
-	/**
-	* Second parameter RGB(255,255,255) sets the colorkey to white
-	* LWA_COLORKEY flag indicates that color key is valid
-	* LWA_ALPHA indicates that ALphablend parameter (factor)
-	* is valid
-	*/
-	pSetLayeredWindowAttributes (hwnd, RGB(255,255,255), 255, LWA_ALPHA);
-	}
-	SetWindowPos(hwnd,HWND_TOPMOST,x,y,cx,cy, SWP_FRAMECHANGED|SWP_NOACTIVATE);
-//SM_CXVIRTUALSCREEN
-	return true;
-}
-
-DWORD WINAPI BlackWindow(LPVOID lpParam)
-{
- 	// TODO: Place code here.
-	HDESK desktop;
-	desktop = OpenInputDesktop(0, FALSE,
-								DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-								DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-								DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-								DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-								);
-
-	if (desktop == NULL)
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n"));
-	else 
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n"));
-
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-
-	char new_name[256];
-	if (desktop)
-	{
-		if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
-		}
-
-		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop);
-
-		if (!SetThreadDesktop(desktop))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
-		}
-	}
-
-	create_window();
-	MSG msg;
-	while (GetMessage(&msg,0,0,0) != 0)
-	{
-		TranslateMessage(&msg);
-		DispatchMessage(&msg);
-	}
-	vnclog.Print(LL_INTERR, VNCLOG("end BlackWindow \n"));
-	SetThreadDesktop(old_desktop);
-	if (desktop) CloseDesktop(desktop);
-
-	return 0;
-}
diff --git a/ica/win32/winvnc/winvnc/buildtime.cpp b/ica/win32/winvnc/winvnc/buildtime.cpp
deleted file mode 100644
index 30ca1c0..0000000
--- a/ica/win32/winvnc/winvnc/buildtime.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//  Copyright (C) 2002 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 at realvnc.com for information on obtaining it.
-
-char buildtime[] = __DATE__ " " __TIME__;
diff --git a/ica/win32/winvnc/winvnc/d3des.c b/ica/win32/winvnc/winvnc/d3des.c
deleted file mode 100644
index 6d508d4..0000000
--- a/ica/win32/winvnc/winvnc/d3des.c
+++ /dev/null
@@ -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++ = (unsigned char)((*outof >> 24) & 0xffL);
-	*into++ = (unsigned char)((*outof >> 16) & 0xffL);
-	*into++ = (unsigned char)((*outof >>  8) & 0xffL);
-	*into++ = (unsigned char)( *outof++	 & 0xffL);
-	*into++ = (unsigned char)((*outof >> 24) & 0xffL);
-	*into++ = (unsigned char)((*outof >> 16) & 0xffL);
-	*into++ = (unsigned char)((*outof >>  8) & 0xffL);
-	*into	=  (unsigned char)(*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
- **********************************************************************/
diff --git a/ica/win32/winvnc/winvnc/d3des.h b/ica/win32/winvnc/winvnc/d3des.h
deleted file mode 100644
index feae87f..0000000
--- a/ica/win32/winvnc/winvnc/d3des.h
+++ /dev/null
@@ -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
- ********************************************************************/
diff --git a/ica/win32/winvnc/winvnc/getinfo.cpp b/ica/win32/winvnc/winvnc/getinfo.cpp
deleted file mode 100644
index 5fa4f99..0000000
--- a/ica/win32/winvnc/winvnc/getinfo.cpp
+++ /dev/null
@@ -1,589 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h> 
-#if defined(_WIN32) || defined(_WIN64)
-#include <tchar.h>
-#endif
-#include <memory.h>
-//#include <math.h>
-#include <stdio.h>    
-#include <string.h>
-#include "Dtwinver.h"
-
-#if !defined(_WIN32) && !defined(_WIN64)
-  #define _stprintf sprintf
-  #define _tcscat strcat
-  #define LPTSTR LPSTR
-#endif
-
-
-int getinfo(char mytext[1024])
-
-{                                  
-  COSVersion::OS_VERSION_INFO osvi;
-  memset(&osvi, 0, sizeof(osvi));
-#ifdef _WIN32
-  TCHAR sText[512];
-  TCHAR sBuf[100];
-#else
-  char sText[512];
-  char sBuf[100];
-#endif
-
-  COSVersion os;  
-  if (os.GetVersion(&osvi))
-  {
-  #ifndef UNDER_CE
-    _stprintf(sText, _T("OS: "));
-    
-    switch (osvi.EmulatedPlatform)
-    {
-      case COSVersion::Dos:               
-      {
-        _tcscat(sText, _T("DOS"));                
-        break;
-      }
-      case COSVersion::Windows3x:         
-      {
-        _tcscat(sText, _T("Windows"));        
-        if (os.IsWin32sInstalled(&osvi))
-          _tcscat(sText, _T(" (Win32s)"));
-        break;
-      }
-      case COSVersion::WindowsCE:
-      {
-        _tcscat(sText, _T("Windows CE"));        
-        break;
-      }
-      case COSVersion::Windows9x:
-      {
-        if (os.IsWindows95(&osvi))
-          _stprintf(sBuf, _T("Windows 95"));
-        else if (os.IsWindows95SP1(&osvi))
-          _stprintf(sBuf, _T("Windows 95 SP1"));
-        else if (os.IsWindows95OSR2(&osvi))
-          _stprintf(sBuf, _T("Windows 95 OSR2"));
-        else if (os.IsWindows98(&osvi))
-          _stprintf(sBuf, _T("Windows 98"));
-        else if (os.IsWindows98SP1(&osvi))
-          _stprintf(sBuf, _T("Windows 98 SP1"));
-        else if (os.IsWindows98SE(&osvi))
-          _stprintf(sBuf, _T("Windows 98 Second Edition"));
-        else if (os.IsWindowsME(&osvi))
-          _stprintf(sBuf, _T("Windows Millenium Edition"));
-        else
-          _stprintf(sBuf, _T("Windows ??"));
-        _tcscat(sText, sBuf);          
-        break;
-      }
-      case COSVersion::WindowsNT:
-      {
-        if (os.IsNTPreWin2k(&osvi))
-        {
-          _tcscat(sText, _T("Windows NT"));          
-
-          if (os.IsNTWorkstation(&osvi))
-            _tcscat(sText, _T(" (Workstation)"));
-          else if (os.IsNTStandAloneServer(&osvi))
-            _tcscat(sText, _T(" (Server)"));
-          else if (os.IsNTPDC(&osvi))
-            _tcscat(sText, _T(" (Primary Domain Controller)"));
-          else if (os.IsNTBDC(&osvi))
-            _tcscat(sText, _T(" (Backup Domain Controller)"));
-
-          if (os.IsNTDatacenterServer(&osvi))
-            _tcscat(sText, _T(", (Datacenter)"));
-          else if (os.IsNTEnterpriseServer(&osvi))
-            _tcscat(sText, _T(", (Enterprise)"));
-        }
-        else if (os.IsWindows2000(&osvi))
-        {
-          _tcscat(sText, _T("Windows 2000"));          
-
-          if (os.IsWin2000Professional(&osvi))
-            _tcscat(sText, _T(" (Professional)"));
-          else if (os.IsWin2000Server(&osvi))
-            _tcscat(sText, _T(" (Server)"));
-          else if (os.IsWin2000DomainController(&osvi))
-            _tcscat(sText, _T(" (Domain Controller)"));
-
-          if (os.IsWin2000DatacenterServer(&osvi))
-            _tcscat(sText, _T(", (Datacenter)"));
-          else if (os.IsWin2000AdvancedServer(&osvi))
-            _tcscat(sText, _T(", (Advanced Server)"));
-        }
-        else if (os.IsWindowsXPOrWindowsServer2003(&osvi))
-        {
-          if (os.IsXPPersonal(&osvi))
-            _tcscat(sText, _T("Windows XP (Personal)"));          
-          else if (os.IsXPProfessional(&osvi))
-            _tcscat(sText, _T("Windows XP (Professional)"));          
-          else if (os.IsWindowsServer2003(&osvi))
-            _tcscat(sText, _T("Windows Server 2003"));          
-          else if (os.IsDomainControllerWindowsServer2003(&osvi))
-            _tcscat(sText, _T("Windows Server 2003 (Domain Controller)"));          
-
-          if (os.IsDatacenterWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Datacenter Edition)"));
-          else if (os.IsEnterpriseWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Enterprise Edition)"));
-          else if (os.IsWebWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Web Edition)"));
-          else if (os.IsWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Standard Edition)"));
-        }
-
-        if (os.IsTerminalServicesInstalled(&osvi))
-          _tcscat(sText, _T(", (Terminal Services)"));
-        if (os.ISSmallBusinessEditionInstalled(&osvi))
-          _tcscat(sText, _T(", (BackOffice Small Business Edition)"));
-        if (os.IsEmbedded(&osvi))
-          _tcscat(sText, _T(", (Embedded)"));
-        if (os.IsTerminalServicesInRemoteAdminMode(&osvi))
-          _tcscat(sText, _T(", (Terminal Services in Remote Admin Mode)"));
-        if (os.IsEmulated64Bit(&osvi))
-          _tcscat(sText, _T(", (64 Bit Edition)"));
-        if (os.IsMediaCenterInstalled(&osvi))
-          _tcscat(sText, _T(", (Media Center Edition)"));
-
-        if (osvi.dwSuiteMask & COSVERSION_SUITE_UNIPROCESSOR_FREE)
-          _tcscat(sText, _T(", (Uniprocessor Free)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_UNIPROCESSOR_CHECKED)
-          _tcscat(sText, _T(", (Uniprocessor Checked)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_MULTIPROCESSOR_FREE)
-          _tcscat(sText, _T(", (Multiprocessor Free)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_MULTIPROCESSOR_CHECKED)
-          _tcscat(sText, _T(", (Multiprocessor Checked)"));
-
-        break;
-      }
-      default: 
-      {
-        _stprintf(sBuf, _T("Unknown OS"));
-        break;
-      }
-    }                     
-
-#ifndef UNDER_CE
-    switch (osvi.EmulatedProcessorType)
-    {
-      case COSVersion::INTEL_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (Intel Processor)"));
-        break;
-      }
-      case COSVersion::MSIL_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (MSIL Processor)"));
-        break;
-      }
-      case COSVersion::MIPS_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (MIPS Processor)"));
-        break;
-      }
-      case COSVersion::ARM_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (ARM Processor)"));
-        break;
-      }
-      case COSVersion::SHX_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (SHX Processor)"));
-        break;
-      }
-      case COSVersion::ALPHA_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (Alpha Processor)"));
-        break;
-      }
-      case COSVersion::ALPHA64_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (Alpha64 Processor)"));
-        break;
-      }
-      case COSVersion::PPC_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (PPC Processor)"));
-        break;
-      }
-      case COSVersion::IA64_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (IA64 Processor)"));
-        break;
-      }
-      case COSVersion::AMD64_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (AMD64 Processor)"));
-        break;
-      }
-      case COSVersion::UNKNOWN_PROCESSOR: //deliberate fallthrough
-      default:
-      {
-        _tcscat(sText, _T(", (Unknown Processor)"));
-        break;
-      }
-    }
-#endif
-
-    _stprintf(sBuf, _T(" v%d."), (int) osvi.dwEmulatedMajorVersion);
-    _tcscat(sText, sBuf);     
-    if (osvi.dwEmulatedMinorVersion % 10)
-    {
-      if (osvi.dwEmulatedMinorVersion > 9)
-        _stprintf(sBuf, _T("%02d"), (int) osvi.dwEmulatedMinorVersion);
-      else
-        _stprintf(sBuf, _T("%01d"), (int) osvi.dwEmulatedMinorVersion);
-    }
-    else
-      _stprintf(sBuf, _T("%01d"), (int) osvi.dwEmulatedMinorVersion / 10);
-    _tcscat(sText, sBuf);                           
-    if (osvi.dwEmulatedBuildNumber)
-    {
-      _stprintf(sBuf, _T(" Build:%d"), (int) osvi.dwEmulatedBuildNumber);
-      _tcscat(sText, sBuf);           
-    }
-    if (osvi.wEmulatedServicePackMajor)       
-    {
-      if (osvi.wEmulatedServicePackMinor)
-      {
-        //Handle the special case of NT 4 SP 6a which Dtwinver ver treats as SP 6.1
-        if (os.IsNTPreWin2k(&osvi) && (osvi.wEmulatedServicePackMajor == 6) && (osvi.wEmulatedServicePackMinor == 1))
-          _stprintf(sBuf, _T(" Service Pack: 6a"));
-        //Handle the special case of XP SP 1a which Dtwinver ver treats as SP 1.1
-        else if (os.IsWindowsXP(&osvi) && (osvi.wEmulatedServicePackMajor == 1) && (osvi.wEmulatedServicePackMinor == 1))
-          _stprintf(sBuf, _T(" Service Pack: 1a"));
-        else       
-          _stprintf(sBuf, _T(" Service Pack:%d.%d"), osvi.wEmulatedServicePackMajor, osvi.wEmulatedServicePackMinor);
-      }
-      else
-        _stprintf(sBuf, _T(" Service Pack:%d"), osvi.wEmulatedServicePackMajor);
-      _tcscat(sText, sBuf);
-    }                            
-    else
-    {
-      if (osvi.wEmulatedServicePackMinor)       
-        _stprintf(sBuf, _T(" Service Pack:0.%d"), osvi.wEmulatedServicePackMinor);
-    }
-
-    _tcscat(sText, _T("\n"));        
-  #endif
-  /*  
-    //CE does not really have a concept of an emulated OS so
-    //lets not bother displaying any info on this on CE
-    if (osvi.UnderlyingPlatform == COSVersion::WindowsCE)
-      _tcscpy(sText, _T("OS: "));
-    else
-      _tcscat(sText, _T("Underlying OS: "));
-                                                         
-    switch (osvi.UnderlyingPlatform)
-    {
-      case COSVersion::Dos:               
-      {
-        _tcscat(sText, _T("DOS"));                
-        break;
-      }
-      case COSVersion::Windows3x:         
-      {
-        _tcscat(sText, _T("Windows"));                
-        break;
-      }
-      case COSVersion::WindowsCE:            
-      {
-        _tcscat(sText, _T("Windows CE"));                
-        break;
-      }
-      case COSVersion::Windows9x:           
-      {
-        if (os.IsWindows95(&osvi))
-          _stprintf(sBuf, _T("Windows 95"));
-        else if (os.IsWindows95SP1(&osvi))
-          _stprintf(sBuf, _T("Windows 95 SP1"));
-        else if (os.IsWindows95OSR2(&osvi))
-          _stprintf(sBuf, _T("Windows 95 OSR2"));
-        else if (os.IsWindows98(&osvi))
-          _stprintf(sBuf, _T("Windows 98"));
-        else if (os.IsWindows98SP1(&osvi))
-          _stprintf(sBuf, _T("Windows 98 SP1"));
-        else if (os.IsWindows98SE(&osvi))
-          _stprintf(sBuf, _T("Windows 98 Second Edition"));
-        else if (os.IsWindowsME(&osvi))
-          _stprintf(sBuf, _T("Windows Millenium Edition"));
-        else
-          _stprintf(sBuf, _T("Windows ??"));
-        _tcscat(sText, sBuf);                  
-        break;
-      }
-      case COSVersion::WindowsNT:    
-      {
-        if (os.IsNTPreWin2k(&osvi))
-        {
-          _tcscat(sText, _T("Windows NT"));                  
-
-          if (os.IsNTWorkstation(&osvi))
-            _tcscat(sText, _T(" (Workstation)"));
-          else if (os.IsNTStandAloneServer(&osvi))
-            _tcscat(sText, _T(" (Server)"));
-          else if (os.IsNTPDC(&osvi))
-            _tcscat(sText, _T(" (Primary Domain Controller)"));
-          else if (os.IsNTBDC(&osvi))
-            _tcscat(sText, _T(" (Backup Domain Controller)"));
-
-          if (os.IsNTDatacenterServer(&osvi))
-            _tcscat(sText, _T(", (Datacenter)"));
-          else if (os.IsNTEnterpriseServer(&osvi))
-            _tcscat(sText, _T(", (Enterprise)"));
-        }
-        else if (os.IsWindows2000(&osvi))
-        {
-          _tcscat(sText, _T("Windows 2000"));                  
-
-          if (os.IsWin2000Professional(&osvi))
-            _tcscat(sText, _T(" (Professional)"));
-          else if (os.IsWin2000Server(&osvi))
-            _tcscat(sText, _T(" (Server)"));
-          else if (os.IsWin2000DomainController(&osvi))
-            _tcscat(sText, _T(" (Domain Controller)"));
-
-          if (os.IsWin2000DatacenterServer(&osvi))
-            _tcscat(sText, _T(", (Datacenter)"));
-          else if (os.IsWin2000AdvancedServer(&osvi))
-            _tcscat(sText, _T(", (Advanced Server)"));
-        }
-        else if (os.IsWindowsXPOrWindowsServer2003(&osvi))
-        {
-          if (os.IsXPPersonal(&osvi))
-            _tcscat(sText, _T("Windows XP (Personal)"));                  
-          else if (os.IsXPProfessional(&osvi))
-            _tcscat(sText, _T("Windows XP (Professional)"));                  
-          else if (os.IsWindowsServer2003(&osvi))
-            _tcscat(sText, _T("Windows Server 2003"));          
-          else if (os.IsDomainControllerWindowsServer2003(&osvi))
-            _tcscat(sText, _T("Windows Server 2003 (Domain Controller)"));          
-
-          if (os.IsDatacenterWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Datacenter Edition)"));
-          else if (os.IsEnterpriseWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Enterprise Edition)"));
-          else if (os.IsWebWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Web Edition)"));
-          else if (os.IsWindowsServer2003(&osvi))
-            _tcscat(sText, _T(", (Standard Edition)"));
-        }
-
-        if (os.IsTerminalServicesInstalled(&osvi))
-          _tcscat(sText, _T(", (Terminal Services)"));
-        if (os.ISSmallBusinessEditionInstalled(&osvi))
-          _tcscat(sText, _T(", (BackOffice Small Business Edition)"));
-        if (os.IsEmbedded(&osvi))
-          _tcscat(sText, _T(", (Embedded)"));
-        if (os.IsTerminalServicesInRemoteAdminMode(&osvi))
-          _tcscat(sText, _T(", (Terminal Services in Remote Admin Mode)"));
-        if (os.IsEmulated64Bit(&osvi))
-          _tcscat(sText, _T(", (64 Bit Edition)"));
-        if (os.IsMediaCenterInstalled(&osvi))
-          _tcscat(sText, _T(", (Media Center Edition)"));
-
-        if (osvi.dwSuiteMask & COSVERSION_SUITE_UNIPROCESSOR_FREE)
-          _tcscat(sText, _T(", (Uniprocessor Free)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_UNIPROCESSOR_CHECKED)
-          _tcscat(sText, _T(", (Uniprocessor Checked)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_MULTIPROCESSOR_FREE)
-          _tcscat(sText, _T(", (Multiprocessor Free)"));
-        else if (osvi.dwSuiteMask & COSVERSION_SUITE_MULTIPROCESSOR_CHECKED)
-          _tcscat(sText, _T(", (Multiprocessor Checked)"));
-
-        break;
-      }
-      default:                         
-      {
-        _stprintf(sBuf, _T("Unknown OS"));
-        _tcscat(sText, sBuf);                
-        break;
-      }
-    }                                      
-
-#ifndef UNDER_CE
-    switch (osvi.UnderlyingProcessorType)
-    {
-      case COSVersion::INTEL_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (Intel Processor)"));
-        break;
-      }
-      case COSVersion::MSIL_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (MSIL Processor)"));
-        break;
-      }
-      case COSVersion::MIPS_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (MIPS Processor)"));
-        break;
-      }
-      case COSVersion::ARM_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (ARM Processor)"));
-        break;
-      }
-      case COSVersion::SHX_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (SHX Processor)"));
-        break;
-      }
-      case COSVersion::ALPHA_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (Alpha Processor)"));
-        break;
-      }
-      case COSVersion::PPC_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (PPC Processor)"));
-        break;
-      }
-      case COSVersion::IA64_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (IA64 Processor)"));
-        break;
-      }
-      case COSVersion::AMD64_PROCESSOR:
-      {
-        _tcscat(sText, _T(", (AMD64 Processor)"));
-        break;
-      }
-      case COSVersion::UNKNOWN_PROCESSOR: //deliberate fallthrough
-      default:
-      {
-        _tcscat(sText, _T(", (Unknown Processor)"));
-        break;
-      }
-    }
-#endif
-
-    _stprintf(sBuf, _T(" v%d."), osvi.dwUnderlyingMajorVersion);
-    _tcscat(sText, sBuf);     
-    if (osvi.dwUnderlyingMinorVersion % 10)
-    {
-      if (osvi.dwUnderlyingMinorVersion > 9)
-        _stprintf(sBuf, _T("%02d"), osvi.dwUnderlyingMinorVersion);
-      else
-        _stprintf(sBuf, _T("%01d"), osvi.dwUnderlyingMinorVersion);
-    }
-    else
-      _stprintf(sBuf, _T("%01d"), osvi.dwUnderlyingMinorVersion / 10);
-    _tcscat(sText, sBuf);          
-    if (osvi.dwUnderlyingBuildNumber)
-    {
-      _stprintf(sBuf, _T(" Build:%d"), osvi.dwUnderlyingBuildNumber);
-      _tcscat(sText, sBuf);
-    }
-    if (osvi.wUnderlyingServicePackMajor)       
-    {
-      if (osvi.wUnderlyingServicePackMinor)       
-      {
-        //Handle the special case of NT 4 SP 6a which Dtwinver ver treats as SP 6.1
-        if (os.IsNTPreWin2k(&osvi) && (osvi.wUnderlyingServicePackMajor == 6) && (osvi.wUnderlyingServicePackMinor == 1))
-          _stprintf(sBuf, _T(" Service Pack: 6a"));
-        //Handle the special case of XP SP 1a which Dtwinver ver treats as SP 1.1
-        else if (os.IsWindowsXP(&osvi) && (osvi.wUnderlyingServicePackMajor == 1) && (osvi.wUnderlyingServicePackMinor == 1))
-          _stprintf(sBuf, _T(" Service Pack: 1a"));
-        else
-          _stprintf(sBuf, _T(" Service Pack:%d.%d"), osvi.wUnderlyingServicePackMajor, osvi.wUnderlyingServicePackMinor);
-      }
-      else
-        _stprintf(sBuf, _T(" Service Pack:%d"), osvi.wUnderlyingServicePackMajor);
-      _tcscat(sText, sBuf);
-    }                            
-    else
-    {
-      if (osvi.wUnderlyingServicePackMinor)       
-        _stprintf(sBuf, _T(" Service Pack:0.%d"), osvi.wUnderlyingServicePackMinor);
-    }
-    _tcscat(sText, _T("\n"));    
-
-    //Some extra info for CE
-  #ifdef UNDER_CE
-    if (osvi.UnderlyingPlatform == COSVersion::WindowsCE)
-    {
-      _tcscat(sText, _T("Model: "));
-      _tcscat(sText, osvi.szOEMInfo);
-      _tcscat(sText, _T("\nDevice Type: "));
-      _tcscat(sText, osvi.szPlatformType);
-    }
-  #endif*/ 
-  }
-  else
-    _stprintf(sText, _T("Failed in call to GetOSVersion\n"));
-           
-  
-
-	char UserName[256+1]="";
-	DWORD Size=256+1;
-	if (GetUserName(UserName,&Size)!=0)
-	{
-		strcpy(mytext,"Current user : ");
-		strcat(mytext,UserName);
-	}
-	char ComputerName[256+1]="";
-	if (GetComputerName(ComputerName,&Size)!=0)
-	{
-		strcat(mytext,"\nComputerName : ");
-		strcat(mytext,ComputerName);
-	}
-	///////////////////////////////
-
-    char name[255];
-	char *IP=NULL;
-	PHOSTENT hostinfo;
-		if(gethostname(name, sizeof(name))==0)
-		{
-			if((hostinfo=gethostbyname(name)) != NULL)
-			{
-				IP = inet_ntoa(*(struct in_addr*)* hostinfo->h_addr_list);
-			}
-		}
-	if (IP)
-	{
-	strcat(mytext,"\nIP : ");
-	strcat(mytext,IP);
-	}
-
-	//////////////////////////////////////
-/*	MEMORYSTATUS memoryStatus;
-	ZeroMemory(&memoryStatus,sizeof(MEMORYSTATUS));
-	memoryStatus.dwLength = sizeof (MEMORYSTATUS);
-	
-	::GlobalMemoryStatus (&memoryStatus);
-	
-	sprintf("Installed RAM: %ldMB",(DWORD) ceil(memoryStatus.dwTotalPhys/1024/1024));	
-	sprintf("\r\nMemory Available: %ldKB",(DWORD) (memoryStatus.dwAvailPhys/1024));	
-	sprintf("\r\nPrecent of used RAM: %%%ld\n",memoryStatus.dwMemoryLoad);
-	sprintf("\n");
-	sprintf(sText);*/
-	strcat(mytext,"\n");
-	strcat(mytext,sText);      
-
-  return 0;
-}
diff --git a/ica/win32/winvnc/winvnc/helpers.cpp b/ica/win32/winvnc/winvnc/helpers.cpp
deleted file mode 100644
index a705ccc..0000000
--- a/ica/win32/winvnc/winvnc/helpers.cpp
+++ /dev/null
@@ -1,611 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <algorithm>
-#include "stdhdrs.h"
-#include "inifile.h"
-#include <string>
-#include <cctype>
-
-//  We first use shellexecute with "runas"
-//  This way we can use UAC and user/passwd
-//	Runas is standard OS, so no security risk
-
-const char winvncSettings[]				= "-settings";
-const char winvncStopservice[]			= "-stopservice";
-const char winvncStartservice[]			= "-startservice";
-const char winvncInstallService[]		= "-install";
-const char winvncUnInstallService[]		= "-uninstall";
-const char winvncSecurityEditor[]		= "-securityeditor";
-
-extern char service_name[];
-
-/////////////////////////////////////////////////////////////////////
-void
-Set_settings_as_admin(char *mycommand)
-{
-	char exe_file_name[MAX_PATH];
-	char commanline[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	strcpy(commanline, winvncSettings);
-	strcat(commanline, ":");
-	strcat_s(commanline, 260, mycommand);
-
-	SHELLEXECUTEINFO shExecInfo;
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = commanline;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-
-
-void Copy_to_Secure_from_temp_helper(char *lpCmdLine)
-{
-IniFile myIniFile_In;
-IniFile myIniFile_Out;
-myIniFile_Out.IniFileSetSecure();
-myIniFile_In.IniFileSetTemp(lpCmdLine);
-
-TCHAR *group1=new char[150];
-TCHAR *group2=new char[150];
-TCHAR *group3=new char[150];
-BOOL BUseRegistry;
-LONG MSLogonRequired;
-LONG NewMSLogon;
-LONG locdom1;
-LONG locdom2;
-LONG locdom3;
-LONG DebugMode=2;
-LONG Avilog=0;
-LONG DebugLevel=10;
-LONG DisableTrayIcon;
-LONG LoopbackOnly;
-LONG UseDSMPlugin;
-LONG AllowLoopback;
-LONG AuthRequired;
-LONG ConnectPriority;
-
-char DSMPlugin[128];
-char *authhosts=new char[150];
-
-LONG AllowShutdown=1;
-LONG AllowProperties=1;
-LONG AllowEditClients=1;
-
-LONG FileTransferEnabled=0;
-LONG FTUserImpersonation=1;
-LONG BlankMonitorEnabled=1;
-LONG BlankInputsOnly=0; //PGM
-LONG DefaultScale=1;
-LONG CaptureAlphaBlending=1;
-LONG BlackAlphaBlending=1;
-
-LONG SocketConnect=1;
-LONG HTTPConnect;
-LONG XDMCPConnect;
-LONG AutoPortSelect=1;
-LONG PortNumber;
-LONG HttpPortNumber;
-LONG IdleTimeout;
-
-LONG RemoveWallpaper=1;
-LONG RemoveAero=1;
-
-LONG QuerySetting=1;
-LONG QueryTimeout=10;
-LONG QueryAccept;
-LONG QueryIfNoLogon;
-
-LONG EnableRemoteInputs=1;
-LONG LockSettings=0;
-LONG DisableLocalInputs=0;
-LONG EnableJapInput=0;
-LONG kickrdp=0;
-LONG clearconsole=0;
-
-#define MAXPWLEN 8
-char passwd[MAXPWLEN];
-
-LONG TurboMode=1;
-LONG PollUnderCursor=0;
-LONG PollForeground=0;
-LONG PollFullScreen=1;
-LONG PollConsoleOnly=0;
-LONG PollOnEventOnly=0;
-LONG Driver=0;
-LONG Hook=1;
-LONG Virtual;
-LONG SingleWindow=0;
-char SingleWindowName[32];
-char path[512];
-LONG MaxCpu=40;
-
-//adzm 2010-05-30 - dsmplugin config
-char DSMPluginConfig[512];
-*DSMPluginConfig = '\0';
-
-LONG Primary=1;
-LONG Secondary=0;
-
-
-BUseRegistry = myIniFile_In.ReadInt("admin", "UseRegistry", 0);
-if (!myIniFile_Out.WriteInt("admin", "UseRegistry", BUseRegistry))
-{
-		//error
-		MessageBoxSecure(NULL,"Permission denied:Uncheck [_] Protect my computer... in run as dialog or use user with write permission." ,myIniFile_Out.myInifile,MB_ICONERROR);
-}
-
-MSLogonRequired=myIniFile_In.ReadInt("admin", "MSLogonRequired", false);
-myIniFile_Out.WriteInt("admin", "MSLogonRequired", MSLogonRequired);
-NewMSLogon=myIniFile_In.ReadInt("admin", "NewMSLogon", false);
-myIniFile_Out.WriteInt("admin", "NewMSLogon", NewMSLogon);
-
-
-myIniFile_In.ReadString("admin_auth","group1",group1,150);
-myIniFile_In.ReadString("admin_auth","group2",group2,150);
-myIniFile_In.ReadString("admin_auth","group3",group3,150);
-myIniFile_Out.WriteString("admin_auth", "group1",group1);
-myIniFile_Out.WriteString("admin_auth", "group2",group2);
-myIniFile_Out.WriteString("admin_auth", "group3",group3);
-
-
-
-locdom1=myIniFile_In.ReadInt("admin_auth", "locdom1",0);
-locdom2=myIniFile_In.ReadInt("admin_auth", "locdom2",0);
-locdom3=myIniFile_In.ReadInt("admin_auth", "locdom3",0);
-myIniFile_Out.WriteInt("admin_auth", "locdom1", locdom1);
-myIniFile_Out.WriteInt("admin_auth", "locdom2", locdom2);
-myIniFile_Out.WriteInt("admin_auth", "locdom3", locdom3);
-
-
-DebugMode=myIniFile_In.ReadInt("admin", "DebugMode", 0);
-Avilog=myIniFile_In.ReadInt("admin", "Avilog", 0);
-myIniFile_In.ReadString("admin", "path", path,512);
-DebugLevel=myIniFile_In.ReadInt("admin", "DebugLevel", 0);
-DisableTrayIcon=myIniFile_In.ReadInt("admin", "DisableTrayIcon", false);
-LoopbackOnly=myIniFile_In.ReadInt("admin", "LoopbackOnly", false);
-
-myIniFile_Out.WriteInt("admin", "DebugMode", DebugMode);
-myIniFile_Out.WriteInt("admin", "Avilog", Avilog);
-myIniFile_Out.WriteString("admin", "path", path);
-myIniFile_Out.WriteInt("admin", "DebugLevel", DebugLevel);
-myIniFile_Out.WriteInt("admin", "DisableTrayIcon", DisableTrayIcon);
-myIniFile_Out.WriteInt("admin", "LoopbackOnly", LoopbackOnly);
-
-UseDSMPlugin=myIniFile_In.ReadInt("admin", "UseDSMPlugin", false);
-AllowLoopback=myIniFile_In.ReadInt("admin", "AllowLoopback", false);
-AuthRequired=myIniFile_In.ReadInt("admin", "AuthRequired", true);
-ConnectPriority=myIniFile_In.ReadInt("admin", "ConnectPriority", 0);
-
-myIniFile_Out.WriteInt("admin", "UseDSMPlugin", UseDSMPlugin);
-myIniFile_Out.WriteInt("admin", "AllowLoopback", AllowLoopback);
-myIniFile_Out.WriteInt("admin", "AuthRequired", AuthRequired);
-myIniFile_Out.WriteInt("admin", "ConnectPriority", ConnectPriority);
-
-
-myIniFile_In.ReadString("admin", "DSMPlugin",DSMPlugin,128);
-myIniFile_In.ReadString("admin", "AuthHosts",authhosts,150);
-
-myIniFile_Out.WriteString("admin", "DSMPlugin",DSMPlugin);
-myIniFile_Out.WriteString("admin", "AuthHosts",authhosts);
-
-//adzm 2010-05-30 - dsmplugin config
-myIniFile_In.ReadString("admin", "DSMPluginConfig",DSMPluginConfig,512);
-myIniFile_Out.WriteString("admin", "DSMPluginConfig",DSMPluginConfig);
-
-AllowShutdown=myIniFile_In.ReadInt("admin", "AllowShutdown", true);
-AllowProperties=myIniFile_In.ReadInt("admin", "AllowProperties", true);
-AllowEditClients=myIniFile_In.ReadInt("admin", "AllowEditClients", true);
-myIniFile_Out.WriteInt("admin", "AllowShutdown" ,AllowShutdown);
-myIniFile_Out.WriteInt("admin", "AllowProperties" ,AllowProperties);
-myIniFile_Out.WriteInt("admin", "AllowEditClients" ,AllowEditClients);
-
-
-FileTransferEnabled=myIniFile_In.ReadInt("admin", "FileTransferEnabled", true);
-FTUserImpersonation=myIniFile_In.ReadInt("admin", "FTUserImpersonation", true);
-BlankMonitorEnabled = myIniFile_In.ReadInt("admin", "BlankMonitorEnabled", true);
-BlankInputsOnly = myIniFile_In.ReadInt("admin", "BlankInputsOnly", false); //PGM
-DefaultScale = myIniFile_In.ReadInt("admin", "DefaultScale", 1);
-CaptureAlphaBlending = myIniFile_In.ReadInt("admin", "CaptureAlphaBlending", false); // sf at 2005
-BlackAlphaBlending = myIniFile_In.ReadInt("admin", "BlackAlphaBlending", false); // sf at 2005
-
-Primary = myIniFile_In.ReadInt("admin", "primary", true);
-Secondary = myIniFile_In.ReadInt("admin", "secondary", false);
-
-myIniFile_Out.WriteInt("admin", "FileTransferEnabled", FileTransferEnabled);
-myIniFile_Out.WriteInt("admin", "FTUserImpersonation", FTUserImpersonation);
-myIniFile_Out.WriteInt("admin", "BlankMonitorEnabled", BlankMonitorEnabled);
-myIniFile_Out.WriteInt("admin", "BlankInputsOnly", BlankInputsOnly); //PGM
-myIniFile_Out.WriteInt("admin", "DefaultScale", DefaultScale);
-myIniFile_Out.WriteInt("admin", "CaptureAlphaBlending", CaptureAlphaBlending);
-myIniFile_Out.WriteInt("admin", "BlackAlphaBlending", BlackAlphaBlending);
-
-myIniFile_Out.WriteInt("admin", "primary", Primary);
-myIniFile_Out.WriteInt("admin", "secondary", Secondary);
-
-
-	// Connection prefs
-SocketConnect=myIniFile_In.ReadInt("admin", "SocketConnect", true);
-HTTPConnect=myIniFile_In.ReadInt("admin", "HTTPConnect", true);
-XDMCPConnect=myIniFile_In.ReadInt("admin", "XDMCPConnect", true);
-AutoPortSelect=myIniFile_In.ReadInt("admin", "AutoPortSelect", true);
-PortNumber=myIniFile_In.ReadInt("admin", "PortNumber", 0);
-HttpPortNumber=myIniFile_In.ReadInt("admin", "HTTPPortNumber",0);
-IdleTimeout=myIniFile_In.ReadInt("admin", "IdleTimeout", 0);
-myIniFile_Out.WriteInt("admin", "SocketConnect", SocketConnect);
-myIniFile_Out.WriteInt("admin", "HTTPConnect", HTTPConnect);
-myIniFile_Out.WriteInt("admin", "XDMCPConnect", XDMCPConnect);
-myIniFile_Out.WriteInt("admin", "AutoPortSelect", AutoPortSelect);
-myIniFile_Out.WriteInt("admin", "PortNumber", PortNumber);
-myIniFile_Out.WriteInt("admin", "HTTPPortNumber", HttpPortNumber);
-myIniFile_Out.WriteInt("admin", "IdleTimeout", IdleTimeout);
-	
-RemoveWallpaper=myIniFile_In.ReadInt("admin", "RemoveWallpaper", 0);
-RemoveAero=myIniFile_In.ReadInt("admin", "RemoveAero", 0);
-myIniFile_Out.WriteInt("admin", "RemoveWallpaper", RemoveWallpaper);
-myIniFile_Out.WriteInt("admin", "RemoveAero", RemoveAero);
-
-	// Connection querying settings
-QuerySetting=myIniFile_In.ReadInt("admin", "QuerySetting", 0);
-QueryTimeout=myIniFile_In.ReadInt("admin", "QueryTimeout", 0);
-QueryAccept=myIniFile_In.ReadInt("admin", "QueryAccept", 0);
-QueryIfNoLogon=myIniFile_In.ReadInt("admin", "QueryIfNoLogon", 0);
-myIniFile_Out.WriteInt("admin", "QuerySetting", QuerySetting);
-myIniFile_Out.WriteInt("admin", "QueryTimeout", QueryTimeout);
-myIniFile_Out.WriteInt("admin", "QueryAccept", QueryAccept);
-myIniFile_Out.WriteInt("admin", "QueryIfNoLogon", QueryIfNoLogon);
-
-myIniFile_In.ReadPassword(passwd,MAXPWLEN);
-myIniFile_Out.WritePassword(passwd);
-memset(passwd, '\0', MAXPWLEN); //PGM 
-myIniFile_In.ReadPassword2(passwd,MAXPWLEN); //PGM
-myIniFile_Out.WritePassword2(passwd); //PGM
-
-EnableRemoteInputs=myIniFile_In.ReadInt("admin", "InputsEnabled", 0);
-LockSettings=myIniFile_In.ReadInt("admin", "LockSetting", 0);
-DisableLocalInputs=myIniFile_In.ReadInt("admin", "LocalInputsDisabled", 0);
-EnableJapInput=myIniFile_In.ReadInt("admin", "EnableJapInput", 0);
-kickrdp=myIniFile_In.ReadInt("admin", "kickrdp", 0);
-clearconsole=myIniFile_In.ReadInt("admin", "clearconsole", 0);
-
-myIniFile_Out.WriteInt("admin", "InputsEnabled", EnableRemoteInputs);
-myIniFile_Out.WriteInt("admin", "LockSetting", LockSettings);
-myIniFile_Out.WriteInt("admin", "LocalInputsDisabled", DisableLocalInputs);	
-myIniFile_Out.WriteInt("admin", "EnableJapInput", EnableJapInput);	
-myIniFile_Out.WriteInt("admin", "kickrdp", kickrdp);
-myIniFile_Out.WriteInt("admin", "clearconsole", clearconsole);
-
-
-
-TurboMode = myIniFile_In.ReadInt("poll", "TurboMode", 0);
-PollUnderCursor=myIniFile_In.ReadInt("poll", "PollUnderCursor", 0);
-PollForeground=myIniFile_In.ReadInt("poll", "PollForeground", 0);
-PollFullScreen=myIniFile_In.ReadInt("poll", "PollFullScreen", 0);
-PollConsoleOnly=myIniFile_In.ReadInt("poll", "OnlyPollConsole", 0);
-PollOnEventOnly=myIniFile_In.ReadInt("poll", "OnlyPollOnEvent", 0);
-MaxCpu=myIniFile_In.ReadInt("poll", "MaxCpu", 0);
-Driver=myIniFile_In.ReadInt("poll", "EnableDriver", 0);
-Hook=myIniFile_In.ReadInt("poll", "EnableHook", 0);
-Virtual=myIniFile_In.ReadInt("poll", "EnableVirtual", 0);
-
-SingleWindow=myIniFile_In.ReadInt("poll","SingleWindow",SingleWindow);
-myIniFile_In.ReadString("poll", "SingleWindowName", SingleWindowName,32);
-
-myIniFile_Out.WriteInt("poll", "TurboMode", TurboMode);
-myIniFile_Out.WriteInt("poll", "PollUnderCursor", PollUnderCursor);
-myIniFile_Out.WriteInt("poll", "PollForeground", PollForeground);
-myIniFile_Out.WriteInt("poll", "PollFullScreen", PollFullScreen);
-myIniFile_Out.WriteInt("poll", "OnlyPollConsole",PollConsoleOnly);
-myIniFile_Out.WriteInt("poll", "OnlyPollOnEvent", PollOnEventOnly);
-myIniFile_Out.WriteInt("poll", "MaxCpu", MaxCpu);
-myIniFile_Out.WriteInt("poll", "EnableDriver", Driver);
-myIniFile_Out.WriteInt("poll", "EnableHook", Hook);
-myIniFile_Out.WriteInt("poll", "EnableVirtual", Virtual);
-
-myIniFile_Out.WriteInt("poll", "SingleWindow", SingleWindow);
-myIniFile_Out.WriteString("poll", "SingleWindowName", SingleWindowName);
-
-MaxCpu=myIniFile_In.ReadInt("poll", "MaxCpu",MaxCpu);
-myIniFile_Out.WriteInt("poll", "MaxCpu", MaxCpu);
-
-DeleteFile(lpCmdLine);
-}
-void
-Real_settings(char *mycommand)
-{
-Copy_to_Secure_from_temp_helper(mycommand);
-}
-
-void
-Set_stop_service_as_admin()
-{
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	SHELLEXECUTEINFO shExecInfo;
-
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = winvncStopservice;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-
-}
-
-void
-Real_stop_service()
-{
-    char command[MAX_PATH + 32]; // 29 January 2008 jdp 
-    _snprintf(command, sizeof command, "net stop \"%s\"", service_name);
-	WinExec(command,SW_HIDE);
-}
-
-void
-Set_start_service_as_admin()
-{
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	SHELLEXECUTEINFO shExecInfo;
-
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = winvncStartservice;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-
-}
-
-void Open_homepage()
-{
-	ShellExecute(0, "open", "http://www.uvnc.com", 0, 0, 1);
-}
-
-void Open_forum()
-{
-	ShellExecute(0, "open", "http://forum.uvnc.com", 0, 0, 1);
-}
-
-void
-Real_start_service()
-{
-    char command[MAX_PATH + 32]; // 29 January 2008 jdp 
-    _snprintf(command, sizeof command, "net start \"%s\"", service_name);
-	WinExec(command,SW_HIDE);
-}
-
-void
-Set_install_service_as_admin()
-{
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	SHELLEXECUTEINFO shExecInfo;
-
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = winvncInstallService;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-
-}
-
-void
-Set_uninstall_service_as_admin()
-{
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	SHELLEXECUTEINFO shExecInfo;
-
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = winvncUnInstallService;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-
-}
-
-void
-winvncSecurityEditorHelper_as_admin()
-{
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-	SHELLEXECUTEINFO shExecInfo;
-
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = winvncSecurityEditor;
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-void make_upper(std::string& str)
-{
-    // convert to uppercase
-    std::transform(str.begin(), str.end(), str.begin(), toupper);//(int(*)(int))
-}
-//**************************************************************************
-// GetServiceName() looks up service by application path. If found, the function
-// fills pszServiceName (must be at least 256+1 characters long).
-bool GetServiceName(TCHAR *pszAppPath, TCHAR *pszServiceName)
-{
-    // prepare given application path for matching against service list
-    std::string appPath(pszAppPath);
-    // convert to uppercase
-    make_upper(appPath);
-
-	// connect to serice control manager
-    SC_HANDLE hManager = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE);
-    if (!hManager)
-        return false;
-
-    DWORD dwBufferSize = 0;
-    DWORD dwCount = 0;
-    DWORD dwPosition = 0;
-    bool bResult = false;
-
-    // call EnumServicesStatus() the first time to receive services array size
-    BOOL bOK = EnumServicesStatus(
-        hManager,
-        SERVICE_WIN32,
-        SERVICE_STATE_ALL,
-        NULL,
-        0,
-        &dwBufferSize,
-        &dwCount,
-        &dwPosition);
-    if (!bOK && GetLastError() == ERROR_MORE_DATA)
-    {
-        // allocate space per results from the first call
-        ENUM_SERVICE_STATUS *pServices = (ENUM_SERVICE_STATUS *) new UCHAR[dwBufferSize];
-        if (pServices)
-        {
-            // call EnumServicesStatus() the second time to actually get the services array
-            bOK = EnumServicesStatus(
-                hManager,
-                SERVICE_WIN32,
-                SERVICE_STATE_ALL,
-                pServices,
-                dwBufferSize,
-                &dwBufferSize,
-                &dwCount,
-                &dwPosition);
-            if (bOK)
-            {
-                // iterate through all services returned by EnumServicesStatus()
-                for (DWORD i = 0; i < dwCount && !bResult; i++)
-                {
-                    // open service
-                    SC_HANDLE hService = OpenService(hManager,
-                        pServices[i].lpServiceName,
-                        GENERIC_READ);
-                    if (!hService)
-                        break;
-
-                    // call QueryServiceConfig() the first time to receive buffer size
-                    bOK = QueryServiceConfig(
-                        hService,
-                        NULL,
-                        0,
-                        &dwBufferSize);
-                    if (!bOK && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-                    {
-                        // allocate space per results from the first call
-                        QUERY_SERVICE_CONFIG *pServiceConfig = (QUERY_SERVICE_CONFIG *) new UCHAR[dwBufferSize];
-                        if (pServiceConfig)
-                        {
-                            // call EnumServicesStatus() the second time to actually get service config
-                            bOK = QueryServiceConfig(
-                                hService,
-                                pServiceConfig,
-                                dwBufferSize,
-                                &dwBufferSize);
-                            if (bOK)
-                            {
-                                // match given application name against executable path in the service config
-                                std::string servicePath(pServiceConfig->lpBinaryPathName);
-                                make_upper(servicePath);
-                                if (servicePath.find(appPath.c_str()) != (size_t) -1)
-                                {
-									bResult = true;
-                                    strncpy(pszServiceName, pServices[i].lpServiceName, 256);
-                                    pszServiceName[255] = 0;
-                                }
-                            }
-
-                            delete [] (UCHAR *) pServiceConfig;
-                        }
-                    }
-
-                    CloseServiceHandle(hService);
-                }
-            }
-
-            delete [] (UCHAR *) pServices;
-        }
-    }
-
-    // disconnect from serice control manager
-    CloseServiceHandle(hManager);
-
-    return bResult;
-}
-extern BOOL	m_fRunningFromExternalService;
-DWORD MessageBoxSecure(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType)
-{
-	DWORD retunvalue;
-	if (m_fRunningFromExternalService)
-	{
-		HDESK desktop=NULL;
-		HDESK old_desktop;
-		desktop = OpenInputDesktop(0, FALSE,DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
-		old_desktop = GetThreadDesktop(GetCurrentThreadId());
-		if (desktop && 	old_desktop && old_desktop!=desktop)
-			{					
-					SetThreadDesktop(desktop);
-					retunvalue=MessageBox(hWnd,lpText,lpCaption,uType);
-					SetThreadDesktop(old_desktop);
-					CloseDesktop(desktop);
-			}
-		else retunvalue=0;
-	}
-	else
-	{
-		retunvalue=MessageBox(hWnd,lpText,lpCaption,uType);
-	}
-	return retunvalue;
-}
diff --git a/ica/win32/winvnc/winvnc/httpconnect.cpp b/ica/win32/winvnc/winvnc/httpconnect.cpp
deleted file mode 100644
index de84ad8..0000000
--- a/ica/win32/winvnc/winvnc/httpconnect.cpp
+++ /dev/null
@@ -1,1479 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "httpconnect.h"
-
-PARAMETER_ITEM parameter_table[] = {
-    { ENV_SOCKS_SERVER, NULL },
-    { ENV_SOCKS5_SERVER, NULL },
-    { ENV_SOCKS4_SERVER, NULL },
-    { ENV_SOCKS_RESOLVE, NULL },
-    { ENV_SOCKS5_RESOLVE, NULL },
-    { ENV_SOCKS4_RESOLVE, NULL },
-    { ENV_SOCKS5_USER, NULL },
-    { ENV_SOCKS5_PASSWD, NULL },
-    { ENV_SOCKS5_PASSWORD, NULL },
-    { ENV_HTTP_PROXY, NULL },
-    { ENV_HTTP_PROXY_USER, NULL },
-    { ENV_HTTP_PROXY_PASSWORD, NULL },
-    { ENV_CONNECT_USER, NULL },
-    { ENV_CONNECT_PASSWORD, NULL },
-    { ENV_SSH_ASKPASS, NULL },
-    { ENV_SOCKS5_DIRECT, NULL },
-    { ENV_SOCKS4_DIRECT, NULL },
-    { ENV_SOCKS_DIRECT, NULL },
-    { ENV_HTTP_DIRECT, NULL },
-    { ENV_CONNECT_DIRECT, NULL },
-    { ENV_SOCKS5_AUTH, NULL },
-    { NULL, NULL }
-};
-
-LOOKUP_ITEM socks4_rep_names[] = {
-    { SOCKS4_REP_SUCCEEDED,  "request granted (succeeded)"},
-    { SOCKS4_REP_REJECTED,   "request rejected or failed"},
-    { SOCKS4_REP_IDENT_FAIL, "cannot connect identd"},
-    { SOCKS4_REP_USERID,     "user id not matched"},
-    { -1, NULL }
-};
-
-LOOKUP_ITEM socks5_rep_names[] = {
-    { SOCKS5_REP_SUCCEEDED, "succeeded"},
-    { SOCKS5_REP_FAIL,      "general SOCKS server failure"},
-    { SOCKS5_REP_NALLOWED,  "connection not allowed by ruleset"},
-    { SOCKS5_REP_NUNREACH,  "Network unreachable"},
-    { SOCKS5_REP_HUNREACH,  "Host unreachable"},
-    { SOCKS5_REP_REFUSED,   "connection refused"},
-    { SOCKS5_REP_EXPIRED,   "TTL expired"},
-    { SOCKS5_REP_CNOTSUP,   "Command not supported"},
-    { SOCKS5_REP_ANOTSUP,   "Address not supported"},
-    { SOCKS5_REP_INVADDR,   "Invalid address"},
-    { -1, NULL }
-};
-
-AUTH_METHOD_ITEM socks5_auth_table[] = {
-    { "none", SOCKS5_AUTH_NOAUTH },
-    { "gssapi", SOCKS5_AUTH_GSSAPI },
-    { "userpass", SOCKS5_AUTH_USERPASS },
-    { "chap", SOCKS5_AUTH_CHAP },
-    { NULL, (unsigned char) -1 },
-};
-
-const char *digits    = "0123456789";
-const char *dotdigits = "0123456789.";
-char *method_names[] = { "UNDECIDED", "DIRECT", "SOCKS", "HTTP", "TELNET" };
-
-httpconnect::~httpconnect()
-{
-}
-httpconnect::httpconnect()
-{
-	relay_method = METHOD_UNDECIDED;          
-	relay_host = NULL;                        
-	relay_port = 0;                        
-	relay_user = NULL;  
-	dest_port = 0;
-	f_debug = 0;
-	proxy_auth_type = PROXY_AUTH_NONE;
-	local_port = 0; 
-	local_type = LOCAL_STDIO;
-	socks_version = 5; 
-	socks_resolve = RESOLVE_UNKNOWN;
-	f_report = 1;
-	socks5_auth = NULL;
-	n_direct_addr_list = 0;
-}
-
-const char *base64_table =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/* packet operation macro */
-
-//int askpassbox(char *input, char *inuser, char *output, char *outuser);
-
-void *
-httpconnect::xmalloc (size_t size)
-{
-    void *ret = malloc(size);
-    return ret;
-}
-
-void
-httpconnect::downcase( char *buf )
-{
-    while ( *buf ) {
-        if ( isupper(*buf) )
-            *buf += 'a'-'A';
-        buf++;
-    }
-}
-
-char *
-httpconnect::expand_host_and_port (const char *fmt, const char *host, int port)
-{
-    const char *src;
-    char *buf, *dst;//, *ptr;
-    size_t len = strlen(fmt) + strlen(host) + 20;
-    buf = (char *)xmalloc (len);
-    dst = buf;
-    src = fmt;
-    
-    while (*src) {
-	if (*src == '%') {
-	    switch (src[1]) {
-	    case 'h':
-		strcpy (dst, host);
-		src += 2;
-		break;
-	    case 'p':
-		sprintf (dst, "%d", port);
-		src += 2;
-		break;
-	    default:
-		src ++;
-		break;
-	    }
-	    dst = buf + strlen (buf);
-	} else if (*src == '\\') {
-	    switch (src[1]) {
-	    case 'r':				/* CR */
-		*dst++ = '\r';
-		src += 2;
-		break;
-	    case 'n':				/* LF */
-		*dst++ = '\n';
-		src += 2;
-		break;
-	    case 't':				/* TAB */
-		*dst++ = '\t';
-		src += 2;
-		break;
-	    default:
-		src ++;
-		break;
-	    }
-	} else {
-	    /* usual */
-	    *dst++ = *src++;
-	}
-	*dst = '\0';
-    }
-    assert (strlen(buf) < len);
-    return buf;
-}
-
-
-int
-httpconnect::lookup_resolve( const char *str )
-{
-    char *buf = _strdup( str );
-    int ret;
-
-    downcase( buf );
-    if ( strcmp( buf, "both" ) == 0 )
-        ret = RESOLVE_BOTH;
-    else if ( strcmp( buf, "remote" ) == 0 )
-        ret = RESOLVE_REMOTE;
-    else if ( strcmp( buf, "local" ) == 0 )
-        ret = RESOLVE_LOCAL;
-    else if ( strspn(buf, dotdigits) == strlen(buf) ) {
-        ret = RESOLVE_LOCAL;                    /* this case is also 'local' */
-        socks_ns.sin_addr.s_addr = inet_addr(buf);
-        socks_ns.sin_family = AF_INET;
-    }
-    else
-        ret = RESOLVE_UNKNOWN;
-    free(buf);
-    return ret;
-}
-
-char *
-httpconnect::getusername(void)
-{
-    static char buf[1024];
-    DWORD size = sizeof(buf);
-    buf[0] = '\0';
-    GetUserName( buf, &size);
-    return buf;
-}
-
-/* expect
-   check STR is begin with substr with case-ignored comparison.
-   Return 1 if matched, otherwise 0.
-*/
-int
-httpconnect::expect( char *str, char *substr)
-{
-    int len = strlen(substr);
-    while ( 0 < len-- ) {
-        if ( toupper(*str) != toupper(*substr) )
-            return 0;                           /* not matched */
-        str++, substr++;
-    }
-    return 1;                   /* good, matched */
-}
-
-PARAMETER_ITEM*
-httpconnect::find_parameter_item(const char* name)
-{
-    int i;
-    for( i = 0; parameter_table[i].name != NULL; i++ ){
-        if ( strncmp(name, parameter_table[i].name, strlen(parameter_table[i].name)) == 0 )
-            return &parameter_table[i];
-    }
-    return NULL;
-}
-
-char*
-httpconnect::getparam(const char* name)
-{
-    char *value = getenv(name);
-    if ( value == NULL ){
-        PARAMETER_ITEM *item = find_parameter_item(name);
-        if ( item != NULL )
-            value = item->value;
-    }
-    return value;
-}
-
-
-/** DIRECT connection **/
-
-void
-httpconnect::mask_addr (void *addr, void *mask, int addrlen)
-{
-    char *a, *m;
-    a =(char*) addr;
-    m = (char *)mask;
-    while ( 0 < addrlen-- )
-        *a++ &= *m++;
-}
-
-int
-httpconnect::add_direct_addr (struct in_addr *addr, struct in_addr *mask, int negative)
-{
-    struct in_addr iaddr;
-    char *s;
-    if ( MAX_DIRECT_ADDR_LIST <= n_direct_addr_list ) {
-        return -1;
-    }
-    iaddr = *addr;
-    mask_addr(&iaddr, mask, sizeof(iaddr));
-    s = _strdup(inet_ntoa(iaddr));
-    free(s);
-    memcpy( &direct_addr_list[n_direct_addr_list].addr,
-            &iaddr, sizeof(iaddr));
-    memcpy( &direct_addr_list[n_direct_addr_list].mask,
-            mask, sizeof(*mask));
-    direct_addr_list[n_direct_addr_list].negative = negative;
-    n_direct_addr_list++;
-    return 0;
-}
-
-int
-httpconnect::parse_addr_pair (const char *str, struct in_addr *addr, struct in_addr *mask)
-{
-    const char *ptr;
-    u_char *dsta, *dstm;
-    int i, n;
-
-    assert( str != NULL );
-    addr->s_addr = 0;
-    mask->s_addr = 0;
-    ptr = str;
-    dsta = (u_char*)&addr->s_addr;
-    dstm = (u_char*)&mask->s_addr;
-    for (i=0; i<4; i++ ) {
-        if ( *ptr == '\0' )
-            break;              /* case of format #3 */
-        if ( !isdigit(*ptr) )
-            return -1;          /* format error: */
-        *dsta++ = atoi( ptr );
-        *dstm++ = 255;          /* automatic mask for format #3 */
-        while ( isdigit(*ptr) ) /* skip digits */
-            ptr++;
-        if ( *ptr == '.' )
-            ptr++;
-        else
-            break;
-    }
-    /* At this point, *ptr points '/' or EOS ('\0') */
-    if ( *ptr == '\0' )
-        return 0;                       /* complete as format #3 */
-    if ( *ptr != '/' )
-        return -1;                      /* format error */
-    /* Now parse mask for format #1 or #2 */
-    ptr++;
-    mask->s_addr = 0;                   /* clear automatic mask */
-
-    if ( strchr( ptr, '.') ) {
-        /* case of format #1 */
-        dstm = (u_char*)&mask->s_addr;
-        for (i=0; i<4; i++) {
-            if ( !isdigit(*ptr) )
-                return -1;              /* format error: */
-            *dstm++ = atoi(ptr);
-            while ( isdigit(*ptr) )     /* skip digits */
-                ptr++;
-            if ( *ptr == '.' )
-                ptr++;
-            else
-                break;                  /* from for loop */
-        }
-        /* complete as format #1 */
-    } else {
-        /* case of format #2 */
-        if ( !isdigit(*ptr) )
-            return -1;                  /* format error: */
-        n = atoi(ptr);
-        if ( n<0 || 32<n)
-            return -1;                  /* format error */
-        mask->s_addr = (n==0)? 0: htonl(((u_long)0xFFFFFFFF)<<(32-n));
-        /* complete as format #1 */
-    }
-    return 0;
-}
-
-void
-httpconnect::initialize_direct_addr (void)
-{
-    int negative;
-    int n_entries;
-    char *env = NULL, *beg, *next, *envkey = NULL;
-    struct in_addr addr, mask;
-
-    if ( relay_method == METHOD_SOCKS ){
-        if ( socks_version == 5 )
-            envkey = ENV_SOCKS5_DIRECT;
-        else
-            envkey = ENV_SOCKS4_DIRECT;
-        env = getparam(envkey);
-        if ( env == NULL )
-            env = getparam(ENV_SOCKS_DIRECT);
-    } else if ( relay_method == METHOD_HTTP ){
-        env = getparam(ENV_HTTP_DIRECT);
-    }
-
-    if ( env == NULL )
-        env = getparam(ENV_CONNECT_DIRECT);
-
-    if ( env == NULL )
-        return;                 /* no entry */
-    env = _strdup( env );        /* reallocate to modify */
-    beg = next = env;
-    n_entries = 0;
-    do {
-        if ( MAX_DIRECT_ADDR_LIST <= n_entries ) {
-            break;              /* from do loop */
-        }
-        next = strchr( beg, ',');
-        if ( next != NULL )
-            *next++ = '\0';
-        addr.s_addr = 0;
-        mask.s_addr = 0;
-        if (*beg == '!') {
-            negative = 1;
-            beg++;
-        } else
-            negative = 0;
-        if ( !parse_addr_pair( beg, &addr, &mask ) ) {
-            add_direct_addr( &addr, &mask, negative );
-        } else {
-            return;
-        }
-        if ( next != NULL )
-            beg = next;
-    } while ( next != NULL );
-
-    free( env );
-    return;
-}
-
-int
-httpconnect::cmp_addr (void *addr1, void *addr2, int addrlen)
-{
-    return memcmp( addr1, addr2, addrlen );
-}
-
-int
-httpconnect::is_direct_address (const struct sockaddr_in *addr)
-{
-    int i;
-    struct in_addr saddr, iaddr;
-
-    saddr = addr->sin_addr;
-
-    /* Note: assume IPV4 address !! */
-    for (i=0; i<n_direct_addr_list; i++ ) {
-        iaddr = saddr;
-        mask_addr( &iaddr, &direct_addr_list[i].mask,
-                   sizeof(struct in_addr));
-        if (cmp_addr(&iaddr, &direct_addr_list[i].addr,
-                     sizeof(struct in_addr)) == 0) {
-            if (direct_addr_list[i].negative) {
-                return 0;       /* not direct */
-            }
-            if (!direct_addr_list[i].negative) {               
-                return 1;       /* direct*/
-            }
-        }
-    }
-    return 0;                   /* not direct */
-}
-
-char *
-httpconnect::determine_relay_user ()
-{
-    char *user = NULL;
-    /* get username from environment variable, or system. */
-    if (relay_method == METHOD_SOCKS) {
-        if (user == NULL && socks_version == 5)
-            user = getparam (ENV_SOCKS5_USER);
-        if (user == NULL && socks_version == 4)
-            user = getparam (ENV_SOCKS4_USER);
-        if (user == NULL)
-            user = getparam (ENV_SOCKS_USER);
-    } else if (relay_method == METHOD_HTTP) {
-        if (user == NULL)
-            user = getparam (ENV_HTTP_PROXY_USER);
-    }
-    if (user == NULL)
-        user = getparam (ENV_CONNECT_USER);
-    /* determine relay user by system call if not yet. */
-    if (user == NULL)
-        user = getusername();
-    return user;
-}
-
-char *
-httpconnect::determine_relay_password ()
-{
-    char *pass = NULL;
-    if (pass == NULL && relay_method == METHOD_HTTP)
-        pass = getparam(ENV_HTTP_PROXY_PASSWORD);
-    if (pass == NULL && relay_method == METHOD_SOCKS)
-        pass = getparam(ENV_SOCKS5_PASSWD);
-    if (pass == NULL && relay_method == METHOD_SOCKS)
-        pass = getparam(ENV_SOCKS5_PASSWORD);
-    if (pass == NULL)
-        pass = getparam(ENV_CONNECT_PASSWORD);
-    return pass;
-}
-
-
-int
-httpconnect::set_relay( int method, char *spec )
-{
-    char *buf, *sep, *resolve;
-
-    relay_method = method;
-    initialize_direct_addr();
-    if (n_direct_addr_list == 0) {
-       
-    } else {
-        int i;
-        for ( i=0; i<n_direct_addr_list; i++ ) {
-            char *s1, *s2;
-            s1 = _strdup(inet_ntoa(direct_addr_list[i].addr));
-            s2 = _strdup(inet_ntoa(direct_addr_list[i].mask));
-            free(s1);
-            free(s2);
-        }
-    }
-
-    switch ( method ) {
-    case METHOD_DIRECT:
-        return -1;                              /* nothing to do */
-
-    case METHOD_SOCKS:
-        if ( spec == NULL ) {
-            switch ( socks_version ) {
-            case 5:
-                spec = getparam(ENV_SOCKS5_SERVER);
-                break;
-            case 4:
-                spec = getparam(ENV_SOCKS4_SERVER);
-                break;
-            }
-        }
-        if ( spec == NULL )
-            spec = getparam(ENV_SOCKS_SERVER);
-
-        if ( spec == NULL )
-            return 0;
-        relay_port = 1080;                      /* set default first */
-
-        /* determine resolve method */
-        if ( socks_resolve == RESOLVE_UNKNOWN ) {
-            if ( ((socks_version == 5) &&
-                  ((resolve = getparam(ENV_SOCKS5_RESOLVE)) != NULL)) ||
-                 ((socks_version == 4) &&
-                  ((resolve = getparam(ENV_SOCKS4_RESOLVE)) != NULL)) ||
-                 ((resolve = getparam(ENV_SOCKS_RESOLVE)) != NULL) ) {
-                socks_resolve = lookup_resolve( resolve );
-                if ( socks_resolve == RESOLVE_UNKNOWN )
-                     return 0;
-            } else {
-                /* default */
-                if ( socks_version == 5 )
-                    socks_resolve = RESOLVE_REMOTE;
-                else
-                    socks_resolve = RESOLVE_LOCAL;
-            }
-        }
-        break;
-
-    case METHOD_HTTP:
-        if ( spec == NULL )
-            spec = getparam(ENV_HTTP_PROXY);
-        if ( spec == NULL )
-             return 0;
-        relay_port = 80;                        /* set default first */
-        break;
-    }
-
-    if (expect( spec, HTTP_PROXY_PREFIX)) {
-        /* URL format like: "http://server:port/" */
-        /* extract server:port part */
-        buf = _strdup( spec + strlen(HTTP_PROXY_PREFIX));
-        buf[strcspn(buf, "/")] = '\0';
-    } else {
-        /* assume spec is aready "server:port" format */
-        buf = _strdup( spec );
-    }
-    spec = buf;
-
-    /* check username in spec */
-    sep = strchr( spec, '@' );
-    if ( sep != NULL ) {
-        *sep = '\0';
-        relay_user = _strdup( spec );
-        spec = sep +1;
-    }
-    if (relay_user == NULL)
-        relay_user = determine_relay_user();
-
-    /* split out hostname and port number from spec */
-    sep = strchr(spec,':');
-    if ( sep == NULL ) {
-        /* hostname only, port is already set as default */
-        relay_host = _strdup( spec );
-    } else {
-        /* hostname and port */
-        relay_port = atoi(sep+1);
-        *sep = '\0';
-        relay_host = _strdup( spec );
-    }
-    free(buf);
-    return 0;
-}
-
-
-u_short
-httpconnect::resolve_port( const char *service )
-{
-    int port;
-    if ( service[strspn (service, digits)] == '\0'  ) {
-        /* all digits, port number */
-        port = atoi(service);
-    } else {
-        /* treat as service name */
-        struct servent *ent;
-        ent = getservbyname( service, NULL );
-        if ( ent == NULL ) {
-            port = 0;
-        } else {
-            port = ntohs(ent->s_port);
-        }
-    }
-    return (u_short)port;
-}
-
-int
-httpconnect::local_resolve (const char *host, struct sockaddr_in *addr)
-{
-    struct hostent *ent;
-    if ( strspn(host, dotdigits) == strlen(host) ) {
-        /* given by IPv4 address */
-        addr->sin_family = AF_INET;
-        addr->sin_addr.s_addr = inet_addr(host);
-    } else {
-        ent = gethostbyname (host);
-        if ( ent ) {
-            memcpy (&addr->sin_addr, ent->h_addr, ent->h_length);
-            addr->sin_family = ent->h_addrtype;
-        } else {
-            return -1;                          /* failed */
-        }
-    }
-    return 0;                                   /* good */
-}
-
-SOCKET
-httpconnect::open_connection( const char *host, u_short port )
-{
-    SOCKET s;
-    struct sockaddr_in saddr;
-
-    if ( relay_method == METHOD_DIRECT ) {
-        host = dest_host;
-        port = dest_port;
-    } else if ((local_resolve (dest_host, &saddr) >= 0)&&
-               (is_direct_address(&saddr))) {
-        relay_method = METHOD_DIRECT;
-        host = dest_host;
-        port = dest_port;
-    } else {
-        host = relay_host;
-        port = relay_port;
-    }
-
-    if (local_resolve (host, &saddr) < 0) {
-        return SOCKET_ERROR;
-    }
-    saddr.sin_port = htons(port);
-    s = socket( AF_INET, SOCK_STREAM, 0 );
-    if ( connect( s, (struct sockaddr *)&saddr, sizeof(saddr))
-         == SOCKET_ERROR) {
-        return SOCKET_ERROR;
-    }
-    return s;
-}
-
-void
-httpconnect::report_text( char *prefix, char *buf )
-{
-    static char work[1024];
-    char *tmp;
-
-    if ( !f_debug )
-        return;
-    if ( !f_report )
-        return;                                 /* don't report */
-    while ( *buf ) {
-        memset( work, 0, sizeof(work));
-        tmp = work;
-        while ( *buf && ((tmp-work) < (int)sizeof(work)-5) ) {
-            switch ( *buf ) {
-            case '\t': *tmp++ = '\\'; *tmp++ = 't'; break;
-            case '\r': *tmp++ = '\\'; *tmp++ = 'r'; break;
-            case '\n': *tmp++ = '\\'; *tmp++ = 'n'; break;
-            case '\\': *tmp++ = '\\'; *tmp++ = '\\'; break;
-            default:
-                if ( isprint(*buf) ) {
-                    *tmp++ = *buf;
-                } else {
-                    sprintf( tmp, "\\x%02X", (unsigned char)*buf);
-                    tmp += strlen(tmp);
-                }
-            }
-            buf++;
-            *tmp = '\0';
-        }
-    }
-}
-
-int
-httpconnect::atomic_out( SOCKET s, char *buf, int size )
-{
-    int ret, len;
-
-    assert( buf != NULL );
-    assert( 0<=size );
-    /* do atomic out */
-    ret = 0;
-    while ( 0 < size ) {
-        len = send( s, buf+ret, size, 0 );
-        if ( len == -1 )
-           return -1;
-        ret += len;
-        size -= len;
-    }
-    return ret;
-}
-
-int
-httpconnect::atomic_in( SOCKET s, char *buf, int size )
-{
-    int ret, len;
-
-    assert( buf != NULL );
-    assert( 0<=size );
-
-    /* do atomic in */
-    ret = 0;
-    while ( 0 < size ) {
-        len = recv( s, buf+ret, size, 0 );
-        if ( len == -1 ) {
-            return -1;
-        } else if ( len == 0 ) {
-            return -1;
-        }
-        ret += len;
-        size -= len;
-    }
-    return ret;
-}
-
-int
-httpconnect::line_input( SOCKET s, char *buf, int size )
-{
-    char *dst = buf;
-    if ( size == 0 )
-        return 0;                               /* no error */
-    size--;
-    while ( 0 < size ) {
-        switch ( recv( s, dst, 1, 0) ) {        /* recv one-by-one */
-        case SOCKET_ERROR:
-            return -1;                          /* error */
-        case 0:
-            size = 0;                           /* end of stream */
-            break;
-        default:
-            /* continue reading until last 1 char is EOL? */
-            if ( *dst == '\n' ) {
-                /* finished */
-                size = 0;
-            } else {
-                /* more... */
-                size--;
-            }
-            dst++;
-        }
-    }
-    *dst = '\0';
-//    report_text( "<<<", buf);
-    return 0;
-}
-
-
-char *
-httpconnect::cut_token( char *str, char *delim)
-{
-    char *ptr = str + strcspn(str, delim);
-    char *end = ptr + strspn(ptr, delim);
-    if ( ptr == str )
-        return NULL;
-    while ( ptr < end )
-        *ptr++ = '\0';
-    return ptr;
-}
-
-const char *
-httpconnect::lookup(int num, LOOKUP_ITEM *items)
-{
-    int i = 0;
-    while (0 <= items[i].num) {
-        if (items[i].num == num)
-            return items[i].str;
-        i++;
-    }
-    return "(unknown)";
-}
-
-
-char *
-httpconnect::readpass( const char* prompt, ...)
-{
-    static char buf[1000];                      /* XXX, don't be fix length */
-    va_list args;
-    va_start(args, prompt);
-    vsprintf(buf, prompt, args);
-    va_end(args);
-	//askpassbox(buf,relay_user, buf,relay_user);
-    buf[strcspn(buf, "\r\n")] = '\0';
-    return buf;
-}
-
-int
-httpconnect::socks5_do_auth_userpass( SOCKET s )
-{
-    unsigned char buf[1024], *ptr;
-    char *pass = NULL;
-    int len;
-
-    /* do User/Password authentication. */
-    /* This feature requires username and password from
-       command line argument or environment variable,
-       or terminal. */
-    if (relay_user == NULL)
-        return -1;
-
-    /* get password from environment variable if exists. */
-    if ((pass=determine_relay_password()) == NULL &&
-        (pass=readpass("Enter SOCKS5 password for %s@%s: ",
-                       relay_user, relay_host)) == NULL)
-        return -1;
-
-    /* make authentication packet */
-    ptr = buf;
-    PUT_BYTE( ptr++, 1 );                       /* subnegotiation ver.: 1 */
-    len = strlen( relay_user );                 /* ULEN and UNAME */
-    PUT_BYTE( ptr++, len );
-    strcpy( (char*)ptr, relay_user );
-    ptr += len;
-    len = strlen( pass );                       /* PLEN and PASSWD */
-    PUT_BYTE( ptr++, strlen(pass));
-    strcpy( (char *)ptr, pass );
-    ptr += len;
-    memset (pass, 0, strlen(pass));             /* erase password */
-
-    /* send it and get answer */
-    f_report = 0;
-    atomic_out( s, (char*)buf, ptr-buf );
-    f_report = 1;
-    atomic_in( s, (char*)buf, 2 );
-
-    /* check status */
-    if ( buf[1] == 0 )
-        return 0;                               /* success */
-    else
-        return -1;                              /* fail */
-}
-
-const char *
-httpconnect::socks5_getauthname( int auth )
-{
-    switch ( auth ) {
-    case SOCKS5_AUTH_REJECT: return "REJECTED";
-    case SOCKS5_AUTH_NOAUTH: return "NO-AUTH";
-    case SOCKS5_AUTH_GSSAPI: return "GSSAPI";
-    case SOCKS5_AUTH_USERPASS: return "USERPASS";
-    case SOCKS5_AUTH_CHAP: return "CHAP";
-    case SOCKS5_AUTH_EAP: return "EAP";
-    case SOCKS5_AUTH_MAF: return "MAF";
-    default: return "(unknown)";
-    }
-}
-
-int
-httpconnect::socks5_auth_parse_1(char *start, char *end){
-    int i, len;
-    for ( ; *start; start++ )
-        if ( *start != ' ' && *start != '\t') break;
-    for ( end--; end >= start; end-- ) {
-        if ( *end != ' ' && *end != '\t'){
-            end++;
-            break;
-        }
-    }
-    len = end - start;
-    for ( i = 0; socks5_auth_table[i].name != NULL; i++ ){
-        if ( strncmp(start, socks5_auth_table[i].name, len) == 0) {
-            return socks5_auth_table[i].auth;
-        }
-    }
-    return -1;
-}
-
-int
-httpconnect::socks5_auth_parse(char *start, unsigned char *auth_list, int max_auth){
-    char *end;
-    int i = 0;
-    while ( i < max_auth ) {
-        end = strchr(start, ',');
-        if (*start && end) {
-            auth_list[i++] = socks5_auth_parse_1(start, end);
-            start = ++end;
-        } else {
-            break;
-        }
-    }
-    if ( *start && ( i < max_auth ) ){
-        for( end = start; *end; end++ );
-        auth_list[i++] = socks5_auth_parse_1(start, end);
-    } else {
-       return -1;
-    }
-    return i;
-}
-
-/* begin SOCKS5 relaying
-   And no authentication is supported.
- */
-int
-httpconnect::begin_socks5_relay( SOCKET s )
-{
-    unsigned char buf[256], *ptr, *env = (unsigned char*)socks5_auth;
-    unsigned char n_auth = 0; unsigned char auth_list[10], auth_method;
-    int len, auth_result, i;
-
-    /* request authentication */
-    ptr = buf;
-    PUT_BYTE( ptr++, 5);                        /* SOCKS version (5) */
-
-    if ( env == NULL )
-        env = (unsigned char*)getparam(ENV_SOCKS5_AUTH);
-    if ( env == NULL ) {
-        /* add no-auth authentication */
-        auth_list[n_auth++] = SOCKS5_AUTH_NOAUTH;
-        /* add user/pass authentication */
-        auth_list[n_auth++] = SOCKS5_AUTH_USERPASS;
-    } else {
-        n_auth = socks5_auth_parse((char*)env, auth_list, 10);
-    }
-    PUT_BYTE( ptr++, n_auth);                   /* num auth */
-    for (i=0; i<n_auth; i++) {
-        PUT_BYTE( ptr++, auth_list[i]);         /* authentications */
-    }
-    atomic_out( s, (char*)buf, ptr-buf );              /* send requst */
-    atomic_in( s, (char*)buf, 2 );                     /* recv response */
-    if ( (buf[0] != 5) ||                       /* ver5 response */
-         (buf[1] == 0xFF) ) {                   /* check auth method */
-        return -1;
-    }
-    auth_method = buf[1];
-
-
-    switch ( auth_method ) {
-    case SOCKS5_AUTH_REJECT:
-        return -1;                              /* fail */
-
-    case SOCKS5_AUTH_NOAUTH:
-        /* nothing to do */
-        auth_result = 0;
-        break;
-
-    case SOCKS5_AUTH_USERPASS:
-        auth_result = socks5_do_auth_userpass(s);
-        break;
-
-    default:
-        return -1;                              /* fail */
-    }
-    if ( auth_result != 0 ) {
-        return -1;
-    }
-    /* request to connect */
-    ptr = buf;
-    PUT_BYTE( ptr++, 5);                        /* SOCKS version (5) */
-    PUT_BYTE( ptr++, 1);                        /* CMD: CONNECT */
-    PUT_BYTE( ptr++, 0);                        /* FLG: 0 */
-    if ( dest_addr.sin_addr.s_addr == 0 ) {
-        /* resolved by SOCKS server */
-        PUT_BYTE( ptr++, 3);                    /* ATYP: DOMAINNAME */
-        len = strlen(dest_host);
-        PUT_BYTE( ptr++, len);                  /* DST.ADDR (len) */
-        memcpy( ptr, dest_host, len );          /* (hostname) */
-        ptr += len;
-    } else {
-        /* resolved localy */
-        PUT_BYTE( ptr++, 1 );                   /* ATYP: IPv4 */
-        memcpy( ptr, &dest_addr.sin_addr.s_addr, sizeof(dest_addr.sin_addr));
-        ptr += sizeof(dest_addr.sin_addr);
-    }
-    PUT_BYTE( ptr++, dest_port>>8);     /* DST.PORT */
-    PUT_BYTE( ptr++, dest_port&0xFF);
-    atomic_out( s, (char*)buf, ptr-buf);               /* send request */
-    atomic_in( s, (char*)buf, 4 );                     /* recv response */
-    if ( (buf[1] != SOCKS5_REP_SUCCEEDED) ) {   /* check reply code */
-        return -1;
-    }
-    ptr = buf + 4;
-    switch ( buf[3] ) {                         /* case by ATYP */
-    case 1:                                     /* IP v4 ADDR*/
-        atomic_in( s, (char*)ptr, 4+2 );               /* recv IPv4 addr and port */
-        break;
-    case 3:                                     /* DOMAINNAME */
-        atomic_in( s, (char*)ptr, 1 );                 /* recv name and port */
-        atomic_in( s, (char*)ptr+1, *(unsigned char*)ptr + 2);
-        break;
-    case 4:                                     /* IP v6 ADDR */
-        atomic_in( s, (char*)ptr, 16+2 );              /* recv IPv6 addr and port */
-        break;
-    }
-
-    /* Conguraturation, connected via SOCKS5 server! */
-    return 0;
-}
-
-int
-httpconnect::begin_socks4_relay( SOCKET s )
-{
-    unsigned char buf[256], *ptr;
-    ptr = buf;
-    PUT_BYTE( ptr++, 4);                        /* protocol version (4) */
-    PUT_BYTE( ptr++, 1);                        /* CONNECT command */
-    PUT_BYTE( ptr++, dest_port>>8);     /* destination Port */
-    PUT_BYTE( ptr++, dest_port&0xFF);
-    /* destination IP */
-    memcpy(ptr, &dest_addr.sin_addr, sizeof(dest_addr.sin_addr));
-    ptr += sizeof(dest_addr.sin_addr);
-    if ( dest_addr.sin_addr.s_addr == 0 )
-        *(ptr-1) = 1;                           /* fake, protocol 4a */
-    /* username */
-    if (relay_user == NULL)
-        return -1;
-    strcpy( (char*)ptr, relay_user );
-    ptr += strlen( relay_user ) +1;
-    /* destination host name (for protocol 4a) */
-    if ( (socks_version == 4) && (dest_addr.sin_addr.s_addr == 0)) {
-        strcpy( (char*)ptr, dest_host );
-        ptr += strlen( dest_host ) +1;
-    }
-    /* send command and get response
-       response is: VN:1, CD:1, PORT:2, ADDR:4 */
-    atomic_out( s, (char*)buf, ptr-buf);               /* send request */
-    atomic_in( s, (char*)buf, 8 );                     /* recv response */
-    if ( (buf[1] != SOCKS4_REP_SUCCEEDED) ) {   /* check reply code */       
-        return -1;                              /* failed */
-    }
-
-    /* Conguraturation, connected via SOCKS4 server! */
-    return 0;
-}
-
-int
-httpconnect::sendf(SOCKET s, const char *fmt,...)
-{
-    static char buf[10240];                     /* xxx, enough? */
-
-    va_list args;
-    va_start( args, fmt );
-    vsprintf( buf, fmt, args );
-    va_end( args );
-
-//    report_text(">>>", buf);
-    if ( send(s, buf, strlen(buf), 0) == SOCKET_ERROR ) {       
-        return -1;
-    }
-    return 0;
-}
-
-char *
-httpconnect::make_base64_string(const char *str)
-{
-    static char *buf;
-    unsigned char *src;
-    char *dst;
-    int bits, data, src_len, dst_len;
-    /* make base64 string */
-    src_len = strlen(str);
-    dst_len = (src_len+2)/3*4;
-    buf = (char*)xmalloc(dst_len+1);
-    bits = data = 0;
-    src = (unsigned char *)str;
-    dst = (char *)buf;
-    while ( dst_len-- ) {
-        if ( bits < 6 ) {
-            data = (data << 8) | *src;
-            bits += 8;
-            if ( *src != 0 )
-                src++;
-        }
-        *dst++ = base64_table[0x3F & (data >> (bits-6))];
-        bits -= 6;
-    }
-    *dst = '\0';
-    /* fix-up tail padding */
-    switch ( src_len%3 ) {
-    case 1:
-        *--dst = '=';
-    case 2:
-        *--dst = '=';
-    }
-    return buf;
-}
-
-
-int
-httpconnect::basic_auth (SOCKET s)
-{
-    char *userpass;
-    char *cred;
-    const char *user = relay_user;
-    char *pass = NULL;
-    int len, ret;
-
-    /* Get username/password for authentication */
-    if (user == NULL)
-	{       
-		return -1;
-	}
-    if ((pass = determine_relay_password ()) == NULL &&
-        (pass = readpass("Enter proxy authentication password for %s@%s: ",
-                         relay_user, relay_host)) == NULL)
-	{
-		return -1;
-	}
-
-    len = strlen(user)+strlen(pass)+1;
-    userpass = (char*)xmalloc(len+1);
-    sprintf(userpass,"%s:%s", user, pass);
-    memset (pass, 0, strlen(pass));
-    cred = make_base64_string(userpass);
-    memset (userpass, 0, len);
-
-    f_report = 0;                               /* don't report for security */
-    ret = sendf(s, "Proxy-Authorization: Basic %s\r\n", cred);
-    f_report = 1;
-    report_text(">>>", "Proxy-Authorization: Basic xxxxx\r\n");
-
-    memset(cred, 0, strlen(cred));
-    free(cred);
-
-    return ret;
-}
-
-/* begin relaying via HTTP proxy
-   Directs CONNECT method to proxy server to connect to
-   destination host (and port). It may not be allowed on your
-   proxy server.
- */
-int
-httpconnect::begin_http_relay( SOCKET s )
-{
-	char auth_www[] = "WWW-Authenticate:";
-	char auth_proxy[] = "Proxy-Authenticate:";
-    char buf[1024];
-    int result;
-    char *auth_what;
-    if (sendf(s,"CONNECT %s:%d HTTP/1.0\r\n", dest_host, dest_port) < 0)
-        return START_ERROR;
-    if (proxy_auth_type == PROXY_AUTH_BASIC && basic_auth (s) < 0)
-        return START_ERROR;
-    if (sendf(s,"\r\n") < 0)
-        return START_ERROR;
-
-    /* get response */
-    if ( line_input(s, buf, sizeof(buf)) < 0 ) {
-        return START_ERROR;
-    }
-
-    /* check status */
-    if (!strchr(buf, ' ')) {
-	return START_ERROR;
-    }
-    result = atoi(strchr(buf,' '));
-
-    switch ( result ) {
-    case 200:
-        break;
-    case 302:                                   /* redirect */
-        do {
-            if (line_input(s, buf, sizeof(buf)))
-                break;
-            downcase(buf);
-            if (expect(buf, "Location: ")) {
-                relay_host = cut_token(buf, "//");
-                cut_token(buf, "/");
-                relay_port = atoi(cut_token(buf, ":"));
-            }
-        } while (strcmp(buf,"\r\n") != 0);
-        return START_RETRY;
-
-    /* We handle both 401 and 407 codes here: 401 is WWW-Authenticate, which
-     * not strictly the correct response, but some proxies do send this (e.g.
-     * Symantec's Raptor firewall) */
-    case 401:                                   /* WWW-Auth required */
-    case 407:                                   /* Proxy-Auth required */
-        /** NOTE: As easy implementation, we support only BASIC scheme
-            and ignore realm. */
-        /* If proxy_auth_type is PROXY_AUTH_BASIC and get
-         this result code, authentication was failed. */
-        if (proxy_auth_type != PROXY_AUTH_NONE) {
-            return START_ERROR;
-        }
-        auth_what = (result == 401) ? auth_www : auth_proxy;
-        do {
-            if ( line_input(s, buf, sizeof(buf)) ) {
-                break;
-            }
-            downcase(buf);
-            if (expect(buf, auth_what)) {
-                /* parse type and realm */
-                char *scheme, *realm;
-                scheme = cut_token(buf, " ");
-                realm = cut_token(scheme, " ");
-                if ( scheme == NULL || realm == NULL ) {
-                    return START_ERROR;         /* fail */
-                }
-                /* check supported auth type */
-                if (expect(scheme, "basic")) {
-                    proxy_auth_type = PROXY_AUTH_BASIC;
-                } 
-            }
-        } while (strcmp(buf,"\r\n") != 0);
-        if ( proxy_auth_type == PROXY_AUTH_NONE ) {
-            return START_ERROR;
-        } else {
-            return START_RETRY;
-        }
-
-    default:
-        /* Not allowed */
-        return START_ERROR;
-    }
-    /* skip to end of response header */
-    do {
-        if ( line_input(s, buf, sizeof(buf) ) ) {
-            return START_ERROR;
-        }
-    } while ( strcmp(buf,"\r\n") != 0 );
-
-    return START_OK;
-}
-
-
-BOOL httpconnect::ParseDisplay(LPTSTR display, LPTSTR phost, int hostlen, int *pport) 
-{
-	int tmp_port;
-	TCHAR *colonpos = _tcschr(display, L':');
-    if (hostlen < (int)_tcslen(display))
-        return FALSE;
-
-    if (colonpos == NULL)
-	{
-		// No colon -- use default port number
-        tmp_port = HTTP_PORT;
-		_tcsncpy(phost, display, MAX_HOST_NAME_LEN);
-	}
-	else
-	{
-		_tcsncpy(phost, display, colonpos - display);
-		phost[colonpos - display] = L'\0';
-		if (colonpos[1] == L':') {
-			// Two colons -- interpret as a port number
-			if (_stscanf(colonpos + 2, TEXT("%d"), &tmp_port) != 1) 
-				return FALSE;
-		}
-		else
-		{
-			// One colon -- interpret as a display number or port number
-			if (_stscanf(colonpos + 1, TEXT("%d"), &tmp_port) != 1) 
-				return FALSE;
-
-			// RealVNC method - If port < 100 interpret as display number else as Port number
-			if (tmp_port < 100)
-				tmp_port += HTTP_PORT;
-		}
-	}
-    *pport = tmp_port;
-    return TRUE;
-}
-
-BOOL httpconnect::ParseDisplay2(LPTSTR display, LPTSTR phost, int hostlen, int *pport) 
-{
-	int tmp_port;
-	TCHAR *colonpos = _tcschr(display, L':');
-    if (hostlen < (int)_tcslen(display))
-        return FALSE;
-
-    if (colonpos == NULL)
-	{
-		// No colon -- use default port number
-        tmp_port = HTTPS_PORT;
-		_tcsncpy(phost, display, MAX_HOST_NAME_LEN);
-	}
-	else
-	{
-		_tcsncpy(phost, display, colonpos - display);
-		phost[colonpos - display] = L'\0';
-		if (colonpos[1] == L':') {
-			// Two colons -- interpret as a port number
-			if (_stscanf(colonpos + 2, TEXT("%d"), &tmp_port) != 1) 
-				return FALSE;
-		}
-		else
-		{
-			// One colon -- interpret as a display number or port number
-			if (_stscanf(colonpos + 1, TEXT("%d"), &tmp_port) != 1) 
-				return FALSE;
-
-			// RealVNC method - If port < 100 interpret as display number else as Port number
-			if (tmp_port < 100)
-				tmp_port += HTTPS_PORT;
-		}
-	}
-    *pport = tmp_port;
-    return TRUE;
-}
-
-/** Main of program **/
-SOCKET
-httpconnect::mainconnect( int meth,char *server,char *remoteserver, int remoteport)
-{
-	int ret;
-    SOCKET remote;
-    WSADATA wsadata;
-    WSAStartup( 0x101, &wsadata);
-
-	//set_relay( METHOD_SOCKS, "24.125.118.146:26836");
-	/*	f_debug++;
-	set_relay(METHOD_HTTP,"proxy.skynet.be:8080");
-	local_type=1;
-	local_port=1111;
-	dest_host="uvnc.com";
-	dest_port=443;*/
-
-
-	f_debug++;
-	local_type = LOCAL_SOCKET;
-    local_port = 1111;
-	strcpy(dest_host,remoteserver);
-	dest_port=remoteport;
-	set_relay( meth, server );
-
-
-retry:
-
-    /* make connection */
-    if ( relay_method == METHOD_DIRECT ) {
-        remote = open_connection (dest_host, dest_port);
-        if ( (errno_t) remote == SOCKET_ERROR )
-		{
-			return 0;
-		}
-    } else {
-        remote = open_connection (relay_host, relay_port);
-        if ( (errno_t) remote == SOCKET_ERROR )
-		{
-			return 0;
-		}
-    }
-
-    if (relay_method == METHOD_SOCKS &&
-        socks_resolve == RESOLVE_LOCAL &&
-        local_resolve (dest_host, &dest_addr) < 0) {
-		return 0;
-    }
-
-    /** relay negociation **/
-    switch ( relay_method ) {
-    case METHOD_SOCKS:
-        if ( ((socks_version == 5) && (begin_socks5_relay(remote) < 0)) ||
-             ((socks_version == 4) && (begin_socks4_relay(remote) < 0)) )
-		{
-			return 0;
-		}
-        break;
-
-    case METHOD_HTTP:
-        ret = begin_http_relay(remote);
-        switch (ret) {
-        case START_ERROR:
-            closesocket(remote);
-			return 0;
-        case START_OK:
-            break;
-        case START_RETRY:
-            /* retry with authentication */
-           closesocket(remote);
-            goto retry;
-        }
-        break;
-    }
-	return remote;
-}
-
-
-SOCKET 
-httpconnect::Get_https_socket(char *port, char *host)
-{
-	TCHAR proxy[512];
-	memset (proxy,0,sizeof(proxy));
-	TCHAR * pch=NULL;
-	pfnWinHttpGetIEProxyConfig pWHGIEPC = NULL;
-	HMODULE hModWH=NULL;
-	//New function, ask current user proxy
-	if ((hModWH = LoadLibrary("winhttp.dll"))) {
-	pWHGIEPC = (pfnWinHttpGetIEProxyConfig) (GetProcAddress(hModWH, "WinHttpGetIEProxyConfigForCurrentUser"));
-	}
-	WINHTTP_CURRENT_USER_IE_PROXY_CONFIG MyProxyConfig;
-	if(!pWHGIEPC(&MyProxyConfig))
-	{
-		return 0;
-	}
-	if (hModWH) FreeLibrary(hModWH);
-	if(NULL != MyProxyConfig.lpszAutoConfigUrl)
-		{
-			GlobalFree(MyProxyConfig.lpszAutoConfigUrl);
-		}
-	if(NULL != MyProxyConfig.lpszProxyBypass)
-		{
-			GlobalFree(MyProxyConfig.lpszProxyBypass);
-		}
-	if(NULL != MyProxyConfig.lpszProxy)
-		{
-			WideCharToMultiByte( CP_ACP, 0, MyProxyConfig.lpszProxy,-1,proxy,512,NULL,NULL);
-			GlobalFree(MyProxyConfig.lpszProxy);
-		}
-
-	TCHAR remotehost[256];
-	int remoteport=0;
-	TCHAR remotehost2[256];
-	int remoteport2=0;
-	TCHAR tempchar1[256];
-	TCHAR tempchar2[256];
-	_tcscpy(tempchar1,"");
-	_tcscpy(tempchar2,"");
-
-	if (strlen(proxy)!=0)
-	{
-		pch = _tcstok (proxy,";");
-	
-		if (_tcsstr(pch,"http=")!=NULL)
-		{
-			_tcscpy(tempchar1,pch);
-		}
-		if (_tcsstr(pch,"https=")!=NULL)
-		{
-			_tcscpy(tempchar2,pch);
-		}
-		if (_tcsstr(pch,"=")==NULL)
-		{
-			_tcscpy(tempchar2,pch);
-		}
-	}
-
-	while (pch != NULL)
-		{
-			pch = _tcstok (NULL, ";");
-			if (pch != NULL)
-			{
-				if (_tcsstr(pch,"http=")!=NULL)
-					{
-						_tcscpy(tempchar1,pch+5);
-					}
-				if (_tcsstr(pch,"https=")!=NULL)
-					{
-						_tcscpy(tempchar2,pch+6);
-					}
-
-			}
-	}
-	ParseDisplay(tempchar1, remotehost, 255, &remoteport);
-	ParseDisplay2(tempchar2, remotehost2, 255, &remoteport2);
-	SOCKET mysock=0;
-
-	if (remoteport2!=1080)
-		{
-			mysock=mainconnect(METHOD_HTTP,tempchar2,host,atoi(port));
-		}
-	else
-		{
-			mysock=mainconnect(METHOD_SOCKS,tempchar2,host,atoi(port));
-		}
-
-	return mysock;
-}
diff --git a/ica/win32/winvnc/winvnc/httpconnect.h b/ica/win32/winvnc/winvnc/httpconnect.h
deleted file mode 100644
index a4df941..0000000
--- a/ica/win32/winvnc/winvnc/httpconnect.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <memory.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <winsock2.h>
-#include <windows.h>
-#include <sys/stat.h>
-#include <io.h>
-#include <conio.h>
-#include <tchar.h>
-
-#define LOCAL_STDIO     0
-#define LOCAL_SOCKET    1
-#define HTTP_PORT 80
-#define HTTPS_PORT 443
-#define MAX_HOST_NAME_LEN 256
-/* relay method, server and port */
-#define METHOD_UNDECIDED 0
-#define METHOD_DIRECT    1
-#define METHOD_SOCKS     2
-#define METHOD_HTTP      3
-#define METHOD_TELNET    4
-/* informations for SOCKS */
-#define SOCKS5_REP_SUCCEEDED    0x00    /* succeeded */
-#define SOCKS5_REP_FAIL         0x01    /* general SOCKS serer failure */
-#define SOCKS5_REP_NALLOWED     0x02    /* connection not allowed by ruleset */
-#define SOCKS5_REP_NUNREACH     0x03    /* Network unreachable */
-#define SOCKS5_REP_HUNREACH     0x04    /* Host unreachable */
-#define SOCKS5_REP_REFUSED      0x05    /* connection refused */
-#define SOCKS5_REP_EXPIRED      0x06    /* TTL expired */
-#define SOCKS5_REP_CNOTSUP      0x07    /* Command not supported */
-#define SOCKS5_REP_ANOTSUP      0x08    /* Address not supported */
-#define SOCKS5_REP_INVADDR      0x09    /* Inalid address */
-/* SOCKS5 authentication methods */
-#define SOCKS5_AUTH_REJECT      0xFF    /* No acceptable auth method */
-#define SOCKS5_AUTH_NOAUTH      0x00    /* without authentication */
-#define SOCKS5_AUTH_GSSAPI      0x01    /* GSSAPI */
-#define SOCKS5_AUTH_USERPASS    0x02    /* User/Password */
-#define SOCKS5_AUTH_CHAP        0x03    /* Challenge-Handshake Auth Proto. */
-#define SOCKS5_AUTH_EAP         0x05    /* Extensible Authentication Proto. */
-#define SOCKS5_AUTH_MAF         0x08    /* Multi-Authentication Framework */
-#define SOCKS4_REP_SUCCEEDED    90      /* rquest granted (succeeded) */
-#define SOCKS4_REP_REJECTED     91      /* request rejected or failed */
-#define SOCKS4_REP_IDENT_FAIL   92      /* cannot connect identd */
-#define SOCKS4_REP_USERID       93      /* user id not matched */
-#define RESOLVE_UNKNOWN 0
-#define RESOLVE_LOCAL   1
-#define RESOLVE_REMOTE  2
-#define RESOLVE_BOTH    3
-/* Environment variable names */
-#define ENV_SOCKS_SERVER  "SOCKS_SERVER"        /* SOCKS server */
-#define ENV_SOCKS5_SERVER "SOCKS5_SERVER"
-#define ENV_SOCKS4_SERVER "SOCKS4_SERVER"
-#define ENV_SOCKS_RESOLVE  "SOCKS_RESOLVE"      /* resolve method */
-#define ENV_SOCKS5_RESOLVE "SOCKS5_RESOLVE"
-#define ENV_SOCKS4_RESOLVE "SOCKS4_RESOLVE"
-#define ENV_SOCKS5_USER     "SOCKS5_USER"       /* auth user for SOCKS5 */
-#define ENV_SOCKS4_USER     "SOCKS4_USER"       /* auth user for SOCKS4 */
-#define ENV_SOCKS_USER      "SOCKS_USER"        /* auth user for SOCKS */
-#define ENV_SOCKS5_PASSWD   "SOCKS5_PASSWD"     /* auth password for SOCKS5 */
-#define ENV_SOCKS5_PASSWORD "SOCKS5_PASSWORD"   /* old style */
-#define ENV_HTTP_PROXY          "HTTP_PROXY"    /* common env var */
-#define ENV_HTTP_PROXY_USER     "HTTP_PROXY_USER" /* auth user */
-#define ENV_HTTP_PROXY_PASSWORD "HTTP_PROXY_PASSWORD" /* auth password */
-#define ENV_TELNET_PROXY          "TELNET_PROXY"    /* common env var */
-#define ENV_CONNECT_USER     "CONNECT_USER"     /* default auth user name */
-#define ENV_CONNECT_PASSWORD "CONNECT_PASSWORD" /* default auth password */
-#define ENV_SOCKS_DIRECT   "SOCKS_DIRECT"       /* addr-list for non-proxy */
-#define ENV_SOCKS5_DIRECT  "SOCKS5_DIRECT"
-#define ENV_SOCKS4_DIRECT  "SOCKS4_DIRECT"
-#define ENV_HTTP_DIRECT    "HTTP_DIRECT"
-#define ENV_CONNECT_DIRECT "CONNECT_DIRECT"
-#define ENV_SOCKS5_AUTH "SOCKS5_AUTH"
-#define ENV_SSH_ASKPASS "SSH_ASKPASS"           /* askpass program */
-/* Prefix string of HTTP_PROXY */
-#define HTTP_PROXY_PREFIX "http://"
-#define PROXY_AUTH_NONE 0
-#define PROXY_AUTH_BASIC 1
-#define PROXY_AUTH_DIGEST 2
-#define REASON_UNK              -2
-#define REASON_ERROR            -1
-#define REASON_CLOSED_BY_LOCAL  0
-#define REASON_CLOSED_BY_REMOTE 1
-#define START_ERROR -1
-#define START_OK     0
-#define START_RETRY  1
-#define socket_errno() WSAGetLastError()
-#define popen _popen
-
-#ifndef ECONNRESET
-#define ECONNRESET WSAECONNRESET
-#endif
-
-#define MAX_DIRECT_ADDR_LIST 256
-
-#define PUT_BYTE(ptr,data) (*(unsigned char*)ptr = data)
-
-struct ADDRPAIR {
-    struct in_addr addr;
-    struct in_addr mask;
-    int negative;
-};
-
-typedef struct {
-    BOOL    fAutoDetect;
-    LPWSTR  lpszAutoConfigUrl;
-    LPWSTR  lpszProxy;
-    LPWSTR  lpszProxyBypass;
-} WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
-
-typedef BOOL (STDAPICALLTYPE * pfnWinHttpGetIEProxyConfig)
-(
-    IN OUT WINHTTP_CURRENT_USER_IE_PROXY_CONFIG * pProxyConfig
-);
-
-typedef struct {
-    int num;
-    const char *str;
-} LOOKUP_ITEM;
-
-typedef struct {
-    char* name;
-    char* value;
-} PARAMETER_ITEM;
-
-typedef struct {
-    char* name;
-    unsigned char auth;
-} AUTH_METHOD_ITEM;
-
-
-class httpconnect
-{
-	
-public:
-	httpconnect();
-	~httpconnect();
-
-	void *xmalloc (size_t size);
-	void downcase( char *buf );
-	char * expand_host_and_port (const char *fmt, const char *host, int port);
-	int lookup_resolve( const char *str );
-	char *getusername(void);
-	int expect( char *str, char *substr);
-	PARAMETER_ITEM* find_parameter_item(const char* name);
-	char* getparam(const char* name);
-	void mask_addr (void *addr, void *mask, int addrlen);
-	int add_direct_addr (struct in_addr *addr, struct in_addr *mask, int negative);
-	int parse_addr_pair (const char *str, struct in_addr *addr, struct in_addr *mask);
-	void initialize_direct_addr (void);
-	int cmp_addr (void *addr1, void *addr2, int addrlen);
-	int is_direct_address (const struct sockaddr_in *addr);
-	char * determine_relay_user ();
-	char *determine_relay_password ();
-	int set_relay( int method, char *spec );
-	u_short resolve_port( const char *service );
-	int local_resolve (const char *host, struct sockaddr_in *addr);
-	SOCKET open_connection( const char *host, u_short port );
-	void report_text( char *prefix, char *buf );
-	int atomic_out( SOCKET s, char *buf, int size );
-	int atomic_in( SOCKET s, char *buf, int size );
-	int line_input( SOCKET s, char *buf, int size );
-	char *cut_token( char *str, char *delim);
-	const char * lookup(int num, LOOKUP_ITEM *items);
-	const char * socks5_getauthname( int auth );
-	int socks5_do_auth_userpass( SOCKET s );
-	char *readpass( const char* prompt, ...);
-	int socks5_auth_parse_1(char *start, char *end);
-	int socks5_auth_parse(char *start, unsigned char *auth_list, int max_auth);
-	int begin_socks5_relay( SOCKET s );
-	int begin_socks4_relay( SOCKET s );
-	int sendf(SOCKET s, const char *fmt,...);
-	char * make_base64_string(const char *str);
-	int basic_auth (SOCKET s);
-	int begin_http_relay( SOCKET s );
-	BOOL ParseDisplay(LPTSTR display, LPTSTR phost, int hostlen, int *pport) ;
-	BOOL ParseDisplay2(LPTSTR display, LPTSTR phost, int hostlen, int *pport) ;
-	SOCKET mainconnect( int meth,char *server,char *remoteserver, int remoteport);
-	SOCKET Get_https_socket(char *port, char *host);
-
-	int   relay_method;          
-	char *relay_host;                        
-	u_short relay_port;                        
-	char *relay_user;  
-	char dest_host[256];
-	u_short dest_port;
-	struct sockaddr_in dest_addr;
-	int f_debug;
-	int proxy_auth_type;
-	u_short local_port; 
-	int   local_type;
-	int socks_version; 
-	int socks_resolve;
-	int f_report;
-	struct sockaddr_in socks_ns;
-	char *socks5_auth;
-	struct ADDRPAIR direct_addr_list[MAX_DIRECT_ADDR_LIST];
-	int n_direct_addr_list;
-};
diff --git a/ica/win32/winvnc/winvnc/inifile.cpp b/ica/win32/winvnc/winvnc/inifile.cpp
deleted file mode 100644
index 68b6185..0000000
--- a/ica/win32/winvnc/winvnc/inifile.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include "inifile.h"
-void Set_settings_as_admin(char *mycommand);
-
-
-IniFile::IniFile()
-{
-char WORKDIR[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return;
-		*p = '\0';
-		}
-	strcpy(myInifile,"");
-	strcat(myInifile,WORKDIR);//set the directory
-	strcat(myInifile,"\\");
-	strcat(myInifile,INIFILE_NAME);
-}
-
-void
-IniFile::IniFileSetSecure()
-{
-char WORKDIR[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return;
-		*p = '\0';
-		}
-	strcpy(myInifile,"");
-	strcat(myInifile,WORKDIR);//set the directory
-	strcat(myInifile,"\\");
-	strcat(myInifile,INIFILE_NAME);
-}
-
-void
-IniFile::IniFileSetTemp(char *lpCmdLine)
-{	
-	strcpy_s(myInifile,260,lpCmdLine);
-}
-
-/*void
-IniFile::IniFileSetTemp()
-{
-char WORKDIR[MAX_PATH];
-
-	if (!GetTempPath(MAX_PATH,WORKDIR))
-	{
-		//Function failed, just set something
-		if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return;
-		*p = '\0';
-		}
-		strcpy(myInifile,"");
-		strcat(myInifile,WORKDIR);//set the directory
-		strcat(myInifile,"\\");
-		strcat(myInifile,INIFILE_NAME);
-		return;
-	}
-
-	strcpy(myInifile,"");
-	strcat(myInifile,WORKDIR);//set the directory
-	strcat(myInifile,INIFILE_NAME);
-}*/
-
-void
-IniFile::copy_to_secure()
-{
-		char dir[MAX_PATH];
-
-		char exe_file_name[MAX_PATH];
-		GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-		strcpy(dir, exe_file_name);
-		strcat(dir, " -settingshelper");
-		strcat(dir, ":");
-		strcat(dir, myInifile);
-
-
-		STARTUPINFO          StartUPInfo;
-		PROCESS_INFORMATION  ProcessInfo;
-		HANDLE Token=NULL;
-		HANDLE process=NULL;
-		ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-		ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-		StartUPInfo.wShowWindow = SW_SHOW;
-		StartUPInfo.lpDesktop = "Winsta0\\Default";
-		StartUPInfo.cb = sizeof(STARTUPINFO);
-		HWND tray = FindWindow(("Shell_TrayWnd"), 0);
-		if (!tray)
-			return;
-	
-		DWORD processId = 0;
-			GetWindowThreadProcessId(tray, &processId);
-		if (!processId)
-			return;	
-		process = OpenProcess(MAXIMUM_ALLOWED, FALSE, processId);
-		if (!process)
-			return;	
-		OpenProcessToken(process, MAXIMUM_ALLOWED, &Token);
-		CreateProcessAsUser(Token,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-		DWORD error=GetLastError();
-		if (process) CloseHandle(process);
-		if (Token) CloseHandle(Token);
-		if (ProcessInfo.hThread) CloseHandle (ProcessInfo.hThread);
-		if (ProcessInfo.hProcess) CloseHandle (ProcessInfo.hProcess);
-		if (error==1314)
-		{
-			Set_settings_as_admin(myInifile);
-		}
-
-}
-
-IniFile::~IniFile()
-{
-}
-
-bool
-IniFile::WriteString(char *key1, char *key2,char *value)
-{
-	//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile); 
-	return (FALSE != WritePrivateProfileString(key1,key2, value,myInifile));
-}
-
-bool 
-IniFile::WriteInt(char *key1, char *key2,int value)
-{
-	char       buf[32];
-	wsprintf(buf, "%d", value);
-	//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
-	int result=WritePrivateProfileString(key1,key2, buf,myInifile);
-	if (result==0) return false;
-	return true;
-}
-
-int
-IniFile::ReadInt(char *key1, char *key2,int Defaultvalue)
-{
-	//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
-	return GetPrivateProfileInt(key1, key2, Defaultvalue, myInifile);
-}
-
-void 
-IniFile::ReadString(char *key1, char *key2,char *value,int valuesize)
-{
-	//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
-	GetPrivateProfileString(key1,key2, "",value,valuesize,myInifile);
-}
-
-void 
-IniFile::ReadPassword(char *value,int valuesize)
-{
-	//int size=ReadInt("ultravnc", "passwdsize",0);
-	//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifilePasswd);
-	GetPrivateProfileStruct("ultravnc","passwd",value,8,myInifile);
-}
-
-void //PGM
-IniFile::ReadPassword2(char *value,int valuesize) //PGM
-{ //PGM
-	GetPrivateProfileStruct("ultravnc","passwd2",value,8,myInifile); //PGM
-} //PGM
-
-bool
-IniFile::WritePassword(char *value)
-{
-		//WriteInt("ultravnc", "passwdsize",sizeof(value));
-		//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
-		return (FALSE != WritePrivateProfileStruct("ultravnc","passwd", value,8,myInifile));
-}
-
-bool //PGM
-IniFile::WritePassword2(char *value) //PGM
-{ //PGM
-		return (FALSE != WritePrivateProfileStruct("ultravnc","passwd2", value,8,myInifile)); //PGM
-} //PGM
-
-bool IniFile::IsWritable()
-{
-    bool writable = WriteInt("Permissions", "isWritable",1);
-    if (writable)
-        WritePrivateProfileSection("Permissions", "", myInifile);
-
-    return writable;
-}
-
diff --git a/ica/win32/winvnc/winvnc/inifile.h b/ica/win32/winvnc/winvnc/inifile.h
deleted file mode 100644
index efecab7..0000000
--- a/ica/win32/winvnc/winvnc/inifile.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h>
-#if (!defined(_WINVNC_INIFILE))
-#define _WINVNC_INIFILE
-
-bool Copy_to_Temp(char *tempfile);
-bool Copy_to_Secure_from_temp(char *tempfile);
-#define INIFILE_NAME "ultravnc.ini"
-
-class IniFile
-{
-
-// Fields
-public:
-	char myInifile[MAX_PATH];
-
-// Methods
-public:
-	// Make the desktop thread & window proc friends
-
-	IniFile();
-	~IniFile();
-	bool WriteString(char *key1, char *key2,char *value);
-	bool WritePassword(char *value);
-	bool WritePassword2(char *value); //PGM
-	bool WriteInt(char *key1, char *key2,int value);
-	int ReadInt(char *key1, char *key2,int Defaultvalue);
-	void ReadString(char *key1, char *key2,char *value,int valuesize);
-	void ReadPassword(char *value,int valuesize);
-	void ReadPassword2(char *value,int valuesize); //PGM
-	void IniFileSetSecure();
-	//void IniFileSetTemp();
-	void IniFileSetTemp(char *lpCmdLine);
-	void copy_to_secure();
-
-    bool IsWritable();
-
-protected:
-		
-};
-#endif
diff --git a/ica/win32/winvnc/winvnc/initipp.cpp b/ica/win32/winvnc/winvnc/initipp.cpp
deleted file mode 100644
index 17beb57..0000000
--- a/ica/win32/winvnc/winvnc/initipp.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#ifdef IPP
-#include "ippcore.h"
-#include "ippversion.h"
-#include <windows.h>
-
-#define CACHE_LINE 32
-#define bool BOOL
-#define false FALSE
-#define true TRUE
-
-
-static int ippstaticinitcalled=0;
-#if IPP_VERSION_MAJOR>=5
-#define ippCoreGetStatusString ippGetStatusString
-#define ippCoreGetCpuType ippGetCpuType
-#define ippStaticInitBest ippStaticInit
-#endif
-
-
-// MMX_SSESupport.h
-
-#pragma once
-
-#define _MMX_FEATURE_BIT        0x00800000      // bit 23
-#define _SSE_FEATURE_BIT        0x02000000      // bit 25
-// bit flags set by cpuid when called with register eax set to 1
-#define MMX_SUPPORTED			0x00800000
-#define SSE_SUPPORTED			0x02000000
-#define SSE2_SUPPORTED			0x04000000
-#define AMD_3DNOW_SUPPORTED		0x80000000
-
-// AMD specific
-#define AMD_3DNOW_EX_SUPPORTED	0x40000000
-#define AMD_MMX_EX_SUPPORTED	0x00400000
-
-#define SUPPORT_MMX				0x0001
-#define SUPPORT_3DNOW			0x0002
-#define SUPPORT_SSE				0x0004
-#define SUPPORT_SSE2			0x0008
-DWORD				dwFeatures;
-
-
-#ifndef _X64
-bool IsCPUID()
-{
-	__try 
-	{
-		_asm 
-		{
-			xor eax, eax
-			cpuid
-		}
-	}
-	__except (EXCEPTION_EXECUTE_HANDLER) 
-	{
-		return false;
-	}
-	return true;
-}
-
-bool QueryCPUInfo()
-{
-	DWORD dwStandard = 0;
-	DWORD dwFeature = 0;
-	
-	DWORD dwMax = 0;
-	DWORD dwExt = 0;
-	int feature = 0;
-	int os_support = 0;
-
-	union {
-		char cBuffer[12+1];
-		struct {
-			DWORD dw0;
-			DWORD dw1;
-			DWORD dw2;
-		} stc;
-	} Vendor;
-
-	if (!IsCPUID())
-		return false;
-
-	dwFeatures=0;
-	memset(&Vendor, 0, sizeof(Vendor));
-
-	_asm {
-		push ebx
-		push ecx
-		push edx
-
-		// get the vendor string
-		xor eax, eax
-		cpuid
-		mov dwMax, eax
-		mov Vendor.stc.dw0, ebx
-		mov Vendor.stc.dw1, edx
-		mov Vendor.stc.dw2, ecx
-
-		// get the Standard bits
-		mov eax, 1
-		cpuid
-		mov dwStandard, eax
-		mov dwFeature, edx
-
-		// get AMD-specials
-		mov eax, 80000000h
-		cpuid
-		cmp eax, 80000000h
-		jc notamd
-		mov eax, 80000001h
-		cpuid
-		mov dwExt, edx
-
-notamd:
-		pop ecx
-		pop ebx
-		pop edx
-	}
-
-	if (dwFeature & MMX_SUPPORTED) 
-		dwFeatures |= SUPPORT_MMX;
-
-	if (dwExt & AMD_3DNOW_SUPPORTED) 
-		dwFeatures |= SUPPORT_3DNOW;
-
-	if (dwFeature & SSE_SUPPORTED) 
-		dwFeatures |= SUPPORT_SSE;
-
-	if (dwFeature & SSE2_SUPPORTED) 
-		dwFeatures |= SUPPORT_SSE2;
-
-	return true;
-}
-
-
-static
-IppCpuType
-AutoDetect(void)
-{
-IppCpuType cputype=ippCpuUnknown;
-QueryCPUInfo();
-if ((dwFeatures & SUPPORT_MMX) == SUPPORT_MMX) cputype=ippCpuPII;
-if ((dwFeatures & SUPPORT_SSE) == SUPPORT_SSE) cputype=ippCpuPIII;
-if ((dwFeatures & SUPPORT_SSE2) == SUPPORT_SSE2) cputype=ippCpuP4;
-return cputype;
-}
-#endif
-
-void InitIpp()
-{
-if(!ippstaticinitcalled)
-	{
-		IppCpuType cpu=ippCoreGetCpuType();
-#ifndef _X64
-		if(cpu==ippCpuUnknown) {cpu=AutoDetect();  ippInitCpu(cpu);}
-		else
-#endif
-		ippStaticInitBest();
-		ippstaticinitcalled=1;
-	}
-}
-#endif
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/keysymdef.h b/ica/win32/winvnc/winvnc/keysymdef.h
deleted file mode 100644
index 87274b7..0000000
--- a/ica/win32/winvnc/winvnc/keysymdef.h
+++ /dev/null
@@ -1,1595 +0,0 @@
-/* $TOG: keysymdef.h /main/28 1998/05/22 16:18:01 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1994, 1998  The Open Group
-
-All Rights Reserved.
-
-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.
-
-******************************************************************/
-
-#define XK_VoidSymbol		0xFFFFFF	/* void symbol */
-
-#ifdef XK_MISCELLANY
-/*
- * TTY Functions, cleverly chosen to map to ascii, for convenience of
- * programming, but could have been arbitrary (at the cost of lookup
- * tables in client code.
- */
-
-#define XK_BackSpace		0xFF08	/* back space, back char */
-#define XK_Tab			0xFF09
-#define XK_Linefeed		0xFF0A	/* Linefeed, LF */
-#define XK_Clear		0xFF0B
-#define XK_Return		0xFF0D	/* Return, enter */
-#define XK_Pause		0xFF13	/* Pause, hold */
-#define XK_Scroll_Lock		0xFF14
-#define XK_Sys_Req		0xFF15
-#define XK_Escape		0xFF1B
-#define XK_Delete		0xFFFF	/* Delete, rubout */
-
-
-
-/* International & multi-key character composition */
-
-#define XK_Multi_key		0xFF20  /* Multi-key character compose */
-#define XK_Codeinput		0xFF37
-#define XK_SingleCandidate	0xFF3C
-#define XK_MultipleCandidate	0xFF3D
-#define XK_PreviousCandidate	0xFF3E
-
-/* Japanese keyboard support */
-
-#define XK_Kanji		0xFF21	/* Kanji, Kanji convert */
-#define XK_Muhenkan		0xFF22  /* Cancel Conversion */
-#define XK_Henkan_Mode		0xFF23  /* Start/Stop Conversion */
-#define XK_Henkan		0xFF23  /* Alias for Henkan_Mode */
-#define XK_Romaji		0xFF24  /* to Romaji */
-#define XK_Hiragana		0xFF25  /* to Hiragana */
-#define XK_Katakana		0xFF26  /* to Katakana */
-#define XK_Hiragana_Katakana	0xFF27  /* Hiragana/Katakana toggle */
-#define XK_Zenkaku		0xFF28  /* to Zenkaku */
-#define XK_Hankaku		0xFF29  /* to Hankaku */
-#define XK_Zenkaku_Hankaku	0xFF2A  /* Zenkaku/Hankaku toggle */
-#define XK_Touroku		0xFF2B  /* Add to Dictionary */
-#define XK_Massyo		0xFF2C  /* Delete from Dictionary */
-#define XK_Kana_Lock		0xFF2D  /* Kana Lock */
-#define XK_Kana_Shift		0xFF2E  /* Kana Shift */
-#define XK_Eisu_Shift		0xFF2F  /* Alphanumeric Shift */
-#define XK_Eisu_toggle		0xFF30  /* Alphanumeric toggle */
-#define XK_Kanji_Bangou		0xFF37  /* Codeinput */
-#define XK_Zen_Koho		0xFF3D	/* Multiple/All Candidate(s) */
-#define XK_Mae_Koho		0xFF3E	/* Previous Candidate */
-
-/* 0xFF31 thru 0xFF3F are under XK_KOREAN */
-
-/* Cursor control & motion */
-
-#define XK_Home			0xFF50
-#define XK_Left			0xFF51	/* Move left, left arrow */
-#define XK_Up			0xFF52	/* Move up, up arrow */
-#define XK_Right		0xFF53	/* Move right, right arrow */
-#define XK_Down			0xFF54	/* Move down, down arrow */
-#define XK_Prior		0xFF55	/* Prior, previous */
-#define XK_Page_Up		0xFF55
-#define XK_Next			0xFF56	/* Next */
-#define XK_Page_Down		0xFF56
-#define XK_End			0xFF57	/* EOL */
-#define XK_Begin		0xFF58	/* BOL */
-
-
-/* Misc Functions */
-
-#define XK_Select		0xFF60	/* Select, mark */
-#define XK_Print		0xFF61
-#define XK_Execute		0xFF62	/* Execute, run, do */
-#define XK_Insert		0xFF63	/* Insert, insert here */
-#define XK_Undo			0xFF65	/* Undo, oops */
-#define XK_Redo			0xFF66	/* redo, again */
-#define XK_Menu			0xFF67
-#define XK_Find			0xFF68	/* Find, search */
-#define XK_Cancel		0xFF69	/* Cancel, stop, abort, exit */
-#define XK_Help			0xFF6A	/* Help */
-#define XK_Break		0xFF6B
-#define XK_Mode_switch		0xFF7E	/* Character set switch */
-#define XK_script_switch        0xFF7E  /* Alias for mode_switch */
-#define XK_Num_Lock		0xFF7F
-
-/* Keypad Functions, keypad numbers cleverly chosen to map to ascii */
-
-#define XK_KP_Space		0xFF80	/* space */
-#define XK_KP_Tab		0xFF89
-#define XK_KP_Enter		0xFF8D	/* enter */
-#define XK_KP_F1		0xFF91	/* PF1, KP_A, ... */
-#define XK_KP_F2		0xFF92
-#define XK_KP_F3		0xFF93
-#define XK_KP_F4		0xFF94
-#define XK_KP_Home		0xFF95
-#define XK_KP_Left		0xFF96
-#define XK_KP_Up		0xFF97
-#define XK_KP_Right		0xFF98
-#define XK_KP_Down		0xFF99
-#define XK_KP_Prior		0xFF9A
-#define XK_KP_Page_Up		0xFF9A
-#define XK_KP_Next		0xFF9B
-#define XK_KP_Page_Down		0xFF9B
-#define XK_KP_End		0xFF9C
-#define XK_KP_Begin		0xFF9D
-#define XK_KP_Insert		0xFF9E
-#define XK_KP_Delete		0xFF9F
-#define XK_KP_Equal		0xFFBD	/* equals */
-#define XK_KP_Multiply		0xFFAA
-#define XK_KP_Add		0xFFAB
-#define XK_KP_Separator		0xFFAC	/* separator, often comma */
-#define XK_KP_Subtract		0xFFAD
-#define XK_KP_Decimal		0xFFAE
-#define XK_KP_Divide		0xFFAF
-
-#define XK_KP_0			0xFFB0
-#define XK_KP_1			0xFFB1
-#define XK_KP_2			0xFFB2
-#define XK_KP_3			0xFFB3
-#define XK_KP_4			0xFFB4
-#define XK_KP_5			0xFFB5
-#define XK_KP_6			0xFFB6
-#define XK_KP_7			0xFFB7
-#define XK_KP_8			0xFFB8
-#define XK_KP_9			0xFFB9
-
-
-
-/*
- * Auxilliary Functions; note the duplicate definitions for left and right
- * function keys;  Sun keyboards and a few other manufactures have such
- * function key groups on the left and/or right sides of the keyboard.
- * We've not found a keyboard with more than 35 function keys total.
- */
-
-#define XK_F1			0xFFBE
-#define XK_F2			0xFFBF
-#define XK_F3			0xFFC0
-#define XK_F4			0xFFC1
-#define XK_F5			0xFFC2
-#define XK_F6			0xFFC3
-#define XK_F7			0xFFC4
-#define XK_F8			0xFFC5
-#define XK_F9			0xFFC6
-#define XK_F10			0xFFC7
-#define XK_F11			0xFFC8
-#define XK_L1			0xFFC8
-#define XK_F12			0xFFC9
-#define XK_L2			0xFFC9
-#define XK_F13			0xFFCA
-#define XK_L3			0xFFCA
-#define XK_F14			0xFFCB
-#define XK_L4			0xFFCB
-#define XK_F15			0xFFCC
-#define XK_L5			0xFFCC
-#define XK_F16			0xFFCD
-#define XK_L6			0xFFCD
-#define XK_F17			0xFFCE
-#define XK_L7			0xFFCE
-#define XK_F18			0xFFCF
-#define XK_L8			0xFFCF
-#define XK_F19			0xFFD0
-#define XK_L9			0xFFD0
-#define XK_F20			0xFFD1
-#define XK_L10			0xFFD1
-#define XK_F21			0xFFD2
-#define XK_R1			0xFFD2
-#define XK_F22			0xFFD3
-#define XK_R2			0xFFD3
-#define XK_F23			0xFFD4
-#define XK_R3			0xFFD4
-#define XK_F24			0xFFD5
-#define XK_R4			0xFFD5
-#define XK_F25			0xFFD6
-#define XK_R5			0xFFD6
-#define XK_F26			0xFFD7
-#define XK_R6			0xFFD7
-#define XK_F27			0xFFD8
-#define XK_R7			0xFFD8
-#define XK_F28			0xFFD9
-#define XK_R8			0xFFD9
-#define XK_F29			0xFFDA
-#define XK_R9			0xFFDA
-#define XK_F30			0xFFDB
-#define XK_R10			0xFFDB
-#define XK_F31			0xFFDC
-#define XK_R11			0xFFDC
-#define XK_F32			0xFFDD
-#define XK_R12			0xFFDD
-#define XK_F33			0xFFDE
-#define XK_R13			0xFFDE
-#define XK_F34			0xFFDF
-#define XK_R14			0xFFDF
-#define XK_F35			0xFFE0
-#define XK_R15			0xFFE0
-
-/* Modifiers */
-
-#define XK_Shift_L		0xFFE1	/* Left shift */
-#define XK_Shift_R		0xFFE2	/* Right shift */
-#define XK_Control_L		0xFFE3	/* Left control */
-#define XK_Control_R		0xFFE4	/* Right control */
-#define XK_Caps_Lock		0xFFE5	/* Caps lock */
-#define XK_Shift_Lock		0xFFE6	/* Shift lock */
-
-#define XK_Meta_L		0xFFE7	/* Left meta */
-#define XK_Meta_R		0xFFE8	/* Right meta */
-#define XK_Alt_L		0xFFE9	/* Left alt */
-#define XK_Alt_R		0xFFEA	/* Right alt */
-#define XK_Super_L		0xFFEB	/* Left super */
-#define XK_Super_R		0xFFEC	/* Right super */
-#define XK_Hyper_L		0xFFED	/* Left hyper */
-#define XK_Hyper_R		0xFFEE	/* Right hyper */
-#endif /* XK_MISCELLANY */
-
-/*
- * ISO 9995 Function and Modifier Keys
- * Byte 3 = 0xFE
- */
-
-#ifdef XK_XKB_KEYS
-#define	XK_ISO_Lock					0xFE01
-#define	XK_ISO_Level2_Latch				0xFE02
-#define	XK_ISO_Level3_Shift				0xFE03
-#define	XK_ISO_Level3_Latch				0xFE04
-#define	XK_ISO_Level3_Lock				0xFE05
-#define	XK_ISO_Group_Shift		0xFF7E	/* Alias for mode_switch */
-#define	XK_ISO_Group_Latch				0xFE06
-#define	XK_ISO_Group_Lock				0xFE07
-#define	XK_ISO_Next_Group				0xFE08
-#define	XK_ISO_Next_Group_Lock				0xFE09
-#define	XK_ISO_Prev_Group				0xFE0A
-#define	XK_ISO_Prev_Group_Lock				0xFE0B
-#define	XK_ISO_First_Group				0xFE0C
-#define	XK_ISO_First_Group_Lock				0xFE0D
-#define	XK_ISO_Last_Group				0xFE0E
-#define	XK_ISO_Last_Group_Lock				0xFE0F
-
-#define	XK_ISO_Left_Tab					0xFE20
-#define	XK_ISO_Move_Line_Up				0xFE21
-#define	XK_ISO_Move_Line_Down				0xFE22
-#define	XK_ISO_Partial_Line_Up				0xFE23
-#define	XK_ISO_Partial_Line_Down			0xFE24
-#define	XK_ISO_Partial_Space_Left			0xFE25
-#define	XK_ISO_Partial_Space_Right			0xFE26
-#define	XK_ISO_Set_Margin_Left				0xFE27
-#define	XK_ISO_Set_Margin_Right				0xFE28
-#define	XK_ISO_Release_Margin_Left			0xFE29
-#define	XK_ISO_Release_Margin_Right			0xFE2A
-#define	XK_ISO_Release_Both_Margins			0xFE2B
-#define	XK_ISO_Fast_Cursor_Left				0xFE2C
-#define	XK_ISO_Fast_Cursor_Right			0xFE2D
-#define	XK_ISO_Fast_Cursor_Up				0xFE2E
-#define	XK_ISO_Fast_Cursor_Down				0xFE2F
-#define	XK_ISO_Continuous_Underline			0xFE30
-#define	XK_ISO_Discontinuous_Underline			0xFE31
-#define	XK_ISO_Emphasize				0xFE32
-#define	XK_ISO_Center_Object				0xFE33
-#define	XK_ISO_Enter					0xFE34
-
-#define	XK_dead_grave					0xFE50
-#define	XK_dead_acute					0xFE51
-#define	XK_dead_circumflex				0xFE52
-#define	XK_dead_tilde					0xFE53
-#define	XK_dead_macron					0xFE54
-#define	XK_dead_breve					0xFE55
-#define	XK_dead_abovedot				0xFE56
-#define	XK_dead_diaeresis				0xFE57
-#define	XK_dead_abovering				0xFE58
-#define	XK_dead_doubleacute				0xFE59
-#define	XK_dead_caron					0xFE5A
-#define	XK_dead_cedilla					0xFE5B
-#define	XK_dead_ogonek					0xFE5C
-#define	XK_dead_iota					0xFE5D
-#define	XK_dead_voiced_sound				0xFE5E
-#define	XK_dead_semivoiced_sound			0xFE5F
-#define	XK_dead_belowdot				0xFE60
-
-#define	XK_First_Virtual_Screen				0xFED0
-#define	XK_Prev_Virtual_Screen				0xFED1
-#define	XK_Next_Virtual_Screen				0xFED2
-#define	XK_Last_Virtual_Screen				0xFED4
-#define	XK_Terminate_Server				0xFED5
-
-#define	XK_AccessX_Enable				0xFE70
-#define	XK_AccessX_Feedback_Enable			0xFE71
-#define	XK_RepeatKeys_Enable				0xFE72
-#define	XK_SlowKeys_Enable				0xFE73
-#define	XK_BounceKeys_Enable				0xFE74
-#define	XK_StickyKeys_Enable				0xFE75
-#define	XK_MouseKeys_Enable				0xFE76
-#define	XK_MouseKeys_Accel_Enable			0xFE77
-#define	XK_Overlay1_Enable				0xFE78
-#define	XK_Overlay2_Enable				0xFE79
-#define	XK_AudibleBell_Enable				0xFE7A
-
-#define	XK_Pointer_Left					0xFEE0
-#define	XK_Pointer_Right				0xFEE1
-#define	XK_Pointer_Up					0xFEE2
-#define	XK_Pointer_Down					0xFEE3
-#define	XK_Pointer_UpLeft				0xFEE4
-#define	XK_Pointer_UpRight				0xFEE5
-#define	XK_Pointer_DownLeft				0xFEE6
-#define	XK_Pointer_DownRight				0xFEE7
-#define	XK_Pointer_Button_Dflt				0xFEE8
-#define	XK_Pointer_Button1				0xFEE9
-#define	XK_Pointer_Button2				0xFEEA
-#define	XK_Pointer_Button3				0xFEEB
-#define	XK_Pointer_Button4				0xFEEC
-#define	XK_Pointer_Button5				0xFEED
-#define	XK_Pointer_DblClick_Dflt			0xFEEE
-#define	XK_Pointer_DblClick1				0xFEEF
-#define	XK_Pointer_DblClick2				0xFEF0
-#define	XK_Pointer_DblClick3				0xFEF1
-#define	XK_Pointer_DblClick4				0xFEF2
-#define	XK_Pointer_DblClick5				0xFEF3
-#define	XK_Pointer_Drag_Dflt				0xFEF4
-#define	XK_Pointer_Drag1				0xFEF5
-#define	XK_Pointer_Drag2				0xFEF6
-#define	XK_Pointer_Drag3				0xFEF7
-#define	XK_Pointer_Drag4				0xFEF8
-#define	XK_Pointer_Drag5				0xFEFD
-
-#define	XK_Pointer_EnableKeys				0xFEF9
-#define	XK_Pointer_Accelerate				0xFEFA
-#define	XK_Pointer_DfltBtnNext				0xFEFB
-#define	XK_Pointer_DfltBtnPrev				0xFEFC
-
-#endif
-
-/*
- * 3270 Terminal Keys
- * Byte 3 = 0xFD
- */
-
-#ifdef XK_3270
-#define XK_3270_Duplicate      0xFD01
-#define XK_3270_FieldMark      0xFD02
-#define XK_3270_Right2         0xFD03
-#define XK_3270_Left2          0xFD04
-#define XK_3270_BackTab        0xFD05
-#define XK_3270_EraseEOF       0xFD06
-#define XK_3270_EraseInput     0xFD07
-#define XK_3270_Reset          0xFD08
-#define XK_3270_Quit           0xFD09
-#define XK_3270_PA1            0xFD0A
-#define XK_3270_PA2            0xFD0B
-#define XK_3270_PA3            0xFD0C
-#define XK_3270_Test           0xFD0D
-#define XK_3270_Attn           0xFD0E
-#define XK_3270_CursorBlink    0xFD0F
-#define XK_3270_AltCursor      0xFD10
-#define XK_3270_KeyClick       0xFD11
-#define XK_3270_Jump           0xFD12
-#define XK_3270_Ident          0xFD13
-#define XK_3270_Rule           0xFD14
-#define XK_3270_Copy           0xFD15
-#define XK_3270_Play           0xFD16
-#define XK_3270_Setup          0xFD17
-#define XK_3270_Record         0xFD18
-#define XK_3270_ChangeScreen   0xFD19
-#define XK_3270_DeleteWord     0xFD1A
-#define XK_3270_ExSelect       0xFD1B
-#define XK_3270_CursorSelect   0xFD1C
-#define XK_3270_PrintScreen    0xFD1D
-#define XK_3270_Enter          0xFD1E
-#endif
-
-/*
- *  Latin 1
- *  Byte 3 = 0
- */
-#ifdef XK_LATIN1
-#define XK_space               0x020
-#define XK_exclam              0x021
-#define XK_quotedbl            0x022
-#define XK_numbersign          0x023
-#define XK_dollar              0x024
-#define XK_percent             0x025
-#define XK_ampersand           0x026
-#define XK_apostrophe          0x027
-#define XK_quoteright          0x027	/* deprecated */
-#define XK_parenleft           0x028
-#define XK_parenright          0x029
-#define XK_asterisk            0x02a
-#define XK_plus                0x02b
-#define XK_comma               0x02c
-#define XK_minus               0x02d
-#define XK_period              0x02e
-#define XK_slash               0x02f
-#define XK_0                   0x030
-#define XK_1                   0x031
-#define XK_2                   0x032
-#define XK_3                   0x033
-#define XK_4                   0x034
-#define XK_5                   0x035
-#define XK_6                   0x036
-#define XK_7                   0x037
-#define XK_8                   0x038
-#define XK_9                   0x039
-#define XK_colon               0x03a
-#define XK_semicolon           0x03b
-#define XK_less                0x03c
-#define XK_equal               0x03d
-#define XK_greater             0x03e
-#define XK_question            0x03f
-#define XK_at                  0x040
-#define XK_A                   0x041
-#define XK_B                   0x042
-#define XK_C                   0x043
-#define XK_D                   0x044
-#define XK_E                   0x045
-#define XK_F                   0x046
-#define XK_G                   0x047
-#define XK_H                   0x048
-#define XK_I                   0x049
-#define XK_J                   0x04a
-#define XK_K                   0x04b
-#define XK_L                   0x04c
-#define XK_M                   0x04d
-#define XK_N                   0x04e
-#define XK_O                   0x04f
-#define XK_P                   0x050
-#define XK_Q                   0x051
-#define XK_R                   0x052
-#define XK_S                   0x053
-#define XK_T                   0x054
-#define XK_U                   0x055
-#define XK_V                   0x056
-#define XK_W                   0x057
-#define XK_X                   0x058
-#define XK_Y                   0x059
-#define XK_Z                   0x05a
-#define XK_bracketleft         0x05b
-#define XK_backslash           0x05c
-#define XK_bracketright        0x05d
-#define XK_asciicircum         0x05e
-#define XK_underscore          0x05f
-#define XK_grave               0x060
-#define XK_quoteleft           0x060	/* deprecated */
-#define XK_a                   0x061
-#define XK_b                   0x062
-#define XK_c                   0x063
-#define XK_d                   0x064
-#define XK_e                   0x065
-#define XK_f                   0x066
-#define XK_g                   0x067
-#define XK_h                   0x068
-#define XK_i                   0x069
-#define XK_j                   0x06a
-#define XK_k                   0x06b
-#define XK_l                   0x06c
-#define XK_m                   0x06d
-#define XK_n                   0x06e
-#define XK_o                   0x06f
-#define XK_p                   0x070
-#define XK_q                   0x071
-#define XK_r                   0x072
-#define XK_s                   0x073
-#define XK_t                   0x074
-#define XK_u                   0x075
-#define XK_v                   0x076
-#define XK_w                   0x077
-#define XK_x                   0x078
-#define XK_y                   0x079
-#define XK_z                   0x07a
-#define XK_braceleft           0x07b
-#define XK_bar                 0x07c
-#define XK_braceright          0x07d
-#define XK_asciitilde          0x07e
-
-#define XK_nobreakspace        0x0a0
-#define XK_exclamdown          0x0a1
-#define XK_cent        	       0x0a2
-#define XK_sterling            0x0a3
-#define XK_currency            0x0a4
-#define XK_yen                 0x0a5
-#define XK_brokenbar           0x0a6
-#define XK_section             0x0a7
-#define XK_diaeresis           0x0a8
-#define XK_copyright           0x0a9
-#define XK_ordfeminine         0x0aa
-#define XK_guillemotleft       0x0ab	/* left angle quotation mark */
-#define XK_notsign             0x0ac
-#define XK_hyphen              0x0ad
-#define XK_registered          0x0ae
-#define XK_macron              0x0af
-#define XK_degree              0x0b0
-#define XK_plusminus           0x0b1
-#define XK_twosuperior         0x0b2
-#define XK_threesuperior       0x0b3
-#define XK_acute               0x0b4
-#define XK_mu                  0x0b5
-#define XK_paragraph           0x0b6
-#define XK_periodcentered      0x0b7
-#define XK_cedilla             0x0b8
-#define XK_onesuperior         0x0b9
-#define XK_masculine           0x0ba
-#define XK_guillemotright      0x0bb	/* right angle quotation mark */
-#define XK_onequarter          0x0bc
-#define XK_onehalf             0x0bd
-#define XK_threequarters       0x0be
-#define XK_questiondown        0x0bf
-#define XK_Agrave              0x0c0
-#define XK_Aacute              0x0c1
-#define XK_Acircumflex         0x0c2
-#define XK_Atilde              0x0c3
-#define XK_Adiaeresis          0x0c4
-#define XK_Aring               0x0c5
-#define XK_AE                  0x0c6
-#define XK_Ccedilla            0x0c7
-#define XK_Egrave              0x0c8
-#define XK_Eacute              0x0c9
-#define XK_Ecircumflex         0x0ca
-#define XK_Ediaeresis          0x0cb
-#define XK_Igrave              0x0cc
-#define XK_Iacute              0x0cd
-#define XK_Icircumflex         0x0ce
-#define XK_Idiaeresis          0x0cf
-#define XK_ETH                 0x0d0
-#define XK_Eth                 0x0d0	/* deprecated */
-#define XK_Ntilde              0x0d1
-#define XK_Ograve              0x0d2
-#define XK_Oacute              0x0d3
-#define XK_Ocircumflex         0x0d4
-#define XK_Otilde              0x0d5
-#define XK_Odiaeresis          0x0d6
-#define XK_multiply            0x0d7
-#define XK_Ooblique            0x0d8
-#define XK_Ugrave              0x0d9
-#define XK_Uacute              0x0da
-#define XK_Ucircumflex         0x0db
-#define XK_Udiaeresis          0x0dc
-#define XK_Yacute              0x0dd
-#define XK_THORN               0x0de
-#define XK_Thorn               0x0de	/* deprecated */
-#define XK_ssharp              0x0df
-#define XK_agrave              0x0e0
-#define XK_aacute              0x0e1
-#define XK_acircumflex         0x0e2
-#define XK_atilde              0x0e3
-#define XK_adiaeresis          0x0e4
-#define XK_aring               0x0e5
-#define XK_ae                  0x0e6
-#define XK_ccedilla            0x0e7
-#define XK_egrave              0x0e8
-#define XK_eacute              0x0e9
-#define XK_ecircumflex         0x0ea
-#define XK_ediaeresis          0x0eb
-#define XK_igrave              0x0ec
-#define XK_iacute              0x0ed
-#define XK_icircumflex         0x0ee
-#define XK_idiaeresis          0x0ef
-#define XK_eth                 0x0f0
-#define XK_ntilde              0x0f1
-#define XK_ograve              0x0f2
-#define XK_oacute              0x0f3
-#define XK_ocircumflex         0x0f4
-#define XK_otilde              0x0f5
-#define XK_odiaeresis          0x0f6
-#define XK_division            0x0f7
-#define XK_oslash              0x0f8
-#define XK_ugrave              0x0f9
-#define XK_uacute              0x0fa
-#define XK_ucircumflex         0x0fb
-#define XK_udiaeresis          0x0fc
-#define XK_yacute              0x0fd
-#define XK_thorn               0x0fe
-#define XK_ydiaeresis          0x0ff
-#endif /* XK_LATIN1 */
-
-/*
- *   Latin 2
- *   Byte 3 = 1
- */
-
-#ifdef XK_LATIN2
-#define XK_Aogonek             0x1a1
-#define XK_breve               0x1a2
-#define XK_Lstroke             0x1a3
-#define XK_Lcaron              0x1a5
-#define XK_Sacute              0x1a6
-#define XK_Scaron              0x1a9
-#define XK_Scedilla            0x1aa
-#define XK_Tcaron              0x1ab
-#define XK_Zacute              0x1ac
-#define XK_Zcaron              0x1ae
-#define XK_Zabovedot           0x1af
-#define XK_aogonek             0x1b1
-#define XK_ogonek              0x1b2
-#define XK_lstroke             0x1b3
-#define XK_lcaron              0x1b5
-#define XK_sacute              0x1b6
-#define XK_caron               0x1b7
-#define XK_scaron              0x1b9
-#define XK_scedilla            0x1ba
-#define XK_tcaron              0x1bb
-#define XK_zacute              0x1bc
-#define XK_doubleacute         0x1bd
-#define XK_zcaron              0x1be
-#define XK_zabovedot           0x1bf
-#define XK_Racute              0x1c0
-#define XK_Abreve              0x1c3
-#define XK_Lacute              0x1c5
-#define XK_Cacute              0x1c6
-#define XK_Ccaron              0x1c8
-#define XK_Eogonek             0x1ca
-#define XK_Ecaron              0x1cc
-#define XK_Dcaron              0x1cf
-#define XK_Dstroke             0x1d0
-#define XK_Nacute              0x1d1
-#define XK_Ncaron              0x1d2
-#define XK_Odoubleacute        0x1d5
-#define XK_Rcaron              0x1d8
-#define XK_Uring               0x1d9
-#define XK_Udoubleacute        0x1db
-#define XK_Tcedilla            0x1de
-#define XK_racute              0x1e0
-#define XK_abreve              0x1e3
-#define XK_lacute              0x1e5
-#define XK_cacute              0x1e6
-#define XK_ccaron              0x1e8
-#define XK_eogonek             0x1ea
-#define XK_ecaron              0x1ec
-#define XK_dcaron              0x1ef
-#define XK_dstroke             0x1f0
-#define XK_nacute              0x1f1
-#define XK_ncaron              0x1f2
-#define XK_odoubleacute        0x1f5
-#define XK_udoubleacute        0x1fb
-#define XK_rcaron              0x1f8
-#define XK_uring               0x1f9
-#define XK_tcedilla            0x1fe
-#define XK_abovedot            0x1ff
-#endif /* XK_LATIN2 */
-
-/*
- *   Latin 3
- *   Byte 3 = 2
- */
-
-#ifdef XK_LATIN3
-#define XK_Hstroke             0x2a1
-#define XK_Hcircumflex         0x2a6
-#define XK_Iabovedot           0x2a9
-#define XK_Gbreve              0x2ab
-#define XK_Jcircumflex         0x2ac
-#define XK_hstroke             0x2b1
-#define XK_hcircumflex         0x2b6
-#define XK_idotless            0x2b9
-#define XK_gbreve              0x2bb
-#define XK_jcircumflex         0x2bc
-#define XK_Cabovedot           0x2c5
-#define XK_Ccircumflex         0x2c6
-#define XK_Gabovedot           0x2d5
-#define XK_Gcircumflex         0x2d8
-#define XK_Ubreve              0x2dd
-#define XK_Scircumflex         0x2de
-#define XK_cabovedot           0x2e5
-#define XK_ccircumflex         0x2e6
-#define XK_gabovedot           0x2f5
-#define XK_gcircumflex         0x2f8
-#define XK_ubreve              0x2fd
-#define XK_scircumflex         0x2fe
-#endif /* XK_LATIN3 */
-
-
-/*
- *   Latin 4
- *   Byte 3 = 3
- */
-
-#ifdef XK_LATIN4
-#define XK_kra                 0x3a2
-#define XK_kappa               0x3a2	/* deprecated */
-#define XK_Rcedilla            0x3a3
-#define XK_Itilde              0x3a5
-#define XK_Lcedilla            0x3a6
-#define XK_Emacron             0x3aa
-#define XK_Gcedilla            0x3ab
-#define XK_Tslash              0x3ac
-#define XK_rcedilla            0x3b3
-#define XK_itilde              0x3b5
-#define XK_lcedilla            0x3b6
-#define XK_emacron             0x3ba
-#define XK_gcedilla            0x3bb
-#define XK_tslash              0x3bc
-#define XK_ENG                 0x3bd
-#define XK_eng                 0x3bf
-#define XK_Amacron             0x3c0
-#define XK_Iogonek             0x3c7
-#define XK_Eabovedot           0x3cc
-#define XK_Imacron             0x3cf
-#define XK_Ncedilla            0x3d1
-#define XK_Omacron             0x3d2
-#define XK_Kcedilla            0x3d3
-#define XK_Uogonek             0x3d9
-#define XK_Utilde              0x3dd
-#define XK_Umacron             0x3de
-#define XK_amacron             0x3e0
-#define XK_iogonek             0x3e7
-#define XK_eabovedot           0x3ec
-#define XK_imacron             0x3ef
-#define XK_ncedilla            0x3f1
-#define XK_omacron             0x3f2
-#define XK_kcedilla            0x3f3
-#define XK_uogonek             0x3f9
-#define XK_utilde              0x3fd
-#define XK_umacron             0x3fe
-#endif /* XK_LATIN4 */
-
-/*
- * Latin-9 (a.k.a. Latin-0)
- * Byte 3 = 19
- */
-
-#ifdef XK_LATIN9
-#define XK_OE                  0x13bc
-#define XK_oe                  0x13bd
-#define XK_Ydiaeresis          0x13be
-#endif /* XK_LATIN9 */
-
-/*
- * Katakana
- * Byte 3 = 4
- */
-
-#ifdef XK_KATAKANA
-#define XK_overline				       0x47e
-#define XK_kana_fullstop                               0x4a1
-#define XK_kana_openingbracket                         0x4a2
-#define XK_kana_closingbracket                         0x4a3
-#define XK_kana_comma                                  0x4a4
-#define XK_kana_conjunctive                            0x4a5
-#define XK_kana_middledot                              0x4a5  /* deprecated */
-#define XK_kana_WO                                     0x4a6
-#define XK_kana_a                                      0x4a7
-#define XK_kana_i                                      0x4a8
-#define XK_kana_u                                      0x4a9
-#define XK_kana_e                                      0x4aa
-#define XK_kana_o                                      0x4ab
-#define XK_kana_ya                                     0x4ac
-#define XK_kana_yu                                     0x4ad
-#define XK_kana_yo                                     0x4ae
-#define XK_kana_tsu                                    0x4af
-#define XK_kana_tu                                     0x4af  /* deprecated */
-#define XK_prolongedsound                              0x4b0
-#define XK_kana_A                                      0x4b1
-#define XK_kana_I                                      0x4b2
-#define XK_kana_U                                      0x4b3
-#define XK_kana_E                                      0x4b4
-#define XK_kana_O                                      0x4b5
-#define XK_kana_KA                                     0x4b6
-#define XK_kana_KI                                     0x4b7
-#define XK_kana_KU                                     0x4b8
-#define XK_kana_KE                                     0x4b9
-#define XK_kana_KO                                     0x4ba
-#define XK_kana_SA                                     0x4bb
-#define XK_kana_SHI                                    0x4bc
-#define XK_kana_SU                                     0x4bd
-#define XK_kana_SE                                     0x4be
-#define XK_kana_SO                                     0x4bf
-#define XK_kana_TA                                     0x4c0
-#define XK_kana_CHI                                    0x4c1
-#define XK_kana_TI                                     0x4c1  /* deprecated */
-#define XK_kana_TSU                                    0x4c2
-#define XK_kana_TU                                     0x4c2  /* deprecated */
-#define XK_kana_TE                                     0x4c3
-#define XK_kana_TO                                     0x4c4
-#define XK_kana_NA                                     0x4c5
-#define XK_kana_NI                                     0x4c6
-#define XK_kana_NU                                     0x4c7
-#define XK_kana_NE                                     0x4c8
-#define XK_kana_NO                                     0x4c9
-#define XK_kana_HA                                     0x4ca
-#define XK_kana_HI                                     0x4cb
-#define XK_kana_FU                                     0x4cc
-#define XK_kana_HU                                     0x4cc  /* deprecated */
-#define XK_kana_HE                                     0x4cd
-#define XK_kana_HO                                     0x4ce
-#define XK_kana_MA                                     0x4cf
-#define XK_kana_MI                                     0x4d0
-#define XK_kana_MU                                     0x4d1
-#define XK_kana_ME                                     0x4d2
-#define XK_kana_MO                                     0x4d3
-#define XK_kana_YA                                     0x4d4
-#define XK_kana_YU                                     0x4d5
-#define XK_kana_YO                                     0x4d6
-#define XK_kana_RA                                     0x4d7
-#define XK_kana_RI                                     0x4d8
-#define XK_kana_RU                                     0x4d9
-#define XK_kana_RE                                     0x4da
-#define XK_kana_RO                                     0x4db
-#define XK_kana_WA                                     0x4dc
-#define XK_kana_N                                      0x4dd
-#define XK_voicedsound                                 0x4de
-#define XK_semivoicedsound                             0x4df
-#define XK_kana_switch          0xFF7E  /* Alias for mode_switch */
-#endif /* XK_KATAKANA */
-
-/*
- *  Arabic
- *  Byte 3 = 5
- */
-
-#ifdef XK_ARABIC
-#define XK_Arabic_comma                                0x5ac
-#define XK_Arabic_semicolon                            0x5bb
-#define XK_Arabic_question_mark                        0x5bf
-#define XK_Arabic_hamza                                0x5c1
-#define XK_Arabic_maddaonalef                          0x5c2
-#define XK_Arabic_hamzaonalef                          0x5c3
-#define XK_Arabic_hamzaonwaw                           0x5c4
-#define XK_Arabic_hamzaunderalef                       0x5c5
-#define XK_Arabic_hamzaonyeh                           0x5c6
-#define XK_Arabic_alef                                 0x5c7
-#define XK_Arabic_beh                                  0x5c8
-#define XK_Arabic_tehmarbuta                           0x5c9
-#define XK_Arabic_teh                                  0x5ca
-#define XK_Arabic_theh                                 0x5cb
-#define XK_Arabic_jeem                                 0x5cc
-#define XK_Arabic_hah                                  0x5cd
-#define XK_Arabic_khah                                 0x5ce
-#define XK_Arabic_dal                                  0x5cf
-#define XK_Arabic_thal                                 0x5d0
-#define XK_Arabic_ra                                   0x5d1
-#define XK_Arabic_zain                                 0x5d2
-#define XK_Arabic_seen                                 0x5d3
-#define XK_Arabic_sheen                                0x5d4
-#define XK_Arabic_sad                                  0x5d5
-#define XK_Arabic_dad                                  0x5d6
-#define XK_Arabic_tah                                  0x5d7
-#define XK_Arabic_zah                                  0x5d8
-#define XK_Arabic_ain                                  0x5d9
-#define XK_Arabic_ghain                                0x5da
-#define XK_Arabic_tatweel                              0x5e0
-#define XK_Arabic_feh                                  0x5e1
-#define XK_Arabic_qaf                                  0x5e2
-#define XK_Arabic_kaf                                  0x5e3
-#define XK_Arabic_lam                                  0x5e4
-#define XK_Arabic_meem                                 0x5e5
-#define XK_Arabic_noon                                 0x5e6
-#define XK_Arabic_ha                                   0x5e7
-#define XK_Arabic_heh                                  0x5e7  /* deprecated */
-#define XK_Arabic_waw                                  0x5e8
-#define XK_Arabic_alefmaksura                          0x5e9
-#define XK_Arabic_yeh                                  0x5ea
-#define XK_Arabic_fathatan                             0x5eb
-#define XK_Arabic_dammatan                             0x5ec
-#define XK_Arabic_kasratan                             0x5ed
-#define XK_Arabic_fatha                                0x5ee
-#define XK_Arabic_damma                                0x5ef
-#define XK_Arabic_kasra                                0x5f0
-#define XK_Arabic_shadda                               0x5f1
-#define XK_Arabic_sukun                                0x5f2
-#define XK_Arabic_switch        0xFF7E  /* Alias for mode_switch */
-#endif /* XK_ARABIC */
-
-/*
- * Cyrillic
- * Byte 3 = 6
- */
-#ifdef XK_CYRILLIC
-#define XK_Serbian_dje                                 0x6a1
-#define XK_Macedonia_gje                               0x6a2
-#define XK_Cyrillic_io                                 0x6a3
-#define XK_Ukrainian_ie                                0x6a4
-#define XK_Ukranian_je                                 0x6a4  /* deprecated */
-#define XK_Macedonia_dse                               0x6a5
-#define XK_Ukrainian_i                                 0x6a6
-#define XK_Ukranian_i                                  0x6a6  /* deprecated */
-#define XK_Ukrainian_yi                                0x6a7
-#define XK_Ukranian_yi                                 0x6a7  /* deprecated */
-#define XK_Cyrillic_je                                 0x6a8
-#define XK_Serbian_je                                  0x6a8  /* deprecated */
-#define XK_Cyrillic_lje                                0x6a9
-#define XK_Serbian_lje                                 0x6a9  /* deprecated */
-#define XK_Cyrillic_nje                                0x6aa
-#define XK_Serbian_nje                                 0x6aa  /* deprecated */
-#define XK_Serbian_tshe                                0x6ab
-#define XK_Macedonia_kje                               0x6ac
-#define XK_Byelorussian_shortu                         0x6ae
-#define XK_Cyrillic_dzhe                               0x6af
-#define XK_Serbian_dze                                 0x6af  /* deprecated */
-#define XK_numerosign                                  0x6b0
-#define XK_Serbian_DJE                                 0x6b1
-#define XK_Macedonia_GJE                               0x6b2
-#define XK_Cyrillic_IO                                 0x6b3
-#define XK_Ukrainian_IE                                0x6b4
-#define XK_Ukranian_JE                                 0x6b4  /* deprecated */
-#define XK_Macedonia_DSE                               0x6b5
-#define XK_Ukrainian_I                                 0x6b6
-#define XK_Ukranian_I                                  0x6b6  /* deprecated */
-#define XK_Ukrainian_YI                                0x6b7
-#define XK_Ukranian_YI                                 0x6b7  /* deprecated */
-#define XK_Cyrillic_JE                                 0x6b8
-#define XK_Serbian_JE                                  0x6b8  /* deprecated */
-#define XK_Cyrillic_LJE                                0x6b9
-#define XK_Serbian_LJE                                 0x6b9  /* deprecated */
-#define XK_Cyrillic_NJE                                0x6ba
-#define XK_Serbian_NJE                                 0x6ba  /* deprecated */
-#define XK_Serbian_TSHE                                0x6bb
-#define XK_Macedonia_KJE                               0x6bc
-#define XK_Byelorussian_SHORTU                         0x6be
-#define XK_Cyrillic_DZHE                               0x6bf
-#define XK_Serbian_DZE                                 0x6bf  /* deprecated */
-#define XK_Cyrillic_yu                                 0x6c0
-#define XK_Cyrillic_a                                  0x6c1
-#define XK_Cyrillic_be                                 0x6c2
-#define XK_Cyrillic_tse                                0x6c3
-#define XK_Cyrillic_de                                 0x6c4
-#define XK_Cyrillic_ie                                 0x6c5
-#define XK_Cyrillic_ef                                 0x6c6
-#define XK_Cyrillic_ghe                                0x6c7
-#define XK_Cyrillic_ha                                 0x6c8
-#define XK_Cyrillic_i                                  0x6c9
-#define XK_Cyrillic_shorti                             0x6ca
-#define XK_Cyrillic_ka                                 0x6cb
-#define XK_Cyrillic_el                                 0x6cc
-#define XK_Cyrillic_em                                 0x6cd
-#define XK_Cyrillic_en                                 0x6ce
-#define XK_Cyrillic_o                                  0x6cf
-#define XK_Cyrillic_pe                                 0x6d0
-#define XK_Cyrillic_ya                                 0x6d1
-#define XK_Cyrillic_er                                 0x6d2
-#define XK_Cyrillic_es                                 0x6d3
-#define XK_Cyrillic_te                                 0x6d4
-#define XK_Cyrillic_u                                  0x6d5
-#define XK_Cyrillic_zhe                                0x6d6
-#define XK_Cyrillic_ve                                 0x6d7
-#define XK_Cyrillic_softsign                           0x6d8
-#define XK_Cyrillic_yeru                               0x6d9
-#define XK_Cyrillic_ze                                 0x6da
-#define XK_Cyrillic_sha                                0x6db
-#define XK_Cyrillic_e                                  0x6dc
-#define XK_Cyrillic_shcha                              0x6dd
-#define XK_Cyrillic_che                                0x6de
-#define XK_Cyrillic_hardsign                           0x6df
-#define XK_Cyrillic_YU                                 0x6e0
-#define XK_Cyrillic_A                                  0x6e1
-#define XK_Cyrillic_BE                                 0x6e2
-#define XK_Cyrillic_TSE                                0x6e3
-#define XK_Cyrillic_DE                                 0x6e4
-#define XK_Cyrillic_IE                                 0x6e5
-#define XK_Cyrillic_EF                                 0x6e6
-#define XK_Cyrillic_GHE                                0x6e7
-#define XK_Cyrillic_HA                                 0x6e8
-#define XK_Cyrillic_I                                  0x6e9
-#define XK_Cyrillic_SHORTI                             0x6ea
-#define XK_Cyrillic_KA                                 0x6eb
-#define XK_Cyrillic_EL                                 0x6ec
-#define XK_Cyrillic_EM                                 0x6ed
-#define XK_Cyrillic_EN                                 0x6ee
-#define XK_Cyrillic_O                                  0x6ef
-#define XK_Cyrillic_PE                                 0x6f0
-#define XK_Cyrillic_YA                                 0x6f1
-#define XK_Cyrillic_ER                                 0x6f2
-#define XK_Cyrillic_ES                                 0x6f3
-#define XK_Cyrillic_TE                                 0x6f4
-#define XK_Cyrillic_U                                  0x6f5
-#define XK_Cyrillic_ZHE                                0x6f6
-#define XK_Cyrillic_VE                                 0x6f7
-#define XK_Cyrillic_SOFTSIGN                           0x6f8
-#define XK_Cyrillic_YERU                               0x6f9
-#define XK_Cyrillic_ZE                                 0x6fa
-#define XK_Cyrillic_SHA                                0x6fb
-#define XK_Cyrillic_E                                  0x6fc
-#define XK_Cyrillic_SHCHA                              0x6fd
-#define XK_Cyrillic_CHE                                0x6fe
-#define XK_Cyrillic_HARDSIGN                           0x6ff
-#endif /* XK_CYRILLIC */
-
-/*
- * Greek
- * Byte 3 = 7
- */
-
-#ifdef XK_GREEK
-#define XK_Greek_ALPHAaccent                           0x7a1
-#define XK_Greek_EPSILONaccent                         0x7a2
-#define XK_Greek_ETAaccent                             0x7a3
-#define XK_Greek_IOTAaccent                            0x7a4
-#define XK_Greek_IOTAdiaeresis                         0x7a5
-#define XK_Greek_OMICRONaccent                         0x7a7
-#define XK_Greek_UPSILONaccent                         0x7a8
-#define XK_Greek_UPSILONdieresis                       0x7a9
-#define XK_Greek_OMEGAaccent                           0x7ab
-#define XK_Greek_accentdieresis                        0x7ae
-#define XK_Greek_horizbar                              0x7af
-#define XK_Greek_alphaaccent                           0x7b1
-#define XK_Greek_epsilonaccent                         0x7b2
-#define XK_Greek_etaaccent                             0x7b3
-#define XK_Greek_iotaaccent                            0x7b4
-#define XK_Greek_iotadieresis                          0x7b5
-#define XK_Greek_iotaaccentdieresis                    0x7b6
-#define XK_Greek_omicronaccent                         0x7b7
-#define XK_Greek_upsilonaccent                         0x7b8
-#define XK_Greek_upsilondieresis                       0x7b9
-#define XK_Greek_upsilonaccentdieresis                 0x7ba
-#define XK_Greek_omegaaccent                           0x7bb
-#define XK_Greek_ALPHA                                 0x7c1
-#define XK_Greek_BETA                                  0x7c2
-#define XK_Greek_GAMMA                                 0x7c3
-#define XK_Greek_DELTA                                 0x7c4
-#define XK_Greek_EPSILON                               0x7c5
-#define XK_Greek_ZETA                                  0x7c6
-#define XK_Greek_ETA                                   0x7c7
-#define XK_Greek_THETA                                 0x7c8
-#define XK_Greek_IOTA                                  0x7c9
-#define XK_Greek_KAPPA                                 0x7ca
-#define XK_Greek_LAMDA                                 0x7cb
-#define XK_Greek_LAMBDA                                0x7cb
-#define XK_Greek_MU                                    0x7cc
-#define XK_Greek_NU                                    0x7cd
-#define XK_Greek_XI                                    0x7ce
-#define XK_Greek_OMICRON                               0x7cf
-#define XK_Greek_PI                                    0x7d0
-#define XK_Greek_RHO                                   0x7d1
-#define XK_Greek_SIGMA                                 0x7d2
-#define XK_Greek_TAU                                   0x7d4
-#define XK_Greek_UPSILON                               0x7d5
-#define XK_Greek_PHI                                   0x7d6
-#define XK_Greek_CHI                                   0x7d7
-#define XK_Greek_PSI                                   0x7d8
-#define XK_Greek_OMEGA                                 0x7d9
-#define XK_Greek_alpha                                 0x7e1
-#define XK_Greek_beta                                  0x7e2
-#define XK_Greek_gamma                                 0x7e3
-#define XK_Greek_delta                                 0x7e4
-#define XK_Greek_epsilon                               0x7e5
-#define XK_Greek_zeta                                  0x7e6
-#define XK_Greek_eta                                   0x7e7
-#define XK_Greek_theta                                 0x7e8
-#define XK_Greek_iota                                  0x7e9
-#define XK_Greek_kappa                                 0x7ea
-#define XK_Greek_lamda                                 0x7eb
-#define XK_Greek_lambda                                0x7eb
-#define XK_Greek_mu                                    0x7ec
-#define XK_Greek_nu                                    0x7ed
-#define XK_Greek_xi                                    0x7ee
-#define XK_Greek_omicron                               0x7ef
-#define XK_Greek_pi                                    0x7f0
-#define XK_Greek_rho                                   0x7f1
-#define XK_Greek_sigma                                 0x7f2
-#define XK_Greek_finalsmallsigma                       0x7f3
-#define XK_Greek_tau                                   0x7f4
-#define XK_Greek_upsilon                               0x7f5
-#define XK_Greek_phi                                   0x7f6
-#define XK_Greek_chi                                   0x7f7
-#define XK_Greek_psi                                   0x7f8
-#define XK_Greek_omega                                 0x7f9
-#define XK_Greek_switch         0xFF7E  /* Alias for mode_switch */
-#endif /* XK_GREEK */
-
-/*
- * Technical
- * Byte 3 = 8
- */
-
-#ifdef XK_TECHNICAL
-#define XK_leftradical                                 0x8a1
-#define XK_topleftradical                              0x8a2
-#define XK_horizconnector                              0x8a3
-#define XK_topintegral                                 0x8a4
-#define XK_botintegral                                 0x8a5
-#define XK_vertconnector                               0x8a6
-#define XK_topleftsqbracket                            0x8a7
-#define XK_botleftsqbracket                            0x8a8
-#define XK_toprightsqbracket                           0x8a9
-#define XK_botrightsqbracket                           0x8aa
-#define XK_topleftparens                               0x8ab
-#define XK_botleftparens                               0x8ac
-#define XK_toprightparens                              0x8ad
-#define XK_botrightparens                              0x8ae
-#define XK_leftmiddlecurlybrace                        0x8af
-#define XK_rightmiddlecurlybrace                       0x8b0
-#define XK_topleftsummation                            0x8b1
-#define XK_botleftsummation                            0x8b2
-#define XK_topvertsummationconnector                   0x8b3
-#define XK_botvertsummationconnector                   0x8b4
-#define XK_toprightsummation                           0x8b5
-#define XK_botrightsummation                           0x8b6
-#define XK_rightmiddlesummation                        0x8b7
-#define XK_lessthanequal                               0x8bc
-#define XK_notequal                                    0x8bd
-#define XK_greaterthanequal                            0x8be
-#define XK_integral                                    0x8bf
-#define XK_therefore                                   0x8c0
-#define XK_variation                                   0x8c1
-#define XK_infinity                                    0x8c2
-#define XK_nabla                                       0x8c5
-#define XK_approximate                                 0x8c8
-#define XK_similarequal                                0x8c9
-#define XK_ifonlyif                                    0x8cd
-#define XK_implies                                     0x8ce
-#define XK_identical                                   0x8cf
-#define XK_radical                                     0x8d6
-#define XK_includedin                                  0x8da
-#define XK_includes                                    0x8db
-#define XK_intersection                                0x8dc
-#define XK_union                                       0x8dd
-#define XK_logicaland                                  0x8de
-#define XK_logicalor                                   0x8df
-#define XK_partialderivative                           0x8ef
-#define XK_function                                    0x8f6
-#define XK_leftarrow                                   0x8fb
-#define XK_uparrow                                     0x8fc
-#define XK_rightarrow                                  0x8fd
-#define XK_downarrow                                   0x8fe
-#endif /* XK_TECHNICAL */
-
-/*
- *  Special
- *  Byte 3 = 9
- */
-
-#ifdef XK_SPECIAL
-#define XK_blank                                       0x9df
-#define XK_soliddiamond                                0x9e0
-#define XK_checkerboard                                0x9e1
-#define XK_ht                                          0x9e2
-#define XK_ff                                          0x9e3
-#define XK_cr                                          0x9e4
-#define XK_lf                                          0x9e5
-#define XK_nl                                          0x9e8
-#define XK_vt                                          0x9e9
-#define XK_lowrightcorner                              0x9ea
-#define XK_uprightcorner                               0x9eb
-#define XK_upleftcorner                                0x9ec
-#define XK_lowleftcorner                               0x9ed
-#define XK_crossinglines                               0x9ee
-#define XK_horizlinescan1                              0x9ef
-#define XK_horizlinescan3                              0x9f0
-#define XK_horizlinescan5                              0x9f1
-#define XK_horizlinescan7                              0x9f2
-#define XK_horizlinescan9                              0x9f3
-#define XK_leftt                                       0x9f4
-#define XK_rightt                                      0x9f5
-#define XK_bott                                        0x9f6
-#define XK_topt                                        0x9f7
-#define XK_vertbar                                     0x9f8
-#endif /* XK_SPECIAL */
-
-/*
- *  Publishing
- *  Byte 3 = a
- */
-
-#ifdef XK_PUBLISHING
-#define XK_emspace                                     0xaa1
-#define XK_enspace                                     0xaa2
-#define XK_em3space                                    0xaa3
-#define XK_em4space                                    0xaa4
-#define XK_digitspace                                  0xaa5
-#define XK_punctspace                                  0xaa6
-#define XK_thinspace                                   0xaa7
-#define XK_hairspace                                   0xaa8
-#define XK_emdash                                      0xaa9
-#define XK_endash                                      0xaaa
-#define XK_signifblank                                 0xaac
-#define XK_ellipsis                                    0xaae
-#define XK_doubbaselinedot                             0xaaf
-#define XK_onethird                                    0xab0
-#define XK_twothirds                                   0xab1
-#define XK_onefifth                                    0xab2
-#define XK_twofifths                                   0xab3
-#define XK_threefifths                                 0xab4
-#define XK_fourfifths                                  0xab5
-#define XK_onesixth                                    0xab6
-#define XK_fivesixths                                  0xab7
-#define XK_careof                                      0xab8
-#define XK_figdash                                     0xabb
-#define XK_leftanglebracket                            0xabc
-#define XK_decimalpoint                                0xabd
-#define XK_rightanglebracket                           0xabe
-#define XK_marker                                      0xabf
-#define XK_oneeighth                                   0xac3
-#define XK_threeeighths                                0xac4
-#define XK_fiveeighths                                 0xac5
-#define XK_seveneighths                                0xac6
-#define XK_trademark                                   0xac9
-#define XK_signaturemark                               0xaca
-#define XK_trademarkincircle                           0xacb
-#define XK_leftopentriangle                            0xacc
-#define XK_rightopentriangle                           0xacd
-#define XK_emopencircle                                0xace
-#define XK_emopenrectangle                             0xacf
-#define XK_leftsinglequotemark                         0xad0
-#define XK_rightsinglequotemark                        0xad1
-#define XK_leftdoublequotemark                         0xad2
-#define XK_rightdoublequotemark                        0xad3
-#define XK_prescription                                0xad4
-#define XK_minutes                                     0xad6
-#define XK_seconds                                     0xad7
-#define XK_latincross                                  0xad9
-#define XK_hexagram                                    0xada
-#define XK_filledrectbullet                            0xadb
-#define XK_filledlefttribullet                         0xadc
-#define XK_filledrighttribullet                        0xadd
-#define XK_emfilledcircle                              0xade
-#define XK_emfilledrect                                0xadf
-#define XK_enopencircbullet                            0xae0
-#define XK_enopensquarebullet                          0xae1
-#define XK_openrectbullet                              0xae2
-#define XK_opentribulletup                             0xae3
-#define XK_opentribulletdown                           0xae4
-#define XK_openstar                                    0xae5
-#define XK_enfilledcircbullet                          0xae6
-#define XK_enfilledsqbullet                            0xae7
-#define XK_filledtribulletup                           0xae8
-#define XK_filledtribulletdown                         0xae9
-#define XK_leftpointer                                 0xaea
-#define XK_rightpointer                                0xaeb
-#define XK_club                                        0xaec
-#define XK_diamond                                     0xaed
-#define XK_heart                                       0xaee
-#define XK_maltesecross                                0xaf0
-#define XK_dagger                                      0xaf1
-#define XK_doubledagger                                0xaf2
-#define XK_checkmark                                   0xaf3
-#define XK_ballotcross                                 0xaf4
-#define XK_musicalsharp                                0xaf5
-#define XK_musicalflat                                 0xaf6
-#define XK_malesymbol                                  0xaf7
-#define XK_femalesymbol                                0xaf8
-#define XK_telephone                                   0xaf9
-#define XK_telephonerecorder                           0xafa
-#define XK_phonographcopyright                         0xafb
-#define XK_caret                                       0xafc
-#define XK_singlelowquotemark                          0xafd
-#define XK_doublelowquotemark                          0xafe
-#define XK_cursor                                      0xaff
-#endif /* XK_PUBLISHING */
-
-/*
- *  APL
- *  Byte 3 = b
- */
-
-#ifdef XK_APL
-#define XK_leftcaret                                   0xba3
-#define XK_rightcaret                                  0xba6
-#define XK_downcaret                                   0xba8
-#define XK_upcaret                                     0xba9
-#define XK_overbar                                     0xbc0
-#define XK_downtack                                    0xbc2
-#define XK_upshoe                                      0xbc3
-#define XK_downstile                                   0xbc4
-#define XK_underbar                                    0xbc6
-#define XK_jot                                         0xbca
-#define XK_quad                                        0xbcc
-#define XK_uptack                                      0xbce
-#define XK_circle                                      0xbcf
-#define XK_upstile                                     0xbd3
-#define XK_downshoe                                    0xbd6
-#define XK_rightshoe                                   0xbd8
-#define XK_leftshoe                                    0xbda
-#define XK_lefttack                                    0xbdc
-#define XK_righttack                                   0xbfc
-#endif /* XK_APL */
-
-/*
- * Hebrew
- * Byte 3 = c
- */
-
-#ifdef XK_HEBREW
-#define XK_hebrew_doublelowline                        0xcdf
-#define XK_hebrew_aleph                                0xce0
-#define XK_hebrew_bet                                  0xce1
-#define XK_hebrew_beth                                 0xce1  /* deprecated */
-#define XK_hebrew_gimel                                0xce2
-#define XK_hebrew_gimmel                               0xce2  /* deprecated */
-#define XK_hebrew_dalet                                0xce3
-#define XK_hebrew_daleth                               0xce3  /* deprecated */
-#define XK_hebrew_he                                   0xce4
-#define XK_hebrew_waw                                  0xce5
-#define XK_hebrew_zain                                 0xce6
-#define XK_hebrew_zayin                                0xce6  /* deprecated */
-#define XK_hebrew_chet                                 0xce7
-#define XK_hebrew_het                                  0xce7  /* deprecated */
-#define XK_hebrew_tet                                  0xce8
-#define XK_hebrew_teth                                 0xce8  /* deprecated */
-#define XK_hebrew_yod                                  0xce9
-#define XK_hebrew_finalkaph                            0xcea
-#define XK_hebrew_kaph                                 0xceb
-#define XK_hebrew_lamed                                0xcec
-#define XK_hebrew_finalmem                             0xced
-#define XK_hebrew_mem                                  0xcee
-#define XK_hebrew_finalnun                             0xcef
-#define XK_hebrew_nun                                  0xcf0
-#define XK_hebrew_samech                               0xcf1
-#define XK_hebrew_samekh                               0xcf1  /* deprecated */
-#define XK_hebrew_ayin                                 0xcf2
-#define XK_hebrew_finalpe                              0xcf3
-#define XK_hebrew_pe                                   0xcf4
-#define XK_hebrew_finalzade                            0xcf5
-#define XK_hebrew_finalzadi                            0xcf5  /* deprecated */
-#define XK_hebrew_zade                                 0xcf6
-#define XK_hebrew_zadi                                 0xcf6  /* deprecated */
-#define XK_hebrew_qoph                                 0xcf7
-#define XK_hebrew_kuf                                  0xcf7  /* deprecated */
-#define XK_hebrew_resh                                 0xcf8
-#define XK_hebrew_shin                                 0xcf9
-#define XK_hebrew_taw                                  0xcfa
-#define XK_hebrew_taf                                  0xcfa  /* deprecated */
-#define XK_Hebrew_switch        0xFF7E  /* Alias for mode_switch */
-#endif /* XK_HEBREW */
-
-/*
- * Thai
- * Byte 3 = d
- */
-
-#ifdef XK_THAI
-#define XK_Thai_kokai					0xda1
-#define XK_Thai_khokhai					0xda2
-#define XK_Thai_khokhuat				0xda3
-#define XK_Thai_khokhwai				0xda4
-#define XK_Thai_khokhon					0xda5
-#define XK_Thai_khorakhang			        0xda6  
-#define XK_Thai_ngongu					0xda7  
-#define XK_Thai_chochan					0xda8  
-#define XK_Thai_choching				0xda9   
-#define XK_Thai_chochang				0xdaa  
-#define XK_Thai_soso					0xdab
-#define XK_Thai_chochoe					0xdac
-#define XK_Thai_yoying					0xdad
-#define XK_Thai_dochada					0xdae
-#define XK_Thai_topatak					0xdaf
-#define XK_Thai_thothan					0xdb0
-#define XK_Thai_thonangmontho			        0xdb1
-#define XK_Thai_thophuthao			        0xdb2
-#define XK_Thai_nonen					0xdb3
-#define XK_Thai_dodek					0xdb4
-#define XK_Thai_totao					0xdb5
-#define XK_Thai_thothung				0xdb6
-#define XK_Thai_thothahan				0xdb7
-#define XK_Thai_thothong	 			0xdb8
-#define XK_Thai_nonu					0xdb9
-#define XK_Thai_bobaimai				0xdba
-#define XK_Thai_popla					0xdbb
-#define XK_Thai_phophung				0xdbc
-#define XK_Thai_fofa					0xdbd
-#define XK_Thai_phophan					0xdbe
-#define XK_Thai_fofan					0xdbf
-#define XK_Thai_phosamphao			        0xdc0
-#define XK_Thai_moma					0xdc1
-#define XK_Thai_yoyak					0xdc2
-#define XK_Thai_rorua					0xdc3
-#define XK_Thai_ru					0xdc4
-#define XK_Thai_loling					0xdc5
-#define XK_Thai_lu					0xdc6
-#define XK_Thai_wowaen					0xdc7
-#define XK_Thai_sosala					0xdc8
-#define XK_Thai_sorusi					0xdc9
-#define XK_Thai_sosua					0xdca
-#define XK_Thai_hohip					0xdcb
-#define XK_Thai_lochula					0xdcc
-#define XK_Thai_oang					0xdcd
-#define XK_Thai_honokhuk				0xdce
-#define XK_Thai_paiyannoi				0xdcf
-#define XK_Thai_saraa					0xdd0
-#define XK_Thai_maihanakat				0xdd1
-#define XK_Thai_saraaa					0xdd2
-#define XK_Thai_saraam					0xdd3
-#define XK_Thai_sarai					0xdd4   
-#define XK_Thai_saraii					0xdd5   
-#define XK_Thai_saraue					0xdd6    
-#define XK_Thai_sarauee					0xdd7    
-#define XK_Thai_sarau					0xdd8    
-#define XK_Thai_sarauu					0xdd9   
-#define XK_Thai_phinthu					0xdda
-#define XK_Thai_maihanakat_maitho   			0xdde
-#define XK_Thai_baht					0xddf
-#define XK_Thai_sarae					0xde0    
-#define XK_Thai_saraae					0xde1
-#define XK_Thai_sarao					0xde2
-#define XK_Thai_saraaimaimuan				0xde3   
-#define XK_Thai_saraaimaimalai				0xde4  
-#define XK_Thai_lakkhangyao				0xde5
-#define XK_Thai_maiyamok				0xde6
-#define XK_Thai_maitaikhu				0xde7
-#define XK_Thai_maiek					0xde8   
-#define XK_Thai_maitho					0xde9
-#define XK_Thai_maitri					0xdea
-#define XK_Thai_maichattawa				0xdeb
-#define XK_Thai_thanthakhat				0xdec
-#define XK_Thai_nikhahit				0xded
-#define XK_Thai_leksun					0xdf0 
-#define XK_Thai_leknung					0xdf1  
-#define XK_Thai_leksong					0xdf2 
-#define XK_Thai_leksam					0xdf3
-#define XK_Thai_leksi					0xdf4  
-#define XK_Thai_lekha					0xdf5  
-#define XK_Thai_lekhok					0xdf6  
-#define XK_Thai_lekchet					0xdf7  
-#define XK_Thai_lekpaet					0xdf8  
-#define XK_Thai_lekkao					0xdf9 
-#endif /* XK_THAI */
-
-/*
- *   Korean
- *   Byte 3 = e
- */
-
-#ifdef XK_KOREAN
-
-#define XK_Hangul		0xff31    /* Hangul start/stop(toggle) */
-#define XK_Hangul_Start		0xff32    /* Hangul start */
-#define XK_Hangul_End		0xff33    /* Hangul end, English start */
-#define XK_Hangul_Hanja		0xff34    /* Start Hangul->Hanja Conversion */
-#define XK_Hangul_Jamo		0xff35    /* Hangul Jamo mode */
-#define XK_Hangul_Romaja	0xff36    /* Hangul Romaja mode */
-#define XK_Hangul_Codeinput	0xff37    /* Hangul code input mode */
-#define XK_Hangul_Jeonja	0xff38    /* Jeonja mode */
-#define XK_Hangul_Banja		0xff39    /* Banja mode */
-#define XK_Hangul_PreHanja	0xff3a    /* Pre Hanja conversion */
-#define XK_Hangul_PostHanja	0xff3b    /* Post Hanja conversion */
-#define XK_Hangul_SingleCandidate	0xff3c    /* Single candidate */
-#define XK_Hangul_MultipleCandidate	0xff3d    /* Multiple candidate */
-#define XK_Hangul_PreviousCandidate	0xff3e    /* Previous candidate */
-#define XK_Hangul_Special	0xff3f    /* Special symbols */
-#define XK_Hangul_switch	0xFF7E    /* Alias for mode_switch */
-
-/* Hangul Consonant Characters */
-#define XK_Hangul_Kiyeog				0xea1
-#define XK_Hangul_SsangKiyeog				0xea2
-#define XK_Hangul_KiyeogSios				0xea3
-#define XK_Hangul_Nieun					0xea4
-#define XK_Hangul_NieunJieuj				0xea5
-#define XK_Hangul_NieunHieuh				0xea6
-#define XK_Hangul_Dikeud				0xea7
-#define XK_Hangul_SsangDikeud				0xea8
-#define XK_Hangul_Rieul					0xea9
-#define XK_Hangul_RieulKiyeog				0xeaa
-#define XK_Hangul_RieulMieum				0xeab
-#define XK_Hangul_RieulPieub				0xeac
-#define XK_Hangul_RieulSios				0xead
-#define XK_Hangul_RieulTieut				0xeae
-#define XK_Hangul_RieulPhieuf				0xeaf
-#define XK_Hangul_RieulHieuh				0xeb0
-#define XK_Hangul_Mieum					0xeb1
-#define XK_Hangul_Pieub					0xeb2
-#define XK_Hangul_SsangPieub				0xeb3
-#define XK_Hangul_PieubSios				0xeb4
-#define XK_Hangul_Sios					0xeb5
-#define XK_Hangul_SsangSios				0xeb6
-#define XK_Hangul_Ieung					0xeb7
-#define XK_Hangul_Jieuj					0xeb8
-#define XK_Hangul_SsangJieuj				0xeb9
-#define XK_Hangul_Cieuc					0xeba
-#define XK_Hangul_Khieuq				0xebb
-#define XK_Hangul_Tieut					0xebc
-#define XK_Hangul_Phieuf				0xebd
-#define XK_Hangul_Hieuh					0xebe
-
-/* Hangul Vowel Characters */
-#define XK_Hangul_A					0xebf
-#define XK_Hangul_AE					0xec0
-#define XK_Hangul_YA					0xec1
-#define XK_Hangul_YAE					0xec2
-#define XK_Hangul_EO					0xec3
-#define XK_Hangul_E					0xec4
-#define XK_Hangul_YEO					0xec5
-#define XK_Hangul_YE					0xec6
-#define XK_Hangul_O					0xec7
-#define XK_Hangul_WA					0xec8
-#define XK_Hangul_WAE					0xec9
-#define XK_Hangul_OE					0xeca
-#define XK_Hangul_YO					0xecb
-#define XK_Hangul_U					0xecc
-#define XK_Hangul_WEO					0xecd
-#define XK_Hangul_WE					0xece
-#define XK_Hangul_WI					0xecf
-#define XK_Hangul_YU					0xed0
-#define XK_Hangul_EU					0xed1
-#define XK_Hangul_YI					0xed2
-#define XK_Hangul_I					0xed3
-
-/* Hangul syllable-final (JongSeong) Characters */
-#define XK_Hangul_J_Kiyeog				0xed4
-#define XK_Hangul_J_SsangKiyeog				0xed5
-#define XK_Hangul_J_KiyeogSios				0xed6
-#define XK_Hangul_J_Nieun				0xed7
-#define XK_Hangul_J_NieunJieuj				0xed8
-#define XK_Hangul_J_NieunHieuh				0xed9
-#define XK_Hangul_J_Dikeud				0xeda
-#define XK_Hangul_J_Rieul				0xedb
-#define XK_Hangul_J_RieulKiyeog				0xedc
-#define XK_Hangul_J_RieulMieum				0xedd
-#define XK_Hangul_J_RieulPieub				0xede
-#define XK_Hangul_J_RieulSios				0xedf
-#define XK_Hangul_J_RieulTieut				0xee0
-#define XK_Hangul_J_RieulPhieuf				0xee1
-#define XK_Hangul_J_RieulHieuh				0xee2
-#define XK_Hangul_J_Mieum				0xee3
-#define XK_Hangul_J_Pieub				0xee4
-#define XK_Hangul_J_PieubSios				0xee5
-#define XK_Hangul_J_Sios				0xee6
-#define XK_Hangul_J_SsangSios				0xee7
-#define XK_Hangul_J_Ieung				0xee8
-#define XK_Hangul_J_Jieuj				0xee9
-#define XK_Hangul_J_Cieuc				0xeea
-#define XK_Hangul_J_Khieuq				0xeeb
-#define XK_Hangul_J_Tieut				0xeec
-#define XK_Hangul_J_Phieuf				0xeed
-#define XK_Hangul_J_Hieuh				0xeee
-
-/* Ancient Hangul Consonant Characters */
-#define XK_Hangul_RieulYeorinHieuh			0xeef
-#define XK_Hangul_SunkyeongeumMieum			0xef0
-#define XK_Hangul_SunkyeongeumPieub			0xef1
-#define XK_Hangul_PanSios				0xef2
-#define XK_Hangul_KkogjiDalrinIeung			0xef3
-#define XK_Hangul_SunkyeongeumPhieuf			0xef4
-#define XK_Hangul_YeorinHieuh				0xef5
-
-/* Ancient Hangul Vowel Characters */
-#define XK_Hangul_AraeA					0xef6
-#define XK_Hangul_AraeAE				0xef7
-
-/* Ancient Hangul syllable-final (JongSeong) Characters */
-#define XK_Hangul_J_PanSios				0xef8
-#define XK_Hangul_J_KkogjiDalrinIeung			0xef9
-#define XK_Hangul_J_YeorinHieuh				0xefa
-
-/* Korean currency symbol */
-#define XK_Korean_Won					0xeff
-
-#endif /* XK_KOREAN */
-
-#ifdef XK_CURRENCY
-#define XK_EcuSign					0x20a0
-#define XK_ColonSign					0x20a1
-#define XK_CruzeiroSign					0x20a2
-#define XK_FFrancSign					0x20a3
-#define XK_LiraSign					0x20a4
-#define XK_MillSign					0x20a5
-#define XK_NairaSign					0x20a6
-#define XK_PesetaSign					0x20a7
-#define XK_RupeeSign					0x20a8
-#define XK_WonSign					0x20a9
-#define XK_NewSheqelSign				0x20aa
-#define XK_DongSign					0x20ab
-#define XK_EuroSign					0x20ac
-#endif
diff --git a/ica/win32/winvnc/winvnc/minmax.h b/ica/win32/winvnc/winvnc/minmax.h
deleted file mode 100644
index 8715826..0000000
--- a/ica/win32/winvnc/winvnc/minmax.h
+++ /dev/null
@@ -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 at 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
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/read_write_ini.cpp b/ica/win32/winvnc/winvnc/read_write_ini.cpp
deleted file mode 100644
index 1ba0da0..0000000
--- a/ica/win32/winvnc/winvnc/read_write_ini.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "inifile.h"
-DWORD MessageBoxSecure(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);
-
-bool do_copy (IniFile& myIniFile_In, IniFile& myIniFile_Out)
-{
-
-TCHAR *group1=new char[150];
-TCHAR *group2=new char[150];
-TCHAR *group3=new char[150];
-BOOL BUseRegistry;
-LONG MSLogonRequired;
-LONG NewMSLogon;
-LONG locdom1;
-LONG locdom2;
-LONG locdom3;
-LONG DebugMode;
-LONG Avilog;
-LONG DebugLevel;
-LONG DisableTrayIcon;
-LONG LoopbackOnly;
-LONG UseDSMPlugin;
-LONG AllowLoopback;
-LONG AuthRequired;
-LONG ConnectPriority;
-
-char DSMPlugin[128];
-char *authhosts=new char[150];
-
-LONG AllowShutdown=1;
-LONG AllowProperties=1;
-LONG AllowEditClients=1;
-
-LONG FileTransferEnabled=0;
-LONG FTUserImpersonation=1;
-LONG BlankMonitorEnabled=1;
-LONG BlankInputsOnly=0; //PGM
-LONG DefaultScale=1;
-LONG CaptureAlphaBlending=1;
-LONG BlackAlphaBlending=1;
-
-LONG SocketConnect=1;
-LONG HTTPConnect;
-LONG XDMCPConnect;
-LONG AutoPortSelect=1;
-LONG PortNumber=5900;
-LONG HttpPortNumber=5800;
-LONG IdleTimeout=0;
-
-LONG RemoveWallpaper=1;
-LONG RemoveAero=1;
-
-LONG QuerySetting=1;
-LONG QueryTimeout=10;
-LONG QueryAccept=4;
-LONG QueryIfNoLogon=1;
-
-LONG EnableRemoteInputs=1;
-LONG LockSettings=0;
-LONG DisableLocalInputs=0;
-LONG EnableJapInput=0;
-LONG kickrdp=0;
-LONG clearconsole=0;
-
-#define MAXPWLEN 8
-char passwd[MAXPWLEN];
-
-LONG TurboMode=1;
-LONG PollUnderCursor=0;
-LONG PollForeground=0;
-LONG PollFullScreen=1;
-LONG PollConsoleOnly=0;
-LONG PollOnEventOnly=0;
-LONG Driver=0;
-LONG Hook=1;
-LONG Virtual=0;
-LONG SingleWindow=0;
-char SingleWindowName[32];
-char path[512];
-LONG MaxCpu=40;
-
-LONG Primary=1;
-LONG Secondary=0;
-//Beep(100,20000);
-BUseRegistry = myIniFile_In.ReadInt("admin", "UseRegistry", 0);
-if (!myIniFile_Out.WriteInt("admin", "UseRegistry", BUseRegistry))
-{
-		//error
-		char temp[10];
-		DWORD error=GetLastError();
-		MessageBoxSecure(NULL,myIniFile_Out.myInifile,_itoa(error,temp,10),MB_ICONERROR);
-		return false;
-}
-
-MSLogonRequired=myIniFile_In.ReadInt("admin", "MSLogonRequired", false);
-myIniFile_Out.WriteInt("admin", "MSLogonRequired", MSLogonRequired);
-NewMSLogon=myIniFile_In.ReadInt("admin", "NewMSLogon", false);
-myIniFile_Out.WriteInt("admin", "NewMSLogon", NewMSLogon);
-
-
-myIniFile_In.ReadString("admin_auth","group1",group1,150);
-myIniFile_In.ReadString("admin_auth","group2",group2,150);
-myIniFile_In.ReadString("admin_auth","group3",group3,150);
-myIniFile_Out.WriteString("admin_auth", "group1",group1);
-myIniFile_Out.WriteString("admin_auth", "group2",group2);
-myIniFile_Out.WriteString("admin_auth", "group3",group3);
-
-
-
-locdom1=myIniFile_In.ReadInt("admin_auth", "locdom1",0);
-locdom2=myIniFile_In.ReadInt("admin_auth", "locdom2",0);
-locdom3=myIniFile_In.ReadInt("admin_auth", "locdom3",0);
-myIniFile_Out.WriteInt("admin_auth", "locdom1", locdom1);
-myIniFile_Out.WriteInt("admin_auth", "locdom2", locdom2);
-myIniFile_Out.WriteInt("admin_auth", "locdom3", locdom3);
-
-
-DebugMode=myIniFile_In.ReadInt("admin", "DebugMode", 0);
-Avilog=myIniFile_In.ReadInt("admin", "Avilog", 0);
-myIniFile_In.ReadString("admin", "path", path,512);
-DebugLevel=myIniFile_In.ReadInt("admin", "DebugLevel", 0);
-DisableTrayIcon=myIniFile_In.ReadInt("admin", "DisableTrayIcon", false);
-LoopbackOnly=myIniFile_In.ReadInt("admin", "LoopbackOnly", false);
-
-myIniFile_Out.WriteInt("admin", "DebugMode", DebugMode);
-myIniFile_Out.WriteInt("admin", "Avilog", Avilog);
-myIniFile_Out.WriteString("admin", "path", path);
-myIniFile_Out.WriteInt("admin", "DebugLevel", DebugLevel);
-myIniFile_Out.WriteInt("admin", "DisableTrayIcon", DisableTrayIcon);
-myIniFile_Out.WriteInt("admin", "LoopbackOnly", LoopbackOnly);
-
-UseDSMPlugin=myIniFile_In.ReadInt("admin", "UseDSMPlugin", false);
-AllowLoopback=myIniFile_In.ReadInt("admin", "AllowLoopback", false);
-AuthRequired=myIniFile_In.ReadInt("admin", "AuthRequired", true);
-ConnectPriority=myIniFile_In.ReadInt("admin", "ConnectPriority", 0);
-
-myIniFile_Out.WriteInt("admin", "UseDSMPlugin", UseDSMPlugin);
-myIniFile_Out.WriteInt("admin", "AllowLoopback", AllowLoopback);
-myIniFile_Out.WriteInt("admin", "AuthRequired", AuthRequired);
-myIniFile_Out.WriteInt("admin", "ConnectPriority", ConnectPriority);
-
-
-myIniFile_In.ReadString("admin", "DSMPlugin",DSMPlugin,128);
-myIniFile_In.ReadString("admin", "AuthHosts",authhosts,150);
-
-myIniFile_Out.WriteString("admin", "DSMPlugin",DSMPlugin);
-myIniFile_Out.WriteString("admin", "AuthHosts",authhosts);
-
-AllowShutdown=myIniFile_In.ReadInt("admin", "AllowShutdown", true);
-AllowProperties=myIniFile_In.ReadInt("admin", "AllowProperties", true);
-AllowEditClients=myIniFile_In.ReadInt("admin", "AllowEditClients", true);
-myIniFile_Out.WriteInt("admin", "AllowShutdown" ,AllowShutdown);
-myIniFile_Out.WriteInt("admin", "AllowProperties" ,AllowProperties);
-myIniFile_Out.WriteInt("admin", "AllowEditClients" ,AllowEditClients);
-
-
-FileTransferEnabled=myIniFile_In.ReadInt("admin", "FileTransferEnabled", true);
-FTUserImpersonation=myIniFile_In.ReadInt("admin", "FTUserImpersonation", true);
-BlankMonitorEnabled = myIniFile_In.ReadInt("admin", "BlankMonitorEnabled", true);
-BlankInputsOnly = myIniFile_In.ReadInt("admin", "BlankInputsOnly", false); //PGM
-DefaultScale = myIniFile_In.ReadInt("admin", "DefaultScale", 1);
-CaptureAlphaBlending = myIniFile_In.ReadInt("admin", "CaptureAlphaBlending", false); // sf at 2005
-BlackAlphaBlending = myIniFile_In.ReadInt("admin", "BlackAlphaBlending", false); // sf at 2005
-
-Primary = myIniFile_In.ReadInt("admin", "primary", true);
-Secondary = myIniFile_In.ReadInt("admin", "secondary", false);
-
-
-myIniFile_Out.WriteInt("admin", "FileTransferEnabled", FileTransferEnabled);
-myIniFile_Out.WriteInt("admin", "FTUserImpersonation", FTUserImpersonation);
-myIniFile_Out.WriteInt("admin", "BlankMonitorEnabled", BlankMonitorEnabled);
-myIniFile_Out.WriteInt("admin", "BlankInputsOnly", BlankInputsOnly); //PGM
-myIniFile_Out.WriteInt("admin", "DefaultScale", DefaultScale);
-myIniFile_Out.WriteInt("admin", "CaptureAlphaBlending", CaptureAlphaBlending);
-myIniFile_Out.WriteInt("admin", "BlackAlphaBlending", BlackAlphaBlending);
-myIniFile_Out.WriteInt("admin", "FileTransferTimeout", 30);
-
-myIniFile_Out.WriteInt("admin", "primary", Primary);
-myIniFile_Out.WriteInt("admin", "secondary", Secondary);
-
-	// Connection prefs
-SocketConnect=myIniFile_In.ReadInt("admin", "SocketConnect", true);
-HTTPConnect=myIniFile_In.ReadInt("admin", "HTTPConnect", true);
-XDMCPConnect=myIniFile_In.ReadInt("admin", "XDMCPConnect", true);
-AutoPortSelect=myIniFile_In.ReadInt("admin", "AutoPortSelect", true);
-PortNumber=myIniFile_In.ReadInt("admin", "PortNumber", PortNumber);
-HttpPortNumber=myIniFile_In.ReadInt("admin", "HTTPPortNumber",HttpPortNumber);
-IdleTimeout=myIniFile_In.ReadInt("admin", "IdleTimeout", IdleTimeout);
-myIniFile_Out.WriteInt("admin", "SocketConnect", SocketConnect);
-myIniFile_Out.WriteInt("admin", "HTTPConnect", HTTPConnect);
-myIniFile_Out.WriteInt("admin", "XDMCPConnect", XDMCPConnect);
-myIniFile_Out.WriteInt("admin", "AutoPortSelect", AutoPortSelect);
-myIniFile_Out.WriteInt("admin", "PortNumber", PortNumber);
-myIniFile_Out.WriteInt("admin", "HTTPPortNumber", HttpPortNumber);
-myIniFile_Out.WriteInt("admin", "IdleTimeout", IdleTimeout);
-	
-RemoveWallpaper=myIniFile_In.ReadInt("admin", "RemoveWallpaper", RemoveWallpaper);
-RemoveAero=myIniFile_In.ReadInt("admin", "RemoveAero", RemoveAero);
-myIniFile_Out.WriteInt("admin", "RemoveWallpaper", RemoveWallpaper);
-myIniFile_Out.WriteInt("admin", "RemoveAero", RemoveAero);
-
-	// Connection querying settings
-QuerySetting=myIniFile_In.ReadInt("admin", "QuerySetting", QuerySetting);
-QueryTimeout=myIniFile_In.ReadInt("admin", "QueryTimeout", QueryTimeout);
-QueryAccept=myIniFile_In.ReadInt("admin", "QueryAccept", QueryAccept);
-QueryIfNoLogon=myIniFile_In.ReadInt("admin", "QueryIfNoLogon", QueryIfNoLogon);
-myIniFile_Out.WriteInt("admin", "QuerySetting", QuerySetting);
-myIniFile_Out.WriteInt("admin", "QueryTimeout", QueryTimeout);
-myIniFile_Out.WriteInt("admin", "QueryAccept", QueryAccept);
-myIniFile_Out.WriteInt("admin", "QueryIfNoLogon", QueryIfNoLogon);
-
-myIniFile_In.ReadPassword(passwd,MAXPWLEN);
-myIniFile_Out.WritePassword(passwd);
-memset(passwd, '\0', MAXPWLEN); //PGM 
-myIniFile_In.ReadPassword2(passwd,MAXPWLEN); //PGM
-myIniFile_Out.WritePassword2(passwd); //PGM
-
-EnableRemoteInputs=myIniFile_In.ReadInt("admin", "InputsEnabled", EnableRemoteInputs);
-LockSettings=myIniFile_In.ReadInt("admin", "LockSetting", LockSettings);
-DisableLocalInputs=myIniFile_In.ReadInt("admin", "LocalInputsDisabled", DisableLocalInputs);
-EnableJapInput=myIniFile_In.ReadInt("admin", "EnableJapInput", EnableJapInput);
-kickrdp=myIniFile_In.ReadInt("admin", "kickrdp", kickrdp);
-clearconsole=myIniFile_In.ReadInt("admin", "clearconsole", clearconsole);
-
-myIniFile_Out.WriteInt("admin", "InputsEnabled", EnableRemoteInputs);
-myIniFile_Out.WriteInt("admin", "LockSetting", LockSettings);
-myIniFile_Out.WriteInt("admin", "LocalInputsDisabled", DisableLocalInputs);	
-myIniFile_Out.WriteInt("admin", "EnableJapInput", EnableJapInput);
-myIniFile_Out.WriteInt("admin", "kickrdp", kickrdp);
-myIniFile_Out.WriteInt("admin", "clearconsole", clearconsole);
-
-
-TurboMode = myIniFile_In.ReadInt("poll", "TurboMode", TurboMode);
-PollUnderCursor=myIniFile_In.ReadInt("poll", "PollUnderCursor", PollUnderCursor);
-PollForeground=myIniFile_In.ReadInt("poll", "PollForeground", PollForeground);
-PollFullScreen=myIniFile_In.ReadInt("poll", "PollFullScreen", PollFullScreen);
-PollConsoleOnly=myIniFile_In.ReadInt("poll", "OnlyPollConsole", PollConsoleOnly);
-PollOnEventOnly=myIniFile_In.ReadInt("poll", "OnlyPollOnEvent", PollOnEventOnly);
-MaxCpu=myIniFile_In.ReadInt("poll", "MaxCpu",MaxCpu);
-Driver=myIniFile_In.ReadInt("poll", "EnableDriver",Driver);
-Hook=myIniFile_In.ReadInt("poll", "EnableHook", Hook);
-Virtual=myIniFile_In.ReadInt("poll", "EnableVirtual", Virtual);
-
-SingleWindow=myIniFile_In.ReadInt("poll","SingleWindow",SingleWindow);
-myIniFile_In.ReadString("poll", "SingleWindowName", SingleWindowName,32);
-
-myIniFile_Out.WriteInt("poll", "TurboMode", TurboMode);
-myIniFile_Out.WriteInt("poll", "PollUnderCursor", PollUnderCursor);
-myIniFile_Out.WriteInt("poll", "PollForeground", PollForeground);
-myIniFile_Out.WriteInt("poll", "PollFullScreen", PollFullScreen);
-myIniFile_Out.WriteInt("poll", "OnlyPollConsole",PollConsoleOnly);
-myIniFile_Out.WriteInt("poll", "OnlyPollOnEvent", PollOnEventOnly);
-myIniFile_Out.WriteInt("poll", "MaxCpu", MaxCpu);
-myIniFile_Out.WriteInt("poll", "EnableDriver", Driver);
-myIniFile_Out.WriteInt("poll", "EnableHook", Hook);
-myIniFile_Out.WriteInt("poll", "EnableVirtual", Virtual);
-
-myIniFile_Out.WriteInt("poll", "SingleWindow", SingleWindow);
-myIniFile_Out.WriteString("poll", "SingleWindowName", SingleWindowName);
-return true;
-}
-
-bool Copy_to_Temp(char *tempfile)
-{
-IniFile myIniFile_In;
-IniFile myIniFile_Out;
-myIniFile_In.IniFileSetSecure();
-myIniFile_Out.IniFileSetTemp(tempfile);
-
-return do_copy(myIniFile_In, myIniFile_Out);
-
-}
-
-
-bool Copy_to_Secure_from_temp(char *tempfile)
-{
-IniFile myIniFile_In;
-IniFile myIniFile_Out;
-myIniFile_Out.IniFileSetSecure();
-myIniFile_In.IniFileSetTemp(tempfile);
-
-return do_copy(myIniFile_In, myIniFile_Out);
-}
diff --git a/ica/win32/winvnc/winvnc/res/AuthPanel.class b/ica/win32/winvnc/winvnc/res/AuthPanel.class
deleted file mode 100644
index 14ea30f..0000000
Binary files a/ica/win32/winvnc/winvnc/res/AuthPanel.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/ButtonPanel.class b/ica/win32/winvnc/winvnc/res/ButtonPanel.class
deleted file mode 100644
index fcbf38a..0000000
Binary files a/ica/win32/winvnc/winvnc/res/ButtonPanel.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/DH.class b/ica/win32/winvnc/winvnc/res/DH.class
deleted file mode 100644
index 9929fa0..0000000
Binary files a/ica/win32/winvnc/winvnc/res/DH.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/FTPFrame.class b/ica/win32/winvnc/winvnc/res/FTPFrame.class
deleted file mode 100644
index c0ddd3c..0000000
Binary files a/ica/win32/winvnc/winvnc/res/FTPFrame.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/Finger.cur b/ica/win32/winvnc/winvnc/res/Finger.cur
deleted file mode 100644
index 8fb9346..0000000
Binary files a/ica/win32/winvnc/winvnc/res/Finger.cur and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/RecordingFrame.class b/ica/win32/winvnc/winvnc/res/RecordingFrame.class
deleted file mode 100644
index 4a09aa4..0000000
Binary files a/ica/win32/winvnc/winvnc/res/RecordingFrame.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/SessionRecorder.class b/ica/win32/winvnc/winvnc/res/SessionRecorder.class
deleted file mode 100644
index 6c030d3..0000000
Binary files a/ica/win32/winvnc/winvnc/res/SessionRecorder.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/clipboardframe.class b/ica/win32/winvnc/winvnc/res/clipboardframe.class
deleted file mode 100644
index 00f180f..0000000
Binary files a/ica/win32/winvnc/winvnc/res/clipboardframe.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/descipher.class b/ica/win32/winvnc/winvnc/res/descipher.class
deleted file mode 100644
index 9fe50e8..0000000
Binary files a/ica/win32/winvnc/winvnc/res/descipher.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/ding_dong.wav b/ica/win32/winvnc/winvnc/res/ding_dong.wav
deleted file mode 100644
index 5577fc3..0000000
Binary files a/ica/win32/winvnc/winvnc/res/ding_dong.wav and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/ftpframe$strcomp.class b/ica/win32/winvnc/winvnc/res/ftpframe$strcomp.class
deleted file mode 100644
index e147b7b..0000000
Binary files a/ica/win32/winvnc/winvnc/res/ftpframe$strcomp.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/icon2.ico b/ica/win32/winvnc/winvnc/res/icon2.ico
deleted file mode 100644
index 94f49df..0000000
Binary files a/ica/win32/winvnc/winvnc/res/icon2.ico and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/optionsframe.class b/ica/win32/winvnc/winvnc/res/optionsframe.class
deleted file mode 100644
index 2601e9f..0000000
Binary files a/ica/win32/winvnc/winvnc/res/optionsframe.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/rfbproto.class b/ica/win32/winvnc/winvnc/res/rfbproto.class
deleted file mode 100644
index 4231ae5..0000000
Binary files a/ica/win32/winvnc/winvnc/res/rfbproto.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/runas.bmp b/ica/win32/winvnc/winvnc/res/runas.bmp
deleted file mode 100644
index ca11149..0000000
Binary files a/ica/win32/winvnc/winvnc/res/runas.bmp and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/vnc-1.bmp b/ica/win32/winvnc/winvnc/res/vnc-1.bmp
deleted file mode 100644
index 9b81765..0000000
Binary files a/ica/win32/winvnc/winvnc/res/vnc-1.bmp and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/vnccanvas.class b/ica/win32/winvnc/winvnc/res/vnccanvas.class
deleted file mode 100644
index 66dda73..0000000
Binary files a/ica/win32/winvnc/winvnc/res/vnccanvas.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/vncviewer.class b/ica/win32/winvnc/winvnc/res/vncviewer.class
deleted file mode 100644
index 2ce572d..0000000
Binary files a/ica/win32/winvnc/winvnc/res/vncviewer.class and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/vncviewer.jar b/ica/win32/winvnc/winvnc/res/vncviewer.jar
deleted file mode 100644
index 911606e..0000000
Binary files a/ica/win32/winvnc/winvnc/res/vncviewer.jar and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/res/world3a.ico b/ica/win32/winvnc/winvnc/res/world3a.ico
deleted file mode 100644
index f864974..0000000
Binary files a/ica/win32/winvnc/winvnc/res/world3a.ico and /dev/null differ
diff --git a/ica/win32/winvnc/winvnc/resource.h b/ica/win32/winvnc/winvnc/resource.h
deleted file mode 100644
index f587443..0000000
--- a/ica/win32/winvnc/winvnc/resource.h
+++ /dev/null
@@ -1,312 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by winvnc.rc
-//
-#define IDI_WINVNC                      102
-#define IDD_PROPERTIES                  102
-#define IDS_WARNING                     103
-#define IDR_TRAYMENU                    104
-#define IDR_VNCVIEWER_JAR               116
-#define IDR_RECFRAME_CLASS              117
-#define IDR_SESSIONREC_CLASS            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_BUTTONPANEL_CLASS           129
-#define IDR_DESCIPHER_CLASS             130
-#define IDD_ABOUT                       131
-#define IDB_VNCLOGO                     132
-#define IDI_FLASH                       134
-#define IDD_OUTGOING_CONN               135
-#define IDD_ACCEPT_CONN                 136
-#define IDD_PATHS                       138
-#define IDB_LOGO64                      139
-#define IDD_TEXTCHAT_DLG                140
-#define IDD_LIST_DLG                    141
-#define IDB_BITMAP2                     143
-#define IDB_BITMAP4                     144
-#define IDB_BITMAP1                     144
-#define IDD_MSLOGON                     145
-#define IDD_PROPERTIES1                 146
-#define IDD_ABOUT1                      147
-#define IDR_FTPFRAME_CLASS              148
-#define IDR_DH_CLASS                    149
-#define IDR_FTPFRAMESTRCOMP_CLASS       151
-#define IDR_JAVAARCHIVE1                155
-#define IDR_JAVACLASS1                  156
-#define IDR_JAVACLASS2                  157
-#define IDR_JAVACLASS3                  158
-#define IDR_JAVACLASS4                  159
-#define IDR_JAVACLASS5                  160
-#define IDR_JAVACLASS6                  161
-#define IDR_JAVACLASS7                  162
-#define IDR_JAVACLASS8                  163
-#define IDR_JAVACLASS9                  164
-#define IDR_JAVACLASS10                 165
-#define IDR_JAVACLASS11                 166
-#define IDR_JAVACLASS12                 167
-#define IDR_JAVACLASS13                 169
-#define IDD_USER_NAME                   604
-#define IDD_PASSWORD                    608
-#define IDR_MESSAGES_PROPERTIES         900
-#define IDR_MESSAGES_CLASS              901
-#define IDD_LOGON                       1002
-#define IDC_CONNECT_BORDER              1003
-#define IDD_AUTH_DIALOG                 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_DISPLAYNO                   1008
-#define IDC_PASSWORD                    1009
-#define IDC_PASSWD_EDIT                 1009
-#define IDC_UPDATE_BORDER               1010
-#define IDC_PASSWORD_LABEL2             1010
-#define IDC_POLL_FULLSCREEN             1011
-#define IDC_PASSWORD2                   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_HOSTS                       1016
-#define IDC_VERSION                     1017
-#define IDC_DISPLAY_NO_LABEL            1017
-#define IDC_NAME                        1018
-#define IDC_HOST_ADD                    1018
-#define IDC_EMAIL                       1019
-#define IDC_BUILDTEXT                   1019
-#define IDC_HOST_REMOVE                 1019
-#define IDC_VNC                         1020
-#define IDC_HOST_UP                     1020
-#define IDC_ATT                         1021
-#define IDC_BUILDTIME                   1021
-#define IDC_HOST_DOWN                   1021
-#define IDC_WWW                         1022
-#define IDC_HOST_EDIT                   1022
-#define IDC_COPYRIGHT                   1023
-#define IDC_DISABLE_INPUTS              1024
-#define IDC_APPLY                       1025
-#define IDC_PORTNO_AUTO                 1026
-#define IDD_DOMAIN                      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 IDC_FILETRANSFER                1046
-#define IDC_SCALE                       1048
-#define IDC_PATH                        1049
-#define IDC_SETMASTER                   1050
-#define IDC_MSLOGON_CHECK               1051
-#define IDC_PLUGIN_CHECK                1052
-#define IDC_COMBO1                      1053
-#define IDC_PLUGINS_COMBO               1053
-#define IDC_PLUGIN_BUTTON               1054
-#define IDC_VIEWERS_LISTBOX             1055
-#define IDC_SINGLE_WINDOW               1056
-#define IDC_CLIENTTEXT                  1056
-#define IDC_VIEWERS_LISTBOX2            1056
-#define IDC_PENDING_LISTBOX             1056
-#define IDC_KILL_B                      1057
-#define IDC_NAME_APPLI                  1058
-#define IDC_TEXTCHAT_B                  1058
-#define IDC_SPECDISPLAY                 1060
-#define IDC_SPECPORT                    1061
-#define IDC_PORTRFB                     1062
-#define IDC_PORTHTTP                    1063
-#define IDC_STATUS                      1064
-#define IDC_WARNING                     1064
-#define IDC_PERSISTENT_CHECK            1065
-#define IDC_DRIVER                      1066
-#define IDC_HOOK                        1067
-#define IDC_VIRTUAL                     1068
-#define IDC_CONNECT_XDMCP               1069
-#define IDC_BLANK                       1070
-#define IDC_BLANK2                      1071
-#define IDC_TURBOMODE                   1075
-#define IDC_SEND_B                      1078
-#define IDC_LOG                         1079
-#define IDC_ALLOWLOOPBACK               1080
-#define IDQUERY                         1081
-#define IDQUERYTIMEOUT                  1082
-#define IDC_EDIT1                       1084
-#define IDC_GROUP1                      1084
-#define IDC_IDCODE                      1084
-#define IDC_BLANKINGTXT                 1084
-#define IDC_EDIT_PATH                   1084
-#define IDC_MAXCPU                      1084
-#define IDC_MSLOGON_CHECKD              1085
-#define IDC_GROUP2                      1086
-#define IDC_MSLOGON_CHECKD2             1086
-#define IDC_GROUP3                      1087
-#define IDC_CHECKG1L                    1088
-#define IDC_CHECKG2L                    1089
-#define IDC_CHECKG3L                    1090
-#define IDC_CHECKG1D                    1091
-#define IDC_CHECKG2D                    1092
-#define IDC_CHECKG3D                    1093
-#define IDC_MSLOGON                     1094
-#define IDC_CHECKDRIVER                 1096
-#define IDC_RADIO1                      1097
-#define IDC_MV1                         1097
-#define IDC_RADIO2                      1098
-#define IDC_MV2                         1098
-#define IDC_RADIO3                      1099
-#define IDC_MV3                         1099
-#define IDC_RADIO4                      1100
-#define IDC_MV4                         1100
-#define IDC_LOOPBACKONLY                1101
-#define IDC_CHECK2                      1102
-#define IDC_DISABLETRAY                 1102
-#define IDC_DREFUSE                     1105
-#define IDC_DACCEPT                     1106
-#define IDC_ALLOWSHUTDOWN               1107
-#define IDC_ALLOWEDITCLIENTS            1108
-#define IDC_NEW_MSLOGON                 1109
-#define IDC_HIDE_B                      1110
-#define IDC_ALPHA                       1112
-#define IDC_ALPHABLACK                  1114
-#define IDC_ALPHABLACK2                 1116
-#define IDC_FTUSERIMPERSONATION_CHECK   1117
-#define IDC_REMOVE_Aero                 1118
-#define IDE_CUSTOM1                     1119
-#define IDC_WWW2                        1120
-#define IDC_WWW3                        1121
-#define IDC_CHECK1                      1122
-#define IDC_JAP_INPUTS                  1122
-#define IDC_CHECK3                      1123
-#define IDC_EURO                        1123
-#define IDC_VIDEO                       1125
-#define IDC_BUTTON1                     1126
-#define IDC_CLEAR                       1126
-#define IDC_CONNECTION_NUMBER_LABEL     1128
-#define IDC_CONNECTION_NUMBER_STATIC    1128
-#define IDC_CAPTION_STATIC              1129
-#define IDC_Path1                       1132
-#define IDC_Path2                       1133
-#define IDC_Path3                       1134
-#define IDC_LOCALTEXT_EDIT              1140
-#define IDC_INPUTAREA_EDIT              1140
-#define IDC_REMOTETEXT_EDIT             1141
-#define IDC_CHATAREA_EDIT               1141
-#define IDC_CLEAR_B                     1142
-#define IDC_FINGER                      9000
-#define IDC_GAMMAGRAY                   9001
-#define IDC_STATIC_SPLIT                9002
-#define ID_ADMIN_PROPERTIES             40000
-#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
-#define ID_LISTCLIENTS                  40007
-#define ID_ONLINEHELP                   40013
-#define ID_HOME                         40014
-#define ID_CLOSE_SERVICE                40015
-#define ID_RUNASSERVICE                 40016
-#define ID_UNINSTALL_SERVICE            40017
-#define ID_START_SERVICE                40018
-#define ID_TRAY_VISITUSONLINE           40019
-#define ID_VISITUSONLINE_HOMEPAGE       40020
-#define ID_VISITUSONLINE_FORUM          40021
-#define ID_TRAY_ENABLESOFTWARECAD       40022
-#define ID_SOFTWARECAD                  40023
-#define ID_TRAY_REBOOTINSAFEMODE        40024
-#define ID_REBOOTSAFEMODE               40025
-#define ID_TRAY_DELETESOFTWARECAD       40026
-#define ID_DELSOFTWARECAD               40027
-#define ID_TRAY_FORCEREBOOT             40028
-#define ID_REBOOT_FORCE                 40029
-#define ID_FAILED_INIT                  41000
-#define ID_WINVNC_USAGE                 41001
-#define ID_ANOTHER_INST                 41002
-#define ID_NO_EXIST_INST                41003
-#define ID_UNABLE_INST                  41004
-#define ID_SCM_NOT_HERE                 41005
-#define ID_SERV_NOT_REG                 41006
-#define ID_SERV_FAIL_ST                 41007
-#define ID_SERV_CT_MISS                 41008
-#define ID_SERV_OLD_REG                 41009
-#define ID_SERVHELP_UNAB                41010
-#define ID_SERV_CT_UNREG                41011
-#define ID_SERV_NOT_UNRG                41012
-#define ID_SERV_NCONTACT                41013
-#define ID_SERVHELP_NREM                41014
-#define ID_SERV_NOT_STOP                41015
-#define ID_SERV_MK_UNREG                41016
-#define ID_SERV_NT_FOUND                41017
-#define ID_WINVNC_ERROR                 41018
-#define ID_WINVNC_WARNIN                41019
-#define ID_PLUGIN_LOADIN                41020
-#define ID_NO_PASSWD_NO_OVERRIDE_ERR    41021
-#define ID_NO_PASSWD_NO_OVERRIDE_WARN   41022
-#define ID_NO_PASSWD_NO_LOGON_WARN      41023
-#define ID_NO_OVERRIDE_ERR              41024
-#define ID_NO_CURRENT_USER_ERR          41025
-#define ID_CANNOT_EDIT_DEFAULT_PREFS    41026
-#define ID_NO_PASSWORD_WARN             41027
-#define ID_PLUGIN_NOT_LOAD              41028
-#define ID_MB1                          41029
-#define ID_WVNC                         41030
-#define ID_AUTHAD_NOT_FO                41031
-#define ID_WARNING                      41032
-#define ID_AUTH_NOT_FO                  41033
-#define ID_DESKTOP_BITBLT_ROOT          41034
-#define ID_DESKTOP_BITBLT_MEM           41035
-#define ID_DESKTOP_PLANAR_NOTC          41036
-#define ID_FAILED_CONNECT_LISTING_VIEW  41037
-#define ID_OUTGOING_CONNECTION          41038
-#define ID_UNABLE_PROC_MSLOGON          41039
-#define ID_RICHED32_UNLOAD              41040
-#define ID_RICHED32_DLL_LD              41041
-#define ID_SERV_SUCCESS_INST            41042
-#define ID_SERV_SUCCESS_REG             41043
-#define ID_SERV_SUCCESS_UNREG           41044
-#define ID_ULTRAVNC_TEXTCHAT            41045
-#define ID_ULTRAVNC_WARNING             41046
-#define ID_NO_PLUGIN_DETECT             41047
-#define ID_CHAT_WITH_S_ULTRAVNC         41048
-#define ID_CURRENT_USER_PROP            41049
-#define ID_DEFAULT_SYST_PROP            41050
-#define ID_AUTOREJECT_U                 41051
-#define ID_AUTOACCEPT_U                 41052
-#define ID_CADERROR                     41053
-#define ID_CADERRORFILE                 41054
-#define ID_CADPERMISSION                41055
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        170
-#define _APS_NEXT_COMMAND_VALUE         40030
-#define _APS_NEXT_CONTROL_VALUE         1131
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
diff --git a/ica/win32/winvnc/winvnc/rfb.h b/ica/win32/winvnc/winvnc/rfb.h
deleted file mode 100644
index 3fb6b20..0000000
--- a/ica/win32/winvnc/winvnc/rfb.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//  Copyright (C) 2002 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 at 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 HPORT_TO_DISPLAY(p) ( (p) - HTTP_PORT_OFFSET )
-#define DISPLAY_TO_PORT(d)  ( (d) + RFB_PORT_OFFSET )
-#define DISPLAY_TO_HPORT(d) ( (d) + HTTP_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
diff --git a/ica/win32/winvnc/winvnc/rfbMisc.h b/ica/win32/winvnc/winvnc/rfbMisc.h
deleted file mode 100644
index 6f75375..0000000
--- a/ica/win32/winvnc/winvnc/rfbMisc.h
+++ /dev/null
@@ -1,124 +0,0 @@
-//  Copyright (C) 2002 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 at realvnc.com for information on obtaining it.
-
-#include <vector>
-
-#ifndef max
-#define max(a,b)            (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef min
-#define min(a,b)            (((a) < (b)) ? (a) : (b))
-#endif
-
-
-#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.
-
-
-#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), iterations(0), max_user_time(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__
-
-
diff --git a/ica/win32/winvnc/winvnc/rfbRect.h b/ica/win32/winvnc/winvnc/rfbRect.h
deleted file mode 100644
index 40418ff..0000000
--- a/ica/win32/winvnc/winvnc/rfbRect.h
+++ /dev/null
@@ -1,117 +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 at 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;
-			if (is_empty()) return r;
-			if (r.is_empty()) return *this;
-			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__
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/rfbRegion.h b/ica/win32/winvnc/winvnc/rfbRegion.h
deleted file mode 100644
index de0742e..0000000
--- a/ica/win32/winvnc/winvnc/rfbRegion.h
+++ /dev/null
@@ -1,31 +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 at realvnc.com for information on obtaining it.
-
-//#define USE_X11_REGIONS
-
-#ifdef USE_X11_REGIONS
-#include "rfbRegion_X11.h"
-#else
-
-#include "rfbRegion_win32.h"
-
-
-#endif // X11
diff --git a/ica/win32/winvnc/winvnc/rfbRegion_X11.cxx b/ica/win32/winvnc/winvnc/rfbRegion_X11.cxx
deleted file mode 100644
index f6e4670..0000000
--- a/ica/win32/winvnc/winvnc/rfbRegion_X11.cxx
+++ /dev/null
@@ -1,210 +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 at 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 (0 != XEqualRegion(Xrgn, b.Xrgn));
-}
-
-bool Region::is_empty() const {
-  return (0 != 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;
-
-  rects.clear();
-  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);
-}
-
-int Region::Numrects()
-{
-	return Xrgn->numRects;
-}*/
-/*XRegion Region::replaceXrgn(XRegion newrgn) {
-  XRegion tmp = Xrgn;
-  Xrgn = newrgn;
-  return tmp;
-}*/
diff --git a/ica/win32/winvnc/winvnc/rfbRegion_X11.h b/ica/win32/winvnc/winvnc/rfbRegion_X11.h
deleted file mode 100644
index 30214ee..0000000
--- a/ica/win32/winvnc/winvnc/rfbRegion_X11.h
+++ /dev/null
@@ -1,87 +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 at 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;
-	int Numrects();
-
-    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__
diff --git a/ica/win32/winvnc/winvnc/rfbRegion_win32.cpp b/ica/win32/winvnc/winvnc/rfbRegion_win32.cpp
deleted file mode 100644
index 3a728de..0000000
--- a/ica/win32/winvnc/winvnc/rfbRegion_win32.cpp
+++ /dev/null
@@ -1,280 +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 at realvnc.com for information on obtaining it.
-
-// Cross-platform Region class based on the X11 region implementation
-
-#include "stdhdrs.h"
-#include "rfbRegion_win32.h"
-
-using namespace rfb;
-
-void dump_rects(char *n, HRGN rgn, bool dbg = 0)
-{
-/*#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("Region %s %p contains rects:\n"), n, rgn);
-	DWORD buffsize = GetRegionData(rgn, 0, NULL);
-	if (!buffsize)
-		return ;
-
-	unsigned char* buffer = new unsigned char[buffsize];
-
-	if (GetRegionData(rgn, buffsize, (LPRGNDATA)buffer) != buffsize)
-	{
-		delete [] buffer;
-		return ;
-	}
-
-	bool stop_needed(dbg && strcmp(n, "rgncache")==0);
-	LPRGNDATA region_data = (LPRGNDATA)buffer;
-	DWORD nRects = region_data->rdh.nCount;
-
-	if (nRects == 0)
-	{
-		delete [] buffer;
-		return ;
-	}
-
-	static bool enabled(false);
-	RECT *pRectangles = reinterpret_cast<RECT*>(&region_data->Buffer[0]);
-	for (DWORD i = 0; i < nRects; ++i)
-	{
-		//vnclog.Print(LL_INTWARN, VNCLOG("           (%u,%u - %u,%u)\n"), pRectangles[i].left, pRectangles[i].top,pRectangles[i].right, pRectangles[i].bottom);
-
-		if (stop_needed && enabled)
-		{
-			if (pRectangles[i].left == 0 &&pRectangles[i].top ==0 &&
-				pRectangles[i].right == 1280 && pRectangles[i].bottom == 1024)
-				DebugBreak();
-		}
-	}
-
-	delete [] buffer;
-#endif*/
-}
-
-
-Region::Region() : m_name(_strdup("")) {
-  rgn = CreateRectRgn(0,0,0,0);
-}
-
-Region::Region(int x1, int y1, int x2, int y2) : m_name(_strdup("")) {
-  rgn = CreateRectRgn(x1, y1, x2, y2);
-}
-
-Region::Region(const Rect& r) : m_name(_strdup("")) {
-  rgn = CreateRectRgn(r.tl.x, r.tl.y, r.br.x, r.br.y);
-}
-
-Region::Region(const Region& r) : m_name(_strdup("")) {
-  rgn = CreateRectRgn(0,0,0,0);
-  CombineRgn(rgn, r.rgn, r.rgn, RGN_COPY);
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("Copy-construct Region %p from %s %p\n"), rgn, r.m_name, r.rgn);
-  dump_rects(m_name, rgn);
-#endif
-}
-
-Region::~Region() {
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("Deleting Region %s %p\n"), m_name, rgn);
-#endif
-  DeleteObject(rgn);
-  free(m_name);
-}
-
-bool Region::IsPtInRegion(int x, int y)
-{
-	return PtInRegion(rgn,x,y);
-}
-
-rfb::Region& Region::operator=(const Region& r) {
-  clear();
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("Assign Region %s %p from %s %p\n"), m_name, rgn, r.m_name, r.rgn);
-  dump_rects(m_name, rgn);
-#endif
-  CombineRgn(rgn, r.rgn, r.rgn, RGN_COPY);
-  return *this;
-}
-
-
-void Region::clear() {
-  SetRectRgn(rgn, 0, 0, 0, 0);
-}
-
-void Region::reset(const Rect& r) {
-  SetRectRgn(rgn, r.tl.x, r.tl.y, r.br.x, r.br.y);
-}
-
-void Region::translate(const Point& delta) {
-  OffsetRgn(rgn, delta.x, delta.y);
-}
-
-
-void Region::assign_intersect(const Region& r) {
-  CombineRgn(rgn, rgn, r.rgn, RGN_AND);
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("assign_intersect this %s %p, other %s %p\n"), m_name, rgn, r.m_name, r.rgn);
-  dump_rects(m_name, rgn);
-#endif
-}
-
-void Region::assign_union(const Region& r) {
-  CombineRgn(rgn, rgn, r.rgn, RGN_OR);
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("assign_union this %s %p, other %s %p\n"),  m_name, rgn, r.m_name, r.rgn);
-  dump_rects(m_name, rgn, 1);
-#endif
-}
-
-void Region::assign_subtract(const Region& r) {
-  CombineRgn(rgn, rgn, r.rgn, RGN_DIFF);
-#if defined(_DEBUG)
-  //vnclog.Print(LL_INTWARN, VNCLOG("assign_subtract %s %p, other %s %p\n"), m_name, rgn, r.m_name, r.rgn);
-  dump_rects(m_name, rgn);
-#endif
-}
-
-
-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 EqualRgn(rgn, b.rgn) ? true : false;
-}
-
-bool Region::is_empty() const {
-  RECT rc;
-  return (GetRgnBox(rgn, &rc) == NULLREGION);
-}
-
-bool Region::get_rects(std::vector<Rect>& rects,
-					   bool left2right,
-					   bool topdown) const {
-#if defined(_DEBUG)
-   //vnclog.Print(LL_INTWARN, VNCLOG("get_rects %s %p\n"), m_name, rgn);
-#endif
-
-   DWORD buffsize = GetRegionData(rgn, 0, NULL);
-   if (!buffsize)
-	   return false;
-
-
-   unsigned char* buffer = new unsigned char[buffsize];
-   memset(buffer,0,buffsize);
-
-   if (GetRegionData(rgn, buffsize, (LPRGNDATA)buffer) != buffsize)
-   {
-	   delete [] buffer;
-	   return false;
-   }
-
-   LPRGNDATA region_data = (LPRGNDATA)buffer;
-   DWORD nRects = region_data->rdh.nCount;
-
-   if (nRects == 0)
-   {
-	   delete [] buffer;
-	   return false;
-   }
-
-   rects.clear();
-   rects.reserve(nRects);
-   RECT *pRectangles = reinterpret_cast<RECT*>(&region_data->Buffer[0]);
-
-   int xInc = left2right ? 1 : -1;
-   int yInc = topdown ? 1 : -1;
-   int i = topdown ? 0 : nRects-1;
-#if defined(_DEBUG)
-   //vnclog.Print(LL_INTWARN, VNCLOG("Region %s %p contains rects:\n"), m_name, rgn);
-#endif
-
-   while (nRects > 0) {
-	   int firstInNextBand = i;
-	   int nRectsInBand = 0;
-
-	   while (nRects > 0 && pRectangles[firstInNextBand].top == pRectangles[i].top) {
-		   firstInNextBand += yInc;
-		   nRects--;
-		   nRectsInBand++;
-	   }
-
-	   if (xInc != yInc)
-		   i = firstInNextBand - yInc;
-
-	   while (nRectsInBand > 0) {
-		   Rect r(pRectangles[i].left, pRectangles[i].top,
-			   pRectangles[i].right, pRectangles[i].bottom);
-
-#if defined(_DEBUG)
-		   //vnclog.Print(LL_INTWARN, VNCLOG("           (%u,%u - %u,%u) %ux%u\n"), r.tl.x, r.tl.y, r.br.x, r.br.y, r.width(), r.height());
-#endif
-		   rects.push_back(r);
-		   i += xInc;
-		   nRectsInBand--;
-	   }
-
-	   i = firstInNextBand;
-   }
-   delete [] buffer;
-
-   return !rects.empty();
-}
-
-rfb::Rect Region::get_bounding_rect() const {
-  RECT rc;
-  GetRgnBox(rgn, &rc);
-  return Rect(rc.left, rc.top, rc.right, rc.bottom);
-}
-
-int Region::Numrects()
-{
-	char *pRgnData;
-	DWORD dwCount(0);
-	int nRects(0);
-
-	dwCount = GetRegionData(rgn, 0, 0);
-	pRgnData = new char[dwCount];
-	if (pRgnData == 0) return 0;
-
-	if (GetRegionData(rgn, dwCount, reinterpret_cast<LPRGNDATA>(pRgnData)) == dwCount)
-		nRects = reinterpret_cast<LPRGNDATA>(pRgnData)->rdh.nCount;
-
-	delete [] pRgnData;
-	return nRects;
-}
-
diff --git a/ica/win32/winvnc/winvnc/rfbRegion_win32.h b/ica/win32/winvnc/winvnc/rfbRegion_win32.h
deleted file mode 100644
index 7903a16..0000000
--- a/ica/win32/winvnc/winvnc/rfbRegion_win32.h
+++ /dev/null
@@ -1,93 +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 at 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 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);
-	bool IsPtInRegion(int x, int y);
-
-    ~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 name(const char *n)
-	{
-		free(m_name);
-		m_name = _strdup(n);
-	}
-
-    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;
-	int Numrects();
-
-    void debug_print(const char *prefix) const;
-
-  protected:
-	  HRGN rgn;
-	  char *m_name;
-  };
-  typedef Region Region2D;
-
-};
-
-#endif /* __RFB_REGION_WIN32_INCLUDED__ */
-
-
diff --git a/ica/win32/winvnc/winvnc/rfbUpdateTracker.cpp b/ica/win32/winvnc/winvnc/rfbUpdateTracker.cpp
deleted file mode 100644
index b5154b7..0000000
--- a/ica/win32/winvnc/winvnc/rfbUpdateTracker.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at 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_cached(const Region2D &region) {
-	child.add_cached(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.assign_union(region);
-}
-
-void SimpleUpdateTracker::add_cached(const Region2D &region) {
-	cached.assign_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() && !copied.is_empty()) {
-			// Old copyrect is (probably) bigger - use it
-			changed = changed.union_(dest);
-		} else {
-			// New copyrect is probably bigger
-			// RealVNC 336 change 
-			Region2D invalid = src.intersect(changed);
-			invalid.translate(delta);
-			changed.assign_union(invalid);
-			changed.assign_union(copied);
-//			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;
-	}
-
-	// RealVNC 336 change
-	Region2D valid = overlap.subtract(changed);
-	valid.translate(delta);
-	changed.assign_union(copied);
-	changed.assign_union(dest);
-	changed.assign_subtract(valid);
-//	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.assign_subtract(changed);
-
-	// Ensure the UpdateInfo structure is empty
-	info.copied.clear();
-	info.changed.clear();
-	info.cached.clear();
-	
-
-	// Clip the changed region to the clip region
-	Region2D updatergn = changed.intersect(cliprgn);
-	changed.assign_subtract(updatergn);
-
-	// Clip the copyrect region to the display
-	Region2D copyrgn = copied.intersect(cliprgn);
-	copied.assign_subtract(copyrgn);
-
-	// Clip the cacherect region to the display
-	Region2D cachedrgn = cached.intersect(cliprgn);
-	cached.assign_subtract(cachedrgn);
-
-	// Save the update and copyrect rectangles info the UpdateInfo
-	updatergn.get_rects(info.changed, 1, 1);
-	cachedrgn.get_rects(info.cached, 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);
-	Region2D cached_clipped = cached.intersect(cliprgn);
-	copied.assign_subtract(copied_clipped);
-	changed.assign_subtract(changed_clipped);
-	cached.assign_subtract(cached_clipped);
-	if (!copied_clipped.is_empty()) {
-		info.add_copied(copied_clipped, copy_delta);
-	}
-	if (!changed_clipped.is_empty())
-		info.add_changed(changed_clipped);
-	if (!cached_clipped.is_empty())
-		info.add_cached(cached_clipped);
-}
-
-void SimpleUpdateTracker::get_update(UpdateInfo &info) const {
-	info.copied.clear();
-	info.changed.clear();
-	info.cached.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);
-	cached.get_rects(info.cached, 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);
-	}
-	if (!cached.is_empty()) {
-		to.add_cached(cached);
-	}
-}
-
diff --git a/ica/win32/winvnc/winvnc/rfbUpdateTracker.h b/ica/win32/winvnc/winvnc/rfbUpdateTracker.h
deleted file mode 100644
index f292820..0000000
--- a/ica/win32/winvnc/winvnc/rfbUpdateTracker.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at 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 cached;
-		RectVector copied;
-		Point copy_delta;
-		RectVector changed;
-	};
-
-	class UpdateTracker {
-	public:
-		UpdateTracker() {};
-		virtual ~UpdateTracker() {};
-
-		virtual void add_changed(const Region2D &region) = 0;
-		virtual void add_cached(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_cached(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_cached(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_cached_region() const {return cached;};
-		virtual const Region2D& get_copied_region() const {return copied;};
-
-
-		virtual bool is_empty() const {return changed.is_empty() && copied.is_empty() && cached.is_empty();};
-
-		virtual void clear() {
-			changed.clear();
-			copied.clear();
-			cached.clear();
-		};
-	protected:
-		Region2D changed;
-		Region2D cached;
-		Region2D copied;
-		Point copy_delta;
-		bool copy_enabled;
-	};
-
-};
-
-#endif /* __RFB_UPDATETRACKER_INCLUDED__ */
diff --git a/ica/win32/winvnc/winvnc/security.cpp b/ica/win32/winvnc/winvnc/security.cpp
deleted file mode 100644
index e014df6..0000000
--- a/ica/win32/winvnc/winvnc/security.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include "lmcons.h"
-#include "vncservice.h"
-#include "vncOSVersion.h"
-#include "common/ScopeGuard.h"
-
-
-typedef BOOL (WINAPI *pWTSQueryUserToken_proto)(ULONG, PHANDLE);
-
-DWORD GetCurrentUserToken(HANDLE& process, HANDLE &Token)
-{
-	if(OSversion()==4 || OSversion()==5) return 1;
-	if (!vncService::RunningAsService())
-	{
-		if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &Token))
-			return 0;
-		return 2;
-	}
-	{
-	  HWND tray = FindWindow(("Shell_TrayWnd"), 0);
-      if (!tray)
-        return 0;
-	  DWORD processId = 0;
-      GetWindowThreadProcessId(tray, &processId);
-      if (!processId)
-        return 0;
-	  process = OpenProcess(MAXIMUM_ALLOWED, FALSE, processId);
-      if (!process)
-        return 0;
-	  OpenProcessToken(process, MAXIMUM_ALLOWED, &Token);
-	  // Remeber the closhandle
-	  //
-	}
-	return 2;
-}
-
-bool ImpersonateCurrentUser() {
-  SetLastError(0);
-  HANDLE process=0;
-  HANDLE Token=NULL;
-
-  GetCurrentUserToken(process, Token);
-
-  // Auto close process and token when leaving scope
-  ON_BLOCK_EXIT(CloseHandle, process);
-  ON_BLOCK_EXIT(CloseHandle, Token);
-
-  bool test=(FALSE != ImpersonateLoggedOnUser(Token));
-
-  return test;
-}
-
-bool
-RevertCurrentUser() {
-  return (FALSE != RevertToSelf());
-}
-
-bool RunningAsAdministrator ()
-{
- BOOL   fAdmin;
- TOKEN_GROUPS *ptg = NULL;
- DWORD  cbTokenGroups;
- DWORD  dwGroup;
- PSID   psidAdmin;
- SetLastError(0);
- HANDLE process=0;
- HANDLE Token=NULL;
-
- if (GetCurrentUserToken(process, Token)==1) return true;
-
- ON_BLOCK_EXIT(CloseHandle, process);
- ON_BLOCK_EXIT(CloseHandle, Token);
-
- SID_IDENTIFIER_AUTHORITY SystemSidAuthority= { SECURITY_NT_AUTHORITY };
-
- // Then we must query the size of the group information associated with
- // the token. Note that we expect a FALSE result from GetTokenInformation
- // because we've given it a NULL buffer. On exit cbTokenGroups will tell
- // the size of the group information.
-
- if ( GetTokenInformation ( Token, TokenGroups, NULL, 0, &cbTokenGroups))
-  return ( FALSE);
-
- // Here we verify that GetTokenInformation failed for lack of a large
- // enough buffer.
- DWORD aa=GetLastError();
- if ( aa != ERROR_INSUFFICIENT_BUFFER)
-  return ( FALSE);
-
- // Now we allocate a buffer for the group information.
- // Since _alloca allocates on the stack, we don't have
- // to explicitly deallocate it. That happens automatically
- // when we exit this function.
-
- if ( ! ( ptg= (_TOKEN_GROUPS *) _malloca ( cbTokenGroups))) 
-  return ( FALSE);
-
- // Now we ask for the group information again.
- // This may fail if an administrator has added this account
- // to an additional group between our first call to
- // GetTokenInformation and this one.
-
- if ( !GetTokenInformation ( Token, TokenGroups, ptg, cbTokenGroups,
-          &cbTokenGroups) )
-  return ( FALSE);
-
- // Now we must create a System Identifier for the Admin group.
-
- if ( ! AllocateAndInitializeSid ( &SystemSidAuthority, 2, 
-            SECURITY_BUILTIN_DOMAIN_RID, 
-            DOMAIN_ALIAS_RID_ADMINS,
-            0, 0, 0, 0, 0, 0, &psidAdmin) )
-  return ( FALSE);
-
- // Finally we'll iterate through the list of groups for this access
- // token looking for a match against the SID we created above.
-
- fAdmin= FALSE;
-
- for ( dwGroup= 0; dwGroup < ptg->GroupCount; dwGroup++)
- {
-  if ( EqualSid ( ptg->Groups[dwGroup].Sid, psidAdmin))
-  {
-   fAdmin = TRUE;
-
-   break;
-  }
- }
-
- // Before we exit we must explicity deallocate the SID we created.
-
- FreeSid ( psidAdmin);
- return (FALSE != fAdmin);
-}
diff --git a/ica/win32/winvnc/winvnc/service.cpp b/ica/win32/winvnc/winvnc/service.cpp
deleted file mode 100644
index 18202a2..0000000
--- a/ica/win32/winvnc/winvnc/service.cpp
+++ /dev/null
@@ -1,1059 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncService
-
-// Implementation of service-oriented functionality of WinVNC
-#include <windows.h>
-#include <userenv.h>
-#include <wtsapi32.h>
-#include <stdio.h>
-#include <tlhelp32.h>
-#include "inifile.h"
-#include "common/win32_helpers.h"
-
-HANDLE hEvent=NULL;
-HANDLE hEventcad=NULL;
-extern HANDLE stopServiceEvent;
-static char app_path[MAX_PATH];
-typedef DWORD (*WTSGETACTIVECONSOLESESSIONID)();
-typedef bool (*WTSQUERYUSERTOKEN)(ULONG,PHANDLE);
-helper::DynamicFn<WTSGETACTIVECONSOLESESSIONID> lpfnWTSGetActiveConsoleSessionId("kernel32", "WTSGetActiveConsoleSessionId");
-helper::DynamicFn<WTSQUERYUSERTOKEN> lpfnWTSQueryUserToken("Wtsapi32.dll", "WTSQueryUserToken");
-PROCESS_INFORMATION  ProcessInfo;
-int counter=0;
-extern char cmdtext[256];
-int kickrdp=0;
-int clear_console=0;
-bool W2K=0;
-//////////////////////////////////////////////////////////////////////////////
-#define MAXSTRLENGTH    255
-BOOL Char2Wchar(WCHAR* pDest, char* pSrc, int nDestStrLen)
-{
-     int nSrcStrLen = 0;
-     int nOutputBuffLen = 0;
-
-     if(pDest == NULL || pSrc == NULL)
-     {
-          return FALSE;
-     }
-
-     nSrcStrLen = strlen(pSrc);
-     if(nSrcStrLen == 0)
-     {  
-          return FALSE;
-     }
-
-     nDestStrLen = nSrcStrLen;
-
-     if (nDestStrLen > MAXSTRLENGTH - 1)
-     {
-          return FALSE;
-     }
-     memset(pDest,0,sizeof(TCHAR)*nDestStrLen);
-     nOutputBuffLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pSrc,nSrcStrLen, pDest, nDestStrLen);
- 
-     if (nOutputBuffLen == 0)
-     {
-          GetLastError();
-          return FALSE;
-     }
-
-     pDest[nOutputBuffLen] = '\0';
-     return TRUE;
-}
-//////////////////////////////////////////////////////////////////////////////
-typedef BOOLEAN (WINAPI* pWinStationQueryInformationW)(
-  IN   HANDLE hServer,
-  IN   ULONG LogonId,
-  IN   DWORD /*WINSTATIONINFOCLASS*/ WinStationInformationClass,
-  OUT  PVOID pWinStationInformation,
-  IN   ULONG WinStationInformationLength,
-  OUT  PULONG pReturnLength
-);
-DWORD MarshallString(LPCWSTR    pszText, LPVOID, DWORD  dwMaxSize,LPBYTE*
-ppNextBuf, DWORD* pdwUsedBytes)
-{
-        DWORD   dwOffset = *pdwUsedBytes;
-        if(!pszText)
-                return 0;
-        DWORD   dwLen = (wcslen(pszText)+1)*sizeof(WCHAR);
-        if(*pdwUsedBytes + dwLen> dwMaxSize)
-                return 0;
-        memmove(*ppNextBuf, pszText , dwLen);
-        *pdwUsedBytes += dwLen;
-        *ppNextBuf += dwLen;
-        return dwOffset;
-
-}
-
-typedef struct _CPAU_PARAM{
-        DWORD   cbSize;
-        DWORD   dwProcessId;
-        BOOL    bUseDefaultToken;
-        HANDLE  hToken;
-        LPWSTR  lpApplicationName;
-        LPWSTR  lpCommandLine;
-        SECURITY_ATTRIBUTES     ProcessAttributes;
-        SECURITY_ATTRIBUTES ThreadAttributes;
-        BOOL bInheritHandles;
-        DWORD dwCreationFlags;
-        LPVOID lpEnvironment;
-        LPWSTR lpCurrentDirectory;
-        STARTUPINFOW StartupInfo;
-        PROCESS_INFORMATION     ProcessInformation;
-
-}CPAU_PARAM;
-
-typedef struct _CPAU_RET_PARAM{
-        DWORD   cbSize;
-        BOOL    bRetValue;
-        DWORD   dwLastErr;
-        PROCESS_INFORMATION     ProcInfo;
-
-}CPAU_RET_PARAM;
-
-BOOL CreateRemoteSessionProcess(
-        IN DWORD        dwSessionId,
-        IN BOOL         bUseDefaultToken,
-        IN HANDLE       hToken,
-        IN LPCWSTR      lpApplicationName,
-        IN LPSTR       A_lpCommandLine,
-        IN LPSECURITY_ATTRIBUTES lpProcessAttributes,
-        IN LPSECURITY_ATTRIBUTES lpThreadAttributes,
-        IN BOOL bInheritHandles,
-        IN DWORD dwCreationFlags,
-        IN LPVOID lpEnvironment,
-        IN LPCWSTR lpCurrentDirectory,
-        IN LPSTARTUPINFO A_lpStartupInfo,
-        OUT LPPROCESS_INFORMATION lpProcessInformation)
-{
-
-		WCHAR       lpCommandLine[255];
-		STARTUPINFOW StartupInfo;
-		Char2Wchar(lpCommandLine, A_lpCommandLine, 255);
-		ZeroMemory(&StartupInfo,sizeof(STARTUPINFOW));
-		StartupInfo.wShowWindow = SW_SHOW;
-		StartupInfo.lpDesktop = L"Winsta0\\Winlogon";
-		StartupInfo.cb = sizeof(STARTUPINFOW);
-
-        WCHAR           szWinStaPath[MAX_PATH];
-        BOOL            bGetNPName=FALSE;
-        WCHAR           szNamedPipeName[MAX_PATH]=L"";
-        DWORD           dwNameLen;
-        HINSTANCE       hInstWinSta;
-        HANDLE          hNamedPipe;
-        BOOL            bRet = FALSE;
-        DWORD           cbReadBytes,cbWriteBytes;
-        DWORD           dwEnvLen = 0;
-        union{
-                CPAU_PARAM      cpauData;
-                BYTE            bDump[0x2000];
-        };
-        CPAU_RET_PARAM  cpauRetData;
-        DWORD                   dwUsedBytes = sizeof(cpauData);
-        LPBYTE                  pBuffer = (LPBYTE)(&cpauData+1);
-        GetSystemDirectoryW(szWinStaPath, MAX_PATH);
-        lstrcatW(szWinStaPath,L"\\winsta.dll");
-        hInstWinSta = LoadLibraryW(szWinStaPath);
-
-        if(hInstWinSta)
-        {
-                pWinStationQueryInformationW pfWinStationQueryInformationW=(pWinStationQueryInformationW)GetProcAddress(hInstWinSta,"WinStationQueryInformationW");
-                if(pfWinStationQueryInformationW)
-                {
-                        bGetNPName = pfWinStationQueryInformationW(0, dwSessionId, 0x21,szNamedPipeName, sizeof(szNamedPipeName), &dwNameLen);
-                }
-                FreeLibrary(hInstWinSta);
-        }
-        if(!bGetNPName || szNamedPipeName[0] == '\0')
-        {
-                swprintf(szNamedPipeName,L"\\\\.\\Pipe\\TerminalServer\\SystemExecSrvr\\%d", dwSessionId);
-        }
-
-        do{
-                hNamedPipe = CreateFileW(szNamedPipeName, GENERIC_READ|GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, 0);
-                if(hNamedPipe == INVALID_HANDLE_VALUE)
-                {
-                        if(GetLastError() == ERROR_PIPE_BUSY)
-                        {
-                                if(!WaitNamedPipeW(szNamedPipeName, 30000))
-                                        return FALSE;
-                        }
-                        else
-                        {
-                                return FALSE;
-                        }
-                }
-        }while(hNamedPipe == INVALID_HANDLE_VALUE);
-
-        memset(&cpauData, 0, sizeof(cpauData));
-        cpauData.bInheritHandles        = bInheritHandles;
-        cpauData.bUseDefaultToken       = bUseDefaultToken;
-        cpauData.dwCreationFlags        = dwCreationFlags;
-        cpauData.dwProcessId            = GetCurrentProcessId();
-        cpauData.hToken                         = hToken;
-        cpauData.lpApplicationName      =(LPWSTR)MarshallString(lpApplicationName, &cpauData, sizeof(bDump),&pBuffer, &dwUsedBytes);
-        cpauData.lpCommandLine          = (LPWSTR)MarshallString(lpCommandLine,&cpauData, sizeof(bDump), &pBuffer, &dwUsedBytes);
-        cpauData.StartupInfo            = StartupInfo;
-        cpauData.StartupInfo.lpDesktop  =(LPWSTR)MarshallString(cpauData.StartupInfo.lpDesktop, &cpauData,sizeof(bDump), &pBuffer, &dwUsedBytes);
-        cpauData.StartupInfo.lpTitle    =(LPWSTR)MarshallString(cpauData.StartupInfo.lpTitle, &cpauData,sizeof(bDump), &pBuffer, &dwUsedBytes);
-
-        if(lpEnvironment)
-        {
-                if(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)
-                {
-                        while((dwEnvLen+dwUsedBytes <= sizeof(bDump)))
-                        {
-                                if(((LPWSTR)lpEnvironment)[dwEnvLen/2]=='\0' &&((LPWSTR)lpEnvironment)[dwEnvLen/2+1] == '\0')
-                                {
-                                        dwEnvLen+=2*sizeof(WCHAR);
-                                        break;
-                                }
-                                dwEnvLen+=sizeof(WCHAR);
-                        }
-                }
-                else
-                {
-                        while(dwEnvLen+dwUsedBytes <= sizeof(bDump))
-                        {
-                                if(((LPSTR)lpEnvironment)[dwEnvLen]=='\0' && ((LPSTR)lpEnvironment)[dwEnvLen+1]=='\0')
-                                {
-                                        dwEnvLen+=2;
-                                        break;
-                                }
-                                dwEnvLen++;
-                        }
-                }
-                if(dwEnvLen+dwUsedBytes <= sizeof(bDump))
-                {
-                        memmove(pBuffer, lpEnvironment, dwEnvLen);
-                        cpauData.lpEnvironment = (LPVOID)dwUsedBytes;
-                        pBuffer += dwEnvLen;
-                        dwUsedBytes += dwEnvLen;
-                }
-                else
-                {
-                        cpauData.lpEnvironment = NULL;
-                }
-        }
-        else
-        {
-                cpauData.lpEnvironment  = NULL;
-        }
-        cpauData.cbSize  = dwUsedBytes;
-
-		HANDLE hProcess=NULL;
-        if(WriteFile(hNamedPipe, &cpauData, cpauData.cbSize, &cbWriteBytes,NULL))
-		{
-			Sleep(250);
-			if (ReadFile(hNamedPipe, & cpauRetData, sizeof(cpauRetData),&cbReadBytes, NULL))
-			{
-				hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, cpauRetData.ProcInfo.dwProcessId);
-	#ifdef _DEBUG
-						char			szText[256];
-						sprintf(szText," ++++++cpau  %i  %i %i %i %i %i\n",cpauRetData.bRetValue,cpauRetData.ProcInfo.hProcess,cpauRetData.ProcInfo.dwProcessId,cpauRetData.ProcInfo.dwThreadId,cpauRetData.ProcInfo.hThread,hProcess);
-						OutputDebugString(szText);						
-	#endif
-					bRet = cpauRetData.bRetValue;
-					if(bRet)
-					{
-							*lpProcessInformation = cpauRetData.ProcInfo;
-					}
-					else
-							SetLastError(cpauRetData.dwLastErr);
-			}
-		}
-        else
-                bRet = FALSE;
-		// function sometimes fail, the use processid to get hprocess... bug MS
-		if (lpProcessInformation->hProcess==0) lpProcessInformation->hProcess=hProcess;
-		//this should never happen, looping connections
-		if (lpProcessInformation->hProcess==0) 
-			Sleep(5000);
-        CloseHandle(hNamedPipe);
-        return bRet;
-
-}
-//////////////////////////////////////////////////////////////////////////////
-
-static int pad2()
-{
-
-	OSVERSIONINFO OSversion;
-	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-
-	GetVersionEx(&OSversion);
-	W2K=0;
-	switch(OSversion.dwPlatformId)
-	{
-		case VER_PLATFORM_WIN32_NT:
-						  if(OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==0)
-									 W2K=1;							    
-								  
-	}
-	char exe_file_name[MAX_PATH];
-	char cmdline[MAX_PATH];
-    GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-    strcpy(app_path, exe_file_name);
-	strcat(app_path, " ");
-	strcat(app_path,cmdtext);
-    strcat(app_path, "_run");
-	IniFile myIniFile;
-	kickrdp=myIniFile.ReadInt("admin", "kickrdp", kickrdp);
-	clear_console=myIniFile.ReadInt("admin", "clearconsole", clear_console);
-	myIniFile.ReadString("admin", "service_commandline",cmdline,256);
-	if (strlen(cmdline)!=0)
-	{
-		strcpy(app_path, exe_file_name);
-		strcat(app_path, " ");
-		strcat(app_path,cmdline);
-		strcat(app_path, " -service_run");
-	}
-	return 0;
-}
-//////////////////////////////////////////////////////////////////////////////
-
-BOOL SetTBCPrivileges(VOID) {
-  DWORD dwPID;
-  HANDLE hProcess;
-  HANDLE hToken;
-  LUID Luid;
-  TOKEN_PRIVILEGES tpDebug;
-  dwPID = GetCurrentProcessId();
-  if ((hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID)) == NULL) return FALSE;
-  if (OpenProcessToken(hProcess, TOKEN_ALL_ACCESS, &hToken) == 0) return FALSE;
-  if ((LookupPrivilegeValue(NULL, SE_TCB_NAME, &Luid)) == 0) return FALSE;
-  tpDebug.PrivilegeCount = 1;
-  tpDebug.Privileges[0].Luid = Luid;
-  tpDebug.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-  if ((AdjustTokenPrivileges(hToken, FALSE, &tpDebug, sizeof(tpDebug), NULL, NULL)) == 0) return FALSE;
-  if (GetLastError() != ERROR_SUCCESS) return FALSE;
-  CloseHandle(hToken);
-  CloseHandle(hProcess);
-  return TRUE;
-}
-//////////////////////////////////////////////////////////////////////////////
-#include <tlhelp32.h>
-
-DWORD GetwinlogonPid()
-{
-	//DWORD dwSessionId;
-	DWORD dwExplorerLogonPid=0;
-	PROCESSENTRY32 procEntry;
-
-	//dwSessionId=0;
-
-	
-
-    HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-    if (hSnap == INVALID_HANDLE_VALUE)
-    {
-        return 0 ;
-    }
-
-    procEntry.dwSize = sizeof(PROCESSENTRY32);
-
-    if (!Process32First(hSnap, &procEntry))
-    {
-		CloseHandle(hSnap);
-        return 0 ;
-    }
-
-    do
-    {
-        if (_stricmp(procEntry.szExeFile, "winlogon.exe") == 0)
-        {
-			dwExplorerLogonPid = procEntry.th32ProcessID;
-        }
-
-    } while (Process32Next(hSnap, &procEntry));
-	CloseHandle(hSnap);
-	return dwExplorerLogonPid;
-}
-//////////////////////////////////////////////////////////////////////////////
-DWORD
-Find_winlogon(DWORD SessionId)
-{
-
-  PWTS_PROCESS_INFO pProcessInfo = NULL;
-  DWORD         ProcessCount = 0;
-//  char         szUserName[255];
-  DWORD         Id = -1;
-
-  typedef BOOL (WINAPI *pfnWTSEnumerateProcesses)(HANDLE,DWORD,DWORD,PWTS_PROCESS_INFO*,DWORD*);
-  typedef VOID (WINAPI *pfnWTSFreeMemory)(PVOID);
-
-  helper::DynamicFn<pfnWTSEnumerateProcesses> pWTSEnumerateProcesses("wtsapi32","WTSEnumerateProcessesA");
-  helper::DynamicFn<pfnWTSFreeMemory> pWTSFreeMemory("wtsapi32", "WTSFreeMemory");
-
-  if (pWTSEnumerateProcesses.isValid() && pWTSFreeMemory.isValid())
-  {
-    if ((*pWTSEnumerateProcesses)(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pProcessInfo, &ProcessCount))
-  {
-    // dump each process description
-    for (DWORD CurrentProcess = 0; CurrentProcess < ProcessCount; CurrentProcess++)
-    {
-
-        if( _stricmp(pProcessInfo[CurrentProcess].pProcessName, "winlogon.exe") == 0 )
-        {    
-			if (SessionId==pProcessInfo[CurrentProcess].SessionId)
-			{
-            Id = pProcessInfo[CurrentProcess].ProcessId;
-            break;
-			}
-        }
-    }
-
-    (*pWTSFreeMemory)(pProcessInfo);
-    }
-  }
-
-  return Id;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-BOOL
-get_winlogon_handle(OUT LPHANDLE  lphUserToken)
-{
-	BOOL   bResult = FALSE;
-	HANDLE hProcess;
-	HANDLE hTokenThis = NULL;
-	DWORD ID_session=0;
-	if (lpfnWTSGetActiveConsoleSessionId.isValid()) ID_session=(*lpfnWTSGetActiveConsoleSessionId)();
-	DWORD Id=0;
-	if (W2K==0) Id=Find_winlogon(ID_session);
-	else Id=GetwinlogonPid();
-
-    // fall back to old method if Terminal services is disabled
-    if (W2K == 0 && Id == (DWORD)-1)
-        Id=GetwinlogonPid();
-
-	#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText," ++++++ Find_winlogon %i %i %d\n",ID_session,Id,error);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif
-
-
-	hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, Id );
-	if (hProcess)
-	{
-		#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText," ++++++ OpenProcess %i \n",hProcess);
-					SetLastError(0);
-					OutputDebugString(szText);		
-		#endif
-
-		OpenProcessToken(hProcess, TOKEN_ASSIGN_PRIMARY|TOKEN_ALL_ACCESS, &hTokenThis);
-
-		#ifdef _DEBUG
-					error=GetLastError();
-					sprintf(szText," ++++++ OpenProcessToken %i %i\n",hTokenThis,error);
-					SetLastError(0);
-					OutputDebugString(szText);		
-		#endif
-		{
-		bResult = DuplicateTokenEx(hTokenThis, TOKEN_ASSIGN_PRIMARY|TOKEN_ALL_ACCESS,NULL, SecurityImpersonation, TokenPrimary, lphUserToken);
-		#ifdef _DEBUG
-					error=GetLastError();
-					sprintf(szText," ++++++ DuplicateTokenEx %i %i %i %i\n",hTokenThis,&lphUserToken,error,bResult);
-					SetLastError(0);
-					OutputDebugString(szText);		
-		#endif
-		SetTokenInformation(*lphUserToken, TokenSessionId, &ID_session, sizeof(DWORD));
-		#ifdef _DEBUG
-					error=GetLastError();
-					sprintf(szText," ++++++ SetTokenInformation( %i %i %i\n",hTokenThis,&lphUserToken,error);
-					SetLastError(0);
-					OutputDebugString(szText);		
-		#endif
-		CloseHandle(hTokenThis);
-		}
-		CloseHandle(hProcess);
-	}
-	return bResult;
-}
-//////////////////////////////////////////////////////////////////////////////
-
-BOOL
-GetSessionUserTokenWin(OUT LPHANDLE  lphUserToken)
-{
-  BOOL   bResult = FALSE;
-  if (lpfnWTSGetActiveConsoleSessionId.isValid()) (*lpfnWTSGetActiveConsoleSessionId)();
-  
-  if (lphUserToken != NULL) {   
-		  bResult = get_winlogon_handle(lphUserToken);
-  }
-  return bResult;
-}
-//////////////////////////////////////////////////////////////////////////////
-BOOL
-GetSessionUserTokenDefault(OUT LPHANDLE  lphUserToken)
-{
-  BOOL   bResult = FALSE;
-  HANDLE hImpersonationToken = INVALID_HANDLE_VALUE;
-  DWORD ID=0;
-  if (lpfnWTSGetActiveConsoleSessionId.isValid()) ID=(*lpfnWTSGetActiveConsoleSessionId)();
-
-  if (lphUserToken != NULL) {   
-      if ((*lpfnWTSQueryUserToken)(ID, &hImpersonationToken)) 
-      {
-        bResult = DuplicateTokenEx(hImpersonationToken,
-                                   0,
-                                   NULL,
-                                   SecurityImpersonation,
-                                   TokenPrimary,
-                                   lphUserToken);
-        CloseHandle(hImpersonationToken);
-      }     
-  }
-  return bResult;
-
-}
-//////////////////////////////////////////////////////////////////////////////
-// START the app as system 
-BOOL
-LaunchProcessWin(DWORD dwSessionId)
-{
-  BOOL                 bReturn = FALSE;
-  HANDLE               hToken;
-  STARTUPINFO          StartUPInfo;
-  PVOID                lpEnvironment = NULL;
-
-  ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-  ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-  StartUPInfo.wShowWindow = SW_SHOW;
-  StartUPInfo.lpDesktop = "Winsta0\\Winlogon";
-  //StartUPInfo.lpDesktop = "Winsta0\\Default";
-  StartUPInfo.cb = sizeof(STARTUPINFO);
-  SetTBCPrivileges();
-  pad2();
-
-  if ( GetSessionUserTokenWin(&hToken) )
-  {
-      if ( CreateEnvironmentBlock(&lpEnvironment, hToken, FALSE) ) 
-      {
-      
-		 SetLastError(0);
-         if (CreateProcessAsUser(hToken,NULL,app_path,NULL,NULL,FALSE,CREATE_UNICODE_ENVIRONMENT |DETACHED_PROCESS,lpEnvironment,NULL,&StartUPInfo,&ProcessInfo))
-			{
-				counter=0;
-				bReturn = TRUE;
-				#ifdef _DEBUG
-					DWORD error=GetLastError();
-					char			szText[256];
-					sprintf(szText," ++++++ CreateProcessAsUser winlogon %d\n",error);
-					OutputDebugString(szText);		
-				#endif
-			}
-		 else
-		 {
-			 DWORD error=GetLastError();
-			 #ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++ CreateProcessAsUser failed %d %d %d\n",error,kickrdp,counter);
-					OutputDebugString(szText);		
-			#endif
-			if (error==233 && kickrdp==1)
-					{
-						counter++;
-						if (counter>3)
-							{
-								#ifdef _DEBUG
-								DWORD error=GetLastError();
-								sprintf(szText," ++++++ error==233 win\n");
-								SetLastError(0);
-								OutputDebugString(szText);		
-								#endif
-								typedef BOOLEAN (WINAPI * pWinStationConnect) (HANDLE,ULONG,ULONG,PCWSTR,ULONG);
-								typedef BOOL (WINAPI * pLockWorkStation)();
-								HMODULE  hlibwinsta = LoadLibrary("winsta.dll"); 
-								HMODULE  hlibuser32 = LoadLibrary("user32.dll");
-								pWinStationConnect WinStationConnectF=NULL;
-								pLockWorkStation LockWorkStationF=NULL;
-
-								if (hlibwinsta)
-								   {
-									   WinStationConnectF=(pWinStationConnect)GetProcAddress(hlibwinsta, "WinStationConnectW"); 
-								   }
-								if (hlibuser32)
-								   {
-									   LockWorkStationF=(pLockWorkStation)GetProcAddress(hlibuser32, "LockWorkStation"); 
-								   }
-								if (WinStationConnectF!=NULL && WinStationConnectF!=NULL)
-									{
-											DWORD ID=0;
-											if (lpfnWTSGetActiveConsoleSessionId.isValid()) ID=(*lpfnWTSGetActiveConsoleSessionId)();
-											WinStationConnectF(0, 0, ID, L"", 0);
-											LockWorkStationF();
-									}
-								Sleep(3000);
-						}
-					}
-			else if (error==233)
-			{
-				CreateRemoteSessionProcess(dwSessionId,true,hToken,NULL,app_path,NULL,NULL,FALSE,CREATE_UNICODE_ENVIRONMENT |DETACHED_PROCESS,lpEnvironment,NULL,&StartUPInfo,&ProcessInfo);
-				counter=0;
-				bReturn = TRUE;
-			}
-		 }
-
-         if (lpEnvironment) 
-         {
-            DestroyEnvironmentBlock(lpEnvironment);
-         }
-
-	  }//createenv
-	  else
-	  {
-		  SetLastError(0);
-         if (CreateProcessAsUser(hToken,NULL,app_path,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo))
-			{
-				counter=0;
-				bReturn = TRUE;
-				#ifdef _DEBUG
-					DWORD error=GetLastError();
-					char			szText[256];
-					sprintf(szText," ++++++ CreateProcessAsUser winlogon %d\n",error);
-					OutputDebugString(szText);		
-				#endif
-			}
-		 else
-		 {
-			 DWORD error=GetLastError();
-			 #ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++ CreateProcessAsUser no env failed %d\n",error);
-					OutputDebugString(szText);		
-			#endif
-			//Little trick needed, FUS sometimes has an unreachable logon session.
-			 //Switch to USER B, logout user B
-			 //The logon session is then unreachable
-			 //We force the logon session on the console
-			if (error==233 && kickrdp==1)
-					{
-						counter++;
-						if (counter>3)
-							{
-								#ifdef _DEBUG
-								DWORD error=GetLastError();
-								sprintf(szText," ++++++ error==233 win\n");
-								SetLastError(0);
-								OutputDebugString(szText);		
-								#endif
-								typedef BOOLEAN (WINAPI * pWinStationConnect) (HANDLE,ULONG,ULONG,PCWSTR,ULONG);
-								typedef BOOL (WINAPI * pLockWorkStation)();
-								HMODULE  hlibwinsta = LoadLibrary("winsta.dll"); 
-								HMODULE  hlibuser32 = LoadLibrary("user32.dll");
-								pWinStationConnect WinStationConnectF=NULL;
-								pLockWorkStation LockWorkStationF=NULL;
-
-								if (hlibwinsta)
-								   {
-									   WinStationConnectF=(pWinStationConnect)GetProcAddress(hlibwinsta, "WinStationConnectW"); 
-								   }
-								if (hlibuser32)
-								   {
-									   LockWorkStationF=(pLockWorkStation)GetProcAddress(hlibuser32, "LockWorkStation"); 
-								   }
-								if (WinStationConnectF!=NULL && WinStationConnectF!=NULL)
-									{
-											DWORD ID=0;
-											if (lpfnWTSGetActiveConsoleSessionId.isValid()) ID=(*lpfnWTSGetActiveConsoleSessionId)();
-											WinStationConnectF(0, 0, ID, L"", 0);
-											LockWorkStationF();
-									}
-								Sleep(3000);
-						}
-			}
-			else if (error==233)
-			{
-				CreateRemoteSessionProcess(dwSessionId,true,hToken,NULL,app_path,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-				counter=0;
-				bReturn = TRUE;
-			}
-	  }
-        
-	}  //getsession
-	CloseHandle(hToken);
-	}
-  else
-  {
-	 #ifdef _DEBUG
-	char			szText[256];
-	DWORD error=GetLastError();
-	sprintf(szText," ++++++ Getsessionusertokenwin failed %d\n",error);
-	OutputDebugString(szText);		
-	#endif
-
-  }
-    
-    return bReturn;
-}
-//////////////////////////////////////////////////////////////////////////////
-
-void wait_for_existing_process()
-{
-#ifdef _DEBUG
-        OutputDebugString("Checking for preexisting tray icon\n");
-#endif
-    while ((hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "Global\\SessionEventUltra")) != NULL) {
-    	SetEvent(hEvent); // signal tray icon to shut down 
-        CloseHandle(hEvent);
-
-#ifdef _DEBUG
-        OutputDebugString("Waiting for existing tray icon to exit\n");
-#endif
-        Sleep(1000);
-    }
-}
-
-#include <sddl.h>
-SECURITY_ATTRIBUTES secAttr;
-extern SERVICE_STATUS serviceStatus;
-
-char old_buffer_s[512];
-int old_buflen_s=0;
-char buffer_s[512];
-int buflen_s;
-
-bool CheckIPAddrString() {
-    char namebuf[256];
-
-    if (gethostname(namebuf, 256) != 0) {
-		strncpy(buffer_s, "Host name unavailable", buflen_s);
-		return false;
-    };
-
-    HOSTENT *ph = gethostbyname(namebuf);
-    if (!ph) {
-		strncpy(buffer_s, "IP address unavailable", buflen_s);
-		return false;
-    };
-
-    *buffer_s = '\0';
-    char digtxt[5];
-    for (int i = 0; ph->h_addr_list[i]; i++) {
-    	for (int j = 0; j < ph->h_length; j++) {
-			sprintf(digtxt, "%d.", (unsigned char) ph->h_addr_list[i][j]);
-			strncat(buffer_s, digtxt, (buflen_s-1)-strlen(buffer_s));
-		}	
-		buffer_s[strlen(buffer_s)-1] = '\0';
-		if (ph->h_addr_list[i+1] != 0)
-			strncat(buffer_s, ", ", (buflen_s-1)-strlen(buffer_s));
-    }
-	if (strlen(buffer_s)<512) // just in case it would be bigger then our buffer
-	{
-	if (old_buflen_s!=0)
-	{
-		if (strncmp(old_buffer_s,buffer_s,old_buflen_s)!=NULL)	
-		{
-			old_buflen_s=strlen(buffer_s);
-			strncpy(old_buffer_s,buffer_s,strlen(buffer_s));
-			return false;
-		}
-	}
-	old_buflen_s=strlen(buffer_s);
-	strncpy(old_buffer_s,buffer_s,strlen(buffer_s));
-	}
-	return true;
-}
-
-void monitor_sessions()
-{
-	pad2();
-
-	int counter_ipcheck=0;
-	DWORD dwSessionId=0;
-	DWORD OlddwSessionId=99;
-	ProcessInfo.hProcess=0;
-	bool Slow_connect=false;
-	bool last_con=false;
-	//We use this event to notify the program that the session has changed
-	//The program need to end so the service can restart the program in the correct session
-    wait_for_existing_process();
-	hEvent = CreateEvent(NULL, FALSE, FALSE, "Global\\SessionEventUltra");	
-	hEventcad = CreateEvent(NULL, FALSE, FALSE, "Global\\SessionEventUltraCad");
-	Sleep(3000);
-	HANDLE testevent[2];
-	testevent[0]=stopServiceEvent;
-	testevent[1]=hEventcad;
-	bool ToCont=true;
-	while(ToCont && serviceStatus.dwCurrentState==SERVICE_RUNNING)
-	{
-	DWORD dwEvent;
-	dwEvent=WaitForMultipleObjects(2,testevent,FALSE, 1000);
-	switch (dwEvent) 
-    { 
-		//stopServiceEvent, exit while loop
-		case WAIT_OBJECT_0 + 0: 
-			ToCont=false;
-            break; 
-
-        //cad request
-        case WAIT_OBJECT_0 + 1: 
-			{
-			typedef VOID (WINAPI *SendSas)(BOOL asUser);
-			HINSTANCE Inst = LoadLibrary("sas.dll");
-			SendSas sendSas = (SendSas) GetProcAddress(Inst, "SendSAS");
-			if (sendSas) sendSas(FALSE);
-			else
-			{
-				char WORKDIR[MAX_PATH];
-				char mycommand[MAX_PATH];
-				if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-					{
-					char* p = strrchr(WORKDIR, '\\');
-					if (p == NULL) return;
-					*p = '\0';
-					}
-				strcpy(mycommand,"");
-				strcat(mycommand,WORKDIR);//set the directory
-				strcat(mycommand,"\\");
-				strcat(mycommand,"cad.exe");
-				(void)ShellExecute(GetDesktopWindow(), "open", mycommand, "", 0, SW_SHOWNORMAL);
-			}
-			if (Inst) FreeLibrary(Inst);
-			}
-            break; 
-
-        case WAIT_TIMEOUT:
-			{
-				counter_ipcheck++;
-				if (counter_ipcheck==30)
-				{
-					counter_ipcheck=0;
-					if (!CheckIPAddrString()) OlddwSessionId=99;  //force restart
-				}
-
-									if (lpfnWTSGetActiveConsoleSessionId.isValid())
-										dwSessionId = (*lpfnWTSGetActiveConsoleSessionId)();
-									if (OlddwSessionId!=dwSessionId)
-									{
-										#ifdef _DEBUG
-												char			szText[256];
-												sprintf(szText," ++++++SetEvent Session change: signal tray icon to shut down\n");
-												OutputDebugString(szText);		
-										#endif
-										SetEvent(hEvent);
-									}
-
-		
-			
-
-									if (dwSessionId!=0xFFFFFFFF)
-										{
-													DWORD dwCode=0;
-													if (ProcessInfo.hProcess==NULL)
-													{
-																Sleep(1000);
-																if (Slow_connect) Sleep(2000);
-							#ifdef _DEBUG
-														OutputDebugString("No Tray icon existed, starting first process\n");
-							#endif
-																LaunchProcessWin(dwSessionId);
-																Slow_connect=false;
-													}
-													else if (GetExitCodeProcess(ProcessInfo.hProcess,&dwCode))
-													{
-														if(dwCode != STILL_ACTIVE)
-															{
-																if (last_con==true)
-																{
-																	//problems, we move from win-->default-->win
-																	// Put a long timeout to give system time to start or logout
-																	Sleep(2000);
-																}
-							//#if 0
-																Sleep(1000);
-																if (Slow_connect) Sleep(4000);
-							//#endif
-							#ifdef _DEBUG
-																OutputDebugString("Waiting up to 15 seconds for tray icon process to exit\n");
-							#endif
-
-																WaitForSingleObject(ProcessInfo.hProcess, 15000);
-																CloseHandle(ProcessInfo.hProcess);
-																CloseHandle(ProcessInfo.hThread);
-																LaunchProcessWin(dwSessionId);
-																Slow_connect=false;
-															}
-														else
-															{
-																if (Slow_connect==false)
-																{
-																	//This is the first time, so createprocess worked
-																	//last_con=false-->defaultdesk
-																	//last_con=true-->windesk
-																	last_con=false;
-																}
-																Slow_connect=true;
-															}
-													}
-													else
-													{
-														if (last_con==true)
-																{
-																	//problems, we move from win-->default-->win
-																	// Put a long timeout to give system time to start or logout
-																	Sleep(2000);
-																}
-														Sleep(1000);
-														if (Slow_connect) Sleep(4000);
-														if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-														if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-							#ifdef _DEBUG
-														OutputDebugString("Tray icon exited, starting new process\n");
-							#endif
-														LaunchProcessWin(dwSessionId);
-														Slow_connect=false;
-													}
-												#ifdef _DEBUG
-												char			szText[256];
-												sprintf(szText," ++++++1 %i %i %i %i\n",OlddwSessionId,dwSessionId,dwCode,ProcessInfo.hProcess);
-												OutputDebugString(szText);		
-												#endif
-												OlddwSessionId=dwSessionId;
-										}
-			}//timeout
-		}//switch
-	}//while
-	#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++SetEvent Service stopping: signal tray icon to shut down\n");
-					OutputDebugString(szText);		
-	#endif
-	if (hEvent) SetEvent(hEvent);
-
-    if (ProcessInfo.hProcess)
-    {
-#ifdef _DEBUG
-    OutputDebugString("Waiting up to 15 seconds for tray icon process to exit\n");
-#endif
-        WaitForSingleObject(ProcessInfo.hProcess, 15000);
-	    if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-	    if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-    }
-
-//	EndProcess();
-
-	if (hEvent) CloseHandle(hEvent);
-	if (hEventcad) CloseHandle(hEventcad);
-}
-
-// 20 April 2008 jdp paquette at atnetsend.net
-
-bool IsAnyRDPSessionActive()
-{
-    WTS_SESSION_INFO *pSessions = 0;
-    DWORD   nSessions(0);
-    DWORD   rdpSessionExists = false;
-
-    typedef BOOL (WINAPI *pfnWTSEnumerateSessions)(HANDLE,DWORD,DWORD,PWTS_SESSION_INFO*,DWORD*);
-    typedef VOID (WINAPI *pfnWTSFreeMemory)(PVOID);
-
-    helper::DynamicFn<pfnWTSEnumerateSessions> pWTSEnumerateSessions("wtsapi32","WTSEnumerateSessionsA");
-    helper::DynamicFn<pfnWTSFreeMemory> pWTSFreeMemory("wtsapi32", "WTSFreeMemory");
-
-    if (pWTSEnumerateSessions.isValid() && pWTSFreeMemory.isValid())
-
-
-    if ((*pWTSEnumerateSessions)(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pSessions, &nSessions)) 
-    {
-        for (DWORD i(0); i < nSessions && !rdpSessionExists; ++i)
-        {
-            if ((_stricmp(pSessions[i].pWinStationName, "Console") != 0) &&
-                (pSessions[i].State == WTSActive        || 
-                 pSessions[i].State == WTSShadow        ||
-                 pSessions[i].State == WTSConnectQuery
-                ))
-            {
-                rdpSessionExists = true;
-            }
-        }
-
-        (*pWTSFreeMemory)(pSessions);
-    }
-
-    return rdpSessionExists ? true : false;
-}
-
-// 20 April 2008 jdp paquette at atnetsend.net
-void disconnect_remote_sessions()
-{
-	typedef BOOLEAN (WINAPI * pWinStationConnect) (HANDLE,ULONG,ULONG,PCWSTR,ULONG);
-	
-	typedef BOOL (WINAPI * pLockWorkStation)();
-
-	HMODULE  hlibwinsta = LoadLibrary("winsta.dll"); 
-	HMODULE  hlibuser32 = LoadLibrary("user32.dll");
-	pWinStationConnect WinStationConnectF=NULL;
-	pLockWorkStation LockWorkStationF=NULL;
-
-
-    // don't kick rdp off if there's still an active session
-    if (IsAnyRDPSessionActive())
-        return;
-
-	if (hlibwinsta)
-	   {
-		   WinStationConnectF=(pWinStationConnect)GetProcAddress(hlibwinsta, "WinStationConnectW"); 
-	   }
-	
-	if (hlibuser32)
-	   {
-		   LockWorkStationF=(pLockWorkStation)GetProcAddress(hlibuser32, "LockWorkStation"); 
-	   }
-	if (WinStationConnectF!=NULL && LockWorkStationF!=NULL)
-		{
-				DWORD ID=0;
-				if (lpfnWTSGetActiveConsoleSessionId.isValid()) ID=(*lpfnWTSGetActiveConsoleSessionId)();
-				WinStationConnectF(0, 0, ID, L"", 0);
-				// sleep to allow the system to finish the connect/disconnect process. If we don't
-				// then the workstation won't get locked every time.
-            	Sleep(3000);
-				if (!LockWorkStationF())
-                {
-                    char msg[1024];
-                    sprintf(msg, "LockWorkstation failed with error 0x%0X", (unsigned int) GetLastError());
-                    ::OutputDebugString(msg);
-                }
-
-		}
-	Sleep(3000);
-
-	if (hlibwinsta)
-        FreeLibrary(hlibwinsta);
-	if (hlibuser32)
-        FreeLibrary(hlibuser32);
-}
-
diff --git a/ica/win32/winvnc/winvnc/service_motor.cpp b/ica/win32/winvnc/winvnc/service_motor.cpp
deleted file mode 100644
index 3e5b417..0000000
--- a/ica/win32/winvnc/winvnc/service_motor.cpp
+++ /dev/null
@@ -1,898 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include <windows.h>
-#include <wtsapi32.h>
-#include "common/win32_helpers.h"
-
-static void WINAPI service_main(DWORD, LPTSTR *);
-static void WINAPI control_handler(DWORD controlCode);
-static DWORD WINAPI control_handler_ex(DWORD controlCode, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext);
-static int pad();
-
-SERVICE_STATUS serviceStatus;
-static SERVICE_STATUS_HANDLE serviceStatusHandle=0;
-HANDLE stopServiceEvent=0;
-extern HANDLE hEvent;
-static char service_path[MAX_PATH];
-void monitor_sessions();
-void Restore_after_reboot();
-char service_name[256]="uvnc_service";
-char *app_name = "UltraVNC";
-void disconnect_remote_sessions();
-char cmdtext[256];
-extern int clear_console;
-bool IsWin2000()
-{
-	OSVERSIONINFO OSversion;
-	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-
-    if (OSversion.dwPlatformId == VER_PLATFORM_WIN32_NT)
-    {
-        if (OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==0)
-            return true; 
-						
-    }
-
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-static void WINAPI service_main(DWORD argc, LPTSTR* argv) {
-    /* initialise service status */
-    serviceStatus.dwServiceType=SERVICE_WIN32;
-    serviceStatus.dwCurrentState=SERVICE_STOPPED;
-    serviceStatus.dwControlsAccepted=0;
-    serviceStatus.dwWin32ExitCode=NO_ERROR;
-    serviceStatus.dwServiceSpecificExitCode=NO_ERROR;
-    serviceStatus.dwCheckPoint=0;
-    serviceStatus.dwWaitHint=0;
-
-    typedef SERVICE_STATUS_HANDLE (WINAPI * pfnRegisterServiceCtrlHandlerEx)(LPCTSTR, LPHANDLER_FUNCTION_EX, LPVOID);
-    helper::DynamicFn<pfnRegisterServiceCtrlHandlerEx> pRegisterServiceCtrlHandlerEx("advapi32.dll","RegisterServiceCtrlHandlerExA");
-
-    if (pRegisterServiceCtrlHandlerEx.isValid())
-      serviceStatusHandle = (*pRegisterServiceCtrlHandlerEx)(service_name, control_handler_ex, 0);
-    else 
-      serviceStatusHandle = RegisterServiceCtrlHandler(service_name, control_handler);
-
-    if(serviceStatusHandle) {
-        /* service is starting */
-        serviceStatus.dwCurrentState=SERVICE_START_PENDING;
-        SetServiceStatus(serviceStatusHandle, &serviceStatus);
-
-        /* do initialisation here */
-        stopServiceEvent=CreateEvent(0, FALSE, FALSE, 0);
-
-        /* running */
-        serviceStatus.dwControlsAccepted |= (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
-        if (!IsWin2000())
-            serviceStatus.dwControlsAccepted |= SERVICE_ACCEPT_SESSIONCHANGE;
-
-        serviceStatus.dwCurrentState=SERVICE_RUNNING;
-        SetServiceStatus(serviceStatusHandle, &serviceStatus);
-
-Restore_after_reboot();
-monitor_sessions();
-
-        /* service was stopped */
-        serviceStatus.dwCurrentState=SERVICE_STOP_PENDING;
-        SetServiceStatus(serviceStatusHandle, &serviceStatus);
-
-        /* do cleanup here */
-        if (stopServiceEvent) CloseHandle(stopServiceEvent);
-        stopServiceEvent=0;
-
-        /* service is now stopped */
-        serviceStatus.dwControlsAccepted&=
-            ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
-        serviceStatus.dwCurrentState=SERVICE_STOPPED;
-        SetServiceStatus(serviceStatusHandle, &serviceStatus);
-    }
-}
-////////////////////////////////////////////////////////////////////////////////
-static void WINAPI control_handler(DWORD controlCode)
-{
-  control_handler_ex(controlCode, 0, 0, 0);
-}
-static DWORD WINAPI control_handler_ex(DWORD controlCode, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) {
-    switch (controlCode) {
-    case SERVICE_CONTROL_INTERROGATE:
-        break;
-
-    case SERVICE_CONTROL_SHUTDOWN:
-    case SERVICE_CONTROL_STOP:
-        serviceStatus.dwCurrentState=SERVICE_STOP_PENDING;
-        SetServiceStatus(serviceStatusHandle, &serviceStatus);
-        SetEvent(stopServiceEvent);
-		SetEvent(hEvent);
-        return NO_ERROR;
-
-    case SERVICE_CONTROL_PAUSE:
-        break;
-
-    case SERVICE_CONTROL_CONTINUE:
-        break;
-
-    case SERVICE_CONTROL_SESSIONCHANGE:
-        {
-            if (dwEventType == WTS_REMOTE_DISCONNECT)
-            {
-                // disconnect rdp, and reconnect to the console
-                if ( clear_console) disconnect_remote_sessions();
-            }
-        }
-        break;
-
-    default:
-        if(controlCode >= 128 && controlCode <= 255)
-            break; 
-        else
-            break;
-    }
-    SetServiceStatus(serviceStatusHandle, &serviceStatus);
-    return NO_ERROR;
-}
-////////////////////////////////////////////////////////////////////////////////
-int start_service(char *cmd) {
-	strcpy_s(cmdtext,256,cmd);
-    SERVICE_TABLE_ENTRY serviceTable[]={
-	 {service_name, service_main},
-        {0, 0}
-    };
-
-    if(!StartServiceCtrlDispatcher(serviceTable)) {
-        return 1;
-    }
-    return 0; /* NT service started */
-}
-////////////////////////////////////////////////////////////////////////////////
-void set_service_description()
-{
-    // Add service description 
-	DWORD	dw;
-	HKEY hKey;
-	char tempName[256];
-    char desc[] = "Provides secure remote desktop sharing";
-	_snprintf(tempName,  sizeof tempName, "SYSTEM\\CurrentControlSet\\Services\\%s", service_name);
-	RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-						tempName,
-						0,
-						REG_NONE,
-						REG_OPTION_NON_VOLATILE,
-						KEY_READ|KEY_WRITE,
-						NULL,
-						&hKey,
-						&dw);
-	RegSetValueEx(hKey,
-					"Description",
-					0,
-					REG_SZ,
-					(const BYTE *)desc,
-					strlen(desc)+1);
-
-
-	RegCloseKey(hKey);
-}
-
-
-// List of other required services ("dependency 1\0dependency 2\0\0")
-// *** These need filling in properly
-#define VNCDEPENDENCIES    "Tcpip\0\0"
-
-
-
-int install_service(void) {
-    SC_HANDLE scm, service;
-	pad();
-
-    scm=OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
-    if(!scm) {
-        MessageBoxSecure(NULL, "Failed to open service control manager",
-            app_name, MB_ICONERROR);
-        return 1;
-    }
-    //"Provides secure remote desktop sharing"
-    service=CreateService(scm,service_name, service_name, SERVICE_ALL_ACCESS,
-                          SERVICE_WIN32_OWN_PROCESS,
-                          SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, service_path,
-        NULL, NULL, VNCDEPENDENCIES, NULL, NULL);
-    if(!service) {
-		DWORD myerror=GetLastError();
-		if (myerror==ERROR_ACCESS_DENIED)
-		{
-			MessageBoxSecure(NULL, "Failed: Permission denied",
-            app_name, MB_ICONERROR);
-			CloseServiceHandle(scm);
-			return 1;
-		}
-		if (myerror==ERROR_SERVICE_EXISTS)
-		{
-			//MessageBoxSecure(NULL, "Failed: Already exist",
-            //"UltraVnc", MB_ICONERROR);
-			CloseServiceHandle(scm);
-			return 1;
-		}
-
-        MessageBoxSecure(NULL, "Failed to create a new service",
-            app_name, MB_ICONERROR);
-        CloseServiceHandle(scm);
-        return 1;
-    }
-    else
-        set_service_description();
-    CloseServiceHandle(service);
-    CloseServiceHandle(scm);
-    return 0;
-}
-////////////////////////////////////////////////////////////////////////////////
-int uninstall_service(void) {
-    SC_HANDLE scm, service;
-    SERVICE_STATUS serviceStatus;
-
-    scm=OpenSCManager(0, 0, SC_MANAGER_CONNECT);
-    if(!scm) {
-        MessageBoxSecure(NULL, "Failed to open service control manager",
-            app_name, MB_ICONERROR);
-        return 1;
-    }
-
-	service=OpenService(scm, service_name,
-        SERVICE_QUERY_STATUS | DELETE);
-    if(!service) {
-		DWORD myerror=GetLastError();
-		if (myerror==ERROR_ACCESS_DENIED)
-		{
-			MessageBoxSecure(NULL, "Failed: Permission denied",
-            app_name, MB_ICONERROR);
-			CloseServiceHandle(scm);
-			return 1;
-		}
-		if (myerror==ERROR_SERVICE_DOES_NOT_EXIST)
-		{
-#if 0
-			MessageBoxSecure(NULL, "Failed: Service is not installed",
-            app_name, MB_ICONERROR);
-#endif
-			CloseServiceHandle(scm);
-			return 1;
-		}
-
-        MessageBoxSecure(NULL, "Failed to open the service",
-            app_name, MB_ICONERROR);
-        CloseServiceHandle(scm);
-        return 1;
-    }
-    if(!QueryServiceStatus(service, &serviceStatus)) {
-        MessageBoxSecure(NULL, "Failed to query service status",
-            app_name, MB_ICONERROR);
-        CloseServiceHandle(service);
-        CloseServiceHandle(scm);
-        return 1;
-    }
-    if(serviceStatus.dwCurrentState!=SERVICE_STOPPED) {
-        //MessageBoxSecure(NULL, "The service is still running, disable it first",
-        //    "UltraVnc", MB_ICONERROR);
-        CloseServiceHandle(service);
-        CloseServiceHandle(scm);
-		Sleep(2500);uninstall_service();
-        return 1;
-    }
-    if(!DeleteService(service)) {
-        MessageBoxSecure(NULL, "Failed to delete the service",
-            app_name, MB_ICONERROR);
-        CloseServiceHandle(service);
-        CloseServiceHandle(scm);
-        return 1;
-    }
-    CloseServiceHandle(service);
-    CloseServiceHandle(scm);
-    return 0;
-}
-////////////////////////////////////////////////////////////////////////////////
-static int pad()
-{
-	char exe_file_name[MAX_PATH], dir[MAX_PATH], *ptr;
-    GetModuleFileName(0, exe_file_name, MAX_PATH);
-
-    /* set current directory */
-    strcpy(dir, exe_file_name);
-    ptr=strrchr(dir, '\\'); /* last backslash */
-    if(ptr)
-        ptr[1]='\0'; /* truncate program name */
-    if(!SetCurrentDirectory(dir)) {
-        return 1;
-    }
-
-    strcpy(service_path, "\"");
-    strcat(service_path, exe_file_name);
-    strcat(service_path, "\" -service");
-	return 0;
-}
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-BOOL CreateServiceSafeBootKey()
-{
-	HKEY hKey;
-	DWORD dwDisp = 0;
-	LONG lSuccess;
-	char szKey[1024];
-	_snprintf(szKey, 1024, "SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\%s\\%s", "Network", service_name);
-	lSuccess = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0L, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisp);
-	if (lSuccess == ERROR_SUCCESS)
-	{
-    RegSetValueEx(hKey, NULL, 0, REG_SZ, (unsigned char*)"Service", 8);
-		RegCloseKey(hKey);
-		return TRUE;
-	}
-	else
-		return FALSE;
-}
-////////////////////////////////////////////////////////////////////////////////
-void Set_Safemode()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6)
-			{
-					char drivepath[150];
-					char systemdrive[150];
-					char stringvalue[512];
-					GetEnvironmentVariable("SYSTEMDRIVE", systemdrive, 150);
-					strcat (systemdrive,"/boot.ini");
-					GetPrivateProfileString("boot loader","default","",drivepath,150,systemdrive);
-					if (strlen(drivepath)==0) return;
-					GetPrivateProfileString("operating systems",drivepath,"",stringvalue,512,systemdrive);
-					if (strlen(stringvalue)==0) return;
-					strcat(stringvalue," /safeboot:network");
-					SetFileAttributes(systemdrive,FILE_ATTRIBUTE_NORMAL);
-					WritePrivateProfileString("operating systems",drivepath,stringvalue,systemdrive);
-
-			}
-			else
-			{
-
-#ifdef _X64
-			char systemroot[150];
-			GetEnvironmentVariable("SystemRoot", systemroot, 150);
-			char exe_file_name[MAX_PATH];
-			char parameters[MAX_PATH];
-			strcpy(exe_file_name,systemroot);
-			strcat(exe_file_name,"\\system32\\");
-			strcat(exe_file_name,"bcdedit.exe");
-			strcpy(parameters,"/set safeboot network");
-			SHELLEXECUTEINFO shExecInfo;
-			shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-			shExecInfo.fMask = 0;
-			shExecInfo.hwnd = GetForegroundWindow();
-			shExecInfo.lpVerb = "runas";
-			shExecInfo.lpFile = exe_file_name;
-			shExecInfo.lpParameters = parameters;
-			shExecInfo.lpDirectory = NULL;
-			shExecInfo.nShow = SW_HIDE;
-			shExecInfo.hInstApp = NULL;
-			ShellExecuteEx(&shExecInfo);
-#else
-
-			typedef BOOL (WINAPI *LPFN_Wow64DisableWow64FsRedirection)(PVOID* OldValue);
-			typedef BOOL (WINAPI *LPFN_Wow64RevertWow64FsRedirection)(PVOID OldValue);
-			PVOID OldValue;  
-			LPFN_Wow64DisableWow64FsRedirection pfnWow64DisableWowFsRedirection = (LPFN_Wow64DisableWow64FsRedirection)GetProcAddress(GetModuleHandle("kernel32"),"Wow64DisableWow64FsRedirection");
-			LPFN_Wow64RevertWow64FsRedirection pfnWow64RevertWow64FsRedirection = (LPFN_Wow64RevertWow64FsRedirection)GetProcAddress(GetModuleHandle("kernel32"),"Wow64RevertWow64FsRedirection");
-			if (pfnWow64DisableWowFsRedirection && pfnWow64RevertWow64FsRedirection) 
-			{
-				if(TRUE == pfnWow64DisableWowFsRedirection(&OldValue))
-					{
-						char systemroot[150];
-						GetEnvironmentVariable("SystemRoot", systemroot, 150);
-						char exe_file_name[MAX_PATH];
-						char parameters[MAX_PATH];
-						strcpy(exe_file_name,systemroot);
-						strcat(exe_file_name,"\\system32\\");
-						strcat(exe_file_name,"bcdedit.exe");
-						strcpy(parameters,"/set safeboot network");
-						SHELLEXECUTEINFO shExecInfo;
-						shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-						shExecInfo.fMask = 0;
-						shExecInfo.hwnd = GetForegroundWindow();
-						shExecInfo.lpVerb = "runas";
-						shExecInfo.lpFile = exe_file_name;
-						shExecInfo.lpParameters = parameters;
-						shExecInfo.lpDirectory = NULL;
-						shExecInfo.nShow = SW_HIDE;
-						shExecInfo.hInstApp = NULL;
-						ShellExecuteEx(&shExecInfo);
-						pfnWow64RevertWow64FsRedirection(OldValue);
-					}
-				else
-				{
-					char systemroot[150];
-					GetEnvironmentVariable("SystemRoot", systemroot, 150);
-					char exe_file_name[MAX_PATH];
-					char parameters[MAX_PATH];
-					strcpy(exe_file_name,systemroot);
-					strcat(exe_file_name,"\\system32\\");
-					strcat(exe_file_name,"bcdedit.exe");
-					strcpy(parameters,"/set safeboot network");
-					SHELLEXECUTEINFO shExecInfo;
-					shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-					shExecInfo.fMask = 0;
-					shExecInfo.hwnd = GetForegroundWindow();
-					shExecInfo.lpVerb = "runas";
-					shExecInfo.lpFile = exe_file_name;
-					shExecInfo.lpParameters = parameters;
-					shExecInfo.lpDirectory = NULL;
-					shExecInfo.nShow = SW_HIDE;
-					shExecInfo.hInstApp = NULL;
-					ShellExecuteEx(&shExecInfo);
-				}
-			}
-			else
-			{
-				char systemroot[150];
-				GetEnvironmentVariable("SystemRoot", systemroot, 150);
-				char exe_file_name[MAX_PATH];
-				char parameters[MAX_PATH];
-				strcpy(exe_file_name,systemroot);
-				strcat(exe_file_name,"\\system32\\");
-				strcat(exe_file_name,"bcdedit.exe");
-				strcpy(parameters,"/set safeboot network");
-				SHELLEXECUTEINFO shExecInfo;
-				shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-				shExecInfo.fMask = 0;
-				shExecInfo.hwnd = GetForegroundWindow();
-				shExecInfo.lpVerb = "runas";
-				shExecInfo.lpFile = exe_file_name;
-				shExecInfo.lpParameters = parameters;
-				shExecInfo.lpDirectory = NULL;
-				shExecInfo.nShow = SW_HIDE;
-				shExecInfo.hInstApp = NULL;
-				ShellExecuteEx(&shExecInfo);
-			}
-#endif
-
-			}
-}
-
-BOOL reboot()
-{
-	HANDLE hToken; 
-    TOKEN_PRIVILEGES tkp; 
-    if (OpenProcessToken(    GetCurrentProcess(),
-                TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, 
-                & hToken)) 
-		{
-			LookupPrivilegeValue(    NULL,  SE_SHUTDOWN_NAME,  & tkp.Privileges[0].Luid);          
-			tkp.PrivilegeCount = 1; 
-			tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 
-			if(AdjustTokenPrivileges(    hToken,  FALSE,  & tkp,  0,  (PTOKEN_PRIVILEGES)NULL,  0))
-				{
-					ExitWindowsEx(EWX_REBOOT, 0);
-				}
-		}
-	return TRUE;
-}
-
-BOOL Force_reboot()
-{
-	HANDLE hToken; 
-    TOKEN_PRIVILEGES tkp; 
-    if (OpenProcessToken(    GetCurrentProcess(),
-                TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, 
-                & hToken)) 
-		{
-			LookupPrivilegeValue(    NULL,  SE_SHUTDOWN_NAME,  & tkp.Privileges[0].Luid);          
-			tkp.PrivilegeCount = 1; 
-			tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 
-			if(AdjustTokenPrivileges(    hToken,  FALSE,  & tkp,  0,  (PTOKEN_PRIVILEGES)NULL,  0))
-				{
-					OSVERSIONINFO OSversion;	
-					OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-					GetVersionEx(&OSversion);
-					if(OSversion.dwMajorVersion<6)
-					{
-					ExitWindowsEx(EWX_REBOOT|EWX_FORCEIFHUNG, 0);
-					}
-					else
-					{
-					ExitWindowsEx(EWX_REBOOT|EWX_FORCE, 0);
-					}
-				}
-		}
-	return TRUE;
-}
-
-void Reboot_with_force_reboot()
-{
-	Force_reboot();
-
-}
-
-void Reboot_with_force_reboot_elevated()
-{
-
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-	SHELLEXECUTEINFO shExecInfo;
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = "-rebootforce";
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_HIDE;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-
-void Reboot_in_safemode()
-{
-	if (CreateServiceSafeBootKey()) 
-		{
-			Set_Safemode();
-			reboot();
-		}
-
-}
-
-void Reboot_in_safemode_elevated()
-{
-
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-	SHELLEXECUTEINFO shExecInfo;
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = "-rebootsafemode";
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_HIDE;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-
-////////////////// ALL /////////////////////////////
-////////////////////////////////////////////////////
-
-BOOL DeleteServiceSafeBootKey()
-{
-	LONG lSuccess;
-	char szKey[1024];
-	_snprintf(szKey, 1024, "SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\%s\\%s", "Network", service_name);
-	lSuccess = RegDeleteKey(HKEY_LOCAL_MACHINE, szKey);
-	return lSuccess == ERROR_SUCCESS;
-
-}
-
-void Restore_safemode()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6)
-		{
-			char drivepath[150];
-			char systemdrive[150];
-			char stringvalue[512];
-			GetEnvironmentVariable("SYSTEMDRIVE", systemdrive, 150);
-			strcat (systemdrive,"/boot.ini");
-			GetPrivateProfileString("boot loader","default","",drivepath,150,systemdrive);
-			if (strlen(drivepath)==0) return;
-			GetPrivateProfileString("operating systems",drivepath,"",stringvalue,512,systemdrive);
-			if (strlen(stringvalue)==0) return;
-			char* p = strrchr(stringvalue, '/');
-			if (p == NULL) return;
-				*p = '\0';
-			WritePrivateProfileString("operating systems",drivepath,stringvalue,systemdrive);		
-			SetFileAttributes(systemdrive,FILE_ATTRIBUTE_READONLY);
-		}
-	else
-		{
-#ifdef _X64
-			char systemroot[150];
-			GetEnvironmentVariable("SystemRoot", systemroot, 150);
-			char exe_file_name[MAX_PATH];
-			char parameters[MAX_PATH];
-			strcpy(exe_file_name,systemroot);
-			strcat(exe_file_name,"\\system32\\");
-			strcat(exe_file_name,"bcdedit.exe");
-			strcpy(parameters,"/deletevalue safeboot");
-			SHELLEXECUTEINFO shExecInfo;
-			shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-			shExecInfo.fMask = 0;
-			shExecInfo.hwnd = GetForegroundWindow();
-			shExecInfo.lpVerb = "runas";
-			shExecInfo.lpFile = exe_file_name;
-			shExecInfo.lpParameters = parameters;
-			shExecInfo.lpDirectory = NULL;
-			shExecInfo.nShow = SW_HIDE;
-			shExecInfo.hInstApp = NULL;
-			ShellExecuteEx(&shExecInfo);
-#else
-			typedef BOOL (WINAPI *LPFN_Wow64DisableWow64FsRedirection)(PVOID* OldValue);
-			typedef BOOL (WINAPI *LPFN_Wow64RevertWow64FsRedirection)(PVOID OldValue);
-			PVOID OldValue;  
-			LPFN_Wow64DisableWow64FsRedirection pfnWow64DisableWowFsRedirection = (LPFN_Wow64DisableWow64FsRedirection)GetProcAddress(GetModuleHandle("kernel32"),"Wow64DisableWow64FsRedirection");
-			LPFN_Wow64RevertWow64FsRedirection pfnWow64RevertWow64FsRedirection = (LPFN_Wow64RevertWow64FsRedirection)GetProcAddress(GetModuleHandle("kernel32"),"Wow64RevertWow64FsRedirection");
-			if (pfnWow64DisableWowFsRedirection && pfnWow64RevertWow64FsRedirection)  ///win32 on x64 system
-			{
-				if(TRUE == pfnWow64DisableWowFsRedirection(&OldValue))
-					{
-						char systemroot[150];
-						GetEnvironmentVariable("SystemRoot", systemroot, 150);
-						char exe_file_name[MAX_PATH];
-						char parameters[MAX_PATH];
-						strcpy(exe_file_name,systemroot);
-						strcat(exe_file_name,"\\system32\\");
-						strcat(exe_file_name,"bcdedit.exe");
-						strcpy(parameters,"/deletevalue safeboot");
-						SHELLEXECUTEINFO shExecInfo;
-						shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-						shExecInfo.fMask = 0;
-						shExecInfo.hwnd = GetForegroundWindow();
-						shExecInfo.lpVerb = "runas";
-						shExecInfo.lpFile = exe_file_name;
-						shExecInfo.lpParameters = parameters;
-						shExecInfo.lpDirectory = NULL;
-						shExecInfo.nShow = SW_HIDE;
-						shExecInfo.hInstApp = NULL;
-						ShellExecuteEx(&shExecInfo);
-						pfnWow64RevertWow64FsRedirection(OldValue);
-					}
-				else
-				{
-					char systemroot[150];
-					GetEnvironmentVariable("SystemRoot", systemroot, 150);
-					char exe_file_name[MAX_PATH];
-					char parameters[MAX_PATH];
-					strcpy(exe_file_name,systemroot);
-					strcat(exe_file_name,"\\system32\\");
-					strcat(exe_file_name,"bcdedit.exe");
-					strcpy(parameters,"/deletevalue safeboot");
-					SHELLEXECUTEINFO shExecInfo;
-					shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-					shExecInfo.fMask = 0;
-					shExecInfo.hwnd = GetForegroundWindow();
-					shExecInfo.lpVerb = "runas";
-					shExecInfo.lpFile = exe_file_name;
-					shExecInfo.lpParameters = parameters;
-					shExecInfo.lpDirectory = NULL;
-					shExecInfo.nShow = SW_HIDE;
-					shExecInfo.hInstApp = NULL;
-					ShellExecuteEx(&shExecInfo);
-				}
-			}
-			else  //win32 on W32
-			{
-				char systemroot[150];
-				GetEnvironmentVariable("SystemRoot", systemroot, 150);
-				char exe_file_name[MAX_PATH];
-				char parameters[MAX_PATH];
-				strcpy(exe_file_name,systemroot);
-				strcat(exe_file_name,"\\system32\\");
-				strcat(exe_file_name,"bcdedit.exe");
-				strcpy(parameters,"/deletevalue safeboot");
-				SHELLEXECUTEINFO shExecInfo;
-				shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-				shExecInfo.fMask = 0;
-				shExecInfo.hwnd = GetForegroundWindow();
-				shExecInfo.lpVerb = "runas";
-				shExecInfo.lpFile = exe_file_name;
-				shExecInfo.lpParameters = parameters;
-				shExecInfo.lpDirectory = NULL;
-				shExecInfo.nShow = SW_HIDE;
-				shExecInfo.hInstApp = NULL;
-				ShellExecuteEx(&shExecInfo);
-			}
-#endif
-		}
-}
-
-void Restore_after_reboot()
-{
-	//If we are running !normal mode
-	//disable boot.ini /safemode:network
-	//disable safeboot service
-	if (GetSystemMetrics(SM_CLEANBOOT) != 0)
-	{
-		Restore_safemode();
-		DeleteServiceSafeBootKey();
-	}
-}
-
-
-////////////////// >VISTA /////////////////////////////
-///////////////////////////////////////////////////////
-bool ISUACENabled()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6) return false;
-	HKEY hKey;
-	if (::RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hKey) == ERROR_SUCCESS)
-		{
-			DWORD value = 0;
-			DWORD tt=4;
-			if (::RegQueryValueExW(hKey, L"EnableLUA", NULL, NULL, (LPBYTE)&value, &tt) == ERROR_SUCCESS)
-			{
-			RegCloseKey(hKey);
-			return (value != 0);
-			}
-			RegCloseKey(hKey);
-		}
-	return false;
-}
-
-bool IsSoftwareCadEnabled()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6) return true;
-
-	HKEY hkLocal, hkLocalKey;
-	DWORD dw;
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		return 0;
-		}
-	if (RegOpenKeyEx(hkLocal,
-		"System",
-		0, KEY_READ,
-		&hkLocalKey) != ERROR_SUCCESS)
-	{
-		RegCloseKey(hkLocal);
-		return 0;
-	}
-
-	LONG pref=0;
-	ULONG type = REG_DWORD;
-	ULONG prefsize = sizeof(pref);
-
-	if (RegQueryValueEx(hkLocalKey,
-			"SoftwareSASGeneration",
-			NULL,
-			&type,
-			(LPBYTE) &pref,
-			&prefsize) != ERROR_SUCCESS)
-	{
-			RegCloseKey(hkLocalKey);
-			RegCloseKey(hkLocal);
-			return false;
-	}
-	RegCloseKey(hkLocalKey);
-	RegCloseKey(hkLocal);
-	if (pref!=0) return true;
-	else return false;
-}
-
-void
-Enable_softwareCAD()
-{							
-	HKEY hkLocal, hkLocalKey;
-	DWORD dw;
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		return;
-		}
-	if (RegOpenKeyEx(hkLocal,
-		"System",
-		0, KEY_WRITE | KEY_READ,
-		&hkLocalKey) != ERROR_SUCCESS)
-	{
-		RegCloseKey(hkLocal);
-		return;
-	}
-	LONG pref;
-	pref=1;
-	RegSetValueEx(hkLocalKey, "SoftwareSASGeneration", 0, REG_DWORD, (LPBYTE) &pref, sizeof(pref));
-	RegCloseKey(hkLocalKey);
-	RegCloseKey(hkLocal);
-}
-
-void delete_softwareCAD()
-{
-	//Beep(1000,10000);
-	HKEY hkLocal, hkLocalKey;
-	DWORD dw;
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		return;
-		}
-	if (RegOpenKeyEx(hkLocal,
-		"System",
-		0, KEY_WRITE | KEY_READ,
-		&hkLocalKey) != ERROR_SUCCESS)
-	{
-		RegCloseKey(hkLocal);
-		return;
-	}
-	RegDeleteValue(hkLocalKey, "SoftwareSASGeneration");
-	RegCloseKey(hkLocalKey);
-	RegCloseKey(hkLocal);
-
-}
-
-void delete_softwareCAD_elevated()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6) return;
-
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-	SHELLEXECUTEINFO shExecInfo;
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = "-delsoftwarecad";
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-
-void Enable_softwareCAD_elevated()
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-	if(OSversion.dwMajorVersion<6) return;
-
-	char exe_file_name[MAX_PATH];
-	GetModuleFileName(0, exe_file_name, MAX_PATH);
-	SHELLEXECUTEINFO shExecInfo;
-	shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
-	shExecInfo.fMask = 0;
-	shExecInfo.hwnd = GetForegroundWindow();
-	shExecInfo.lpVerb = "runas";
-	shExecInfo.lpFile = exe_file_name;
-	shExecInfo.lpParameters = "-softwarecad";
-	shExecInfo.lpDirectory = NULL;
-	shExecInfo.nShow = SW_SHOWNORMAL;
-	shExecInfo.hInstApp = NULL;
-	ShellExecuteEx(&shExecInfo);
-}
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
diff --git a/ica/win32/winvnc/winvnc/stdhdrs.cpp b/ica/win32/winvnc/winvnc/stdhdrs.cpp
deleted file mode 100644
index 0034fd3..0000000
--- a/ica/win32/winvnc/winvnc/stdhdrs.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-#include "stdhdrs.h"
-
-// Create the main log object
-VNCLog vnclog;
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/stdhdrs.h b/ica/win32/winvnc/winvnc/stdhdrs.h
deleted file mode 100644
index 5ca8be9..0000000
--- a/ica/win32/winvnc/winvnc/stdhdrs.h
+++ /dev/null
@@ -1,104 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-//need to be added for VS 2005
-//#define _WIN32_IE 0x0500
-#define WIN32_LEAN_AND_MEAN
-#ifndef STRICT
-#define STRICT
-#endif
-
-//compile special case, rfb port is used for java and rfb
-//#define HTTP_SAMEPORT
-
-#include <winsock2.h>
-#include <windows.h>
-#include <shellapi.h>
-//#include <winsock2.h>
-
-#include <malloc.h>
-#include <stdio.h>
-#include <process.h>
-#include <crtdbg.h>
-
-#include <QtCore/QString>
-
-//#include "dpi.h"
-
-// LOGGING SUPPORT
-void *memcpy_amd(void *dest, const void *src, size_t n);
-bool CheckVideoDriver(bool);
-#define MAXPATH 256
-
-#include "vnclog.h"
-extern VNCLog vnclog;
-
-// No logging at all
-#define LL_NONE		0
-// Log server startup/shutdown
-#define LL_STATE	1
-// Log connect/disconnect
-#define LL_CLIENTS	2
-// Log connection errors (wrong pixfmt, etc)
-#define LL_CONNERR	3
-// Log socket errors
-#define LL_SOCKERR	4
-// Log internal errors
-#define LL_INTERR	5
-
-#define LL_ERROR	6
-
-// 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
-
-errno_t strcat_s(char* dst, size_t size, const char* src);
-errno_t strncat_s(char* dst, size_t size, const char* src, size_t n);
-errno_t strcpy_s(char* dst, size_t size, const char* src);
-errno_t strncpy_s(char* dst, size_t size, const char* src, size_t n);
-
-#define KEEPALIVE_HEADROOM 1
-#define KEEPALIVE_INTERVAL 5
-#define FT_RECV_TIMEOUT    30
-
-// adzm 2010-08
-#define SOCKET_KEEPALIVE_TIMEOUT 10000
-#define SOCKET_KEEPALIVE_INTERVAL 1000
-
-// Macros for sticking in the current file name
-#define VNCLOG(s)	(QString("%1 : %2").arg(__PRETTY_FUNCTION__).arg(s).toUtf8().constData())
-#if MSC_VER > 12
-#ifndef _X64
-#pragma comment(linker,"/manifestdependency:\"type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
-#else
-#pragma comment(linker,"/manifestdependency:\"type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
-#endif
-#endif
-//#define memcpy memcpy_amd
-//remove comment to compiler for >=athlon  or >=PIII
-DWORD MessageBoxSecure(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);
diff --git a/ica/win32/winvnc/winvnc/tableinitcmtemplate.cpp b/ica/win32/winvnc/winvnc/tableinitcmtemplate.cpp
deleted file mode 100644
index d8e07b0..0000000
--- a/ica/win32/winvnc/winvnc/tableinitcmtemplate.cpp
+++ /dev/null
@@ -1,96 +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(OUTVNC)
-#error "This file shouldn't be compiled."
-#error "It is included as part of translate.c"
-#endif
-
-#define OUT_T CONCAT2E(CARD,OUTVNC)
-#define SwapOUTVNC(x) CONCAT2E(Swap,OUTVNC) (x)
-#define rfbInitColourMapSingleTableOUTVNC \
-				CONCAT2E(rfbInitColourMapSingleTable,OUTVNC)
-
-// 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
-rfbInitColourMapSingleTableOUTVNC (char **table,
-								rfbPixelFormat *in,
-								rfbPixelFormat *out)
-{
-	vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable called\n"));
-
-	// ALLOCATE SPACE FOR COLOUR TABLE
-
-    unsigned 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 = GetDcMirror();
-	if (hDC==NULL) vnclog.Print(LL_ALL, VNCLOG("Using video Palette\n"));
-	else vnclog.Print(LL_ALL, VNCLOG("Using mirror video Palette\n"));
-	if (hDC==NULL) 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 (OUTVNC != 8)
-		if (out->bigEndian != in->bigEndian)
-		{
-			t[i] = SwapOUTVNC(t[i]);
-		}
-#endif
-	}
-
-	vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable done\n"));
-}
-
-#undef OUT_T
-#undef SwapOUT
-#undef rfbInitColourMapSingleTableOUTVNC
diff --git a/ica/win32/winvnc/winvnc/tableinittctemplate.cpp b/ica/win32/winvnc/winvnc/tableinittctemplate.cpp
deleted file mode 100644
index d21c6cd..0000000
--- a/ica/win32/winvnc/winvnc/tableinittctemplate.cpp
+++ /dev/null
@@ -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(OUTVNC)
-#error "This file shouldn't be compiled."
-#error "It is included as part of translate.c"
-#endif
-
-#define OUT_T CONCAT2E(CARD,OUTVNC)
-#define SwapOUTVNC(x) CONCAT2E(Swap,OUTVNC) (x)
-#define rfbInitTrueColourSingleTableOUTVNC \
-				CONCAT2E(rfbInitTrueColourSingleTable,OUTVNC)
-#define rfbInitTrueColourRGBTablesOUTVNC CONCAT2E(rfbInitTrueColourRGBTables,OUTVNC)
-#define rfbInitOneRGBTableOUTVNC CONCAT2E(rfbInitOneRGBTable,OUTVNC)
-
-static void
-rfbInitOneRGBTableOUTVNC (OUT_T *table, int inMax, int outMax, int outShift,
-		       int swap);
-
-
-/*
- * rfbInitTrueColourSingleTable sets up a single lookup table for truecolour
- * translation.
- */
-
-static void
-rfbInitTrueColourSingleTableOUTVNC (char **table, rfbPixelFormat *in,
-				 rfbPixelFormat *out)
-{
-    int i;
-    int inRed, inGreen, inBlue, outRed, outGreen, outBlue;
-    OUT_T *t=NULL;
-    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;
-
-	if (t) t[i] = ((outRed   << out->redShift)   |
-		(outGreen << out->greenShift) |
-		(outBlue  << out->blueShift));
-#if (OUTVNC != 8)
-	if (t) if (out->bigEndian != in->bigEndian) {
-	    t[i] = SwapOUTVNC(t[i]);
-	}
-#endif
-    }
-}
-
-
-/*
- * rfbInitTrueColourRGBTables sets up three separate lookup tables for the
- * red, green and blue values.
- */
-
-static void
-rfbInitTrueColourRGBTablesOUTVNC (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;
-
-    rfbInitOneRGBTableOUTVNC (redTable, in->redMax, out->redMax,
-			   out->redShift, (out->bigEndian != in->bigEndian));
-    rfbInitOneRGBTableOUTVNC (greenTable, in->greenMax, out->greenMax,
-			   out->greenShift, (out->bigEndian != in->bigEndian));
-    rfbInitOneRGBTableOUTVNC (blueTable, in->blueMax, out->blueMax,
-			   out->blueShift, (out->bigEndian != in->bigEndian));
-}
-
-static void
-rfbInitOneRGBTableOUTVNC (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 (OUTVNC != 8)
-	if (swap) {
-	    table[i] = SwapOUTVNC(table[i]);
-	}
-#endif
-    }
-}
-
-#undef OUT_T
-#undef SwapOUTVNC
-#undef rfbInitTrueColourSingleTableOUTVNC
-#undef rfbInitTrueColourRGBTablesOUTVNC
-#undef rfbInitOneRGBTableOUTVNC
diff --git a/ica/win32/winvnc/winvnc/tabletranstemplate.cpp b/ica/win32/winvnc/winvnc/tabletranstemplate.cpp
deleted file mode 100644
index 1a8c729..0000000
--- a/ica/win32/winvnc/winvnc/tabletranstemplate.cpp
+++ /dev/null
@@ -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(INVNC) || !defined(OUTVNC)
-#error "This file shouldn't be compiled."
-#error "It is included as part of translate.c"
-#endif
-
-#define IN_T CONCAT2E(CARD,INVNC)
-#define OUT_T CONCAT2E(CARD,OUTVNC)
-#define rfbTranslateWithSingleTableINVNCtoOUTVNC \
-				CONCAT4E(rfbTranslateWithSingleTable,INVNC,to,OUTVNC)
-#define rfbTranslateWithRGBTablesINVNCtoOUTVNC \
-				CONCAT4E(rfbTranslateWithRGBTables,INVNC,to,OUTVNC)
-
-/*
- * rfbTranslateWithSingleTableINVNCtoOUTVNC translates a rectangle of pixel data
- * using a single lookup table.
- */
-
-static void
-rfbTranslateWithSingleTableINVNCtoOUTVNC (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--;
-    }
-}
-
-
-/*
- * rfbTranslateWithRGBTablesINVNCtoOUTVNC translates a rectangle of pixel data
- * using three separate lookup tables for the red, green and blue values.
- */
-
-static void
-rfbTranslateWithRGBTablesINVNCtoOUTVNC (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 rfbTranslateWithSingleTableINVNCtoOUTVNC
-#undef rfbTranslateWithRGBTablesINVNCtoOUTVNC
diff --git a/ica/win32/winvnc/winvnc/translate.cpp b/ica/win32/winvnc/winvnc/translate.cpp
deleted file mode 100644
index d13854d..0000000
--- a/ica/win32/winvnc/winvnc/translate.cpp
+++ /dev/null
@@ -1,184 +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"
-#include "vncOSVersion.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 OUTVNC 8
-#include "tableinittctemplate.cpp"
-#include "tableinitcmtemplate.cpp"
-#define INVNC 8
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 16
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 32
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#undef OUTVNC
-
-#define OUTVNC 16
-#include "tableinittctemplate.cpp"
-#include "tableinitcmtemplate.cpp"
-#define INVNC 8
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 16
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 32
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#undef OUTVNC
-
-#define OUTVNC 32
-#include "tableinittctemplate.cpp"
-#include "tableinitcmtemplate.cpp"
-#define INVNC 8
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 16
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#define INVNC 32
-#include "tabletranstemplate.cpp"
-#undef INVNC
-#undef OUTVNC
-
-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 >> 3);
-
-    while (height > 0) {
-	memcpy(optr, iptr, bytesPerOutputLine);
-	iptr += bytesBetweenInputLines;
-	optr += bytesPerOutputLine;
-	--height;
-    }
-}
-
-
-
-HDC GetDcMirror()
-{
-typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
-		HDC m_hrootdc=NULL;
-		pEnumDisplayDevices pd=NULL;
-		LPSTR driverName = "mv video hook driver2";
-		BOOL DriverFound;
-		DEVMODE devmode;
-		FillMemory(&devmode, sizeof(DEVMODE), 0);
-		devmode.dmSize = sizeof(DEVMODE);
-		devmode.dmDriverExtra = 0;
-		/*BOOL change = */EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
-		devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-		HMODULE hUser32=LoadLibrary("USER32");
-		if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-		if (pd)
-			{
-				LPSTR deviceName=NULL;
-				DISPLAY_DEVICE dd;
-				ZeroMemory(&dd, sizeof(dd));
-				dd.cb = sizeof(dd);
-				devmode.dmDeviceName[0] = '\0';
-				INT devNum = 0;
-				BOOL result;
-				DriverFound=false;
-				while ((result = (*pd)(NULL,devNum, &dd,0)))
-				{
-					if (strcmp((const char *)&dd.DeviceString[0], driverName) == 0)
-					{
-					DriverFound=true;
-					break;
-					}
-					devNum++;
-				}
-				if (DriverFound)
-				{
-				deviceName = (LPSTR)&dd.DeviceName[0];
-				m_hrootdc = CreateDC("DISPLAY",deviceName,NULL,NULL);	
-				}
-			}
-		if (hUser32) FreeLibrary(hUser32);
-
-		return m_hrootdc;
-}
diff --git a/ica/win32/winvnc/winvnc/translate.h b/ica/win32/winvnc/winvnc/translate.h
deleted file mode 100644
index 30a095b..0000000
--- a/ica/win32/winvnc/winvnc/translate.h
+++ /dev/null
@@ -1,81 +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 at 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"
-#include "vncmemcpy.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);
-
-extern HDC GetDcMirror();
-
-// 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
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/videodriver.cpp b/ica/win32/winvnc/winvnc/videodriver.cpp
deleted file mode 100644
index d31a034..0000000
--- a/ica/win32/winvnc/winvnc/videodriver.cpp
+++ /dev/null
@@ -1,974 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include "videodriver.h"
-#include <strsafe.h>
-LPSTR driverName = "mv video hook driver2";
-
-#define MAP1 1030
-#define UNMAP1 1031
-#define CURSOREN 1060
-#define CURSORDIS 1061
-
-VIDEODRIVER::VIDEODRIVER()
-{
-	mypVideoMemory=NULL;
-	mypchangebuf=NULL;
-	myframebuffer=NULL;
-	shared_buffer_size=0;
-}
-
-void
-VIDEODRIVER::VIDEODRIVER_start(int x,int y,int w,int h)
-{
-	blocked=true;
-	oldaantal=1;
-	mypVideoMemory=NULL;
-	OSVER=OSVersion();
-	if (OSVER==OSWIN2000|| OSVER==OSWINXP64)
-	{
-		if (Mirror_driver_attach_XP(x,y,w,h))
-		{
-			if (GetDcMirror()!=NULL)
-			{
-			mypVideoMemory=VideoMemory_GetSharedMemory();
-			mypchangebuf=(PCHANGES_BUF)mypVideoMemory;
-			myframebuffer=mypVideoMemory+sizeof(CHANGES_BUF);
-			}
-			else
-			{
-				mypVideoMemory=NULL;
-			}
-		}
-		else
-		{
-			mypVideoMemory=NULL;
-		}
-	}
-	if (OSVER==OSVISTA)
-	{
-		if (Mirror_driver_Vista(1,x,y,w,h))
-		{
-			if (GetDcMirror()!=NULL)
-			{
-			mypVideoMemory=VideoMemory_GetSharedMemory();
-			mypchangebuf=(PCHANGES_BUF)mypVideoMemory;
-			myframebuffer=mypVideoMemory+sizeof(CHANGES_BUF);
-			//if (mypVideoMemory==NULL) MessageBoxSecure(NULL,"MVideo driver failed", NULL, MB_OK);
-			}
-			else
-			{
-	//			MessageBoxSecure(NULL,"Video driver failed", NULL, MB_OK);
-////////////////////////////////////////////////////////////////////////////////
-				if (Mirror_driver_attach_XP(x,y,w,h))
-					{
-						if (GetDcMirror()!=NULL)
-						{
-						mypVideoMemory=VideoMemory_GetSharedMemory();
-						mypchangebuf=(PCHANGES_BUF)mypVideoMemory;
-						myframebuffer=mypVideoMemory+sizeof(CHANGES_BUF);
-						}
-						else
-						{
-							mypVideoMemory=NULL;
-						}
-					}
-					else
-					{
-						mypVideoMemory=NULL;
-					}
-////////////////////////////////////////////////////////////////////////////////
-				//mypVideoMemory=NULL;
-			}
-		}
-		else
-		{
-			mypVideoMemory=NULL;
-		}
-	}
-	blocked=false;
-}
-
-void
-VIDEODRIVER::VIDEODRIVER_Stop()
-{
-	OSVER=OSVersion();
-	if (OSVER==OSWIN2000||OSVER==OSWINXP64)
-	{
-		Mirror_driver_detach_XP();
-		if (mypVideoMemory!=NULL) VideoMemory_ReleaseSharedMemory(mypVideoMemory);
-	}
-	if (OSVER==OSVISTA)
-	{
-		Mirror_driver_Vista(0,0,0,0,0);
-		if (mypVideoMemory!=NULL) VideoMemory_ReleaseSharedMemory(mypVideoMemory);
-	}
-	mypVideoMemory=NULL;
-	mypchangebuf=NULL;
-	myframebuffer=NULL;
-
-
-}
-
-
-VIDEODRIVER::~VIDEODRIVER()
-{
-	//mypVideoMemory=NULL;
-	OSVER=OSVersion();
-	if (OSVER==OSWIN2000|| OSVER==OSWINXP64)
-	{
-		Mirror_driver_detach_XP();
-		if (mypVideoMemory!=NULL) VideoMemory_ReleaseSharedMemory(mypVideoMemory);
-	}
-	if (OSVER==OSVISTA)
-	{
-		Mirror_driver_Vista(0,0,0,0,0);
-		if (mypVideoMemory!=NULL) VideoMemory_ReleaseSharedMemory(mypVideoMemory);
-	}
-
-}
-
-void VIDEODRIVER::VideoMemory_ReleaseSharedMemory(PCHAR pVideoMemory)
-{
-    UnmapViewOfFile(pVideoMemory);
-}
-
-PCHAR VIDEODRIVER::VideoMemory_GetSharedMemory(void)
-{
-   PCHAR pVideoMemory=NULL;
-   HANDLE hMapFile, hFile, hFile0,hFile1;
-   hFile=NULL;
-   
-   hFile0 = CreateFile("c:\\video0.dat", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
-   hFile1 = CreateFile("c:\\video1.dat", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
-
-   if ((hFile0 && hFile0 != INVALID_HANDLE_VALUE) && !(hFile1 && hFile1 != INVALID_HANDLE_VALUE)) hFile=hFile0;
-   if ((hFile1 && hFile1 != INVALID_HANDLE_VALUE) && !(hFile0 && hFile0 != INVALID_HANDLE_VALUE)) hFile=hFile1;
-   if ((hFile0 && hFile0 != INVALID_HANDLE_VALUE) && (hFile1 && hFile1 != INVALID_HANDLE_VALUE))
-   {
-	   DWORD size0=GetFileSize(hFile0,NULL);
-	   DWORD size1=GetFileSize(hFile1,NULL);
-	   if (size0==shared_buffer_size) hFile=hFile0;
-	   if (size1==shared_buffer_size) hFile=hFile1;
-	    if (size1==shared_buffer_size && size0==shared_buffer_size)
-		{
-			//find last modification time
-			FILETIME createt0, lastWriteTime0, lastAccessTime0;
-			GetFileTime( hFile0, &createt0, &lastAccessTime0, &lastWriteTime0);
-			FILETIME createt1, lastWriteTime1, lastAccessTime1;
-			GetFileTime( hFile0, &createt1, &lastAccessTime1, &lastWriteTime1);
-			LONG result=CompareFileTime(&lastWriteTime0,&lastWriteTime1);
-			if (result==0 || result== 1) hFile=hFile0;
-			else hFile=hFile1;
-
-		}
-
-   }
-
-
-   if(hFile && hFile != INVALID_HANDLE_VALUE)
-   {
-       hMapFile = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
-
-       if(hMapFile && hMapFile != INVALID_HANDLE_VALUE)
-       {
-           pVideoMemory = (char *) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
-    
-           CloseHandle(hMapFile);
-       }
-
-       CloseHandle(hFile);
-   }
-   else
-   {
-	   vnclog.Print(LL_INTERR, VNCLOG("Error video.dat \n")); 
-   }
-   
-   return pVideoMemory;
-}
-
-bool
-VIDEODRIVER::Mirror_driver_Vista(DWORD dwAttach,int x,int y,int w,int h)
-{
-	HDESK   hdeskInput=NULL;
-    HDESK   hdeskCurrent=NULL;
-	pEnumDisplayDevices pd=NULL;
-	HMODULE hUser32=LoadLibrary("USER32");
-	if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-	if (!pd) return false;
-    BOOL  bED   = TRUE;
-    DEVMODE devmode;
-
-    FillMemory(&devmode, sizeof(DEVMODE), 0);
-    devmode.dmSize = sizeof(DEVMODE);
-    devmode.dmDriverExtra = 0;
-
-    // Make sure we have a display on this thread.
-    BOOL change = EnumDisplaySettings(NULL,
-                                      ENUM_CURRENT_SETTINGS,
-                                      &devmode);
-
-    devmode.dmFields = DM_BITSPERPEL |
-                       DM_PELSWIDTH | 
-                       DM_PELSHEIGHT |
-                       DM_POSITION ;
-
-    if (change) 
-    {
-        // query all display devices in the system until we hit a primary
-        // display device. Using it get the width and height of the primary
-        // so we can use that for the mirror driver. Also enumerate the
-        // display devices installed on this machine untill we hit
-        // our favourate mirrored driver, then extract the device name string
-        // of the format '\\.\DISPLAY#'
-//		MessageBoxSecure(NULL, "change ok", NULL, MB_OK);
-   
-        DISPLAY_DEVICE dispDevice;
-   
-        FillMemory(&dispDevice, sizeof(DISPLAY_DEVICE), 0);
-   
-        dispDevice.cb = sizeof(DISPLAY_DEVICE);
-   
-        LPSTR deviceName = NULL;
-
-        devmode.dmDeviceName[0] = '\0';
-
-        INT devNum = 0;
-        BOOL result;
-        DWORD cxPrimary = 0xFFFFFFFF;
-        DWORD cyPrimary = 0xFFFFFFFF;
-
-        // First enumerate for Primary display device:
-        while ((result = (*pd)(NULL,
-                                devNum,
-                                &dispDevice,
-                                0)))
-        {
-//          MessageBoxSecure(NULL, &dispDevice.DeviceString[0], NULL, MB_OK);
-          if (dispDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
-          {
-              // Primary device. Find out its dmPelsWidht and dmPelsHeight.
-              EnumDisplaySettings(dispDevice.DeviceName,
-                                  ENUM_CURRENT_SETTINGS,
-                                  &devmode);
-
-              cxPrimary = devmode.dmPelsWidth;
-              cyPrimary = devmode.dmPelsHeight;
-              break;
-          }
-          devNum++;
-        }
-#if defined(MIRROR_24)
-		if (devmode.dmBitsPerPel == 24)
-			devmode.dmBitsPerPel = 32;
-#endif
-		if (devmode.dmBitsPerPel!=8 && devmode.dmBitsPerPel!=16 && devmode.dmBitsPerPel!=32) 
-		{
-			if (hUser32) FreeLibrary(hUser32);
-			return false;
-		}
-		shared_buffer_size=devmode.dmBitsPerPel/8*w*h+sizeof(CHANGES_BUF);
-
-        // error check
-        if (!result)
-        {
-//           MessageBoxSecure(NULL,  driverName, NULL, MB_OK);
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-
-        if (cxPrimary == 0xffffffff || cyPrimary == 0xffffffff)
-        {
-//             MessageBoxSecure(NULL,"cxPrimary or cyPrimary not valid", NULL, MB_OK);
-			if (hUser32) FreeLibrary(hUser32);
-            return false;
-        }
-
-        // Enumerate again for the mirror driver:
-        devNum = 0;
-        while ((result = (*pd)(NULL,
-                                  devNum,
-                                  &dispDevice,
-                                  0)))
-        {
-          if (strcmp(&dispDevice.DeviceString[0], driverName) == 0)
-              break;
-
-           devNum++;
-        }
-
-        // error check       
-        if (!result)
-        {
-//          MessageBoxSecure(NULL,driverName, NULL, MB_OK);
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-
-//        printf("DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\n\n",
-//               devNum,
-//               &dispDevice.DeviceName[0],
-//               &dispDevice.DeviceString[0],
-//               &dispDevice.DeviceID[0],
-//               &dispDevice.DeviceKey[0]);
-
-        CHAR deviceNum[MAX_PATH];
-        LPSTR deviceSub;
-
-        // Simply extract 'DEVICE#' from registry key.  This will depend
-        // on how many mirrored devices your driver has and which ones
-        // you intend to use.
-
-        _strupr(&dispDevice.DeviceKey[0]);
-
-        deviceSub = strstr(&dispDevice.DeviceKey[0],
-                           "\\DEVICE");
-
-        if (!deviceSub) 
-            StringCbCopy(&deviceNum[0], sizeof(deviceNum), "DEVICE0");
-        else
-            StringCbCopy(&deviceNum[0], sizeof(deviceNum), ++deviceSub);
-
-        // Reset the devmode for mirror driver use:
-		int depth=devmode.dmBitsPerPel;
-        FillMemory(&devmode, sizeof(DEVMODE), 0);
-        devmode.dmSize = sizeof(DEVMODE);
-        devmode.dmDriverExtra = 0;
-		devmode.dmBitsPerPel=depth;
-
-        devmode.dmFields = DM_BITSPERPEL |
-                           DM_PELSWIDTH | 
-                           DM_PELSHEIGHT |
-                           DM_POSITION;
-
-        StringCbCopy((LPSTR)&devmode.dmDeviceName[0], sizeof(devmode.dmDeviceName), "mv2");
-        deviceName = (LPSTR)&dispDevice.DeviceName[0];
-
-        if (bED)
-        {
-            // Attach and detach information is sent via the dmPelsWidth/Height
-            // of the devmode.
-            //
-//			MessageBoxSecure(NULL,"bED", NULL, MB_OK);
-            if (dwAttach == 0)
-            {
-                devmode.dmPelsWidth = 0;
-                devmode.dmPelsHeight = 0;
-            }
-            else
-            {
-                devmode.dmPelsWidth=w;
-				devmode.dmPelsHeight=h;
-				devmode.dmPosition.x=x;
-				devmode.dmPosition.y=y;
-            }
-            // Update the mirror device's registry data with the devmode. Dont
-            // do a mode change.
-			
-/////////////////////////
-				hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
-				if (hdeskCurrent != NULL)
-					{
-						hdeskInput = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED);
-						if (hdeskInput != NULL)
-							{
-								SetThreadDesktop(hdeskInput);
-							}
-					}
-
-
-				INT code =
-            ChangeDisplaySettingsEx(deviceName,
-                                    &devmode, 
-                                    NULL,
-                                    (CDS_UPDATEREGISTRY | CDS_RESET|CDS_GLOBAL),
-                                    NULL
-                                    );
-//            GetDispCode(code);
-			if (code!=0) 
-			{
-				if (hUser32) FreeLibrary(hUser32);
-				return false;
-			}
-            // Now do the real mode change to take mirror driver changes into
-            // effect.
-            code = ChangeDisplaySettingsEx(NULL,
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           NULL);
-
-			if (hdeskCurrent) SetThreadDesktop(hdeskCurrent);
-			if (hdeskInput) CloseDesktop(hdeskInput);
-
-			if (code!=0)
-			{
-				if (hUser32) FreeLibrary(hUser32);
-				return false;
-			}
-			if (hUser32) FreeLibrary(hUser32);
-			return true;
-        }
-		if (hUser32) FreeLibrary(hUser32);
-		return false;
-	}
-	if (hUser32) FreeLibrary(hUser32);
-	return false;
-}
-
-
-
-void
-VIDEODRIVER::Mirror_driver_detach_XP()
-{
-	HDESK   hdeskInput=NULL;
-    HDESK   hdeskCurrent=NULL;
-	pEnumDisplayDevices pd=NULL;
-	HMODULE hUser32=LoadLibrary("USER32");
-	if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-	if (!pd) return;
-	DEVMODE devmode;
-
-    FillMemory(&devmode, sizeof(DEVMODE), 0);
-
-    devmode.dmSize = sizeof(DEVMODE);
-    devmode.dmDriverExtra = 0;
-
-    BOOL change = EnumDisplaySettings(NULL,
-                                      ENUM_CURRENT_SETTINGS,
-                                      &devmode);
-
-    devmode.dmFields = DM_BITSPERPEL |
-                       DM_PELSWIDTH | 
-                       DM_PELSHEIGHT;
-
-    if (change) 
-    {
-        // query all display devices in the system until we hit
-        // our favourate mirrored driver, then extract the device name string
-        // of the format '\\.\DISPLAY#'
-       
-        DISPLAY_DEVICE dispDevice;
-       
-        FillMemory(&dispDevice, sizeof(DISPLAY_DEVICE), 0);
-       
-        dispDevice.cb = sizeof(DISPLAY_DEVICE);
-       
-        LPSTR deviceName = NULL;
-
-        devmode.dmDeviceName[0] = '\0';
-
-        INT devNum = 0;
-        BOOL result;
-
-        while ((result = (*pd)(NULL,
-                                  devNum,
-                                  &dispDevice,
-                                  0)))
-        {
-          if (strcmp(&dispDevice.DeviceString[0], driverName) == 0)
-              break;
-
-           devNum++;
-        }
-       
-        if (!result)
-        {
-           printf("No '%s' found.\n", driverName);
-		   if (hUser32) FreeLibrary(hUser32);
-           return;
-        }
-
-        printf("DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\n\n",
-               devNum,
-               &dispDevice.DeviceName[0],
-               &dispDevice.DeviceString[0],
-               &dispDevice.DeviceID[0],
-               &dispDevice.DeviceKey[0]);
-
-        CHAR deviceNum[MAX_PATH];
-        LPSTR deviceSub;
-
-        // Simply extract 'DEVICE#' from registry key.  This will depend
-        // on how many mirrored devices your driver has and which ones
-        // you intend to use.
-
-        _strupr(&dispDevice.DeviceKey[0]);
-
-        deviceSub = strstr(&dispDevice.DeviceKey[0],
-                           "\\DEVICE");
-
-        if (!deviceSub) 
-            StringCbCopy(&deviceNum[0], sizeof(deviceNum), "DEVICE0");
-        else
-            StringCbCopy(&deviceNum[0], sizeof(deviceNum), ++deviceSub);
-        
-        // Add 'Attach.ToDesktop' setting.
-        //
-		{
-				HKEY hKeyProfileMirror = (HKEY)0;
-				if (RegCreateKey(HKEY_LOCAL_MACHINE,
-								_T("SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\mv2"),
-								 &hKeyProfileMirror) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-
-				HKEY hKeyDevice = (HKEY)0;
-				if (RegCreateKey(hKeyProfileMirror,
-								 _T(&deviceNum[0]),
-								 &hKeyDevice) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-
-				DWORD one = 0;
-				if (RegSetValueEx(hKeyDevice,
-								  _T("Attach.ToDesktop"),
-								  0,
-								  REG_DWORD,
-								  (unsigned char *)&one,
-								  4) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-				RegCloseKey(hKeyProfileMirror);
-				RegCloseKey(hKeyDevice);
-		}
-		{
-				deviceSub = strstr(&dispDevice.DeviceKey[0],
-                           "SYSTEM");
-
-				HKEY hKeyProfileMirror = (HKEY)0;
-				if (RegCreateKey(HKEY_LOCAL_MACHINE,
-								_T("SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current"),
-								 &hKeyProfileMirror) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-
-				HKEY hKeyDevice = (HKEY)0;
-				if (RegCreateKey(hKeyProfileMirror,
-								 _T(deviceSub),
-								 &hKeyDevice) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-
-				DWORD one = 0;
-				if (RegSetValueEx(hKeyDevice,
-								  _T("Attach.ToDesktop"),
-								  0,
-								  REG_DWORD,
-								  (unsigned char *)&one,
-								  4) != ERROR_SUCCESS)
-				{
-				   if (hUser32) FreeLibrary(hUser32);
-				   return;
-				}
-				RegCloseKey(hKeyProfileMirror);
-				RegCloseKey(hKeyDevice);
-		}
-
-
-        FillMemory(&devmode, sizeof(DEVMODE), 0);
-
-        devmode.dmSize = sizeof(DEVMODE);
-        devmode.dmDriverExtra = 0;
-
-        StringCbCopy((LPSTR)&devmode.dmDeviceName[0], sizeof(devmode.dmDeviceName), "mv2");
-        deviceName = (LPSTR)&dispDevice.DeviceName[0];
-		devmode.dmBitsPerPel=32;
-        // add 'Default.*' settings to the registry under above hKeyProfile\mirror\device
-		hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
-				if (hdeskCurrent != NULL)
-					{
-						hdeskInput = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED);
-						if (hdeskInput != NULL)
-							{
-								SetThreadDesktop(hdeskInput);
-							}
-					}
-
-        ChangeDisplaySettingsEx(deviceName,
-                                &devmode, 
-                                NULL,
-                                CDS_UPDATEREGISTRY,
-                                NULL
-                                );
-    
-//        GetDispCode(code);
-
-        ChangeDisplaySettingsEx(deviceName,
-                                &devmode, 
-                                NULL,
-                                0,
-                                NULL
-                                );
-   
-		if (hdeskCurrent) SetThreadDesktop(hdeskCurrent);
-		if (hdeskInput) CloseDesktop(hdeskInput);
-		
-	}
-if (hUser32) FreeLibrary(hUser32);
-}
-
-//BOOL
-//Activate_video_driver();
-
-bool
-VIDEODRIVER::Mirror_driver_attach_XP(int x,int y,int w,int h)
-{
-	HDESK   hdeskInput=NULL;
-    HDESK   hdeskCurrent=NULL;
-
-	pEnumDisplayDevices pd=NULL;
-	HMODULE hUser32=LoadLibrary("USER32");
-	if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-	if (!pd) return false;
-
-	DEVMODE devmode;
-
-    FillMemory(&devmode, sizeof(DEVMODE), 0);
-
-    devmode.dmSize = sizeof(DEVMODE);
-    devmode.dmDriverExtra = 0;
-
-    BOOL change = EnumDisplaySettings(NULL,
-                                      ENUM_CURRENT_SETTINGS,
-                                      &devmode);
-
-    devmode.dmFields = DM_BITSPERPEL |
-                       DM_PELSWIDTH | 
-					   DM_POSITION |
-                       DM_PELSHEIGHT;
-
-#if defined(MIRROR_24)
-	// for 24 bit mode, have the mirror driver use 32 bit.
-	if (devmode.dmBitsPerPel == 24)
-		devmode.dmBitsPerPel = 32;
-#endif
-	if (devmode.dmBitsPerPel!=8 && devmode.dmBitsPerPel!=16 && devmode.dmBitsPerPel!=32)
-	{
-		if (hUser32) FreeLibrary(hUser32);
-		return false;
-	}
-
-	shared_buffer_size=devmode.dmBitsPerPel/8*w*h+sizeof(CHANGES_BUF);
-
-    if (change) 
-    {
-        // query all display devices in the system until we hit
-        // our favourate mirrored driver, then extract the device name string
-        // of the format '\\.\DISPLAY#'
-       
-        DISPLAY_DEVICE dispDevice;
-       
-        FillMemory(&dispDevice, sizeof(DISPLAY_DEVICE), 0);
-       
-        dispDevice.cb = sizeof(DISPLAY_DEVICE);
-       
-        LPSTR deviceName = NULL;
-
-        devmode.dmDeviceName[0] = '\0';
-
-        INT devNum = 0;
-        BOOL result;
-
-        while ((result = (*pd)(NULL,
-                                  devNum,
-                                  &dispDevice,
-                                  0)))
-        {
-          if (strcmp(&dispDevice.DeviceString[0], driverName) == 0)
-              break;
-
-           devNum++;
-        }
-       
-        if (!result)
-        {
-           printf("No '%s' found.\n", driverName);
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-
-        printf("DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\n\n",
-               devNum,
-               &dispDevice.DeviceName[0],
-               &dispDevice.DeviceString[0],
-               &dispDevice.DeviceID[0],
-               &dispDevice.DeviceKey[0]);
-
-        CHAR deviceNum[MAX_PATH];
-        LPSTR deviceSub;
-
-        // Simply extract 'DEVICE#' from registry key.  This will depend
-        // on how many mirrored devices your driver has and which ones
-        // you intend to use.
-
-        _strupr(&dispDevice.DeviceKey[0]);
-
-        deviceSub = strstr(&dispDevice.DeviceKey[0],
-                           "\\DEVICE");
-
-        if (!deviceSub) 
-            StringCbCopy(&deviceNum[0], MAX_PATH, "DEVICE0");
-        else
-            StringCbCopy(&deviceNum[0], MAX_PATH, ++deviceSub);
-        
-        // Add 'Attach.ToDesktop' setting.
-        //
-
-        HKEY hKeyProfileMirror = (HKEY)0;
-        if (RegCreateKey(HKEY_LOCAL_MACHINE,
-                        _T("SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\mv2"),
-                         &hKeyProfileMirror) != ERROR_SUCCESS)
-        {
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-
-        HKEY hKeyDevice = (HKEY)0;
-        if (RegCreateKey(hKeyProfileMirror,
-                         _T(&deviceNum[0]),
-                         &hKeyDevice) != ERROR_SUCCESS)
-        {
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-
-        DWORD one = 1;
-        if (RegSetValueEx(hKeyDevice,
-                          _T("Attach.ToDesktop"),
-                          0,
-                          REG_DWORD,
-                          (unsigned char *)&one,
-                          4) != ERROR_SUCCESS)
-        {
-		   if (hUser32) FreeLibrary(hUser32);
-           return false;
-        }
-		int depth=devmode.dmBitsPerPel;
-
-        FillMemory(&devmode, sizeof(DEVMODE), 0);
-
-        devmode.dmSize = sizeof(DEVMODE);
-        devmode.dmDriverExtra = 0;
-
-        StringCbCopy((LPSTR)&devmode.dmDeviceName[0], 32, "mv2");
-
-        devmode.dmFields = DM_BITSPERPEL |
-                           DM_PELSWIDTH | 
-		    			   DM_POSITION |
-                           DM_PELSHEIGHT;
-        deviceName = (LPSTR)&dispDevice.DeviceName[0];
-		devmode.dmPelsWidth=w;
-		devmode.dmPelsHeight=h;
-		devmode.dmPosition.x=x;
-		devmode.dmPosition.y=y;
-		devmode.dmBitsPerPel=depth;
-
-		hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
-				if (hdeskCurrent != NULL)
-					{
-						hdeskInput = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED);
-						if (hdeskInput != NULL)
-							{
-								SetThreadDesktop(hdeskInput);
-							}
-					}
-
-        // add 'Default.*' settings to the registry under above hKeyProfile\mirror\device
-        INT code =
-        ChangeDisplaySettingsEx(deviceName,
-                                &devmode, 
-                                NULL,
-                                CDS_UPDATEREGISTRY,
-                                NULL
-                                );
-    
-//        GetDispCode(code);
-		if (code!=0) 
-		{
-			if (hUser32) FreeLibrary(hUser32);
-			return false;
-		}
-        code = ChangeDisplaySettingsEx(deviceName,
-                                &devmode, 
-                                NULL,
-                                0,
-                                NULL
-                                );
-   
-		if (hdeskCurrent)SetThreadDesktop(hdeskCurrent);
-		if (hdeskInput)CloseDesktop(hdeskInput);
-
-		RegCloseKey(hKeyProfileMirror);
-        RegCloseKey(hKeyDevice);
-		if (code!=0)
-		{
-			if (hUser32) FreeLibrary(hUser32);
-			return false;
-		}
-		if (hUser32) FreeLibrary(hUser32);
-		return true;
-	}
-	if (hUser32) FreeLibrary(hUser32);
-	return false;
-}
-
-int
-VIDEODRIVER::OSVersion()
-{
-   OSVERSIONINFOEX osvi;
-   SYSTEM_INFO si;
-   PGNSI pGNSI;
-   BOOL bOsVersionInfoEx;
-
-   ZeroMemory(&si, sizeof(SYSTEM_INFO));
-   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
-   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-   if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
-   {
-      osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-      if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) 
-         return FALSE;
-   }
-   pGNSI = (PGNSI) GetProcAddress(
-      GetModuleHandle(TEXT("kernel32.dll")), 
-      "GetNativeSystemInfo");
-   if(NULL != pGNSI)
-      pGNSI(&si);
-   else GetSystemInfo(&si);
-
-	switch (osvi.dwPlatformId)
-   {
-      case VER_PLATFORM_WIN32_NT:
-
-      // Test for the specific product.
-
-      if ( osvi.dwMajorVersion == 6)
-      {
-         return OSVISTA;
-      }
-
-      if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
-      {
-         if( osvi.wProductType == VER_NT_WORKSTATION &&
-                   si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
-         {
-            return OSWINXP64;
-         }
-         else return OSWIN2003;
-      }
-
-      if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
-         return OSWINXP;
-
-      if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
-         return OSWIN2000;
-
-      if ( osvi.dwMajorVersion <= 4 )
-         return OSOLD;
-
-	}
-	return OSOLD;
-}
-
-
-HDC
-VIDEODRIVER::GetDcMirror()
-{
-typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
-		HDC m_hrootdc=NULL;
-		pEnumDisplayDevices pd=NULL;
-		LPSTR driverName = "mv video hook driver2";
-		BOOL DriverFound;
-		DEVMODE devmode;
-		FillMemory(&devmode, sizeof(DEVMODE), 0);
-		devmode.dmSize = sizeof(DEVMODE);
-		devmode.dmDriverExtra = 0;
-		/*BOOL change = */EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
-		devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-		HMODULE hUser32=LoadLibrary("USER32");
-		if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-		if (pd)
-			{
-				LPSTR deviceName=NULL;
-				DISPLAY_DEVICE dd;
-				ZeroMemory(&dd, sizeof(dd));
-				dd.cb = sizeof(dd);
-				devmode.dmDeviceName[0] = '\0';
-				INT devNum = 0;
-				BOOL result;
-				DriverFound=false;
-				while ((result = (*pd)(NULL,devNum, &dd,0)))
-				{
-					if (strcmp((const char *)&dd.DeviceString[0], driverName) == 0)
-					{
-					DriverFound=true;
-					break;
-					}
-					devNum++;
-				}
-				if (DriverFound)
-				{
-				deviceName = (LPSTR)&dd.DeviceName[0];
-				m_hrootdc = CreateDC("DISPLAY",deviceName,NULL,NULL);	
-				if (m_hrootdc) DeleteDC(m_hrootdc);
-				}
-			}
-		if (hUser32) FreeLibrary(hUser32);
-
-		return m_hrootdc;
-}
-
-BOOL
-VIDEODRIVER:: HardwareCursor()
-{
-	HDC gdc;
-	gdc = GetDC(NULL);
-	ExtEscape(gdc, MAP1, 0, NULL, 0, NULL);
-	ExtEscape(gdc, CURSOREN, 0, NULL, 0, NULL);
-	ReleaseDC(NULL,gdc);
-	return true;
-}
-
-BOOL
-VIDEODRIVER:: NoHardwareCursor()
-{
-	HDC gdc;
-	gdc = GetDC(NULL);
-	ExtEscape(gdc, CURSORDIS, 0, NULL, 0, NULL);
-	ReleaseDC(NULL,gdc);
-	return true;
-}
-
diff --git a/ica/win32/winvnc/winvnc/videodriver.h b/ica/win32/winvnc/winvnc/videodriver.h
deleted file mode 100644
index 57fec0b..0000000
--- a/ica/win32/winvnc/winvnc/videodriver.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#ifndef _VIDEOD_H
-#define _VIDEOD_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <windows.h>
-
-#include <tchar.h>
-#include <winbase.h>
-#include <winreg.h>
-//#include <StrSafe.h>
-
-#define MAXCHANGES_BUF 2000
-
-#define OSVISTA 6
-#define OSWINXP 5
-#define OSWIN2000 5
-#define OSWIN2003 5
-#define OSOLD 4
-#define OSWINXP64 7
-
-#define SCREEN_SCREEN 11
-#define BLIT 12
-#define SOLIDFILL 13
-#define BLEND 14
-#define TRANS 15
-#define PLG 17
-#define TEXTOUT 18
-
-typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
-typedef LONG (WINAPI* pChangeDisplaySettingsExA)(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID);
-typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-typedef struct _CHANGES_RECORD
-{
-	ULONG type;  //screen_to_screen, blit, newcache,oldcache
-	RECT rect;	
-	POINT point;
-}CHANGES_RECORD;
-typedef CHANGES_RECORD *PCHANGES_RECORD;
-typedef struct _CHANGES_BUF
-	{
-	 ULONG counter;
-	 CHANGES_RECORD pointrect[MAXCHANGES_BUF];
-	}CHANGES_BUF;
-typedef CHANGES_BUF *PCHANGES_BUF;
-
-class VIDEODRIVER
-{
-public:
-	VIDEODRIVER();
-	void VIDEODRIVER_start(int x,int y,int w,int h);
-	void VIDEODRIVER_Stop();
-	virtual ~VIDEODRIVER();
-	BOOL HardwareCursor();
-	BOOL NoHardwareCursor();
-
-	ULONG oldaantal;
-	PCHAR mypVideoMemory;
-	PCHAR myframebuffer;
-	PCHANGES_BUF mypchangebuf;
-	BOOL blocked;
-	DWORD shared_buffer_size;
-	
-
-protected:
-	int OSVersion();
-	bool Mirror_driver_attach_XP(int x,int y,int w,int h);
-	void Mirror_driver_detach_XP();
-	bool Mirror_driver_Vista(DWORD dwAttach,int x,int y,int w,int h);
-	PCHAR VideoMemory_GetSharedMemory(void);
-	void VideoMemory_ReleaseSharedMemory(PCHAR pVideoMemory);
-	HDC GetDcMirror();
-
-	int OSVER;
-	
-};
-
-#endif
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/videodrivercheck.cpp b/ica/win32/winvnc/winvnc/videodrivercheck.cpp
deleted file mode 100644
index 233ab74..0000000
--- a/ica/win32/winvnc/winvnc/videodrivercheck.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h>
-#include <stdlib.h>
-#include "vncOSVersion.h"
-
-DWORD MessageBoxSecure(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);
-typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
-
-/*bool CheckDriver2(void)
-{
-	SC_HANDLE       schMaster;
-	SC_HANDLE       schSlave;
-
-	schMaster = OpenSCManager (NULL, NULL, SC_MANAGER_ALL_ACCESS); 
-
-    schSlave = OpenService (schMaster, "vnccom", SERVICE_ALL_ACCESS);
-
-    if (schSlave == NULL) 
-    {
-     CloseServiceHandle(schMaster);
-	 return false;
-    }
-	else
-	{
-		CloseServiceHandle (schSlave);
-		CloseServiceHandle(schMaster);
-		return true;
-	}
-}*/
-
-
-///////////////////////////////////////////////////////////////////
-BOOL GetDllProductVersion(char* dllName, char *vBuffer, int size)
-{
-   char *versionInfo;
-   void *lpBuffer;
-   unsigned int cBytes;
-   DWORD rBuffer;
-
-   if( !dllName || !vBuffer )
-      return(FALSE);
-
-//   DWORD sName = GetModuleFileName(NULL, fileName, sizeof(fileName));
-// FYI only
-    /*char systemroot[150];
-	GetEnvironmentVariable("SystemRoot", systemroot, 150);
-	char exe_file_name[MAX_PATH];
-	strcpy(exe_file_name,systemroot);
-	strcat(exe_file_name,"\\system32\\driver\\");
-	strcat(exe_file_name,dllName);*/
-
-   DWORD sVersion = GetFileVersionInfoSize(dllName, &rBuffer);
-   if (sVersion==0) return (FALSE);
-   versionInfo = new char[sVersion];
-
-   BOOL resultValue = VerQueryValue(versionInfo,  
-
-TEXT("\\StringFileInfo\\040904b0\\ProductVersion"), 
-                                    &lpBuffer, 
-                                    &cBytes);
-
-   if( !resultValue )
-   {
-	   resultValue = VerQueryValue(versionInfo,TEXT("\\StringFileInfo\\000004b0\\ProductVersion"), 
-                                    &lpBuffer, 
-                                    &cBytes);
-
-   }
-
-   if( resultValue )
-   {
-      strncpy(vBuffer, (char *) lpBuffer, size);
-      delete []versionInfo;
-      return(TRUE);
-   }
-   else
-   {
-      *vBuffer = '\0';
-      delete []versionInfo;
-      return(FALSE);
-   }
-}
-
-///////////////////////////////////////////////////////////////////
-
-bool
-CheckVideoDriver(bool Box)
-{
-		typedef BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
-		pEnumDisplayDevices pd=NULL;
-		LPSTR driverName = "mv video hook driver2";
-		BOOL DriverFound;
-		DEVMODE devmode;
-		FillMemory(&devmode, sizeof(DEVMODE), 0);
-		devmode.dmSize = sizeof(DEVMODE);
-		devmode.dmDriverExtra = 0;
-		/*BOOL change = */EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
-		devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-		HMODULE hUser32=LoadLibrary("USER32");
-		if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-		if (pd)
-			{
-				LPSTR deviceName=NULL;
-				DISPLAY_DEVICE dd;
-				ZeroMemory(&dd, sizeof(dd));
-				dd.cb = sizeof(dd);
-				devmode.dmDeviceName[0] = '\0';
-				INT devNum = 0;
-				BOOL result;
-				DriverFound=false;
-				while ((result = (*pd)(NULL,devNum, &dd,0)))
-				{
-					if (strcmp((const char *)&dd.DeviceString[0], driverName) == 0)
-					{
-					DriverFound=true;
-					break;
-					}
-					devNum++;
-				}
-				if (DriverFound)
-				{
-					if (hUser32) FreeLibrary(hUser32);
-					if(Box)
-					{
-						char buf[512];
-						GetDllProductVersion("mv2.dll",buf,512);
-						if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
-						{
-							strcat(buf," driver Active");
-							HDC testdc=NULL;
-							deviceName = (LPSTR)&dd.DeviceName[0];
-							testdc = CreateDC("DISPLAY",deviceName,NULL,NULL);	
-							if (testdc)
-							{
-								DeleteDC(testdc);
-								strcat(buf," access ok");
-							}
-							else
-							{
-								strcat(buf," access denied, permission problem");
-							}
-						}
-						else
-							strcat(buf," driver Not Active");
-						    
-						MessageBoxSecure(NULL,buf,"driver info: required version 1.22",0);
-					}
-					return true;
-				}
-				else if(Box) MessageBoxSecure(NULL,"Driver not found: Perhaps you need to reboot after install","driver info: required version 1.22",0);
-			}
-	if (hUser32) FreeLibrary(hUser32);	
-	return false;
-}
diff --git a/ica/win32/winvnc/winvnc/vistahook.cpp b/ica/win32/winvnc/winvnc/vistahook.cpp
deleted file mode 100644
index b5cfd5d..0000000
--- a/ica/win32/winvnc/winvnc/vistahook.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "vncdesktopthread.h"
-#include "Localization.h"
-#include "vnctimedmsgbox.h"
-namespace
-{
-    int g_Oldcounter=0;
-}
-bool stop_hookwatch=false;
-
-inline bool
-ClipRect(int *x, int *y, int *w, int *h,
-	    int cx, int cy, int cw, int ch) {
-  if (*x < cx) {
-    *w -= (cx-*x);
-    *x = cx;
-  }
-  if (*y < cy) {
-    *h -= (cy-*y);
-    *y = cy;
-  }
-  if (*x+*w > cx+cw) {
-    *w = (cx+cw)-*x;
-  }
-  if (*y+*h > cy+ch) {
-    *h = (cy+ch)-*y;
-  }
-  return (*w>0) && (*h>0);
-}
-
-DWORD WINAPI hookwatch(LPVOID lpParam)
-{
-	vncDesktopThread *dt = (vncDesktopThread *)lpParam;
-
-	while (!stop_hookwatch)
-	{
-		if (dt->g_obIPC.listall()->counter!=g_Oldcounter)
-		{
-			dt->m_desktop->TriggerUpdate();
-			Sleep(15);
-		}
-		Sleep(5);
-	}
-
-	return 0;
-}
-
-bool
-vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache)
-{
-	bool returnvalue=false;
-	//vnclog.Print(LL_INTERR, VNCLOG("counter,g_Oldcounter %i %i  \n"),ringbuffer->counter,g_Oldcounter);
-	if (ringbuffer->counter==g_Oldcounter) return 0;
-	int counter=ringbuffer->counter;
-	if (counter<1 || counter>1999) return 0;
-
-	if (g_Oldcounter<counter)
-	{
-		for (int i =g_Oldcounter+1; i<=counter;i++)
-		{
-			if (ringbuffer->type[i]==0)
-			{
-				rfb::Rect rect;
-				rect.tl = rfb::Point(ringbuffer->rect1[i].left, ringbuffer->rect1[i].top);
-				rect.br = rfb::Point(ringbuffer->rect1[i].right, ringbuffer->rect1[i].bottom);
-				//Buffer coordinates
-				//rect.tl.x-=(m_desktop->m_SWOffsetx);
-				//rect.br.x-=(m_desktop->m_SWOffsetx);
-				//rect.tl.y-=(m_desktop->m_SWOffsety);
-				//rect.br.y-=(m_desktop->m_SWOffsety);
-				vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i  \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-	/*#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText,"REct1 %i %i %i %i  \n",rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif	*/		
-				rect = rect.intersect(m_desktop->m_Cliprect);
-				if (!rect.is_empty())
-				{
-/*#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText,"REctXXXXXXXXXXX %i %i %i %i  \n",rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif*/
-					returnvalue=true;
-					rgncache.assign_union(rect);
-				}
-			}
-			if (ringbuffer->type[i]==2 || ringbuffer->type[i]==4)
-			{
-				/*if (MyGetCursorInfo)
-					{
-						MyCURSORINFO cinfo;
-						cinfo.cbSize=sizeof(MyCURSORINFO);
-						MyGetCursorInfo(&cinfo);
-						m_desktop->SetCursor(cinfo.hCursor);
-						//vnclog.Print(LL_INTERR, VNCLOG("Cursor %i  \n"),cinfo.hCursor);
-					}*/
-	
-				
-			}
-			
-		}
-
-	}
-	else
-	{
-		int  i = 0;
-		for (i =g_Oldcounter+1;i<2000;i++)
-		{
-			if (ringbuffer->type[i]==0 )
-			{
-				rfb::Rect rect;
-				rect.tl = rfb::Point(ringbuffer->rect1[i].left, ringbuffer->rect1[i].top);
-				rect.br = rfb::Point(ringbuffer->rect1[i].right, ringbuffer->rect1[i].bottom);
-				//Buffer coordinates
-				//rect.tl.x-=m_desktop->m_ScreenOffsetx;
-				//rect.br.x-=m_desktop->m_ScreenOffsetx;
-				//rect.tl.y-=m_desktop->m_ScreenOffsety;
-				//rect.br.y-=m_desktop->m_ScreenOffsety;
-				//vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i  \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText,"REct2 %i %i %i %i  \n",rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif				
-				rect = rect.intersect(m_desktop->m_Cliprect);
-				if (!rect.is_empty())
-				{
-					returnvalue=true;
-					rgncache.assign_union(rect);
-				}
-			}
-			if (ringbuffer->type[i]==2 || ringbuffer->type[i]==4)
-			{
-				/*if (MyGetCursorInfo)
-					{
-						MyCURSORINFO cinfo;
-						cinfo.cbSize=sizeof(MyCURSORINFO);
-						MyGetCursorInfo(&cinfo);
-						m_desktop->SetCursor(cinfo.hCursor);
-						//vnclog.Print(LL_INTERR, VNCLOG("Cursor %i  \n"),cinfo.hCursor);
-					}*/
-				
-			}
-			
-		}
-		for (i=1;i<=counter;i++)
-		{
-			if (ringbuffer->type[i]==0 )
-			{
-				rfb::Rect rect;
-				rect.tl = rfb::Point(ringbuffer->rect1[i].left, ringbuffer->rect1[i].top);
-				rect.br = rfb::Point(ringbuffer->rect1[i].right, ringbuffer->rect1[i].bottom);
-				//Buffer coordinates
-				//rect.tl.x-=m_desktop->m_ScreenOffsetx;
-				//rect.br.x-=m_desktop->m_ScreenOffsetx;
-				//rect.tl.y-=m_desktop->m_ScreenOffsety;
-				//rect.br.y-=m_desktop->m_ScreenOffsety;
-				//vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i  \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-				
-				rect = rect.intersect(m_desktop->m_Cliprect);
-				if (!rect.is_empty())
-				{
-					returnvalue=true;
-					rgncache.assign_union(rect);
-				}
-			}
-			if (ringbuffer->type[i]==2 || ringbuffer->type[i]==4)
-			{
-				/*if (MyGetCursorInfo)
-					{
-						MyCURSORINFO cinfo;
-						cinfo.cbSize=sizeof(MyCURSORINFO);
-						MyGetCursorInfo(&cinfo);
-						m_desktop->SetCursor(cinfo.hCursor);
-						//vnclog.Print(LL_INTERR, VNCLOG("Cursor %i  \n"),cinfo.hCursor);
-					}*/
-				
-			}
-			
-		}
-	}
-	g_Oldcounter=counter;
-	return returnvalue;
-}
-void Enable_softwareCAD_elevated();
-void delete_softwareCAD_elevated();
-DWORD GetExplorerLogonPid();
-bool IsSoftwareCadEnabled();
-bool ISUACENabled();
-extern HANDLE hShutdownEventcad;
-
-
-DWORD WINAPI Cadthread(LPVOID lpParam)
-{
-	OSVERSIONINFO OSversion;	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-	GetVersionEx(&OSversion);
-
-
-	HDESK desktop=NULL;
-	desktop = OpenInputDesktop(0, FALSE,
-								DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-								DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-								DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-								DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-								);
-
-
-	
-	if (desktop == NULL)
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n"));
-	else 
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n"));
-
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-
-	char new_name[256];
-	if (desktop)
-	{
-	if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
-	}
-
-	vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop);
-
-	if (!SetThreadDesktop(desktop))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
-	}
-	}
-
-	//////
-	if(OSversion.dwMajorVersion>=6 && vncService::RunningAsService())
-			{
-				/*if (OSversion.dwMinorVersion==0) //Vista
-				{
-					if (ISUACENabled() && !IsSoftwareCadEnabled())//ok
-					{
-						
-					}
-					if (!ISUACENabled() && IsSoftwareCadEnabled())
-					{
-						
-					}
-					if (!ISUACENabled() && !IsSoftwareCadEnabled())
-					{
-						DWORD result=MessageBoxSecure(NULL,"UAC is Disable, make registry changes to allow cad","Warning",MB_YESNO);
-						if (result==IDYES)
-						{
-							HANDLE hProcess,hPToken;
-							DWORD id=GetExplorerLogonPid();
-							if (id!=0) 
-								{
-									hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-									if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) return 0;
-
-									char dir[MAX_PATH];
-									char exe_file_name[MAX_PATH];
-									GetModuleFileName(0, exe_file_name, MAX_PATH);
-									strcpy(dir, exe_file_name);
-									strcat(dir, " -softwarecadhelper");
-		
-							
-									STARTUPINFO          StartUPInfo;
-									PROCESS_INFORMATION  ProcessInfo;
-									HANDLE Token=NULL;
-									HANDLE process=NULL;
-									ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-									ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-									StartUPInfo.wShowWindow = SW_SHOW;
-									StartUPInfo.lpDesktop = "Winsta0\\Default";
-									StartUPInfo.cb = sizeof(STARTUPINFO);
-				
-									CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-									DWORD errorcode=GetLastError();
-									if (process) CloseHandle(process);
-									if (Token) CloseHandle(Token);
-									if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-									if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-									if (errorcode==1314)
-									{
-										Enable_softwareCAD_elevated();
-									}
-								}
-						}
-					}
-					if (ISUACENabled() && IsSoftwareCadEnabled())
-					{
-						DWORD result=MessageBoxSecure(NULL,"UAC is Enablde, make registry changes to allow cad","Warning",MB_YESNO);
-						if (result==IDYES)
-						{
-							HANDLE hProcess,hPToken;
-							DWORD id=GetExplorerLogonPid();
-							if (id!=0) 
-								{
-									hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-									if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) return 0;
-
-									char dir[MAX_PATH];
-									char exe_file_name[MAX_PATH];
-									GetModuleFileName(0, exe_file_name, MAX_PATH);
-									strcpy(dir, exe_file_name);
-									strcat(dir, " -delsoftwarecadhelper");
-			
-							
-									STARTUPINFO          StartUPInfo;
-									PROCESS_INFORMATION  ProcessInfo;
-									HANDLE Token=NULL;
-									HANDLE process=NULL;
-									ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-									ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-									StartUPInfo.wShowWindow = SW_SHOW;
-									StartUPInfo.lpDesktop = "Winsta0\\Default";
-									StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-									CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-									DWORD errorcode=GetLastError();
-									if (process) CloseHandle(process);
-									if (Token) CloseHandle(Token);
-									if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-									if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-									if (errorcode==1314)
-										{
-											delete_softwareCAD_elevated();
-										}							
-								}
-						}
-					}
-
-				}
-				else*/
-					if( vncService::RunningAsService() &&!IsSoftwareCadEnabled())
-					{
-						DWORD result=MessageBoxSecure(NULL,"UAC is Disable, make registry changes to allow cad","Warning",MB_YESNO);
-						if (result==IDYES)
-							{
-								HANDLE hProcess,hPToken;
-								DWORD id=GetExplorerLogonPid();
-								if (id!=0) 
-									{						
-									hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-									if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) return 0;
-
-									char dir[MAX_PATH];
-									char exe_file_name[MAX_PATH];
-									GetModuleFileName(0, exe_file_name, MAX_PATH);
-									strcpy(dir, exe_file_name);
-									strcat(dir, " -softwarecadhelper");
-		
-							
-									STARTUPINFO          StartUPInfo;
-									PROCESS_INFORMATION  ProcessInfo;
-									HANDLE Token=NULL;
-									HANDLE process=NULL;
-									ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-									ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-									StartUPInfo.wShowWindow = SW_SHOW;
-									StartUPInfo.lpDesktop = "Winsta0\\Default";
-									StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-									CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-									DWORD errorcode=GetLastError();
-									if (process) CloseHandle(process);
-									if (Token) CloseHandle(Token);
-									if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-									if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-									if (errorcode==1314)
-										{
-											Enable_softwareCAD_elevated();
-										}							
-									}
-							}
-					
-					}
-			}
-       /////////////////////
-	if(OSversion.dwMajorVersion==6)//&& OSversion.dwMinorVersion>=1) //win7  // test win7 +Vista
-	{
-
-		if (hShutdownEventcad==NULL ) hShutdownEventcad = OpenEvent(EVENT_MODIFY_STATE, FALSE, "Global\\SessionEventUltraCad");
-		if (hShutdownEventcad!=NULL ) SetEvent(hShutdownEventcad);
-		if (old_desktop) SetThreadDesktop(old_desktop);
-		if (desktop) CloseDesktop(desktop);
-		return 0;
-	}
-
-	 HKEY hKey; 
-	 DWORD isLUAon = 0; 
-     if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"), 0, KEY_READ, &hKey) == ERROR_SUCCESS) 
-              { 
-              DWORD LUAbufSize = 4; 
-              RegQueryValueEx(hKey, TEXT("EnableLUA"), NULL, NULL, (LPBYTE)&isLUAon, &LUAbufSize); 
-              RegCloseKey(hKey); 
-			  }
-     if (isLUAon != 1 && OSversion.dwMajorVersion==6) 
-	 {
-		 if (hShutdownEventcad==NULL ) hShutdownEventcad = OpenEvent(EVENT_MODIFY_STATE, FALSE, "Global\\SessionEventUltraCad");
-		 if (hShutdownEventcad!=NULL ) SetEvent(hShutdownEventcad);
-		 if (old_desktop) SetThreadDesktop(old_desktop);
-		 if (desktop) CloseDesktop(desktop);
-		 return 0;
-	 }
-
-//Full path needed, sometimes it just default to system32
-	char WORKDIR[MAX_PATH];
-	char mycommand[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return 0;
-		*p = '\0';
-		}
-	strcpy(mycommand,"");
-	strcat(mycommand,WORKDIR);//set the directory
-	strcat(mycommand,"\\");
-	strcat(mycommand,"cad.exe");
-
-	int nr=(LONG_PTR)ShellExecute(GetDesktopWindow(), "open", mycommand, "", 0, SW_SHOWNORMAL);
-	if (nr<=32)
-	{
-		//error
-		//
-		if ( nr==SE_ERR_ACCESSDENIED )
-			vncTimedMsgBox::Do(
-									sz_ID_CADPERMISSION,
-									sz_ID_ULTRAVNC_WARNING,
-									MB_ICONINFORMATION | MB_OK
-									);
-
-		if ( nr==ERROR_PATH_NOT_FOUND || nr==ERROR_FILE_NOT_FOUND)
-			vncTimedMsgBox::Do(
-									sz_ID_CADERRORFILE,
-									sz_ID_ULTRAVNC_WARNING,
-									MB_ICONINFORMATION | MB_OK
-									);
-
-	}
-
-	if (old_desktop) SetThreadDesktop(old_desktop);
-	if (desktop) CloseDesktop(desktop);
-	return 0;
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncDesktopSW.cpp b/ica/win32/winvnc/winvnc/vncDesktopSW.cpp
deleted file mode 100644
index a1794be..0000000
--- a/ica/win32/winvnc/winvnc/vncDesktopSW.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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.uvnc.com/
-
-
-// System headers
-#include <assert.h>
-#include "stdhdrs.h"
-
-// Custom headers
-#include <omnithread.h>
-#include "winvnc.h"
-#include "vnchooks/VNCHooks.h"
-#include "vncserver.h"
-#include "rfbRegion.h"
-#include "rfbRect.h"
-#include "vncdesktop.h"
-#include "vncservice.h"
-
-BOOL vncDesktop:: CalculateSWrect(RECT &rect)
-{
-
-	if (!m_Single_hWnd)
-	{
-		m_server->SingleWindow(false);
-		m_SWtoDesktop=TRUE;
-		rect.top=0;
-		rect.left=0;
-		rect.right=m_scrinfo.framebufferWidth;
-		rect.bottom=m_scrinfo.framebufferHeight;
-		return FALSE;
-	}
-
-	if (IsIconic(m_Single_hWnd))
-	{
-		m_server->SingleWindow(false);
-		m_Single_hWnd=NULL;
-		m_SWtoDesktop=TRUE;
-		rect.top=0;
-		rect.left=0;
-		rect.right=m_scrinfo.framebufferWidth;
-		rect.bottom=m_scrinfo.framebufferHeight;
-		return FALSE;
-	}
-	if ( IsWindowVisible(m_Single_hWnd) && GetWindowRect(m_Single_hWnd,&rect)) 
-		{
-			RECT taskbar;
-			rect.top=Max(rect.top,0);
-			rect.left=Max(rect.left,0);
-			rect.right=Min(rect.right,m_scrinfo.framebufferWidth);
-			rect.bottom=Min(rect.bottom,m_scrinfo.framebufferHeight);
-			APPBARDATA pabd;
-			pabd.cbSize=sizeof(APPBARDATA);
-			SHAppBarMessage(ABM_GETTASKBARPOS, &pabd);
-			taskbar.top=Max(pabd.rc.top,0);
-			taskbar.left=Max(pabd.rc.left,0);
-			taskbar.right=Min(pabd.rc.right,m_scrinfo.framebufferWidth);
-			taskbar.bottom=Min(pabd.rc.bottom,m_scrinfo.framebufferHeight);
-			///desktop
-			if (rect.top==0 && rect.left== 0&& rect.right==m_scrinfo.framebufferWidth && rect.bottom==m_scrinfo.framebufferHeight)
-				{
-					m_server->SingleWindow(false);
-					m_Single_hWnd=NULL;
-					rect.top=0;
-					rect.left=0;
-					rect.right=m_scrinfo.framebufferWidth;
-					rect.bottom=m_scrinfo.framebufferHeight;
-					return TRUE;
-				}
-			//taskbar
-			if (rect.top>=taskbar.top && rect.left== taskbar.left&& rect.right==taskbar.right && rect.bottom==taskbar.bottom)
-			
-				{
-					rect.top=taskbar.top;
-					rect.left=taskbar.left;
-					rect.right=taskbar.right;
-					rect.bottom=taskbar.bottom;
-					if ((m_SWHeight!=(rect.bottom-rect.top)) || (m_SWWidth!=(rect.right-rect.left)))
-					m_SWSizeChanged=TRUE;
-					m_SWHeight=rect.bottom-rect.top;
-					m_SWWidth=rect.right-rect.left;
-					return TRUE;	
-				}
-			//eliminate other little windows
-			if ((m_SWHeight!=(rect.bottom-rect.top)) || (m_SWWidth!=(rect.right-rect.left)))
-				m_SWSizeChanged=TRUE;
-			//vnclog.Print(LL_INTINFO, VNCLOG("screen format %d %d %d %d\n"),
-			//		rect.top,
-			//		rect.bottom,rect.right,rect.left);
-			if ((rect.bottom-rect.top)<64||(rect.right-rect.left)<128 || rect.bottom<0 ||rect.top<0 || rect.right<0 ||
-				rect.left<0 || rect.bottom>m_scrinfo.framebufferHeight||rect.top>m_scrinfo.framebufferHeight||
-				rect.right>m_scrinfo.framebufferWidth||rect.left>m_scrinfo.framebufferWidth)
-			{
-				m_server->SingleWindow(false);
-				m_Single_hWnd=NULL;
-				m_SWtoDesktop=TRUE;
-				rect.top=0;
-				rect.left=0;
-				rect.right=m_scrinfo.framebufferWidth;
-				rect.bottom=m_scrinfo.framebufferHeight;
-				m_SWSizeChanged=FALSE;
-				return FALSE;
-			}
-
-
-			m_SWHeight=rect.bottom-rect.top;
-			m_SWWidth=rect.right-rect.left;
-			return TRUE;
-		}		
-	m_server->SingleWindow(false);
-	m_Single_hWnd=NULL;
-	m_SWtoDesktop=TRUE;
-	rect.top=0;
-	rect.left=0;
-	rect.right=m_scrinfo.framebufferWidth;
-	rect.bottom=m_scrinfo.framebufferHeight;
-	return FALSE;
-}
-
-void vncDesktop::SWinit()
-{
-	m_Single_hWnd=NULL;
-	m_Single_hWnd_backup=NULL;
-	m_SWHeight=0;
-	m_SWWidth=0;
-	m_SWSizeChanged=FALSE;
-	m_SWmoved=FALSE;
-	m_SWOffsetx=0;
-	m_SWOffsety=0;
-	vnclog.Print(LL_INTINFO, VNCLOG("SWinit \n"));
-}
-
-rfb::Rect
-vncDesktop::GetSize()
-{
-	//vnclog.Print(LL_INTINFO, VNCLOG("GetSize \n"));
-	if (m_server->SingleWindow())
-		{
-		RECT rect;
-		rect.left=m_Cliprect.tl.x;
-		rect.top=m_Cliprect.tl.y;
-		rect.right=m_Cliprect.br.x;
-		rect.bottom=m_Cliprect.br.y;
-		return rfb::Rect(rect.left, rect.top, rect.right, rect.bottom);
-		
-		}
-	else if (!m_videodriver)
-		{
-		m_SWOffsetx=0;
-		m_SWOffsety=0;
-		return rfb::Rect(0, 0, m_scrinfo.framebufferWidth, m_scrinfo.framebufferHeight);
-		}
-	 else
-		{
-			if (multi_monitor)
-				return rfb::Rect(0,0,mymonitor[2].Width,mymonitor[2].Height);	
-			else
-				return rfb::Rect(0,0,mymonitor[0].Width,mymonitor[0].Height);
-		}
-}
-
-rfb::Rect
-vncDesktop::GetQuarterSize()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize \n"));
-if (m_server->SingleWindow())
-	{
-	RECT rect;
-	if (CalculateSWrect(rect))
-	{
-		rect.left=rect.left-m_ScreenOffsetx;
-		rect.right=rect.right-m_ScreenOffsetx;
-		rect.bottom=rect.bottom-m_ScreenOffsety;
-		rect.top=rect.top-m_ScreenOffsety;
-		if (m_SWOffsetx!=rect.left || m_SWOffsety!=rect.top) m_SWmoved=TRUE;
-		m_SWOffsetx=rect.left;
-		m_SWOffsety=rect.top;
-		m_Cliprect.tl.x=rect.left;
-		m_Cliprect.tl.y=rect.top;
-		m_Cliprect.br.x=rect.right;
-		m_Cliprect.br.y=rect.bottom;
-		return rfb::Rect(rect.left, rect.bottom, rect.right-rect.left, (rect.bottom-rect.top)/4);
-	}
-	else
-	{
-	m_SWOffsetx=0;
-	m_SWOffsety=0;
-	m_Cliprect.tl.x=0;
-	m_Cliprect.tl.y=0;
-	m_Cliprect.br.x=m_bmrect.br.x;
-	m_Cliprect.br.y=m_bmrect.br.y;
-	return rfb::Rect(0, 0, m_bmrect.br.x, m_bmrect.br.y/4);
-
-	}
-	}
-else
-	{ 
-	m_SWOffsetx=0;
-	m_SWOffsety=0;
-	m_Cliprect.tl.x=0;
-	m_Cliprect.tl.y=0;
-	m_Cliprect.br.x=m_bmrect.br.x;
-	m_Cliprect.br.y=m_bmrect.br.y;
-	vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize \n"));
-	return rfb::Rect(0, 0, m_bmrect.br.x, m_bmrect.br.y/4);
-	}
-}
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeTight.cpp b/ica/win32/winvnc/winvnc/vncEncodeTight.cpp
deleted file mode 100644
index e9f28ec..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeTight.cpp
+++ /dev/null
@@ -1,1614 +0,0 @@
-//  Copyright (C) 2000 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeTight
-
-// This file implements the vncEncoder-derived vncEncodeTight class.
-// This class overrides some vncEncoder functions to produce a bitmap
-// to Tight encoder. Tight is much more efficient than RAW format on
-// most screen data and usually 2..10 times as efficient as hextile.
-// It's also more efficient than Zlib encoding in most cases.
-// But note that tight compression may use more CPU time on the server.
-// However, over slower (128kbps or less) connections, the reduction
-// in data transmitted usually outweighs the extra latency added
-// while the server CPU performs the compression algorithms.
-
-#include "vncEncodeTight.h"
-
-// Compression level stuff. The following array contains various
-// encoder parameters for each of 10 compression levels (0..9).
-// Last three parameters correspond to JPEG quality levels (0..9).
-//
-// NOTE: m_conf[9].maxRectSize should be >= m_conf[i].maxRectSize,
-// where i in [0..8]. RequiredBuffSize() method depends on this.
-
-const TIGHT_CONF vncEncodeTight::m_conf[10] = {
-//	{	512,   32,	 6, 65536, 0, 0, 0, 0,	 0,   0,   4,  5, 10000, 23000 },
-//	{ 65536,65536,	 6, 65536, 1, 1, 0, 0,	 0,   0,   6, 15, 10000, 23000 },
-
-//	{  2048,  128,   6, 65536, 1, 1, 1, 0,   0,   0,   8, 15,  8000, 18000 },
-//	{  6144,  256,   8, 65536, 3, 3, 2, 0,   0,   0,  24, 20,  6500, 15000 },
-//	{ 10240, 1024,  12, 65536, 5, 5, 3, 0,   0,   0,  32, 25,  5000, 12000 },
-//	{ 16384, 2048,  12, 65536, 6, 6, 4, 0,   0,   0,  32, 37,  4000, 10000 },
-//	{ 32768, 2048,  12,  4096, 7, 7, 5, 4, 150, 380,  32, 50,  3000,  8000 },
-//	{ 65536, 2048,  16,  4096, 7, 7, 6, 4, 170, 420,  48, 60,  2000,  5000 },
-//	{ 65536, 2048,  16,  4096, 8, 8, 7, 5, 180, 450,  64, 70,  1000,  2500 },
-//	{ 65536, 2048,  32,  8192, 9, 9, 8, 6, 190, 475,  64, 75,   500,  1200 },
-//	{ 65536, 2048,  32,  8192, 9, 9, 9, 6, 200, 500,  96, 80,   200,   500 }
-	{ 16384,16384,	 6, 65536, 1, 1, 0, 0,	 0,   0,   8, 14, 10000, 23000 },
-	{ 16384,16384,   6, 65536, 1, 1, 1, 0,   0,   0,   8, 20,  8000, 18000 },
-	{ 16384,16384,   8, 65536, 3, 3, 2, 0,   0,   0,  24, 25,  6500, 15000 },
-	{ 32768,32768,  12, 65536, 5, 5, 3, 0,   0,   0,  32, 30,  5000, 12000 },
-	{ 32768,32768,  12, 65536, 6, 6, 4, 0,   0,   0,  32, 35,  4000, 10000 },
-	{ 32768,32768,  12,  4096, 7, 7, 5, 4, 150, 380,  32, 40,  3000,  8000 },
-	{ 65536,65536,  16,  4096, 7, 7, 6, 4, 170, 420,  48, 50,  2000,  5000 },
-	{ 65536,65536,  16,  4096, 8, 8, 7, 5, 180, 450,  64, 60,  1000,  2500 },
-	{ 65536,65536,  32,  8192, 9, 9, 8, 6, 190, 475,  64, 70,   500,  1200 },
-	{ 65536,65536,  32,  8192, 9, 9, 9, 6, 200, 500,  96, 80,   200,   500 }
-};
-
-vncEncodeTight::vncEncodeTight()
-{
-	m_buffer = NULL;
-	m_bufflen = 0;
-
-	m_hdrBuffer = new BYTE [sz_rfbFramebufferUpdateRectHeader + 8 + 256*4];
-	m_prevRowBuf = NULL;
-
-	for (int i = 0; i < 4; i++)
-		m_zsActive[i] = false;
-}
-
-vncEncodeTight::~vncEncodeTight()
-{
-	if (m_buffer != NULL) {
-		delete[] m_buffer;
-		m_buffer = NULL;
-	}
-
-	delete[] m_hdrBuffer;
-
-	for (int i = 0; i < 4; i++) {
-		if (m_zsActive[i])
-			deflateEnd(&m_zsStruct[i]);
-		m_zsActive[i] = false;
-	}
-	if (m_prevRowBuf != NULL)
-	{
-		delete[] m_prevRowBuf;
-		m_prevRowBuf=NULL;
-	}
-}
-
-void
-vncEncodeTight::Init()
-{
-	vncEncoder::Init();
-}
-
-/*****************************************************************************
- *
- * Routines to implement Tight Encoding.
- *
- */
-
-UINT
-vncEncodeTight::RequiredBuffSize(UINT width, UINT height)
-{
-	// FIXME: Use actual compression level instead of 9?
-	int result = m_conf[ m_compresslevel ].maxRectSize * (m_remoteformat.bitsPerPixel / 8);
-	result += result / 100 + 16;
-
-	return result;
-}
-
-UINT
-vncEncodeTight::NumCodedRects(RECT &rect)
-{
-	const int w = rect.right - rect.left;
-	const int h = rect.bottom - rect.top;
-
-	// No matter how many rectangles we will send if LastRect markers
-	// are used to terminate rectangle stream.
-	if (m_use_lastrect && w * h >= MIN_SPLIT_RECT_SIZE) {
-		return 0;
-	}
-
-	const int maxRectSize = m_conf[m_compresslevel].maxRectSize;
-	const int maxRectWidth = m_conf[m_compresslevel].maxRectWidth;
-
-	if (w > maxRectWidth || w * h > maxRectSize) {
-		const int subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w;
-		const int subrectMaxHeight = maxRectSize / subrectMaxWidth;
-		return (((w - 1) / maxRectWidth + 1) *
-				((h - 1) / subrectMaxHeight + 1));
-	} else {
-		return 1;
-	}
-}
-
-UINT
-vncEncodeTight::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest,
-						   const RECT &rect)
-{
-	int x = rect.left, y = rect.top;
-	int w = rect.right - x, h = rect.bottom - y;
-
-	const int maxRectSize = m_conf[m_compresslevel].maxRectSize;
-	const int rawDataSize = maxRectSize * (m_remoteformat.bitsPerPixel / 8);
-
-	if (m_bufflen < rawDataSize) {
-		if (m_buffer != NULL)
-			delete [] m_buffer;
-
-		m_buffer = new BYTE [rawDataSize+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-
-		m_bufflen = rawDataSize;
-	}
-
-	if ( m_remoteformat.depth == 24 && m_remoteformat.redMax == 0xFF &&
-		 m_remoteformat.greenMax == 0xFF && m_remoteformat.blueMax == 0xFF ) {
-		m_usePixelFormat24 = true;
-	} else {
-		m_usePixelFormat24 = false;
-	}
-
-	if (!m_use_lastrect || w * h < MIN_SPLIT_RECT_SIZE)
-		return EncodeRectSimple(source, outConn, dest, rect);
-
-	// Calculate maximum number of rows in one non-solid rectangle.
-
-	int nMaxRows;
-	{
-		int maxRectSize = m_conf[m_compresslevel].maxRectSize;
-		int maxRectWidth = m_conf[m_compresslevel].maxRectWidth;
-		int nMaxWidth = (w > maxRectWidth) ? maxRectWidth : w;
-		nMaxRows = maxRectSize / nMaxWidth;
-	}
-
-	// Try to find large solid-color areas and send them separately.
-
-	CARD32 colorValue;
-	int x_best, y_best, w_best, h_best;
-	int dx, dy, dw, dh;
-
-	for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) {
-
-		// If a rectangle becomes too large, send its upper part now.
-
-		if (dy - y >= nMaxRows) {
-			RECT upperRect;
-			SetRect(&upperRect, x, y, x + w, y + nMaxRows);
-
-			int size = EncodeRectSimple(source, outConn, dest, upperRect);
-			outConn->SendExactQueue((char *)dest, size);
-
-			y += nMaxRows;
-			h -= nMaxRows;
-		}
-
-		dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ?
-			MAX_SPLIT_TILE_SIZE : (y + h - dy);
-
-		for (dx = x; dx < x + w; dx += MAX_SPLIT_TILE_SIZE) {
-
-			dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w) ?
-				MAX_SPLIT_TILE_SIZE : (x + w - dx);
-
-			if (CheckSolidTile(source, dx, dy, dw, dh, &colorValue, FALSE)) {
-
-				// Get dimensions of solid-color area.
-
-				FindBestSolidArea(source, dx, dy, w - (dx - x), h - (dy - y),
-								  colorValue, &w_best, &h_best);
-
-				// Make sure a solid rectangle is large enough
-				// (or the whole rectangle is of the same color).
-
-				if ( w_best * h_best != w * h &&
-					 w_best * h_best < MIN_SOLID_SUBRECT_SIZE )
-					continue;
-
-				// Try to extend solid rectangle to maximum size.
-
-				x_best = dx; y_best = dy;
-				ExtendSolidArea(source, x, y, w, h, colorValue,
-								&x_best, &y_best, &w_best, &h_best);
-
-				// Compute dimensions of surrounding rectangles.
-
-				RECT rects[4];
-				SetRect(&rects[0],
-						x, y, x + w, y_best);
-				SetRect(&rects[1],
-						x, y_best, x_best, y_best + h_best);
-				SetRect(&rects[2],
-						x_best + w_best, y_best, x + w, y_best + h_best);
-				SetRect(&rects[3],
-						x, y_best + h_best, x + w, y + h);
-
-				// Send solid-color area and surrounding rectangles.
-
-				for (int i = 0; i < 4; i++) {
-					if (i == 2) {
-						RECT onePixel;
-						SetRect(&onePixel,
-								x_best, y_best, x_best + 1, y_best + 1);
-						Translate(source, m_buffer, onePixel);
-
-						SendTightHeader(x_best, y_best, w_best, h_best);
-						int size = SendSolidRect(dest);
-
-						outConn->SendExactQueue((char *)m_hdrBuffer, m_hdrBufferBytes);
-						outConn->SendExactQueue((char *)dest, size);
-						encodedSize += (m_hdrBufferBytes + size -
-										sz_rfbFramebufferUpdateRectHeader);
-						transmittedSize += (m_hdrBufferBytes + size);
-					}
-					if ( rects[i].left == rects[i].right ||
-						 rects[i].top  == rects[i].bottom ) {
-						continue;
-					}
-					int size = EncodeRect(source, outConn, dest, rects[i]);
-					outConn->SendExactQueue((char *)dest, size);
-				}
-
-				// Return after all recursive calls done (0 == data sent).
-
-				return 0;
-			}
-
-		}
-
-	}
-
-	// No suitable solid-color rectangles found.
-
-	return EncodeRectSimple(source, outConn, dest, rect);
-}
-
-void
-vncEncodeTight::FindBestSolidArea(BYTE *source, int x, int y, int w, int h,
-								  CARD32 colorValue, int *w_ptr, int *h_ptr)
-{
-	int dx, dy, dw, dh;
-	int w_prev;
-	int w_best = 0, h_best = 0;
-
-	w_prev = w;
-
-	for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) {
-
-		dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ?
-			MAX_SPLIT_TILE_SIZE : (y + h - dy);
-		dw = (w_prev > MAX_SPLIT_TILE_SIZE) ?
-			MAX_SPLIT_TILE_SIZE : w_prev;
-
-		if (!CheckSolidTile(source, x, dy, dw, dh, &colorValue, TRUE))
-			break;
-
-		for (dx = x + dw; dx < x + w_prev;) {
-			dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w_prev) ?
-				MAX_SPLIT_TILE_SIZE : (x + w_prev - dx);
-			if (!CheckSolidTile(source, dx, dy, dw, dh, &colorValue, TRUE))
-				break;
-			dx += dw;
-		}
-
-		w_prev = dx - x;
-		if (w_prev * (dy + dh - y) > w_best * h_best) {
-			w_best = w_prev;
-			h_best = dy + dh - y;
-		}
-	}
-
-	*w_ptr = w_best;
-	*h_ptr = h_best;
-}
-
-void vncEncodeTight::ExtendSolidArea(BYTE *source, int x, int y, int w, int h,
-									 CARD32 colorValue,
-									 int *x_ptr, int *y_ptr,
-									 int *w_ptr, int *h_ptr)
-{
-	int cx, cy;
-
-	// Try to extend the area upwards.
-	for ( cy = *y_ptr - 1;
-		  cy >= y && CheckSolidTile(source, *x_ptr, cy, *w_ptr, 1,
-									&colorValue, TRUE);
-		  cy-- );
-	*h_ptr += *y_ptr - (cy + 1);
-	*y_ptr = cy + 1;
-
-	// ... downwards.
-	for ( cy = *y_ptr + *h_ptr;
-		  cy < y + h && CheckSolidTile(source, *x_ptr, cy, *w_ptr, 1,
-									   &colorValue, TRUE);
-		  cy++ );
-	*h_ptr += cy - (*y_ptr + *h_ptr);
-
-	// ... to the left.
-	for ( cx = *x_ptr - 1;
-		  cx >= x && CheckSolidTile(source, cx, *y_ptr, 1, *h_ptr,
-									&colorValue, TRUE);
-		  cx-- );
-	*w_ptr += *x_ptr - (cx + 1);
-	*x_ptr = cx + 1;
-
-	// ... to the right.
-	for ( cx = *x_ptr + *w_ptr;
-		  cx < x + w && CheckSolidTile(source, cx, *y_ptr, 1, *h_ptr,
-									   &colorValue, TRUE);
-		  cx++ );
-	*w_ptr += cx - (*x_ptr + *w_ptr);
-}
-
-bool
-vncEncodeTight::CheckSolidTile(BYTE *source, int x, int y, int w, int h,
-							   CARD32 *colorPtr, bool needSameColor)
-{
-	switch(m_localformat.bitsPerPixel) {
-	case 32:
-		return CheckSolidTile32(source, x, y, w, h, colorPtr, needSameColor);
-	case 16:
-		return CheckSolidTile16(source, x, y, w, h, colorPtr, needSameColor);
-	default:
-		return CheckSolidTile8(source, x, y, w, h, colorPtr, needSameColor);
-	}
-}
-
-#define DEFINE_CHECK_SOLID_FUNCTION(bpp)									  \
-																			  \
-bool 																		  \
-vncEncodeTight::CheckSolidTile##bpp(BYTE *source, int x, int y, int w, int h, \
-									CARD32 *colorPtr, bool needSameColor)	  \
-{																			  \
-	CARD##bpp *fbptr;														  \
-	CARD##bpp colorValue;													  \
-	int dx, dy; 															  \
-																			  \
-	fbptr = (CARD##bpp *)													  \
-		&source[y * m_bytesPerRow + x * (bpp/8)];							  \
-																			  \
-	colorValue = *fbptr;													  \
-	if (needSameColor && (CARD32)colorValue != *colorPtr)					  \
-		return false;														  \
-																			  \
-	for (dy = 0; dy < h; dy++) {											  \
-		for (dx = 0; dx < w; dx++) {										  \
-			if (colorValue != fbptr[dx])									  \
-				return false;												  \
-		}																	  \
-		fbptr = (CARD##bpp *)((BYTE *)fbptr + m_bytesPerRow);				  \
-	}																		  \
-																			  \
-	*colorPtr = (CARD32)colorValue; 										  \
-	return true;															  \
-}
-
-DEFINE_CHECK_SOLID_FUNCTION(8)
-DEFINE_CHECK_SOLID_FUNCTION(16)
-DEFINE_CHECK_SOLID_FUNCTION(32)
-
-UINT
-vncEncodeTight::EncodeRectSimple(BYTE *source, VSocket *outConn, BYTE *dest,
-								 const RECT &rect)
-{
-	const int x = rect.left, y = rect.top;
-	const int w = rect.right - x, h = rect.bottom - y;
-
-	const int maxRectSize = m_conf[m_compresslevel].maxRectSize;
-	const int maxRectWidth = m_conf[m_compresslevel].maxRectWidth;
-
-	int partialSize = 0;
-
-	if (w > maxRectWidth || w * h > maxRectSize) {
-		const int subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w;
-		const int subrectMaxHeight = maxRectSize / subrectMaxWidth;
-		int dx, dy, rw, rh;
-
-		for (dy = 0; dy < h; dy += subrectMaxHeight) {
-			for (dx = 0; dx < w; dx += maxRectWidth) {
-				rw = (dx + maxRectWidth < w) ? maxRectWidth : w - dx;
-				rh = (dy + subrectMaxHeight < h) ? subrectMaxHeight : h - dy;
-
-				partialSize = EncodeSubrect(source, outConn, dest,
-											x+dx, y+dy, rw, rh);
-				if (dy + subrectMaxHeight < h || dx + maxRectWidth < w) {
-					outConn->SendExactQueue((char *)dest, partialSize);
-				}
-			}
-		}
-	} else {
-		partialSize = EncodeSubrect(source, outConn, dest, x, y, w, h);
-	}
-
-	return partialSize;
-}
-
-UINT
-vncEncodeTight::EncodeSubrect(BYTE *source, VSocket *outConn, BYTE *dest,
-							  int x, int y, int w, int h)
-{
-	SendTightHeader(x, y, w, h);
-
-	RECT r;
-	r.left = x; r.top = y;
-	r.right = x + w; r.bottom = y + h;
-	Translate(source, m_buffer, r);
-
-	m_paletteMaxColors = w * h / m_conf[m_compresslevel].idxMaxColorsDivisor;
-	if ( m_paletteMaxColors < 2 &&
-		 w * h >= m_conf[m_compresslevel].monoMinRectSize ) {
-		m_paletteMaxColors = 2;
-	}
-	switch (m_remoteformat.bitsPerPixel) {
-	case 8:
-		FillPalette8(w * h);
-		break;
-	case 16:
-		FillPalette16(w * h);
-		break;
-	default:
-		FillPalette32(w * h);
-	}
-
-	int encDataSize;
-	switch (m_paletteNumColors) {
-	case 0:
-		// Truecolor image
-		if (DetectSmoothImage(w, h)) {
-			if (m_qualitylevel != -1) {
-				encDataSize = SendJpegRect(dest, w, h,
-										   m_conf[m_qualitylevel].jpegQuality);
-			} else {
-				encDataSize = SendGradientRect(dest, w, h);
-			}
-		} else {
-			encDataSize = SendFullColorRect(dest, w, h);
-		}
-		break;
-	case 1:
-		// Solid rectangle
-		encDataSize = SendSolidRect(dest);
-		break;
-	case 2:
-		// Two-color rectangle
-		encDataSize = SendMonoRect(dest, w, h);
-		break;
-	default:
-		// Up to 256 different colors
-		if ( m_paletteNumColors > 96 &&
-			 m_qualitylevel != -1 && m_qualitylevel <= 3 &&
-			 DetectSmoothImage(w, h) ) {
-			encDataSize = SendJpegRect(dest, w, h,
-									   m_conf[m_qualitylevel].jpegQuality);
-		} else {
-			encDataSize = SendIndexedRect(dest, w, h);
-		}
-	}
-
-	if (encDataSize < 0)
-		return vncEncoder::EncodeRect(source, dest, r);
-
-	outConn->SendExactQueue((char *)m_hdrBuffer, m_hdrBufferBytes);
-
-	encodedSize += m_hdrBufferBytes - sz_rfbFramebufferUpdateRectHeader + encDataSize;
-	transmittedSize += m_hdrBufferBytes + encDataSize;
-
-	return encDataSize;
-}
-
-void
-vncEncodeTight::SendTightHeader(int x, int y, int w, int h)
-{
-	rfbFramebufferUpdateRectHeader rect;
-
-	rect.r.x = Swap16IfLE(x-m_SWOffsetx);
-	rect.r.y = Swap16IfLE(y-m_SWOffsety);
-	rect.r.w = Swap16IfLE(w);
-	rect.r.h = Swap16IfLE(h);
-	rect.encoding = Swap32IfLE(rfbEncodingTight);
-
-	dataSize += w * h * (m_remoteformat.bitsPerPixel / 8);
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-
-	memcpy(m_hdrBuffer, (BYTE *)&rect, sz_rfbFramebufferUpdateRectHeader);
-	m_hdrBufferBytes = sz_rfbFramebufferUpdateRectHeader;
-}
-
-//
-// Subencoding implementations.
-//
-
-int
-vncEncodeTight::SendSolidRect(BYTE *dest)
-{
-	int len;
-
-	if (m_usePixelFormat24) {
-		Pack24(m_buffer, 1);
-		len = 3;
-	} else
-		len = m_remoteformat.bitsPerPixel / 8;
-
-	m_hdrBuffer[m_hdrBufferBytes++] = rfbTightFill << 4;
-	memcpy (dest, m_buffer, len);
-
-	return len;
-}
-
-int
-vncEncodeTight::SendMonoRect(BYTE *dest, int w, int h)
-{
-	const int streamId = 1;
-	int paletteLen, dataLen;
-	CARD8 paletteBuf[8];
-
-	// Prepare tight encoding header.
-	dataLen = (w + 7) / 8;
-	dataLen *= h;
-
-	m_hdrBuffer[m_hdrBufferBytes++] = (streamId | rfbTightExplicitFilter) << 4;
-	m_hdrBuffer[m_hdrBufferBytes++] = rfbTightFilterPalette;
-	m_hdrBuffer[m_hdrBufferBytes++] = 1;
-
-	// Prepare palette, convert image.
-	switch (m_remoteformat.bitsPerPixel) {
-	case 32:
-		EncodeMonoRect32((CARD8 *)m_buffer, w, h);
-
-		((CARD32 *)paletteBuf)[0] = m_monoBackground;
-		((CARD32 *)paletteBuf)[1] = m_monoForeground;
-
-		if (m_usePixelFormat24) {
-			Pack24(paletteBuf, 2);
-			paletteLen = 6;
-		} else
-			paletteLen = 8;
-
-		memcpy(&m_hdrBuffer[m_hdrBufferBytes], paletteBuf, paletteLen);
-		m_hdrBufferBytes += paletteLen;
-		break;
-
-	case 16:
-		EncodeMonoRect16((CARD8 *)m_buffer, w, h);
-
-		((CARD16 *)paletteBuf)[0] = (CARD16)m_monoBackground;
-		((CARD16 *)paletteBuf)[1] = (CARD16)m_monoForeground;
-
-		memcpy(&m_hdrBuffer[m_hdrBufferBytes], paletteBuf, 4);
-		m_hdrBufferBytes += 4;
-		break;
-
-	default:
-		EncodeMonoRect8((CARD8 *)m_buffer, w, h);
-
-		m_hdrBuffer[m_hdrBufferBytes++] = (BYTE)m_monoBackground;
-		m_hdrBuffer[m_hdrBufferBytes++] = (BYTE)m_monoForeground;
-	}
-
-	return CompressData(dest, streamId, dataLen,
-						m_conf[m_compresslevel].monoZlibLevel,
-						Z_DEFAULT_STRATEGY);
-}
-
-int
-vncEncodeTight::SendIndexedRect(BYTE *dest, int w, int h)
-{
-	const int streamId = 2;
-	int i, entryLen;
-	CARD8 paletteBuf[256*4];
-
-	// Prepare tight encoding header.
-	m_hdrBuffer[m_hdrBufferBytes++] = (streamId | rfbTightExplicitFilter) << 4;
-	m_hdrBuffer[m_hdrBufferBytes++] = rfbTightFilterPalette;
-	m_hdrBuffer[m_hdrBufferBytes++] = (BYTE)(m_paletteNumColors - 1);
-
-	// Prepare palette, convert image.
-	switch (m_remoteformat.bitsPerPixel) {
-	case 32:
-		EncodeIndexedRect32((CARD8 *)m_buffer, w * h);
-
-		for (i = 0; i < m_paletteNumColors; i++) {
-			((CARD32 *)paletteBuf)[i] =
-				m_palette.entry[i].listNode->rgb;
-		}
-		if (m_usePixelFormat24) {
-			Pack24(paletteBuf, m_paletteNumColors);
-			entryLen = 3;
-		} else
-			entryLen = 4;
-
-		memcpy(&m_hdrBuffer[m_hdrBufferBytes], paletteBuf,
-			   m_paletteNumColors * entryLen);
-		m_hdrBufferBytes += m_paletteNumColors * entryLen;
-		break;
-
-	case 16:
-		EncodeIndexedRect16((CARD8 *)m_buffer, w * h);
-
-		for (i = 0; i < m_paletteNumColors; i++) {
-			((CARD16 *)paletteBuf)[i] =
-				(CARD16)m_palette.entry[i].listNode->rgb;
-		}
-
-		memcpy(&m_hdrBuffer[m_hdrBufferBytes], paletteBuf,
-			   m_paletteNumColors * 2);
-		m_hdrBufferBytes += m_paletteNumColors * 2;
-		break;
-
-	default:
-		return -1;				// Should never happen.
-	}
-
-	return CompressData(dest, streamId, w * h,
-						m_conf[m_compresslevel].idxZlibLevel,
-						Z_DEFAULT_STRATEGY);
-}
-
-int
-vncEncodeTight::SendFullColorRect(BYTE *dest, int w, int h)
-{
-	const int streamId = 0;
-	int len;
-
-	m_hdrBuffer[m_hdrBufferBytes++] = 0x00;
-
-	if (m_usePixelFormat24) {
-		Pack24(m_buffer, w * h);
-		len = 3;
-	} else
-		len = m_remoteformat.bitsPerPixel / 8;
-
-	return CompressData(dest, streamId, w * h * len,
-						m_conf[m_compresslevel].rawZlibLevel,
-						Z_DEFAULT_STRATEGY);
-}
-
-int
-vncEncodeTight::SendGradientRect(BYTE *dest, int w, int h)
-{
-	const int streamId = 3;
-	int len;
-
-	if (m_remoteformat.bitsPerPixel == 8)
-		return SendFullColorRect(dest, w, h);
-
-	if (m_prevRowBuf == NULL)
-		m_prevRowBuf = new int [2048*3];
-
-	m_hdrBuffer[m_hdrBufferBytes++] = (streamId | rfbTightExplicitFilter) << 4;
-	m_hdrBuffer[m_hdrBufferBytes++] = rfbTightFilterGradient;
-
-	if (m_usePixelFormat24) {
-		FilterGradient24(m_buffer, w, h);
-		len = 3;
-	} else if (m_remoteformat.bitsPerPixel == 32) {
-		FilterGradient32((CARD32 *)m_buffer, w, h);
-		len = 4;
-	} else {
-		FilterGradient16((CARD16 *)m_buffer, w, h);
-		len = 2;
-	}
-
-	return CompressData(dest, streamId, w * h * len,
-						m_conf[m_compresslevel].gradientZlibLevel,
-						Z_FILTERED);
-}
-
-int
-vncEncodeTight::CompressData(BYTE *dest, int streamId, int dataLen,
-							 int zlibLevel, int zlibStrategy)
-{
-	if (dataLen < TIGHT_MIN_TO_COMPRESS) {
-		memcpy(dest, m_buffer, dataLen);
-		return dataLen;
-	}
-
-	z_streamp pz = &m_zsStruct[streamId];
-
-	// Initialize compression stream if needed.
-	if (!m_zsActive[streamId]) {
-		pz->zalloc = Z_NULL;
-		pz->zfree = Z_NULL;
-		pz->opaque = Z_NULL;
-
-		vnclog.Print(LL_INTINFO,
-					 VNCLOG("calling deflateInit2 with zlib level:%d\n"),
-					 zlibLevel);
-		int err = deflateInit2 (pz, zlibLevel, Z_DEFLATED, MAX_WBITS,
-								MAX_MEM_LEVEL, zlibStrategy);
-		if (err != Z_OK) {
-			vnclog.Print(LL_INTINFO,
-						 VNCLOG("deflateInit2 returned error:%d:%s\n"),
-						 err, pz->msg);
-			return -1;
-		}
-
-		m_zsActive[streamId] = true;
-		m_zsLevel[streamId] = zlibLevel;
-	}
-
-	int outBufferSize = dataLen + dataLen / 100 + 16;
-
-	// Prepare buffer pointers.
-	pz->next_in = (Bytef *)m_buffer;
-	pz->avail_in = dataLen;
-	pz->next_out = (Bytef *)dest;
-	pz->avail_out = outBufferSize;
-
-	// Change compression parameters if needed.
-	if (zlibLevel != m_zsLevel[streamId]) {
-		vnclog.Print(LL_INTINFO,
-					 VNCLOG("calling deflateParams with zlib level:%d\n"),
-					 zlibLevel);
-		int err = deflateParams (pz, zlibLevel, zlibStrategy);
-		if (err != Z_OK) {
-			vnclog.Print(LL_INTINFO,
-						 VNCLOG("deflateParams returned error:%d:%s\n"),
-						 err, pz->msg);
-			return -1;
-		}
-		m_zsLevel[streamId] = zlibLevel;
-	}
-
-	// Actual compression.
-	if ( deflate (pz, Z_SYNC_FLUSH) != Z_OK ||
-		 pz->avail_in != 0 || pz->avail_out == 0 ) {
-		vnclog.Print(LL_INTINFO, VNCLOG("deflate() call failed.\n"));
-		return -1;
-	}
-
-	return SendCompressedData(outBufferSize - pz->avail_out);
-}
-
-int
-vncEncodeTight::SendCompressedData(int compressedLen)
-{
-	// Prepare compressed data size for sending.
-	m_hdrBuffer[m_hdrBufferBytes++] = compressedLen & 0x7F;
-	if (compressedLen > 0x7F) {
-		m_hdrBuffer[m_hdrBufferBytes-1] |= 0x80;
-		m_hdrBuffer[m_hdrBufferBytes++] = compressedLen >> 7 & 0x7F;
-		if (compressedLen > 0x3FFF) {
-			m_hdrBuffer[m_hdrBufferBytes-1] |= 0x80;
-			m_hdrBuffer[m_hdrBufferBytes++] = compressedLen >> 14 & 0xFF;
-		}
-	}
-	return compressedLen;
-}
-
-void
-vncEncodeTight::FillPalette8(int count)
-{
-	CARD8 *data = (CARD8 *)m_buffer;
-	CARD8 c0, c1;
-	int i, n0, n1;
-
-	m_paletteNumColors = 0;
-
-	c0 = data[0];
-	for (i = 1; i < count && data[i] == c0; i++);
-	if (i == count) {
-		m_paletteNumColors = 1;
-		return; 				// Solid rectangle
-	}
-
-	if (m_paletteMaxColors < 2)
-		return;
-
-	n0 = i;
-	c1 = data[i];
-	n1 = 0;
-	for (i++; i < count; i++) {
-		if (data[i] == c0) {
-			n0++;
-		} else if (data[i] == c1) {
-			n1++;
-		} else
-			break;
-	}
-	if (i == count) {
-		if (n0 > n1) {
-			m_monoBackground = (CARD32)c0;
-			m_monoForeground = (CARD32)c1;
-		} else {
-			m_monoBackground = (CARD32)c1;
-			m_monoForeground = (CARD32)c0;
-		}
-		m_paletteNumColors = 2;   // Two colors
-	}
-}
-
-#define DEFINE_FILL_PALETTE_FUNCTION(bpp)									  \
-																			  \
-void																		  \
-vncEncodeTight::FillPalette##bpp(int count) 								  \
-{																			  \
-	CARD##bpp *data = (CARD##bpp *)m_buffer;								  \
-	CARD##bpp c0, c1, ci;													  \
-	int i, n0, n1, ni;														  \
-																			  \
-	c0 = data[0];															  \
-	for (i = 1; i < count && data[i] == c0; i++);							  \
-	if (i >= count) {														  \
-		m_paletteNumColors = 1; /* Solid rectangle */						  \
-		return; 															  \
-	}																		  \
-																			  \
-	if (m_paletteMaxColors < 2) {											  \
-		m_paletteNumColors = 0; /* Full-color format preferred */			  \
-		return; 															  \
-	}																		  \
-																			  \
-	n0 = i; 																  \
-	c1 = data[i];															  \
-	n1 = 0; 																  \
-	for (i++; i < count; i++) { 											  \
-		ci = data[i];														  \
-		if (ci == c0) { 													  \
-			n0++;															  \
-		} else if (ci == c1) {												  \
-			n1++;															  \
-		} else																  \
-			break;															  \
-	}																		  \
-	if (i >= count) {														  \
-		if (n0 > n1) {														  \
-			m_monoBackground = (CARD32)c0;									  \
-			m_monoForeground = (CARD32)c1;									  \
-		} else {															  \
-			m_monoBackground = (CARD32)c1;									  \
-			m_monoForeground = (CARD32)c0;									  \
-		}																	  \
-		m_paletteNumColors = 2; /* Two colors */							  \
-		return; 															  \
-	}																		  \
-																			  \
-	PaletteReset(); 														  \
-	PaletteInsert (c0, (CARD32)n0, bpp);									  \
-	PaletteInsert (c1, (CARD32)n1, bpp);									  \
-																			  \
-	ni = 1; 																  \
-	for (i++; i < count; i++) { 											  \
-		if (data[i] == ci) {												  \
-			ni++;															  \
-		} else {															  \
-			if (!PaletteInsert (ci, (CARD32)ni, bpp))						  \
-				return; 													  \
-			ci = data[i];													  \
-			ni = 1; 														  \
-		}																	  \
-	}																		  \
-	PaletteInsert (ci, (CARD32)ni, bpp);									  \
-}
-
-DEFINE_FILL_PALETTE_FUNCTION(16)
-DEFINE_FILL_PALETTE_FUNCTION(32)
-
-
-//
-// Functions to operate with palette structures.
-//
-
-#define HASH_FUNC16(rgb) ((int)(((rgb >> 8) + rgb) & 0xFF))
-#define HASH_FUNC32(rgb) ((int)(((rgb >> 16) + (rgb >> 8)) & 0xFF))
-
-void
-vncEncodeTight::PaletteReset(void)
-{
-	m_paletteNumColors = 0;
-	memset(m_palette.hash, 0, 256 * sizeof(COLOR_LIST *));
-}
-
-int
-vncEncodeTight::PaletteInsert(CARD32 rgb, int numPixels, int bpp)
-{
-	COLOR_LIST *pnode;
-	COLOR_LIST *prev_pnode = NULL;
-	int hash_key, idx, new_idx, count;
-
-	hash_key = (bpp == 16) ? HASH_FUNC16(rgb) : HASH_FUNC32(rgb);
-
-	pnode = m_palette.hash[hash_key];
-
-	while (pnode != NULL) {
-		if (pnode->rgb == rgb) {
-			// Such palette entry already exists.
-			new_idx = idx = pnode->idx;
-			count = m_palette.entry[idx].numPixels + numPixels;
-			if (new_idx && m_palette.entry[new_idx-1].numPixels < count) {
-				do {
-					m_palette.entry[new_idx] = m_palette.entry[new_idx-1];
-					m_palette.entry[new_idx].listNode->idx = new_idx;
-					new_idx--;
-				}
-				while (new_idx &&
-					   m_palette.entry[new_idx-1].numPixels < count);
-				m_palette.entry[new_idx].listNode = pnode;
-				pnode->idx = new_idx;
-			}
-			m_palette.entry[new_idx].numPixels = count;
-			return m_paletteNumColors;
-		}
-		prev_pnode = pnode;
-		pnode = pnode->next;
-	}
-
-	// Check if palette is full.
-	if ( m_paletteNumColors == 256 ||
-		 m_paletteNumColors == m_paletteMaxColors ) {
-		m_paletteNumColors = 0;
-		return 0;
-	}
-
-	// Move palette entries with lesser pixel counts.
-	for ( idx = m_paletteNumColors;
-		  idx > 0 && m_palette.entry[idx-1].numPixels < numPixels;
-		  idx-- ) {
-		m_palette.entry[idx] = m_palette.entry[idx-1];
-		m_palette.entry[idx].listNode->idx = idx;
-	}
-
-	// Add new palette entry into the freed slot.
-	pnode = &m_palette.list[m_paletteNumColors];
-	if (prev_pnode != NULL) {
-		prev_pnode->next = pnode;
-	} else {
-		m_palette.hash[hash_key] = pnode;
-	}
-	pnode->next = NULL;
-	pnode->idx = idx;
-	pnode->rgb = rgb;
-	m_palette.entry[idx].listNode = pnode;
-	m_palette.entry[idx].numPixels = numPixels;
-
-	return (++m_paletteNumColors);
-}
-
-
-//
-// Converting 32-bit color samples into 24-bit colors.
-// Should be called only when redMax, greenMax and blueMax are 255.
-// Color components assumed to be byte-aligned.
-//
-
-void
-vncEncodeTight::Pack24(BYTE *buf, int count)
-{
-	CARD32 *buf32;
-	CARD32 pix;
-	int r_shift, g_shift, b_shift;
-
-	buf32 = (CARD32 *)buf;
-
-	if (!m_localformat.bigEndian == !m_remoteformat.bigEndian) {
-		r_shift = m_remoteformat.redShift;
-		g_shift = m_remoteformat.greenShift;
-		b_shift = m_remoteformat.blueShift;
-	} else {
-		r_shift = 24 - m_remoteformat.redShift;
-		g_shift = 24 - m_remoteformat.greenShift;
-		b_shift = 24 - m_remoteformat.blueShift;
-	}
-
-	while (count--) {
-		pix = *buf32++;
-		*buf++ = (char)(pix >> r_shift);
-		*buf++ = (char)(pix >> g_shift);
-		*buf++ = (char)(pix >> b_shift);
-	}
-}
-
-
-//
-// Converting truecolor samples into palette indices.
-//
-
-#define DEFINE_IDX_ENCODE_FUNCTION(bpp) 									  \
-																			  \
-void																		  \
-vncEncodeTight::EncodeIndexedRect##bpp(BYTE *buf, int count)				  \
-{																			  \
-	COLOR_LIST *pnode;														  \
-	CARD##bpp *src; 														  \
-	CARD##bpp rgb;															  \
-	int rep = 0;															  \
-																			  \
-	src = (CARD##bpp *) buf;												  \
-																			  \
-	while (count--) {														  \
-		rgb = *src++;														  \
-		while (count && *src == rgb) {										  \
-			rep++, src++, count--;											  \
-		}																	  \
-		pnode = m_palette.hash[HASH_FUNC##bpp(rgb)];						  \
-		while (pnode != NULL) { 											  \
-			if ((CARD##bpp)pnode->rgb == rgb) { 							  \
-				*buf++ = (CARD8)pnode->idx; 								  \
-				while (rep) {												  \
-					*buf++ = (CARD8)pnode->idx; 							  \
-					rep--;													  \
-				}															  \
-				break;														  \
-			}																  \
-			pnode = pnode->next;											  \
-		}																	  \
-	}																		  \
-}
-
-DEFINE_IDX_ENCODE_FUNCTION(16)
-DEFINE_IDX_ENCODE_FUNCTION(32)
-
-#define DEFINE_MONO_ENCODE_FUNCTION(bpp)									  \
-																			  \
-void																		  \
-vncEncodeTight::EncodeMonoRect##bpp(BYTE *buf, int w, int h)				  \
-{																			  \
-	CARD##bpp *ptr; 														  \
-	CARD##bpp bg;															  \
-	unsigned int value, mask;												  \
-	int aligned_width;														  \
-	int x, y, bg_bits;														  \
-																			  \
-	ptr = (CARD##bpp *) buf;												  \
-	bg = (CARD##bpp) m_monoBackground;										  \
-	aligned_width = w - w % 8;												  \
-																			  \
-	for (y = 0; y < h; y++) {												  \
-		for (x = 0; x < aligned_width; x += 8) {							  \
-			for (bg_bits = 0; bg_bits < 8; bg_bits++) { 					  \
-				if (*ptr++ != bg)											  \
-					break;													  \
-			}																  \
-			if (bg_bits == 8) { 											  \
-				*buf++ = 0; 												  \
-				continue;													  \
-			}																  \
-			mask = 0x80 >> bg_bits; 										  \
-			value = mask;													  \
-			for (bg_bits++; bg_bits < 8; bg_bits++) {						  \
-				mask >>= 1; 												  \
-				if (*ptr++ != bg) { 										  \
-					value |= mask;											  \
-				}															  \
-			}																  \
-			*buf++ = (CARD8)value;											  \
-		}																	  \
-																			  \
-		mask = 0x80;														  \
-		value = 0;															  \
-		if (x >= w) 														  \
-			continue;														  \
-																			  \
-		for (; x < w; x++) {												  \
-			if (*ptr++ != bg) { 											  \
-				value |= mask;												  \
-			}																  \
-			mask >>= 1; 													  \
-		}																	  \
-		*buf++ = (CARD8)value;												  \
-	}																		  \
-}
-
-DEFINE_MONO_ENCODE_FUNCTION(8)
-DEFINE_MONO_ENCODE_FUNCTION(16)
-DEFINE_MONO_ENCODE_FUNCTION(32)
-
-
-//
-// ``Gradient'' filter for 24-bit color samples.
-// Should be called only when redMax, greenMax and blueMax are 255.
-// Color components assumed to be byte-aligned.
-//
-
-void
-vncEncodeTight::FilterGradient24(BYTE *buf, int w, int h)
-{
-	CARD32 *buf32;
-	CARD32 pix32;
-	int *prevRowPtr;
-	int shiftBits[3];
-	int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3];
-	int prediction;
-	int x, y, c;
-
-	buf32 = (CARD32 *)buf;
-	memset (m_prevRowBuf, 0, w * 3 * sizeof(int));
-
-	if (!m_localformat.bigEndian == !m_remoteformat.bigEndian) {
-		shiftBits[0] = m_remoteformat.redShift;
-		shiftBits[1] = m_remoteformat.greenShift;
-		shiftBits[2] = m_remoteformat.blueShift;
-	} else {
-		shiftBits[0] = 24 - m_remoteformat.redShift;
-		shiftBits[1] = 24 - m_remoteformat.greenShift;
-		shiftBits[2] = 24 - m_remoteformat.blueShift;
-	}
-
-	for (y = 0; y < h; y++) {
-		for (c = 0; c < 3; c++) {
-			pixUpper[c] = 0;
-			pixHere[c] = 0;
-		}
-		prevRowPtr = m_prevRowBuf;
-		for (x = 0; x < w; x++) {
-			pix32 = *buf32++;
-			for (c = 0; c < 3; c++) {
-				pixUpperLeft[c] = pixUpper[c];
-				pixLeft[c] = pixHere[c];
-				pixUpper[c] = *prevRowPtr;
-				pixHere[c] = (int)(pix32 >> shiftBits[c] & 0xFF);
-				*prevRowPtr++ = pixHere[c];
-
-				prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c];
-				if (prediction < 0) {
-					prediction = 0;
-				} else if (prediction > 0xFF) {
-					prediction = 0xFF;
-				}
-				*buf++ = (BYTE)(pixHere[c] - prediction);
-			}
-		}
-	}
-}
-
-
-//
-// ``Gradient'' filter for other color depths.
-//
-
-#define DEFINE_GRADIENT_FILTER_FUNCTION(bpp)								  \
-																			  \
-void																		  \
-vncEncodeTight::FilterGradient##bpp(CARD##bpp *buf, int w, int h)			  \
-{																			  \
-	CARD##bpp pix, diff;													  \
-	bool endianMismatch;													  \
-	int *prevRowPtr;														  \
-	int maxColor[3], shiftBits[3];											  \
-	int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3];				  \
-	int prediction; 														  \
-	int x, y, c;															  \
-																			  \
-	memset (m_prevRowBuf, 0, w * 3 * sizeof(int));							  \
-																			  \
-	endianMismatch = (!m_localformat.bigEndian != !m_remoteformat.bigEndian); \
-																			  \
-	maxColor[0] = m_remoteformat.redMax;									  \
-	maxColor[1] = m_remoteformat.greenMax;									  \
-	maxColor[2] = m_remoteformat.blueMax;									  \
-	shiftBits[0] = m_remoteformat.redShift; 								  \
-	shiftBits[1] = m_remoteformat.greenShift;								  \
-	shiftBits[2] = m_remoteformat.blueShift;								  \
-																			  \
-	for (y = 0; y < h; y++) {												  \
-		for (c = 0; c < 3; c++) {											  \
-			pixUpper[c] = 0;												  \
-			pixHere[c] = 0; 												  \
-		}																	  \
-		prevRowPtr = m_prevRowBuf;											  \
-		for (x = 0; x < w; x++) {											  \
-			pix = *buf; 													  \
-			if (endianMismatch) {											  \
-				pix = Swap##bpp(pix);										  \
-			}																  \
-			diff = 0;														  \
-			for (c = 0; c < 3; c++) {										  \
-				pixUpperLeft[c] = pixUpper[c];								  \
-				pixLeft[c] = pixHere[c];									  \
-				pixUpper[c] = *prevRowPtr;									  \
-				pixHere[c] = (int)(pix >> shiftBits[c] & maxColor[c]);		  \
-				*prevRowPtr++ = pixHere[c]; 								  \
-																			  \
-				prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c];	  \
-				if (prediction < 0) {										  \
-					prediction = 0; 										  \
-				} else if (prediction > maxColor[c]) {						  \
-					prediction = maxColor[c];								  \
-				}															  \
-				diff |= ((pixHere[c] - prediction) & maxColor[c])			  \
-					<< shiftBits[c];										  \
-			}																  \
-			if (endianMismatch) {											  \
-				diff = Swap##bpp(diff); 									  \
-			}																  \
-			*buf++ = diff;													  \
-		}																	  \
-	}																		  \
-}
-
-DEFINE_GRADIENT_FILTER_FUNCTION(16)
-DEFINE_GRADIENT_FILTER_FUNCTION(32)
-
-
-//
-// Code to guess if given rectangle is suitable for smooth image
-// compression (by applying "gradient" filter or JPEG coder).
-//
-
-#define JPEG_MIN_RECT_SIZE	4096
-
-#define DETECT_SUBROW_WIDTH   7
-#define DETECT_MIN_WIDTH	  8
-#define DETECT_MIN_HEIGHT	  8
-
-int
-vncEncodeTight::DetectSmoothImage (int w, int h)
-{
-	if ( m_localformat.bitsPerPixel == 8 || m_remoteformat.bitsPerPixel == 8 ||
-		 w < DETECT_MIN_WIDTH || h < DETECT_MIN_HEIGHT ) {
-		return 0;
-	}
-
-	if (m_qualitylevel != -1) {
-		if (w * h < JPEG_MIN_RECT_SIZE) {
-			return 0;
-		}
-	} else {
-		if (w * h < m_conf[m_compresslevel].gradientMinRectSize) {
-			return 0;
-		}
-	}
-
-	unsigned long avgError;
-	if (m_remoteformat.bitsPerPixel == 32) {
-		if (m_usePixelFormat24) {
-			avgError = DetectSmoothImage24(w, h);
-			if (m_qualitylevel != -1) {
-				return (avgError < m_conf[m_qualitylevel].jpegThreshold24);
-			}
-			return (avgError < m_conf[m_compresslevel].gradientThreshold24);
-		} else {
-			avgError = DetectSmoothImage32(w, h);
-		}
-	} else {
-		avgError = DetectSmoothImage16(w, h);
-	}
-	if (m_qualitylevel != -1) {
-		return (avgError < m_conf[m_qualitylevel].jpegThreshold);
-	}
-	return (avgError < m_conf[m_compresslevel].gradientThreshold);
-}
-
-unsigned long
-vncEncodeTight::DetectSmoothImage24 (int w, int h)
-{
-	int diffStat[256];
-	int pixelCount = 0;
-	int pix, left[3];
-	unsigned long avgError;
-
-	// If client is big-endian, color samples begin from the second
-	// byte (offset 1) of a 32-bit pixel value.
-	int off = (m_remoteformat.bigEndian != 0);
-
-	memset(diffStat, 0, 256*sizeof(int));
-
-	int y = 0, x = 0;
-	int d, dx, c;
-	while (y < h && x < w) {
-		for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) {
-			for (c = 0; c < 3; c++) {
-				left[c] = (int)m_buffer[((y+d)*w+x+d)*4+off+c] & 0xFF;
-			}
-			for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) {
-				for (c = 0; c < 3; c++) {
-					pix = (int)m_buffer[((y+d)*w+x+d+dx)*4+off+c] & 0xFF;
-					diffStat[abs(pix - left[c])]++;
-					left[c] = pix;
-				}
-				pixelCount++;
-			}
-		}
-		if (w > h) {
-			x += h;
-			y = 0;
-		} else {
-			x = 0;
-			y += w;
-		}
-	}
-
-	if (diffStat[0] * 33 / pixelCount >= 95)
-		return 0;
-
-	avgError = 0;
-	for (c = 1; c < 8; c++) {
-		avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c);
-		if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2)
-			return 0;
-	}
-	for (; c < 256; c++) {
-		avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c);
-	}
-	avgError /= (pixelCount * 3 - diffStat[0]);
-
-	return avgError;
-}
-
-#define DEFINE_DETECT_FUNCTION(bpp) 										  \
-																			  \
-unsigned long																  \
-vncEncodeTight::DetectSmoothImage##bpp (int w, int h)						  \
-{																			  \
-	bool endianMismatch;													  \
-	CARD##bpp pix;															  \
-	int maxColor[3], shiftBits[3];											  \
-	int x, y, d, dx, c; 													  \
-	int diffStat[256];														  \
-	int pixelCount = 0; 													  \
-	int sample, sum, left[3];												  \
-	unsigned long avgError; 												  \
-																			  \
-	endianMismatch = (!m_localformat.bigEndian != !m_remoteformat.bigEndian); \
-																			  \
-	maxColor[0] = m_remoteformat.redMax;									  \
-	maxColor[1] = m_remoteformat.greenMax;									  \
-	maxColor[2] = m_remoteformat.blueMax;									  \
-	shiftBits[0] = m_remoteformat.redShift; 								  \
-	shiftBits[1] = m_remoteformat.greenShift;								  \
-	shiftBits[2] = m_remoteformat.blueShift;								  \
-																			  \
-	memset(diffStat, 0, 256*sizeof(int));									  \
-																			  \
-	y = 0, x = 0;															  \
-	while (y < h && x < w) {												  \
-		for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) {	  \
-			pix = ((CARD##bpp *)m_buffer)[(y+d)*w+x+d]; 					  \
-			if (endianMismatch) {											  \
-				pix = Swap##bpp(pix);										  \
-			}																  \
-			for (c = 0; c < 3; c++) {										  \
-				left[c] = (int)(pix >> shiftBits[c] & maxColor[c]); 		  \
-			}																  \
-			for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) { 				  \
-				pix = ((CARD##bpp *)m_buffer)[(y+d)*w+x+d+dx];				  \
-				if (endianMismatch) {										  \
-					pix = Swap##bpp(pix);									  \
-				}															  \
-				sum = 0;													  \
-				for (c = 0; c < 3; c++) {									  \
-					sample = (int)(pix >> shiftBits[c] & maxColor[c]);		  \
-					sum += abs(sample - left[c]);							  \
-					left[c] = sample;										  \
-				}															  \
-				if (sum > 255)												  \
-					sum = 255;												  \
-				diffStat[sum]++;											  \
-				pixelCount++;												  \
-			}																  \
-		}																	  \
-		if (w > h) {														  \
-			x += h; 														  \
-			y = 0;															  \
-		} else {															  \
-			x = 0;															  \
-			y += w; 														  \
-		}																	  \
-	}																		  \
-																			  \
-	if ((diffStat[0] + diffStat[1]) * 100 / pixelCount >= 90)				  \
-		return 0;															  \
-																			  \
-	avgError = 0;															  \
-	for (c = 1; c < 8; c++) {												  \
-		avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c);	  \
-		if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2)			  \
-			return 0;														  \
-	}																		  \
-	for (; c < 256; c++) {													  \
-		avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c);	  \
-	}																		  \
-	avgError /= (pixelCount - diffStat[0]); 								  \
-																			  \
-	return avgError;														  \
-}
-
-DEFINE_DETECT_FUNCTION(16)
-DEFINE_DETECT_FUNCTION(32)
-
-//
-// JPEG compression stuff.
-//
-
-static bool jpegError;
-static int jpegDstDataLen;
-
-static void JpegSetDstManager(j_compress_ptr cinfo, JOCTET *buf, size_t buflen);
-
-int
-vncEncodeTight::SendJpegRect(BYTE *dst, int w, int h, int quality)
-{
-	struct jpeg_compress_struct cinfo;
-	struct jpeg_error_mgr jerr;
-
-	if (m_localformat.bitsPerPixel == 8)
-		return SendFullColorRect(dst, w, h);
-
-	BYTE *srcBuf = new BYTE[w * 3];
-	JSAMPROW rowPointer[1];
-	rowPointer[0] = (JSAMPROW)srcBuf;
-
-	cinfo.err = jpeg_std_error(&jerr);
-	jpeg_create_compress(&cinfo);
-
-	cinfo.image_width = w;
-	cinfo.image_height = h;
-	cinfo.input_components = 3;
-	cinfo.in_color_space = JCS_RGB;
-
-	jpeg_set_defaults(&cinfo);
-	jpeg_set_quality(&cinfo, quality, TRUE);
-
-	JpegSetDstManager (&cinfo, (JOCTET*)dst, w * h * (m_localformat.bitsPerPixel / 8));
-
-	jpeg_start_compress(&cinfo, TRUE);
-
-	for (int dy = 0; dy < h; dy++) {
-		PrepareRowForJpeg(srcBuf, dy, w);
-		jpeg_write_scanlines(&cinfo, rowPointer, 1);
-		if (jpegError)
-			break;
-	}
-
-	if (!jpegError)
-		jpeg_finish_compress(&cinfo);
-
-	jpeg_destroy_compress(&cinfo);
-	delete[] srcBuf;
-
-	if (jpegError)
-		return SendFullColorRect(dst, w, h);
-
-	m_hdrBuffer[m_hdrBufferBytes++] = rfbTightJpeg << 4;
-
-	return SendCompressedData(jpegDstDataLen);
-}
-
-void
-vncEncodeTight::PrepareRowForJpeg(BYTE *dst, int y, int w)
-{
-	if (m_remoteformat.bitsPerPixel == 32) {
-		CARD32 *src = (CARD32 *)&m_buffer[y * w * sizeof(CARD32)];
-		if (m_usePixelFormat24) {
-			PrepareRowForJpeg24(dst, src, w);
-		} else {
-			PrepareRowForJpeg32(dst, src, w);
-		}
-	} else {
-		// 16 bpp assumed.
-		CARD16 *src = (CARD16 *)&m_buffer[y * w * sizeof(CARD16)];
-		PrepareRowForJpeg16(dst, src, w);
-	}
-}
-
-void
-vncEncodeTight::PrepareRowForJpeg24(BYTE *dst, CARD32 *src, int count)
-{
-	int r_shift, g_shift, b_shift;
-	if (!m_localformat.bigEndian == !m_remoteformat.bigEndian) {
-		r_shift = m_remoteformat.redShift;
-		g_shift = m_remoteformat.greenShift;
-		b_shift = m_remoteformat.blueShift;
-	} else {
-		r_shift = 24 - m_remoteformat.redShift;
-		g_shift = 24 - m_remoteformat.greenShift;
-		b_shift = 24 - m_remoteformat.blueShift;
-	}
-
-	CARD32 pix;
-	while (count--) {
-		pix = *src++;
-		*dst++ = (BYTE)(pix >> r_shift);
-		*dst++ = (BYTE)(pix >> g_shift);
-		*dst++ = (BYTE)(pix >> b_shift);
-	}
-}
-
-#define DEFINE_JPEG_GET_ROW_FUNCTION(bpp)									\
-																			\
-void																		\
-vncEncodeTight::PrepareRowForJpeg##bpp(BYTE *dst, CARD##bpp *src, int count)\
-{																			\
-	bool endianMismatch =													\
-		(!m_localformat.bigEndian != !m_remoteformat.bigEndian);			\
-																			\
-	int r_shift = m_remoteformat.redShift;									\
-	int g_shift = m_remoteformat.greenShift;								\
-	int b_shift = m_remoteformat.blueShift; 								\
-	int r_max = m_remoteformat.redMax;										\
-	int g_max = m_remoteformat.greenMax;									\
-	int b_max = m_remoteformat.blueMax; 									\
-																			\
-	CARD##bpp pix;															\
-	while (count--) {														\
-		pix = *src++;														\
-		if (endianMismatch) {												\
-			pix = Swap##bpp(pix);											\
-		}																	\
-		*dst++ = (BYTE)((pix >> r_shift & r_max) * 255 / r_max);			\
-		*dst++ = (BYTE)((pix >> g_shift & g_max) * 255 / g_max);			\
-		*dst++ = (BYTE)((pix >> b_shift & b_max) * 255 / b_max);			\
-	}																		\
-}
-
-DEFINE_JPEG_GET_ROW_FUNCTION(16)
-DEFINE_JPEG_GET_ROW_FUNCTION(32)
-
-/*
- * Destination manager implementation for JPEG library.
- */
-
-static struct jpeg_destination_mgr jpegDstManager;
-static JOCTET *jpegDstBuffer;
-static size_t jpegDstBufferLen;
-
-static void JpegInitDestination(j_compress_ptr cinfo);
-static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo);
-static void JpegTermDestination(j_compress_ptr cinfo);
-
-static void
-JpegInitDestination(j_compress_ptr cinfo)
-{
-	jpegError = false;
-	jpegDstManager.next_output_byte = jpegDstBuffer;
-	jpegDstManager.free_in_buffer = jpegDstBufferLen;
-}
-
-static boolean
-JpegEmptyOutputBuffer(j_compress_ptr cinfo)
-{
-	jpegError = true;
-	jpegDstManager.next_output_byte = jpegDstBuffer;
-	jpegDstManager.free_in_buffer = jpegDstBufferLen;
-
-	return TRUE;
-}
-
-static void
-JpegTermDestination(j_compress_ptr cinfo)
-{
-	jpegDstDataLen = jpegDstBufferLen - jpegDstManager.free_in_buffer;
-}
-
-static void
-JpegSetDstManager(j_compress_ptr cinfo, JOCTET *buf, size_t buflen)
-{
-	jpegDstBuffer = buf;
-	jpegDstBufferLen = buflen;
-	jpegDstManager.init_destination = JpegInitDestination;
-	jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer;
-	jpegDstManager.term_destination = JpegTermDestination;
-	cinfo->dest = &jpegDstManager;
-}
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeTight.h b/ica/win32/winvnc/winvnc/vncEncodeTight.h
deleted file mode 100644
index ea8b901..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeTight.h
+++ /dev/null
@@ -1,199 +0,0 @@
-//  Copyright (C) 2000 Constantin Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeTight object
-
-class vncEncodeTight;
-
-#if !defined(_WINVNC_ENCODETIGHT)
-#define _WINVNC_ENCODETIGHT
-#pragma once
-
-#include "vncencoder.h"
-
-#ifdef IPP
-#include "..\..\ipp_zlib\src\zlib\zlib.h"
-#else
-#include "zlib.h"
-#endif
-extern "C"
-{
-#ifdef IPP
-#include "libjpeg/jpeglib.h"
-#else
-#include "libjpeg-turbo-win/jpeglib.h"
-#endif
-}
-#include <math.h>
-
-// Minimum amount of data to be compressed. This value should not be
-// changed, doing so will break compatibility with existing clients.
-#define TIGHT_MIN_TO_COMPRESS 12
-
-// The parameters below may be adjusted.
-#define MIN_SPLIT_RECT_SIZE     4096
-#define MIN_SOLID_SUBRECT_SIZE  2048
-#define MAX_SPLIT_TILE_SIZE       16
-
-// C-style structures to store palette entries and compression paramentes.
-// Such code probably should be converted into C++ classes.
-
-struct COLOR_LIST {
-	COLOR_LIST *next;
-	int idx;
-	CARD32 rgb;
-};
-
-struct PALETTE_ENTRY {
-	COLOR_LIST *listNode;
-	int numPixels;
-};
-
-struct PALETTE {
-	PALETTE_ENTRY entry[256];
-	COLOR_LIST *hash[256];
-	COLOR_LIST list[256];
-};
-
-struct TIGHT_CONF {
-	int maxRectSize, maxRectWidth;
-	int monoMinRectSize, gradientMinRectSize;
-	int idxZlibLevel, monoZlibLevel, rawZlibLevel, gradientZlibLevel;
-	unsigned long gradientThreshold, gradientThreshold24;
-	int idxMaxColorsDivisor;
-	int jpegQuality;
-	unsigned long jpegThreshold, jpegThreshold24;
-};
-
-
-// Class definition
-
-class vncEncodeTight : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeTight();
-	~vncEncodeTight();
-
-	virtual void Init();
-	virtual const char* GetEncodingName() { return "Tight"; }
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(RECT &rect);
-
-	virtual UINT EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect);
-
-// Implementation
-protected:
-	int m_paletteNumColors, m_paletteMaxColors;
-	CARD32 m_monoBackground, m_monoForeground;
-	PALETTE m_palette;
-
-	z_stream m_zsStruct[4];
-	bool m_zsActive[4];
-	int m_zsLevel[4];
-
-	BYTE *m_hdrBuffer;
-	int m_hdrBufferBytes;
-	BYTE *m_buffer;
-	int m_bufflen;
-	int *m_prevRowBuf;
-
-	bool m_usePixelFormat24;
-
-	static const TIGHT_CONF m_conf[10];
-
-	// Protected member functions.
-
-	void FindBestSolidArea(BYTE *source, int x, int y, int w, int h,
-						   CARD32 colorValue, int *w_ptr, int *h_ptr);
-	void ExtendSolidArea  (BYTE *source, int x, int y, int w, int h,
-						   CARD32 colorValue,
-						   int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr);
-	bool CheckSolidTile   (BYTE *source, int x, int y, int w, int h,
-						   CARD32 *colorPtr, bool needSameColor);
-	bool CheckSolidTile8  (BYTE *source, int x, int y, int w, int h,
-						   CARD32 *colorPtr, bool needSameColor);
-	bool CheckSolidTile16 (BYTE *source, int x, int y, int w, int h,
-						   CARD32 *colorPtr, bool needSameColor);
-	bool CheckSolidTile32 (BYTE *source, int x, int y, int w, int h,
-						   CARD32 *colorPtr, bool needSameColor);
-
-	UINT EncodeRectSimple (BYTE *source, VSocket *outConn, BYTE *dest,
-						   const RECT &rect);
-	UINT EncodeSubrect    (BYTE *source, VSocket *outConn, BYTE *dest,
-						   int x, int y, int w, int h);
-	void SendTightHeader  (int x, int y, int w, int h);
-
-	int SendSolidRect     (BYTE *dest);
-	int SendMonoRect      (BYTE *dest, int w, int h);
-	int SendIndexedRect   (BYTE *dest, int w, int h);
-	int SendFullColorRect (BYTE *dest, int w, int h);
-	int SendGradientRect  (BYTE *dest, int w, int h);
-	int CompressData      (BYTE *dest, int streamId, int dataLen,
-						   int zlibLevel, int zlibStrategy);
-	int SendCompressedData(int compressedLen);
-
-	void FillPalette8 (int count);
-	void FillPalette16(int count);
-	void FillPalette32(int count);
-
-	void PaletteReset(void);
-	int PaletteInsert(CARD32 rgb, int numPixels, int bpp);
-
-	void Pack24(BYTE *buf, int count);
-
-	void EncodeIndexedRect16(BYTE *buf, int count);
-	void EncodeIndexedRect32(BYTE *buf, int count);
-
-	void EncodeMonoRect8 (BYTE *buf, int w, int h);
-	void EncodeMonoRect16(BYTE *buf, int w, int h);
-	void EncodeMonoRect32(BYTE *buf, int w, int h);
-
-	void FilterGradient24(BYTE *buf, int w, int h);
-	void FilterGradient16(CARD16 *buf, int w, int h);
-	void FilterGradient32(CARD32 *buf, int w, int h);
-
-	int DetectSmoothImage (int w, int h);
-	unsigned long DetectSmoothImage24 (int w, int h);
-	unsigned long DetectSmoothImage16 (int w, int h);
-	unsigned long DetectSmoothImage32 (int w, int h);
-
-	int SendJpegRect(BYTE *dst, int w, int h, int quality);
-	void PrepareRowForJpeg(BYTE *dst, int y, int w);
-	void PrepareRowForJpeg24(BYTE *dst, CARD32 *src, int count);
-	void PrepareRowForJpeg16(BYTE *dst, CARD16 *src, int count);
-	void PrepareRowForJpeg32(BYTE *dst, CARD32 *src, int count);
-};
-
-#endif // _WINVNC_ENCODETIGHT
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeUltra.cpp b/ica/win32/winvnc/winvnc/vncEncodeUltra.cpp
deleted file mode 100644
index b292458..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeUltra.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeUltra
-
-// This file implements the vncEncoder-derived vncEncodeUltra class.
-// This class overrides some vncEncoder functions to produce a bitmap
-// to Ultra encoder.  Ultra is much more efficient than RAW format on
-// most screen data and usually twice as efficient as hextile.  Of
-// course, Ultra compression uses more CPU time on the server.
-// However, over slower (64kbps or less) connections, the reduction
-// in data transmitted usually outweighs the extra latency added
-// while the server CPU performs the compression algorithms.
-
-#include "vncEncodeUltra.h"
-
-#define IN_LEN		(128*1024)
-#define OUT_LEN		(IN_LEN + IN_LEN / 64 + 16 + 3)
-#define HEAP_ALLOC(var,size) \
-	lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
-static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS);
-
-vncEncodeUltra::vncEncodeUltra()
-{
-	m_buffer = NULL;
-	m_Queuebuffer = NULL;
-	m_QueueCompressedbuffer = NULL;
-	m_bufflen = 0;
-	m_Queuelen = 0;
-	MaxQueuebufflen=128*1024;
-
-	m_Queuebuffer = new BYTE [MaxQueuebufflen+1];
-		if (m_Queuebuffer == NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Memory error"));
-		}
-	m_QueueCompressedbuffer = new BYTE [MaxQueuebufflen+(MaxQueuebufflen/100)+8];
-		if (m_Queuebuffer == NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Memory error"));
-		}
-	lzo=false;
-}
-
-vncEncodeUltra::~vncEncodeUltra()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-	}
-
-	if (m_Queuebuffer != NULL)
-	{
-		delete [] m_Queuebuffer;
-		m_Queuebuffer = NULL;
-	}
-
-	if (m_QueueCompressedbuffer != NULL)
-	{
-		delete [] m_QueueCompressedbuffer;
-		m_QueueCompressedbuffer = NULL;
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("Ultra  encoder stats: rawdata=%d  protocol=%d compressed=%d transmitted=%d\n"),dataSize, rectangleOverhead, encodedSize,transmittedSize);
-
-	if (dataSize != 0) {
-		vnclog.Print(LL_INTINFO, VNCLOG("Ultra  encoder efficiency: %.3f%%\n"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize));
-	}
-}
-
-void
-vncEncodeUltra::Init()
-{
-	totalraw=0;
-	encodedSize=0;
-	rectangleOverhead=0;
-	transmittedSize=0;
-	dataSize=0;
-	vncEncoder::Init();
-	m_nNbRects=0;
-	m_queueEnable = true; // sf at 2003
-}
-
-UINT
-vncEncodeUltra::RequiredBuffSize(UINT width, UINT height)
-{
-	int result;
-
-	// The Ultra library specifies a maximum compressed size of
-	// the raw size plus one percent plus 8 bytes.  We also need
-	// to cover the Ultra header space.
-	result = vncEncoder::RequiredBuffSize(width, height);
-	result += result/ 64 + 16 + 3 + sz_rfbZlibHeader+sz_rfbFramebufferUpdateRectHeader;
-	return result;
-}
-
-UINT
-vncEncodeUltra::NumCodedRects(const rfb::Rect &rect)
-{
-	return 0;
-	const int rectW = rect.br.x - rect.tl.x;
-	const int rectH = rect.br.y - rect.tl.y;
-	return (( rectH - 1 ) / ( Ultra_MAX_SIZE( rectW ) / rectW ) + 1 );
-}
-
-/*****************************************************************************
- *
- * Routines to implement Ultra Encoding (LZ+Huffman compression) by calling
- * the included Ultra library.
- */
-
-// Encode the rectangle using Ultra compression
-inline UINT
-vncEncodeUltra::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const rfb::Rect &rect)
-{
-	
-	int  totalSize = 0;
-	int  partialSize = 0;
-	int  maxLines;
-	int  linesRemaining;
-	RECT partialRect;
-	const int rectW = rect.br.x - rect.tl.x;
-	const int rectH = rect.br.y - rect.tl.y;
-
-	partialRect.right = rect.br.x;
-	partialRect.left = rect.tl.x;
-	partialRect.top = rect.tl.y;
-	partialRect.bottom = rect.br.y;
-
-	/* WBB: For testing purposes only! */
-	// vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d\n"), rect.right, rect.left, rect.top, rect.bottom);
-
-	if (rectW==0) return 0;
-	if (rectH==0) return 0;
-	maxLines = ( Ultra_MAX_SIZE(rectW) / rectW );
-	linesRemaining = rectH;
-
-	while ( linesRemaining > 0 ) {
-
-		int linesToComp;
-
-		if ( maxLines < linesRemaining )
-			linesToComp = maxLines;
-		else
-			linesToComp = linesRemaining;
-
-		partialRect.bottom = partialRect.top + linesToComp;
-
-		/* WBB: For testing purposes only! */
-		// vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d\n"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom);
-
-		partialSize = EncodeOneRect( source,dest, partialRect,outConn );
-		totalSize += partialSize;
-
-		linesRemaining -= linesToComp;
-		partialRect.top += linesToComp;
-
-		if (( linesRemaining > 0 ) &&
-			( partialSize > 0 ))
-		{
-			// Send the encoded data
-			outConn->SendExactQueue( (char *)dest, partialSize );
-			transmittedSize += partialSize;
-		}
-
-
-	}
-	transmittedSize += partialSize;
-
-	return partialSize;
-
-}
-
-// Encode the rectangle using zlib compression
-inline UINT
-vncEncodeUltra::EncodeOneRect(BYTE *source, BYTE *dest, const RECT &rect,VSocket *outConn)
-{
-	const int rectW = rect.right - rect.left;
-	const int rectH = rect.bottom - rect.top;
-	const int rawDataSize = (rectW*rectH*m_remoteformat.bitsPerPixel / 8);
-
-	if (!outConn->m_pIntegratedPluginInterface) m_queueEnable=false;
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	// Modif rdv at 2002 - v1.1.x - Application Resize
-	surh->r.x = (CARD16) rect.left-m_SWOffsetx;
-	surh->r.y = (CARD16) rect.top-m_SWOffsety;
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingUltra);
-
-	dataSize += ( rectW * rectH * m_remoteformat.bitsPerPixel) / 8;
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	
-	// create a space big enough for the Zlib encoded pixels
-	if (m_bufflen < rawDataSize)
-	{
-		if (m_buffer != NULL)
-		{
-			delete [] m_buffer;
-			m_buffer = NULL;
-		}
-		m_buffer = new BYTE [rawDataSize+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-		m_bufflen = rawDataSize;
-	}
-	// Translate the data into our new buffer
-	Translate(source, m_buffer, rect);
-
-	// Perhaps we can queue the small updates and compress them combined
-	if (rawDataSize < VNC_ENCODE_ULTRA_MIN_COMP_SIZE)
-	{
-		if (m_queueEnable)
-			{
-				surh->encoding = Swap32IfLE(rfbEncodingRaw);
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,rawDataSize);
-				AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +rawDataSize,outConn,0);
-				return 0;
-			}
-		else return vncEncoder::EncodeRect(source, dest, rect);
-	}
-
-	
-	if (rawDataSize<1000 && m_queueEnable)
-		{
-			surh->encoding = Swap32IfLE(rfbEncodingRaw);
-			memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,rawDataSize);
-			AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +rawDataSize,outConn,1);
-			return 0;
-		}
-
-	surh->encoding = Swap32IfLE(rfbEncodingUltra);
-				
-	if (lzo==false)
-		{
-			if (lzo_init() == LZO_E_OK) lzo=true;
-		}
-	lzo1x_1_compress(m_buffer,rawDataSize,dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader,&out_len,wrkmem);
-	if (out_len > (lzo_uint)rawDataSize)
-				{
-					return vncEncoder::EncodeRect(source, dest, rect);
-				}
-	
-		// Format the ZlibHeader
-		rfbZlibHeader *zlibh=(rfbZlibHeader *)(dest+sz_rfbFramebufferUpdateRectHeader);
-		zlibh->nBytes = Swap32IfLE(out_len);
-	
-		// Update statistics
-		encodedSize += sz_rfbZlibHeader + out_len;
-		rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-
-		// Return the amount of data sent	
-		return sz_rfbFramebufferUpdateRectHeader +
-			sz_rfbZlibHeader +
-			out_len;
-
-}
-
-
-
-void
-vncEncodeUltra::AddToQueu(BYTE *source,int sizerect,VSocket *outConn,int updatetype)
-{
-	if (m_Queuelen+sizerect>(MaxQueuebufflen)) SendUltrarects(outConn);
-	memcpy(m_Queuebuffer+m_Queuelen,source,sizerect);
-	m_Queuelen+=sizerect;
-	m_nNbRects++;
-	if (updatetype==1) must_be_zipped=true;
-	if (m_nNbRects>0) SendUltrarects(outConn);
-}
-
-void
-vncEncodeUltra::AddToQueu2(BYTE *source,int sizerect,VSocket *outConn,int updatetype)
-{
-	BYTE *databegin=m_QueueCompressedbuffer+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader;
-	rfbFramebufferUpdateRectHeader *CacheRectsHeader=(rfbFramebufferUpdateRectHeader*)m_QueueCompressedbuffer;
-	rfbZlibHeader *CacheZipHeader=(rfbZlibHeader*)m_QueueCompressedbuffer+sz_rfbFramebufferUpdateRectHeader;
-	const lzo_uint rawDataSize = (sizerect);
-	lzo1x_1_compress(source,rawDataSize,databegin,&out_len,wrkmem);
-
-	if (out_len>rawDataSize)
-				{
-					outConn->SendExactQueue( (char *)source, sizerect); // 1 Small update
-					encodedSize += sizerect-sz_rfbFramebufferUpdateRectHeader;
-					rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-					return;
-				}
-
-	int rawDataSize1=rawDataSize/65535;
-	int rawDataSize2=rawDataSize%65535;
-
-	CacheRectsHeader->r.x = (CARD16)(1);
-	CacheRectsHeader->r.y = (CARD16)(rawDataSize2);
-	CacheRectsHeader->r.w = (CARD16)(rawDataSize1);
-	CacheRectsHeader->r.x = Swap16IfLE(CacheRectsHeader->r.x);
-	CacheRectsHeader->r.y = Swap16IfLE(CacheRectsHeader->r.y);
-	CacheRectsHeader->r.w = Swap16IfLE(CacheRectsHeader->r.w);
- 	CacheRectsHeader->r.h = 0;
-	CacheRectsHeader->encoding = Swap32IfLE(rfbEncodingUltraZip);
-
-	// Format the UltraHeader
-	CacheZipHeader->nBytes = Swap32IfLE(out_len);
-
-	vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),out_len,rawDataSize,1);
-	outConn->SendExactQueue((char *)m_QueueCompressedbuffer, out_len+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader);
-	// Update statistics
-	encodedSize += sz_rfbZlibHeader + out_len;
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	transmittedSize += out_len+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader;
-}
-
-void
-vncEncodeUltra::SendUltrarects(VSocket *outConn)
-{
-	int NRects=m_nNbRects;
-	const lzo_uint rawDataSize = (m_Queuelen);
-
-	if (NRects==0) return; // NO update
-	if (m_nNbRects<3 && !must_be_zipped) 
-	{
-		outConn->SendExactQueue( (char *)m_Queuebuffer, m_Queuelen); // 1 Small update
-		m_nNbRects=0;
-		m_Queuelen=0;
-		encodedSize += m_Queuelen-sz_rfbFramebufferUpdateRectHeader;
-		rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-		return;
-	}
-	m_nNbRects=0;
-	m_Queuelen=0;
-	must_be_zipped=false;
-
-	lzo1x_1_compress(m_Queuebuffer,rawDataSize,m_QueueCompressedbuffer,&out_len,wrkmem);
-
-	if (out_len>rawDataSize)
-				{
-					outConn->SendExactQueue( (char *)m_Queuebuffer, m_Queuelen); // 1 Small update
-					m_nNbRects=0;
-					m_Queuelen=0;
-					encodedSize += m_Queuelen-sz_rfbFramebufferUpdateRectHeader;
-					rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-					return;
-				}
-
-	int rawDataSize1=rawDataSize/65535;
-	int rawDataSize2=rawDataSize%65535;
-
-	rfbFramebufferUpdateRectHeader CacheRectsHeader;
-	CacheRectsHeader.r.x = (CARD16)(NRects);
-	CacheRectsHeader.r.y = (CARD16)(rawDataSize2);
-	CacheRectsHeader.r.w = (CARD16)(rawDataSize1);
-	CacheRectsHeader.r.x = Swap16IfLE(CacheRectsHeader.r.x);
-	CacheRectsHeader.r.y = Swap16IfLE(CacheRectsHeader.r.y);
-	CacheRectsHeader.r.w = Swap16IfLE(CacheRectsHeader.r.w);
- 	CacheRectsHeader.r.h = 0;
-	CacheRectsHeader.encoding = Swap32IfLE(rfbEncodingUltraZip);
-
-	// Format the UltraHeader
-	rfbZlibHeader CacheZipHeader;
-	CacheZipHeader.nBytes = Swap32IfLE(out_len);
-
-	vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),out_len,rawDataSize,NRects);
-	outConn->SendExactQueue((char *)&CacheRectsHeader, sizeof(CacheRectsHeader));
-	outConn->SendExactQueue((char *)&CacheZipHeader, sizeof(CacheZipHeader));
-	outConn->SendExactQueue((char *)m_QueueCompressedbuffer, out_len);
-	// Update statistics
-	encodedSize += sz_rfbZlibHeader + out_len;
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	transmittedSize += out_len+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader;
-}
-
-void
-vncEncodeUltra::LastRect(VSocket *outConn)
-{
-	SendUltrarects(outConn);
-}
diff --git a/ica/win32/winvnc/winvnc/vncEncodeUltra.h b/ica/win32/winvnc/winvnc/vncEncodeUltra.h
deleted file mode 100644
index 6e0d1de..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeUltra.h
+++ /dev/null
@@ -1,107 +0,0 @@
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeUltra object
-
-// The vncEncodeUltra object uses a Ultra based compression encoding to send rectangles
-// to a client
-
-class vncEncodeUltra;
-
-#if !defined(_WINVNC_EncodeULTRA)
-#define _WINVNC_EncodeULTRA
-#pragma once
-
-#include "vncencoder.h"
-#include "lzo/minilzo.h"
-
-// Minimum Ultra rectangle size in bytes.  Anything smaller will
-// not compress well due to overhead.
-#define VNC_ENCODE_ULTRA_MIN_COMP_SIZE (32)
-
-// Set maximum Ultra rectangle size in pixels.  Always allow at least
-// two scan lines.
-#define Ultra_MAX_RECT_SIZE (16*1024)
-#define Ultra_MAX_SIZE(min) ((( min * 2 ) > Ultra_MAX_RECT_SIZE ) ? ( min * 2 ) : Ultra_MAX_RECT_SIZE )
-#define SOLID_COLOR	0 // 1 color
-#define MONO_COLOR	1 //2 colors
-#define MULTI_COLOR	2 // >2 colors
-#define PURE_Ultra	3 
-#define	XOR_SEQUENCE 4 //XOR previous image
-
-
-// Class definition
-
-class vncEncodeUltra : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeUltra();
-	~vncEncodeUltra();
-
-	virtual void Init();
-	virtual const char* GetEncodingName() { return "Ultra"; }
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source,VSocket *outConn, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeOneRect(BYTE *source ,BYTE *dest, const RECT &rect,VSocket *outConn);
-
-	virtual void LastRect(VSocket *outConn);
-	virtual void AddToQueu(BYTE *source,int size,VSocket *outConn,int must_be_zipped);
-	virtual void AddToQueu2(BYTE *source,int size,VSocket *outConn,int must_be_zipped);
-	virtual void SendUltrarects(VSocket *outConn);
-
-	void EnableQueuing(BOOL fEnable){ m_queueEnable = fEnable; };
-
-// Implementation
-protected:
-	BYTE		      *m_buffer;
-	BYTE			  *m_Queuebuffer;
-	BYTE			  *m_QueueCompressedbuffer;
-	int			       m_bufflen;
-	int totalraw;
-	int SoMoMu; //solid/mono/multi color
-
-	int				   m_Queuebufflen;
-	int				   MaxQueuebufflen;
-	int				   m_Queuelen;
-	int				   m_nNbRects;
-	int				   must_be_zipped;
-	BOOL				m_queueEnable;
-
-	bool				lzo;
-	lzo_uint out_len;
-};
-
-#endif // _WINVNC_EncodeUltra
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeUltra2.cpp b/ica/win32/winvnc/winvnc/vncEncodeUltra2.cpp
deleted file mode 100644
index 01c19df..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeUltra2.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeUltra2
-
-// This file implements the vncEncoder-derived vncEncodeUltra2 class.
-// This class overrides some vncEncoder functions to produce a bitmap
-// to Ultra encoder.  Ultra is much more efficient than RAW format on
-// most screen data and usually twice as efficient as hextile.  Of
-// course, Ultra compression uses more CPU time on the server.
-// However, over slower (64kbps or less) connections, the reduction
-// in data transmitted usually outweighs the extra latency added
-// while the server CPU performs the compression algorithms.
-
-#include "vncEncodeUltra2.h"
-#include <mmsystem.h>
-
-struct jpeg_destination_mgr jpegDstManager;
-static JOCTET *jpegDstBuffer;
-static size_t jpegDstBufferLen;
-static void JpegInitDestination(j_compress_ptr cinfo);
-static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo);
-static void JpegTermDestination(j_compress_ptr cinfo);
-static void JpegSetDstManager(j_compress_ptr cinfo, JOCTET *buf, size_t buflen);
-static bool jpegError;
-static int jpegDstDataLen;
-
-#define IN_LEN		(128*1024)
-#define OUT_LEN		(IN_LEN + IN_LEN / 64 + 16 + 3)
-#define HEAP_ALLOC(var,size) \
-	lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
-static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS);
-
-
-vncEncodeUltra2::vncEncodeUltra2()
-{
-	m_buffer = NULL;
-	m_bufflen = 0;
-	destbuffer=NULL;
-}
-
-vncEncodeUltra2::~vncEncodeUltra2()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-	}
-	if (destbuffer!=0) free (destbuffer);
-}
-
-void
-vncEncodeUltra2::Init()
-{
-	encodedSize=0;
-	rectangleOverhead=0;
-	transmittedSize=0;
-	dataSize=0;
-	vncEncoder::Init();
-}
-
-UINT
-vncEncodeUltra2::RequiredBuffSize(UINT width, UINT height)
-{
-	int result;
-
-	// The Ultra library specifies a maximum compressed size of
-	// the raw size plus one percent plus 8 bytes.  We also need
-	// to cover the Ultra header space.
-	result = vncEncoder::RequiredBuffSize(width, height);
-	result += result/ 64 + 16 + 3 + sz_rfbZlibHeader+sz_rfbFramebufferUpdateRectHeader+ sz_rfbZlibHeader;
-	return result;
-}
-
-
-UINT
-vncEncodeUltra2::NumCodedRects(const rfb::Rect &rect)
-{
-	return 0;
-}
-
-/*****************************************************************************
- *
- * Routines to implement Ultra Encoding (LZ+Huffman compression) by calling
- * the included Ultra library.
- */
-
-// Encode the rectangle using Ultra compression
-// Encode the rectangle using Ultra compression
-inline UINT
-vncEncodeUltra2::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const rfb::Rect &rect2)
-{
-
-	int  Size = 0;
-	rfb::Rect rect;
-	rect.br.x=rect2.br.x;
-	rect.br.y=rect2.br.y;
-	rect.tl.x=rect2.tl.x;
-	rect.tl.y=rect2.tl.y;
-	while(((rect.br.x-rect.tl.x))/8*8!=(rect.br.x-rect.tl.x))
-		{
-		
-			if (rect.br.x+1<=framebufferWidth) rect.br.x+=1;
-			else if (rect.tl.x-1>=0) rect.tl.x-=1;
-			
-		}
-		while(((rect.br.y-rect.tl.y))/8*8!=(rect.br.y-rect.tl.y))
-		{
-		
-			if (rect.br.y+1<=framebufferHeight) rect.br.y+=1;
-			else if (rect.tl.y-1>=0) rect.tl.y-=1;
-			
-		}
-
-	const int rectW = rect.br.x - rect.tl.x;
-	const int rectH = rect.br.y - rect.tl.y;
-	const int rawDataSize = (rectW*rectH*m_remoteformat.bitsPerPixel / 8);
-
-	if (rectW==0) return 0;
-	if (rectH==0) return 0;
-
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	// Modif rdv at 2002 - v1.1.x - Application Resize
-	surh->r.x = (CARD16) rect.tl.x-m_SWOffsetx;
-	surh->r.y = (CARD16) rect.tl.y-m_SWOffsety;
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingUltra2);
-
-	// create a space big enough for the Zlib encoded pixels
-	if (m_bufflen < rawDataSize)
-	{
-		if (m_buffer != NULL)
-		{
-			delete [] m_buffer;
-			m_buffer = NULL;
-		}
-		m_buffer = new BYTE [rawDataSize+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-		m_bufflen = rawDataSize;
-	}
-	// Translate the data into our new buffer
-	Translate(source, m_buffer, rect);
-	rfbZlibHeader *zlibh=(rfbZlibHeader *)(dest+sz_rfbFramebufferUpdateRectHeader);
-
-	if ((rectW*rectH)<1024)
-	{
-		
-		if (rawDataSize < 64)
-		{
-			return vncEncoder::EncodeRect(source, dest, rect);
-		}
-				
-		if (lzo==false)
-		{
-			if (lzo_init() == LZO_E_OK) lzo=true;
-		}
-		lzo1x_1_compress(m_buffer,rawDataSize,dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader,&out_len,wrkmem);
-		if (out_len > (lzo_uint)rawDataSize)
-				{
-					return vncEncoder::EncodeRect(source, dest, rect);
-				}
-		surh->encoding = Swap32IfLE(rfbEncodingUltra);
-		zlibh->nBytes = Swap32IfLE(out_len);
-		Size=out_len;
-	}
-	else
-	{
-		Size=SendJpegRect(m_buffer,dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader, rawDataSize, rectW , rectH , m_qualitylevel*10,m_remoteformat);		
-		zlibh->nBytes = Swap32IfLE(Size);
-	}
-	transmittedSize += sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader+ Size;
-	return sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader+ Size;
-}
-
-int
-vncEncodeUltra2::SendJpegRect(BYTE *src,BYTE *dst, int dst_size, int w, int h, int quality,rfbPixelFormat m_remoteformat)
-{
-
-  struct jpeg_compress_struct cinfo;
-  struct jpeg_error_mgr jerr;
-
-  cinfo.err = jpeg_std_error(&jerr);
-  jpeg_create_compress(&cinfo);
-  BYTE *srcBuf=NULL;
-
-  cinfo.image_width = w;
-  cinfo.image_height = h;
-  cinfo.in_color_space = JCS_RGB;
-  cinfo.input_components = 3;
-
-#ifdef JCS_EXTENSIONS
-  // Try to have libjpeg read directly from our native format
-  if(m_remoteformat.bitsPerPixel==32) {
-    int redShift, greenShift, blueShift;
-
-    if(m_remoteformat.bigEndian) {
-      redShift = 24 - m_remoteformat.redShift;
-      greenShift = 24 - m_remoteformat.greenShift;
-      blueShift = 24 - m_remoteformat.blueShift;
-    } else {
-      redShift = m_remoteformat.redShift;
-      greenShift = m_remoteformat.greenShift;
-      blueShift = m_remoteformat.blueShift;
-    }
-
-    if(redShift == 0 && greenShift == 8 && blueShift == 16)
-      cinfo.in_color_space = JCS_EXT_RGBX;
-    if(redShift == 16 && greenShift == 8 && blueShift == 0)
-      cinfo.in_color_space = JCS_EXT_BGRX;
-    if(redShift == 24 && greenShift == 16 && blueShift == 8)
-      cinfo.in_color_space = JCS_EXT_XBGR;
-    if(redShift == 8 && greenShift == 16 && blueShift == 24)
-      cinfo.in_color_space = JCS_EXT_XRGB;
-
-    if (cinfo.in_color_space != JCS_RGB) {
-      srcBuf = src;
-      cinfo.input_components = 4;
-    }
-  }
-#endif
-
-  jpeg_set_defaults(&cinfo);
-  jpeg_set_quality(&cinfo, quality, TRUE);
-  if(quality >= 96) cinfo.dct_method = JDCT_ISLOW;
-  else cinfo.dct_method = JDCT_FASTEST;
-
-   cinfo.comp_info[0].h_samp_factor = 2;
-   cinfo.comp_info[0].v_samp_factor = 2;
-
-  JpegSetDstManager(&cinfo, dst, dst_size);
-
-  JSAMPROW *rowPointer = new JSAMPROW[h];
-  for (int dy = 0; dy < h; dy++)
-    rowPointer[dy] = (JSAMPROW)(&srcBuf[dy * w * 4]);
-
-  jpeg_start_compress(&cinfo, TRUE);
-  while (cinfo.next_scanline < cinfo.image_height)
-  {
-    jpeg_write_scanlines(&cinfo, &rowPointer[cinfo.next_scanline],
-      cinfo.image_height - cinfo.next_scanline);
-	if (jpegError)
-			break;
-  }
-
-  if (!jpegError)
-		jpeg_finish_compress(&cinfo);
-  jpeg_destroy_compress(&cinfo);
-
-  delete[] rowPointer;
-  if (jpegError) return 0;
-  return jpegDstDataLen;
-}
-
-
-void
-JpegInitDestination(j_compress_ptr cinfo)
-{
-	jpegError = false;
-	jpegDstManager.next_output_byte = jpegDstBuffer;
-	jpegDstManager.free_in_buffer = jpegDstBufferLen;
-}
-
-boolean
-JpegEmptyOutputBuffer(j_compress_ptr cinfo)
-{
-	jpegError = true;
-	jpegDstManager.next_output_byte = jpegDstBuffer;
-	jpegDstManager.free_in_buffer = jpegDstBufferLen;
-
-	return TRUE;
-}
-
-void
-JpegTermDestination(j_compress_ptr cinfo)
-{
-	jpegDstDataLen = jpegDstBufferLen - jpegDstManager.free_in_buffer;
-}
-
-void
-JpegSetDstManager(j_compress_ptr cinfo, JOCTET *buf, size_t buflen)
-{
-	jpegDstBuffer = buf;
-	jpegDstBufferLen = buflen;
-	jpegDstManager.init_destination = JpegInitDestination;
-	jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer;
-	jpegDstManager.term_destination = JpegTermDestination;
-	cinfo->dest = &jpegDstManager;
-}
diff --git a/ica/win32/winvnc/winvnc/vncEncodeUltra2.h b/ica/win32/winvnc/winvnc/vncEncodeUltra2.h
deleted file mode 100644
index a052666..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeUltra2.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeUltra2 object
-
-// The vncEncodeUltra2 object uses a Ultra based compression encoding to send rectangles
-// to a client
-
-class vncEncodeUltra2;
-
-#if !defined(_WINVNC_EncodeULTRA2)
-#define _WINVNC_EncodeULTRA2
-#pragma once
-#include "vncencoder.h"
-#include "lzo/minilzo.h"
-#include "libjpeg-turbo-win/jpeglib.h"
-
-// Class definition
-
-class vncEncodeUltra2 : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeUltra2();
-	~vncEncodeUltra2();
-
-	virtual void Init();
-	virtual const char* GetEncodingName() { return "Ultra"; }
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source,VSocket *outConn, BYTE *dest, const rfb::Rect &rect);
-
-// Implementation
-public:
-	BYTE		      *m_buffer;
-	int			       m_bufflen;
-	int SendJpegRect(BYTE *src,BYTE *dst, int dst_size, int w, int h, int quality,rfbPixelFormat m_remoteformat);
-	bool				lzo;
-	lzo_uint out_len;
-	unsigned char *destbuffer;
-};
-
-#endif // _WINVNC_EncodeUltra
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeZlib.cpp b/ica/win32/winvnc/winvnc/vncEncodeZlib.cpp
deleted file mode 100644
index 794f92f..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeZlib.cpp
+++ /dev/null
@@ -1,683 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeZlib
-
-// This file implements the vncEncoder-derived vncEncodeZlib class.
-// This class overrides some vncEncoder functions to produce a bitmap
-// to Zlib encoder.  Zlib is much more efficient than RAW format on
-// most screen data and usually twice as efficient as hextile.  Of
-// course, zlib compression uses more CPU time on the server.
-// However, over slower (64kbps or less) connections, the reduction
-// in data transmitted usually outweighs the extra latency added
-// while the server CPU performs the compression algorithms.
-
-#include "vncEncodeZlib.h"
-
-vncEncodeZlib::vncEncodeZlib()
-{
-	m_buffer = NULL;
-	m_buffer2 = NULL;
-	m_Queuebuffer = NULL;
-	m_QueueCompressedbuffer = NULL;
-	m_bufflen = 0;
-	m_Queuelen = 0;
-	m_Maskbuffer =NULL;
-	m_MaskbufferSize =0;
-	compStreamInited = false;
-	MaxQueuebufflen=128*1024;
-	m_Queuebuffer = new BYTE [MaxQueuebufflen+1];
-		if (m_Queuebuffer == NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Memory error"));
-		}
-	m_QueueCompressedbuffer = new BYTE [MaxQueuebufflen+(MaxQueuebufflen/100)+8];
-		if (m_Queuebuffer == NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Memory error"));
-		}
-}
-
-vncEncodeZlib::~vncEncodeZlib()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-	}
-
-	if (m_buffer2 != NULL)
-	{
-		delete [] m_buffer2;
-		m_buffer2 = NULL;
-	}
-
-	if (m_Queuebuffer != NULL)
-	{
-		delete [] m_Queuebuffer;
-		m_Queuebuffer = NULL;
-	}
-
-	if (m_QueueCompressedbuffer != NULL)
-	{
-		delete [] m_QueueCompressedbuffer;
-		m_QueueCompressedbuffer = NULL;
-	}
-
-	if (m_Maskbuffer !=NULL)
-	{
-		delete [] m_Maskbuffer;
-		m_Maskbuffer = NULL;
-
-	}
-
-	if ( compStreamInited == true )
-	{
-		deflateEnd( &compStream );
-	}
-	compStreamInited = false;
-
-	vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder stats: rawdata=%d  protocol=%d compressed=%d transmitted=%d\n"),dataSize, rectangleOverhead, encodedSize,transmittedSize);
-
-	if (dataSize != 0) {
-		vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder efficiency: %.3f%%\n"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize));
-	}
-}
-
-void
-vncEncodeZlib::Init()
-{
-	totalraw=0;
-	encodedSize=0;
-	rectangleOverhead=0;
-	transmittedSize=0;
-	dataSize=0;
-	vncEncoder::Init();
-	m_nNbRects=0;
-}
-
-UINT
-vncEncodeZlib::RequiredBuffSize(UINT width, UINT height)
-{
-	int result;
-
-	// The zlib library specifies a maximum compressed size of
-	// the raw size plus one percent plus 8 bytes.  We also need
-	// to cover the zlib header space.
-	result = vncEncoder::RequiredBuffSize(width, height);
-	Firstrun=result*2;//Needed to exclude xor when cachebuffer is empty
-	result += ((result / 100) + 8) + sz_rfbZlibHeader;
-	return result;
-}
-
-UINT
-vncEncodeZlib::NumCodedRects(const rfb::Rect &rect)
-{
-	const int rectW = rect.br.x - rect.tl.x;
-	const int rectH = rect.br.y - rect.tl.y;
-	int aantal=(( rectH - 1 ) / ( ZLIB_MAX_SIZE( rectW ) / rectW ) + 1 );
-	m_queueEnable=false;
-	if (m_use_lastrect && aantal>1) {
-		m_queueEnable=true;
-		return 0;
-	}
-/******************************************************************
-	return 1;
-******************************************************************/
-
-	// Return the number of rectangles needed to encode the given
-	// update.  ( ZLIB_MAX_SIZE(rectW) / rectW ) is the number of lines in 
-	// each maximum size rectangle.
-	// When solid is enabled, most of the pixels are removed
-	return (( rectH - 1 ) / ( ZLIB_MAX_SIZE( rectW ) / rectW ) + 1 );
-}
-
-/*****************************************************************************
- *
- * Routines to implement zlib Encoding (LZ+Huffman compression) by calling
- * the included zlib library.
- */
-
-// Encode the rectangle using zlib compression
-inline UINT
-vncEncodeZlib::EncodeRect(BYTE *source,BYTE *source2, VSocket *outConn, BYTE *dest, const rfb::Rect &rect)
-{
-	int  totalSize = 0;
-	int  partialSize = 0;
-	int  maxLines;
-	int  linesRemaining;
-	RECT partialRect;
-
-	const int rectW = rect.br.x - rect.tl.x;
-	const int rectH = rect.br.y - rect.tl.y;
-
-	partialRect.right = rect.br.x;
-	partialRect.left = rect.tl.x;
-	partialRect.top = rect.tl.y;
-	partialRect.bottom = rect.br.y;
-
-	/* WBB: For testing purposes only! */
-	// vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d\n"), rect.right, rect.left, rect.top, rect.bottom);
-
-	maxLines = ( ZLIB_MAX_SIZE(rectW) / rectW );
-	linesRemaining = rectH;
-
-	while ( linesRemaining > 0 ) {
-
-		int linesToComp;
-
-		if ( maxLines < linesRemaining )
-			linesToComp = maxLines;
-		else
-			linesToComp = linesRemaining;
-
-		partialRect.bottom = partialRect.top + linesToComp;
-
-		/* WBB: For testing purposes only! */
-		// vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d\n"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom);
-
-		partialSize = EncodeOneRect( source,source2, dest, partialRect,outConn );
-		totalSize += partialSize;
-
-		linesRemaining -= linesToComp;
-		partialRect.top += linesToComp;
-
-		if (( linesRemaining > 0 ) &&
-			( partialSize > 0 ))
-		{
-			// Send the encoded data
-			outConn->SendExactQueue( (char *)dest, partialSize );
-			transmittedSize += partialSize;
-		}
-
-
-	}
-	transmittedSize += partialSize;
-
-	return partialSize;
-
-}
-
-// Encode the rectangle using zlib compression
-inline UINT
-vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT &rect,VSocket *outConn)
-{
-	int totalCompDataLen = 0;
-	int previousTotalOut;
-	int deflateResult;
-
-	const int rectW = rect.right - rect.left;
-	const int rectH = rect.bottom - rect.top;
-	const int rawDataSize = (rectW*rectH*m_remoteformat.bitsPerPixel / 8);
-	const int maxCompSize = (rawDataSize + (rawDataSize/100) + 8);
-
-	if (!outConn->m_pIntegratedPluginInterface) m_queueEnable=false;
-
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	// Modif rdv at 2002 - v1.1.x - Application Resize
-	surh->r.x = (CARD16) rect.left-m_SWOffsetx;
-	surh->r.y = (CARD16) rect.top-m_SWOffsety;
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingZlib);
-
-	dataSize += ( rectW * rectH * m_remoteformat.bitsPerPixel) / 8;
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	
-	// create a space big enough for the Zlib encoded pixels
-	if (m_bufflen < rawDataSize)
-	{
-		if (m_buffer != NULL)
-		{
-			delete [] m_buffer;
-			m_buffer = NULL;
-		}
-		m_buffer = new BYTE [rawDataSize+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-		m_bufflen = rawDataSize;
-		if (m_buffer2 != NULL)
-		{
-			delete [] m_buffer2;
-			m_buffer2 = NULL;
-		}
-		m_buffer2 = new BYTE [rawDataSize+1];
-	}
-	// Translate the data into our new buffer
-	compStream.avail_in = rawDataSize;
-	Translate(source, m_buffer, rect);
-	// Perhaps we can queue the small updates and compress them combined
-	if (rawDataSize < VNC_ENCODE_ZLIB_MIN_COMP_SIZE)
-	{
-		if (m_queueEnable && source2 && dataSize>Firstrun)
-			{
-				surh->encoding = Swap32IfLE(rfbEncodingRaw);
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,rawDataSize);
-				AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +rawDataSize,outConn,0);
-				return 0;
-			}
-		else return vncEncoder::EncodeRect(source, dest, rect);
-	}
-
-
-	UINT newsize;
-	SoMoMu=PURE_ZLIB;
-	if (m_buffer2 && source2 && dataSize>Firstrun)
-		{
-			Translate(source2,m_buffer2, rect);
-			newsize=PrepareXOR(m_buffer,m_buffer2,rect);
-		}
-	switch (SoMoMu)
-	{
-		case SOLID_COLOR:
-			{
-				surh->encoding = Swap32IfLE(rfbEncodingSolidColor);
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,compStream.avail_in);
-				//vnclog.Print(LL_INTINFO, VNCLOG("Solid \n"));
-				if (m_queueEnable)
-				{
-				AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +newsize,outConn,0);
-				return 0;
-				}
-				return sz_rfbFramebufferUpdateRectHeader +newsize;
-			}
-		case MONO_COLOR:
-			{
-				compStream.avail_in = newsize;
-				surh->encoding = Swap32IfLE(rfbEncodingXORMonoColor_Zlib);
-				//vnclog.Print(LL_INTINFO, VNCLOG("Mono \n"));
-				if (m_queueEnable)
-				{
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,newsize);
-				AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +newsize,outConn,1);
-				return 0;
-				}
-				break;
-
-			}
-		case MULTI_COLOR:
-			{
-				compStream.avail_in = newsize;
-				surh->encoding = Swap32IfLE(rfbEncodingXORMultiColor_Zlib);
-				///vnclog.Print(LL_INTINFO, VNCLOG("MultiColor \n"));
-				break;
-			}
-
-		case XOR_SEQUENCE:
-			{
-				compStream.avail_in = newsize;
-				surh->encoding = Swap32IfLE(rfbEncodingXOR_Zlib);
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,newsize);
-				if (newsize<1000 && m_queueEnable)
-				{
-					AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +newsize,outConn,1);
-					return 0;
-				}
-				///vnclog.Print(LL_INTINFO, VNCLOG("XOR \n"));
-				break;
-			}
-
-		case PURE_ZLIB:
-			{
-				if (rawDataSize<1000 && m_queueEnable)
-				{
-				surh->encoding = Swap32IfLE(rfbEncodingRaw);
-				memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,rawDataSize);
-				AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +rawDataSize,outConn,1);
-				return 0;
-				}
-
-				surh->encoding = Swap32IfLE(rfbEncodingZlib);
-				///vnclog.Print(LL_INTINFO, VNCLOG("Pure \n"));
-				break;
-			}
-	}
-		// Initialize input/output buffer assignment for compressor state.
-		compStream.next_in = m_buffer;
-		compStream.avail_out = maxCompSize;
-		compStream.next_out = (dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader);
-		compStream.data_type = Z_BINARY;
-	
-		// If necessary, the first time, initialize the compressor state.
-		if ( compStreamInited == false )
-		{
-	
-			compStream.total_in = 0;
-			compStream.total_out = 0;
-			compStream.zalloc = Z_NULL;
-			compStream.zfree = Z_NULL;
-			compStream.opaque = Z_NULL;
-	
-			//vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d\n"), m_compresslevel);
-	
-			deflateResult = deflateInit2( &compStream,
-										m_compresslevel,
-										Z_DEFLATED,
-										MAX_WBITS,
-										MAX_MEM_LEVEL,
-										Z_DEFAULT_STRATEGY );
-			if ( deflateResult != Z_OK )
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s\n"), deflateResult, compStream.msg);
-				return vncEncoder::EncodeRect(source, dest, rect);
-			}
-			compStreamInited = true;
-		}
-
-		// Record previous total output size.
-		previousTotalOut = compStream.total_out;
-
-		// Compress the raw data into the result buffer.
-		deflateResult = deflate( &compStream, Z_SYNC_FLUSH );
-
-		if ( deflateResult != Z_OK )
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s\n"), deflateResult, compStream.msg);
-			return vncEncoder::EncodeRect(source, dest, rect);
-		}
-	
-		// Calculate size of compressed data.
-		totalCompDataLen = compStream.total_out - previousTotalOut;
-	
-		// Format the ZlibHeader
-		rfbZlibHeader *zlibh=(rfbZlibHeader *)(dest+sz_rfbFramebufferUpdateRectHeader);
-		zlibh->nBytes = Swap32IfLE(totalCompDataLen);
-	
-		// Update statistics
-		encodedSize += sz_rfbZlibHeader + totalCompDataLen;
-		rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-
-		// Return the amount of data sent	
-		return sz_rfbFramebufferUpdateRectHeader +
-			sz_rfbZlibHeader +
-			totalCompDataLen;
-
-}
-
-inline UINT
-vncEncodeZlib::PrepareXOR(BYTE * m_buffer,BYTE * m_buffer2,RECT rect)
-{
-	
-	DWORD c1;
-	DWORD c2;
-	unsigned char *c1ptr;
-	unsigned char *c2ptr;
-
-	unsigned char *sourceptr = m_buffer;
-	unsigned char *source2ptr = m_buffer2;
-	unsigned char *sourceposptr = m_buffer2;
-
-	const int rectW = rect.right - rect.left;
-	const int rectH = rect.bottom - rect.top;
-	const int BytePerPixel=m_remoteformat.bitsPerPixel/8;
-	const int rawDataSize = (rectW*rectH*BytePerPixel);
-	const int maskDataSize = (((rectW*rectH)+7)/8);
-	
-	if (m_MaskbufferSize < maskDataSize)
-	{
-		if (m_Maskbuffer != NULL)
-		{
-			delete [] m_Maskbuffer;
-			m_Maskbuffer = NULL;
-		}
-		m_Maskbuffer = new mybool [maskDataSize+1];
-	}
-	
-	c1ptr=(unsigned char *)&c1;
-	c2ptr=(unsigned char *)&c2;
-
-	totalraw+=rawDataSize; //stats
-
-	memcpy(c1ptr,sourceptr,BytePerPixel);
-	// detect mono and solid parts
-	int j=0;
-	int nr_colors=1;
-	bool temparray[8];
-	int byte_nr=0;
-	for (int i=0; i<rawDataSize;i=i+BytePerPixel)
-	{
-		if (memcmp(sourceptr,c1ptr,BytePerPixel)!= 0)
-		{
-			if (nr_colors==1)
-				{
-					memcpy(c2ptr,sourceptr,BytePerPixel);
-					nr_colors++;
-					SoMoMu=MONO_COLOR;
-				}
-			else if (memcmp(sourceptr,c2ptr,BytePerPixel)!= 0)
-				{
-						SoMoMu=MULTI_COLOR;
-						nr_colors++;
-						break;//stop checking we have more then 2 colors
-				}
-			temparray[j]=true;
-		}
-		else
-		{
-			temparray[j]=false;
-		}
-		if (j==7) //0-7 byte
-		{
-			m_Maskbuffer[byte_nr].b0=temparray[0];
-			m_Maskbuffer[byte_nr].b1=temparray[1];
-			m_Maskbuffer[byte_nr].b2=temparray[2];
-			m_Maskbuffer[byte_nr].b3=temparray[3];
-			m_Maskbuffer[byte_nr].b4=temparray[4];
-			m_Maskbuffer[byte_nr].b5=temparray[5];
-			m_Maskbuffer[byte_nr].b6=temparray[6];
-			m_Maskbuffer[byte_nr].b7=temparray[7];
-			byte_nr++;
-			j=0;
-		}
-		else j++;
-		sourceptr+=BytePerPixel;
-		source2ptr+=BytePerPixel;
-	}
-	// add the last partial byte
-	if (j!=0)
-	{
-		m_Maskbuffer[byte_nr].b0=temparray[0];
-		m_Maskbuffer[byte_nr].b1=temparray[1];
-		m_Maskbuffer[byte_nr].b2=temparray[2];
-		m_Maskbuffer[byte_nr].b3=temparray[3];
-		m_Maskbuffer[byte_nr].b4=temparray[4];
-		m_Maskbuffer[byte_nr].b5=temparray[5];
-		m_Maskbuffer[byte_nr].b6=temparray[6];
-		m_Maskbuffer[byte_nr].b7=temparray[7];
-	}
-
-//SOLID COLOR
-	if (nr_colors==1)
-	{
-	//full solid rectangle
-		unsigned char *sourceptr = m_buffer;
-		memcpy(sourceptr,c1ptr,BytePerPixel);
-		SoMoMu=SOLID_COLOR;
-		return BytePerPixel;
-		}
-//MONO COLOR
-	if (nr_colors==2)
-	{
-
-		unsigned char *sourceptr = m_buffer;
-		memcpy(sourceptr,m_Maskbuffer,maskDataSize);
-		sourceptr+=maskDataSize;
-		memcpy(sourceptr,c1ptr,BytePerPixel);
-		sourceptr+=BytePerPixel;
-		memcpy(sourceptr,c2ptr,BytePerPixel);
-		SoMoMu=MONO_COLOR;
-		return maskDataSize+(2)*BytePerPixel;
-	}
-
-//USE XOR AGAINST PREVIOUS IMAGE
-	{
-		int j=0;
-		int k=0;
-		SoMoMu=XOR_SEQUENCE;
-		bool temparray[8];
-		int byte_nr=0;
-		sourceptr = m_buffer;
-		source2ptr = m_buffer2;
-		for (int i=0; i<rawDataSize;i=i+BytePerPixel)
-		{
-			if (memcmp(sourceptr,source2ptr,BytePerPixel)!= 0)
-			{
-				memcpy(sourceposptr,sourceptr,BytePerPixel);
-				temparray[j]=true;
-				sourceposptr+=BytePerPixel;
-				k++;
-			}
-			else
-			{
-				temparray[j]=false;
-			}
-			if (j==7) //0-7 byte
-			{
-				m_Maskbuffer[byte_nr].b0=temparray[0];
-				m_Maskbuffer[byte_nr].b1=temparray[1];
-				m_Maskbuffer[byte_nr].b2=temparray[2];
-				m_Maskbuffer[byte_nr].b3=temparray[3];
-				m_Maskbuffer[byte_nr].b4=temparray[4];
-				m_Maskbuffer[byte_nr].b5=temparray[5];
-				m_Maskbuffer[byte_nr].b6=temparray[6];
-				m_Maskbuffer[byte_nr].b7=temparray[7];
-				byte_nr++;
-				j=0;
-			}
-			else j++;
-			sourceptr+=BytePerPixel;
-			source2ptr+=BytePerPixel;
-		}
-		//add last byte, perhaps j==0
-		if (j!=0)
-		{
-			m_Maskbuffer[byte_nr].b0=temparray[0];
-			m_Maskbuffer[byte_nr].b1=temparray[1];
-			m_Maskbuffer[byte_nr].b2=temparray[2];
-			m_Maskbuffer[byte_nr].b3=temparray[3];
-			m_Maskbuffer[byte_nr].b4=temparray[4];
-			m_Maskbuffer[byte_nr].b5=temparray[5];
-			m_Maskbuffer[byte_nr].b6=temparray[6];
-			m_Maskbuffer[byte_nr].b7=temparray[7];
-		}
-	
-		//check if new size is better then old
-		if ((maskDataSize+(k)*BytePerPixel)<rawDataSize)
-		{
-			unsigned char *sourceptr = m_buffer;
-			memcpy(sourceptr,m_Maskbuffer,maskDataSize);
-			sourceptr+=maskDataSize;
-			memcpy(sourceptr,m_buffer2,k*BytePerPixel);
-			return maskDataSize+(k)*BytePerPixel;
-		}
-	}
-	SoMoMu=PURE_ZLIB;
-	return 0;
-}
-
-void
-vncEncodeZlib::AddToQueu(BYTE *source,int sizerect,VSocket *outConn,int updatetype)
-{
-	if (m_Queuelen+sizerect>(MaxQueuebufflen)) SendZlibrects(outConn);
-	memcpy(m_Queuebuffer+m_Queuelen,source,sizerect);
-	m_Queuelen+=sizerect;
-	m_nNbRects++;
-	if (updatetype==1) must_be_zipped=true;
-	if (m_nNbRects>50) SendZlibrects(outConn);
-}
-
-void
-vncEncodeZlib::SendZlibrects(VSocket *outConn)
-{
-	int NRects=m_nNbRects;
-	const int rawDataSize = (m_Queuelen);
-	const int maxCompSize = (m_Queuelen + (m_Queuelen/100) + 8);
-
-	if (NRects==0) return; // NO update
-	if (m_nNbRects<3 && !must_be_zipped) 
-	{
-		outConn->SendExactQueue( (char *)m_Queuebuffer, m_Queuelen); // 1 Small update
-		m_nNbRects=0;
-		m_Queuelen=0;
-		encodedSize += m_Queuelen-sz_rfbFramebufferUpdateRectHeader;
-		rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-		return;
-	}
-	m_nNbRects=0;
-	m_Queuelen=0;
-	must_be_zipped=false;
-
-
-	int nRet = compress((unsigned char*)(m_QueueCompressedbuffer),
-						(unsigned long*)&maxCompSize,
-						(unsigned char*)m_Queuebuffer,
-						rawDataSize
-						);
-
-	if (nRet != 0)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("compression error"));
-		return ;
-	}
-	int rawDataSize1=rawDataSize/65535;
-	int rawDataSize2=rawDataSize%65535;
-
-	rfbFramebufferUpdateRectHeader CacheRectsHeader;
-	CacheRectsHeader.r.x = (CARD16)(NRects);
-	CacheRectsHeader.r.y = (CARD16)(rawDataSize2);
-	CacheRectsHeader.r.w = (CARD16)(rawDataSize1);
-	CacheRectsHeader.r.x = Swap16IfLE(CacheRectsHeader.r.x);
-	CacheRectsHeader.r.y = Swap16IfLE(CacheRectsHeader.r.y);
-	CacheRectsHeader.r.w = Swap16IfLE(CacheRectsHeader.r.w);
- 	CacheRectsHeader.r.h = 0;
-	CacheRectsHeader.encoding = Swap32IfLE(rfbEncodingSolMonoZip);
-
-	// Format the ZlibHeader
-	rfbZlibHeader CacheZipHeader;
-	CacheZipHeader.nBytes = Swap32IfLE(maxCompSize);
-
-	vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),maxCompSize,rawDataSize,NRects);
-	outConn->SendExactQueue((char *)&CacheRectsHeader, sizeof(CacheRectsHeader));
-	outConn->SendExactQueue((char *)&CacheZipHeader, sizeof(CacheZipHeader));
-	outConn->SendExactQueue((char *)m_QueueCompressedbuffer, maxCompSize);
-	// Update statistics
-	encodedSize += sz_rfbZlibHeader + maxCompSize;
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	transmittedSize += maxCompSize+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader;
-}
-
-void
-vncEncodeZlib::LastRect(VSocket *outConn)
-{
-	SendZlibrects(outConn);
-}
diff --git a/ica/win32/winvnc/winvnc/vncEncodeZlib.h b/ica/win32/winvnc/winvnc/vncEncodeZlib.h
deleted file mode 100644
index df6c9d1..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeZlib.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeZlib object
-
-// The vncEncodeZlib object uses a zlib based compression encoding to send rectangles
-// to a client
-
-class vncEncodeZlib;
-
-#if !defined(_WINVNC_ENCODEZLIB)
-#define _WINVNC_ENCODEZLIB
-#pragma once
-
-#include "vncencoder.h"
-#ifdef IPP
-#include "..\..\ipp_zlib\src\zlib\zlib.h"
-#else
-#include "zlib.h"
-#endif
-
-// Minimum zlib rectangle size in bytes.  Anything smaller will
-// not compress well due to overhead.
-#define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17)
-
-// Set maximum zlib rectangle size in pixels.  Always allow at least
-// two scan lines.
-#define ZLIB_MAX_RECT_SIZE (8*1024)
-#define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? ( min * 2 ) : ZLIB_MAX_RECT_SIZE )
-#define SOLID_COLOR	0 // 1 color
-#define MONO_COLOR	1 //2 colors
-#define MULTI_COLOR	2 // >2 colors
-#define PURE_ZLIB	3 
-#define	XOR_SEQUENCE 4 //XOR previous image
-
-struct mybool {
- bool b0 : 1;
- bool b1 : 1;
- bool b2 : 1;
- bool b3 : 1;
- bool b4 : 1;
- bool b5 : 1;
- bool b6 : 1;
- bool b7 : 1;
-};
-
-// Class definition
-
-class vncEncodeZlib : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeZlib();
-	~vncEncodeZlib();
-
-	virtual void Init();
-	virtual const char* GetEncodingName() { return "Zlib"; }
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source,BYTE *source2, VSocket *outConn, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT &rect,VSocket *outConn);
-	virtual UINT PrepareXOR(BYTE *m_buffer,BYTE *m_buffer2,RECT rect);
-
-	virtual void LastRect(VSocket *outConn);
-	virtual void AddToQueu(BYTE *source,int size,VSocket *outConn,int must_be_zipped);
-	virtual void SendZlibrects(VSocket *outConn);
-
-
-// Implementation
-protected:
-	BYTE		      *m_buffer;
-	BYTE		      *m_buffer2;
-	BYTE			  *m_Queuebuffer;
-	BYTE			  *m_QueueCompressedbuffer;
-	mybool			  *m_Maskbuffer;
-	int				  m_MaskbufferSize;
-	int			       m_bufflen;
-	struct z_stream_s  compStream;
-	bool               compStreamInited;
-	int totalraw;
-	int SoMoMu; //solid/mono/multi color
-
-	int				   m_Queuebufflen;
-	int				   MaxQueuebufflen;
-	int				   m_Queuelen;
-	int				   m_nNbRects;
-	int				   must_be_zipped;
-	BOOL				m_queueEnable;
-	int					Firstrun;
-};
-
-#endif // _WINVNC_ENCODEZLIB
-
diff --git a/ica/win32/winvnc/winvnc/vncEncodeZlibHex.cpp b/ica/win32/winvnc/winvnc/vncEncodeZlibHex.cpp
deleted file mode 100644
index 9d25aac..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeZlibHex.cpp
+++ /dev/null
@@ -1,645 +0,0 @@
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-//  vncEncodeZlibHex
-
-// This file implements the vncEncoder-derived vncEncodeZlibHex class.
-// This class overrides some vncEncoder functions to produce a
-// Hextile encoder with zlib.  Hextile splits all top-level update rectangles
-// into smaller, 16x16 rectangles and encodes these using the
-// optimized Hextile sub-encodings, including zlib.
-
-#include "vncEncodeZlibHex.h"
-#include "rfb.h"
-// #include "MinMax.h"
-#include <stdlib.h>
-#include <time.h>
-
-//#define IN_LEN		(128*1024)
-//#define OUT_LEN		(IN_LEN + IN_LEN / 64 + 16 + 3)
-/*#define HEAP_ALLOC(var,size) \
-	lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]*/
-//static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS);
-
-
-vncEncodeZlibHex::vncEncodeZlibHex()
-{
-
-	m_buffer = NULL;
-	m_bufflen = 0;
-	m_Queuebuffer = NULL;
-	m_Queuelen = 0;
-	MaxQueuebufflen=128*1024;
-	compStreamRaw.total_in = ZLIBHEX_COMP_UNINITED;
-	compStreamEncoded.total_in = ZLIBHEX_COMP_UNINITED;
-	//lzo=false;
-	m_Queuebuffer = new BYTE [MaxQueuebufflen+1];
-		if (m_Queuebuffer == NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Memory error"));
-		}
-
-}
-
-vncEncodeZlibHex::~vncEncodeZlibHex()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-		m_bufflen = 0;
-	}
-	if ( compStreamRaw.total_in != ZLIBHEX_COMP_UNINITED )
-	{
-		deflateEnd( &compStreamRaw );
-		compStreamRaw.total_in = ZLIBHEX_COMP_UNINITED;
-	}
-	if ( compStreamEncoded.total_in != ZLIBHEX_COMP_UNINITED )
-	{
-		deflateEnd( &compStreamEncoded );
-		compStreamEncoded.total_in = ZLIBHEX_COMP_UNINITED;
-	}
-	if (m_Queuebuffer != NULL)
-	{
-		delete [] m_Queuebuffer;
-		m_Queuebuffer = NULL;
-	}
-
-}
-
-void
-vncEncodeZlibHex::Init()
-{
-	vncEncoder::Init();
-}
-
-UINT
-vncEncodeZlibHex::RequiredBuffSize(UINT width, UINT height)
-{
-	int accumSize;
-
-	// Start with the raw encoding size, which includes the
-	// rectangle header size.
-	accumSize = vncEncoder::RequiredBuffSize(width, height);
-	// Add overhead associated with zlib compression, worst case.
-	accumSize += ((accumSize / 100) + 8);
-	// Add zlib/other subencoding overhead, worst case.
-	accumSize += (((width/16)+1) * ((height/16)+1) * ((3 * m_remoteformat.bitsPerPixel / 8) + 2));
-
-	return accumSize;
-}
-
-UINT
-vncEncodeZlibHex::NumCodedRects(RECT &rect)
-{
-	return 0;
-	return 1;
-}
-
-/*
- * hextile.c
- *
- * Routines to implement Hextile Encoding
- */
-
-#include <stdio.h>
-#include "rfb.h"
-
-/*
- * vncEncodeZlibHex::EncodeRect - send a rectangle using hextile encoding.
- */
-
-UINT
-vncEncodeZlibHex::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect)
-{
-	const int rectW = rect.right - rect.left;
-	const int rectH = rect.bottom - rect.top;
-
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	surh->r.x = (CARD16) (rect.left-m_SWOffsetx);
-	surh->r.y = (CARD16) (rect.top-m_SWOffsety);
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingZlibHex);
-
-	rectangleOverhead += sz_rfbFramebufferUpdateRectHeader;
-	dataSize += ( rectW * rectH * m_remoteformat.bitsPerPixel) / 8;
-
-	// Go ahead and send the RFB update header, in case partial updates
-	// are send in EncodeHextiles#() below.
-	outConn->SendExactQueue( (char *)dest, sz_rfbFramebufferUpdateRectHeader);
-//	AddToQueu((BYTE *)dest,sz_rfbFramebufferUpdateRectHeader,outConn);
-	
-	transmittedSize += sz_rfbFramebufferUpdateRectHeader;
-
-	// Do the encoding
-	UINT retval;
-    switch (m_remoteformat.bitsPerPixel)
-	{
-	case 8:
-		retval= EncodeHextiles8(source, dest, outConn, rect.left, rect.top, rectW, rectH);
-		SendZlibHexrects(outConn);
-		return retval;
-    case 16:
-		retval= EncodeHextiles16(source, dest, outConn, rect.left, rect.top, rectW, rectH);
-		SendZlibHexrects(outConn);
-		return retval;
-    case 32:
-		retval= EncodeHextiles32(source, dest, outConn, rect.left, rect.top, rectW, rectH);
-		SendZlibHexrects(outConn);
-		return retval;
-    }
-
-	return vncEncoder::EncodeRect(source, dest, rect);
-}
-
-UINT
-vncEncodeZlibHex::zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct z_stream_s *compressor)
-{
-	int previousTotalOut;
-	int deflateResult;
-//	unsigned int out_len;
-
-	// Initialize input/output buffer assignment for compressor state.
-	compressor->avail_in = length;
-	compressor->next_in = from_buf;
-	compressor->avail_out = (2 * length);
-	compressor->next_out = to_buf;
-	compressor->data_type = Z_BINARY;
-	/*if (lzo==false)
-		{
-			if (lzo_init() == LZO_E_OK) lzo=true;
-		}
-	if (lzo1x_1_compress(from_buf,length,to_buf,&out_len,wrkmem)!=LZO_E_OK)
-		vnclog.Print(LL_INTINFO, VNCLOG("Error compressing  \n"));
-	return out_len;*/
-
-	//vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d \n"), length,out_len);
-
-
-	// If necessary, the first time, initialize the compressor state.
-	if ( compressor->total_in == ZLIBHEX_COMP_UNINITED )
-	{
-
-		compressor->total_in = 0;
-		compressor->total_out = 0;
-		compressor->zalloc = Z_NULL;
-		compressor->zfree = Z_NULL;
-		compressor->opaque = Z_NULL;
-
-		vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d\n"), m_compresslevel);
-
-		deflateResult = deflateInit2( compressor,
-			                          m_compresslevel,
-					                  Z_DEFLATED,
-					                  MAX_WBITS,
-					                  MAX_MEM_LEVEL,
-					                  Z_DEFAULT_STRATEGY );
-		if ( deflateResult != Z_OK )
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s\n"), deflateResult, compressor->msg);
-			return -1;
-		}
-
-	}
-
-	// Record previous total output size.
-	previousTotalOut = compressor->total_out;
-
-	// Compress the raw data into the result buffer.
-	deflateResult = deflate( compressor, Z_SYNC_FLUSH );
-
-	if ( deflateResult != Z_OK )
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s\n"), deflateResult, compressor->msg);
-		return -1;
-	}
-//	vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d %d \n"), length,compressor->total_out - previousTotalOut,out_len);
-//	if (length/2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####50######### \n"), length);
-//	if (length/3*2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####33######### \n"), length);
-//	if (length/4*3>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####25######### \n"), length);
-
-	return compressor->total_out - previousTotalOut;
-}
-
-
-#define PUT_PIXEL8(pix) (dest[destoffset++] = (pix))
-
-#define PUT_PIXEL16(pix) (dest[destoffset++] = ((char*)&(pix))[0],			\
-			  dest[destoffset++] = ((char*)&(pix))[1])
-
-#define PUT_PIXEL32(pix) (dest[destoffset++] = ((char*)&(pix))[0],			\
-			  dest[destoffset++] = ((char*)&(pix))[1],						\
-			  dest[destoffset++] = ((char*)&(pix))[2],						\
-			  dest[destoffset++] = ((char*)&(pix))[3])
-
-#define DEFINE_SEND_HEXTILES(bpp)											\
-																			\
-static UINT subrectEncode##bpp(CARD##bpp *src, BYTE *dest,					\
-				int w, int h, CARD##bpp bg,									\
-			    CARD##bpp fg, BOOL mono);									\
-static void testColours##bpp(CARD##bpp *data, int size, BOOL *mono,			\
-			     BOOL *solid, CARD##bpp *bg, CARD##bpp *fg);				\
-																			\
-																			\
-/*																			\
- * rfbSendHextiles															\
- */																			\
-																			\
-																			\
-UINT																		\
-vncEncodeZlibHex::EncodeHextiles##bpp(BYTE *source, BYTE *dest,				\
-				  VSocket *outConn, int rx, int ry, int rw, int rh)			\
-{																			\
-    int x, y, w, h;															\
-    int rectoffset, destoffset;												\
-    int encodedBytes, compressedSize;										\
-	CARD16* card16ptr;														\
-	CARD##bpp bg, fg, newBg, newFg;											\
-	bg=0;fg=0;newBg=0;newFg=0;												\
-	BOOL mono, solid;														\
-	BOOL validBg = FALSE;													\
-	BOOL validFg = FALSE;													\
-	int subEncodedLen;														\
-	CARD##bpp clientPixelData[(16*16+2)*(bpp/8)+8+14+2];					\
-																			\
-	destoffset = 0;															\
-																			\
-    for (y = ry; y < ry+rh; y += 16)										\
-	{																		\
-		for (x = rx; x < rx+rw; x += 16)									\
-		{																	\
-		    w = h = 16;														\
-		    if (rx+rw - x < 16)												\
-				w = rx+rw - x;												\
-		    if (ry+rh - y < 16)												\
-				h = ry+rh - y;												\
-																			\
-			RECT hexrect;													\
-			hexrect.left = x;												\
-			hexrect.top = y;												\
-			hexrect.right = x+w;											\
-			hexrect.bottom = y+h;											\
-			Translate(source, (BYTE *) clientPixelData, hexrect);			\
-																			\
-			rectoffset = destoffset;										\
-			dest[rectoffset] = 0;											\
-			destoffset++;													\
-																			\
-			testColours##bpp(clientPixelData, w * h,						\
-			     &mono, &solid, &newBg, &newFg);							\
-																			\
-			if (!validBg || (newBg != bg))									\
-			{																\
-				validBg = TRUE;												\
-				bg = newBg;													\
-				dest[rectoffset] |= rfbHextileBackgroundSpecified;			\
-				PUT_PIXEL##bpp(bg);											\
-			}																\
-																			\
-			if (solid)														\
-				continue;													\
-																			\
-			dest[rectoffset] |= rfbHextileAnySubrects;						\
-																			\
-			if (mono)														\
-			{																\
-				if (!validFg || (newFg != fg))								\
-				{															\
-					validFg = TRUE;											\
-					fg = newFg;												\
-					dest[rectoffset] |= rfbHextileForegroundSpecified;		\
-					PUT_PIXEL##bpp(fg);										\
-				}															\
-			}																\
-			else															\
-			{																\
-				validFg = FALSE;											\
-				dest[rectoffset] |= rfbHextileSubrectsColoured;			    \
-			}																\
-																			\
-			encodedBytes = subrectEncode##bpp(clientPixelData,				\
-											dest + destoffset,				\
-											w, h, bg, fg, mono);			\
-																			\
-			if (encodedBytes == 0)											\
-			{																\
-																			\
-				/* hextile encoding was too large, use raw/zlib */			\
-				if ((w*h*(bpp/8)) > VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE)		\
-				{															\
-					/* raw data large enough to use zlib */					\
-					validBg = FALSE;										\
-					validFg = FALSE;										\
-					destoffset = rectoffset;								\
-					dest[destoffset++] = rfbHextileZlibRaw;				\
-																			\
-					Translate(source, (BYTE *) clientPixelData, hexrect);	\
-																			\
-					compressedSize = zlibCompress((BYTE *) clientPixelData,	\
-													dest + destoffset + 2,	\
-													(w*h*(bpp/8)),			\
-													&compStreamRaw);		\
-																			\
-																			\
-					card16ptr = (CARD16*) (dest + destoffset);				\
-					*card16ptr = Swap16IfLE(compressedSize);				\
-					destoffset += compressedSize + 2;						\
-																			\
-			    }															\
-				else														\
-				{															\
-					/* raw size small enough, use directly */				\
-					validBg = FALSE;										\
-					validFg = FALSE;										\
-					destoffset = rectoffset;								\
-					dest[destoffset++] = rfbHextileRaw;						\
-																			\
-					Translate(source, (dest + destoffset), hexrect);		\
-																			\
-					destoffset += (w*h*(bpp/8));							\
-																			\
-				}															\
-			}																\
-			else /* when (encodedBytes != 0) */								\
-			{																\
-				/* Hextile encoding smaller than raw, compress further? */	\
-				/* Subencoded data harder to compress, need larger batch? */	\
-				if (encodedBytes > (VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE * 2))	\
-				{															\
-					/* hex encoded data large enough to use zlib */			\
-					subEncodedLen = (encodedBytes + destoffset - rectoffset - 1);		\
-					destoffset = rectoffset + 1;								\
-					memcpy( clientPixelData, (dest + destoffset), subEncodedLen);		\
-					dest[rectoffset] |= rfbHextileZlibHex;					\
-																			\
-					compressedSize = zlibCompress((BYTE *) clientPixelData,	\
-													dest + destoffset + 2,	\
-													subEncodedLen,			\
-													&compStreamEncoded);	\
-																			\
-																			\
-					card16ptr = (CARD16*) (dest + destoffset);				\
-					*card16ptr = Swap16IfLE(compressedSize);				\
-					destoffset += compressedSize + 2;						\
-			    }															\
-				else														\
-				{															\
-					/* hex encoded data too small for zlib, send as is */	\
-					destoffset += encodedBytes;								\
-			    }															\
-			}																\
-																			\
-		}																	\
-																			\
-		if (destoffset > VNC_ENCODE_ZLIBHEX_MIN_DATAXFER)					\
-		{																	\
-			/* Send the encoded data as partial update */					\
-			AddToQueu((BYTE *)dest,destoffset,outConn);				        \
-			transmittedSize += destoffset;									\
-			encodedSize += destoffset;										\
-			destoffset = 0;													\
-																			\
-		}																	\
-    }																		\
-	transmittedSize += destoffset;											\
-	encodedSize += destoffset;												\
-																			\
-    return destoffset;														\
-}																			\
-																			\
-static UINT																	\
-subrectEncode##bpp(CARD##bpp *src, BYTE *dest, int w, int h, CARD##bpp bg,	\
-		   CARD##bpp fg, BOOL mono)											\
-{																			\
-    CARD##bpp cl;															\
-    int x,y;																\
-    int i,j;																\
-    int hx=0,hy,vx=0,vy;													\
-    int hyflag;																\
-    CARD##bpp *seg;															\
-    CARD##bpp *line;														\
-    int hw,hh,vw,vh;														\
-    int thex,they,thew,theh;												\
-    int numsubs = 0;														\
-    int newLen;																\
-    int rectoffset;															\
-	int destoffset;															\
-																			\
-	destoffset = 0;															\
-    rectoffset = destoffset;												\
-    destoffset++;															\
-																			\
-    for (y=0; y<h; y++)														\
-	{																		\
-		line = src+(y*w);													\
-		for (x=0; x<w; x++)													\
-		{																	\
-		    if (line[x] != bg)												\
-			{																\
-				cl = line[x];												\
-				hy = y-1;													\
-				hyflag = 1;													\
-				for (j=y; j<h; j++)											\
-				{															\
-					seg = src+(j*w);										\
-					if (seg[x] != cl) {break;}								\
-					i = x;													\
-					while ((seg[i] == cl) && (i < w)) i += 1;				\
-					i -= 1;													\
-					if (j == y) vx = hx = i;								\
-					if (i < vx) vx = i;										\
-					if ((hyflag > 0) && (i >= hx))							\
-					{														\
-						hy += 1;											\
-					}														\
-					else													\
-					{														\
-						hyflag = 0;											\
-					}														\
-				}															\
-				vy = j-1;													\
-																			\
-				/* We now have two possible subrects: (x,y,hx,hy) and		\
-				 * (x,y,vx,vy).  We'll choose the bigger of the two.		\
-				 */															\
-				hw = hx-x+1;												\
-				hh = hy-y+1;												\
-				vw = vx-x+1;												\
-				vh = vy-y+1;												\
-																			\
-				thex = x;													\
-				they = y;													\
-																			\
-				if ((hw*hh) > (vw*vh))										\
-				{															\
-				    thew = hw;												\
-				    theh = hh;												\
-				}															\
-				else														\
-				{															\
-				    thew = vw;												\
-				    theh = vh;												\
-				}															\
-																			\
-				if (mono)													\
-				{															\
-				    newLen = destoffset - rectoffset + 2;					\
-				}															\
-				else														\
-				{															\
-				    newLen = destoffset - rectoffset + bpp/8 + 2;			\
-				}															\
-																			\
-				if (newLen > (w * h * (bpp/8)))								\
-				    return 0;												\
-																			\
-				numsubs += 1;												\
-																			\
-				if (!mono) PUT_PIXEL##bpp(cl);								\
-																			\
-				dest[destoffset++] = rfbHextilePackXY(thex,they);			\
-				dest[destoffset++] = rfbHextilePackWH(thew,theh);			\
-																			\
-				/*															\
-				 * Now mark the subrect as done.							\
-				 */															\
-				for (j=they; j < (they+theh); j++)							\
-				{															\
-					for (i=thex; i < (thex+thew); i++)						\
-					{														\
-						src[j*w+i] = bg;									\
-					}														\
-				}															\
-		    }																\
-		}																	\
-    }																		\
-																			\
-    dest[rectoffset] = numsubs;												\
-																			\
-    return destoffset;														\
-}																			\
-																			\
-																			\
-/*																			\
- * testColours() tests if there are one (solid), two (mono) or more			\
- * colours in a tile and gets a reasonable guess at the best background	    \
- * pixel, and the foreground pixel for mono.								\
- */																			\
-																			\
-static void																	\
-testColours##bpp(CARD##bpp *data, int size,									\
-				 BOOL *mono, BOOL *solid,									\
-				 CARD##bpp *bg, CARD##bpp *fg)								\
-{																			\
-    CARD##bpp colour1, colour2;												\
-    int n1 = 0, n2 = 0;														\
-    *mono = TRUE;															\
-    *solid = TRUE;															\
-	colour1=0;																\
-	colour2=0;																\
-																			\
-    for (; size > 0; size--, data++)										\
-	{																		\
-																			\
-		if (n1 == 0)														\
-		    colour1 = *data;												\
-																			\
-		if (*data == colour1)												\
-		{																	\
-		    n1++;															\
-		    continue;														\
-		}																	\
-																			\
-		if (n2 == 0)														\
-		{																	\
-		    *solid = FALSE;													\
-		    colour2 = *data;												\
-		}																	\
-																			\
-		if (*data == colour2)												\
-		{																	\
-		    n2++;															\
-		    continue;														\
-		}																	\
-																			\
-		*mono = FALSE;														\
-		break;																\
-	}																		\
-																			\
-    if (n1 > n2)															\
-	{																		\
-		*bg = colour1;														\
-		*fg = colour2;														\
-    }																		\
-	else																	\
-	{																		\
-		*bg = colour2;														\
-		*fg = colour1;														\
-    }																		\
-}
-
-DEFINE_SEND_HEXTILES(8)
-DEFINE_SEND_HEXTILES(16)
-DEFINE_SEND_HEXTILES(32)
-
-
-void
-vncEncodeZlibHex::AddToQueu(BYTE *source,int sizerect,VSocket *outConn)
-{
-	if (m_Queuelen+sizerect>(MaxQueuebufflen)) SendZlibHexrects(outConn);
-	if (sizerect>(MaxQueuebufflen)) 
-		{
-			outConn->SendExactQueue( (char *)source,sizerect);
-			return;
-		}
-//	vnclog.Print(LL_INTINFO, VNCLOG("Add %i %i \n"),sizerect,m_Queuelen);
-	memcpy(m_Queuebuffer+m_Queuelen,source,sizerect);
-	m_Queuelen+=sizerect;
-}
-
-void
-vncEncodeZlibHex::SendZlibHexrects(VSocket *outConn)
-{
-	if (m_Queuelen==0) return; // NO update
-	
-		outConn->SendExactQueue( (char *)m_Queuebuffer, m_Queuelen); // 1 Small update
-		m_Queuelen=0;
-		encodedSize += m_Queuelen-sz_rfbFramebufferUpdateRectHeader;
-		return;
-}
-
-void
-vncEncodeZlibHex::LastRect(VSocket *outConn)
-{
-	SendZlibHexrects(outConn);
-}
diff --git a/ica/win32/winvnc/winvnc/vncEncodeZlibHex.h b/ica/win32/winvnc/winvnc/vncEncodeZlibHex.h
deleted file mode 100644
index 8476cd9..0000000
--- a/ica/win32/winvnc/winvnc/vncEncodeZlibHex.h
+++ /dev/null
@@ -1,114 +0,0 @@
-//  Copyright (C) 2000 Tridia Corporation. 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.
-//
-// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-//
-// 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeZlibHex object
-
-// The vncEncodeZlibHex object uses a compression encoding to send rectangles
-// to a client.  As with the hextile encoding, all rectangles are broken down
-// into a matrix of 16x16 (or smaller at bottom/right) tiles, which are 
-// individually encoded with a subencoding mechanism.  This encoding addds
-// the ability to apply zlib compression to the raw and other hextile
-// subencodings.
-
-class vncEncodeZlibHex;
-
-#if !defined(_WINVNC_ENCODEZLIBHEX)
-#define _WINVNC_ENCODEZLIBHEX
-#pragma once
-
-#include "vncencoder.h"
-
-#ifdef IPP
-#include "..\..\ipp_zlib\src\zlib\zlib.h"
-#else
-#include "zlib.h"
-#endif
-#include "lzo/minilzo.h"
-
-// Minimum zlib rectangle size in bytes.  Anything smaller will
-// not compress well due to overhead.
-// temp change lzo
-//#define VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE (17)
-#define VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE (64)
-// Flag used to mark our compressors as uninitialized.
-#define ZLIBHEX_COMP_UNINITED ((DWORD)-1)
-
-// Size of the smallest update portion sent independently across
-// the network.  This encoder can transmit partial updates to
-// improve latency issues with performance.
-#define VNC_ENCODE_ZLIBHEX_MIN_DATAXFER (1400)
-
-// Class definition
-
-class vncEncodeZlibHex : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeZlibHex();
-	~vncEncodeZlibHex();
-
-	void Init();
-	virtual const char* GetEncodingName() { return "ZlibHex"; }
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(RECT &rect);
-
-	// virtual UINT EncodeRect(BYTE *source, BYTE *dest, const RECT &rect);
-	virtual UINT EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect);
-
-	virtual void LastRect(VSocket *outConn);
-	virtual void AddToQueu(BYTE *source,int size,VSocket *outConn);
-	virtual void SendZlibHexrects(VSocket *outConn);
-
-protected:
-	virtual UINT zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct z_stream_s *compressor);
-
-	virtual UINT EncodeHextiles8(BYTE *source, BYTE *dest,
-		VSocket *outConn, int x, int y, int w, int h);
-	virtual UINT EncodeHextiles16(BYTE *source, BYTE *dest,
-		VSocket *outConn, int x, int y, int w, int h);
-	virtual UINT EncodeHextiles32(BYTE *source, BYTE *dest,
-		VSocket *outConn, int x, int y, int w, int h);
-
-// Implementation
-protected:
-	BYTE		      *m_buffer;
-	int			       m_bufflen;
-	struct z_stream_s  compStreamRaw;
-	struct z_stream_s  compStreamEncoded;
-	//bool lzo;
-	BYTE			  *m_Queuebuffer;
-	int					m_Queuelen;
-	int					MaxQueuebufflen;
-};
-
-#endif // _WINVNC_ENCODEHEXTILE
-
diff --git a/ica/win32/winvnc/winvnc/vncListDlg.cpp b/ica/win32/winvnc/winvnc/vncListDlg.cpp
deleted file mode 100644
index 11c46f6..0000000
--- a/ica/win32/winvnc/winvnc/vncListDlg.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at Vnc Team Members. 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.uvnc.com/
-
-// vncListDlg.cpp
-
-// Implementation of the vncListDlg dialog!
-
-#include "stdhdrs.h"
-
-#include "winvnc.h"
-#include "vncListDlg.h"
-#include "common/win32_helpers.h"
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-//
-//
-//
-vncListDlg::vncListDlg()
-{
-	m_dlgvisible = FALSE;
-}
-
-//
-//
-//
-vncListDlg::~vncListDlg()
-{
-}
-
-//
-//
-//
-BOOL vncListDlg::Init(vncServer* pServer)
-{
-	m_pServer = pServer;
-	return TRUE;
-}
-
-//
-//
-//
-void vncListDlg::Display()
-{
-	if (!m_dlgvisible)
-	{
-		// [v1.0.2-jp1 fix] Load resouce from dll
-		//DialogBoxParam(	hAppInstance,
-		DialogBoxParam(	hInstResDLL,
-						MAKEINTRESOURCE(IDD_LIST_DLG), 
-						NULL,
-						(DLGPROC) DialogProc,
-						(LONG_PTR) this
-						);
-	}
-}
-
-//
-//
-//
-BOOL CALLBACK vncListDlg::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
-    vncListDlg *_this = helper::SafeGetWindowUserData<vncListDlg>(hwnd);
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{
-            helper::SafeSetWindowUserData(hwnd, lParam);
-			_this = (vncListDlg *) lParam;
-
-			vncClientList::iterator i;
-			HWND hList = GetDlgItem(hwnd, IDC_VIEWERS_LISTBOX);
-
-			_this->m_pServer->ListAuthClients(hList);
-			SendMessage(hList, LB_SETCURSEL, -1, 0);
-
-			// adzm 2009-07-05
-			HWND hPendingList = GetDlgItem(hwnd, IDC_PENDING_LISTBOX);
-			_this->m_pServer->ListUnauthClients(hPendingList);
-
-			SetForegroundWindow(hwnd);
-			_this->m_dlgvisible = TRUE;
-			if (!_this->m_pServer->GetAllowEditClients())
-			{
-				EnableWindow(GetDlgItem(hwnd, IDC_KILL_B), false);
-			}
-			else EnableWindow(GetDlgItem(hwnd, IDC_KILL_B), true);
-
-			// Allow TextChat if one client only
-			/*
-			EnableWindow(GetDlgItem(hwnd, IDC_TEXTCHAT_B),
-				         _this->m_pServer->AuthClientCount() == 1 ? TRUE : FALSE);
-			*/
-			return TRUE;
-		}
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-
-		case IDCANCEL:
-		case IDOK:
-			EndDialog(hwnd, TRUE);
-			_this->m_dlgvisible = FALSE;
-			return TRUE;
-
-		case IDC_KILL_B:
-			{
-			HWND hList = GetDlgItem(hwnd, IDC_VIEWERS_LISTBOX);
-			LRESULT nSelected = SendMessage(hList, LB_GETCURSEL, 0, 0);
-			if (nSelected != LB_ERR)
-			{
-				char szClient[128];
-				if (SendMessage(hList, LB_GETTEXT, nSelected, (LPARAM)szClient) > 0)
-					_this->m_pServer->KillClient(szClient);
-			}
-			EndDialog(hwnd, TRUE);
-			_this->m_dlgvisible = FALSE;
-			return TRUE;
-			}
-			break;
-
-		case IDC_TEXTCHAT_B:
-			{
-			HWND hList = GetDlgItem(hwnd, IDC_VIEWERS_LISTBOX);
-			LRESULT nSelected = SendMessage(hList, LB_GETCURSEL, 0, 0);
-			if (nSelected != LB_ERR)
-			{
-				char szClient[128];
-				if (SendMessage(hList, LB_GETTEXT, nSelected, (LPARAM)szClient) > 0)
-					_this->m_pServer->TextChatClient(szClient);
-			}
-			EndDialog(hwnd, TRUE);
-			_this->m_dlgvisible = FALSE;
-			return TRUE;
-			}
-			break;
-
-		}
-		break;
-
-	case WM_DESTROY:
-		EndDialog(hwnd, FALSE);
-		_this->m_dlgvisible = FALSE;
-		return TRUE;
-	}
-	return 0;
-}
diff --git a/ica/win32/winvnc/winvnc/vncListDlg.h b/ica/win32/winvnc/winvnc/vncListDlg.h
deleted file mode 100644
index 23347fd..0000000
--- a/ica/win32/winvnc/winvnc/vncListDlg.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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.uvnc.com/
-
-class vncListDlg;
-
-#if (!defined(_WINVNC_VNCLISTDLG))
-#define _WINVNC_VNCLISTDLG
-
-#include "stdhdrs.h"
-#include "vncserver.h"
-
-
-class vncListDlg
-{
-public:
-	// Constructor / destructor
-	vncListDlg();
-	~vncListDlg();
-
-	BOOL Init(vncServer* pServer);
-	static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-	void Display();
-
-	vncServer* m_pServer;
-	BOOL m_dlgvisible;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncMultiMonitor.cpp b/ica/win32/winvnc/winvnc/vncMultiMonitor.cpp
deleted file mode 100644
index 67e1d30..0000000
--- a/ica/win32/winvnc/winvnc/vncMultiMonitor.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-// System headers
-#include <assert.h>
-#include "stdhdrs.h"
-
-// Custom headers
-//#include <WinAble.h>
-#include <omnithread.h>
-#include "winvnc.h"
-#include "vnchooks/VNCHooks.h"
-#include "vncserver.h"
-#include "vnckeymap.h"
-#include "rfbRegion.h"
-#include "rfbRect.h"
-#include "vncdesktop.h"
-#include "vncservice.h"
-// Modif rdv at 2002 - v1.1.x - videodriver
-#include "vncOSVersion.h"
-
-#include "mmsystem.h" // sf at 2002
-#include "TextChat.h" // sf at 2002
-#include "vncdesktopthread.h"
-#include "common/win32_helpers.h"
-
-void 
-vncDesktop::Checkmonitors()
-{
-  nr_monitors=GetNrMonitors();
-  DEVMODE devMode;
-  if (nr_monitors>0)
-  {
-	if(OSversion()==1 || OSversion()==2 || OSversion()==4 )GetPrimaryDevice();
-	devMode.dmSize = sizeof(DEVMODE);
-	if(OSversion()==1 || OSversion()==2 || OSversion()==4 ) EnumDisplaySettings(mymonitor[0].device, ENUM_CURRENT_SETTINGS, &devMode);
-	else EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
-	mymonitor[0].offsetx=devMode.dmPosition.x;
-	mymonitor[0].offsety=devMode.dmPosition.y;
-	mymonitor[0].Width=devMode.dmPelsWidth;
-	mymonitor[0].Height=devMode.dmPelsHeight;
-	mymonitor[0].Depth=devMode.dmBitsPerPel;
-  }
-  if (nr_monitors>1)
-  {
-	GetSecondaryDevice();
-	devMode.dmSize = sizeof(DEVMODE);
-	EnumDisplaySettings(mymonitor[1].device, ENUM_CURRENT_SETTINGS, &devMode);
-	mymonitor[1].offsetx=devMode.dmPosition.x;
-	mymonitor[1].offsety=devMode.dmPosition.y;
-	mymonitor[1].Width=devMode.dmPelsWidth;
-	mymonitor[1].Height=devMode.dmPelsHeight;
-	mymonitor[1].Depth=devMode.dmBitsPerPel;
-  }
-	///
-    mymonitor[2].offsetx=GetSystemMetrics(SM_XVIRTUALSCREEN);
-    mymonitor[2].offsety=GetSystemMetrics(SM_YVIRTUALSCREEN);
-    mymonitor[2].Width=GetSystemMetrics(SM_CXVIRTUALSCREEN);
-    mymonitor[2].Height=GetSystemMetrics(SM_CYVIRTUALSCREEN);
-	mymonitor[2].Depth=mymonitor[0].Depth;//depth primary monitor is used
-
-}
-
-
-
-int
-vncDesktop::GetNrMonitors()
-{
-	if(OSversion()==3 || OSversion()==5) return 1;
-	int i;
-    int j=0;
-    
-    helper::DynamicFn<pEnumDisplayDevices> pd("USER32","EnumDisplayDevicesA");
-
-    if (pd.isValid())
-    {
-        DISPLAY_DEVICE dd;
-        ZeroMemory(&dd, sizeof(dd));
-        dd.cb = sizeof(dd);
-        for (i=0; (*pd)(NULL, i, &dd, 0); i++)
-			{
-				if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
-					if (!(dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER))j++;
-			}
-	}
-	return j;
-}
-
-void
-vncDesktop::GetPrimaryDevice()
-{
-	int i;
-    helper::DynamicFn<pEnumDisplayDevices> pd("USER32","EnumDisplayDevicesA");
-
-    if (pd.isValid())
-    {
-        DISPLAY_DEVICE dd;
-        ZeroMemory(&dd, sizeof(dd));
-        dd.cb = sizeof(dd);
-        for (i=0; (*pd)(NULL, i, &dd, 0); i++)
-			{
-				if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
-					if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
-						if (!(dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER))
-						{
-							strcpy(mymonitor[0].device,(char *)dd.DeviceName);
-						}
-
-			}
-	}
-}
-
-void
-vncDesktop::GetSecondaryDevice()
-{
-	int i;
-    helper::DynamicFn<pEnumDisplayDevices> pd("USER32","EnumDisplayDevicesA");
-
-    if (pd.isValid())
-    {
-        DISPLAY_DEVICE dd;
-        ZeroMemory(&dd, sizeof(dd));
-        dd.cb = sizeof(dd);
-        for (i=0; (*pd)(NULL, i, &dd, 0); i++)
-			{
-				if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
-					if (!(dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE))
-						if (!(dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER))
-						{
-							strcpy(mymonitor[1].device,(char *)dd.DeviceName);
-						}
-
-			}
-	}
-}
diff --git a/ica/win32/winvnc/winvnc/vncOSVersion.cpp b/ica/win32/winvnc/winvnc/vncOSVersion.cpp
deleted file mode 100644
index 356161c..0000000
--- a/ica/win32/winvnc/winvnc/vncOSVersion.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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.uvnc.com/
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#include <windows.h>
-int OSTYPE=4;
-void
-SetOSVersion()
-{
-	OSVERSIONINFO OSversion;
-	
-	OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-
-	GetVersionEx(&OSversion);
-
-	switch(OSversion.dwPlatformId)
-	{
-		case VER_PLATFORM_WIN32_NT:
-								  if(OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==0)
-									 OSTYPE=1;							    
-								  if(OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==1)
-									 OSTYPE=1;
-								  if(OSversion.dwMajorVersion==5)
-									 OSTYPE=1;
-								  if(OSversion.dwMajorVersion>=6) // handle anything >= 6
-									 OSTYPE=2;
-								  if(OSversion.dwMajorVersion<=4) 	  
-								     OSTYPE=3;
-								  break;
-		case VER_PLATFORM_WIN32_WINDOWS:
-								if(OSversion.dwMinorVersion==0) 
-								{
-									OSTYPE=5; //95
-									break;
-								}
-								OSTYPE=4;
-	}
-}
-
-int OSversion()
-{
-	return OSTYPE;
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncOSVersion.h b/ica/win32/winvnc/winvnc/vncOSVersion.h
deleted file mode 100644
index e941a72..0000000
--- a/ica/win32/winvnc/winvnc/vncOSVersion.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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://ultravnc.sourceforge.net/
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if !defined(DISPL)
-#define DISPL
-#pragma once
-void SetOSVersion();
-int OSversion();
-#endif
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncabout.cpp b/ica/win32/winvnc/winvnc/vncabout.cpp
deleted file mode 100644
index 60ea1c8..0000000
--- a/ica/win32/winvnc/winvnc/vncabout.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-//  Copyright (C) 2002 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 at 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"
-
-//	[v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-HBITMAP
-    DoGetBkGndBitmap(IN CONST UINT uBmpResId )
-    {
-        static HBITMAP hbmBkGnd = NULL;
-        if (NULL == hbmBkGnd)
-        {
-            /*char szFileName[MAX_PATH];
-			if (GetModuleFileName(NULL, szFileName, MAX_PATH))
-				{
-				char* p = strrchr(szFileName, '\\');
-					if (p == NULL) return false;
-					*p = '\0';
-				strcat (szFileName,"\\background2.bmp");
-			}
-			hbmBkGnd = (HBITMAP)LoadImage( NULL, szFileName, IMAGE_BITMAP, 0, 0,
-               LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );*/
-			hbmBkGnd = (HBITMAP)LoadImage(
-                GetModuleHandle(NULL), MAKEINTRESOURCE(uBmpResId),
-                    IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
-
-            if (NULL == hbmBkGnd)
-                hbmBkGnd = (HBITMAP)-1;
-        }
-        return (hbmBkGnd == (HBITMAP)-1)
-            ? NULL : hbmBkGnd;
-    }
-BOOL
-    DoSDKEraseBkGnd(
-        IN CONST HDC hDC,
-        IN CONST COLORREF crBkGndFill
-      )
-    {
-        HBITMAP hbmBkGnd = DoGetBkGndBitmap(IDB_BITMAP1);
-        if (hDC && hbmBkGnd)
-        {
-            RECT rc;
-            if ((ERROR != GetClipBox(hDC, &rc)) && !IsRectEmpty(&rc))
-            {
-                HDC hdcMem = CreateCompatibleDC(hDC);
-                if (hdcMem)
-                {
-                    HBRUSH hbrBkGnd = CreateSolidBrush(crBkGndFill);
-                    if (hbrBkGnd)
-                    {
-                        HGDIOBJ hbrOld = SelectObject(hDC, hbrBkGnd);
-                        if (hbrOld)
-                        {
-                            SIZE size = {
-                                (rc.right-rc.left), (rc.bottom-rc.top)
-                            };
-
-                            if (PatBlt(hDC, rc.left, rc.top, size.cx, size.cy, PATCOPY))
-                            {
-                                HGDIOBJ hbmOld = SelectObject(hdcMem, hbmBkGnd);
-                                if (hbmOld)
-                                {
-                                    BitBlt(hDC, rc.left, rc.top, size.cx, size.cy,
-                                        hdcMem, rc.left, rc.top, SRCCOPY);
-                                    SelectObject(hdcMem, hbmOld);
-                                }
-                            }
-                            SelectObject(hDC, hbrOld);
-                        }
-                        DeleteObject(hbrBkGnd);
-                    }
-                    DeleteDC(hdcMem);
-                }
-            }
-        }
-        return TRUE;
-    }
-
-// 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)
-		{
-			//	[v1.0.2-jp1 fix]
-			//DialogBoxParam(hAppInstance,
-			DialogBoxParam(hInstResDLL,
-				MAKEINTRESOURCE(IDD_ABOUT), 
-				NULL,
-				(DLGPROC) DialogProc,
-				(LONG_PTR) 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!
-#ifndef _X64
-	vncAbout *_this = (vncAbout *) GetWindowLong(hwnd, GWL_USERDATA);
-#else
-	vncAbout *_this = (vncAbout *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#endif
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{
-			// Retrieve the Dialog box parameter and use it as a pointer
-			// to the calling vncProperties object
-#ifndef _X64
-			SetWindowLong(hwnd, GWL_USERDATA, lParam);
-#else
-			SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
-#endif
-			_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;
-	/*case WM_ERASEBKGND:
-            {
-                DoSDKEraseBkGnd((HDC)wParam, RGB(255,0,0));
-				return true;
-            }
-	case WM_CTLCOLORSTATIC:
-   {
-
-    //GetStockObject(NULL_BRUSH);
-    SetBkMode((HDC) wParam, TRANSPARENT);
-	return (DWORD) GetStockObject(NULL_BRUSH);
-
-   }*/
-	}
-	return 0;
-}
diff --git a/ica/win32/winvnc/winvnc/vncabout.h b/ica/win32/winvnc/winvnc/vncabout.h
deleted file mode 100644
index ad7e881..0000000
--- a/ica/win32/winvnc/winvnc/vncabout.h
+++ /dev/null
@@ -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 at 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_VNCABOUT
diff --git a/ica/win32/winvnc/winvnc/vncacceptdialog.cpp b/ica/win32/winvnc/winvnc/vncacceptdialog.cpp
deleted file mode 100644
index 53293bd..0000000
--- a/ica/win32/winvnc/winvnc/vncacceptdialog.cpp
+++ /dev/null
@@ -1,204 +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 at 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"
-#include "common/win32_helpers.h"
-
-#include "Localization.h" // Act : add localization on messages
-
-//	[v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-// Constructor
-
-vncAcceptDialog::vncAcceptDialog(UINT timeoutSecs,BOOL acceptOnTimeout, const char *ipAddress)
-{
-	m_timeoutSecs = timeoutSecs;
-	m_ipAddress = _strdup(ipAddress);
-	m_foreground_hack=FALSE;
-	m_acceptOnTimeout = acceptOnTimeout;
-}
-
-// 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()
-{
-	//	[v1.0.2-jp1 fix]
-	//int retVal = DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_ACCEPT_CONN), 
-	int retVal = DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_ACCEPT_CONN), 
-		NULL, (DLGPROC) vncAcceptDlgProc, (LONG_PTR) this);
-	delete this;
-	switch (retVal) 
-	{
-		case IDREJECT:
-			return 0;
-		case IDACCEPT:
-			return 1;
-	}
-	return (m_acceptOnTimeout) ? 1 : 0;
-
-}
-
-// 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 = helper::SafeGetWindowUserData<vncAcceptDialog>(hwnd);
-	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
-            helper::SafeSetWindowUserData(hwnd, 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)
-			{
-				if (_this->m_acceptOnTimeout)
-					EndDialog(hwnd, IDACCEPT);
-				else
-				EndDialog(hwnd, IDREJECT);
-			}
-			_this->m_timeoutCount = _this->m_timeoutSecs;
-
-			char temp[256];
-			if (_this->m_acceptOnTimeout)
-				sprintf(temp, "AutoAccept:%u", (_this->m_timeoutCount));
-			else
-				sprintf(temp, "AutoReject:%u", (_this->m_timeoutCount));
-			SetDlgItemText(hwnd, IDC_ACCEPT_TIMEOUT, temp);
-
-
-			// 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)
-			{
-				if ( _this->m_acceptOnTimeout ) 
-					{
-						EndDialog(hwnd, IDACCEPT);
-					}
-				else 
-					{
-						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];
-		if ( _this->m_acceptOnTimeout )
-			sprintf(temp, "AutoAccept: %u", (_this->m_timeoutCount));
-		else
-			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;
-}
-
diff --git a/ica/win32/winvnc/winvnc/vncacceptdialog.h b/ica/win32/winvnc/winvnc/vncacceptdialog.h
deleted file mode 100644
index 604149f..0000000
--- a/ica/win32/winvnc/winvnc/vncacceptdialog.h
+++ /dev/null
@@ -1,73 +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 at 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,BOOL acceptOnTimeout, 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;
-
-	BOOL m_acceptOnTimeout;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncauth.c b/ica/win32/winvnc/winvnc/vncauth.c
deleted file mode 100644
index ef33844..0000000
--- a/ica/win32/winvnc/winvnc/vncauth.c
+++ /dev/null
@@ -1,187 +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 at 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)
-{
-    size_t 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((unsigned  char*) encryptedPasswd, (unsigned char*) 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((unsigned char*) inouttext, passwd);
-
-    passwd[8] = 0;
-
-    return (char *)passwd;
-}
-
-char *
-vncDecryptPasswdMs(char *inouttext) 
-{ 
-        // Marscha at 2004: corrected bug which occured for some passwords. 
-        // See http://forum.ultravnc.net/viewtopic.php?t=803 
-    unsigned char *passwd = (unsigned char *)malloc(33); 
-        int i; 
-        for (i = 0; i < MAXMSPWLEN; i++) 
-                passwd[i] = inouttext[i]; 
-
-        //des seems only to handle the first 8 chars.. 
-    deskey(fixedkey, DE1); 
-    des(passwd, passwd); 
-    passwd[32] = 0; 
-
-        // Marscha at 2004: Seems to be not necessary, but I found no 
-        // documentation what des() guarantees beyond the 8th byte. 
-        for (i=8; i < MAXMSPWLEN; i++) 
-                passwd[i] = inouttext[i]; 
-
-    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);    
-  }
-}
-
-void
-vncRandomBytesMs(unsigned char *where) {
-  int i;
-  static unsigned int seed;
-  seed += (unsigned int) time(0) + _getpid() + _getpid() * 987654;
-
-  srand(seed);
-  for (i=0; i < CHALLENGESIZEMS; 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];
-    size_t 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);
-    }
-}
-
-/*
- *   marscha at 2006
- *   Decrypt bytes[length] in memory using key.
- *   Key has to be 8 bytes, length a multiple of 8 bytes.
- */
-void
-vncDecryptBytes(unsigned char *where, const int length, const unsigned char *key) {
-	int i, j;
-	deskey((unsigned char*) key, DE1);
-	for (i = length - 8; i > 0; i -= 8) {
-		des(where + i, where + i);
-		for (j = 0; j < 8; j++)
-			where[i + j] ^= where[i + j - 8];
-	}
-	/* i = 0 */
-	des (where, where);
-	for (i = 0; i < 8; i++)
-		where[i] ^= key[i];
-}
diff --git a/ica/win32/winvnc/winvnc/vncauth.h b/ica/win32/winvnc/winvnc/vncauth.h
deleted file mode 100644
index eda1b24..0000000
--- a/ica/win32/winvnc/winvnc/vncauth.h
+++ /dev/null
@@ -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 at uk.research.att.com for information on obtaining it.
-
-
-/* 
- * vncauth.h - describes the functions provided by the vncauth library.
- */
-
-#define MAXPWLEN 8
-#define MAXMSPWLEN 32
-#define CHALLENGESIZE 16
-#define CHALLENGESIZEMS 64
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-extern int vncEncryptPasswd(char *passwd, char *fname);
-extern char *vncDecryptPasswd(char *fname);
-extern char *vncDecryptPasswdMs(char *fname);
-extern void vncRandomBytes(unsigned char *bytes);
-extern void vncRandomBytesMs(unsigned char *bytes);
-extern void vncEncryptBytes(unsigned char *bytes, const char *passwd);
-// marscha
-extern void vncDecryptBytes(unsigned char *bytes, const int length, const unsigned char *key);
-#ifdef __cplusplus
-}
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncbuffer.cpp b/ica/win32/winvnc/winvnc/vncbuffer.cpp
deleted file mode 100644
index 8855740..0000000
--- a/ica/win32/winvnc/winvnc/vncbuffer.cpp
+++ /dev/null
@@ -1,1201 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// ScrBuffer implementation
-
-#include "stdhdrs.h"
-
-// Header
-
-#include "vncdesktop.h"
-#include "rfbMisc.h"
-
-#include "vncbuffer.h"
-
-vncBuffer::vncBuffer()
-{
-	m_freemainbuff = FALSE;
-	m_mainbuff = NULL;
-	m_backbuff = NULL;
-	m_cachebuff =NULL;
-	m_use_cache = FALSE;
-	m_cursor_shape_cleared = FALSE;
-	m_backbuffsize = 0;
-	m_desktop=NULL;
-
-	// Modif sf at 2002 - Scaling
-	m_ScaledBuff = NULL;
-	m_nScale = 1;
-	m_ScaledSize = 0;
-
-	m_nAccuracyDiv = 4;
-
-	nRowIndex = 0;
-	m_cursorpending = false;
-	m_single_monitor=1;
-	m_multi_monitor=0;
-
-	// sf at 2005 - Grey Palette
-	m_fGreyPalette = false;
-	m_videodriverused=false;
-}
-
-vncBuffer::~vncBuffer()
-{
-	if (m_freemainbuff) {
-		// We need to free the slow-blit buffer
-		// Modif rdv at 2002 - v1.1.x - Videodriver
-	if (m_mainbuff != NULL)
-		{
-			delete [] m_mainbuff;
-			m_mainbuff = NULL;
-		}
-	}
-	if (m_backbuff != NULL)
-	{
-		delete [] m_backbuff;
-		m_backbuff = NULL;
-	}
-
-	if (m_cachebuff != NULL)
-	{
-		delete [] m_cachebuff;
-		m_cachebuff = NULL;
-	}
-
-	// Modif sf at 2002 - Scaling
-	if (m_ScaledBuff != NULL)
-	{
-		delete [] m_ScaledBuff;
-		m_ScaledBuff = NULL;
-	}
-	m_ScaledSize = 0;
-
-
-	m_backbuffsize = 0;
-}
-
-BOOL 
-vncBuffer::SetDesktop(vncDesktop *desktop)
-{
-	// Called from vncdesktop startup
-	// only possible on startup or reinitialization
-	// access is block by m_desktop->m_update_lock
-	m_desktop=desktop;
-	return CheckBuffer();
-}
-
-rfb::Rect
-vncBuffer::GetSize()
-{
-try
-	{
-		return m_desktop->GetSize();
-	}
-	catch (...)
-	{	
-		//return rfb::Rect(0, 0, m_scrinfo.framebufferWidth, m_scrinfo.framebufferHeight);
-		return rfb::Rect(0, 0, 0, 0);
-	}
-
-}
-
-// Modif sf at 2002 - Scaling
-UINT vncBuffer::GetScale()
-{
-	return m_nScale;
-}
-
-
-BOOL vncBuffer::SetScale(int nScale)
-{
-	//called by
-	//vncClientThread::run(void *arg) Lock Added
-	// case rfbSetScale:  Lock Added OK
-
-	m_nScale = nScale;
-
-	// Problem, driver buffer is not writable
-	// so we always need a m_scalednuff
-	/*if (m_nScale == 1)
-	{
-		//if (m_mainbuff)memcpy(m_ScaledBuff, m_mainbuff, m_desktop->ScreenBuffSize());
-		//else ZeroMemory(m_ScaledBuff, m_desktop->ScreenBuffSize());
-		if (!CheckBuffer()) // added to remove scaled buffer
-            return FALSE;
-		if (m_mainbuff)memcpy(m_backbuff, m_mainbuff, m_desktop->ScreenBuffSize());
-		else ZeroMemory(m_ScaledBuff, m_desktop->ScreenBuffSize());
-	}
-	else
-	*/
-	{
-		// sf at 2002 - Idealy, we must do a ScaleRect of the whole screen here.
-		// ScaleRect(rfb::Rect(0, 0, m_scrinfo.framebufferWidth / m_nScale, m_scrinfo.framebufferHeight / m_nScale));
-		if (!CheckBuffer())//added to create scaled buffer
-            return FALSE;
-		ZeroMemory(m_ScaledBuff, m_desktop->ScreenBuffSize());
-		ZeroMemory(m_backbuff, m_desktop->ScreenBuffSize());
-	}
-	
-	return TRUE;
-}
-
-
-rfb::Rect vncBuffer::GetViewerSize()
-{
-	rfb::Rect rect;
-	rect=m_desktop->GetSize();
-	return rfb::Rect(rect.tl.x,rect.tl.y, rect.br.x / m_nScale, rect.br.y / m_nScale);
-}
-
-
-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
-			// Modif rdv at 2002 - v1.1.x - Videodriver
-			if (m_mainbuff != NULL)
-			{
-				delete [] m_mainbuff;
-				m_mainbuff = NULL;
-			}
-		}
-
-		if (m_cachebuff != NULL)
-		{
-			delete [] m_cachebuff;
-			m_cachebuff = NULL;
-		}
-
-		// Check whether or not the vncDesktop is using fast blits
-		// Modif rdv at 2002 - v1.1.x - Videodriver
-		
-		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_backbuffsize != m_desktop->ScreenBuffSize())
-        {
-		    if (m_backbuff != NULL)
-		    {
-			    delete [] m_backbuff;
-			    m_backbuff = NULL;
-        		m_backbuffsize = 0;
-		    }
-
-		    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;
-		    }
-    		m_backbuffsize = m_desktop->ScreenBuffSize();
-        }
-
-		if (m_use_cache)
-		{
-			if ((m_cachebuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]\n"), m_desktop->ScreenBuffSize());
-				return FALSE;
-			}
-			ClearCache();
-		}
-
-		memset(m_backbuff, 0, m_desktop->ScreenBuffSize());
-
-		// Problem, driver buffer is not writable
-		// so we always need a m_scalednuff
-		/// If scale==1 we don't need to allocate the memory
-		/*if (m_nScale > 1) 
-		{*/
-            if (m_ScaledSize != m_desktop->ScreenBuffSize())
-            {
-		        // Modif sf at 2002 - Scaling
-		        if (m_ScaledBuff != NULL)
-		        {
-			        delete [] m_ScaledBuff;
-			        m_ScaledBuff = NULL;
-            		m_ScaledSize = 0;
-		        }
-
-                // Modif sf at 2002 - Scaling
-			    if ((m_ScaledBuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL)
-			    {
-				    vnclog.Print(LL_INTERR, VNCLOG("unable to allocate scaled buffer[%d]\n"), m_desktop->ScreenBuffSize());
-				    return FALSE;
-			    }
-			    m_ScaledSize = m_desktop->ScreenBuffSize();
-            }
-		/*}
-		else
-		{
-			delete [] m_ScaledBuff;
-			m_ScaledBuff = NULL;
-    		m_ScaledSize = 0;
-		}
-
-		if (m_nScale > 1) */
-			memcpy(m_ScaledBuff, m_mainbuff, m_desktop->ScreenBuffSize());
-
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("local buffer=%d\n"), m_backbuffsize);
-
-	return TRUE;
-}
-
-
-// Modif sf at 2002 - v1.1.0
-//
-// Set the accuracy divider factor 
-// that is utilized in the GetChangedRegion function
-// for changes detection in Rectangles.
-// The higher the value the less accuracy.
-// WARNING :this value must be a 32 divider.
-//
-BOOL vncBuffer::SetAccuracy(int nAccuracy)
-{
-	m_nAccuracyDiv = nAccuracy;
-	nRowIndex = 0;
-
-	return TRUE;
-}
-
-void vncBuffer::VideDriverUsed(bool enabled)
-{
-	m_videodriverused=enabled;
-}
-
-bool vncBuffer::VideDriverUsed()
-{
-	return m_videodriverused;
-}
-
-
-// Check a specified rectangle for changes and fill the region with
-// the changed subrects
-//#pragma function(memcpy,Save_memcmp)
-
-const int BLOCK_SIZE = 32;
-void vncBuffer::CheckRect(rfb::Region2D &dest, rfb::Region2D &cacheRgn, const rfb::Rect &srcrect)
-{
-/*#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText,"CheckRect ++++++++++++++++ %i %i %i %i  \n",srcrect.tl.x,srcrect.br.x,srcrect.tl.y,srcrect.br.y);
-					SetLastError(0);
-					OutputDebugString(szText);		
-#endif*/
-	//only called from desktopthread
-	if (!FastCheckMainbuffer())
-		return;
-
-	const UINT bytesPerPixel = m_scrinfo.format.bitsPerPixel >> 3; // divide by 8
-
-	rfb::Rect new_rect;
-	rfb::Rect srect = srcrect;
-
-	// Modif sf at 2002 - Scaling
-	rfb::Rect ScaledRect;
-	ScaledRect.tl.x = ((srect.tl.x < 0)? 0: srect.tl.x) / m_nScale;
-	ScaledRect.tl.y = ((srect.tl.y < 0)? 0: srect.tl.y) / m_nScale;
-
-	ScaledRect.br.x = ((srect.br.x < 0)? 0: srect.br.x) / m_nScale;
-	ScaledRect.br.y = ((srect.br.y < 0)? 0: srect.br.y) / m_nScale;
-
-	
-
-
-	int x, y;
-	UINT ay, by;
-
-	// DWORD align the incoming rectangle.  (bPP will be 8, 16 or 32)
-	if (bytesPerPixel < 4) {
-		if (bytesPerPixel == 1)				// 1 byte per pixel
-			ScaledRect.tl.x -= (ScaledRect.tl.x & 3);	// round down to nearest multiple of 4
-		else								// 2 bytes per pixel
-			ScaledRect.tl.x -= (ScaledRect.tl.x & 1);	// round down to nearest multiple of 2
-	}
-
-	// Modif sf at 2002 - Scaling
-	// Problem, driver buffer is not writable
-	// so we always need a m_scalednuff
-	unsigned char *TheBuffer;
-	if (m_nScale == 1 && !m_videodriverused)
-		TheBuffer = m_mainbuff;
-	else
-		TheBuffer = m_ScaledBuff;
-
-	// sf at 2004 - Optimization (attempt...)
-	int nOptimizedBlockSize; 
-	bool fSmallRect = false;
-	if (ScaledRect.br.x - ScaledRect.tl.x < 16)
-	{
-		nOptimizedBlockSize = BLOCK_SIZE / 4;
-		fSmallRect = true;
-	}
-	else if (ScaledRect.br.x - ScaledRect.tl.x < 32)
-		nOptimizedBlockSize = BLOCK_SIZE / 2;
-	else
-		nOptimizedBlockSize = BLOCK_SIZE * 2;
-
-	ptrdiff_t ptrBlockOffset = (ScaledRect.tl.y * m_bytesPerRow) + (ScaledRect.tl.x * bytesPerPixel);
-
-	if (m_use_cache && !m_desktop->m_UltraEncoder_used && m_cachebuff)
-	{
-	// Scan down the rectangle
-		unsigned char *o_topleft_ptr = m_backbuff  + ptrBlockOffset;
-		unsigned char *c_topleft_ptr = m_cachebuff + ptrBlockOffset;
-		unsigned char *n_topleft_ptr = TheBuffer   + ptrBlockOffset;
-		int last_x, last_y;
-		for (y = ScaledRect.tl.y, last_y = ScaledRect.br.y; y < last_y; y += nOptimizedBlockSize)
-	{
-		// Work out way down the bitmap
-		unsigned char * o_row_ptr = o_topleft_ptr;
-		unsigned char * n_row_ptr = n_topleft_ptr;
-		unsigned char * c_row_ptr = c_topleft_ptr;
-
-		const UINT blockbottom = min(y + nOptimizedBlockSize, ScaledRect.br.y);
-			for (x = ScaledRect.tl.x, last_x = ScaledRect.br.x; x < last_x; x += nOptimizedBlockSize)
-		{
-			// Work our way across the row
-			unsigned char *n_block_ptr = n_row_ptr;
-			unsigned char *o_block_ptr = o_row_ptr;
-			unsigned char *c_block_ptr = c_row_ptr;
-
-			const UINT blockright = min(x + nOptimizedBlockSize, ScaledRect.br.x);
-			const UINT bytesPerBlockRow = (blockright-x) * bytesPerPixel;
-
-				bool fCache = true; // RDV at 2002
-			// Modif sf at 2002 - v1.1.0
-			// int nRowIndex = 0; // We don't reinit nRowIndex for each rect -> we don't always miss the same changed pixels
-			int nOffset = (int)(bytesPerBlockRow / m_nAccuracyDiv);
-
-			unsigned char *y_o_ptr = o_block_ptr;
-			unsigned char *y_n_ptr = n_block_ptr;
-			unsigned char *y_c_ptr = c_block_ptr;
-
-			// Scan this block
-			for (ay = y; ay < blockbottom; ay++)
-			{
-					int nBlockOffset =  nRowIndex * nOffset;
-					if (memcmp(n_block_ptr + nBlockOffset, o_block_ptr + nBlockOffset, nOffset) != 0)
-				{
-					// A pixel has changed, so this block needs updating
-					if (fSmallRect) // Ignore unchanged first rows (samll rect : less chance to miss changes when using nAccuracy div)
-					{
-						new_rect.tl.y = ay * m_nScale;
-						y_n_ptr += ((ay-y) * m_bytesPerRow);
-						y_o_ptr += ((ay-y) * m_bytesPerRow);
-					}
-					else
-					{
-						new_rect.tl.y = y * m_nScale;
-					}
-					new_rect.tl.x = x * m_nScale;
-					new_rect.br.x = blockright * m_nScale;
-					new_rect.br.y = blockbottom * m_nScale;
-
-					for (by = ((fSmallRect) ? ay : y); by < blockbottom; by++)
-					{
-						// Until then, new rect and cached rect are equal.
-						// So test the next row
-						// TODO: send the common part as cached rect and the rest as changed rect
-						if (fCache)
-							{
-							if (memcmp(y_n_ptr, y_c_ptr, bytesPerBlockRow) != 0)
-							{
-									fCache = false; // New rect and cached rect differ
-								}
-							}
-						memcpy(y_c_ptr, y_o_ptr, bytesPerBlockRow); // Save back buffer rect in cache
-						memcpy(y_o_ptr, y_n_ptr, bytesPerBlockRow); // Save new rect in back buffer
-						y_n_ptr += m_bytesPerRow;
-						y_o_ptr += m_bytesPerRow;
-						y_c_ptr += m_bytesPerRow;
-					}
-					if (fCache) // The Rect was in the cache
-					{
-							cacheRgn.assign_union(rfb::Region2D(new_rect));
-					}
-					else // The Rect wasn't in the cache
-					{
-							dest.assign_union(new_rect);
-					}
-
-					break;
-				}
-
-				n_block_ptr += m_bytesPerRow;
-				o_block_ptr += m_bytesPerRow;
-				c_block_ptr += m_bytesPerRow;
-
-				nRowIndex = (nRowIndex + 1) % m_nAccuracyDiv; // sf at 2002 - v1.1.0
-			}
-
-			o_row_ptr += bytesPerBlockRow;
-			n_row_ptr += bytesPerBlockRow;
-			c_row_ptr += bytesPerBlockRow;
-		}
-
-		o_topleft_ptr += m_bytesPerRow * nOptimizedBlockSize;
-		n_topleft_ptr += m_bytesPerRow * nOptimizedBlockSize;
-		c_topleft_ptr += m_bytesPerRow * nOptimizedBlockSize;
-	}
-	}
-	else
-	{
-	// Scan down the rectangle
-		unsigned char *o_topleft_ptr = m_backbuff + ptrBlockOffset;
-		unsigned char *n_topleft_ptr = TheBuffer  + ptrBlockOffset;
-	for (y = ScaledRect.tl.y; y < ScaledRect.br.y; y += nOptimizedBlockSize)
-	{
-		// 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 + nOptimizedBlockSize, ScaledRect.br.y);
-		for (x = ScaledRect.tl.x; x < ScaledRect.br.x; x += nOptimizedBlockSize)
-		{
-			// 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+nOptimizedBlockSize, ScaledRect.br.x);
-			const UINT bytesPerBlockRow = (blockright-x) * bytesPerPixel;
-
-			// Modif sf at 2002 
-			unsigned char *y_o_ptr = o_block_ptr;
-			unsigned char *y_n_ptr = n_block_ptr;
-
-			// int nRowIndex = 0;
-			int nOffset = (int)(bytesPerBlockRow / m_nAccuracyDiv);
-
-			// Scan this block
-			for (ay = y; ay < blockbottom; ay++)
-			{
-					int nBlockOffset =  nRowIndex * nOffset;
-					if (memcmp(n_block_ptr + nBlockOffset, o_block_ptr + nBlockOffset, nOffset) != 0)
-				{
-					// A pixel has changed, so this block needs updating
-					if (fSmallRect) // Ignore unchanged first rows (samll rect : less chance to miss changes when using nAccuracy div)
-					{
-						new_rect.tl.y = ay * m_nScale;
-						y_n_ptr += ((ay-y) * m_bytesPerRow);
-						y_o_ptr += ((ay-y) * m_bytesPerRow);
-					}
-					else
-					{
-						new_rect.tl.y = y * m_nScale;
-					}
-					new_rect.tl.x = x * m_nScale;
-					new_rect.br.x = (blockright * m_nScale);
-					new_rect.br.y = (blockbottom * m_nScale);
-						dest.assign_union(new_rect);
-
-					// Copy the changes to the back buffer
-					for (by = ((fSmallRect) ? ay : y); by < blockbottom; by++)
-					{
-						memcpy(y_o_ptr, y_n_ptr, bytesPerBlockRow);
-						y_n_ptr += m_bytesPerRow;
-						y_o_ptr += m_bytesPerRow;
-					}
-
-					break;
-				}
-				// Last Run Ptr gets over de bounding
-				// Boundcheker keeps complaining
-				if (ay!=blockbottom-1)
-				{
-					n_block_ptr += m_bytesPerRow;
-					o_block_ptr += m_bytesPerRow;
-					nRowIndex = (nRowIndex + 1) % m_nAccuracyDiv;
-				}
-			}
-			if (x != ScaledRect.br.x-1)
-			{
-				o_row_ptr += bytesPerBlockRow;
-				n_row_ptr += bytesPerBlockRow;
-			}
-		}
-		if (y != ScaledRect.br.y-1)
-		{
-			o_topleft_ptr += m_bytesPerRow * nOptimizedBlockSize;
-			n_topleft_ptr += m_bytesPerRow * nOptimizedBlockSize;
-		}
-	}
-	}
-}
-
-//rdv modif scaled and videodriver
-void
-vncBuffer::GrabRegion(rfb::Region2D &src,BOOL driver,BOOL capture)
-{
-	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
-	//
-	//
-	//************ Added extra cliprect check
-	int x,y,w,h;
-	for (i = rects.begin(); i != rects.end(); ++i)
-	{
-		rfb::Rect rect = *i;
-		x=rect.tl.x;
-		y=rect.tl.y;
-		w=rect.br.x-rect.tl.x;
-		h=rect.br.y-rect.tl.y;
-		src=src.subtract(rect);
-		if (ClipRect(&x, &y, &w, &h, m_desktop->m_Cliprect.tl.x, m_desktop->m_Cliprect.tl.y,
-				m_desktop->m_Cliprect.br.x-m_desktop->m_Cliprect.tl.x, m_desktop->m_Cliprect.br.y-m_desktop->m_Cliprect.tl.y))
-			{
-				rect.tl.x=x;
-				rect.tl.y=y;
-				rect.br.x=x+w;
-				rect.br.y=y+h;
-				src=src.union_(rect);
-			}
-	}
-	src.get_rects(rects, 1, 1);
-	if (rects.empty()) 
-		{
-			return;
-		}
-
-	// 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,driver,capture);
-
-			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,driver,capture);
-}
-
-void
-vncBuffer::CheckRegion(rfb::Region2D &dest,rfb::Region2D &cacheRgn ,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
-	//
-	// Block desactivation mainbuff while running
-	// No Lock Needed, only called from vncdesktopthread
-	for (i = rects.begin(); i != rects.end(); ++i)
-	{
-		CheckRect(dest,cacheRgn, *i);
-	}
-}
-
-
-
-// Reduce possible colors to 8 shades of gray
-int To8GreyColors(int r, int g, int b)
-{
-    int Value;
-    Value = (r*11 + g*16 +b*5 ) / 32;
-	
-	if (Value <= 0x20)
-		return 0x101010;
-	else if (Value <= 0x40)
-		return 0x303030;
-	else if (Value <= 0x60)
-		return 0x505050;
-	else if (Value <= 0x80)
-		return 0x707070;
-	else if (Value <= 0xa0)
-		return 0x909090;
-	else if (Value <= 0xc0)
-		return 0xb0b0b0;
-	else if (Value <= 0xe0)
-		return 0xd0d0d0;
-	else
-		return 0xf0f0f0;  
-}
- 
-
-// Modif sf at 2002 - Scaling
-void vncBuffer::ScaleRect(rfb::Rect &rect)
-{
-    bool fCanReduceColors = true;
-
-    //JK 26th Jan, 2005: Color conversion to 8 shades of gray added,
-	//at the moment only works if server has 24/32-bit color
-
-    // this construct is faster than the old method -- it has no jumps, so there's no chance of
-    // branch mispredictions, and it generates better asm code .
-    fCanReduceColors = (((m_scrinfo.format.redMax ^ m_scrinfo.format.blueMax ^ 
-                        m_scrinfo.format.greenMax ^ 0xff) == 0)  && m_fGreyPalette);
-
-#if 0
-	if ((m_scrinfo.format.redMax == 255) 
-		&& 
-		(m_scrinfo.format.blueMax == 255)
-		&&
-		(m_scrinfo.format.greenMax == 255)
-		&&
-		m_fGreyPalette
-		)
-		fCanReduceColors = true;
-	else
-		fCanReduceColors = false;
-#endif
-	//End JK
-
-	// called from grabrect and grabmouse
-	// grabmouse is only called from desktopthread, no lock needed
-	// grebrect called from grabregion called from desktopthread, no lock needed
-	// no lock needed
-	if (!FastCheckMainbuffer())
-		return;
-	///////////
-	rect.tl.y = (rect.tl.y - (rect.tl.y % m_nScale));
-	rect.br.y = (rect.br.y - (rect.br.y % m_nScale)) + m_nScale - 1;
-	rect.tl.x = (rect.tl.x - (rect.tl.x % m_nScale));
-	rect.br.x = (rect.br.x - (rect.br.x % m_nScale)) + m_nScale - 1;
-
-	rfb::Rect ScaledRect;
-	ScaledRect.tl.y = rect.tl.y / m_nScale;
-	ScaledRect.br.y = rect.br.y / m_nScale;
-	ScaledRect.tl.x = rect.tl.x / m_nScale;
-	ScaledRect.br.x = rect.br.x / m_nScale;
-
-	// Copy and scale data from screen Main buffer to Scaled buffer
-	BYTE *pMain   =	m_mainbuff + (rect.tl.y * m_bytesPerRow) + 
-					(rect.tl.x * m_scrinfo.format.bitsPerPixel / 8);
-	BYTE *pScaled = m_ScaledBuff + (ScaledRect.tl.y * m_bytesPerRow) +
-					(ScaledRect.tl.x * m_scrinfo.format.bitsPerPixel / 8);
-
-	// We keep one pixel for m_Scale*m_nScale pixels in the Main buffer
-	// and copy it in the Scaled Buffer
-
-	// TrueColor Case.
-	// Pixels Blending (takes the "medium" pixel of each m_Scale*m_nScale square)
-	// This TrueColor Pixel blending routine comes from the Harakan's WinVNC with Server Side Scaling
-	// Extension. It replaces my own buggy Blending function that given *ugly* results.
-	if (m_nScale == 1 && !m_videodriverused)
-	{
-		//nothing to do, we use the current buffer
-		//Thebuffer=mainbuffer
-		//This avoid the memcpy, on slower systems this give
-		// a real speed boost.
-	}
-	else if (m_scrinfo.format.trueColour && m_nScale!=1)
-	{
-		unsigned long lRed;
-		unsigned long lGreen;
-		unsigned long lBlue;
-		unsigned long lScaledPixel;
-		UINT nBytesPerPixel = (m_scrinfo.format.bitsPerPixel / 8);
-
-		// For each line of the Destination ScaledRect
-		for (int y = ScaledRect.tl.y; y < ScaledRect.br.y; y++)
-		{
-			// For each Pixel of the line 
-			for (int x = 0; x < (ScaledRect.br.x - ScaledRect.tl.x); x++)
-			{
-				lRed   = 0; 
-				lGreen = 0;
-				lBlue  = 0;
-				// Take a m_Scale*m_nScale square of pixels in the Main Buffer
-				// and get the global Red, Green, Blue values for this square
-				for (UINT r = 0; r < m_nScale; r++)
-				{
-					for (UINT c = 0; c < m_nScale; c++)
-					{
-						lScaledPixel = 0;
-						for (UINT b = 0; b < nBytesPerPixel; b++)
-						{
-							lScaledPixel += (pMain[(((x * m_nScale) + c) * nBytesPerPixel) + (r * m_bytesPerRow) + b]) << (8 * b);
-						}
-						lRed   += (lScaledPixel >> m_scrinfo.format.redShift) & m_scrinfo.format.redMax;
-						lGreen += (lScaledPixel >> m_scrinfo.format.greenShift) & m_scrinfo.format.greenMax;
-						lBlue  += (lScaledPixel >> m_scrinfo.format.blueShift) & m_scrinfo.format.blueMax;
-					}
-				}
-				// Get the medium R,G,B values for the sqare
-				lRed   /= m_nScale * m_nScale;
-				lGreen /= m_nScale * m_nScale;
-				lBlue  /= m_nScale * m_nScale;
-				// Calculate the resulting "medium" pixel
-				// lScaledPixel = (lRed << m_scrinfo.format.redShift) + (lGreen << m_scrinfo.format.greenShift) + (lBlue << m_scrinfo.format.blueShift);
-                // JK 26th Jan, 2005: Reduce possible colors to 8 shades of gray
-				if (fCanReduceColors)
-				{
-					lScaledPixel = To8GreyColors(lRed, lGreen, lBlue);
-				}
-				else
-				{
-					// Calculate the resulting "medium" pixel
-					lScaledPixel = (lRed << m_scrinfo.format.redShift) + (lGreen << m_scrinfo.format.greenShift) + (lBlue << m_scrinfo.format.blueShift);
-				} 
-				
-				// Copy the resulting pixel in the Scaled Buffer
-				for (UINT b = 0; b < nBytesPerPixel; b++)
-				{
-					pScaled[(x * nBytesPerPixel) + b] = (lScaledPixel >> (8 * b)) & 0xFF;
-				}
-			}
-			// Move the buffers' pointers to their next "line"
-			pMain   += (m_bytesPerRow * m_nScale); // Skip m_nScale raws of the mainbuffer's Rect
-			pScaled += m_bytesPerRow; 
-		}
-	}
-	// Keep only the topleft pixel of each MainBuffer's m_Scale*m_nScale block
-	// Very incurate method...but bearable result in 256 and 16bit colors modes.
-	else 
-	{
-		UINT nBytesPerPixel = (m_scrinfo.format.bitsPerPixel / 8);
-		for (int y = ScaledRect.tl.y; y < ScaledRect.br.y; y++)
-		{
-			/*for (int x = 0; x < (ScaledRect.br.x - ScaledRect.tl.x); x++)
-			{
-				memcpy(&pScaled[x * nBytesPerPixel], &pMain[x * m_nScale * nBytesPerPixel], nBytesPerPixel);
-			}*/
-			memcpy(&pScaled[0], &pMain[0], nBytesPerPixel*(ScaledRect.br.x - ScaledRect.tl.x));
-			// Move the buffers' pointers to their next "line"
-			pMain   += (m_bytesPerRow * m_nScale); // Skip m_nScale lines of the mainbuffer's Rect
-			pScaled += m_bytesPerRow;
-		}
-	}
-}
-
-
-// Modif sf at 2005 - Grey Scale transformation
-// Ok, it's a little wild to do it here... should be done in Translate.cpp,..
-void vncBuffer::GreyScaleRect(rfb::Rect &rect)
-{
-	bool fCanReduceColors = true;
-    fCanReduceColors = (((m_scrinfo.format.redMax ^ m_scrinfo.format.blueMax ^ 
-                        m_scrinfo.format.greenMax ^ 0xff) == 0)  && m_fGreyPalette);
-#if 0
-    //JK 26th Jan, 2005: Color conversion to 8 shades of gray added,
-	//at the moment only works if server has 24/32-bit color
-	if ((m_scrinfo.format.redMax == 255) 
-		&& 
-		(m_scrinfo.format.blueMax == 255)
-		&&
-		(m_scrinfo.format.greenMax == 255)
-		&&
-		m_fGreyPalette
-		)
-		fCanReduceColors = true;
-	else
-		fCanReduceColors = false;
-	//End JK
-#endif
-	if (!fCanReduceColors) return;
-	if (!FastCheckMainbuffer())
-		return;
-	///////////
-	rect.tl.y = (rect.tl.y - (rect.tl.y % m_nScale));
-	rect.br.y = (rect.br.y - (rect.br.y % m_nScale)) + m_nScale - 1;
-	rect.tl.x = (rect.tl.x - (rect.tl.x % m_nScale));
-	rect.br.x = (rect.br.x - (rect.br.x % m_nScale)) + m_nScale - 1;
-
-	rfb::Rect ScaledRect;
-	ScaledRect.tl.y = rect.tl.y / m_nScale;
-	ScaledRect.br.y = rect.br.y / m_nScale;
-	ScaledRect.tl.x = rect.tl.x / m_nScale;
-	ScaledRect.br.x = rect.br.x / m_nScale;
-
-	// Copy and scale data from screen Main buffer to Scaled buffer
-	BYTE *pMain   =	m_mainbuff + (rect.tl.y * m_bytesPerRow) + 
-					(rect.tl.x * m_scrinfo.format.bitsPerPixel / 8);
-	BYTE *pScaled = m_ScaledBuff + (ScaledRect.tl.y * m_bytesPerRow) +
-					(ScaledRect.tl.x * m_scrinfo.format.bitsPerPixel / 8);
-	
-	UINT nBytesPerPixel = (m_scrinfo.format.bitsPerPixel / 8);
-
-	unsigned long lRed;
-	unsigned long lGreen;
-	unsigned long lBlue;
-	unsigned long lPixel;
-
-		for (int y = ScaledRect.tl.y; y < ScaledRect.br.y; y++)
-		{
-			for (int x = 0; x < (ScaledRect.br.x - ScaledRect.tl.x); x++)
-			{
-				lPixel = 0;
-			for (UINT b = 0; b < nBytesPerPixel; b++)
-				lPixel += ((pMain[(x * nBytesPerPixel) + b]) << (8 * b));
-
-			lRed   = (lPixel >> m_scrinfo.format.redShift) & m_scrinfo.format.redMax;
-			lGreen = (lPixel >> m_scrinfo.format.greenShift) & m_scrinfo.format.greenMax;
-			lBlue  = (lPixel >> m_scrinfo.format.blueShift) & m_scrinfo.format.blueMax;
-			lPixel = To8GreyColors(lRed, lGreen, lBlue);
-			
-			for (UINT bb = 0; bb < nBytesPerPixel; bb++)
-				pScaled[(x * nBytesPerPixel) + bb] = (lPixel >> (8 * bb)) & 0xFF;
-			}
-			// Move the buffers' pointers to their next "line"
-			pMain   += (m_bytesPerRow * m_nScale); // Skip m_nScale lines of the mainbuffer's Rect
-			pScaled += m_bytesPerRow;
-		}
-}
-
-void vncBuffer::WriteMessageOnScreen(char* tt)
-{
-	m_desktop->WriteMessageOnScreen(tt,m_mainbuff, m_backbuffsize);
-}
-
-void
-vncBuffer::GrabRect(const rfb::Rect &rect,BOOL driver,BOOL capture)
-{
-	//no lock needed
-	if (!FastCheckMainbuffer()) return;
-
-	if (!driver) m_desktop->CaptureScreen(rect, m_mainbuff, m_backbuffsize,capture);
-
-	// Modif sf at 2002 - Scaling
-	// Only use scaledbuffer if necessary !
-	rfb::Rect TheRect = rect;
-	// if (m_nScale > 1) ScaleRect(rfb::Rect(rect.tl.x, rect.tl.y, rect.br.x, rect.br.y)); // sf at 2002 - Waste of time !!!
-	// Problem, driver buffer is not writable
-	// so we always need a m_scalednuff
-	/*if (m_nScale > 1) 
-		ScaleRect(TheRect);
-	else if (m_fGreyPalette)
-		GreyScaleRect(TheRect);*/
-	if (m_fGreyPalette)GreyScaleRect(TheRect);
-	else ScaleRect(TheRect);
-
-}
-
-
-void
-vncBuffer::CopyRect(const rfb::Rect &dest, const rfb::Point &delta)
-{
-	rfb::Rect ScaledDest;
-	rfb::Rect ScaledSource;
-
-	rfb::Rect src = dest.translate(delta.negate());
-
-	// Modif sf at 2002 - Scaling
-	ScaledDest.tl.y = dest.tl.y / m_nScale;
-	ScaledDest.br.y = dest.br.y / m_nScale;
-	ScaledDest.tl.x = dest.tl.x / m_nScale;
-	ScaledDest.br.x = dest.br.x / m_nScale;
-	ScaledSource.tl.y = src.tl.y / m_nScale;
-	ScaledSource.br.y = src.br.y / m_nScale;
-	ScaledSource.tl.x = src.tl.x / m_nScale;
-	ScaledSource.br.x = src.br.x / m_nScale;
-
-	ClearCacheRect(ScaledSource);
-	ClearCacheRect(ScaledDest);
-
-
-	// Copy the data from one part of the back-buffer to another!
-	const UINT bytesPerPixel = m_scrinfo.format.bitsPerPixel / 8;
-	const UINT bytesPerLine = (ScaledDest.br.x - ScaledDest.tl.x) * bytesPerPixel;
-	BYTE *srcptr = m_backbuff + (ScaledSource.tl.y * m_bytesPerRow) +
-					(ScaledSource.tl.x * bytesPerPixel);
-
-	BYTE *destptr = m_backbuff + (ScaledDest.tl.y * m_bytesPerRow) +
-					(ScaledDest.tl.x * bytesPerPixel);
-	// Copy the data around in the right order
-	if (ScaledDest.tl.y < ScaledSource.tl.y)
-	{
-		for (int y = ScaledDest.tl.y; y < ScaledDest.br.y; y++)
-		{
-			memmove(destptr, srcptr, bytesPerLine);
-			srcptr += m_bytesPerRow;
-			destptr += m_bytesPerRow;
-		}
-	}
-	else
-	{
-		srcptr += (m_bytesPerRow * ((ScaledDest.br.y - ScaledDest.tl.y)-1));
-		destptr += (m_bytesPerRow * ((ScaledDest.br.y - ScaledDest.tl.y)-1));
-		for (int y = ScaledDest.br.y; y > ScaledDest.tl.y; y--)
-		{
-			memmove(destptr, srcptr, bytesPerLine);
-			srcptr -= m_bytesPerRow;
-			destptr -= m_bytesPerRow;
-		}
-	}
-}
-
-
-void
-vncBuffer::ClearCache()
-{
-	m_cursor_shape_cleared=TRUE;
-	if (m_use_cache && m_cachebuff)
-	{
-	RECT dest;
-	dest.left=0;
-	dest.top=0;
-	dest.right=m_scrinfo.framebufferWidth;
-	dest.bottom=m_scrinfo.framebufferHeight;
-	// Modif sf at 2002 - v1.1.0 - Scramble the cache
-	int nValue = 0;
-	BYTE *cacheptr = m_cachebuff + (dest.top * m_bytesPerRow) +
-		(dest.left * m_scrinfo.format.bitsPerPixel/8);
-
-	const UINT bytesPerLine = (dest.right-dest.left)*(m_scrinfo.format.bitsPerPixel/8);
-
-		for (int y=dest.top; y < dest.bottom; y++)
-		{
-			memset(cacheptr, nValue++, bytesPerLine);
-			cacheptr+=m_bytesPerRow;
-			if (nValue == 255) nValue = 0; 
-		}
-	}
-}
-
-void
-vncBuffer::ClearCacheRect(const rfb::Rect &dest)
-{
-	if (m_use_cache && m_cachebuff)
-	{
-	int nValue = 0;
-	BYTE *cacheptr = m_cachebuff + (dest.tl.y * m_bytesPerRow) +
-		(dest.tl.x * m_scrinfo.format.bitsPerPixel/8);
-
-	const UINT bytesPerLine = (dest.br.x-dest.tl.x)*(m_scrinfo.format.bitsPerPixel/8);
-
-		for (int y=dest.tl.y; y < dest.br.y; y++)
-		{
-			memset(cacheptr, nValue++, bytesPerLine);
-			cacheptr+=m_bytesPerRow;
-			if (nValue == 255) nValue = 0; 
-		}
-	}
-}
-
-void
-vncBuffer::ClearBack()
-{
-	if (m_mainbuff) memcpy(m_backbuff, m_mainbuff, m_desktop->ScreenBuffSize());
-}
-
-//***************************
-// This is used on SW switch
-// if backbuffer is not cleared
-// the checker marks the rects
-// as already send
-//***************************
-void
-vncBuffer::BlackBack()
-{
-	RECT dest;
-	dest.left=0;
-	dest.top=0;
-	dest.right=m_scrinfo.framebufferWidth;
-	dest.bottom=m_scrinfo.framebufferHeight;
-	int nValue = 1;
-	BYTE *backptr = m_backbuff + (dest.top * m_bytesPerRow) +
-		(dest.left * m_scrinfo.format.bitsPerPixel/8);
-
-	const UINT bytesPerLine = (dest.right-dest.left)*(m_scrinfo.format.bitsPerPixel/8);
-
-		for (int y=dest.top; y < dest.bottom; y++)
-		{
-			memset(backptr, nValue, bytesPerLine);
-			backptr+=m_bytesPerRow;
-			if (nValue == 255) nValue = 0; 
-		}
-}
-
-void
-vncBuffer::GrabMouse()
-{
-	//no lock needed
-	if (!FastCheckMainbuffer()) return;
-	m_desktop->CaptureMouse(m_mainbuff, m_backbuffsize);
-
-	// Modif sf at 2002 - Scaling
-	rfb::Rect rect = m_desktop->MouseRect();
-	
-	// Problem, driver buffer is not writable
-		// so we always need a m_scalednuff
-	/*if (m_nScale > 1) */
-		ScaleRect(rect);
-}
-
-void
-vncBuffer::GetMousePos(rfb::Rect &rect)
-{
-	rect = m_desktop->MouseRect();
-}
-
-// Verify that the fast blit buffer hasn't changed
-inline BOOL
-vncBuffer::FastCheckMainbuffer() {
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	VOID *tmp = m_desktop->OptimisedBlitBuffer();
-	if (tmp && (m_mainbuff != tmp))
-		{
-//			omni_mutex_lock l(m_desktop->m_videodriver_lock2);
-			BOOL result=CheckBuffer();
-			return result;
-		}
-	return TRUE;
-}
-
-
-// sf at 2005
-void vncBuffer::EnableGreyPalette(BOOL enable)
-{
-	m_fGreyPalette = enable;
-}
-
-// RDV
-void
-vncBuffer::EnableCache(BOOL enable)
-{
-	m_use_cache = enable;
-	if (m_use_cache)
-	{
-		if (m_cachebuff != NULL)
-		{
-			delete [] m_cachebuff;
-			m_cachebuff = NULL;
-		}
-		if ((m_cachebuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]\n"), m_desktop->ScreenBuffSize());
-			return;
-		}
-		ClearCache();
-		// BlackBack();
-	}
-	/*else
-	{
-		if (m_cachebuff != NULL)
-		{
-			delete [] m_cachebuff;
-			m_cachebuff = NULL;
-		}
-	}*/
-}
-
-BOOL
-vncBuffer::IsCacheEnabled()
-{
-	return m_use_cache;
-}
-
-BOOL
-vncBuffer::IsShapeCleared()
-{
-	BOOL value=m_cursor_shape_cleared;
-	m_cursor_shape_cleared=FALSE;
-	return value;
-}
-
-void
-vncBuffer::MultiMonitors(int number)
-{
-	if (number==1) {m_single_monitor=true;m_multi_monitor=false;}
-	if (number==2) {m_single_monitor=false;m_multi_monitor=true;}
-}
-
-bool
-vncBuffer::IsMultiMonitor()
-{
-	if (m_single_monitor) return false;//we need at least 1 display
-	else return true;
-}
-
-
-					   
-bool
-vncBuffer::ClipRect(int *x, int *y, int *w, int *h,
-	    int cx, int cy, int cw, int ch) {
-  if (*x < cx) {
-    *w -= (cx-*x);
-    *x = cx;
-  }
-  if (*y < cy) {
-    *h -= (cy-*y);
-    *y = cy;
-  }
-  if (*x+*w > cx+cw) {
-    *w = (cx+cw)-*x;
-  }
-  if (*y+*h > cy+ch) {
-    *h = (cy+ch)-*y;
-  }
-  return (*w>0) && (*h>0);
-}
diff --git a/ica/win32/winvnc/winvnc/vncbuffer.h b/ica/win32/winvnc/winvnc/vncbuffer.h
deleted file mode 100644
index f2cd7c8..0000000
--- a/ica/win32/winvnc/winvnc/vncbuffer.h
+++ /dev/null
@@ -1,158 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at 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 vncDesktop;
-
-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"
-#include "vncmemcpy.h"
-
-// Class definition
-
-class vncBuffer
-{
-// Methods
-public:
-	// Create/Destroy methods
-	vncBuffer();
-	~vncBuffer();
-
-	BOOL 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,rfb::Region2D &cache, const rfb::Region2D &src);
-	void CheckRect(rfb::Region2D &dest,rfb::Region2D &cache, const rfb::Rect &src);
-
-	// SCREEN CAPTURE
-	void CopyRect(const rfb::Rect &dest, const rfb::Point &delta);
-	void GrabMouse();
-	void GrabRegion(rfb::Region2D &src,BOOL driver,BOOL capture);
-	void GetMousePos(rfb::Rect &rect);
-
-	// CACHE RDV
-	void ClearCache();
-	void ClearCacheRect(const rfb::Rect &dest);
-	void ClearBack();
-	void BlackBack();
-	void EnableCache(BOOL enable);
-	BOOL IsCacheEnabled();
-	BOOL IsShapeCleared();
-	void MultiMonitors(int number);
-	bool  IsMultiMonitor();
-	void WriteMessageOnScreen(char*);
-
-	// sf at 2005 - Grey Palette
-	void EnableGreyPalette(BOOL enable);
-
-	// Modif sf at 2002 - Scaling
-	void ScaleRect(rfb::Rect &rect);
-	void GreyScaleRect(rfb::Rect &rect);
-	rfb::Rect GetViewerSize();
-	UINT GetScale();
-	BOOL SetScale(int scale);
-
-	// Modif sf at 2002 - Optim
-	BOOL SetAccuracy(int accuracy);
-
-	// CURSOR HANDLING
-	BOOL IsCursorUpdatePending(){return m_cursorpending;};
-	void SetCursorPending(BOOL enable){m_cursorpending=enable;};
-
-	bool ClipRect(int *x, int *y, int *w, int *h, int cx, int cy, int cw, int ch);
-
-// 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,BOOL driver,BOOL capture);
-
-	BOOL		m_freemainbuff;
-
-	UINT		m_bytesPerRow;
-
-	// CACHE RDV
-	BOOL			m_use_cache;
-	BOOL			m_single_monitor;
-	BOOL			m_multi_monitor;
-
-	// Modif sf at 2002 - Scaling
-	int			m_ScaledSize;
-	UINT		m_nScale;
-	BYTE		*m_ScaledBuff;
-
-	int			m_nAccuracyDiv; // Accuracy divider for changes detection in Rects
-	int			nRowIndex;
-
-	// CURSOR HANDLING
-	BOOL			m_cursorpending;
-
-public:
-	rfbServerInitMsg	m_scrinfo;
-	// vncEncodeMgr reads data from back buffer directly when encoding
-	BYTE		*m_backbuff;
-	int			m_backbuffsize;
-	// CACHE RDV
-	BYTE		*m_cachebuff;
-	BYTE		*m_mainbuff;
-	vncDesktop	*m_desktop;
-//	Ultravncmemcpy mem;
-	BOOL			m_cursor_shape_cleared;
-
-	// sf at 2005 - Grey palette
-	BOOL m_fGreyPalette;
-	bool m_videodriverused;
-	void VideDriverUsed(bool enabled);
-	bool VideDriverUsed();
-};
-
-#endif // _WINVNC_VNCBUFFER
diff --git a/ica/win32/winvnc/winvnc/vncclient.cpp b/ica/win32/winvnc/winvnc/vncclient.cpp
deleted file mode 100644
index a8aee9a..0000000
--- a/ica/win32/winvnc/winvnc/vncclient.cpp
+++ /dev/null
@@ -1,6099 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncClient.cpp
-
-// The per-client object.  This object takes care of all per-client stuff,
-// such as socket input and buffering of updates.
-
-// 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.
-
-// Includes
-#include "stdhdrs.h"
-#include <omnithread.h>
-#include <string>
-#include <sstream>
-#include "resource.h"
-
-// Custom
-#include "vncserver.h"
-#include "vncclient.h"
-#include "vsocket.h"
-#include "vncdesktop.h"
-#include "rfbRegion.h"
-#include "vncbuffer.h"
-#include "vncservice.h"
-#include "vncpasswd.h"
-#include "vncacceptdialog.h"
-#include "vnckeymap.h"
-#include "vncmenu.h"
-
-#include "rfb/dh.h"
-#include "vncauth.h"
-
-#ifdef IPP
-#include "..\..\ipp_zlib\src\zlib\zlib.h"
-#else
-#include "zlib.h"
-#endif
-#include "mmsystem.h" // sf at 2002
-#include "sys/types.h"
-#include "sys/stat.h"
-
-#include <string>
-#include <iterator>
-#include <shlobj.h>
-#include "vncOSVersion.h"
-#include "common/win32_helpers.h"
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-extern BOOL ultravnc_italc_load_int( LPCSTR valname, LONG *out );
-extern BOOL ultravnc_italc_ask_permission( const char *username, const char *host );
-#endif
-
-bool isDirectoryTransfer(const char *szFileName);
-extern BOOL SPECIAL_SC_PROMPT;
-extern BOOL SPECIAL_SC_EXIT;
-int getinfo(char mytext[1024]);
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-// take a full path & file name, split it, prepend prefix to filename, then merge it back
-static std::string make_temp_filename(const char *szFullPath)
-{
-    // don't add prefix for directory transfers.
-    if (isDirectoryTransfer(szFullPath))
-        return szFullPath;
-        
-    std::string tmpName(szFullPath);
-    std::string::size_type pos = tmpName.rfind('\\');
-    if (pos != std::string::npos)
-        tmpName.insert(pos + 1, rfbPartialFilePrefix);
-
-    return tmpName;
-}
-#endif
-
-std::string get_real_filename(std::string name)
-{
-    std::string::size_type pos;
-
-    pos = name.find(rfbPartialFilePrefix);
-    if (pos != std::string::npos)
-        name.erase(pos, sz_rfbPartialFilePrefix);
- 
-    return name;
-}
-
-
-// #include "rfb.h"
-bool DeleteFileOrDirectory(TCHAR *srcpath)
-{
-    TCHAR path[MAX_PATH + 1]; // room for extra null; SHFileOperation requires double null terminator
-    memset(path, 0, sizeof path);
-    
-    _tcsncpy(path, srcpath, MAX_PATH);
-
-    SHFILEOPSTRUCT op;
-    memset(&op, 0, sizeof(SHFILEOPSTRUCT));
-    op.wFunc = FO_DELETE;
-    op.pFrom  = path;
-    op.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
-    
-    int result = SHFileOperation(&op);
-    // MSDN says to not look at the error code, just treat 0 as SUCCESS, nonzero is failure.
-    // Do not use GetLastError with the return values of this function.
-
-    return result == 0;
-}
-
-bool replaceFile(const char *src, const char *dst)
-{
-    DWORD dwFileAttribs;
-    bool status;
-    
-    dwFileAttribs = GetFileAttributes(dst);
-    // make the file read/write if it's read only.
-    if (dwFileAttribs != INVALID_FILE_ATTRIBUTES && dwFileAttribs & FILE_ATTRIBUTE_READONLY)
-        SetFileAttributes(dst, dwFileAttribs & ~FILE_ATTRIBUTE_READONLY);
-
-    if (OSversion() == 3)
-    {
-        status = ::CopyFile(src, dst, false) ? true : false;
-        if (status)
-            ::DeleteFile(src);
-    }
-    else
-        status = ::MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? true : false;
-
-    // restore orginal file attributes, if we have them. We won't have them if
-    // the destination file didn't exist prior to the copy/move.
-    if (dwFileAttribs != INVALID_FILE_ATTRIBUTES)
-        SetFileAttributes(dst, dwFileAttribs);
-
-    return status;
-}
-#include "Localization.h" // Act : add localization on messages
-typedef BOOL (WINAPI *PGETDISKFREESPACEEX)(LPCSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
-
-DWORD GetExplorerLogonPid();
-unsigned long updates_sent;
-
-// vncClient update thread class
-
-//	[v1.0.2-jp1 fix]
-//	yak!'s File transfer patch
-//	Simply forward strchr() and strrchr() to _mbschr() and _mbsrchr() to avoid 0x5c problem, respectively.
-//	Probably, it is better to write forward functions internally.
-#include <mbstring.h>
-#define strchr(a, b) reinterpret_cast<char*>(_mbschr(reinterpret_cast<unsigned char*>(a), b))
-#define strrchr(a, b) reinterpret_cast<char*>(_mbsrchr(reinterpret_cast<unsigned char*>(a), b))
-
-
-// 31 January 2008 jdp
-std::string AddDirPrefixAndSuffix(const char *name)
-{
-    std::string dirname(rfbDirPrefix);
-    dirname += name;
-    dirname += rfbDirSuffix;
-
-    return dirname;
-}
-
-bool isDirectory(const char *name)
-{
-    struct _stat statbuf;
-
-    _stat(name, &statbuf);
-    return (statbuf.st_mode & _S_IFDIR) == _S_IFDIR;
-}
-bool isDirectoryTransfer(const char *szFileName)
-{
-    return (strncmp(strrchr(const_cast<char*>(szFileName), '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix)) == 0);
-}
-
-void GetZippedFolderPathName(const char *szZipFile, char *path)
-{
-    // input lookes like: "c:\temp\!UVNCDIR-folder.zip"
-    // output should look like "c:\temp\folder"
-
-    const char *zip_ext = ".zip";
-    std::string folder_path(szZipFile);
-    std::string::size_type pos;
-
-    // remove "!UVNCDIR-"
-    pos = folder_path.find(rfbZipDirectoryPrefix);
-    if (pos != std::string::npos)
-        folder_path.replace(pos, strlen(rfbZipDirectoryPrefix),"");
-
-    // remove ".zip"
-    pos = folder_path.rfind(zip_ext);
-    if (pos != std::string::npos)
-        folder_path.replace(pos, strlen(zip_ext), "");
-
-    // remove "[ "
-    pos = folder_path.find(rfbDirPrefix);
-    if (pos != std::string::npos)
-        folder_path.replace(pos, strlen(rfbDirPrefix),"");
-
-    // remove " ]"
-    pos = folder_path.rfind(rfbDirSuffix);
-    if (pos != std::string::npos)
-        folder_path.replace(pos, strlen(rfbDirSuffix),"");
-    
-    std::copy(folder_path.begin(), folder_path.end(), path);
-    path[folder_path.size()] = 0; // terminate the string    
-}
-
-void SplitTransferredFileNameAndDate(char *szFileAndDate, char *filetime)
-{
-    char *p = strrchr(szFileAndDate, ',');
-    if (p == NULL)
-    {
-        if (filetime)
-            *filetime = '\0';
-    }
-    else
-    {
-        if (filetime)
-            strcpy(filetime, p+1);
-        *p = '\0';
-    }
-}
-
-
-/*
- * File transfer event hooks
- *
- * The following functions are called from various points in the file transfer
- * process. They are notification hooks; the hook function cannot affect the
- * file operation. One possible use of these hooks is to implement auditing
- * of file operations on the server side.
- *
- * Note that uploads are transfers from the server to the viewer and a
- * download is a transfer from the viewer to the server.
- *
- * The hook will have to use the state stored in the vncClient object
- * to figure out what was done in most cases. For those cases where it
- * is not possible, the hook is passed enough information about the event.
- *  
- */
-
-// called at the successful start of a file upload
-void vncClient::FTUploadStartHook()
-{
-}
-
-// called when an abort is received from the viewer. it is assumed that it was
-// due to the user cancelling the transfer
-void vncClient::FTUploadCancelledHook()
-{
-}
-
-// Called when an upload fails for any reason: network failure, out of disk space, insufficient privileges etc.
-void vncClient::FTUploadFailureHook()
-{
-}
-
-// Called after the file is successfully uploaded. At this point the file transfer is complete.
-void vncClient::FTUploadCompleteHook()
-{
-}
-
-// called at the successful start of a file download
-void vncClient::FTDownloadStartHook()
-{
-}
-
-// called when an abort is received from the viewer. it is assumed that it was
-// due to the user cancelling the transfer
-void vncClient::FTDownloadCancelledHook()
-{
-}
-
-// Called when an dowload fails for any reason: network failure, out of disk space, insufficient privileges etc.
-void vncClient::FTDownloadFailureHook()
-{
-}
-
-// Called after the file is successfully downloaded. At this point the file transfer is complete.
-void vncClient::FTDownloadCompleteHook()
-{
-}
-
-// Called when a new folder is created.
-void vncClient::FTNewFolderHook(std::string name)
-{
-}
-
-// called when a folder is created
-void vncClient::FTDeleteHook(std::string name, bool isDir)
-{
-}
-
-// called when a file or folder is renamed.
-void vncClient::FTRenameHook(std::string oldName, std::string newname)
-{
-}
-
-
-
-class vncClientUpdateThread : public omni_thread
-{
-public:
-
-	// Init
-	BOOL Init(vncClient *client);
-
-	// Kick the thread to send an update
-	void Trigger();
-
-	// Kill the thread
-	void Kill();
-
-	// Disable/enable updates
-	void EnableUpdates(BOOL enable);
-
-	void get_time_now(unsigned long* abs_sec, unsigned long* abs_nsec);
-
-	// The main thread function
-    virtual void *run_undetached(void *arg);
-
-protected:
-	virtual ~vncClientUpdateThread();
-
-	// Fields
-protected:
-	vncClient *m_client;
-	omni_condition *m_signal;
-	omni_condition *m_sync_sig;
-	BOOL m_active;
-	BOOL m_enable;
-};
-
-// Modif cs at 2005
-#ifdef DSHOW
-class MutexAutoLock 
-{
-public:
-	MutexAutoLock(HANDLE* phMutex) 
-	{ 
-		m_phMutex = phMutex;
-
-		if(WAIT_OBJECT_0 != WaitForSingleObject(*phMutex, INFINITE))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("Could not get access to the mutex\n"));
-		}
-	}
-	~MutexAutoLock() 
-	{ 
-		ReleaseMutex(*m_phMutex);
-	}
-
-	HANDLE* m_phMutex;
-};
-#endif
-
-BOOL
-vncClientUpdateThread::Init(vncClient *client)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("init update thread\n"));
-
-	m_client = client;
-	omni_mutex_lock l(m_client->GetUpdateLock());
-	m_signal = new omni_condition(&m_client->GetUpdateLock());
-	m_sync_sig = new omni_condition(&m_client->GetUpdateLock());
-	m_active = TRUE;
-	m_enable = m_client->m_disable_protocol == 0;
-	if (m_signal && m_sync_sig) {
-		start_undetached();
-		return TRUE;
-	}
-	return FALSE;
-}
-
-vncClientUpdateThread::~vncClientUpdateThread()
-{
-	if (m_signal) delete m_signal;
-	if (m_sync_sig) delete m_sync_sig;
-	vnclog.Print(LL_INTINFO, VNCLOG("update thread gone\n"));
-	m_client->m_updatethread=NULL;
-}
-
-void
-vncClientUpdateThread::Trigger()
-{
-	// ALWAYS lock client UpdateLock before calling this!
-	// Only trigger an update if protocol is enabled
-	if (m_client->m_disable_protocol == 0) {
-		m_signal->signal();
-	}
-}
-
-void
-vncClientUpdateThread::Kill()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("kill update thread\n"));
-
-	omni_mutex_lock l(m_client->GetUpdateLock());
-	m_active=FALSE;
-	m_signal->signal();
-}
-
-
-void
-vncClientUpdateThread::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
-vncClientUpdateThread::EnableUpdates(BOOL enable)
-{
-	// ALWAYS call this with the UpdateLock held!
-	if (enable) {
-		vnclog.Print(LL_INTINFO, VNCLOG("enable update thread\n"));
-	} else {
-		vnclog.Print(LL_INTINFO, VNCLOG("disable update thread\n"));
-	}
-
-	m_enable = enable;
-	m_signal->signal();
-	unsigned long now_sec, now_nsec;
-    get_time_now(&now_sec, &now_nsec);
-	m_sync_sig->wait();
-	/*if  (m_sync_sig->timedwait(now_sec+1,0)==0)
-		{
-//			m_signal->signal();
-			vnclog.Print(LL_INTINFO, VNCLOG("thread timeout\n"));
-		} */
-	vnclog.Print(LL_INTINFO, VNCLOG("enable/disable synced\n"));
-}
-
-void*
-vncClientUpdateThread::run_undetached(void *arg)
-{
-	rfb::SimpleUpdateTracker update;
-	rfb::Region2D clipregion;
-	// adzm - 2010-07 - Extended clipboard
-	//char *clipboard_text = 0;
-	update.enable_copyrect(true);
-	BOOL send_palette = FALSE;
-
-	updates_sent=0;
-
-	vnclog.Print(LL_INTINFO, VNCLOG("starting update thread\n"));
-
-	while (1)
-	{
-//#ifdef _DEBUG
-//										char			szText[256];
-//										sprintf(szText," run_undetached loop \n");
-//										OutputDebugString(szText);		
-//#endif
-		// Block waiting for an update to send
-		{
-			omni_mutex_lock l(m_client->GetUpdateLock());
-			/*#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++ Mutex lock clientupdatethread\n");
-					OutputDebugString(szText);		
-			#endif*/
-
-			m_client->m_incr_rgn.assign_union(clipregion);
-
-			// We block as long as updates are disabled, or the client
-			// isn't interested in them, unless this thread is killed.
-			if (updates_sent < 1) 
-			{
-			while (m_active && (
-						!m_enable || (
-							m_client->m_update_tracker.get_changed_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							m_client->m_update_tracker.get_copied_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							m_client->m_update_tracker.get_cached_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							// adzm - 2010-07 - Extended clipboard
-							!(m_client->m_clipboard.m_bNeedToProvide || m_client->m_clipboard.m_bNeedToNotify) &&
-							!m_client->m_cursor_pos_changed // nyama/marscha - PointerPos
-							)
-						)
-					) {
-				// Issue the synchronisation signal, to tell other threads
-				// where we have got to
-				m_sync_sig->broadcast();
-
-				// Wait to be kicked into action
-				m_signal->wait();
-			}
-			}
-			else
-			{
-				while (m_active && (
-						!m_enable || (
-							m_client->m_update_tracker.get_changed_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							m_client->m_update_tracker.get_copied_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							m_client->m_update_tracker.get_cached_region().intersect(m_client->m_incr_rgn).is_empty() &&
-							!m_client->m_encodemgr.IsCursorUpdatePending() &&
-							// adzm - 2010-07 - Extended clipboard
-							!(m_client->m_clipboard.m_bNeedToProvide || m_client->m_clipboard.m_bNeedToNotify) &&
-							!m_client->m_NewSWUpdateWaiting &&
-							!m_client->m_cursor_pos_changed // nyama/marscha - PointerPos
-							)
-						)
-					) {
-				// Issue the synchronisation signal, to tell other threads
-				// where we have got to
-				m_sync_sig->broadcast();
-
-				// Wait to be kicked into action
-				m_signal->wait();
-			}
-			}
-			// If the thread is being killed then quit
-			if (!m_active) break;
-
-			// SEND AN UPDATE!
-			// The thread is active, updates are enabled, and the
-			// client is expecting an update - let's see if there
-			// is anything to send.
-
-			// Modif sf at 2002 - FileTransfer - Don't send anything if a file transfer is running !
-			// if (m_client->m_fFileTransferRunning) return 0;
-			// if (m_client->m_pTextChat->m_fTextChatRunning) return 0;
-
-			// sf at 2002
-			// New scale requested, we do it before sending the next Update
-			if (m_client->fNewScale)
-			{
-				// Send the new framebuffer size to the client
-				rfb::Rect ViewerSize = m_client->m_encodemgr.m_buffer->GetViewerSize();
-				
-				// Copyright (C) 2001 - Harakan software
-				if (m_client->m_fPalmVNCScaling)
-				{
-					rfb::Rect ScreenSize = m_client->m_encodemgr.m_buffer->GetSize();
-					rfbPalmVNCReSizeFrameBufferMsg rsfb;
-					rsfb.type = rfbPalmVNCReSizeFrameBuffer;
-					rsfb.desktop_w = Swap16IfLE(ScreenSize.br.x);
-					rsfb.desktop_h = Swap16IfLE(ScreenSize.br.y);
-					rsfb.buffer_w = Swap16IfLE(ViewerSize.br.x);
-					rsfb.buffer_h = Swap16IfLE(ViewerSize.br.y);
-					m_client->m_socket->SendExact((char*)&rsfb,
-													sz_rfbPalmVNCReSizeFrameBufferMsg,
-													rfbPalmVNCReSizeFrameBuffer);
-				}
-				else // eSVNC-UltraVNC Scaling
-				{
-					rfbResizeFrameBufferMsg rsmsg;
-					rsmsg.type = rfbResizeFrameBuffer;
-					rsmsg.framebufferWidth  = Swap16IfLE(ViewerSize.br.x);
-					rsmsg.framebufferHeigth = Swap16IfLE(ViewerSize.br.y);
-					m_client->m_socket->SendExact((char*)&rsmsg,
-													sz_rfbResizeFrameBufferMsg,
-													rfbResizeFrameBuffer);
-					m_client->m_ScaledScreen = m_client->m_encodemgr.m_buffer->GetViewerSize();
-					m_client->m_nScale = m_client->m_encodemgr.m_buffer->GetScale();
-				}
-
-				m_client->m_encodemgr.m_buffer->ClearCache();
-				m_client->fNewScale = false;
-				m_client->m_fPalmVNCScaling = false;
-
-				// return 0;
-			}
-
-			// Has the palette changed?
-			send_palette = m_client->m_palettechanged;
-			m_client->m_palettechanged = FALSE;
-
-			// Fetch the incremental region
-			clipregion = m_client->m_incr_rgn;
-			//m_client->m_incr_rgn.clear();
-
-			// Get the clipboard data, if any
-			// adzm - 2010-07 - Extended clipboard
-			if (!(m_client->m_clipboard.m_bNeedToProvide || m_client->m_clipboard.m_bNeedToNotify))
-			{
-				m_client->m_incr_rgn.clear();
-			}
-		
-			// Get the update details from the update tracker
-			m_client->m_update_tracker.flush_update(update, clipregion);
-
-		//if (!m_client->m_encodemgr.m_buffer->m_desktop->IsVideoDriverEnabled())
-		//TEST if (!m_client->m_encodemgr.m_buffer->m_desktop->m_hookdriver)
-		{
-			// Render the mouse if required
-
-		if (updates_sent > 1 ) m_client->m_cursor_update_pending = m_client->m_encodemgr.WasCursorUpdatePending();
-		updates_sent++;
-
-		if (!m_client->m_cursor_update_sent && !m_client->m_cursor_update_pending) 
-			{
-				if (m_client->m_mousemoved)
-				{
-					// Re-render its old location
-					m_client->m_oldmousepos =
-						m_client->m_oldmousepos.intersect(m_client->m_ScaledScreen); // sf at 2002
-					if (!m_client->m_oldmousepos.is_empty())
-						update.add_changed(m_client->m_oldmousepos);
-
-					// And render its new one
-					m_client->m_encodemgr.m_buffer->GetMousePos(m_client->m_oldmousepos);
-					m_client->m_oldmousepos =
-						m_client->m_oldmousepos.intersect(m_client->m_ScaledScreen);
-					if (!m_client->m_oldmousepos.is_empty())
-						update.add_changed(m_client->m_oldmousepos);
-	
-					m_client->m_mousemoved = FALSE;
-				}
-			}
-		}
-
-		// SEND THE CLIPBOARD
-		// If there is clipboard text to be sent then send it
-		// Also allow in loopbackmode
-		// Loopback mode with winvncviewer will cause a loping
-		// But ssh is back working		
-		if (!m_client->m_fFileSessionOpen) {
-
-			bool bShouldFlush = false;
-
-			// adzm - 2010-07 - Extended clipboard
-			// send any clipboard data that should be sent automatically
-			if (m_client->m_clipboard.m_bNeedToProvide) {
-				m_client->m_clipboard.m_bNeedToProvide = false;
-				if (m_client->m_clipboard.settings.m_bSupportsEx) {
-					
-					int actualLen = m_client->m_clipboard.extendedClipboardDataMessage.GetDataLength();
-
-					rfbServerCutTextMsg message;
-					memset(&message, 0, sizeof(rfbServerCutTextMsg));
-					message.type = rfbServerCutText;
-
-					message.length = Swap32IfLE(-actualLen);
-
-					bShouldFlush = true;
-
-					//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-					if (!m_client->SendRFBMsgQueue(rfbServerCutText,
-						(BYTE *) &message, sizeof(message))) {
-						m_client->m_socket->Close();
-					}
-					if (!m_client->m_socket->SendExactQueue((char*)(m_client->m_clipboard.extendedClipboardDataMessage.GetData()), m_client->m_clipboard.extendedClipboardDataMessage.GetDataLength()))
-					{
-						m_client->m_socket->Close();
-					}
-				} else {
-					rfbServerCutTextMsg message;
-
-					const char* cliptext = m_client->m_clipboard.m_strLastCutText.c_str();
-					char* unixtext = new char[m_client->m_clipboard.m_strLastCutText.length() + 1];
-					
-					// Replace CR-LF with LF - never send CR-LF on the wire,
-					// since Unix won't like it
-					int unixpos=0;
-					int cliplen=strlen(cliptext);
-					for (int x=0; x<cliplen; x++)
-					{
-						if (cliptext[x] != '\x0d')
-						{
-							unixtext[unixpos] = cliptext[x];
-							unixpos++;
-						}
-					}
-					unixtext[unixpos] = 0;
-
-					message.length = Swap32IfLE(strlen(unixtext));
-
-					bShouldFlush = true;
-
-					//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-					if (!m_client->SendRFBMsgQueue(rfbServerCutText,
-						(BYTE *) &message, sizeof(message))) {
-						m_client->m_socket->Close();
-					}
-					if (!m_client->m_socket->SendExactQueue(unixtext, strlen(unixtext)))
-					{
-						m_client->m_socket->Close();
-					}
-
-					delete[] unixtext;
-				}
-				m_client->m_clipboard.extendedClipboardDataMessage.Reset();
-			}
-			
-			// adzm - 2010-07 - Extended clipboard
-			// notify of any other formats
-			if (m_client->m_clipboard.m_bNeedToNotify) {
-				m_client->m_clipboard.m_bNeedToNotify = false;
-				if (m_client->m_clipboard.settings.m_bSupportsEx) {
-					
-					int actualLen = m_client->m_clipboard.extendedClipboardDataNotifyMessage.GetDataLength();
-
-					rfbServerCutTextMsg message;
-					memset(&message, 0, sizeof(rfbServerCutTextMsg));
-					message.type = rfbServerCutText;
-
-					message.length = Swap32IfLE(-actualLen);
-
-					//adzm 2010-09 - minimize packets. SendExact flushes the queue.Queue
-
-					bShouldFlush = true;
-
-					if (!m_client->SendRFBMsgQueue(rfbServerCutText,
-						(BYTE *) &message, sizeof(message))) {
-						m_client->m_socket->Close();
-					}
-					if (!m_client->m_socket->SendExact((char*)(m_client->m_clipboard.extendedClipboardDataNotifyMessage.GetData()), m_client->m_clipboard.extendedClipboardDataNotifyMessage.GetDataLength()))
-					{
-						m_client->m_socket->Close();
-					}
-				}
-				m_client->m_clipboard.extendedClipboardDataNotifyMessage.Reset();
-			}
-
-			if (bShouldFlush) {
-				m_client->m_socket->ClearQueue();
-			}
-		}
-
-		// SEND AN UPDATE
-		// We do this without holding locks, to avoid network problems
-		// stalling the server.
-
-		// Update the client palette if necessary
-
-		if (send_palette) {
-			m_client->SendPalette();
-		}
-
-		//add extra check to avoid buffer/encoder sync problems
-		if ((m_client->m_encodemgr.m_scrinfo.framebufferHeight == m_client->m_encodemgr.m_buffer->m_scrinfo.framebufferHeight) &&
-			(m_client->m_encodemgr.m_scrinfo.framebufferWidth == m_client->m_encodemgr.m_buffer->m_scrinfo.framebufferWidth) &&
-			(m_client->m_encodemgr.m_scrinfo.format.bitsPerPixel == m_client->m_encodemgr.m_buffer->m_scrinfo.format.bitsPerPixel))
-		{
-
-			// Send updates to the client - this implicitly clears
-			// the supplied update tracker
-			if (m_client->SendUpdate(update)) {
-				updates_sent++;
-				clipregion.clear();
-			}
-		}
-		else
-		{
-			clipregion.clear();
-		}
-
-			/*#ifdef _DEBUG
-//					char			szText[256];
-					sprintf(szText," ++++++ Mutex unlock clientupdatethread\n");
-					OutputDebugString(szText);		
-			#endif*/
-		}
-
-		yield();
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("stopping update thread\n"));
-	
-	vnclog.Print(LL_INTERR, "client sent %lu updates\n", updates_sent);
-	return 0;
-}
-
-vncClientThread::~vncClientThread()
-{
-	if (m_client != NULL)
-		delete m_client;
-}
-
-BOOL
-vncClientThread::Init(vncClient *client, vncServer *server, VSocket *socket, BOOL auth, BOOL shared)
-{
-	// Save the server pointer and window handle
-	m_server = server;
-	m_socket = socket;
-	m_client = client;
-	m_auth = auth;
-	m_shared = shared;
-	m_autoreconnectcounter_quit=false;
-	m_client->m_Autoreconnect=m_server->AutoReconnect();
-	m_server->AutoReconnect(false);
-
-	m_AutoReconnectPort=m_server->AutoReconnectPort();
-	strcpy(m_szAutoReconnectAdr,m_server->AutoReconnectAdr());
-	strcpy(m_szAutoReconnectId,m_server->AutoReconnectId());
-	// Start the thread
-	start();
-
-	return TRUE;
-}
-
-BOOL
-vncClientThread::InitVersion()
-{
-	// adzm 2010-09
-	m_major = 0;
-	m_minor = 0;
-
-	rfbProtocolVersionMsg protocol_ver;
-	protocol_ver[12] = 0;
-	if (strcmp(m_client->ProtocolVersionMsg,"0.0.0.0")==0)
-	{
-		// Generate the server's protocol version
-		// RDV 2010-6-10 
-		// removed SPECIAL_SC_PROMPT
-		rfbProtocolVersionMsg protocolMsg;		
-		sprintf((char *)protocolMsg,
-					rfbProtocolVersionFormat,
-					rfbProtocolMajorVersion,
-					rfbProtocolMinorVersion);
-		// adzm 2010-08
-		bool bRetry = true;
-		bool bReady = false;
-		int nRetry = 0;
-		while (!bReady && bRetry) {
-			// RDV 2010-6-10 
-			// removed SPECIAL_SC_PROMPT
-
-			// Send our protocol version, and get the client's protocol version
-			if (!m_socket->SendExact((char *)&protocolMsg, sz_rfbProtocolVersionMsg) || 
-				!m_socket->ReadExact((char *)&protocol_ver, sz_rfbProtocolVersionMsg)) {
-				bReady = false;
-				// we need to reconnect!
-				
-				Sleep(min(nRetry * 1000, 30000));
-
-				if (TryReconnect()) {
-					// reconnect if in SC mode and not already using AutoReconnect
-					bRetry = true;
-					nRetry++;
-				} else {
-					bRetry = false;
-				}
-			} else {
-				bReady = true;
-			}
-		}
-
-		if (!bReady) {
-			return FALSE;
-		}
-	}
-	else 
-		memcpy(protocol_ver,m_client->ProtocolVersionMsg, sz_rfbProtocolVersionMsg);
-
-	// sf at 2006 - Trying to fix neverending authentication bug - Check if this is RFB protocole
-	if (strncmp(protocol_ver,"RFB", 3)!=0)
-		return FALSE;
-
-	// Check viewer's the protocol version
-	sscanf((char *)&protocol_ver, rfbProtocolVersionFormat, &m_major, &m_minor);
-	if (m_major != rfbProtocolMajorVersion)
-		return FALSE;
-
-	m_ms_logon = m_server->MSLogonRequired();
-	vnclog.Print(LL_INTINFO, VNCLOG("m_ms_logon set to %s"), m_ms_logon ? "true" : "false");
-
-	// adzm 2010-09 - see rfbproto.h for more discussion on all this
-	m_client->SetUltraViewer(false); // sf at 2005 - Fix Open TextChat from server bug 
-	// UltraViewer will be set when viewer responds with rfbUltraVNC Auth type
-	// RDV 2010-6-10 
-	// removed SPECIAL_SC_PROMPT
-	
-	if ( (m_minor >= 7) && m_socket->IsUsePluginEnabled() && m_server->GetDSMPluginPointer()->IsEnabled() && m_socket->GetIntegratedPlugin() != NULL) {
-		m_socket->SetPluginStreamingIn();
-		m_socket->SetPluginStreamingOut();
-	}
-
-	return TRUE;
-}
-
-// RDV 2010-4-10
-// Ask user Permission Accept/Reject
-// Interactive, destop depended
-BOOL
-vncClientThread::FilterClients_Ask_Permission()
-{
-	// Verify the peer host name against the AuthHosts string
-	vncServer::AcceptQueryReject verified;
-	if (m_auth) {
-		verified = vncServer::aqrAccept;
-	} else {
-		verified = m_server->VerifyHost(m_socket->GetPeerName());
-	}
-	
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	// If necessary, query the connection with a timed dialog
-	char username[UNLEN+1];
-	if (!vncService::CurrentUser(username, sizeof(username))) return false;
-	if ((strcmp(username, "") != 0) || m_server->QueryIfNoLogon()) // marscha at 2006 - Is AcceptDialog required even if no user is logged on
-    {
-		if (verified == vncServer::aqrQuery) {
-            // 10 Dec 2008 jdp reject/accept all incoming connections if the workstation is locked
-            if (vncService::IsWSLocked() && !m_server->QueryIfNoLogon()) {
-                verified = m_server->QueryAccept() == 1 ? vncServer::aqrAccept : vncServer::aqrReject;
-            } else {
-
-			vncAcceptDialog *acceptDlg = new vncAcceptDialog(m_server->QueryTimeout(),m_server->QueryAccept(), m_socket->GetPeerName());
-	
-			if (acceptDlg == NULL) 
-				{
-					if (m_server->QueryAccept()==1) 
-					{
-						verified = vncServer::aqrAccept;
-					}
-					else 
-					{
-						verified = vncServer::aqrReject;
-					}
-				}
-			else 
-				{
-						HDESK desktop;
-						desktop = OpenInputDesktop(0, FALSE,
-													DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-													DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-													DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-													DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-													);
-
-						HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-						
-					
-						SetThreadDesktop(desktop);
-
-						if ( !(acceptDlg->DoDialog()) ) verified = vncServer::aqrReject;
-
-						SetThreadDesktop(old_desktop);
-						CloseDesktop(desktop);
-				}
-            }
-		}
-    }
-#endif
-
-	if (verified == vncServer::aqrReject) {
-		return FALSE;
-	}
-	return TRUE;
-}
-
-// RDV 2010-4-10
-// Filter Blacklisted are refused connection
-// Not interactive, not destop depended
-BOOL
-vncClientThread::FilterClients_Blacklist()
-{
-	// Verify the peer host name against the AuthHosts string
-	vncServer::AcceptQueryReject verified;
-	if (m_auth) {
-		verified = vncServer::aqrAccept;
-	} else {
-		verified = m_server->VerifyHost(m_socket->GetPeerName());
-	}
-
-	if (verified == vncServer::aqrReject) {
-		return FALSE;
-	}
-	return TRUE;
-}
-
-BOOL vncClientThread::CheckEmptyPasswd()
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	char password[MAXPWLEN];
-	m_server->GetPassword(password);
-	vncPasswd::ToText plain(password);
-	// By default we disallow passwordless workstations!
-	if ((strlen(plain) == 0) && m_server->AuthRequired())
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("no password specified for server - client rejected\n"));
-		SendConnFailed("This server does not have a valid password enabled.  "
-					"Until a password is set, incoming connections cannot be accepted.");
-		return FALSE;
-	}
-#endif
-	return TRUE;
-}
-
-BOOL
-vncClientThread::CheckLoopBack()
-{
-	// By default we filter out local loop connections, because they're pointless
-	if (!m_server->LoopbackOk())
-	{
-		char *localname = _strdup(m_socket->GetSockName());
-		char *remotename = _strdup(m_socket->GetPeerName());
-
-		// Check that the local & remote names are different!
-		if ((localname != NULL) && (remotename != NULL))
-		{
-			BOOL ok = _stricmp(localname, remotename) != 0;
-
-			if (localname != NULL)
-				free(localname);
-
-			if (remotename != NULL)
-				free(remotename);
-
-			if (!ok)
-			{
-				vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client rejected\n"));
-				SendConnFailed("Local loop-back connections are disabled.");
-				return FALSE;
-			}
-		}
-	}
-	else
-	{
-		char *localname = _strdup(m_socket->GetSockName());
-		char *remotename = _strdup(m_socket->GetPeerName());
-
-		// Check that the local & remote names are different!
-		if ((localname != NULL) && (remotename != NULL))
-		{
-			BOOL ok = _stricmp(localname, remotename) != 0;
-
-			if (localname != NULL)
-				free(localname);
-
-			if (remotename != NULL)
-				free(remotename);
-
-			if (!ok)
-			{
-				vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client accepted\n"));
-				m_client->m_IsLoopback=true;
-			}
-#ifdef ULTRAVNC_ITALC_SUPPORT
-			else
-			{
-				LONG val = 0;
-				if( ultravnc_italc_load_int( "LocalConnectOnly", &val ) && val )
-				{
-					// FOOOOOOO
-					vnclog.Print(LL_CONNERR, VNCLOG("non-loopback connections disabled - client rejected\n"));
-					SendConnFailed("non-loopback connections are disabled.");
-					return FALSE;
-				}
-			}
-#endif
-		}
-
-	}
-	return TRUE;
-}
-
-//WARNING  USING THIS FUNCTION AT A WRONG PLACE
-//SEND  0 ---> rfbVncAuthOK
-void vncClientThread::SendConnFailed(const char* szMessage)
-{
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	if (m_minor>=7)
-		{
-			// 0 = Failure
-			CARD8 value=0;
-			if (!m_socket->SendExactQueue((char *)&value, sizeof(value)))
-				return;
-		}
-	else
-		{
-			CARD32 auth_val = Swap32IfLE(rfbConnFailed);
-			if (!m_socket->SendExactQueue((char *)&auth_val, sizeof(auth_val)))
-				return;
-		}
-	CARD32 errlen = Swap32IfLE(strlen(szMessage));
-	if (!m_socket->SendExactQueue((char *)&errlen, sizeof(errlen)))
-		return;
-	m_socket->SendExact(szMessage, strlen(szMessage));
-}
-
-void vncClientThread::LogAuthResult(bool success)
-{
-	if (!success)
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("authentication failed\n"));
-		typedef BOOL (*LogeventFn)(char *machine);
-		LogeventFn Logevent = 0;
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-			{
-				char* p = strrchr(szCurrentDir, '\\');
-				*p = '\0';
-				strcat (szCurrentDir,"\\logging.dll");
-			}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				//BOOL result=false;
-				Logevent = (LogeventFn) GetProcAddress( hModule, "LOGFAILED" );
-				Logevent((char *)m_client->GetClientName());
-				FreeLibrary(hModule);
-			}		
-	}
-	else
-	{
-		typedef BOOL (*LogeventFn)(char *machine);
-		LogeventFn Logevent = 0;
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-			{
-				char* p = strrchr(szCurrentDir, '\\');
-				*p = '\0';
-				strcat (szCurrentDir,"\\logging.dll");
-			}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				//BOOL result=false;
-				Logevent = (LogeventFn) GetProcAddress( hModule, "LOGLOGON" );
-				Logevent((char *)m_client->GetClientName());
-				FreeLibrary(hModule);
-			}
-	}
-}
-
-BOOL
-vncClientThread::InitAuthenticate()
-{
-	vnclog.Print(LL_INTINFO, "Entered InitAuthenticate\n");
-	// RDV 2010-4-10
-	// Split Filter in desktop in/depended
-	if (!FilterClients_Blacklist())
-		{
-			SendConnFailed("Your connection has been rejected.");
-			return FALSE;
-		}
-	if (!CheckEmptyPasswd()) return FALSE;
-	if (!CheckLoopBack()) return FALSE;
-
-	//adzm 2010-09 - Do the actual authentication
-	if (m_minor >= 7) {
-		std::vector<CARD8> current_auth;
-		if (!AuthenticateClient(current_auth)) {
-			return FALSE;
-		}
-	} else {
-		// RDV 2010-4-10
-		if (!FilterClients_Ask_Permission())
-			{
-				SendConnFailed("Your connection has been rejected.");
-				return FALSE;
-			}
-		if (!AuthenticateLegacyClient()) {
-			return FALSE;
-		}
-	}
-
-
-	// Read the client's initialisation message
-	rfbClientInitMsg client_ini;
-	if (!m_socket->ReadExact((char *)&client_ini, sz_rfbClientInitMsg))
-		return FALSE;
-
-	// If the client wishes to have exclusive access then remove other clients
-	if (m_server->ConnectPriority()==3 && !m_shared )
-	{
-		// Existing
-			if (m_server->AuthClientCount() > 0)
-			{
-				vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected\n"));
-				return FALSE;
-			}
-	}
-	// adzm 2010-09
-	if (!(client_ini.flags & clientInitShared) && !m_shared)
-	{
-		// Which client takes priority, existing or incoming?
-		if (m_server->ConnectPriority() < 1)
-		{
-			// Incoming
-			vnclog.Print(LL_INTINFO, VNCLOG("non-shared connection - disconnecting old clients\n"));
-			m_server->KillAuthClients();
-		} else if (m_server->ConnectPriority() > 1)
-		{
-			// Existing
-			if (m_server->AuthClientCount() > 0)
-			{
-				vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected\n"));
-				return FALSE;
-			}
-		}
-	}
-
-	vnclog.Print(LL_CLIENTS, VNCLOG("Leaving InitAuthenticate\n"));
-	// Tell the server that this client is ok
-	return m_server->Authenticated(m_client->GetClientId());
-}
-
-BOOL vncClientThread::AuthenticateClient(std::vector<CARD8>& current_auth)
-{
-	// adzm 2010-09 - Gather all authentication types we support
-	std::vector<CARD8> auth_types;
-
-	const bool bUseSessionSelect = false;
-	
-	// obviously needs to be one that we suggested in the first place
-	bool bSecureVNCPluginActive = std::find(current_auth.begin(), current_auth.end(), rfbUltraVNC_SecureVNCPluginAuth) != current_auth.end();
-	bool bSCPromptActive = std::find(current_auth.begin(), current_auth.end(), rfbUltraVNC_SCPrompt) != current_auth.end();
-	bool bSessionSelectActive = std::find(current_auth.begin(), current_auth.end(), rfbUltraVNC_SessionSelect) != current_auth.end();
-
-	if (current_auth.empty()) {
-		// send the UltraVNC auth type to identify ourselves as an UltraVNC server, but only initially
-		auth_types.push_back(rfbUltraVNC);
-	}
-
-	// encryption takes priority over everything, for now at least.
-	// would be useful to have a host list to configure these settings.
-	// Include the SecureVNCPluginAuth type for those that support it but are not UltraVNC viewers
-	if (!bSecureVNCPluginActive && m_socket->IsUsePluginEnabled() && m_server->GetDSMPluginPointer()->IsEnabled() && m_socket->GetIntegratedPlugin() != NULL)
-	{
-		auth_types.push_back(rfbUltraVNC_SecureVNCPluginAuth);
-	}
-	else if ( (SPECIAL_SC_PROMPT || SPECIAL_SC_EXIT) && !bSCPromptActive ) 
-	{
-		// adzm 2010-10 - Add the SCPrompt pseudo-auth
-		auth_types.push_back(rfbUltraVNC_SCPrompt);
-	}
-	else if (bUseSessionSelect)
-	{
-		// adzm 2010-10 - Add the SessionSelect pseudo-auth
-		auth_types.push_back(rfbUltraVNC_SessionSelect);
-	}
-	else
-	{			
-		// Retrieve the local password
-		char password[MAXPWLEN];
-		m_server->GetPassword(password);
-		vncPasswd::ToText plain(password);
-
-		if (!m_auth && m_ms_logon)
-		{
-			auth_types.push_back(rfbUltraVNC_MsLogonIIAuth);
-		}
-		else
-		{
-			if (m_auth || (strlen(plain) == 0))
-			{
-				auth_types.push_back(rfbNoAuth);
-			} else {
-				auth_types.push_back(rfbVncAuth);
-			}
-		}
-	}
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	auth_types.clear();
-	if( m_ms_logon )
-	{
-		auth_types.push_back(rfbUltraVNC_MsLogonIIAuth);
-	}
-	auth_types.push_back(rfbSecTypeItalc);
-#endif
-	// adzm 2010-09 - Send the auths
-	{
-		CARD8 authCount = (CARD8)auth_types.size();
-		if (!m_socket->SendExactQueue((const char*)&authCount, sizeof(authCount)))
-			return FALSE;
-
-		for (std::vector<CARD8>::iterator auth_it = auth_types.begin(); auth_it != auth_types.end(); auth_it++)
-		{
-			CARD8 authType = *auth_it;
-			if (!m_socket->SendExactQueue((const char*)&authType, sizeof(authType)))
-				return FALSE;
-		}
-		if (!m_socket->ClearQueue())
-			return FALSE;
-	}
-	// read the accepted auth type
-	CARD8 auth_accepted = rfbInvalidAuth;
-	if (!m_socket->ReadExact((char*)&auth_accepted, sizeof(auth_accepted)))
-		return FALSE;
-
-	// obviously needs to be one that we suggested in the first place
-	if (std::find(auth_types.begin(), auth_types.end(), auth_accepted) == auth_types.end()) {
-		return FALSE;
-	}
-
-	// mslogonI never seems to be used anymore -- the old code would say if (m_ms_logon) AuthMsLogon (II) else AuthVnc
-	// and within AuthVnc would be if (m_ms_logon) { /* mslogon code */ }. THat could never be hit since the first case
-	// would always match!
-
-	// Authenticate the connection, if required
-	BOOL auth_success = FALSE;
-	std::string auth_message;
-	switch (auth_accepted)
-	{
-	case rfbUltraVNC:
-		m_client->SetUltraViewer(true);
-		auth_success = true;
-		break;
-	case rfbUltraVNC_SecureVNCPluginAuth:
-		auth_success = AuthSecureVNCPlugin(auth_message);	
-		break;
-	case rfbUltraVNC_MsLogonIIAuth:
-		auth_success = AuthMsLogon(auth_message);
-		break;
-	case rfbVncAuth:
-		auth_success = AuthVnc(auth_message);
-		break;
-	case rfbNoAuth:
-		auth_success = TRUE;
-		break;
-	case rfbUltraVNC_SCPrompt:
-		// adzm 2010-10 - Do the SCPrompt auth
-		auth_success = AuthSCPrompt(auth_message);
-		break;
-	case rfbUltraVNC_SessionSelect:
-		// adzm 2010-10 - Do the SessionSelect auth
-		auth_success = AuthSessionSelect(auth_message);
-		break;
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	case rfbSecTypeItalc:
-		auth_success =
-			ItalcCoreServer::instance()->
-				authSecTypeItalc( vsocketDispatcher, m_socket );
-		break;
-#endif
-	default:
-		auth_success = FALSE;
-		break;
-	}
-	// Log authentication success or failure
-	LogAuthResult(auth_success ? true : false);
-
-	// Return the result
-	CARD32 auth_result = rfbVncAuthFailed;
-	if (auth_success) {
-		current_auth.push_back(auth_accepted);
-
-		// continue the authentication if mslogon is enabled. any method of authentication should
-		// work out fine with this method. Currently we limit ourselves to only one layer beyond
-		// the plugin to avoid deep recursion, but that can easily be changed if necessary.
-		if (m_ms_logon && auth_accepted == rfbUltraVNC_SecureVNCPluginAuth && m_socket->GetIntegratedPlugin()) {
-			auth_result = rfbVncAuthContinue;
-		} else if (auth_accepted == rfbUltraVNC) {
-			auth_result = rfbVncAuthContinue;
-		} else if ( (SPECIAL_SC_PROMPT || SPECIAL_SC_EXIT) && !bSCPromptActive) {
-			auth_result = rfbVncAuthContinue;
-		} else if (bUseSessionSelect && !bSessionSelectActive) {
-			auth_result = rfbVncAuthContinue;
-		} else {
-			auth_result = rfbVncAuthOK;
-		}
-	}
-
-	// RDV 2010-4-10
-	// This is a good spot for asking the user permission Accept/Reject
-	// Only when auth_result == rfbVncAuthOK, in all other cases it isn't needed
-	// adzm 2010-10 - This was causing failure with DSM plugin, since this is
-	// pretty much the same as another auth type we'll just move it into that code
-	// instead. So see the AuthSCPrompt function.
-
-	// Check the FilterClients thing after final auth
-	if (auth_result == rfbVncAuthOK)
-	{
-		// If not rejected by viewer
-		if (auth_result != rfbVncAuthFailed)
-		{
-			BOOL result=FilterClients_Ask_Permission();
-			if (!result)
-			{
-				auth_result = rfbVncAuthFailed;
-				auth_success = false;
-			}
-		}
-	}
-
-	CARD32 auth_result_msg = Swap32IfLE(auth_result);
-	if (!m_socket->SendExactQueue((char *)&auth_result_msg, sizeof(auth_result_msg)))
-		return FALSE;
-
-	// Send a failure reason	
-	if (!auth_success) {
-		if (auth_message.empty()) {
-			auth_message = "authentication rejected";
-		}
-		CARD32 auth_message_length = Swap32IfLE(auth_message.length());
-		if (!m_socket->SendExactQueue((char *)&auth_message_length, sizeof(auth_message_length)))
-			return FALSE;
-		if (!m_socket->SendExact(auth_message.c_str(), auth_message.length()))
-			return FALSE;
-		return FALSE;
-	}
-
-	if (!m_socket->ClearQueue())
-		return FALSE;
-	
-	//adzm 2010-09 - Set handshake complete if integrated plugin finished auth
-	if (auth_success && auth_accepted == rfbUltraVNC_SecureVNCPluginAuth && m_socket->GetIntegratedPlugin()) {			
-		m_socket->GetIntegratedPlugin()->SetHandshakeComplete();	
-	}
-
-	if (auth_success && auth_result == rfbVncAuthContinue) {
-		if (!AuthenticateClient(current_auth)) {
-			return FALSE;
-		}
-	}
-
-	if (auth_success) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-
-BOOL vncClientThread::AuthenticateLegacyClient()
-{
-	// Retrieve the local password
-	char password[MAXPWLEN];
-	m_server->GetPassword(password);
-	vncPasswd::ToText plain(password);
-
-	CARD32 auth_type = rfbInvalidAuth;
-
-	if (m_socket->IsUsePluginEnabled() && m_server->GetDSMPluginPointer()->IsEnabled() && m_socket->GetIntegratedPlugin() != NULL)
-	{
-		auth_type = rfbLegacy_SecureVNCPlugin;
-	}
-	else if (m_ms_logon)
-	{
-		auth_type = rfbLegacy_MsLogon;
-	}
-	else if (strlen(plain) > 0)
-	{
-		auth_type = rfbVncAuth;
-	}
-	else if (m_auth || (strlen(plain) == 0))
-	{
-		auth_type = rfbNoAuth;
-	}
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	// always use MS logon authentication when authenticating against
-	// an old VNC viewer - this allows to use the iTALC client as regular
-	// VNC server
-	auth_type = rfbLegacy_MsLogon;
-#endif
-
-	// abort if invalid
-	if (auth_type == rfbInvalidAuth) {
-		SendConnFailed("unable to determine legacy authentication method");
-		return FALSE;
-	}
-
-	// RDV 2010-4-10
-	// CARD32, byte swap is needed
-	auth_type=Swap32IfLE(auth_type);
-	// adzm 2010-09 - Send the single auth type
-	if (!m_socket->SendExact((const char*)&auth_type, sizeof(auth_type)))
-		return FALSE;
-	// RDV 2010-4-10
-	// CARD32, reset original
-	auth_type=Swap32IfLE(auth_type);
-
-	// Authenticate the connection, if required
-	BOOL auth_success = FALSE;
-	std::string auth_message;
-	switch (auth_type)
-	{
-	case rfbLegacy_SecureVNCPlugin:
-		auth_success = AuthSecureVNCPlugin(auth_message);	
-		// adzm 2010-11 - Legacy 1.0.8.2 special build will continue here with mslogon
-		if (auth_success && m_ms_logon) {
-			CARD32 auth_result_msg = Swap32IfLE(rfbLegacy_MsLogon);
-			if (!m_socket->SendExact((char *)&auth_result_msg, sizeof(auth_result_msg)))
-				return FALSE;
-			
-			//adzm 2010-09 - Set handshake complete if integrated plugin finished auth
-			if (auth_success && auth_type == rfbLegacy_SecureVNCPlugin && m_socket->GetIntegratedPlugin()) {			
-				m_socket->GetIntegratedPlugin()->SetHandshakeComplete();
-			}
-
-			auth_type = rfbLegacy_MsLogon;
-			auth_success = AuthMsLogon(auth_message);
-		}
-		break;
-	case rfbLegacy_MsLogon:
-		auth_success = AuthMsLogon(auth_message);
-		break;
-	case rfbVncAuth:
-		auth_success = AuthVnc(auth_message);
-		break;
-	case rfbNoAuth:
-		auth_success = TRUE;
-		break;
-	default:
-		auth_success = FALSE;
-		break;
-	}
-
-	// Log authentication success or failure
-	LogAuthResult(auth_success ? true : false);
-
-	// Return the result
-	CARD32 auth_result = rfbVncAuthFailed;
-	if (auth_success) {
-		auth_result = rfbVncAuthOK;
-	}
-
-	CARD32 auth_result_msg = Swap32IfLE(auth_result);
-	if (!m_socket->SendExact((char *)&auth_result_msg, sizeof(auth_result_msg)))
-		return FALSE;
-	
-	//adzm 2010-09 - Set handshake complete if integrated plugin finished auth
-	if (auth_success && auth_type == rfbLegacy_SecureVNCPlugin && m_socket->GetIntegratedPlugin()) {			
-		m_socket->GetIntegratedPlugin()->SetHandshakeComplete();
-	}
-
-	if (auth_success) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-// must SetHandshakeComplete after sending auth result!
-BOOL vncClientThread::AuthSecureVNCPlugin(std::string& auth_message)
-{
-	char password[MAXPWLEN];
-	m_server->GetPassword(password);
-	vncPasswd::ToText plain(password);
-	m_socket->SetDSMPluginConfig(m_server->GetDSMPluginConfig());
-	BOOL auth_ok = FALSE;
-
-	const char* plainPassword = plain;
-
-	if (!m_ms_logon && plainPassword && strlen(plainPassword) > 0) {
-		m_socket->GetIntegratedPlugin()->SetPasswordData((const BYTE*)plainPassword, strlen(plainPassword));
-	}
-
-	int nSequenceNumber = 0;
-	bool bSendChallenge = true;
-	do
-	{
-		BYTE* pChallenge = NULL;
-		int nChallengeLength = 0;
-		if (!m_socket->GetIntegratedPlugin()->GetChallenge(pChallenge, nChallengeLength, nSequenceNumber)) {
-			m_socket->GetIntegratedPlugin()->FreeMemory(pChallenge);
-			auth_message = m_socket->GetIntegratedPlugin()->GetLastErrorString();
-			return FALSE;
-		}
-
-		WORD wChallengeLength = (WORD)nChallengeLength;
-
-		if (!m_socket->SendExactQueue((const char*)&wChallengeLength, sizeof(wChallengeLength))) {
-			m_socket->GetIntegratedPlugin()->FreeMemory(pChallenge);
-			return FALSE;
-		}
-
-		if (!m_socket->SendExact((const char*)pChallenge, nChallengeLength)) {
-			m_socket->GetIntegratedPlugin()->FreeMemory(pChallenge);
-			return FALSE;
-		}
-
-		m_socket->GetIntegratedPlugin()->FreeMemory(pChallenge);
-		WORD wResponseLength = 0;
-		if (!m_socket->ReadExact((char*)&wResponseLength, sizeof(wResponseLength))) {
-			return FALSE;
-		}
-
-		BYTE* pResponseData = new BYTE[wResponseLength];
-		
-		if (!m_socket->ReadExact((char*)pResponseData, wResponseLength)) {
-			delete[] pResponseData;
-			return FALSE;
-		}
-
-		if (!m_socket->GetIntegratedPlugin()->HandleResponse(pResponseData, (int)wResponseLength, nSequenceNumber, bSendChallenge)) {
-			auth_message = m_socket->GetIntegratedPlugin()->GetLastErrorString();
-			auth_ok = FALSE;
-			bSendChallenge = false;
-		} else if (!bSendChallenge) {
-			auth_ok = TRUE;
-		}
-
-		delete[] pResponseData;
-		nSequenceNumber++;
-	} while (bSendChallenge);
-
-	if (auth_ok) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-// marscha at 2006: Try to better hide the windows password.
-// I know that this is no breakthrough in modern cryptography.
-// It's just a patch/kludge/workaround.
-BOOL 
-vncClientThread::AuthMsLogon(std::string& auth_message) 
-{
-	DH dh;
-	char gen[8], mod[8], pub[8], resp[8];
-	char user[256], passwd[64];
-	unsigned char key[8];
-	
-	dh.createKeys();
-	int64ToBytes(dh.getValue(DH_GEN), gen);
-	int64ToBytes(dh.getValue(DH_MOD), mod);
-	int64ToBytes(dh.createInterKey(), pub);
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.	
-	if (!m_socket->SendExactQueue(gen, sizeof(gen))) return FALSE;
-	if (!m_socket->SendExactQueue(mod, sizeof(mod))) return FALSE;
-	if (!m_socket->SendExact(pub, sizeof(pub))) return FALSE;
-	if (!m_socket->ReadExact(resp, sizeof(resp))) return FALSE;
-	if (!m_socket->ReadExact(user, sizeof(user))) return FALSE;
-	if (!m_socket->ReadExact(passwd, sizeof(passwd))) return FALSE;
-
-	int64ToBytes(dh.createEncryptionKey(bytesToInt64(resp)), (char*) key);
-	vnclog.Print(0, "After DH: g=%I64u, m=%I64u, i=%I64u, key=%I64u\n", bytesToInt64(gen), bytesToInt64(mod), bytesToInt64(pub), bytesToInt64((char*) key));
-	vncDecryptBytes((unsigned char*) user, sizeof(user), key); user[255] = '\0';
-	vncDecryptBytes((unsigned char*) passwd, sizeof(passwd), key); passwd[63] = '\0';
-
-	int result = CheckUserGroupPasswordUni(user, passwd, m_client->GetClientName());
-	vnclog.Print(LL_INTINFO, "CheckUserGroupPasswordUni result=%i\n", result);
-	if (result == 2) {
-		m_client->EnableKeyboard(false);
-		m_client->EnablePointer(false);
-	}
-
-	if (result) {
-#ifdef ULTRAVNC_ITALC_SUPPORT
-		return ultravnc_italc_ask_permission( user, m_socket->GetPeerName() );
-#endif
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-BOOL vncClientThread::AuthVnc(std::string& auth_message)
-{
-	char password[MAXPWLEN];
-	m_server->GetPassword(password);
-	vncPasswd::ToText plain(password);
-
-	BOOL auth_ok = FALSE;
-	{
-		// Now create a 16-byte challenge
-		char challenge[16];
-		char challenge2[16]; //PGM
-		char response[16];
-		vncRandomBytes((BYTE *)&challenge);
-		memcpy(challenge2, challenge, 16); //PGM
-		
-
-		{
-			vnclog.Print(LL_INTINFO, "password authentication");
-			if (!m_socket->SendExact(challenge, sizeof(challenge)))
-            {
-				vnclog.Print(LL_SOCKERR, VNCLOG("Failed to send challenge to client\n"));
-				return FALSE;
-            }
-
-
-			// Read the response
-			if (!m_socket->ReadExact(response, sizeof(response)))
-            {
-				vnclog.Print(LL_SOCKERR, VNCLOG("Failed to receive challenge response from client\n"));
-				return FALSE;
-            }
-			// Encrypt the challenge bytes
-			vncEncryptBytes((BYTE *)&challenge, plain);
-
-			auth_ok = TRUE;
-			// Compare them to the response
-			for (size_t i=0; i<sizeof(challenge); i++)
-			{
-				if (challenge[i] != response[i])
-				{
-					auth_ok = FALSE;
-					break;
-				}
-			}
-			if (!auth_ok) //PGM
-			{ //PGM
-				memset(password, '\0', MAXPWLEN); //PGM
-				m_server->GetPassword2(password); //PGM
-				vncPasswd::ToText plain2(password); //PGM
-				if ((strlen(plain2) > 0)) //PGM
-				{ //PGM
-					vnclog.Print(LL_INTINFO, "View-only password authentication"); //PGM
-					m_client->EnableKeyboard(false); //PGM
-					m_client->EnablePointer(false); //PGM
-					auth_ok = TRUE; //PGM
-
-					// Encrypt the view-only challenge bytes //PGM
-					vncEncryptBytes((BYTE *)&challenge2, plain2); //PGM
-
-					// Compare them to the response //PGM
-					for (size_t i=0; i<sizeof(challenge2); i++) //PGM
-					{ //PGM
-						if (challenge2[i] != response[i]) //PGM
-						{ //PGM
-							auth_ok = FALSE; //PGM
-							break; //PGM
-						} //PGM
-					} //PGM
-				} //PGM
-			} //PGM
-		}
-	}
-
-	if (auth_ok) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-// adzm 2010-10
-BOOL vncClientThread::AuthSCPrompt(std::string& auth_message)
-{
-	// Check if viewer accept connection
-	char mytext[1024];
-	getinfo(mytext);
-	int size=strlen(mytext);
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	if (!m_socket->SendExactQueue((char *)&size, sizeof(int)))
-		return FALSE;
-	if (!m_socket->SendExact((char *)mytext, size))
-		return FALSE;
-	int nummer;
-	if (!m_socket->ReadExact((char *)&nummer, sizeof(int)))
-	{
-		return FALSE;
-	}
-	if (nummer==0)
-	{
-		auth_message = "Viewer refused connection";
-		return FALSE;
-	} else {
-		return TRUE;
-	}
-}
-
-BOOL vncClientThread::AuthSessionSelect(std::string& auth_message)
-{
-	return TRUE;
-	/* Session select */
-	/*
-	{
-		//Fake Function
-		CARD32 auth_result_msg = Swap32IfLE(rfbUltraVNC_SessionSelect);
-		if (!m_socket->SendExact((char *)&auth_result_msg, sizeof(auth_result_msg)))
-			return FALSE;
-		CARD8 Items=3;
-		if (!m_socket->SendExact((char *)&Items, sizeof(Items)))
-			return FALSE;
-		char line1[128];
-		char line2[128];
-		char line3[128];
-		strcpy(line1,"line1 ");
-		strcpy(line2,"line22 ");
-		strcpy(line3,"line312 123 ");
-		if (!m_socket->SendExact((char *)line1, 128))
-			return FALSE;
-		if (!m_socket->SendExact((char *)line2, 128))
-			return FALSE;
-		if (!m_socket->SendExact((char *)line3, 128))
-			return FALSE;
-		int nummer;
-		if (!m_socket->ReadExact((char *)&nummer, sizeof(int)))
-		{
-			return FALSE;
-		}
-		int a=0;
-	}
-	*/
-}
-
-void
-ClearKeyState(BYTE key)
-{
-	// This routine is used by the VNC client handler to clear the
-	// CAPSLOCK, NUMLOCK and SCROLL-LOCK states.
-
-	BYTE keyState[256];
-	
-	GetKeyboardState((LPBYTE)&keyState);
-
-	if(keyState[key] & 1)
-	{
-		// Simulate the key being pressed
-		keybd_event(key, 0, KEYEVENTF_EXTENDEDKEY, 0);
-
-		// Simulate it being release
-		keybd_event(key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
-	}
-}
-
-
-// Modif sf at 2002
-// Get the local ip addresses as a human-readable string.
-// If more than one, then with \n between them.
-// If not available, then gets a message to that effect.
-void GetIPString(char *buffer, int buflen)
-{
-    char namebuf[256];
-
-    if (gethostname(namebuf, 256) != 0)
-	{
-		strncpy(buffer, "Host name unavailable", buflen);
-		return;
-    }
-
-    HOSTENT *ph = NULL;
-	ph=gethostbyname(namebuf);
-    if (!ph)
-	{
-		strncpy(buffer, "IP address unavailable", buflen);
-		return;
-    }
-
-    *buffer = '\0';
-    char digtxt[5];
-    for (int i = 0; ph->h_addr_list[i]; i++)
-	{
-    	for (int j = 0; j < ph->h_length; j++)
-		{
-	    sprintf(digtxt, "%d.", (unsigned char) ph->h_addr_list[i][j]);
-	    strncat(buffer, digtxt, (buflen-1)-strlen(buffer));
-		}	
-		buffer[strlen(buffer)-1] = '\0';
-		if (ph->h_addr_list[i+1] != 0)
-			strncat(buffer, ", ", (buflen-1)-strlen(buffer));
-    }
-}
-
-// adzm 2010-08
-bool vncClientThread::InitSocket()
-{
-	// To avoid people connecting and then halting the connection, set a timeout
-
-	// adzm 2010-10 - Set 0 timeout if using repeater
-	VBool bSocketTimeoutSet = VFalse;
-	if (m_client->GetRepeaterID()) {
-		bSocketTimeoutSet = m_socket->SetTimeout(0);
-	} else {
-		bSocketTimeoutSet = m_socket->SetTimeout(30000);
-	}
-	if (!bSocketTimeoutSet) {
-		vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError());
-	}
-
-	// sf at 2002 - DSM Plugin - Tell the client's socket where to find the DSMPlugin 
-	if (m_server->GetDSMPluginPointer() != NULL)
-	{
-		m_socket->SetDSMPluginPointer(m_server->GetDSMPluginPointer());
-		vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Pointer to socket OK\n"));
-
-		//adzm 2010-05-12 - dsmplugin config
-		m_socket->SetDSMPluginConfig(m_server->GetDSMPluginConfig());
-	}
-	else
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("Invalid DSMPlugin Pointer\n"));
-		return false;
-	}
-
-	// LOCK INITIAL SETUP
-	// All clients have the m_protocol_ready flag set to FALSE initially, to prevent
-	// updates and suchlike interfering with the initial protocol negotiations.
-
-	// sf at 2002 - DSMPlugin
-	// Use Plugin only from this point (now BEFORE Protocole handshaking)
-	if (m_server->GetDSMPluginPointer()->IsEnabled())
-	{
-
-		// sf at 2007 - Current DSM code does not support multithreading
-		// Data mix is causing server crash and viewer drops when more than one viewer is copnnected at a time
-		// We must reject any new viewer connection BEFORE any data passes through the plugin
-		// This is a dirty workaround. We ignore all Multi Viewer connection settings...
-		//adzm 2009-06-20 - Fixed this to use multi-threaded version, so therefore we can handle multiple
-		// clients with no issues.
-		if (!m_server->GetDSMPluginPointer()->SupportsMultithreaded() && m_server->AuthClientCount() > 0)
-		{
-			vnclog.Print(LL_CLIENTS, VNCLOG("A connection using DSM already exist - client rejected to avoid crash \n"));
-			return false;
-		} 
-
-		//adzm 2009-06-20 - TODO - Not sure about this. what about pending connections via the repeater?
-		if (m_server->AuthClientCount() == 0)
-			m_server->GetDSMPluginPointer()->ResetPlugin();	//SEC reset if needed
-		m_socket->EnableUsePlugin(true);
-		m_client->m_encodemgr.EnableQueuing(false);
-		// TODO: Make a more secured challenge (with time stamp)
-	}
-	else
-		m_client->m_encodemgr.EnableQueuing(true);
-
-	return true;
-}
-
-bool vncClientThread::TryReconnect()
-{
-	if (fShutdownOrdered || m_client->m_Autoreconnect || !m_client->GetHost() || !m_client->GetRepeaterID()) {
-		return false;
-	}
-
-	if (m_socket) {
-		m_socket->Close();
-		if (m_client && m_client->m_socket) {
-			m_client->m_socket = NULL;
-		}
-		delete m_socket;
-		m_socket = NULL;
-	}
-
-	// Attempt to create a new socket
-	VSocket *tmpsock = new VSocket;
-	if (!tmpsock) {
-		return false;
-	}
-
-	m_socket = tmpsock;
-	if (m_client) {
-		m_client->m_socket = tmpsock;
-	}
-	
-	// 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
-	m_socket->Create();
-	if (m_socket->Connect(m_client->GetHost(), m_client->GetHostPort()))	{
-		if (m_client->GetRepeaterID()) {
-			char finalidcode[_MAX_PATH];
-			//adzm 2010-08 - this was sending uninitialized data over the wire
-			ZeroMemory(finalidcode, sizeof(finalidcode));
-			strncpy(finalidcode, m_client->GetRepeaterID(), sizeof(finalidcode) - 1);
-
-			m_socket->Send(finalidcode,250);
-
-			InitSocket();
-
-			return true;
-		}
-	}
-
-	return false;
-}
-
-void
-vncClientThread::run(void *arg)
-{
-	// All this thread does is go into a socket-receive loop,
-	// waiting for stuff on the given socket
-
-	// IMPORTANT : ALWAYS call RemoveClient on the server before quitting
-	// this thread.
-    SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
-
-	vnclog.Print(LL_CLIENTS, VNCLOG("client connected : %s (%hd)\n"),
-								m_client->GetClientName(),
-								m_client->GetClientId());
-	// Save the handle to the thread's original desktop
-	HDESK home_desktop = GetThreadDesktop(GetCurrentThreadId());
-	HDESK input_desktop = 0;
-
-	// Initially blacklist the client so that excess connections from it get dropped
-	m_server->AddAuthHostsBlacklist(m_client->GetClientName());
-
-	// adzm 2010-08
-	if (!InitSocket()) {
-		m_server->RemoveClient(m_client->GetClientId());
-		return;
-	}
-
-	// GET PROTOCOL VERSION
-	if (!InitVersion())
-	{
-		// adzm 2009-07-05
-		{
-			char szInfo[256];
-
-			if (m_client->GetRepeaterID() && (strlen(m_client->GetRepeaterID()) > 0) ) {
-				_snprintf(szInfo, 255, "Could not connect using %s!", m_client->GetRepeaterID());
-			} else {
-				_snprintf(szInfo, 255, "Could not connect to %s!", m_client->GetClientName());
-			}
-
-			szInfo[255] = '\0';
-
-			vncMenu::NotifyBalloon(szInfo, NULL);
-		}
-		m_server->RemoveClient(m_client->GetClientId());
-		
-		// wa at 2005 - AutoReconnection attempt if required
-		if (m_client->m_Autoreconnect)
-		{
-			for (int i=0;i<10*m_server->AutoReconnect_counter;i++)
-			{
-				Sleep(100);
-				if (m_autoreconnectcounter_quit) return;
-			}
-			m_server->AutoReconnect_counter+=10;
-			if (m_server->AutoReconnect_counter>1800) m_server->AutoReconnect_counter=1800;
-			vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient I\n"));
-			m_server->AutoReconnect(m_client->m_Autoreconnect);
-			m_server->AutoReconnectPort(m_AutoReconnectPort);
-			m_server->AutoReconnectAdr(m_szAutoReconnectAdr);
-			m_server->AutoReconnectId(m_szAutoReconnectId);
-
-			vncService::PostAddNewClient(1111, 1111);
-		}
-
-		return;
-	}
-	m_server->AutoReconnect_counter=0;
-	vnclog.Print(LL_INTINFO, VNCLOG("negotiated version\n"));
-
-	// AUTHENTICATE LINK
-	if (!InitAuthenticate())
-	{
-		m_server->RemoveClient(m_client->GetClientId());
-		return;
-	}
-
-	// Authenticated OK - remove from blacklist and remove timeout
-	m_server->RemAuthHostsBlacklist(m_client->GetClientName());
-	m_socket->SetTimeout(m_server->AutoIdleDisconnectTimeout()*1000);
-	vnclog.Print(LL_INTINFO, VNCLOG("authenticated connection\n"));
-
-	// Set Client Connect time
-	m_client->SetConnectTime(timeGetTime());
-
-	// INIT PIXEL FORMAT
-
-	// Get the screen format
-//	m_client->m_fullscreen = m_client->m_encodemgr.GetSize();
-
-	// Modif sf at 2002 - Scaling
-	{
-	omni_mutex_lock l(m_client->GetUpdateLock());
-	if (m_server->AreThereMultipleViewers()==false)
-		m_client->m_encodemgr.m_buffer->SetScale(m_server->GetDefaultScale()); // v1.1.2
-	}
-	m_client->m_ScaledScreen = m_client->m_encodemgr.m_buffer->GetViewerSize();
-	m_client->m_nScale = m_client->m_encodemgr.m_buffer->GetScale();
-
-
-	// Get the name of this desktop
-	// sf at 2002 - v1.1.x - Complete the computer name with the IP address if necessary
-	bool fIP = false;
-    char desktopname[MAX_COMPUTERNAME_LENGTH + 3 + 256] = {0};
-	DWORD desktopnamelen = MAX_COMPUTERNAME_LENGTH + 1 + 256;
-	memset((char*)desktopname, 0, sizeof(desktopname));
-	if (GetComputerName(desktopname, &desktopnamelen))
-	{
-		// Make the name lowercase
-		for (size_t x=0; x<strlen(desktopname); x++)
-		{
-			desktopname[x] = tolower(desktopname[x]);
-		}
-		// Check for the presence of "." in the string (then it's presumably an IP adr)
-		if (strchr(desktopname, '.') != NULL) fIP = true;
-	}
-	else
-	{
-		strcpy(desktopname, "WinVNC");
-	}
-
-	// We add the IP address(es) to the computer name, if possible and necessary
-	if (!fIP)
-	{
-		char szIP[256];
-		GetIPString(szIP, sizeof(szIP));
-		if (strlen(szIP) > 3 && szIP[0] != 'I' && szIP[0] != 'H') 
-		{
-			strcat(desktopname, " ( ");
-			strcat(desktopname, szIP);
-			strcat(desktopname, " )");
-		}
-	}
-
-	strcat(desktopname, " - ");
-	if (vncService::RunningAsService()) strcat(desktopname, "service mode");
-	else strcat(desktopname, "application mode");
-
-	// Send the server format message to the client
-	rfbServerInitMsg server_ini;
-	server_ini.format = m_client->m_encodemgr.m_buffer->GetLocalFormat();
-
-	// Endian swaps
-	// Modif sf at 2002 - Scaling
-	server_ini.framebufferWidth = Swap16IfLE(m_client->m_ScaledScreen.br.x - m_client->m_ScaledScreen.tl.x);
-	server_ini.framebufferHeight = Swap16IfLE(m_client->m_ScaledScreen.br.y - m_client->m_ScaledScreen.tl.y);
-	// server_ini.framebufferWidth = Swap16IfLE(m_client->m_fullscreen.br.x-m_client->m_fullscreen.tl.x);
-	// server_ini.framebufferHeight = Swap16IfLE(m_client->m_fullscreen.br.y-m_client->m_fullscreen.tl.y);
-
-	server_ini.format.redMax = Swap16IfLE(server_ini.format.redMax);
-	server_ini.format.greenMax = Swap16IfLE(server_ini.format.greenMax);
-	server_ini.format.blueMax = Swap16IfLE(server_ini.format.blueMax);
-
-	CARD32 nNameLength = strlen(desktopname);
-
-	server_ini.nameLength = Swap32IfLE(nNameLength);
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	if (!m_socket->SendExactQueue((char *)&server_ini, sizeof(server_ini)))
-	{
-		m_server->RemoveClient(m_client->GetClientId());
-		return;
-	}
-	if (!m_socket->SendExact(desktopname, nNameLength))
-	{
-		m_server->RemoveClient(m_client->GetClientId());
-		return;
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("sent pixel format to client\n"));
-
-	// UNLOCK INITIAL SETUP
-	// Initial negotiation is complete, so set the protocol ready flag
-	m_client->EnableProtocol();
-	
-	// Add a fullscreen update to the client's update list
-	// sf at 2002 - Scaling
-	// m_client->m_update_tracker.add_changed(m_client->m_fullscreen);
-	{ // RealVNC 336
-		omni_mutex_lock l(m_client->GetUpdateLock());
-		m_client->m_update_tracker.add_changed(m_client->m_ScaledScreen);
-	}
-
-	// MAIN LOOP
-#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," MAIN LOOP \n");
-										OutputDebugString(szText);		
-#endif
-	// Set the input thread to a high priority
-	set_priority(omni_thread::PRIORITY_HIGH);
-
-	BOOL connected = TRUE;
-	// added jeff
-	BOOL need_to_disable_input = m_server->LocalInputsDisabled();
-    bool need_to_clear_keyboard = true;
-    bool need_first_keepalive = false;
-    bool need_ft_version_msg =  false;
-	// adzm - 2010-07 - Extended clipboard
-	bool need_notify_extended_clipboard = false;
-	// adzm 2010-09 - Notify streaming DSM plugin support
-	bool need_notify_streaming_DSM = false;
-
-	while (connected)
-	{
-		rfbClientToServerMsg msg;
-
-		// Ensure that we're running in the correct desktop
-		if (!m_client->IsFileTransBusy())
-		// This desktop switch is responsible for the keyboard input
-		if (vncService::InputDesktopSelected()==0)
-		{
-			vnclog.Print(LL_CONNERR, VNCLOG("vncClientThread \n"));
-			if (!vncService::SelectDesktop(NULL, &input_desktop)) 
-					break;
-		}
-		// added jeff
-        // 2 May 2008 jdp paquette at atnetsend.net moved so that we're on the right desktop  when we're a service
-	    // Clear the CapsLock and NumLock keys
-	    if (m_client->m_keyboardenabled && need_to_clear_keyboard)
-	    {
-		    ClearKeyState(VK_CAPITAL);
-		    // *** JNW - removed because people complain it's wrong
-		    //ClearKeyState(VK_NUMLOCK);
-		    ClearKeyState(VK_SCROLL);
-            need_to_clear_keyboard = false;
-	    }
-        //
-        if (need_to_disable_input)
-        {
-            // have to do this here if we're a service so that we're on the correct desktop
-            m_client->m_encodemgr.m_buffer->m_desktop->SetDisableInput();
-            need_to_disable_input = false;
-        }
-
-        // reclaim input block after local C+A+D if user currently has it blocked 
-        m_client->m_encodemgr.m_buffer->m_desktop->block_input();
-
-        if (need_first_keepalive)
-        {
-            // send first keepalive to let the client know we accepted the encoding request
-            m_client->SendServerStateUpdate(rfbKeepAliveInterval, m_server->GetKeepAliveInterval());
-            m_client->SendKeepAlive();
-            need_first_keepalive = false;
-        }
-		if (m_client->m_want_update_state && m_client->m_Support_rfbSetServerInput)
-		{
-			m_client->m_want_update_state=false;
-			m_client->SendServerStateUpdate(m_client->m_state, m_client->m_value);
-#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText,"SendServerStateUpdate %i %i  \n",m_client->m_state,m_client->m_value);
-					OutputDebugString(szText);		
-#endif
-		}
-        if (need_ft_version_msg)
-        {
-            // send a ft protocol message to client.
-            m_client->SendFTProtocolMsg();
-            need_ft_version_msg = false;
-        }
-		// adzm - 2010-07 - Extended clipboard
-		if (need_notify_extended_clipboard)
-		{
-			m_client->NotifyExtendedClipboardSupport();
-			need_notify_extended_clipboard = false;
-		}
-		// adzm 2010-09 - Notify streaming DSM plugin support
-		if (need_notify_streaming_DSM)
-		{
-			m_client->NotifyPluginStreamingSupport();
-			need_notify_streaming_DSM = false;
-		}
-		// sf at 2002 - v1.1.2
-		int nTO = 1; // Type offset
-		// If DSM Plugin, we must read all the transformed incoming rfb messages (type included)
-		// adzm 2010-09
-		if (!m_socket->IsPluginStreamingIn() && m_socket->IsUsePluginEnabled() && m_server->GetDSMPluginPointer()->IsEnabled())
-		{
-			if (!m_socket->ReadExact((char *)&msg.type, sizeof(msg.type)))
-			{
-				connected = FALSE;
-				break;
-			}
-		    nTO = 0;
-		}
-		else
-		{
-			// Try to read a message ID
-			if (!m_socket->ReadExact((char *)&msg.type, sizeof(msg.type)))
-			{
-				connected = FALSE;
-				break;
-			}
-		}
-/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," msg.type %i \n",msg.type);
-										OutputDebugString(szText);		
-#endif*/
-		// What to do is determined by the message id
-		switch(msg.type)
-		{
-
-        case rfbKeepAlive:
-            // nothing else to read.
-            // NO-OP
-#if defined(_DEBUG)
-                    {
-                        static time_t lastrecv = 0;
-                        time_t now = time(&now);
-                        time_t delta = now - lastrecv;
-                        lastrecv = now;
-                        char msgg[255];
-                        sprintf(msgg, "keepalive received %u seconds since last one\n", delta);
-                        OutputDebugString(msgg);
-
-                    }
-#endif
-            if (sz_rfbKeepAliveMsg > 1)
-            {
-			    if (!m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbKeepAliveMsg-nTO))
-			    {
-				    connected = FALSE;
-				    break;
-			    }
-            }
-            break;
-
-		case rfbSetPixelFormat:
-			// Read the rest of the message:
-			if (!m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbSetPixelFormatMsg-nTO))
-			{
-				connected = FALSE;
-				break;
-			}
-
-			// Swap the relevant bits.
-			msg.spf.format.redMax = Swap16IfLE(msg.spf.format.redMax);
-			msg.spf.format.greenMax = Swap16IfLE(msg.spf.format.greenMax);
-			msg.spf.format.blueMax = Swap16IfLE(msg.spf.format.blueMax);
-
-			// sf at 2005 - Additional param for Grey Scale transformation
-			m_client->m_encodemgr.EnableGreyPalette((msg.spf.format.pad1 == 1));
-			
-			// Prevent updates while the pixel format is changed
-			m_client->DisableProtocol();
-				
-			// Tell the buffer object of the change			
-			if (!m_client->m_encodemgr.SetClientFormat(msg.spf.format))
-			{
-				vnclog.Print(LL_CONNERR, VNCLOG("remote pixel format invalid\n"));
-
-				connected = FALSE;
-			}
-
-			// Set the palette-changed flag, just in case...
-			m_client->m_palettechanged = TRUE;
-
-			// Re-enable updates
-			m_client->EnableProtocol();
-			
-			break;
-
-		case rfbSetEncodings:
-			// Read the rest of the message:
-			if (!m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbSetEncodingsMsg-nTO))
-			{
-				connected = FALSE;
-				break;
-			}
-
-			// RDV cache
-			m_client->m_encodemgr.EnableCache(FALSE);
-
-	        // RDV XOR and client detection
-			m_client->m_encodemgr.AvailableXOR(FALSE);
-			m_client->m_encodemgr.AvailableZRLE(FALSE);
-			m_client->m_encodemgr.AvailableTight(FALSE);
-
-			// sf at 2002 - Tight
-			m_client->m_encodemgr.SetQualityLevel(-1);
-			m_client->m_encodemgr.SetCompressLevel(6);
-			m_client->m_encodemgr.EnableLastRect(FALSE);
-
-			// Tight - CURSOR HANDLING
-			m_client->m_encodemgr.EnableXCursor(FALSE);
-			m_client->m_encodemgr.EnableRichCursor(FALSE);
-			m_server->EnableXRichCursor(FALSE);
-			m_client->m_cursor_update_pending = FALSE;
-			m_client->m_cursor_update_sent = FALSE;
-
-			// Prevent updates while the encoder is changed
-			m_client->DisableProtocol();
-
-			// Read in the preferred encodings
-			msg.se.nEncodings = Swap16IfLE(msg.se.nEncodings);
-			{
-				int x;
-				BOOL encoding_set = FALSE;
-
-				// By default, don't use copyrect!
-				m_client->m_update_tracker.enable_copyrect(false);
-
-				for (x=0; x<msg.se.nEncodings; x++)
-				{
-					CARD32 encoding;
-
-					// Read an encoding in
-					if (!m_socket->ReadExact((char *)&encoding, sizeof(encoding)))
-					{
-						connected = FALSE;
-						break;
-					}
-
-					// Is this the CopyRect encoding (a special case)?
-					if (Swap32IfLE(encoding) == rfbEncodingCopyRect)
-					{
-						m_client->m_update_tracker.enable_copyrect(true);
-						continue;
-					}
-
-					// Is this a NewFBSize encoding request?
-					if (Swap32IfLE(encoding) == rfbEncodingNewFBSize) {
-						m_client->m_use_NewSWSize = TRUE;
-						continue;
-					}
-
-					// CACHE RDV
-					if (Swap32IfLE(encoding) == rfbEncodingCacheEnable)
-					{
-						m_client->m_encodemgr.EnableCache(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("Cache protocol extension enabled\n"));
-						continue;
-					}
-
-
-					// XOR zlib
-					if (Swap32IfLE(encoding) == rfbEncodingXOREnable) {
-						m_client->m_encodemgr.AvailableXOR(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("XOR protocol extension enabled\n"));
-						continue;
-					}
-
-
-					// Is this a CompressLevel encoding?
-					if ((Swap32IfLE(encoding) >= rfbEncodingCompressLevel0) &&
-						(Swap32IfLE(encoding) <= rfbEncodingCompressLevel9))
-					{
-						// Client specified encoding-specific compression level
-						int level = (int)(Swap32IfLE(encoding) - rfbEncodingCompressLevel0);
-						m_client->m_encodemgr.SetCompressLevel(level);
-						vnclog.Print(LL_INTINFO, VNCLOG("compression level requested: %d\n"), level);
-						continue;
-					}
-
-					// Is this a QualityLevel encoding?
-					if ((Swap32IfLE(encoding) >= rfbEncodingQualityLevel0) &&
-						(Swap32IfLE(encoding) <= rfbEncodingQualityLevel9))
-					{
-						// Client specified image quality level used for JPEG compression
-						int level = (int)(Swap32IfLE(encoding) - rfbEncodingQualityLevel0);
-						m_client->m_encodemgr.SetQualityLevel(level);
-						vnclog.Print(LL_INTINFO, VNCLOG("image quality level requested: %d\n"), level);
-						continue;
-					}
-
-					// Is this a LastRect encoding request?
-					if (Swap32IfLE(encoding) == rfbEncodingLastRect) {
-						m_client->m_encodemgr.EnableLastRect(TRUE); // We forbid Last Rect for now 
-						vnclog.Print(LL_INTINFO, VNCLOG("LastRect protocol extension enabled\n"));
-						continue;
-					}
-
-					// Is this an XCursor encoding request?
-					if (Swap32IfLE(encoding) == rfbEncodingXCursor) {
-						m_client->m_encodemgr.EnableXCursor(TRUE);
-						m_server->EnableXRichCursor(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("X-style cursor shape updates enabled\n"));
-						continue;
-					}
-
-					// Is this a RichCursor encoding request?
-					if (Swap32IfLE(encoding) == rfbEncodingRichCursor) {
-						m_client->m_encodemgr.EnableRichCursor(TRUE);
-						m_server->EnableXRichCursor(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("Full-color cursor shape updates enabled\n"));
-						continue;
-					}
-
-					// Is this a PointerPos encoding request? nyama/marscha - PointerPos
-					if (Swap32IfLE(encoding) == rfbEncodingPointerPos) {
-						m_client->m_use_PointerPos = TRUE;
-						vnclog.Print(LL_INTINFO, VNCLOG("PointerPos protocol extension enabled\n"));
-						continue;
-					}
-					// 21 March 2008 jdp - client wants server state updates
-					if (Swap32IfLE(encoding) == rfbEncodingServerState) {
-						m_client->m_wants_ServerStateUpdates = true;
-                        m_server->EnableServerStateUpdates(true);
-						vnclog.Print(LL_INTINFO, VNCLOG("ServerState protocol extension enabled\n"));
-                        continue;
-					}
-					// 21 March 2008 jdp  - client wants keepalive messages
-					if (Swap32IfLE(encoding) == rfbEncodingpseudoSession) {
-						m_client->m_session_supported=true;
-						vnclog.Print(LL_INTINFO, VNCLOG("KeepAlive protocol extension enabled\n"));
-                        continue;
-					}
-
-					if (Swap32IfLE(encoding) == rfbEncodingEnableKeepAlive) {
-						m_client->m_wants_KeepAlive = true;
-                        m_server->EnableKeepAlives(true);
-                        need_first_keepalive = true;
-						vnclog.Print(LL_INTINFO, VNCLOG("KeepAlive protocol extension enabled\n"));
-                        continue;
-					}
-
-					if (Swap32IfLE(encoding) == rfbEncodingFTProtocolVersion) {
-                        need_ft_version_msg = true;
-						vnclog.Print(LL_INTINFO, VNCLOG("FTProtocolVersion protocol extension enabled\n"));
-                        continue;
-					}
-
-					// adzm - 2010-07 - Extended clipboard
-					if (Swap32IfLE(encoding) == rfbEncodingExtendedClipboard) {
-						need_notify_extended_clipboard = true;
-						m_client->m_clipboard.settings.m_bSupportsEx = true;
-						vnclog.Print(LL_INTINFO, VNCLOG("Extended clipboard protocol extension enabled\n"));
-						continue;
-					}
-
-					// adzm 2010-09 - Notify streaming DSM plugin support
-					if (Swap32IfLE(encoding) == rfbEncodingPluginStreaming) {
-						need_notify_streaming_DSM = true;
-						vnclog.Print(LL_INTINFO, VNCLOG("Streaming DSM support enabled\n"));
-						continue;
-					}
-
-					// RDV - We try to detect which type of viewer tries to connect
-					if (Swap32IfLE(encoding) == rfbEncodingZRLE) {
-						m_client->m_encodemgr.AvailableZRLE(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("ZRLE found \n"));
-						// continue;
-					}
-
-					if (Swap32IfLE(encoding) == rfbEncodingTight) {
-						m_client->m_encodemgr.AvailableTight(TRUE);
-						vnclog.Print(LL_INTINFO, VNCLOG("Tight found\n"));
-						// continue;
-					}
-
-					// Have we already found a suitable encoding?
-					if (!encoding_set)
-					{
-						// No, so try the buffer to see if this encoding will work...
-						omni_mutex_lock l(m_client->GetUpdateLock());
-						if (m_client->m_encodemgr.SetEncoding(Swap32IfLE(encoding),FALSE))
-							encoding_set = TRUE;
-					}
-				}
-
-				// If no encoding worked then default to RAW!
-				if (!encoding_set)
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("defaulting to raw encoder\n"));
-					omni_mutex_lock l(m_client->GetUpdateLock());
-					if (!m_client->m_encodemgr.SetEncoding(Swap32IfLE(rfbEncodingRaw),FALSE))
-					{
-						vnclog.Print(LL_INTERR, VNCLOG("failed to select raw encoder!\n"));
-
-						connected = FALSE;
-					}
-				}
-
-				// sf at 2002 - For now we disable cache protocole when more than one client are connected
-				// (But the cache buffer (if exists) is kept intact (for XORZlib usage))
-				if (m_server->AuthClientCount() > 1)
-					m_server->DisableCacheForAllClients();
-
-			}
-
-			// Re-enable updates
-			m_client->client_settings_passed=true;
-			m_client->EnableProtocol();
-
-
-			break;
-			
-		case rfbFramebufferUpdateRequest:
-			// Read the rest of the message:
-/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," rfbFramebufferUpdateRequest \n");
-										OutputDebugString(szText);		
-#endif*/
-			if (!m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbFramebufferUpdateRequestMsg-nTO))
-			{
-				connected = FALSE;
-				break;
-			}
-
-			{
-				//Fix server viewer crash, when server site scaling is used
-				//
-				m_client->m_ScaledScreen =m_client->m_encodemgr.m_buffer->GetViewerSize();
-
-				rfb::Rect update;
-				// Get the specified rectangle as the region to send updates for
-				// Modif sf at 2002 - Scaling.
-				update.tl.x = (Swap16IfLE(msg.fur.x) + m_client->m_SWOffsetx) * m_client->m_nScale;
-				update.tl.y = (Swap16IfLE(msg.fur.y) + m_client->m_SWOffsety) * m_client->m_nScale;
-				update.br.x = update.tl.x + Swap16IfLE(msg.fur.w) * m_client->m_nScale;
-				update.br.y = update.tl.y + Swap16IfLE(msg.fur.h) * m_client->m_nScale;
-				// Verify max size, scaled changed on server while not pushed to viewer
-				if (update.tl.x< (int)((m_client->m_ScaledScreen.tl.x + m_client->m_SWOffsetx) * m_client->m_nScale)) update.tl.x = (m_client->m_ScaledScreen.tl.x + m_client->m_SWOffsetx) * m_client->m_nScale;
-				if (update.tl.y < (int)((m_client->m_ScaledScreen.tl.y + m_client->m_SWOffsety) * m_client->m_nScale)) update.tl.y = (m_client->m_ScaledScreen.tl.y + m_client->m_SWOffsety) * m_client->m_nScale;
-				if (update.br.x > (int)(update.tl.x + (m_client->m_ScaledScreen.br.x-m_client->m_ScaledScreen.tl.x) * m_client->m_nScale)) update.br.x = update.tl.x + (m_client->m_ScaledScreen.br.x-m_client->m_ScaledScreen.tl.x) * m_client->m_nScale;
-				if (update.br.y > (int)(update.tl.y + (m_client->m_ScaledScreen.br.y-m_client->m_ScaledScreen.tl.y) * m_client->m_nScale)) update.br.y = update.tl.y + (m_client->m_ScaledScreen.br.y-m_client->m_ScaledScreen.tl.y) * m_client->m_nScale;
-				rfb::Region2D update_rgn = update;
-
-				//fullscreeen request, make it independed of the incremental rectangle
-				if (!msg.fur.incremental)
-				{
-#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText,"FULL update request \n");
-										OutputDebugString(szText);		
-#endif
-
-					update.tl.x = (m_client->m_ScaledScreen.tl.x + m_client->m_SWOffsetx) * m_client->m_nScale;
-					update.tl.y = (m_client->m_ScaledScreen.tl.y + m_client->m_SWOffsety) * m_client->m_nScale;
-					update.br.x = update.tl.x + (m_client->m_ScaledScreen.br.x-m_client->m_ScaledScreen.tl.x) * m_client->m_nScale;
-					update.br.y = update.tl.y + (m_client->m_ScaledScreen.br.y-m_client->m_ScaledScreen.tl.y) * m_client->m_nScale;
-
-					update_rgn=update;
-				}
-/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText,"Update asked for region %i %i %i %i %i \n",update.tl.x,update.tl.y,update.br.x,update.br.y,m_client->m_SWOffsetx);
-										OutputDebugString(szText);		
-#endif*/
-//				vnclog.Print(LL_SOCKERR, VNCLOG("Update asked for region %i %i %i %i %i\n"),update.tl.x,update.tl.y,update.br.x,update.br.y,m_client->m_SWOffsetx);
-
-				// RealVNC 336
-				if (update_rgn.is_empty()) {
-#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText,"FATAL! client update region is empty!\n");
-										OutputDebugString(szText);		
-#endif
-					vnclog.Print(LL_INTERR, VNCLOG("FATAL! client update region is empty!\n"));
-					connected = FALSE;
-					break;
-				}
-
-				{
-					omni_mutex_lock l(m_client->GetUpdateLock());
-
-					// Add the requested area to the incremental update cliprect
-					m_client->m_incr_rgn.assign_union(update_rgn);
-
-					// Is this request for a full update?
-					if (!msg.fur.incremental)
-					{
-						// Yes, so add the region to the update tracker
-						m_client->m_update_tracker.add_changed(update_rgn);
-						
-						// Tell the desktop grabber to fetch the region's latest state
-						m_client->m_encodemgr.m_buffer->m_desktop->QueueRect(update);
-					}					
-
-					 // Kick the update thread (and create it if not there already)
-					m_client->m_encodemgr.m_buffer->m_desktop->TriggerUpdate();
-					m_client->TriggerUpdateThread();
-				}
-			}
-			break;
-
-		case rfbKeyEvent:
-			// Read the rest of the message:
-			if (m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbKeyEventMsg-nTO))
-			{				
-				if (m_client->m_keyboardenabled)
-				{
-					msg.ke.key = Swap32IfLE(msg.ke.key);
-
-					// Get the keymapper to do the work
-					// m_client->m_keymap.DoXkeysym(msg.ke.key, msg.ke.down);
-					vncKeymap::keyEvent(msg.ke.key, (0 != msg.ke.down),m_client->m_jap);
-
-					m_client->m_remoteevent = TRUE;
-				}
-			}
-			m_client->m_encodemgr.m_buffer->m_desktop->TriggerUpdate();
-			break;
-
-		case rfbPointerEvent:
-			// Read the rest of the message:
-			if (m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbPointerEventMsg-nTO))
-			{
-				if (m_client->m_pointerenabled)
-				{
-					// Convert the coords to Big Endian
-					// Modif sf at 2002 - Scaling
-					msg.pe.x = (Swap16IfLE(msg.pe.x));
-					msg.pe.y = (Swap16IfLE(msg.pe.y));
-					//Error, msd.pe.x is defined as unsigned while with a negative secondary screen it's negative
-					//offset need to be used later in this function
-					msg.pe.x = (msg.pe.x)* m_client->m_nScale;// + (m_client->m_SWOffsetx+m_client->m_ScreenOffsetx);
-					msg.pe.y = (msg.pe.y)* m_client->m_nScale;// + (m_client->m_SWOffsety+m_client->m_ScreenOffsety);
-
-					// Work out the flags for this event
-					DWORD flags = MOUSEEVENTF_ABSOLUTE;
-
-					if (msg.pe.x != m_client->m_ptrevent.x ||
-						msg.pe.y != m_client->m_ptrevent.y)
-						flags |= MOUSEEVENTF_MOVE;
-					if ( (msg.pe.buttonMask & rfbButton1Mask) != 
-						(m_client->m_ptrevent.buttonMask & rfbButton1Mask) )
-					{
-					    if (GetSystemMetrics(SM_SWAPBUTTON))
-						flags |= (msg.pe.buttonMask & rfbButton1Mask) 
-						    ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
-					    else
-						flags |= (msg.pe.buttonMask & rfbButton1Mask) 
-						    ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
-					}
-					if ( (msg.pe.buttonMask & rfbButton2Mask) != 
-						(m_client->m_ptrevent.buttonMask & rfbButton2Mask) )
-					{
-						flags |= (msg.pe.buttonMask & rfbButton2Mask) 
-						    ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;
-					}
-					if ( (msg.pe.buttonMask & rfbButton3Mask) != 
-						(m_client->m_ptrevent.buttonMask & rfbButton3Mask) )
-					{
-					    if (GetSystemMetrics(SM_SWAPBUTTON))
-						flags |= (msg.pe.buttonMask & rfbButton3Mask) 
-						    ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
-					    else
-						flags |= (msg.pe.buttonMask & rfbButton3Mask) 
-						    ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
-					}
-
-
-					// Treat buttons 4 and 5 presses as mouse wheel events
-					DWORD wheel_movement = 0;
-					if (m_client->m_encodemgr.IsMouseWheelTight())
-					{
-						if ((msg.pe.buttonMask & rfbButton4Mask) != 0 &&
-							(m_client->m_ptrevent.buttonMask & rfbButton4Mask) == 0)
-						{
-							flags |= MOUSEEVENTF_WHEEL;
-							wheel_movement = (DWORD)+120;
-						}
-						else if ((msg.pe.buttonMask & rfbButton5Mask) != 0 &&
-								 (m_client->m_ptrevent.buttonMask & rfbButton5Mask) == 0)
-						{
-							flags |= MOUSEEVENTF_WHEEL;
-							wheel_movement = (DWORD)-120;
-						}
-					}
-					else
-					{
-						// RealVNC 335 Mouse wheel support
-						if (msg.pe.buttonMask & rfbWheelUpMask) {
-							flags |= MOUSEEVENTF_WHEEL;
-							wheel_movement = WHEEL_DELTA;
-						}
-						if (msg.pe.buttonMask & rfbWheelDownMask) {
-							flags |= MOUSEEVENTF_WHEEL;
-							wheel_movement = -WHEEL_DELTA;
-						}
-					}
-
-					// Generate coordinate values
-					// bug fix John Latino
-					// offset for multi display
-					int screenX, screenY, screenDepth;
-					m_server->GetScreenInfo(screenX, screenY, screenDepth);
-					// 1 , only one display, so always positive
-					//primary display always have (0,0) as corner
-					if (m_client->m_display_type==1)
-						{
-							unsigned long x = ((msg.pe.x + (m_client->m_SWOffsetx)) *  65535) / (screenX-1);
-							unsigned long y = ((msg.pe.y + (m_client->m_SWOffsety))* 65535) / (screenY-1);
-							// Do the pointer event
-							::mouse_event(flags, (DWORD) x, (DWORD) y, wheel_movement, 0);
-//							vnclog.Print(LL_INTINFO, VNCLOG("########mouse_event :%i %i \n"),x,y);
-						}
-					else
-						{//second or spanned
-							if (m_client->Sendinput.isValid())
-							{							
-								INPUT evt;
-								evt.type = INPUT_MOUSE;
-								int xx=msg.pe.x-GetSystemMetrics(SM_XVIRTUALSCREEN)+ (m_client->m_SWOffsetx+m_client->m_ScreenOffsetx);
-								int yy=msg.pe.y-GetSystemMetrics(SM_YVIRTUALSCREEN)+ (m_client->m_SWOffsety+m_client->m_ScreenOffsety);
-								evt.mi.dx = (xx * 65535) / (GetSystemMetrics(SM_CXVIRTUALSCREEN)-1);
-								evt.mi.dy = (yy* 65535) / (GetSystemMetrics(SM_CYVIRTUALSCREEN)-1);
-								evt.mi.dwFlags = flags | MOUSEEVENTF_VIRTUALDESK;
-								evt.mi.dwExtraInfo = 0;
-								evt.mi.mouseData = wheel_movement;
-								evt.mi.time = 0;
-								(*m_client->Sendinput)(1, &evt, sizeof(evt));
-							}
-							else
-							{
-								POINT cursorPos; GetCursorPos(&cursorPos);
-								ULONG oldSpeed, newSpeed = 10;
-								ULONG mouseInfo[3];
-								if (flags & MOUSEEVENTF_MOVE) 
-									{
-										flags &= ~MOUSEEVENTF_ABSOLUTE;
-										SystemParametersInfo(SPI_GETMOUSE, 0, &mouseInfo, 0);
-										SystemParametersInfo(SPI_GETMOUSESPEED, 0, &oldSpeed, 0);
-										ULONG idealMouseInfo[] = {10, 0, 0};
-										SystemParametersInfo(SPI_SETMOUSESPEED, 0, &newSpeed, 0);
-										SystemParametersInfo(SPI_SETMOUSE, 0, &idealMouseInfo, 0);
-									}
-								::mouse_event(flags, msg.pe.x-cursorPos.x, msg.pe.y-cursorPos.y, wheel_movement, 0);
-								if (flags & MOUSEEVENTF_MOVE) 
-									{
-										SystemParametersInfo(SPI_SETMOUSE, 0, &mouseInfo, 0);
-										SystemParametersInfo(SPI_SETMOUSESPEED, 0, &oldSpeed, 0);
-									}
-							}
-					}
-					// Save the old position
-					m_client->m_ptrevent = msg.pe;
-
-					// Flag that a remote event occurred
-					m_client->m_remoteevent = TRUE;
-
-					// Tell the desktop hook system to grab the screen...
-					// removed, terrible performance
-					// Why do we grap the screen after any inch a mouse move
-					// Removing it doesn't seems to have any missing update 
-					 m_client->m_encodemgr.m_buffer->m_desktop->TriggerUpdate();
-				}
-			}	
-			break;
-
-		case rfbClientCutText:
-			// Read the rest of the message:
-			if (m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbClientCutTextMsg-nTO))
-			{
-				// Allocate storage for the text
-				// adzm - 2010-07 - Extended clipboard
-				int length = Swap32IfLE(msg.cct.length);
-				if (length > 104857600) // 100 MBytes max
-					break;
-				if (length < 0 && m_client->m_clipboard.settings.m_bSupportsEx) {
-
-					length = abs(length);
-
-					ExtendedClipboardDataMessage extendedClipboardDataMessage;
-
-					extendedClipboardDataMessage.EnsureBufferLength(length, false);
-					
-					// Read in the data
-					if (!m_socket->ReadExact((char*)extendedClipboardDataMessage.GetBuffer(), length)) {
-						break;
-					}
-					
-					DWORD action = extendedClipboardDataMessage.GetFlags() & clipActionMask;
-
-					// clipCaps may be combined with other actions
-					if (action & clipCaps) {
-						action = clipCaps;
-					}
-
-					switch(action) {
-						case clipCaps:
-							m_client->m_clipboard.settings.HandleCapsPacket(extendedClipboardDataMessage, true);
-							break;
-						case clipProvide:
-							m_server->UpdateLocalClipTextEx(extendedClipboardDataMessage, m_client);
-							break;
-						case clipRequest:
-						case clipPeek:
-							{
-								ClipboardData clipboardData;
-								
-								// only need an owner window when setting clipboard data -- by using NULL we can rely on fewer locks
-								if (clipboardData.Load(NULL)) {
-									m_client->UpdateClipTextEx(clipboardData, extendedClipboardDataMessage.GetFlags());
-								}
-							}
-							break;
-						case clipNotify:	// irrelevant coming from viewer
-						default:
-							// unsupported or not implemented
-							break;
-					}
-				} else if (length >= 0) {
-					char* winStr = NULL;
-					{
-						char *text = new char [length+1];
-						if (text == NULL)
-							break;
-						text[length] = 0;
-
-						// Read in the text
-						if (!m_socket->ReadExact(text, length)) {
-							delete [] text;
-							break;
-						}
-						
-						int len = strlen(text);
-						winStr = new char[len*2+1];
-
-						int j = 0;
-						for (int i = 0; i < len; i++)
-						{
-							if (text[i] == 10)
-								winStr[j++] = 13;
-							winStr[j++] = text[i];
-						}
-						winStr[j++] = 0;
-						
-						// Free the clip text we read
-						delete [] text;
-					}
-
-					if (winStr != NULL) {
-						m_client->m_clipboard.m_strLastCutText = winStr;
-						// Get the server to update the local clipboard
-						m_server->UpdateLocalClipText(winStr);
-
-						// Free the transformed clip text
-						delete [] winStr;
-					}
-				} else {
-					break;
-				}
-			}
-			break;
-
-
-		// Modif sf at 2002 - Scaling
-		// Server Scaling Message received
-		case rfbPalmVNCSetScaleFactor:
-			if (m_server->AreThereMultipleViewers()==false)
-					m_client->m_fPalmVNCScaling = true;
-		case rfbSetScale: // Specific PalmVNC SetScaleFactor
-			// need to be ignored if multiple viewers are running, else buffer change on the fly and one of the viewers crash.
-			{
-			// m_client->m_fPalmVNCScaling = false;
-			// Read the rest of the message 
-			if (m_client->m_fPalmVNCScaling)
-			{
-				if (!m_socket->ReadExact(((char *) &msg) + nTO, sz_rfbPalmVNCSetScaleFactorMsg - nTO))
-				{
-					connected = FALSE;
-					break;
-				}
-			}
-			else
-			{
-				if (!m_socket->ReadExact(((char *) &msg) + nTO, sz_rfbSetScaleMsg - nTO))
-				{
-					connected = FALSE;
-					break;
-				}
-			}
-			if (m_server->AreThereMultipleViewers()==true) break;
-			// Only accept reasonable scales...
-			if (msg.ssc.scale < 1 || msg.ssc.scale > 9) break;
-			m_client->m_nScale_viewer = msg.ssc.scale;
-			m_client->m_nScale = msg.ssc.scale;
-			{
-				omni_mutex_lock l(m_client->GetUpdateLock());
-				if (!m_client->m_encodemgr.m_buffer->SetScale(msg.ssc.scale))
-					{
-						connected = FALSE;
-						break;
-					}
-	
-				m_client->fNewScale = true;
-				m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.br.x=m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.br.x/msg.ssc.scale;
-				m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.br.y=m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.br.y/msg.ssc.scale;
-				m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.tl.x=m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.tl.x/msg.ssc.scale;
-				m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.tl.y=m_client->m_encodemgr.m_buffer->m_desktop->m_cursorpos.tl.y/msg.ssc.scale;
-				InvalidateRect(NULL,NULL,TRUE);
-				m_client->TriggerUpdateThread();
-			}
-
-			}
-			break;
-
-
-		// Set Server Input
-		case rfbSetServerInput:
-			if (!m_socket->ReadExact(((char *) &msg) + nTO, sz_rfbSetServerInputMsg - nTO))
-			{
-				connected = FALSE;
-				break;
-			}
-
-			m_client->m_Support_rfbSetServerInput=true;
-			if (m_client->m_keyboardenabled)
-				{
-					// added jeff
-                vnclog.Print(LL_INTINFO, VNCLOG("rfbSetServerInput: inputs %s\n"), (msg.sim.status==1) ? "disabled" : "enabled");
-		#ifdef _DEBUG
-					char szText[256];
-					sprintf(szText,"rfbSetServerInput  %i %i %i\n",msg.sim.status,m_server->GetDesktopPointer()->GetBlockInputState() , m_client->m_bClientHasBlockedInput);
-					OutputDebugString(szText);		
-		#endif
-                // only allow change if this is the client that originally changed the input state
-				/// fix by PGM (pgmoney)
-				if (!m_server->GetDesktopPointer()->GetBlockInputState() && msg.sim.status==1) 
-					{ 
-						//CARD32 state = rfbServerState_Enabled; 
-						m_client->m_encodemgr.m_buffer->m_desktop->SetBlockInputState(true); 
-						m_client->m_bClientHasBlockedInput = (true);
-					} 
-				if (m_server->GetDesktopPointer()->GetBlockInputState() && msg.sim.status==0)
-					{
-						//CARD32 state = rfbServerState_Disabled; 
-						m_client->m_encodemgr.m_buffer->m_desktop->SetBlockInputState(FALSE);
-						m_client->m_bClientHasBlockedInput = (FALSE); 
-					} 
-
-				if (!m_server->GetDesktopPointer()->GetBlockInputState() && msg.sim.status==0)
-					{
-						//CARD32 state = rfbServerState_Disabled; 
-						m_client->m_encodemgr.m_buffer->m_desktop->SetBlockInputState(FALSE);
-						m_client->m_bClientHasBlockedInput = (FALSE);
-					}
-				}
-			break;
-
-
-		// Set Single Window
-		case rfbSetSW:
-			if (!m_socket->ReadExact(((char *) &msg) + nTO, sz_rfbSetSWMsg - nTO))
-			{
-				connected = FALSE;
-				break;
-			}
-			if (Swap16IfLE(msg.sw.x)<5 && Swap16IfLE(msg.sw.y)<5) 
-			{
-				m_client->m_encodemgr.m_buffer->m_desktop->SetSW(1,1);
-				break;
-			}
-			m_client->m_encodemgr.m_buffer->m_desktop->SetSW(
-				(Swap16IfLE(msg.sw.x) + m_client->m_SWOffsetx+m_client->m_ScreenOffsetx) * m_client->m_nScale,
-				(Swap16IfLE(msg.sw.y) + m_client->m_SWOffsety+m_client->m_ScreenOffsety) * m_client->m_nScale);
-			break;
-
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-		// Modif sf at 2002 - TextChat
-		case rfbTextChat:
-			m_client->m_pTextChat->ProcessTextChatMsg(nTO);
-			break;
-#endif
-
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-		// Modif sf at 2002 - FileTransfer
-		// File Transfer Message
-		case rfbFileTransfer:
-			{
-			// sf at 2004 - An unlogged user can't access to FT
-			bool fUserOk = true;
-			if (m_server->FTUserImpersonation())
-			{
-				fUserOk = m_client->DoFTUserImpersonation();
-			}
-
-		    if (!m_client->m_keyboardenabled || !m_client->m_pointerenabled) fUserOk = false; //PGM
-
-			omni_mutex_lock l(m_client->GetUpdateLock());
-
-			// Read the rest of the message:
-			m_client->m_fFileTransferRunning = TRUE; 
-			if (m_socket->ReadExact(((char *) &msg) + nTO, sz_rfbFileTransferMsg - nTO))
-			{
-				switch (msg.ft.contentType)
-				{
-				// A new file is received from the client
-					// case rfbFileHeader:
-                    case rfbFileTransferSessionStart:
-                        m_client->m_fFileSessionOpen = true;
-                        break;
-                    case rfbFileTransferSessionEnd:
-                        m_client->m_fFileSessionOpen = false;
-                        break;
-					case rfbFileTransferOffer:
-						{
-						omni_mutex_lock ll(m_client->GetUpdateLock());
-						if (!m_server->FileTransferEnabled() || !fUserOk) break;
-						// bool fError = false;
-						const UINT length = Swap32IfLE(msg.ft.length);
-						memset(m_client->m_szFullDestName, 0, sizeof(m_client->m_szFullDestName));
-						if (length > sizeof(m_client->m_szFullDestName)) break;
-						// Read in the Name of the file to create
-						if (!m_socket->ReadExact(m_client->m_szFullDestName, length)) 
-						{
-							//MessageBoxSecure(NULL, "1. Abort !", "Ultra WinVNC", MB_OK);
-							// vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive FileName from Viewer. Abort !\n"));
-							break;
-						}
-						
-						// sf at 2004 - Improving huge files size handling
-						CARD32 sizeL = Swap32IfLE(msg.ft.size);
-						CARD32 sizeH = 0;
-						CARD32 sizeHtmp = 0;
-						if (!m_socket->ReadExact((char*)&sizeHtmp, sizeof(CARD32)))
-						{
-							//MessageBoxSecure(NULL, "2. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive SizeH from Viewer. Abort !\n"));
-							break;
-						}
-						sizeH = Swap32IfLE(sizeHtmp);
-
-						// Parse the FileTime
-						char *p = strrchr(m_client->m_szFullDestName, ',');
-						if (p == NULL)
-							m_client->m_szFileTime[0] = '\0';
-						else 
-						{
-							strcpy(m_client->m_szFileTime, p+1);
-							*p = '\0';
-						}
-
-
-                        // make a temp file name
-                        strcpy(m_client->m_szFullDestName, make_temp_filename(m_client->m_szFullDestName).c_str());
-                        
-						DWORD dwDstSize = (DWORD)0; // Dummy size, actually a return value
-
-						// Also check the free space on destination drive
-						ULARGE_INTEGER lpFreeBytesAvailable;
-						ULARGE_INTEGER lpTotalBytes;		
-						ULARGE_INTEGER lpTotalFreeBytes;
-						unsigned long dwFreeKBytes;
-						char *szDestPath = new char [length + 1 + 64];
-						if (szDestPath == NULL) break;
-						memset(szDestPath, 0, length + 1 + 64);
-						strcpy(szDestPath, m_client->m_szFullDestName);
-						*strrchr(szDestPath, '\\') = '\0'; // We don't handle UNCs for now
-
-						// loadlibrary
-						// needed for 95 non OSR2
-						// Possible this will block filetransfer, but at least server will start
-						PGETDISKFREESPACEEX pGetDiskFreeSpaceEx;
-						pGetDiskFreeSpaceEx = (PGETDISKFREESPACEEX)GetProcAddress( GetModuleHandle("kernel32.dll"),"GetDiskFreeSpaceExA");
-
-						if (pGetDiskFreeSpaceEx)
-						{
-							if (!pGetDiskFreeSpaceEx((LPCTSTR)szDestPath,
-											&lpFreeBytesAvailable,
-											&lpTotalBytes,
-											&lpTotalFreeBytes)
-								) 
-								dwDstSize = 0xFFFFFFFF;
-						}
-
-						delete [] szDestPath;
-						dwFreeKBytes  = (unsigned long) (Int64ShraMod32(lpFreeBytesAvailable.QuadPart, 10));
-						__int64 nnFileSize = (((__int64)sizeH) << 32 ) + sizeL;
-						if ((__int64)dwFreeKBytes < (__int64)(nnFileSize / 1000)) dwDstSize = 0xFFFFFFFF;
-
-						// Allocate buffer for file packets
-						m_client->m_pBuff = new char [sz_rfbBlockSize + 1024];
-						if (m_client->m_pBuff == NULL)
-							dwDstSize = 0xFFFFFFFF;
-
-						// Allocate buffer for DeCompression
-						m_client->m_pCompBuff = new char [sz_rfbBlockSize];
-						if (m_client->m_pCompBuff == NULL)
-							dwDstSize = 0xFFFFFFFF;
-
-						rfbFileTransferMsg ft;
-						ft.type = rfbFileTransfer;
-
-						// sf at 2004 - Delta Transfer
-						bool fAlreadyExists = false;
-                        if (dwDstSize != 0xFFFFFFFF)
-                        {
-						    // sf at 2004 - Directory Delta Transfer
-						    // If the offered file is a zipped directory, we test if it already exists here
-						    // and create the zip accordingly. This way we can generate the checksums for it.
-						    // m_client->CheckAndZipDirectoryForChecksuming(m_client->m_szFullDestName);
-
-						    // Create Local Dest file
-						    m_client->m_hDestFile = CreateFile(m_client->m_szFullDestName,
-															    GENERIC_WRITE | GENERIC_READ,
-															    FILE_SHARE_READ | FILE_SHARE_WRITE,
-															    NULL,
-															    OPEN_ALWAYS,
-															    FILE_FLAG_SEQUENTIAL_SCAN,
-															    NULL);
-                            fAlreadyExists = (GetLastError() == ERROR_ALREADY_EXISTS);
-						    if (m_client->m_hDestFile == INVALID_HANDLE_VALUE)
-							    dwDstSize = 0xFFFFFFFF;
-						    else
-							    dwDstSize = 0x00;
-                        }
-						if (fAlreadyExists && dwDstSize != 0xFFFFFFFF)
-						{
-							ULARGE_INTEGER n2SrcSize;
-							bool bSize = m_client->MyGetFileSize(m_client->m_szFullDestName, &n2SrcSize); 
-							//DWORD dwFileSize = GetFileSize(m_client->m_hDestFile, NULL); 
-							//if (dwFileSize != 0xFFFFFFFF)
-							if (bSize)
-							{
-								int nCSBufferSize = (4 * (int)(n2SrcSize.QuadPart / sz_rfbBlockSize)) + 1024;
-								char* lpCSBuff = new char [nCSBufferSize];
-								if (lpCSBuff != NULL)
-								{
-									int nCSBufferLen = m_client->GenerateFileChecksums(	m_client->m_hDestFile,
-																						lpCSBuff,
-																						nCSBufferSize);
-									if (nCSBufferLen != -1)
-									{
-										ft.contentType = rfbFileChecksums;
-										ft.size = Swap32IfLE(nCSBufferSize);
-										ft.length = Swap32IfLE(nCSBufferLen);
-										//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-										m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-										m_socket->SendExactQueue((char *)lpCSBuff, nCSBufferLen);
-										delete [] lpCSBuff;
-									}
-								}
-							}
-						}
-
-						ft.contentType = rfbFileAcceptHeader;
-						ft.size = Swap32IfLE(dwDstSize); // File Size in bytes, 0xFFFFFFFF (-1) means error
-						ft.length = Swap32IfLE(strlen(m_client->m_szFullDestName));
-						//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-						m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-						m_socket->SendExact((char *)m_client->m_szFullDestName, strlen(m_client->m_szFullDestName));
-
-						if (dwDstSize == 0xFFFFFFFF)
-						{
-                            helper::close_handle(m_client->m_hDestFile);
-							if (m_client->m_pCompBuff != NULL)
-							{
-								delete [] m_client->m_pCompBuff;
-								m_client->m_pCompBuff = NULL;
-							}
-							if (m_client->m_pBuff != NULL)
-							{
-								delete [] m_client->m_pBuff;
-								m_client->m_pBuff = NULL;
-							}
-
-							//MessageBoxSecure(NULL, "3. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Dest File size. Abort !\n"));
-                            m_client->FTDownloadFailureHook();
-							break;
-						}
-
-						m_client->m_dwFileSize = Swap32IfLE(msg.ft.size);
-						m_client->m_dwNbPackets = (DWORD)(m_client->m_dwFileSize / sz_rfbBlockSize);
-						m_client->m_dwNbReceivedPackets = 0;
-						m_client->m_dwNbBytesWritten = 0;
-						m_client->m_dwTotalNbBytesWritten = 0;
-
-						m_client->m_fUserAbortedFileTransfer = false;
-						m_client->m_fFileDownloadError = false;
-						m_client->m_fFileDownloadRunning = true;
-                        m_client->FTDownloadStartHook();
-                        m_socket->SetRecvTimeout(m_server->GetFTTimeout()*1000);
-
-						}
-						break;
-
-					// The client requests a File
-					case rfbFileTransferRequest:
-						{
-						omni_mutex_lock ll(m_client->GetUpdateLock());
-						m_client->m_fCompressionEnabled = (Swap32IfLE(msg.ft.size) == 1);
-						const UINT length = Swap32IfLE(msg.ft.length);
-						memset(m_client->m_szSrcFileName, 0, sizeof(m_client->m_szSrcFileName));
-						if (length > sizeof(m_client->m_szSrcFileName)) break;
-						// Read in the Name of the file to create
-						if (!m_socket->ReadExact(m_client->m_szSrcFileName, length))
-						{
-							//MessageBoxSecure(NULL, "4. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Cannot read requested filename. Abort !\n"));
-							break;
-						}
-						
-                        // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						if (!m_server->FileTransferEnabled() || !fUserOk) break;
-						// sf at 2003 - Directory Transfer trick
-						// If the file is an Ultra Directory Zip Request we zip the directory here
-						// and we give it the requested name for transfer
-						int nDirZipRet = m_client->ZipPossibleDirectory(m_client->m_szSrcFileName);
-						if (nDirZipRet == -1)
-						{
-							//MessageBoxSecure(NULL, "5. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to zip requested dir. Abort !\n"));
-
-							//	[v1.0.2-jp1 fix] Empty directory receive problem
-							rfbFileTransferMsg ft;
-							ft.type = rfbFileTransfer;
-							ft.contentType = rfbFileHeader;
-							ft.size = Swap32IfLE(0xffffffffu); // File Size in bytes, 0xFFFFFFFF (-1) means error
-							ft.length = Swap32IfLE(strlen(m_client->m_szSrcFileName));
-							//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-							m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-							m_socket->SendExactQueue((char *)m_client->m_szSrcFileName, strlen(m_client->m_szSrcFileName));
-                            // 2 May 2008 jdp send the highpart too, else the client will hang
-                            // sf at 2004 - Improving huge file size handling
-                            // TODO: what if we're speaking the old protocol, how can we tell? 
-					        CARD32 sizeH = Swap32IfLE(0xffffffffu);
-					        m_socket->SendExact((char *)&sizeH, sizeof(CARD32));
-
-							m_client->m_fFileUploadError = true;
-							m_client->m_fFileUploadRunning = false;
-                            m_client->FTUploadFailureHook();
-
-							break;
-						}
-
-
-						// Open source file
-						m_client->m_hSrcFile = CreateFile(
-															m_client->m_szSrcFileName,		
-															GENERIC_READ,		
-															FILE_SHARE_READ,	
-															NULL,				
-															OPEN_EXISTING,		
-															FILE_FLAG_SEQUENTIAL_SCAN,	
-															NULL
-														);				
-						
-						// DWORD dwSrcSize = (DWORD)0;
-						ULARGE_INTEGER n2SrcSize;
-						if (m_client->m_hSrcFile == INVALID_HANDLE_VALUE)
-						{
-							DWORD TheError = GetLastError();
-							// dwSrcSize = 0xFFFFFFFF;
-							n2SrcSize.LowPart = 0xFFFFFFFF;
-                            n2SrcSize.HighPart = 0xFFFFFFFF;
-						}
-						else
-						{	
-							// Source file size 
-							bool bSize = m_client->MyGetFileSize(m_client->m_szSrcFileName, &n2SrcSize); 
-							// dwSrcSize = GetFileSize(m_client->m_hSrcFile, NULL); 
-							// if (dwSrcSize == 0xFFFFFFFF)
-							if (!bSize)
-							{
-								helper::close_handle(m_client->m_hSrcFile);
-								n2SrcSize.LowPart = 0xFFFFFFFF;
-                                n2SrcSize.HighPart = 0xFFFFFFFF;
-							}
-							else
-							{
-								// Add the File Time Stamp to the filename
-								FILETIME SrcFileModifTime; 
-								BOOL fRes = GetFileTime(m_client->m_hSrcFile, NULL, NULL, &SrcFileModifTime);
-								if (fRes)
-								{
-									char szSrcFileTime[18];
-									// sf at 2003 - Convert file time to local time
-									// We've made the choice off displaying all the files 
-									// off client AND server sides converted in clients local
-									// time only. So we don't convert server's files times.
-									/*
-									FILETIME LocalFileTime;
-									FileTimeToLocalFileTime(&SrcFileModifTime, &LocalFileTime);
-									*/
-									SYSTEMTIME FileTime;
-									FileTimeToSystemTime(&SrcFileModifTime/*&LocalFileTime*/, &FileTime);
-									wsprintf(szSrcFileTime,"%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
-											FileTime.wMonth,
-											FileTime.wDay,
-											FileTime.wYear,
-											FileTime.wHour,
-											FileTime.wMinute
-											);
-									strcat(m_client->m_szSrcFileName, ",");
-									strcat(m_client->m_szSrcFileName, szSrcFileTime);
-								}
-							}
-						}
-
-						// sf at 2004 - Delta Transfer
-						if (m_client->m_lpCSBuffer != NULL) 
-						{
-							delete [] m_client->m_lpCSBuffer;
-							m_client->m_lpCSBuffer = NULL;
-						}
-						m_client->m_nCSOffset = 0;
-						m_client->m_nCSBufferSize = 0;
-
-						// Send the FileTransferMsg with rfbFileHeader
-						rfbFileTransferMsg ft;
-						
-						ft.type = rfbFileTransfer;
-						ft.contentType = rfbFileHeader;
-						ft.size = Swap32IfLE(n2SrcSize.LowPart); // File Size in bytes, 0xFFFFFFFF (-1) means error
-						ft.length = Swap32IfLE(strlen(m_client->m_szSrcFileName));
-						//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-						m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-						m_socket->SendExactQueue((char *)m_client->m_szSrcFileName, strlen(m_client->m_szSrcFileName));
-						
-						// sf at 2004 - Improving huge file size handling
-						CARD32 sizeH = Swap32IfLE(n2SrcSize.HighPart);
-						m_socket->SendExact((char *)&sizeH, sizeof(CARD32));
-
-						// delete [] szSrcFileName;
-						if (n2SrcSize.LowPart == 0xFFFFFFFF && n2SrcSize.HighPart == 0xFFFFFFFF)
-						{
-							//MessageBoxSecure(NULL, "6. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Src File size. Abort !\n"));
-                            m_client->FTUploadFailureHook();
-							break; // If error, we don't send anything else
-						}
-                        m_client->FTUploadStartHook();
-						}
-						break;
-
-					// sf at 2004 - Delta Transfer
-					// Destination file already exists - the viewer sends the checksums
-					case rfbFileChecksums:
-                        m_socket->SetSendTimeout(m_server->GetFTTimeout()*1000);
-						connected = m_client->ReceiveDestinationFileChecksums(Swap32IfLE(msg.ft.size), Swap32IfLE(msg.ft.length));
-						break;
-
-					// Destination file (viewer side) is ready for reception (size > 0) or not (size = -1)
-					case rfbFileHeader:
-						{
-						// Check if the file has been created on client side
-						if (Swap32IfLE(msg.ft.size) == -1)
-						{
-							helper::close_handle(m_client->m_hSrcFile);
-                            m_client->FTUploadFailureHook();
-							// MessageBoxSecure(NULL, "7. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: File not created on client side. Abort !\n"));
-							break;
-						}
-
-						// Allocate buffer for file packets
-						m_client->m_pBuff = new char [sz_rfbBlockSize];
-						if (m_client->m_pBuff == NULL)
-						{
-							helper::close_handle(m_client->m_hSrcFile);
-							//MessageBoxSecure(NULL, "8. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate buffer. Abort !\n"));
-                            m_client->FTUploadFailureHook();
-							break;
-						}
-
-						// Allocate buffer for compression
-						// Todo : make a global buffer with CheckBufferSize proc
-						m_client->m_pCompBuff = new char [sz_rfbBlockSize + 1024]; // TODO: Improve this
-						if (m_client->m_pCompBuff == NULL)
-						{
-							helper::close_handle(m_client->m_hSrcFile);
-							if (m_client->m_pBuff != NULL) {
-								delete [] m_client->m_pBuff;
-								m_client->m_pBuff = NULL;
-							}
-							//MessageBoxSecure(NULL, "9. Abort !", "Ultra WinVNC", MB_OK);
-							//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate comp. buffer. Abort !\n"));
-                            m_client->FTUploadFailureHook();
-							break;
-						}
-
-						m_client->m_fEof = false;
-						m_client->m_dwNbBytesRead = 0;
-						m_client->m_dwTotalNbBytesWritten = 0;
-						m_client->m_nPacketCount = 0;
-						m_client->m_fFileUploadError = false;
-						m_client->m_fFileUploadRunning = true;
-                        m_client->m_fUserAbortedFileTransfer = false;
-
-						connected = m_client->SendFileChunk();
-						}
-						break;
-
-
-					case rfbFilePacket:
-						if (!m_server->FileTransferEnabled() || !fUserOk) break;
-						connected = m_client->ReceiveFileChunk(Swap32IfLE(msg.ft.length), Swap32IfLE(msg.ft.size));
-                        m_client->SendKeepAlive();
-						break;
-
-
-					case rfbEndOfFile:
-						if (!m_server->FileTransferEnabled() || !fUserOk) break;
-
-						if (m_client->m_fFileDownloadRunning)
-						{
-							m_client->FinishFileReception();
-						}
-						break;
-
-					// We use this message for FileTransfer rights (<=RC18 versions)
-					// The client asks for FileTransfer permission
-					case rfbAbortFileTransfer:
-
-						// For now...
-						if (m_client->m_fFileDownloadRunning)
-						{
-							m_client->m_fFileDownloadError = true;
-                            m_client->m_fUserAbortedFileTransfer = true;
-							m_client->FinishFileReception();
-						}
-						else if (m_client->m_fFileUploadRunning)
-						{
-							m_client->m_fFileUploadError = true;
-                            m_client->m_fUserAbortedFileTransfer = true;
-							// m_client->FinishFileSending();
-						}
-						else // Old method for FileTransfer handshake perimssion (<=RC18)
-						{
-							// We reject any <=RC18 Viewer FT 
-							m_client->fFTRequest = true;
-
-							// sf at 2002 - DO IT HERE FOR THE MOMENT 
-							// FileTransfer permission requested by the client
-							if (m_client->fFTRequest)
-							{
-								rfbFileTransferMsg ft;
-								ft.type = rfbFileTransfer;
-								ft.contentType = rfbAbortFileTransfer;
-
-								bool bOldFTProtocole = (msg.ft.contentParam == 0);
-								if (bOldFTProtocole)
-									ft.contentType = rfbAbortFileTransfer; // Viewer with New V2 FT protocole
-								else
-									ft.contentType = rfbFileTransferAccess; // Viewer with old FT protocole
-
-								if (!bOldFTProtocole && m_server->FileTransferEnabled() && m_client->m_server->RemoteInputsEnabled() && fUserOk)
-								   ft.size = Swap32IfLE(1);
-								else
-								   ft.size = Swap32IfLE(-1); 
-								m_client->m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-								m_client->fFTRequest = false;
-							}
-						}
-						break;
-
-					/* Not yet used because we want backward compatibility...
-					// From RC19 versions, the viewer uses this new message to request FT persmission
-					// It also transmits its FT versions
-					case rfbFileTransferAccess:
-						m_client->fFTRequest = true;
-
-						// FileTransfer permission requested by the client
-						if (m_client->fFTRequest)
-						{
-							rfbFileTransferMsg ft;
-							ft.type = rfbFileTransfer;
-							ft.contentType = rfbFileTransferAccess;
-
-							if (m_server->FileTransferEnabled() && m_client->m_server->RemoteInputsEnabled())
-							   ft.size = Swap32IfLE(1);
-							else
-							   ft.size = Swap32IfLE(-1); 
-							m_client->m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-							m_client->fFTRequest = false;
-						}
-
-						break;
-					*/
-
-					// The client requests the content of a directory or Drives List
-					case rfbDirContentRequest:
-						switch (msg.ft.contentParam)
-						{
-							// Client requests the List of Local Drives
-							case rfbRDrivesList:
-								{
-								TCHAR szDrivesList[256]; // Format when filled : "C:\<NULL>D:\<NULL>....Z:\<NULL><NULL>
-								DWORD dwLen;
-								DWORD nIndex = 0;
-								int nType = 0;
-								TCHAR szDrive[4];
-								dwLen = GetLogicalDriveStrings(256, szDrivesList);
-                                // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						        if (!m_server->FileTransferEnabled() || !fUserOk) break;
-
-								// We add Drives types to this drive list...
-								while (nIndex < dwLen - 3)
-								{
-									strcpy(szDrive, szDrivesList + nIndex);
-									// We replace the "\" char following the drive letter and ":"
-									// with a char corresponding to the type of drive
-									// We obtain something like "C:l<NULL>D:c<NULL>....Z:n\<NULL><NULL>"
-									// Isn't it ugly ?
-									nType = GetDriveType(szDrive);
-									switch (nType)
-									{
-									case DRIVE_FIXED:
-										szDrivesList[nIndex + 2] = 'l';
-										break;
-									case DRIVE_REMOVABLE:
-										szDrivesList[nIndex + 2] = 'f';
-										break;
-									case DRIVE_CDROM:
-										szDrivesList[nIndex + 2] = 'c';
-										break;
-									case DRIVE_REMOTE:
-										szDrivesList[nIndex + 2] = 'n';
-										break;
-									}
-									nIndex += 4;
-								}
-
-								rfbFileTransferMsg ft;
-								ft.type = rfbFileTransfer;
-								ft.contentType = rfbDirPacket;
-								ft.contentParam = rfbADrivesList;
-								ft.length = Swap32IfLE((int)dwLen);
-								//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-								m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-								m_socket->SendExact((char *)szDrivesList, (int)dwLen);
-								}
-								break;
-
-							// Client requests the content of a directory
-							case rfbRDirContent:
-								{
-									//omni_mutex_lock l(m_client->GetUpdateLock());
-
-									const UINT length = Swap32IfLE(msg.ft.length);
-									char szDir[MAX_PATH + 2];
-									if (length > sizeof(szDir)) break;
-
-									// Read in the Name of Dir to explore
-									if (!m_socket->ReadExact(szDir, length)) break;
-									szDir[length] = 0;
-
-                                    // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						            if (!m_server->FileTransferEnabled() || !fUserOk) break;
-									// sf at 2004 - Shortcuts Case
-									// Todo: Cultures translation ?
-									int nFolder = -1;
-									char szP[MAX_PATH + 2];
-									bool fShortError = false;
-									if (!_strnicmp(szDir, "My Documents", 11))
-										nFolder = CSIDL_PERSONAL;
-									if (!_strnicmp(szDir, "Desktop", 7))
-										nFolder = CSIDL_DESKTOP;
-									if (!_strnicmp(szDir, "Network Favorites", 17))
-										nFolder = CSIDL_NETHOOD;
-
-									if (nFolder != -1)
-										// if (SHGetSpecialFolderPath(NULL, szP, nFolder, FALSE))
-										if (m_client->GetSpecialFolderPath(nFolder, szP))
-										{
-											if (szP[strlen(szP)-1] != '\\') strcat(szP,"\\");
-											strcpy(szDir, szP);
-										}
-										else
-											fShortError = true;
-
-									strcat(szDir, "*");
-
-									WIN32_FIND_DATA fd;
-									HANDLE ff;
-									BOOL fRet = TRUE;
-
-									rfbFileTransferMsg ft;
-									ft.type = rfbFileTransfer;
-									ft.contentType = rfbDirPacket;
-									ft.contentParam = rfbADirectory; // or rfbAFile...
-
-									DWORD errmode = SetErrorMode(SEM_FAILCRITICALERRORS); // No popup please !
-									ff = FindFirstFile(szDir, &fd);
-									SetErrorMode( errmode );
-									
-									// Case of media not accessible
-									if (ff == INVALID_HANDLE_VALUE || fShortError)
-									{
-										ft.length = Swap32IfLE(0);										
-										m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-										break;
-									}
-
-									ft.length = Swap32IfLE(strlen(szDir)-1);	
-									//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-									m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-									// sf at 2004 - Also send back the full directory path to the viewer (necessary for Shorcuts)
-									m_socket->SendExactQueue((char *)szDir, strlen(szDir)-1);
-
-
-									while ( fRet )
-									{
-										// sf at 2003 - Convert file time to local time
-										// We've made the choice off displaying all the files 
-										// off client AND server sides converted in clients local
-										// time only. So we don't convert server's files times.
-										/* 
-										FILETIME LocalFileTime;
-										FileTimeToLocalFileTime(&fd.ftLastWriteTime, &LocalFileTime);
-										fd.ftLastWriteTime.dwLowDateTime = LocalFileTime.dwLowDateTime;
-										fd.ftLastWriteTime.dwHighDateTime = LocalFileTime.dwHighDateTime;
-										*/
-
-										if (((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY && strcmp(fd.cFileName, "."))
-											||
-											(!strcmp(fd.cFileName, "..")))
-										{
-											// Serialize the interesting part of WIN32_FIND_DATA
-											char szFileSpec[sizeof(WIN32_FIND_DATA)];
-											int nOptLen = sizeof(WIN32_FIND_DATA) - MAX_PATH - 14 + lstrlen(fd.cFileName);
-											memcpy(szFileSpec, &fd, nOptLen);
-
-											ft.length = Swap32IfLE(nOptLen);
-											//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-											m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-											m_socket->SendExactQueue((char *)szFileSpec, nOptLen);
-										}
-										else if (strcmp(fd.cFileName, "."))
-										{
-											// Serialize the interesting part of WIN32_FIND_DATA
-											// Get rid of the trailing blanck chars. It makes a BIG
-											// difference when there's a lot of files in the dir.
-											char szFileSpec[sizeof(WIN32_FIND_DATA)];
-											int nOptLen = sizeof(WIN32_FIND_DATA) - MAX_PATH - 14 + lstrlen(fd.cFileName);
-											memcpy(szFileSpec, &fd, nOptLen);
-
-											ft.length = Swap32IfLE(nOptLen);
-											//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-											m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-											m_socket->SendExactQueue((char *)szFileSpec, nOptLen);
-
-										}
-										fRet = FindNextFile(ff, &fd);
-									}
-									FindClose(ff);
-									
-									// End of the transfer
-									ft.contentParam = 0;
-									ft.length = Swap32IfLE(0);
-									m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-								}
-								break;
-						}
-						break;
-
-					// The client sends a command
-					case rfbCommand:
-						switch (msg.ft.contentParam)
-						{
-							// Client requests the creation of a directory
-							case rfbCDirCreate:
-								{
-									const UINT length = Swap32IfLE(msg.ft.length);
-									char szDir[MAX_PATH];
-									if (length > sizeof(szDir)) break;
-
-									// Read in the Name of Dir to explore
-									if (!m_socket->ReadExact(szDir, length))
-									{
-										// todo: manage error !
-										break;
-									}
-									szDir[length] = 0;
-
-                                    // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						            if (!m_server->FileTransferEnabled() || !fUserOk) break;
-									// Create the Dir
-									BOOL fRet = CreateDirectory(szDir, NULL);
-
-									rfbFileTransferMsg ft;
-									ft.type = rfbFileTransfer;
-									ft.contentType = rfbCommandReturn;
-									ft.contentParam = rfbADirCreate;
-									ft.size = fRet ? 0 : -1;
-									ft.length = msg.ft.length;
-
-									//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-									m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-									m_socket->SendExact((char *)szDir, (int)length);
-                                    if (fRet)
-                                        m_client->FTNewFolderHook(szDir);
-								}
-								break;
-
-							// Client requests the deletion of a file
-							case rfbCFileDelete:
-								{
-									UINT length = Swap32IfLE(msg.ft.length);
-									char szFile[MAX_PATH];
-									if (length > sizeof(szFile)) break;
-
-									// Read in the Name of the File 
-									if (!m_socket->ReadExact(szFile, length))
-									{
-										// todo: manage error !
-										break;
-									}
-									szFile[length] = 0;
-                                    // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						            if (!m_server->FileTransferEnabled() || !fUserOk) break;
-
-									// Delete the file
-                                    // 13 February 2008 jdp
-                                    bool isDir = isDirectory(szFile);
-                                    std::string newname(szFile);
-                                    // put the '[]' around the name if it's a folder, so that the client can display
-                                    // the proper messages. Otherwise, the client assumes it's a file.
-                                    if (isDir)
-                                        newname = AddDirPrefixAndSuffix(szFile);
-
-                                    length = newname.length()+1;
-									BOOL fRet = DeleteFileOrDirectory(szFile);
-
-									rfbFileTransferMsg ft;
-									ft.type = rfbFileTransfer;
-									ft.contentType = rfbCommandReturn;
-									ft.contentParam = rfbAFileDelete;
-									ft.size = fRet ? 0 : -1;
-									ft.length = Swap32IfLE(length);
-
-									//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-									m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-									m_socket->SendExact((char *)newname.c_str(), length);
-                                    if (fRet)
-                                        m_client->FTDeleteHook(szFile, isDir);
-								}
-								break;
-
-							// Client requests the Renaming of a file/directory
-							case rfbCFileRename:
-								{
-									const UINT length = Swap32IfLE(msg.ft.length);
-									char szNames[(2 * MAX_PATH) + 1];
-									if (length > sizeof(szNames)) break;
-
-									// Read in the Names
-									if (!m_socket->ReadExact(szNames, length))
-									{
-										// todo: manage error !
-										break;
-									}
-									szNames[length] = 0;
-                                    // moved jdp 8/5/08 -- have to read whole packet to keep protocol in sync
-						            if (!m_server->FileTransferEnabled() || !fUserOk) break;
-
-									char *p = strrchr(szNames, '*');
-									if (p == NULL) break;
-									char szCurrentName[ (2 * MAX_PATH) + 1];
-									char szNewName[ (2 * MAX_PATH) + 1];
-
-									strcpy(szNewName, p + 1); 
-									*p = '\0';
-									strcpy(szCurrentName, szNames);
-									*p = '*';
-
-									// Rename
-									BOOL fRet = MoveFile(szCurrentName, szNewName);
-
-									rfbFileTransferMsg ft;
-									ft.type = rfbFileTransfer;
-									ft.contentType = rfbCommandReturn;
-									ft.contentParam = rfbAFileRename;
-									ft.size = fRet ? 0 : -1;
-									ft.length = msg.ft.length;
-
-									//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-									m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-									m_socket->SendExact((char *)szNames, (int)length);
-                                    if (fRet)
-                                        m_client->FTRenameHook(szCurrentName, szNewName);
-								}
-								break;
-
-
-						}  // End of swith
-						break;
-
-				} // End of switch
-
-			} // End of if
-			else // Fix from Jeremy C. 
-			{
-				if (m_client->m_fFileDownloadRunning)
-				{
-					m_client->m_fFileDownloadError = true;
-					FlushFileBuffers(m_client->m_hDestFile);
-                    helper::close_handle(m_client->m_hDestFile);
-                    m_client->FTDownloadFailureHook();
-                    m_client->m_fFileDownloadRunning = false;
-				}
-                if (m_client->m_fFileUploadRunning)
-                {
-					m_client->m_fFileUploadError = true;
-                    FlushFileBuffers(m_client->m_hSrcFile);
-                    helper::close_handle(m_client->m_hSrcFile);
-                    m_client->FTUploadFailureHook();
-                    m_client->m_fFileUploadRunning = false;
-				}
-				//vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: message content reading error\n"));
-			}
-			/*
-			// sf at 2005 - Cancel FT User impersonation if possible
-			// Fix from byteboon (Jeremy C.)
-			if (m_server->FTUserImpersonation())
-			{
-				m_client->UndoFTUserImpersonation();
-			}
-			*/
-
-			m_client->m_fFileTransferRunning = FALSE;
-			}
-			break;
-#endif
-
-			// Modif cs at 2005
-#ifdef DSHOW
-		case rfbKeyFrameRequest:
-			{
-				MutexAutoLock l_Lock(&m_client->m_hmtxEncodeAccess);
-
-				omni_mutex_lock l(m_client->GetUpdateLock());
-
-				if(m_client->m_encodemgr.ResetZRLEEncoding())
-				{
-					rfb::Rect update;
-
-					rfb::Rect ViewerSize = m_client->m_encodemgr.m_buffer->GetViewerSize();
-
-					update.tl.x = 0;
-					update.tl.y = 0;
-					update.br.x = ViewerSize.br.x;
-					update.br.y = ViewerSize.br.y;
-					rfb::Region2D update_rgn = update;
-
-					// Add the requested area to the incremental update cliprect
-					m_client->m_incr_rgn.assign_union(update_rgn);
-
-					// Yes, so add the region to the update tracker
-					m_client->m_update_tracker.add_changed(update_rgn);
-					
-					// Tell the desktop grabber to fetch the region's latest state
-					m_client->m_encodemgr.m_buffer->m_desktop->QueueRect(update);
-
-					// Kick the update thread (and create it if not there already)
-					m_client->TriggerUpdateThread();
-
-					// Send a message back to the client to confirm that we have reset the zrle encoding			
-					rfbKeyFrameUpdateMsg header;
-					header.type = rfbKeyFrameUpdate;
-					m_client->SendRFBMsg(rfbKeyFrameUpdate, (BYTE *)&header, sz_rfbKeyFrameUpdateMsg);
-				}				
-				else
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("[rfbKeyFrameRequest] Unable to Reset ZRLE Encoding\n"));
-				}
-			}
-			break;
-#endif
-		// adzm 2010-09 - Notify streaming DSM plugin support
-        case rfbNotifyPluginStreaming:
-            if (sz_rfbNotifyPluginStreamingMsg > 1)
-            {
-			    if (!m_socket->ReadExact(((char *) &msg)+nTO, sz_rfbNotifyPluginStreamingMsg-nTO))
-			    {
-				    connected = FALSE;
-				    break;
-			    }
-            }
-			m_socket->SetPluginStreamingIn();
-            break;
-#ifdef ULTRAVNC_ITALC_SUPPORT
-		case rfbItalcCoreRequest:
-		{
-			omni_mutex_lock l(m_client->GetUpdateLock());
-			if( !ItalcCoreServer::instance()->
-				handleItalcClientMessage( vsocketDispatcher, m_socket ) )
-			{
-				connected = FALSE;
-			}
-			break;
-		}
-#endif
-		default:
-			// Unknown message, so fail!
-			connected = FALSE;
-		}
-
-		// sf at 2005 - Cancel FT User impersonation if possible
-		// We do it here to ensure impersonation is cancelled
-		if (m_server->FTUserImpersonation())
-		{
-			m_client->UndoFTUserImpersonation();
-		}
-
-	}
-
-	if (fShutdownOrdered) {
-		m_autoreconnectcounter_quit=true;
-		//needed to give autoreconnect (max 100) to quit
-		Sleep(200);
-	}
-	
-
-    if (m_client->m_fFileDownloadRunning)
-    {
-        m_client->m_fFileDownloadError = true;
-        FlushFileBuffers(m_client->m_hDestFile);
-        m_client->FTDownloadFailureHook();
-        m_client->m_fFileDownloadRunning = false;
-        helper::close_handle(m_client->m_hDestFile);
-    }
-        
-    if (m_client->m_fFileUploadRunning)
-    {
-        m_client->m_fFileUploadError = true;
-        FlushFileBuffers(m_client->m_hSrcFile);
-        m_client->FTUploadFailureHook();
-        m_client->m_fFileUploadRunning = false;
-        helper::close_handle(m_client->m_hSrcFile);
-    }
-
-  
-
-	// Move into the thread's original desktop
-	// TAG 14
-	vncService::SelectHDESK(home_desktop);
-    if (m_client->m_bClientHasBlockedInput)
-    {
-        m_client->m_encodemgr.m_buffer->m_desktop->SetBlockInputState(false);
-        m_client->m_bClientHasBlockedInput = false;
-    }
-	if (input_desktop)
-		if (!CloseDesktop(input_desktop))
-		vnclog.Print(LL_INTERR, VNCLOG("failed to close desktop\n"));
-	// Quit this thread.  This will automatically delete the thread and the
-	// associated client.
-	vnclog.Print(LL_CLIENTS, VNCLOG("client disconnected : %s (%hd)\n"),
-									m_client->GetClientName(),
-									m_client->GetClientId());
-	//////////////////
-	// LOG it also in the event
-	//////////////////
-	{
-		typedef BOOL (*LogeventFn)(char *machine);
-		LogeventFn Logevent = 0;
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			*p = '\0';
-			strcat (szCurrentDir,"\\logging.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				//BOOL result=false;
-				Logevent = (LogeventFn) GetProcAddress( hModule, "LOGEXIT" );
-				Logevent((char *)m_client->GetClientName());
-				FreeLibrary(hModule);
-			}
-	}
-
-
-	// Disable the protocol to ensure that the update thread
-	// is not accessing the desktop and buffer objects
-	m_client->DisableProtocol();
-
-	// Finally, it's safe to kill the update thread here
-	if (m_client->m_updatethread) {
-		m_client->m_updatethread->Kill();
-		m_client->m_updatethread->join(NULL);
-	}
-	// Remove the client from the server
-	// This may result in the desktop and buffer being destroyed
-	// It also guarantees that the client will not be passed further
-	// updates
-	m_server->RemoveClient(m_client->GetClientId());
-
-	// sf at 2003 - AutoReconnection attempt if required
-	if (!fShutdownOrdered) {
-		if (m_client->m_Autoreconnect)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient II\n"));
-			m_server->AutoReconnect(m_client->m_Autoreconnect);
-			m_server->AutoReconnectPort(m_AutoReconnectPort);
-			m_server->AutoReconnectAdr(m_szAutoReconnectAdr);
-			m_server->AutoReconnectId(m_szAutoReconnectId);
-			vncService::PostAddNewClient(1111, 1111);
-		}
-	}
-}
-
-// The vncClient itself
-
-// adzm - 2010-07 - Extended clipboard
-vncClient::vncClient() : m_clipboard(ClipboardSettings::defaultServerCaps), Sendinput("USER32", "SendInput")
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("vncClient() executing...\n"));
-
-	m_socket = NULL;
-	m_client_name = 0;
-
-	// Initialise mouse fields
-	m_mousemoved = FALSE;
-	m_ptrevent.buttonMask = 0;
-	m_ptrevent.x = 0;
-	m_ptrevent.y=0;
-
-	// Other misc flags
-	m_thread = NULL;
-	m_palettechanged = FALSE;
-
-	// Initialise the two update stores
-	m_updatethread = NULL;
-	m_update_tracker.init(this);
-
-	m_remoteevent = FALSE;
-
-	// adzm - 2010-07 - Extended clipboard
-	//m_clipboard_text = 0;
-
-	// IMPORTANT: Initially, client is not protocol-ready.
-	m_disable_protocol = 1;
-
-	//SINGLE WINDOW
-	m_use_NewSWSize = FALSE;
-	m_SWOffsetx=0;
-	vnclog.Print(LL_INTINFO, VNCLOG("TEST 4\n"));
-	m_SWOffsety=0;
-	m_ScreenOffsetx=0;
-	m_ScreenOffsety=0;
-
-	// sf at 2002 
-	fNewScale = false;
-	m_fPalmVNCScaling = false;
-	fFTRequest = false;
-
-	// Modif sf at 2002 - FileTransfer
-	m_fFileTransferRunning = FALSE;
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	m_pZipUnZip = new CZipUnZip32(); // Directory FileTransfer utils
-#endif
-
-	m_hDestFile = 0;
-	//m_szFullDestName = NULL;
-	m_dwFileSize = 0; 
-	m_dwNbPackets = 0;
-	m_dwNbReceivedPackets = 0;
-	m_dwNbBytesWritten = 0;
-	m_dwTotalNbBytesWritten = 0;
-	m_fFileDownloadError = false;
-    m_fUserAbortedFileTransfer  = false;
-	m_fFileDownloadRunning = false;
-	m_hSrcFile = INVALID_HANDLE_VALUE;
-	//m_szSrcFileName = NULL;
-	m_fEof = false;
-	m_dwNbBytesRead = 0;
-	m_dwTotalNbBytesRead = 0;
-	m_nPacketCount = 0;
-	m_fCompressionEnabled = false;
-	m_fFileUploadError = false;
-	m_fFileUploadRunning = false;
-
-	// sf at 2004 - Delta Transfer
-	m_lpCSBuffer = NULL;
-	m_nCSOffset = 0;
-	m_nCSBufferSize = 0;
-
-	// CURSOR HANDLING
-	m_cursor_update_pending = FALSE;
-	m_cursor_update_sent = FALSE;
-	// nyama/marscha - PointerPos
-	m_use_PointerPos = FALSE;
-	m_cursor_pos_changed = FALSE;
-	m_cursor_pos.x = 0;
-	m_cursor_pos.y = 0;
-
-	//cachestats
-	totalraw=0;
-
-	m_pRawCacheZipBuf = NULL;
-	m_nRawCacheZipBufSize = 0;
-	m_pCacheZipBuf = NULL;
-	m_nCacheZipBufSize = 0;
-
-	// sf at 2005 - FTUserImpersonation
-	m_fFTUserImpersonatedOk = false;
-	m_lLastFTUserImpersonationTime = 0L;
-
-	// Modif sf at 2002 - Text Chat
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	m_pTextChat = new TextChat(this); 	
-#endif
-	m_fUltraViewer = true;
-	m_IsLoopback=false;
-	m_NewSWUpdateWaiting=false;
-	client_settings_passed=false;
-/*	roundrobin_counter=0;
-	for (int i=0;i<rfbEncodingZRLE+1;i++)
-		for (int j=0;j<31;j++)
-		{
-		  timearray[i][j]=0;
-		  sizearray[i][j]=0;
-		}*/
-// Modif cs at 2005
-#ifdef DSHOW
-	m_hmtxEncodeAccess = CreateMutex(NULL, FALSE, NULL);
-#endif
-    m_wants_ServerStateUpdates =  false;
-    m_bClientHasBlockedInput = false;
-	m_Support_rfbSetServerInput = false;
-    m_wants_KeepAlive = false;
-	m_session_supported = false;
-    m_fFileSessionOpen = false;
-	m_pBuff = 0;
-	m_pCompBuff = 0;
-	m_NewSWDesktop = 0;
-	NewsizeW = 0;
-	NewsizeH = 0;
-
-	
-	// adzm 2009-07-05
-	m_szRepeaterID = NULL; // as in, not using
-	m_szHost = NULL;
-	m_hostPort = 0;
-	m_want_update_state=false;
-	m_initial_update=true;
-	m_nScale_viewer = 1;
-}
-
-vncClient::~vncClient()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("~vncClient() executing...\n"));
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	// Modif sf at 2002 - Text Chat
-	if (m_pTextChat) 
-	{
-        m_pTextChat->KillDialog();
-		delete(m_pTextChat);
-		m_pTextChat = NULL;
-	}
-#endif
-
-	// Directory FileTransfer utils
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	if (m_pZipUnZip) delete m_pZipUnZip;
-#endif
-
-	// We now know the thread is dead, so we can clean up
-	if (m_client_name != 0) {
-		free(m_client_name);
-		m_client_name = 0;
-	}
-
-	// If we have a socket then kill it
-	if (m_socket != NULL)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("deleting socket\n"));
-
-		delete m_socket;
-		m_socket = NULL;
-	}
-	if (m_pRawCacheZipBuf != NULL)
-		{
-			delete [] m_pRawCacheZipBuf;
-			m_pRawCacheZipBuf = NULL;
-		}
-	if (m_pCacheZipBuf != NULL)
-		{
-			delete [] m_pCacheZipBuf;
-			m_pCacheZipBuf = NULL;
-		}
-	// adzm - 2010-07 - Extended clipboard
-	/*if (m_clipboard_text) {
-		free(m_clipboard_text);
-	}*/
-// Modif cs at 2005
-#ifdef DSHOW
-	CloseHandle(m_hmtxEncodeAccess);
-#endif
-	if (m_lpCSBuffer)
-		delete [] m_lpCSBuffer;
-	if (m_pBuff)
-		delete [] m_pBuff;
-	if (m_pCompBuff)
-		delete [] m_pCompBuff;
-
-	//thos give sometimes errors, hlogfile is already removed at this point
-	//vnclog.Print(LL_INTINFO, VNCLOG("cached %d \n"),totalraw);
-	if (SPECIAL_SC_EXIT && !fShutdownOrdered) // if fShutdownOrdered, hwnd may not be valid
-	{
-		//adzm 2009-06-20 - if we are SC, only exit if no other viewers are connected!
-		// (since multiple viewers is now allowed with the new DSM plugin)
-		// adzm 2009-08-02
-		// adzm 2010-08 - stay alive if we have an UnauthClientCount as well, since another connection may be pending
-		if ( (m_server == NULL) || (m_server && m_server->AuthClientCount() == 0 && m_server->UnauthClientCount() == 0) ) {
-			// We want that the server exit when the viewer exit
-			//adzm 2010-02-10 - Finds the appropriate VNC window for this process
-			HWND hwnd=FindWinVNCWindow(true);
-			if (hwnd) SendMessage(hwnd,WM_COMMAND,ID_CLOSE,0);
-		}
-	}
-
-	// adzm 2009-07-05
-	if (m_szRepeaterID) {
-		free(m_szRepeaterID);
-	}
-	// adzm 2009-08-02
-	if (m_szHost) {
-		free(m_szHost);
-	}
-}
-
-// Init
-BOOL
-vncClient::Init(vncServer *server,
-				VSocket *socket,
-				BOOL auth,
-				BOOL shared,
-				vncClientId newid)
-{
-	// Save the server id;
-	m_server = server;
-
-	// Save the socket
-	m_socket = socket;
-
-	// Save the name of the connecting client
-	char *name = m_socket->GetPeerName();
-	if (name != 0)
-		m_client_name = _strdup(name);
-	else
-		m_client_name = _strdup("<unknown>");
-
-	// Save the client id
-	m_id = newid;
-
-	// Spawn the child thread here
-	m_thread = new vncClientThread;
-	if (m_thread == NULL)
-		return FALSE;
-	return ((vncClientThread *)m_thread)->Init(this, m_server, m_socket, auth, shared);
-
-	return FALSE;
-}
-
-void
-vncClient::Kill()
-{
-	// Close the socket
-	vnclog.Print(LL_INTINFO, VNCLOG("client Kill() called"));
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	if (m_pTextChat)
-        m_pTextChat->KillDialog();
-#endif
-	if (m_socket != NULL)
-		m_socket->Close();
-}
-
-// Client manipulation functions for use by the server
-void
-vncClient::SetBuffer(vncBuffer *buffer)
-{
-	// Until authenticated, the client object has no access
-	// to the screen buffer.  This means that there only need
-	// be a buffer when there's at least one authenticated client.
-	m_encodemgr.SetBuffer(buffer);
-}
-
-void
-vncClient::TriggerUpdateThread()
-{
-	// ALWAYS lock the client UpdateLock before calling this!
-	// RealVNC 336	
-	// Check that this client has an update thread
-	// The update thread never dissappears, and this is the only
-	// thread allowed to create it, so this can be done without locking.
-	
-	if (!m_updatethread)
-	{
-		m_updatethread = new vncClientUpdateThread;
-		if (!m_updatethread || 
-			!m_updatethread->Init(this)) {
-			Kill();
-		}
-	}				
-	if (m_updatethread)
-		m_updatethread->Trigger();
-}
-
-void
-vncClient::UpdateMouse()
-{
-	if (!m_mousemoved && !m_cursor_update_sent)
-	{
-	omni_mutex_lock l(GetUpdateLock());
-    m_mousemoved=TRUE;
-	}
-	// nyama/marscha - PointerPos
-	// PointerPos code doesn take in account prim/secundary display
-	// offset needed
-	if (m_use_PointerPos && !m_cursor_pos_changed) {
-		POINT cursorPos;
-		GetCursorPos(&cursorPos);
-		cursorPos.x=cursorPos.x-(m_ScreenOffsetx+m_SWOffsetx);
-		cursorPos.y=cursorPos.y-(m_ScreenOffsety+m_SWOffsety);
-		//vnclog.Print(LL_INTINFO, VNCLOG("UpdateMouse m_cursor_pos(%d, %d), new(%d, %d)\n"), 
-		//  m_cursor_pos.x, m_cursor_pos.y, cursorPos.x, cursorPos.y);
-		if (cursorPos.x != m_cursor_pos.x || cursorPos.y != m_cursor_pos.y) {
-			// This movement isn't by this client, but generated locally or by other client.
-			// Send it to this client.
-			omni_mutex_lock l(GetUpdateLock());
-			m_cursor_pos.x = cursorPos.x;
-			m_cursor_pos.y = cursorPos.y;
-			m_cursor_pos_changed = TRUE;
-			TriggerUpdateThread();
-		}
-	}
-}
-
-// adzm - 2010-07 - Extended clipboard
-/*
-void
-vncClient::UpdateClipText(const char* text)
-{
-	//This is already locked in the vncdesktopsynk
-	//omni_mutex_lock l(GetUpdateLock());
-	if (m_clipboard_text) {
-		free(m_clipboard_text);
-		m_clipboard_text = 0;
-	}
-	m_clipboard_text = _strdup(text);
-	TriggerUpdateThread();
-}
-*/
-
-// adzm - 2010-07 - Extended clipboard
-void
-vncClient::UpdateClipTextEx(ClipboardData& clipboardData, CARD32 overrideFlags)
-{
-	//This is already locked in the vncdesktopsynk
-	//But it's just a critical section, doesn't matter how often you lock it in the same thread
-	//as long as it is unlocked the same number of times.
-	omni_mutex_lock l(GetUpdateLock());
-	if (m_clipboard.UpdateClipTextEx(clipboardData, overrideFlags)) {
-		TriggerUpdateThread();
-	}
-}
-
-void
-vncClient::UpdateCursorShape()
-{
-	omni_mutex_lock l(GetUpdateLock());
-	TriggerUpdateThread();
-}
-
-void
-vncClient::UpdatePalette(bool lock)
-{
-	if (lock) omni_mutex_lock l(GetUpdateLock());
-	m_palettechanged = TRUE;
-}
-
-void
-vncClient::UpdateLocalFormat(bool lock)
-{
-	if (lock) DisableProtocol();
-	else DisableProtocol_no_mutex();
-	vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format\n"));
-	m_encodemgr.SetServerFormat();
-	if (lock) EnableProtocol();
-	else EnableProtocol_no_mutex();
-}
-
-BOOL
-vncClient::SetNewSWSize(long w,long h,BOOL Desktop)
-{
-	if (!m_use_NewSWSize) return FALSE;
-	DisableProtocol_no_mutex();
-
-	vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format and buffer size\n"));
-	m_encodemgr.SetServerFormat();
-	m_palettechanged = TRUE;
-	if (Desktop) m_encodemgr.SetEncoding(0,TRUE);//0=dummy
-	m_NewSWUpdateWaiting=true;
-	NewsizeW=w;
-	NewsizeH=h;
-	EnableProtocol_no_mutex();
-
-	return TRUE;
-}
-
-BOOL
-vncClient::SetNewSWSizeFR(long w,long h,BOOL Desktop)
-{
-	if (!m_use_NewSWSize) return FALSE;
-	m_NewSWUpdateWaiting=true;
-	NewsizeW=w;
-	NewsizeH=h;
-	return TRUE;
-}
-
-// Functions used to set and retrieve the client settings
-const char*
-vncClient::GetClientName()
-{
-	return m_client_name;
-}
-
-// Enabling and disabling clipboard/GFX updates
-void
-vncClient::DisableProtocol()
-{
-	BOOL disable = FALSE;
-	{	 
-		omni_mutex_lock l(GetUpdateLock());
-		if (m_disable_protocol == 0)
-			disable = TRUE;
-		m_disable_protocol++;
-		if (disable && m_updatethread)
-			m_updatethread->EnableUpdates(FALSE);
-	}
-}
-
-void
-vncClient::EnableProtocol()
-{
-	{	 
-		omni_mutex_lock l(GetUpdateLock());
-		if (m_disable_protocol == 0) {
-			vnclog.Print(LL_INTERR, VNCLOG("protocol enabled too many times!\n"));
-			m_socket->Close();
-			return;
-		}
-		m_disable_protocol--;
-		if ((m_disable_protocol == 0) && m_updatethread)
-			m_updatethread->EnableUpdates(TRUE);
-	}
-}
-
-void
-vncClient::DisableProtocol_no_mutex()
-{
-	BOOL disable = FALSE;
-	{	 
-		if (m_disable_protocol == 0)
-			disable = TRUE;
-		m_disable_protocol++;
-		if (disable && m_updatethread)
-			m_updatethread->EnableUpdates(FALSE);
-	}
-}
-
-void
-vncClient::EnableProtocol_no_mutex()
-{
-	{	 
-		if (m_disable_protocol == 0) {
-			vnclog.Print(LL_INTERR, VNCLOG("protocol enabled too many times!\n"));
-			m_socket->Close();
-			return;
-		}
-		m_disable_protocol--;
-		if ((m_disable_protocol == 0) && m_updatethread)
-			m_updatethread->EnableUpdates(TRUE);
-	}
-}
-
-// Internal methods
-BOOL
-vncClient::SendRFBMsg(CARD8 type, BYTE *buffer, int buflen)
-{
-	// Set the message type
-	((rfbServerToClientMsg *)buffer)->type = type;
-
-	// Send the message
-	if (!m_socket->SendExact((char *) buffer, buflen, type))
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("failed to send RFB message to client\n"));
-
-		Kill();
-		return FALSE;
-	}
-	return TRUE;
-}
-
-//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-BOOL
-vncClient::SendRFBMsgQueue(CARD8 type, BYTE *buffer, int buflen)
-{
-	// Set the message type
-	((rfbServerToClientMsg *)buffer)->type = type;
-
-	// Send the message
-	if (!m_socket->SendExactQueue((char *) buffer, buflen, type))
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("failed to send RFB message to client\n"));
-
-		Kill();
-		return FALSE;
-	}
-	return TRUE;
-}
-#define min(a, b)  (((a) < (b)) ? (a) : (b))
-
-BOOL
-vncClient::SendUpdate(rfb::SimpleUpdateTracker &update)
-{
-	if (!m_initial_update) return FALSE;
-
-	// If there is nothing to send then exit
-
-	if (update.is_empty() && !m_cursor_update_pending && !m_NewSWUpdateWaiting && !m_cursor_pos_changed) return FALSE;
-	
-	// Get the update info from the tracker
-	rfb::UpdateInfo update_info;
-	update.get_update(update_info);
-	update.clear();
-	//Old update could be outsite the new bounding
-	//We first make sure the new size is send to the client
-	//The cleint ask a full update after screen_size change
-	if (m_NewSWUpdateWaiting) 
-		{
-			m_socket->ClearQueue();
-			rfbFramebufferUpdateRectHeader hdr;
-			if (m_use_NewSWSize) {
-				m_ScaledScreen = m_encodemgr.m_buffer->GetViewerSize();
-				m_nScale = m_encodemgr.m_buffer->GetScale();
-				hdr.r.x = 0;
-				hdr.r.y = 0;
-				hdr.r.w = Swap16IfLE(NewsizeW*m_nScale_viewer/m_nScale);
-				hdr.r.h = Swap16IfLE(NewsizeH*m_nScale_viewer/m_nScale);
-				hdr.encoding = Swap32IfLE(rfbEncodingNewFBSize);
-				rfbFramebufferUpdateMsg header;
-				header.nRects = Swap16IfLE(1);
-				//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-				SendRFBMsgQueue(rfbFramebufferUpdate, (BYTE *)&header,sz_rfbFramebufferUpdateMsg);
-				m_socket->SendExact((char *)&hdr, sizeof(hdr));
-				m_NewSWUpdateWaiting=false;
-				return TRUE;
-			}
-		}
-
-	// Find out how many rectangles in total will be updated
-	// This includes copyrects and changed rectangles split
-	// up by codings such as CoRRE.
-	int updates = 0;
-	int numsubrects = 0;
-	updates += update_info.copied.size();
-	if (m_encodemgr.IsCacheEnabled())
-	{
-		if (update_info.cached.size() > 5)
-		{
-			updates++;
-		}
-		else 
-		{
-			updates += update_info.cached.size();
-			//vnclog.Print(LL_INTERR, "cached %d\n", updates);
-		}
-	}
-	
-	rfb::RectVector::const_iterator i;
-	if (updates!= 0xFFFF)
-	{
-		for ( i=update_info.changed.begin(); i != update_info.changed.end(); ++i)
-		{
-			// Tight specific (lastrect)
-			numsubrects = m_encodemgr.GetNumCodedRects(*i);
-			
-			// Skip rest rectangles if an encoder will use LastRect extension.
-			if (numsubrects == 0) {
-				updates = 0xFFFF;
-				break;
-			}
-			updates += numsubrects;
-			//vnclog.Print(LL_INTERR, "changed %d\n", updates);
-		}
-	}	
-	
-	// if no cache is supported by the other viewer
-	// We need to send the cache as a normal update
-	if (!m_encodemgr.IsCacheEnabled() && updates!= 0xFFFF) 
-	{
-		for (i=update_info.cached.begin(); i != update_info.cached.end(); ++i)
-		{
-			// Tight specific (lastrect)
-			numsubrects = m_encodemgr.GetNumCodedRects(*i);
-			
-			// Skip rest rectangles if an encoder will use LastRect extension.
-			if (numsubrects == 0) {
-				updates = 0xFFFF;
-				//break;
-			}	
-			else updates += numsubrects;
-			//vnclog.Print(LL_INTERR, "cached2 %d\n", updates);
-		}
-	}
-	
-	// 
-	if (!m_encodemgr.IsXCursorSupported()) m_cursor_update_pending=false;
-	// Tight specific (lastrect)
-	if (updates != 0xFFFF)
-	{
-		// Tight - CURSOR HANDLING
-		if (m_cursor_update_pending)
-		{
-			updates++;
-		}
-		// nyama/marscha - PointerPos
-		if (m_cursor_pos_changed)
-			updates++;
-		if (updates == 0) return FALSE;
-	}
-
-//	Sendtimer.start();
-
-	omni_mutex_lock l(GetUpdateLock());
-	// Otherwise, send <number of rectangles> header
-	rfbFramebufferUpdateMsg header;
-	header.nRects = Swap16IfLE(updates);
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	if (!SendRFBMsgQueue(rfbFramebufferUpdate, (BYTE *) &header, sz_rfbFramebufferUpdateMsg))
-		return TRUE;
-	
-	// CURSOR HANDLING
-	if (m_cursor_update_pending) {
-		if (!SendCursorShapeUpdate())
-			return FALSE;
-	}
-	// nyama/marscha - PointerPos
-	if (m_cursor_pos_changed)
-		if (!SendCursorPosUpdate())
-			return FALSE;
-	
-	// Send the copyrect rectangles
-	if (!update_info.copied.empty()) {
-		rfb::Point to_src_delta = update_info.copy_delta.negate();
-		for (i=update_info.copied.begin(); i!=update_info.copied.end(); i++) {
-			rfb::Point src = (*i).tl.translate(to_src_delta);
-			if (!SendCopyRect(*i, src))
-				return FALSE;
-		}
-	}
-	
-	if (m_encodemgr.IsCacheEnabled())
-	{
-		if (update_info.cached.size() > 5)
-		{
-			if (!SendCacheZip(update_info.cached))
-				return FALSE;
-		}
-		else
-		{
-			if (!SendCacheRectangles(update_info.cached))
-				return FALSE;
-		}
-	}
-	else 
-	{
-		if (!SendRectangles(update_info.cached))
-			return FALSE;
-	}
-	
-	if (!SendRectangles(update_info.changed))
-		return FALSE;
-	// Tight specific - Send LastRect marker if needed.
-	if (updates == 0xFFFF)
-	{
-		m_encodemgr.LastRect(m_socket);
-		if (!SendLastRect())
-			return FALSE;
-	}
-	m_socket->ClearQueue();
-	// vnclog.Print(LL_INTINFO, VNCLOG("Update cycle\n"));
-	return TRUE;
-}
-
-// Send a set of rectangles
-BOOL
-vncClient::SendRectangles(const rfb::RectVector &rects)
-{
-	// Modif cs at 2005
-#ifdef DSHOW
-	MutexAutoLock l_Lock(&m_hmtxEncodeAccess);
-#endif
-	rfb::RectVector::const_iterator i;
-	rfb::Rect rect;
-	int x,y;
-	int Blocksize=254;
-	int BlocksizeX=254;
-
-
-	// Work through the list of rectangles, sending each one
-	for (i=rects.begin();i!=rects.end();++i) {
-		if (m_encodemgr.ultra2_encoder_in_use)
-		{
-			//We want smaller rect, so data can be send and decoded while handling next update
-			rect.tl.x=(*i).tl.x;
-			rect.br.x=(*i).br.x;
-			rect.tl.y=(*i).tl.y;
-			rect.br.y=(*i).br.y;
-
-			if ((rect.br.x-rect.tl.x) * (rect.br.y-rect.tl.y) > Blocksize*BlocksizeX )
-			{
- 
-			for (y = rect.tl.y; y < rect.br.y; y += Blocksize)
-			{
-				int blockbottom = min(y + Blocksize, rect.br.y);
-				for (x = rect.tl.x; x < rect.br.x; x += BlocksizeX)
-					{
- 
-					   int blockright = min(x+BlocksizeX, rect.br.x);
-					   rfb::Rect tilerect;
-					   tilerect.tl.x=x;
-					   tilerect.br.x=blockright;
-					   tilerect.tl.y=y;
-					   tilerect.br.y=blockbottom;
-					   if (!SendRectangle(tilerect)) return FALSE;
-					}
-			}
-			}
-			else
-			{
-				if (!SendRectangle(rect)) return FALSE;
-			}
-
-		}
-		else
-		{
-		if (!SendRectangle(*i)) return FALSE;
-		}
-	}
-	return TRUE;
-}
-
-
-
-// Tell the encoder to send a single rectangle
-BOOL
-vncClient::SendRectangle(const rfb::Rect &rect)
-{
-	// Get the buffer to encode the rectangle
-	// Modif sf at 2002 - Scaling
-	rfb::Rect ScaledRect;
-	ScaledRect.tl.y = rect.tl.y / m_nScale;
-	ScaledRect.br.y = rect.br.y / m_nScale;
-	ScaledRect.tl.x = rect.tl.x / m_nScale;
-	ScaledRect.br.x = rect.br.x / m_nScale;
-
-	//	Totalsend+=(ScaledRect.br.x-ScaledRect.tl.x)*(ScaledRect.br.y-ScaledRect.tl.y);
-
-	// sf at 2002 - DSMPlugin
-	// Some encoders (Hextile, ZRLE, Raw..) store all the data to send into 
-	// m_clientbuffer and return the total size from EncodeRect()
-	// Some Encoders (Tight, Zlib, ZlibHex..) send data on the fly and return
-	// a partial size from EncodeRect(). 
-	// On the viewer side, the data is read piece by piece or in one shot 
-	// still depending on the encoding...
-	// It is not compatible with DSM: we need to read/write data blocks of same 
-	// size on both sides in one shot
-	// We create a common method to send the data 
-	// adzm 2010-09
-	if (!m_socket->IsPluginStreamingOut() && m_socket->IsUsePluginEnabled() && m_server->GetDSMPluginPointer()->IsEnabled())
-	{
-		// Tell the SendExact() calls to write into the local NetRectBuffer memory buffer
-		m_socket->SetWriteToNetRectBuffer(true);
-		m_socket->SetNetRectBufOffset(0);
-		// sf at 2003 - we can't easely predict how many rects are going to be sent 
-		// (for Tight encoding for instance)
-		// Then we take the worse case (screen buffer size * 1.5) for the net rect buffer size.
-		// m_socket->CheckNetRectBufferSize((int)(m_encodemgr.GetClientBuffSize() * 2));
-		m_socket->CheckNetRectBufferSize((int)(m_encodemgr.m_buffer->m_desktop->ScreenBuffSize() * 3 / 2));
-		UINT bytes = m_encodemgr.EncodeRect(ScaledRect, m_socket);
-		if (bytes == 0)
-		{
-			return true;
-		}
-		m_socket->SetWriteToNetRectBuffer(false);
-
-		BYTE* pDataBuffer = NULL;
-		UINT TheSize = 0;
-
-		// If SendExact() was called from inside the encoder
-		if (m_socket->GetNetRectBufOffset() > 0)
-		{
-			TheSize = m_socket->GetNetRectBufOffset();
-#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText," ++++++ crashtest TheSize %i \n",TheSize);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif
-			m_socket->SetNetRectBufOffset(0);
-			pDataBuffer = m_socket->GetNetRectBuf();
-			// Add the rest to the data buffer if it exists
-			if (bytes > 0)
-			{
-				memcpy(pDataBuffer + TheSize, m_encodemgr.GetClientBuffer(), bytes);
-			}
-		}
-		else // If all data was stored in m_clientbuffer
-		{
-			TheSize = bytes;
-#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText," ++++++ crashtest TheSize2 %i \n",TheSize);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif
-			bytes = 0;
-			pDataBuffer = m_encodemgr.GetClientBuffer();
-		}
-
-		// Send the header
-		m_socket->SendExactQueue((char *)pDataBuffer, sz_rfbFramebufferUpdateRectHeader);
-
-		// Send the size of the following rects data buffer
-		CARD32 Size = (CARD32)(TheSize + bytes - sz_rfbFramebufferUpdateRectHeader);
-#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText," ++++++ crashtest Size %i %i\n",Size,bytes);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif
-		Size = Swap32IfLE(Size);
-		m_socket->SendExactQueue((char*)&Size, sizeof(CARD32));
-		// Send the data buffer
-		m_socket->SendExactQueue(((char *)pDataBuffer + sz_rfbFramebufferUpdateRectHeader),
-							TheSize + bytes - sz_rfbFramebufferUpdateRectHeader
-							);
-		
-	}
-	else // Normal case - No DSM - Symetry is not important
-	{
-		UINT bytes = m_encodemgr.EncodeRect(ScaledRect, m_socket);
-
-		// if (bytes == 0) return false; // From realvnc337. No! Causes viewer disconnections/
-
-		// Send the encoded data
-		return m_socket->SendExactQueue((char *)(m_encodemgr.GetClientBuffer()), bytes);
-	}
-
-	return true;
-}
-
-// Send a single CopyRect message
-BOOL
-vncClient::SendCopyRect(const rfb::Rect &dest, const rfb::Point &source)
-{
-	// Create the message header
-	// Modif sf at 2002 - Scaling
-	rfbFramebufferUpdateRectHeader copyrecthdr;
-	copyrecthdr.r.x = Swap16IfLE((dest.tl.x - m_SWOffsetx) / m_nScale );
-	copyrecthdr.r.y = Swap16IfLE((dest.tl.y - m_SWOffsety) / m_nScale);
-	copyrecthdr.r.w = Swap16IfLE((dest.br.x - dest.tl.x) / m_nScale);
-	copyrecthdr.r.h = Swap16IfLE((dest.br.y - dest.tl.y) / m_nScale);
-	copyrecthdr.encoding = Swap32IfLE(rfbEncodingCopyRect);
-
-	// Create the CopyRect-specific section
-	rfbCopyRect copyrectbody;
-	copyrectbody.srcX = Swap16IfLE((source.x- m_SWOffsetx) / m_nScale);
-	copyrectbody.srcY = Swap16IfLE((source.y- m_SWOffsety) / m_nScale);
-
-	// Now send the message;
-	if (!m_socket->SendExactQueue((char *)&copyrecthdr, sizeof(copyrecthdr)))
-		return FALSE;
-	if (!m_socket->SendExactQueue((char *)&copyrectbody, sizeof(copyrectbody)))
-		return FALSE;
-
-	return TRUE;
-}
-
-// Send the encoder-generated palette to the client
-// This function only returns FALSE if the SendExact fails - any other
-// error is coped with internally...
-BOOL
-vncClient::SendPalette()
-{
-	rfbSetColourMapEntriesMsg setcmap;
-	RGBQUAD *rgbquad;
-	UINT ncolours = 256;
-
-	// Reserve space for the colour data
-	rgbquad = new RGBQUAD[ncolours];
-	if (rgbquad == NULL)
-		return TRUE;
-					
-	// Get the data
-	if (!m_encodemgr.GetPalette(rgbquad, ncolours))
-	{
-		delete [] rgbquad;
-		return TRUE;
-	}
-
-	// Compose the message
-	setcmap.type = rfbSetColourMapEntries;
-	setcmap.firstColour = Swap16IfLE(0);
-	setcmap.nColours = Swap16IfLE(ncolours);
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	if (!m_socket->SendExactQueue((char *) &setcmap, sz_rfbSetColourMapEntriesMsg, rfbSetColourMapEntries))
-	{
-		delete [] rgbquad;
-		return FALSE;
-	}
-
-	// Now send the actual colour data...
-	for (UINT i=0; i<ncolours; i++)
-	{
-		struct _PIXELDATA {
-			CARD16 r, g, b;
-		} pixeldata;
-
-		pixeldata.r = Swap16IfLE(((CARD16)rgbquad[i].rgbRed) << 8);
-		pixeldata.g = Swap16IfLE(((CARD16)rgbquad[i].rgbGreen) << 8);
-		pixeldata.b = Swap16IfLE(((CARD16)rgbquad[i].rgbBlue) << 8);
-
-		//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-		if (!m_socket->SendExactQueue((char *) &pixeldata, sizeof(pixeldata)))
-		{
-			delete [] rgbquad;
-			return FALSE;
-		}
-	}
-
-	// Delete the rgbquad data
-	delete [] rgbquad;
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	m_socket->ClearQueue();
-
-	return TRUE;
-}
-
-void
-vncClient::SetSWOffset(int x,int y)
-{
-	//if (m_SWOffsetx!=x || m_SWOffsety!=y) m_encodemgr.m_buffer->ClearCache();
-	m_SWOffsetx=x;
-	m_SWOffsety=y;
-	m_encodemgr.SetSWOffset(x,y);
-}
-
-void
-vncClient::SetScreenOffset(int x,int y,int type)
-{
-	m_ScreenOffsetx=x;
-	m_ScreenOffsety=y;
-	m_display_type=type;
-}
-
-void
-vncClient::InitialUpdate(bool value)
-{
-	m_initial_update=value;
-}
-
-// CACHE RDV
-// Send a set of rectangles
-BOOL
-vncClient::SendCacheRectangles(const rfb::RectVector &rects)
-{
-//	rfb::Rect rect;
-	rfb::RectVector::const_iterator i;
-
-	if (rects.size() == 0) return TRUE;
-	vnclog.Print(LL_INTINFO, VNCLOG("******** Sending %d Cache Rects \r\n"), rects.size());
-
-	// Work through the list of rectangles, sending each one
-	for (i= rects.begin();i != rects.end();++i)
-	{
-		if (!SendCacheRect(*i))
-			return FALSE;
-	}
-
-	return TRUE;
-}
-
-// Tell the encoder to send a single rectangle
-BOOL
-vncClient::SendCacheRect(const rfb::Rect &dest)
-{
-	// Create the message header
-	// Modif rdv at 2002 - v1.1.x - Application Resize
-	// Modif sf at 2002 - Scaling
-	rfbFramebufferUpdateRectHeader cacherecthdr;
-	cacherecthdr.r.x = Swap16IfLE((dest.tl.x - m_SWOffsetx) / m_nScale );
-	cacherecthdr.r.y = Swap16IfLE((dest.tl.y - m_SWOffsety) / m_nScale);
-	cacherecthdr.r.w = Swap16IfLE((dest.br.x - dest.tl.x) / m_nScale);
-	cacherecthdr.r.h = Swap16IfLE((dest.br.y - dest.tl.y) / m_nScale);
-	cacherecthdr.encoding = Swap32IfLE(rfbEncodingCache);
-
-	totalraw+=(dest.br.x - dest.tl.x)*(dest.br.y - dest.tl.y)*32 / 8; // 32bit test
-	// Create the CopyRect-specific section
-	rfbCacheRect cacherectbody;
-	cacherectbody.special = Swap16IfLE(9999); //not used dummy
-
-	// Now send the message;
-	if (!m_socket->SendExactQueue((char *)&cacherecthdr, sizeof(cacherecthdr)))
-		return FALSE;
-	if (!m_socket->SendExactQueue((char *)&cacherectbody, sizeof(cacherectbody)))
-		return FALSE;
-	return TRUE;
-}
-
-BOOL
-vncClient::SendCursorShapeUpdate()
-{
-	m_cursor_update_pending = FALSE;
-
-	if (!m_encodemgr.SendCursorShape(m_socket)) {
-		m_cursor_update_sent = FALSE;
-		return m_encodemgr.SendEmptyCursorShape(m_socket);
-	}
-
-	m_cursor_update_sent = TRUE;
-	return TRUE;
-}
-
-BOOL
-vncClient::SendCursorPosUpdate()
-{
-	m_cursor_pos_changed = FALSE;
-
-	rfbFramebufferUpdateRectHeader hdr;
-	hdr.r.x = Swap16IfLE(m_cursor_pos.x);
-	hdr.r.y = Swap16IfLE(m_cursor_pos.y);
-	hdr.r.w = 0;
-	hdr.r.h = 0;
-	hdr.encoding = Swap32IfLE(rfbEncodingPointerPos);
-
-	if (!m_socket->SendExactQueue((char *)&hdr, sizeof(hdr)))
-		return FALSE;
-
-	return TRUE;
-}
-
-// Tight specific - Send LastRect marker indicating that there are no more rectangles to send
-BOOL
-vncClient::SendLastRect()
-{
-	// Create the message header
-	rfbFramebufferUpdateRectHeader hdr;
-	hdr.r.x = 0;
-	hdr.r.y = 0;
-	hdr.r.w = 0;
-	hdr.r.h = 0;
-	hdr.encoding = Swap32IfLE(rfbEncodingLastRect);
-
-	// Now send the message;
-	if (!m_socket->SendExactQueue((char *)&hdr, sizeof(hdr)))
-		return FALSE;
-
-	return TRUE;
-}
-
-
-//
-// sf at 2002 - New cache rects transport - Uses Zlib
-//
-// 
-BOOL vncClient::SendCacheZip(const rfb::RectVector &rects)
-{
-	//int totalCompDataLen = 0;
-
-	int nNbCacheRects = rects.size();
-	if (!nNbCacheRects) return true;
-	unsigned long rawDataSize = nNbCacheRects * sz_rfbRectangle;
-	unsigned long maxCompSize = (rawDataSize + (rawDataSize/100) + 8);
-
-	// Check RawCacheZipBuff
-	// create a space big enough for the Zlib encoded cache rects list
-	if (m_nRawCacheZipBufSize < rawDataSize)
-	{
-		if (m_pRawCacheZipBuf != NULL)
-		{
-			delete [] m_pRawCacheZipBuf;
-			m_pRawCacheZipBuf = NULL;
-		}
-		m_pRawCacheZipBuf = new BYTE [rawDataSize+1];
-		if (m_pRawCacheZipBuf == NULL) 
-			return false;
-		m_nRawCacheZipBufSize = rawDataSize;
-	}
-
-	// Copy all the cache rects coordinates into the RawCacheZip Buffer 
-	rfbRectangle theRect;
-	rfb::RectVector::const_iterator i;
-	BYTE* p = m_pRawCacheZipBuf;
-	for (i = rects.begin();i != rects.end();++i)
-	{
-		theRect.x = Swap16IfLE(((*i).tl.x - m_SWOffsetx) / m_nScale );
-		theRect.y = Swap16IfLE(((*i).tl.y - m_SWOffsety) / m_nScale);
-		theRect.w = Swap16IfLE(((*i).br.x - (*i).tl.x) / m_nScale);
-		theRect.h = Swap16IfLE(((*i).br.y - (*i).tl.y) / m_nScale);
-		memcpy(p, (BYTE*)&theRect, sz_rfbRectangle);
-		p += sz_rfbRectangle;
-	}
-
-	// Create a space big enough for the Zlib encoded cache rects list
-	if (m_nCacheZipBufSize < maxCompSize)
-	{
-		if (m_pCacheZipBuf != NULL)
-		{
-			delete [] m_pCacheZipBuf;
-			m_pCacheZipBuf = NULL;
-		}
-		m_pCacheZipBuf = new BYTE [maxCompSize+1];
-		if (m_pCacheZipBuf == NULL) return 0;
-		m_nCacheZipBufSize = maxCompSize;
-	}
-
-	int nRet = compress((unsigned char*)(m_pCacheZipBuf),
-						(unsigned long*)&maxCompSize,
-						(unsigned char*)m_pRawCacheZipBuf,
-						rawDataSize
-						);
-
-	if (nRet != 0)
-	{
-		return false;
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("*** Sending CacheZip Rects=%d Size=%d (%d)\r\n"), nNbCacheRects, maxCompSize, nNbCacheRects * 14);
-
-	// Send the Update Rect header
-	rfbFramebufferUpdateRectHeader CacheRectsHeader;
-	CacheRectsHeader.r.x = Swap16IfLE(nNbCacheRects);
-	CacheRectsHeader.r.y = 0;
-	CacheRectsHeader.r.w = 0;
- 	CacheRectsHeader.r.h = 0;
-	CacheRectsHeader.encoding = Swap32IfLE(rfbEncodingCacheZip);
-
-	// Format the ZlibHeader
-	rfbZlibHeader CacheZipHeader;
-	CacheZipHeader.nBytes = Swap32IfLE(maxCompSize);
-
-	// Now send the message
-	if (!m_socket->SendExactQueue((char *)&CacheRectsHeader, sizeof(CacheRectsHeader)))
-		return FALSE;
-	if (!m_socket->SendExactQueue((char *)&CacheZipHeader, sizeof(CacheZipHeader)))
-		return FALSE;
-	if (!m_socket->SendExactQueue((char *)m_pCacheZipBuf, maxCompSize))
-		return FALSE;
-
-	return TRUE;
-}
-
-
-//
-//
-//
-void vncClient::EnableCache(BOOL enabled)
-{
-	m_encodemgr.EnableCache(enabled);
-}
-
-void vncClient::SetProtocolVersion(rfbProtocolVersionMsg *protocolMsg)
-{
-	if (protocolMsg!=NULL) memcpy(ProtocolVersionMsg,protocolMsg,sz_rfbProtocolVersionMsg);
-	else strcpy(ProtocolVersionMsg,"0.0.0.0");
-}
-
-void vncClient::Clear_Update_Tracker()
-{
-	m_update_tracker.clear();
-}
-
-void vncClient::TriggerUpdate()
-{
-	m_encodemgr.m_buffer->m_desktop->TriggerUpdate();
-}
-
-
-////////////////////////////////////////////////
-// Asynchronous & Delta File Transfer functions
-////////////////////////////////////////////////
-
-//
-// sf at 2004 - Delta Transfer
-// Create the checksums buffer of an open file
-//
-int vncClient::GenerateFileChecksums(HANDLE hFile, char* lpCSBuffer, int nCSBufferSize)
-{
-	bool fEof = false;
-	bool fError = false;
-	DWORD dwNbBytesRead = 0;
-	int nCSBufferOffset = 0;
-
-	char* lpBuffer = new char [sz_rfbBlockSize];
-	if (lpBuffer == NULL)
-		return -1;
-
-	while ( !fEof )
-	{
-		int nRes = ReadFile(hFile, lpBuffer, sz_rfbBlockSize, &dwNbBytesRead, NULL);
-		if (!nRes && dwNbBytesRead != 0)
-			fError = true;
-
-		if (nRes && dwNbBytesRead == 0)
-			fEof = true;
-		else
-		{
-			unsigned long cs = adler32(0L, Z_NULL, 0);
-			cs = adler32(cs, (unsigned char*)lpBuffer, (int)dwNbBytesRead);
-
-			memcpy(lpCSBuffer + nCSBufferOffset, &cs, 4);
-			nCSBufferOffset += 4; 
-		}
-	}
-
-	SetFilePointer(hFile, 0L, NULL, FILE_BEGIN); 
-	delete [] lpBuffer;
-
-	if (fError) 
-	{
-		return -1;
-	}
-
-	return nCSBufferOffset;
-
-}
-
-
-//
-// sf at 2004 - Delta Transfer
-// Destination file already exists
-// The server sends the checksums of this file in one shot.
-// 
-bool vncClient::ReceiveDestinationFileChecksums(int nSize, int nLen)
-{
-	if (nLen < 0 || nLen > 104857600) // 100 MBytes max
-		return false;
-
-	m_lpCSBuffer = new char [nLen+1];
-	if (m_lpCSBuffer == NULL) 
-	{
-		return false;
-	}
-
-	memset(m_lpCSBuffer, '\0', nLen+1);
-
-	VBool res = m_socket->ReadExact((char *)m_lpCSBuffer, nLen);
-	m_nCSBufferSize = nLen;
-
-	return res == VTrue;
-}
-
-//
-//
-//
-bool vncClient::ReceiveFileChunk(int nLen, int nSize)
-{
-    bool connected = true;
-	
-	if (!m_fFileDownloadRunning)
-		return  connected;
-
-	if (m_fFileDownloadError)
-	{
-		FinishFileReception();
-		return connected;
-	}
-
-	if (nLen < 0)
-		return false;
-
-	if (nLen > sz_rfbBlockSize) return connected;
-
-	bool fCompressed = true;
-	BOOL fRes = true;
-	bool fAlreadyHere = (nSize == 2);
-
-	// sf at 2004 - Delta Transfer - Empty packet
-	if (fAlreadyHere) 
-	{
-		DWORD dwPtr = SetFilePointer(m_hDestFile, nLen, NULL, FILE_CURRENT); 
-		if (dwPtr == 0xFFFFFFFF)
-			fRes = false;
-	}
-	else
-	{
-        connected = m_socket->ReadExact((char *)m_pBuff, nLen) == VTrue;
-		if (connected)
-		{
-			if (nSize == 0) fCompressed = false;
-			unsigned int nRawBytes = sz_rfbBlockSize;
-			
-			if (fCompressed)
-			{
-				// Decompress incoming data
-				int nRet = uncompress(	(unsigned char*)m_pCompBuff,	// Dest 
-										(unsigned long *)&nRawBytes, // Dest len
-										(const unsigned char*)m_pBuff,// Src
-										nLen	// Src len
-									);							
-				if (nRet != 0)
-				{
-					m_fFileDownloadError = true;
-					FinishFileReception();
-					return connected;
-				}
-			}
-
-			fRes = WriteFile(m_hDestFile,
-							fCompressed ? m_pCompBuff : m_pBuff,
-							fCompressed ? nRawBytes : nLen,
-							&m_dwNbBytesWritten,
-							NULL);
-		}
-		else
-		{
-			m_fFileDownloadError = true;
-			// FlushFileBuffers(m_client->m_hDestFile);
-			FinishFileReception();
-		}
-	}
-
-	if (!fRes)
-	{
-		// TODO : send an explicit error msg to the client...
-		m_fFileDownloadError = true;
-		FinishFileReception();
-		return connected;
-	}
-
-	m_dwTotalNbBytesWritten += (fAlreadyHere ? nLen : m_dwNbBytesWritten);
-	m_dwNbReceivedPackets++;
-
-	return connected;
-}
-
-
-void vncClient::FinishFileReception()
-{
-	if (!m_fFileDownloadRunning)
-		return;
-
-	m_fFileDownloadRunning = false;
-	m_socket->SetRecvTimeout(m_server->AutoIdleDisconnectTimeout()*1000);
-    SendKeepAlive(true);
-
-	// sf at 2004 - Delta transfer
-	SetEndOfFile(m_hDestFile);
-
-	// if error ?
-	FlushFileBuffers(m_hDestFile);
-
-	// Set the DestFile Time Stamp
-	if (strlen(m_szFileTime))
-	{
-		FILETIME DestFileTime;
-		SYSTEMTIME FileTime;
-		FileTime.wMonth  = atoi(m_szFileTime);
-		FileTime.wDay    = atoi(m_szFileTime + 3);
-		FileTime.wYear   = atoi(m_szFileTime + 6);
-		FileTime.wHour   = atoi(m_szFileTime + 11);
-		FileTime.wMinute = atoi(m_szFileTime + 14);
-		FileTime.wMilliseconds = 0;
-		FileTime.wSecond = 0;
-		SystemTimeToFileTime(&FileTime, &DestFileTime);
-		// ToDo: hook error
-		SetFileTime(m_hDestFile, &DestFileTime, &DestFileTime, &DestFileTime);
-	}
-
-	// CleanUp
-	helper::close_handle(m_hDestFile);
-
-	// sf at 2004 - Delta Transfer : we can keep the existing file data :)
-	// if (m_fFileDownloadError) DeleteFile(m_szFullDestName);
-
-	// sf at 2003 - Directory Transfer trick
-	// If the file is an Ultra Directory Zip we unzip it here and we delete the
-	// received file
-	// Todo: make a better free space check above in this particular case. The free space must be at least
-	// 3 times the size of the directory zip file (this zip file is ~50% of the real directory size) 
-	bool bWasDir = UnzipPossibleDirectory(m_szFullDestName);
-	/*
-	if (!m_fFileDownloadError && !strncmp(strrchr(m_szFullDestName, '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix)))
-	{
-		char szPath[MAX_PATH + MAX_PATH];
-		char szDirName[MAX_PATH]; // Todo: improve this (size) 
-		strcpy(szPath, m_szFullDestName);
-		// Todo: improve all this (p, p2, p3 NULL test or use a standard substring extraction function)
-		char *p = strrchr(szPath, '\\') + 1; 
-		char *p2 = strchr(p, '-') + 1; // rfbZipDirectoryPrefix MUST have a "-" at the end...
-		strcpy(szDirName, p2);
-		char *p3 = strrchr(szDirName, '.');
-		*p3 = '\0';
-		if (p != NULL) *p = '\0';
-		strcat(szPath, szDirName);
-
-		// Create the Directory
-		// BOOL fRet = CreateDirectory(szPath, NULL);
-		m_pZipUnZip->UnZipDirectory(szPath, m_szFullDestName);
-		DeleteFile(m_szFullDestName);
-	}
-	*/
-
-    if (m_fFileDownloadError && m_fUserAbortedFileTransfer)
-    {
-        SplitTransferredFileNameAndDate(m_szFullDestName, 0);
-        ::DeleteFile(m_szFullDestName);
-        FTDownloadCancelledHook();
-    }
-    else
-    {
-        std::string realName = get_real_filename(m_szFullDestName);
-        if (!m_fFileDownloadError && !bWasDir)
-            m_fFileDownloadError = !replaceFile(m_szFullDestName, realName.c_str());
-        if (m_fFileDownloadError)
-            FTDownloadFailureHook();
-        else
-            FTDownloadCompleteHook();
-    }
-	//delete [] m_szFullDestName;
-
-	if (m_pCompBuff != NULL)
-	{
-		delete [] m_pCompBuff;
-		m_pCompBuff = NULL;
-	}
-	if (m_pBuff != NULL)
-	{
-		delete [] m_pBuff;
-		m_pBuff = NULL;
-	}
-	if (m_lpCSBuffer)
-	{
-		delete [] m_lpCSBuffer;
-		m_lpCSBuffer = NULL;
-	}
-
-	return;
-}
-
-
-
-bool vncClient::SendFileChunk()
-{
-    bool connected = true;
-	omni_mutex_lock l(GetUpdateLock());
-
-	if (!m_fFileUploadRunning) return connected;
-	if ( m_fEof || m_fFileUploadError)
-	{
-		FinishFileSending();
-		return connected;
-	}
-
-	int nRes = ReadFile(m_hSrcFile, m_pBuff, sz_rfbBlockSize, &m_dwNbBytesRead, NULL);
-	if (!nRes && m_dwNbBytesRead != 0)
-	{
-		m_fFileUploadError = true;
-	}
-
-	if (nRes && m_dwNbBytesRead == 0)
-	{
-		m_fEof = true;
-	}
-	else
-	{
-		// sf at 2004 - Delta Transfer
-		bool fAlreadyThere = false;
-		unsigned long nCS = 0;
-		// if Checksums are available for this file
-		if (m_lpCSBuffer != NULL)
-		{
-			if (m_nCSOffset < m_nCSBufferSize)
-			{
-				memcpy(&nCS, &m_lpCSBuffer[m_nCSOffset], 4);
-				if (nCS != 0)
-				{
-					m_nCSOffset += 4;
-					unsigned long cs = adler32(0L, Z_NULL, 0);
-					cs = adler32(cs, (unsigned char*)m_pBuff, (int)m_dwNbBytesRead);
-					if (cs == nCS)
-						fAlreadyThere = true;
-				}
-			}
-		}
-
-		if (fAlreadyThere)
-		{
-			// Send the FileTransferMsg with empty rfbFilePacket
-			rfbFileTransferMsg ft;
-			ft.type = rfbFileTransfer;
-			ft.contentType = rfbFilePacket;
-			ft.size = Swap32IfLE(2); // Means "Empty packet"// Swap32IfLE(nCS); 
-			ft.length = Swap32IfLE(m_dwNbBytesRead);
-			m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-		}
-		else
-		{
-			// Compress the data
-			// (Compressed data can be longer if it was already compressed)
-			unsigned int nMaxCompSize = sz_rfbBlockSize + 1024; // TODO: Improve this...
-			bool fCompressed = false;
-			if (m_fCompressionEnabled)
-			{
-				int nRetC = compress((unsigned char*)(m_pCompBuff),
-									(unsigned long *)&nMaxCompSize,	
-									(unsigned char*)m_pBuff,
-									m_dwNbBytesRead
-									);
-
-				if (nRetC != 0)
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("Compress returned error in File Send :%d\n"), nRetC);
-					// Todo: send data uncompressed instead
-					m_fFileUploadError = true;
-					FinishFileSending();
-					return connected;
-				}
-				fCompressed = true;
-			}
-
-			// Test if we have to deal with already compressed data
-			if (nMaxCompSize > m_dwNbBytesRead)
-				fCompressed = false;
-				// m_fCompressionEnabled = false;
-
-			rfbFileTransferMsg ft;
-
-			ft.type = rfbFileTransfer;
-			ft.contentType = rfbFilePacket;
-			ft.size = fCompressed ? Swap32IfLE(1) : Swap32IfLE(0); 
-			ft.length = fCompressed ? Swap32IfLE(nMaxCompSize) : Swap32IfLE(m_dwNbBytesRead);
-
-			//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-            connected = VFalse != m_socket->SendExactQueue((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-            if (connected) {
-			if (fCompressed)
-				connected = VFalse != m_socket->SendExact((char *)m_pCompBuff , nMaxCompSize);
-			else
-				connected = VFalse != m_socket->SendExact((char *)m_pBuff , m_dwNbBytesRead);
-			}
-            }
-		
-		m_dwTotalNbBytesRead += m_dwNbBytesRead;
-		// TODO : test on nb of bytes written
-	}
-					
-    if (connected)
-    {
-	// Order next asynchronous packet sending
- 	PostToWinVNC( FileTransferSendPacketMessage, (WPARAM)this, (LPARAM)0);
-    }
-    return connected;
-}
-
-
-void vncClient::FinishFileSending()
-{
-	omni_mutex_lock l(GetUpdateLock());
-
-	if (!m_fFileUploadRunning)
-		return;
-
-    // restore original timeout
-	m_socket->SetSendTimeout(m_server->AutoIdleDisconnectTimeout()*1000);
-
-	m_fFileUploadRunning = false;
-
-	rfbFileTransferMsg ft;
-
-	// File Copy OK
-	if ( !m_fFileUploadError /*nRet == 1*/)
-	{
-		ft.type = rfbFileTransfer;
-		ft.contentType = rfbEndOfFile;
-		m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-	}
-	else // Error in file copy
-	{
-		// TODO : send an error msg to the client...
-		ft.type = rfbFileTransfer;
-		ft.contentType = rfbAbortFileTransfer;
-		m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-	}
-	
-	helper::close_handle(m_hSrcFile);
-	if (m_pBuff != NULL)
-	{
-		delete [] m_pBuff;
-		m_pBuff = NULL;
-	}
-	if (m_pCompBuff != NULL)
-	{
-		delete [] m_pCompBuff;
-		m_pCompBuff = NULL;
-	}
-
-	// sf at 2003 - Directory Transfer trick
-	// If the transfered file is a Directory zip, we delete it locally, whatever the result of the transfer
-	if (!strncmp(strrchr(m_szSrcFileName, '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix)))
-	{
-		char *p = strrchr(m_szSrcFileName, ',');
-		if (p != NULL) *p = '\0'; // Remove the time stamp we've added above from the file name
-		DeleteFile(m_szSrcFileName);
-	}
-    //  jdp 8/8/2008
-    if (m_fUserAbortedFileTransfer)
-        FTUploadCancelledHook();
-    else if (m_fFileUploadError)
-        FTUploadFailureHook();
-    else
-        FTUploadCompleteHook();
-
-}
-
-
-bool vncClient::GetSpecialFolderPath(int nId, char* szPath)
-{
-	LPITEMIDLIST pidl;
-    bool retval = false;
-
-    LPMALLOC pSHMalloc;
-
-    if (FAILED(SHGetMalloc(&pSHMalloc)))
-        return false;
-
-	if (SHGetSpecialFolderLocation(0, nId, &pidl) == NOERROR)
-    {
-        retval = SHGetPathFromIDList(pidl, szPath) ? true : false;
-
-        pSHMalloc->Free(pidl);
-    }
-
-    pSHMalloc->Release();
-
-	return retval;
-}
-
-//
-// Zip a possible directory
-//
-int vncClient::ZipPossibleDirectory(LPSTR szSrcFileName)
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-//	vnclog.Print(0, _T("ZipPossibleDirectory\n"));
-	char* p1 = strrchr(szSrcFileName, '\\') + 1;
-	char* p2 = strrchr(szSrcFileName, rfbDirSuffix[0]);
-	if (
-		p1[0] == rfbDirPrefix[0] && p1[1] == rfbDirPrefix[1]  // Check dir prefix
-		&& p2[1] == rfbDirSuffix[1] && p2 != NULL && p1 < p2  // Check dir suffix
-		) //
-	{
-		// sf at 2004 - Improving Directory Transfer: Avoids ReadOnly media problem
-		char szDirZipPath[MAX_PATH];
-		char szWorkingDir[MAX_PATH];
-		::GetTempPath(MAX_PATH,szWorkingDir); //PGM Use Windows Temp folder
-		if (szWorkingDir == NULL) //PGM 
-		{ //PGM
-			if (GetModuleFileName(NULL, szWorkingDir, MAX_PATH))
-			{
-				char* p = strrchr(szWorkingDir, '\\');
-				if (p == NULL)
-					return -1;
-				*(p+1) = '\0';
-			}
-			else
-			{
-				return -1;
-			}
-		}//PGM
-
-		char szPath[MAX_PATH];
-		char szDirectoryName[MAX_PATH];
-		strcpy(szPath, szSrcFileName);
-		p1 = strrchr(szPath, '\\') + 1;
-		strcpy(szDirectoryName, p1 + 2); // Skip dir prefix (2 chars)
-		szDirectoryName[strlen(szDirectoryName) - 2] = '\0'; // Remove dir suffix (2 chars)
-		*p1 = '\0';
-        m_OrigSourceDirectoryName = std::string(szPath) + szDirectoryName;
-		if ((strlen(szPath) + strlen(rfbZipDirectoryPrefix) + strlen(szDirectoryName) + 4) > (MAX_PATH - 1)) return -1;
-		sprintf(szDirZipPath, "%s%s%s%s", szWorkingDir, rfbZipDirectoryPrefix, szDirectoryName, ".zip"); 
-		strcat(szPath, szDirectoryName);
-		strcpy(szDirectoryName, szPath);
-		if (strlen(szDirectoryName) > (MAX_PATH - 4)) return -1;
-		strcat(szDirectoryName, "\\*.*");
-		bool fZip = m_pZipUnZip->ZipDirectory(szPath, szDirectoryName, szDirZipPath, true);
-		if (!fZip) return -1;
-		strcpy(szSrcFileName, szDirZipPath);
-		return 1;
-	}
-	else
-#endif
-		return 0;
-}
-
-
-int vncClient::CheckAndZipDirectoryForChecksuming(LPSTR szSrcFileName)
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	if (!m_fFileDownloadError 
-		&& 
-		!strncmp(strrchr(szSrcFileName, '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix))
-	   )
-	{
-		char szPath[MAX_PATH + MAX_PATH];
-		char szDirName[MAX_PATH];
-		char szDirectoryName[MAX_PATH * 2];
-		strcpy(szPath, szSrcFileName);
-		char *p = strrchr(szPath, '\\') + 1; 
-		char *p2 = strchr(p, '-') + 1;
-		strcpy(szDirName, p2);
-		char *p3 = strrchr(szDirName, '.');
-		*p3 = '\0';
-		if (p != NULL) *p = '\0';
-		strcat(szPath, szDirName);
-
-		int nRes = CreateDirectory(szPath, NULL);
-		DWORD err = GetLastError(); // debug
-		if (GetLastError() == ERROR_ALREADY_EXISTS)
-		{
-			strcpy(szDirectoryName, szPath);
-			// p = strrchr(szPath, '\\') + 1; 
-			// if (p != NULL) *p = '\0'; else return -1;
-			if (strlen(szDirectoryName) > (MAX_PATH - 4)) return -1;
-			strcat(szDirectoryName, "\\*.*");
-			bool fZip = m_pZipUnZip->ZipDirectory(szPath, szDirectoryName, szSrcFileName, true);
-			if (!fZip) return -1;
-		}
-
-	}		
-#endif
-	return 0;
-}
-
-//
-// Unzip possible directory
-// Todo: handle unzip error correctly...
-//
-bool vncClient::UnzipPossibleDirectory(LPSTR szFileName)
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-//	vnclog.Print(0, _T("UnzipPossibleDirectory\n"));
-	if (!m_fFileDownloadError 
-		&& 
-		!strncmp(strrchr(szFileName, '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix))
-	   )
-	{
-		char szPath[MAX_PATH + MAX_PATH];
-		char szDirName[MAX_PATH]; // Todo: improve this (size) 
-		strcpy(szPath, szFileName);
-		// Todo: improve all this (p, p2, p3 NULL test or use a standard substring extraction function)
-		char *p = strrchr(szPath, '\\') + 1; 
-		char *p2 = strchr(p, '-') + 1; // rfbZipDirectoryPrefix MUST have a "-" at the end...
-		strcpy(szDirName, p2);
-		char *p3 = strrchr(szDirName, '.');
-		*p3 = '\0';
-		if (p != NULL) *p = '\0';
-		strcat(szPath, szDirName);
-		// Create the Directory
-		bool fUnzip = m_pZipUnZip->UnZipDirectory(szPath, szFileName);
-		DeleteFile(szFileName);
-        return true;
-	}						
-#endif
-	return false;
-}
-
-
-//
-// GetFileSize() doesn't handle files > 4GBytes...
-// GetFileSizeEx() doesn't exist under Win9x...
-// So let's write our own function.
-// 
-bool vncClient::MyGetFileSize(char* szFilePath, ULARGE_INTEGER *n2FileSize)
-{
-	WIN32_FIND_DATA fd;
-	HANDLE ff;
-
-    DWORD errmode = SetErrorMode(SEM_FAILCRITICALERRORS); // No popup please !
-	ff = FindFirstFile(szFilePath, &fd);
-	SetErrorMode( errmode );
-
-	if (ff == INVALID_HANDLE_VALUE)
-	{
-		return false;
-	}
-
-	FindClose(ff);
-
-	(*n2FileSize).LowPart = fd.nFileSizeLow;
-	(*n2FileSize).HighPart = fd.nFileSizeHigh;
-	(*n2FileSize).QuadPart = (((__int64)fd.nFileSizeHigh) << 32 ) + fd.nFileSizeLow;
-	
-	return true;
-}
-
-
-bool vncClient::DoFTUserImpersonation()
-{
-	vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Call\n"));
-	omni_mutex_lock l(GetUpdateLock());
-
-	if (m_fFileDownloadRunning) return true;
-	if (m_fFileUploadRunning) return true;
-	if (m_fFTUserImpersonatedOk) return true;
-    // if we're already impersonating the user and have a session open, do nothing.
-    if (m_fFileSessionOpen && m_fFTUserImpersonatedOk)
-        return true;
-
-	vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - 1\n"));
-	bool fUserOk = true;
-
-	if (vncService::IsWSLocked())
-	{
-		m_fFTUserImpersonatedOk = false;
-		vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - WSLocked\n"));
-		return false;
-	}
-
-	char username[UNLEN+1];
-	vncService::CurrentUser((char *)&username, sizeof(username));
-	vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - currentUser = %s\n"), username);
-	if (strcmp(username, "") != 0)
-	{
-		// sf at 2007 - New method to achieve FTUserImpersonation - Still needs to be further tested...
-		HANDLE hProcess, hPToken;
-		DWORD pid = GetExplorerLogonPid();
-		if (pid != 0) 
-		{
-			hProcess = OpenProcess(MAXIMUM_ALLOWED, FALSE, pid);
-			if (!OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-									|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-									|TOKEN_READ|TOKEN_WRITE,&hPToken
-								 )
-			) 
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - OpenProcessToken Error\n"));
-				fUserOk = false;
-			}
-			else
-			{
-				if (!ImpersonateLoggedOnUser(hPToken))
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - ImpersonateLoggedOnUser Failed\n"));
-					fUserOk = false;
-				}
-			}
-
-			CloseHandle(hProcess);
-			CloseHandle(hPToken);
-		}
-		
-		/* Old method
-		// Modif Byteboon (Jeremy C.) - Impersonnation
-		if (m_server->m_impersonationtoken)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Impersonationtoken exists\n"));
-			HANDLE newToken;
-			if (DuplicateToken(m_server->m_impersonationtoken, SecurityImpersonation, &newToken))
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken ok\n"));
-				if(!ImpersonateLoggedOnUser(newToken))
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - failed to impersonate [%d]\n"),GetLastError());
-					fUserOk = false;
-				}
-				CloseHandle(newToken);
-			}
-			else
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken FAILEDk\n"));
-				fUserOk = false;
-			}
-		}
-		else
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - No impersonationtoken\n"));
-			fUserOk = false;
-		}
-		*/
-		
-		if (!vncService::RunningAsService())
-			fUserOk = true;
-	}
-	else
-	{
-		fUserOk = false;
-	}
-
-	if (fUserOk)
-		m_lLastFTUserImpersonationTime = timeGetTime();
-
-	m_fFTUserImpersonatedOk = fUserOk;
-
-	return fUserOk;
-			
-}
-
-
-void vncClient::UndoFTUserImpersonation()
-{
-	//vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Call\n"));
-	//moved to after returns, Is this lock realy needed if no revert is done ?
-	//
-	//omni_mutex_lock l(GetUpdateLock());
-
-	if (!m_fFTUserImpersonatedOk) return;
-	if (m_fFileDownloadRunning) return;
-	if (m_fFileUploadRunning) return;
-    if (m_fFileSessionOpen) return;
-
-	vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - 1\n"));
-	DWORD lTime = timeGetTime();
-	if (lTime - m_lLastFTUserImpersonationTime < 10000) return;
-	omni_mutex_lock l(GetUpdateLock());
-	vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Impersonationtoken exists\n"));
-	RevertToSelf();
-	m_fFTUserImpersonatedOk = false;
-}
-
-// 10 April 2008 jdp paquette at atnetsend.net
-// This can crash as we can not send middle in an update...
-
-void vncClient::Record_SendServerStateUpdate(CARD32 state, CARD32 value)
-{
-    m_state=state;
-	m_value=value;
-	m_want_update_state=true;
-#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText,"Record_SendServerStateUpdate %i %i  \n",m_state,m_value);
-					OutputDebugString(szText);		
-#endif
-}
-
-void vncClient::SendServerStateUpdate(CARD32 state, CARD32 value)
-{
-    if (m_wants_ServerStateUpdates && m_socket)
-    {
-        // send message to client
-		rfbServerStateMsg rsmsg;
-        memset(&rsmsg, 0, sizeof rsmsg);
-		rsmsg.type = rfbServerState;
-		rsmsg.state  = Swap32IfLE(state);
-		rsmsg.value = Swap32IfLE(value);
-
-		m_socket->SendExact((char*)&rsmsg, sz_rfbServerStateMsg, rfbServerState);
-    }
-}
-
-void vncClient::SendKeepAlive(bool bForce)
-{
-    if (m_wants_KeepAlive && m_socket)
-    {
-		//adzm 2010-08-01
-		DWORD nInterval = (DWORD)m_server->GetKeepAliveInterval() * 1000;
-		DWORD nTicksSinceLastSent = GetTickCount() - m_socket->GetLastSentTick();
-
-        if (!bForce && nTicksSinceLastSent < nInterval)
-            return;
-
-        rfbKeepAliveMsg kp;
-        memset(&kp, 0, sizeof kp);
-        kp.type = rfbKeepAlive;
-
-		m_socket->SendExact((char*)&kp, sz_rfbKeepAliveMsg, rfbKeepAlive);
-    }
-}
-
-void vncClient::SendFTProtocolMsg()
-{
-    rfbFileTransferMsg ft;
-    memset(&ft, 0, sizeof ft);
-    ft.type = rfbFileTransfer;
-    ft.contentType = rfbFileTransferProtocolVersion;
-    ft.contentParam = FT_PROTO_VERSION_3;
-    m_socket->SendExact((char *)&ft, sz_rfbFileTransferMsg, rfbFileTransfer);
-
-}
-
-// adzm - 2010-07 - Extended clipboard
-void vncClient::NotifyExtendedClipboardSupport()
-{	
-	ExtendedClipboardDataMessage extendedDataMessage;
-	m_clipboard.settings.PrepareCapsPacket(extendedDataMessage);
-
-	rfbServerCutTextMsg msg;
-    memset(&msg, 0, sizeof(rfbServerCutTextMsg));
-	msg.type = rfbServerCutText;
-	msg.length = Swap32IfLE(-extendedDataMessage.GetDataLength());
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	m_socket->SendExactQueue((char *)&msg, sz_rfbServerCutTextMsg, rfbServerCutText);
-	m_socket->SendExact((char *)(extendedDataMessage.GetData()), extendedDataMessage.GetDataLength());
-}
-
-// adzm 2010-09 - Notify streaming DSM plugin support
-void vncClient::NotifyPluginStreamingSupport()
-{	
-	rfbNotifyPluginStreamingMsg msg;
-    memset(&msg, 0, sizeof(rfbNotifyPluginStreamingMsg));
-	msg.type = rfbNotifyPluginStreaming;
-
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	m_socket->SendExact((char *)&msg, sz_rfbNotifyPluginStreamingMsg, rfbNotifyPluginStreaming);
-	m_socket->SetPluginStreamingOut();
-}
diff --git a/ica/win32/winvnc/winvnc/vncclient.h b/ica/win32/winvnc/winvnc/vncclient.h
deleted file mode 100644
index f5f8694..0000000
--- a/ica/win32/winvnc/winvnc/vncclient.h
+++ /dev/null
@@ -1,605 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at 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
-#ifndef __GNUC__
-#pragma warning(disable : 4786)
-#endif
-
-#include <list>
-#include <string>
-#include <vector>
-#include <algorithm>
-#include "common/win32_helpers.h"
-
-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"
-#include "TextChat.h" // sf at 2002 - TextChat
-//#include "timer.h"
-// adzm - 2010-07 - Extended clipboard
-#include "common/Clipboard.h"
-
-// The vncClient class itself
-typedef UINT (WINAPI *pSendinput)(UINT,LPINPUT,INT);
-#define SPI_GETMOUSESPEED         0x0070
-#define SPI_SETMOUSESPEED         0x0071
-#define MOUSEEVENTF_VIRTUALDESK	  0x4000
-
-class vncClientUpdateThread;
-
-#define FT_PROTO_VERSION_OLD 1  // <= RC18 server.. "fOldFTPRotocole" version
-#define FT_PROTO_VERSION_2   2  // base ft protocol
-#define FT_PROTO_VERSION_3   3  // new ft protocol session messages
-
-
-
-extern int CheckUserGroupPasswordUni(char * userin,char *password,const char *machine);
-
-using namespace rfb;
-
-class vncClient
-{
-public:
-	// Constructor/destructor
-	vncClient();
-	virtual ~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);
-	// adzm - 2010-07 - Extended clipboard
-	virtual void UpdateClipTextEx(ClipboardData& clipboardData, CARD32 overrideFlags = 0);
-	virtual void UpdatePalette(bool lock);
-	virtual void UpdateLocalFormat(bool lock);
-
-	// 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());
-/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," UpdateWanted %i \n",!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_cached_region()).is_empty() &&
-											m_incr_rgn.intersect(m_update_tracker.get_copied_region()).is_empty());
-										OutputDebugString(szText);		
-#endif*/
-		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_cached_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 EnableKeyboard(BOOL enable) {m_keyboardenabled = enable;};
-	virtual void EnablePointer(BOOL enable) {m_pointerenabled = enable;};
-	virtual void EnableJap(bool enable) {m_jap = enable;};
-	virtual void SetCapability(int capability) {m_capability = capability;};
-
-	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();
-	virtual void DisableProtocol_no_mutex();
-	virtual void EnableProtocol_no_mutex();
-	// resize desktop
-	virtual BOOL SetNewSWSize(long w,long h,BOOL desktop);
-	virtual BOOL SetNewSWSizeFR(long w,long h,BOOL desktop);
-	virtual void SetSWOffset(int x,int y);
-	virtual void SetScreenOffset(int x,int y,int type);
-	virtual void InitialUpdate(bool value);
-
-	virtual TextChat* GetTextChatPointer() { return m_pTextChat; }; // sf at 2002
-	virtual void SetUltraViewer(bool fTrue) { m_fUltraViewer = fTrue;};
-	virtual bool IsUltraViewer() { return m_fUltraViewer;};
-
-	virtual void EnableCache(BOOL enabled);
-
-
-	// sf at 2002
-	virtual void SetConnectTime(long lTime) {m_lConnectTime = lTime;};
-	virtual long GetConnectTime() {return m_lConnectTime;};
-	virtual bool IsSlowEncoding() {return m_encodemgr.IsSlowEncoding();};
-	virtual bool IsUltraEncoding() {return m_encodemgr.IsUltraEncoding();};
-	virtual bool IsFileTransBusy(){return (m_fFileUploadRunning||m_fFileDownloadRunning || m_fFileSessionOpen);};
-	void SetProtocolVersion(rfbProtocolVersionMsg *protocolMsg);
-	void Clear_Update_Tracker();
-	void TriggerUpdate();
-	void UpdateCursorShape();
-
-	// adzm 2009-07-05 - repeater IDs
-	void SetRepeaterID(char* szid)
-	{
-		if (m_szRepeaterID) {
-			free(m_szRepeaterID);
-		}
-
-		m_szRepeaterID = NULL;
-
-		if (szid != NULL && strlen(szid) > 0) {
-			m_szRepeaterID = _strdup(szid);
-		}
-	};
-	char* GetRepeaterID() {return m_szRepeaterID;};
-
-	// adzm 2009-08-02
-	void SetHost(char* szHost)
-	{
-		if (m_szHost) {
-			free(m_szHost);
-		}
-
-		m_szHost = NULL;
-
-		if (szHost != NULL && strlen(szHost) > 0) {
-			m_szHost = _strdup(szHost);
-		}
-	};
-	char* GetHost() {return m_szHost;};
-
-	void SetHostPort(int port) {
-		m_hostPort = port;
-	};
-	int GetHostPort() {
-		return m_hostPort;
-	};
-
-	// sf at 2004 - Asynchronous FileTransfer - Delta Transfer
-	int  GenerateFileChecksums(HANDLE hFile, char* lpCSBuffer, int nCSBufferSize);
-	bool ReceiveDestinationFileChecksums(int nSize, int nLen);
-	bool ReceiveFileChunk(int nLen, int nSize);
-	void FinishFileReception();
-	bool SendFileChunk();
-	void FinishFileSending();
-	bool GetSpecialFolderPath(int nId, char* szPath);
-	int  ZipPossibleDirectory(LPSTR szSrcFileName);
-	int  CheckAndZipDirectoryForChecksuming(LPSTR szSrcFileName);
-	bool  UnzipPossibleDirectory(LPSTR szFileName);
-	bool MyGetFileSize(char* szFilePath, ULARGE_INTEGER* n2FileSize);
-	bool DoFTUserImpersonation();
-	void UndoFTUserImpersonation();
-
-    // jdp at 2008 - File Transfer event hooks
-    void FTUploadStartHook();
-    void FTUploadCancelledHook();
-    void FTUploadFailureHook();
-    void FTUploadCompleteHook();
-
-    void FTDownloadStartHook();
-    void FTDownloadCancelledHook();
-    void FTDownloadFailureHook();
-    void FTDownloadCompleteHook();
-
-    void FTNewFolderHook(std::string name);
-    void FTDeleteHook(std::string name, bool isDir);
-    void FTRenameHook(std::string oldName, std::string newname);
-    void SendServerStateUpdate(CARD32 state, CARD32 value);
-	void Record_SendServerStateUpdate(CARD32 state, CARD32 value);
-    void SendKeepAlive(bool bForce = false);
-    void SendFTProtocolMsg();
-	// adzm - 2010-07 - Extended clipboard
-	void NotifyExtendedClipboardSupport();
-	// adzm 2010-09 - Notify streaming DSM plugin support
-	void NotifyPluginStreamingSupport();
-
-	// sf at 2002 
-	// Update routines
-protected:
-	BOOL SendUpdate(rfb::SimpleUpdateTracker &update);
-	BOOL SendRFBMsg(CARD8 type, BYTE *buffer, int buflen);
-	//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-	BOOL SendRFBMsgQueue(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();
-	// CACHE
-	BOOL SendCacheRectangles(const rfb::RectVector &rects);
-	BOOL SendCacheRect(const rfb::Rect &dest);
-	BOOL SendCacheZip(const rfb::RectVector &rects); // sf at 2002
-
-	// Tight - CURSOR HANDLING
-	BOOL SendCursorShapeUpdate();
-	// nyama/marscha - PointerPos
-	BOOL SendCursorPosUpdate();
-	BOOL SendLastRect(); // Tight
-
-	void TriggerUpdateThread();
-
-	void PollWindow(HWND hwnd);
-
-
-	CARD32 m_state;
-	CARD32 m_value;
-	bool m_want_update_state; 
-	int unlockcounter;
-
-
-	// 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;}
-
-		virtual void add_changed(const rfb::Region2D &region) {
-			{
-				// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-				SimpleUpdateTracker::add_changed(region);
-				m_client->TriggerUpdateThread();
-			}
-		}
-		virtual void add_cached(const rfb::Region2D &region) {
-			{
-				// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-				SimpleUpdateTracker::add_cached(region);
-				m_client->TriggerUpdateThread();
-			}
-		}
-		
-		virtual void add_copied(const rfb::Region2D &dest, const rfb::Point &delta) {
-			{
-				// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-				SimpleUpdateTracker::add_copied(dest, delta);
-				m_client->TriggerUpdateThread();
-			}
-		}
-
-		virtual void clear() {
-			// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-			SimpleUpdateTracker::clear();
-		}
-
-		virtual void flush_update(rfb::UpdateInfo &info, const rfb::Region2D &cliprgn) {;
-			// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-			SimpleUpdateTracker::flush_update(info, cliprgn);
-		}
-		virtual void flush_update(rfb::UpdateTracker &to, const rfb::Region2D &cliprgn) {;
-			// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-			SimpleUpdateTracker::flush_update(to, cliprgn);
-		}
-
-		virtual void get_update(rfb::UpdateInfo &info) const {;
-			// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-			SimpleUpdateTracker::get_update(info);
-		}
-		virtual void get_update(rfb::UpdateTracker &to) const {
-			// RealVNC 336 change - omni_mutex_lock l(m_client->GetUpdateLock());
-			SimpleUpdateTracker::get_update(to);
-		}
-
-		virtual bool is_empty() const{
-			// RealVNC 336 change -  omni_mutex_lock l(m_client->GetUpdateLock());
-			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;};
-	int				m_SWOffsetx;
-	int				m_SWOffsety;
-	int				m_ScreenOffsetx;
-	int				m_ScreenOffsety;
-	int				m_display_type;
-	BOOL			m_NewSWUpdateWaiting;
-	rfbProtocolVersionMsg ProtocolVersionMsg;
-	//Timer Sendtimer;
-	//int roundrobin_counter;
-	//int timearray[rfbEncodingZRLE+1][31];
-	//int sizearray[rfbEncodingZRLE+1][31];
-	//int Totalsend;
-	BOOL client_settings_passed;
-	bool		m_Autoreconnect;
-
-	// Internal stuffs
-protected:
-	// Per-client settings
-	BOOL			m_IsLoopback;
-	BOOL			m_keyboardenabled;
-	BOOL			m_pointerenabled;
-	bool			m_jap;
-	int				m_capability;
-	vncClientId		m_id;
-	long			m_lConnectTime;
-
-	// 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;
-
-	// adzm 2009-07-05
-	char*			m_szRepeaterID;
-	// adzm 2009-08-02
-	char*			m_szHost;
-	int				m_hostPort;
-
-
-	// 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;
-	// vncKeymap		m_keymap;
-
-	// 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;
-	Clipboard		m_clipboard;
-
-	//SINGLE WINDOW
-	BOOL			m_use_NewSWSize;
-	BOOL			m_NewSWDesktop;
-	int				NewsizeW;
-	int				NewsizeH;
-
-	// CURSOR HANDLING
-	BOOL			m_cursor_update_pending;
-	BOOL			m_cursor_update_sent;
-	// nyama/marscha - PointerPos
-	BOOL			m_cursor_pos_changed;
-	BOOL			m_use_PointerPos;
-	POINT			m_cursor_pos;
-
-	// Modif sf at 2002 - FileTransfer 
-	BOOL m_fFileTransferRunning;
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	CZipUnZip32		*m_pZipUnZip;
-#endif
-
-	char  m_szFullDestName[MAX_PATH + 64];
-	char  m_szFileTime[18];
-	char* m_pBuff;
-	char* m_pCompBuff;
-	HANDLE m_hDestFile;
-	DWORD m_dwFileSize; 
-	DWORD m_dwNbPackets;
-	DWORD m_dwNbReceivedPackets;
-	DWORD m_dwNbBytesWritten;
-	DWORD m_dwTotalNbBytesWritten;
-	bool m_fFileDownloadError;
-	bool m_fFileDownloadRunning;
-    bool m_fFileSessionOpen;
-
-    // 8 April 2008 jdp
-    bool m_fUserAbortedFileTransfer;
-	char m_szSrcFileName[MAX_PATH + 64]; // Path + timestring
-	HANDLE m_hSrcFile;
-	bool m_fEof;
-	DWORD m_dwNbBytesRead;
-	DWORD m_dwTotalNbBytesRead;
-	int m_nPacketCount;
-	bool m_fCompressionEnabled;
-	bool m_fFileUploadError;
-	bool m_fFileUploadRunning;
-
-	// sf at 2004 - Delta Transfer
-	char*	m_lpCSBuffer;
-	int		m_nCSOffset;
-	int		m_nCSBufferSize;
-
-	// Modif sf at 2002 - Scaling
-	rfb::Rect		m_ScaledScreen;
-	UINT			m_nScale;
-	UINT			m_nScale_viewer;
-	bool			fNewScale;
-	bool			m_fPalmVNCScaling;
-	bool			fFTRequest;
-
-	// sf at 2002 
-	BYTE* m_pCacheZipBuf;
-	unsigned int m_nCacheZipBufSize;
-	BYTE* m_pRawCacheZipBuf;
-	unsigned int m_nRawCacheZipBufSize;
-
-	friend class TextChat; 
-	TextChat *m_pTextChat;	// Modif sf at 2002 - Text Chat
-
-	bool m_fUltraViewer; // sf at 2002 
-
-	// sf at 2005 - FTUserImpersonation
-	bool m_fFTUserImpersonatedOk;
-	DWORD m_lLastFTUserImpersonationTime;
-
-	//stats
-	int totalraw;
-
-    helper::DynamicFn<pSendinput> Sendinput;
-	// Modif cs at 2005
-#ifdef DSHOW
-	HANDLE m_hmtxEncodeAccess;
-#endif
-
-    std::string m_OrigSourceDirectoryName;
-    bool        m_wants_ServerStateUpdates;
-    bool        m_bClientHasBlockedInput;
-	bool		m_Support_rfbSetServerInput;
-    bool        m_wants_KeepAlive;
-	bool		m_session_supported;
-	bool		m_initial_update;
-};
-
-
-// vncClient thread class
-
-class vncClientThread : public omni_thread
-{
-public:
-
-	// Init
-	virtual BOOL Init(vncClient *client,
-		vncServer *server,
-		VSocket *socket,
-		BOOL auth,
-		BOOL shared);
-
-	// Sub-Init routines
-	virtual BOOL InitVersion();
-	virtual BOOL InitAuthenticate();
-	virtual BOOL AuthenticateClient(std::vector<CARD8>& current_auth);
-	virtual BOOL AuthenticateLegacyClient();
-
-	BOOL AuthSecureVNCPlugin(std::string& auth_message); // must SetHandshakeComplete after sending auth result!
-	BOOL AuthMsLogon(std::string& auth_message);
-	BOOL AuthVnc(std::string& auth_message);
-	BOOL AuthSCPrompt(std::string& auth_message); // adzm 2010-10
-	BOOL AuthSessionSelect(std::string& auth_message); // adzm 2010-10
-
-	BOOL FilterClients_Blacklist();
-	BOOL FilterClients_Ask_Permission();
-	BOOL CheckEmptyPasswd();
-	BOOL CheckLoopBack();
-	void LogAuthResult(bool success);
-	void SendConnFailed(const char* szMessage);
-
-	// adzm 2010-08
-	virtual bool InitSocket();
-	virtual bool TryReconnect();
-
-	// The main thread function
-	virtual void run(void *arg);
-	bool m_autoreconnectcounter_quit;
-
-	UINT m_AutoReconnectPort;
-	char m_szAutoReconnectAdr[255];
-	char m_szAutoReconnectId[MAX_PATH];
-
-protected:
-	virtual ~vncClientThread();
-
-	// Fields
-protected:
-	VSocket *m_socket;
-	vncServer *m_server;
-	vncClient *m_client;
-	BOOL m_auth;
-	BOOL m_shared;
-	BOOL m_ms_logon;
-	int m_major;
-	int m_minor;
-};
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncconndialog.cpp b/ica/win32/winvnc/winvnc/vncconndialog.cpp
deleted file mode 100644
index 8cc8f13..0000000
--- a/ica/win32/winvnc/winvnc/vncconndialog.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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 at 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"
-#include "common/win32_helpers.h"
-
-#include <ctype.h>
-
-#include "Localization.h" // ACT : Add localization on messages
-
-//	[v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-extern BOOL SPECIAL_SC_PROMPT;
-
-// Constructor
-
-vncConnDialog::vncConnDialog(vncServer *server)
-{
-	m_server = server;
-	m_hicon = NULL;
-	m_hfont = NULL;
-}
-
-// Destructor
-
-vncConnDialog::~vncConnDialog()
-{
-}
-
-// Routine called to activate the dialog and, once it's done, delete it
-
-INT_PTR vncConnDialog::DoDialog()
-{
-	//	[v1.0.2-jp1 fix]
-	//DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_OUTGOING_CONN), 	
-	//adzm 2009-06-20 - Return the result
-	INT_PTR nResult = DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_OUTGOING_CONN), 
-		NULL, (DLGPROC) vncConnDlgProc, (LONG_PTR) this);
-	delete this;
-	return nResult;
-}
-
-// 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 = helper::SafeGetWindowUserData<vncConnDialog>(hwnd);
-
-	switch (uMsg) {
-	case WM_PAINT:
-		{
-			//adzm 2009-06-20
-			if (GetUpdateRect(hwnd, NULL, TRUE)) {
-				PAINTSTRUCT ps;
-				HDC hdc = BeginPaint(hwnd, &ps);
-
-				{
-					RECT rcIcon;
-					rcIcon.top = 0;
-					rcIcon.left = 0;
-					rcIcon.bottom = 48;
-					rcIcon.right = 48;
-					
-					RECT rcClient;
-					if (GetClientRect(hwnd, &rcClient)) {
-						int nDifference = (rcClient.bottom - rcIcon.bottom) / 2;
-						if (nDifference > 0) {
-							rcIcon.top += nDifference;
-							rcIcon.bottom += nDifference;
-						}
-					}
-
-					RECT rcLabel;
-					HWND hwndLabel = GetDlgItem(hwnd, IDC_CONNECTION_NUMBER_STATIC);
-					if (GetWindowRect(hwndLabel, &rcLabel)) {
-						LPRECT lprcLabel = &rcLabel;
-						ScreenToClient(hwnd, (LPPOINT)lprcLabel);
-						ScreenToClient(hwnd, ((LPPOINT)lprcLabel)+1);
-
-						int nAdjustment = (rcLabel.left - rcIcon.right) / 2;
-
-						rcIcon.left += nAdjustment;
-						rcIcon.right += nAdjustment;
-					}
-
-					RECT rcIntersect;
-
-					if (IntersectRect(&rcIntersect, &rcIcon, &(ps.rcPaint))) {
-						if (_this->m_hicon == NULL) {
-							_this->m_hicon = (HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-							   48, 48, 0);
-						}
-						if (_this->m_hicon) {
-							HBRUSH hbr = (HBRUSH)SendMessage(hwnd, WM_CTLCOLORDLG, (WPARAM)hdc, (WPARAM)hwnd);
-							DrawIconEx(hdc, rcIcon.left, rcIcon.top, _this->m_hicon, 48, 48, 0, hbr, DI_NORMAL);
-						}
-					}
-				}
-
-				EndPaint(hwnd, &ps);
-			}
-
-			return 0;
-		}
-
-		// 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
-            helper::SafeSetWindowUserData(hwnd, lParam);
-
-            vncConnDialog *_this = (vncConnDialog *) lParam;
-
-			//adzm 2009-06-20
-			if (g_szRepeaterHost) {
-				SetDlgItemText(hwnd, IDC_HOSTNAME_EDIT, g_szRepeaterHost);
-
-				//adzm 2009-06-20
-				if (SPECIAL_SC_PROMPT) {
-					HWND hwndChild = GetDlgItem(hwnd, IDC_HOSTNAME_EDIT);
-					if (hwndChild) {
-						ShowWindow(hwndChild, SW_HIDE);
-					}
-					hwndChild = GetDlgItem(hwnd, IDC_HOSTNAME_STATIC);
-					if (hwndChild) {
-						ShowWindow(hwndChild, SW_HIDE);
-					}
-
-					HWND hwndEdit = GetDlgItem(hwnd, IDC_IDCODE);
-					HWND hwndLabel = GetDlgItem(hwnd, IDC_CONNECTION_NUMBER_STATIC);
-
-					RECT rcEdit;
-					RECT rcLabel;
-					GetWindowRect(hwndEdit, &rcEdit);
-					GetWindowRect(hwndLabel, &rcLabel);
-
-					LPRECT lprcEdit = &rcEdit;
-					LPRECT lprcLabel = &rcLabel;
-
-					ScreenToClient(hwnd, (LPPOINT)lprcEdit);
-					ScreenToClient(hwnd, ((LPPOINT)lprcEdit)+1);
-					
-					ScreenToClient(hwnd, (LPPOINT)lprcLabel);
-					ScreenToClient(hwnd, ((LPPOINT)lprcLabel)+1);
-
-					RECT rcClient;
-					GetClientRect(hwnd, &rcClient);
-
-					long nTotalHeight = rcEdit.bottom - rcLabel.top;
-
-					long nAdjustedTop = (rcClient.bottom - nTotalHeight) / 2;
-
-					long nAdjustment = nAdjustedTop - rcLabel.top;
-
-					MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + nAdjustment, rcLabel.right - rcLabel.left, rcLabel.bottom - rcLabel.top, TRUE);
-					MoveWindow(hwndEdit, rcEdit.left, rcEdit.top + nAdjustment, rcEdit.right - rcEdit.left, rcEdit.bottom - rcEdit.top, TRUE);
-
-					HWND hwndCaption = GetDlgItem(hwnd, IDC_CAPTION_STATIC);
-					HFONT hFont = (HFONT)SendMessage(hwndCaption, WM_GETFONT, 0, 0);
-					if (hFont) {
-						LOGFONT lf;
-						if (GetObject(hFont, sizeof(LOGFONT), &lf)) {
-							lf.lfWidth = 0;
-							lf.lfHeight = (lf.lfHeight * 6) / 4;
-
-							_this->m_hfont = CreateFontIndirect(&lf);
-
-							if (_this->m_hfont) {
-								SendMessage(hwndCaption, WM_SETFONT, (WPARAM)_this->m_hfont, (LPARAM)TRUE);
-							}
-						}
-					}
-					SetWindowText(hwndCaption, "Connect to Technical Support");
-					ShowWindow(hwndCaption, SW_SHOWNA);
-				}
-
-				SetFocus(GetDlgItem(hwnd, IDC_IDCODE));
-			} else {            
-				// Make the text entry box active
-				SetFocus(GetDlgItem(hwnd, IDC_HOSTNAME_EDIT));
-			}
-			
-			SetForegroundWindow(hwnd);
-			
-            // Return success!
-			return TRUE;
-		}
-
-		// Dialog has just received a command
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-			// User clicked OK or pressed return
-		case IDOK:
-		{
-			// sf at 2002 - host:num & host::num analyse.
-			// Compatible with both RealVNC and TightVNC methods
-			char hostname[_MAX_PATH];
-			char actualhostname[_MAX_PATH];
-			char idcode[_MAX_PATH];
-			char *portp;
-			int port;
-			bool id;
-
-			// Get the hostname of the VNCviewer
-			GetDlgItemText(hwnd, IDC_HOSTNAME_EDIT, hostname, _MAX_PATH);
-			GetDlgItemText(hwnd, IDC_IDCODE, idcode, _MAX_PATH);
-			if (strcmp(idcode,"")==0) id=false;
-			else id=true;
-
-			strcpy(actualhostname, hostname);
-			
-			//adzm 2010-02-15 - Multiple repeaters chosen by modulo of ID
-
-			char finalidcode[_MAX_PATH];
-			//adzm 2010-08 - this was sending uninitialized data over the wire
-			ZeroMemory(finalidcode, sizeof(finalidcode));
-
-			//adzm 2009-06-20
-			if (id) {
-				size_t i = 0;
-
-				for (i = 0; i < strlen(idcode); i++)
-				{
-					finalidcode[i] = toupper(idcode[i]);
-				} 
-				finalidcode[i] = 0;
-
-				if (0 != strncmp("ID:", idcode, 3)) {
-					strcpy(finalidcode, "ID:");
-					
-					for (i = 0; i < strlen(idcode); i++)
-					{
-						finalidcode[i+3] = toupper(idcode[i]);
-					} 
-					finalidcode[i+3] = 0;
-				}
-
-				
-				//adzm 2010-02-15 - At this point, finalidcode is of the form "ID:#####"
-				int numericId = atoi(finalidcode + 3);
-
-				int numberOfHosts = 1;
-				for (i = 0; i < strlen(hostname); i++) {
-					if (hostname[i] == ';') {
-						numberOfHosts++;
-					}
-				}
-
-				if (numberOfHosts <= 1) {
-					// then hostname == actualhostname
-				} else {
-					int modulo = numericId % numberOfHosts;
-
-					char* szToken = strtok(hostname, ";");
-					while (szToken) {
-						if (modulo == 0) {
-							strcpy(actualhostname, szToken);
-							break;
-						}
-
-						modulo--;
-						szToken = strtok(NULL, ";");
-					}
-				}
-			}
-
-			// Calculate the Display and Port offset.
-			port = INCOMING_PORT_OFFSET;
-			portp = strchr(actualhostname, ':');
-			if (portp)
-			{
-				*portp++ = '\0';
-				if (*portp == ':') // Tight127 method
-				{
-					port = atoi(++portp);		// Port number after "::"
-				}
-				else // RealVNC method
-				{
-					if (atoi(portp) < 100)		// If < 100 after ":" -> display number
-						port += atoi(portp);
-					else
-						port = atoi(portp);	    // If > 100 after ":" -> Port number
-				}
-			}
-
-
-			
-			// 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(actualhostname, port))
-			{
-				if (id) 
-					{							
-						
-
-						tmpsock->Send(finalidcode,250);
-						tmpsock->SetTimeout(0);
-/*						if (strncmp(hostname,"ID",2)!=0)
-						{
-						while (true)
-						{
-							char result[1];
-							tmpsock->Read(result,1);
-							if (strcmp(result,"2")==0)
-								break;
-							tmpsock->Send("1",1);
-						}
-						}*/
-						
-						// adzm 2009-07-05 - repeater IDs
-						// Add the new client to this server
-						// adzm 2009-08-02
-						_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, finalidcode, actualhostname, port);
-					} else {
-						// Add the new client to this server
-						// adzm 2009-08-02
-						_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, actualhostname, port);				
-					}
-				// And close the dialog
-				EndDialog(hwnd, TRUE);
-			}
-			else
-			{
-				// Print up an error message
-				MessageBoxSecure(NULL, 
-					sz_ID_FAILED_CONNECT_LISTING_VIEW,
-					sz_ID_OUTGOING_CONNECTION,
-					MB_OK | MB_ICONEXCLAMATION );
-				delete tmpsock;
-			}
-			return TRUE;
-		}
-		
-			// Cancel the dialog
-		case IDCANCEL:
-			EndDialog(hwnd, FALSE);
-			return TRUE;
-		};
-
-		break;
-
-	case WM_DESTROY:
-		EndDialog(hwnd, FALSE);
-		if (_this->m_hicon != NULL) {
-			DestroyIcon(_this->m_hicon);
-			_this->m_hicon = NULL;
-		}
-		if (_this->m_hfont != NULL) {
-			DeleteObject(_this->m_hfont);
-			_this->m_hfont = NULL;
-		}
-		return TRUE;
-	}
-	return 0;
-}
-
diff --git a/ica/win32/winvnc/winvnc/vncconndialog.h b/ica/win32/winvnc/winvnc/vncconndialog.h
deleted file mode 100644
index 878b3fc..0000000
--- a/ica/win32/winvnc/winvnc/vncconndialog.h
+++ /dev/null
@@ -1,69 +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 at 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
-	//adzm 2009-06-20 - Return the result
-	INT_PTR 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;
-
-	//adzm 2009-06-20
-	HICON m_hicon;
-	HFONT m_hfont;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncdesktop.cpp b/ica/win32/winvnc/winvnc/vncdesktop.cpp
deleted file mode 100644
index 93c491a..0000000
--- a/ica/win32/winvnc/winvnc/vncdesktop.cpp
+++ /dev/null
@@ -1,2456 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-// vncDesktop implementation
-
-// System headers
-#include <assert.h>
-#include "stdhdrs.h"
-
-// Custom headers
-//#include <WinAble.h>
-#include <omnithread.h>
-#include "winvnc.h"
-#include "vnchooks/VNCHooks.h"
-#include "vncserver.h"
-#include "vnckeymap.h"
-#include "rfbRegion.h"
-#include "rfbRect.h"
-#include "vncdesktop.h"
-#include "vncservice.h"
-// Modif rdv at 2002 - v1.1.x - videodriver
-#include "vncOSVersion.h"
-
-#include "mmsystem.h" // sf at 2002
-#include "TextChat.h" // sf at 2002
-#include "vncdesktopthread.h"
-#include "common/win32_helpers.h"
-#include <algorithm>
-#include <commctrl.h>
-
-
-
-// Constants
-const UINT RFB_SCREEN_UPDATE = RegisterWindowMessage("WinVNC.Update.DrawRect");
-const UINT RFB_COPYRECT_UPDATE = RegisterWindowMessage("WinVNC.Update.CopyRect");
-const UINT RFB_MOUSE_UPDATE = RegisterWindowMessage("WinVNC.Update.Mouse");
-const char szDesktopSink[] = "WinVNC desktop sink";
-
-bool g_Desktop_running;
-extern bool g_DesktopThread_running;
-extern bool g_update_triggered;
-DWORD WINAPI BlackWindow(LPVOID lpParam);
-
-//
-// // Modif sf at 2002 - v1.1.0 - Optimization
-//
-// Here we try to speed up the Poll FullScreen function.
-// Instead of adding the entire Rect to cached region,
-// we divide it in 32/32 pixels blocks and only scan the top-left
-// pixel of each block.
-// If a pixel has changed, we find the smallest window containing this pixel
-// and add the Window rect to the cached region
-//
-// This function is supposed to be a good compromise between
-// speed and efficiency.
-// The accuracy has been greatly improved and it now detects very
-// small changes on screen that are not detected by the Hooks.
-// This new accuracy is obtained by shifting the detection grid 
-// in diagonale (the function works with several grids that are tested 
-// alternatively). There's probably still room for improvements...
-//
-// NB: Changes generated by applications using hardware acceleration 
-// won't be detected (In order to see a video played on the server using
-// Media Player, the vncviewer user must desactivate "Hardware accelation"
-// in the Media Player options). 
-// 
-// 
-//
- extern bool G_USE_PIXEL;
-PixelCaptureEngine::~PixelCaptureEngine()
-{
-}
-
-PixelCaptureEngine::PixelCaptureEngine()
-	{
-		if (OSversion()==2) m_bIsVista=true;
-		else 
-			m_bIsVista=false;
-/*		if (G_USE_PIXEL)
-			m_bIsVista=false;*/
-	}
-void
-PixelCaptureEngine::PixelCaptureEngineInit(HDC rootdc, HDC memdc, HBITMAP membitmap, bool bCaptureAlpha, void *dibbits, int bpp, int bpr)
-	{
-		m_hmemdc=memdc;
-		m_membitmap=membitmap;
-		m_oldbitmap=0;
-		m_DIBbits=dibbits;
-		m_bCaptureAlpha=bCaptureAlpha;
-		m_hrootdc=rootdc;
-		m_bytesPerPixel=bpp;
-		m_bytesPerRow=bpr;
-	}
-
-bool
-PixelCaptureEngine::CaptureRect(const rfb::Rect& rect)
-	{
-		if (m_bIsVista)
-		{
-				m_rect = rect;
-				if ((m_oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-					return false;
-
-				// Capture screen into bitmap
-				BOOL blitok = BitBlt(m_hmemdc, 0, 0, rect.width(), rect.height(), m_hrootdc, rect.tl.x, rect.tl.y, 
-									 m_bCaptureAlpha ? (CAPTUREBLT | SRCCOPY) : SRCCOPY);
-				return blitok ? true : false;
-		}
-		return true;
-	}
-
-COLORREF
-PixelCaptureEngine::CapturePixel(int x, int y)
-	{
-		if (m_bIsVista)
-		{
-				COLORREF cr = 0;
-				unsigned int index = (m_bytesPerRow * y) + (m_bytesPerPixel * x);
-				memcpy(&cr, ((char*)m_DIBbits)+index, m_bytesPerPixel);
-
-				return cr;
-		}
-		else
-		{
-
-				COLORREF cr=0;		
-				cr=GetPixel(m_hrootdc, x, y);
-				return cr;
-		}
-	}
-
-void
-PixelCaptureEngine::ReleaseCapture()
-	{
-		// Select the old bitmap back into the memory DC
-	if (m_bIsVista) 
-		{
-				SelectObject(m_hmemdc, m_oldbitmap);
-				m_oldbitmap = 0;
-		}
-	}
-
-
-bool vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bool fTurbo)
-{
-	bool returnvalue=false;
-	bool fInitGrid = false;
-	bool fIncCycle = false;
-	// For more accuracy, we could use 24 or even 16
-	const int PIXEL_BLOCK_SIZE  = 32; // Pixels Grid definition
-	const int GRID_OFFSET = 4;  // Pixels Grid shifting during cycle (in pixels)
-								// The number of grid per zone is PIXEL_BLOCK_SIZE/GRID_OFFSET (must be int !)
-	int x, y;
-	int xo, yo;
-	// WindowsList lWList;
-	WindowsList::iterator iWindow;
-
-	// In turbo mode, we clear the list of windows at each iteration -> Lot of updates because 
-	//  the same windows can be detected several times during a complete cycle
-	// (To avoid this pb, we must update all the grids at the same coordinate when a pixel of 
-	// one grid has changed -> later)
-	// Otherwise we only clear it each time the Grid cycle loops -> Less updates, less framerate,
-	// less CPU, less bandwidth
-	if (fTurbo || (m_nGridCycle == 0))
-		m_lWList.clear();
-
-	// Create all the Grids (for all the 5 zones (4 quarter screens + 1 full screen)
-	// Actually, the quarter screens are not utilized in v1.1.0 but it does not
-	// generate any overhead neither additionnal memory consumption (see below)
-	if (m_lGridsList.empty())
-	{
-		for (int i = 0; i < (5 * PIXEL_BLOCK_SIZE / GRID_OFFSET); i++)
-		{
-			RGBPixelList *pList = new RGBPixelList;
-			pList->reserve((rect.height() / PIXEL_BLOCK_SIZE) * (rect.width() / PIXEL_BLOCK_SIZE));
-			if (pList != NULL)
-			{
-				m_lGridsList.push_back(pList);
-			    vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid %d created !\n"), i);
-			}
-		}
-
-		hDeskWnd = GetDesktopWindow();
-		HWND hWnd = FindWindow(_T("Progman"), _T("Program Manager"));
-		if (NULL != hWnd) hWnd = FindWindowEx(hWnd, NULL, "SHELLDLL_DefView", "");
-		if (NULL != hWnd) hWnd = FindWindowEx(hWnd, NULL, "SysListView32", "FolderView");
-		hFolderView=hWnd;
-		if (NULL != hWnd)
-			{
-			nr_rects = SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);
-			if (nr_rects>200) nr_rects=200;
-			for (int j = 0; j < nr_rects; j++)
-                {
-					DWORD pid;
-					GetWindowThreadProcessId(hWnd, &pid);
-					HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
-					RECT* ptritemrect;
-					RECT itemrect;
-					ptritemrect = (RECT*)VirtualAllocEx(hProcess, NULL, sizeof(RECT), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
-					if (ptritemrect == NULL) {
-					   
-					} else {
-					SendMessage(hWnd, LVM_GETITEMRECT, j, (LPARAM)ptritemrect);
-#ifdef _X64
-					SIZE_T copied = 0;
-#else
-					DWORD copied = 0;
-#endif
-					ReadProcessMemory(hProcess, (void*)ptritemrect, (LPVOID)&itemrect, sizeof(itemrect), &copied);
-					rfb::Rect wrect = rfb::Rect(itemrect).intersect(m_Cliprect);
-					iconregion.assign_union(wrect);
-					VirtualFreeEx(hProcess, ptritemrect, 0, MEM_RELEASE);
-					}
-				}
-			}
-
-	}
-
-	PixelEngine.PixelCaptureEngineInit(m_hrootdc, m_hmemdc, m_membitmap, m_fCaptureAlphaBlending && !m_Black_window_active, 
-		                           m_DIBbits, m_scrinfo.format.bitsPerPixel / 8, m_bytesPerRow);
-	// We test one zone at a time 
-	// vnclog.Print(LL_INTINFO, VNCLOG("### Polling Grid %d - SubGrid %d\n"), nZone, m_nGridCycle); 
-	GridsList::iterator iGrid;
-	int nGridPos = (nZone * PIXEL_BLOCK_SIZE / GRID_OFFSET) + m_nGridCycle;
-
-	iGrid = m_lGridsList.begin();
-    std::advance(iGrid, nGridPos);
-
-	RGBPixelList *pThePixelGrid  =  *iGrid;
-	RGBPixelList::iterator iPixelColor =  pThePixelGrid->begin();
-
-	if (nZone == 0 || nZone == 4)
-	{
-	   // vnclog.Print(LL_INTINFO, VNCLOG("### IncCycle Please !\n")); 
-	   fIncCycle = true;
-	}
-
-	if (pThePixelGrid->empty())
-	{
-		// vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init\n"));
-		fInitGrid = true;
-	}
-
-	int nOffset = GRID_OFFSET * m_nGridCycle;
-
-
-
-	PixelEngine.CaptureRect(rect);
-	if (PixelEngine.m_bIsVista) returnvalue=true;
-	// Try to detect if screen is almost idle
-	// no need to poll static screens very fast, it only use cpu
-	change_found=0;
-	// We walk our way through the Grids
-	for (y = rect.tl.y; y < (rect.br.y -nOffset -1) ; y += PIXEL_BLOCK_SIZE)
-	{
-		yo = y + nOffset;
-
-		for (x = rect.tl.x; x < (rect.br.x -nOffset); x += PIXEL_BLOCK_SIZE)
-		{
-			xo = x + nOffset;
-			bool AlreadyInRegion=rgn.IsPtInRegion(xo,yo);
-			// Read the pixel's color on the screen
-			COLORREF PixelColor = 0;
-			//if (!AlreadyInRegion || fInitGrid ) 
-				PixelColor =PixelEngine.CapturePixel(xo, yo);
-
-			// If init list
-			if (fInitGrid)
-			{
-				int off = iPixelColor - pThePixelGrid->begin();
-			   pThePixelGrid->push_back(PixelColor);
-				iPixelColor = pThePixelGrid->begin() + off;
-			   // vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init : Pixel xo=%d - yo=%d - C=%ld\n"), xo, yo, (long)PixelColor); 
-			   continue;
-			}
-
-//			vnclog.Print(LL_INTINFO, VNCLOG("### GetPixel %i\n"),OSversion());
-			// If the pixel has changed
-			if (*iPixelColor != PixelColor)
-			{
-				change_found=1;
-				// Save the new Pixel in the list
-				*iPixelColor = PixelColor;
-				if (!AlreadyInRegion)
-				{
-				// Then find the corresponding Window
-				POINT point;
-				RECT rect;
-
-				point.x = xo;
-				point.y = yo;
-
-				// Find the smallest, non-hidden, non-disabled Window containing this pixel
-				// REM: We don't use ChildWindowFromPoint because we don't want of hidden windows
-				HWND hwnd = WindowFromPoint(point);
-
-				/// This is the fulldesktop, cause a full scan performance !
-				if (hFolderView == hwnd && hFolderView)
-				{
-					if (iconregion.IsPtInRegion(xo,yo))rgn.assign_union(iconregion);
-					else
-					{
-							rect.left=xo-PIXEL_BLOCK_SIZE-m_ScreenOffsetx;
-							rect.right=xo+PIXEL_BLOCK_SIZE-m_ScreenOffsetx;
-							rect.top=yo-PIXEL_BLOCK_SIZE-m_ScreenOffsetx;
-							rect.bottom=yo+PIXEL_BLOCK_SIZE-m_ScreenOffsetx;
-							rfb::Rect wrect = rfb::Rect(rect).intersect(m_Cliprect);
-							if (!wrect.is_empty())
-							{
-								rgn.assign_union(wrect);
-							}
-					}
-				}
-				// Look if we've already detected this window
-				if (hwnd != hDeskWnd  && hFolderView != hwnd)
-				{
-					
-					// Look if we've already detected this window
-					if (std::find(m_lWList.begin(), m_lWList.end(), hwnd) == m_lWList.end())
-					{			    
-						// Add the corresponding rect to the cache region 
-						if (GetWindowRect(hwnd, &rect))
-							{
-								//Buffer coordinates
-								rect.left-=m_ScreenOffsetx;
-								rect.right-=m_ScreenOffsetx;
-								rect.top-=m_ScreenOffsety;
-								rect.bottom-=m_ScreenOffsety;
-								rfb::Rect wrect = rfb::Rect(rect).intersect(m_Cliprect);
-								if (!wrect.is_empty())
-									{
-/*#ifdef _DEBUG
-					char			szText[256];
-					DWORD error=GetLastError();
-					sprintf(szText,"CheckRect 222222 ++++++++++++++++ %i %i %i %i  \n",wrect.tl.x,wrect.br.x,wrect.tl.y,wrect.br.y);
-					SetLastError(0);
-					OutputDebugString(szText);		
-#endif*/
-										rgn.assign_union(wrect);
-										m_lWList.insert(hwnd);
-									}
-							}
-					}
-				}
-			}
-			}
-
-			++iPixelColor; // Next PixelColor in the list
-		}
-	}
-	PixelEngine.ReleaseCapture();
-	///////////////////////
-	// We coun the number of idle detects
-	// after x time, force some timeout
-	if (change_found)
-	{
-		idle_counter=0;
-	}
-	else
-	{
-		idle_counter=idle_counter+5;
-	}
-	if (idle_counter>20) 
-	{
-		//Beep(100,idle_counter);
-		Sleep (idle_counter);
-	}
-	// 250 increased to 500, possible even 1000 will still have a good reaction time
-	if (idle_counter>1000) idle_counter=1000;
-	///////////////////////
-
-	if (fIncCycle)
-	{
-	   m_nGridCycle = (m_nGridCycle + 1) % (PIXEL_BLOCK_SIZE / GRID_OFFSET);
-	}
-	return returnvalue;
-}
-
-
-
-
-// Implementation
-
-vncDesktop::vncDesktop()
-{
-	m_thread = NULL;
-#ifdef AVILOG
-	AviGen=NULL;
-#endif
-	m_Black_window_active=false;
-	m_hwnd = NULL;
-	//m_timerid = 0;
-	// adzm - 2010-07 - Fix clipboard hangs
-	m_settingClipboardViewer = false;
-	m_hnextviewer = NULL;
-	m_hcursor = NULL;
-	m_hOldcursor = NULL; // sf at 2002
-
-	m_displaychanged = FALSE;
-	m_update_triggered = FALSE;
-	g_update_triggered = FALSE;
-
-	m_hrootdc = NULL;
-	m_hmemdc = NULL;
-	m_membitmap = NULL;
-
-	// adzm - 2010-07 - Fix clipboard hangs
-	//m_initialClipBoardSeen = FALSE;
-
-	m_foreground_window = NULL;
-
-	// Vars for Will Dean's DIBsection patch
-	m_DIBbits = NULL;
-	m_formatmunged = FALSE;
-
-	m_clipboard_active = FALSE;
-
-	m_pollingcycle = 0;
-
-	// Modif sf at 2002 - v1.1.0 
-	m_lWList.clear();
-    m_lGridsList.clear();
-	m_nGridCycle = 0;
-
-	// Modif sf at 2002 - v1.1.0
-	// m_lLastTempo = 0L;
-	m_lLastMouseUpdateTime = 0L;
-	m_lLastSlowClientTestTime = timeGetTime();
-
-	// sf at 2002 - TextChat - No more used for now
-	// m_fTextChatRunning = false;
-	// m_pCurrentTextChat = NULL;
-
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	m_videodriver=NULL;
-	m_ScreenOffsetx=0;
-	m_ScreenOffsety=0;
-	m_hookdriver=false;
-
-	OldPowerOffTimeout=0;
-
-	On_Off_hookdll=false;
-	g_Desktop_running=true;
-	hUser32=LoadLibrary("USER32");
-	if (hUser32) pbi = (pBlockInput)GetProcAddress( hUser32, "BlockInput");
-	m_OrigpollingSet=false;
-	m_Origpolling=false;
-	DriverWantedSet=false;
-	can_be_hooked=false;
-
-	multi_monitor=true;
-    m_bIsInputDisabledByClient = false;
-	m_input_desktop = 0;
-	m_home_desktop = 0;
-	idle_counter=0;
-	trigger_events[0]=CreateEvent(NULL,TRUE,FALSE,"timer");
-	trigger_events[1]=CreateEvent(NULL,TRUE,FALSE,"screenupdate");
-	trigger_events[2]=CreateEvent(NULL,TRUE,FALSE,"mouseupdate");
-	trigger_events[3]=CreateEvent(NULL,TRUE,FALSE,"user1");
-	trigger_events[4]=CreateEvent(NULL,TRUE,FALSE,"user2");
-	trigger_events[5]=CreateEvent(NULL,TRUE,FALSE,"quit");
-	restart_event=CreateEvent(NULL,TRUE,TRUE,"restart");
-	rgnpump.clear();
-	lock_region_add=false;
-	InitWindowThreadh=NULL;
-	old_Blockinput=2;
-	old_Blockinput1=2;
-	old_Blockinput2=2;
-	nr_rects=0;
-	iconregion.clear();
-	blankmonitorstate=false;
-}
-
-vncDesktop::~vncDesktop()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("~vncDesktop \n"));
-
-	// If we created a thread then here we delete it
-	// The thread itself does most of the cleanup
-	if(m_thread != NULL)
-	{
-		StopInitWindowthread();
-		int counter=0;
-		while (g_DesktopThread_running!=false)
-		{
-			if (Window()==NULL)SetEvent(trigger_events[5]);;
-			Sleep(100);
-			counter++;
-			if (counter>50) 
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("Desktop thread running, force close \n"));
-				SetEvent(trigger_events[5]);
-				break;
-			}
-		}
-		// Join with the desktop handler thread
-		void *returnval;
-		m_thread->join(&returnval);
-		m_thread = NULL;
-	}
-
-
-
-	// added jeff
-    SetBlockInputState(false);
-	// Let's call Shutdown just in case something went wrong...
-	Shutdown();
-	vnclog.Print(LL_INTINFO, VNCLOG("~vncDesktop Shutdown()\n"));
-	// Modif sf at 2002
-	m_lWList.clear();
-	GridsList::iterator iGrid;
-	for (iGrid = m_lGridsList.begin(); iGrid != m_lGridsList.end(); iGrid++)
-	{
-		if (*iGrid)
-		{
-			// Since we've replaced this:
-			// "typedef std::list<RGBPixelList*> GridsList;"
-			// with this:
-			// "typedef std::list<void*> GridsList;"
-			// we must be carefull to avoid memory leaks...
-			((RGBPixelList*)(*iGrid))->clear();
-			delete ((RGBPixelList*)(*iGrid));
-			//vnclog.Print(LL_INTWARN, VNCLOG("delete ((RGBPixelList) \n"));
-		}
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("~vncDesktop m_lGridsList.clear\n"));
-	m_lGridsList.clear();
-	if (hUser32) FreeLibrary(hUser32);
-	g_Desktop_running=false;
-	for (int i=0;i<6;i++)
-	CloseHandle(trigger_events[i]);
-	CloseHandle(restart_event);
-	//problems, sync could be restarted in the little time the desktop thread was still running
-	//then this doesn't exist on desktop close and sink window crash
-	// Fix E. SAG
-	if (InitWindowThreadh)
-	{
-      vnclog.Print(LL_INTERR, VNCLOG("~vncDesktop:: second request to close InitWindowthread\n"));
-      StopInitWindowthread();
-	}
-}
-
-
-// Tell the desktop hooks to grab & update a particular rectangle
-void
-vncDesktop::QueueRect(const rfb::Rect &rect)
-{
-	//Full screen Update
-	SetEvent(trigger_events[4]);
-}
-	
-// Kick the desktop hooks to perform an update
-void
-vncDesktop::TriggerUpdate()
-{
-	// Note that we should really lock the update lock here,
-	// but there are periodic timer updates anyway, so
-	// we don't actually need to.  Something to think about.
-	if (!m_update_triggered) {
-		m_update_triggered = TRUE;
-		g_update_triggered = TRUE;
-		SetEvent(trigger_events[0]);
-	}
-}
-
-
-// Routine to startup and install all the hooks and stuff
-DWORD
-vncDesktop::Startup()
-{
-	// Initialise the Desktop object
-    DWORD status;
-	if (!InitDesktop())
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("InitDesktop Failed\n"));
-			return ERROR_DESKTOP_INIT_FAILED;
-		}
-
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	vnclog.Print(LL_INTINFO, VNCLOG("InitVideo driver Called\n"));
-	if (FALSE != DriverWantedSet)
-			{
-			m_server->Driver(DriverWanted);
-			m_server->Hook(HookWanted);
-			DriverWantedSet=FALSE;
-			}
-	if (m_server->Driver())
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("Driver option enabled \n"));
-					if(OSversion()==1 || OSversion()==2 )
-						{
-							//Enable only the video driver for the Default desktop
-							HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
-							DWORD dummy;
-							char new_name[256];
-							if (GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-								{
-									if (strcmp(new_name,"Default")==0)
-										{
-											InitVideoDriver();
-										}
-									else 
-										vnclog.Print(LL_INTINFO, VNCLOG("no default desktop \n"));
-								}
-						}
-				}
-    else
-	vnclog.Print(LL_INTINFO, VNCLOG("Driver option disabled \n"));
-	if (m_Origpolling) m_server->PollFullScreen(m_Origpolling);
-	m_OrigpollingSet=false;
-	
-	if (VideoBuffer())
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("Break log\n"));
-	}
-	if ((status = InitBitmap()) != 0)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("InitBitmap Failed\n"));
-			return status;
-		}
-
-	if (!ThunkBitmapInfo())
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("ThunkBitmapInfo Failed\n"));
-			return FALSE;
-		}
-
-	if (VideoBuffer())
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("Removing real Dib buffer and replace by driver communication buffer\n"));
-		if (m_membitmap != NULL)
-			{
-				DeleteObject(m_membitmap);
-				m_membitmap = NULL;
-			}
-		m_DIBbits=m_videodriver->myframebuffer;
-		pchanges_buf=m_videodriver->mypchangebuf;
-		m_buffer.VideDriverUsed(true);
-		InvalidateRect(NULL,NULL,TRUE);
-	}
-    else if ((status = EnableOptimisedBlits()) != 0)
-    {
-		vnclog.Print(LL_INTINFO, VNCLOG("EnableOptimisedBlits Failed\n"));
-		m_buffer.VideDriverUsed(false);
-		return status;
-    }
-	else m_buffer.VideDriverUsed(false);
-
-	if ((status = SetPixFormat()) != 0)
-		{
-		vnclog.Print(LL_INTINFO, VNCLOG("SetPixFormat Failed\n"));
-		return status;
-		}
-
-	if (!SetPixShifts())
-		{
-		vnclog.Print(LL_INTINFO, VNCLOG("SetPixShift Failed\n"));
-		return ERROR_DESKTOP_UNSUPPORTED_PIXEL_FORMAT;
-		}
-	
-	if (!SetPalette())
-		{
-		vnclog.Print(LL_INTINFO, VNCLOG("SetPalette Failed\n"));
-		return ERROR_DESKTOP_NO_PALETTE;
-		}
-	
-		StartInitWindowthread();
-
-	// Start a timer to handle Polling Mode.  The timer will cause
-	// an "idle" event once every 1/10 second, which is necessary if Polling
-	// Mode is being used, to cause TriggerUpdate to be called.
-
-
-	// Initialise the buffer object
-	if (!m_buffer.SetDesktop(this))
-        return ERROR_DESKTOP_OUT_OF_MEMORY;
-	GetQuarterSize();
-#ifdef AVILOG
-	if(vnclog.GetVideo()){
-		SYSTEMTIME lt;    
-		GetLocalTime(&lt);
-		char str[MAX_PATH + 32]; // 29 January 2008 jdp 
-		_snprintf(str, sizeof str, "%02d_%02d_%02d_%02d_%02d", lt.wMonth,lt.wDay,lt.wHour, lt.wMinute,lt.wSecond);
-		strcat(str,"_vnc.avi");
-		AviGen = new CAVIGenerator(str,"c:\\temp",&m_bminfo.bmi.bmiHeader,5);
-		HRESULT hr;
-		hr=AviGen->InitEngine();
-		if (FAILED(hr))
-		{
-			AviGen->ReleaseEngine(); 
-			delete AviGen;
-			AviGen=NULL;
-		}
-
-	}
-#endif
-	// Everything is ok, so return success
-	return 0;
-}
-
-// Routine to shutdown all the hooks and stuff
-BOOL
-vncDesktop::Shutdown()
-{
-#ifdef AVILOG
-	if (AviGen)
-		{
-			AviGen->ReleaseEngine(); 
-			delete AviGen;
-			AviGen=NULL;
-		}
-#endif
-
-	ShutdownInitWindowthread();
-
-	// Now free all the bitmap stuff
-	if (m_hrootdc != NULL)
-	{
-		if (!DeleteDC(m_hrootdc))
-				vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hrootdc\n"));
-		m_hrootdc = NULL;
-	}
-	if (m_hmemdc != NULL)
-	{
-		// Release our device context
-		if (!DeleteDC(m_hmemdc))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hmemdc\n"));
-		}
-		m_hmemdc = NULL;
-	}
-	if (m_membitmap != NULL)
-	{
-		// Release the custom bitmap, if any
-		if (!DeleteObject(m_membitmap))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteObject\n"));
-		}
-		m_membitmap = NULL;
-	}
-
-    m_DIBbits = NULL;
-
-    if (m_hcursor)
-    {
-        DeleteObject(m_hcursor);
-        m_hcursor = NULL;
-    }
-    if (m_hOldcursor)
-    {
-        DeleteObject(m_hOldcursor);
-        m_hOldcursor = NULL;
-    }
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	ShutdownVideoDriver();
-
-	if (m_home_desktop)
-		vncService::SelectHDESK(m_home_desktop);
-	if (m_input_desktop)
-	{
-		if (!CloseDesktop(m_input_desktop))
-			vnclog.Print(LL_INTERR, VNCLOG("failed to close desktop\n"));
-		m_input_desktop = 0;
-	}
-	GridsList::iterator iGrid;
-	for (iGrid = m_lGridsList.begin(); iGrid != m_lGridsList.end(); iGrid++)
-	{
-		if (*iGrid)
-		{
-			// Since we've replaced this:
-			// "typedef std::list<RGBPixelList*> GridsList;"
-			// with this:
-			// "typedef std::list<void*> GridsList;"
-			// we must be carefull to avoid memory leaks...
-			((RGBPixelList*)(*iGrid))->clear();
-			delete ((RGBPixelList*)(*iGrid));
-			vnclog.Print(LL_INTWARN, VNCLOG("delete ((RGBPixelList) \n"));
-		}
-	}
-	m_lGridsList.clear();
-	m_foreground_window_rect.clear();
-	return TRUE;
-}
-
-// Routine to ensure we're on the correct NT desktop
-
-BOOL
-vncDesktop::InitDesktop()
-{
-	int result=vncService::InputDesktopSelected();
-	if (result==1 || result==2)
-		return TRUE;
-	vnclog.Print(LL_INTINFO, VNCLOG("InitDesktop...\n"));
-	return vncService::SelectDesktop(NULL, &m_input_desktop);
-}
-
-// Routine used to close the screen saver, if it's active...
-
-BOOL CALLBACK
-KillScreenSaverFunc(HWND hwnd, LPARAM lParam)
-{
-	char buffer[256];
-
-	// - ONLY try to close Screen-saver windows!!!
-	if ((GetClassName(hwnd, buffer, 256) != 0) &&
-		(strcmp(buffer, "WindowsScreenSaverClass") == 0))
-		PostMessage(hwnd, WM_CLOSE, 0, 0);
-	return TRUE;
-}
-
-void
-vncDesktop::KillScreenSaver()
-{
-	OSVERSIONINFO osversioninfo;
-	osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo);
-
-	// Get the current OS version
-	if (!GetVersionEx(&osversioninfo))
-		return;
-
-	vnclog.Print(LL_INTINFO, VNCLOG("KillScreenSaver...\n"));
-
-	// How to kill the screen saver depends on the OS
-	switch (osversioninfo.dwPlatformId)
-	{
-	case VER_PLATFORM_WIN32_WINDOWS:
-		{
-			// Windows 95
-
-			// Fidn the ScreenSaverClass window
-			HWND hsswnd = FindWindow ("WindowsScreenSaverClass", NULL);
-			if (hsswnd != NULL)
-				PostMessage(hsswnd, WM_CLOSE, 0, 0); 
-			break;
-		} 
-	case VER_PLATFORM_WIN32_NT:
-		{
-			// Windows NT
-
-			// Find the screensaver desktop
-			HDESK hDesk = OpenDesktop(
-				"Screen-saver",
-				0,
-				FALSE,
-				DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS
-				);
-			if (hDesk != NULL)
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("Killing ScreenSaver\n"));
-
-				// Close all windows on the screen saver desktop
-				EnumDesktopWindows(hDesk, (WNDENUMPROC) &KillScreenSaverFunc, 0);
-				CloseDesktop(hDesk);
-				// Pause long enough for the screen-saver to close
-				//Sleep(2000);
-				// Reset the screen saver so it can run again
-				SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_SENDWININICHANGE); 
-			}
-			break;
-		}
-	}
-}
-
-
-//
-// Modif sf at 2002 - Single Window
-//
-BOOL CALLBACK EnumWindowsHnd(HWND hwnd, LPARAM arg)
-{
- int  nRet;
- char buffer[128];
- char szNameAppli[16];
-
- strncpy(szNameAppli, (LPSTR)(((vncDesktop*)arg)->GetServerPointer()->GetWindowName()),15);
- szNameAppli[15]=0;
- nRet = GetWindowText(hwnd, buffer, sizeof(buffer));
- if (nRet > 0)
- {
-  if ( !_strnicmp(buffer, szNameAppli, lstrlen(szNameAppli)))
-  {
-       ((vncDesktop*)arg)->m_Single_hWnd = hwnd;
-       return FALSE;
-  }
-  else
-	  return TRUE;
- }
- return TRUE;
-}
-
-
-DWORD
-vncDesktop::InitBitmap()
-{	
-	// Get the device context for the whole screen and find it's size
-	DriverType=NONE;
-	if (OSversion()==1 || OSversion()==2) //XP W2k
-		{	
-			if (VideoBuffer())
-				{
-					pEnumDisplayDevices pd=NULL;
-					const CHAR driverName[] = "mv video hook driver2";
-					BOOL DriverFound;
-					DEVMODE devmode;
-					FillMemory(&devmode, sizeof(DEVMODE), 0);
-					devmode.dmSize = sizeof(DEVMODE);
-					devmode.dmDriverExtra = 0;
-					/*BOOL change = */EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
-					devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-					HMODULE hUser32=LoadLibrary("USER32");
-					if (hUser32) pd = (pEnumDisplayDevices)GetProcAddress( hUser32, "EnumDisplayDevicesA");
-						if (pd)
-							{
-								LPSTR deviceName=NULL;
-								DISPLAY_DEVICE dd;
-								ZeroMemory(&dd, sizeof(dd));
-								dd.cb = sizeof(dd);
-								devmode.dmDeviceName[0] = '\0';
-								INT devNum = 0;
-								BOOL result;
-								DriverFound=false;
-								while ((result = (*pd)(NULL,devNum, &dd,0)))
-									{
-										if (strcmp((const char *)&dd.DeviceString[0], driverName) == 0)
-											{
-												DriverFound=true;
-												break;
-											}
-										devNum++;
-									}
-								if (DriverFound)
-									{
-										deviceName = (LPSTR)&dd.DeviceName[0];
-										m_hrootdc = CreateDC("DISPLAY",deviceName,NULL,NULL);
-										/*BOOL change = */EnumDisplaySettings(deviceName,ENUM_CURRENT_SETTINGS,&devmode);
-										m_ScreenOffsetx=devmode.dmPosition.x;
-										m_ScreenOffsety=devmode.dmPosition.y;
-										if (m_hrootdc) DriverType=MIRROR;
-										Checkmonitors();
-										requested_multi_monitor=m_buffer.IsMultiMonitor();
-										multi_monitor=false;
-										if (requested_multi_monitor && nr_monitors>1) multi_monitor=true;
-									}
-							}
-					if (hUser32) FreeLibrary(hUser32);
-				}//VIDEOBUFFER
-			}//OS
-
-	// RDV SINGLE WINDOW
-	if (m_server->SingleWindow() && m_Single_hWnd==NULL)
-	{		
-		EnumWindows((WNDENUMPROC)EnumWindowsHnd, (LPARAM) this);
-	}
-
-	if (m_hrootdc == NULL) {
-		vnclog.Print(LL_INTERR, VNCLOG("No driver used \n"));
-		//Multi-Monitor changes
-		Checkmonitors();
-		requested_multi_monitor=m_buffer.IsMultiMonitor();
-		multi_monitor=false;
-		if (requested_multi_monitor && nr_monitors>1) multi_monitor=true;
-
-		if (!multi_monitor)
-		{
-			m_hrootdc = CreateDC(("DISPLAY"),mymonitor[0].device,NULL,NULL);
-			m_ScreenOffsetx=mymonitor[0].offsetx;
-			m_ScreenOffsety=mymonitor[0].offsety;
-		}
-		else
-		{
-			m_hrootdc = GetDC(NULL);
-			m_ScreenOffsetx=mymonitor[2].offsetx;
-			m_ScreenOffsety=mymonitor[2].offsety;;
-		}
-		if (m_hrootdc == NULL) {
-				vnclog.Print(LL_INTERR, VNCLOG("Failed m_rootdc \n"));
-				return ERROR_DESKTOP_NO_ROOTDC;
-		}
-		
-	}
-	if (multi_monitor && !VideoBuffer()) m_bmrect = rfb::Rect(0, 0,mymonitor[2].Width,mymonitor[2].Height);
-	else if (!VideoBuffer()) m_bmrect = rfb::Rect(0, 0,mymonitor[0].Width,mymonitor[0].Height);
-	else m_bmrect = rfb::Rect(0, 0,GetDeviceCaps(m_hrootdc, HORZRES),GetDeviceCaps(m_hrootdc, VERTRES));
-	vnclog.Print(LL_INTINFO, VNCLOG("bitmap dimensions are %d x %d\n"), m_bmrect.br.x, m_bmrect.br.y);
-
-	// Create a compatible memory DC
-	m_hmemdc = CreateCompatibleDC(m_hrootdc);
-	if (m_hmemdc == NULL) {
-		vnclog.Print(LL_INTERR, VNCLOG("failed to create compatibleDC(%d)\n"), GetLastError());
-		return ERROR_DESKTOP_NO_ROOTDC;
-	}
-
-	// Check that the device capabilities are ok
-	if ((GetDeviceCaps(m_hrootdc, RASTERCAPS) & RC_BITBLT) == 0)
-	{
-		MessageBoxSecure(
-			NULL,
-			"vncDesktop : root device doesn't support BitBlt\n"
-			"WinVNC cannot be used with this graphic device driver",
-			szAppName,
-			MB_ICONSTOP | MB_OK
-			);
-		return ERROR_DESKTOP_NO_BITBLT;
-	}
-	if ((GetDeviceCaps(m_hmemdc, RASTERCAPS) & RC_DI_BITMAP) == 0)
-	{
-		MessageBoxSecure(
-			NULL,
-			"vncDesktop : memory device doesn't support GetDIBits\n"
-			"WinVNC cannot be used with this graphics device driver",
-			szAppName,
-			MB_ICONSTOP | MB_OK
-			);
-		return ERROR_DESKTOP_NO_GETDIBITS;
-	}
-
-	// Create the bitmap to be compatible with the ROOT DC!!!
-	m_membitmap = CreateCompatibleBitmap(m_hrootdc,1,1); //m_bmrect.br.x, m_bmrect.br.y);
-	if (m_membitmap == NULL) {
-		vnclog.Print(LL_INTERR, VNCLOG("failed to create memory bitmap(%d)\n"), GetLastError());
-		return ERROR_DESKTOP_NO_COMPATBITMAP;
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("created memory bitmap\n"));
-
-	// Get the bitmap's format and colour details
-	int result;
-	memset(&m_bminfo, 0, sizeof(m_bminfo));
-	m_bminfo.bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	m_bminfo.bmi.bmiHeader.biBitCount = 0;
-	result = ::GetDIBits(m_hmemdc, m_membitmap, 0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-	if (result == 0) {
-		vnclog.Print(LL_INTERR, VNCLOG("unable to get display format\n"));
-		return ERROR_DESKTOP_NO_DISPLAYFORMAT;
-	}
-	result = ::GetDIBits(m_hmemdc, m_membitmap,  0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-	if (result == 0) {
-		vnclog.Print(LL_INTERR, VNCLOG("unable to get display colour info\n"));
-		return ERROR_DESKTOP_NO_DISPLAYFORMAT;
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("got bitmap format\n"));
-
-	// Henceforth we want to use a top-down scanning representation
-    m_bminfo.bmi.bmiHeader.biWidth = m_bmrect.br.x;
-    m_bminfo.bmi.bmiHeader.biHeight = m_bmrect.br.y;
-    m_bminfo.bmi.bmiHeader.biSizeImage = abs((m_bminfo.bmi.bmiHeader.biWidth *
-				m_bminfo.bmi.bmiHeader.biHeight *
-				m_bminfo.bmi.bmiHeader.biBitCount)/ 8);
-	m_bminfo.bmi.bmiHeader.biHeight = - abs(m_bminfo.bmi.bmiHeader.biHeight);
-
-	// Is the bitmap palette-based or truecolour?
-	m_bminfo.truecolour = (GetDeviceCaps(m_hmemdc, RASTERCAPS) & RC_PALETTE) == 0;
-	InvalidateRect(NULL,NULL,TRUE);
-	return 0;
-}
-
-BOOL
-vncDesktop::ThunkBitmapInfo()
-{
-	// If we leave the pixel format intact, the blist can be optimised (Will Dean's patch)
-	m_formatmunged = FALSE;
-
-	// HACK ***.  Optimised blits don't work with palette-based displays, yet
-	if (!m_bminfo.truecolour) {
-		m_formatmunged = TRUE;
-	}
-
-	// Attempt to force the actual format into one we can handle
-	// We can handle 8-bit-palette and 16/32-bit-truecolour modes
-	switch (m_bminfo.bmi.bmiHeader.biBitCount)
-	{
-	case 1:
-	case 4:
-		vnclog.Print(LL_INTINFO, VNCLOG("DBG:used/bits/planes/comp/size = %d/%d/%d/%d/%d\n"),
-			(int)m_bminfo.bmi.bmiHeader.biClrUsed,
-			(int)m_bminfo.bmi.bmiHeader.biBitCount,
-			(int)m_bminfo.bmi.bmiHeader.biPlanes,
-			(int)m_bminfo.bmi.bmiHeader.biCompression,
-			(int)m_bminfo.bmi.bmiHeader.biSizeImage);
-		
-		// Correct the BITMAPINFO header to the format we actually want
-		m_bminfo.bmi.bmiHeader.biClrUsed = 0;
-		m_bminfo.bmi.bmiHeader.biPlanes = 1;
-		m_bminfo.bmi.bmiHeader.biCompression = BI_RGB;
-		m_bminfo.bmi.bmiHeader.biBitCount = 8;
-		m_bminfo.bmi.bmiHeader.biSizeImage =
-			abs((m_bminfo.bmi.bmiHeader.biWidth *
-				m_bminfo.bmi.bmiHeader.biHeight *
-				m_bminfo.bmi.bmiHeader.biBitCount)/ 8);
-		m_bminfo.bmi.bmiHeader.biClrImportant = 0;
-		m_bminfo.truecolour = FALSE;
-
-		// Display format is non-VNC compatible - use the slow blit method
-		m_formatmunged = TRUE;
-		break;	
-	case 24:
-		// Update the bitmapinfo header
-		m_bminfo.bmi.bmiHeader.biBitCount = 32;
-		m_bminfo.bmi.bmiHeader.biPlanes = 1;
-		m_bminfo.bmi.bmiHeader.biCompression = BI_RGB;
-		m_bminfo.bmi.bmiHeader.biSizeImage =
-			abs((m_bminfo.bmi.bmiHeader.biWidth *
-				m_bminfo.bmi.bmiHeader.biHeight *
-				m_bminfo.bmi.bmiHeader.biBitCount)/ 8);
-		// Display format is non-VNC compatible - use the slow blit method
-		m_formatmunged = TRUE;
-		break;
-	}
-
-	return TRUE;
-}
-
-DWORD
-vncDesktop::SetPixFormat()
-{
- // If we are using a memory bitmap then check how many planes it uses
-  // The VNC code can only handle formats with a single plane (CHUNKY pixels)
-  if (!m_DIBbits) {
-	  vnclog.Print(LL_INTINFO, VNCLOG("DBG:display context has %d planes!\n"),
-      GetDeviceCaps(m_hrootdc, PLANES));
-	  vnclog.Print(LL_INTINFO, VNCLOG("DBG:memory context has %d planes!\n"),
-      GetDeviceCaps(m_hmemdc, PLANES));
-	  if (GetDeviceCaps(m_hmemdc, PLANES) != 1)
-	  {
-		  MessageBoxSecure(
-			  NULL,
-			  "vncDesktop : current display is PLANAR, not CHUNKY!\n"
-			  "WinVNC cannot be used with this graphics device driver",
-			  szAppName,
-			  MB_ICONSTOP | MB_OK
-			  );
-          return ERROR_DESKTOP_UNSUPPORTED_PIXEL_ORGANIZATION;
-	  }
-  }
-	
-	
-	// Examine the bitmapinfo structure to obtain the current pixel format
-	m_scrinfo.format.trueColour = m_bminfo.truecolour;
-	m_scrinfo.format.bigEndian = 0;
-
-	// Set up the native buffer width, height and format
-	m_scrinfo.framebufferWidth = (CARD16) (m_bmrect.br.x - m_bmrect.tl.x);		// Swap endian before actually sending
-	m_scrinfo.framebufferHeight = (CARD16) (m_bmrect.br.y - m_bmrect.tl.y);	// Swap endian before actually sending
-	m_scrinfo.format.bitsPerPixel = (CARD8) m_bminfo.bmi.bmiHeader.biBitCount;
-	m_scrinfo.format.depth        = (CARD8) m_bminfo.bmi.bmiHeader.biBitCount;
-
-	// Calculate the number of bytes per row
-	m_bytesPerRow = m_scrinfo.framebufferWidth * m_scrinfo.format.bitsPerPixel / 8;
-
-	return 0;
-}
-
-BOOL
-vncDesktop::SetPixShifts()
-{
-	// Sort out the colour shifts, etc.
-	DWORD redMask=0, blueMask=0, greenMask = 0;
-
-	switch (m_bminfo.bmi.bmiHeader.biBitCount)
-	{
-	case 16:
-		// Standard 16-bit display
-		if (m_bminfo.bmi.bmiHeader.biCompression == BI_RGB)
-		{
-			// each word single pixel 5-5-5
-			redMask = 0x7c00; greenMask = 0x03e0; blueMask = 0x001f;
-		}
-		else
-		{
-			if (m_bminfo.bmi.bmiHeader.biCompression == BI_BITFIELDS)
-			{
-				redMask =   *(DWORD *) &m_bminfo.bmi.bmiColors[0];
-				greenMask = *(DWORD *) &m_bminfo.bmi.bmiColors[1];
-				blueMask =  *(DWORD *) &m_bminfo.bmi.bmiColors[2];
-			}
-		}
-		break;
-
-	case 32:
-		// Standard 24/32 bit displays
-		if (m_bminfo.bmi.bmiHeader.biCompression == BI_RGB)
-		{
-			redMask = 0xff0000; greenMask = 0xff00; blueMask = 0x00ff;
-		}
-		else
-		{
-			if (m_bminfo.bmi.bmiHeader.biCompression == BI_BITFIELDS)
-			{
-				redMask =   *(DWORD *) &m_bminfo.bmi.bmiColors[0];
-				greenMask = *(DWORD *) &m_bminfo.bmi.bmiColors[1];
-				blueMask =  *(DWORD *) &m_bminfo.bmi.bmiColors[2];
-			}
-		}
-		break;
-
-	default:
-		// Other pixel formats are only valid if they're palette-based
-		if (m_bminfo.truecolour)
-		{
-			vnclog.Print(LL_INTERR, "unsupported truecolour pixel format for setpixshifts\n");
-			return FALSE;
-		}
-		return TRUE;
-	}
-
-	// Convert the data we just retrieved
-	MaskToMaxAndShift(redMask, m_scrinfo.format.redMax, m_scrinfo.format.redShift);
-	MaskToMaxAndShift(greenMask, m_scrinfo.format.greenMax, m_scrinfo.format.greenShift);
-	MaskToMaxAndShift(blueMask, m_scrinfo.format.blueMax, m_scrinfo.format.blueShift);
-
-	return TRUE;
-}
-
-BOOL
-vncDesktop::SetPalette()
-{
-	// Lock the current display palette into the memory DC we're holding
-	// *** CHECK THIS FOR LEAKS!
-    if (VideoBuffer())
-        return TRUE;
-	if (!m_bminfo.truecolour)
-	{
-		if (!m_DIBbits)
-		{
-			// - Handle the palette for a non DIB-Section
-			
-			LOGPALETTE *palette;
-			UINT size = sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 256);
-			
-			palette = (LOGPALETTE *) new char[size];
-			if (palette == NULL) {
-				vnclog.Print(LL_INTERR, VNCLOG("unable to allocate logical palette\n"));
-				return FALSE;
-			}
-			
-			// Initialise the structure
-			palette->palVersion = 0x300;
-			palette->palNumEntries = 256;
-			
-			// Get the system colours
-			if (GetSystemPaletteEntries(m_hrootdc,
-				0, 256, palette->palPalEntry) == 0)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("unable to get system palette entries\n"));
-				delete [] palette;
-				return FALSE;
-			}
-			
-			// Create a palette from those
-			HPALETTE pal = CreatePalette(palette);
-			if (pal == NULL)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("unable to create HPALETTE\n"));
-				delete [] palette;
-				return FALSE;
-			}
-			
-			// Select the palette into our memory DC
-			HPALETTE oldpalette = SelectPalette(m_hmemdc, pal, FALSE);
-			if (oldpalette == NULL)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("unable to select() HPALETTE\n"));
-				delete [] palette;
-				DeleteObject(pal);
-				return FALSE;
-			}
-			
-			// Worked, so realise the palette
-			if (RealizePalette(m_hmemdc) == GDI_ERROR)
-				vnclog.Print(LL_INTWARN, VNCLOG("warning - failed to RealizePalette\n"));
-			
-			// It worked!
-			delete [] palette;
-			DeleteObject(oldpalette);
-			
-			vnclog.Print(LL_INTINFO, VNCLOG("initialised palette OK\n"));
-			return TRUE;
-		}
-		else
-		{
-			// - Handle a DIB-Section's palette
-			
-			// - Fetch the system palette for the framebuffer
-			PALETTEENTRY syspalette[256];
-			UINT entries = ::GetSystemPaletteEntries(m_hrootdc, 0, 256, syspalette);
-			vnclog.Print(LL_INTERR, VNCLOG("framebuffer has %u palette entries"), entries);
-			
-			// - Store it and convert it to RGBQUAD format
-			RGBQUAD dibpalette[256];
-			unsigned int i;
-			for (i=0;i<entries;i++) {
-				dibpalette[i].rgbRed = syspalette[i].peRed;
-				dibpalette[i].rgbGreen = syspalette[i].peGreen;
-				dibpalette[i].rgbBlue = syspalette[i].peBlue;
-				dibpalette[i].rgbReserved = 0;
-			}
-			
-			// - Set the rest of the palette to something nasty but usable
-			for (i=entries;i<256;i++) {
-				dibpalette[i].rgbRed = i % 2 ? 255 : 0;
-				dibpalette[i].rgbGreen = i/2 % 2 ? 255 : 0;
-				dibpalette[i].rgbBlue = i/4 % 2 ? 255 : 0;
-				dibpalette[i].rgbReserved = 0;
-			}
-			
-			// - Update the DIB section to use the same palette
-			HDC bitmapDC=::CreateCompatibleDC(m_hrootdc);
-			if (!bitmapDC) {
-				vnclog.Print(LL_INTERR, VNCLOG("unable to create temporary DC"), GetLastError());
-				return FALSE;
-			}
-			HBITMAP old_bitmap = (HBITMAP)::SelectObject(bitmapDC, m_membitmap);
-			if (!old_bitmap) {
-				vnclog.Print(LL_INTERR, VNCLOG("unable to select DIB section into temporary DC"), GetLastError());
-                DeleteDC(bitmapDC);
-				return FALSE;
-			}
-			UINT entries_set = ::SetDIBColorTable(bitmapDC, 0, 256, dibpalette);
-			if (entries_set == 0) {
-				vnclog.Print(LL_INTERR, VNCLOG("unable to set DIB section palette"), GetLastError());
-//				return FALSE;
-			}
-			if (!::SelectObject(bitmapDC, old_bitmap)) {
-				vnclog.Print(LL_INTERR, VNCLOG("unable to restore temporary DC bitmap"), GetLastError());
-                DeleteObject(old_bitmap);
-                DeleteDC(bitmapDC);
-				return FALSE;
-			}
-            DeleteObject(old_bitmap);
-            DeleteDC(bitmapDC);
-            return TRUE;
-		}
-    }
- 
-	// Not a palette based local screen - forget it!
-	vnclog.Print(LL_INTERR, VNCLOG("no palette data for truecolour display\n"));
-	return TRUE;
-}
-////////////////////////////////////////////////////////////////////////////////
-DWORD WINAPI Driverwatch(LPVOID lpParam)
-{
-	//Mouse shape changed
-	if (OSversion()==1 || OSversion()==2)
-	{
-		HANDLE event;
-		//DrvWatch *mywatch=(DrvWatch*)lpParam;
-		HWND hwnd=(HWND)lpParam;
-		event=NULL;
-		while (event==NULL)
-		{
-			event = OpenEvent (SYNCHRONIZE, FALSE, "VncEvent") ;
-			Sleep(900);
-			if (!IsWindow(hwnd)) 
-			{
-				if (event) CloseHandle(event);
-				return 0;
-			}
-		}
-		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
-		for (;;)
-		{
-		if (WaitForSingleObject(event, 2000) == WAIT_OBJECT_0)
-			{
-				PostMessage(hwnd, WM_MOUSESHAPE, 0, 0);
-			}
-		if (!IsWindow(hwnd) || !g_Desktop_running)
-		{
-			if (event) CloseHandle(event);
-			break;
-		}
-		}
-	}
-	return 0;
-}
-
-
-
-DWORD
-vncDesktop::EnableOptimisedBlits()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("attempting to enable DIBsection blits\n"));
-
-	// Create a new DIB section
-	//HBITMAP tempbitmap=NULL;
-	HBITMAP tempbitmap = CreateDIBSection(m_hmemdc, &m_bminfo.bmi, DIB_RGB_COLORS, &m_DIBbits, NULL, 0);
-	if (tempbitmap == NULL) {
-		vnclog.Print(LL_INTINFO, VNCLOG("failed to build DIB section - reverting to slow blits\n"));
-		m_DIBbits = NULL;
-        tempbitmap = CreateCompatibleBitmap(m_hrootdc, m_bmrect.br.x, m_bmrect.br.y);
-	    if (tempbitmap == NULL) {
-		    vnclog.Print(LL_INTERR, VNCLOG("failed to create memory bitmap(%d)\n"), GetLastError());
-		    return ERROR_DESKTOP_NO_DIBSECTION_OR_COMPATBITMAP;
-	    }
-	    else
-	        vnclog.Print(LL_INTINFO, VNCLOG("enabled slow blits OK\n"));
-	}
-    else
-        vnclog.Print(LL_INTINFO, VNCLOG("enabled fast DIBsection blits OK\n"));
-
-	// Delete the old memory bitmap
-	if (m_membitmap != NULL) {
-		DeleteObject(m_membitmap);
-		m_membitmap = NULL;
-	}
-
-	// Replace old membitmap with DIB section
-	m_membitmap = tempbitmap;
-    return 0;
-}
-
-DWORD
-vncDesktop::Init(vncServer *server)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("initialising desktop handler\n"));
-
-	// Save the server pointer
-	m_server = server;
-
-	// sf at 2005
-	if (OSversion()==1 || OSversion()==2)
-	m_fCaptureAlphaBlending = m_server->CaptureAlphaBlending();
-	else m_fCaptureAlphaBlending=false;
-
-	// Load in the arrow cursor
-	m_hdefcursor = LoadCursor(NULL, IDC_ARROW);
-	m_hcursor = m_hdefcursor;
-	m_hOldcursor = m_hdefcursor; //sf at 2002
-
-	// Spawn a thread to handle that window's message queue
-	vncDesktopThread *thread = new vncDesktopThread;
-	if (thread == NULL) {
-		vnclog.Print(LL_INTERR, VNCLOG("failed to start hook thread\n"));
-		return ERROR_DESKTOP_NO_DESKTOPTHREAD;
-	}
-	m_thread = thread;
-	//SINGEL WINDOW
-	SWinit();
-	// InitHookSettings();
-	return thread->Init(this, m_server);
-}
-
-int
-vncDesktop::ScreenBuffSize()
-{
-	return m_scrinfo.format.bitsPerPixel/8 *
-		m_scrinfo.framebufferWidth *
-		m_scrinfo.framebufferHeight;
-}
-
-void
-vncDesktop::FillDisplayInfo(rfbServerInitMsg *scrinfo)
-{
-	memcpy(scrinfo, &m_scrinfo, sz_rfbServerInitMsg);
-}
-
-
-void
-vncDesktop::WriteMessageOnScreen(char * tt,BYTE *scrBuff, UINT scrBuffSize)
-{
-	// Select the memory bitmap into the memory DC
-	RECT rect;
-	SetRect(&rect, 0,0, 300, 120);
-	COLORREF bgcol =RGB(0xff, 0x00, 0x00);
-	COLORREF oldtxtcol =SetTextColor(m_hmemdc, RGB(0,0,254));
-	COLORREF oldbgcol  =SetBkColor(  m_hmemdc, bgcol);
-	HBRUSH backgroundBrush = CreateSolidBrush(bgcol);
-
-	HBITMAP oldbitmap;
-	if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-					return;
-
-	FillRect(m_hmemdc, &rect, backgroundBrush); 
-	DrawText(m_hmemdc,tt,strlen(tt),&rect,DT_CENTER | DT_VCENTER);
-				// Select the old bitmap back into the memory DC
-	//DWORD err= GetLastError();
-
-	
-	//ExtTextOut(m_hmemdc, 0, 0, ETO_OPAQUE,&rect,tt,strlen(tt), NULL); 
-        
-
-	SetBkColor(  m_hmemdc, oldbgcol);
-	SetTextColor(m_hmemdc, oldtxtcol);
-	SelectObject(m_hmemdc, oldbitmap);
-	DeleteObject(backgroundBrush); 
-
-	CopyToBuffer(rect, scrBuff, scrBuffSize);
-}
-
-#ifndef CAPTUREBLT
-#define CAPTUREBLT  0x40000000
-#endif
-
-// Function to capture an area of the screen immediately prior to sending
-// an update.
-void
-vncDesktop::CaptureScreen(const rfb::Rect &rect, BYTE *scrBuff, UINT scrBuffSize,BOOL capture)
-{
-	assert(rect.enclosed_by(m_bmrect));
-	if (capture)
-	{
-		if (OSversion()==1 || OSversion()==2)
-		m_fCaptureAlphaBlending = m_server->CaptureAlphaBlending();
-
-
-		// Select the memory bitmap into the memory DC
-		HBITMAP oldbitmap;
-		if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-			return;
-
-	#if defined(_DEBUG)
-		DWORD t = timeGetTime();
-	#endif
-		// Capture screen into bitmap
-		BOOL blitok = false;
-		if (multi_monitor)
-		{
-		blitok=BitBlt(m_hmemdc, 
-			 rect.tl.x,
-			 rect.tl.y,
-			(rect.br.x-rect.tl.x),
-			(rect.br.y-rect.tl.y),
-			m_hrootdc,
-			rect.tl.x+m_ScreenOffsetx,
-			rect.tl.y+m_ScreenOffsety,
-			(m_fCaptureAlphaBlending && !m_Black_window_active) ? (CAPTUREBLT | SRCCOPY) : SRCCOPY
-			);
-		}
-		else
-		{
-			blitok=BitBlt(m_hmemdc, 
-			 rect.tl.x,
-			 rect.tl.y,
-			(rect.br.x-rect.tl.x),
-			(rect.br.y-rect.tl.y),
-			m_hrootdc, rect.tl.x, rect.tl.y, (m_fCaptureAlphaBlending && !m_Black_window_active) ? (CAPTUREBLT | SRCCOPY) : SRCCOPY);
-		}
-	#if defined(_DEBUG)
-		DWORD e = timeGetTime() - t;
-		vnclog.Print(LL_INTWARN, VNCLOG("Blit (%u,%u - %u,%u) (%ux%u took %ums\n"), 
-			rect.tl.x, rect.tl.y, rect.br.x, rect.br.y,
-			rect.width(), rect.height(), e);
-	#endif
-	#if 0
-		//*******************************
-		static int cycle(0);
-		static COLORREF c[] = {RGB(0xFF,0,0), RGB(0,0xFF,0),RGB(0,0,0xFF), RGB(0xFF, 0,0xFF), RGB(0,0xFF,0xFF)};
-	HPEN pen = CreatePen(PS_SOLID|PS_INSIDEFRAME, 2, c[cycle]);
-	HPEN oldpen = (HPEN)SelectObject(m_hmemdc, pen);
-	SelectObject(m_hmemdc, GetStockObject(HOLLOW_BRUSH));
-	Rectangle(m_hmemdc, rect.tl.x, rect.tl.y, rect.br.x, rect.br.y);
-	SelectObject(m_hmemdc, oldpen);
-	DeleteObject(pen);
-		cycle = (cycle + 1) % (sizeof c / sizeof c[0]);
-		//*******************************
-	#endif
-		// Select the old bitmap back into the memory DC
-		SelectObject(m_hmemdc, oldbitmap);
-
-		if (blitok)
-		{
-			// Copy the new data to the screen buffer (CopyToBuffer optimises this if possible)
-			CopyToBuffer(rect, scrBuff, scrBuffSize);
-		}
-	}
-	else
-	{
-		CopyToBuffer(rect, scrBuff, scrBuffSize);
-	}
-
-}
-
-// Add the mouse pointer to the buffer
-void
-vncDesktop::CaptureMouse(BYTE *scrBuff, UINT scrBuffSize)
-{
-	POINT CursorPos;
-	ICONINFO IconInfo = {0};
-
-	// If the mouse cursor handle is invalid then forget it
-	if (m_hcursor == NULL)
-		return;
-
-	// Get the cursor position
-	if (!GetCursorPos(&CursorPos))
-		return;
-	CursorPos.x -= m_ScreenOffsetx;
-	CursorPos.y -= m_ScreenOffsety;
-	//vnclog.Print(LL_INTINFO, VNCLOG("CursorPos %i %i\n"),CursorPos.x, CursorPos.y);
-	// Translate position for hotspot
-	if (GetIconInfo(m_hcursor, &IconInfo))
-	{
-		CursorPos.x -= ((int) IconInfo.xHotspot);
-		CursorPos.y -= ((int) IconInfo.yHotspot);
-		/// Buffer has (0,0) coordinates, Cursor (screencoordinates)
-		CursorPos.x -= m_ScreenOffsetx;
-		CursorPos.y -= m_ScreenOffsety;
-		///
-		
-		if (CursorPos.x<=m_bmrect.tl.x || CursorPos.y<=m_bmrect.tl.y || CursorPos.x>=m_bmrect.br.x || CursorPos.y>=m_bmrect.br.y) 
-		{
-			if ((m_cursorpos.tl.x<=m_bmrect.tl.x)||
-				(m_cursorpos.tl.y<=m_bmrect.tl.y)||
-				(m_cursorpos.br.x>=m_bmrect.br.x)||
-				(m_cursorpos.br.y>=m_bmrect.br.y))
-			{
-				m_cursorpos.tl.x=0;
-				m_cursorpos.tl.y=0;
-				m_cursorpos.br.x=16;
-				m_cursorpos.br.y=16;
-			}
-			//Error, cursor isn't on the visbale display.
-			if (IconInfo.hbmMask != NULL)
-					DeleteObject(IconInfo.hbmMask);
-				if (IconInfo.hbmColor != NULL)
-					DeleteObject(IconInfo.hbmColor);
-			return;
-		}
-
-		// Save the bounding rectangle
-		m_cursorpos.tl = CursorPos;
-		m_cursorpos.br = rfb::Point(GetSystemMetrics(SM_CXCURSOR),
-		GetSystemMetrics(SM_CYCURSOR)).translate(CursorPos);
-		// Clip the bounding rect to the screen
-		// Copy the mouse cursor into the screen buffer, if any of it is visible
-		m_cursorpos = m_cursorpos.intersect(m_bmrect);
-
-		if (IconInfo.hbmMask && IconInfo.hbmColor)
-			{
-					HBITMAP oldbitmap;
-					if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-							return;
-					HDC mdc1, mdc2;
-					mdc1 = CreateCompatibleDC(m_hmemdc);
-					mdc2 = CreateCompatibleDC(m_hmemdc);
-					HBITMAP oldbmp1 = (HBITMAP)SelectObject(mdc1, IconInfo.hbmMask);
-					HBITMAP oldbmp2 = (HBITMAP)SelectObject(mdc2, IconInfo.hbmColor);
-					BitBlt(m_hmemdc,m_cursorpos.tl.x, m_cursorpos.tl.y,m_cursorpos.br.x-m_cursorpos.tl.x, m_cursorpos.br.y-m_cursorpos.tl.y, mdc1, 0, 0, SRCAND);
-					BitBlt(m_hmemdc, m_cursorpos.tl.x, m_cursorpos.tl.y, m_cursorpos.br.x-m_cursorpos.tl.x, m_cursorpos.br.y-m_cursorpos.tl.y, mdc2, 0, 0, SRCINVERT);
-
-					SelectObject(m_hmemdc, oldbitmap);
-					SelectObject(mdc1, oldbmp1);
-					SelectObject(mdc2, oldbmp2);
-					DeleteDC(mdc1);
-					DeleteDC(mdc2);
-			}
-		else
-			{
-
-				// Select the memory bitmap into the memory DC
-				HBITMAP oldbitmap;
-				if ((oldbitmap = (HBITMAP) SelectObject(m_hmemdc, m_membitmap)) == NULL)
-					return;
-
-				// Draw the cursor
-				DrawIconEx(
-					m_hmemdc,									// handle to device context 
-					CursorPos.x, CursorPos.y,
-					m_hcursor,									// handle to icon to draw 
-					0,0,										// width of the icon 
-					0,											// index of frame in animated cursor 
-					NULL,										// handle to background brush 
-					DI_NORMAL | DI_COMPAT						// icon-drawing flags 
-					);
-
-				// Select the old bitmap back into the memory DC
-				SelectObject(m_hmemdc, oldbitmap);
-		}
-
-		if (IconInfo.hbmMask != NULL)
-			DeleteObject(IconInfo.hbmMask);
-		if (IconInfo.hbmColor != NULL)
-			DeleteObject(IconInfo.hbmColor);
-	}
-
-
-	if (!m_cursorpos.is_empty()) {
-		CopyToBuffer(m_cursorpos, scrBuff, scrBuffSize);
-	}
-}
-
-
-// CURSOR HANDLING
-// Obtain cursor image data in server's local format.
-// The length of databuf[] should be at least (width * height * 4).
-BOOL
-vncDesktop::GetRichCursorData(BYTE *databuf, HCURSOR hcursor, int width, int height)
-{
-	// Protect the memory bitmap (is it really necessary here?)
-	omni_mutex_lock l(m_update_lock);
-
-	// Create bitmap, select it into memory DC
-	HBITMAP membitmap = CreateCompatibleBitmap(m_hrootdc, width, height);
-	if (membitmap == NULL) {
-		return FALSE;
-	}
-	HBITMAP oldbitmap = (HBITMAP) SelectObject(m_hmemdc, membitmap);
-	if (oldbitmap == NULL) {
-		DeleteObject(membitmap);
-		return FALSE;
-	}
-
-	// Draw the cursor
-	DrawIconEx(m_hmemdc, 0, 0, hcursor, 0, 0, 0, NULL, DI_IMAGE);
-	SelectObject(m_hmemdc, oldbitmap);
-
-	// Prepare BITMAPINFO structure (copy most m_bminfo fields)
-	BITMAPINFO *bmi = (BITMAPINFO *)calloc(1, sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD));
-	int lines=0;
-	if (bmi)
-	{
-	memcpy(bmi, &m_bminfo.bmi, sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD));
-	bmi->bmiHeader.biWidth = width;
-	bmi->bmiHeader.biHeight = -height;
-
-	// Clear data buffer and extract RGB data
-	memset(databuf, 0x00, width * height * 4);
-	lines = GetDIBits(m_hmemdc, membitmap, 0, height, databuf, bmi, DIB_RGB_COLORS);
-
-	// Cleanup
-	free(bmi);
-	}
-	DeleteObject(membitmap);
-
-	return (lines != 0);
-}
-
-// Return the current mouse pointer position
-rfb::Rect
-vncDesktop::MouseRect()
-{
-	return m_cursorpos;
-}
-
-void
-vncDesktop::SetCursor(HCURSOR cursor)
-{
-	if (cursor == NULL)
-		m_hcursor = m_hdefcursor;
-	else
-	{
-		m_hOldcursor = m_hcursor; // sf at 2002
-		m_hcursor = cursor;
-	}
-}
-
-// Manipulation of the clipboard
-void vncDesktop::SetClipText(char* rfbStr)
-{
-  // Open the system clipboard
-  if (OpenClipboard(m_hwnd))
-  {
-    // Empty it
-    if (EmptyClipboard())
-    {
-	  // adzm - 2010-07 - Extended clipboard
-      HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, strlen(rfbStr) + 1);
-
-      if (hMem != NULL)
-      {
-        LPSTR pMem = (char*)GlobalLock(hMem);
-
-        // Get the data
-		if (pMem)
-		{
-			strcpy(pMem, rfbStr);
-        	// Tell the clipboard
-        	GlobalUnlock(hMem);
-        	SetClipboardData(CF_TEXT, hMem);
-		}
-      }
-    }
-  }
-
-  // Now close it
-  CloseClipboard();
-}
-
-// adzm - 2010-07 - Extended clipboard
-void vncDesktop::SetClipTextEx(ExtendedClipboardDataMessage& extendedClipboardDataMessage)
-{
-	{
-		ClipboardData newClipboard;
-
-		if (newClipboard.Restore(Window(), extendedClipboardDataMessage)) {
-			vnclog.Print(LL_INTINFO, VNCLOG("Set extended clipboard data\n"));
-
-			newClipboard.FreeData();
-		} else {
-			vnclog.Print(LL_INTWARN, VNCLOG("Failed to set extended clipboard data\n"));
-		}
-	}
-}
-
-// INTERNAL METHODS
-
-inline void
-vncDesktop::MaskToMaxAndShift(DWORD mask, CARD16 &max, CARD8 &shift)
-{
-	for (shift = 0; (mask & 1) == 0; shift++)
-		mask >>= 1;
-	max = (CARD16) mask;
-}
-
-// Copy data from the memory bitmap into a buffer
-void
-vncDesktop::CopyToBuffer(const rfb::Rect &rect, BYTE *destbuff, UINT destbuffsize)
-{
-	// Finish drawing anything in this thread 
-	// Wish we could do this for the whole system - maybe we should
-	// do something with LockWindowUpdate here.
-	GdiFlush();
-
-	// Are we being asked to blit from the DIBsection to itself?
-	if (destbuff == m_DIBbits) {
-		// Yes.  Ignore the request!
-		return;
-	}
-
-	int y_inv;
-	BYTE * destbuffpos;
-
-	// Calculate the scanline-ordered y position to copy from
-	y_inv = m_scrinfo.framebufferHeight-rect.tl.y-(rect.br.y-rect.tl.y);
-
-	// Calculate where in the output buffer to put the data
-	destbuffpos = destbuff + (m_bytesPerRow * rect.tl.y);
-
-	// Set the number of bytes for GetDIBits to actually write
-	// NOTE : GetDIBits pads the destination buffer if biSizeImage < no. of bytes required
-	m_bminfo.bmi.bmiHeader.biSizeImage = (rect.br.y-rect.tl.y) * m_bytesPerRow;
-
-	// Get the actual bits from the bitmap into the bit buffer
-	// If fast (DIBsection) blits are disabled then use the old GetDIBits technique
-	if (m_DIBbits == NULL) {
-		if (GetDIBits(m_hmemdc, m_membitmap, y_inv,
-					(rect.br.y-rect.tl.y), destbuffpos,
-					&m_bminfo.bmi, DIB_RGB_COLORS) == 0)
-		{
-#ifdef _MSC_VER
-			_RPT1(_CRT_WARN, "vncDesktop : [1] GetDIBits failed! %d\n", GetLastError());
-			_RPT3(_CRT_WARN, "vncDesktop : thread = %d, DC = %d, bitmap = %d\n", omni_thread::self(), m_hmemdc, m_membitmap);
-			_RPT2(_CRT_WARN, "vncDesktop : y = %d, height = %d\n", y_inv, (rect.br.y-rect.tl.y));
-#endif
-		}
-	} else {
-		// Fast blits are enabled.  [I have a sneaking suspicion this will never get used, unless
-		// something weird goes wrong in the code.  It's here to keep the function general, though!]
-
-		int bytesPerPixel = m_scrinfo.format.bitsPerPixel / 8;
-		BYTE *srcbuffpos = (BYTE*)m_DIBbits;
-
-		srcbuffpos += (m_bytesPerRow * rect.tl.y) + (bytesPerPixel * rect.tl.x);
-		destbuffpos += bytesPerPixel * rect.tl.x;
-
-		int widthBytes = (rect.br.x-rect.tl.x) * bytesPerPixel;
-
-		for(int y = rect.tl.y; y < rect.br.y; y++)
-		{
-			memcpy(destbuffpos, srcbuffpos, widthBytes);
-			srcbuffpos += m_bytesPerRow;
-			destbuffpos += m_bytesPerRow;
-		}
-	}
-}
-
-// Routine to find out which windows have moved
-// If copyrect detection isn't perfect then this call returns
-// the copyrect destination region, to allow the caller to check
-// for mistakes
-bool
-vncDesktop::CalcCopyRects(rfb::UpdateTracker &tracker)
-{
-	HWND foreground = GetForegroundWindow();
-	RECT foreground_rect;
-
-	// Actually, we just compare the new and old foreground window & its position
-	if (foreground != m_foreground_window) {
-		m_foreground_window=foreground;
-		// Is the window invisible or can we not get its rect?
-		if (!IsWindowVisible(foreground) ||
-			!GetWindowRect(foreground, &foreground_rect)) {
-			//Buffer coordinates
-			m_foreground_window_rect.clear();
-		} else {
-			foreground_rect.left-=m_ScreenOffsetx;
-			foreground_rect.right-=m_ScreenOffsetx;
-			foreground_rect.top-=m_ScreenOffsety;
-			foreground_rect.bottom-=m_ScreenOffsety;
-			m_foreground_window_rect = foreground_rect;
-		}
-	} else {
-		// Same window is in the foreground - let's see if it's moved
-		RECT destrect;
-		rfb::Rect dest;
-		rfb::Point source;
-
-		// Get the window rectangle
-		if (IsWindowVisible(foreground) && GetWindowRect(foreground, &destrect))
-		{
-			//vnclog.Print(LL_INTERR, VNCLOG("foreground %i %i %i %i\n"),destrect.left,destrect.right,destrect.top,destrect.bottom);
-			//screen to buffer coordinates
-			destrect.left-=m_ScreenOffsetx;
-			destrect.right-=m_ScreenOffsetx;
-			destrect.top-=m_ScreenOffsety;
-			destrect.bottom-=m_ScreenOffsety;
-			//vnclog.Print(LL_INTERR, VNCLOG("foreground %i %i %i %i\n"),destrect.left,destrect.right,destrect.top,destrect.bottom);
-
-			//We cant have negative coordinates
-			//move window on desktop 1 and show desktop 2
-			if (destrect.left<0 || destrect.right<0 || destrect.top<0 || destrect.bottom<0) return false;
-			// we also can have to big coordinates
-			// move window on desktop2 and show desktop 1
-			if (destrect.left > m_Cliprect.br.x ||destrect.right > m_Cliprect.br.x ||destrect.top > m_Cliprect.br.y ||destrect.bottom > m_Cliprect.br.y)
-			return false;
-
-
-			rfb::Rect old_foreground_window_rect = m_foreground_window_rect;
-			source = m_foreground_window_rect.tl;
-			m_foreground_window_rect = dest = destrect;
-			//vnclog.Print(LL_INTERR, VNCLOG("dest %i %i %i %i\n"),dest.tl.x,dest.br.x,dest.tl.y,dest.br.y);
-			//vnclog.Print(LL_INTERR, VNCLOG("source %i %i \n"),source.x,source.y);
-
-			if (!dest.is_empty() && !old_foreground_window_rect.is_empty())
-			{
-				// Got the destination position.  Now send to clients!
-				if (!source.equals(dest.tl))
-				{
-					rfb::Point delta;
-					delta= rfb::Point(dest.tl.x-source.x, dest.tl.y-source.y);
-				//	if (dest.tl.x-source.x==0 || dest.tl.y-source.y==0) return false;
-					//vnclog.Print(LL_INTERR, VNCLOG("delta %i %i \n"),delta.x,delta.y);
-
-					// Clip the destination rectangle
-					dest = dest.intersect(m_bmrect);
-					//vnclog.Print(LL_INTERR, VNCLOG("dest2 %i %i %i %i\n"),dest.tl.x,dest.br.x,dest.tl.y,dest.br.y);
-					if (dest.is_empty()) return false;
-					// Clip the source rectangle
-					dest = dest.translate(delta.negate()).intersect(m_bmrect);
-					//vnclog.Print(LL_INTERR, VNCLOG("dest3 %i %i %i %i\n"),dest.tl.x,dest.br.x,dest.tl.y,dest.br.y);
-					if (dest.tl.x<0 || dest.br.x<0 || dest.tl.y<0 || dest.br.y<0) return false;
-					if (dest.tl.x > m_Cliprect.br.x ||dest.br.x > m_Cliprect.br.x ||dest.tl.y > m_Cliprect.br.y ||dest.br.y > m_Cliprect.br.y)
-					return false;
-					m_buffer.ClearCacheRect(dest);
-					dest = dest.translate(delta);
-					//vnclog.Print(LL_INTERR, VNCLOG("dest4 %i %i %i %i\n"),dest.tl.x,dest.br.x,dest.tl.y,dest.br.y);
-					m_buffer.ClearCacheRect(dest);
-					if (!dest.is_empty()) {
-						tracker.add_copied(dest, delta);
-						return true;
-					}
-				}
-			}
-		} else {
-			m_foreground_window_rect.clear();
-		}
-	}
-	return false;
-}
-
-
-// added jef
-void vncDesktop::SetBlankMonitor(bool enabled)
-{
-
-	// Added Jef Fix
-	typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD);
-	PSLWA pSetLayeredWindowAttributes=NULL;
-	HMODULE hDLL = LoadLibrary ("user32");
-	if (hDLL) pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
-	if (!pSetLayeredWindowAttributes) m_server->BlackAlphaBlending(false);
-	//if (VideoBuffer()) m_server->BlackAlphaBlending(false);
-
-    vnclog.Print(LL_INTINFO, VNCLOG("SetBlankMonitor: monitor %s, using alpha %s\n"), 
-        enabled ? "off" : "on",
-        m_server->BlackAlphaBlending() ? "true" : "false");
-
-	// Also Turn Off the Monitor if allowed ("Blank Screen", "Blank Monitor")
-	if (m_server->BlankMonitorEnabled())
-    {
-	    if (enabled)
-	    {
-		    if ((!m_server->BlackAlphaBlending() || VideoBuffer()) && (OSversion()!=2))
-		    {
-			    SetProcessShutdownParameters(0x100, 0);
-			    SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0, &OldPowerOffTimeout, 0);
-			    SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 100, NULL, 0);
-			    SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 1, NULL, 0);
-			    SendMessage(m_hwnd,WM_SYSCOMMAND,SC_MONITORPOWER,(LPARAM)2);
-		    }
-		    else
-		    {
-			    HANDLE ThreadHandle2=NULL;
-			    DWORD dwTId;
-			    ThreadHandle2 = CreateThread(NULL, 0, BlackWindow, NULL, 0, &dwTId);
-			   if (ThreadHandle2)  CloseHandle(ThreadHandle2);
-			    m_Black_window_active=true;
-		    }
-	    }
-	    else // Monitor On
-	    {
-		    if ((!m_server->BlackAlphaBlending() || VideoBuffer()) && (OSversion()!=2))
-		    {
-			    if (OldPowerOffTimeout!=0)
-				    SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, OldPowerOffTimeout, NULL, 0);
-			    SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, NULL, 0);
-			    if (m_hwnd!=NULL) SendMessage(m_hwnd,WM_SYSCOMMAND,SC_MONITORPOWER,(LPARAM)-1);
-			    OldPowerOffTimeout=0;
-				//JUst in case video driver state was changed
-				HWND Blackhnd = FindWindow(("blackscreen"), 0);
-			    if (Blackhnd) PostMessage(Blackhnd, WM_CLOSE, 0, 0);
-		    }
-		    else
-		    {
-			    HWND Blackhnd = FindWindow(("blackscreen"), 0);
-			    if (Blackhnd) PostMessage(Blackhnd, WM_CLOSE, 0, 0);
-			    m_Black_window_active=false;
-		    }
-	    }
-    }
-}
-
-
-// Modif rdv at 2002 Dis/enable input
-void
-vncDesktop::SetDisableInput()
-{
-    CARD32 state;
-    state=!block_input();
-    m_server->NotifyClients_StateChange(rfbServerRemoteInputsState, state);
-}
-
-
-// SW
-void vncDesktop::SetSW(int x,int y)
-{
-	POINT point;
-	point.x=x;
-	point.y=y;
-	MONITORINFO monitorinfo;
-	monitorinfo.cbSize=sizeof(MONITORINFO);
-
-    helper::DynamicFn<LPGETMONITORINFO> GetMonitorInfo("USER32","GetMonitorInfoA");
-    helper::DynamicFn<LPMONITOTFROMPOINT> MonitorFromPoint("USER32","MonitorFromPointA");
-
-	if (x <= 5 && y<=5 && x>-5 && y>-5) 
-		{
-			// 2= multi monitor
-			// 1= single monitor
-			if (requested_multi_monitor)m_buffer.MultiMonitors(1);
-			else m_buffer.MultiMonitors(2);
-			m_Single_hWnd=NULL;
-			return;
-		}
-	//SW is disabled seems to crash server
-	//until found and fixed we better disabled it to avoid
-	//this
-	return;
-
-	m_Single_hWnd=WindowFromPoint(point);
-
-	if (m_Single_hWnd==GetDesktopWindow())
-		{
-			if (GetMonitorInfo.isValid() && MonitorFromPoint.isValid())
-			{
-				HMONITOR hmonitor= (*MonitorFromPoint)(point,MONITOR_DEFAULTTONEAREST);
-				(*GetMonitorInfo)(hmonitor,&monitorinfo);
-				if (monitorinfo.dwFlags ==MONITORINFOF_PRIMARY) 
-				{
-					m_buffer.MultiMonitors(1);
-					m_Single_hWnd=NULL;
-				}
-				else
-				{
-					m_buffer.MultiMonitors(2);
-					m_Single_hWnd=NULL;
-				}
-			}
-			return;
-		}
-
-	if (m_Single_hWnd==NULL) m_server->SingleWindow(false);
-	else
-		{
-		HWND parent;
-		while((parent=GetParent(m_Single_hWnd))!=NULL)
-			{
-				m_Single_hWnd=parent;
-			}
-		m_server->SingleWindow(true);
-		}
-
-}
-
-/***************************************************************************
-* Ultravnc use 2 different software hooking methods 
-* hookdll: Hook the messages between the windows (nt,9.x)
-* ddihook: Hook the messages to the video buffer (9.x)
-* Driver hooking
-* Driver hooking is done at kernel level.
-* and exist of 2 parts
-* update mechanism: rectangles are send from kernel to vnc (shared mem)
-* shared video buffer: direct access the memeory without bitblit
-*  m_hookdriver: use driver update mechanism (ddihook in case of 9.x)
-*  m_hookdll: use software update mechanism
-***************************************************************************/
-
-// Modif rdv at 2002 - v1.1.x - videodriver
-
-BOOL vncDesktop::VideoBuffer()
-{
-	//Always access the shared mememory thru this function
-	// Check NULL
-	if (m_videodriver==NULL) return FALSE;
-	if (m_videodriver->mypVideoMemory) return true;
-
-	if (!m_videodriver->mypVideoMemory)
-	{
-		m_hookswitch=true;
-		Hookdll_Changed=true;
-		return FALSE;
-	}
-	return FALSE;
-}
-
-DWORD WINAPI Warningbox_non_locked(LPVOID lpParam)
-{
-	MessageBoxSecure(NULL,"Current driver to old for this version \nUpdate driver or disable Video hook driver\n in the server properties window","",0);
-	return 0;
-}
-
-// Modif rdv at 2002 - v1.1.x - videodriver
-BOOL vncDesktop::InitVideoDriver()
-{
-	omni_mutex_lock l(m_videodriver_lock);
-	
-	if(!(OSversion()==1  || OSversion()==2)) return true; //we need w2k or xp
-	vnclog.Print(LL_INTERR, VNCLOG("Driver option is enabled\n"));
-	// If m_videodriver exist, the driver was activated.
-	// This does not mean he is still active
-	// Screen switching disable the driver at kernel level
-	// The pointers to the shared memory still exist, but no more memeory
-	// associated...This is the biggest risk when using the driver
-	//
-
-	// First check driver version
-	if (m_videodriver!=NULL) 
-	{
-		
-								vnclog.Print(LL_INTERR, VNCLOG("Closing pending driver driver version\n"));
-								if (m_videodriver!=NULL) delete m_videodriver;
-			
-	}
-
-	m_videodriver=new VIDEODRIVER;
-	//try to use the mirror driver if he is still active
-	Checkmonitors();
-	nr_monitors=GetNrMonitors();
-	if (nr_monitors==1)
-		{
-			m_ScreenOffsetx=mymonitor[0].offsetx;
-			m_ScreenOffsety=mymonitor[0].offsety;
-			m_videodriver->VIDEODRIVER_start(mymonitor[0].offsetx,mymonitor[0].offsety,mymonitor[0].Width,mymonitor[0].Height);
-		}
-	if (nr_monitors>1)
-		{
-			m_ScreenOffsetx=mymonitor[2].offsetx;
-			m_ScreenOffsety=mymonitor[2].offsety;
-			m_videodriver->VIDEODRIVER_start(mymonitor[2].offsetx,mymonitor[2].offsety,mymonitor[2].Width,mymonitor[2].Height);
-		}		
-	vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver\n"));
-	m_hookdriver=true;
-	m_hookdll=false;
-	// check if driver has mapped the shared memory
-	if (!m_videodriver->mypVideoMemory) 
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver Failed\n"));
-		vnclog.Print(LL_INTERR, VNCLOG("Using non driver mode\n"));
-		if (m_videodriver!=NULL) delete m_videodriver;
-		m_videodriver=NULL;
-		// If driver selected and fialed to start default to hookdll
-		// 
-		m_hookdriver=false;
-		m_hookdll=true;
-		// sf at 2002 - Necessary for the following InitHookSettings() call
-		// Remember old states
-		DriverWantedSet=true;
-		DriverWanted=m_server->Driver();
-		HookWanted=m_server->Hook();
-		m_server->Driver(false);
-		m_server->Hook(true);
-		return false;
-	}
-	
-	if (m_videodriver->mypVideoMemory)
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("Driver Used\n"));
-		if (!m_videodriver->mypVideoMemory)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("Unable to map memory\n"));
-			delete m_videodriver;
-			m_videodriver=NULL;
-			// If driver selected and fialed to start default to hookdll
-			// 
-			m_hookdriver=false;
-			m_hookdll=true;
-			return false;
-		}
-		vnclog.Print(LL_INTERR, VNCLOG("Shared memory mapped\n"));
-		InvalidateRect(NULL,NULL,TRUE);
-
-		return true;
-	}
-	return true;
-}
-
-
-// Modif rdv at 2002 - v1.1.x - videodriver
-void vncDesktop::ShutdownVideoDriver()
-{
-	if(!(OSversion()!=1 || OSversion()!=2)) return;
-	if (m_videodriver==NULL) return;
-	if (m_videodriver!=NULL)
-	{
-		delete m_videodriver;
-		m_videodriver=NULL;
-	}
-	StopDriverWatches=true;
-}
-
-
-//
-// This proc sets the Desktop update handling params depending
-// on tranitted settings and internal constraints.
-// It is called from several places (InitHookSettings(), SetHookings()
-// and from Desktop thread loop).
-// 
-void vncDesktop::SethookMechanism(BOOL hookall,BOOL hookdriver)
-{
-	m_hookswitch=false;
-	// Force at least one updates handling method !
-	if (!hookall && !hookdriver && !m_server->PollFullScreen())
-	{
-		hookall = TRUE;
-		m_server->PollFullScreen(TRUE);
-	}
-
-	// 9,x case 
-	vnclog.Print(LL_INTERR, VNCLOG("SethookMechanism called\r\n"));
-	if(OSversion()==4 || OSversion()==5)
-	{
-		m_hookdriver=false;//(user driver updates)
-		m_hookdll=false;//(use hookdll updates)
-		if (hookall || hookdriver) m_hookdll=true;
-		//always try to stop the ddihook before starting
-		StartStopddihook(false);ddihook=false;
-		if (hookdriver) StartStopddihook(true);
-		// same for the hookdll
-		BOOL old_On_Off_hookdll=On_Off_hookdll;
-		if (hookdriver || hookall) On_Off_hookdll=true;
-		else On_Off_hookdll=false;
-		if (old_On_Off_hookdll!=On_Off_hookdll) Hookdll_Changed=true;
-		else Hookdll_Changed=false;
-	}
-	// W2k-XP case
-	else if(OSversion()==1 || OSversion()==2)
-	{
-		// sf at 2002 - We forbid hoodll and hookdriver at the same time (pointless and high CPU load)
-		if (!hookall && !hookdriver) {m_hookdll=false;m_hookdriver=false;}
-		if (hookall && hookdriver) {m_hookdll=false;m_hookdriver=true;}
-		if (hookall && !hookdriver) {m_hookdll=true;m_hookdriver=false;}
-		if (!hookall && hookdriver) {m_hookdll=false;m_hookdriver=true;}
-
-		BOOL old_On_Off_hookdll=On_Off_hookdll;
-		if (m_hookdll) On_Off_hookdll=true;
-		else On_Off_hookdll=false;
-		if (old_On_Off_hookdll!=On_Off_hookdll) Hookdll_Changed=true;
-		else Hookdll_Changed=false;
-		if (OSversion()==2) Hookdll_Changed=true;
-		
-		vnclog.Print(LL_INTERR, VNCLOG("Sethook_restart_wanted hook=%d driver=%d \r\n"),m_hookdll,m_hookdriver);
-		if (Hookdll_Changed)
-			vnclog.Print(LL_INTERR, VNCLOG("Hookdll status changed \r\n"));
-
-		if ((m_hookdriver && !VideoBuffer()) || (!m_hookdriver && VideoBuffer()))
-		{
-			m_hookswitch=true;
-			vnclog.Print(LL_INTERR, VNCLOG("Driver Status changed\r\n"));
-		}
-	}
-	else //NT4
-	{
-		if (!hookall && !hookdriver) {m_hookdll=false;m_hookdriver=false;}
-		if (hookall && hookdriver) {m_hookdll=true;m_hookdriver=false;}
-		if (hookall && !hookdriver) {m_hookdll=true;m_hookdriver=false;}
-		if (!hookall && hookdriver) {m_hookdll=false;m_hookdriver=false;}
-		BOOL old_On_Off_hookdll=On_Off_hookdll;
-		if (m_hookdll) On_Off_hookdll=true;
-		else On_Off_hookdll=false;
-		if (old_On_Off_hookdll!=On_Off_hookdll) Hookdll_Changed=true;
-		else Hookdll_Changed=false;
-	}
-
-}
-void vncDesktop::StartStopddihook(BOOL enabled)
-{
-	if (enabled)
-	{
-		STARTUPINFO ssi;
-		PROCESS_INFORMATION ppi;
-		m_hddihook=NULL;
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return;
-			*p = '\0';
-			strcat (szCurrentDir,"\\16bithlp.exe");
-		}
-		// Add ddi hook
-		ZeroMemory( &ssi, sizeof(ssi) );
-		ssi.cb = sizeof(ssi);
-		// Start the child process. 
-		if( !CreateProcess( NULL,szCurrentDir, NULL,NULL,FALSE,0,NULL,NULL,&ssi,&ppi ) ) 
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("set ddihooks Failed\n"));
-			ddihook=false;
-		}
-		else
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("set ddihooks OK\n"));
-			ddihook=true;
-			WaitForInputIdle(ppi.hProcess, 10000);
-			m_hddihook=ppi.hProcess;
-		}
-	}
-	else
-	{
-		if (m_hddihook != NULL)
-		{
-			TerminateProcess(m_hddihook,0);
-			m_hddihook=NULL;
-			ddihook=false;
-		}
-	}
-
-}
-
-void vncDesktop::StartStophookdll(BOOL enabled)
-{
-	vnclog.Print(LL_INTERR, VNCLOG("PostMessage(m_hwnd, WM_HOOKCHANGE \n"));
-	PostMessage(m_hwnd, WM_HOOKCHANGE, enabled, 0);
-}
-
-
-//
-//
-//
-void vncDesktop::InitHookSettings()
-{
-	SethookMechanism(m_server->Hook(),m_server->Driver());
-}
-
-
-void vncDesktop::SetBlockInputState(bool newstate)
-{
-	CARD32 state = 0;
-	if (m_server->BlankMonitorEnabled())
-    {
-		if (!m_server->BlankInputsOnly()) 
-			{
-				if (blankmonitorstate==1 && newstate==1) 
-					{
-						SetBlankMonitor(0);
-						blankmonitorstate=0;
-					}
-				else
-				{
-					SetBlankMonitor(newstate);	
-					blankmonitorstate=newstate;
-				}
-			}
-		m_bIsInputDisabledByClient=newstate;
-		state=!block_input();
-		
-    }
-	else state=!newstate;
-
-	m_bIsInputDisabledByClient = !state;
-
- m_server->NotifyClients_StateChange(rfbServerRemoteInputsState, state);
-}
-
-bool vncDesktop::block_input()
-{
-    int Blockinput_val;
-	if(m_bIsInputDisabledByClient || m_server->LocalInputsDisabled())
-	{
-		Blockinput_val=true;
-	}
-	else
-	{
-		Blockinput_val=false;
-	}
-
-	/*#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," blockinput %i %i %i %i\n",m_bIsInputDisabledByClient,m_server->LocalInputsDisabled(),old_Blockinput1,old_Blockinput2);
-					SetLastError(0);
-					OutputDebugString(szText);		
-	#endif*/
-
-	if (old_Blockinput1!=m_bIsInputDisabledByClient || old_Blockinput2!=m_server->LocalInputsDisabled())
-	{
-		CARD32 state;
-		state=!Blockinput_val;
-		m_server->NotifyClients_StateChange(rfbServerRemoteInputsState, state);
-	}
-    if (pbi)
-    {
-		(*pbi)(Blockinput_val);
-		DWORD aa=GetLastError();
-		if (old_Blockinput!=Blockinput_val && aa==5)
-		{
-			if (m_hookinited)
-			PostMessage(m_hwnd, WM_HOOKCHANGE, 2, 0);
-			else Blockinput_val=false;
-		}
-
-    }
-	old_Blockinput1=m_bIsInputDisabledByClient;
-	old_Blockinput2=m_server->LocalInputsDisabled();
-	old_Blockinput=Blockinput_val;
-
-    return Blockinput_val;
-}
diff --git a/ica/win32/winvnc/winvnc/vncdesktop.h b/ica/win32/winvnc/winvnc/vncdesktop.h
deleted file mode 100644
index a908907..0000000
--- a/ica/win32/winvnc/winvnc/vncdesktop.h
+++ /dev/null
@@ -1,537 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncDesktop object
-
-// The vncDesktop object handles retrieval of data from the
-// display buffer.  It also uses the RFBLib DLL to supply
-// information on mouse movements and screen updates to
-// the server
-
-class vncDesktop;
-
-#if !defined(_WINVNC_VNCDESKTOP)
-#define _WINVNC_VNCDESKTOP
-#pragma once
-
-// Include files
-#include "stdhdrs.h"
-
-class vncServer;
-#include "rfbRegion.h"
-#include "rfbUpdateTracker.h"
-#include "vncbuffer.h"
-#include "translate.h"
-#include <omnithread.h>
-
-// Modif rdv at 2002 - v1.1.x - videodriver
-#include "videodriver.h"
-
-// Modif sf at 2002 - v1.1.0
-#include <list>
-#include <set>
-#include "TextChat.h"
-#ifdef AVILOG
-#include "avilog/avilog/AVIGenerator.h"
-#endif
-// adzm - 2010-07 - Extended clipboard
-#include "common/Clipboard.h"
-//#define COMPILE_MULTIMON_STUBS
-//#include "Multimon.h"
-#ifndef SM_CMONITORS
-
-#define SM_XVIRTUALSCREEN       76
-#define SM_YVIRTUALSCREEN       77
-#define SM_CXVIRTUALSCREEN      78
-#define SM_CYVIRTUALSCREEN      79
-#define SM_CMONITORS            80
-#define SM_SAMEDISPLAYFORMAT    81
-
-// HMONITOR is already declared if WINVER >= 0x0500 in windef.h
-// This is for components built with an older version number.
-//
-#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500)
-DECLARE_HANDLE(HMONITOR);
-#define HMONITOR_DECLARED
-#endif
-
-#define MONITOR_DEFAULTTONULL       0x00000000
-#define MONITOR_DEFAULTTOPRIMARY    0x00000001
-#define MONITOR_DEFAULTTONEAREST    0x00000002
-
-#define MONITORINFOF_PRIMARY        0x00000001
-
-typedef struct tagMONITORINFO
-{
-    DWORD   cbSize;
-    RECT    rcMonitor;
-    RECT    rcWork;
-    DWORD   dwFlags;
-} MONITORINFO, *LPMONITORINFO;
-
-#ifndef CCHDEVICENAME
-#define CCHDEVICENAME 32
-#endif
-
-#ifdef __cplusplus
-typedef struct tagMONITORINFOEXA : public tagMONITORINFO
-{
-    CHAR        szDevice[CCHDEVICENAME];
-} MONITORINFOEXA, *LPMONITORINFOEXA;
-typedef struct tagMONITORINFOEXW : public tagMONITORINFO
-{
-    WCHAR       szDevice[CCHDEVICENAME];
-} MONITORINFOEXW, *LPMONITORINFOEXW;
-#ifdef UNICODE
-typedef MONITORINFOEXW MONITORINFOEX;
-typedef LPMONITORINFOEXW LPMONITORINFOEX;
-#else
-typedef MONITORINFOEXA MONITORINFOEX;
-typedef LPMONITORINFOEXA LPMONITORINFOEX;
-#endif // UNICODE
-#else // ndef __cplusplus
-typedef struct tagMONITORINFOEXA
-{
-    MONITORINFO;
-    CHAR        szDevice[CCHDEVICENAME];
-} MONITORINFOEXA, *LPMONITORINFOEXA;
-typedef struct tagMONITORINFOEXW
-{
-    MONITORINFO;
-    WCHAR       szDevice[CCHDEVICENAME];
-} MONITORINFOEXW, *LPMONITORINFOEXW;
-#ifdef UNICODE
-typedef MONITORINFOEXW MONITORINFOEX;
-typedef LPMONITORINFOEXW LPMONITORINFOEX;
-#else
-typedef MONITORINFOEXA MONITORINFOEX;
-typedef LPMONITORINFOEXA LPMONITORINFOEX;
-#endif // UNICODE
-#endif
-#endif
-
-typedef std::vector<COLORREF> RGBPixelList;   // List of RGB values (pixels)
-// sf at 2002 - Generates ClassName lenght warning in debug mode compile.
-// typedef std::list<RGBPixelList*> GridsList; // List of Grids of pixels
-typedef std::vector<RGBPixelList*> GridsList; // List of Grids of pixels
-typedef std::set<HWND> WindowsList;       // List of windows handles
-
-
-// Constants
-extern const UINT RFB_SCREEN_UPDATE;
-extern const UINT RFB_COPYRECT_UPDATE;
-extern const UINT RFB_MOUSE_UPDATE;
-extern const char szDesktopSink[];
-
-#define NONE 0
-#define MIRROR 1
-#define PSEUDO 2
-
-// initialization errors
-#define ERROR_DESKTOP_NO_PALETTE 					    1
-#define ERROR_DESKTOP_INIT_FAILED 					    2
-#define ERROR_DESKTOP_UNSUPPORTED_PIXEL_ORGANIZATION    3
-#define ERROR_DESKTOP_UNSUPPORTED_PIXEL_FORMAT 		    4
-#define ERROR_DESKTOP_NO_HOOKWINDOW 				    5
-#define ERROR_DESKTOP_NO_ROOTDC                         6
-#define ERROR_DESKTOP_NO_BITBLT                         7
-#define ERROR_DESKTOP_NO_GETDIBITS                      8
-#define ERROR_DESKTOP_NO_COMPATBITMAP                   9
-#define ERROR_DESKTOP_NO_DISPLAYFORMAT                  10
-#define ERROR_DESKTOP_OUT_OF_MEMORY                     11
-#define ERROR_DESKTOP_NO_DIBSECTION_OR_COMPATBITMAP     12
-#define ERROR_DESKTOP_NO_DESKTOPTHREAD                  13
-typedef struct DrvWatch
-{
-	HWND hwnd;
-	bool *stop;
-}DrvWatch;
-
-typedef BOOL (*SetHooksFn)(DWORD thread_id,UINT UpdateMsg,UINT CopyMsg,UINT MouseMsg,BOOL ddihook);
-typedef BOOL (*UnSetHooksFn)(DWORD thread_id);
-typedef BOOL (*SetKeyboardFilterHookFn)(BOOL activate);	
-typedef BOOL (*SetMouseFilterHookFn)(BOOL activate);
-typedef BOOL (*SetHookFn)(HWND hwnd);
-typedef BOOL (*UnSetHookFn)(HWND hwnd);
-
-typedef BOOL (WINAPI*  pBlockInput) (BOOL);
-typedef BOOL (WINAPI* LPGETMONITORINFO)(HMONITOR, LPMONITORINFO);
-typedef HMONITOR (WINAPI* LPMONITOTFROMPOINT) (POINT,DWORD);
-
-
-// Class definition
-// multi monitor
-struct monitor
-{
-	int Width;
-	int Height;
-	int Depth;
-	char device[32];
-	int offsetx;
-	int offsety;
-};
-
-
-class PixelCaptureEngine
-{
-public:
-	PixelCaptureEngine();
-	~PixelCaptureEngine();
-	void PixelCaptureEngineInit(HDC rootdc, HDC memdc, HBITMAP membitmap, bool bCaptureAlpha, void *dibbits, int bpp, int bpr);
-	bool CaptureRect(const rfb::Rect& rect);
-	COLORREF CapturePixel(int x, int y);
-	void ReleaseCapture();
-	bool		m_bIsVista;
-
-private:
-	HDC			m_hrootdc;
-	HDC			m_hmemdc;
-	HBITMAP		m_membitmap;
-	HBITMAP		m_oldbitmap;
-	void		*m_DIBbits;
-	rfb::Rect	m_rect;
-	bool		m_bCaptureAlpha;
-	int			m_bytesPerPixel;
-	int			m_bytesPerRow;
-};
-
-class vncDesktop
-{
-
-// Fields
-public:
-
-// Methods
-public:
-	// Make the desktop thread & window proc friends
-	friend class vncDesktopThread;
-	friend LRESULT CALLBACK DesktopWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
-
-	// Create/Destroy methods
-	vncDesktop();
-	~vncDesktop();
-
-	DWORD Init(vncServer *pSrv);
-
-	// Tell the desktop hooks to grab & update a particular rectangle
-	void QueueRect(const rfb::Rect &rect);
-	
-	// Kick the desktop hooks to perform an update
-	void TriggerUpdate();
-
-	// Get a reference to the desktop update lock
-	// The lock is held while data is being grabbed and copied
-	// to the back buffer, and while changes are being passed to
-	// clients
-	omni_mutex &GetUpdateLock() {return m_update_lock;};
-
-	// Screen translation, capture, info
-	void FillDisplayInfo(rfbServerInitMsg *scrInfo);
-	void CaptureScreen(const rfb::Rect &UpdateArea, BYTE *scrBuff, UINT scrBuffSize,BOOL capture);
-	int ScreenBuffSize();
-	HWND Window() {return m_hwnd;};
-
-	// Mouse related
-	void CaptureMouse(BYTE *scrBuff, UINT scrBuffSize);
-	rfb::Rect MouseRect();
-	void SetCursor(HCURSOR cursor);
-	// CURSOR HANDLING
-	BOOL GetRichCursorData(BYTE *databuf, HCURSOR hcursor, int width, int height);
-	HCURSOR GetCursor() { return m_hcursor; }
-
-	// Clipboard manipulation
-	void SetClipText(LPSTR text);
-	// adzm - 2010-07 - Extended clipboard
-	void SetClipTextEx(ExtendedClipboardDataMessage& extendedClipboardDataMessage);
-
-	// Method to obtain the DIBsection buffer if fast blits are enabled
-	// If they're disabled, it'll return NULL
-	inline VOID *OptimisedBlitBuffer() {return m_DIBbits;};
-
-	// adzm - 2010-07 - Extended clipboard
-	//BOOL	m_initialClipBoardSeen;
-
-	// Handler for pixel data grabbing and region change checking
-	vncBuffer		m_buffer;
-		//SINGLE WINDOW
-	vncServer		*GetServerPointer() {return m_server;};
-	HWND			m_Single_hWnd;
-	HWND			m_Single_hWnd_backup;
-	BOOL			CalculateSWrect(RECT &rect);
-	rfb::Rect		GetSize();
-	rfb::Rect		GetQuarterSize();
-
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	//BOOL IsVideoDriverEnabled();
-	BOOL VideoBuffer();
-	int m_ScreenOffsetx;
-	int m_ScreenOffsety;
-	int DriverType;
-	DWORD color[10];
-	// added jeff
-	void SetBlankMonitor(bool enabled);
-	// Modif rdv at 2002 Dis/enable input
-	void SetDisableInput();
-	void SetSW(int x,int y);
-	//hook selection
-	BOOL m_hookdriver;
-	void SethookMechanism(BOOL hookall,BOOL hookdriver);
-	bool m_UltraEncoder_used;
-	rfb::Rect		m_Cliprect;//the region to check
-	bool StopDriverWatches;
-
-	PCHANGES_BUF pchanges_buf;
-	CHANGES_BUF changes_buf;
-
-	int GetNrMonitors();
-	void GetPrimaryDevice();
-	void GetSecondaryDevice();
-	void Checkmonitors();
-    // 28 Mar 2008 jdp
-    void SetBlockInputState(bool newstate);
-    bool GetBlockInputState() { return m_bIsInputDisabledByClient; }
-    bool block_input();
-	BOOL InitWindow();
-	HANDLE trigger_events[6];
-	HANDLE restart_event;
-	DWORD pumpID;
-	rfb::Region2D rgnpump;
-	bool lock_region_add;
-
-	// The current mouse position
-	rfb::Rect		m_cursorpos;
-	void WriteMessageOnScreen(char*,BYTE *scrBuff, UINT scrBuffSize);
-
-	// Implementation
-protected:
-
-	// Routines to hook and unhook us
-	DWORD Startup();
-	BOOL Shutdown();
-	
-	// Init routines called by the child thread
-	BOOL InitDesktop();
-	void KillScreenSaver();
-//	void KillWallpaper();
-//	void RestoreWallpaper();
-	DWORD InitBitmap();
-	BOOL ThunkBitmapInfo();
-	DWORD SetPixFormat();
-	BOOL SetPixShifts();
-	BOOL InitHooks();
-	BOOL SetPalette();
-	int m_timer;
-
-	// Fetching pixel data to a buffer, and handling copyrects
-	void CopyToBuffer(const rfb::Rect &rect, BYTE *scrBuff, UINT scrBuffSize);
-	bool CalcCopyRects(rfb::UpdateTracker &tracker);
-
-	// Routine to attempt enabling optimised DIBsection blits
-	DWORD EnableOptimisedBlits();
-
-	// Convert a bit mask eg. 00111000 to max=7, shift=3
-	static void MaskToMaxAndShift(DWORD mask, CARD16 &max, CARD8 &shift);
-	
-	// Enabling & disabling clipboard handling
-	void SetClipboardActive(BOOL active) {m_clipboard_active = active;};
-
-	// Modif sf at 2002 - v1.1.0 - FastDetectChanges stuff
-	bool FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bool fTurbo);
-	GridsList    m_lGridsList;   // List of changes detection grids
-	WindowsList  m_lWList;		 // List of Windows handles  
-	// HDC	         m_hDC;			 // Local Screen Device context to capture our Grid of pixels 
-	int          m_nGridCycle;   // Cycle index for grid shifting
-
-	// Modif sf at 2002 - v1.1.0
-	long         m_lLastMouseUpdateTime;
-	long         m_lLastSlowClientTestTime;
-	// long			m_lLastTempo;
-
-	// sf at 2002 - TextChat - No more used for now
-	// bool m_fTextChatRunning;
-	// TextChat* m_pCurrentTextChat;
-
-	BOOL m_fCaptureAlphaBlending;
-	// DATA
-
-	// Generally useful stuff
-	vncServer 		*m_server;
-	omni_thread 	*m_thread;
-	HWND			m_hwnd;
-	//UINT			m_timerid;
-	HWND			m_hnextviewer;
-	// adzm - 2010-07 - Fix clipboard hangs
-	bool			m_settingClipboardViewer;
-	BOOL			m_clipboard_active;
-
-	// device contexts for memory and the screen
-	HDC				m_hmemdc;
-	HDC				m_hrootdc;
-
-	// New and old bitmaps
-	HBITMAP			m_membitmap;
-	omni_mutex		m_update_lock;
-
-	rfb::Rect		m_bmrect;
-	struct _BMInfo {
-		BOOL			truecolour;
-		BITMAPINFO		bmi;
-		// Colormap info - comes straight after BITMAPINFO - **HACK**
-		RGBQUAD			cmap[256];
-	} m_bminfo;
-
-	// Screen info
-	rfbServerInitMsg	m_scrinfo;
-
-	// These are the red, green & blue masks for a pixel
-	DWORD			m_rMask, m_gMask, m_bMask;
-
-	// This is always handy to have
-	int				m_bytesPerRow;
-
-	// Handle of the default cursor
-	HCURSOR			m_hcursor;
-	HCURSOR			m_hOldcursor; // sf at 2002
-
-	// Handle of the basic arrow cursor
-	HCURSOR			m_hdefcursor;
-
-	// Boolean flag to indicate when the display resolution has changed
-	BOOL			m_displaychanged;
-
-	// Boolean flag to indicate whether or not an update trigger message
-	// is already in the desktop thread message queue
-	BOOL			m_update_triggered;
-
-	// Extra vars used for the DIBsection optimisation
-	VOID			*m_DIBbits;
-	BOOL			m_formatmunged;
-
-	// Info used for polling modes
-	UINT			m_pollingcycle;
-	// rfb::Rect		m_fullscreen; // sf at 2002 - v1.1.0
-
-	// Handling of the foreground window, to produce CopyRects
-	HWND			m_foreground_window;
-	rfb::Rect		m_foreground_window_rect;
-
-	//SINGLE WINDOW
-	void SWinit();
-	int m_SWHeight;
-	int m_SWWidth;
-	BOOL m_SWSizeChanged;
-	BOOL m_SWmoved;
-	BOOL m_SWtoDesktop;
-	int m_SWOffsetx;
-	int m_SWOffsety;
-
-	//DDIHOOK
-
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	VIDEODRIVER *m_videodriver;
-	BOOL InitVideoDriver();
- 	void ShutdownVideoDriver();
-	omni_mutex		m_videodriver_lock;
-
-	// Modif input dis/enabke
-	DWORD m_thread_hooks;
-	BOOL ddihook;
-	UINT OldPowerOffTimeout;
-	bool m_Black_window_active;
-
-	//	[v1.0.2-jp1 fix] Monitor Blanking
-	//BOOL m_grayed;
-	//WORD bk_gamma[3][256];
-	
-	//hook selection
-	BOOL m_hookdll;
-	BOOL On_Off_hookdll;
-	BOOL m_hookswitch;
-	BOOL Hookdll_Changed;
-	BOOL m_hookinited;
-	HANDLE m_hddihook;
-	void StartStopddihook(BOOL enabled);
-	void StartStophookdll(BOOL enabled);
-	void InitHookSettings();
-	HMODULE hModule;
-	HMODULE hSCModule;
-	SetHooksFn SetHooks;
-	UnSetHooksFn  UnSetHooks;
-	SetHookFn SetHook;
-	UnSetHookFn  UnSetHook;
-	SetKeyboardFilterHookFn SetKeyboardFilterHook;
-	SetMouseFilterHookFn SetMouseFilterHook;
-	//hooks in schook Hook(s)
-	SetKeyboardFilterHookFn SetKeyboardFilterHooks;
-	SetMouseFilterHookFn SetMouseFilterHooks;
-
-
-	pBlockInput pbi;
-	HMODULE hUser32;
-	BOOL m_OrigpollingSet;
-	BOOL m_Origpolling;
-/*	BOOL Check24bit();*/
-	COLORREF CapturePixel(int x,int y);
-	HANDLE InitWindowThreadh;
-	void StopInitWindowthread();
-	void StartInitWindowthread();
-	void ShutdownInitWindowthread();
-	bool can_be_hooked;
-	int old_Blockinput;
-	int old_Blockinput1;
-	int old_Blockinput2;
-	int nr_rects;
-	HWND hDeskWnd;
-	HWND hFolderView;
-	rfb::Region2D iconregion;
-	bool blankmonitorstate;
-
-	
-BOOL DriverWanted;
-BOOL HookWanted;
-BOOL DriverWantedSet;
-
-//Multi monitor
-monitor mymonitor[3];
-int nr_monitors;
-bool multi_monitor;
-bool requested_multi_monitor;
-
-bool m_bIsInputDisabledByClient; // 28 March 2008 jdp
-#ifdef AVILOG
-CAVIGenerator *AviGen;
-#endif
-
-private:
-	HDESK m_input_desktop;
-	HDESK m_home_desktop;
-	PixelCaptureEngine PixelEngine;
-	int idle_counter;
-	bool change_found;
-};
-
-#endif // _WINVNC_VNCDESKTOP
diff --git a/ica/win32/winvnc/winvnc/vncdesktopsink.cpp b/ica/win32/winvnc/winvnc/vncdesktopsink.cpp
deleted file mode 100644
index f51c0c3..0000000
--- a/ica/win32/winvnc/winvnc/vncdesktopsink.cpp
+++ /dev/null
@@ -1,748 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "winvnc.h"
-#include "vncserver.h"
-#include "vncdesktop.h"
-#include "vncservice.h"
-#include <string.h>
-
-#define MSGFLT_ADD		1
-typedef BOOL (WINAPI *CHANGEWINDOWMESSAGEFILTER)(UINT message, DWORD dwFlag);
-int OSversion();
-DWORD WINAPI Driverwatch(LPVOID lpParam);
-DWORD WINAPI InitWindowThread(LPVOID lpParam);
-
-void
-vncDesktop::ShutdownInitWindowthread()
-{
-	// we keep the sink window running
-	// but ignore info
-	can_be_hooked=false;
-	vnclog.Print(LL_INTINFO, VNCLOG("ShutdownInitWindowthread \n"));
-}
-
-void
-vncDesktop::StopInitWindowthread()
-{
-	//vndesktopthread is closing, all threads need to be stopped
-	//else winvnc wil stay running in background on exit
-		can_be_hooked=true;
-		if (InitWindowThreadh)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("~vncDesktop::Tell initwindowthread to close \n"));
-			PostThreadMessage(pumpID, WM_QUIT, 0, 0);
-			DWORD status=WaitForSingleObject(InitWindowThreadh,2000);
-			if (status==WAIT_TIMEOUT)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("~vncDesktop::ERROR:  messageloop blocked \n"));
-				// WE need to kill the thread to prevent a winvnc lock
-				TerminateThread(InitWindowThreadh,0);
-				CloseHandle(InitWindowThreadh);
-				m_hwnd=NULL;
-				InitWindowThreadh=NULL;
-			}
-			else
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("~vncDesktop:: iniwindowthread proper closed \n"));
-				CloseHandle(InitWindowThreadh);
-				InitWindowThreadh=NULL;
-			}
-		}
-		else
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("initwindowthread already closed \n"));
-		}
-}
-
-void
-vncDesktop::StartInitWindowthread()
-{
-	// Check if the input desktop == Default desktop
-	// Hooking the winlogon is not needed, no clipboard
-	// see if the threaddesktop== Default
-	HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-	char new_name[256];
-	can_be_hooked=false;
-	vnclog.Print(LL_INTINFO, VNCLOG("StartInitWindowthread \n"));
-	if (GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-	{
-		if (strcmp(new_name,"Default")==0)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("StartInitWindowthread default desk\n"));
-			if (InitWindowThreadh==NULL)
-			{
-				ResetEvent(restart_event);
-				InitWindowThreadh=CreateThread(NULL,0,InitWindowThread,this,0,&pumpID);
-				DWORD status=WaitForSingleObject(restart_event,10000);
-				if (status==WAIT_TIMEOUT)
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("ERROR: initwindowthread failed to start \n"));
-					if (InitWindowThreadh!=NULL)
-					{
-						TerminateThread(InitWindowThreadh,0);
-						CloseHandle(InitWindowThreadh);
-						m_hwnd=NULL;
-						InitWindowThreadh=NULL;
-					}
-					can_be_hooked=false;
-				}
-				else
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("StartInitWindowthread started\n"));
-					can_be_hooked=true;
-				}
-			}
-			else
-			{
-				// initwindowthread is still running
-				// make it back active
-				vnclog.Print(LL_INTINFO, VNCLOG("StartInitWindowthread reactivate\n"));
-				can_be_hooked=true;
-			}
-		}
-		else
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("StartInitWindowthread no default desk\n"));
-		}
-	}
-}
-
-DWORD WINAPI
-InitWindowThread(LPVOID lpParam)
-{
-	vncDesktop *mydesk=(vncDesktop*)lpParam;
-	mydesk->InitWindow();
-	return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window procedure for the Desktop window
-LRESULT CALLBACK
-DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-#ifndef _X64
-	vncDesktop *_this = (vncDesktop*)GetWindowLong(hwnd, GWL_USERDATA);
-#else
-	vncDesktop *_this = (vncDesktop*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#endif
-	#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText,"Message %i\n",iMsg );
-										OutputDebugString(szText);
-										//vnclog.Print(LL_INTERR, VNCLOG("%i  \n"),iMsg);
-			#endif
-	switch (iMsg)
-	{
-	case WM_CREATE:
-		vnclog.Print(LL_INTERR, VNCLOG("wmcreate  \n"));
-		break;
-	case WM_TIMER:
-		if (_this->can_be_hooked)
-		{
-			if (wParam==100)
-			{
-					KillTimer(hwnd, 100); 
-					if (_this->SetHook)
-					{
-						_this->SetHook(hwnd);
-						vnclog.Print(LL_INTERR, VNCLOG("set SC hooks OK\n"));
-						_this->m_hookinited = TRUE;
-						if (_this->SetKeyboardFilterHooks) _this->SetKeyboardFilterHooks( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-						if (_this->SetMouseFilterHooks) _this->SetMouseFilterHooks( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-					}
-					else if (_this->SetHooks)
-					{
-						if (!_this->SetHooks(
-							GetCurrentThreadId(),
-							RFB_SCREEN_UPDATE,
-							RFB_COPYRECT_UPDATE,
-							RFB_MOUSE_UPDATE, 0
-							))
-						{
-							vnclog.Print(LL_INTERR, VNCLOG("failed to set system hooks\n"));
-							// Switch on full screen polling, so they can see something, at least...
-							_this->m_server->PollFullScreen(TRUE);
-							_this->m_hookinited = FALSE;
-						} 
-						else 
-						{
-							vnclog.Print(LL_INTERR, VNCLOG("set hooks OK\n"));
-							_this->m_hookinited = TRUE;
-							// Start up the keyboard and mouse filters
-							if (_this->SetKeyboardFilterHook) _this->SetKeyboardFilterHook(_this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-							if (_this->SetMouseFilterHook) _this->SetMouseFilterHook(_this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-						}
-					}
-			}
-			else SetEvent(_this->trigger_events[0]);
-		}
-		break;
-	case WM_MOUSESHAPE:
-		if (_this->can_be_hooked)
-		{
-			SetEvent(_this->trigger_events[3]);
-		}
-		break;
-	case WM_HOOKCHANGE:
-		if (wParam==1)
-			{
-				if (_this->m_hookinited==FALSE)
-				SetTimer(hwnd,100,4000,NULL);
-			}
-		else if (wParam==2)
-		{
-			if (_this->m_hookinited)
-				{						
-					if (_this->SetHook)
-					{
-						if (_this->SetKeyboardFilterHooks) _this->SetKeyboardFilterHooks( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-						if (_this->SetMouseFilterHooks) _this->SetMouseFilterHooks( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-					}
-					else if (_this->SetHooks)
-					{
-
-						if (_this->SetKeyboardFilterHook) _this->SetKeyboardFilterHook( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-						if (_this->SetMouseFilterHook) _this->SetMouseFilterHook( _this->m_bIsInputDisabledByClient || _this->m_server->LocalInputsDisabled());
-					}
-
-				}
-		}
-		else if (_this->m_hookinited)
-			{
-				_this->m_hookinited=FALSE;
-				if (_this->UnSetHook)
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("unset SC hooks OK\n"));
-					_this->UnSetHook(hwnd);
-				}
-				else if (_this->UnSetHooks)
-				{
-				if(!_this->UnSetHooks(GetCurrentThreadId()) )
-					vnclog.Print(LL_INTERR, VNCLOG("Unsethooks Failed\n"));
-				else vnclog.Print(LL_INTERR, VNCLOG("Unsethooks OK\n"));
-				}
-				
-			}
-		return true;
-
-	case WM_QUERYENDSESSION:
-
-		/*if (OSversion()==2) 
-		{
-		if (_this->m_hnextviewer!=NULL) ChangeClipboardChain(hwnd, _this->m_hnextviewer);
-		_this->m_hnextviewer=NULL;
-		if (_this->m_hookinited)
-			{
-				_this->m_hookinited=FALSE;
-				if (_this->UnSetHook)
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("unset SC hooks OK\n"));
-					_this->UnSetHook(hwnd);
-				}
-				else if (_this->UnSetHooks)
-				{
-				if(!_this->UnSetHooks(GetCurrentThreadId()) )
-					vnclog.Print(LL_INTERR, VNCLOG("Unsethooks Failed\n"));
-				else vnclog.Print(LL_INTERR, VNCLOG("Unsethooks OK\n"));
-				}
-				
-			}
-		vnclog.Print(LL_INTERR, VNCLOG("WM_QUERYENDSESSION\n"));
-		PostQuitMessage(0);
-		SetEvent(_this->trigger_events[5]);
-		}*/
-		return DefWindowProc(hwnd, iMsg, wParam, lParam);
-
-	case WM_CLOSE:
-		if (_this->m_hnextviewer!=NULL) ChangeClipboardChain(hwnd, _this->m_hnextviewer);
-		_this->m_hnextviewer=NULL;
-		DestroyWindow(hwnd);
-		break;
-	case WM_DESTROY:		
-		KillTimer(hwnd, 100); 
-		if (_this->m_hnextviewer!=NULL) ChangeClipboardChain(hwnd, _this->m_hnextviewer);
-		_this->m_hnextviewer=NULL;
-		if (_this->m_hookinited)
-			{
-				_this->m_hookinited=FALSE;
-				if (_this->UnSetHook)
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("unset SC hooks OK\n"));
-					_this->UnSetHook(hwnd);
-				}
-				else if (_this->UnSetHooks)
-				{
-				if(!_this->UnSetHooks(GetCurrentThreadId()) )
-					vnclog.Print(LL_INTERR, VNCLOG("Unsethooks Failed\n"));
-				else vnclog.Print(LL_INTERR, VNCLOG("Unsethooks OK\n"));
-				}
-				
-			}
-		vnclog.Print(LL_INTERR, VNCLOG("WM_DESTROY\n"));
-		break;
-	///ddihook
-	case WM_SYSCOMMAND:
-		// User has clicked an item on the tray menu
-		switch (wParam)
-		{
-			case SC_MONITORPOWER:
-				vnclog.Print(LL_INTINFO, VNCLOG("Monitor22 %i\n"),lParam);
-		}
-		vnclog.Print(LL_INTINFO, VNCLOG("Monitor3 %i %i\n"),wParam,lParam);
-		return DefWindowProc(hwnd, iMsg, wParam, lParam);
-	case WM_POWER:
-	case WM_POWERBROADCAST:
-		// User has clicked an item on the tray menu
-		switch (wParam)
-		{
-			case SC_MONITORPOWER:
-				vnclog.Print(LL_INTINFO, VNCLOG("Monitor222 %i\n"),lParam);
-		}
-		vnclog.Print(LL_INTINFO, VNCLOG("Power3 %i %i\n"),wParam,lParam);
-		return DefWindowProc(hwnd, iMsg, wParam, lParam);
-
-	case WM_COPYDATA:
-        {
-			PCOPYDATASTRUCT pMyCDS = (PCOPYDATASTRUCT) lParam;
-			if (pMyCDS->dwData==112233)
-			{
-					DWORD mysize=pMyCDS->cbData;
-					char mytext[1024];
-					char *myptr;
-					char split[4][6];
-					strcpy(mytext,(LPCSTR)pMyCDS->lpData);
-					myptr=mytext;
-					for (DWORD j =0; j<(mysize/20);j++)
-					{
-						for (int i=0;i<4;i++)
-							{
-								strcpy(split[i],"     ");
-								strncpy(split[i],myptr,4);
-								myptr=myptr+5;
-							}
-						_this->QueueRect(rfb::Rect(atoi(split[0]), atoi(split[1]), atoi(split[2]), atoi(split[3])));
-					}
-					
-			}
-			//vnclog.Print(LL_INTINFO, VNCLOG("copydata\n"));	
-        }
-			return 0;
-
-	// GENERAL
-
-	case WM_DISPLAYCHANGE:
-		// The display resolution is changing
-		// We must kick off any clients since their screen size will be wrong
-		// WE change the clients screensize, if they support it.
-		vnclog.Print(LL_INTERR, VNCLOG("WM_DISPLAYCHANGE\n"));
-		// We First check if the Resolution changed is caused by a temp resolution switch
-		// For a temp resolution we don't use the driver, to fix the mirror driver
-		// to the new change, a resolution switch is needed, preventing screensaver locking.
-
-		if (_this->m_videodriver != NULL) //Video driver active
-		{
-			if (!_this->m_videodriver->blocked)
-			{
-				_this->m_displaychanged = TRUE;
-				_this->m_hookdriver=true;
-				_this->m_videodriver->blocked=true;
-				vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver active\n"));	
-			}
-			else
-			{
-				//Remove display change, cause by driver activation
-				_this->m_videodriver->blocked=false;
-				vnclog.Print(LL_INTERR, VNCLOG("Resolution switch by driver activation removed\n"));
-			}
-		}
-		else 
-		{
-				_this->m_displaychanged = TRUE;
-				_this->m_hookdriver=true;
-				vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver NOT active\n"));
-			
-		}
-		return 0;
-
-	case WM_SYSCOLORCHANGE:
-	case WM_PALETTECHANGED:
-		if (!_this->m_displaychanged)
-		{
-		// The palette colours have changed, so tell the server
-
-		// Get the system palette
-            // better to use the wrong colors than close the connection
-		_this->SetPalette();
-
-		// Update any palette-based clients, too
-		_this->m_server->UpdatePalette(true);
-		}
-		return 0;
-
-		// CLIPBOARD MESSAGES
-
-	case WM_CHANGECBCHAIN:
-		// The clipboard chain has changed - check our nextviewer handle
-		if ((HWND)wParam == _this->m_hnextviewer)
-			_this->m_hnextviewer = (HWND)lParam;
-		else
-			if (_this->m_hnextviewer != NULL) {				
-				// adzm - 2010-07 - Fix clipboard hangs
-				// use SendNotifyMessage instead of SendMessage so misbehaving or hung applications
-				// won't cause our thread to hang.
-				SendNotifyMessage(_this->m_hnextviewer,
-							WM_CHANGECBCHAIN,
-							wParam, lParam);
-			}
-
-		return 0;
-
-	case WM_DRAWCLIPBOARD:
-		// adzm - 2010-07 - Fix clipboard hangs
-		if (_this->can_be_hooked && !_this->m_settingClipboardViewer)
-		{
-			// The clipboard contents have changed
-			if((GetClipboardOwner() != _this->Window()) &&
-				//_this->m_initialClipBoardSeen &&
-				_this->m_clipboard_active && !_this->m_server->IsThereFileTransBusy())
-			{
-				// adzm - 2010-07 - Extended clipboard
-				{
-					// only need a window when setting clipboard data
-					omni_mutex_lock l(_this->m_update_lock);
-					_this->m_server->UpdateClipTextEx(NULL);
-				}
-				/*
-				LPSTR cliptext = NULL;
-
-				// Open the clipboard
-				if (OpenClipboard(_this->Window()))
-				{
-					// Get the clipboard data
-					HGLOBAL cliphandle = GetClipboardData(CF_TEXT);
-					if (cliphandle != NULL)
-					{
-						LPSTR clipdata = (LPSTR) GlobalLock(cliphandle);
-
-						// Copy it into a new buffer
-						if (clipdata == NULL)
-							cliptext = NULL;
-						else
-							cliptext = _strdup(clipdata);
-
-						// Release the buffer and close the clipboard
-						GlobalUnlock(cliphandle);
-					}
-
-					CloseClipboard();
-				}
-
-				if (cliptext != NULL)
-				{
-					int cliplen = strlen(cliptext);
-					LPSTR unixtext = (char *)malloc(cliplen+1);
-
-					// Replace CR-LF with LF - never send CR-LF on the wire,
-					// since Unix won't like it
-					int unixpos=0;
-					for (int x=0; x<cliplen; x++)
-					{
-						if (cliptext[x] != '\x0d')
-						{
-							unixtext[unixpos] = cliptext[x];
-							unixpos++;
-						}
-					}
-					unixtext[unixpos] = 0;
-
-					// Free the clip text
-					free(cliptext);
-					cliptext = NULL;
-
-					// Now send the unix text to the server
-					omni_mutex_lock l(_this->m_update_lock);
-					_this->m_server->UpdateClipText(unixtext);
-
-					free(unixtext);
-				}
-				*/
-			}
-
-			//_this->m_initialClipBoardSeen = TRUE;
-		}
-
-		if (_this->m_hnextviewer != NULL)
-		{
-			// adzm - 2010-07 - Fix clipboard hangs
-			// Pass the message to the next window in clipboard viewer chain.  
-			
-			// use SendNotifyMessage instead of SendMessage so misbehaving or hung applications
-			// won't cause our thread to hang.
-			return SendNotifyMessage(_this->m_hnextviewer, WM_DRAWCLIPBOARD, wParam, lParam); 
-		}
-
-		return 0;
-
-	default:
-		return DefWindowProc(hwnd, iMsg, wParam, lParam);
-	}
-	return 0;
-}
-//////////////////////////////////////////////////////////////////////////////////////////
-
-ATOM m_wndClass = INVALID_ATOM;
-
-BOOL
-vncDesktop::InitWindow()
-{
-	vnclog.Print(LL_INTERR, VNCLOG("InitWindow called\n"));
-	
-	HDESK desktop;
-	desktop = OpenInputDesktop(0, FALSE,
-								DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-								DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-								DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-								DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-								);
-
-	if (desktop == NULL)
-		vnclog.Print(LL_INTERR, VNCLOG("InitWindow:OpenInputdesktop Error \n"));
-	else 
-		vnclog.Print(LL_INTERR, VNCLOG("InitWindow:OpenInputdesktop OK\n"));
-
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-
-	char new_name[256];
-
-	if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("InitWindow:!GetUserObjectInformation \n"));
-	}
-
-	vnclog.Print(LL_INTERR, VNCLOG("InitWindow:SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop);
-
-	if (!SetThreadDesktop(desktop))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("InitWindow:SelectHDESK:!SetThreadDesktop \n"));
-	}
-
-	HMODULE  hUser32 = LoadLibrary("user32.dll");
-	CHANGEWINDOWMESSAGEFILTER pfnFilter = NULL;
-	pfnFilter =(CHANGEWINDOWMESSAGEFILTER)GetProcAddress(hUser32,"ChangeWindowMessageFilter");
-	if (pfnFilter) pfnFilter(RFB_SCREEN_UPDATE, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(RFB_COPYRECT_UPDATE, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(RFB_MOUSE_UPDATE, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(WM_QUIT, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(WM_SHUTDOWN, MSGFLT_ADD);
-
-
-	
-	if (m_wndClass == 0) {
-		// Create the window class
-		WNDCLASSEX wndclass;
-
-		wndclass.cbSize			= sizeof(wndclass);
-		wndclass.style			= 0;
-		wndclass.lpfnWndProc	= &DesktopWndProc;
-		wndclass.cbClsExtra		= 0;
-		wndclass.cbWndExtra		= 0;
-		wndclass.hInstance		= hAppInstance;
-		wndclass.hIcon			= NULL;
-		wndclass.hCursor		= NULL;
-		wndclass.hbrBackground	= (HBRUSH) GetStockObject(WHITE_BRUSH);
-		wndclass.lpszMenuName	= (const char *) NULL;
-		wndclass.lpszClassName	= szDesktopSink;
-		wndclass.hIconSm		= NULL;
-
-		// Register it
-		m_wndClass = RegisterClassEx(&wndclass);
-		if (!m_wndClass) {
-			vnclog.Print(LL_INTERR, VNCLOG("failed to register window class\n"));
-			SetEvent(restart_event);
-			return FALSE;
-		}
-	}
-
-	// And create a window
-	m_hwnd = CreateWindow(szDesktopSink,
-				"WinVNC",
-				WS_OVERLAPPEDWINDOW,
-				CW_USEDEFAULT,
-				CW_USEDEFAULT,
-				400, 200,
-				NULL,
-				NULL,
-				hAppInstance,
-				NULL);
-
-	if (m_hwnd == NULL) {
-		vnclog.Print(LL_INTERR, VNCLOG("failed to create hook window\n"));
-		SetEvent(restart_event);
-		return FALSE;
-	}
-
-	// Set the "this" pointer for the window
-    helper::SafeSetWindowUserData(m_hwnd, (LONG_PTR)this);
-
-	// Enable clipboard hooking
-	// adzm - 2010-07 - Fix clipboard hangs
-	m_settingClipboardViewer = true;
-	m_hnextviewer = SetClipboardViewer(m_hwnd);
-	m_settingClipboardViewer = false;
-	StopDriverWatches=false;
-	if (VideoBuffer())
-	{
-		DWORD myword;
-		HANDLE T1=NULL;
-		T1=CreateThread(NULL,0,Driverwatch,m_hwnd,0,&myword);
-		if (T1) CloseHandle(T1);
-	}
-	vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO load hookdll's\n"));
-	////////////////////////
-		hModule=NULL;
-	char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return 0;
-			*p = '\0';
-			strcat (szCurrentDir,"\\vnchooks.dll");
-		}
-	hSCModule=NULL;
-	char szCurrentDirSC[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDirSC, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDirSC, '\\');
-			if (p == NULL) return 0;
-			*p = '\0';
-#ifdef _X64
-			strcat (szCurrentDirSC,"\\schook64.dll");
-#else
-			strcat (szCurrentDirSC,"\\schook.dll");
-#endif
-		}
-
-	UnSetHooks=NULL;
-	SetMouseFilterHook=NULL;
-	SetKeyboardFilterHook=NULL;
-	SetMouseFilterHooks=NULL;
-	SetKeyboardFilterHooks=NULL;
-	SetHooks=NULL;
-
-	UnSetHook=NULL;
-	SetHook=NULL;
-
-	hModule = LoadLibrary(szCurrentDir);
-	hSCModule = LoadLibrary(szCurrentDirSC);//TOFIX resource leak
-	if (hModule)
-		{
-			UnSetHooks = (UnSetHooksFn) GetProcAddress( hModule, "UnSetHooks" );
-			SetMouseFilterHook  = (SetMouseFilterHookFn) GetProcAddress( hModule, "SetMouseFilterHook" );
-			SetKeyboardFilterHook  = (SetKeyboardFilterHookFn) GetProcAddress( hModule, "SetKeyboardFilterHook" );
-			SetHooks  = (SetHooksFn) GetProcAddress( hModule, "SetHooks" );
-		}
-	if (hSCModule)
-		{
-			UnSetHook = (UnSetHookFn) GetProcAddress( hSCModule, "UnSetHook" );
-			SetHook  = (SetHookFn) GetProcAddress( hSCModule, "SetHook" );
-			SetMouseFilterHooks  = (SetMouseFilterHookFn) GetProcAddress( hSCModule, "SetMouseFilterHook" );
-			SetKeyboardFilterHooks  = (SetKeyboardFilterHookFn) GetProcAddress( hSCModule, "SetKeyboardFilterHook" );
-		}
-	///////////////////////////////////////////////
-	vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO start dispatch\n"));
-	MSG msg;
-	SetEvent(restart_event);
-	while (TRUE)
-	{
-		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO %i %i\n"),msg.message,msg.hwnd);
-			if (msg.message==WM_QUIT || fShutdownOrdered)		
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO called wm_quit\n"));
-					DestroyWindow(m_hwnd);
-					SetEvent(trigger_events[5]);
-					break;
-				}
-			else if (msg.message==WM_SHUTDOWN)
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO called wm_user+4\n"));
-					DestroyWindow(m_hwnd);
-					break;
-				}
-			else if (msg.message==RFB_SCREEN_UPDATE)
-				{
-					if (can_be_hooked)
-					{
-					vnclog.Print(LL_INTERR, VNCLOG("RFB_SCREEN_UPDATE  \n"));
-					rfb::Rect rect;
-					rect.tl = rfb::Point((SHORT)LOWORD(msg.wParam), (SHORT)HIWORD(msg.wParam));
-					rect.br = rfb::Point((SHORT)LOWORD(msg.lParam), (SHORT)HIWORD(msg.lParam));
-					//Buffer coordinates
-					rect.tl.x-=m_ScreenOffsetx;
-					rect.br.x-=m_ScreenOffsetx;
-					rect.tl.y-=m_ScreenOffsety;
-					rect.br.y-=m_ScreenOffsety;
-					vnclog.Print(LL_INTERR, VNCLOG("REct3 %i %i %i %i  \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y);
-				
-					rect = rect.intersect(m_Cliprect);
-					if (!rect.is_empty())
-						{
-							while (lock_region_add) Sleep(5);
-							rgnpump.assign_union(rect);
-							SetEvent(trigger_events[1]);
-						}
-					}
-				}
-			else if (msg.message==RFB_MOUSE_UPDATE)
-				{
-					if (can_be_hooked)
-					{
-					vnclog.Print(LL_INTERR, VNCLOG("RFB_MOUSE_UPDATE  \n"));
-					SetCursor((HCURSOR) msg.wParam);
-					SetEvent(trigger_events[2]);
-					}
-				}
-			else
-				{
-					if (msg.message==WM_USER+3 )vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO called wm_user+3\n"));
-					TranslateMessage(&msg);
-					DispatchMessage(&msg);
-				}
-		}
-		else WaitMessage();
-	}
-
-	if (hModule)FreeLibrary(hModule);
-	if (hSCModule)FreeLibrary(hSCModule);
-	SetThreadDesktop(old_desktop);
-    CloseDesktop(desktop);
-	///////////////////////
-	vnclog.Print(LL_INTERR, VNCLOG("OOOOOOOOOOOO end dispatch\n"));
-	m_hwnd = NULL;
-	return TRUE;
-}
diff --git a/ica/win32/winvnc/winvnc/vncdesktopthread.cpp b/ica/win32/winvnc/winvnc/vncdesktopthread.cpp
deleted file mode 100644
index 6d7d4fa..0000000
--- a/ica/win32/winvnc/winvnc/vncdesktopthread.cpp
+++ /dev/null
@@ -1,1334 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "vncdesktopthread.h"
-#include "vncOSVersion.h"
-bool g_DesktopThread_running;
-bool g_update_triggered;
-DWORD WINAPI hookwatch(LPVOID lpParam);
-extern bool stop_hookwatch;
-void testBench();
-
-
-inline bool
-ClipRect(int *x, int *y, int *w, int *h,
-	    int cx, int cy, int cw, int ch) {
-  if (*x < cx) {
-    *w -= (cx-*x);
-    *x = cx;
-  }
-  if (*y < cy) {
-    *h -= (cy-*y);
-    *y = cy;
-  }
-  if (*x+*w > cx+cw) {
-    *w = (cx+cw)-*x;
-  }
-  if (*y+*h > cy+ch) {
-    *h = (cy+ch)-*y;
-  }
-  return (*w>0) && (*h>0);
-}
-
-////////////////////////////////////////////////////////////////////////////////////
-// Modif rdv at 2002 - v1.1.x - videodriver
-void
-vncDesktopThread::copy_bitmaps_to_buffer(ULONG i,rfb::Region2D &rgncache,rfb::UpdateTracker &tracker)
-{
-	
-		rfb::Rect rect;
-		int x = m_desktop->pchanges_buf->pointrect[i].rect.left;
-		int w = m_desktop->pchanges_buf->pointrect[i].rect.right-m_desktop->pchanges_buf->pointrect[i].rect.left;
-		int y = m_desktop->pchanges_buf->pointrect[i].rect.top;
-		int h = m_desktop->pchanges_buf->pointrect[i].rect.bottom-m_desktop->pchanges_buf->pointrect[i].rect.top;
-		//vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i \n"),x,y,w,h);
-
-		if (!ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-			m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y)) return;
-		//vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i \n"),x,y,w,h);
-		rect.tl.x = x;
-		rect.br.x = x+w;
-		rect.tl.y = y;
-		rect.br.y = y+h;
-
-		switch(m_desktop->pchanges_buf->pointrect[i].type)
-			{
-				case SCREEN_SCREEN:
-					{
-						int dx=m_desktop->pchanges_buf->pointrect[i].point.x;
-						int dy=m_desktop->pchanges_buf->pointrect[i].point.y;
-						if (!m_screen_moved && (dx==0 || dy==0) )
-								{
-//// Fix in case !Cliprect
-									int xx=x;
-                                    int yy=y;
-                                    int hh=h;
-                                    int ww=w;
-                                    if (ClipRect(&xx,&yy,&ww,&hh,m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-                                                m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y))
-									{
-                                    rect.tl.x=xx;
-                                    rect.tl.y=yy;
-                                    rect.br.x=xx+ww;
-                                    rect.br.y=yy+hh;
-                                    rgncache.assign_union(rect);
-									}
-
-//////////////////////
-// Fix Eckerd
-									x=x+dx;;
-									y=y+dy;;
-									if (!ClipRect(&x,&y,&w,&h,m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-												m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y)) return;
-//////////////////////
-// Fix Eckerd
-									rect.tl.x=x-dx;
-									rect.tl.y=y-dy;
-									rect.br.x=x+w-dx;
-									rect.br.y=y+h-dy;
-
-									rfb::Point delta = rfb::Point(-dx,-dy);
-									rgncache.assign_union(rect);
-									tracker.add_copied(rect, delta);
-								//	vnclog.Print(LL_INTINFO, VNCLOG("Copyrect \n"));
-								}
-						else
-								{
-									rgncache.assign_union(rect);
-								}
-						break;
-					}
-
-				case SOLIDFILL:
-				case TEXTOUT:
-				case BLEND:
-				case TRANS:
-				case PLG:
-				case BLIT:;
-					rgncache.assign_union(rect);
-					break;
-				default:
-					break;
-			}
-}
-
-
-
-// Modif rdv at 2002 - v1.1.x - videodriver
-BOOL
-vncDesktopThread::handle_driver_changes(rfb::Region2D &rgncache,rfb::UpdateTracker &tracker)
-{ 
-
-	omni_mutex_lock l(m_desktop->m_videodriver_lock);
-
-	int oldaantal=m_desktop->m_videodriver->oldaantal;
-	int counter=m_desktop->pchanges_buf->counter;
-//	int nr_updates=m_desktop->pchanges_buf->pointrect[0].type;
-//	vnclog.Print(LL_INTERR, VNCLOG("updates, rects %i\n"),oldaantal-counter);
-	if (oldaantal==counter) return FALSE;
-	if (counter<1 || counter >1999) return FALSE;
-//	m_desktop->pchanges_buf->pointrect[0].type=0;
-	if (!m_server->SingleWindow()) m_screen_moved=m_desktop->CalcCopyRects(tracker);
-	else m_screen_moved=true;
-
-/// HEITE01E
-// buffer was overloaded, so we use the bounding rect
-/*	if (nr_updates>2000)
-	{
-		rfb::Rect rect;
-		int x = m_desktop->pchanges_buf->pointrect[0].rect.left;
-		int w = m_desktop->pchanges_buf->pointrect[0].rect.right-m_desktop->pchanges_buf->pointrect[0].rect.left;
-		int y = m_desktop->pchanges_buf->pointrect[0].rect.top;
-		int h = m_desktop->pchanges_buf->pointrect[0].rect.bottom-m_desktop->pchanges_buf->pointrect[0].rect.top;
-		if (ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-			m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y))
-		{
-		rect.tl.x = x;
-		rect.br.x = x+w;
-		rect.tl.y = y;
-		rect.br.y = y+h;
-		rgncache=rgncache.union_(rect);
-		m_desktop->m_videodriver->oldaantal=counter;
-		}
-	    return TRUE;
-	}*/
-	if (m_server->SingleWindow()) m_screen_moved=true;
-	if (oldaantal<counter)
-		{
-			for (int i =oldaantal+1; i<=counter;i++)
-				{
-					copy_bitmaps_to_buffer(i,rgncache,tracker);
-				}
-
-		}
-	else
-		{
-		    int i = 0;
-			for (i =oldaantal+1;i<MAXCHANGES_BUF;i++)
-				{
-					copy_bitmaps_to_buffer(i,rgncache,tracker);
-				}
-			for (i=1;i<=counter;i++)
-				{
-					copy_bitmaps_to_buffer(i,rgncache,tracker);
-				}
-		}	
-//	vnclog.Print(LL_INTINFO, VNCLOG("Nr rects %i \n"),rgncache.Numrects());
-	m_desktop->m_videodriver->oldaantal=counter;
-// A lot updates left after combining 
-// This generates an overflow
-// We expand each single update to minimum 32x32
-	if (rgncache.Numrects()>150)
-	{
-		rfb::Region2D rgntemp;
-		rfb::RectVector rects;
-		rfb::RectVector::iterator i;
-		rgncache.get_rects(rects, 1, 1);
-		for (i = rects.begin(); i != rects.end(); ++i)
-			{
-				rfb::Rect rect = *i;
-				rect.tl.x=rect.tl.x/32*32;
-				rect.tl.y=rect.tl.y/32*32;
-				rect.br.x=rect.br.x/32*32+32;
-				rect.br.y=rect.br.y/32*32+32;
-				if (rect.br.x>m_desktop->m_bmrect.br.x) rect.br.x=m_desktop->m_bmrect.br.x;
-				if (rect.br.y>m_desktop->m_bmrect.br.y) rect.br.y=m_desktop->m_bmrect.br.y;
-				rgntemp.assign_union(rect);
-			}
-//Still to many little updates
-//Use the bounding rectangle for updates
-		if (rgntemp.Numrects()>50)
-		{
-			Rect brect=rgntemp.get_bounding_rect();
-			rgncache.clear();
-			rgncache.assign_union(brect);
-		}
-		else
-		{
-		rgncache.clear();
-		rgncache.assign_union(rgntemp);
-		}
-	}
-	return TRUE;
-}
-
-BOOL
-vncDesktopThread::Init(vncDesktop *desktop, vncServer *server)
-{
-	// Save the server pointer
-	m_server = server;
-	m_desktop = desktop;
-	m_returnset = FALSE;
-	m_returnsig = new omni_condition(&m_returnLock);
-	// Start the thread
-	start_undetached();
-	// Wait for the thread to let us know if it failed to init
-	{	omni_mutex_lock l(m_returnLock);
-
-		while (!m_returnset)
-		{
-			m_returnsig->wait();
-		}
-	}
-	if (m_return!=0) 
-    {
-        g_DesktopThread_running=false;
-    }
-	return m_return;
-}
-
-void
-vncDesktopThread::ReturnVal(DWORD result)
-{
-	omni_mutex_lock l(m_returnLock);
-	m_returnset = TRUE;
-	m_return = result;
-	m_returnsig->signal();
-}
-
-void
-vncDesktopThread::PollWindow(rfb::Region2D &rgn, HWND hwnd)
-{
-	// Are we set to low-load polling?
-	if (m_server->PollOnEventOnly())
-	{
-		// Yes, so only poll if the remote user has done something
-		if (!m_server->RemoteEventReceived()) {
-			return;
-		}
-	}
-
-	// Does the client want us to poll only console windows?
-	if (m_desktop->m_server->PollConsoleOnly())
-	{
-		char classname[20];
-
-		// Yes, so check that this is a console window...
-		if (GetClassName(hwnd, classname, sizeof(classname))) {
-			if ((strcmp(classname, "tty") != 0) &&
-				(strcmp(classname, "ConsoleWindowClass") != 0)) {
-				return;
-			}
-		}
-	}
-
-	RECT rect;
-
-	// Get the rectangle
-	if (GetWindowRect(hwnd, &rect)) {
-		//Buffer coordinates
-			rect.left-=m_desktop->m_ScreenOffsetx;
-			rect.right-=m_desktop->m_ScreenOffsetx;
-			rect.top-=m_desktop->m_ScreenOffsety;
-			rect.bottom-=m_desktop->m_ScreenOffsety;
-		rfb::Rect wrect = rfb::Rect(rect).intersect(m_desktop->m_Cliprect);
-		if (!wrect.is_empty()) {
-			rgn.assign_union(wrect);
-		}
-	}
-}
-
-
-bool vncDesktopThread::handle_display_change(HANDLE& threadHandle, rfb::Region2D& rgncache, rfb::SimpleUpdateTracker& clipped_updates, rfb::ClippedUpdateTracker& updates)
-{
-	BOOL screensize_changed=false;
-	if (first_run)
-	{
-		first_run=false;
-		m_server->SetNewSWSizeFR(m_desktop->m_scrinfo.framebufferWidth,m_desktop->m_scrinfo.framebufferHeight,FALSE);//changed no lock ok
-		//m_server->SetScreenOffset(m_desktop->m_ScreenOffsetx,m_desktop->m_ScreenOffsety,m_desktop->nr_monitors);// no lock ok
-		//m_desktop->m_displaychanged=true;
-		//screensize_changed=true;
-	}
-
-	if (vncService::InputDesktopSelected()==2)
-	{
-		m_desktop->m_buffer.WriteMessageOnScreen("UltraVVNC running as application doesn't \nhave permission to acces \nUAC protected windows.\n\nThe is screen is locked until the remote user \nunlock this window");
-		rfb::Rect rect;
-		rect.tl = rfb::Point(0,0);
-		rect.br = rfb::Point(300,120);
-		rgncache.assign_union(rect);
-	}
-		
-	if ((m_desktop->m_displaychanged ||									//WM_DISPLAYCHANGE
-			vncService::InputDesktopSelected()==0 ||							//handle logon and screensaver desktops
-			m_desktop->m_SWtoDesktop ||										//switch from SW to full desktop or visa versa
-			m_desktop->m_hookswitch||										//hook change request
-			m_desktop->requested_multi_monitor!=m_desktop->m_buffer.IsMultiMonitor()		//monitor change request
-			) )
-			{
-				// We need to wait until viewer has send if he support Size changes
-				if (!m_server->All_clients_initialalized())
-				{
-					Sleep(30);
-					vnclog.Print(LL_INTERR, VNCLOG("Wait for viewer init \n"));
-				}
-
-				//logging
-				if (m_desktop->m_displaychanged)								vnclog.Print(LL_INTERR, VNCLOG("++++Screensize changed \n"));
-				if (m_desktop->m_SWtoDesktop)									vnclog.Print(LL_INTERR, VNCLOG("m_SWtoDesktop \n"));
-				if (m_desktop->m_hookswitch)									vnclog.Print(LL_INTERR, VNCLOG("m_hookswitch \n"));
-				if (m_desktop->requested_multi_monitor!=m_desktop->m_buffer.IsMultiMonitor()) vnclog.Print(LL_INTERR, VNCLOG("desktop switch %i %i \n"),m_desktop->requested_multi_monitor,m_desktop->m_buffer.IsMultiMonitor());
-				if (!m_server->IsThereFileTransBusy())
-				if (vncService::InputDesktopSelected()==0)						vnclog.Print(LL_INTERR, VNCLOG("++++InputDesktopSelected \n"));
-				
-				
-				//BOOL screensize_changed=false;
-				BOOL monitor_changed=false;
-				rfbServerInitMsg oldscrinfo;
-				//*******************************************************
-				// Lock Buffers from here
-				//*******************************************************
-				{
-					if (XRichCursorEnabled) m_server->UpdateCursorShape();
-					/// We lock all buffers,,and also back the client thread update mechanism
-					omni_mutex_lock l(m_desktop->m_update_lock);
-					/*#ifdef _DEBUG
-					char			szText[256];
-					sprintf(szText," ++++++ Mutex lock display changes\n");
-					OutputDebugString(szText);		
-			#endif*/
-					// We remove all queue updates from the tracker
-					m_server->Clear_Update_Tracker();
-					// Also clear the current updates
-					rgncache.clear();
-					// Also clear the copy_rect updates
-					clipped_updates.clear();
-					// TESTTESTTEST
-					// Are all updates cleared....old updates could generate bounding errors
-					// any other queues to clear ? Yep cursor positions
-					m_desktop->m_cursorpos.tl.x=0;
-					m_desktop->m_cursorpos.tl.y=0;
-					m_desktop->m_cursorpos.br.x=0;
-					m_desktop->m_cursorpos.br.y=0;
-					//keep a copy of the old screen size, so we can check for changes later on
-					oldscrinfo = m_desktop->m_scrinfo;
-						
-					if (m_desktop->requested_multi_monitor!=m_desktop->m_buffer.IsMultiMonitor())
-						{
-							m_desktop->Checkmonitors();
-							m_desktop->requested_multi_monitor=m_desktop->m_buffer.IsMultiMonitor();
-							int old_monitor=m_desktop->multi_monitor;	
-							m_desktop->multi_monitor=true;
-							if (m_desktop->requested_multi_monitor && m_desktop->nr_monitors>1) m_desktop->multi_monitor=true;
-							else m_desktop->multi_monitor=false;							
-							if ( old_monitor!=m_desktop->multi_monitor) monitor_changed=true;
-						}
-
-					//*******************************************************
-					// Reinitialize buffers,color, etc
-					// monitor change, for non driver, use another buffer
-					//*******************************************************
-					if (!m_server->IsThereFileTransBusy())
-					if (m_desktop->m_displaychanged || vncService::InputDesktopSelected()==0 || m_desktop->m_hookswitch || (monitor_changed && !m_desktop->m_videodriver))
-					{
-								// Attempt to close the old hooks
-								// shutdown(true) driver is reinstalled without shutdown,(shutdown need a 640x480x8 switch)
-								vnclog.Print(LL_INTERR, VNCLOG("m_desktop->Shutdown"));
-								monitor_changed=false;
-								if (!m_desktop->Shutdown())
-									{
-										vnclog.Print(LL_INTERR, VNCLOG("Shutdown KillAuthClients\n"));
-										m_server->KillAuthClients();
-										return false;
-									}					
-								bool fHookDriverWanted = (FALSE != m_desktop->m_hookdriver);
-                                Sleep(1000);
-								vnclog.Print(LL_INTERR, VNCLOG("m_desktop->Startup"));
-								if (m_desktop->Startup() != 0)
-									{
-										vnclog.Print(LL_INTERR, VNCLOG("Startup KillAuthClients\n"));
-										m_server->KillAuthClients();
-										SetEvent(m_desktop->restart_event);
-										return false;
-									}
-
-								if (m_desktop->m_videodriver)
-									{
-										if (!XRichCursorEnabled) m_desktop->m_videodriver->HardwareCursor();
-										else m_desktop->m_videodriver->NoHardwareCursor();
-									}
-								m_server->SetScreenOffset(m_desktop->m_ScreenOffsetx,m_desktop->m_ScreenOffsety,m_desktop->nr_monitors);
-
-								// sf at 2003 - After a new Startup(), we check if the required video driver
-								// is actually available. If not, we force hookdll
-								// No need for m_hookswitch again because the driver is NOT available anyway.
-								// All the following cases are now handled:
-								// 1. Desktop thread starts with "Video Driver" checked and no video driver available...
-								//    -> HookDll forced (handled by the first InitHookSettings() after initial Startup() call
-								// 2. Desktop Thread starts without "Video Driver" checked but available driver
-								//    then the user checks "Video Driver" -> Video Driver used
-								// 3. Desktop thread starts with "Video Driver" and available driver used
-								//    Then driver is switched off (-> hookDll) 
-								//    Then the driver is switched on again (-> hook driver used again)
-								// 4. Desktop thread starts without "Video Driver" checked and no driver available
-								//    then the users checks "Video Driver" 
-								if (fHookDriverWanted && m_desktop->m_videodriver == NULL)
-									{
-										vnclog.Print(LL_INTERR, VNCLOG("m_videodriver == NULL \n"));
-										m_desktop->SethookMechanism(true, false); 	// InitHookSettings() would work as well;
-									}
-								stop_hookwatch=true;
-								vnclog.Print(LL_INTERR, VNCLOG("threadHandle \n"));
-								if (threadHandle)
-								{
-									WaitForSingleObject( threadHandle, INFINITE );
-									CloseHandle(threadHandle);
-									stop_hookwatch=false;
-									threadHandle=NULL;
-								}
-								vnclog.Print(LL_INTERR, VNCLOG("threadHandle2 \n"));
-
-					}
-					//*******************************************************
-					// end reinit
-					//*******************************************************
-
-					if ((m_desktop->m_scrinfo.framebufferWidth != oldscrinfo.framebufferWidth) ||
-						(m_desktop->m_scrinfo.framebufferHeight != oldscrinfo.framebufferHeight ||
-							m_desktop->m_SWtoDesktop==TRUE ))
-							{
-								screensize_changed=true;	
-								vnclog.Print(LL_INTINFO, VNCLOG("SCR: new screen format %dx%dx%d\n"),
-								m_desktop->m_scrinfo.framebufferWidth,
-								m_desktop->m_scrinfo.framebufferHeight,
-								m_desktop->m_scrinfo.format.bitsPerPixel);
-							}
-
-					m_desktop->m_displaychanged = FALSE;
-					m_desktop->m_hookswitch = FALSE;
-					m_desktop->Hookdll_Changed = m_desktop->On_Off_hookdll; // Set the hooks again if necessary !
-					m_desktop->m_SWtoDesktop=FALSE;
-					//****************************************************************************
-					//************* SCREEN SIZE CHANGED 
-					//****************************************************************************
-
-					if (screensize_changed)
-						{
-							vnclog.Print(LL_INTERR, VNCLOG("Size changed\n"));
-							POINT CursorPos;
-							m_desktop->SWinit();
-							m_desktop->GetQuarterSize();
-							GetCursorPos(&CursorPos);
-							CursorPos.x -= m_desktop->m_ScreenOffsetx;
-							CursorPos.y -= m_desktop->m_ScreenOffsety;
-							m_desktop->m_cursorpos.tl = CursorPos;
-							m_desktop->m_cursorpos.br = rfb::Point(GetSystemMetrics(SM_CXCURSOR),
-							GetSystemMetrics(SM_CYCURSOR)).translate(CursorPos);
-							m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);
-							// Adjust the UpdateTracker clip region
-							updates.set_clip_region(m_desktop->m_Cliprect);
-							m_desktop->m_buffer.ClearCache();
-						}
-					if (monitor_changed)
-					{
-						// we are using the driver, so a monitor change is a view change, like a special kind of single window
-						// m_desktop->current_monitor is the new monitor we want to see
-						// monitor size mymonitor[m_desktop->current_monitor-1]
-						// m_SWOffset is used by the encoders to send the correct coordinates to the viewer
-						// Cliprect, buffer coordinates
-						if (m_desktop->multi_monitor)
-						{
-							m_desktop->m_SWOffsetx=0;
-							m_desktop->m_SWOffsety=0;
-							m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);
-
-							m_desktop->m_Cliprect.tl.x=0;
-							m_desktop->m_Cliprect.tl.y=0;
-							m_desktop->m_Cliprect.br.x=m_desktop->mymonitor[2].offsetx+m_desktop->mymonitor[2].Width-m_desktop->mymonitor[2].offsetx;
-							m_desktop->m_Cliprect.br.y=m_desktop->mymonitor[2].offsety+m_desktop->mymonitor[2].Height-m_desktop->mymonitor[2].offsety;
-						}
-						else
-						{
-							m_desktop->m_SWOffsetx=m_desktop->mymonitor[0].offsetx-m_desktop->mymonitor[2].offsetx;
-							m_desktop->m_SWOffsety=m_desktop->mymonitor[0].offsety-m_desktop->mymonitor[2].offsety;
-							m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);
-
-							m_desktop->m_Cliprect.tl.x=m_desktop->mymonitor[0].offsetx-m_desktop->mymonitor[2].offsetx;
-							m_desktop->m_Cliprect.tl.y=m_desktop->mymonitor[0].offsety-m_desktop->mymonitor[2].offsety;
-							m_desktop->m_Cliprect.br.x=m_desktop->mymonitor[0].offsetx+m_desktop->mymonitor[0].Width-m_desktop->mymonitor[2].offsetx;
-							m_desktop->m_Cliprect.br.y=m_desktop->mymonitor[0].offsety+m_desktop->mymonitor[0].Height-m_desktop->mymonitor[2].offsety;
-						}
-
-
-
-						vnclog.Print(LL_INTERR, VNCLOG("***********###############************ %i %i %i %i %i %i\n"),m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety
-							,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y,m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y);
-
-
-						rgncache.assign_union(rfb::Region2D(m_desktop->m_Cliprect));
-						updates.set_clip_region(m_desktop->m_Cliprect);				
-						m_desktop->m_buffer.ClearCache();
-						m_desktop->m_buffer.BlackBack();
-
-
-					}
-					m_desktop->m_buffer.ClearCache();
-					m_desktop->m_buffer.BlackBack();
-					InvalidateRect(NULL,NULL,TRUE);
-					rgncache.assign_union(rfb::Region2D(m_desktop->m_Cliprect));
-					
-					if (memcmp(&m_desktop->m_scrinfo.format, &oldscrinfo.format, sizeof(rfbPixelFormat)) != 0)
-						{
-							vnclog.Print(LL_INTERR, VNCLOG("Format changed\n"));
-							m_server->UpdatePalette(false); // changed no lock ok
-							m_server->UpdateLocalFormat(false); // changed no lock ok
-						}
-
-					if (screensize_changed) 
-						{
-							screensize_changed=false;
-							m_server->SetNewSWSize(m_desktop->m_scrinfo.framebufferWidth,m_desktop->m_scrinfo.framebufferHeight,FALSE);//changed no lock ok
-							m_server->SetScreenOffset(m_desktop->m_ScreenOffsetx,m_desktop->m_ScreenOffsety,m_desktop->nr_monitors);// no lock ok
-						}
-					
-					if (monitor_changed)
-						{
-								monitor_changed=false;
-								if (m_desktop->multi_monitor)
-									m_server->SetNewSWSize(m_desktop->mymonitor[2].Width,m_desktop->mymonitor[2].Height,TRUE); //changed no lock ok
-								else
-									m_server->SetNewSWSize(m_desktop->mymonitor[0].Width,m_desktop->mymonitor[0].Height,TRUE); //changed no lock ok
-						}
-
-		/*#ifdef _DEBUG
-					//char			szText[256];
-					sprintf(szText," ++++++ Mutex unlock display changes\n");
-					OutputDebugString(szText);		
-			#endif*/
-			}// end lock
-	}
-
-	return true;
-}
-
-void vncDesktopThread::do_polling(HANDLE& threadHandle, rfb::Region2D& rgncache, int& fullpollcounter, bool cursormoved)
-{
-	// POLL PROBLEM AREAS
-	// We add specific areas of the screen to the region cache,
-	// causing them to be fetched for processing.
-	// if can_be_hooked==false, hooking is temp disabled, use polling
-
-	if (m_desktop->SetHook && g_obIPC.listall()!=NULL && m_desktop->can_be_hooked) 
-	{
-		DWORD dwTId(0);
-		if (threadHandle==NULL) threadHandle = CreateThread(NULL, 0, hookwatch, this, 0, &dwTId);
-		if (Handle_Ringbuffer(g_obIPC.listall(),rgncache)) return;
-	}
-	DWORD lTime = timeGetTime();
-
-	m_desktop->m_buffer.SetAccuracy(m_desktop->m_server->TurboMode() ? 8 : 4); 
-
-	//if (cursormoved)
-	//	m_lLastMouseMoveTime = lTime;
-	if (cursormoved) m_desktop->idle_counter=0;
-	if ((m_desktop->m_server->PollFullScreen() /*&& !cursormoved*/) || (!m_desktop->can_be_hooked && !cursormoved))
-	{
-		int timeSinceLastMouseMove = lTime - m_lLastMouseMoveTime;
-		if (timeSinceLastMouseMove > 150) // 150 ms pause after a Mouse move 
-		{
-			m_lLastMouseMoveTime = lTime;
-			++fullpollcounter;
-			rfb::Rect r = m_desktop->GetSize();
-			// THIS FUNCTION IS A PIG. It uses too much CPU on older machines (PIII, P4)
-			if (vncService::InputDesktopSelected()!=2)
-			{
-				if (m_desktop->FastDetectChanges(rgncache, r, 0, true)) capture=false;
-			}
-			else
-			{
-				capture=false;
-			}
-
-			/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," Capture %i\n",capture);
-										OutputDebugString(szText);		
-			#endif*/
-
-			// force full screen scan every three seconds after the mouse stops moving
-			if (fullpollcounter > 200) 
-			{
-				rgncache.assign_union(m_desktop->m_Cliprect);
-				fullpollcounter = 0;
-			}
-		}
-	}
-		
-    HWND hWndToPoll = 0;
-	if (m_desktop->m_server->PollForeground() || !m_desktop->can_be_hooked)
-	{
-		// Get the window rectangle for the currently selected window
-		hWndToPoll = GetForegroundWindow();
-		if (hWndToPoll != NULL)
-			 PollWindow(rgncache, hWndToPoll);
-		
-	}
-	
-	if (m_desktop->m_server->PollUnderCursor() || !m_desktop->can_be_hooked)
-	{
-		// Find the mouse position
-		POINT mousepos;
-		if (GetCursorPos(&mousepos))
-		{
-			// Find the window under the mouse
-			HWND hwnd = WindowFromPoint(mousepos);
-            // exclude the foreground window (done above) and desktop
-			if (hwnd != NULL && hwnd != hWndToPoll && hwnd != GetDesktopWindow())
-				 PollWindow(rgncache, hwnd);
-
-		}
-	}
-}
-void *
-vncDesktopThread::run_undetached(void *arg)
-{
-	//*******************************************************
-	// INIT
-	//*******************************************************
-	//testBench();
-	capture=true;
-	vnclog.Print(LL_INTERR, VNCLOG("Hook changed 1\n"));
-	// Save the thread's "home" desktop, under NT (no effect under 9x)
-	m_desktop->m_home_desktop = GetThreadDesktop(GetCurrentThreadId());
-    vnclog.Print(LL_INTERR, VNCLOG("Hook changed 2\n"));
-	// Attempt to initialise and return success or failure
-	m_desktop->KillScreenSaver();
-	{
-		keybd_event(VK_CONTROL, 0, 0, 0);
-        keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
-		Sleep(500); //Give screen some time to kill screensaver
-	}
-    DWORD startup_error;
-	if ((startup_error = m_desktop->Startup()) != 0)
-	{
-		//TAG14
-		vncService::SelectHDESK(m_desktop->m_home_desktop);
-		if (m_desktop->m_input_desktop)
-			CloseDesktop(m_desktop->m_input_desktop);
-		ReturnVal(startup_error);
-		return NULL;
-	}
-	// Succeeded to initialise ok
-	ReturnVal(0);
-
-	//telling running viewers to wait until first update
-	m_server->InitialUpdate(false);
-	// sf at 2003 - Done here to take into account if the driver is actually activated
-	m_desktop->InitHookSettings(); 
-	initialupdate=false;
-
-	// We set a flag inside the desktop handler here, to indicate it's now safe
-	// to handle clipboard messages
-	m_desktop->SetClipboardActive(TRUE);
-
-	// All changes in the state of the display are stored in a local
-	// UpdateTracker object, and are flushed to the vncServer whenever
-	// client updates are about to be triggered
-	rfb::SimpleUpdateTracker clipped_updates;
-	rfb::ClippedUpdateTracker updates(clipped_updates, m_desktop->m_Cliprect);
-	clipped_updates.enable_copyrect(true);
-	rfb::Region2D rgncache;
-
-
-	// Incoming update messages are collated into a single region cache
-	// The region cache areas are checked for changes before an update
-	// is triggered, and the changed areas are passed to the UpdateTracker
-	rgncache = m_desktop->m_Cliprect;
-	m_server->SetScreenOffset(m_desktop->m_ScreenOffsetx,m_desktop->m_ScreenOffsety,m_desktop->nr_monitors);
-
-	// The previous cursor position is stored, to allow us to erase the
-	// old instance whenever it moves.
-	rfb::Point oldcursorpos;
-
-	// The driver gives smaller rectangles to check
-	// if Accuracy is 4 you eliminate pointer updates
-	if (m_desktop->VideoBuffer() && m_desktop->m_hookdriver)
-		m_desktop->m_buffer.SetAccuracy(4);
-
-	//init vars
-	m_desktop->m_SWSizeChanged=FALSE;
-	m_desktop->m_SWtoDesktop=FALSE;
-	m_desktop->m_SWmoved=FALSE;
-	m_desktop->Hookdll_Changed = true;
-	m_desktop->m_displaychanged=false;
-	m_desktop->m_hookswitch=false;
-	m_desktop->m_hookinited = FALSE;
-
-	// Set driver cursor state
-	XRichCursorEnabled= (FALSE != m_desktop->m_server->IsXRichCursorEnabled());
-	if (!XRichCursorEnabled && m_desktop->m_videodriver) m_desktop->m_videodriver->HardwareCursor();
-	if (XRichCursorEnabled && m_desktop->m_videodriver) m_desktop->m_videodriver->NoHardwareCursor();
-	if (XRichCursorEnabled) m_server->UpdateCursorShape();
-
-	InvalidateRect(NULL,NULL,TRUE);
-	oldtick=timeGetTime();
-	oldtick2=timeGetTime();
-	int fullpollcounter=0;
-	//*******************************************************
-	// END INIT
-	//*******************************************************
-	// START PROCESSING DESKTOP MESSAGES
-	/////////////////////
-	HANDLE threadHandle=NULL;
-	stop_hookwatch=false;
-	/////////////////////
-	// We use a dynmiac value based on cpu usage
-    //DWORD MIN_UPDATE_INTERVAL=33;
-	/////////////////////
-	bool looping=true;
-	int waiting_update=0;
-	SetEvent(m_desktop->restart_event);
-	///
-	Sleep(1000);
-	rgncache.assign_union(rfb::Region2D(m_desktop->m_Cliprect));
-	if (m_desktop->VideoBuffer() && m_desktop->m_hookdriver)
-											{
-												m_desktop->m_buffer.GrabRegion(rgncache,true,true);
-											}
-										else
-											{
-												m_desktop->m_buffer.GrabRegion(rgncache,false,true);
-											}
-	//telling running viewers to wait until first update, done
-	if  (m_server->MaxCpu() <50)
-		{
-			MIN_UPDATE_INTERVAL_MIN=50;
-			MIN_UPDATE_INTERVAL_MAX=1000;
-		}
-	if (m_server->IsUltraVncViewer()) first_run=true;
-	else first_run=false;
-
-	while (looping && !fShutdownOrdered)
-	{		
-		DWORD result;
-		newtick = timeGetTime();
-		int waittime;
-		waittime=33;
-		if (m_desktop->VideoBuffer() && m_desktop->m_hookdriver) 
-		{
-			int fastcounter=0;
-			POINT cursorpos;
-			while (m_desktop->m_videodriver->oldaantal==m_desktop->pchanges_buf->counter)
-			{
-				Sleep(5);
-				fastcounter++;
-				if (fastcounter>20)
-				{
-					/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText,"fastcounter\n");
-										OutputDebugString(szText);		
-					#endif*/
-					break;
-				}
-				if (GetCursorPos(&cursorpos) && 
-										((cursorpos.x != oldcursorpos.x) ||
-										(cursorpos.y != oldcursorpos.y))) break;
-			}
-			waittime=0;
-		}
-		/*else
-		{
-			waittime=waittime-(waiting_update*10);
-		}
-		if (waittime<0) waittime=0;
-		if (waittime>100) waittime=100;*/
-
-		result=WaitForMultipleObjects(6,m_desktop->trigger_events,FALSE,waittime);
-		{
-			//#ifdef _DEBUG
-			//							char			szText[256];
-			//							sprintf(szText,"WaitForMultipleObjects %i\n",result );
-			//							OutputDebugString(szText);		
-			//#endif
-
-			// We need to wait until restart is done
-			// else wait_timeout goes in to looping while sink window is not ready
-			// if no window could be started in 10 seconds something went wrong, close
-			// desktop thread.
-			DWORD status=WaitForSingleObject(m_desktop->restart_event,10000);
-			if (status==WAIT_TIMEOUT) looping=false;
-			switch(result)
-			{
-				case WAIT_TIMEOUT:
-				case WAIT_OBJECT_0:
-				{
-				waiting_update=0;
-				ResetEvent(m_desktop->trigger_events[0]);
-							{
-								//measure current cpu usage of winvnc
-								if (fullpollcounter==10 || fullpollcounter==0 || fullpollcounter==5) cpuUsage = usage.GetUsage();
-								if (cpuUsage > m_server->MaxCpu()) 
-									MIN_UPDATE_INTERVAL+=10;
-								else MIN_UPDATE_INTERVAL-=10;
-								if (MIN_UPDATE_INTERVAL<MIN_UPDATE_INTERVAL_MIN) MIN_UPDATE_INTERVAL=MIN_UPDATE_INTERVAL_MIN;
-								if (MIN_UPDATE_INTERVAL>MIN_UPDATE_INTERVAL_MAX) MIN_UPDATE_INTERVAL=MIN_UPDATE_INTERVAL_MAX;
-
-
-					//			vnclog.Print(LL_INTERR, VNCLOG("!PeekMessage \n"));
-								// MAX 30fps
-								newtick = timeGetTime(); // Better resolution than GetTickCount ;)
-								if ((newtick-oldtick)<MIN_UPDATE_INTERVAL)
-								{
-									Sleep(MIN_UPDATE_INTERVAL-(newtick-oldtick));
-									//continue;  Verify, this can cause screen lockup
-									// We need another PeekMessage, but this is only done
-									// by hookdll and viewer asking for new update
-									// can cause a very long wait time
-								}	
-								
-								/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," cpu2: %d %i %i\n",cpuUsage,MIN_UPDATE_INTERVAL,newtick-oldtick);
-										OutputDebugString(szText);		
-								#endif*/
-								//oldtick=newtick;
-								if (m_desktop->VideoBuffer() && m_desktop->m_hookdriver) handle_driver_changes(rgncache,updates);
-								m_desktop->m_update_triggered = FALSE;
-								g_update_triggered = FALSE;
-								//if (m_desktop->m_timerid==NULL) m_desktop->m_timerid = SetTimer(m_desktop->m_hwnd, 1, 100, NULL);
-
-								//*******************************************************
-								// HOOKDLL START STOP need to be executed from the thread
-								//*******************************************************
-								if (m_desktop->Hookdll_Changed && !m_desktop->m_hookswitch)
-								{
-									vnclog.Print(LL_INTERR, VNCLOG("Hook changed \n"));
-									m_desktop->StartStophookdll(m_desktop->On_Off_hookdll);
-									if (m_desktop->On_Off_hookdll)
-										m_desktop->m_hOldcursor = NULL; // Force mouse cursor grabbing if hookdll On
-									// Todo: in case of hookdriver Off - Hoodll On -> hookdriver On - Hoodll Off
-									// we must send an empty mouse cursor to the clients so they get rid of their local
-									// mouse cursor bitmap
-									m_desktop->Hookdll_Changed=false;
-								}
-								//*******************************************************
-								// SCREEN DISPLAY HAS CHANGED, RESTART DRIVER (IF Used)
-								//*******************************************************
-								if (!m_server->IsThereFileTransBusy())
-									if (!handle_display_change(threadHandle, rgncache, clipped_updates, updates))
-									{
-										//failed we need to quit thread
-										looping=false;
-										break;
-									}
-								//*******************************************************
-								// END SCREEN DISPLAY HAS CHANGED
-								//*******************************************************
-					//			m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);
-							
-								//*******************************************************************
-								// SINGLE WINDOW 
-								// size SW changed
-								// Position change -->change offsets
-								//*******************************************************************
-								bool SWSizeChanged=false;
-								if (m_server->SingleWindow())
-								{
-									omni_mutex_lock l(m_desktop->m_update_lock);
-									m_desktop->GetQuarterSize();
-									m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);
-									//SW size changed
-									if (m_desktop->m_SWSizeChanged)
-									{
-										SWSizeChanged=true;
-										m_desktop->m_SWSizeChanged=FALSE;
-										m_desktop->GetQuarterSize();
-										rgncache.assign_union(rfb::Region2D(m_desktop->m_Cliprect));
-					//					vnclog.Print(LL_INTINFO, VNCLOG("4 %i %i %i %i \n"),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y);
-										updates.set_clip_region(m_desktop->m_Cliprect);
-										m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);				
-										m_desktop->m_buffer.ClearCache();
-										m_desktop->m_buffer.BlackBack();
-									}
-									//SW position changed
-									if (m_desktop->m_SWmoved)
-									{
-										m_desktop->m_SWmoved=FALSE;
-										updates.set_clip_region(m_desktop->m_Cliprect);
-										m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety);				
-										rgncache.assign_union(rfb::Region2D(m_desktop->m_Cliprect));
-					//					vnclog.Print(LL_INTINFO, VNCLOG("5 %i %i %i %i \n"),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y);
-										m_desktop->m_buffer.ClearCache();
-										m_desktop->m_buffer.BlackBack();
-									}
-
-								if (m_server->SingleWindow() && SWSizeChanged)
-									{
-										m_server->SetNewSWSize(m_desktop->m_SWWidth,m_desktop->m_SWHeight,FALSE);
-										m_server->SetScreenOffset(m_desktop->m_ScreenOffsetx,m_desktop->m_ScreenOffsety,m_desktop->nr_monitors);
-									}
-								}// end update lock
-								
-								////////////////////////////////////////////////////////////////////////////////
-								// END DYNAMIC CHANGES
-								////////////////////////////////////////////////////////////////////////////////
-
-								//Beep(1000,10);
-								//
-								// CALCULATE CHANGES
-								m_desktop->m_UltraEncoder_used=m_desktop->m_server->IsThereAUltraEncodingClient();
-					//			vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted B\n"));
-//#ifdef _DEBUG
-////										char			szText[256];
-//									sprintf(szText," m_desktop->m_server->UpdateWanted check\n");
-//										OutputDebugString(szText);		
-//#endif
-								omni_mutex_lock l(m_desktop->m_update_lock);
-								if (m_desktop->m_server->UpdateWanted())
-								{
-									oldtick=newtick;
-					//				vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted N\n"));
-									//TEST4
-									// Re-render the mouse's old location if it's moved
-									bool cursormoved = false;
-									POINT cursorpos;
-									if (GetCursorPos(&cursorpos) && 
-										((cursorpos.x != oldcursorpos.x) ||
-										(cursorpos.y != oldcursorpos.y)))
-									{
-					//					vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted M %i %i %i %i\n"),cursorpos.x, oldcursorpos.x,cursorpos.y,oldcursorpos.y);
-										cursormoved = TRUE;
-										oldcursorpos = rfb::Point(cursorpos);
-										// nyama/marscha - PointerPos. Inform clients about mouse move.
-										m_desktop->m_server->UpdateMouse();
-										if (MyGetCursorInfo)
-										{
-											MyCURSORINFO cinfo;
-											cinfo.cbSize=sizeof(MyCURSORINFO);
-											MyGetCursorInfo(&cinfo);
-											m_desktop->SetCursor(cinfo.hCursor);
-										}
-									}
-
-									//****************************************************************************
-									//************* Check for moved windows
-									//****************************************************************************
-									// Back removed, to many artifacts
-									bool s_moved=false;
-									//if ((cpuUsage >= m_server->MaxCpu()/2))
-									{
-									if (!m_desktop->m_hookdriver && !m_server->SingleWindow()) 
-											s_moved=m_desktop->CalcCopyRects(updates);
-									}
-								
-									//****************************************************************************
-									//************* Polling ---- no driver
-									//****************************************************************************
-									if (!m_desktop->m_hookdriver || !m_desktop->can_be_hooked)
-									{
-										if (!s_moved)
-										do_polling(threadHandle, rgncache, fullpollcounter, cursormoved);
-									}
-									//****************************************************************************
-									//************* driver  No polling
-									//****************************************************************************
-									else 
-									{
-										// long lTime = timeGetTime();
-										if (cursormoved)
-										{
-											// if (lTime - m_desktop->m_lLastMouseUpdateTime < 200)
-											// 	continue;
-											m_desktop->m_buffer.SetAccuracy(m_desktop->m_server->TurboMode() ? 2 : 1);
-											// m_desktop->m_lLastMouseUpdateTime = lTime;
-										}
-										else
-											// 4 is not that bad...but not perfect (especially with tree branchs display)
-											m_desktop->m_buffer.SetAccuracy(m_desktop->m_server->TurboMode() ? 4 : 2); 
-									}
-									
-									
-									// PROCESS THE MOUSE POINTER
-									// Some of the hard work is done in clients, some here
-									// This code fetches the desktop under the old pointer position
-									// but the client is responsible for actually encoding and sending
-									// it when required.
-									// This code also renders the pointer and saves the rendered position
-									// Clients include this when rendering updates.
-									// The code is complicated in this way because we wish to avoid 
-									// rendering parts of the screen the mouse moved through between
-									// client updates, since in practice they will probably not have changed.
-								
-									if (cursormoved && !m_desktop->m_hookdriver)
-										{
-											if (!m_desktop->m_cursorpos.is_empty())
-											{
-												// Cursor position seems to be outsite the bounding
-												// When you make the screen smaller
-												// add extra check
-												rfb::Rect rect;
-												int x = m_desktop->m_cursorpos.tl.x;
-												int w = m_desktop->m_cursorpos.br.x-x;
-												int y = m_desktop->m_cursorpos.tl.y;
-												int h = m_desktop->m_cursorpos.br.y-y;
-												if (ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-													m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y))
-													{
-														rect.tl.x = x;
-														rect.br.x = x+w;
-														rect.tl.y = y;
-														rect.br.y = y+h;
-														rgncache.assign_union(rect);
-					//									vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y);
-					//									vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y);
-													}
-											}
-
-										}
-									
-
-									{
-										// Prevent any clients from accessing the Buffer
-										omni_mutex_lock ll(m_desktop->m_update_lock);
-										
-										// CHECK FOR COPYRECTS
-										// This actually just checks where the Foreground window is
-										// Back added, no need to stop polling during move
-										if ((cpuUsage < m_server->MaxCpu()/2))
-										{
-										if (!m_desktop->m_hookdriver && !m_server->SingleWindow() && !s_moved) 
-											s_moved=m_desktop->CalcCopyRects(updates);
-										}
-										
-										// GRAB THE DISPLAY
-										// Fetch data from the display to our display cache.
-										// Update the scaled rects when using server side scaling
-										// something wrong inithooking again
-										// We make sure no updates are in the regions
-										// sf at 2002 - Added "&& m_desktop->m_hookdriver"
-										// Otherwise we're still getting driver updates (from shared memory buffer)
-										// after a m_hookdriver switching from on to off 
-										// (and m_hookdll from off to on) that causes mouse cursor garbage,
-										// or missing mouse cursor.
-										/*char tempchar[10];
-										if ((newtick-oldtick2) != 0) itoa(1000/((newtick-oldtick2)),tempchar,10);
-										oldtick2=newtick;
-										m_desktop->m_buffer.WriteMessageOnScreen(tempchar);*/
-										if (m_desktop->VideoBuffer() && m_desktop->m_hookdriver)
-											{
-												m_desktop->m_buffer.GrabRegion(rgncache,true,capture);
-											}
-										else
-											{
-												m_desktop->m_buffer.GrabRegion(rgncache,false,capture);
-											}
-/*#ifdef _DEBUG
-										char			szText[256];
-										sprintf(szText," capture %i\n",capture);
-										OutputDebugString(szText);		
-#endif*/
-										capture=true;
-											
-										// sf at 2002 - v1.1.x - Mouse handling
-										// If one client, send cursor shapes only when the cursor changes.
-										// This is Disabled for now.
-										if( !XRichCursorEnabled==m_desktop->m_server->IsXRichCursorEnabled())
-											{
-												XRichCursorEnabled= (FALSE != m_desktop->m_server->IsXRichCursorEnabled());
-												if (m_desktop->m_videodriver)
-														{
-																if (!XRichCursorEnabled) m_desktop->m_videodriver->HardwareCursor();
-																else m_desktop->m_videodriver->NoHardwareCursor();
-														}
-
-											}
-										if (m_desktop->m_server->IsXRichCursorEnabled() && !m_desktop->m_UltraEncoder_used)
-											{
-												if (m_desktop->m_hcursor != m_desktop->m_hOldcursor || m_desktop->m_buffer.IsShapeCleared())
-														{
-																m_desktop->m_hOldcursor = m_desktop->m_hcursor;
-																m_desktop->m_buffer.SetCursorPending(TRUE);
-																if (!m_desktop->m_hookdriver) m_desktop->m_buffer.GrabMouse(); // Grab mouse cursor in all cases
-																m_desktop->m_server->UpdateMouse();
-																rfb::Rect rect;
-																int x = m_desktop->m_cursorpos.tl.x;
-																int w = m_desktop->m_cursorpos.br.x-x;
-																int y = m_desktop->m_cursorpos.tl.y;
-																int h = m_desktop->m_cursorpos.br.y-y;
-																if (ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-																	m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y))
-																		{
-																			rect.tl.x = x;
-																			rect.br.x = x+w;
-																			rect.tl.y = y;
-																			rect.br.y = y+h;
-																			rgncache.assign_union(rect);
-					//														vnclog.Print(LL_INTINFO, VNCLOG("7 %i %i %i %i \n"),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y);
-					//														vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y);
-																		}
-																m_server->UpdateCursorShape();
-																}
-											}
-										else if (!m_desktop->m_hookdriver)// If several clients, send them all the mouse updates
-											{												
-												// Render the mouse
-												//if (!m_desktop->VideoBuffer())
-												m_desktop->m_buffer.GrabMouse();
-												
-												if (cursormoved /*&& !m_desktop->m_buffer.IsCursorUpdatePending()*/) 
-															{
-																// Inform clients that it has moved
-																m_desktop->m_server->UpdateMouse();
-																// Get the buffer to fetch the pointer bitmap
-																if (!m_desktop->m_cursorpos.is_empty())
-																{
-																	rfb::Rect rect;
-																int x = m_desktop->m_cursorpos.tl.x;
-																int w = m_desktop->m_cursorpos.br.x-x;
-																int y = m_desktop->m_cursorpos.tl.y;
-																int h = m_desktop->m_cursorpos.br.y-y;
-																if (ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y,
-																	m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y))
-																		{
-																			rect.tl.x = x;
-																			rect.br.x = x+w;
-																			rect.tl.y = y;
-																			rect.br.y = y+h;
-																			rgncache.assign_union(rect);
-																		}
-																}
-
-															}
-												}	
-										
-											
-										// SCAN THE CHANGED REGION FOR ACTUAL CHANGES
-										// The hooks return hints as to areas that may have changed.
-										// We check the suggested areas, and just send the ones that
-										// have actually changed.
-										// Note that we deliberately don't check the copyrect destination
-										// here, to reduce the overhead & the likelihood of corrupting the
-										// backbuffer contents.
-										rfb::Region2D checkrgn;
-										rfb::Region2D changedrgn;
-										rfb::Region2D cachedrgn;
-
-											
-										//Update the backbuffer for the copyrect region
-										if (!clipped_updates.get_copied_region().is_empty()) 
-											{
-												rfb::UpdateInfo update_info;
-												rfb::RectVector::const_iterator i;
-												clipped_updates.get_update(update_info);
-												if (!update_info.copied.empty()) 
-													{
-														for (i=update_info.copied.begin(); i!=update_info.copied.end(); i++) 						
-															m_desktop->m_buffer.CopyRect(*i, update_info.copy_delta);
-													}
-											}
-										//Remove the copyrect region from the other updates					
-										//checkrgn = rgncache.union_(clipped_updates.get_copied_region());	
-										checkrgn = rgncache.subtract(clipped_updates.get_copied_region());	
-										//make sure the copyrect is checked next update
-										if (!clipped_updates.get_copied_region().is_empty() && (cpuUsage < m_server->MaxCpu()/2))
-										{
-
-											rfb::UpdateInfo update_info;
-												rfb::RectVector::const_iterator i;
-												clipped_updates.get_update(update_info);
-												if (!update_info.copied.empty()) 
-													{
-														for (i=update_info.copied.begin(); i!=update_info.copied.end(); i++) 						
-														{
-															rfb::Rect rect;
-															rect.br.x=i->br.x+4;
-															rect.br.y=i->br.y+4;
-															rect.tl.x=i->tl.x-4;
-															rect.tl.y=i->tl.y-4;
-															rect = rect.intersect(m_desktop->m_Cliprect);
-															rgncache=rgncache.union_(rect);
-															rfb::Rect src = rect.translate(update_info.copy_delta.negate());
-															src = src.intersect(m_desktop->m_Cliprect);
-															rgncache=rgncache.union_(src);
-														}
-													}
-										}
-										else
-											rgncache = clipped_updates.get_copied_region();
-										
-										//Check all regions for changed and cached parts
-										//This is very cpu intensive, only check once for all viewers
-										if (!checkrgn.is_empty())
-											m_desktop->m_buffer.CheckRegion(changedrgn,cachedrgn, checkrgn);
-										if (!initialupdate)
-											{
-												m_server->InitialUpdate(true);
-												initialupdate=true;
-											}
-										updates.add_changed(changedrgn);
-										updates.add_cached(cachedrgn);
-												
-										clipped_updates.get_update(m_server->GetUpdateTracker());
-									}  // end mutex lock
-
-									// Clear the update tracker and region cache an solid
-									clipped_updates.clear();
-									// screen blanking
-									if (m_desktop->OldPowerOffTimeout!=0)
-										{
-										if (!m_server->BlackAlphaBlending() || m_desktop->VideoBuffer())
-											{
-												if(OSversion()!=2)
-												{
-												SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 1, NULL, 0);
-												SendMessage(m_desktop->m_hwnd,WM_SYSCOMMAND,SC_MONITORPOWER,(LPARAM)2);
-												}
-					// don't block input here, this is the wrong thread!
-											}
-										}
-					#ifdef AVILOG
-									if (m_desktop->AviGen) m_desktop->AviGen->AddFrame((BYTE*)m_desktop->m_DIBbits);
-					#endif
-								}
-								//newtick = timeGetTime(); 
-							}
-						}
-					break;
-
-				case WAIT_OBJECT_0+1:
-					ResetEvent(m_desktop->trigger_events[1]);
-					m_desktop->lock_region_add=true;
-					rgncache.assign_union(m_desktop->rgnpump);
-					m_desktop->rgnpump.clear();
-					m_desktop->lock_region_add=false;
-					waiting_update++;
-					break;
-				case WAIT_OBJECT_0+2:
-					ResetEvent(m_desktop->trigger_events[2]);
-					break;
-				case WAIT_OBJECT_0+3:
-					if (MyGetCursorInfo)
-					{
-						MyCURSORINFO cinfo;
-						cinfo.cbSize=sizeof(MyCURSORINFO);
-						MyGetCursorInfo(&cinfo);
-						m_desktop->SetCursor(cinfo.hCursor);
-					}
-					ResetEvent(m_desktop->trigger_events[3]);
-					break;
-				case WAIT_OBJECT_0+4:
-					rgncache.assign_union(m_desktop->m_Cliprect);
-					ResetEvent(m_desktop->trigger_events[4]);
-					break;
-				case WAIT_OBJECT_0+5:
-					//break to close
-					looping=false;
-					ResetEvent(m_desktop->trigger_events[5]);
-					break;
-			}
-		}
-		
-	}//while
-
-	stop_hookwatch=true;
-	if (threadHandle)
-	{
-		WaitForSingleObject( threadHandle, 5000 );
-		CloseHandle(threadHandle);
-	}
-	
-	m_desktop->SetClipboardActive(FALSE);
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread\n"));
-	
-	// Clear all the hooks and close windows, etc.
-    m_desktop->SetBlockInputState(false);
-	m_server->SingleWindow(false);
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread:SetBlockInputState\n"));
-	
-	// Clear the shift modifier keys, now that there are no remote clients
-	vncKeymap::ClearShiftKeys();
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread:ClearShiftKeys\n"));
-	
-	// Switch back into our home desktop, under NT (no effect under 9x)
-	//TAG14
-	HWND mywin=FindWindow("blackscreen",NULL);
-	if (mywin)SendMessage(mywin,WM_CLOSE, 0, 0);
-	g_DesktopThread_running=false;
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread:g_DesktopThread_running=false\n"));
-	m_desktop->Shutdown();
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread:m_desktop->Shutdown\n"));
-	return NULL;
-}
diff --git a/ica/win32/winvnc/winvnc/vncdesktopthread.h b/ica/win32/winvnc/winvnc/vncdesktopthread.h
deleted file mode 100644
index a71aae1..0000000
--- a/ica/win32/winvnc/winvnc/vncdesktopthread.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#if !defined(_WINVNC_VNCDESKTOPTHREAD)
-#define _WINVNC_VNCDESKTOPTHREAD
-#include "stdhdrs.h"
-#include "vncserver.h"
-#include "vnckeymap.h"
-#include "vncdesktop.h"
-#include "vncservice.h"
-#include "mmsystem.h"
-#include "IPC.h"
-#include "CpuUsage.h"
-
-typedef struct _CURSORINFO
-{
-    DWORD   cbSize;
-    DWORD   flags;
-    HCURSOR hCursor;
-    POINT   ptScreenPos;
-} MyCURSORINFO, *PMyCURSORINFO, *LPMyCURSORINFO;
-// The desktop handler thread
-// This handles the messages posted by RFBLib to the vncDesktop window
-typedef BOOL (WINAPI *_GetCursorInfo)(PMyCURSORINFO pci);
-extern bool g_DesktopThread_running;
-#define MSGFLT_ADD		1
-typedef BOOL (WINAPI *CHANGEWINDOWMESSAGEFILTER)(UINT message, DWORD dwFlag);
-
-extern const UINT RFB_SCREEN_UPDATE;
-extern const UINT RFB_COPYRECT_UPDATE;
-extern const UINT RFB_MOUSE_UPDATE;
-
-class vncDesktopThread : public omni_thread
-{
-public:
-	vncDesktopThread() {
-		/* BEGIN: Tobias Doerffel, 2011/11 */
-		capture = false;
-		first_run = false;
-		initialupdate = false;
-		XRichCursorEnabled = false;
-		m_screen_moved = false;
-		m_desktop = NULL;
-		m_server = NULL;
-		/* END: Tobias Doerffel, 2011/11 */
-
-		m_returnsig = NULL;
-		user32 = LoadLibrary("user32.dll");
-		MyGetCursorInfo=NULL;
-		if (user32) MyGetCursorInfo=(_GetCursorInfo )GetProcAddress(user32, "GetCursorInfo");
-		g_DesktopThread_running=true;
-
-		m_lLastMouseMoveTime = 0L;
-		
-		hUser32 = LoadLibrary("user32.dll");
-		CHANGEWINDOWMESSAGEFILTER pfnFilter = NULL;
-		if (hUser32)
-		{
-		pfnFilter =(CHANGEWINDOWMESSAGEFILTER)GetProcAddress(hUser32,"ChangeWindowMessageFilter");
-		if (pfnFilter) pfnFilter(RFB_SCREEN_UPDATE, MSGFLT_ADD);
-		if (pfnFilter) pfnFilter(RFB_COPYRECT_UPDATE, MSGFLT_ADD);
-		if (pfnFilter) pfnFilter(RFB_MOUSE_UPDATE, MSGFLT_ADD);
-		}
-		cpuUsage=0;
-		MIN_UPDATE_INTERVAL=33;
-		MIN_UPDATE_INTERVAL_MAX=500;
-		MIN_UPDATE_INTERVAL_MIN=33;
-		// replaced by macpu ini setting
-		MAX_CPU_USAGE=20;
-	};
-protected:
-	~vncDesktopThread() {
-		if (m_returnsig != NULL) delete m_returnsig;
-		if (user32) FreeLibrary(user32);
-		g_DesktopThread_running=false;
-		if (hUser32) FreeLibrary(hUser32);
-	};
-private:
-	bool handle_display_change(HANDLE& threadhandle, rfb::Region2D& rgncache, rfb::SimpleUpdateTracker& clipped_updates, rfb::ClippedUpdateTracker& updates);
-	void do_polling(HANDLE& threadHandle, rfb::Region2D& rgncache, int& fullpollcounter, bool cursormoved);
-
-public:
-	virtual BOOL Init(vncDesktop *desktop, vncServer *server);
-	virtual void *run_undetached(void *arg);
-	virtual void ReturnVal(DWORD result);
-	void PollWindow(rfb::Region2D &rgn, HWND hwnd);
-	// Modif rdv at 2002 - v1.1.x - videodriver
-	virtual BOOL handle_driver_changes(rfb::Region2D &rgncache,rfb::UpdateTracker &tracker);
-	virtual void copy_bitmaps_to_buffer(ULONG i,rfb::Region2D &rgncache,rfb::UpdateTracker &tracker);
-	bool Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache);
-	CIPC g_obIPC;
-	vncDesktop *m_desktop;
-
-protected:
-	vncServer *m_server;
-
-	omni_mutex m_returnLock;
-	omni_condition *m_returnsig;
-	DWORD m_return;
-	BOOL m_returnset;
-	bool m_screen_moved;
-	//bool lastsend;
-	HMODULE user32;
-	_GetCursorInfo MyGetCursorInfo;
-	bool XRichCursorEnabled;
-	DWORD newtick,oldtick,oldtick2;
-
-	DWORD m_lLastMouseMoveTime;
-	HMODULE  hUser32;
-	CProcessorUsage usage;
-	short cpuUsage;
-	DWORD MIN_UPDATE_INTERVAL;
-	DWORD MIN_UPDATE_INTERVAL_MAX;
-	DWORD MIN_UPDATE_INTERVAL_MIN;
-	DWORD MAX_CPU_USAGE;
-	bool capture;
-	bool first_run;
-	bool initialupdate;
-
-};
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncencodecorre.cpp b/ica/win32/winvnc/winvnc/vncencodecorre.cpp
deleted file mode 100644
index e0cc787..0000000
--- a/ica/win32/winvnc/winvnc/vncencodecorre.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeCoRRE
-
-// This file implements the vncEncoder-derived vncEncodeCoRRE class.
-// This class overrides some vncEncoder functions to produce a 
-// Compact RRE encoder.  Compact RRE (CoRRE) uses fewer bytes to
-// encode each subrect, which makes it faster in general.  It also
-// splits large rectangles up into ones of at most 256 pixels width
-// & height.  This results in better granularity to use for deciding
-// whether to send RAW or CoRRE/RRE. 
-
-#include "vncencodecorre.h"
-#include "rfb.h"
-#include "rfbMisc.h"
-#include <stdlib.h>
-#include <time.h>
-
-vncEncodeCoRRE::vncEncodeCoRRE()
-{
-	m_buffer = NULL;
-	m_bufflen = 0;
-
-	// Set some sensible defaults
-	m_maxwidth = 24;
-	m_maxheight = 24;
-	m_maxadjust = 1;
-
-	// Set the threshold up/down probability
-	m_threshold = 50;
-
-	// Seed the random number generator
-	srand((unsigned)time(NULL));
-
-	m_statsready = FALSE;
-	m_encodedbytes = 0;
-	m_rectbytes = 0;
-}
-
-vncEncodeCoRRE::~vncEncodeCoRRE()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-	}
-}
-
-void vncEncodeCoRRE::Init()
-{
-	vncEncoder::Init();
-}
-
-UINT vncEncodeCoRRE::RequiredBuffSize(UINT width, UINT height)
-{
-	rfb::Rect fullscreen = rfb::Rect(0, 0, width, height);
-	UINT codedrects;
-
-	// Work out how many rectangles the entire screen would
-	// be re-encoded to...
-	codedrects = NumCodedRects(fullscreen);
-
-	// The buffer size required is the size of raw data for the whole
-	// screen plus enough space for the required number of rectangle
-	// headers.
-	// This is inherently always greater than the RAW encoded size of
-	// the whole screen!
-	return (codedrects * sz_rfbFramebufferUpdateRectHeader) +
-			(width * height * m_remoteformat.bitsPerPixel)/8;
-}
-
-UINT
-vncEncodeCoRRE::NumCodedRects(const rfb::Rect &rect)
-{
-	// If we have any statistical data handy then adjust the CoRRE sizes
-	if (m_statsready)
-	{
-		m_statsready = FALSE;
-
-		UINT newscore = m_encodedbytes * m_lastrectbytes;
-		UINT oldscore = m_lastencodedbytes * m_rectbytes;
-
-		if (newscore <= oldscore)
-		{
-			// The change was a good one, so adjust the threshold accordingly!
-			m_threshold = max(5, min(95, m_threshold + m_maxadjust));
-
-			m_maxwidth = max(8, min(255, m_maxwidth + m_maxadjust));
-			m_maxheight = max(8, min(255, m_maxheight + m_maxadjust));
-		}
-		else
-		{
-			// The change was a bad one, so adjust the threshold accordingly!
-			// m_threshold = Max(5, Min(95, m_threshold - m_maxadjust));
-		}
-
-		// Now calculate a new adjustment and apply it
-		m_maxadjust = ((rand() % 99)<m_threshold) ? 1 : -1;
-		
-		// Prepare the stats data for next time...
-		m_lastencodedbytes = m_encodedbytes;
-		m_lastrectbytes = m_rectbytes;
-
-		m_encodedbytes = 0;
-		m_rectbytes = 0;
-	}
-
-	// Now return the number of rects that this one would encode to
-    if ((UINT)(rect.br.y-rect.tl.y) > m_maxheight)
-	{
-		rfb::Rect subrect1, subrect2;
-
-		// Find how many rects the two subrects would take
-		subrect1.tl.x = rect.tl.x;
-		subrect1.br.x = rect.br.x;
-		subrect1.tl.y = rect.tl.y;
-		subrect1.br.y = rect.tl.y + m_maxheight;
-
-		subrect2.tl.x = rect.tl.x;
-		subrect2.br.x = rect.br.x;
-		subrect2.tl.y = rect.tl.y + m_maxheight;
-		subrect2.br.y = rect.br.y;
-
-		return NumCodedRects(subrect1) + NumCodedRects(subrect2);
-	}
-
-    if ((UINT)(rect.br.x-rect.tl.x) > m_maxwidth)
-	{
-		rfb::Rect subrect1, subrect2;
-
-		// Find how many rects the two subrects would take
-		subrect1.tl.x = rect.tl.x;
-		subrect1.br.x = rect.tl.x + m_maxwidth;
-		subrect1.tl.y = rect.tl.y;
-		subrect1.br.y = rect.br.y;
-
-		subrect2.tl.x = rect.tl.x + m_maxwidth;
-		subrect2.br.x = rect.br.x;
-		subrect2.tl.y = rect.tl.y;
-		subrect2.br.y = rect.br.y;
-		return NumCodedRects(subrect1) + NumCodedRects(subrect2);
-	}
-
-	// This rectangle is small enough not to require splitting
-	return 1;
-}
-
-/*
- * corre.c
- *
- * Routines to implement Compact Rise-and-Run-length Encoding (CoRRE).  This
- * code is based on krw's original javatel rfbserver.
- */
-
-/*
- * This version modified for WinVNC by jnw.
- */
-
-static int rreAfterBufLen;
-
-static int subrectEncode8 (CARD8 *source, CARD8 *dest, int w, int h, int max);
-static int subrectEncode16 (CARD16 *source, CARD8 *dest, int w, int h, int max);
-static int subrectEncode32 (CARD32 *source, CARD8 *dest, int w, int h, int max);
-static CARD32 getBgColour (char *data, int size, int bpp);
-
-/*
- * vncEncodeCoRRE::EncodeRect - send an arbitrary size rectangle using CoRRE
- * encoding.
- */
-
-UINT
-vncEncodeCoRRE::EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	// Do the encoding
-	UINT size = InternalEncodeRect(source, dest, rect);
-
-	const UINT rectW = rect.br.x - rect.tl.x;
-	const UINT rectH = rect.br.y - rect.tl.y;
-
-	// Will this rectangle have been split for encoding?
-	if ((rectW>m_maxwidth) || (rectH>m_maxheight))
-	{
-		// Yes : Once we return, the stats will be valid!
-		m_statsready = TRUE;
-
-		// Update the stats
-		m_encodedbytes += size;
-		m_rectbytes += sz_rfbFramebufferUpdateRectHeader +
-			(rectW*rectH*m_remoteformat.bitsPerPixel/8);
-	}
-
-	return size;
-}
-
-UINT
-vncEncodeCoRRE::InternalEncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	int size = 0;
-
-    if ((UINT)(rect.br.y-rect.tl.y) > m_maxheight)
-	{
-		rfb::Rect subrect;
-
-		// Rectangle is too high - split it into two subrects to send
-		subrect.tl.x = rect.tl.x;
-		subrect.br.x = rect.br.x;
-		subrect.tl.y = rect.tl.y;
-		subrect.br.y = rect.tl.y + m_maxheight;
-		size += InternalEncodeRect(source, dest + size, subrect);
-
-		subrect.tl.x = rect.tl.x;
-		subrect.br.x = rect.br.x;
-		subrect.tl.y = rect.tl.y + m_maxheight;
-		subrect.br.y = rect.br.y;
-		size += InternalEncodeRect(source, dest + size, subrect);
-
-		return size;
-    }
-
-    if ((UINT)(rect.br.x-rect.tl.x) > m_maxwidth)
-	{
-		rfb::Rect subrect;
-
-		// Rectangle is too high - split it into two subrects to send
-		subrect.tl.x = rect.tl.x;
-		subrect.br.x = rect.tl.x + m_maxwidth;
-		subrect.tl.y = rect.tl.y;
-		subrect.br.y = rect.br.y;
-		size += InternalEncodeRect(source, dest + size, subrect);
-
-		subrect.tl.x = rect.tl.x + m_maxwidth;
-		subrect.br.x = rect.br.x;
-		subrect.tl.y = rect.tl.y;
-		subrect.br.y = rect.br.y;
-		size += InternalEncodeRect(source, dest + size, subrect);
-
-		return size;
-	}
-
-    return EncodeSmallRect(source, dest, rect);
-}
-
-void
-vncEncodeCoRRE::SetCoRREMax(BYTE width, BYTE height)
-{
-	m_maxwidth = width;
-	m_maxheight = height;
-}
-
-/*
- * EncodeSmallRect - send a small (guaranteed < 256x256)
- * rectangle using CoRRE encoding.
- */
-
-UINT
-vncEncodeCoRRE::EncodeSmallRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	int subrects = -1;
-
-	const UINT rectW = rect.br.x - rect.tl.x;
-	const UINT rectH = rect.br.y - rect.tl.y;
-
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	surh->r.x = (CARD16) (rect.tl.x-m_SWOffsetx);
-	surh->r.y = (CARD16) (rect.tl.y-m_SWOffsety);
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingCoRRE);
-	
-	// create a space big enough for the CoRRE encoded pixels
-	if (m_bufflen < (int)(rectW*rectH*m_remoteformat.bitsPerPixel / 8))
-	{
-		if (m_buffer != NULL)
-		{
-			delete [] m_buffer;
-			m_buffer = NULL;
-		}
-		m_buffer = new BYTE [rectW*rectH*m_remoteformat.bitsPerPixel/8+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-
-		m_bufflen = rectW*rectH*m_remoteformat.bitsPerPixel/8;
-	}
-	
-	// Translate the data into our new buffer
-	Translate(source, m_buffer, rect);
-
-	// The Buffer object will have ensured that the destination buffer is
-	// big enough using RequiredBuffSize
-
-	// Choose the appropriate encoding routine (for speed...)
-	switch(m_remoteformat.bitsPerPixel)
-	{
-	case 8:
-		subrects = subrectEncode8(
-			m_buffer,
-			dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader,
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	case 16:
-		subrects = subrectEncode16(
-			(CARD16 *)m_buffer,
-			(CARD8 *)(dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader),
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	case 32:
-		subrects = subrectEncode32(
-			(CARD32 *)m_buffer,
-			(CARD8 *)(dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader),
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	}
-
-	// If we couldn't encode the rectangles then just send the data raw
-	if (subrects < 0)
-		return vncEncoder::EncodeRect(source, dest, rect);
-
-	// Send the RREHeader
-	rfbRREHeader *rreh=(rfbRREHeader *)(dest+sz_rfbFramebufferUpdateRectHeader);
-	rreh->nSubrects = Swap32IfLE(subrects);
-
-	// Calculate the size of the buffer produced
-	return sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + rreAfterBufLen;
-}
-
-/*
- * subrectEncode() encodes the given multicoloured rectangle as a background 
- * colour overwritten by single-coloured rectangles.  It returns the number 
- * of subrectangles in the encoded buffer, or -1 if subrect encoding won't
- * fit in the buffer.  It puts the encoded rectangles in rreAfterBuf.  The
- * single-colour rectangle partition is not optimal, but does find the biggest
- * horizontal or vertical rectangle top-left anchored to each consecutive 
- * coordinate position.
- *
- * The coding scheme is simply [<bgcolour><subrect><subrect>...] where each 
- * <subrect> is [<colour><x><y><w><h>].
- */
-
-#define DEFINE_SUBRECT_ENCODE(bpp)							\
-static int													\
-subrectEncode##bpp(											\
-	CARD##bpp *source,										\
-    CARD8 *dest,											\
-	int w,													\
-	int h,													\
-	int maxbytes)											\
-{															\
-    CARD##bpp cl;											\
-    rfbCoRRERectangle subrect;								\
-    int x,y;												\
-    int i,j;												\
-    int hx=0,hy,vx=0,vy;									\
-    int hyflag;												\
-    CARD##bpp *seg;											\
-    CARD##bpp *line;										\
-    int hw,hh,vw,vh;										\
-    int thex,they,thew,theh;								\
-    int numsubs = 0;										\
-    int newLen;												\
-    CARD##bpp bg = (CARD##bpp)getBgColour((char*)source,w*h,bpp);	\
-															\
-    *((CARD##bpp*)dest) = bg;								\
-															\
-    rreAfterBufLen = (bpp/8);								\
-															\
-    for (y=0; y<h; y++) {									\
-      line = source+(y*w);									\
-      for (x=0; x<w; x++) {									\
-        if (line[x] != bg) {								\
-          cl = line[x];										\
-          hy = y-1;											\
-          hyflag = 1;										\
-          for (j=y; j<h; j++) {								\
-            seg = source+(j*w);								\
-            if (seg[x] != cl) {break;}					    \
-            i = x;											\
-            while ((seg[i] == cl) && (i < w)) i += 1;		\
-            i -= 1;											\
-            if (j == y) vx = hx = i;					    \
-            if (i < vx) vx = i;								\
-            if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;}      \
-          }													\
-          vy = j-1;											\
-															\
-          /*  We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy)  \
-           *  We'll choose the bigger of the two.			\
-           */												\
-          hw = hx-x+1;										\
-          hh = hy-y+1;										\
-          vw = vx-x+1;										\
-          vh = vy-y+1;										\
-															\
-          thex = x;											\
-          they = y;											\
-															\
-          if ((hw*hh) > (vw*vh)) {							\
-            thew = hw;										\
-            theh = hh;										\
-          } else {											\
-            thew = vw;										\
-            theh = vh;										\
-          }													\
-															\
-          subrect.x = thex;									\
-          subrect.y = they;									\
-          subrect.w = thew;									\
-          subrect.h = theh;									\
-															\
-	  newLen = rreAfterBufLen + (bpp/8) + sz_rfbCoRRERectangle;			\
-          if ((newLen > (w * h * (bpp/8))) || (newLen > maxbytes))		\
-	    return -1;											\
-															\
-	  numsubs += 1;											\
-	  *((CARD##bpp*)(dest + rreAfterBufLen)) = cl;			\
-	  rreAfterBufLen += (bpp/8);							\
-	  memcpy(&dest[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle);		\
-	  rreAfterBufLen += sz_rfbCoRRERectangle;			    \
-															\
-		  /*												\
-           * Now mark the subrect as done.				    \
-           */												\
-          for (j=they; j < (they+theh); j++) {				\
-            for (i=thex; i < (thex+thew); i++) {			\
-              source[j*w+i] = bg;								\
-            }												\
-          }													\
-        }													\
-      }														\
-    }														\
-															\
-    return numsubs;											\
-}
-
-DEFINE_SUBRECT_ENCODE(8)
-DEFINE_SUBRECT_ENCODE(16)
-DEFINE_SUBRECT_ENCODE(32)
-
-/*
- * getBgColour() gets the most prevalent colour in a byte array.
- */
-static CARD32
-getBgColour(
-	char *data,
-	int size,
-	int bpp)
-{
-    
-#define NUMCLRS 256
-  
-  static int counts[NUMCLRS];
-  int i,j,k;
-
-  int maxcount = 0;
-  CARD8 maxclr = 0;
-
-  if (bpp != 8) {
-    if (bpp == 16) {
-      return ((CARD16 *)data)[0];
-    } else if (bpp == 32) {
-      return ((CARD32 *)data)[0];
-    } else {
-      fprintf(stderr,"getBgColour: bpp %d?\n",bpp);
-      exit(1);
-    }
-  }
-
-  for (i=0; i<NUMCLRS; i++) {
-    counts[i] = 0;
-  }
-
-  for (j=0; j<size; j++) {
-    k = (int)(((CARD8 *)data)[j]);
-    if (k >= NUMCLRS) {
-      fprintf(stderr, "%s: unusual colour = %d\n", "getBgColour",k);
-      exit(1);
-    }
-    counts[k] += 1;
-    if (counts[k] > maxcount) {
-      maxcount = counts[k];
-      maxclr = ((CARD8 *)data)[j];
-    }
-  }
-  
-  return maxclr;
-}
diff --git a/ica/win32/winvnc/winvnc/vncencodecorre.h b/ica/win32/winvnc/winvnc/vncencodecorre.h
deleted file mode 100644
index 0f0ff2a..0000000
--- a/ica/win32/winvnc/winvnc/vncencodecorre.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeCoRRE object
-
-// The vncEncodeCoRRE object uses a compression encoding to send rectangles
-// to a client
-
-class vncEncodeCoRRE;
-
-#if !defined(_WINVNC_ENCODECORRRE)
-#define _WINVNC_ENCODECORRE
-#pragma once
-
-#include "vncencoder.h"
-
-// Class definition
-
-class vncEncodeCoRRE : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeCoRRE();
-	~vncEncodeCoRRE();
-
-	virtual void Init();
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-	virtual void SetCoRREMax(BYTE width, BYTE height);
-protected:
-	virtual UINT InternalEncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeSmallRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-
-// Implementation
-protected:
-	BYTE		*m_buffer;
-	int			m_bufflen;
-
-	// Maximum height & width for CoRRE
-	UINT		m_maxwidth;
-	UINT		m_maxheight;
-
-	// Last-update stats for CoRRE
-	UINT		m_encodedbytes, m_rectbytes;
-	UINT		m_lastencodedbytes, m_lastrectbytes;
-	int			m_maxadjust;
-	int			m_threshold;
-	BOOL		m_statsready;
-};
-
-#endif // _WINVNC_ENCODECORRE
-
diff --git a/ica/win32/winvnc/winvnc/vncencodehext.cpp b/ica/win32/winvnc/winvnc/vncencodehext.cpp
deleted file mode 100644
index 82b117c..0000000
--- a/ica/win32/winvnc/winvnc/vncencodehext.cpp
+++ /dev/null
@@ -1,411 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeHexT
-
-// This file implements the vncEncoder-derived vncEncodeHexT class.
-// This class overrides some vncEncoder functions to produce a
-// Hextile encoder.  Hextile splits all top-level update rectangles
-// into smaller, 16x16 rectangles and encodes these using the
-// optimised Hextile sub-encodings.
-
-#include "vncencodehext.h"
-#include "rfb.h"
-#include "rfbMisc.h"
-#include <stdlib.h>
-#include <time.h>
-
-vncEncodeHexT::vncEncodeHexT()
-{
-}
-
-vncEncodeHexT::~vncEncodeHexT()
-{
-}
-
-void
-vncEncodeHexT::Init()
-{
-	vncEncoder::Init();
-}
-
-UINT
-vncEncodeHexT::RequiredBuffSize(UINT width, UINT height)
-{
-	return vncEncoder::RequiredBuffSize(width, height) + (((width/16)+1) * ((height/16)+1));
-}
-
-UINT
-vncEncodeHexT::NumCodedRects(const rfb::Rect &rect)
-{
-	return 1;
-}
-
-/*
- * hextile.c
- *
- * Routines to implement Hextile Encoding
- */
-
-#include <stdio.h>
-#include "rfb.h"
-
-/*
- * vncEncodeHexT::EncodeRect - send a rectangle using hextile encoding.
- */
-
-UINT
-vncEncodeHexT::EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect_IN)
-{
-	rfb::Rect rect;
-	rect.tl.x=(rect_IN.tl.x < 0)? 0: rect_IN.tl.x;
-	rect.tl.y=(rect_IN.tl.y < 0)? 0: rect_IN.tl.y;
-	rect.br.x=(rect_IN.br.x < 0)? 0: rect_IN.br.x;
-	rect.br.y=(rect_IN.br.y < 0)? 0: rect_IN.br.y;
-
-	const UINT rectW = rect.br.x - rect.tl.x;
-	const UINT rectH = rect.br.y - rect.tl.y;
-
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	surh->r.x = (CARD16) (rect.tl.x-m_SWOffsetx);
-	surh->r.y = (CARD16) (rect.tl.y-m_SWOffsety);
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingHextile);
-
-	// Do the encoding
-    switch (m_remoteformat.bitsPerPixel)
-	{
-	case 8:
-		return sz_rfbFramebufferUpdateRectHeader +
-			EncodeHextiles8(source, dest + sz_rfbFramebufferUpdateRectHeader,
-				rect.tl.x, rect.tl.y, rectW, rectH);
-    case 16:
-		return sz_rfbFramebufferUpdateRectHeader +
-			EncodeHextiles16(source, dest + sz_rfbFramebufferUpdateRectHeader,
-				rect.tl.x, rect.tl.y, rectW, rectH);
-    case 32:
-		return sz_rfbFramebufferUpdateRectHeader +
-			EncodeHextiles32(source, dest + sz_rfbFramebufferUpdateRectHeader,
-				rect.tl.x, rect.tl.y, rectW, rectH);
-    }
-
-	return vncEncoder::EncodeRect(source, dest, rect);
-}
-
-#define PUT_PIXEL8(pix) (dest[destoffset++] = (pix))
-
-#define PUT_PIXEL16(pix) (dest[destoffset++] = ((char*)&(pix))[0],			\
-			  dest[destoffset++] = ((char*)&(pix))[1])
-
-#define PUT_PIXEL32(pix) (dest[destoffset++] = ((char*)&(pix))[0],			\
-			  dest[destoffset++] = ((char*)&(pix))[1],						\
-			  dest[destoffset++] = ((char*)&(pix))[2],						\
-			  dest[destoffset++] = ((char*)&(pix))[3])
-
-#define DEFINE_SEND_HEXTILES(bpp)											\
-																			\
-static UINT subrectEncode##bpp(CARD##bpp *src, BYTE *dest,					\
-				int w, int h, CARD##bpp bg,									\
-			    CARD##bpp fg, BOOL mono);									\
-static void testColours##bpp(CARD##bpp *data, int size, BOOL *mono,			\
-			     BOOL *solid, CARD##bpp *bg, CARD##bpp *fg);				\
-																			\
-																			\
-/*																			\
- * rfbSendHextiles															\
- */																			\
-																			\
-UINT																		\
-vncEncodeHexT::EncodeHextiles##bpp(BYTE *source, BYTE *dest,				\
-				  int rx, int ry, int rw, int rh)							\
-{																			\
-    int x, y, w, h;															\
-    int rectoffset, destoffset;												\
-    CARD##bpp bg = 0, fg = 0, newBg, newFg;									\
-    BOOL mono, solid;														\
-    BOOL validBg = FALSE;													\
-    CARD##bpp clientPixelData[16*16*(bpp/8)];								\
-    BOOL validFg = FALSE;													\
-																			\
-	destoffset = 0;															\
-																			\
-    for (y = ry; y < ry+rh; y += 16)										\
-	{																		\
-		for (x = rx; x < rx+rw; x += 16)									\
-		{																	\
-		    w = h = 16;														\
-		    if (rx+rw - x < 16)												\
-				w = rx+rw - x;												\
-		    if (ry+rh - y < 16)												\
-				h = ry+rh - y;												\
-																			\
-			rfb::Rect hexrect;												\
-			hexrect.tl.x = x;												\
-			hexrect.tl.y = y;												\
-			hexrect.br.x = x+w;												\
-			hexrect.br.y = y+h;												\
-			Translate(source, (BYTE *) &clientPixelData, hexrect);			\
-																			\
-			rectoffset = destoffset;										\
-			dest[rectoffset] = 0;											\
-			destoffset++;													\
-																			\
-			testColours##bpp(clientPixelData, w * h,						\
-			     &mono, &solid, &newBg, &newFg);							\
-																			\
-			if (!validBg || (newBg != bg))									\
-			{																\
-				validBg = TRUE;												\
-				bg = newBg;													\
-				dest[rectoffset] |= rfbHextileBackgroundSpecified;			\
-				PUT_PIXEL##bpp(bg);											\
-			}																\
-																			\
-			if (solid)														\
-				continue;													\
-																			\
-			dest[rectoffset] |= rfbHextileAnySubrects;						\
-																			\
-			if (mono)														\
-			{																\
-				if (!validFg || (newFg != fg))								\
-				{															\
-					validFg = TRUE;											\
-					fg = newFg;												\
-					dest[rectoffset] |= rfbHextileForegroundSpecified;		\
-					PUT_PIXEL##bpp(fg);										\
-				}															\
-			}																\
-			else															\
-			{																\
-				validFg = FALSE;											\
-				dest[rectoffset] |= rfbHextileSubrectsColoured;			    \
-			}																\
-																			\
-			int encodedbytes = subrectEncode##bpp(clientPixelData,			\
-								   dest + destoffset,						\
-								   w, h, bg, fg, mono);						\
-			destoffset += encodedbytes;										\
-			if (encodedbytes == 0)											\
-			{																\
-				/* encoding was too large, use raw */						\
-				validBg = FALSE;											\
-				validFg = FALSE;											\
-				destoffset = rectoffset;									\
-				dest[destoffset++] = rfbHextileRaw;							\
-																			\
-				Translate(source, (BYTE *) &clientPixelData, hexrect);		\
-																			\
-				memcpy(dest + destoffset, (char *)clientPixelData,			\
-			       w * h * (bpp/8));										\
-																			\
-				destoffset += w * h * (bpp/8);								\
-		    }																\
-		}																	\
-    }																		\
-																			\
-    return destoffset;														\
-}																			\
-																			\
-static UINT																	\
-subrectEncode##bpp(CARD##bpp *src, BYTE *dest, int w, int h, CARD##bpp bg,	\
-		   CARD##bpp fg, BOOL mono)											\
-{																			\
-    CARD##bpp cl;															\
-    int x,y;																\
-    int i,j;																\
-    int hx=0,hy,vx=0,vy;													\
-    int hyflag;																\
-    CARD##bpp *seg;															\
-    CARD##bpp *line;														\
-    int hw,hh,vw,vh;														\
-    int thex,they,thew,theh;												\
-    int numsubs = 0;														\
-    int newLen;																\
-    int rectoffset;															\
-	int destoffset;															\
-																			\
-	destoffset = 0;															\
-    rectoffset = destoffset;												\
-    destoffset++;															\
-																			\
-    for (y=0; y<h; y++)														\
-	{																		\
-		line = src+(y*w);													\
-		for (x=0; x<w; x++)													\
-		{																	\
-		    if (line[x] != bg)												\
-			{																\
-				cl = line[x];												\
-				hy = y-1;													\
-				hyflag = 1;													\
-				for (j=y; j<h; j++)											\
-				{															\
-					seg = src+(j*w);										\
-					if (seg[x] != cl) {break;}								\
-					i = x;													\
-					while ((i < w) && (seg[i] == cl)) i += 1;				\
-					i -= 1;													\
-					if (j == y) vx = hx = i;								\
-					if (i < vx) vx = i;										\
-					if ((hyflag > 0) && (i >= hx))							\
-					{														\
-						hy += 1;											\
-					}														\
-					else													\
-					{														\
-						hyflag = 0;											\
-					}														\
-				}															\
-				vy = j-1;													\
-																			\
-				/* We now have two possible subrects: (x,y,hx,hy) and		\
-				 * (x,y,vx,vy).  We'll choose the bigger of the two.		\
-				 */															\
-				hw = hx-x+1;												\
-				hh = hy-y+1;												\
-				vw = vx-x+1;												\
-				vh = vy-y+1;												\
-																			\
-				thex = x;													\
-				they = y;													\
-																			\
-				if ((hw*hh) > (vw*vh))										\
-				{															\
-				    thew = hw;												\
-				    theh = hh;												\
-				}															\
-				else														\
-				{															\
-				    thew = vw;												\
-				    theh = vh;												\
-				}															\
-																			\
-				if (mono)													\
-				{															\
-				    newLen = destoffset - rectoffset + 2;					\
-				}															\
-				else														\
-				{															\
-				    newLen = destoffset - rectoffset + bpp/8 + 2;			\
-				}															\
-																			\
-				if (newLen > (w * h * (bpp/8)))								\
-				    return 0;												\
-																			\
-				numsubs += 1;												\
-																			\
-				if (!mono) PUT_PIXEL##bpp(cl);								\
-																			\
-				dest[destoffset++] = rfbHextilePackXY(thex,they);			\
-				dest[destoffset++] = rfbHextilePackWH(thew,theh);			\
-																			\
-				/*															\
-				 * Now mark the subrect as done.							\
-				 */															\
-				for (j=they; j < (they+theh); j++)							\
-				{															\
-					for (i=thex; i < (thex+thew); i++)						\
-					{														\
-						src[j*w+i] = bg;									\
-					}														\
-				}															\
-		    }																\
-		}																	\
-    }																		\
-																			\
-    dest[rectoffset] = numsubs;												\
-																			\
-    return destoffset;														\
-}																			\
-																			\
-																			\
-/*																			\
- * testColours() tests if there are one (solid), two (mono) or more			\
- * colours in a tile and gets a reasonable guess at the best background	    \
- * pixel, and the foreground pixel for mono.								\
- */																			\
-																			\
-static void																	\
-testColours##bpp(CARD##bpp *data, int size,									\
-				 BOOL *mono, BOOL *solid,									\
-				 CARD##bpp *bg, CARD##bpp *fg)								\
-{																			\
-    CARD##bpp colour1, colour2;												\
-    int n1 = 0, n2 = 0;														\
-    *mono = TRUE;															\
-    *solid = TRUE;															\
-	colour1=0;																\
-	colour2=0;																\
-																			\
-    for (; size > 0; size--, data++)										\
-	{																		\
-																			\
-		if (n1 == 0)														\
-		    colour1 = *data;												\
-																			\
-		if (*data == colour1)												\
-		{																	\
-		    n1++;															\
-		    continue;														\
-		}																	\
-																			\
-		if (n2 == 0)														\
-		{																	\
-		    *solid = FALSE;													\
-		    colour2 = *data;												\
-		}																	\
-																			\
-		if (*data == colour2)												\
-		{																	\
-		    n2++;															\
-		    continue;														\
-		}																	\
-																			\
-		*mono = FALSE;														\
-		break;																\
-	}																		\
-																			\
-    if (n1 > n2)															\
-	{																		\
-		*bg = colour1;														\
-		*fg = colour2;														\
-    }																		\
-	else																	\
-	{																		\
-		*bg = colour2;														\
-		*fg = colour1;														\
-    }																		\
-}
-
-DEFINE_SEND_HEXTILES(8)
-DEFINE_SEND_HEXTILES(16)
-DEFINE_SEND_HEXTILES(32)
diff --git a/ica/win32/winvnc/winvnc/vncencodehext.h b/ica/win32/winvnc/winvnc/vncencodehext.h
deleted file mode 100644
index 6fccec8..0000000
--- a/ica/win32/winvnc/winvnc/vncencodehext.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeHexT object
-
-// The vncEncodeHexT object uses a compression encoding to send rectangles
-// to a client
-
-class vncEncodeHexT;
-
-#if !defined(_WINVNC_ENCODEHEXTILE)
-#define _WINVNC_ENCODEHEXTILE
-#pragma once
-
-#include "vncencoder.h"
-
-// Class definition
-
-class vncEncodeHexT : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeHexT();
-	~vncEncodeHexT();
-
-	virtual void Init();
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-
-protected:
-	virtual UINT EncodeHextiles8(BYTE *source, BYTE *dest,
-		int x, int y, int w, int h);
-	virtual UINT EncodeHextiles16(BYTE *source, BYTE *dest,
-		int x, int y, int w, int h);
-	virtual UINT EncodeHextiles32(BYTE *source, BYTE *dest,
-		int x, int y, int w, int h);
-
-// Implementation
-protected:
-};
-
-#endif // _WINVNC_ENCODEHEXTILE
-
diff --git a/ica/win32/winvnc/winvnc/vncencodemgr.h b/ica/win32/winvnc/winvnc/vncencodemgr.h
deleted file mode 100644
index 01b3692..0000000
--- a/ica/win32/winvnc/winvnc/vncencodemgr.h
+++ /dev/null
@@ -1,926 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-// vncEncodeMgr
-
-// This class is used internally by vncClient to offload the handling of
-// bitmap data encoding and translation.  Trying to avoid bloating the
-// already rather bloaty vncClient class!
-
-class vncEncodeMgr;
-
-#if !defined(_WINVNC_VNCENCODEMGR)
-#define _WINVNC_VNCENCODEMGR
-#pragma once
-
-// Includes
-
-#include "vncencoder.h"
-#include "vncencoderre.h"
-#include "vncencodecorre.h"
-#include "vncencodehext.h"
-#include "vncencodezrle.h"
-#include "vncEncodeZlib.h"
-#include "vncEncodeZlibHex.h"
-#include "vncEncodeTight.h"
-#include "vncEncodeUltra.h"
-#include "vncEncodeUltra2.h"
-#include "vncbuffer.h"
-
-//
-// -=- Define the Encoding Manager interface
-// 
-
-class vncEncodeMgr
-{
-public:
-	// Create/Destroy methods
-	inline vncEncodeMgr();
-	inline ~vncEncodeMgr();
-
-	inline void SetBuffer(vncBuffer *buffer);
-
-	// BUFFER INFO
-	inline rfb::Rect GetSize();
-	inline BYTE *GetClientBuffer();
-	inline UINT GetClientBuffSize() {return m_clientbuffsize;}; // sf at 2002
-	inline BOOL GetPalette(RGBQUAD *quadbuff, UINT ncolours);
-
-	inline omni_mutex& GetUpdateLock() {return m_buffer->m_desktop->GetUpdateLock();};
-
-	// ENCODING & TRANSLATION
-	inline UINT GetNumCodedRects(const rfb::Rect &rect);
-	inline BOOL SetEncoding(CARD32 encoding,BOOL reinitialize);
-	//inline UINT EncodeRect(const rfb::Rect &rect);
-	inline UINT EncodeRect(const rfb::Rect &rect,VSocket *outconn);
-
-
-	// Tight - CONFIGURING ENCODER
-	inline void SetCompressLevel(int level);
-	inline void SetQualityLevel(int level);
-	inline void EnableLastRect(BOOL enable);
-	inline BOOL IsLastRectEnabled() { return m_use_lastrect; }
-
-	// CURSOR HANDLING
-	inline void EnableXCursor(BOOL enable);
-	inline void EnableRichCursor(BOOL enable);
-	inline BOOL SetServerFormat();
-	inline BOOL SetClientFormat(rfbPixelFormat &format);
-	inline rfbPixelFormat GetClientFormat() {return m_clientformat;};
-	inline void SetSWOffset(int x,int y);
-	// CURSOR HANDLING
-	inline BOOL IsCursorUpdatePending();
-	inline BOOL WasCursorUpdatePending();
-	inline BOOL SendCursorShape(VSocket *outConn);
-	inline BOOL SendEmptyCursorShape(VSocket *outConn);
-	inline BOOL IsXCursorSupported();
-	// CLIENT OPTIONS
-	inline void AvailableXOR(BOOL enable){m_use_xor = enable;};
-	inline void AvailableZRLE(BOOL enable){m_use_zrle = enable;};
-	inline void AvailableTight(BOOL enable){m_use_tight = enable;};
-	inline void EnableQueuing(BOOL enable){m_fEnableQueuing = enable;};
-	inline BOOL IsMouseWheelTight();
-	// CACHE HANDLING
-	inline void EnableCache(BOOL enabled);
-	inline BOOL IsCacheEnabled();
-
-	// sf at 2005 - Grey palette
-	inline void EnableGreyPalette(BOOL enable);
-
-	// QUEUE ZLIBXOR
-	inline void LastRect(VSocket *outConn);
-	// Modif cs at 2005
-#ifdef DSHOW
-	inline BOOL ResetZRLEEncoding(void);
-#endif
-
-	inline bool IsSlowEncoding() {return (m_encoding == rfbEncodingZYWRLE || m_encoding == rfbEncodingZRLE || m_encoding == rfbEncodingTight || m_encoding == rfbEncodingZlib);};
-	inline bool IsUltraEncoding() {return (m_encoding == rfbEncodingUltra || m_encoding == rfbEncodingUltra2);};
-
-
-
-protected:
-
-	// Routine used internally to ensure the client buffer is OK
-	inline BOOL CheckBuffer();
-
-	// Pixel buffers and access to display buffer
-	BYTE		*m_clientbuff;
-	UINT		m_clientbuffsize;
-/*	BYTE		*m_clientbackbuff;
-	UINT		m_clientbackbuffsize;*/
-	//RESIZE
-
-	// Pixel formats, translation and encoding
-	rfbPixelFormat	m_clientformat;
-	BOOL			m_clientfmtset;
-	rfbTranslateFnType	m_transfunc;
-	vncEncoder*		m_encoder;
-	vncEncoder*		zrleEncoder;
-	bool			zlib_encoder_in_use;
-	vncEncoder*		m_hold_zlib_encoder;
-	bool			ultra_encoder_in_use;
-	vncEncoder*		m_hold_ultra_encoder;
-	vncEncoder*		m_hold_ultra2_encoder;
-	bool			zlibhex_encoder_in_use;
-	vncEncoder*		m_hold_zlibhex_encoder;
-	bool			tight_encoder_in_use;
-	vncEncoder*		m_hold_tight_encoder;
-
-	// Tight 
-	int				m_compresslevel;
-	int				m_qualitylevel;
-	BOOL			m_use_lastrect;
-
-	// Tight - CURSOR HANDLING
-	BOOL			m_use_xcursor;
-	BOOL			m_use_richcursor;
-	HCURSOR			m_hcursor;		// Used to track cursor shape changes
-
-	// Client detection
-	// if tight->tight zrle->zrle both=ultra
-	BOOL			m_use_xor;
-	BOOL			m_use_zrle;
-	BOOL			m_use_tight;
-	BOOL			m_fEnableQueuing;
-
-	// cache handling
-	BOOL			m_cache_enabled;
-	int				m_SWOffsetx;
-	int				m_SWOffsety;
-
-public:
-	vncBuffer	*m_buffer;
-	rfbServerInitMsg	m_scrinfo;
-	CARD32		m_encoding;
-	bool			ultra2_encoder_in_use;
-};
-
-//
-// -=- Constructor/destructor
-//
-
-inline vncEncodeMgr::vncEncodeMgr()
-{
-	m_encoding = rfbEncodingRaw;
-	m_transfunc = NULL;
-
-	zrleEncoder=NULL;
-	m_encoder = NULL;
-	m_buffer=NULL;
-
-	m_clientbuff = NULL;
-	m_clientbuffsize = 0;
-/*	m_clientbackbuff = NULL;
-	m_clientbackbuffsize = 0;*/
-
-	m_clientfmtset = FALSE;
-	zlib_encoder_in_use = false;
-	m_hold_zlib_encoder = NULL;
-    ultra_encoder_in_use = false;
-	ultra2_encoder_in_use = false;
-	m_hold_ultra_encoder = NULL;
-	m_hold_ultra2_encoder = NULL;
-	zlibhex_encoder_in_use = false;
-	m_hold_zlibhex_encoder = NULL;
-	tight_encoder_in_use = false;
-	m_hold_tight_encoder = NULL;
-
-	// Tight 
-	m_compresslevel = 6;
-	m_qualitylevel = -1;
-	m_use_lastrect = FALSE;
-	// Tight CURSOR HANDLING
-	m_use_xcursor = FALSE;
-	m_use_richcursor = FALSE;
-//	m_hcursor = NULL;
-
-	m_SWOffsetx=0;
-	m_SWOffsety=0;
-
-}
-
-inline vncEncodeMgr::~vncEncodeMgr()
-{
-	if (zrleEncoder && zrleEncoder != m_encoder)
-		delete zrleEncoder;
-
-	if (m_hold_zlib_encoder != NULL && m_hold_zlib_encoder != m_encoder) {
-		delete m_hold_zlib_encoder;
-		m_hold_zlib_encoder = NULL;
-	}
-
-	if (m_hold_ultra_encoder != NULL && m_hold_ultra_encoder != m_encoder) {
-		delete m_hold_ultra_encoder;
-		m_hold_ultra_encoder = NULL;
-	}
-
-	if (m_hold_ultra2_encoder != NULL && m_hold_ultra2_encoder != m_encoder) {
-		delete m_hold_ultra2_encoder;
-		m_hold_ultra2_encoder = NULL;
-	}
-
-	if (m_hold_zlibhex_encoder != NULL && m_hold_zlibhex_encoder != m_encoder) {
-		delete m_hold_zlibhex_encoder;
-		m_hold_zlibhex_encoder = NULL;
-	}
-
-	if (m_hold_tight_encoder != NULL && m_hold_tight_encoder != m_encoder)
-	{
-		// m_hold_tight_encoder->LogStats();
-		delete m_hold_tight_encoder;
-		m_hold_tight_encoder = NULL;
-	}
-
-	if (m_encoder != NULL)
-	{
-		delete m_encoder;
-		m_encoder = NULL;
-		m_hold_zlib_encoder = NULL;
-		m_hold_ultra_encoder = NULL;
-		m_hold_ultra2_encoder = NULL;
-		m_hold_zlibhex_encoder = NULL;
-		m_hold_tight_encoder = NULL;
-
-	}
-	if (m_clientbuff != NULL)
-	{
-		delete [] m_clientbuff;
-		m_clientbuff = NULL;
-	}
-/*	if (m_clientbackbuff != NULL)
-	{
-		delete m_clientbackbuff;
-		m_clientbackbuff = NULL;
-	}*/
-}
-
-inline void
-vncEncodeMgr::SetBuffer(vncBuffer *buffer)
-{
-	m_buffer=buffer;
-	CheckBuffer();
-}
-
-//
-// -=- Encoding of pixel data for transmission
-//
-
-inline BYTE *
-vncEncodeMgr::GetClientBuffer()
-{
-	return m_clientbuff;
-}
-
-inline BOOL
-vncEncodeMgr::GetPalette(RGBQUAD *quadlist, UINT ncolours)
-{
-	// Try to get the RGBQUAD data from the encoder
-	// This will only work if the remote client is palette-based,
-	// in which case the encoder will be storing RGBQUAD data
-	if (m_encoder == NULL)
-	{
-		vnclog.Print(LL_INTWARN, VNCLOG("GetPalette called but no encoder set\n"));
-		return FALSE;
-	}
-
-	// Now get the palette data
-	return m_encoder->GetRemotePalette(quadlist, ncolours);
-}
-
-inline BOOL
-vncEncodeMgr::CheckBuffer()
-{
-	// Get the screen format, in case it has changed
-	m_buffer->m_desktop->FillDisplayInfo(&m_scrinfo);
-
-	// If the client has not specified a pixel format then set one for it
-	if (!m_clientfmtset) {
-	    m_clientfmtset = TRUE;
-	    m_clientformat = m_scrinfo.format;
-	}
-
-	// If the client has not selected an encoding then set one for it
-	if ((m_encoder == NULL) && (!SetEncoding(rfbEncodingRaw,FALSE)))
-		return FALSE;
-
-	// Check the client buffer is sufficient
-	const UINT clientbuffsize =
-	    m_encoder->RequiredBuffSize(m_scrinfo.framebufferWidth,
-									m_scrinfo.framebufferHeight);
-	if (m_clientbuffsize != clientbuffsize)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("request client buffer[%u]\n"), clientbuffsize);
-	    if (m_clientbuff != NULL)
-	    {
-			delete [] m_clientbuff;
-			m_clientbuff = NULL;
-	    }
-	    m_clientbuffsize = 0;
-
-	    m_clientbuff = new BYTE [clientbuffsize];
-	    if (m_clientbuff == NULL)
-	    {		
-			vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client buffer[%u]\n"), clientbuffsize);
-			return FALSE;
-	    }
-		memset(m_clientbuff, 0, clientbuffsize);
-	    m_clientbuffsize = clientbuffsize;
-	}
-
-/*	// Check the client backing buffer matches the server back buffer
-	const UINT backbuffsize = m_buffer->m_backbuffsize;
-	if (m_clientbackbuffsize != backbuffsize)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("request client back buffer[%u]\n"), backbuffsize);
-		if (m_clientbackbuff) {
-			delete [] m_clientbackbuff;
-			m_clientbackbuff = 0;
-		}
-		m_clientbackbuffsize = 0;
-
-		m_clientbackbuff = new BYTE[backbuffsize];
-		if (!m_clientbackbuff) {
-			vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client back buffer[%u]\n"), backbuffsize);
-			return FALSE;
-		}
-		memset(m_clientbackbuff, 0, backbuffsize);
-		m_clientbackbuffsize = backbuffsize;
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("remote buffer=%u\n"), m_clientbuffsize);*/
-
-	return TRUE;
-}
-
-// Set the encoding to use
-inline BOOL
-vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize)
-{
-	if (reinitialize)
-	{
-		encoding=m_encoding;
-		if (!m_buffer->CheckBuffer())
-            return FALSE;
-	}
-	else m_encoding=encoding;
-
-	// Delete the old encoder
-	if (m_encoder != NULL)
-	{
-		if ( zlib_encoder_in_use )
-		{
-			m_hold_zlib_encoder = m_encoder;
-		}
-		else if ( ultra_encoder_in_use )
-		{
-			m_hold_ultra_encoder = m_encoder;
-		}
-		else if ( ultra2_encoder_in_use )
-		{
-			m_hold_ultra2_encoder = m_encoder;
-		}
-		else if ( zlibhex_encoder_in_use )
-		{
-			m_hold_zlibhex_encoder = m_encoder;
-		}
-		else if ( tight_encoder_in_use )
-		{
-			m_hold_tight_encoder = m_encoder;
-		}
-		else
-		{
-		if (m_encoder != zrleEncoder)
-			delete m_encoder;
-		}
-		m_encoder = NULL;
-		
-	}
-	zlib_encoder_in_use = false;
-	ultra_encoder_in_use = false;
-	ultra2_encoder_in_use = false;
-	zlibhex_encoder_in_use = false;
-	tight_encoder_in_use = false;
-	// Returns FALSE if the desired encoding cannot be used
-	switch(encoding)
-	{
-
-	case rfbEncodingRaw:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("raw encoder requested\n"));
-
-		// Create a RAW encoder
-		m_encoder = new vncEncoder;
-		if (m_encoder == NULL)
-			return FALSE;
-		break;
-
-	case rfbEncodingRRE:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("RRE encoder requested\n"));
-
-		// Create a RRE encoder
-		m_encoder = new vncEncodeRRE;
-		if (m_encoder == NULL)
-			return FALSE;
-		break;
-
-	case rfbEncodingCoRRE:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("CoRRE encoder requested\n"));
-
-		// Create a CoRRE encoder
-		m_encoder = new vncEncodeCoRRE;
-		if (m_encoder == NULL)
-			return FALSE;
-		break;
-
-	case rfbEncodingHextile:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("Hextile encoder requested\n"));
-
-		// Create a CoRRE encoder
-		m_encoder = new vncEncodeHexT;
-		if (m_encoder == NULL)
-			return FALSE;
-		break;
-
-	case rfbEncodingUltra:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder requested\n"));
-
-		// Create a Zlib encoder, if needed.
-		// If a Zlib encoder was used previously, then reuse it here
-		// to maintain zlib dictionary synchronization with the viewer.
-		if ( m_hold_ultra_encoder == NULL )
-		{
-			m_encoder = new vncEncodeUltra;
-		}
-		else
-		{
-			m_encoder = m_hold_ultra_encoder;
-		}
-		if (m_encoder == NULL)
-			return FALSE;
-		ultra_encoder_in_use = true;//
-
-		// sf at 2003 - UltraEncoder Queing does not work with DSM - Disable it in this case until
-		// some work is done to improve Queuing/DSM compatibility
-		((vncEncodeUltra*)(m_encoder))->EnableQueuing(m_fEnableQueuing);
-		EnableXCursor(false);
-		EnableRichCursor(false);
-		EnableCache(false);
-		break;
-
-	case rfbEncodingUltra2:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder requested\n"));
-
-		// Create a Zlib encoder, if needed.
-		// If a Zlib encoder was used previously, then reuse it here
-		// to maintain zlib dictionary synchronization with the viewer.
-		if ( m_hold_ultra2_encoder == NULL )
-		{
-			m_encoder = new vncEncodeUltra2;
-		}
-		else
-		{
-			m_encoder = m_hold_ultra2_encoder;
-		}
-		if (m_encoder == NULL)
-			return FALSE;
-		ultra2_encoder_in_use = true;//
-
-		// sf at 2003 - UltraEncoder Queing does not work with DSM - Disable it in this case until
-		// some work is done to improve Queuing/DSM compatibility
-		EnableXCursor(false);
-		EnableRichCursor(false);
-		EnableCache(false);
-		break;
-
-	case rfbEncodingZRLE:
-		vnclog.Print(LL_INTINFO, VNCLOG("ZRLE encoder requested\n"));
-		if (!zrleEncoder)
-			zrleEncoder = new vncEncodeZRLE;
-		m_encoder = zrleEncoder;
-		((vncEncodeZRLE*)zrleEncoder)->m_use_zywrle = FALSE;
-		break;
-
-	case rfbEncodingZYWRLE:
-		vnclog.Print(LL_INTINFO, VNCLOG("ZYWRLE encoder requested\n"));
-		if (!zrleEncoder)
-			zrleEncoder = new vncEncodeZRLE;
-		m_encoder = zrleEncoder;
-		((vncEncodeZRLE*)zrleEncoder)->m_use_zywrle = TRUE;
-		break;
-
-	case rfbEncodingZlib:
-
-		vnclog.Print(LL_INTINFO, VNCLOG("Zlib encoder requested\n"));
-
-		// Create a Zlib encoder, if needed.
-		// If a Zlib encoder was used previously, then reuse it here
-		// to maintain zlib dictionary synchronization with the viewer.
-		if ( m_hold_zlib_encoder == NULL )
-		{
-			m_encoder = new vncEncodeZlib;
-		}
-		else
-		{
-			m_encoder = m_hold_zlib_encoder;
-		}
-		if (m_encoder == NULL)
-			return FALSE;
-		zlib_encoder_in_use = true;//
-		break;
-
-
-	case rfbEncodingZlibHex:
-		vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex encoder requested\n"));
-
-		// Create a ZlibHex encoder, if needed.
-		// If a Zlibhex encoder was used previously, then reuse it here
-		// to maintain zlib dictionary synchronization with the viewer.
-		if ( m_hold_zlibhex_encoder == NULL )
-		{
-			m_encoder = new vncEncodeZlibHex;
-		}
-		else
-		{
-			m_encoder = m_hold_zlibhex_encoder;
-		}
-		if (m_encoder == NULL)
-			return FALSE;
-		zlibhex_encoder_in_use = true;//
-		break;
-
-
-	case rfbEncodingTight:
-		vnclog.Print(LL_INTINFO, VNCLOG("Tight encoder requested\n"));
-
-		// Create a Tight encoder, if needed.
-		// If a Tight encoder was used previously, then reuse it here
-		// to maintain zlib dictionaries synchronization with the viewer.
-		if ( m_hold_tight_encoder == NULL )
-		{
-			m_encoder = new vncEncodeTight;
-		}
-		else
-		{
-			m_encoder = m_hold_tight_encoder;
-		}
-		if (m_encoder == NULL)
-			return FALSE;
-		tight_encoder_in_use = true;
-		break;
-
-	default:
-		// An unknown encoding was specified
-		vnclog.Print(LL_INTERR, VNCLOG("unknown encoder requested\n"));
-
-		return FALSE;
-	}
-
-	// Initialise it and give it the pixel format
-	m_encoder->Init();
-	m_encoder->SetLocalFormat(
-			m_scrinfo.format,
-			m_scrinfo.framebufferWidth,
-			m_scrinfo.framebufferHeight);
-	if (m_clientfmtset)
-		if (!m_encoder->SetRemoteFormat(m_clientformat))
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported\n"));
-
-			return FALSE;
-		}
-
-	if (reinitialize)
-	{
-		if (m_encoder != NULL)
-		{
-			m_encoder->EnableXCursor(m_use_xcursor);
-			m_encoder->EnableRichCursor(m_use_richcursor);
-			m_encoder->SetCompressLevel(m_compresslevel);
-			m_encoder->SetQualityLevel(m_qualitylevel);
-			m_encoder->EnableLastRect(m_use_lastrect);
-		}
-
-	}
-		m_buffer->ClearCache();
-		m_buffer->ClearBack();
-		m_encoder->SetSWOffset(m_SWOffsetx,m_SWOffsety);
-	// Check that the client buffer is compatible
-	return CheckBuffer();
-}
-
-// Predict how many update rectangles a given rect will encode to
-// For Raw, RRE or Hextile, this is always 1.  For CoRRE, may be more,
-// because each update rect is limited in size.
-inline UINT
-vncEncodeMgr::GetNumCodedRects(const rfb::Rect &rect)
-{
-	// sf at 2002 - Tight encoding
-	// TODO: Add the appropriate virtual NumCodedRects function to Tight encoder instead.
-	if (tight_encoder_in_use || zlibhex_encoder_in_use)
-	{
-		RECT TRect;
-		TRect.right = rect.br.x;
-		TRect.left = rect.tl.x;
-		TRect.top = rect.tl.y;
-		TRect.bottom = rect.br.y;
-		return m_encoder->NumCodedRects(TRect);
-	}
-
-	return m_encoder->NumCodedRects(rect);
-}
-
-//
-// -=- Pixel format translation
-//
-
-// Update the local pixel format used by the encoder
-inline BOOL
-vncEncodeMgr::SetServerFormat()
-{
-	if (m_encoder) {
-		return CheckBuffer() && m_encoder->SetLocalFormat(
-			m_scrinfo.format,
-			m_scrinfo.framebufferWidth,
-			m_scrinfo.framebufferHeight);
-	}
-	return FALSE;
-}
-
-// Specify the client's pixel format
-inline BOOL
-vncEncodeMgr::SetClientFormat(rfbPixelFormat &format)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("SetClientFormat called\n"));
-	
-	// Save the desired format
-	m_clientfmtset = TRUE;
-	m_clientformat = format;
-
-	// Tell the encoder of the new format
-	if (m_encoder != NULL)
-		m_encoder->SetRemoteFormat(format);
-
-	// Check that the output buffer is sufficient
-	if (!CheckBuffer())
-		return FALSE;
-
-	return TRUE;
-}
-
-// Translate a rectangle to the client's pixel format
-inline UINT
-vncEncodeMgr::EncodeRect(const rfb::Rect &rect,VSocket *outconn)
-{
-	//Fix crash after resolution change
-	// vncencoder seems still to have to old resolution while other parts are already updated
-	// Could not find it, but this extra check eliminate the out of buffer updates during transition
-	if(rect.br.x>m_scrinfo.framebufferWidth) 
-		return 0;
-	if(rect.br.y>m_scrinfo.framebufferHeight) 
-		return 0;
-	// Call the encoder to encode the rectangle into the client buffer...
-	/*if (!m_clientbackbuffif){*/
-	if (!m_buffer->m_backbuff){
-		vnclog.Print(LL_INTERR, "no client back-buffer available in EncodeRect\n");
-		return 0;
-	}
-	if (zlib_encoder_in_use)
-	{
-		if (m_use_xor)
-		{
-		return m_encoder->EncodeRect(m_buffer->m_backbuff, m_buffer->m_cachebuff, outconn ,m_clientbuff, rect);
-		}
-		else return m_encoder->EncodeRect(m_buffer->m_backbuff, NULL, outconn ,m_clientbuff, rect);
-	}
-	if (ultra_encoder_in_use)
-	{
-		return m_encoder->EncodeRect(m_buffer->m_backbuff, outconn ,m_clientbuff, rect);
-	}
-	if (ultra2_encoder_in_use)
-	{
-		return m_encoder->EncodeRect(m_buffer->m_backbuff, outconn ,m_clientbuff, rect);
-	}
-
-	// sf at 2002 - Tight encoding
-	if (tight_encoder_in_use || zlibhex_encoder_in_use  || ultra_encoder_in_use || ultra2_encoder_in_use)
-	{
-		RECT TRect;
-		TRect.right = rect.br.x;
-		TRect.left = rect.tl.x;
-		TRect.top = rect.tl.y;
-		TRect.bottom = rect.br.y;
-		return m_encoder->EncodeRect(m_buffer->m_backbuff, outconn, m_clientbuff, TRect); // sf at 2002 - For Tight...
-	}
-
-	return m_encoder->EncodeRect(m_buffer->m_backbuff, m_clientbuff, rect);
-}
-
-rfb::Rect 
-vncEncodeMgr::GetSize()
-{
-	return m_buffer->GetSize();
-}
-inline void
-vncEncodeMgr::SetSWOffset(int x,int y)
-{
-	m_SWOffsetx=x;
-	m_SWOffsety=y;
-	m_encoder->SetSWOffset(x,y);
-}
-
-inline void
-vncEncodeMgr::EnableXCursor(BOOL enable)
-{
-	m_use_xcursor = enable;
-	if (m_encoder != NULL) {
-		m_encoder->EnableXCursor(enable);
-	}
-	m_hcursor = NULL;
-}
-
-inline void
-vncEncodeMgr::EnableRichCursor(BOOL enable)
-{
-	m_use_richcursor = enable;
-	if (m_encoder != NULL) {
-		m_encoder->EnableRichCursor(enable);
-	}
-	m_hcursor = NULL;
-}
-
-// Check if cursor shape update should be sent
-inline BOOL
-vncEncodeMgr::IsCursorUpdatePending()
-{
-	if (m_use_xcursor || m_use_richcursor) {
-		return m_buffer->IsCursorUpdatePending();
-	}
-	return false;
-}
-
-inline BOOL
-vncEncodeMgr::WasCursorUpdatePending()
-{
-	BOOL pending=m_buffer->IsCursorUpdatePending();
-	m_buffer->SetCursorPending(FALSE);
-	return pending;
-}
-
-inline BOOL
-vncEncodeMgr::SendCursorShape(VSocket *outConn) {
-	return m_encoder->SendCursorShape(outConn, m_buffer->m_desktop);
-}
-
-inline BOOL
-vncEncodeMgr::SendEmptyCursorShape(VSocket *outConn) {
-	return m_encoder->SendEmptyCursorShape(outConn);
-}
-
-inline BOOL
-vncEncodeMgr::IsXCursorSupported() {
-	return m_encoder->IsXCursorSupported();
-}
-
-// Tight
-inline void
-vncEncodeMgr::SetCompressLevel(int level)
-{
-	m_compresslevel = (level >= 0 && level <= 9) ? level : 6;
-	if (m_encoder != NULL)
-		m_encoder->SetCompressLevel(m_compresslevel);
-}
-
-inline void
-vncEncodeMgr::SetQualityLevel(int level)
-{
-	m_qualitylevel = (level >= 0 && level <= 9) ? level : -1;
-	if (m_encoder != NULL)
-		m_encoder->SetQualityLevel(m_qualitylevel);
-}
-
-inline void
-vncEncodeMgr::EnableLastRect(BOOL enable)
-{
-	m_use_lastrect = enable;
-	if (m_encoder != NULL) {
-		m_encoder->EnableLastRect(enable);
-	}
-}
-
-inline BOOL
-vncEncodeMgr::IsMouseWheelTight()
-{
-	if (m_use_tight && !m_use_xor) //tight client
-		return true;
-	return false;
-}
-
-// sf at 2005
-inline void vncEncodeMgr::EnableGreyPalette(BOOL enable)
-{
-	m_buffer->EnableGreyPalette(enable);
-}
-
-inline void
-vncEncodeMgr::EnableCache(BOOL enabled)
-{
-	m_cache_enabled = enabled;
-	// if (enabled)
-	m_buffer->EnableCache(enabled);
-}
-
-inline BOOL
-vncEncodeMgr::IsCacheEnabled()
-{
-	return m_cache_enabled;
-}
-
-inline void
-vncEncodeMgr::LastRect(VSocket *outConn)
-{
-	m_encoder->LastRect(outConn);
-}
-
-// Modif cs at 2005
-#ifdef DSHOW
-inline BOOL
-vncEncodeMgr::ResetZRLEEncoding(void)
-{
-	if (NULL != zrleEncoder)
-	{
-		delete zrleEncoder;
-
-		zrleEncoder = NULL;
-
-		zrleEncoder = new vncEncodeZRLE;
-
-		m_encoder = zrleEncoder;
-
-		// Initialise it and give it the pixel format
-		m_encoder->Init();
-
-		m_encoder->SetLocalFormat(	m_scrinfo.format,
-									m_scrinfo.framebufferWidth,
-									m_scrinfo.framebufferHeight);
-
-		if (m_clientfmtset)
-		{
-			if (!m_encoder->SetRemoteFormat(m_clientformat))
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported\n"));
-
-				return FALSE;
-			}
-		}
-
-		if (m_encoder != NULL)
-		{
-			m_encoder->EnableXCursor(m_use_xcursor);
-			m_encoder->EnableRichCursor(m_use_richcursor);
-			m_encoder->SetCompressLevel(m_compresslevel);
-			m_encoder->SetQualityLevel(m_qualitylevel);
-			m_encoder->EnableLastRect(m_use_lastrect);
-		}
-
-		m_buffer->ClearCache();
-		m_buffer->ClearBack();
-
-		// Check that the client buffer is compatible
-		return CheckBuffer();
-	}
-
-	return FALSE;
-}			
-#endif
-
-#endif // _WINVNC_VNCENCODEMGR
-
diff --git a/ica/win32/winvnc/winvnc/vncencoder.cpp b/ica/win32/winvnc/winvnc/vncencoder.cpp
deleted file mode 100644
index 1ffb6c6..0000000
--- a/ica/win32/winvnc/winvnc/vncencoder.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncoder - Object used to encode data for RFB
-
-#include "vncencoder.h"
-#include "vncbuffer.h"
-
-// Pixel format used internally when the client is palette-based & server is truecolour
-
-static const rfbPixelFormat BGR233Format = {
-    8, 8, 0, 1, 7, 7, 3, 0, 3, 6
-};
-
-// The base (RAW) encoder class
-
-vncEncoder::vncEncoder()
-{
-	ZeroMemory(&m_remoteformat, sizeof(m_remoteformat));
-	ZeroMemory(&m_localformat, sizeof(m_localformat));
-	ZeroMemory(&m_transformat, sizeof(m_transformat));
-	m_transtable = NULL;
-	m_localpalette = NULL;
-	m_bytesPerRow = 0;
-
-	m_SWOffsetx=0;
-	m_SWOffsety=0;
-
-	// Tight - CURSOR HANDLING
-	m_compresslevel = 6;
-	m_qualitylevel = -1;
-	m_use_lastrect = FALSE;
-	m_use_xcursor = FALSE;
-	m_use_richcursor = FALSE;
-
-}
-
-vncEncoder::~vncEncoder()
-{
-	if (m_transtable != NULL)
-	{
-		free(m_transtable);
-		m_transtable = NULL;
-	}
-	if (m_localpalette != NULL)
-	{
-		free(m_localpalette);
-		m_localpalette = NULL;
-	}
-}
-
-void
-vncEncoder::Init()
-{
-	transmittedSize = 0;
-	dataSize = 0;
-	rectangleOverhead = 0;
-	encodedSize = 0;
-}
-
-UINT
-vncEncoder::RequiredBuffSize(UINT width, UINT height)
-{
-	return sz_rfbFramebufferUpdateRectHeader +
-		(width * height * m_remoteformat.bitsPerPixel)/8;
-}
-
-UINT
-vncEncoder::NumCodedRects(const rfb::Rect &rect)
-{
-	return 1;
-}
-
-
-// Tight
-UINT vncEncoder::NumCodedRects(RECT &rect)
-{
-	rfb::Rect TRect;
-	TRect.br.x = rect.right;
-	TRect.tl.x = rect.left;
-	TRect.tl.y = rect.top;
-	TRect.br.y = rect.bottom;
-	
-	return NumCodedRects(TRect);
-}
-
-// Translate a rectangle
-inline void
-vncEncoder::Translate(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	// Calculate where in the source rectangle to read from
-	BYTE *sourcepos = (BYTE *)(source + (m_bytesPerRow * rect.tl.y)+(rect.tl.x * (m_localformat.bitsPerPixel / 8)));
-
-	// Call the translation function
-	(*m_transfunc) (m_transtable,
-					&m_localformat,
-					&m_transformat,
-					(char *)sourcepos,
-					(char *)dest,
-					m_bytesPerRow,
-					rect.br.x-rect.tl.x,
-					rect.br.y-rect.tl.y
-					);
-}
-
-// Encode a rectangle
-inline UINT
-vncEncoder::EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	// Create the header for the update in the destination area
-	rfbFramebufferUpdateRectHeader *surh = (rfbFramebufferUpdateRectHeader *)dest;
-	surh->r.x = (CARD16) (rect.tl.x-m_SWOffsetx);
-	surh->r.y = (CARD16) (rect.tl.y-m_SWOffsety);
-	surh->r.w = (CARD16) (rect.br.x-rect.tl.x);
-	surh->r.h = (CARD16) (rect.br.y-rect.tl.y);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingRaw);
-
-	// Translate the data in place in the output buffer
-	Translate(source, dest + sz_rfbFramebufferUpdateRectHeader, rect);
-
-	// Return the buffer size
-	return sz_rfbFramebufferUpdateRectHeader +
-		((rect.br.x-rect.tl.x)*(rect.br.y-rect.tl.y)*m_remoteformat.bitsPerPixel) / 8;
-}
-
-inline UINT
-vncEncoder::EncodeRect(BYTE *source, BYTE *source2,VSocket *outConn, BYTE *dest, const rfb::Rect &rect)
-{
-
-	return EncodeRect(source, dest, rect);
-
-}
-
-inline UINT
-vncEncoder::EncodeRect(BYTE *source,VSocket *outConn, BYTE *dest, const rfb::Rect &rect)
-{
-
-	return EncodeRect(source, dest, rect);
-
-}
-
-
-// Tight
-inline UINT
-vncEncoder::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect)
-{
-	rfb::Rect TRect;
-	TRect.br.x = rect.right;
-	TRect.tl.x = rect.left;
-	TRect.tl.y = rect.top;
-	TRect.br.y = rect.bottom;
-	
-	return EncodeRect(source, dest, TRect);
-}
-
-
-BOOL
-vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("remote palette data requested\n"));
-
-	// If the local server is palette-based then call SetTranslateFunction
-	// to update the palette-to-truecolour mapping:
-	if (!m_localformat.trueColour)
-	{
-		if (!SetTranslateFunction())
-			return FALSE;
-	}
-
-	// If the client is truecolour then don't fill in the palette buffer...
-	if (m_remoteformat.trueColour)
-		return FALSE;
-
-	// If the server is truecolour then fake BGR233
-	if (m_localformat.trueColour)
-	{
-		// Fake BGR233...
-		vnclog.Print(LL_INTINFO, VNCLOG("generating BGR233 palette data\n"));
-
-		int ncolors = 1 << m_transformat.bitsPerPixel;
-		if (m_localpalette != NULL)
-			free(m_localpalette);
-		m_localpalette = (char *)malloc(ncolors * sizeof(RGBQUAD));
-		
-		if (m_localpalette != NULL)
-		{
-			RGBQUAD *colour = (RGBQUAD *)m_localpalette;
-
-			for (int i=0; i<ncolors; i++)
-			{
-				colour[i].rgbBlue = (((i >> m_transformat.blueShift) & m_transformat.blueMax) * 255) / m_transformat.blueMax;
-				colour[i].rgbRed = (((i >> m_transformat.redShift) & m_transformat.redMax) * 255) / m_transformat.redMax;
-				colour[i].rgbGreen = (((i >> m_transformat.greenShift) & m_transformat.greenMax) * 255) / m_transformat.greenMax;
-			}
-		}
-	}
-	else
-	{
-		// Set up RGBQUAD rfbPixelFormat info
-		vnclog.Print(LL_INTINFO, VNCLOG("generating 8-bit palette data\n"));
-
-		rfbPixelFormat remote;
-		remote.trueColour = TRUE;
-		remote.bitsPerPixel = 32;
-		remote.depth = 24;
-		remote.bigEndian = FALSE;
-		remote.redMax = remote.greenMax = remote.blueMax = 255;
-		remote.redShift = 16;
-		remote.greenShift = 8;
-		remote.blueShift = 0;
-
-		// We get the ColourMapSingleTableFns procedure to handle retrieval of the
-		// palette for us, to avoid replicating the code!
-		(*rfbInitColourMapSingleTableFns[remote.bitsPerPixel / 16])
-			(&m_localpalette, &m_localformat, &remote);
-	}
-
-	// Did we create some palette info?
-	if (m_localpalette == NULL)
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("failed to obtain colour map data!\n"));
-		return FALSE;
-	}
-
-	// Copy the data into the RGBQUAD buffer
-	memcpy(quadlist, m_localpalette, ncolours*sizeof(RGBQUAD));
-
-	return TRUE;
-}
-
-BOOL
-vncEncoder::SetTranslateFunction()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("settranslatefunction called\n"));
-
-	// By default, the actual format translated to matches the client format
-	m_transformat = m_remoteformat;
-
-    // Check that bits per pixel values are valid
-
-    if ((m_transformat.bitsPerPixel != 8) &&
-		(m_transformat.bitsPerPixel != 16) &&
-		(m_transformat.bitsPerPixel != 32))
-    {
-		vnclog.Print(LL_CONNERR,
-			VNCLOG("only 8, 16 or 32 bits supported remotely - %d requested\n"),
-			m_transformat.bitsPerPixel
-			);
-
-		return FALSE;
-    }
-	
-    if ((m_localformat.bitsPerPixel != 8) &&
-		(m_localformat.bitsPerPixel != 16) &&
-		(m_localformat.bitsPerPixel != 32))
-    {
-		vnclog.Print(LL_CONNERR,
-			VNCLOG("only 8, 16 or 32 bits supported locally - %d in use\n"),
-			m_localformat.bitsPerPixel
-			);
-
-		return FALSE;
-    }
-
-	if (!m_transformat.trueColour && (m_transformat.bitsPerPixel != 8))
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported remotely\n"));
-		return FALSE;
-	}
-	if (!m_localformat.trueColour && (m_localformat.bitsPerPixel != 8))
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported locally\n"));
-		return FALSE;
-	}
-
-	// Now choose the translation function to use
-
-	// We don't do remote palettes unless they're 8-bit
-    if (!m_transformat.trueColour)
-	{
-		// Is the local format the same?
-		if (!m_localformat.trueColour &&
-			(m_localformat.bitsPerPixel == m_transformat.bitsPerPixel))
-		{
-			// Yes, so don't do any encoding
-			vnclog.Print(LL_INTINFO, VNCLOG("no encoding required - both 8-bit palettized\n"));
-
-			m_transfunc = rfbTranslateNone;
-
-			// The first time the client sends an update, it will call
-			// GetRemotePalette to get the palette information required
-			return TRUE;
-		}
-		else if (m_localformat.trueColour)
-		{
-			// Local side is truecolour, remote is palettized
-			vnclog.Print(LL_INTINFO, VNCLOG("local truecolour, remote palettized.  using BGR233 palette\n"));
-
-			// Fill out the translation table as if writing to BGR233
-			m_transformat = BGR233Format;
-
-			// Continue on down to the main translation section
-		}
-		else
-		{
-			// No, so not supported yet...
-			vnclog.Print(LL_CONNERR, VNCLOG("unknown local pixel format in use!\n"));
-			return FALSE;
-		}
-	}
-
-	// REMOTE FORMAT IS TRUE-COLOUR
-
-	// Handle 8-bit palette-based local data
-	if (!m_localformat.trueColour)
-	{
-		// 8-bit palette to truecolour...
-
-		// Yes, so pick the right translation function!
-		vnclog.Print(LL_INTINFO, VNCLOG("using 8-bit colourmap to truecolour translation\n"));
-
-		m_transfunc = rfbTranslateWithSingleTableFns
-			[m_localformat.bitsPerPixel / 16]
-			[m_transformat.bitsPerPixel / 16];
-
-		(*rfbInitColourMapSingleTableFns[m_transformat.bitsPerPixel / 16])
-			(&m_transtable, &m_localformat, &m_transformat);
-		return m_transtable != NULL;
-	}
-
-	// If we reach here then we're doing truecolour to truecolour
-
-	// Are the formats identical?
-    if (PF_EQ(m_transformat,m_localformat))
-	{
-		// Yes, so use the null translation function
-		vnclog.Print(LL_INTINFO, VNCLOG("no translation required\n"));
-
-		m_transfunc = rfbTranslateNone;
-
-		return TRUE;
-    }
-
-	// Is the local display a 16-bit one
-    if (m_localformat.bitsPerPixel == 16)
-	{
-		// Yes, so use a single lookup-table
-		vnclog.Print(LL_INTINFO, VNCLOG("single LUT used\n"));
-
-		m_transfunc = rfbTranslateWithSingleTableFns
-			[m_localformat.bitsPerPixel / 16]
-			[m_transformat.bitsPerPixel / 16];
-
-		(*rfbInitTrueColourSingleTableFns[m_transformat.bitsPerPixel / 16])
-			(&m_transtable, &m_localformat, &m_transformat);
-    }
-	else
-	{
-		// No, so use three tables - one for each of R, G, B.
-		vnclog.Print(LL_INTINFO, VNCLOG("triple LUT used\n"));
-
-		m_transfunc = rfbTranslateWithRGBTablesFns
-			[m_localformat.bitsPerPixel / 16]
-			[m_transformat.bitsPerPixel / 16];
-
-		(*rfbInitTrueColourRGBTablesFns[m_transformat.bitsPerPixel / 16])
-			(&m_transtable, &m_localformat, &m_transformat);
-    }
-
-	return m_transtable != NULL;
-}
-
-BOOL
-vncEncoder::SetLocalFormat(rfbPixelFormat &pixformat, int width, int height)
-{
-	// Work out the bytes per row at the local end - useful
-	m_bytesPerRow = width * pixformat.bitsPerPixel/8;
-	framebufferWidth=width;
-	framebufferHeight=height;
-	// Save the pixel format
-	m_localformat = pixformat;
-	return SetTranslateFunction();
-}
-
-BOOL
-vncEncoder::SetRemoteFormat(rfbPixelFormat &pixformat)
-{
-	// Save the client pixel format
-	m_remoteformat = pixformat;
-
-	return SetTranslateFunction();
-}
-
-void
-vncEncoder::SetSWOffset(int x,int y)
-{
-	m_SWOffsetx=x;
-	m_SWOffsety=y;
-}
-
-// Tight
-void
-vncEncoder::SetCompressLevel(int level)
-{
-	m_compresslevel = (level >= 0 && level <= 9) ? level : 6;
-}
-
-void
-vncEncoder::SetQualityLevel(int level)
-{
-	m_qualitylevel = (level >= 0 && level <= 9) ? level : -1;
-}
-
-inline void
-vncEncoder::LastRect(VSocket *outConn)
-{
-
-}
diff --git a/ica/win32/winvnc/winvnc/vncencoder.h b/ica/win32/winvnc/winvnc/vncencoder.h
deleted file mode 100644
index 3675c0a..0000000
--- a/ica/win32/winvnc/winvnc/vncencoder.h
+++ /dev/null
@@ -1,139 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncoder object
-
-// The vncEncoder object encodes regions of a display buffer for sending
-// to a client
-
-class vncEncoder;
-
-#if !defined(RFBENCODER_DEFINED)
-#define RFBENCODER_DEFINED
-#pragma once
-
-#include "vncbuffer.h"
-#include "translate.h"
-#include "vsocket.h"
-#include "vncmemcpy.h"
-
-// Class definition
-
-class vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncoder();
-	virtual ~vncEncoder();
-
-	// Initialisation
-	virtual void Init();
-
-	// Encoder stats used by the buffer object
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-	virtual UINT NumCodedRects(RECT &rect); // For Tight
-
-
-	// Translation & encoding routines
-	//  - Source is the base address of the ENTIRE SCREEN buffer.
-	//    The Translate routine compensates automatically for the desired rectangle.
-	//  - Dest is the base address to encode the rect to.  The rect will be encoded
-	//    into a contiguous region of the buffer.
-	virtual void Translate(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeRect(BYTE *source, BYTE *source2,VSocket *outConn, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeRect(BYTE *source,VSocket *outConn, BYTE *dest, const rfb::Rect &rect);
-	virtual UINT EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &rect); // sf at 2002 - For Tight...
-
-	// CURSOR HANDLING
-	void Translate(BYTE *source, BYTE *dest, int w, int h, int bytesPerRow);
-
-	// Translation handling
-	BOOL SetLocalFormat(rfbPixelFormat &pixformat, int width, int height);
-	BOOL SetRemoteFormat(rfbPixelFormat &pixformat);
-
-	// Colour map handling
-	BOOL GetRemotePalette(RGBQUAD *quadlist, UINT ncolours);
-	void SetSWOffset(int x,int y);
-
-	// Tight
-	void SetCompressLevel(int level);
-	void SetQualityLevel(int level);
-	void EnableLastRect(BOOL enable) { m_use_lastrect = enable; }
-
-	// Tight - CURSOR HANDLING
-	void EnableXCursor(BOOL enable) { m_use_xcursor = enable; }
-	void EnableRichCursor(BOOL enable) { m_use_richcursor = enable; }
-	BOOL SendEmptyCursorShape(VSocket *outConn);
-	BOOL SendCursorShape(VSocket *outConn, vncDesktop *desktop);
-	BOOL IsXCursorSupported();
-
-	virtual void LastRect(VSocket *outConn); //xorzlib
-
-protected:
-	BOOL SetTranslateFunction();
-
-	// Tight - CURSOR HANDLING
-	BOOL SendXCursorShape(VSocket *outConn, BYTE *mask, int xhot,int yhot,int width,int height);
-	BOOL SendRichCursorShape(VSocket *outConn, BYTE *mbits, BYTE *cbits, int xhot,int yhot,int width,int height);
-	void FixCursorMask(BYTE *mbits, BYTE *cbits, int width, int height, int width_bytes);
-
-// Implementation
-protected:
-	rfbTranslateFnType	m_transfunc;			// Translator function
-	char*				m_transtable;			// Colour translation LUT
-	char*				m_localpalette;			// Palette info if client is palette-based
-	rfbPixelFormat		m_localformat;			// Pixel Format info
-	rfbPixelFormat		m_remoteformat;			// Client pixel format info
-	rfbPixelFormat		m_transformat;			// Internal format used for translation (usually == client format)
-	int					m_bytesPerRow;			// Number of bytes per row locally
-	int					framebufferWidth;
-	int					framebufferHeight;
-	int m_SWOffsetx;
-	int m_SWOffsety;
-	int					dataSize;				// Total size of raw data encoded
-	int					rectangleOverhead;		// Total size of rectangle header data
-	int					encodedSize;			// Total size of encoded data
-	int					transmittedSize;		// Total amount of data sent
-
-	// Tight
-	int					m_compresslevel;		// Encoding-specific compression level (if needed).
-	int					m_qualitylevel;			// Image quality level for lossy JPEG compression.
-	BOOL				m_use_lastrect;
-	// Tight - CURSOR HANDLING
-	BOOL				m_use_xcursor;			// XCursor cursor shape updates allowed.
-	BOOL				m_use_richcursor;		// RichCursor cursor shape updates allowed.
-
-//	Ultravncmemcpy mem;
-};
-
-#endif // vncENCODER_DEFINED
diff --git a/ica/win32/winvnc/winvnc/vncencoderCursor.cpp b/ica/win32/winvnc/winvnc/vncencoderCursor.cpp
deleted file mode 100644
index e734f70..0000000
--- a/ica/win32/winvnc/winvnc/vncencoderCursor.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-//  Copyright (C) 2000 Const Kaplinsky. All Rights Reserved.
-
-#include "vncencoder.h"
-#include "vncbuffer.h"
-#include "vncdesktop.h"
-
-//
-// New code implementing cursor shape updates.
-//
-BOOL
-vncEncoder::IsXCursorSupported()
-{
-	if (m_use_xcursor) return true;
-	if (m_use_richcursor) return true;
-	return false;
-}
-BOOL
-vncEncoder::SendEmptyCursorShape(VSocket *outConn)
-{
-	rfbFramebufferUpdateRectHeader hdr;
-	hdr.r.x = Swap16IfLE(0);
-	hdr.r.y = Swap16IfLE(0);
-	hdr.r.w = Swap16IfLE(0);
-	hdr.r.h = Swap16IfLE(0);
-	if (m_use_xcursor) {
-		hdr.encoding = Swap32IfLE(rfbEncodingXCursor);
-	} else {
-		hdr.encoding = Swap32IfLE(rfbEncodingRichCursor);
-	}
-
-	return outConn->SendExactQueue((char *)&hdr, sizeof(hdr));
-}
-
-BOOL
-vncEncoder::SendCursorShape(VSocket *outConn, vncDesktop *desktop)
-{
-	// Make sure the function is used correctly
-	if (!m_use_xcursor && !m_use_richcursor)
-		return FALSE;
-
-	// Check mouse cursor handle
-	HCURSOR hcursor = desktop->GetCursor();
-	if (hcursor == NULL) {
-		vnclog.Print(LL_INTINFO, VNCLOG("cursor handle is NULL.\n"));
-		return FALSE;
-	}
-
-	// Get cursor info
-	ICONINFO IconInfo;
-	if (!GetIconInfo(hcursor, &IconInfo)) {
-		vnclog.Print(LL_INTINFO, VNCLOG("GetIconInfo() failed.\n"));
-		return FALSE;
-	}
-	BOOL isColorCursor = FALSE;
-	if (IconInfo.hbmColor != NULL) {
-		isColorCursor = TRUE;
-		DeleteObject(IconInfo.hbmColor);
-	}
-	if (IconInfo.hbmMask == NULL) {
-		vnclog.Print(LL_INTINFO, VNCLOG("cursor bitmap handle is NULL.\n"));
-		return FALSE;
-	}
-
-	// Check bitmap info for the cursor
-	BITMAP bmMask;
-	if (!GetObject(IconInfo.hbmMask, sizeof(BITMAP), (LPVOID)&bmMask)) {
-		vnclog.Print(LL_INTINFO, VNCLOG("GetObject() for bitmap failed.\n"));
-		DeleteObject(IconInfo.hbmMask);
-		return FALSE;
-	}
-	if (bmMask.bmPlanes != 1 || bmMask.bmBitsPixel != 1) {
-		vnclog.Print(LL_INTINFO, VNCLOG("incorrect data in cursor bitmap.\n"));
-		DeleteObject(IconInfo.hbmMask);
-		return FALSE;
-	}
-
-	// Get monochrome bitmap data for cursor
-	// NOTE: they say we should use GetDIBits() instead of GetBitmapBits().
-	BYTE *mbits = new BYTE[bmMask.bmWidthBytes * bmMask.bmHeight];
-	if (mbits == NULL)
-    {
-		DeleteObject(IconInfo.hbmMask);
-		return FALSE;
-    }
-
-	BOOL success = GetBitmapBits(IconInfo.hbmMask,
-								 bmMask.bmWidthBytes * bmMask.bmHeight, mbits);
-	DeleteObject(IconInfo.hbmMask);
-
-	if (!success) {
-		vnclog.Print(LL_INTINFO, VNCLOG("GetBitmapBits() failed.\n"));
-		delete[] mbits;
-		return FALSE;
-	}
-
-	// Compute cursor dimensions
-	int width = bmMask.bmWidth;
-	int height = (isColorCursor) ? bmMask.bmHeight : bmMask.bmHeight/2;
-
-	// Call appropriate routine to send cursor shape update
-	if (!isColorCursor && m_use_xcursor) {
-		FixCursorMask(mbits, NULL, width, bmMask.bmHeight, bmMask.bmWidthBytes);
-		success = SendXCursorShape(outConn, mbits,
-								   IconInfo.xHotspot, IconInfo.yHotspot,
-								   width, height);
-	}
-	else if (m_use_richcursor) {
-		int cbits_size = width * height * 4;
-		BYTE *cbits = new BYTE[cbits_size];
-		if (cbits == NULL) {
-			delete[] mbits;
-			return FALSE;
-		}
-		if (!desktop->GetRichCursorData(cbits, hcursor, width, height)) {
-			vnclog.Print(LL_INTINFO, VNCLOG("vncDesktop::GetRichCursorData() failed.\n"));
-			delete[] mbits;
-			delete[] cbits;
-			return FALSE;
-		}
-		FixCursorMask(mbits, cbits, width, height, bmMask.bmWidthBytes);
-		success = SendRichCursorShape(outConn, mbits, cbits,
-									  IconInfo.xHotspot, IconInfo.yHotspot,
-									  width, height);
-		delete[] cbits;
-	}
-	else {
-		success = FALSE;	// FIXME: We could convert RichCursor -> XCursor.
-	}
-
-	// Cleanup
-	delete[] mbits;
-
-	return success;
-}
-
-BOOL
-vncEncoder::SendXCursorShape(VSocket *outConn, BYTE *mask,
-							 int xhot, int yhot, int width, int height)
-{
-	rfbFramebufferUpdateRectHeader hdr;
-	hdr.r.x = Swap16IfLE(xhot);
-	hdr.r.y = Swap16IfLE(yhot);
-	hdr.r.w = Swap16IfLE(width);
-	hdr.r.h = Swap16IfLE(height);
-	hdr.encoding = Swap32IfLE(rfbEncodingXCursor);
-
-	BYTE colors[6] = { 0, 0, 0, 0xFF, 0xFF, 0xFF };
-	int maskRowSize = (width + 7) / 8;
-	int maskSize = maskRowSize * height;
-
-	if ( !outConn->SendExactQueue((char *)&hdr, sizeof(hdr)) ||
-		 !outConn->SendExactQueue((char *)colors, 6) ||
-		 !outConn->SendExactQueue((char *)&mask[maskSize], maskSize) ||
-		 !outConn->SendExactQueue((char *)mask, maskSize) ) {
-		return FALSE;
-	}
-	return TRUE;
-}
-
-BOOL
-vncEncoder::SendRichCursorShape(VSocket *outConn, BYTE *mbits, BYTE *cbits,
-								int xhot, int yhot, int width, int height)
-{
-	rfbFramebufferUpdateRectHeader hdr;
-	hdr.r.x = Swap16IfLE(xhot);
-	hdr.r.y = Swap16IfLE(yhot);
-	hdr.r.w = Swap16IfLE(width);
-	hdr.r.h = Swap16IfLE(height);
-	hdr.encoding = Swap32IfLE(rfbEncodingRichCursor);
-
-	// Cet cursor image in local pixel format
-	int srcbuf_rowsize = width * (m_localformat.bitsPerPixel / 8);
-	while (srcbuf_rowsize % sizeof(DWORD))
-		srcbuf_rowsize++;	// Actually, this should never happen
-
-	// Translate image to client pixel format
-	int dstbuf_size = width * height * (m_remoteformat.bitsPerPixel / 8);
-	BYTE *dstbuf = new BYTE[dstbuf_size];
-	Translate(cbits, dstbuf, width, height, srcbuf_rowsize);
-
-	// Send the data
-	int mask_rowsize = (width + 7) / 8;
-	int mask_size = mask_rowsize * height;
-	if ( !outConn->SendExactQueue((char *)&hdr, sizeof(hdr)) ||
-		 !outConn->SendExactQueue((char *)dstbuf, dstbuf_size) ||
-		 !outConn->SendExactQueue((char *)mbits, mask_size) ) {
-		delete[] dstbuf;
-		return FALSE;
-	}
-	delete[] dstbuf;
-	return TRUE;
-}
-
-void
-vncEncoder::FixCursorMask(BYTE *mbits, BYTE *cbits,
-						  int width, int height, int width_bytes)
-{
-	int packed_width_bytes = (width + 7) / 8;
-
-	// Pack and invert bitmap data (mbits)
-	int x, y;
-	for (y = 0; y < height; y++)
-		for (x = 0; x < packed_width_bytes; x++)
-			mbits[y * packed_width_bytes + x] = ~mbits[y * width_bytes + x];
-
-	// Replace "inverted background" bits with black color to ensure
-	// cross-platform interoperability. Not beautiful but necessary code.
-	if (cbits == NULL) {
-		BYTE m, c;
-		height /= 2;
-		for (y = 0; y < height; y++) {
-			for (x = 0; x < packed_width_bytes; x++) {
-				m = mbits[y * packed_width_bytes + x];
-				c = mbits[(height + y) * packed_width_bytes + x];
-				mbits[y * packed_width_bytes + x] |= ~(m | c);
-				mbits[(height + y) * packed_width_bytes + x] |= ~(m | c);
-			}
-		}
-	} else {
-		int bytes_pixel = m_localformat.bitsPerPixel / 8;
-		int bytes_row = width * bytes_pixel;
-		while (bytes_row % sizeof(DWORD))
-			bytes_row++;	// Actually, this should never happen
-
-		BYTE bitmask;
-		int b1, b2;
-		for (y = 0; y < height; y++) {
-			bitmask = 0x80;
-			for (x = 0; x < width; x++) {
-				if ((mbits[y * packed_width_bytes + x / 8] & bitmask) == 0) {
-					for (b1 = 0; b1 < bytes_pixel; b1++) {
-						if (cbits[y * bytes_row + x * bytes_pixel + b1] != 0) {
-							mbits[y * packed_width_bytes + x / 8] ^= bitmask;
-							for (b2 = b1; b2 < bytes_pixel; b2++)
-								cbits[y * bytes_row + x * bytes_pixel + b2] = 0x00;
-							break;
-						}
-					}
-				}
-				if ((bitmask >>= 1) == 0)
-					bitmask = 0x80;
-			}
-		}
-	}
-}
-
-// Translate a rectangle (using arbitrary m_bytesPerRow value,
-// always translating from the beginning of the source pixel array)
-// NOTE: overloaded function!
-inline void
-vncEncoder::Translate(BYTE *source, BYTE *dest, int w, int h, int bytesPerRow)
-{
-	// Call the translation function
-	(*m_transfunc) (m_transtable, &m_localformat, &m_transformat,
-					(char *)source, (char *)dest, bytesPerRow, w, h);
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncencoderre.cpp b/ica/win32/winvnc/winvnc/vncencoderre.cpp
deleted file mode 100644
index 45f96d2..0000000
--- a/ica/win32/winvnc/winvnc/vncencoderre.cpp
+++ /dev/null
@@ -1,333 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeRRE
-
-// This file implements the vncEncoder-derived vncEncodeRRE class.
-// This class overrides some vncEncoder functions to produce a bitmap
-// to RRE encoder.  RRE is much more efficient than RAW format on
-// most screen data.
-
-#include "vncencoderre.h"
-
-vncEncodeRRE::vncEncodeRRE()
-{
-	m_buffer = NULL;
-	m_bufflen = 0;
-}
-
-vncEncodeRRE::~vncEncodeRRE()
-{
-	if (m_buffer != NULL)
-	{
-		delete [] m_buffer;
-		m_buffer = NULL;
-	}
-}
-
-void
-vncEncodeRRE::Init()
-{
-	vncEncoder::Init();
-}
-
-UINT
-vncEncodeRRE::RequiredBuffSize(UINT width, UINT height)
-{
-	return vncEncoder::RequiredBuffSize(width, height);
-}
-
-UINT
-vncEncodeRRE::NumCodedRects(const rfb::Rect &rect)
-{
-	return 1;
-}
-
-/*****************************************************************************
- *
- * Routines to implement Rise-and-Run-length Encoding (RRE).  This code is
- * based on krw's original javatel rfbserver.
- * This code courtesy of tjr
- */
-
-/*
- * rreBeforeBuf contains pixel data in the client's format.
- * rreAfterBuf contains the RRE encoded version.  If the RRE encoded version is
- * larger than the raw data or if it exceeds rreAfterBufSize then
- * normal encoding is used instead.
- */
-
-static int rreAfterBufLen;
-
-static int subrectEncode8 (CARD8 *data, CARD8 *buf, int w, int h, int maxBytes);
-static int subrectEncode16 (CARD16 *data, CARD8 *buf, int w, int h, int maxBytes);
-static int subrectEncode32 (CARD32 *data, CARD8 *buf, int w, int h, int maxBytes);
-static CARD32 getBgColour (char *data, int size, int bpp);
-
-/*
- * subrectEncode() encodes the given multicoloured rectangle as a background 
- * colour overwritten by single-coloured rectangles.  It returns the number 
- * of subrectangles in the encoded buffer, or -1 if subrect encoding won't
- * fit in the buffer.  It puts the encoded rectangles in rreAfterBuf.  The
- * single-colour rectangle partition is not optimal, but does find the biggest
- * horizontal or vertical rectangle top-left anchored to each consecutive 
- * coordinate position.
- *
- * The coding scheme is simply [<bgcolour><subrect><subrect>...] where each 
- * <subrect> is [<colour><x><y><w><h>].
- *
- * This code has been modified from tjr's original by Wez(jnw)
- */
-
-#define DEFINE_SUBRECT_ENCODE(bpp)											\
-static int																	\
-subrectEncode##bpp(															\
-	CARD##bpp *data,														\
-	CARD8 *buf,																\
-	int w,																	\
-	int h,																	\
-	int maxBytes															\
-	)																		\
-{																			\
-    CARD##bpp cl;															\
-    rfbRectangle subrect;													\
-    int x,y;																\
-    int i,j;																\
-    int hx=0,hy=0,vx=0,vy=0;														\
-    int hyflag;																\
-    CARD##bpp *seg;															\
-    CARD##bpp *line;														\
-    int hw,hh,vw,vh;														\
-    int thex,they,thew,theh;												\
-    int numsubs = 0;														\
-    int newLen;																\
-    CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp);				\
-																			\
-	/* Set the background colour value */									\
-	*((CARD##bpp *)buf) = bg;																\
-																			\
-    rreAfterBufLen = (bpp/8);												\
-																			\
-    for (y=0; y<h; y++) {													\
-      line = data+(y*w);													\
-      for (x=0; x<w; x++) {													\
-        if (line[x] != bg) {												\
-          cl = line[x];														\
-          hy = y-1;															\
-          hyflag = 1;														\
-          for (j=y; j<h; j++) {												\
-            seg = data+(j*w);												\
-            if (seg[x] != cl) {break;}										\
-            i = x;															\
-            while ((i < w) && (seg[i] == cl)) i += 1;						\
-            i -= 1;															\
-            if (j == y) vx = hx = i;										\
-            if (i < vx) vx = i;												\
-            if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;}	\
-          }																	\
-          vy = j-1;															\
-																			\
-          /*  We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy)	\
-           *  We'll choose the bigger of the two.								\
-           */																\
-          hw = hx-x+1;														\
-          hh = hy-y+1;														\
-          vw = vx-x+1;														\
-          vh = vy-y+1;														\
-																			\
-          thex = x;															\
-          they = y;															\
-																			\
-          if ((hw*hh) > (vw*vh)) {											\
-            thew = hw;														\
-            theh = hh;														\
-          } else {															\
-            thew = vw;														\
-            theh = vh;														\
-          }																	\
-																			\
-          subrect.x = Swap16IfLE(thex);										\
-          subrect.y = Swap16IfLE(they);										\
-          subrect.w = Swap16IfLE(thew);										\
-          subrect.h = Swap16IfLE(theh);										\
-																			\
-	newLen = rreAfterBufLen + (bpp/8) + sz_rfbRectangle;					\
-	if ((newLen > (w * h * (bpp/8))) || (newLen > maxBytes))				\
-	    return -1;															\
-																			\
-	  numsubs += 1;															\
-	  *((CARD##bpp *)(buf + rreAfterBufLen)) = cl;											\
-	  rreAfterBufLen += (bpp/8);											\
-	  memcpy(&buf[rreAfterBufLen],&subrect, sz_rfbRectangle);				\
-	  rreAfterBufLen += sz_rfbRectangle;									\
-																			\
-          /*																\
-           * Now mark the subrect as done.									\
-           */																\
-          for (j=they; j < (they+theh); j++) {								\
-            for (i=thex; i < (thex+thew); i++) {							\
-              data[j*w+i] = bg;												\
-            }																\
-          }																	\
-        }																	\
-      }																		\
-    }																		\
-																			\
-    return numsubs;															\
-}
-
-DEFINE_SUBRECT_ENCODE(8)
-DEFINE_SUBRECT_ENCODE(16)
-DEFINE_SUBRECT_ENCODE(32)
-
-/*
- * getBgColour() gets the most prevalent colour in a byte array.
- */
-static CARD32
-getBgColour(char *data, int size, int bpp)
-{
-    
-#define NUMCLRS 256
-  
-  static int counts[NUMCLRS];
-  int i,j,k;
-
-  int maxcount = 0;
-  CARD8 maxclr = 0;
-
-  if (bpp != 8) {
-    if (bpp == 16) {
-      return ((CARD16 *)data)[0];
-    } else if (bpp == 32) {
-      return ((CARD32 *)data)[0];
-    } else {
-      fprintf(stderr,"getBgColour: bpp %d?\n",bpp);
-      exit(1);
-    }
-  }
-
-  for (i=0; i<NUMCLRS; i++) {
-    counts[i] = 0;
-  }
-
-  for (j=0; j<size; j++) {
-    k = (int)(((CARD8 *)data)[j]);
-    if (k >= NUMCLRS) {
-      fprintf(stderr, "%s: unusual colour = %d\n", "getBgColour",k);
-      exit(1);
-    }
-    counts[k] += 1;
-    if (counts[k] > maxcount) {
-      maxcount = counts[k];
-      maxclr = ((CARD8 *)data)[j];
-    }
-  }
-  
-  return maxclr;
-}
-
-// Encode the rectangle using RRE
-inline UINT
-vncEncodeRRE::EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-	int subrects = -1;
-
-	const UINT rectW = rect.br.x - rect.tl.x;
-	const UINT rectH = rect.br.y - rect.tl.y;
-
-	// Create the rectangle header
-	rfbFramebufferUpdateRectHeader *surh=(rfbFramebufferUpdateRectHeader *)dest;
-	surh->r.x = (CARD16) (rect.tl.x-m_SWOffsetx);
-	surh->r.y = (CARD16) (rect.tl.y-m_SWOffsety);
-	surh->r.w = (CARD16) (rectW);
-	surh->r.h = (CARD16) (rectH);
-	surh->r.x = Swap16IfLE(surh->r.x);
-	surh->r.y = Swap16IfLE(surh->r.y);
-	surh->r.w = Swap16IfLE(surh->r.w);
-	surh->r.h = Swap16IfLE(surh->r.h);
-	surh->encoding = Swap32IfLE(rfbEncodingRRE);
-	
-	// create a space big enough for the RRE encoded pixels
-	if (m_bufflen < (int)(rectW*rectH*m_remoteformat.bitsPerPixel / 8))
-	{
-		if (m_buffer != NULL)
-		{
-			delete [] m_buffer;
-			m_buffer = NULL;
-		}
-		m_buffer = new BYTE [rectW*rectH*m_remoteformat.bitsPerPixel/8+1];
-		if (m_buffer == NULL)
-			return vncEncoder::EncodeRect(source, dest, rect);
-		m_bufflen = rectW*rectH*m_remoteformat.bitsPerPixel/8;
-	}
-	
-	// Translate the data into our new buffer
-	Translate(source, m_buffer, rect);
-
-	// Choose the appropriate encoding routine (for speed...)
-	switch(m_remoteformat.bitsPerPixel)
-	{
-	case 8:
-		subrects = subrectEncode8(
-			m_buffer,
-			dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader,
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	case 16:
-		subrects = subrectEncode16(
-			(CARD16 *)m_buffer,
-			(CARD8 *)(dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader),
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	case 32:
-		subrects = subrectEncode32(
-			(CARD32 *)m_buffer,
-			(CARD8 *)(dest+sz_rfbFramebufferUpdateRectHeader+sz_rfbRREHeader),
-			rectW,
-			rectH,
-			m_bufflen-sz_rfbFramebufferUpdateRectHeader-sz_rfbRREHeader
-			);
-		break;
-	}
-
-	// If we couldn't encode the rectangles then just send the data raw
-	if (subrects < 0)
-		return vncEncoder::EncodeRect(source, dest, rect);
-
-	// Send the RREHeader
-	rfbRREHeader *rreh=(rfbRREHeader *)(dest+sz_rfbFramebufferUpdateRectHeader);
-	rreh->nSubrects = Swap32IfLE(subrects);
-	
-	// Return the amount of data sent	
-	return sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader +
-		(m_remoteformat.bitsPerPixel / 8) +
-		(subrects * (sz_rfbRectangle + m_remoteformat.bitsPerPixel / 8));
-}
diff --git a/ica/win32/winvnc/winvnc/vncencoderre.h b/ica/win32/winvnc/winvnc/vncencoderre.h
deleted file mode 100644
index f9d0471..0000000
--- a/ica/win32/winvnc/winvnc/vncencoderre.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncEncodeRRE object
-
-// The vncEncodeRRE object uses a compression encoding to send rectangles
-// to a client
-
-class vncEncodeRRE;
-
-#if !defined(_WINVNC_ENCODERRRE)
-#define _WINVNC_ENCODERRE
-#pragma once
-
-#include "vncencoder.h"
-
-// Class definition
-
-class vncEncodeRRE : public vncEncoder
-{
-// Fields
-public:
-
-// Methods
-public:
-	// Create/Destroy methods
-	vncEncodeRRE();
-	~vncEncodeRRE();
-
-	virtual void Init();
-
-	virtual UINT RequiredBuffSize(UINT width, UINT height);
-	virtual UINT NumCodedRects(const rfb::Rect &rect);
-
-	virtual UINT EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-
-// Implementation
-protected:
-	BYTE		*m_buffer;
-	int			m_bufflen;
-};
-
-#endif // _WINVNC_ENCODERRE
-
diff --git a/ica/win32/winvnc/winvnc/vncencodezrle.cpp b/ica/win32/winvnc/winvnc/vncencodezrle.cpp
deleted file mode 100644
index 179c86f..0000000
--- a/ica/win32/winvnc/winvnc/vncencodezrle.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//  Copyright (C) 2002 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 at realvnc.com for information on obtaining it.
-
-#include "vncencodezrle.h"
-#include "rfb.h"
-#include "rfbMisc.h"
-#include <stdlib.h>
-#include <time.h>
-#include <rdr/MemOutStream.h>
-#include <rdr/ZlibOutStream.h>
-
-#define GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf)     \
-  rfb::Rect rect;                                    \
-  rect.tl.x = tx;                               \
-  rect.tl.y = ty;                                \
-  rect.br.x = tx+tw;                           \
-  rect.br.y = ty+th;                          \
-  encoder->Translate(source, (BYTE*)buf, rect);
-
-#define EXTRA_ARGS , BYTE* source, vncEncoder* encoder
-
-#define ENDIAN_LITTLE 0
-#define ENDIAN_BIG 1
-#define ENDIAN_NO 2
-#define BPP 8
-#define ZYWRLE_ENDIAN ENDIAN_NO
-#include <rfb/zrleEncode.h>
-#undef BPP
-#define BPP 15
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_LITTLE
-#include <rfb/zrleEncode.h>
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_BIG
-#include <rfb/zrleEncode.h>
-#undef BPP
-#define BPP 16
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_LITTLE
-#include <rfb/zrleEncode.h>
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_BIG
-#include <rfb/zrleEncode.h>
-#undef BPP
-#define BPP 32
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_LITTLE
-#include <rfb/zrleEncode.h>
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_BIG
-#include <rfb/zrleEncode.h>
-#define CPIXEL 24A
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_LITTLE
-#include <rfb/zrleEncode.h>
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_BIG
-#include <rfb/zrleEncode.h>
-#undef CPIXEL
-#define CPIXEL 24B
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_LITTLE
-#include <rfb/zrleEncode.h>
-#undef ZYWRLE_ENDIAN
-#define ZYWRLE_ENDIAN ENDIAN_BIG
-#include <rfb/zrleEncode.h>
-#undef CPIXEL
-#undef BPP
-
-vncEncodeZRLE::vncEncodeZRLE()
-{
-  mos = new rdr::MemOutStream;
-  zos = new rdr::ZlibOutStream;
-  beforeBuf = new rdr::U32[rfbZRLETileWidth * rfbZRLETileHeight + 1];
-  m_use_zywrle = FALSE;
-}
-
-vncEncodeZRLE::~vncEncodeZRLE()
-{
-  delete mos;
-  delete zos;
-  delete [] (rdr::U32 *) beforeBuf;
-}
-
-void vncEncodeZRLE::Init()
-{
-  vncEncoder::Init();
-}
-
-UINT vncEncodeZRLE::RequiredBuffSize(UINT width, UINT height)
-{
-  // this is a guess - 12 bytes plus 1.5 times raw... (zlib.h says compress
-  // needs 12 bytes plus 1.001 times raw data but that's not quite what we give
-  // zlib anyway)
-  return (sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader + 12 +
-          width * height * (m_remoteformat.bitsPerPixel / 8) * 3 / 2);
-}
-
-UINT vncEncodeZRLE::EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect)
-{
-  int x = rect.tl.x;
-  int y = rect.tl.y;
-  int w = rect.br.x - x;
-  int h = rect.br.y - y;
-
-  mos->clear();
-
-  if( m_use_zywrle ){
-	  if( m_qualitylevel < 0 ){
-		  zywrle_level = 1;
-	  }else if( m_qualitylevel < 3 ){
-		  zywrle_level = 3;
-	  }else if( m_qualitylevel < 6 ){
-		  zywrle_level = 2;
-	  }else{
-		  zywrle_level = 1;
-	  }
-  }else{
-	  zywrle_level = 0;
-  }
-
-  switch (m_remoteformat.bitsPerPixel) {
-
-  case 8:
-    zrleEncode8NE( x, y, w, h, mos, zos, beforeBuf, source, this);
-    break;
-
-  case 16:
-    if( m_remoteformat.greenMax > 0x1F ){
-      if( m_remoteformat.bigEndian ){
-        zrleEncode16BE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }else{
-        zrleEncode16LE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }
-	}else{
-      if( m_remoteformat.bigEndian ){
-        zrleEncode15BE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }else{
-        zrleEncode15LE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }
-	}
-    break;
-
-  case 32:
-    bool fitsInLS3Bytes
-      = ((m_remoteformat.redMax   << m_remoteformat.redShift)   < (1<<24) &&
-         (m_remoteformat.greenMax << m_remoteformat.greenShift) < (1<<24) &&
-         (m_remoteformat.blueMax  << m_remoteformat.blueShift)  < (1<<24));
-
-    bool fitsInMS3Bytes = (m_remoteformat.redShift   > 7  &&
-                           m_remoteformat.greenShift > 7  &&
-                           m_remoteformat.blueShift  > 7);
-
-    if ((fitsInLS3Bytes && !m_remoteformat.bigEndian) ||
-        (fitsInMS3Bytes && m_remoteformat.bigEndian))
-    {
-      if( m_remoteformat.bigEndian ){
-        zrleEncode24ABE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }else{
-        zrleEncode24ALE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }
-    }
-    else if ((fitsInLS3Bytes && m_remoteformat.bigEndian) ||
-             (fitsInMS3Bytes && !m_remoteformat.bigEndian))
-    {
-      if( m_remoteformat.bigEndian ){
-        zrleEncode24BBE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }else{
-        zrleEncode24BLE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }
-    }
-    else
-    {
-      if( m_remoteformat.bigEndian ){
-        zrleEncode32BE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }else{
-        zrleEncode32LE(x, y, w, h, mos, zos, beforeBuf, source, this);
-	  }
-    }
-    break;
-  }
-
-  rfbFramebufferUpdateRectHeader* surh = (rfbFramebufferUpdateRectHeader*)dest;
-  surh->r.x = Swap16IfLE(x-m_SWOffsetx);
-  surh->r.y = Swap16IfLE(y-m_SWOffsety);
-  surh->r.w = Swap16IfLE(w);
-  surh->r.h = Swap16IfLE(h);
-  if( m_use_zywrle ){
-    surh->encoding = Swap32IfLE(rfbEncodingZYWRLE);
-  }else{
-    surh->encoding = Swap32IfLE(rfbEncodingZRLE);
-  }
-
-  rfbZRLEHeader* hdr = (rfbZRLEHeader*)(dest +
-                                        sz_rfbFramebufferUpdateRectHeader);
-
-  hdr->length = Swap32IfLE(mos->length());
-
-  memcpy(dest + sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader,
-         (rdr::U8*)mos->data(), mos->length());
-
-  return sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader + mos->length();
-}
diff --git a/ica/win32/winvnc/winvnc/vncencodezrle.h b/ica/win32/winvnc/winvnc/vncencodezrle.h
deleted file mode 100644
index 0e554f5..0000000
--- a/ica/win32/winvnc/winvnc/vncencodezrle.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//  Copyright (C) 2002 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 at realvnc.com for information on obtaining it.
-
-#ifndef _WINVNC_ENCODEZRLE
-#define _WINVNC_ENCODEZRLE
-
-#include "vncencoder.h"
-
-namespace rdr { class ZlibOutStream; class MemOutStream; }
-
-class vncEncodeZRLE : public vncEncoder
-{
-public:
-  vncEncodeZRLE();
-  ~vncEncodeZRLE();
-
-  virtual void Init();
-
-  virtual UINT RequiredBuffSize(UINT width, UINT height);
-
-  virtual UINT EncodeRect(BYTE *source, BYTE *dest, const rfb::Rect &rect);
-
-  BOOL m_use_zywrle;
-
-private:
-  rdr::ZlibOutStream* zos;
-  rdr::MemOutStream* mos;
-  void* beforeBuf;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vnchttpconnect.cpp b/ica/win32/winvnc/winvnc/vnchttpconnect.cpp
deleted file mode 100644
index 9d57c71..0000000
--- a/ica/win32/winvnc/winvnc/vnchttpconnect.cpp
+++ /dev/null
@@ -1,664 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncHTTPConnect.cpp
-
-// Implementation of the HTTP server class
-
-#include "stdhdrs.h"
-#include "vsocket.h"
-#include "vnchttpconnect.h"
-#include "vncserver.h"
-#include <omnithread.h>
-#include "resource.h"
-
-#include <ctype.h>
-
-//	[v1.0.2-jp1 fix]
-extern	HINSTANCE	hInstResDLL;
-extern bool			fShutdownOrdered;
-
-/* Old viewer - TODO: remove
-// HTTP messages/message formats
-const char HTTP_MSG_OK []			="HTTP/1.0 200 OK\r\n\r\n";
-const char HTTP_FMT_INDEX[]			="<HTML><TITLE>VNC desktop [%.256s]</TITLE>\n"
-	"<APPLET CODE=vncviewer.class ARCHIVE=vncviewer.jar WIDTH=%d HEIGHT=%d>\n"
-	"<param name=PORT value=%d></APPLET></HTML>\n";
-const char HTTP_MSG_NOSOCKCONN []	="<HTML><TITLE>Ultr at VNC desktop</TITLE>\n"
-	"<BODY>The requested desktop is not configured to accept incoming connections.</BODY>\n"
-	"</HTML>\n";
-const char HTTP_MSG_NOSUCHFILE []	="HTTP/1.0 404 Not found\r\n\r\n"
-    "<HEAD><TITLE>File Not Found</TITLE></HEAD>\n"
-    "<BODY><H1>The requested file could not be found</H1></BODY>\n";
-*/
-
-// HTTP messages / message formats
-const char HTTP_MSG_OK[] = "HTTP/1.0 200 OK\n\n";
-
-const char HTTP_FMT_INDEX[] =
-"<HTML>\n"
-"  <HEAD><TITLE> [%.256s] </TITLE></HEAD>\n"
-"  <BODY>\n"
-"  <SPAN style='position: absolute; top:0px;left:0px'>\n" // sf at 2002 - Hopefully supported by all recent browsers... to be checked.
-"<OBJECT \n"
-"    ID='VncViewer'\n"
-"    classid = 'clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'\n"
-"    codebase = 'http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0'\n"
-"    WIDTH = %d HEIGHT = %d >\n"
-"    <PARAM NAME = CODE VALUE = VncViewer.class >\n"
-"    <PARAM NAME = ARCHIVE VALUE = VncViewer.jar >\n"
-"    <PARAM NAME = 'type' VALUE = 'application/x-java-applet;version=1.4'>\n"
-"    <PARAM NAME = 'scriptable' VALUE = 'false'>\n"
-"    <PARAM NAME = PORT VALUE=%d>\n"
-"    <PARAM NAME = ENCODING VALUE=Tight>\n"
-"    <PARAM NAME = 'Open New Window' VALUE='Yes'>\n"
-"    %s\n"
-"    <COMMENT>\n"
-"	<EMBED \n"
-"            type = 'application/x-java-applet;version=1.4' \\\n"
-"            CODE = VncViewer.class \\\n"
-"            ARCHIVE = VncViewer.jar \\\n"
-"            WIDTH = %d \\\n"
-"            HEIGHT = %d \\\n"
-"            PORT =%d \\\n"
-"            ENCODING =Tight \\\n"
-"            %s\\\n"
-"	    scriptable = false \\\n"
-"	    pluginspage ='http://java.sun.com/products/plugin/index.html#download'>\n"
-"	    <NOEMBED>\n"            
-"            </NOEMBED>\n"
-"	</EMBED>\n"
-"    </COMMENT>\n"
-"</OBJECT>\n"
-/*
-"    <APPLET CODE=VncViewer.class ARCHIVE=VncViewer.jar WIDTH=%d HEIGHT=%d>\n"
-"      <PARAM NAME=PORT VALUE=%d>\n"
-"      <PARAM NAME=ENCODING VALUE=Tight>\n"
-"    </APPLET>"*/
-"  </SPAN>\n"
-// "    <BR>\n"
-// "    <A href=\"http://ultravnc.sf.net\">Ultr at VNC Home Page</A></HTML>\n" // sf at 2002: don't waste space 
-"  </BODY>\n"
-"</HTML>\n";
-
-const char HTTP_MSG_NOSOCKCONN [] =
-"<HTML>\n"
-"  <HEAD><TITLE>Ultr at VNC desktop</TITLE></HEAD>\n"
-"  <BODY>\n"
-"    <H1>Connections Disabled</H1>\n"
-"    The requested desktop is not configured to accept incoming connections.\n"
-"  </BODY>\n"
-"</HTML>\n";
-
-const char HTTP_MSG_BADPARAMS [] =
-"<HTML>\n"
-"  <HEAD><TITLE>Ultr at VNC desktop</TITLE></HEAD>\n"
-"  <BODY>\n"
-"    <H1>Bad Parameters</H1>\n"
-"    The sequence of applet parameters specified within the URL is invalid.\n"
-"  </BODY>\n"
-"</HTML>\n";
-
-const char HTTP_MSG_NOSUCHFILE [] =
-"HTTP/1.0 404 Not Found\n\n"
-"<HTML>\n"
-"  <HEAD><TITLE>404 Not Found</TITLE></HEAD>\n"
-"  <BODY>\n"
-"    <H1>Not Found</H1>\n"
-"    The requested file could not be found.\n"
-"  </BODY>\n"
-"</HTML>\n";
-
-
-
-// Filename to resource ID mappings for the Java class files:
-typedef struct _FileToResourceMap {
-	char *filename;
-	char *type;
-	int resourceID;
-} FileMap;
-
-const FileMap filemapping []	={
-	{"/VncViewer.jar", "JavaArchive", IDR_VNCVIEWER_JAR},
-	{"/AuthPanel.class", "JavaClass", IDR_AUTHPANEL_CLASS},
-	{"/ClipboardFrame.class", "JavaClass", IDR_CLIPBOARDFRAME_CLASS},
-	{"/DesCipher.class", "JavaClass", IDR_DESCIPHER_CLASS},
-	{"/OptionsFrame.class", "JavaClass", IDR_OPTIONSFRAME_CLASS},
-	{"/RfbProto.class", "JavaClass", IDR_RFBPROTO_CLASS},
-	{"/VncCanvas.class", "JavaClass", IDR_VNCCANVAS_CLASS},
-	{"/VncViewer.class", "JavaClass", IDR_VNCVIEWER_CLASS},
-	{"/ButtonPanel.class", "JavaClass", IDR_BUTTONPANEL_CLASS},
-	{"/RecordingFrame.class", "JavaClass", IDR_RECFRAME_CLASS},
-	{"/SessionRecorder.class", "JavaClass", IDR_SESSIONREC_CLASS},
-	{"/FTPFrame.class", "JavaClass", IDR_FTPFRAME_CLASS},
-	{"/DH.class", "JavaClass", IDR_DH_CLASS},
-	{"/FTPFRame$StrComp.class", "JavaClass", IDR_FTPFRAMESTRCOMP_CLASS},
-	};
-
-const FileMap filemapping2 []	={
-	{"/VncViewer.jar", "JavaArchive", IDR_JAVAARCHIVE1},
-	{"/AuthPanel.class", "JavaClass", IDR_JAVACLASS1},
-	{"/ClipboardFrame.class", "JavaClass", IDR_JAVACLASS3},
-	{"/DesCipher.class", "JavaClass", IDR_JAVACLASS4},
-	{"/OptionsFrame.class", "JavaClass", IDR_JAVACLASS8},
-	{"/RfbProto.class", "JavaClass", IDR_JAVACLASS10},
-	{"/VncCanvas.class", "JavaClass", IDR_JAVACLASS12},
-	{"/VncViewer.class", "JavaClass", IDR_JAVACLASS13},
-	{"/ButtonPanel.class", "JavaClass", IDR_JAVACLASS2},
-	{"/RecordingFrame.class", "JavaClass", IDR_JAVACLASS9},
-	{"/SessionRecorder.class", "JavaClass", IDR_JAVACLASS11},
-	{"/FTPFrame.class", "JavaClass", IDR_JAVACLASS7},
-	{"/DH.class", "JavaClass", IDR_JAVACLASS5},
-	{"/FTPFRame$StrComp.class", "JavaClass", IDR_JAVACLASS6},
-	};
-const int filemappingsize		= 14;
-
-#ifdef HTTP_SAMEPORT
-// Added for HTTP-via-RFB. Allows us to handle an HTTP transaction
-// without starting a separate thread.
-class vncHTTPConnectThreadHelper {
-public:
-	// Routines to handle HTTP requests
-	void Init(vncServer* svr) { m_server = svr; }
-	void DoHTTP(VSocket *socket);
-	char *ReadLine(VSocket *socket, char delimiter);
-protected:
-	vncServer	*m_server;
-};
-#endif
-
-#ifdef HTTP_SAMEPORT
-class vncHTTPConnectThread : public omni_thread, public vncHTTPConnectThreadHelper
-#else
-// The function for the spawned thread to run
-class vncHTTPConnectThread : public omni_thread
-#endif
-{
-public:
-	// Init routine
-	virtual BOOL Init(VSocket *socket, vncServer *server);
-
-	// Code to be executed by the thread
-	virtual void *run_undetached(void * arg);
-#ifndef HTTP_SAMEPORT
-	// Routines to handle HTTP requests
-	virtual void DoHTTP(VSocket *socket);
-	virtual char *ReadLine(VSocket *socket, char delimiter);
-#endif
-
-	// Fields used internally
-	BOOL		m_shutdown;
-protected:
-#ifndef HTTP_SAMEPORT
-	vncServer	*m_server;
-#endif
-	VSocket		*m_socket;
-};
-
-#ifdef HTTP_SAMEPORT
-// Added for HTTP-via-RFB. This function is called when a connection is
-// accepted on the RFB port. If the client sends an HTTP request we
-// handle it here and return TRUE. Otherwise we return
-// FALSE and the caller continues with the RFB handshake.
-VBool maybeHandleHTTPRequest(VSocket* sock,vncServer* svr)
-{
-	if (!sock->ReadSelect(2000)) return false;
-
-	// Client is sending data. Create a vncHTTPConnectThread to
-	// handle it.
-	vncHTTPConnectThreadHelper http;
-	http.Init(svr);
-	http.DoHTTP(sock);
-	sock->Shutdown();
-	sock->Close();
-	delete sock;
-	return true;
-}
-#endif
-
-// Method implementations
-BOOL vncHTTPConnectThread::Init(VSocket *socket, vncServer *server)
-{
-	// Save the server pointer
-	m_server = server;
-
-	// Save the socket pointer
-	m_socket = socket;
-
-	// Start the thread
-	m_shutdown = FALSE;
-	start_undetached();
-
-	return TRUE;
-}
-
-// Code to be executed by the thread
-void *vncHTTPConnectThread::run_undetached(void * arg)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("started HTTP server thread\n"));
-
-	// Go into a loop, listening for connections on the given socket
-	while (!m_shutdown)
-	{
-		// Accept an incoming connection
-		VSocket *new_socket = m_socket->Accept();
-		if (new_socket == NULL)
-			break;
-		if (m_shutdown)
-		{
-			delete new_socket;
-			break;
-		}
-		vnclog.Print(LL_CLIENTS, VNCLOG("HTTP client connected\n"));
-		Sleep(250);
-		// Successful accept - perform the transaction
-		new_socket->SetTimeout(15000); //ms
-		DoHTTP(new_socket);
-		Sleep(500);
-		// And close the client
-		new_socket->Shutdown();
-		new_socket->Close();
-		delete new_socket;
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("quitting HTTP server thread\n"));
-
-	return NULL;
-}
-
-#ifdef HTTP_SAMEPORT
-void vncHTTPConnectThreadHelper::DoHTTP(VSocket *socket)
-#else
-void vncHTTPConnectThread::DoHTTP(VSocket *socket)
-#endif
-{
-	char filename[1024];
-	char *line;
-
-	// Read in the HTTP header
-	if ((line = ReadLine(socket, '\n')) == NULL)
-		return;
-
-	// Scan the header for the filename and free the storage
-	int result = sscanf(line, "GET %s ", (char*)&filename);
-	delete [] line;
-	if ((result == 0) || (result == EOF))
-		return;
-
-	vnclog.Print(LL_CLIENTS, VNCLOG("file %s requested\n"), filename);
-
-	// Read in the rest of the browser's request data and discard...
-	BOOL emptyline=TRUE;
-
-	for (;;)
-	{
-		char c;
-
-		if (!socket->ReadExactHTTP(&c, 1))
-			return;
-		if (c=='\n')
-		{
-			if (emptyline)
-				break;
-			emptyline = TRUE;
-		}
-		else
-			if (c >= ' ')
-			{
-				emptyline = FALSE;
-			}
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("parameters read\n"));
-
-    if (filename[0] != '/')
-	{
-		vnclog.Print(LL_CONNERR, VNCLOG("filename didn't begin with '/'\n"));
-		socket->SendExactHTTP(HTTP_MSG_NOSUCHFILE, strlen(HTTP_MSG_NOSUCHFILE));
-		return;
-	}
-
-	// Switch, dependent upon the filename:
-	if (strcmp(filename, "/") == 0 ||
-			( strlen(filename) > 4 &&
-				filename[0]=='/' && filename[1]=='?' ) )
-	{
-		char indexpage[2048 + MAX_COMPUTERNAME_LENGTH + 1];
-
-		vnclog.Print(LL_CLIENTS, VNCLOG("sending main page\n"));
-
-		// Send the OK notification message to the client
-		if (!socket->SendExactHTTP(HTTP_MSG_OK, strlen(HTTP_MSG_OK)))
-			return;
-
-		// Compose the index page
-		if (m_server->SockConnected())
-		{
-			int width, height, depth;
-
-			// Get the screen's dimensions
-			m_server->GetScreenInfo(width, height, depth);
-
-			// Get the name of this desktop
-			char desktopname[MAX_COMPUTERNAME_LENGTH+1];
-			DWORD desktopnamelen = MAX_COMPUTERNAME_LENGTH + 1;
-			if (GetComputerName(desktopname, &desktopnamelen))
-			{
-				// Make the name lowercase
-				for (size_t x=0; x<strlen(desktopname); x++)
-				{
-					desktopname[x] = tolower(desktopname[x]);
-				}
-			}
-			else
-			{
-				strcpy(desktopname, "WinVNC");
-			}
-
-			// Tobias Doerffel, 2010/12
-			char paramsObj[4096];
-			char paramsEmbed[4096];
-			paramsObj[0] = 0;
-			paramsEmbed[0] = 0;
-			char *pf = filename+1;
-			while( ( *pf == '?' || ( pf = strchr( pf, '&' ) ) != NULL ) && pf[1] )
-			{
-				pf = pf+1;
-				char buf[128];
-				size_t curlen = strlen( pf );
-				char *next = strchr( pf, '&' );
-				if( next )
-				{
-					curlen = next - pf;
-				}
-				if( curlen > 0 && curlen+1 < sizeof( buf ) )
-				{
-					strncpy( buf, pf, curlen );
-					buf[curlen] = 0;
-					char *eq = strchr( buf, '=' );
-					if( eq )
-					{
-						*eq = 0;
-						char paramObj[128];
-						char paramEmbed[128];
-						sprintf( paramObj, "<PARAM NAME=%s VALUE=%s>\n", buf, eq+1 );
-						sprintf( paramEmbed, "%s = %s\n", buf, eq+1 );
-						if( strlen(paramObj)+strlen(paramsObj) < sizeof( paramsObj ) )
-						{
-							strcat( paramsObj, paramObj );
-						}
-						if( strlen(paramEmbed)+strlen(paramsEmbed) < sizeof( paramsEmbed ) )
-						{
-							strcat( paramsEmbed, paramEmbed );
-						}
-					}
-				}
-			}
-			// END - Tobias Doerffel, 2010/12
-
-			// Send the java applet page
-			sprintf(indexpage, HTTP_FMT_INDEX,
-				desktopname, width, height+32,
-				m_server->GetPort(),
-				paramsObj,
-				width, height+32,
-				m_server->GetPort(),
-				paramsEmbed
-				);
-		}
-		else
-		{
-			// Send a "sorry, not allowed" page
-			sprintf(indexpage, HTTP_MSG_NOSOCKCONN);
-		}
-
-		// Send the page
-		if (socket->SendExactHTTP(indexpage, strlen(indexpage)))
-			vnclog.Print(LL_INTINFO, VNCLOG("sent page\n"));
-
-		return;
-	}
-
-	// File requested was not the index so check the mappings
-	// list for a different file.
-
-	if (m_server->MSLogonRequired())
-	{
-
-		for (int x=0; x < filemappingsize; x++)
-	{
-		if (strcmp(filename, filemapping2[x].filename) == 0)
-		{
-			HRSRC resource;
-			HGLOBAL resourcehan;
-			char *resourceptr;
-			int resourcesize;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("requested file recognised\n"));
-
-			// Find the resource here
-			//	[v1.0.2-jp1 fix]
-			//resource = FindResource(NULL,
-			resource = FindResource(hInstResDLL,
-					MAKEINTRESOURCE(filemapping2[x].resourceID),
-					filemapping2[x].type
-					);
-			if (resource == NULL)
-				return;
-
-			// Get its size
-			//	[v1.0.2-jp1 fix]
-			//resourcesize = SizeofResource(NULL, resource);
-			resourcesize = SizeofResource(hInstResDLL, resource);
-
-			// Load the resource
-			//	[v1.0.2-jp1 fix]
-			//resourcehan = LoadResource(NULL, resource);
-			resourcehan = LoadResource(hInstResDLL, resource);
-			if (resourcehan == NULL)
-				return;
-
-			// Lock the resource
-			resourceptr = (char *)LockResource(resourcehan);
-			if (resourceptr == NULL)
-				return;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("sending file...\n"));
-
-			// Send the OK message
-			if (!socket->SendExactHTTP(HTTP_MSG_OK, strlen(HTTP_MSG_OK)))
-				return;
-
-			// Now send the entirety of the data to the client
-			if (!socket->SendExactHTTP(resourceptr, resourcesize))
-				return;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("file successfully sent\n"));
-
-			return;
-		}
-	}
-	}
-	else
-	{
-	// Now search the mappings for the desired file
-	for (int x=0; x < filemappingsize; x++)
-	{
-		if (strcmp(filename, filemapping[x].filename) == 0)
-		{
-			HRSRC resource;
-			HGLOBAL resourcehan;
-			char *resourceptr;
-			int resourcesize;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("requested file recognised\n"));
-
-			// Find the resource here
-			//	[v1.0.2-jp1 fix]
-			//resource = FindResource(NULL,
-			resource = FindResource(hInstResDLL,
-					MAKEINTRESOURCE(filemapping[x].resourceID),
-					filemapping[x].type
-					);
-			if (resource == NULL)
-				return;
-
-			// Get its size
-			//	[v1.0.2-jp1 fix]
-			//resourcesize = SizeofResource(NULL, resource);
-			resourcesize = SizeofResource(hInstResDLL, resource);
-
-			// Load the resource
-			//	[v1.0.2-jp1 fix]
-			//resourcehan = LoadResource(NULL, resource);
-			resourcehan = LoadResource(hInstResDLL, resource);
-			if (resourcehan == NULL)
-				return;
-
-			// Lock the resource
-			resourceptr = (char *)LockResource(resourcehan);
-			if (resourceptr == NULL)
-				return;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("sending file...\n"));
-
-			// Send the OK message
-			if (!socket->SendExactHTTP(HTTP_MSG_OK, strlen(HTTP_MSG_OK)))
-				return;
-
-			// Now send the entirety of the data to the client
-			if (!socket->SendExactHTTP(resourceptr, resourcesize))
-				return;
-
-			vnclog.Print(LL_INTINFO, VNCLOG("file successfully sent\n"));
-
-			return;
-		}
-	}
-	}
-
-	// Send the NoSuchFile notification message to the client
-	if (!socket->SendExactHTTP(HTTP_MSG_NOSUCHFILE, strlen(HTTP_MSG_NOSUCHFILE)))
-		return;
-}
-#ifdef HTTP_SAMEPORT
-char *vncHTTPConnectThreadHelper::ReadLine(VSocket *socket, char delimiter)
-#else
-char *vncHTTPConnectThread::ReadLine(VSocket *socket, char delimiter)
-#endif
-{
-	int max=1024;
-	// Allocate the maximum required buffer
-	char *buffer = new char[max+1];
-	int buffpos = 0;
-
-	// Read in data until a delimiter is read
-	for (;;)
-	{
-		char c;
-
-		if (!socket->ReadExactHTTP(&c, 1))
-		{
-			delete [] buffer;
-			return NULL;
-		}
-
-		if (c == delimiter)
-		{
-			buffer[buffpos] = 0;
-			return buffer;
-		}
-
-		buffer[buffpos] = c;
-		buffpos++;
-
-		if (buffpos == (max-1))
-		{
-			buffer[buffpos] = 0;
-			return buffer;
-		}
-	}
-}
-
-// The vncSockConnect class implementation
-
-vncHTTPConnect::vncHTTPConnect()
-{
-	m_thread = NULL;
-}
-
-vncHTTPConnect::~vncHTTPConnect()
-{
-   m_socket.Shutdown();
-
-    // Join with our lovely thread
-    if (m_thread != NULL)
-    {
-		// *** This is a hack to force the listen thread out of the accept call,
-		// because Winsock accept semantics are broken.
-		((vncHTTPConnectThread *)m_thread)->m_shutdown = TRUE;
-
-		VSocket socket;
-		socket.Create();
-		socket.Bind(0);
-		socket.Connect("localhost", m_port);
-		socket.Close();
-
-		void *returnval;
-		m_thread->join(&returnval);
-		m_thread = NULL;
-
-		m_socket.Close();
-    }
-}
-
-BOOL vncHTTPConnect::Init(vncServer *server, UINT port)
-{
-	// Save the port id
-	m_port = port;
-
-	// Create the listening socket
-	if (!m_socket.Create())
-		return FALSE;
-
-	// Bind it
-	if (!m_socket.Bind(m_port, server->LoopbackOnly()))
-		return FALSE;
-
-	// Set it to listen
-	if (!m_socket.Listen())
-		return FALSE;
-
-	// Create the new thread
-	m_thread = new vncHTTPConnectThread;
-	if (m_thread == NULL)
-		return FALSE;
-
-	// And start it running
-	return ((vncHTTPConnectThread *)m_thread)->Init(&m_socket, server);
-}
-
diff --git a/ica/win32/winvnc/winvnc/vnchttpconnect.h b/ica/win32/winvnc/winvnc/vnchttpconnect.h
deleted file mode 100644
index c86ffe9..0000000
--- a/ica/win32/winvnc/winvnc/vnchttpconnect.h
+++ /dev/null
@@ -1,70 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncHTTPConnect.h
-
-// The vncHTTPConnect class creates a listening socket and binds
-// it to the specified port number.  It then creates a listen
-// thread which goes into a loop, listening on the socket.
-// When the vncHTTPConnect object is destroyed, all resources are
-// freed automatically, including the listen thread.
-// This server allows clients to request the java classes required
-// to view the desktop remotely.
-
-class vncHTTPConnect;
-
-#if (!defined(_WINVNC_VNCHTTPCONNECT))
-#define _WINVNC_VNCHTTPCONNECT
-
-// Includes
-#include "stdhdrs.h"
-#include "vsocket.h"
-#include <omnithread.h>
-
-class vncServer;
-
-// The vncHTTPConnect class itself
-class vncHTTPConnect
-{
-public:
-	// Constructor/destructor
-	vncHTTPConnect();
-	virtual ~vncHTTPConnect();
-
-	// Init
-	virtual VBool Init(vncServer *server, UINT port);
-
-	// Implementation
-protected:
-	// The listening socket
-	VSocket m_socket;
-
-	// The port to listen on
-	UINT m_port;
-
-	// The in-coming accept thread
-	omni_thread *m_thread;
-};
-
-#endif // _WINVNC_VNCHTTPCONNECT
diff --git a/ica/win32/winvnc/winvnc/vncinsthandler.cpp b/ica/win32/winvnc/winvnc/vncinsthandler.cpp
deleted file mode 100644
index cc9c356..0000000
--- a/ica/win32/winvnc/winvnc/vncinsthandler.cpp
+++ /dev/null
@@ -1,65 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncInstHandler.cpp
-
-// Implementation of the class used to ensure that only
-// one instance is running
-
-#include "stdhdrs.h"
-#include "vncinsthandler.h"
-
-// Name of the mutex
-
-const char mutexname [] = "WinVNC_Win32_Instance_Mutex";
-
-// The class methods
-vncInstHandler::vncInstHandler()
-{
-	mutex=NULL;
-}
-
-vncInstHandler::~vncInstHandler()
-{
-	if (mutex)
-	{
-		ReleaseMutex(mutex);
-		CloseHandle (mutex);
-	}
-}
-
-BOOL
-vncInstHandler::Init()
-{
-	// Create the named mutex
-	mutex = CreateMutex(NULL, FALSE, mutexname);
-	if (mutex == NULL)
-		return FALSE;
-
-	// Check that the mutex didn't already exist
-	if (GetLastError() == ERROR_ALREADY_EXISTS)
-		return FALSE;
-
-	return TRUE;
-}
diff --git a/ica/win32/winvnc/winvnc/vncinsthandler.h b/ica/win32/winvnc/winvnc/vncinsthandler.h
deleted file mode 100644
index 1aebf1c..0000000
--- a/ica/win32/winvnc/winvnc/vncinsthandler.h
+++ /dev/null
@@ -1,52 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncInstHandler
-
-// The WinMain procedure for WinVNC produces one of these objects.
-// It creates a named mutex and checks to see whether that mutex
-// already existed in the system.  If it did, then there is a previous
-// instance of WinVNC running, which must be requested to quit cleanly.
-
-class vncInstHandler;
-
-#if (!defined(_WINVNC_VNCINSTHANDLER))
-#define _WINVNC_VNCINSTHANDLER
-
-// Includes
-#include "stdhdrs.h"
-
-// The vncInstHandler class itself
-class vncInstHandler
-{
-	
-public:
-	vncInstHandler();
-	~vncInstHandler();
-	// Constructor/destructor
-	BOOL Init();
-	HANDLE mutex;
-};
-
-#endif // _WINVNC_VNCINSTHANDLER
diff --git a/ica/win32/winvnc/winvnc/vnckeymap.cpp b/ica/win32/winvnc/winvnc/vnckeymap.cpp
deleted file mode 100644
index 1f9b91b..0000000
--- a/ica/win32/winvnc/winvnc/vnckeymap.cpp
+++ /dev/null
@@ -1,832 +0,0 @@
-//  Copyright (C) 2002 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 program is not available from the place from
-// which you received this file, check http://www.realvnc.com/ or contact
-// the authors on info at realvnc.com for information on obtaining it.
-
-// vncKeymap.cpp
-
-// This code originally just mapped between X keysyms and local Windows
-// virtual keycodes.  Now it actually does the local-end simulation of
-// key presses, to keep this messy code on one place!
-#ifndef __GNUC__
-#pragma warning(disable : 4786)
-#endif
-#include "vncservice.h"
-#include "vnckeymap.h"
-#include <rdr/types.h>
-#define XK_MISCELLANY
-#define XK_LATIN1
-#define XK_CURRENCY
-#define XK_GREEK
-#define XK_TECHNICAL
-#define XK_XKB_KEYS
-
-//	[v1.0.2-jp1 fix] IOport's patch (Define XK_KATAKANA)
-#define XK_KATAKANA
-
-#include "keysymdef.h"
-
-//	[v1.0.2-jp1 fix] IOport's patch (Include "ime.h" for IME control)
-#include <ime.h>
- 
-#include <map>
-#include <vector>
-DWORD WINAPI Cadthread(LPVOID lpParam);
-
-// Mapping of X keysyms to windows VK codes.  Ordering here is the same as
-// keysymdef.h to make checking easier
-rdr::U32 keysymDead=0;
-
-struct keymap_t {
-  rdr::U32 keysym;
-  rdr::U8 vk;
-  bool extended;
-};
-
-std::vector<unsigned char> deadChars;
-
-static keymap_t keymap[] = {
-
-  // TTY functions
-
-  { XK_BackSpace,        VK_BACK, 0 },
-  { XK_Tab,              VK_TAB, 0 },
-  { XK_Clear,            VK_CLEAR, 0 },
-  { XK_Return,           VK_RETURN, 0 },
-  { XK_Pause,            VK_PAUSE, 0 },
-  { XK_Escape,           VK_ESCAPE, 0 },
-  { XK_Delete,           VK_DELETE, 1 },
-
-  // Japanese stuff - almost certainly wrong...
-  //	[v1.0.2-jp1 fix] IOport's patch (Correct definition of Japanese key)
-  //{ XK_Kanji,            VK_KANJI, 0 },
-  //{ XK_Kana_Shift,       VK_KANA, 0 },
-  // Japanese key
-  { XK_Kanji,            VK_KANJI, 0 },				/* 0x19: Kanji, Kanji convert */
-  { XK_Muhenkan,         VK_NONCONVERT, 0 },		/* 0x1d: Cancel Conversion */
-  { XK_Romaji,           VK_DBE_ROMAN, 0 },			/* 0xf5: to Romaji */
-  { XK_Hiragana,         VK_DBE_HIRAGANA, 0 },		/* 0xf2: to Hiragana */
-  { XK_Katakana,         VK_DBE_KATAKANA, 0 },		/* 0xf1: to Katakana */
-  { XK_Zenkaku,          VK_DBE_SBCSCHAR, 0 },		/* 0xf3: to Zenkaku */
-  { XK_Hankaku,          VK_DBE_DBCSCHAR, 0 },		/* 0xf4: to Hankaku */
-  { XK_Eisu_toggle,      VK_DBE_ALPHANUMERIC, 0 },	/* 0xf0: Alphanumeric toggle */
-  { XK_Mae_Koho,         VK_CONVERT, 0 },			/* 0x1c: Previous Candidate */
-
-  // Cursor control & motion
-
-  { XK_Home,             VK_HOME, 1 },
-  { XK_Left,             VK_LEFT, 1 },
-  { XK_Up,               VK_UP, 1 },
-  { XK_Right,            VK_RIGHT, 1 },
-  { XK_Down,             VK_DOWN, 1 },
-  { XK_Page_Up,          VK_PRIOR, 1 },
-  { XK_Page_Down,        VK_NEXT, 1 },
-  { XK_End,              VK_END, 1 },
-
-  // Misc functions
-
-  { XK_Select,           VK_SELECT, 0 },
-  { XK_Print,            VK_SNAPSHOT, 0 },
-  { XK_Execute,          VK_EXECUTE, 0 },
-  { XK_Insert,           VK_INSERT, 1 },
-  { XK_Help,             VK_HELP, 0 },
-  { XK_Break,            VK_CANCEL, 1 },
-
-  // Keypad Functions, keypad numbers
-
-  { XK_KP_Space,         VK_SPACE, 0 },
-  { XK_KP_Tab,           VK_TAB, 0 },
-  { XK_KP_Enter,         VK_RETURN, 1 },
-  { XK_KP_F1,            VK_F1, 0 },
-  { XK_KP_F2,            VK_F2, 0 },
-  { XK_KP_F3,            VK_F3, 0 },
-  { XK_KP_F4,            VK_F4, 0 },
-  { XK_KP_Home,          VK_HOME, 0 },
-  { XK_KP_Left,          VK_LEFT, 0 },
-  { XK_KP_Up,            VK_UP, 0 },
-  { XK_KP_Right,         VK_RIGHT, 0 },
-  { XK_KP_Down,          VK_DOWN, 0 },
-  { XK_KP_End,           VK_END, 0 },
-  { XK_KP_Page_Up,       VK_PRIOR, 0 },
-  { XK_KP_Page_Down,     VK_NEXT, 0 },
-  { XK_KP_Begin,         VK_CLEAR, 0 },
-  { XK_KP_Insert,        VK_INSERT, 0 },
-  { XK_KP_Delete,        VK_DELETE, 0 },
-  // XXX XK_KP_Equal should map in the same way as ascii '='
-  { XK_KP_Multiply,      VK_MULTIPLY, 0 },
-  { XK_KP_Add,           VK_ADD, 0 },
-  { XK_KP_Separator,     VK_SEPARATOR, 0 },
-  { XK_KP_Subtract,      VK_SUBTRACT, 0 },
-  { XK_KP_Decimal,       VK_DECIMAL, 0 },
-  { XK_KP_Divide,        VK_DIVIDE, 1 },
-
-  { XK_KP_0,             VK_NUMPAD0, 0 },
-  { XK_KP_1,             VK_NUMPAD1, 0 },
-  { XK_KP_2,             VK_NUMPAD2, 0 },
-  { XK_KP_3,             VK_NUMPAD3, 0 },
-  { XK_KP_4,             VK_NUMPAD4, 0 },
-  { XK_KP_5,             VK_NUMPAD5, 0 },
-  { XK_KP_6,             VK_NUMPAD6, 0 },
-  { XK_KP_7,             VK_NUMPAD7, 0 },
-  { XK_KP_8,             VK_NUMPAD8, 0 },
-  { XK_KP_9,             VK_NUMPAD9, 0 },
-
-  // Auxilliary Functions
-
-  { XK_F1,               VK_F1, 0 },
-  { XK_F2,               VK_F2, 0 },
-  { XK_F3,               VK_F3, 0 },
-  { XK_F4,               VK_F4, 0 },
-  { XK_F5,               VK_F5, 0 },
-  { XK_F6,               VK_F6, 0 },
-  { XK_F7,               VK_F7, 0 },
-  { XK_F8,               VK_F8, 0 },
-  { XK_F9,               VK_F9, 0 },
-  { XK_F10,              VK_F10, 0 },
-  { XK_F11,              VK_F11, 0 },
-  { XK_F12,              VK_F12, 0 },
-  { XK_F13,              VK_F13, 0 },
-  { XK_F14,              VK_F14, 0 },
-  { XK_F15,              VK_F15, 0 },
-  { XK_F16,              VK_F16, 0 },
-  { XK_F17,              VK_F17, 0 },
-  { XK_F18,              VK_F18, 0 },
-  { XK_F19,              VK_F19, 0 },
-  { XK_F20,              VK_F20, 0 },
-  { XK_F21,              VK_F21, 0 },
-  { XK_F22,              VK_F22, 0 },
-  { XK_F23,              VK_F23, 0 },
-  { XK_F24,              VK_F24, 0 },
-
-    // Modifiers
-    
-  { XK_Shift_L,          VK_SHIFT, 0 },
-  { XK_Shift_R,          VK_RSHIFT, 0 },
-  { XK_Control_L,        VK_CONTROL, 0 },
-  { XK_Control_R,        VK_CONTROL, 1 },
-  { XK_Alt_L,            VK_MENU, 0 },
-  { XK_Alt_R,            VK_RMENU, 1 },
-
-// Left & Right Windows keys & Windows Menu Key
-
-  { XK_Super_L,			VK_LWIN, 0 }, 
-  { XK_Super_R,			VK_RWIN, 0 }, 
-  { XK_Menu,			VK_APPS, 0 }, 
-
-};
-
-struct latin1ToDeadChars_t {
-  rdr::U8 latin1Char;
-  rdr::U8 deadChar;
-  rdr::U8 baseChar;
-  int a,b,c;
-};
-
-latin1ToDeadChars_t latin1ToDeadChars[] = {
-
-  { XK_Agrave, XK_grave, XK_A },
-  { XK_Egrave, XK_grave, XK_E },
-  { XK_Igrave, XK_grave, XK_I },
-  { XK_Ograve, XK_grave, XK_O },
-  { XK_Ugrave, XK_grave, XK_U },
-  { XK_agrave, XK_grave, XK_a },
-  { XK_egrave, XK_grave, XK_e },
-  { XK_igrave, XK_grave, XK_i },
-  { XK_ograve, XK_grave, XK_o},
-  { XK_ugrave, XK_grave, XK_u },
-
-  { XK_Aacute, XK_acute, XK_A },
-  { XK_Eacute, XK_acute, XK_E },
-  { XK_Iacute, XK_acute, XK_I },
-  { XK_Oacute, XK_acute, XK_O },
-  { XK_Uacute, XK_acute, XK_U },
-  { XK_Yacute, XK_acute, XK_Y },
-  { XK_aacute, XK_acute, XK_a },
-  { XK_eacute, XK_acute, XK_e },
-  { XK_iacute, XK_acute, XK_i },
-  { XK_oacute, XK_acute, XK_o},
-  { XK_uacute, XK_acute, XK_u },
-  { XK_yacute, XK_acute, XK_y },
-
-  { XK_Acircumflex, XK_asciicircum, XK_A },
-  { XK_Ecircumflex, XK_asciicircum, XK_E },
-  { XK_Icircumflex, XK_asciicircum, XK_I },
-  { XK_Ocircumflex, XK_asciicircum, XK_O },
-  { XK_Ucircumflex, XK_asciicircum, XK_U },
-  { XK_acircumflex, XK_asciicircum, XK_a },
-  { XK_ecircumflex, XK_asciicircum, XK_e },
-  { XK_icircumflex, XK_asciicircum, XK_i },
-  { XK_ocircumflex, XK_asciicircum, XK_o},
-  { XK_ucircumflex, XK_asciicircum, XK_u },
-
-  { XK_Adiaeresis, XK_diaeresis, XK_A },
-  { XK_Ediaeresis, XK_diaeresis, XK_E },
-  { XK_Idiaeresis, XK_diaeresis, XK_I },
-  { XK_Odiaeresis, XK_diaeresis, XK_O },
-  { XK_Udiaeresis, XK_diaeresis, XK_U },
-  { XK_adiaeresis, XK_diaeresis, XK_a },
-  { XK_ediaeresis, XK_diaeresis, XK_e },
-  { XK_idiaeresis, XK_diaeresis, XK_i },
-  { XK_odiaeresis, XK_diaeresis, XK_o},
-  { XK_udiaeresis, XK_diaeresis, XK_u },
-  { XK_ydiaeresis, XK_diaeresis, XK_y },
-
-  { XK_Aring, XK_degree, XK_A },
-  { XK_aring, XK_degree, XK_a },
-
-  { XK_Ccedilla, XK_cedilla, XK_C },
-  { XK_ccedilla, XK_cedilla, XK_c },
-
-  { XK_Atilde, XK_asciitilde, XK_A },
-  { XK_Ntilde, XK_asciitilde, XK_N },
-  { XK_Otilde, XK_asciitilde, XK_O },
-  { XK_atilde, XK_asciitilde, XK_a },
-  { XK_ntilde, XK_asciitilde, XK_n },
-  { XK_otilde, XK_asciitilde, XK_o },
-};
-
-rdr::U8 latin1DeadChars[] = {
-  XK_grave, XK_acute, XK_asciicircum, XK_diaeresis, XK_degree, XK_cedilla,
-  XK_asciitilde
-};
-
-#define NoSymbol 0xfff
-rdr::U16 ascii_to_x[256] = {
-	NoSymbol,	NoSymbol,	NoSymbol,	XK_KP_Enter,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	XK_Delete,	XK_Tab,		XK_Linefeed,	NoSymbol,
-	NoSymbol,	XK_Return,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	XK_Escape,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	XK_space,	XK_exclam,	XK_quotedbl,	XK_numbersign,
-	XK_dollar,	XK_percent,	XK_ampersand,	XK_apostrophe,
-	XK_parenleft,	XK_parenright,	XK_asterisk,	XK_plus,
-	XK_comma,	XK_minus,	XK_period,	XK_slash,
-	XK_0,		XK_1,		XK_2,		XK_3,
-	XK_4,		XK_5,		XK_6,		XK_7,
-	XK_8,		XK_9,		XK_colon,	XK_semicolon,
-	XK_less,	XK_equal,	XK_greater,	XK_question,
-	XK_at,		XK_A,		XK_B,		XK_C,
-	XK_D,		XK_E,		XK_F,		XK_G,
-	XK_H,		XK_I,		XK_J,		XK_K,
-	XK_L,		XK_M,		XK_N,		XK_O,
-	XK_P,		XK_Q,		XK_R,		XK_S,
-	XK_T,		XK_U,		XK_V,		XK_W,
-	XK_X,		XK_Y,		XK_Z,		XK_bracketleft,
-	XK_backslash,	XK_bracketright,XK_asciicircum,	XK_underscore,
-	XK_grave,	XK_a,		XK_b,		XK_c,
-	XK_d,		XK_e,		XK_f,		XK_g,
-	XK_h,		XK_i,		XK_j,		XK_k,
-	XK_l,		XK_m,		XK_n,		XK_o,
-	XK_p,		XK_q,		XK_r,		XK_s,
-	XK_t,		XK_u,		XK_v,		XK_w,
-	XK_x,		XK_y,		XK_z,		XK_braceleft,
-	XK_bar,		XK_braceright,	XK_asciitilde,	XK_BackSpace,
-// 128
-	XK_Ccedilla,	XK_udiaeresis,	XK_eacute,	XK_acircumflex,
-	XK_adiaeresis,	XK_agrave,	XK_aring,	XK_ccedilla,
-	XK_ecircumflex,	XK_ediaeresis,	XK_egrave,	XK_idiaeresis,
-	XK_icircumflex,	XK_igrave,	XK_Adiaeresis,	XK_Aring,
-	XK_Eacute,	XK_ae,		XK_AE,		XK_ocircumflex,
-	XK_odiaeresis,	XK_ograve,	XK_ntilde,	XK_ugrave,
-	XK_ydiaeresis,	XK_Odiaeresis,	XK_Udiaeresis,	XK_cent,
-	XK_sterling,	XK_yen,		XK_paragraph,	XK_section,
-// 160
-	XK_aacute,	XK_degree,	XK_cent,	XK_sterling,
-	XK_ntilde,	XK_Ntilde,	XK_paragraph,	XK_Greek_BETA,
-	XK_questiondown,XK_hyphen,	XK_notsign,	XK_onehalf,
-	XK_onequarter,	XK_exclamdown,	XK_guillemotleft,XK_guillemotright,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-// 192
-	XK_questiondown,XK_exclamdown,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	XK_Agrave,
-	NoSymbol,	NoSymbol,	XK_AE,		XK_ae,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-	NoSymbol,	NoSymbol,	NoSymbol,	NoSymbol,
-// 224
-	XK_Greek_alpha,	XK_ssharp,	XK_Greek_GAMMA,	XK_Greek_pi,
-	XK_Greek_SIGMA,	XK_Greek_sigma,	XK_mu,	        XK_Greek_tau,
-	XK_Greek_PHI,	XK_Greek_THETA,	XK_Greek_OMEGA,	XK_Greek_delta,
-	XK_infinity,	XK_Ooblique,	XK_Greek_epsilon, XK_intersection,
-	XK_identical,	XK_plusminus,	XK_greaterthanequal, XK_lessthanequal,
-	XK_topintegral,	XK_botintegral,	XK_division,	XK_similarequal,
-	XK_degree,	NoSymbol,	NoSymbol,	XK_radical,
-	XK_Greek_eta,	XK_twosuperior,	XK_periodcentered, NoSymbol,
-  };
-
-
-
-
-// doKeyboardEvent wraps the system keybd_event function and attempts to find
-// the appropriate scancode corresponding to the supplied virtual keycode.
-
-inline void doKeyboardEvent(BYTE vkCode, DWORD flags) {
-  keybd_event(vkCode, MapVirtualKey(vkCode, 0), flags, 0);
-}
-
-// KeyStateModifier is a class which helps simplify generating a "fake" press
-// or release of shift, ctrl, alt, etc.  An instance of the class is created
-// for every key which may need to be pressed or released.  Then either press()
-// or release() may be called to make sure that the corresponding key is in the
-// right state.  The destructor of the class automatically reverts to the
-// previous state.
-
-class KeyStateModifier {
-public:
-  KeyStateModifier(int vkCode_, int flags_=0)
-    : vkCode(vkCode_), flags(flags_), pressed(false), released(false)
-  {}
-  void press() {
-    if (!(GetAsyncKeyState(vkCode) & 0x8000)) {
-      doKeyboardEvent(vkCode, flags);
-      vnclog.Print(LL_INTINFO, "fake %d down\n", vkCode);
-      pressed = true;
-    }
-  }
-  void release() {
-    if (GetAsyncKeyState(vkCode) & 0x8000) {
-      doKeyboardEvent(vkCode, flags | KEYEVENTF_KEYUP);
-      vnclog.Print(LL_INTINFO, "fake %d up\n", vkCode);
-      released = true;
-    }
-  }
-  ~KeyStateModifier() {
-    if (pressed) {
-      doKeyboardEvent(vkCode, flags | KEYEVENTF_KEYUP);
-      vnclog.Print(LL_INTINFO, "fake %d up\n", vkCode);
-    } else if (released) {
-      doKeyboardEvent(vkCode, flags);
-      vnclog.Print(LL_INTINFO, "fake %d down\n", vkCode);
-    }
-  }
-  int vkCode;
-  int flags;
-  bool pressed;
-  bool released;
-};
-
-// Keymapper - a single instance of this class is used to generate Windows key
-// events.
-void doKeyEventWithModifiers(BYTE vkCode, BYTE modifierState, bool down)
-{
-  KeyStateModifier ctrl(VK_CONTROL);
-  KeyStateModifier alt(VK_MENU);
-  KeyStateModifier shift(VK_SHIFT);
-
-  if (down) {
-    if (modifierState & 2) ctrl.press();
-    if (modifierState & 4) alt.press();
-    if (modifierState & 1) {
-      shift.press(); 
-    } else {
-      shift.release();
-    }
-  }
-  doKeyboardEvent(vkCode, down ? 0 : KEYEVENTF_KEYUP);
-}
-
-class Keymapper {
-
-public:
-  Keymapper()
-  {
-    for (size_t i = 0; i < sizeof(keymap) / sizeof(keymap_t); i++) {
-      vkMap[keymap[i].keysym] = keymap[i].vk;
-      extendedMap[keymap[i].keysym] = keymap[i].extended;
-    }
-
-	// Find dead characters for the current keyboard layout
-  // XXX how could we handle the keyboard layout changing?
-  BYTE keystate[256];
-  memset(keystate, 0, 256);
-  for (size_t j = 0; j < sizeof(latin1DeadChars); j++) {
-    SHORT s = VkKeyScan(latin1DeadChars[j]);
-    if (s != -1) {
-      BYTE vkCode = LOBYTE(s);
-      BYTE modifierState = HIBYTE(s);
-      keystate[VK_SHIFT] = (modifierState & 1) ? 0x80 : 0;
-      keystate[VK_CONTROL] = (modifierState & 2) ? 0x80 : 0;
-      keystate[VK_MENU] = (modifierState & 4) ? 0x80 : 0;
-      rdr::U8 chars[2];
-      int nchars = ToAscii(vkCode, 0, keystate, (WORD*)&chars, 0);
-      if (nchars < 0) {
-        vnclog.Print(LL_INTWARN, "Found dead key 0x%x '%c'",
-                   latin1DeadChars[j], latin1DeadChars[j]);
-        deadChars.push_back(latin1DeadChars[j]);
-        ToAscii(vkCode, 0, keystate, (WORD*)&chars, 0);
-      }
-    }
-  }
-
-  }
-
-
-  
-
-  
-
-
-
-
-  void keyEvent(rdr::U32 keysym, bool down, bool jap)
-  {
-	  //vnclog.Print(LL_INTWARN, " keysym 0x%x",keysym);
-	if (keysym>=XK_dead_grave && keysym <=XK_dead_belowdot)// && down)
-	{
-		keysymDead=keysym;
-		vnclog.Print(LL_INTWARN, " ************** DEAD KEY");
-		//we have a dead key
-		//Record dead key
-		return;
-	}
-
-    if ((keysym >= 32 && keysym <= 126) ||
-        (keysym >= 160 && keysym <= 255))
-    {
-	if (keysymDead!=0 && down)
-	{
-		vnclog.Print(LL_INTWARN, " Compose dead 0x%x 0x%x",keysymDead,keysym);
-		switch (keysymDead)
-		{
-		case XK_dead_grave:
-			switch(keysym)
-			{
-			case XK_A: keysym=XK_Agrave;break;
-			case XK_E: keysym=XK_Egrave;break;
-			case XK_I: keysym=XK_Igrave;break;
-			case XK_O: keysym=XK_Ograve;break;
-			case XK_U: keysym=XK_Ugrave;break;
-			case XK_a: keysym=XK_agrave;break;
-			case XK_e: keysym=XK_egrave;break;
-			case XK_i: keysym=XK_igrave;break;
-			case XK_o: keysym=XK_ograve;break;
-			case XK_u: keysym=XK_ugrave;break;
-			}
-		case XK_dead_acute:
-			switch(keysym)
-			{
-			case XK_A: keysym=XK_Aacute;break;
-			case XK_E: keysym=XK_Eacute;break;
-			case XK_I: keysym=XK_Iacute;break;
-			case XK_O: keysym=XK_Oacute;break;
-			case XK_U: keysym=XK_Uacute;break;
-			case XK_a: keysym=XK_aacute;break;
-			case XK_e: keysym=XK_eacute;break;
-			case XK_i: keysym=XK_iacute;break;
-			case XK_o: keysym=XK_oacute;break;
-			case XK_u: keysym=XK_uacute;break;
-			case XK_y: keysym=XK_yacute;break;
-			case XK_Y: keysym=XK_Yacute;break;
-
-			}
-		case XK_dead_circumflex:
-			switch(keysym)
-			{
-			case XK_A: keysym=XK_Acircumflex;break;
-			case XK_E: keysym=XK_Ecircumflex;break;
-			case XK_I: keysym=XK_Icircumflex;break;
-			case XK_O: keysym=XK_Ocircumflex;break;
-			case XK_U: keysym=XK_Ucircumflex;break;
-			case XK_a: keysym=XK_acircumflex;break;
-			case XK_e: keysym=XK_ecircumflex;break;
-			case XK_i: keysym=XK_icircumflex;break;
-			case XK_o: keysym=XK_ocircumflex;break;
-			case XK_u: keysym=XK_ucircumflex;break;
-			}
-		case XK_dead_tilde:
-			switch(keysym)
-			{
-			case XK_A : keysym=XK_Ntilde;break;
-			case XK_O : keysym=XK_Otilde;break;
-			case XK_a : keysym=XK_atilde;break;
-			case XK_n : keysym=XK_ntilde;break;
-			case XK_o : keysym=XK_otilde;break;
-			}
-
-		case XK_dead_diaeresis:
-			switch(keysym)
-			{
-			case XK_A: keysym=XK_Adiaeresis;break;
-			case XK_E: keysym=XK_Ediaeresis;break;
-			case XK_I: keysym=XK_Idiaeresis;break;
-			case XK_O: keysym=XK_Odiaeresis;break;
-			case XK_U: keysym=XK_Udiaeresis;break;
-			case XK_a: keysym=XK_adiaeresis;break;
-			case XK_e: keysym=XK_ediaeresis;break;
-			case XK_i: keysym=XK_idiaeresis;break;
-			case XK_o: keysym=XK_odiaeresis;break;
-			case XK_u: keysym=XK_udiaeresis;break;
-			case XK_y: keysym=XK_ydiaeresis;break;
-
-			}
-		case XK_dead_cedilla:
-			switch(keysym)
-			{
-			case XK_C: keysym=XK_Ccedilla;break;
-			case XK_c: keysym=XK_ccedilla;break;
-			}
-		}
-		keysymDead=0;
-		vnclog.Print(LL_INTWARN, " Composed 0x%x",keysym);
-
-	}
-      // ordinary Latin-1 character
-
-      SHORT s = VkKeyScan(keysym);
-
-      //	[v1.0.2-jp1 fix] yak!'s patch
-	  // This break Other keyboards, we need an easy way of fixing this
-	  if (jap)
-	  {
-		  if (keysym==XK_kana_WO) {
-			s = 0x0130;
-		  } else if (keysym==XK_backslash) {
-			s = 0x00e2;
-		  } else if (keysym==XK_yen) {
-			s = 0x00dc;
-		  }
-	  }
-
-	  //vnclog.Print(LL_INTWARN, " SHORT s %i",s);
-
-	 if (s == -1)
-	 {
-		 
-      if (down) {
-		  vnclog.Print(LL_INTWARN, "down");
-        // not a single keypress - try synthesizing dead chars.
-			{
-			  vnclog.Print(LL_INTWARN, " Found key");
-			  //Lookup ascii representation
-			  int ascii=0;
-#if 0
-              // 11 Dec 2008 jdp disabled since the viewer is sending unicode now
-			  for (ascii=0;ascii<256;ascii++)
-			  {
-				  if (keysym==ascii_to_x[ascii]) break;
-			  }
-#endif
-              ascii = keysym;
-			  if (ascii <= 255)
-			  {
-
-			  rdr::U8 a0=ascii/100;
-			  ascii=ascii%100;
-			  rdr::U8 a1=ascii/10;
-			  ascii=ascii%10;
-			  rdr::U8 a2=ascii;
-
-              KeyStateModifier shift(VK_SHIFT);
-              KeyStateModifier lshift(VK_LSHIFT);
-              KeyStateModifier rshift(VK_RSHIFT);
-
-              if (vncService::IsWin95()) {
-                shift.release();
-              } else {
-                lshift.release();
-                rshift.release();
-			  }
-
-              vnclog.Print(LL_INTWARN, " Simulating ALT+%d%d%d\n", a0, a1 ,a2);
-
-			  keybd_event(VK_MENU,MapVirtualKey( VK_MENU, 0 ), 0 ,0);
-              /**
-                Pressing the Alt+NNN combinations without leading zero (for example, Alt+20, Alt+130, Alt+221) 
-                will insert characters from the Extended ASCII (or MS DOS ASCII, or OEM) table. The character 
-                glyphs contained by this table depend on the language of Windows. See the table below for the 
-                list of characters that can be inserted through the Alt+NNN combinations (without leading zero)
-                in English Windows.
-
-                Pressing the Alt+0NNN combinations will insert the ANSI characters corresponding to the activate 
-                keyboard layout. Please see Windows Character Map utility (charmap.exe) for the possible Alt+0NNN
-                combinations.
-
-                Finally, the Alt+00NNN combinations (two leading zeros) will insert Unicode characters. The Unicode 
-                codes of characters are displayed in Charmap.
-
-              **/
-              // jdp 11 December 2008 - Need the leading 0! 
-			  keybd_event(VK_NUMPAD0,    MapVirtualKey(VK_NUMPAD0,    0), 0, 0);
-			  keybd_event(VK_NUMPAD0,    MapVirtualKey(VK_NUMPAD0,    0),KEYEVENTF_KEYUP,0);
-			  keybd_event(VK_NUMPAD0+a0, MapVirtualKey(VK_NUMPAD0+a0, 0), 0, 0);
-			  keybd_event(VK_NUMPAD0+a0, MapVirtualKey(VK_NUMPAD0+a0, 0),KEYEVENTF_KEYUP,0);
-			  keybd_event(VK_NUMPAD0+a1, MapVirtualKey(VK_NUMPAD0+a1, 0),0,0);
-			  keybd_event(VK_NUMPAD0+a1, MapVirtualKey(VK_NUMPAD0+a1, 0),KEYEVENTF_KEYUP, 0);
-			  keybd_event(VK_NUMPAD0+a2, MapVirtualKey(VK_NUMPAD0+a2, 0) ,0, 0);
-			  keybd_event(VK_NUMPAD0+a2, MapVirtualKey(VK_NUMPAD0+a2, 0),KEYEVENTF_KEYUP, 0);
-			  keybd_event(VK_MENU, MapVirtualKey( VK_MENU, 0 ),KEYEVENTF_KEYUP, 0);
-			  return;
-			  }
-        }
-        vnclog.Print(LL_INTWARN, "ignoring unrecognised Latin-1 keysym 0x%x",keysym);
-      }
-      return;
-    }
-
-      /*if (s == -1) {
-        vnclog.Print(LL_INTWARN, "ignoring unrecognised Latin-1 keysym %d\n",
-                     keysym);
-		keybd_event( VK_MENU, MapVirtualKey(VK_MENU, 0),0, 0);
-		keybd_event( VK_MENU, MapVirtualKey(VK_MENU, 0),KEYEVENTF_KEYUP, 0);
-
-
-        return;
-      }*/
-
-      BYTE vkCode = LOBYTE(s);
-
-      // 18 March 2008 jdp
-      // Correct the keymask shift state to cope with the capslock state
-      BOOL capslockOn = (GetKeyState(VK_CAPITAL) & 1) != 0;
-
-      BYTE modifierState = HIBYTE(s);
-      modifierState = capslockOn ? modifierState ^ 1 : modifierState;
-      KeyStateModifier ctrl(VK_CONTROL);
-      KeyStateModifier alt(VK_MENU);
-      KeyStateModifier shift(VK_SHIFT);
-      KeyStateModifier lshift(VK_LSHIFT);
-      KeyStateModifier rshift(VK_RSHIFT);
-
-      if (down) {
-        if (modifierState & 2) ctrl.press();
-        if (modifierState & 4) alt.press();
-        if (modifierState & 1) {
-          shift.press(); 
-        } else {
-		  // [v1.0.2-jp1 fix] Even if "SHIFT + SPACE" are pressed, "SHIFT" is valid
-          if (vkCode == 0x20){
-		  }
-		  else{
-            if (vncService::IsWin95()) {
-              shift.release();
-			} else {
-              lshift.release();
-              rshift.release();
-			}
-		  }
-        }
-      }
-      vnclog.Print(LL_INTINFO,
-                   "latin-1 key: keysym %d(0x%x) vkCode 0x%x down %d capslockOn %d\n",
-                   keysym, keysym, vkCode, down, capslockOn);
-
-      doKeyboardEvent(vkCode, down ? 0 : KEYEVENTF_KEYUP);
-
-    } else {
-
-      // see if it's a recognised keyboard key, otherwise ignore it
-
-      if (vkMap.find(keysym) == vkMap.end()) {
-        vnclog.Print(LL_INTWARN, "ignoring unknown keysym %d\n",keysym);
-        return;
-      }
-      BYTE vkCode = vkMap[keysym];
-      DWORD flags = 0;
-      if (extendedMap[keysym]) flags |= KEYEVENTF_EXTENDEDKEY;
-      if (!down) flags |= KEYEVENTF_KEYUP;
-
-//      vnclog.Print(LL_INTINFO,
-  //                "keyboard key: keysym %d(0x%x) vkCode 0x%x ext %d down %d\n",
-    //               keysym, keysym, vkCode, extendedMap[keysym], down);
-
-      if (down && (vkCode == VK_DELETE) &&
-          ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0) &&
-          ((GetAsyncKeyState(VK_MENU) & 0x8000) != 0) &&
-          vncService::IsWinNT())
-      {
-		vnclog.Print(LL_INTINFO,
-                 "CAD\n");
-		// If running under Vista and started from Session0 in Application mode
-		if (vncService::VersionMajor()>=6 && vncService::RunningFromExternalService() )
-		{
-			      vnclog.Print(LL_INTINFO,
-                 "Vista and runnning as system -> CAD\n");
-
-				// Try to run the special Vista cad.exe file...
-				HANDLE ThreadHandle2;
-				DWORD dwTId;
-				ThreadHandle2 = CreateThread(NULL, 0, Cadthread, NULL, 0, &dwTId);
-				CloseHandle(ThreadHandle2);
-		}
-		else if (vncService::VersionMajor()>=6)
-		{
-			vnclog.Print(LL_INTINFO,
-                 "Vista and runnning as user -> Taskmgr\n");
-			WinExec("taskmgr.exe", SW_SHOWNORMAL);
-		}
-		else if (vncService::VersionMajor()<6 && vncService::RunningFromExternalService() )
-		{
-			vnclog.Print(LL_INTINFO,
-                 "Not Vista and runnning as system, use old method\n");
-			vncService::SimulateCtrlAltDel();
-		}
-		else if (vncService::VersionMajor()<6)
-		{
-			vnclog.Print(LL_INTINFO,
-                 "Not Vista and runnning as user -> Taskmgr\n");
-			WinExec("taskmgr.exe", SW_SHOWNORMAL);
-		}
-        return;
-      }
-
-      if (vncService::IsWin95()) {
-        switch (vkCode) {
-        case VK_RSHIFT:   vkCode = VK_SHIFT;   break;
-        case VK_RCONTROL: vkCode = VK_CONTROL; break;
-        case VK_RMENU:    vkCode = VK_MENU;    break;
-        }
-      }
-
-      doKeyboardEvent(vkCode, flags);
-    }
-  }
-
-private:
-  std::map<rdr::U32,rdr::U8> vkMap;
-  std::map<rdr::U32,bool> extendedMap;
-} key_mapper;
-
-void vncKeymap::keyEvent(CARD32 keysym, bool down,bool jap)
-{
-  key_mapper.keyEvent(keysym, down,jap);
-}
-
-
-
-void
-SetShiftState(BYTE key, BOOL down)
-{
-	BOOL keystate = (GetAsyncKeyState(key) & 0x8000) != 0;
-
-	// This routine sets the specified key to the desired value (up or down)
-	if ((keystate && down) || ((!keystate) && (!down)))
-		return;
-
-	vnclog.Print(LL_INTINFO,
-		VNCLOG("setshiftstate %d - (%s->%s)\n"),
-		key, keystate ? "down" : "up",
-		down ? "down" : "up");
-
-	// Now send a key event to set the key to the new value
-	doKeyboardEvent(key, down ? 0 : KEYEVENTF_KEYUP);
-	keystate = (GetAsyncKeyState(key) & 0x8000) != 0;
-
-	vnclog.Print(LL_INTINFO,
-		VNCLOG("new state %d (%s)\n"),
-		key, keystate ? "down" : "up");
-}
-
-void
-vncKeymap::ClearShiftKeys()
-{
-	if (vncService::IsWinNT())
-	{
-		// On NT, clear both sets of keys
-
-		// LEFT
-		SetShiftState(VK_LSHIFT, FALSE);
-		SetShiftState(VK_LCONTROL, FALSE);
-		SetShiftState(VK_LMENU, FALSE);
-
-		// RIGHT
-		SetShiftState(VK_RSHIFT, FALSE);
-		SetShiftState(VK_RCONTROL, FALSE);
-		SetShiftState(VK_RMENU, FALSE);
-	}
-	else
-	{
-		// Otherwise, we can't distinguish the keys anyway...
-
-		// Clear the shift key states
-		SetShiftState(VK_SHIFT, FALSE);
-		SetShiftState(VK_CONTROL, FALSE);
-		SetShiftState(VK_MENU, FALSE);
-	}
-}
diff --git a/ica/win32/winvnc/winvnc/vnckeymap.h b/ica/win32/winvnc/winvnc/vnckeymap.h
deleted file mode 100644
index becc9c3..0000000
--- a/ica/win32/winvnc/winvnc/vnckeymap.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2002 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 program is not available from the place from
-// which you received this file, check http://www.realvnc.com/ or contact
-// the authors on info at realvnc.com for information on obtaining it.
-
-#ifndef KEYMAP_H__
-#define KEYMAP_H__
-
-#include "rfb.h"
-
-class vncKeymap {
-public:
-  static void keyEvent(CARD32 keysym, bool down,bool jap);
-  static void ClearShiftKeys();
-};
-
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vnclog.cpp b/ica/win32/winvnc/winvnc/vnclog.cpp
deleted file mode 100644
index 6381592..0000000
--- a/ica/win32/winvnc/winvnc/vnclog.cpp
+++ /dev/null
@@ -1,303 +0,0 @@
-//  Copyright (C) 2002 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 at realvnc.com for information on obtaining it.
-
-// Log.cpp: implementation of the VNCLog class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include <io.h>
-#include "vnclog.h"
-#include "inifile.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-const int VNCLog::ToDebug   =  1;
-const int VNCLog::ToFile    =  2;
-const int VNCLog::ToConsole =  4;
-
-static const int LINE_BUFFER_SIZE = 1024;
-
-VNCLog::VNCLog()
-    : m_tofile(false)
-    , m_todebug(false)
-    , m_toconsole(false)
-    , m_mode(0)
-    , m_level(0)
-    , hlogfile(NULL)
-    , m_append(false)
-	, m_video(false)
-    , m_lastLogTime(0)
-{
-	strcpy(m_filename,"");
-	m_path[0] = 0;
-}
-
-void VNCLog::SetMode(int mode)
-{
-	m_mode = mode;
-    if (mode & ToDebug)
-        m_todebug = true;
-    else
-        m_todebug = false;
-
-    if (mode & ToFile)  {
-		if (!m_tofile)
-			OpenFile();
-	} else {
-		CloseFile();
-        m_tofile = false;
-    }
-    
-    if (mode & ToConsole) {
-        if (!m_toconsole) {
-            AllocConsole(); //lint !e534
-            fclose(stdout);
-            fclose(stderr);
-#ifdef _MSC_VER
-            int fh = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), 0);
-            _dup2(fh, 1);
-            _dup2(fh, 2);
-            _fdopen(1, "wt");
-            _fdopen(2, "wt");
-            printf("fh is %d\n",fh);
-            fflush(stdout);
-#endif
-        }
-
-        m_toconsole = true;
-
-    } else {
-        m_toconsole = false;
-    }
-}
-
-
-void VNCLog::SetLevel(int level) {
-    m_level = level;
-}
-
-void VNCLog::SetFile() 
-{
-	//SetMode(2);
-	//SetLevel(10);
-	char temp[512];
-	IniFile myIniFile;
-	myIniFile.ReadString("admin", "path", temp,512);
-	SetPath(temp);
-	strcpy(m_filename,m_path);
-	strcat(m_filename,"\\");
-	strcat(m_filename,"WinVNC.log");
-	m_append = true;
-	if (m_tofile)
-		OpenFile();
-}
-
-void VNCLog::OpenFile()
-{
-	// Is there a file-name?
-	if (strlen(m_filename) == 0)
-	{
-        m_todebug = true;
-        m_tofile = false;
-        Print(0, "Error opening log file\n");
-		return;
-	}
-
-    m_tofile  = true;
-    
-	// If there's an existing log and we're not appending then move it
-	if (!m_append)
-	{
-		// Build the backup filename
-		char *backupfilename = new char[strlen(m_filename)+5];
-		if (backupfilename)
-		{
-			strcpy(backupfilename, m_filename);
-			strcat(backupfilename, ".bak");
-			// Attempt the move and replace any existing backup
-			// Note that failure is silent - where would we log a message to? ;)
-			MoveFileEx(m_filename, backupfilename, MOVEFILE_REPLACE_EXISTING);
-			delete [] backupfilename;
-		}
-	}
-
-	CloseFile();
-
-    // If filename is NULL or invalid we should throw an exception here
-    hlogfile = CreateFile(
-        m_filename,  GENERIC_WRITE, FILE_SHARE_READ, NULL,
-        OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL  );
-    
-    if (hlogfile == INVALID_HANDLE_VALUE) {
-        // We should throw an exception here
-        m_todebug = true;
-        m_tofile = false;
-        Print(0, "Error opening log file %s\n", m_filename);
-    }
-    if (m_append) {
-        SetFilePointer( hlogfile, 0, NULL, FILE_END );
-    } else {
-        SetEndOfFile( hlogfile );
-    }
-}
-
-// if a log file is open, close it now.
-void VNCLog::CloseFile() {
-    if (hlogfile != NULL) {
-        CloseHandle(hlogfile);
-        hlogfile = NULL;
-    }
-}
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-#include "Logger.h"
-#endif
-
-inline void VNCLog::ReallyPrintLine(int level, const char* line) 
-{
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	if( level == LL_SOCKERR || level == LL_ERROR )
-	{
-		ilog( Error, line );
-	}
-	else if( level == LL_INTWARN || level == LL_CONNERR )
-	{
-		ilog( Warning, line );
-	}
-	else if( level == LL_STATE ||
-				level == LL_CLIENTS || level == LL_INTERR )
-	{
-		ilog( Info, line );
-	}
-	else
-	{
-		ilog( Debug, line );
-	}
-#else
-    if (m_todebug) OutputDebugString(line);
-    if (m_toconsole) {
-        DWORD byteswritten;
-        WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), line, strlen(line), &byteswritten, NULL); 
-    };
-    if (m_tofile && (hlogfile != NULL)) {
-        DWORD byteswritten;
-        WriteFile(hlogfile, line, strlen(line), &byteswritten, NULL); 
-    }
-#endif
-}
-
-void VNCLog::ReallyPrint(int level, const char* format, va_list ap) 
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	time_t current = time(0);
-	if (current != m_lastLogTime) {
-		m_lastLogTime = current;
-		ReallyPrintLine(ctime(&m_lastLogTime));
-	}
-#endif
-
-	// - Write the log message, safely, limiting the output buffer size
-	TCHAR line[(LINE_BUFFER_SIZE * 2) + 1]; // sf at 2006 - Prevents buffer overflow
-	TCHAR szErrorMsg[LINE_BUFFER_SIZE];
-	DWORD  dwErrorCode = GetLastError();
-    _vsnprintf(line, LINE_BUFFER_SIZE, format, ap);
-	SetLastError(0);
-    if (dwErrorCode != 0) {
-	    if (FormatMessage( 
-             FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode,
-             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(char *)&szErrorMsg,
-             LINE_BUFFER_SIZE, NULL) == 0)
-        {
-            sprintf(szErrorMsg, "error code 0x%08X", (unsigned int) dwErrorCode);
-        }
-	strcat(line," --");
-	strcat(line,szErrorMsg);
-	level = LL_ERROR;
-    }
-	ReallyPrintLine(level, line);
-}
-
-VNCLog::~VNCLog()
-{
-    try
-    {
-        CloseFile();
-    }
-    catch(...)
-    {
-    }
-}
-
-void VNCLog::GetLastErrorMsg(LPSTR szErrorMsg) const {
-
-   DWORD  dwErrorCode = GetLastError();
-
-   // Format the error message.
-   FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER 
-         | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode,
-         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &szErrorMsg,
-         0, NULL);
-}
-
-void VNCLog::SetPath(char path[512])
-{
-	if (strlen(path)==0)
-	{
-		char WORKDIR[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return;
-		*p = '\0';
-		}
-		strcpy(m_path,WORKDIR);
-	}
-	else
-	strcpy(m_path,path);
-}
-char *VNCLog::GetPath()
-{
-	if (strlen(m_path)==0)
-	{
-		char WORKDIR[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return "";
-		*p = '\0';
-		}
-		strcpy(m_path,WORKDIR);
-	}
-	
-	return m_path;
-}
-
-void VNCLog::ClearAviConfig()
-{
-	char WORKDIR[MAX_PATH];
-	strcpy(WORKDIR,m_path);
-	strcat(WORKDIR,"\\");
-	strcat(WORKDIR,"codec.cfg");
-	DeleteFile(WORKDIR);
-}
diff --git a/ica/win32/winvnc/winvnc/vnclog.h b/ica/win32/winvnc/winvnc/vnclog.h
deleted file mode 100644
index 8e6b88d..0000000
--- a/ica/win32/winvnc/winvnc/vnclog.h
+++ /dev/null
@@ -1,109 +0,0 @@
-//  Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
-//  Copyright (C) 1999 AT&T Laboratories Cambridge. 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 at realvnc.com for information on obtaining it.
-
-// This is an object and macros which provide general logging and debugging functions.
-// It can log to a file, to a new console, and/or to debug - others maybe to follow.
-// Every log object has a logging level (which can be changed).
-// Only log requests with a high enough level attached get logged. So the
-// level can be thought of as 'amount of detail'.
-// We use Unicode-portable stuff here for compatibility with WinCE.
-//
-// Typical use:
-//
-//       Log log;
-//       log.SetFile( _T("myapp.log") );
-//       ...
-//       log.Print(2, _T("x = %d\n"), x);
-//
-
-#ifndef VNCLOGGING
-#define VNCLOGGING
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <time.h>
-
-class VNCLog  
-{
-public:
-    // Logging mode flags:
-    static const int ToDebug;
-    static const int ToFile;
-    static const int ToConsole;
-
-    // Create a new log object.
-    // Parameters as follows:
-    //    mode     - specifies where output should go, using combination
-    //               of flags above.
-    //    level    - the default level
-    //    filename - if flag Log::ToFile is specified in the type,
-    //               a filename must be specified here.
-    //    append   - if logging to a file, whether or not to append to any
-    //               existing log.
-	VNCLog();
-
-    inline void Print(int level, const char* format, ...) {
-        va_list ap;
-        va_start(ap, format);
-        ReallyPrint(level, format, ap);
-        va_end(ap);
-    }
-    
-    // Change the log level
-    void SetLevel(int level);
-	int  GetLevel() const {return m_level;};
-
-	void SetVideo(bool enable) {m_video=enable;};
-	bool GetVideo() {return m_video;};
-	void SetPath(char path[512]);
-	char *GetPath();
-	void ClearAviConfig();
-
-    // Change the logging mode
-    void SetMode(int mode);
-	int  GetMode() const {return m_mode;};
-
-    // Change or set the logging filename.  This only has an effect if
-	// the log mode includes ToFile
-    void SetFile();
-
-	virtual ~VNCLog();
-
-private:
-	void ReallyPrintLine(int level, const char* line);
-    void ReallyPrint(int level, const char* format, va_list ap);
-	void OpenFile();
-    void CloseFile();
-    bool m_tofile, m_todebug, m_toconsole;
-	int m_mode;
-    int m_level;
-    HANDLE hlogfile;
-	char m_filename[512];
-	bool m_append;
-	bool m_video;
-	char m_path[MAX_PATH];
-
-	time_t m_lastLogTime;
-	void GetLastErrorMsg(LPSTR szErrorMsg) const;
-};
-
-#endif // VNCLOGGING
diff --git a/ica/win32/winvnc/winvnc/vnclogon.cpp b/ica/win32/winvnc/winvnc/vnclogon.cpp
deleted file mode 100644
index 5deec2a..0000000
--- a/ica/win32/winvnc/winvnc/vnclogon.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#include "stdhdrs.h"
-#include "resource.h"
-#include <omnithread.h>
-#include "vncdesktop.h"
-#include "vnclogon.h"
-
-
-extern HINSTANCE	hAppInstance;
-extern BOOL WINAPI SSPLogonUser(LPTSTR szDomain, LPTSTR szUser, LPTSTR szPassword);
-TCHAR szUsername[64];
-TCHAR szPassword[64];
-TCHAR szDomain[64];
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-BOOL vncLogonThread::Init(vncDesktop *desktop)
-{
-	m_desktop = desktop;
-	m_desktop->logon=1;
-	logonhwnd=NULL;
-	rect.left=0;
-	rect.top=0;
-	rect.right=32;
-	rect.bottom=32;
-	start_undetached();
-	return TRUE;
-}
-
-void *vncLogonThread::run_undetached(void * arg)
-{
-	int logonstatus;
-	logonstatus=CreateLogonWindow(hAppInstance);
-	m_desktop->logon=logonstatus;
-
-	return NULL;
-}
-BOOL CALLBACK  
-vncLogonThread::LogonDlgProc(HWND hDlg,
-							 UINT Message,
-							 WPARAM wParam,
-							 LPARAM lParam)
-{
- TCHAR TempString[63];
- vncLogonThread *_this = (vncLogonThread *) GetWindowLong(hDlg, GWL_USERDATA);
-  switch (Message)
-    {
-    case WM_INITDIALOG:
-		_this = (vncLogonThread *) lParam;
-      _this->CenterWindow(hDlg);
-	  SetDlgItemText(hDlg, IDD_DOMAIN,TEXT("."));
-      SetDlgItemText(hDlg, IDD_USER_NAME,TEXT(""));
-      SetDlgItemText(hDlg, IDD_PASSWORD, TEXT(""));
-      SetFocus(GetDlgItem(hDlg, IDD_USER_NAME));
-
-      return(TRUE);
-
-    case WM_COMMAND:
-      if (LOWORD(wParam) == IDCANCEL)
-			{
-				EndDialog(hDlg, 0);
-			}
-      if (LOWORD(wParam) == IDOK)
-			{
-			GetDlgItemText(hDlg, IDD_USER_NAME, TempString, 63);
-			strcpy(szUsername,TempString);
-			GetDlgItemText(hDlg, IDD_PASSWORD,TempString, 63);
-			strcpy(szPassword,TempString);
-			GetDlgItemText(hDlg, IDD_DOMAIN,TempString, 63);
-			strcpy(szDomain,TempString);
-			EndDialog(hDlg, 1);
-			}
-      return(TRUE);
-    }
-
-  return(FALSE);
-
-}
-int vncLogonThread::CreateLogonWindow(HINSTANCE hInstance)
-{
-	int returnvalue=0;
-
-	// [v1.0.2-jp1 fix] Load resouce from dll
-	//returnvalue = DialogBoxParam(hAppInstance,MAKEINTRESOURCE(IDD_LOGON),
-	returnvalue = DialogBoxParam(hInstResDLL,MAKEINTRESOURCE(IDD_LOGON),
-				NULL,
-				(DLGPROC) LogonDlgProc,
-				(LONG) this);
-
-	if (returnvalue==1)
-			
-				if ((strcmp(szUsername ,TEXT(""))!=0) && (strcmp(szPassword ,TEXT(""))!=0))
-					
-						
-						if (SSPLogonUser(szDomain, szUsername,szPassword)) return 3;
-						
-						
-					
-	
-		
-	return 2;
-}
-VOID vncLogonThread::CenterWindow(HWND hwnd)
-{
-  LONG    dx, dy;
-  LONG    dxParent, dyParent;
-  LONG    Style;
-  logonhwnd=hwnd;
-  GetWindowRect(hwnd, &rect);
-  dx = rect.right - rect.left;
-  dy = rect.bottom - rect.top;
-
-  Style = GetWindowLong(hwnd, GWL_STYLE);
-  if ((Style & WS_CHILD) == 0) 
-    {
-      dxParent = GetSystemMetrics(SM_CXSCREEN);
-      dyParent = GetSystemMetrics(SM_CYSCREEN);
-    } 
-  else 
-    {
-      HWND    hwndParent;
-      RECT    rectParent;
-
-      hwndParent = GetParent(hwnd);
-      if (hwndParent == NULL) 
-	{
-	  hwndParent = GetDesktopWindow();
-	}
-
-      GetWindowRect(hwndParent, &rectParent);
-
-      dxParent = rectParent.right - rectParent.left;
-      dyParent = rectParent.bottom - rectParent.top;
-    }
-
-  rect.left = (dxParent - dx) / 2+m_desktop->m_ScreenOffsetx;
-  rect.top  = (dyParent - dy) / 3+m_desktop->m_ScreenOffsety;
-
-  SetWindowPos(hwnd, HWND_TOPMOST, rect.left, rect.top, 0, 0, SWP_NOSIZE);
-
-  SetForegroundWindow(hwnd);
-}
-
diff --git a/ica/win32/winvnc/winvnc/vnclogon.h b/ica/win32/winvnc/winvnc/vnclogon.h
deleted file mode 100644
index f689b42..0000000
--- a/ica/win32/winvnc/winvnc/vnclogon.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "stdhdrs.h"
-#if !defined(_WINVNC_LOGON)
-#define _WINVNC_LOGON
-#pragma once
-class vncLogonThread : public omni_thread
-{
-public:
-	vncLogonThread() {
-		m_returnsig = NULL;
-		m_desktop = NULL;
-		x1 = x2 = y1 = y2 = 0;
-	}
-	~vncLogonThread() {if (m_returnsig != NULL) delete m_returnsig;};
-public:
-	virtual BOOL Init(vncDesktop *desktop);
-	virtual void *run_undetached(void *arg);
-	HWND logonhwnd;
-	RECT    rect;
-
-protected:
-	omni_mutex m_returnLock;
-	omni_condition *m_returnsig;
-	vncDesktop *m_desktop;
-	int x1,x2,y1,y2;
-	VOID CenterWindow(HWND hwnd);
-	static BOOL CALLBACK LogonDlgProc(HWND hDlg,UINT Message,WPARAM wParam,LPARAM lParam);
-	int CreateLogonWindow(HINSTANCE hInstance);
-};
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncmemcpy.h b/ica/win32/winvnc/winvnc/vncmemcpy.h
deleted file mode 100644
index 836f6d2..0000000
--- a/ica/win32/winvnc/winvnc/vncmemcpy.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __CPU_H__
-#define __CPU_H__
-#define CPUID_STD_FPU          0x00000001
-#define CPUID_STD_VME          0x00000002
-#define CPUID_STD_DEBUGEXT     0x00000004
-#define CPUID_STD_4MPAGE       0x00000008
-#define CPUID_STD_TSC          0x00000010
-#define CPUID_STD_MSR          0x00000020
-#define CPUID_STD_PAE          0x00000040
-#define CPUID_STD_MCHKXCP      0x00000080
-#define CPUID_STD_CMPXCHG8B    0x00000100
-#define CPUID_STD_APIC         0x00000200
-#define CPUID_STD_SYSENTER     0x00000800
-#define CPUID_STD_MTRR         0x00001000
-#define CPUID_STD_GPE          0x00002000
-#define CPUID_STD_MCHKARCH     0x00004000
-#define CPUID_STD_CMOV         0x00008000
-#define CPUID_STD_PAT          0x00010000
-#define CPUID_STD_PSE36        0x00020000
-#define CPUID_STD_MMX          0x00800000
-#define CPUID_STD_FXSAVE       0x01000000
-#define CPUID_STD_SSE          0x02000000
-#define CPUID_STD_SSE2         0x04000000
-#define CPUID_EXT_3DNOW        0x80000000
-#define CPUID_EXT_AMD_3DNOWEXT 0x40000000
-#define CPUID_EXT_AMD_MMXEXT   0x00400000
-
-#define FEATURE_CPUID           0x00000001
-#define FEATURE_STD_FEATURES    0x00000002
-#define FEATURE_EXT_FEATURES    0x00000004
-#define FEATURE_TSC             0x00000010
-#define FEATURE_MMX             0x00000020
-#define FEATURE_CMOV            0x00000040
-#define FEATURE_3DNOW           0x00000080
-#define FEATURE_3DNOWEXT        0x00000100
-#define FEATURE_MMXEXT          0x00000200
-#define FEATURE_SSEFP           0x00000400
-#define FEATURE_K6_MTRR         0x00000800
-#define FEATURE_P6_MTRR         0x00001000
-#define FEATURE_SSE				0x00002000
-#define FEATURE_SSE2            0x00004000
-
-class Ultravncmemcpy
-{
-public:
-	Ultravncmemcpy();
-	~Ultravncmemcpy();
-	inline void Set_memcpu();
-	bool Save_memcpy(void* dest,void* src,size_t count);
-	bool Save_memcmp(void* dest,void* src,size_t count);
-	inline void memcpyMMX(void* dest,void* src,DWORD count);
-	inline void memcpySSE(void *dest, const void *src, size_t nbytes);
-	UINT get_feature_flags(void);
-	bool cputype;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncmenu.cpp b/ica/win32/winvnc/winvnc/vncmenu.cpp
deleted file mode 100644
index 5dfe533..0000000
--- a/ica/win32/winvnc/winvnc/vncmenu.cpp
+++ /dev/null
@@ -1,2014 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncMenu
-
-// Implementation of a system tray icon & menu for WinVNC
-
-#include "stdhdrs.h"
-#include "winvnc.h"
-#include "vncservice.h"
-#include "vncconndialog.h"
-#include <lmcons.h>
-#include <wininet.h>
-#include <shlobj.h>
-
-// Header
-
-#include "vncmenu.h"
-#include "HideDesktop.h"
-#include "common/win32_helpers.h"
-
-#ifndef __GNUC__
-// [v1.0.2-jp1 fix]
-#pragma comment(lib, "imm32.lib")
-#endif
-
-extern bool G_1111;
-// Constants
-const UINT MENU_ADD_CLIENT_MSG_INIT = RegisterWindowMessage("WinVNC.AddClient.Message.Init");
-const UINT MENU_ADD_CLIENT_MSG = RegisterWindowMessage("WinVNC.AddClient.Message");
-const UINT MENU_AUTO_RECONNECT_MSG = RegisterWindowMessage("WinVNC.AddAutoClient.Message");
-const UINT MENU_STOP_RECONNECT_MSG = RegisterWindowMessage("WinVNC.AddStopClient.Message");
-const UINT MENU_STOP_ALL_RECONNECT_MSG = RegisterWindowMessage("WinVNC.AddStopAllClient.Message");
-const UINT MENU_REPEATER_ID_MSG = RegisterWindowMessage("WinVNC.AddRepeaterID.Message");
-// adzm 2009-07-05 - Tray icon balloon tips
-// adzm 2010-02-10 - Changed this window message (added 2) to prevent receiving the same message from older UltraVNC builds 
-// which will send this message between processes with process-local pointers to strings as the wParam and lParam
-const UINT MENU_TRAYICON_BALLOON_MSG = RegisterWindowMessage("WinVNC.TrayIconBalloon2.Message");
- 
-
-const UINT FileTransferSendPacketMessage = RegisterWindowMessage("UltraVNC.Viewer.FileTransferSendPacketMessage");
-
-const char *MENU_CLASS_NAME = "WinVNC Tray Icon";
-
-BOOL g_restore_ActiveDesktop = FALSE;
-bool RunningAsAdministrator ();
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-extern bool			fShutdownOrdered;
-
-extern BOOL SPECIAL_SC_PROMPT;
-
-// sf at 2007 - WTS notifications stuff
-#define NOTIFY_FOR_THIS_SESSION 0
-typedef BOOL (WINAPI *WTSREGISTERSESSIONNOTIFICATION)(HWND, DWORD);
-typedef BOOL (WINAPI *WTSUNREGISTERSESSIONNOTIFICATION)(HWND);
-
-static HMODULE DMdll = NULL; 
-typedef HRESULT (CALLBACK *P_DwmIsCompositionEnabled) (BOOL *pfEnabled); 
-static P_DwmIsCompositionEnabled pfnDwmIsCompositionEnabled = NULL; 
-typedef HRESULT (CALLBACK *P_DwmEnableComposition) (BOOL   fEnable); 
-static P_DwmEnableComposition pfnDwmEnableComposition = NULL; 
-static BOOL AeroWasEnabled = FALSE;
-DWORD GetExplorerLogonPid();
-
-void Set_uninstall_service_as_admin();
-void Set_install_service_as_admin();
-void Set_stop_service_as_admin();
-void Set_start_service_as_admin();
-
-DWORD GetCurrentSessionID();
-static unsigned int WM_TASKBARCREATED = 0;
-void Open_homepage();
-void Open_forum();
-
-#define MSGFLT_ADD		1
-typedef BOOL (WINAPI *CHANGEWINDOWMESSAGEFILTER)(UINT message, DWORD dwFlag);
-
-void Enable_softwareCAD_elevated();
-void delete_softwareCAD_elevated();
-void Reboot_in_safemode_elevated();
-bool IsSoftwareCadEnabled();
-bool ISUACENabled();
-void Reboot_with_force_reboot_elevated();
-//HACK to use name in autoreconnect from service with dyn dns
-extern char dnsname[255];
-
-
-static inline VOID UnloadDM(VOID) 
- { 
-         pfnDwmEnableComposition = NULL; 
-         pfnDwmIsCompositionEnabled = NULL; 
-         if (DMdll) FreeLibrary(DMdll); 
-         DMdll = NULL; 
- } 
-static inline BOOL LoadDM(VOID) 
- { 
-         if (DMdll) 
-                 return TRUE; 
-  
-         DMdll = LoadLibraryA("dwmapi.dll"); 
-         if (!DMdll) return FALSE; 
-  
-         pfnDwmIsCompositionEnabled = (P_DwmIsCompositionEnabled)GetProcAddress(DMdll, "DwmIsCompositionEnabled");  
-         pfnDwmEnableComposition = (P_DwmEnableComposition)GetProcAddress(DMdll, "DwmEnableComposition"); 
-  
-         return TRUE; 
- } 
-
-
-
-//bool disable_aero_set=false;
-static inline VOID DisableAero(VOID) 
- { 
-	    /* if (disable_aero_set)
-		 {
-			 vnclog.Print(LL_INTINFO, VNCLOG("DisableAero already done %i \n"),AeroWasEnabled);
-			 return;
-		 }*/
-         BOOL pfnDwmEnableCompositiond = FALSE; 
-         //AeroWasEnabled = FALSE; 
-  
-         if (!LoadDM()) 
-                 return; 
-  
-         if (pfnDwmIsCompositionEnabled && SUCCEEDED(pfnDwmIsCompositionEnabled(&pfnDwmEnableCompositiond))) 
-                 ; 
-         else 
-                 return; 
-  
-		 //disable_aero_set=true;
-		 vnclog.Print(LL_INTINFO, VNCLOG("DisableAero %i \n"),pfnDwmEnableCompositiond);
-          if (!pfnDwmEnableCompositiond)
-			  return; 
-
-  
-		  if (pfnDwmEnableComposition && SUCCEEDED(pfnDwmEnableComposition(FALSE))) {			  
-			AeroWasEnabled = pfnDwmEnableCompositiond;
-		  }
-		 
- } 
-  
- static inline VOID ResetAero(VOID) 
- { 
-	     vnclog.Print(LL_INTINFO, VNCLOG("Reset %i \n"),AeroWasEnabled);
-         if (pfnDwmEnableComposition && AeroWasEnabled) 
-         { 
-                 if (SUCCEEDED(pfnDwmEnableComposition(AeroWasEnabled))) 
-                         ; 
-                 else 
-                         ; 
-         } 
-		 //disable_aero_set=false;
-         UnloadDM(); 
- } 
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static bool IsUserDesktop()
-{
-	//only kill wallpaper if desktop is user desktop
-	HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-	char new_name[256];
-	if (GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-	{
-		if (strcmp(new_name,"Default")==0) {
-			return true;
-		}
-	}	
-
-	return false;
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static void KillWallpaper()
-{
-	HideDesktop();
-}
-
-static void RestoreWallpaper()
-{
-  RestoreDesktop();
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static void KillEffects()
-{
-	DisableEffects();
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static void RestoreEffects()
-{
-	EnableEffects();
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static void KillFontSmoothing()
-{
-	DisableFontSmoothing();
-}
-
-// adzm - 2010-07 - Disable more effects or font smoothing
-static void RestoreFontSmoothing()
-{
-	EnableFontSmoothing();
-}
-
-// Implementation
-
-vncMenu::vncMenu(vncServer *server)
-{
-	vnclog.Print(LL_INTERR, VNCLOG("vncmenu(server)\n"));
-	hWTSDll = NULL;
-	ports_set=false;
-    CoInitialize(0);
-	IsIconSet=false;
-	IconFaultCounter=0;
-
-	HMODULE hUser32 = LoadLibrary("user32.dll");
-	CHANGEWINDOWMESSAGEFILTER pfnFilter = NULL;
-	if (hUser32)
-	{
-	pfnFilter =(CHANGEWINDOWMESSAGEFILTER)GetProcAddress(hUser32,"ChangeWindowMessageFilter");
-	if (pfnFilter) pfnFilter(MENU_ADD_CLIENT_MSG, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(MENU_ADD_CLIENT_MSG_INIT, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(MENU_AUTO_RECONNECT_MSG, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(MENU_STOP_RECONNECT_MSG, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(MENU_STOP_ALL_RECONNECT_MSG, MSGFLT_ADD);
-	if (pfnFilter) pfnFilter(MENU_REPEATER_ID_MSG, MSGFLT_ADD);
-	// adzm 2009-07-05 - Tray icon balloon tips
-	if (pfnFilter) pfnFilter(MENU_TRAYICON_BALLOON_MSG, MSGFLT_ADD);
-    FreeLibrary (hUser32);
-	}
-	
-	// adzm 2009-07-05 - Tray icon balloon tips
-	m_BalloonInfo = NULL;
-	m_BalloonTitle = NULL;
-
-	// Save the server pointer
-	m_server = server;
-
-	// Set the initial user name to something sensible...
-	vncService::CurrentUser((char *)&m_username, sizeof(m_username));
-
-	//if (strcmp(m_username, "") == 0)
-	//	strcpy((char *)&m_username, "SYSTEM");
-	//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::vncMenu - UserName = %s\n"), m_username);
-
-	// Create a dummy window to handle tray icon messages
-	WNDCLASSEX wndclass;
-
-	wndclass.cbSize			= sizeof(wndclass);
-	wndclass.style			= 0;
-	wndclass.lpfnWndProc	= vncMenu::WndProc;
-	wndclass.cbClsExtra		= 0;
-	wndclass.cbWndExtra		= 0;
-	wndclass.hInstance		= hAppInstance;
-	wndclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
-	wndclass.hCursor		= LoadCursor(NULL, IDC_ARROW);
-	wndclass.hbrBackground	= (HBRUSH) GetStockObject(WHITE_BRUSH);
-	wndclass.lpszMenuName	= (const char *) NULL;
-	wndclass.lpszClassName	= MENU_CLASS_NAME;
-	wndclass.hIconSm		= LoadIcon(NULL, IDI_APPLICATION);
-
-	RegisterClassEx(&wndclass);
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	m_hwnd = NULL;
-#else
-	m_hwnd = CreateWindow(MENU_CLASS_NAME,
-				MENU_CLASS_NAME,
-				WS_OVERLAPPEDWINDOW,
-				CW_USEDEFAULT,
-				CW_USEDEFAULT,
-				200, 200,
-				NULL,
-				NULL,
-				hAppInstance,
-				NULL);
-	if (m_hwnd == NULL)
-	{
-		PostQuitMessage(0);
-		return;
-	}
-
-	if (!hWTSDll) hWTSDll = LoadLibrary( ("wtsapi32.dll") );
-	if (hWTSDll)
-	{
-		WTSREGISTERSESSIONNOTIFICATION FunctionWTSRegisterSessionNotification;    
-		FunctionWTSRegisterSessionNotification = (WTSREGISTERSESSIONNOTIFICATION)GetProcAddress((HINSTANCE)hWTSDll, "WTSRegisterSessionNotification" );
-		if (FunctionWTSRegisterSessionNotification)
-			FunctionWTSRegisterSessionNotification( m_hwnd, NOTIFY_FOR_THIS_SESSION );
-	}
-
-	// record which client created this window
-    helper::SafeSetWindowUserData(m_hwnd, (LONG_PTR) this);
-
-	// Ask the server object to notify us of stuff
-	server->AddNotify(m_hwnd);
-#endif
-
-	// Initialise the properties dialog object
-	if (!m_properties.Init(m_server))
-	{
-		PostQuitMessage(0);
-		return;
-	}
-	if (!m_propertiesPoll.Init(m_server))
-	{
-		PostQuitMessage(0);
-		return;
-	}
-	
-	/* Does not work when vncMenu is created from imp_thread
-	hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "Global\\SessionEvent");
-	ResetEvent(hEvent);
-	*/
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	SetTimer(m_hwnd, 1, 5000, NULL);
-#endif
-
-
-	// sf at 2002
-	if (!m_ListDlg.Init(m_server))
-	{
-		PostQuitMessage(0);
-		return;
-	}
-
-	// Load the icons for the tray
-//	m_winvnc_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC));
-//	m_flash_icon = LoadIcon(hAppInstance, MAKEINTRESOURCE(IDI_FLASH));
-	{
-	osvi.dwOSVersionInfoSize = sizeof(osvi);
-	GetVersionEx(&osvi);
-/*if (osvi.dwPlatformId==VER_PLATFORM_WIN32_NT)
-		{
-		  if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion>=1)
-		  {
-			m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
-			m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
-		  }
-		  else
-		 {
-			  m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-			m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-		  }
-		 }
-	else
-		 {
-			  m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-			m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-		  }
-	}*/
-
-	if (osvi.dwPlatformId==VER_PLATFORM_WIN32_NT)
-		{
-		  if(osvi.dwMajorVersion==5 && osvi.dwMinorVersion>=1)
-		  {
-			m_winvnc_icon=(HICON)LoadImage(NULL, "icon1.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_DEFAULTCOLOR);
-			m_flash_icon=(HICON)LoadImage(NULL, "icon2.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_DEFAULTCOLOR);
-			// [v1.0.2-jp1 fix]
-			//if (!m_winvnc_icon) m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-			if (!m_winvnc_icon) m_winvnc_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
-			// [v1.0.2-jp1 fix]
-			//if (!m_flash_icon) m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
- 			if (!m_flash_icon) m_flash_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                       GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
-			
-		  }
-		  else
-		 {
-			  m_winvnc_icon=(HICON)LoadImage(NULL, "icon1.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_VGACOLOR);
-				m_flash_icon=(HICON)LoadImage(NULL, "icon2.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_VGACOLOR);
-				
-			  // [v1.0.2-jp1 fix]
-			  //if (!m_winvnc_icon)m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
- 			  if (!m_winvnc_icon)m_winvnc_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                       GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-			 // [v1.0.2-jp1 fix]
-			 //if (!m_flash_icon)m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
- 			 if (!m_flash_icon)m_flash_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                       GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-			 
-		  }
-		 }
-	else
-		 {
-				m_winvnc_icon=(HICON)LoadImage(NULL, "icon1.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_VGACOLOR);
-				m_flash_icon=(HICON)LoadImage(NULL, "icon2.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_VGACOLOR);
-				
-				// [v1.0.2-jp1 fix]
-				//if (!m_winvnc_icon)m_winvnc_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-				if (!m_winvnc_icon)m_winvnc_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_WINVNC), IMAGE_ICON,
-                       GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-				// [v1.0.2-jp1 fix]
-				//if (!m_flash_icon)m_flash_icon=(HICON)LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-				if (!m_flash_icon)m_flash_icon=(HICON)LoadImage(hInstResDLL, MAKEINTRESOURCE(IDI_FLASH), IMAGE_ICON,
-                        GetSystemMetrics(SM_CXSMICON),
-                        GetSystemMetrics(SM_CYSMICON), LR_VGACOLOR);
-				
-		  }
-	}
-
-	// Load the popup menu
-	// [v1.0.2-jp1 fix]
-	//m_hmenu = LoadMenu(hAppInstance, MAKEINTRESOURCE(IDR_TRAYMENU));
-	m_hmenu = LoadMenu(hInstResDLL, MAKEINTRESOURCE(IDR_TRAYMENU));
-
-	// Install the tray icon!
-	AddTrayIcon();
-	CoUninitialize();
-}
-
-vncMenu::~vncMenu()
-{
-	vnclog.Print(LL_INTERR, VNCLOG("vncmenu killed\n"));
-
-	// adzm 2009-07-05 - Tray icon balloon tips
-	if (m_BalloonInfo) {		
-		free(m_BalloonInfo);
-		m_BalloonInfo = NULL;
-	}
-	if (m_BalloonTitle) {
-		free(m_BalloonTitle);
-		m_BalloonTitle = NULL;
-	}
-
-	if (hWTSDll)
-	{
-		WTSUNREGISTERSESSIONNOTIFICATION FunctionWTSUnRegisterSessionNotification;
-		FunctionWTSUnRegisterSessionNotification = (WTSUNREGISTERSESSIONNOTIFICATION)GetProcAddress((HINSTANCE)hWTSDll,"WTSUnRegisterSessionNotification" );
-		if (FunctionWTSUnRegisterSessionNotification)
-			FunctionWTSUnRegisterSessionNotification( m_hwnd );
-		FreeLibrary( hWTSDll );
-		hWTSDll = NULL;
-	}
-
-
-    if (m_winvnc_icon)
-        DestroyIcon(m_winvnc_icon);
-    if (m_flash_icon)
-        DestroyIcon(m_flash_icon);
-
-
-	// Remove the tray icon
-	DelTrayIcon();
-	
-	// Destroy the loaded menu
-	if (m_hmenu != NULL)
-		DestroyMenu(m_hmenu);
-
-	// Tell the server to stop notifying us!
-	if (m_server != NULL)
-		m_server->RemNotify(m_hwnd);
-
-	if (m_server->RemoveWallpaperEnabled())
-		RestoreWallpaper();
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	if (m_server->RemoveEffectsEnabled())
-		RestoreEffects();
-	if (m_server->RemoveFontSmoothingEnabled())
-		RestoreFontSmoothing();
-	if (m_server->RemoveAeroEnabled())
-		ResetAero();
-	CoUninitialize();
-}
-
-void
-vncMenu::AddTrayIcon()
-{
-	return;
-	//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon \n"));
-	vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - UserName = %s\n"), m_username);
-
-	// If the user name is non-null then we have a user!
-	if (strcmp(m_username, "") != 0 && strcmp(m_username, "SYSTEM") != 0)
-	{
-		//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists\n"));
-		// Make sure the server has not been configured to
-		// suppress the tray icon.
-		HWND tray = FindWindow(("Shell_TrayWnd"), 0);
-		if (!tray)
-		{
-			IsIconSet=false;
-			vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists, traywnd is not found reset when counter reach %i=3\n"),IconFaultCounter);
-			IconFaultCounter++;
-			m_server->TriggerUpdate();
-			return;
-		}
-		else
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - ADD Tray Icon call\n"));
-		}
-
-		if (osvi.dwPlatformId==VER_PLATFORM_WIN32_NT && osvi.dwMinorVersion==0 && osvi.dwMajorVersion==5)
-		{
-			if ( ! m_server->GetDisableTrayIcon())
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("########### Shell_TrayWnd found %i\n"),IsIconSet);
-					SendTrayMsg(NIM_ADD, FALSE);
-				}
-		}
-		else
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("########### Shell_TrayWnd found %i\n"),IsIconSet);
-			SendTrayMsg(NIM_ADD, FALSE);
-		}
-		if (m_server->AuthClientCount() != 0) { //PGM @ Advantig
-			// adzm - 2010-07 - Disable more effects or font smoothing
-			if (IsUserDesktop()) {				
-				if (m_server->RemoveWallpaperEnabled()) //PGM @ Advantig
-					KillWallpaper(); //PGM @ Advantig
-				if (m_server->RemoveEffectsEnabled())
-					KillEffects();
-				if (m_server->RemoveFontSmoothingEnabled())
-					KillFontSmoothing();
-			}
-			if (m_server->RemoveAeroEnabled()) //PGM @ Advantig
-				DisableAero(); //PGM @ Advantig
-		} //PGM @ Advantig
-	}
-}
-
-void
-vncMenu::DelTrayIcon()
-{
-	return;
-	//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::DelTrayIcon - DEL Tray Icon call\n"));
-	SendTrayMsg(NIM_DELETE, FALSE);
-}
-
-void
-vncMenu::FlashTrayIcon(BOOL flash)
-{
-	//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::FlashTrayIcon - FLASH Tray Icon call\n"));
-	SendTrayMsg(NIM_MODIFY, flash);
-}
-
-// Get the local ip addresses as a human-readable string.
-// If more than one, then with \n between them.
-// If not available, then gets a message to that effect.
-// The ip address is not likely to change while running
-// this function is an overhead, each time calculating the ip
-// the ip is just used in the tray tip
-char old_buffer[512];
-char old_buflen=0;
-int dns_counter=0; // elimate to many dns requests once every 250s is ok
-void 
-vncMenu::GetIPAddrString(char *buffer, int buflen) {
-	if (old_buflen!=0 && dns_counter<50)
-	{
-		dns_counter++;
-		strcpy(buffer,old_buffer);
-		return;
-	}
-	dns_counter=0;
-    char namebuf[256];
-
-    if (gethostname(namebuf, 256) != 0) {
-		strncpy(buffer, "Host name unavailable", buflen);
-		return;
-    };
-
-    HOSTENT *ph = gethostbyname(namebuf);
-    if (!ph) {
-		strncpy(buffer, "IP address unavailable", buflen);
-		return;
-    };
-
-    *buffer = '\0';
-    char digtxt[5];
-    for (int i = 0; ph->h_addr_list[i]; i++) {
-    	for (int j = 0; j < ph->h_length; j++) {
-			sprintf(digtxt, "%d.", (unsigned char) ph->h_addr_list[i][j]);
-			strncat(buffer, digtxt, (buflen-1)-strlen(buffer));
-		}	
-		buffer[strlen(buffer)-1] = '\0';
-		if (ph->h_addr_list[i+1] != 0)
-			strncat(buffer, ", ", (buflen-1)-strlen(buffer));
-    }
-	if (strlen(buffer)<512) // just in case it would be bigger then our buffer
-	{
-		if (old_buflen!=0)//first time old_buflen=0
-		{
-			if (strcmp(buffer,old_buffer)!=0) //ip changed
-			{
-				if (m_server->SockConnected())
-				{
-					// if connected restart
-					m_server->SockConnect(false);
-					m_server->SockConnect(true);
-				}
-			}
-		}
-	old_buflen=strlen(buffer);
-	strncpy(old_buffer,buffer,strlen(buffer));
-	}
-}
-
-void
-vncMenu::SendTrayMsg(DWORD msg, BOOL flash)
-{
-	// adzm 2009-07-05
-	omni_mutex_lock sync(m_mutexTrayIcon);
-
-	// Create the tray icon message
-	m_nid.hWnd = m_hwnd;
-	m_nid.cbSize = sizeof(m_nid);
-	m_nid.uID = IDI_WINVNC;			// never changes after construction	
-	m_nid.hIcon = flash ? m_flash_icon : m_winvnc_icon;
-	m_nid.uFlags = NIF_ICON | NIF_MESSAGE |NIF_STATE;
-	m_nid.uCallbackMessage = WM_TRAYNOTIFY;
-	if (m_server->GetDisableTrayIcon())
-	{
-	m_nid.dwState = NIS_HIDDEN;
-	m_nid.dwStateMask = NIS_HIDDEN;
-	}
-	else
-	{
-		m_nid.dwState = 0;
-		m_nid.dwStateMask = NIS_HIDDEN;
-
-	}
-
-	// adzm 2009-07-05 - Tray icon balloon tips
-
-	if (m_BalloonInfo && (strlen(m_BalloonInfo) > 0)) {
-		m_nid.uFlags |= NIF_INFO;
-		strncpy(m_nid.szInfo, m_BalloonInfo, 255);
-		m_nid.szInfo[255] = '\0';
-
-		if (m_BalloonTitle && (strlen(m_BalloonTitle) > 0)) {
-			strncpy(m_nid.szInfoTitle, m_BalloonTitle, 63);
-			m_nid.szInfoTitle[63] = '\0';
-		} else {
-			strcpy(m_nid.szInfoTitle, "Remote Connection");
-		}
-
-		m_nid.uTimeout=10000; // minimum
-		m_nid.dwInfoFlags=NIIF_INFO;
-	}
-	
-	if (m_BalloonInfo) {		
-		free(m_BalloonInfo);
-		m_BalloonInfo = NULL;
-	}
-	if (m_BalloonTitle) {
-		free(m_BalloonTitle);
-		m_BalloonTitle = NULL;
-	}
-
-	//vnclog.Print(LL_INTINFO, VNCLOG("SendTRaymesg\n"));
-
-	// Use resource string as tip if there is one
-	// [v1.0.2-jp1 fix]
-	//if (LoadString(hAppInstance, IDI_WINVNC, m_nid.szTip, sizeof(m_nid.szTip)))
-	if (LoadString(hInstResDLL, IDI_WINVNC, m_nid.szTip, sizeof(m_nid.szTip)))
-	{
-	    m_nid.uFlags |= NIF_TIP;
-	}
-	
-	// Try to add the server's IP addresses to the tip string, if possible
-	if (m_nid.uFlags & NIF_TIP)
-	{
-	    strncat(m_nid.szTip, " - ", (sizeof(m_nid.szTip)-1)-strlen(m_nid.szTip));
-
-	    if (m_server->SockConnected())
-	    {
-		unsigned long tiplen = strlen(m_nid.szTip);
-		char *tipptr = ((char *)&m_nid.szTip) + tiplen;
-
-		GetIPAddrString(tipptr, sizeof(m_nid.szTip) - tiplen);
-	    }
-	    else
-	    {
-		strncat(m_nid.szTip, "Not listening", (sizeof(m_nid.szTip)-1)-strlen(m_nid.szTip));
-	    }
-	}
-
-	char namebuf[256];
-
-    if (gethostname(namebuf, 256) == 0) {
-		strncat(m_nid.szTip, " - ", strlen(" - "));
-		strncat(m_nid.szTip, namebuf, strlen(namebuf));
-    }
-
-	if (vncService::RunningAsService())
-	{
-		strncat(m_nid.szTip, " - service", strlen(" - service"));
-	}
-	else
-	{
-		strncat(m_nid.szTip, " - application", strlen(" - application"));
-	}
-
-//	vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call\n"));
-	// Send the message
-	if ((msg == NIM_MODIFY) && (IsIconSet == FALSE)) return; //no icon to modify
-	if ((msg ==NIM_ADD) && (IsIconSet != FALSE)) return; //no icon to set
-	if (msg == NIM_DELETE)
-	{
-		IsIconSet=false;
-		IconFaultCounter=0;
-	}
-	if (Shell_NotifyIcon(msg, &m_nid))
-	{
-//			vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call SUCCESS\n"));
-			// Set the enabled/disabled state of the menu items
-			//		vnclog.Print(LL_INTINFO, VNCLOG("tray icon added ok\n"));
-			EnableMenuItem(m_hmenu, ID_ADMIN_PROPERTIES,
-			m_properties.AllowProperties() ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_PROPERTIES,
-			m_properties.AllowProperties() ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_CLOSE,
-			m_properties.AllowShutdown() ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_KILLCLIENTS,
-			m_properties.AllowEditClients() ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_OUTGOING_CONN,
-			m_properties.AllowEditClients() ? MF_ENABLED : MF_GRAYED);
-			if (vncService::RunningAsService() && !vncService::IsInstalled())
-			{
-				//service is already disabled, but this winvnc was still started from the service
-				vncService::RunningFromExternalService(false);
-			}
-			EnableMenuItem(m_hmenu, ID_CLOSE_SERVICE,(vncService::RunningAsService()&&m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_START_SERVICE,(vncService::IsInstalled() && !vncService::RunningAsService() && m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_RUNASSERVICE,(!vncService::IsInstalled() &&!vncService::RunningAsService() && m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_UNINSTALL_SERVICE,(vncService::IsInstalled()&&m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_REBOOTSAFEMODE,(vncService::RunningAsService()&&m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			EnableMenuItem(m_hmenu, ID_REBOOT_FORCE,(vncService::RunningAsService()&&m_properties.AllowShutdown()) ? MF_ENABLED : MF_GRAYED);
-			OSVERSIONINFO OSversion;	
-			OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
-			GetVersionEx(&OSversion);
-			/*if(OSversion.dwMajorVersion>=6 && m_properties.AllowShutdown() && vncService::RunningAsService())
-			{
-				if (OSversion.dwMinorVersion==0) //Vista
-				{
-					if (ISUACENabled() && !IsSoftwareCadEnabled())//ok
-					{
-						RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-						RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-					}
-					if (!ISUACENabled() && IsSoftwareCadEnabled())
-					{
-						RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-						RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-					}
-					if (!ISUACENabled() && !IsSoftwareCadEnabled())
-					{
-						RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-						GetSubMenu(m_hmenu,ID_SOFTWARECAD);
-					}
-					if (ISUACENabled() && IsSoftwareCadEnabled())
-					{
-						RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-						GetSubMenu(m_hmenu,ID_DELSOFTWARECAD);
-					}
-
-				}
-				else  //WIN7
-				{
-					EnableMenuItem(m_hmenu, ID_SOFTWARECAD,(vncService::RunningAsService()&&m_properties.AllowShutdown()&&!IsSoftwareCadEnabled()) ? MF_ENABLED : MF_GRAYED);
-					if (IsSoftwareCadEnabled()) RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-					RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-				}
-			}
-			else */
-			{
-				RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-			}
-
-
-			// adzm 2009-07-05
-			if (SPECIAL_SC_PROMPT) {
-				RemoveMenu(m_hmenu, ID_ADMIN_PROPERTIES, MF_BYCOMMAND);
-
-				RemoveMenu(m_hmenu, ID_CLOSE_SERVICE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_START_SERVICE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_RUNASSERVICE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_UNINSTALL_SERVICE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_REBOOTSAFEMODE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_REBOOT_FORCE, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_SOFTWARECAD, MF_BYCOMMAND);
-				RemoveMenu(m_hmenu, ID_DELSOFTWARECAD, MF_BYCOMMAND);
-			}
-
-			if (msg == NIM_ADD)
-			{
-				IsIconSet=true;
-				IconFaultCounter=0;
-				vnclog.Print(LL_INTINFO, VNCLOG("IsIconSet \n"));
-			}
-
-	} else {
-
-//		vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED ( %u ) \n"), 0);
-		if (!vncService::RunningAsService())
-		{
-//			//vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runasservice\n"));
-			if (msg == NIM_ADD)
-			{
-				// The tray icon couldn't be created, so use the Properties dialog
-				// as the main program window
-				if (!m_server->RunningFromExternalService()) // sf at 2007 - Do not display Properties pages when running in Application0 mode
-				{
-//					vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runfromexternalservice\n"));
-					//vnclog.Print(LL_INTINFO, VNCLOG("opening dialog box\n"));
-					m_properties.ShowAdmin(TRUE, TRUE);
-					PostQuitMessage(0);
-				}
-			}
-		}
-		else
-		{
-			if (msg == NIM_ADD)
-			{
-			IsIconSet=false;
-			IconFaultCounter++;
-			m_server->TriggerUpdate();
-			vnclog.Print(LL_INTINFO, VNCLOG("Failed IsIconSet \n"));
-			}
-		}
-	}
-}
-
-
-// sf at 2007
-void vncMenu::Shutdown(bool kill_client)
-{
-	vnclog.Print(LL_INTERR, VNCLOG("vncMenu::Shutdown: Close menu - Disconnect all - Shutdown server\n"));
-//	m_server->AutoRestartFlag(TRUE);
-//	m_server->KillAuthClients();
-//	m_server->KillSockConnect();
-//	m_server->ShutdownServer();
-	SendMessage(m_hwnd, WM_CLOSE, 0, 0);
-	if (kill_client) m_server->KillAuthClients();
-}
-
-extern BOOL G_HTTP;
-
-char newuser[UNLEN+1];
-// Process window messages
-LRESULT CALLBACK vncMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-	// This is a static method, so we don't know which instantiation we're 
-	// dealing with. We use Allen Hadden's (ahadden at taratec.com) suggestion 
-	// from a newsgroup to get the pseudo-this.
-     vncMenu *_this = helper::SafeGetWindowUserData<vncMenu>(hwnd);
-	//	Beep(100,10);
-	//	vnclog.Print(LL_INTINFO, VNCLOG("iMsg 0x%x \n"),iMsg);
-
-	 if (iMsg==WM_TASKBARCREATED)
-	 {
-		 if (_this->m_server->RunningFromExternalService())
-			{
-				Sleep(1000);
-				vnclog.Print(LL_INTINFO,
-				VNCLOG("WM_TASKBARCREATED \n"));
-				// User has changed!
-				strcpy(_this->m_username, newuser);
-				vnclog.Print(LL_INTINFO,
-				VNCLOG("############## Kill vncMenu thread\n"));
-				// Order impersonation thread killing
-				KillTimer(hwnd,1);
-				PostQuitMessage(0);
-			}
-	 }
-
-	switch (iMsg)
-	{
-
-	// Every five seconds, a timer message causes the icon to update
-	case WM_TIMER:
-		// sf at 2007 - Can't get the WTS_CONSOLE_CONNECT message work properly for now..
-		// So use a hack instead
-#ifdef ULTRAVNC_ITALC_SUPPORT
-		break;
-#endif
-        // jdp reread some ini settings
-        _this->m_properties.ReloadDynamicSettings();
-
-		// G_1111==true --> reconnect
-		if (G_1111==true)
-		{
-			if (_this->IsIconSet==true)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("Add client reconnect from timer\n"));
-				G_1111=false;
-				PostMessage(hwnd,MENU_ADD_CLIENT_MSG,1111,1111);
-			}
-		}
-
-
-		vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack\n"));
-
-		if (_this->m_server->RunningFromExternalService())
-			{
-				strcpy(newuser,"");
-				if (vncService::CurrentUser((char *) &newuser, sizeof(newuser)))
-				{
-					// Check whether the user name has changed!
-					if (_stricmp(newuser, _this->m_username) != 0 || _this->IconFaultCounter>2)
-					{
-						Sleep(1000);
-						vnclog.Print(LL_INTINFO,
-						VNCLOG("user name has changed\n"));
-						// User has changed!
-						strcpy(_this->m_username, newuser);
-						vnclog.Print(LL_INTINFO,
-						VNCLOG("############## Kill vncMenu thread\n"));
-						// Order impersonation thread killing
-						PostQuitMessage(0);
-						break;
-					}
-				}
-			}
-
-		// *** HACK for running servicified
-		if (vncService::RunningAsService())
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack call - Runningasservice\n"));
-				// Attempt to add the icon if it's not already there
-				_this->AddTrayIcon();
-				// Trigger a check of the current user
-				PostMessage(hwnd, WM_USERCHANGED, 0, 0);
-			}
-		// Update the icon
-		_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-		break;
-
-		// DEAL WITH NOTIFICATIONS FROM THE SERVER:
-	case WM_SRV_CLIENT_AUTHENTICATED:
-	case WM_SRV_CLIENT_DISCONNECT:
-		// Adjust the icon accordingly
-		_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-
-		if (_this->m_server->AuthClientCount() != 0) {
-			// adzm - 2010-07 - Disable more effects or font smoothing
-			if (IsUserDesktop()) {
-				if (_this->m_server->RemoveWallpaperEnabled())
-					KillWallpaper();
-				if (_this->m_server->RemoveEffectsEnabled())
-					KillEffects();
-				if (_this->m_server->RemoveFontSmoothingEnabled())
-					KillFontSmoothing();
-			}
-			if (_this->m_server->RemoveAeroEnabled()) // Moved, redundant if //PGM @ Advantig
-				DisableAero(); // Moved, redundant if //PGM @ Advantig
-		} else {
-			if (_this->m_server->RemoveAeroEnabled()) // Moved, redundant if //PGM @ Advantig
-				ResetAero(); // Moved, redundant if //PGM @ Advantig
-			if (_this->m_server->RemoveWallpaperEnabled()) { // Added { //PGM @ Advantig
-				Sleep(2000); // Added 2 second delay to help wallpaper restore //PGM @ Advantig
-				RestoreWallpaper();
-			} //PGM @ Advantig
-			// adzm - 2010-07 - Disable more effects or font smoothing
-			if (_this->m_server->RemoveEffectsEnabled()) {
-				RestoreEffects();
-			}
-			if (_this->m_server->RemoveFontSmoothingEnabled()) {
-				RestoreFontSmoothing();
-			}
-		}
-//PGM @ Advantig		if (_this->m_server->AuthClientCount() != 0) {
-//PGM @ Advantig			if (_this->m_server->RemoveAeroEnabled())
-//PGM @ Advantig				DisableAero();
-//PGM @ Advantig		} else {
-//PGM @ Advantig			if (_this->m_server->RemoveAeroEnabled())
-//PGM @ Advantig				ResetAero();
-//PGM @ Advantig		}
-		return 0;
-
-		// STANDARD MESSAGE HANDLING
-	case WM_CREATE:
-		WM_TASKBARCREATED = RegisterWindowMessage("TaskbarCreated");
-		return 0;
-
-	case WM_COMMAND:
-		// User has clicked an item on the tray menu
-		switch (LOWORD(wParam))
-		{
-		case ID_DEFAULT_PROPERTIES:
-			// Show the default properties dialog, unless it is already displayed
-			vnclog.Print(LL_INTINFO, VNCLOG("show default properties requested\n"));
-			_this->m_properties.ShowAdmin(TRUE, FALSE);
-			_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-			break;
-		
-		case ID_PROPERTIES:
-			// Show the properties dialog, unless it is already displayed
-			vnclog.Print(LL_INTINFO, VNCLOG("show user properties requested\n"));
-			_this->m_propertiesPoll.Show(TRUE, TRUE);
-			_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-			break;
-
-        case ID_ADMIN_PROPERTIES:
-			// Show the properties dialog, unless it is already displayed
-			vnclog.Print(LL_INTINFO, VNCLOG("show user properties requested\n"));
-			_this->m_properties.ShowAdmin(TRUE, TRUE);
-			_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-			break;
-		
-		case ID_OUTGOING_CONN:
-			// Connect out to a listening VNC viewer
-			{
-				vncConnDialog *newconn = new vncConnDialog(_this->m_server);
-				if (newconn)
-				{
-					newconn->DoDialog();
-					// delete newconn; // NO ! Already done in vncConnDialog.
-				}
-			}
-			break;
-
-		case ID_KILLCLIENTS:
-			// Disconnect all currently connected clients
-			vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_KILLCLIENTS \n"));
-			_this->m_server->KillAuthClients();
-			break;
-
-		// sf at 2002
-		case ID_LISTCLIENTS:
-			_this->m_ListDlg.Display();
-			break;
-
-		case ID_ABOUT:
-			// Show the About box
-			_this->m_about.Show(TRUE);
-			break;
-
-		case ID_VISITUSONLINE_HOMEPAGE:
-			{
-						HANDLE hProcess,hPToken;
-						DWORD id=GetExplorerLogonPid();
-						if (id!=0) 
-						{
-							hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-							if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-							char dir[MAX_PATH];
-							char exe_file_name[MAX_PATH];
-							GetModuleFileName(0, exe_file_name, MAX_PATH);
-							strcpy(dir, exe_file_name);
-							strcat(dir, " -openhomepage");
-				
-							{
-								STARTUPINFO          StartUPInfo;
-								PROCESS_INFORMATION  ProcessInfo;
-								ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-								ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-								StartUPInfo.wShowWindow = SW_SHOW;
-								StartUPInfo.lpDesktop = "Winsta0\\Default";
-								StartUPInfo.cb = sizeof(STARTUPINFO);
-						
-								CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-								GetLastError();
-                                if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-                                if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-								//if (error==1314)
-								//	{
-								//		Open_homepage();
-								//	}
-
-							}
-						}
-			}
-			break;
-
-		case ID_VISITUSONLINE_FORUM:
-			{
-						HANDLE hProcess,hPToken;
-						DWORD id=GetExplorerLogonPid();
-						if (id!=0) 
-						{
-							hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-							if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-							char dir[MAX_PATH];
-							char exe_file_name[MAX_PATH];
-							GetModuleFileName(0, exe_file_name, MAX_PATH);
-							strcpy(dir, exe_file_name);
-							strcat(dir, " -openforum");
-				
-							{
-								STARTUPINFO          StartUPInfo;
-								PROCESS_INFORMATION  ProcessInfo;
-								ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-								ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-								StartUPInfo.wShowWindow = SW_SHOW;
-								StartUPInfo.lpDesktop = "Winsta0\\Default";
-								StartUPInfo.cb = sizeof(STARTUPINFO);
-						
-								CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-								GetLastError();
-                                if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-                                if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-								//if (error==1314)
-								//	{
-								//		Open_forum();
-								//	}
-
-							}
-						}
-			}
-			break;
-
-		case ID_CLOSE:
-			// User selected Close from the tray menu
-			fShutdownOrdered=TRUE;
-			Sleep(1000);
-			vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-			_this->m_server->KillAuthClients();
-			PostMessage(hwnd, WM_CLOSE, 0, 0);
-			break;
-		case ID_SOFTWARECAD:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -softwarecadhelper");
-		
-					{
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD errorcode=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (errorcode==1314)
-					{
-						Enable_softwareCAD_elevated();
-					}
-
-					}
-				}
-			}
-			break;
-
-		case ID_DELSOFTWARECAD:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -delsoftwarecadhelper");
-		
-					{
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD errorcode=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (errorcode==1314)
-					{
-						delete_softwareCAD_elevated();
-					}
-
-					}
-				}
-			}
-			break;
-
-		case ID_REBOOTSAFEMODE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -rebootsafemodehelper");
-		
-					{
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD errorcode=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (errorcode==1314)
-					{
-						Reboot_in_safemode_elevated();
-					}
-
-					}
-				}
-			}
-			break;
-
-		case ID_REBOOT_FORCE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -rebootforcedehelper");
-		
-					{
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD errorcode=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (errorcode==1314)
-					{
-						 Reboot_with_force_reboot_elevated();
-					}
-
-					}
-				}
-			}
-			break;
-
-		case ID_UNINSTALL_SERVICE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -uninstallhelper");
-		
-					{
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD errorcode=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (errorcode==1314)
-					{
-						Set_uninstall_service_as_admin();
-					}
-
-					}
-					/*fShutdownOrdered=TRUE;
-					vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-					_this->m_server->KillAuthClients();					
-					PostMessage(hwnd, WM_CLOSE, 0, 0);*/
-				}
-			}
-			break;
-		case ID_RUNASSERVICE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -installhelper");
-		
-
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD error=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (error==1314)
-					{
-						Set_install_service_as_admin();
-					}
-				}
-			fShutdownOrdered=TRUE;
-			Sleep(1000);
-			vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-			_this->m_server->KillAuthClients();
-			PostMessage(hwnd, WM_CLOSE, 0, 0);
-			}
-			break;
-		case ID_CLOSE_SERVICE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken))
-					{
-						CloseHandle(hProcess);
-						break;
-					}
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -stopservicehelper");
-		
-
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD error=GetLastError();
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (hProcess) CloseHandle(hProcess);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (error==1314)
-					{
-						Set_stop_service_as_admin();
-					}
-				}
-			}
-			break;
-		case ID_START_SERVICE:
-			{
-			HANDLE hProcess,hPToken;
-			DWORD id=GetExplorerLogonPid();
-				if (id!=0) 
-				{
-					hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-					if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-											|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-											|TOKEN_READ|TOKEN_WRITE,&hPToken))
-					{
-						CloseHandle(hProcess);
-						break;
-					}
-
-					char dir[MAX_PATH];
-					char exe_file_name[MAX_PATH];
-					GetModuleFileName(0, exe_file_name, MAX_PATH);
-					strcpy(dir, exe_file_name);
-					strcat(dir, " -startservicehelper");
-		
-
-					STARTUPINFO          StartUPInfo;
-					PROCESS_INFORMATION  ProcessInfo;
-					HANDLE Token=NULL;
-					HANDLE process=NULL;
-					ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-					ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-					StartUPInfo.wShowWindow = SW_SHOW;
-					StartUPInfo.lpDesktop = "Winsta0\\Default";
-					StartUPInfo.cb = sizeof(STARTUPINFO);
-			
-					CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-					DWORD error=GetLastError();
-					if (hPToken) CloseHandle(hPToken);
-					if (process) CloseHandle(process);
-					if (Token) CloseHandle(Token);
-					if (hProcess) CloseHandle(hProcess);
-					if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-					if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-					if (error==1314)
-					{
-						Set_start_service_as_admin();
-					}
-					fShutdownOrdered=TRUE;
-					Sleep(1000);
-					vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-					_this->m_server->KillAuthClients();
-					PostMessage(hwnd, WM_CLOSE, 0, 0);
-				}
-			}
-			break;
-
-		}
-		return 0;
-
-	case WM_TRAYNOTIFY:
-		// User has clicked on the tray icon or the menu
-		{
-			// Get the submenu to use as a pop-up menu
-			HMENU submenu = GetSubMenu(_this->m_hmenu, 0);
-
-			// What event are we responding to, RMB click?
-			if (lParam==WM_RBUTTONUP)
-			{
-				if (submenu == NULL)
-				{ 
-					vnclog.Print(LL_INTERR, VNCLOG("no submenu available\n"));
-					return 0;
-				}
-
-				// Make the first menu item the default (bold font)
-				SetMenuDefaultItem(submenu, 0, TRUE);
-				
-				// Get the current cursor position, to display the menu at
-				POINT mouse;
-				GetCursorPos(&mouse);
-
-				// There's a "bug"
-				// (Microsoft calls it a feature) in Windows 95 that requires calling
-				// SetForegroundWindow. To find out more, search for Q135788 in MSDN.
-				//
-				SetForegroundWindow(_this->m_nid.hWnd);
-
-				// Display the menu at the desired position
-				TrackPopupMenu(submenu,
-						0, mouse.x, mouse.y, 0,
-						_this->m_nid.hWnd, NULL);
-
-                PostMessage(hwnd, WM_NULL, 0, 0);
-
-				return 0;
-			}
-			
-			// Or was there a LMB double click?
-			if (lParam==WM_LBUTTONDBLCLK)
-			{
-				// double click: execute first menu item
-				SendMessage(_this->m_nid.hWnd,
-							WM_COMMAND, 
-							GetMenuItemID(submenu, 0),
-							0);
-			}
-
-			return 0;
-		}
-		
-	case WM_CLOSE:
-		
-		// Only accept WM_CLOSE if the logged on user has AllowShutdown set
-		// Error this clock the service restart.
-		/*if (!_this->m_properties.AllowShutdown())
-		{
-			return 0;
-		}*/
-		// tnatsni Wallpaper fix
-		if (_this->m_server->RemoveWallpaperEnabled())
-			RestoreWallpaper();
-		// adzm - 2010-07 - Disable more effects or font smoothing
-		if (_this->m_server->RemoveEffectsEnabled())
-			RestoreEffects();
-		if (_this->m_server->RemoveFontSmoothingEnabled())
-			RestoreFontSmoothing();
-		if (_this->m_server->RemoveAeroEnabled())
-			ResetAero();
-
-		vnclog.Print(LL_INTERR, VNCLOG("vncMenu WM_CLOSE call - All cleanup done\n"));
-		Sleep(2000);
-		DestroyWindow(hwnd);
-		break;
-		
-	case WM_DESTROY:
-		// The user wants WinVNC to quit cleanly...
-		vnclog.Print(LL_INTINFO, VNCLOG("quitting from WM_DESTROY\n"));
-		PostQuitMessage(0);
-		return 0;
-		
-	case WM_QUERYENDSESSION:
-		{
-			//shutdown or reboot
-			if((lParam & ENDSESSION_LOGOFF) != ENDSESSION_LOGOFF)
-			{
-				fShutdownOrdered=TRUE;
-				Sleep(1000);
-				vnclog.Print(LL_INTERR, VNCLOG("SHUTDOWN OS detected\n"));
-				vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-				_this->m_server->OS_Shutdown=true;
-				_this->m_server->KillAuthClients();				
-				PostMessage(hwnd, WM_CLOSE, 0, 0);
-				break;
-			}
-
-
-			DWORD SessionID;
-			SessionID=GetCurrentSessionID();
-			vnclog.Print(LL_INTERR, VNCLOG("Session ID %i\n"),SessionID);
-			if (SessionID!=0)
-			{
-				fShutdownOrdered=TRUE;
-				Sleep(1000);
-				vnclog.Print(LL_INTERR, VNCLOG("WM_QUERYENDSESSION session!=0\n"));
-				vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n"));
-				_this->m_server->KillAuthClients();				
-				PostMessage(hwnd, WM_CLOSE, 0, 0);
-			}
-		}	
-		break;
-		
-	case WM_ENDSESSION:
-		vnclog.Print(LL_INTERR, VNCLOG("WM_ENDSESSION\n"));
-		break;
-
-	case WM_USERCHANGED:
-		// The current user may have changed.
-		{
-			strcpy(newuser,"");
-
-			if (vncService::CurrentUser((char *) &newuser, sizeof(newuser)))
-			{
-				vnclog.Print(LL_INTINFO,
-					VNCLOG("############### Usernames change: old=\"%s\", new=\"%s\"\n"),
-					_this->m_username, newuser);
-
-				// Check whether the user name has changed!
-				if (_stricmp(newuser, _this->m_username) != 0)
-				{
-					vnclog.Print(LL_INTINFO,
-						VNCLOG("user name has changed\n"));
-
-					// User has changed!
-					strcpy(_this->m_username, newuser);
-
-					// Redraw the tray icon and set it's state
-					_this->DelTrayIcon();
-					_this->AddTrayIcon();
-					_this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
-					// We should load in the prefs for the new user
-					if (_this->m_properties.m_fUseRegistry)
-					{
-						_this->m_properties.Load(TRUE);
-						_this->m_propertiesPoll.Load(TRUE);
-					}
-					else
-					{
-						_this->m_properties.LoadFromIniFile();
-						_this->m_propertiesPoll.LoadFromIniFile();
-					}
-				}
-			}
-		}
-		return 0;
-
-	// [v1.0.2-jp1 fix] Don't show IME toolbar on right click menu.
-	case WM_INITMENU:
-	case WM_INITMENUPOPUP:
-		SendMessage(ImmGetDefaultIMEWnd(hwnd), WM_IME_CONTROL, IMC_CLOSESTATUSWINDOW, 0);
-		return 0;
-
-	default:
-		// Deal with any of our custom message types		
-		// wa at 2005 -- added support for the AutoReconnectId
-		// removed the previous code that used 999,999
-		if ( iMsg == MENU_STOP_RECONNECT_MSG )
-		{
-			_this->m_server->AutoReconnect(false);
-		}
-		if ( iMsg == MENU_STOP_ALL_RECONNECT_MSG )
-		{
-			_this->m_server->StopReconnectAll();
-		}
-		if ( iMsg == MENU_AUTO_RECONNECT_MSG )
-		{
-			char szId[MAX_PATH] = {0};
-			UINT ret = 0;
-			if ( lParam != 0 )
-			{
-				ret = GlobalGetAtomName( (ATOM)lParam, szId, sizeof( szId ) );
-				GlobalDeleteAtom( (ATOM)lParam );
-			}
-			_this->m_server->AutoReconnect(true);
-			
-			if ( ret > 0 )
-				_this->m_server->AutoReconnectId(szId);
-			
-			return 0;
-		}
-		if ( iMsg == MENU_REPEATER_ID_MSG )
- 		{
-			char szId[MAX_PATH] = {0};
-			UINT ret = 0;
-			if ( lParam != 0 )
-			{
-				ret = GlobalGetAtomName( (ATOM)lParam, szId, sizeof( szId ) );
-				GlobalDeleteAtom( (ATOM)lParam );
-			}
-			_this->m_server->IdReconnect(true);
-			
-			if ( ret > 0 )
-				_this->m_server->AutoReconnectId(szId);
-			
-			return 0;
-		}
-
-
-		if (iMsg == MENU_ADD_CLIENT_MSG || iMsg == MENU_ADD_CLIENT_MSG_INIT)
-		{
-
-			if (iMsg == MENU_ADD_CLIENT_MSG_INIT) 
-				_this->m_server->AutoReconnectAdr("");
-
-			// Add Client message.  This message includes an IP address
-			// of a listening client, to which we should connect.
-
-			//adzm 2009-06-20 - Check for special add repeater client message
-			if (wParam == 0xFFFFFFFF && (ULONG) lParam == 0xFFFFFFFF) {
-				vncConnDialog *newconn = new vncConnDialog(_this->m_server);
-				if (newconn)
-				{
-					if (IDOK != newconn->DoDialog()) {
-						if (SPECIAL_SC_PROMPT && _this->m_server->AuthClientCount() == 0 && _this->m_server->UnauthClientCount() == 0) {
-							PostMessage(hwnd, WM_COMMAND, ID_CLOSE, 0);
-						}
-					}
-				}
-				return 0;
-			}
-
-			// If there is no IP address then show the connection dialog
-			if (!lParam) {
-				vncConnDialog *newconn = new vncConnDialog(_this->m_server);
-				if (newconn)
-				{
-					newconn->DoDialog();
-					// winvnc -connect fixed
-					//CHECH memeory leak
-					//			delete newconn;
-				}
-				return 0;
-			}
-
-			unsigned short nport = 0;
-			char *nameDup = 0;
-			char szAdrName[64];
-			char szId[MAX_PATH] = {0};
-			// sf at 2003 - Values are already converted
-
-			if (_this->m_server->m_retry_timeout!=0 && !fShutdownOrdered) Sleep(5000);
-
-
-			if ((_this->m_server->AutoReconnect()|| _this->m_server->IdReconnect() )&& strlen(_this->m_server->AutoReconnectAdr()) > 0)
-			{
-				struct in_addr address;
-				nport = _this->m_server->AutoReconnectPort();
-				VCard32 ipaddress = VSocket::Resolve(_this->m_server->AutoReconnectAdr());
-				unsigned long ipaddress_long=ipaddress;
-				address.S_un.S_addr = ipaddress_long;
-				char *name = inet_ntoa(address);
-				if (name == 0)
-					return 0;
-				nameDup = _strdup(name);
-				if (nameDup == 0)
-					return 0;
-				strcpy(szAdrName, nameDup);
-				// Free the duplicate name
-				if (nameDup != 0) free(nameDup);
-			}
-			else
-			{
-				// Get the IP address stringified
-				struct in_addr address;
-				address.S_un.S_addr = lParam;
-				char *name = inet_ntoa(address);
-				if (name == 0)
-					return 0;
-				nameDup = _strdup(name);
-				if (nameDup == 0)
-					return 0;
-				strcpy(szAdrName, nameDup);
-				// Free the duplicate name
-				if (nameDup != 0) free(nameDup);
-
-				// Get the port number
-				nport = (unsigned short)wParam;
-				if (nport == 0)
-					nport = INCOMING_PORT_OFFSET;
-				
-			}
-
-			// wa at 2005 -- added support for the AutoReconnectId
-			// (but it's not required)
-			bool bId = ( strlen(_this->m_server->AutoReconnectId() ) > 0);
-			if ( bId )
-				strcpy( szId, _this->m_server->AutoReconnectId() );
-			
-			// sf at 2003
-			// Stores the client adr/ports the first time we try to connect
-			// This way we can call this message again later to reconnect with the same values
-			if ((_this->m_server->AutoReconnect() || _this->m_server->IdReconnect())&& strlen(_this->m_server->AutoReconnectAdr()) == 0)
-			{
-				if (strlen(dnsname)>0) _this->m_server->AutoReconnectAdr(dnsname);
-				else 
-				_this->m_server->AutoReconnectAdr(szAdrName);
-				strcpy(dnsname,"");
-
-				_this->m_server->AutoReconnectPort(nport);
-			}
-
-			if (_this->m_server->AutoReconnect())
-			{
-				_this->m_server->AutoConnectRetry();
-			}
-			else
-			{
-				// Attempt to create a new socket
-				VSocket *tmpsock;
-				tmpsock = new VSocket;
-				if (tmpsock) {
-
-					// Connect out to the specified host on the VNCviewer listen port
-					if (G_HTTP)
-					{
-						if (tmpsock->Http_CreateConnect(szAdrName))
-						{
-							if ( bId )
-							{
-							// wa at 2005 -- added support for the AutoReconnectId
-							// Set the ID for this client -- code taken from vncconndialog.cpp (ln:142)
-							tmpsock->Send(szId,250);
-							tmpsock->SetTimeout(0);
-						
-							// adzm 2009-07-05 - repeater IDs
-							// Add the new client to this server
-							// adzm 2009-08-02
-							_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, szId, szAdrName, nport);
-							} else {
-							// Add the new client to this server
-							// adzm 2009-08-02
-							_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, szAdrName, nport);
-							}
-						}
-						else
-						{
-							tmpsock->Create();
-							if (tmpsock->Connect(szAdrName, nport)) {
-							if ( bId )
-								{
-									// wa at 2005 -- added support for the AutoReconnectId
-									// Set the ID for this client -- code taken from vncconndialog.cpp (ln:142)
-									tmpsock->Send(szId,250);
-									tmpsock->SetTimeout(0);
-						
-									// adzm 2009-07-05 - repeater IDs
-									// Add the new client to this server
-									// adzm 2009-08-02
-									_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, szId, szAdrName, nport);
-								} else {
-									// Add the new client to this server
-									// adzm 2009-08-02
-									_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, szAdrName, nport);
-								}
-							} else {
-								delete tmpsock;
-							}
-						}
-
-					}
-					else
-					{
-					tmpsock->Create();
-					if (tmpsock->Connect(szAdrName, nport)) {
-						if ( bId )
-						{
-							// wa at 2005 -- added support for the AutoReconnectId
-							// Set the ID for this client -- code taken from vncconndialog.cpp (ln:142)
-							tmpsock->Send(szId,250);
-							tmpsock->SetTimeout(0);
-						
-							// adzm 2009-07-05 - repeater IDs
-							// Add the new client to this server
-							// adzm 2009-08-02
-							_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, szId, szAdrName, nport);
-						} else {
-							// Add the new client to this server
-							// adzm 2009-08-02
-							_this->m_server->AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, szAdrName, nport);
-						}
-					} else {
-						delete tmpsock;
-					}
-					}
-				}
-			}
-		
-			return 0;
-		}
-
-		// Process FileTransfer asynchronous Send Packet Message
-		if (iMsg == FileTransferSendPacketMessage) 
-		{
-		  vncClient* pClient = (vncClient*) wParam;
-		  if (_this->m_server->IsClient(pClient)) pClient->SendFileChunk();
-		}
-
-		// adzm 2009-07-05 - Tray icon balloon tips
-		if (iMsg == MENU_TRAYICON_BALLOON_MSG) {
-			try {
-				omni_mutex_lock sync(_this->m_mutexTrayIcon);
-
-				// adzm 2009-07-05 - Tray icon balloon tips
-				if (_this->m_BalloonInfo) {		
-					free(_this->m_BalloonInfo);
-					_this->m_BalloonInfo = NULL;
-				}
-				if (_this->m_BalloonTitle) {
-					free(_this->m_BalloonTitle);
-					_this->m_BalloonTitle = NULL;
-				}
-
-				char* szInfo = (char*)wParam;
-				char* szTitle = (char*)lParam;
-				
-				if (szInfo && (strlen(szInfo) > 0) ) {
-					_this->m_BalloonInfo = _strdup(szInfo);
-				}
-				if (szTitle && (strlen(szTitle) > 0) ) {
-					_this->m_BalloonTitle = _strdup(szTitle);
-				}
-
-				if (szInfo) {
-					free(szInfo);
-				}
-				if (szTitle) {
-					free(szTitle);
-				}
-
-				if (_this->IsIconSet) {
-					_this->SendTrayMsg(NIM_MODIFY, _this->m_nid.hIcon == _this->m_winvnc_icon ? FALSE : TRUE);
-				}
-			} catch (...) {
-				// just in case
-				vnclog.Print(LL_INTWARN,
-					VNCLOG("Warning: exception handling balloon message\n"));
-			}
-		}
-	}
-
-	// Message not recognised
-	return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-// adzm 2009-07-05 - Tray icon balloon tips
-BOOL vncMenu::NotifyBalloon(char* szInfo, char* szTitle)
-{
-	char* szInfoCopy = _strdup(szInfo); // TOFIX memory leak;
-	char* szTitleCopy = _strdup(szTitle);
-
-	//adzm 2010-02-10 - Only posts to the same process
-	BOOL returnvalue= PostToThisWinVNC(MENU_TRAYICON_BALLOON_MSG, (WPARAM)szInfoCopy, (LPARAM)szTitleCopy);
-	if (returnvalue==FALSE)
-	{
-			if (szInfoCopy) {
-				free(szInfoCopy);
-			}
-			if (szTitleCopy) {
-				free(szTitleCopy);
-			}
-	}
-	return returnvalue;
-}
diff --git a/ica/win32/winvnc/winvnc/vncmenu.h b/ica/win32/winvnc/winvnc/vncmenu.h
deleted file mode 100644
index d99b7dd..0000000
--- a/ica/win32/winvnc/winvnc/vncmenu.h
+++ /dev/null
@@ -1,140 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncMenu
-
-// This class handles creation of a system-tray icon & menu
-
-class vncMenu;
-
-#if (!defined(_WINVNC_VNCMENU))
-#define _WINVNC_VNCMENU
-
-#include "stdhdrs.h"
-#include <lmcons.h>
-#include "vncserver.h"
-#include "vncproperties.h"
-#include "vncpropertiesPoll.h"
-#include "vncabout.h"
-#include "vncListDlg.h"
-
-// Constants
-extern const UINT MENU_ADD_CLIENT_MSG;
-extern const UINT MENU_ADD_CLIENT_MSG_INIT;
-extern const UINT MENU_AUTO_RECONNECT_MSG;
-extern const UINT MENU_STOP_RECONNECT_MSG;
-extern const UINT MENU_STOP_ALL_RECONNECT_MSG;
-extern const UINT MENU_REPEATER_ID_MSG;
-// adzm 2009-07-05 - Tray icon balloon tips
-extern const UINT MENU_TRAYICON_BALLOON_MSG;
-extern const char *MENU_CLASS_NAME;
-
-// WTS Stuff for FastUserSwitching management
-//typedef BOOL (WINAPI *WTSREGISTERSESSIONNOTIFICATION)(HWND, DWORD);
-//typedef BOOL (WINAPI *WTSUNREGISTERSESSIONNOTIFICATION)(HWND);
-#define WM_WTSSESSION_CHANGE            0x02B1
-#define WTS_CONSOLE_CONNECT                0x1
-#define WTS_CONSOLE_DISCONNECT             0x2
-#define WTS_REMOTE_CONNECT                 0x3
-#define WTS_REMOTE_DISCONNECT              0x4
-#define WTS_SESSION_LOGON                  0x5
-#define WTS_SESSION_LOGOFF                 0x6
-#define WTS_SESSION_LOCK                   0x7
-#define WTS_SESSION_UNLOCK                 0x8
-#define WTS_SESSION_REMOTE_CONTROL         0x9
-#define NOTIFY_FOR_THIS_SESSION     0
-
-extern const UINT FileTransferSendPacketMessage;
-
-// The tray menu class itself
-class vncMenu
-{
-public:
-	vncMenu(vncServer *server);
-	~vncMenu();
-
-	void Shutdown(bool kill_client); // sf at 2007
-
-	// adzm 2009-07-05 - Tray icon balloon tips
-	static BOOL NotifyBalloon(char* szInfo, char* szTitle);
-
-protected:
-	// Tray icon handling
-	void AddTrayIcon();
-	void DelTrayIcon();
-	void FlashTrayIcon(BOOL flash);
-	void SendTrayMsg(DWORD msg, BOOL flash);
-	void GetIPAddrString(char *buffer, int buflen);
-
-	// Message handler for the tray window
-	static LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
-
-	// Fields
-protected:
-	// Check that the password has been set
-	void CheckPassword();
-
-	// The server that this tray icon handles
-	vncServer		*m_server;
-
-	// Properties object for this server
-	vncProperties	m_properties;
-	vncPropertiesPoll	m_propertiesPoll;
-
-	// About dialog for this server
-	vncAbout		m_about;
-
-	// List of viewers
-	vncListDlg		m_ListDlg;
-
-	HWND			m_hwnd;
-	HMENU			m_hmenu;
-
-	NOTIFYICONDATA	m_nid;
-	omni_mutex		m_mutexTrayIcon; // adzm 2009-07-05
-	char*			m_BalloonInfo;
-	char*			m_BalloonTitle;
-
-	char			m_username[UNLEN+1];
-
-	// The icon handles
-	HICON			m_winvnc_icon;
-	HICON			m_flash_icon;
-
-	HINSTANCE   hWTSDll;
-	BOOL bConnectSock;
-	BOOL bAutoPort;
-	UINT port_rfb;
-	UINT port_http;
-	BOOL ports_set;
-
-	bool IsIconSet;
-	int IconFaultCounter;
-	//HANDLE hEvent;
-	OSVERSIONINFO	osvi;
-
-};
-
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncntlm.cpp b/ica/win32/winvnc/winvnc/vncntlm.cpp
deleted file mode 100644
index 3cd8067..0000000
--- a/ica/win32/winvnc/winvnc/vncntlm.cpp
+++ /dev/null
@@ -1,1127 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdhdrs.h"
-#include "omnithread.h"
-#include <objbase.h>
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-// Marscha at 2004 - authSSP: from stdhdrs.h, required for logging
-#include "vnclog.h"
-extern VNCLog vnclog;
-#include "inifile.h"
-
-// Marscha at 2004 - authSSP: end of change
-
-#include "Localization.h" // Act : add localization on messages
-
-typedef BOOL (*CheckUserGroupPasswordFn)( char * userin,char *password,char *machine,char *group,int locdom);
-CheckUserGroupPasswordFn CheckUserGroupPassword = 0;
-
-int CheckUserGroupPasswordUni(char * userin,char *password,const char *machine);
-int CheckUserGroupPasswordUni2(char * userin,char *password,const char *machine);
-
-// Marscha at 2004 - authSSP: if "New MS-Logon" is checked, call CheckUserPasswordSDUni
-BOOL IsNewMSLogon();
-//char *AddToModuleDir(char *filename, int length);
-typedef int (*CheckUserPasswordSDUniFn)(const char * userin, const char *password, const char *machine);
-CheckUserPasswordSDUniFn CheckUserPasswordSDUni = 0;
-
-#define MAXSTRING 254
-
-const TCHAR REGISTRY_KEY [] = "Software\\UltraVnc";
-
-HKEY hkLocal=NULL;
-HKEY hkDefault=NULL;
-HKEY hkUser=NULL;
-
-void
-OpenRegistry()
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		DWORD dw;
-		if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-			REGISTRY_KEY,
-			0,REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_READ,
-			NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-			return;
-		if (RegCreateKeyEx(hkLocal,
-			"mslogon",
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ,
-			NULL, &hkDefault, &dw) != ERROR_SUCCESS)
-			return;
-	}
-}
-
-void
-CloseRegistry()
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		if (hkDefault != NULL) RegCloseKey(hkDefault);
-		if (hkUser != NULL) RegCloseKey(hkUser);
-		if (hkLocal != NULL) RegCloseKey(hkLocal);
-	}
-}
-
-LONG
-LoadInt(HKEY key, LPCSTR valname, LONG defval)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		LONG pref;
-		ULONG type = REG_DWORD;
-		ULONG prefsize = sizeof(pref);
-
-		if (RegQueryValueEx(key,
-			valname,
-			NULL,
-			&type,
-			(LPBYTE) &pref,
-			&prefsize) != ERROR_SUCCESS)
-			return defval;
-
-		if (type != REG_DWORD)
-			return defval;
-
-		if (prefsize != sizeof(pref))
-			return defval;
-
-		return pref;
-	}
-	else
-	{
-		return myIniFile.ReadInt("admin_auth", (char *)valname, defval);
-	}
-}
-
-TCHAR *
-LoadString(HKEY key, LPCSTR keyname)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		DWORD type = REG_SZ;
-		DWORD buflen = 256*sizeof(TCHAR);
-		TCHAR *buffer = 0;
-
-		// Get the length of the string
-		if (RegQueryValueEx(key,
-			keyname,
-			NULL,
-			&type,
-			NULL,
-			&buflen) != ERROR_SUCCESS)
-			return 0;
-
-		if (type != REG_BINARY)
-			return 0;
-		buflen = 256*sizeof(TCHAR);
-		buffer = new TCHAR[buflen];
-		if (buffer == 0)
-			return 0;
-
-		// Get the string data
-		if (RegQueryValueEx(key,
-			keyname,
-			NULL,
-			&type,
-			(BYTE*)buffer,
-			&buflen) != ERROR_SUCCESS) {
-			delete [] buffer;
-			return 0;
-		}
-
-		// Verify the type
-		if (type != REG_BINARY) {
-			delete [] buffer;
-			return 0;
-		}
-
-		return (TCHAR *)buffer;
-	}
-	else
-	{
-		TCHAR *authhosts=new char[150];
-		myIniFile.ReadString("admin_auth", (char *)keyname,authhosts,150);
-		return (TCHAR *)authhosts;
-	}
-}
-
-void
-SaveInt(HKEY key, LPCSTR valname, LONG val)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		RegSetValueEx(key, valname, 0, REG_DWORD, (LPBYTE) &val, sizeof(val));
-	}
-	else
-	{
-		myIniFile.WriteInt("admin_auth", (char *)valname, val);
-	}
-}
-
-void
-SaveString(HKEY key,LPCSTR valname, TCHAR *buffer)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		RegSetValueEx(key, valname, 0, REG_BINARY, (LPBYTE) buffer, MAXSTRING);
-	}
-	else
-	{
-		myIniFile.WriteString("admin_auth", (char *)valname,buffer);
-	}
-}
-
-void
-savegroup1(TCHAR *value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group1", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group1", value);
-	}
-}
-TCHAR*
-Readgroup1()
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group1");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group1");
-		return value;
-	}
-}
-
-void
-savegroup2(TCHAR *value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group2", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group2", value);
-	}
-}
-TCHAR*
-Readgroup2()
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group2");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group2");
-		return value;
-	}
-}
-
-void
-savegroup3(TCHAR *value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group3", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group3", value);
-	}
-}
-TCHAR*
-Readgroup3()
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group3");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group3");
-		return value;
-	}
-}
-
-LONG
-Readlocdom1(LONG returnvalue)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom1",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom1",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-savelocdom1(LONG value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom1", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom1", value);
-	}
-
-}
-
-LONG
-Readlocdom2(LONG returnvalue)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom2",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom2",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-savelocdom2(LONG value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom2", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom2", value);
-	}
-
-}
-
-LONG
-Readlocdom3(LONG returnvalue)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom3",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom3",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-savelocdom3(LONG value)
-{
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	if (fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom3", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom3", value);
-	}
-
-}
-
-///////////////////////////////////////////////////////////
-bool CheckAD()
-{
-	HMODULE hModule = LoadLibrary("Activeds.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-bool CheckNetapi95()
-{
-	HMODULE hModule = LoadLibrary("netapi32.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-bool CheckDsGetDcNameW()
-{
-	HMODULE hModule = LoadLibrary("netapi32.dll");
-	if (hModule)
-	{
-		FARPROC test=NULL;
-		test=GetProcAddress( hModule, "DsGetDcNameW" );
-		FreeLibrary(hModule);
-		if (test) return true;
-	}
-	return false;
-}
-
-bool CheckNetApiNT()
-{
-	HMODULE hModule = LoadLibrary("radmin32.dll");
-	if (hModule)
-	{
-		FreeLibrary(hModule);
-		return true;
-	}
-	return false;
-}
-
-int CheckUserGroupPasswordUni(char * userin,char *password,const char *machine)
-{
-	int result = 0;
-	// Marscha at 2004 - authSSP: if "New MS-Logon" is checked, call CUPSD in authSSP.dll,
-	// else call "old" mslogon method.
-	if (IsNewMSLogon()){
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH)) {
-			char* p = strrchr(szCurrentDir, '\\');
-			*p = '\0';
-			strcat (szCurrentDir,"\\authSSP.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule) {
-
-			static omni_mutex authSSPMutex;
-			omni_mutex_lock l( authSSPMutex );
-
-			CheckUserPasswordSDUni = (CheckUserPasswordSDUniFn) GetProcAddress(hModule, "CUPSD");
-			vnclog.Print(LL_INTINFO, VNCLOG("GetProcAddress"));
-			/*HRESULT hr =*/ CoInitialize(NULL);
-			result = CheckUserPasswordSDUni(userin, password, machine);
-			vnclog.Print(LL_INTINFO, "CheckUserPasswordSDUni result=%i", result);
-			CoUninitialize();
-			FreeLibrary(hModule);
-			//result = CheckUserPasswordSDUni(userin, password, machine);
-		} else {
-			LPCTSTR sz_ID_AUTHSSP_NOT_FO = // to be moved to localization.h
-				"You selected ms-logon, but authSSP.dll\nwas not found.Check you installation";
-			MessageBoxSecure(NULL, sz_ID_AUTHSSP_NOT_FO, sz_ID_WARNING, MB_OK);
-		}
-	} else 
-		result = CheckUserGroupPasswordUni2(userin, password, machine);
-	return result;
-}
-
-int CheckUserGroupPasswordUni2(char * userin,char *password,const char *machine)
-{
-	int result=0;
-	BOOL NT4OS=false;
-	BOOL W2KOS=false;
-	char clientname[256];
-	strcpy_s(clientname,256,machine);
-	if (!CheckNetapi95() && !CheckNetApiNT())
-	{
-		return false;
-	}
-	OSVERSIONINFO VerInfo;
-	VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
-		{
-		  return FALSE;
-		}
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && VerInfo.dwMajorVersion == 4)
-		{
-			NT4OS=true;
-		}
-	if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && VerInfo.dwMajorVersion >= 5)
-		{
-			W2KOS=true;
-		}
-	//////////////////////////////////////////////////
-	// Load reg settings
-	//////////////////////////////////////////////////
-	char pszgroup1[256];
-	char pszgroup2[256];
-	char pszgroup3[256];
-	char *group1=NULL;
-	char *group2=NULL;
-	char *group3=NULL;
-	long locdom1=1;
-	long locdom2=0;
-	long locdom3=0;
-	group1=Readgroup1();
-	group2=Readgroup2();
-	group3=Readgroup3();
-	locdom1=Readlocdom1(locdom1);
-	locdom2=Readlocdom2(locdom2);
-	locdom3=Readlocdom3(locdom3);
-	strcpy(pszgroup1,"VNCACCESS");
-	strcpy(pszgroup2,"Administrators");
-	strcpy(pszgroup3,"VNCVIEWONLY");
-	if (group1){strcpy(pszgroup1,group1);}
-	if (group2){strcpy(pszgroup2,group2);}
-	if (group3){strcpy(pszgroup3,group3);}
-
-	savegroup1(pszgroup1);
-	savegroup2(pszgroup2);
-	savegroup3(pszgroup3);
-	savelocdom1(locdom1);
-	savelocdom2(locdom2);
-	savelocdom3(locdom3);
-
-	if (group1){strcpy(pszgroup1,group1);delete group1;}
-	if (group2){strcpy(pszgroup2,group2);delete group2;}
-	if (group3){strcpy(pszgroup3,group3);delete group3;}
-
-	//////////////////////////////////////////////////
-	// logon user only works on NT>
-	// NT4/w2k only as service (system account)
-	// XP> works also as application
-	// Group is not used...admin access rights is needed
-	// MS keep changes there security model for each version....
-	//////////////////////////////////////////////////
-////////////////////////////////////////////////////
-if (strcmp(pszgroup1,"")==0 && strcmp(pszgroup2,"")==0 && strcmp(pszgroup3,"")==0)
-	if ( NT4OS || W2KOS){
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\authadmin.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup1,locdom1);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "authadmin.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-
-if (strcmp(pszgroup1,"")!=0)
-{
-	
-	///////////////////////////////////////////////////
-	// NT4 domain and workgroups
-	//
-	///////////////////////////////////////////////////
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\workgrpdomnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup1,locdom1);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else
-			{
-				MessageBoxSecure(NULL, "workgrpdomnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-	/////////////////////////////////////////////////////////////////
-	if (CheckAD() && W2KOS && (locdom1==2||locdom1==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup1,locdom1);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-	//////////////////////////////////////////////////////////////////////
-	if (CheckAD() && NT4OS && CheckDsGetDcNameW() && (locdom1==2||locdom1==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauthnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup1,locdom1);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauthnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-	//////////////////////////////////////////////////////////////////////
-	if (CheckAD() && !NT4OS && !W2KOS && (locdom1==2||locdom1==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth9x.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup1,locdom1);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth9x.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-}
-/////////////////////////////////////////////////
-if (strcmp(pszgroup2,"")!=0)
-{
-	///////////////////////////////////////////////////
-	// NT4 domain and workgroups
-	//
-	///////////////////////////////////////////////////
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\workgrpdomnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup2,locdom2);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "workgrpdomnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-	//////////////////////////////////////////////////////
-	if ( NT4OS || W2KOS){
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\authadmin.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup2,locdom2);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "authadmin.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-	//////////////////////////////////////////////////////////////////
-	if (CheckAD() && W2KOS && (locdom2==2||locdom2==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup2,locdom2);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-	///////////////////////////////////////////////////////////////////////
-	if (CheckAD() && NT4OS && CheckDsGetDcNameW() && (locdom2==2||locdom2==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauthnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup2,locdom2);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauthnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-	///////////////////////////////////////////////////////////////////////
-	if (CheckAD() && !NT4OS && !W2KOS && (locdom2==2||locdom2==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth9x.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup2,locdom2);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth9x.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-}
-////////////////////////////
-if (strcmp(pszgroup3,"")!=0)
-{
-	///////////////////////////////////////////////////
-	// NT4 domain and workgroups
-	//
-	///////////////////////////////////////////////////
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\workgrpdomnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup3,locdom3);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "workgrpdomnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-	////////////////////////////////////////////////////////
-	if ( NT4OS || W2KOS){
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\authadmin.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup3,locdom3);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "authadmin.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-
-	}
-	if (result==1) goto accessOK;
-	////////////////////////////////////////////////////////////////
-	if (CheckAD() && W2KOS && (locdom3==2||locdom3==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup3,locdom3);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-	}
-	if (result==1) goto accessOK;
-	///////////////////////////////////////////////////////////////////
-	if (CheckAD() && NT4OS && CheckDsGetDcNameW() && (locdom3==2||locdom3==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauthnt4.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup3,locdom3);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauthnt4.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-		}
-		if (result==1) goto accessOK2;
-		///////////////////////////////////////////////////////////////////
-	if (CheckAD() && !NT4OS && !W2KOS && (locdom3==2||locdom3==3))
-	{
-		char szCurrentDir[MAX_PATH];
-		if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-		{
-			char* p = strrchr(szCurrentDir, '\\');
-			if (p == NULL) return false;
-			*p = '\0';
-			strcat (szCurrentDir,"\\ldapauth9x.dll");
-		}
-		HMODULE hModule = LoadLibrary(szCurrentDir);
-		if (hModule)
-			{
-				CheckUserGroupPassword = (CheckUserGroupPasswordFn) GetProcAddress( hModule, "CUGP" );
-				/*HRESULT hr =*/ CoInitialize(NULL);
-				result=CheckUserGroupPassword(userin,password,clientname,pszgroup3,locdom3);
-				CoUninitialize();
-				FreeLibrary(hModule);
-			}
-		else 
-			{
-				MessageBoxSecure(NULL, "ldapauth9x.dll not found", sz_ID_WARNING, MB_OK);
-				result=0;
-			}
-		}
-		if (result==1) goto accessOK2;
-	}
-
-	/////////////////////////////////////////////////
-	// If we reach this place auth failed
-	/////////////////////////////////////////////////
-	{
-				typedef BOOL (*LogeventFn)(char *machine,char *user);
-				LogeventFn Logevent = 0;
-				char szCurrentDir[MAX_PATH];
-				if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-					{
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-						strcat (szCurrentDir,"\\logging.dll");
-					}
-				HMODULE hModule = LoadLibrary(szCurrentDir);
-				if (hModule)
-					{
-						Logevent = (LogeventFn) GetProcAddress( hModule, "LOGFAILEDUSER" );
-						Logevent((char *)clientname,userin);
-						FreeLibrary(hModule);
-					}
-				return result;
-	}
-
-	accessOK://full access
-	{
-				typedef BOOL (*LogeventFn)(char *machine,char *user);
-				LogeventFn Logevent = 0;
-				char szCurrentDir[MAX_PATH];
-				if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-					{
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-						strcat (szCurrentDir,"\\logging.dll");
-					}
-				HMODULE hModule = LoadLibrary(szCurrentDir);
-				if (hModule)
-					{
-						Logevent = (LogeventFn) GetProcAddress( hModule, "LOGLOGONUSER" );
-						Logevent((char *)clientname,userin);
-						FreeLibrary(hModule);
-					}
-				return result;
-	}
-
-	accessOK2://readonly
-	{
-				typedef BOOL (*LogeventFn)(char *machine,char *user);
-				LogeventFn Logevent = 0;
-				char szCurrentDir[MAX_PATH];
-				if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-					{
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-						strcat (szCurrentDir,"\\logging.dll");
-					}
-				HMODULE hModule = LoadLibrary(szCurrentDir);
-				if (hModule)
-					{
-						Logevent = (LogeventFn) GetProcAddress( hModule, "LOGLOGONUSER" );
-						Logevent((char *)clientname,userin);
-						FreeLibrary(hModule);
-					}
-				result=2;
-	}
-
-	return result;
-}
-
-// Marscha at 2004 - authSSP: Is New MS-Logon activated?
-BOOL IsNewMSLogon(){
-	return TRUE;
-	HKEY hKLocal=NULL;
-	BOOL isNewMSLogon = FALSE;
-	LONG data;
-	ULONG type = REG_DWORD;
-	ULONG datasize = sizeof(data);
-	IniFile myIniFile;
-	BOOL fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-		
-	if (fUseRegistry)
-	{
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-				"Software\\ORL\\WinVNC3",
-				0,
-				KEY_QUERY_VALUE,
-				&hKLocal) != ERROR_SUCCESS)
-				return false;
-			
-		if (RegQueryValueEx(hKLocal,
-				"NewMSLogon",
-				NULL,
-				&type,
-				(LPBYTE) &data,
-				&datasize) != ERROR_SUCCESS)
-				return false;
-			
-		if (type != REG_DWORD ||
-				datasize != sizeof(data))
-				return false;
-			
-		isNewMSLogon = data;
-		if (hKLocal != NULL) RegCloseKey(hKLocal);
-		return isNewMSLogon;
-	}
-	else
-	{
-		BOOL newmslogon=false;
-		newmslogon=myIniFile.ReadInt("admin", "NewMSLogon", newmslogon);
-		return newmslogon;
-	}
-
-}
diff --git a/ica/win32/winvnc/winvnc/vncpasswd.h b/ica/win32/winvnc/winvnc/vncpasswd.h
deleted file mode 100644
index 38e69a8..0000000
--- a/ica/win32/winvnc/winvnc/vncpasswd.h
+++ /dev/null
@@ -1,106 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncPasswd
-
-// This header provides helpers for handling encrypted password data.
-// The password handling routines found in vncauth.h should not be used directly
-
-class vncPasswd;
-
-#if (!defined(_WINVNC_VNCPASSWD))
-#define _WINVNC_VNCPASSWD
-
-#include "stdhdrs.h"
-#ifdef _MSC_VER
-extern "C" {
-#include "vncauth.h"
-}
-#else
-#include "vncauth.h"
-#endif
-
-// Password handling helper class
-class vncPasswd
-{
-public:
-
-    // Password decryptor!
-    class ToText
-    {
-    public:
-	inline ToText(const char encrypted[MAXPWLEN])
-	{
-	    vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : ToText called\n"));
-	    plaintext = vncDecryptPasswd((char *)encrypted);
-	}
-	inline ~ToText()
-	{
-	    if (plaintext != NULL)
-	    {
-		ZeroMemory(plaintext, strlen(plaintext));
-		free(plaintext);
-	    }
-	}
-	inline operator const char*() const {return plaintext;};
-    private:
-	char *plaintext;
-    };
-
-    class FromText
-    {
-    public:
-	inline FromText(char *unencrypted)
-	{
-	    vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromText called\n"));
-	    vncEncryptPasswd(unencrypted, encrypted);
-	    // ZeroMemory(unencrypted, strlen(unencrypted));
-	}
-	inline ~FromText()
-	{
-	}
-	inline operator const char*() const {return encrypted;};
-    private:
-	char encrypted[MAXPWLEN];
-    };
-
-    class FromClear
-    {
-    public:
-	inline FromClear()
-	{
-	    vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromClear called\n"));
-	    vncEncryptPasswd((char*)"", encrypted);
-	}
-	inline ~FromClear()
-	{
-	}
-	inline operator const char*() const {return encrypted;};
-    private:
-	char encrypted[MAXPWLEN];
-    };
-};
-
-#endif
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncproperties.cpp b/ica/win32/winvnc/winvnc/vncproperties.cpp
deleted file mode 100644
index 67d87c8..0000000
--- a/ica/win32/winvnc/winvnc/vncproperties.cpp
+++ /dev/null
@@ -1,2612 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 TightVNC. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncProperties.cpp
-
-// Implementation of the Properties dialog!
-
-#include "stdhdrs.h"
-#include "lmcons.h"
-#include "vncservice.h"
-
-#include "winvnc.h"
-#include "vncproperties.h"
-#include "vncserver.h"
-#include "vncpasswd.h"
-#include "vncOSVersion.h"
-#include "common/win32_helpers.h"
-
-#include "Localization.h" // ACT : Add localization on messages
-
-//extern HINSTANCE g_hInst;
-
-bool RunningAsAdministrator ();
-const char WINVNC_REGISTRY_KEY [] = "Software\\ORL\\WinVNC3";
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-// Marscha at 2004 - authSSP: Function pointer for dyn. linking
-typedef void (*vncEditSecurityFn) (HWND hwnd, HINSTANCE hInstance);
-vncEditSecurityFn vncEditSecurity = 0;
-DWORD GetExplorerLogonPid();
-// ethernet packet 1500 - 40 tcp/ip header - 8 PPPoE info
-//unsigned int G_SENDBUFFER=8192;
-unsigned int G_SENDBUFFER=1452;
-
-// Constructor & Destructor
-vncProperties::vncProperties()
-{
-    m_alloweditclients = TRUE;
-	m_allowproperties = TRUE;
-	m_allowshutdown = TRUE;
-	m_dlgvisible = FALSE;
-	m_usersettings = TRUE;
-	Lock_service_helper=TRUE;
-	m_fUseRegistry = FALSE;
-    m_ftTimeout = FT_RECV_TIMEOUT;
-    m_keepAliveInterval = KEEPALIVE_INTERVAL;
-	m_socketKeepAliveTimeout = SOCKET_KEEPALIVE_TIMEOUT; // adzm 2010-08
-	m_pref_Primary=true;
-	m_pref_Secondary=false;
-
-	m_pref_DSMPluginConfig[0] = '\0';
-}
-
-vncProperties::~vncProperties()
-{
-}
-
-
-BOOL CALLBACK
-DialogProc1(HWND hwnd,
-					 UINT uMsg,
-					 WPARAM wParam,
-					 LPARAM lParam )
-{
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{
-
-			// Show the dialog
-			SetForegroundWindow(hwnd);
-
-			return TRUE;
-		}
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-
-		case IDCANCEL:
-		case IDOK:
-			EndDialog(hwnd, TRUE);
-			return TRUE;
-		}
-
-		break;
-
-	case WM_DESTROY:
-		EndDialog(hwnd, FALSE);
-		return TRUE;
-	}
-	return 0;
-}
-
-// Initialisation
-BOOL
-vncProperties::Init(vncServer *server)
-{
-	// Save the server pointer
-	m_server = server;
-
-	// sf at 2007 - Registry mode can still be forced for backward compatibility and OS version < Vista
-	m_fUseRegistry = TRUE;//((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-
-	// Load the settings
-	if (m_fUseRegistry)
-		Load(TRUE);
-	else
-		LoadFromIniFile();
-
-	// If the password is empty then always show a dialog
-	char passwd[MAXPWLEN];
-	m_server->GetPassword(passwd);
-	if(0){
-	    vncPasswd::ToText plain(passwd);
-	    if (strlen(plain) == 0)
-		{
-			 if (!m_allowproperties || !RunningAsAdministrator ()) {
-				if(m_server->AuthRequired()) {
-					MessageBoxSecure(NULL, sz_ID_NO_PASSWD_NO_OVERRIDE_ERR,
-								sz_ID_WINVNC_ERROR,
-								MB_OK | MB_ICONSTOP);
-					PostQuitMessage(0);
-				} else {
-					if (!vncService::RunningAsService())
-						MessageBoxSecure(NULL, sz_ID_NO_PASSWD_NO_OVERRIDE_WARN,
-								sz_ID_WINVNC_ERROR,
-								MB_OK | MB_ICONEXCLAMATION);
-				}
-			} else {
-				// If null passwords are not allowed, ensure that one is entered!
-				if (m_server->AuthRequired()) {
-					char username[UNLEN+1];
-					if (!vncService::CurrentUser(username, sizeof(username)))
-						return FALSE;
-					if (strcmp(username, "") == 0) {
-						Lock_service_helper=true;
-						MessageBoxSecure(NULL, sz_ID_NO_PASSWD_NO_LOGON_WARN,
-									sz_ID_WINVNC_ERROR,
-									MB_OK | MB_ICONEXCLAMATION);
-						ShowAdmin(TRUE, FALSE);
-						Lock_service_helper=false;
-					} else {
-						//Warning box removed, to ugly
-						//DialogBoxParam(hInstResDLL,MAKEINTRESOURCE(IDD_ABOUT1), NULL,(DLGPROC) DialogProc1,(LONG) this);
-						ShowAdmin(TRUE, TRUE);
-					}
-				}
-			}
-		}
-	}
-	Lock_service_helper=false;
-	return TRUE;
-}
-
-
-
-// Dialog box handling functions
-void
-vncProperties::ShowAdmin(BOOL show, BOOL usersettings)
-{
-//	if (Lock_service_helper) return;
-	HANDLE hProcess=NULL;
-	HANDLE hPToken=NULL;
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	DWORD id=GetExplorerLogonPid();
-#endif
-	int iImpersonateResult=0;
-	{
-		char WORKDIR[MAX_PATH];
-		if (!GetTempPath(MAX_PATH,WORKDIR))
-			{
-				//Function failed, just set something
-				if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-				{
-					char* p = strrchr(WORKDIR, '\\');
-					if (p == NULL) return;
-					*p = '\0';
-				}
-					strcpy(m_Tempfile,"");
-					strcat(m_Tempfile,WORKDIR);//set the directory
-					strcat(m_Tempfile,"\\");
-					strcat(m_Tempfile,INIFILE_NAME);
-		}
-		else
-		{
-			strcpy(m_Tempfile,"");
-			strcat(m_Tempfile,WORKDIR);//set the directory
-			strcat(m_Tempfile,INIFILE_NAME);
-		}
-	}
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	if (id!=0) 
-			{
-				hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-				if(OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-										|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-										|TOKEN_READ|TOKEN_WRITE,&hPToken))
-				{
-					ImpersonateLoggedOnUser(hPToken);
-					iImpersonateResult = GetLastError();
-					if(iImpersonateResult == ERROR_SUCCESS)
-					{
-						ExpandEnvironmentStringsForUser(hPToken, "%TEMP%", m_Tempfile, MAX_PATH);
-						strcat(m_Tempfile,"\\");
-						strcat(m_Tempfile,INIFILE_NAME);
-					}
-				}
-	}
-#endif
-
-	if (!m_allowproperties) 
-	{
-		if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-		if (hProcess) CloseHandle(hProcess);
-		if (hPToken) CloseHandle(hPToken);
-		return;
-	}
-	/*if (!RunningAsAdministrator ())
-		{
-		if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-		CloseHandle(hProcess);
-		CloseHandle(hPToken);
-		return;
-		}*/
-
-	if (m_fUseRegistry)
-	{
-		if (vncService::RunningAsService()) usersettings=false;
-		m_usersettings=usersettings;
-	}
-
-	if (show)
-	{
-
-		if (!m_fUseRegistry) // Use the ini file
-		{
-			// We're trying to edit the default local settings - verify that we can
-			/*if (!myIniFile.IsWritable())
-			{
-				if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-				CloseHandle(hProcess);
-				CloseHandle(hPToken);
-				return;
-			}*/
-		}
-		else // Use the registry
-		{
-			// Verify that we know who is logged on
-			if (usersettings)
-			{
-				char username[UNLEN+1];
-				if (!vncService::CurrentUser(username, sizeof(username)))
-					{
-						if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-						CloseHandle(hProcess);
-						CloseHandle(hPToken);
-						return;
-					}
-				if (strcmp(username, "") == 0) {
-					MessageBoxSecure(NULL, sz_ID_NO_CURRENT_USER_ERR, sz_ID_WINVNC_ERROR, MB_OK | MB_ICONEXCLAMATION);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-			}
-			else
-			{
-				// We're trying to edit the default local settings - verify that we can
-				HKEY hkLocal=NULL;
-				HKEY hkDefault=NULL;
-				BOOL canEditDefaultPrefs = 1;
-				DWORD dw;
-				if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-					WINVNC_REGISTRY_KEY,
-					0, REG_NONE, REG_OPTION_NON_VOLATILE,
-					KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-					canEditDefaultPrefs = 0;
-				else if (RegCreateKeyEx(hkLocal,
-					"Default",
-					0, REG_NONE, REG_OPTION_NON_VOLATILE,
-					KEY_WRITE | KEY_READ, NULL, &hkDefault, &dw) != ERROR_SUCCESS)
-					canEditDefaultPrefs = 0;
-				if (hkLocal) RegCloseKey(hkLocal);
-				if (hkDefault) RegCloseKey(hkDefault);
-
-				if (!canEditDefaultPrefs) {
-					MessageBoxSecure(NULL, sz_ID_CANNOT_EDIT_DEFAULT_PREFS, sz_ID_WINVNC_ERROR, MB_OK | MB_ICONEXCLAMATION);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					if (hProcess) CloseHandle(hProcess);
-					if (hPToken) CloseHandle(hPToken);
-					return;
-				}
-			}
-		}
-
-		// Now, if the dialog is not already displayed, show it!
-		if (!m_dlgvisible)
-		{
-			if (m_fUseRegistry) 
-			{
-				if (usersettings)
-					vnclog.Print(LL_INTINFO, VNCLOG("show per-user Properties\n"));
-				else
-					vnclog.Print(LL_INTINFO, VNCLOG("show default system Properties\n"));
-
-				// Load in the settings relevant to the user or system
-				//Load(usersettings);
-				m_usersettings=usersettings;
-			}
-
-			for (;;)
-			{
-				m_returncode_valid = FALSE;
-
-				// Do the dialog box
-				// [v1.0.2-jp1 fix]
-				//int result = DialogBoxParam(hAppInstance,
-				int result = DialogBoxParam(hInstResDLL,
-				    MAKEINTRESOURCE(IDD_PROPERTIES1), 
-				    NULL,
-				    (DLGPROC) DialogProc,
-				    (LONG_PTR) this);
-
-				if (!m_returncode_valid)
-				    result = IDCANCEL;
-
-				vnclog.Print(LL_INTINFO, VNCLOG("dialog result = %d\n"), result);
-
-				if (result == -1)
-				{
-					// Dialog box failed, so quit
-					PostQuitMessage(0);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-
-				// We're allowed to exit if the password is not empty
-				char passwd[MAXPWLEN];
-				m_server->GetPassword(passwd);
-				{
-				    vncPasswd::ToText plain(passwd);
-				    if ((strlen(plain) != 0) || !m_server->AuthRequired())
-					break;
-				}
-
-				vnclog.Print(LL_INTERR, VNCLOG("warning - empty password\n"));
-#ifdef ULTRAVNC_ITALC_SUPPORT
-					break;
-#endif
-
-				// The password is empty, so if OK was used then redisplay the box,
-				// otherwise, if CANCEL was used, close down WinVNC
-				if (result == IDCANCEL)
-				{
-				    vnclog.Print(LL_INTERR, VNCLOG("no password - QUITTING\n"));
-				    PostQuitMessage(0);
-				    if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-
-				// If we reached here then OK was used & there is no password!
-				MessageBoxSecure(NULL, sz_ID_NO_PASSWORD_WARN,
-				    sz_ID_WINVNC_WARNIN, MB_OK | MB_ICONEXCLAMATION);
-
-				omni_thread::sleep(4);
-			}
-
-			// Load in all the settings
-			// If you run as service, you reload the saved settings before they are actual saved
-			// via runas.....
-			if (!vncService::RunningAsService())
-			{
-			if (m_fUseRegistry) 
-				Load(TRUE);
-			else
-				LoadFromIniFile();
-			}
-
-		}
-	}
-	if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-	if (hProcess) CloseHandle(hProcess);
-	if (hPToken) CloseHandle(hPToken);
-}
-
-BOOL CALLBACK
-vncProperties::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!
-     vncProperties *_this = helper::SafeGetWindowUserData<vncProperties>(hwnd);
-
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{			
-			vnclog.Print(LL_INTINFO, VNCLOG("INITDIALOG properties\n"));
-			// Retrieve the Dialog box parameter and use it as a pointer
-			// to the calling vncProperties object
-            helper::SafeSetWindowUserData(hwnd, lParam);
-
-			_this = (vncProperties *) lParam;
-			_this->m_dlgvisible = TRUE;
-			if (_this->m_fUseRegistry)
-			{
-				_this->Load(_this->m_usersettings);
-
-				// Set the dialog box's title to indicate which Properties we're editting
-				if (_this->m_usersettings) {
-					SetWindowText(hwnd, sz_ID_CURRENT_USER_PROP);
-				} else {
-					SetWindowText(hwnd, sz_ID_DEFAULT_SYST_PROP);
-				}
-			}
-			else
-			{
-				_this->LoadFromIniFile();
-			}
-
-			// Initialise the properties controls
-			HWND hConnectSock = GetDlgItem(hwnd, IDC_CONNECT_SOCK);
-
-			// Tight 1.2.7 method
-			BOOL bConnectSock = _this->m_server->SockConnected();
-			SendMessage(hConnectSock, BM_SETCHECK, bConnectSock, 0);
-
-			// Set the content of the password field to a predefined string.
-		    SetDlgItemText(hwnd, IDC_PASSWORD, "~~~~~~~~");
-			EnableWindow(GetDlgItem(hwnd, IDC_PASSWORD), bConnectSock);
-
-			// Set the content of the view-only password field to a predefined string. //PGM
-		    SetDlgItemText(hwnd, IDC_PASSWORD2, "~~~~~~~~"); //PGM
-			EnableWindow(GetDlgItem(hwnd, IDC_PASSWORD2), bConnectSock); //PGM
-
-			// Set the initial keyboard focus
-			if (bConnectSock)
-			{
-				SetFocus(GetDlgItem(hwnd, IDC_PASSWORD));
-				SendDlgItemMessage(hwnd, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1);
-			}
-			else
-				SetFocus(hConnectSock);
-			// Set display/ports settings
-			_this->InitPortSettings(hwnd);
-
-			HWND hConnectHTTP = GetDlgItem(hwnd, IDC_CONNECT_HTTP);
-			SendMessage(hConnectHTTP,
-				BM_SETCHECK,
-				_this->m_server->HTTPConnectEnabled(),
-				0);
-//			HWND hConnectXDMCP = GetDlgItem(hwnd, IDC_CONNECT_XDMCP);
-//			SendMessage(hConnectXDMCP,
-//				BM_SETCHECK,
-//				_this->m_server->XDMCPConnectEnabled(),
-//				0);
-
-			// Modif sf at 2002
-//		   HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-//           SendMessage(hSingleWindow, BM_SETCHECK, _this->m_server->SingleWindow(), 0);
-
-		   // handler to get window name
-//           HWND hWindowName = GetDlgItem(hwnd, IDC_NAME_APPLI);
-//           if ( _this->m_server->GetWindowName() != NULL)
-//		   {
-  //             SetDlgItemText(hwnd, IDC_NAME_APPLI,_this->m_server->GetWindowName());
-    //       }
-    //     EnableWindow(hWindowName, _this->m_server->SingleWindow());
-
-		   // Modif sf at 2002 - v1.1.0
-		   HWND hFileTransfer = GetDlgItem(hwnd, IDC_FILETRANSFER);
-           SendMessage(hFileTransfer, BM_SETCHECK, _this->m_server->FileTransferEnabled(), 0);
-
-		   HWND hFileTransferUserImp = GetDlgItem(hwnd, IDC_FTUSERIMPERSONATION_CHECK);
-           SendMessage(hFileTransferUserImp, BM_SETCHECK, _this->m_server->FTUserImpersonation(), 0);
-		   
-		   HWND hBlank = GetDlgItem(hwnd, IDC_BLANK);
-           SendMessage(hBlank, BM_SETCHECK, _this->m_server->BlankMonitorEnabled(), 0);
-
-		   HWND hBlank2 = GetDlgItem(hwnd, IDC_BLANK2); //PGM
-           SendMessage(hBlank2, BM_SETCHECK, _this->m_server->BlankInputsOnly(), 0); //PGM
-
-		   HWND hAlpha = GetDlgItem(hwnd, IDC_ALPHA);
-           SendMessage(hAlpha, BM_SETCHECK, _this->m_server->CaptureAlphaBlending(), 0);
-		   HWND hAlphab = GetDlgItem(hwnd, IDC_ALPHABLACK);
-           SendMessage(hAlphab, BM_SETCHECK, _this->m_server->BlackAlphaBlending(), 0);
-
-		   // [v1.0.2-jp1 fix]
-//		   HWND hGammaGray = GetDlgItem(hwnd, IDC_GAMMAGRAY);
-//         SendMessage(hGammaGray, BM_SETCHECK, _this->m_server->GammaGray(), 0);
-		   
-		   HWND hLoopback = GetDlgItem(hwnd, IDC_ALLOWLOOPBACK);
-		   BOOL fLoopback = _this->m_server->LoopbackOk();
-		   SendMessage(hLoopback, BM_SETCHECK, fLoopback, 0);
-
-		   HWND hLoopbackonly = GetDlgItem(hwnd, IDC_LOOPBACKONLY);
-		   BOOL fLoopbackonly = _this->m_server->LoopbackOnly();
-		   SendMessage(hLoopbackonly, BM_SETCHECK, fLoopbackonly, 0);
-
-		   HWND hTrayicon = GetDlgItem(hwnd, IDC_DISABLETRAY);
-		   BOOL fTrayicon = _this->m_server->GetDisableTrayIcon();
-		   SendMessage(hTrayicon, BM_SETCHECK, fTrayicon, 0);
-
-		   HWND hAllowshutdown = GetDlgItem(hwnd, IDC_ALLOWSHUTDOWN);
-		   SendMessage(hAllowshutdown, BM_SETCHECK, !_this->m_allowshutdown , 0);
-
-		   HWND hm_alloweditclients = GetDlgItem(hwnd, IDC_ALLOWEDITCLIENTS);
-		   SendMessage(hm_alloweditclients, BM_SETCHECK, !_this->m_alloweditclients , 0);
-		   _this->m_server->SetAllowEditClients(_this->m_alloweditclients);
-		   
-
-		   if (vnclog.GetMode() >= 2)
-			   CheckDlgButton(hwnd, IDC_LOG, BST_CHECKED);
-		   else
-			   CheckDlgButton(hwnd, IDC_LOG, BST_UNCHECKED);
-
-#ifndef AVILOG
-		   ShowWindow (GetDlgItem(hwnd, IDC_CLEAR), SW_HIDE);
-		   ShowWindow (GetDlgItem(hwnd, IDC_VIDEO), SW_HIDE);
-#endif
-		   if (vnclog.GetVideo())
-		   {
-			   SetDlgItemText(hwnd, IDC_EDIT_PATH, vnclog.GetPath());
-			   EnableWindow(GetDlgItem(hwnd, IDC_EDIT_PATH), true);
-			   CheckDlgButton(hwnd, IDC_VIDEO, BST_CHECKED);
-		   }
-		   else
-		   {
-			   SetDlgItemText(hwnd, IDC_EDIT_PATH, vnclog.GetPath());
-			   EnableWindow(GetDlgItem(hwnd, IDC_EDIT_PATH), false);
-			   CheckDlgButton(hwnd, IDC_VIDEO, BST_UNCHECKED);
-		   }
-		   
-			// Marscha at 2004 - authSSP: moved MS-Logon checkbox back to admin props page
-			// added New MS-Logon checkbox
-			// only enable New MS-Logon checkbox and Configure MS-Logon groups when MS-Logon
-			// is checked.
-			HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD);
-			SendMessage(hMSLogon, BM_SETCHECK, _this->m_server->MSLogonRequired(), 0);
-
-			HWND hNewMSLogon = GetDlgItem(hwnd, IDC_NEW_MSLOGON);
-			SendMessage(hNewMSLogon, BM_SETCHECK, _this->m_server->GetNewMSLogon(), 0);
-
-			EnableWindow(GetDlgItem(hwnd, IDC_NEW_MSLOGON), _this->m_server->MSLogonRequired());
-			EnableWindow(GetDlgItem(hwnd, IDC_MSLOGON), _this->m_server->MSLogonRequired());
-			// Marscha at 2004 - authSSP: end of change
-
-		   SetDlgItemInt(hwnd, IDC_SCALE, _this->m_server->GetDefaultScale(), false);
-
-		   
-		   // Remote input settings
-			HWND hEnableRemoteInputs = GetDlgItem(hwnd, IDC_DISABLE_INPUTS);
-			SendMessage(hEnableRemoteInputs,
-				BM_SETCHECK,
-				!(_this->m_server->RemoteInputsEnabled()),
-				0);
-
-			// Local input settings
-			HWND hDisableLocalInputs = GetDlgItem(hwnd, IDC_DISABLE_LOCAL_INPUTS);
-			SendMessage(hDisableLocalInputs,
-				BM_SETCHECK,
-				_this->m_server->LocalInputsDisabled(),
-				0);
-
-			// japanese keybaord
-			HWND hJapInputs = GetDlgItem(hwnd, IDC_JAP_INPUTS);
-			SendMessage(hJapInputs,
-				BM_SETCHECK,
-				_this->m_server->JapInputEnabled(),
-				0);
-
-			// Remove the wallpaper
-			HWND hRemoveWallpaper = GetDlgItem(hwnd, IDC_REMOVE_WALLPAPER);
-			SendMessage(hRemoveWallpaper,
-				BM_SETCHECK,
-				_this->m_server->RemoveWallpaperEnabled(),
-				0);
-			// Remove the composit desktop
-			HWND hRemoveAero = GetDlgItem(hwnd, IDC_REMOVE_Aero);
-			SendMessage(hRemoveAero,
-				BM_SETCHECK,
-				_this->m_server->RemoveAeroEnabled(),
-				0);
-
-			// Lock settings
-			HWND hLockSetting;
-			switch (_this->m_server->LockSettings()) {
-			case 1:
-				hLockSetting = GetDlgItem(hwnd, IDC_LOCKSETTING_LOCK);
-				break;
-			case 2:
-				hLockSetting = GetDlgItem(hwnd, IDC_LOCKSETTING_LOGOFF);
-				break;
-			default:
-				hLockSetting = GetDlgItem(hwnd, IDC_LOCKSETTING_NOTHING);
-			};
-			SendMessage(hLockSetting,
-				BM_SETCHECK,
-				TRUE,
-				0);
-
-			HWND hmvSetting = 0;
-			switch (_this->m_server->ConnectPriority()) {
-			case 0:
-				hmvSetting = GetDlgItem(hwnd, IDC_MV1);
-				break;
-			case 1:
-				hmvSetting = GetDlgItem(hwnd, IDC_MV2);
-				break;
-			case 2:
-				hmvSetting = GetDlgItem(hwnd, IDC_MV3);
-				break;
-			case 3:
-				hmvSetting = GetDlgItem(hwnd, IDC_MV4);
-				break;
-			};
-			SendMessage(hmvSetting,
-				BM_SETCHECK,
-				TRUE,
-				0);
-
-
-			HWND hQuerySetting;
-			switch (_this->m_server->QueryAccept()) {
-			case 0:
-				hQuerySetting = GetDlgItem(hwnd, IDC_DREFUSE);
-				break;
-			case 1:
-				hQuerySetting = GetDlgItem(hwnd, IDC_DACCEPT);
-				break;
-			default:
-				hQuerySetting = GetDlgItem(hwnd, IDC_DREFUSE);
-			};
-			SendMessage(hQuerySetting,
-				BM_SETCHECK,
-				TRUE,
-				0);
-
-			// sf at 2002 - List available DSM Plugins
-			HWND hPlugins = GetDlgItem(hwnd, IDC_PLUGINS_COMBO);
-			int nPlugins = _this->m_server->GetDSMPluginPointer()->ListPlugins(hPlugins);
-			if (!nPlugins) 
-			{
-				SendMessage(hPlugins, CB_ADDSTRING, 0, (LPARAM) sz_ID_NO_PLUGIN_DETECT);
-				SendMessage(hPlugins, CB_SETCURSEL, 0, 0);
-			}
-			else
-				SendMessage(hPlugins, CB_SELECTSTRING, 0, (LPARAM)_this->m_server->GetDSMPluginName());
-
-			// Modif sf at 2002
-			HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
-			SendMessage(hUsePlugin,
-				BM_SETCHECK,
-				_this->m_server->IsDSMPluginEnabled(),
-				0);
-			HWND hButton = GetDlgItem(hwnd, IDC_PLUGIN_BUTTON);
-			EnableWindow(hButton, _this->m_server->IsDSMPluginEnabled());
-
-			// Query window option - Taken from TightVNC advanced properties 
-			HWND hQuery = GetDlgItem(hwnd, IDQUERY);
-			BOOL queryEnabled = (_this->m_server->QuerySetting() == 4);
-			SendMessage(hQuery, BM_SETCHECK, queryEnabled, 0);
-			HWND hQueryTimeout = GetDlgItem(hwnd, IDQUERYTIMEOUT);
-			EnableWindow(hQueryTimeout, queryEnabled);
-			EnableWindow(GetDlgItem(hwnd, IDC_DREFUSE), queryEnabled);
-			EnableWindow(GetDlgItem(hwnd, IDC_DACCEPT), queryEnabled);
-
-
-			char timeout[128];
-			UINT t = _this->m_server->QueryTimeout();
-			sprintf(timeout, "%d", (int)t);
-		    SetDlgItemText(hwnd, IDQUERYTIMEOUT, (const char *) timeout);
-
-			// 2006 - Patch from KP774 - disable some options depending on this OS version
-			// for Win9x, no user impersonation, no LockWorkstation
-			if(OSversion() == 4 || OSversion() == 5)
-			{
-				// Disable userimpersonation
-				_this->m_server->FTUserImpersonation(FALSE);
-				EnableWindow(hFileTransferUserImp, FALSE);
-				SendMessage(hFileTransferUserImp, BM_SETCHECK, FALSE, 0);
-
-				// Disable Lock Workstation
-				if(_this->m_server->LockSettings() == 1)
-				{
-					SendMessage(GetDlgItem(hwnd, IDC_LOCKSETTING_LOCK), BM_SETCHECK, FALSE, 0);
-					_this->m_server->SetLockSettings(0);
-					SendMessage(GetDlgItem(hwnd, IDC_LOCKSETTING_NOTHING), BM_SETCHECK, TRUE, 0);
-				}
-				EnableWindow(GetDlgItem(hwnd, IDC_LOCKSETTING_LOCK), FALSE);
-			}
-
-			// if not XP or above (if win9x or NT4 or NT3.51), disable Alpha blending
-			if(!(OSversion() == 1 || OSversion()==2))
-			{
-				// Disable Capture Alpha Blending
-				_this->m_server->CaptureAlphaBlending(FALSE);
-				EnableWindow(hAlpha, FALSE);
-				SendMessage(hAlpha, BM_SETCHECK, FALSE, 0);
-
-				// Disable Alpha Blending Monitor Blanking
-				_this->m_server->BlackAlphaBlending(FALSE);
-				EnableWindow(hAlphab, FALSE);
-				SendMessage(hAlphab, BM_SETCHECK, FALSE, 0);
-			}
-
-			SetForegroundWindow(hwnd);
-
-			return FALSE; // Because we've set the focus
-		}
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-
-		case IDOK:
-		case IDC_APPLY:
-			{
-				char path[512];
-				int lenpath = GetDlgItemText(hwnd, IDC_EDIT_PATH, (LPSTR) &path, 512);
-				if (lenpath != 0)
-					{
-						vnclog.SetPath(path);
-				}
-				else
-				{
-					strcpy(path,"");
-					vnclog.SetPath(path);
-				}
-
-				// Save the password
-				char passwd[MAXPWLEN+1];
-				// TightVNC method
-				int len = GetDlgItemText(hwnd, IDC_PASSWORD, (LPSTR) &passwd, MAXPWLEN+1);
-				if (strcmp(passwd, "~~~~~~~~") != 0) {
-					if (len == 0)
-					{
-						vncPasswd::FromClear crypt;
-						_this->m_server->SetPassword(crypt);
-					}
-					else
-					{
-						vncPasswd::FromText crypt(passwd);
-						_this->m_server->SetPassword(crypt);
-					}
-				}
-
-				memset(passwd, '\0', MAXPWLEN+1); //PGM
-				len = 0; //PGM
-				len = GetDlgItemText(hwnd, IDC_PASSWORD2, (LPSTR) &passwd, MAXPWLEN+1); //PGM
-				if (strcmp(passwd, "~~~~~~~~") != 0) { //PGM
-					if (len == 0) //PGM
-					{ //PGM
-						vncPasswd::FromClear crypt2; //PGM
-						_this->m_server->SetPassword2(crypt2); //PGM
-					} //PGM
-					else //PGM
-					{ //PGM
-						vncPasswd::FromText crypt2(passwd); //PGM
-						_this->m_server->SetPassword2(crypt2); //PGM
-					} //PGM
-				} //PGM
-
-				memset(passwd, '\0', MAXPWLEN+1); //PGM
-				len = 0; //PGM
-				len = GetDlgItemText(hwnd, IDC_PASSWORD2, (LPSTR) &passwd, MAXPWLEN+1); //PGM
-				if (strcmp(passwd, "~~~~~~~~") != 0) { //PGM
-					if (len == 0) //PGM
-					{ //PGM
-						vncPasswd::FromClear crypt2; //PGM
-						_this->m_server->SetPassword2(crypt2); //PGM
-					} //PGM
-					else //PGM
-					{ //PGM
-						vncPasswd::FromText crypt2(passwd); //PGM
-						_this->m_server->SetPassword2(crypt2); //PGM
-					} //PGM
-				} //PGM
-
-				// Save the new settings to the server
-				int state = SendDlgItemMessage(hwnd, IDC_PORTNO_AUTO, BM_GETCHECK, 0, 0);
-				_this->m_server->SetAutoPortSelect(state == BST_CHECKED);
-
-				// Save port numbers if we're not auto selecting
-				if (!_this->m_server->AutoPortSelect()) {
-					if ( SendDlgItemMessage(hwnd, IDC_SPECDISPLAY,
-											BM_GETCHECK, 0, 0) == BST_CHECKED ) {
-						// Display number was specified
-						BOOL ok;
-						UINT display = GetDlgItemInt(hwnd, IDC_DISPLAYNO, &ok, TRUE);
-						if (ok)
-							_this->m_server->SetPorts(DISPLAY_TO_PORT(display),
-													  DISPLAY_TO_HPORT(display));
-					} else {
-						// Assuming that port numbers were specified
-						BOOL ok1, ok2;
-						UINT port_rfb = GetDlgItemInt(hwnd, IDC_PORTRFB, &ok1, TRUE);
-						UINT port_http = GetDlgItemInt(hwnd, IDC_PORTHTTP, &ok2, TRUE);
-						if (ok1 && ok2)
-							_this->m_server->SetPorts(port_rfb, port_http);
-					}
-				}
-				HWND hConnectSock = GetDlgItem(hwnd, IDC_CONNECT_SOCK);
-				_this->m_server->SockConnect(
-					SendMessage(hConnectSock, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// Update display/port controls on pressing the "Apply" button
-				if (LOWORD(wParam) == IDC_APPLY)
-					_this->InitPortSettings(hwnd);
-
-				
-
-				HWND hConnectHTTP = GetDlgItem(hwnd, IDC_CONNECT_HTTP);
-				_this->m_server->EnableHTTPConnect(
-					SendMessage(hConnectHTTP, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				HWND hConnectXDMCP = GetDlgItem(hwnd, IDC_CONNECT_XDMCP);
-				_this->m_server->EnableXDMCPConnect(
-					SendMessage(hConnectXDMCP, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-				
-				// Remote input stuff
-				HWND hEnableRemoteInputs = GetDlgItem(hwnd, IDC_DISABLE_INPUTS);
-				_this->m_server->EnableRemoteInputs(
-					SendMessage(hEnableRemoteInputs, BM_GETCHECK, 0, 0) != BST_CHECKED
-					);
-
-				// Local input stuff
-				HWND hDisableLocalInputs = GetDlgItem(hwnd, IDC_DISABLE_LOCAL_INPUTS);
-				_this->m_server->DisableLocalInputs(
-					SendMessage(hDisableLocalInputs, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// japanese keyboard
-				HWND hJapInputs = GetDlgItem(hwnd, IDC_JAP_INPUTS);
-				_this->m_server->EnableJapInput(
-					SendMessage(hJapInputs, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// Wallpaper handling
-				HWND hRemoveWallpaper = GetDlgItem(hwnd, IDC_REMOVE_WALLPAPER);
-				_this->m_server->EnableRemoveWallpaper(
-					SendMessage(hRemoveWallpaper, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// Aero handling
-				HWND hRemoveAero = GetDlgItem(hwnd, IDC_REMOVE_Aero);
-				_this->m_server->EnableRemoveAero(
-					SendMessage(hRemoveAero, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// Lock settings handling
-				if (SendMessage(GetDlgItem(hwnd, IDC_LOCKSETTING_LOCK), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetLockSettings(1);
-				} else if (SendMessage(GetDlgItem(hwnd, IDC_LOCKSETTING_LOGOFF), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetLockSettings(2);
-				} else {
-					_this->m_server->SetLockSettings(0);
-				}
-
-				if (SendMessage(GetDlgItem(hwnd, IDC_DREFUSE), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetQueryAccept(0);
-				} else if (SendMessage(GetDlgItem(hwnd, IDC_DACCEPT), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetQueryAccept(1);
-				} 
-
-				if (SendMessage(GetDlgItem(hwnd, IDC_MV1), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetConnectPriority(0);
-				} else if (SendMessage(GetDlgItem(hwnd, IDC_MV2), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetConnectPriority(1);
-				} 
-				 else if (SendMessage(GetDlgItem(hwnd, IDC_MV3), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetConnectPriority(2);
-				} else if (SendMessage(GetDlgItem(hwnd, IDC_MV4), BM_GETCHECK, 0, 0)
-					== BST_CHECKED) {
-					_this->m_server->SetConnectPriority(3);
-				} 
-
-				
-
-				// Modif sf at 2002
-				// [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp
-//				HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-//				_this->m_server->SingleWindow(SendMessage(hSingleWindow, BM_GETCHECK, 0, 0) == BST_CHECKED);
-//
-//				char szName[32];
-//				if (GetDlgItemText(hwnd, IDC_NAME_APPLI, (LPSTR) szName, 32) == 0)
-//				{
-//					vnclog.Print(LL_INTINFO,VNCLOG("Error while reading Window Name %d \n"), GetLastError());
-//				}
-//				else
-//				{
-//					_this->m_server->SetSingleWindowName(szName);
-//				}
-				// [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp
-				
-				// Modif sf at 2002 - v1.1.0
-				HWND hFileTransfer = GetDlgItem(hwnd, IDC_FILETRANSFER);
-				_this->m_server->EnableFileTransfer(SendMessage(hFileTransfer, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				HWND hFileTransferUserImp = GetDlgItem(hwnd, IDC_FTUSERIMPERSONATION_CHECK);
-				_this->m_server->FTUserImpersonation(SendMessage(hFileTransferUserImp, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				HWND hBlank = GetDlgItem(hwnd, IDC_BLANK);
-				_this->m_server->BlankMonitorEnabled(SendMessage(hBlank, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				HWND hBlank2 = GetDlgItem(hwnd, IDC_BLANK2); //PGM
-				_this->m_server->BlankInputsOnly(SendMessage(hBlank2, BM_GETCHECK, 0, 0) == BST_CHECKED); //PGM
-				HWND hAlpha = GetDlgItem(hwnd, IDC_ALPHA);
-				_this->m_server->CaptureAlphaBlending(SendMessage(hAlpha, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				HWND hAlphab = GetDlgItem(hwnd, IDC_ALPHABLACK);
-				_this->m_server->BlackAlphaBlending(SendMessage(hAlphab, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				// [v1.0.2-jp1 fix]
-//				HWND hGammaGray = GetDlgItem(hwnd, IDC_GAMMAGRAY);
-//				_this->m_server->GammaGray(SendMessage(hGammaGray, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				_this->m_server->SetLoopbackOk(IsDlgButtonChecked(hwnd, IDC_ALLOWLOOPBACK));
-				_this->m_server->SetLoopbackOnly(IsDlgButtonChecked(hwnd, IDC_LOOPBACKONLY));
-
-				_this->m_server->SetDisableTrayIcon(IsDlgButtonChecked(hwnd, IDC_DISABLETRAY));
-				_this->m_allowshutdown=!IsDlgButtonChecked(hwnd, IDC_ALLOWSHUTDOWN);
-				_this->m_alloweditclients=!IsDlgButtonChecked(hwnd, IDC_ALLOWEDITCLIENTS);
-				_this->m_server->SetAllowEditClients(_this->m_alloweditclients);
-				if (IsDlgButtonChecked(hwnd, IDC_LOG))
-				{
-					vnclog.SetMode(2);
-					vnclog.SetLevel(10);
-				}
-				else
-				{
-					vnclog.SetMode(0);
-				}
-				if (IsDlgButtonChecked(hwnd, IDC_VIDEO))
-				{
-					vnclog.SetVideo(true);
-				}
-				else
-				{
-					vnclog.SetVideo(false);
-				}
-				// Modif sf at 2002 - v1.1.0
-				// Marscha at 2004 - authSSP: moved MS-Logon checkbox back to admin props page
-				// added New MS-Logon checkbox
-				HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD);
-				_this->m_server->RequireMSLogon(SendMessage(hMSLogon, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				
-				HWND hNewMSLogon = GetDlgItem(hwnd, IDC_NEW_MSLOGON);
-				_this->m_server->SetNewMSLogon(SendMessage(hNewMSLogon, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				// Marscha at 2004 - authSSP: end of change
-
-				int nDScale = GetDlgItemInt(hwnd, IDC_SCALE, NULL, FALSE);
-				if (nDScale < 1 || nDScale > 9) nDScale = 1;
-				_this->m_server->SetDefaultScale(nDScale);
-				
-				// sf at 2002 - DSM Plugin loading
-				// If Use plugin is checked, load the plugin if necessary
-				HWND hPlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
-				if (SendMessage(hPlugin, BM_GETCHECK, 0, 0) == BST_CHECKED)
-				{
-					TCHAR szPlugin[MAX_PATH];
-					GetDlgItemText(hwnd, IDC_PLUGINS_COMBO, szPlugin, MAX_PATH);
-					_this->m_server->SetDSMPluginName(szPlugin);
-					_this->m_server->EnableDSMPlugin(true);
-				}
-				else // If Use plugin unchecked but the plugin is loaded, unload it
-				{
-					_this->m_server->EnableDSMPlugin(false);
-					if (_this->m_server->GetDSMPluginPointer()->IsLoaded())
-					{
-						_this->m_server->GetDSMPluginPointer()->UnloadPlugin();
-						_this->m_server->GetDSMPluginPointer()->SetEnabled(false);
-					}	
-				}
-
-				//adzm 2010-05-12 - dsmplugin config
-				_this->m_server->SetDSMPluginConfig(_this->m_pref_DSMPluginConfig);
-
-				// Query Window options - Taken from TightVNC advanced properties
-				char timeout[256];
-				if (GetDlgItemText(hwnd, IDQUERYTIMEOUT, (LPSTR) &timeout, 256) == 0)
-				    _this->m_server->SetQueryTimeout(atoi(timeout));
-				else
-				    _this->m_server->SetQueryTimeout(atoi(timeout));
-				HWND hQuery = GetDlgItem(hwnd, IDQUERY);
-				_this->m_server->SetQuerySetting((SendMessage(hQuery, BM_GETCHECK, 0, 0) == BST_CHECKED) ? 4 : 2);
-
-				// And to the registry
-
-				/*if (!RunningAsAdministrator () && vncService::RunningAsService())
-				{
-					MessageBoxSecure(NULL,"Only admins are allowed to save","Warning", MB_OK | MB_ICONINFORMATION);
-				}
-				else*/
-				{
-				// Load the settings
-				if (_this->m_fUseRegistry)
-					_this->Save();
-				else
-					_this->SaveToIniFile();
-				}
-
-				// Was ok pressed?
-				if (LOWORD(wParam) == IDOK)
-				{
-					// Yes, so close the dialog
-					vnclog.Print(LL_INTINFO, VNCLOG("enddialog (OK)\n"));
-
-					_this->m_returncode_valid = TRUE;
-
-					EndDialog(hwnd, IDOK);
-					_this->m_dlgvisible = FALSE;
-				}
-
-				_this->m_server->SetHookings();
-
-				return TRUE;
-			}
-
-		// Modif sf at 2002
-		// [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp
-//		 case IDC_SINGLE_WINDOW:
-//			 {
-//				 HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-//				 BOOL fSingleWindow = (SendMessage(hSingleWindow, BM_GETCHECK,0, 0) == BST_CHECKED);
-//				 HWND hWindowName   = GetDlgItem(hwnd, IDC_NAME_APPLI);
-//				 EnableWindow(hWindowName, fSingleWindow);
-//			 }
-//			 return TRUE;
-		// [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp
-
-		case IDCANCEL:
-			vnclog.Print(LL_INTINFO, VNCLOG("enddialog (CANCEL)\n"));
-
-			_this->m_returncode_valid = TRUE;
-
-			EndDialog(hwnd, IDCANCEL);
-			_this->m_dlgvisible = FALSE;
-			return TRUE;
-
-	    // Added Jef Fix - 5 March 2008 paquette at atnetsend.net
-        case IDC_BLANK:
-            {
-                // only enable alpha blanking if blanking is enabled
-                HWND hBlank = ::GetDlgItem(hwnd, IDC_BLANK);
-                HWND hAlphab = ::GetDlgItem(hwnd, IDC_ALPHABLACK);
-                ::EnableWindow(hAlphab, ::SendMessage(hBlank, BM_GETCHECK, 0, 0) == BST_CHECKED);
-                HWND hBlank2 = ::GetDlgItem(hwnd, IDC_BLANK2); //PGM
-                ::EnableWindow(hBlank2, ::SendMessage(hBlank, BM_GETCHECK, 0, 0) == BST_CHECKED); //PGM
-            }
-            break;
-
-        case IDC_BLANK2: //PGM
-            { //PGM
-                // only enable alpha blanking if Disable Only Inputs is disabled //PGM
-                HWND hBlank = ::GetDlgItem(hwnd, IDC_BLANK2); //PGM
-                HWND hAlphab = ::GetDlgItem(hwnd, IDC_ALPHABLACK); //PGM
-                ::EnableWindow(hAlphab, ::SendMessage(hBlank, BM_GETCHECK, 0, 0) == BST_UNCHECKED); //PGM
-            } //PGM
-            break; //PGM
-
-		case IDC_VIDEO:
-			{
-				if (IsDlgButtonChecked(hwnd, IDC_VIDEO))
-				   {
-					   EnableWindow(GetDlgItem(hwnd, IDC_EDIT_PATH), true);
-					   
-				   }
-				   else
-				   {
-					   EnableWindow(GetDlgItem(hwnd, IDC_EDIT_PATH), false);
-					   
-				   }
-				break;
-			}
-
-		case IDC_CLEAR:
-			{
-				vnclog.ClearAviConfig();
-				break;
-			}
-
-		case IDC_CONNECT_SOCK:
-			// TightVNC 1.2.7 method
-			// The user has clicked on the socket connect tickbox
-			{
-				BOOL bConnectSock =
-					(SendDlgItemMessage(hwnd, IDC_CONNECT_SOCK,
-										BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				EnableWindow(GetDlgItem(hwnd, IDC_PASSWORD), bConnectSock);
-
-				HWND hPortNoAuto = GetDlgItem(hwnd, IDC_PORTNO_AUTO);
-				EnableWindow(hPortNoAuto, bConnectSock);
-				HWND hSpecDisplay = GetDlgItem(hwnd, IDC_SPECDISPLAY);
-				EnableWindow(hSpecDisplay, bConnectSock);
-				HWND hSpecPort = GetDlgItem(hwnd, IDC_SPECPORT);
-				EnableWindow(hSpecPort, bConnectSock);
-
-				EnableWindow(GetDlgItem(hwnd, IDC_DISPLAYNO), bConnectSock &&
-					(SendMessage(hSpecDisplay, BM_GETCHECK, 0, 0) == BST_CHECKED));
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTRFB), bConnectSock &&
-					(SendMessage(hSpecPort, BM_GETCHECK, 0, 0) == BST_CHECKED));
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTHTTP), bConnectSock &&
-					(SendMessage(hSpecPort, BM_GETCHECK, 0, 0) == BST_CHECKED));
-			}
-			// RealVNC method
-			/*
-			// The user has clicked on the socket connect tickbox
-			{
-				HWND hConnectSock = GetDlgItem(hwnd, IDC_CONNECT_SOCK);
-				BOOL connectsockon =
-					(SendMessage(hConnectSock, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				HWND hAutoDisplayNo = GetDlgItem(hwnd, IDC_AUTO_DISPLAY_NO);
-				EnableWindow(hAutoDisplayNo, connectsockon);
-			
-				HWND hPortNo = GetDlgItem(hwnd, IDC_PORTNO);
-				EnableWindow(hPortNo, connectsockon
-					&& (SendMessage(hAutoDisplayNo, BM_GETCHECK, 0, 0) != BST_CHECKED));
-			
-				HWND hPassword = GetDlgItem(hwnd, IDC_PASSWORD);
-				EnableWindow(hPassword, connectsockon);
-			}
-			*/
-			return TRUE;
-
-		// TightVNC 1.2.7 method
-		case IDC_PORTNO_AUTO:
-			{
-				EnableWindow(GetDlgItem(hwnd, IDC_DISPLAYNO), FALSE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTRFB), FALSE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTHTTP), FALSE);
-
-				SetDlgItemText(hwnd, IDC_DISPLAYNO, "");
-				SetDlgItemText(hwnd, IDC_PORTRFB, "");
-				SetDlgItemText(hwnd, IDC_PORTHTTP, "");
-			}
-			return TRUE;
-
-		case IDC_SPECDISPLAY:
-			{
-				EnableWindow(GetDlgItem(hwnd, IDC_DISPLAYNO), TRUE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTRFB), FALSE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTHTTP), FALSE);
-
-				int display = PORT_TO_DISPLAY(_this->m_server->GetPort());
-				if (display < 0 || display > 99)
-					display = 0;
-				SetDlgItemInt(hwnd, IDC_DISPLAYNO, display, FALSE);
-				SetDlgItemInt(hwnd, IDC_PORTRFB, _this->m_server->GetPort(), FALSE);
-				SetDlgItemInt(hwnd, IDC_PORTHTTP, _this->m_server->GetHttpPort(), FALSE);
-
-				SetFocus(GetDlgItem(hwnd, IDC_DISPLAYNO));
-				SendDlgItemMessage(hwnd, IDC_DISPLAYNO, EM_SETSEL, 0, (LPARAM)-1);
-			}
-			return TRUE;
-
-		case IDC_SPECPORT:
-			{
-				EnableWindow(GetDlgItem(hwnd, IDC_DISPLAYNO), FALSE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTRFB), TRUE);
-				EnableWindow(GetDlgItem(hwnd, IDC_PORTHTTP), TRUE);
-
-				int d1 = PORT_TO_DISPLAY(_this->m_server->GetPort());
-				int d2 = HPORT_TO_DISPLAY(_this->m_server->GetHttpPort());
-				if (d1 == d2 && d1 >= 0 && d1 <= 99) {
-					SetDlgItemInt(hwnd, IDC_DISPLAYNO, d1, FALSE);
-				} else {
-					SetDlgItemText(hwnd, IDC_DISPLAYNO, "");
-				}
-				SetDlgItemInt(hwnd, IDC_PORTRFB, _this->m_server->GetPort(), FALSE);
-				SetDlgItemInt(hwnd, IDC_PORTHTTP, _this->m_server->GetHttpPort(), FALSE);
-
-				SetFocus(GetDlgItem(hwnd, IDC_PORTRFB));
-				SendDlgItemMessage(hwnd, IDC_PORTRFB, EM_SETSEL, 0, (LPARAM)-1);
-			}
-			return TRUE;
-
-		// RealVNC method
-		/*
-		case IDC_AUTO_DISPLAY_NO:
-			// User has toggled the Auto Port Select feature.
-			// If this is in use, then we don't allow the Display number field
-			// to be modified!
-			{
-				// Get the auto select button
-				HWND hPortNoAuto = GetDlgItem(hwnd, IDC_AUTO_DISPLAY_NO);
-
-				// Should the portno field be modifiable?
-				BOOL enable = SendMessage(hPortNoAuto, BM_GETCHECK, 0, 0) != BST_CHECKED;
-
-				// Set the state
-				HWND hPortNo = GetDlgItem(hwnd, IDC_PORTNO);
-				EnableWindow(hPortNo, enable);
-			}
-			return TRUE;
-		*/
-
-		// Query window option - Taken from TightVNC advanced properties code
-		case IDQUERY:
-			{
-				HWND hQuery = GetDlgItem(hwnd, IDQUERY);
-				BOOL queryon = (SendMessage(hQuery, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				EnableWindow(GetDlgItem(hwnd, IDQUERYTIMEOUT), queryon);
-				EnableWindow(GetDlgItem(hwnd, IDC_DREFUSE), queryon);
-				EnableWindow(GetDlgItem(hwnd, IDC_DACCEPT), queryon);
-			}
-			return TRUE;
-
-		// sf at 2002 - DSM Plugin
-		case IDC_PLUGIN_CHECK:
-			{
-				HWND hUse = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
-				BOOL enable = SendMessage(hUse, BM_GETCHECK, 0, 0) == BST_CHECKED;
-				HWND hButton = GetDlgItem(hwnd, IDC_PLUGIN_BUTTON);
-				EnableWindow(hButton, enable);
-			}
-			return TRUE;
-			// Marscha at 2004 - authSSP: moved MSLogon checkbox back to admin props page
-			// Reason: Different UI for old and new mslogon group config.
-		case IDC_MSLOGON_CHECKD:
-			{
-				BOOL bMSLogonChecked =
-				(SendDlgItemMessage(hwnd, IDC_MSLOGON_CHECKD,
-										BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				EnableWindow(GetDlgItem(hwnd, IDC_NEW_MSLOGON), bMSLogonChecked);
-				EnableWindow(GetDlgItem(hwnd, IDC_MSLOGON), bMSLogonChecked);
-
-			}
-			return TRUE;
-		case IDC_MSLOGON:
-			{
-				// Marscha at 2004 - authSSP: if "New MS-Logon" is checked,
-				// call vncEditSecurity from SecurityEditor.dll,
-				// else call "old" dialog.
-				BOOL bNewMSLogonChecked =
-				(SendDlgItemMessage(hwnd, IDC_NEW_MSLOGON,
-										BM_GETCHECK, 0, 0) == BST_CHECKED);
-				if (bNewMSLogonChecked) {
-					void winvncSecurityEditorHelper_as_admin();
-						HANDLE hProcess,hPToken;
-						DWORD id=GetExplorerLogonPid();
-						if (id!=0) 
-						{
-							hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-							if(!OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-													|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-													|TOKEN_READ|TOKEN_WRITE,&hPToken)) break;
-
-							char dir[MAX_PATH];
-							char exe_file_name[MAX_PATH];
-							GetModuleFileName(0, exe_file_name, MAX_PATH);
-							strcpy(dir, exe_file_name);
-							strcat(dir, " -securityeditorhelper");
-				
-							{
-								STARTUPINFO          StartUPInfo;
-								PROCESS_INFORMATION  ProcessInfo;
-								ZeroMemory(&StartUPInfo,sizeof(STARTUPINFO));
-								ZeroMemory(&ProcessInfo,sizeof(PROCESS_INFORMATION));
-								StartUPInfo.wShowWindow = SW_SHOW;
-								StartUPInfo.lpDesktop = "Winsta0\\Default";
-								StartUPInfo.cb = sizeof(STARTUPINFO);
-						
-								CreateProcessAsUser(hPToken,NULL,dir,NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&StartUPInfo,&ProcessInfo);
-								DWORD error=GetLastError();
-                                if (ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread);
-                                if (ProcessInfo.hProcess) CloseHandle(ProcessInfo.hProcess);
-								if (error==1314)
-									{
-										winvncSecurityEditorHelper_as_admin();
-									}
-
-							}
-						}
-
-/*
-					char szCurrentDir[MAX_PATH];
-					if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH)) {
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-						strcat (szCurrentDir,"\\authSSP.dll");
-					}
-					HMODULE hModule = LoadLibrary(szCurrentDir);
-					if (hModule) {
-						vncEditSecurity = (vncEditSecurityFn) GetProcAddress(hModule, "vncEditSecurity");
-						HRESULT hr = CoInitialize(NULL);
-						vncEditSecurity(hwnd, hAppInstance);
-						CoUninitialize();
-						FreeLibrary(hModule);
-					}*/
-				} else { 
-					// Marscha at 2004 - authSSP: end of change
-					_this->m_vncauth.Init(_this->m_server);
-					_this->m_vncauth.SetTemp(_this->m_Tempfile);
-					_this->m_vncauth.Show(TRUE);
-				}
-			}
-			return TRUE;
-		case IDC_CHECKDRIVER:
-			{
-				CheckVideoDriver(1);
-			}
-			return TRUE;
-		case IDC_PLUGIN_BUTTON:
-			{
-				HWND hPlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
-				if (SendMessage(hPlugin, BM_GETCHECK, 0, 0) == BST_CHECKED)
-				{
-					TCHAR szPlugin[MAX_PATH];
-					GetDlgItemText(hwnd, IDC_PLUGINS_COMBO, szPlugin, MAX_PATH);
-					if (!_this->m_server->GetDSMPluginPointer()->IsLoaded())
-						_this->m_server->GetDSMPluginPointer()->LoadPlugin(szPlugin, false);
-					else
-					{
-						// sf at 2003 - We check if the loaded plugin is the same than
-						// the currently selected one or not
-						_this->m_server->GetDSMPluginPointer()->DescribePlugin();
-						if (_stricmp(_this->m_server->GetDSMPluginPointer()->GetPluginFileName(), szPlugin))
-						{
-							_this->m_server->GetDSMPluginPointer()->UnloadPlugin();
-							_this->m_server->GetDSMPluginPointer()->LoadPlugin(szPlugin, false);
-						}
-					}
-				
-					if (_this->m_server->GetDSMPluginPointer()->IsLoaded())
-					{
-						// We don't send the password yet... no matter the plugin requires
-						// it or not, we will provide it later (at plugin "real" init)
-						// Knowing the environnement ("server-svc" or "server-app") right 
-						// now can be usefull or even mandatory for the plugin 
-						// (specific params saving and so on...)
-						char szParams[32];
-						strcpy(szParams, "NoPassword,");
-						strcat(szParams, vncService::RunningAsService() ? "server-svc" : "server-app");
-						//adzm 2010-05-12 - dsmplugin config
-						char* szNewConfig = NULL;
-						if (_this->m_server->GetDSMPluginPointer()->SetPluginParams(hwnd, szParams, _this->m_pref_DSMPluginConfig, &szNewConfig)) {
-							if (szNewConfig != NULL && strlen(szNewConfig) > 0) {
-								strcpy_s(_this->m_pref_DSMPluginConfig, 511, szNewConfig);
-							}
-						}
-					}
-					else
-					{
-						MessageBoxSecure(NULL, 
-							sz_ID_PLUGIN_NOT_LOAD, 
-							sz_ID_PLUGIN_LOADIN, MB_OK | MB_ICONEXCLAMATION );
-					}
-				}				
-				return TRUE;
-			}
-
-
-
-		}
-		break;
-	}
-	return 0;
-}
-
-
-
-// TightVNC 1.2.7
-// Set display/port settings to the correct state
-void
-vncProperties::InitPortSettings(HWND hwnd)
-{
-	BOOL bConnectSock = m_server->SockConnected();
-	BOOL bAutoPort = m_server->AutoPortSelect();
-	UINT port_rfb = m_server->GetPort();
-	UINT port_http = m_server->GetHttpPort();
-	int d1 = PORT_TO_DISPLAY(port_rfb);
-	int d2 = HPORT_TO_DISPLAY(port_http);
-	BOOL bValidDisplay = (d1 == d2 && d1 >= 0 && d1 <= 99);
-
-	CheckDlgButton(hwnd, IDC_PORTNO_AUTO,
-		(bAutoPort) ? BST_CHECKED : BST_UNCHECKED);
-	CheckDlgButton(hwnd, IDC_SPECDISPLAY,
-		(!bAutoPort && bValidDisplay) ? BST_CHECKED : BST_UNCHECKED);
-	CheckDlgButton(hwnd, IDC_SPECPORT,
-		(!bAutoPort && !bValidDisplay) ? BST_CHECKED : BST_UNCHECKED);
-
-	EnableWindow(GetDlgItem(hwnd, IDC_PORTNO_AUTO), bConnectSock);
-	EnableWindow(GetDlgItem(hwnd, IDC_SPECDISPLAY), bConnectSock);
-	EnableWindow(GetDlgItem(hwnd, IDC_SPECPORT), bConnectSock);
-
-	if (bValidDisplay) {
-		SetDlgItemInt(hwnd, IDC_DISPLAYNO, d1, FALSE);
-	} else {
-		SetDlgItemText(hwnd, IDC_DISPLAYNO, "");
-	}
-	SetDlgItemInt(hwnd, IDC_PORTRFB, port_rfb, FALSE);
-	SetDlgItemInt(hwnd, IDC_PORTHTTP, port_http, FALSE);
-
-	EnableWindow(GetDlgItem(hwnd, IDC_DISPLAYNO),
-		bConnectSock && !bAutoPort && bValidDisplay);
-	EnableWindow(GetDlgItem(hwnd, IDC_PORTRFB),
-		bConnectSock && !bAutoPort && !bValidDisplay);
-	EnableWindow(GetDlgItem(hwnd, IDC_PORTHTTP),
-		bConnectSock && !bAutoPort && !bValidDisplay);
-}
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-extern BOOL ultravnc_italc_load_int( LPCSTR valname, LONG *out );
-#endif
-
-// Functions to load & save the settings
-LONG
-vncProperties::LoadInt(HKEY key, LPCSTR valname, LONG defval)
-{
-	LONG pref;
-	ULONG type = REG_DWORD;
-	ULONG prefsize = sizeof(pref);
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	LONG out;
-	if( ultravnc_italc_load_int( valname, &out ) )
-	{
-		return out;
-	}
-#endif
-	if (RegQueryValueEx(key,
-		valname,
-		NULL,
-		&type,
-		(LPBYTE) &pref,
-		&prefsize) != ERROR_SUCCESS)
-		return defval;
-
-	if (type != REG_DWORD)
-		return defval;
-
-	if (prefsize != sizeof(pref))
-		return defval;
-
-	return pref;
-}
-
-void
-vncProperties::LoadPassword(HKEY key, char *buffer)
-{
-	DWORD type = REG_BINARY;
-	int slen=MAXPWLEN;
-	char inouttext[MAXPWLEN];
-
-	// Retrieve the encrypted password
-	if (RegQueryValueEx(key,
-		"Password",
-		NULL,
-		&type,
-		(LPBYTE) &inouttext,
-		(LPDWORD) &slen) != ERROR_SUCCESS)
-		return;
-
-	if (slen > MAXPWLEN)
-		return;
-
-	memcpy(buffer, inouttext, MAXPWLEN);
-}
-
-void //PGM
-vncProperties::LoadPassword2(HKEY key, char *buffer) //PGM
-{ //PGM
-	DWORD type = REG_BINARY; //PGM
-	int slen=MAXPWLEN; //PGM
-	char inouttext[MAXPWLEN]; //PGM
-
-	// Retrieve the encrypted password //PGM
-	if (RegQueryValueEx(key, //PGM
-		"Password2", //PGM
-		NULL, //PGM
-		&type, //PGM
-		(LPBYTE) &inouttext, //PGM
-		(LPDWORD) &slen) != ERROR_SUCCESS) //PGM
-		return; //PGM
-
-	if (slen > MAXPWLEN) //PGM
-		return; //PGM
-
-	memcpy(buffer, inouttext, MAXPWLEN); //PGM
-} //PGM
-
-char *
-vncProperties::LoadString(HKEY key, LPCSTR keyname)
-{
-	DWORD type = REG_SZ;
-	DWORD buflen = 0;
-	BYTE *buffer = 0;
-
-	// Get the length of the AuthHosts string
-	if (RegQueryValueEx(key,
-		keyname,
-		NULL,
-		&type,
-		NULL,
-		&buflen) != ERROR_SUCCESS)
-		return 0;
-
-	if (type != REG_SZ)
-		return 0;
-	buffer = new BYTE[buflen];
-	if (buffer == 0)
-		return 0;
-
-	// Get the AuthHosts string data
-	if (RegQueryValueEx(key,
-		keyname,
-		NULL,
-		&type,
-		buffer,
-		&buflen) != ERROR_SUCCESS) {
-		delete [] buffer;
-		return 0;
-	}
-
-	// Verify the type
-	if (type != REG_SZ) {
-		delete [] buffer;
-		return 0;
-	}
-
-	return (char *)buffer;
-}
-
-
-void
-vncProperties::ResetRegistry()
-{	
-	char username[UNLEN+1];
-	HKEY hkLocal, hkLocalUser, hkDefault;
-	DWORD dw;
-
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-		return;
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-		strcpy((char *)&username, "SYSTEM");
-
-	// Try to get the machine registry key for WinVNC
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		WINVNC_REGISTRY_KEY,
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		hkLocalUser=NULL;
-		hkDefault=NULL;
-		goto LABELUSERSETTINGS;
-		}
-
-	// Now try to get the per-user local key
-	if (RegOpenKeyEx(hkLocal,
-		username,
-		0, KEY_READ,
-		&hkLocalUser) != ERROR_SUCCESS)
-		hkLocalUser = NULL;
-
-	// Get the default key
-	if (RegCreateKeyEx(hkLocal,
-		"Default",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ,
-		NULL,
-		&hkDefault,
-		&dw) != ERROR_SUCCESS)
-		hkDefault = NULL;
-
-	if (hkLocalUser != NULL) RegCloseKey(hkLocalUser);
-	if (hkDefault != NULL) RegCloseKey(hkDefault);
-	if (hkLocal != NULL) RegCloseKey(hkLocal);
-	RegCloseKey(HKEY_LOCAL_MACHINE);
-LABELUSERSETTINGS:
-	if ((strcmp(username, "SYSTEM") != 0))
-		{
-			HKEY hkGlobalUser;
-			if (RegCreateKeyEx(HKEY_CURRENT_USER,
-				WINVNC_REGISTRY_KEY,
-				0, REG_NONE, REG_OPTION_NON_VOLATILE,
-				KEY_READ, NULL, &hkGlobalUser, &dw) == ERROR_SUCCESS)
-			{
-				RegCloseKey(hkGlobalUser);
-				RegCloseKey(HKEY_CURRENT_USER);
-			}
-		}
-
-}
-
-void
-vncProperties::Load(BOOL usersettings)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Entering Load\n"));
-
-	//if (m_dlgvisible) {
-	//	vnclog.Print(LL_INTWARN, VNCLOG("service helper invoked while Properties panel displayed\n"));
-	//	return;
-	//}
-	ResetRegistry();
-
-	if (vncService::RunningAsService()) usersettings=false;
-
-	// sf at 2007 - Vista mode
-	// The WinVNC service mode is not used under Vista (due to Session0 isolation)
-	// Default settings (Service mode) are used when WinVNC app in run under Vista login screen
-	// User settings (loggued user mode) are used when WinVNC app in run in a user session
-	// Todo: Maybe we should additionally check OS version...
-	if (m_server->RunningFromExternalService())
-		usersettings=false;
-
-	m_usersettings = usersettings;
-
-	if (m_usersettings)
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - User mode\n"));
-	else
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Service mode\n"));
-	
-	char username[UNLEN+1];
-	HKEY hkLocal, hkLocalUser, hkDefault;
-	DWORD dw;
-	
-	// NEW (R3) PREFERENCES ALGORITHM
-	// 1.	Look in HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/%username%
-	//		for sysadmin-defined, user-specific settings.
-	// 2.	If not found, fall back to %username%=Default
-	// 3.	If AllowOverrides is set then load settings from
-	//		HKEY_CURRENT_USER/Software/ORL/WinVNC3
-
-	// GET THE CORRECT KEY TO READ FROM
-
-	// Get the user name / service name
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - NO current user\n"));
-		return;
-	}
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Force USER SYSTEM 1\n"));
-		strcpy((char *)&username, "SYSTEM");
-	}
-
-
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - UserName = %s\n"), username);
-
-	// Try to get the machine registry key for WinVNC
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		WINVNC_REGISTRY_KEY,
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		hkLocalUser=NULL;
-		hkDefault=NULL;
-		goto LABELUSERSETTINGS;
-		}
-
-	// Now try to get the per-user local key
-	if (RegOpenKeyEx(hkLocal,
-		username,
-		0, KEY_READ,
-		&hkLocalUser) != ERROR_SUCCESS)
-		hkLocalUser = NULL;
-
-	// Get the default key
-	if (RegCreateKeyEx(hkLocal,
-		"Default",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ,
-		NULL,
-		&hkDefault,
-		&dw) != ERROR_SUCCESS)
-		hkDefault = NULL;
-
-	// LOAD THE MACHINE-LEVEL PREFS
-
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Machine level prefs\n"));
-
-	// Logging/debugging prefs
-	vnclog.Print(LL_INTINFO, VNCLOG("loading local-only settings\n"));
-	//vnclog.SetMode(LoadInt(hkLocal, "DebugMode", 0));
-	//vnclog.SetLevel(LoadInt(hkLocal, "DebugLevel", 0));
-
-	// Disable Tray Icon
-	m_server->SetDisableTrayIcon(LoadInt(hkLocal, "DisableTrayIcon", false));
-
-	// Authentication required, loopback allowed, loopbackOnly
-
-	m_server->SetLoopbackOnly(LoadInt(hkLocal, "LoopbackOnly", false));
-
-	m_pref_RequireMSLogon=false;
-	m_pref_RequireMSLogon = LoadInt(hkLocal, "MSLogonRequired", m_pref_RequireMSLogon);
-	m_server->RequireMSLogon(m_pref_RequireMSLogon);
-
-	// Marscha at 2004 - authSSP: added NewMSLogon checkbox to admin props page
-	m_pref_NewMSLogon = false;
-	m_pref_NewMSLogon = LoadInt(hkLocal, "NewMSLogon", m_pref_NewMSLogon);
-	m_server->SetNewMSLogon(m_pref_NewMSLogon);
-
-	// sf at 2003 - Moved DSM params here
-	m_pref_UseDSMPlugin=false;
-	m_pref_UseDSMPlugin = LoadInt(hkLocal, "UseDSMPlugin", m_pref_UseDSMPlugin);
-	LoadDSMPluginName(hkLocal, m_pref_szDSMPlugin);	
-	
-	//adzm 2010-05-12 - dsmplugin config
-	{
-		char* szBuffer = LoadString(hkLocal, "DSMPluginConfig");
-		if (szBuffer) {
-			strncpy_s(m_pref_DSMPluginConfig, sizeof(m_pref_DSMPluginConfig) - 1, szBuffer, _TRUNCATE);
-			delete[] szBuffer;
-		} else {
-			m_pref_DSMPluginConfig[0] = '\0';
-		}
-	}
-
-	if (m_server->LoopbackOnly()) m_server->SetLoopbackOk(true);
-	else m_server->SetLoopbackOk(LoadInt(hkLocal, "AllowLoopback", false));
-	m_server->SetAuthRequired(LoadInt(hkLocal, "AuthRequired", true));
-
-	m_server->SetConnectPriority(LoadInt(hkLocal, "ConnectPriority", 0));
-	if (!m_server->LoopbackOnly())
-	{
-		char *authhosts = LoadString(hkLocal, "AuthHosts");
-		if (authhosts != 0) {
-			m_server->SetAuthHosts(authhosts);
-			delete [] authhosts;
-		} else {
-			m_server->SetAuthHosts(0);
-		}
-	} else {
-		m_server->SetAuthHosts(0);
-	}
-
-	// If Socket connections are allowed, should the HTTP server be enabled?
-LABELUSERSETTINGS:
-	// LOAD THE USER PREFERENCES
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Load User Preferences\n"));
-
-	// Set the default user prefs
-	vnclog.Print(LL_INTINFO, VNCLOG("clearing user settings\n"));
-	m_pref_AutoPortSelect=TRUE;
-    m_pref_HTTPConnect = TRUE;
-	m_pref_XDMCPConnect = TRUE;
-	m_pref_PortNumber = RFB_PORT_OFFSET; 
-	m_pref_SockConnect=TRUE;
-	{
-	    vncPasswd::FromClear crypt;
-	    memcpy(m_pref_passwd, crypt, MAXPWLEN);
-	}
-	m_pref_QuerySetting=2;
-	m_pref_QueryTimeout=10;
-	m_pref_QueryAccept=0;
-	m_pref_IdleTimeout=0;
-	m_pref_EnableRemoteInputs=TRUE;
-	m_pref_DisableLocalInputs=FALSE;
-	m_pref_EnableJapInput=FALSE;
-	m_pref_clearconsole=FALSE;
-	m_pref_LockSettings=-1;
-
-	m_pref_RemoveWallpaper=TRUE;
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	m_pref_RemoveEffects=FALSE;
-	m_pref_RemoveFontSmoothing=FALSE;
-	m_pref_RemoveAero=TRUE;
-    m_alloweditclients = TRUE;
-	m_allowshutdown = TRUE;
-	m_allowproperties = TRUE;
-
-	// Modif sf at 2002
-	// [v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp
-//	m_pref_SingleWindow = FALSE;
-	m_pref_UseDSMPlugin = FALSE;
-	*m_pref_szDSMPlugin = '\0';
-	m_pref_DSMPluginConfig[0] = '\0';
-
-	m_pref_EnableFileTransfer = TRUE;
-	m_pref_FTUserImpersonation = TRUE;
-	m_pref_EnableBlankMonitor = TRUE;
-	m_pref_BlankInputsOnly = FALSE;
-	m_pref_QueryIfNoLogon = FALSE;
-	m_pref_DefaultScale = 1;
-	m_pref_CaptureAlphaBlending = FALSE; 
-	m_pref_BlackAlphaBlending = FALSE; 
-//	m_pref_GammaGray = FALSE;			// [v1.0.2-jp1 fix]
-
-
-	// Load the local prefs for this user
-	if (hkDefault != NULL)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Local Preferences - Default\n"));
-
-		vnclog.Print(LL_INTINFO, VNCLOG("loading DEFAULT local settings\n"));
-		LoadUserPrefs(hkDefault);
-		m_allowshutdown = LoadInt(hkDefault, "AllowShutdown", m_allowshutdown);
-		m_allowproperties = LoadInt(hkDefault, "AllowProperties", m_allowproperties);
-		m_alloweditclients = LoadInt(hkDefault, "AllowEditClients", m_alloweditclients);
-	}
-
-	// Are we being asked to load the user settings, or just the default local system settings?
-	if (usersettings)
-	{
-		// We want the user settings, so load them!
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - User Settings on\n"));
-
-		if (hkLocalUser != NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - LoadUser Preferences\n"));
-
-			vnclog.Print(LL_INTINFO, VNCLOG("loading \"%s\" local settings\n"), username);
-			LoadUserPrefs(hkLocalUser);
-			m_allowshutdown = LoadInt(hkLocalUser, "AllowShutdown", m_allowshutdown);
-			m_allowproperties = LoadInt(hkLocalUser, "AllowProperties", m_allowproperties);
-		  m_alloweditclients = LoadInt(hkLocalUser, "AllowEditClients", m_alloweditclients);
-		}
-
-		// Now override the system settings with the user's settings
-		// If the username is SYSTEM then don't try to load them, because there aren't any...
-		if (m_allowproperties && (strcmp(username, "SYSTEM") != 0))
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Override system settings with users settings\n"));
-			HKEY hkGlobalUser;
-			if (RegCreateKeyEx(HKEY_CURRENT_USER,
-				WINVNC_REGISTRY_KEY,
-				0, REG_NONE, REG_OPTION_NON_VOLATILE,
-				KEY_READ, NULL, &hkGlobalUser, &dw) == ERROR_SUCCESS)
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("loading \"%s\" global settings\n"), username);
-				LoadUserPrefs(hkGlobalUser);
-				RegCloseKey(hkGlobalUser);
-
-				// Close the user registry hive so it can unload if required
-				RegCloseKey(HKEY_CURRENT_USER);
-			}
-		}
-	} else {
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - User Settings off\n"));
-		if (hkLocalUser != NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("loading \"%s\" local settings\n"), username);
-			LoadUserPrefs(hkLocalUser);
-			m_allowshutdown = LoadInt(hkLocalUser, "AllowShutdown", m_allowshutdown);
-			m_allowproperties = LoadInt(hkLocalUser, "AllowProperties", m_allowproperties);
-		    m_alloweditclients = LoadInt(hkLocalUser, "AllowEditClients", m_alloweditclients);
-		}
-		vnclog.Print(LL_INTINFO, VNCLOG("bypassing user-specific settings (both local and global)\n"));
-	}
-
-	if (hkLocalUser != NULL) RegCloseKey(hkLocalUser);
-	if (hkDefault != NULL) RegCloseKey(hkDefault);
-	if (hkLocal != NULL) RegCloseKey(hkLocal);
-
-	// Make the loaded settings active..
-	ApplyUserPrefs();
-}
-
-void
-vncProperties::LoadUserPrefs(HKEY appkey)
-{
-	// LOAD USER PREFS FROM THE SELECTED KEY
-
-	// Modif sf at 2002
-	m_pref_EnableFileTransfer = LoadInt(appkey, "FileTransferEnabled", m_pref_EnableFileTransfer);
-	m_pref_FTUserImpersonation = LoadInt(appkey, "FTUserImpersonation", m_pref_FTUserImpersonation); // sf at 2005
-	m_pref_EnableBlankMonitor = LoadInt(appkey, "BlankMonitorEnabled", m_pref_EnableBlankMonitor);
-	m_pref_BlankInputsOnly = LoadInt(appkey, "BlankInputsOnly", m_pref_BlankInputsOnly); //PGM
-	m_pref_DefaultScale = LoadInt(appkey, "DefaultScale", m_pref_DefaultScale);
-	m_pref_CaptureAlphaBlending = LoadInt(appkey, "CaptureAlphaBlending", m_pref_CaptureAlphaBlending); // sf at 2005
-	m_pref_BlackAlphaBlending = LoadInt(appkey, "BlackAlphaBlending", m_pref_BlackAlphaBlending); // sf at 2005
-	
-	m_pref_Primary=LoadInt(appkey, "primary", m_pref_Primary);
-	m_pref_Secondary=LoadInt(appkey, "secondary", m_pref_Secondary);
-
-	m_pref_UseDSMPlugin = LoadInt(appkey, "UseDSMPlugin", m_pref_UseDSMPlugin);
-	LoadDSMPluginName(appkey, m_pref_szDSMPlugin);
-
-	// Connection prefs
-	m_pref_SockConnect=LoadInt(appkey, "SocketConnect", m_pref_SockConnect);
-	m_pref_HTTPConnect=LoadInt(appkey, "HTTPConnect", m_pref_HTTPConnect);
-	m_pref_XDMCPConnect=LoadInt(appkey, "XDMCPConnect", m_pref_XDMCPConnect);
-	m_pref_AutoPortSelect=LoadInt(appkey, "AutoPortSelect", m_pref_AutoPortSelect);
-	m_pref_PortNumber=LoadInt(appkey, "PortNumber", m_pref_PortNumber);
-	m_pref_HttpPortNumber=LoadInt(appkey, "HTTPPortNumber",
-									DISPLAY_TO_HPORT(PORT_TO_DISPLAY(m_pref_PortNumber)));
-	m_pref_IdleTimeout=LoadInt(appkey, "IdleTimeout", m_pref_IdleTimeout);
-	
-	m_pref_RemoveWallpaper=LoadInt(appkey, "RemoveWallpaper", m_pref_RemoveWallpaper);
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	m_pref_RemoveEffects=LoadInt(appkey, "RemoveEffects", m_pref_RemoveEffects);
-	m_pref_RemoveFontSmoothing=LoadInt(appkey, "RemoveFontSmoothing", m_pref_RemoveFontSmoothing);
-	m_pref_RemoveAero=LoadInt(appkey, "RemoveAero", m_pref_RemoveAero);
-
-	// Connection querying settings
-	m_pref_QuerySetting=LoadInt(appkey, "QuerySetting", m_pref_QuerySetting);
-	m_server->SetQuerySetting(m_pref_QuerySetting);
-	m_pref_QueryTimeout=LoadInt(appkey, "QueryTimeout", m_pref_QueryTimeout);
-	m_server->SetQueryTimeout(m_pref_QueryTimeout);
-	m_pref_QueryAccept=LoadInt(appkey, "QueryAccept", m_pref_QueryAccept);
-	m_server->SetQueryAccept(m_pref_QueryAccept);
-
-	// marscha at 2006 - Is AcceptDialog required even if no user is logged on
-	m_pref_QueryIfNoLogon=LoadInt(appkey, "QueryIfNoLogon", m_pref_QueryIfNoLogon);
-	m_server->SetQueryIfNoLogon(m_pref_QueryIfNoLogon);
-
-	// Load the password
-	LoadPassword(appkey, m_pref_passwd);
-	LoadPassword2(appkey, m_pref_passwd2); //PGM
-
-	// Remote access prefs
-	m_pref_EnableRemoteInputs=LoadInt(appkey, "InputsEnabled", m_pref_EnableRemoteInputs);
-	m_pref_LockSettings=LoadInt(appkey, "LockSetting", m_pref_LockSettings);
-	m_pref_DisableLocalInputs=LoadInt(appkey, "LocalInputsDisabled", m_pref_DisableLocalInputs);
-	m_pref_EnableJapInput=LoadInt(appkey, "EnableJapInput", m_pref_EnableJapInput);
-	m_pref_clearconsole=LoadInt(appkey, "clearconsole", m_pref_clearconsole);
-}
-
-void
-vncProperties::ApplyUserPrefs()
-{
-	// APPLY THE CACHED PREFERENCES TO THE SERVER
-
-	// Modif sf at 2002
-	m_server->EnableFileTransfer(m_pref_EnableFileTransfer);
-	m_server->FTUserImpersonation(m_pref_FTUserImpersonation); // sf at 2005
-	m_server->CaptureAlphaBlending(m_pref_CaptureAlphaBlending); // sf at 2005
-	m_server->BlackAlphaBlending(m_pref_BlackAlphaBlending); // sf at 2005
-	m_server->Primary(m_pref_Primary);
-	m_server->Secondary(m_pref_Secondary);
-
-	m_server->BlankMonitorEnabled(m_pref_EnableBlankMonitor);
-	m_server->BlankInputsOnly(m_pref_BlankInputsOnly); //PGM
-	m_server->SetDefaultScale(m_pref_DefaultScale);
-
-	// Update the connection querying settings
-	m_server->SetQuerySetting(m_pref_QuerySetting);
-	m_server->SetQueryTimeout(m_pref_QueryTimeout);
-	m_server->SetQueryAccept(m_pref_QueryAccept);
-	m_server->SetAutoIdleDisconnectTimeout(m_pref_IdleTimeout);
-	m_server->EnableRemoveWallpaper(m_pref_RemoveWallpaper);
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	m_server->EnableRemoveFontSmoothing(m_pref_RemoveFontSmoothing);
-	m_server->EnableRemoveEffects(m_pref_RemoveEffects);
-	m_server->EnableRemoveAero(m_pref_RemoveAero);
-
-	// Is the listening socket closing?
-
-	if (!m_pref_SockConnect)
-		m_server->SockConnect(m_pref_SockConnect);
-
-	m_server->EnableHTTPConnect(m_pref_HTTPConnect);
-	m_server->EnableXDMCPConnect(m_pref_XDMCPConnect);
-
-	// Are inputs being disabled?
-	if (!m_pref_EnableRemoteInputs)
-		m_server->EnableRemoteInputs(m_pref_EnableRemoteInputs);
-	if (m_pref_DisableLocalInputs)
-		m_server->DisableLocalInputs(m_pref_DisableLocalInputs);
-	if (m_pref_EnableJapInput)
-		m_server->EnableJapInput(m_pref_EnableJapInput);
-	m_server->Clearconsole(m_pref_clearconsole);
-
-	// Update the password
-	m_server->SetPassword(m_pref_passwd);
-	m_server->SetPassword2(m_pref_passwd2); //PGM
-
-	// Now change the listening port settings
-	m_server->SetAutoPortSelect(m_pref_AutoPortSelect);
-	if (!m_pref_AutoPortSelect)
-		// m_server->SetPort(m_pref_PortNumber);
-		m_server->SetPorts(m_pref_PortNumber, m_pref_HttpPortNumber); // Tight 1.2.7
-
-	m_server->SockConnect(m_pref_SockConnect);
-
-
-	// Remote access prefs
-	m_server->EnableRemoteInputs(m_pref_EnableRemoteInputs);
-	m_server->SetLockSettings(m_pref_LockSettings);
-	m_server->DisableLocalInputs(m_pref_DisableLocalInputs);
-	m_server->EnableJapInput(m_pref_EnableJapInput);
-	m_server->Clearconsole(m_pref_clearconsole);
-
-	// DSM Plugin prefs
-	m_server->EnableDSMPlugin(m_pref_UseDSMPlugin);
-	m_server->SetDSMPluginName(m_pref_szDSMPlugin);
-	
-	//adzm 2010-05-12 - dsmplugin config
-	m_server->SetDSMPluginConfig(m_pref_DSMPluginConfig);
-
-	if (m_server->IsDSMPluginEnabled()) 
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ ApplyUserPrefs - Plugin Enabled - Call SetDSMPlugin() \n"));
-		m_server->SetDSMPlugin(false);
-	}
-	else
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ ApplyUserPrefs - Plugin NOT enabled \n"));
-	}
-
-}
-
-void
-vncProperties::SaveInt(HKEY key, LPCSTR valname, LONG val)
-{
-	RegSetValueEx(key, valname, 0, REG_DWORD, (LPBYTE) &val, sizeof(val));
-}
-
-void
-vncProperties::SavePassword(HKEY key, char *buffer)
-{
-	RegSetValueEx(key, "Password", 0, REG_BINARY, (LPBYTE) buffer, MAXPWLEN);
-}
-void //PGM
-vncProperties::SavePassword2(HKEY key, char *buffer) //PGM
-{ //PGM
-	RegSetValueEx(key, "Password2", 0, REG_BINARY, (LPBYTE) buffer, MAXPWLEN); //PGM
-} //PGM
-void
-vncProperties::SaveString(HKEY key,LPCSTR valname, const char *buffer)
-{
-	RegSetValueEx(key, valname, 0, REG_BINARY, (LPBYTE) buffer, strlen(buffer)+1);
-}
-
-void
-vncProperties::SaveDSMPluginName(HKEY key, char *buffer)
-{
-	RegSetValueEx(key, "DSMPlugin", 0, REG_BINARY, (LPBYTE) buffer, MAXPATH);
-}
-
-void
-vncProperties::LoadDSMPluginName(HKEY key, char *buffer)
-{
-	DWORD type = REG_BINARY;
-	int slen=MAXPATH;
-	char inouttext[MAXPATH];
-
-	if (RegQueryValueEx(key,
-		"DSMPlugin",
-		NULL,
-		&type,
-		(LPBYTE) &inouttext,
-		(LPDWORD) &slen) != ERROR_SUCCESS)
-		return;
-
-	if (slen > MAXPATH)
-		return;
-
-	memcpy(buffer, inouttext, MAXPATH);
-}
-
-void
-vncProperties::Save()
-{
-	HKEY appkey;
-	DWORD dw;
-
-	if (!m_allowproperties)
-		return;
-
-	// NEW (R3) PREFERENCES ALGORITHM
-	// The user's prefs are only saved if the user is allowed to override
-	// the machine-local settings specified for them.  Otherwise, the
-	// properties entry on the tray icon menu will be greyed out.
-
-	// GET THE CORRECT KEY TO READ FROM
-
-	// Have we loaded user settings, or system settings?
-	if (m_usersettings) {
-		// Verify that we know who is logged on
-		char username[UNLEN+1];
-		if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-			return;
-		if (strcmp(username, "") == 0)
-			return;
-
-		// Try to get the per-user, global registry key for WinVNC
-		if (RegCreateKeyEx(HKEY_CURRENT_USER,
-			WINVNC_REGISTRY_KEY,
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ, NULL, &appkey, &dw) != ERROR_SUCCESS)
-			return;
-	} else {
-		// Try to get the default local registry key for WinVNC
-		HKEY hkLocal;
-		if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-			WINVNC_REGISTRY_KEY,
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS) {
-			MessageBoxSecure(NULL, sz_ID_MB1, sz_ID_WVNC, MB_OK);
-			return;
-		}
-
-		if (RegCreateKeyEx(hkLocal,
-			"Default",
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ, NULL, &appkey, &dw) != ERROR_SUCCESS) {
-			RegCloseKey(hkLocal);
-			return;
-		}
-		RegCloseKey(hkLocal);
-	}
-
-	// SAVE PER-USER PREFS IF ALLOWED
-	SaveUserPrefs(appkey);
-	RegCloseKey(appkey);
-	RegCloseKey(HKEY_CURRENT_USER);
-
-	// Machine Preferences
-	// Get the machine registry key for WinVNC
-	HKEY hkLocal,hkDefault;
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		WINVNC_REGISTRY_KEY,
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_WRITE | KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		return;
-	if (RegCreateKeyEx(hkLocal,
-		"Default",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_WRITE | KEY_READ,
-		NULL,
-		&hkDefault,
-		&dw) != ERROR_SUCCESS)
-		hkDefault = NULL;
-	// sf at 2003
-	SaveInt(hkLocal, "DebugMode", vnclog.GetMode());
-	SaveInt(hkLocal, "Avilog", vnclog.GetVideo());
-	SaveString(hkLocal, "path", vnclog.GetPath());
-	SaveInt(hkLocal, "DebugLevel", vnclog.GetLevel());
-	SaveInt(hkLocal, "AllowLoopback", m_server->LoopbackOk());
-	SaveInt(hkLocal, "LoopbackOnly", m_server->LoopbackOnly());
-	if (hkDefault) SaveInt(hkDefault, "AllowShutdown", m_allowshutdown);
-	if (hkDefault) SaveInt(hkDefault, "AllowProperties",  m_allowproperties);
-	if (hkDefault) SaveInt(hkDefault, "AllowEditClients", m_alloweditclients);
-
-	SaveInt(hkLocal, "DisableTrayIcon", m_server->GetDisableTrayIcon());
-	SaveInt(hkLocal, "MSLogonRequired", m_server->MSLogonRequired());
-	// Marscha at 2004 - authSSP: save "New MS-Logon" state
-	SaveInt(hkLocal, "NewMSLogon", m_server->GetNewMSLogon());
-	// sf at 2003 - DSM params here
-	SaveInt(hkLocal, "UseDSMPlugin", m_server->IsDSMPluginEnabled());
-	SaveInt(hkLocal, "ConnectPriority", m_server->ConnectPriority());
-	SaveDSMPluginName(hkLocal, m_server->GetDSMPluginName());	
-	
-	//adzm 2010-05-12 - dsmplugin config
-	SaveString(hkLocal, "DSMPluginConfig", m_server->GetDSMPluginConfig());
-
-	if (hkDefault) RegCloseKey(hkDefault);
-	if (hkLocal) RegCloseKey(hkLocal);
-}
-
-void
-vncProperties::SaveUserPrefs(HKEY appkey)
-{
-	// SAVE THE PER USER PREFS
-	vnclog.Print(LL_INTINFO, VNCLOG("saving current settings to registry\n"));
-
-	// Modif sf at 2002
-	SaveInt(appkey, "FileTransferEnabled", m_server->FileTransferEnabled());
-	SaveInt(appkey, "FTUserImpersonation", m_server->FTUserImpersonation()); // sf at 2005
-	SaveInt(appkey, "BlankMonitorEnabled", m_server->BlankMonitorEnabled());
-	SaveInt(appkey, "BlankInputsOnly", m_server->BlankInputsOnly()); //PGM
-	SaveInt(appkey, "CaptureAlphaBlending", m_server->CaptureAlphaBlending()); // sf at 2005
-	SaveInt(appkey, "BlackAlphaBlending", m_server->BlackAlphaBlending()); // sf at 2005
-	SaveInt(appkey, "primary", m_server->Primary());
-	SaveInt(appkey, "secondary", m_server->Secondary());
-
-	SaveInt(appkey, "DefaultScale", m_server->GetDefaultScale());
-
-	SaveInt(appkey, "UseDSMPlugin", m_server->IsDSMPluginEnabled());
-	SaveDSMPluginName(appkey, m_server->GetDSMPluginName());
-	//adzm 2010-05-12 - dsmplugin config
-	SaveString(appkey, "DSMPluginConfig", m_server->GetDSMPluginConfig());
-
-	// Connection prefs
-	SaveInt(appkey, "SocketConnect", m_server->SockConnected());
-	SaveInt(appkey, "HTTPConnect", m_server->HTTPConnectEnabled());
-	SaveInt(appkey, "XDMCPConnect", m_server->XDMCPConnectEnabled());
-	SaveInt(appkey, "AutoPortSelect", m_server->AutoPortSelect());
-	if (!m_server->AutoPortSelect()) {
-		SaveInt(appkey, "PortNumber", m_server->GetPort());
-		SaveInt(appkey, "HTTPPortNumber", m_server->GetHttpPort());
-	}
-	SaveInt(appkey, "InputsEnabled", m_server->RemoteInputsEnabled());
-	SaveInt(appkey, "LocalInputsDisabled", m_server->LocalInputsDisabled());
-	SaveInt(appkey, "IdleTimeout", m_server->AutoIdleDisconnectTimeout());
-	SaveInt(appkey, "EnableJapInput", m_server->JapInputEnabled());
-
-	// Connection querying settings
-	SaveInt(appkey, "QuerySetting", m_server->QuerySetting());
-	SaveInt(appkey, "QueryTimeout", m_server->QueryTimeout());
-	SaveInt(appkey, "QueryAccept", m_server->QueryAccept());
-
-	// Lock settings
-	SaveInt(appkey, "LockSetting", m_server->LockSettings());
-
-	// Wallpaper removal
-	SaveInt(appkey, "RemoveWallpaper", m_server->RemoveWallpaperEnabled());
-	// UI Effects
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	SaveInt(appkey, "RemoveEffects", m_server->RemoveEffectsEnabled());
-	SaveInt(appkey, "RemoveFontSmoothing", m_server->RemoveFontSmoothingEnabled());
-	// Composit desktop removal
-	SaveInt(appkey, "RemoveAero", m_server->RemoveAeroEnabled());
-
-	// Save the password
-	char passwd[MAXPWLEN];
-	m_server->GetPassword(passwd);
-	SavePassword(appkey, passwd);
-	memset(passwd, '\0', MAXPWLEN); //PGM
-	m_server->GetPassword2(passwd); //PGM
-	SavePassword2(appkey, passwd); //PGM
-}
-
-
-// ********************************************************************
-// Ini file part - Wwill replace registry access completely, some day
-// WARNING: until then, when adding/modifying a config parameter
-//          don't forget to modify both ini file & registry parts !
-// ********************************************************************
-
-void vncProperties::LoadFromIniFile()
-{
-	//if (m_dlgvisible)
-	//{
-	//	vnclog.Print(LL_INTWARN, VNCLOG("service helper invoked while Properties panel displayed\n"));
-	//	return;
-	//}
-
-	char username[UNLEN+1];
-
-	// Get the user name / service name
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - NO current user\n"));
-		return;
-	}
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Force USER SYSTEM 2\n"));
-		strcpy((char *)&username, "SYSTEM");
-	}
-
-	// Logging/debugging prefs
-	vnclog.SetMode(myIniFile.ReadInt("admin", "DebugMode", 0));
-	char temp[512];
-	myIniFile.ReadString("admin", "path", temp,512);
-	vnclog.SetPath(temp);
-	vnclog.SetLevel(myIniFile.ReadInt("admin", "DebugLevel", 0));
-	vnclog.SetVideo(myIniFile.ReadInt("admin", "Avilog", 0) ? true : false);
-
-	// Disable Tray Icon
-	m_server->SetDisableTrayIcon(myIniFile.ReadInt("admin", "DisableTrayIcon", false));
-
-	// Authentication required, loopback allowed, loopbackOnly
-
-	m_server->SetLoopbackOnly(myIniFile.ReadInt("admin", "LoopbackOnly", false));
-
-	m_pref_RequireMSLogon=false;
-	m_pref_RequireMSLogon = myIniFile.ReadInt("admin", "MSLogonRequired", m_pref_RequireMSLogon);
-	m_server->RequireMSLogon(m_pref_RequireMSLogon);
-
-	// Marscha at 2004 - authSSP: added NewMSLogon checkbox to admin props page
-	m_pref_NewMSLogon = false;
-	m_pref_NewMSLogon = myIniFile.ReadInt("admin", "NewMSLogon", m_pref_NewMSLogon);
-	m_server->SetNewMSLogon(m_pref_NewMSLogon);
-
-	// sf at 2003 - Moved DSM params here
-	m_pref_UseDSMPlugin=false;
-	m_pref_UseDSMPlugin = myIniFile.ReadInt("admin", "UseDSMPlugin", m_pref_UseDSMPlugin);
-	myIniFile.ReadString("admin", "DSMPlugin",m_pref_szDSMPlugin,128);
-	
-	//adzm 2010-05-12 - dsmplugin config
-	myIniFile.ReadString("admin", "DSMPluginConfig", m_pref_DSMPluginConfig, 512);
-
-	if (m_server->LoopbackOnly()) m_server->SetLoopbackOk(true);
-	else m_server->SetLoopbackOk(myIniFile.ReadInt("admin", "AllowLoopback", false));
-	m_server->SetAuthRequired(myIniFile.ReadInt("admin", "AuthRequired", true));
-
-	m_server->SetConnectPriority(myIniFile.ReadInt("admin", "ConnectPriority", 0));
-	if (!m_server->LoopbackOnly())
-	{
-		char *authhosts=new char[150];
-		myIniFile.ReadString("admin", "AuthHosts",authhosts,150);
-		if (authhosts != 0) {
-			m_server->SetAuthHosts(authhosts);
-			delete [] authhosts;
-		} else {
-			m_server->SetAuthHosts(0);
-		}
-	} else {
-		m_server->SetAuthHosts(0);
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Load User Preferences\n"));
-
-	// Set the default user prefs
-	vnclog.Print(LL_INTINFO, VNCLOG("clearing user settings\n"));
-	m_pref_AutoPortSelect=TRUE;
-    m_pref_HTTPConnect = TRUE;
-	m_pref_XDMCPConnect = TRUE;
-	m_pref_PortNumber = RFB_PORT_OFFSET; 
-	m_pref_SockConnect=TRUE;
-	{
-	    vncPasswd::FromClear crypt;
-	    memcpy(m_pref_passwd, crypt, MAXPWLEN);
-	}
-	m_pref_QuerySetting=2;
-	m_pref_QueryTimeout=10;
-	m_pref_QueryAccept=0;
-	m_pref_IdleTimeout=0;
-	m_pref_EnableRemoteInputs=TRUE;
-	m_pref_DisableLocalInputs=FALSE;
-	m_pref_EnableJapInput=FALSE;
-	m_pref_clearconsole=FALSE;
-	m_pref_LockSettings=-1;
-
-	m_pref_RemoveWallpaper=TRUE;
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	m_pref_RemoveEffects=FALSE;
-	m_pref_RemoveFontSmoothing=FALSE;
-	m_pref_RemoveAero=TRUE;
-    m_alloweditclients = TRUE;
-	m_allowshutdown = TRUE;
-	m_allowproperties = TRUE;
-
-	// Modif sf at 2002
-	m_pref_SingleWindow = FALSE;
-	m_pref_UseDSMPlugin = FALSE;
-	*m_pref_szDSMPlugin = '\0';
-	m_pref_DSMPluginConfig[0] = '\0';
-
-	m_pref_EnableFileTransfer = TRUE;
-	m_pref_FTUserImpersonation = TRUE;
-	m_pref_EnableBlankMonitor = TRUE;
-	m_pref_BlankInputsOnly = FALSE;
-	m_pref_QueryIfNoLogon = FALSE;
-	m_pref_DefaultScale = 1;
-	m_pref_CaptureAlphaBlending = FALSE; 
-	m_pref_BlackAlphaBlending = FALSE; 
-
-	LoadUserPrefsFromIniFile();
-	m_allowshutdown = myIniFile.ReadInt("admin", "AllowShutdown", m_allowshutdown);
-	m_allowproperties = myIniFile.ReadInt("admin", "AllowProperties", m_allowproperties);
-	m_alloweditclients = myIniFile.ReadInt("admin", "AllowEditClients", m_alloweditclients);
-
-    m_ftTimeout = myIniFile.ReadInt("admin", "FileTransferTimeout", m_ftTimeout);
-    if (m_ftTimeout > 60)
-        m_ftTimeout = 60;
-
-    m_keepAliveInterval = myIniFile.ReadInt("admin", "KeepAliveInterval", m_keepAliveInterval);
-    if (m_keepAliveInterval >= (m_ftTimeout - KEEPALIVE_HEADROOM))
-        m_keepAliveInterval = m_ftTimeout - KEEPALIVE_HEADROOM;
-
-	// adzm 2010-08
-	m_socketKeepAliveTimeout = myIniFile.ReadInt("admin", "SocketKeepAliveTimeout", m_socketKeepAliveTimeout); 
-	if (m_socketKeepAliveTimeout < 0) m_socketKeepAliveTimeout = 0;
-
-    m_server->SetFTTimeout(m_ftTimeout);
-    m_server->SetKeepAliveInterval(m_keepAliveInterval);
-	m_server->SetSocketKeepAliveTimeout(m_socketKeepAliveTimeout); // adzm 2010-08
-    
-
-	ApplyUserPrefs();
-}
-
-
-void vncProperties::LoadUserPrefsFromIniFile()
-{
-	// Modif sf at 2002
-	m_pref_EnableFileTransfer = myIniFile.ReadInt("admin", "FileTransferEnabled", m_pref_EnableFileTransfer);
-	m_pref_FTUserImpersonation = myIniFile.ReadInt("admin", "FTUserImpersonation", m_pref_FTUserImpersonation); // sf at 2005
-	m_pref_EnableBlankMonitor = myIniFile.ReadInt("admin", "BlankMonitorEnabled", m_pref_EnableBlankMonitor);
-	m_pref_BlankInputsOnly = myIniFile.ReadInt("admin", "BlankInputsOnly", m_pref_BlankInputsOnly); //PGM
-	m_pref_DefaultScale = myIniFile.ReadInt("admin", "DefaultScale", m_pref_DefaultScale);
-	m_pref_CaptureAlphaBlending = myIniFile.ReadInt("admin", "CaptureAlphaBlending", m_pref_CaptureAlphaBlending); // sf at 2005
-	m_pref_BlackAlphaBlending = myIniFile.ReadInt("admin", "BlackAlphaBlending", m_pref_BlackAlphaBlending); // sf at 2005
-
-	m_pref_UseDSMPlugin = myIniFile.ReadInt("admin", "UseDSMPlugin", m_pref_UseDSMPlugin);
-	myIniFile.ReadString("admin", "DSMPlugin",m_pref_szDSMPlugin,128);
-	
-	//adzm 2010-05-12 - dsmplugin config
-	myIniFile.ReadString("admin", "DSMPluginConfig", m_pref_DSMPluginConfig, 512);
-	
-	m_pref_Primary = myIniFile.ReadInt("admin", "primary", m_pref_Primary);
-	m_pref_Secondary = myIniFile.ReadInt("admin", "secondary", m_pref_Secondary);
-
-	// Connection prefs
-	m_pref_SockConnect=myIniFile.ReadInt("admin", "SocketConnect", m_pref_SockConnect);
-	m_pref_HTTPConnect=myIniFile.ReadInt("admin", "HTTPConnect", m_pref_HTTPConnect);
-	m_pref_XDMCPConnect=myIniFile.ReadInt("admin", "XDMCPConnect", m_pref_XDMCPConnect);
-	m_pref_AutoPortSelect=myIniFile.ReadInt("admin", "AutoPortSelect", m_pref_AutoPortSelect);
-	m_pref_PortNumber=myIniFile.ReadInt("admin", "PortNumber", m_pref_PortNumber);
-	m_pref_HttpPortNumber=myIniFile.ReadInt("admin", "HTTPPortNumber",
-									DISPLAY_TO_HPORT(PORT_TO_DISPLAY(m_pref_PortNumber)));
-	m_pref_IdleTimeout=myIniFile.ReadInt("admin", "IdleTimeout", m_pref_IdleTimeout);
-	
-	m_pref_RemoveWallpaper=myIniFile.ReadInt("admin", "RemoveWallpaper", m_pref_RemoveWallpaper);
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	m_pref_RemoveEffects=myIniFile.ReadInt("admin", "RemoveEffects", m_pref_RemoveEffects);
-	m_pref_RemoveFontSmoothing=myIniFile.ReadInt("admin", "RemoveFontSmoothing", m_pref_RemoveFontSmoothing);
-	m_pref_RemoveAero=myIniFile.ReadInt("admin", "RemoveAero", m_pref_RemoveAero);
-
-	// Connection querying settings
-	m_pref_QuerySetting=myIniFile.ReadInt("admin", "QuerySetting", m_pref_QuerySetting);
-	m_server->SetQuerySetting(m_pref_QuerySetting);
-	m_pref_QueryTimeout=myIniFile.ReadInt("admin", "QueryTimeout", m_pref_QueryTimeout);
-	m_server->SetQueryTimeout(m_pref_QueryTimeout);
-	m_pref_QueryAccept=myIniFile.ReadInt("admin", "QueryAccept", m_pref_QueryAccept);
-	m_server->SetQueryAccept(m_pref_QueryAccept);
-
-	// marscha at 2006 - Is AcceptDialog required even if no user is logged on
-	m_pref_QueryIfNoLogon=myIniFile.ReadInt("admin", "QueryIfNoLogon", m_pref_QueryIfNoLogon);
-	m_server->SetQueryIfNoLogon(m_pref_QueryIfNoLogon);
-
-	// Load the password
-	myIniFile.ReadPassword(m_pref_passwd,MAXPWLEN);
-	myIniFile.ReadPassword2(m_pref_passwd2,MAXPWLEN); //PGM
-
-	// Remote access prefs
-	m_pref_EnableRemoteInputs=myIniFile.ReadInt("admin", "InputsEnabled", m_pref_EnableRemoteInputs);
-	m_pref_LockSettings=myIniFile.ReadInt("admin", "LockSetting", m_pref_LockSettings);
-	m_pref_DisableLocalInputs=myIniFile.ReadInt("admin", "LocalInputsDisabled", m_pref_DisableLocalInputs);
-	m_pref_EnableJapInput=myIniFile.ReadInt("admin", "EnableJapInput", m_pref_EnableJapInput);
-	m_pref_clearconsole=myIniFile.ReadInt("admin", "clearconsole", m_pref_clearconsole);
-	G_SENDBUFFER=myIniFile.ReadInt("admin", "sendbuffer", G_SENDBUFFER);
-}
-
-
-void vncProperties::SaveToIniFile()
-{
-	if (!m_allowproperties)
-		return;
-
-	// SAVE PER-USER PREFS IF ALLOWED
-	bool use_uac=false;
-	if (!myIniFile.IsWritable()  || vncService::RunningAsService())
-			{
-				// We can't write to the ini file , Vista in service mode
-				if (!Copy_to_Temp( m_Tempfile)) return;
-				myIniFile.IniFileSetTemp( m_Tempfile);
-				use_uac=true;
-			}
-
-	SaveUserPrefsToIniFile();
-	myIniFile.WriteInt("admin", "DebugMode", vnclog.GetMode());
-	myIniFile.WriteInt("admin", "Avilog", vnclog.GetVideo());
-	myIniFile.WriteString("admin", "path", vnclog.GetPath());
-	myIniFile.WriteInt("admin", "DebugLevel", vnclog.GetLevel());
-	myIniFile.WriteInt("admin", "AllowLoopback", m_server->LoopbackOk());
-	myIniFile.WriteInt("admin", "LoopbackOnly", m_server->LoopbackOnly());
-	myIniFile.WriteInt("admin", "AllowShutdown", m_allowshutdown);
-	myIniFile.WriteInt("admin", "AllowProperties",  m_allowproperties);
-	myIniFile.WriteInt("admin", "AllowEditClients", m_alloweditclients);
-    myIniFile.WriteInt("admin", "FileTransferTimeout", m_ftTimeout);
-    myIniFile.WriteInt("admin", "KeepAliveInterval", m_keepAliveInterval);
-	// adzm 2010-08
-    myIniFile.WriteInt("admin", "SocketKeepAliveTimeout", m_socketKeepAliveTimeout);
-
-	myIniFile.WriteInt("admin", "DisableTrayIcon", m_server->GetDisableTrayIcon());
-	myIniFile.WriteInt("admin", "MSLogonRequired", m_server->MSLogonRequired());
-	// Marscha at 2004 - authSSP: save "New MS-Logon" state
-	myIniFile.WriteInt("admin", "NewMSLogon", m_server->GetNewMSLogon());
-	// sf at 2003 - DSM params here
-	myIniFile.WriteInt("admin", "UseDSMPlugin", m_server->IsDSMPluginEnabled());
-	myIniFile.WriteInt("admin", "ConnectPriority", m_server->ConnectPriority());
-	myIniFile.WriteString("admin", "DSMPlugin",m_server->GetDSMPluginName());
-
-	//adzm 2010-05-12 - dsmplugin config
-	myIniFile.WriteString("admin", "DSMPluginConfig", m_server->GetDSMPluginConfig());
-
-	if (use_uac==true)
-	{
-	myIniFile.copy_to_secure();
-	myIniFile.IniFileSetSecure();
-	}
-}
-
-
-void vncProperties::SaveUserPrefsToIniFile()
-{
-	// SAVE THE PER USER PREFS
-	vnclog.Print(LL_INTINFO, VNCLOG("saving current settings to registry\n"));
-
-	// Modif sf at 2002
-	myIniFile.WriteInt("admin", "FileTransferEnabled", m_server->FileTransferEnabled());
-	myIniFile.WriteInt("admin", "FTUserImpersonation", m_server->FTUserImpersonation()); // sf at 2005
-	myIniFile.WriteInt("admin", "BlankMonitorEnabled", m_server->BlankMonitorEnabled());
-	myIniFile.WriteInt("admin", "BlankInputsOnly", m_server->BlankInputsOnly()); //PGM
-	myIniFile.WriteInt("admin", "CaptureAlphaBlending", m_server->CaptureAlphaBlending()); // sf at 2005
-	myIniFile.WriteInt("admin", "BlackAlphaBlending", m_server->BlackAlphaBlending()); // sf at 2005
-
-	myIniFile.WriteInt("admin", "DefaultScale", m_server->GetDefaultScale());
-
-	myIniFile.WriteInt("admin", "UseDSMPlugin", m_server->IsDSMPluginEnabled());
-	myIniFile.WriteString("admin", "DSMPlugin",m_server->GetDSMPluginName());
-
-	//adzm 2010-05-12 - dsmplugin config
-	myIniFile.WriteString("admin", "DSMPluginConfig", m_server->GetDSMPluginConfig());
-
-	myIniFile.WriteInt("admin", "primary", m_server->Primary());
-	myIniFile.WriteInt("admin", "secondary", m_server->Secondary());
-
-	// Connection prefs
-	myIniFile.WriteInt("admin", "SocketConnect", m_server->SockConnected());
-	myIniFile.WriteInt("admin", "HTTPConnect", m_server->HTTPConnectEnabled());
-	myIniFile.WriteInt("admin", "XDMCPConnect", m_server->XDMCPConnectEnabled());
-	myIniFile.WriteInt("admin", "AutoPortSelect", m_server->AutoPortSelect());
-	if (!m_server->AutoPortSelect()) {
-		myIniFile.WriteInt("admin", "PortNumber", m_server->GetPort());
-		myIniFile.WriteInt("admin", "HTTPPortNumber", m_server->GetHttpPort());
-	}
-	myIniFile.WriteInt("admin", "InputsEnabled", m_server->RemoteInputsEnabled());
-	myIniFile.WriteInt("admin", "LocalInputsDisabled", m_server->LocalInputsDisabled());
-	myIniFile.WriteInt("admin", "IdleTimeout", m_server->AutoIdleDisconnectTimeout());
-	myIniFile.WriteInt("admin", "EnableJapInput", m_server->JapInputEnabled());
-
-	// Connection querying settings
-	myIniFile.WriteInt("admin", "QuerySetting", m_server->QuerySetting());
-	myIniFile.WriteInt("admin", "QueryTimeout", m_server->QueryTimeout());
-	myIniFile.WriteInt("admin", "QueryAccept", m_server->QueryAccept());
-
-	// Lock settings
-	myIniFile.WriteInt("admin", "LockSetting", m_server->LockSettings());
-
-	// Wallpaper removal
-	myIniFile.WriteInt("admin", "RemoveWallpaper", m_server->RemoveWallpaperEnabled());
-	// UI Effects
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	myIniFile.WriteInt("admin", "RemoveEffects", m_server->RemoveEffectsEnabled());
-	myIniFile.WriteInt("admin", "RemoveFontSmoothing", m_server->RemoveFontSmoothingEnabled());
-	// Composit desktop removal
-	myIniFile.WriteInt("admin", "RemoveAero", m_server->RemoveAeroEnabled());
-
-	// Save the password
-	char passwd[MAXPWLEN];
-	m_server->GetPassword(passwd);
-	myIniFile.WritePassword(passwd);
-	memset(passwd, '\0', MAXPWLEN); //PGM
-	m_server->GetPassword2(passwd); //PGM
-	myIniFile.WritePassword2(passwd); //PGM
-}
-
-
-void vncProperties::ReloadDynamicSettings()
-{
-	char username[UNLEN+1];
-
-	// Get the user name / service name
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - NO current user\n"));
-		return;
-	}
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Force USER SYSTEM 2\n"));
-		strcpy((char *)&username, "SYSTEM");
-	}
-
-	// Logging/debugging prefs
-	vnclog.SetMode(myIniFile.ReadInt("admin", "DebugMode", 0));
-	vnclog.SetLevel(myIniFile.ReadInt("admin", "DebugLevel", 0));
-}
diff --git a/ica/win32/winvnc/winvnc/vncproperties.h b/ica/win32/winvnc/winvnc/vncproperties.h
deleted file mode 100644
index 0b8ba53..0000000
--- a/ica/win32/winvnc/winvnc/vncproperties.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-
-class vncProperties;
-
-#if (!defined(_WINVNC_VNCPROPERTIES))
-#define _WINVNC_VNCPROPERTIES
-
-// Includes
-// Marscha at 2004 - authSSP: objbase.h needed for CoInitialize etc.
-#include <objbase.h>
-
-#include "stdhdrs.h"
-#include "vncserver.h"
-#include "vncsetauth.h"
-#include "inifile.h"
-#include <userenv.h>
-// The vncProperties class itself
-class vncProperties
-{
-public:
-	// Constructor/destructor
-	vncProperties();
-	~vncProperties();
-
-	// Initialisation
-	BOOL Init(vncServer *server);
-
-	// The dialog box window proc
-	static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-	// Display the properties dialog
-	// If usersettings is TRUE then the per-user settings come up
-	// If usersettings is FALSE then the default system settings come up
-	void ShowAdmin(BOOL show, BOOL usersettings);
-
-	// Loading & saving of preferences
-	void Load(BOOL usersettings);
-	void ResetRegistry();
-
-	void Save();
-
-
-	// TRAY ICON MENU SETTINGS
-	BOOL AllowProperties() {return m_allowproperties;};
-	BOOL AllowShutdown() {return m_allowshutdown;};
-	BOOL AllowEditClients() {return m_alloweditclients;};
-	bool Lock_service_helper;
-
-	BOOL m_fUseRegistry;
-	// Ini file
-	IniFile myIniFile;
-	void LoadFromIniFile();
-	void LoadUserPrefsFromIniFile();
-	void SaveToIniFile();
-	void SaveUserPrefsToIniFile();
-    void ReloadDynamicSettings();
-
-	// Implementation
-protected:
-	// The server object to which this properties object is attached.
-	vncServer *			m_server;
-
-	// Flag to indicate whether the currently loaded settings are for
-	// the current user, or are default system settings
-	BOOL				m_usersettings;
-
-	// Tray icon menu settings
-	BOOL				m_allowproperties;
-	BOOL				m_allowshutdown;
-	BOOL				m_alloweditclients;
-    int                 m_ftTimeout;
-    int                 m_keepAliveInterval;
-	int                 m_socketKeepAliveTimeout; // adzm 2010-08
-
-
-	// Password handling
-	void LoadPassword(HKEY k, char *buffer);
-	void SavePassword(HKEY k, char *buffer);
-	void LoadPassword2(HKEY k, char *buffer); //PGM
-	void SavePassword2(HKEY k, char *buffer); //PGM
-
-	// String handling
-	char * LoadString(HKEY k, LPCSTR valname);
-	void SaveString(HKEY k, LPCSTR valname, const char *buffer);
-
-	// Manipulate the registry settings
-	LONG LoadInt(HKEY key, LPCSTR valname, LONG defval);
-	void SaveInt(HKEY key, LPCSTR valname, LONG val);
-
-	// Loading/saving all the user prefs
-	void LoadUserPrefs(HKEY appkey);
-	void SaveUserPrefs(HKEY appkey);
-
-	// Making the loaded user prefs active
-	void ApplyUserPrefs();
-	
-	BOOL m_returncode_valid;
-	BOOL m_dlgvisible;
-
-	// STORAGE FOR THE PROPERTIES PRIOR TO APPLICATION
-	BOOL m_pref_SockConnect;
-	BOOL m_pref_HTTPConnect;
-	BOOL m_pref_XDMCPConnect;
-	BOOL m_pref_AutoPortSelect;
-	LONG m_pref_PortNumber;
-	LONG m_pref_HttpPortNumber;  // TightVNC 1.1.7
-	char m_pref_passwd[MAXPWLEN];
-	char m_pref_passwd2[MAXPWLEN]; //PGM
-	UINT m_pref_QuerySetting;
-	// Marscha at 2006 - Is AcceptDialog required even if no user is logged on
-	UINT m_pref_QueryIfNoLogon;
-	UINT m_pref_QueryAccept;
-	UINT m_pref_QueryTimeout;
-	UINT m_pref_IdleTimeout;
-	BOOL m_pref_RemoveWallpaper;
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	BOOL m_pref_RemoveEffects;
-	BOOL m_pref_RemoveFontSmoothing;
-	BOOL m_pref_RemoveAero;
-	BOOL m_pref_EnableRemoteInputs;
-	int m_pref_LockSettings;
-	BOOL m_pref_DisableLocalInputs;
-	BOOL m_pref_EnableJapInput;
-	BOOL m_pref_clearconsole;
-
-	// Modif sf at 2002
-	// [v1.0.2-jp2 fix]
-	BOOL m_pref_SingleWindow;
-	BOOL m_pref_EnableFileTransfer;
-	BOOL m_pref_FTUserImpersonation;
-	BOOL m_pref_EnableBlankMonitor;
-	BOOL m_pref_BlankInputsOnly; //PGM
-	int  m_pref_DefaultScale;
-	BOOL m_pref_RequireMSLogon;
-	BOOL m_pref_CaptureAlphaBlending;
-	BOOL m_pref_BlackAlphaBlending;
-//	BOOL m_pref_GammaGray;	// [v1.0.2-jp1 fix1]
-
-	
-	// Marscha at 2004 - authSSP: added state of "New MS-Logon"
-	BOOL m_pref_NewMSLogon;
-
-	BOOL m_pref_UseDSMPlugin;
-	char m_pref_szDSMPlugin[128];
-	//adzm 2010-05-12 - dsmplugin config
-	char m_pref_DSMPluginConfig[512];
-
-    void LoadDSMPluginName(HKEY key, char *buffer);
-	void SaveDSMPluginName(HKEY key, char *buffer); 
-	vncSetAuth		m_vncauth;
-
-	char m_pref_path111[500];
-	char m_Tempfile[MAX_PATH];
-	BOOL m_pref_Primary;
-	BOOL m_pref_Secondary;
-
-private:
-	void InitPortSettings(HWND hwnd); // TightVNC 1.1.7
-
-
-};
-
-#endif // _WINVNC_VNCPROPERTIES
diff --git a/ica/win32/winvnc/winvnc/vncpropertiesPoll.cpp b/ica/win32/winvnc/winvnc/vncpropertiesPoll.cpp
deleted file mode 100644
index e2d8f02..0000000
--- a/ica/win32/winvnc/winvnc/vncpropertiesPoll.cpp
+++ /dev/null
@@ -1,1049 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 TightVNC. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncPropertiesPoll.cpp
-
-// Implementation of the Properties dialog!
-
-#include "stdhdrs.h"
-#include "lmcons.h"
-#include "vncservice.h"
-
-#include "winvnc.h"
-#include "vncpropertiesPoll.h"
-#include "vncserver.h"
-#include "vncOSVersion.h"
-#include "common/win32_helpers.h"
-
-
-#include "Localization.h" // ACT : Add localization on messages
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-bool RunningAsAdministrator ();
-const char WINVNC_REGISTRY_KEY [] = "Software\\ORL\\WinVNC3";
-DWORD GetExplorerLogonPid();
-
-// Constructor & Destructor
-vncPropertiesPoll::vncPropertiesPoll()
-{
-	m_dlgvisible = FALSE;
-	m_usersettings = TRUE;
-}
-
-vncPropertiesPoll::~vncPropertiesPoll()
-{
-}
-
-// Initialisation
-BOOL
-vncPropertiesPoll::Init(vncServer *server)
-{
-	// Save the server pointer
-	m_server = server;	
-
-	// sf at 2007 - Registry mode can still be forced for backward compatibility and OS version < Vista
-	m_fUseRegistry = TRUE;//((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-
-	// Load the settings
-	if (m_fUseRegistry)
-		Load(TRUE);
-	else
-		LoadFromIniFile();
-
-	return TRUE;
-}
-
-// Dialog box handling functions
-void
-vncPropertiesPoll::Show(BOOL show, BOOL usersettings)
-{
-	HANDLE hProcess=NULL;
-	HANDLE hPToken=NULL;
-	//DWORD id=GetExplorerLogonPid();
-	int iImpersonateResult=0;
-	{
-		char WORKDIR[MAX_PATH];
-		if (!GetTempPath(MAX_PATH,WORKDIR))
-			{
-				//Function failed, just set something
-				if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-				{
-					char* p = strrchr(WORKDIR, '\\');
-					if (p == NULL) return;
-					*p = '\0';
-				}
-					strcpy(m_Tempfile,"");
-					strcat(m_Tempfile,WORKDIR);//set the directory
-					strcat(m_Tempfile,"\\");
-					strcat(m_Tempfile,INIFILE_NAME);
-		}
-		else
-		{
-			strcpy(m_Tempfile,"");
-			strcat(m_Tempfile,WORKDIR);//set the directory
-			strcat(m_Tempfile,INIFILE_NAME);
-		}
-	}
-/*	if (id!=0) 
-			{
-				hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,id);
-				if(OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-										|TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-										|TOKEN_READ|TOKEN_WRITE,&hPToken))
-				{
-					ImpersonateLoggedOnUser(hPToken);
-					iImpersonateResult = GetLastError();
-					if(iImpersonateResult == ERROR_SUCCESS)
-					{
-						ExpandEnvironmentStringsForUser(hPToken, "%TEMP%", m_Tempfile, MAX_PATH);
-						strcat(m_Tempfile,"\\");
-						strcat(m_Tempfile,INIFILE_NAME);
-					}
-				}
-			}*/
-
-	if (show)
-	{
-
-		if (!m_fUseRegistry) // Use the ini file
-		{
-			// We're trying to edit the default local settings - verify that we can
-			/*
-			if (!myIniFile.IsWritable())
-			{
-				if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-				CloseHandle(hProcess);
-				CloseHandle(hPToken);
-				return;
-			}
-			*/
-		}
-		else // Use the registry
-		{
-			// Verify that we know who is logged on
-			if (usersettings) {
-				char username[UNLEN+1];
-				if (!vncService::CurrentUser(username, sizeof(username)))
-				{
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-				if (strcmp(username, "") == 0) {
-					MessageBoxSecure(NULL, sz_ID_NO_CURRENT_USER_ERR, sz_ID_WINVNC_ERROR, MB_OK | MB_ICONEXCLAMATION);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-			} else {
-				// We're trying to edit the default local settings - verify that we can
-				HKEY hkLocal=NULL;
-				HKEY hkDefault=NULL;
-				BOOL canEditDefaultPrefs = 1;
-				DWORD dw;
-				if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-					WINVNC_REGISTRY_KEY,
-					0, REG_NONE, REG_OPTION_NON_VOLATILE,
-					KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-					canEditDefaultPrefs = 0;
-				else if (RegCreateKeyEx(hkLocal,
-					"Default",
-					0, REG_NONE, REG_OPTION_NON_VOLATILE,
-					KEY_WRITE | KEY_READ, NULL, &hkDefault, &dw) != ERROR_SUCCESS)
-					canEditDefaultPrefs = 0;
-				if (hkLocal) RegCloseKey(hkLocal);
-				if (hkDefault) RegCloseKey(hkDefault);
-
-				if (!canEditDefaultPrefs) {
-					MessageBoxSecure(NULL, sz_ID_CANNOT_EDIT_DEFAULT_PREFS, sz_ID_WINVNC_ERROR, MB_OK | MB_ICONEXCLAMATION);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					if (hProcess) CloseHandle(hProcess);
-					if (hPToken) CloseHandle(hPToken);
-					return;
-				}
-			}
-		}
-
-		// Now, if the dialog is not already displayed, show it!
-		if (!m_dlgvisible)
-		{
-			if (m_fUseRegistry) 
-			{
-				if (usersettings)
-					vnclog.Print(LL_INTINFO, VNCLOG("show per-user Properties\n"));
-				else
-					vnclog.Print(LL_INTINFO, VNCLOG("show default system Properties\n"));
-
-				// Load in the settings relevant to the user or system
-				//Load(usersettings);
-				m_usersettings=usersettings;
-				// Load in the settings relevant to the user or system
-				Load(usersettings);
-			}
-			else
-				LoadFromIniFile();
-
-
-			for (;;)
-			{
-				m_returncode_valid = FALSE;
-
-				// Do the dialog box
-				// [v1.0.2-jp1 fix]
-				//int result = DialogBoxParam(hAppInstance,
-				int result = DialogBoxParam(hInstResDLL,
-				    MAKEINTRESOURCE(IDD_PROPERTIES), 
-				    NULL,
-				    (DLGPROC) DialogProcPoll,
-				    (LONG_PTR) this);
-
-				if (!m_returncode_valid)
-				    result = IDCANCEL;
-
-				vnclog.Print(LL_INTINFO, VNCLOG("dialog result = %d\n"), result);
-
-				if (result == -1)
-				{
-					// Dialog box failed, so quit
-					PostQuitMessage(0);
-					if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-					CloseHandle(hProcess);
-					CloseHandle(hPToken);
-					return;
-				}
-				break;
-				omni_thread::sleep(4);
-			}
-
-			// Load in all the settings
-			if (!vncService::RunningAsService())
-			{
-			if (m_fUseRegistry) 
-				Load(TRUE);
-			else
-				LoadFromIniFile();
-			}
-		}
-	}
-	if(iImpersonateResult == ERROR_SUCCESS)RevertToSelf();
-	if (hProcess) CloseHandle(hProcess);
-	if (hPToken) CloseHandle(hPToken);
-}
-
-
-
-
-BOOL CALLBACK
-vncPropertiesPoll::DialogProcPoll(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!
-    vncPropertiesPoll *_this = helper::SafeGetWindowUserData<vncPropertiesPoll>(hwnd);
-
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{
-			// Retrieve the Dialog box parameter and use it as a pointer
-			// to the calling vncPropertiesPoll object
-            helper::SafeSetWindowUserData(hwnd, lParam);
-
-			_this = (vncPropertiesPoll *) lParam;
-			_this->m_dlgvisible = TRUE;
-
-			if (_this->m_fUseRegistry)
-			{
-				_this->Load(_this->m_usersettings);
-
-				// Set the dialog box's title to indicate which Properties we're editting
-				if (_this->m_usersettings) {
-					SetWindowText(hwnd, sz_ID_CURRENT_USER_PROP);
-				} else {
-					SetWindowText(hwnd, sz_ID_DEFAULT_SYST_PROP);
-				}
-			}
-			else
-			{
-				//LoadFromIniFile();
-			}
-
-			// Modif sf at 2002
-
-		   SetDlgItemInt(hwnd, IDC_MAXCPU, _this->m_server->MaxCpu(), false);
-
-		   HWND hTurboMode = GetDlgItem(hwnd, IDC_TURBOMODE);
-           SendMessage(hTurboMode, BM_SETCHECK, _this->m_server->TurboMode(), 0);
-
-			// Set the polling options
-			HWND hDriver = GetDlgItem(hwnd, IDC_DRIVER);
-			SendMessage(hDriver,
-				BM_SETCHECK,
-				_this->m_server->Driver(),0);
-
-			if (OSversion()==3) // If NT4 or below, no driver
-			{
-				SendMessage(hDriver,BM_SETCHECK,false,0);
-				_this->m_server->Driver(false);
-				EnableWindow(hDriver, false);
-			}
-
-			HWND hHook = GetDlgItem(hwnd, IDC_HOOK);
-			SendMessage(hHook,
-				BM_SETCHECK,
-				_this->m_server->Hook(),
-				0);
-
-			HWND hPollFullScreen = GetDlgItem(hwnd, IDC_POLL_FULLSCREEN);
-			SendMessage(hPollFullScreen,
-				BM_SETCHECK,
-				_this->m_server->PollFullScreen(),
-				0);
-
-			HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND);
-			SendMessage(hPollForeground,
-				BM_SETCHECK,
-				_this->m_server->PollForeground(),
-				0);
-
-			HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR);
-			SendMessage(hPollUnderCursor,
-				BM_SETCHECK,
-				_this->m_server->PollUnderCursor(),
-				0);
-
-			HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY);
-			SendMessage(hPollConsoleOnly,
-				BM_SETCHECK,
-				_this->m_server->PollConsoleOnly(),
-				0);
-			EnableWindow(hPollConsoleOnly,
-				_this->m_server->PollUnderCursor() || _this->m_server->PollForeground()
-				);
-
-			HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY);
-			SendMessage(hPollOnEventOnly,
-				BM_SETCHECK,
-				_this->m_server->PollOnEventOnly(),
-				0);
-			EnableWindow(hPollOnEventOnly,
-				_this->m_server->PollUnderCursor() || _this->m_server->PollForeground()
-				);
-
-			// [v1.0.2-jp2 fix-->]
-			HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-			SendMessage(hSingleWindow, BM_SETCHECK, _this->m_server->SingleWindow(), 0);
-
-			HWND hWindowName = GetDlgItem(hwnd, IDC_NAME_APPLI);
-			if ( _this->m_server->GetWindowName() != NULL){
-			   SetDlgItemText(hwnd, IDC_NAME_APPLI,_this->m_server->GetWindowName());
-			}
-			EnableWindow(hWindowName, _this->m_server->SingleWindow());
-			// [<--v1.0.2-jp2 fix]
-
-			SetForegroundWindow(hwnd);
-
-			return FALSE; // Because we've set the focus
-		}
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-
-		case IDOK:
-		case IDC_APPLY:
-			{
-				
-
-				int maxcpu = GetDlgItemInt(hwnd, IDC_MAXCPU, NULL, FALSE);
-				_this->m_server->MaxCpu(maxcpu);
-
-				// Modif sf at 2002
-				HWND hTurboMode = GetDlgItem(hwnd, IDC_TURBOMODE);
-				_this->m_server->TurboMode(SendMessage(hTurboMode, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				// Handle the polling stuff
-				HWND hDriver = GetDlgItem(hwnd, IDC_DRIVER);
-				bool result=(SendMessage(hDriver, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				if (result)
-				{
-					_this->m_server->Driver(CheckVideoDriver(0));
-				}
-				else _this->m_server->Driver(false);
-				HWND hHook = GetDlgItem(hwnd, IDC_HOOK);
-				_this->m_server->Hook(
-					SendMessage(hHook, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-				HWND hPollFullScreen = GetDlgItem(hwnd, IDC_POLL_FULLSCREEN);
-				_this->m_server->PollFullScreen(
-					SendMessage(hPollFullScreen, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND);
-				_this->m_server->PollForeground(
-					SendMessage(hPollForeground, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR);
-				_this->m_server->PollUnderCursor(
-					SendMessage(hPollUnderCursor, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY);
-				_this->m_server->PollConsoleOnly(
-					SendMessage(hPollConsoleOnly, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY);
-				_this->m_server->PollOnEventOnly(
-					SendMessage(hPollOnEventOnly, BM_GETCHECK, 0, 0) == BST_CHECKED
-					);
-
-				// [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp
-				HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-				_this->m_server->SingleWindow(SendMessage(hSingleWindow, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				char szName[32];
-				if (GetDlgItemText(hwnd, IDC_NAME_APPLI, (LPSTR) szName, 32) == 0){
-					vnclog.Print(LL_INTINFO,VNCLOG("Error while reading Window Name %d \n"), GetLastError());
-				}
-				else{
-					_this->m_server->SetSingleWindowName(szName);
-				}
-				// [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp
-
-				// Save the settings
-				if (_this->m_fUseRegistry)
-					_this->Save();
-				else
-					_this->SaveToIniFile();
-
-				// Was ok pressed?
-				if (LOWORD(wParam) == IDOK)
-				{
-					// Yes, so close the dialog
-					vnclog.Print(LL_INTINFO, VNCLOG("enddialog (OK)\n"));
-
-					_this->m_returncode_valid = TRUE;
-
-					EndDialog(hwnd, IDOK);
-					_this->m_dlgvisible = FALSE;
-				}
-
-				_this->m_server->SetHookings();
-
-				return TRUE;
-			}
-
-		// [v1.0.2-jp2 fix-->] Move to vncpropertiesPoll.cpp
-		 case IDC_SINGLE_WINDOW:
-			 {
-				 HWND hSingleWindow = GetDlgItem(hwnd, IDC_SINGLE_WINDOW);
-				 BOOL fSingleWindow = (SendMessage(hSingleWindow, BM_GETCHECK,0, 0) == BST_CHECKED);
-				 HWND hWindowName   = GetDlgItem(hwnd, IDC_NAME_APPLI);
-				 EnableWindow(hWindowName, fSingleWindow);
-			 }
-			 return TRUE;
-		// [<--v1.0.2-jp2 fix] Move to vncpropertiesPoll.cpp
-
-		 case IDCANCEL:
-			vnclog.Print(LL_INTINFO, VNCLOG("enddialog (CANCEL)\n"));
-
-			_this->m_returncode_valid = TRUE;
-
-			EndDialog(hwnd, IDCANCEL);
-			_this->m_dlgvisible = FALSE;
-			return TRUE;
-		
-
-		case IDC_POLL_FOREGROUND:
-		case IDC_POLL_UNDER_CURSOR:
-			// User has clicked on one of the polling mode buttons
-			// affected by the pollconsole and pollonevent options
-			{
-				// Get the poll-mode buttons
-				HWND hPollForeground = GetDlgItem(hwnd, IDC_POLL_FOREGROUND);
-				HWND hPollUnderCursor = GetDlgItem(hwnd, IDC_POLL_UNDER_CURSOR);
-
-				// Determine whether to enable the modifier options
-				BOOL enabled = (SendMessage(hPollForeground, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
-					(SendMessage(hPollUnderCursor, BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-				HWND hPollConsoleOnly = GetDlgItem(hwnd, IDC_CONSOLE_ONLY);
-				EnableWindow(hPollConsoleOnly, enabled);
-
-				HWND hPollOnEventOnly = GetDlgItem(hwnd, IDC_ONEVENT_ONLY);
-				EnableWindow(hPollOnEventOnly, enabled);
-			}
-			return TRUE;
-
-		
-		case IDC_CHECKDRIVER:
-			{
-				CheckVideoDriver(1);
-			}
-			return TRUE;
-		
-
-
-
-		}
-		break;
-	}
-	return 0;
-}
-
-
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-extern BOOL ultravnc_italc_load_int( LPCSTR valname, LONG *out );
-#endif
-
-// Functions to load & save the settings
-LONG
-vncPropertiesPoll::LoadInt(HKEY key, LPCSTR valname, LONG defval)
-{
-	LONG pref;
-	ULONG type = REG_DWORD;
-	ULONG prefsize = sizeof(pref);
-
-#ifdef ULTRAVNC_ITALC_SUPPORT
-	LONG out;
-	if( ultravnc_italc_load_int( valname, &out ) )
-	{
-		return out;
-	}
-#endif
-	if (RegQueryValueEx(key,
-		valname,
-		NULL,
-		&type,
-		(LPBYTE) &pref,
-		&prefsize) != ERROR_SUCCESS)
-		return defval;
-
-	if (type != REG_DWORD)
-		return defval;
-
-	if (prefsize != sizeof(pref))
-		return defval;
-
-	return pref;
-}
-
-void
-vncPropertiesPoll::LoadSingleWindowName(HKEY key, char *buffer)
-{
-	DWORD type = REG_BINARY;
-	int slen=32;
-	char inouttext[32];
-
-	if (RegQueryValueEx(key,
-		"SingleWindowName",
-		NULL,
-		&type,
-		(LPBYTE) &inouttext,
-		(LPDWORD) &slen) != ERROR_SUCCESS)
-		return;
-
-	if (slen > MAXPATH)
-		return;
-
-	memcpy(buffer, inouttext, 32);
-}
-
-char *
-vncPropertiesPoll::LoadString(HKEY key, LPCSTR keyname)
-{
-	DWORD type = REG_SZ;
-	DWORD buflen = 0;
-	BYTE *buffer = 0;
-
-	// Get the length of the AuthHosts string
-	if (RegQueryValueEx(key,
-		keyname,
-		NULL,
-		&type,
-		NULL,
-		&buflen) != ERROR_SUCCESS)
-		return 0;
-
-	if (type != REG_SZ)
-		return 0;
-	buffer = new BYTE[buflen];
-	if (buffer == 0)
-		return 0;
-
-	// Get the AuthHosts string data
-	if (RegQueryValueEx(key,
-		keyname,
-		NULL,
-		&type,
-		buffer,
-		&buflen) != ERROR_SUCCESS) {
-		delete [] buffer;
-		return 0;
-	}
-
-	// Verify the type
-	if (type != REG_SZ) {
-		delete [] buffer;
-		return 0;
-	}
-
-	return (char *)buffer;
-}
-
-void
-vncPropertiesPoll::ResetRegistry()
-{	
-	vnclog.Print(LL_CLIENTS, VNCLOG("Reset Reg\n"));
-	char username[UNLEN+1];
-	HKEY hkLocal, hkLocalUser, hkDefault;
-	DWORD dw;
-
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-		return;
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-		strcpy((char *)&username, "SYSTEM");
-
-	// Try to get the machine registry key for WinVNC
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		WINVNC_REGISTRY_KEY,
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		hkLocalUser=NULL;
-		hkDefault=NULL;
-		goto LABELUSERSETTINGS;
-		}
-
-	// Now try to get the per-user local key
-	if (RegOpenKeyEx(hkLocal,
-		username,
-		0, KEY_READ,
-		&hkLocalUser) != ERROR_SUCCESS)
-		hkLocalUser = NULL;
-
-	// Get the default key
-	if (RegCreateKeyEx(hkLocal,
-		"Default",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ,
-		NULL,
-		&hkDefault,
-		&dw) != ERROR_SUCCESS)
-		hkDefault = NULL;
-
-	if (hkLocalUser != NULL) RegCloseKey(hkLocalUser);
-	if (hkDefault != NULL) RegCloseKey(hkDefault);
-	if (hkLocal != NULL) RegCloseKey(hkLocal);
-	RegCloseKey(HKEY_LOCAL_MACHINE);
-LABELUSERSETTINGS:
-	if ((strcmp(username, "SYSTEM") != 0))
-		{
-			HKEY hkGlobalUser;
-			if (RegCreateKeyEx(HKEY_CURRENT_USER,
-				WINVNC_REGISTRY_KEY,
-				0, REG_NONE, REG_OPTION_NON_VOLATILE,
-				KEY_READ, NULL, &hkGlobalUser, &dw) == ERROR_SUCCESS)
-			{
-				RegCloseKey(hkGlobalUser);
-				RegCloseKey(HKEY_CURRENT_USER);
-			}
-		}
-
-}
-
-void
-vncPropertiesPoll::Load(BOOL usersettings)
-{
-//	if (m_dlgvisible) {
-//		vnclog.Print(LL_INTWARN, VNCLOG("service helper invoked while Properties panel displayed\n"));
-//		return;
-//	}
-	ResetRegistry();
-	
-	char username[UNLEN+1];
-	HKEY hkLocal, hkLocalUser, hkDefault;
-	DWORD dw;
-	
-	// NEW (R3) PREFERENCES ALGORITHM
-	// 1.	Look in HKEY_LOCAL_MACHINE/Software/ORL/WinVNC3/%username%
-	//		for sysadmin-defined, user-specific settings.
-	// 2.	If not found, fall back to %username%=Default
-	// 3.	If AllowOverrides is set then load settings from
-	//		HKEY_CURRENT_USER/Software/ORL/WinVNC3
-
-	// GET THE CORRECT KEY TO READ FROM
-
-	// Get the user name / service name
-	if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-		return;
-
-	// If there is no user logged on them default to SYSTEM
-	if (strcmp(username, "") == 0)
-		strcpy((char *)&username, "SYSTEM");
-
-	// Try to get the machine registry key for WinVNC
-	if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-		WINVNC_REGISTRY_KEY,
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-		{
-		hkLocalUser=NULL;
-		hkDefault=NULL;
-		goto LABELUSERSETTINGS;
-		}
-
-	// Now try to get the per-user local key
-	if (RegOpenKeyEx(hkLocal,
-		username,
-		0, KEY_READ,
-		&hkLocalUser) != ERROR_SUCCESS)
-		hkLocalUser = NULL;
-
-	// Get the default key
-	if (RegCreateKeyEx(hkLocal,
-		"Default",
-		0, REG_NONE, REG_OPTION_NON_VOLATILE,
-		KEY_READ,
-		NULL,
-		&hkDefault,
-		&dw) != ERROR_SUCCESS)
-		hkDefault = NULL;
-
-
-LABELUSERSETTINGS:
-	// LOAD THE USER PREFERENCES
-
-	// Set the default user prefs
-	vnclog.Print(LL_INTINFO, VNCLOG("clearing user settings\n"));
-	m_pref_TurboMode = ((vncService::VersionMajor() >= 6) ? TRUE : FALSE);
-	m_pref_PollUnderCursor=FALSE;
-	m_pref_PollForeground= TRUE;
-	m_pref_PollFullScreen= ((vncService::VersionMajor() >= 6) ? FALSE : TRUE);
-	m_pref_PollConsoleOnly=FALSE;
-	m_pref_PollOnEventOnly=TRUE;
-	m_pref_MaxCpu=40;
-	m_pref_Driver=CheckVideoDriver(0);
-	m_pref_Hook=TRUE;
-	m_pref_Virtual=FALSE;
-
-	// [v1.0.2-jp2 fix]
-	m_pref_SingleWindow = 0;
-	*m_pref_szSingleWindowName = '\0';
-
-	// Load the local prefs for this user
-	if (hkDefault != NULL)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("loading DEFAULT local settings\n"));
-		LoadUserPrefsPoll(hkDefault);
-	}
-
-	
-	if (m_usersettings) {
-		// We want the user settings, so load them!
-
-		if (hkLocalUser != NULL)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("loading \"%s\" local settings\n"), username);
-			LoadUserPrefsPoll(hkLocalUser);
-		}
-
-		// Now override the system settings with the user's settings
-		// If the username is SYSTEM then don't try to load them, because there aren't any...
-		if ((strcmp(username, "SYSTEM") != 0))
-		{
-			HKEY hkGlobalUser;
-			if (RegCreateKeyEx(HKEY_CURRENT_USER,
-				WINVNC_REGISTRY_KEY,
-				0, REG_NONE, REG_OPTION_NON_VOLATILE,
-				KEY_READ, NULL, &hkGlobalUser, &dw) == ERROR_SUCCESS)
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("loading \"%s\" global settings\n"), username);
-				LoadUserPrefsPoll(hkGlobalUser);
-				RegCloseKey(hkGlobalUser);
-
-				// Close the user registry hive so it can unload if required
-				RegCloseKey(HKEY_CURRENT_USER);
-			}
-		}
-	}
-
-	if (hkLocalUser != NULL) RegCloseKey(hkLocalUser);
-	if (hkDefault != NULL) RegCloseKey(hkDefault);
-	if (hkLocal != NULL) RegCloseKey(hkLocal);
-
-	// Make the loaded settings active..
-	ApplyUserPrefs();
-
-	// Note whether we loaded the user settings or just the default system settings
-	m_usersettings = usersettings;
-}
-
-
-void
-vncPropertiesPoll::LoadUserPrefsPoll(HKEY appkey)
-{
-	m_pref_TurboMode = LoadInt(appkey, "TurboMode", m_pref_TurboMode);
-	// Polling prefs
-	m_pref_PollUnderCursor=LoadInt(appkey, "PollUnderCursor", m_pref_PollUnderCursor);
-	m_pref_PollForeground=LoadInt(appkey, "PollForeground", m_pref_PollForeground);
-	m_pref_PollFullScreen=LoadInt(appkey, "PollFullScreen", m_pref_PollFullScreen);
-	m_pref_PollConsoleOnly=LoadInt(appkey, "OnlyPollConsole", m_pref_PollConsoleOnly);
-	m_pref_PollOnEventOnly=LoadInt(appkey, "OnlyPollOnEvent", m_pref_PollOnEventOnly);
-	m_pref_MaxCpu=LoadInt(appkey, "MaxCpu", m_pref_MaxCpu);
-	if (m_pref_MaxCpu==0) m_pref_MaxCpu=100;
-	m_pref_Driver=LoadInt(appkey, "EnableDriver", m_pref_Driver);
-	if (m_pref_Driver)m_pref_Driver=CheckVideoDriver(0);
-	m_pref_Hook=LoadInt(appkey, "EnableHook", m_pref_Hook);
-	m_pref_Virtual=LoadInt(appkey, "EnableVirtual", m_pref_Virtual);
-	// [v1.0.2-jp2 fix]
-	m_pref_SingleWindow=LoadInt(appkey, "SingleWindow", m_pref_SingleWindow);
-	LoadSingleWindowName(appkey, m_pref_szSingleWindowName);
-
-}
-
-void
-vncPropertiesPoll::ApplyUserPrefs()
-{
-	// APPLY THE CACHED PREFERENCES TO THE SERVER
-
-	
-    m_server->TurboMode(m_pref_TurboMode);
-	// Polling prefs
-	m_server->PollUnderCursor(m_pref_PollUnderCursor);
-	m_server->PollForeground(m_pref_PollForeground);
-	m_server->PollFullScreen(m_pref_PollFullScreen);
-	m_server->PollConsoleOnly(m_pref_PollConsoleOnly);
-	m_server->PollOnEventOnly(m_pref_PollOnEventOnly);
-	m_server->MaxCpu(m_pref_MaxCpu);	
-	if (CheckVideoDriver(0) && m_pref_Driver) m_server->Driver(m_pref_Driver);
-	else m_server->Driver(false);
-	m_server->Hook(m_pref_Hook);
-	m_server->Virtual(m_pref_Virtual);
-	// [v1.0.2-jp2 fix]
-	m_server->SingleWindow(m_pref_SingleWindow);
-	m_server->SetSingleWindowName(m_pref_szSingleWindowName);
-
-}
-
-void
-vncPropertiesPoll::SaveInt(HKEY key, LPCSTR valname, LONG val)
-{
-	RegSetValueEx(key, valname, 0, REG_DWORD, (LPBYTE) &val, sizeof(val));
-}
-
-// [v1.0.2-jp2 fix-->]
-void
-vncPropertiesPoll::SaveString(HKEY key,LPCSTR valname, const char *buffer)
-{
-	RegSetValueEx(key, valname, 0, REG_BINARY, (LPBYTE) buffer, strlen(buffer)+1);
-}
-// [<--v1.0.2-jp2 fix]
-
-void
-vncPropertiesPoll::Save()
-{
-	HKEY appkey;
-	DWORD dw;
-
-	// NEW (R3) PREFERENCES ALGORITHM
-	// The user's prefs are only saved if the user is allowed to override
-	// the machine-local settings specified for them.  Otherwise, the
-	// properties entry on the tray icon menu will be greyed out.
-
-	// GET THE CORRECT KEY TO READ FROM
-
-	if (m_usersettings) {
-		// Verify that we know who is logged on
-		char username[UNLEN+1];
-		if (!vncService::CurrentUser((char *)&username, sizeof(username)))
-			return;
-		if (strcmp(username, "") == 0)
-			return;
-
-		// Try to get the per-user, global registry key for WinVNC
-		if (RegCreateKeyEx(HKEY_CURRENT_USER,
-			WINVNC_REGISTRY_KEY,
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ, NULL, &appkey, &dw) != ERROR_SUCCESS)
-			return;
-	} else {
-		// Try to get the default local registry key for WinVNC
-		HKEY hkLocal;
-		if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-			WINVNC_REGISTRY_KEY,
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_READ, NULL, &hkLocal, &dw) != ERROR_SUCCESS) {
-			MessageBoxSecure(NULL, sz_ID_MB1, sz_ID_WVNC, MB_OK);
-			return;
-		}
-
-		if (RegCreateKeyEx(hkLocal,
-			"Default",
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ, NULL, &appkey, &dw) != ERROR_SUCCESS) {
-			RegCloseKey(hkLocal);
-			return;
-		}
-		RegCloseKey(hkLocal);
-	}
-
-	// SAVE PER-USER PREFS IF ALLOWED
-	SaveUserPrefsPoll(appkey);
-	RegCloseKey(appkey);
-	RegCloseKey(HKEY_CURRENT_USER);
-
-}
-
-void
-vncPropertiesPoll::SaveUserPrefsPoll(HKEY appkey)
-{
-	SaveInt(appkey, "TurboMode", m_server->TurboMode());
-	// Polling prefs
-	SaveInt(appkey, "PollUnderCursor", m_server->PollUnderCursor());
-	SaveInt(appkey, "PollForeground", m_server->PollForeground());
-	SaveInt(appkey, "PollFullScreen", m_server->PollFullScreen());
-
-	SaveInt(appkey, "OnlyPollConsole", m_server->PollConsoleOnly());
-	SaveInt(appkey, "OnlyPollOnEvent", m_server->PollOnEventOnly());
-	SaveInt(appkey, "MaxCpu", m_server->MaxCpu());
-	SaveInt(appkey, "EnableDriver", m_server->Driver());
-	SaveInt(appkey, "EnableHook", m_server->Hook());
-	SaveInt(appkey, "EnableVirtual", m_server->Virtual());
-	// [v1.0.2-jp2 fix]
-	SaveInt(appkey, "SingleWindow", m_server->SingleWindow());
-	SaveString(appkey, "SingleWindowName", m_server->GetWindowName());
-}
-
-
-// ********************************************************************
-// Ini file part - Wwill replace registry access completely, some day
-// WARNING: until then, when adding/modifying a config parameter
-//          don't forget to modify both ini file & registry parts !
-// ********************************************************************
-
-void vncPropertiesPoll::LoadFromIniFile()
-{
-//	if (m_dlgvisible)
-//	{
-//		vnclog.Print(LL_INTWARN, VNCLOG("service helper invoked while Properties panel displayed\n"));
-//		return;
-//	}
-	
-	m_pref_TurboMode = ((vncService::VersionMajor() >= 6) ? TRUE : FALSE);
-	m_pref_PollUnderCursor=FALSE;
-	m_pref_PollForeground= TRUE;
-	m_pref_PollFullScreen= ((vncService::VersionMajor() >= 6) ? FALSE : TRUE);
-	m_pref_PollConsoleOnly=FALSE;
-	m_pref_PollOnEventOnly=TRUE;
-	m_pref_MaxCpu=40;
-	m_pref_Driver=CheckVideoDriver(0);
-	m_pref_Hook=TRUE;
-	m_pref_Virtual=FALSE;
-
-	m_pref_SingleWindow = 0;
-	*m_pref_szSingleWindowName = '\0';
-
-	LoadUserPrefsPollFromIniFile();
-	ApplyUserPrefs();
-}
-
-
-void vncPropertiesPoll::LoadUserPrefsPollFromIniFile()
-{
-	m_pref_TurboMode = myIniFile.ReadInt("poll", "TurboMode", m_pref_TurboMode);
-	// Polling prefs
-	m_pref_PollUnderCursor=myIniFile.ReadInt("poll", "PollUnderCursor", m_pref_PollUnderCursor);
-	m_pref_PollForeground=myIniFile.ReadInt("poll", "PollForeground", m_pref_PollForeground);
-	m_pref_PollFullScreen=myIniFile.ReadInt("poll", "PollFullScreen", m_pref_PollFullScreen);
-	m_pref_PollConsoleOnly=myIniFile.ReadInt("poll", "OnlyPollConsole", m_pref_PollConsoleOnly);
-	m_pref_PollOnEventOnly=myIniFile.ReadInt("poll", "OnlyPollOnEvent", m_pref_PollOnEventOnly);
-	m_pref_MaxCpu=myIniFile.ReadInt("poll", "MaxCpu", m_pref_MaxCpu);
-	if (m_pref_MaxCpu==0) m_pref_MaxCpu=100;
-	m_pref_Driver=myIniFile.ReadInt("poll", "EnableDriver", m_pref_Driver);
-	if (m_pref_Driver)m_pref_Driver=CheckVideoDriver(0);
-	m_pref_Hook=myIniFile.ReadInt("poll", "EnableHook", m_pref_Hook);
-	m_pref_Virtual=myIniFile.ReadInt("poll", "EnableVirtual", m_pref_Virtual);
-	
-	m_pref_SingleWindow=myIniFile.ReadInt("poll","SingleWindow",m_pref_SingleWindow);
-	myIniFile.ReadString("poll", "SingleWindowName", m_pref_szSingleWindowName,32);
-
-}
-
-
-void vncPropertiesPoll::SaveToIniFile()
-{
-	bool use_uac=false;
-	if (!myIniFile.IsWritable())
-			{
-				// We can't write to the ini file , Vista in service mode
-				if (!Copy_to_Temp(m_Tempfile)) return ;
-				myIniFile.IniFileSetTemp(m_Tempfile);
-				use_uac=true;
-			}
-	SaveUserPrefsPollToIniFile();
-	if (use_uac==true)
-	{
-	myIniFile.copy_to_secure();
-	myIniFile.IniFileSetSecure();
-	}
-}
-
-
-void vncPropertiesPoll::SaveUserPrefsPollToIniFile()
-{
-	myIniFile.WriteInt("poll", "TurboMode", m_server->TurboMode());
-	// Polling prefs
-	myIniFile.WriteInt("poll", "PollUnderCursor", m_server->PollUnderCursor());
-	myIniFile.WriteInt("poll", "PollForeground", m_server->PollForeground());
-	myIniFile.WriteInt("poll", "PollFullScreen", m_server->PollFullScreen());
-
-	myIniFile.WriteInt("poll", "OnlyPollConsole", m_server->PollConsoleOnly());
-	myIniFile.WriteInt("poll", "OnlyPollOnEvent", m_server->PollOnEventOnly());
-	myIniFile.WriteInt("poll", "MaxCpu", m_server->MaxCpu());
-
-	myIniFile.WriteInt("poll", "EnableDriver", m_server->Driver());
-	myIniFile.WriteInt("poll", "EnableHook", m_server->Hook());
-	myIniFile.WriteInt("poll", "EnableVirtual", m_server->Virtual());
-
-	myIniFile.WriteInt("poll", "SingleWindow", m_server->SingleWindow());
-	myIniFile.WriteString("poll", "SingleWindowName", m_server->GetWindowName());
-	
-}
diff --git a/ica/win32/winvnc/winvnc/vncpropertiesPoll.h b/ica/win32/winvnc/winvnc/vncpropertiesPoll.h
deleted file mode 100644
index 0542719..0000000
--- a/ica/win32/winvnc/winvnc/vncpropertiesPoll.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//  Copyright (C) 2002-2010 Ultr at VNC Team Members. 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.uvnc.com/
-//
-////////////////////////////////////////////////////////////////////////////
-class vncPropertiesPoll;
-
-#if (!defined(_WINVNC_VNCPROPERTIESPOLL))
-#define _WINVNC_VNCPROPERTIESPOLL
-
-// Includes
-#include "stdhdrs.h"
-#include "vncserver.h"
-#include "inifile.h"
-#include <userenv.h>
-// The vncPropertiesPoll class itself
-class vncPropertiesPoll
-{
-public:
-	// Constructor/destructor
-	vncPropertiesPoll();
-	~vncPropertiesPoll();
-
-	// Initialisation
-	BOOL Init(vncServer *server);
-
-	// The dialog box window proc
-	static BOOL CALLBACK DialogProcPoll(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-	// Display the properties dialog
-	// If usersettings is TRUE then the per-user settings come up
-	// If usersettings is FALSE then the default system settings come up
-	void Show(BOOL show, BOOL usersettings);
-
-	// Loading & saving of preferences
-	void Load(BOOL usersettings);
-	void ResetRegistry();
-
-	void Save();
-
-	BOOL m_fUseRegistry;
-	// Ini file
-	IniFile myIniFile;
-	void LoadFromIniFile();
-	void LoadUserPrefsPollFromIniFile();
-	void SaveToIniFile();
-	void SaveUserPrefsPollToIniFile();
-
-	// Implementation
-protected:
-	// The server object to which this properties object is attached.
-	vncServer *			m_server;
-
-	// Flag to indicate whether the currently loaded settings are for
-	// the current user, or are default system settings
-	BOOL				m_usersettings;
-
-
-	// String handling
-	char * LoadString(HKEY k, LPCSTR valname);
-	void SaveString(HKEY k, LPCSTR valname, const char *buffer);
-
-	// Manipulate the registry settings
-	LONG LoadInt(HKEY key, LPCSTR valname, LONG defval);
-	void SaveInt(HKEY key, LPCSTR valname, LONG val);
-
-
-	// Loading/saving all the user prefs
-	void LoadUserPrefsPoll(HKEY appkey);
-	void SaveUserPrefsPoll(HKEY appkey);
-
-	// [v1.0.2-jp2 fix]
-	void LoadSingleWindowName(HKEY key, char *buffer);
-
-	// Making the loaded user prefs active
-	void ApplyUserPrefs();
-	
-	BOOL m_returncode_valid;
-	BOOL m_dlgvisible;
-
-	BOOL m_pref_TurboMode;
-	
-	BOOL m_pref_PollUnderCursor;
-	BOOL m_pref_PollForeground;
-	BOOL m_pref_PollFullScreen;
-	BOOL m_pref_PollConsoleOnly;
-	BOOL m_pref_PollOnEventOnly;
-	LONG m_pref_MaxCpu;
-
-	BOOL m_pref_Driver;
-	BOOL m_pref_Hook;
-	BOOL m_pref_Virtual;
-
-	// [v1.0.2-jp2 fix]
-	BOOL m_pref_SingleWindow;
-	char m_pref_szSingleWindowName[32];
-	char m_Tempfile[MAX_PATH];
-
-};
-
-#endif // _WINVNC_vncPropertiesPoll
diff --git a/ica/win32/winvnc/winvnc/vncserver.cpp b/ica/win32/winvnc/winvnc/vncserver.cpp
deleted file mode 100644
index 74e05f6..0000000
--- a/ica/win32/winvnc/winvnc/vncserver.cpp
+++ /dev/null
@@ -1,2723 +0,0 @@
-//  Copyright (C) 2002 Ultr at Vnc Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncServer.cpp
-
-// vncServer class implementation
-
-// Includes
-#include "stdhdrs.h"
-#include <omnithread.h>
-#include <string.h>
-#include <lmcons.h>
-
-// Custom
-#include "winvnc.h"
-#include "vncserver.h"
-#include "vncsockconnect.h"
-#include "vncclient.h"
-#include "vncservice.h"
-#include "vnctimedmsgbox.h"
-#include "mmsystem.h" // sf at 2002
-
-#include "vncmenu.h"
-
-#include "Localization.h" // ACT : Add localization on messages
-bool g_Server_running;
-extern bool g_Desktop_running;
-extern bool g_DesktopThread_running;
-void*	vncServer::pThis;
-
-// adzm 2009-07-05
-extern BOOL SPECIAL_SC_PROMPT;
-extern BOOL G_HTTP;
-// vncServer::UpdateTracker routines
-
-void
-vncServer::ServerUpdateTracker::add_changed(const rfb::Region2D &rgn) {
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_server->m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_server->m_authClients.begin(); i != m_server->m_authClients.end(); ++i)
-	{
-		// Post the update
-		// REalVNC 336 change
-		// m_server->GetClient(*i)->GetUpdateTracker().add_changed(rgn);
-		vncClient* client = m_server->GetClient(*i);
-		omni_mutex_lock ll(client->GetUpdateLock());
-		client->GetUpdateTracker().add_changed(rgn);
-
-	}
-}
-
-void
-vncServer::ServerUpdateTracker::add_cached(const rfb::Region2D &rgn) {
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_server->m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_server->m_authClients.begin(); i != m_server->m_authClients.end(); ++i)
-	{
-		// Post the update
-		// RealVNC 336 change
-		// m_server->GetClient(*i)->GetUpdateTracker().add_cached(rgn);
-		vncClient* client = m_server->GetClient(*i);
-		omni_mutex_lock ll(client->GetUpdateLock());
-		client->GetUpdateTracker().add_cached(rgn);
-	}
-}
-
-
-
-
-
-void
-vncServer::ServerUpdateTracker::add_copied(const rfb::Region2D &dest, const rfb::Point &delta) {
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_server->m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_server->m_authClients.begin(); i != m_server->m_authClients.end(); ++i)
-	{
-		// Post the update
-		// RealVNC 336 change
-		//m_server->GetClient(*i)->GetUpdateTracker().add_copied(dest, delta);
-		vncClient* client = m_server->GetClient(*i);
-		omni_mutex_lock ll(client->GetUpdateLock());
-		client->GetUpdateTracker().add_copied(dest, delta);
-
-	}
-}
-
-
-
-// Constructor/destructor
-vncServer::vncServer()
-{
-	// used for our retry timer proc;
-	pThis = this;
-	AutoReconnect_counter=0;
-
-	// Initialise some important stuffs...
-	g_Server_running=true;
-	m_socketConn = NULL;
-	m_httpConn = NULL;
-	m_enableHttpConn = false;
-	m_enableXdmcpConn = false;
-	m_desktop = NULL;
-	m_name = NULL;
-	m_port = DISPLAY_TO_PORT(0);
-	m_port_http = DISPLAY_TO_HPORT(0); // TightVNC 1.2.7
-	m_autoportselect = TRUE;
-	m_passwd_required = TRUE;
-	m_auth_hosts = 0;
-	m_blacklist = 0;
-	{
-	    vncPasswd::FromClear clearPWD;
-	    memcpy(m_password, clearPWD, MAXPWLEN);
-	}
-	m_querysetting = 2;
-	m_queryaccept = 0;
-	m_querytimeout = 10;
-	m_retry_timeout = 0;
-
-	// Autolock settings
-	m_lock_on_exit = 0;
-
-	// Set the polling mode options
-	m_poll_fullscreen = FALSE;
-	m_poll_foreground = FALSE;
-	m_poll_undercursor = TRUE;
-
-	m_poll_oneventonly = FALSE;
-	m_MaxCpu=20;
-	m_poll_consoleonly = TRUE;
-
-	m_driver = FALSE;
-	m_hook = FALSE;
-	m_virtual = FALSE;
-	sethook=false;
-	
-	// General options
-	m_loopbackOnly = FALSE;
-	m_loopback_allowed = FALSE;
-	m_lock_on_exit = 0;
-	m_connect_pri = 0;
-	m_disableTrayIcon = FALSE;
-	m_AllowEditClients = FALSE;
-
-	// Set the input options
-	m_enable_remote_inputs = TRUE;
-	m_disable_local_inputs = FALSE;
-	m_enable_jap_input = FALSE;
-
-	// Clear the client mapping table
-	for (int x=0; x<MAX_CLIENTS; x++)
-		m_clientmap[x] = NULL;
-	m_nextid = 0;
-
-	// Initialise the update tracker
-	m_update_tracker.init(this);
-
-	// Signal set when a client quits
-	m_clientquitsig = new omni_condition(&m_clientsLock);
-
-	// Modif sf at 2002
-	m_SingleWindow = FALSE;
-	strcpy(m_szWindowName, "");
-
-	// Modif sf at 2002
-	m_TurboMode = false;
-	// m_fCursorMoved = false;
-
-	// sf at 2002 - v1.1.2
-	// m_fQueuingEnabled = false;
-	m_fFileTransferEnabled = true;
-	m_nDefaultScale = 1;
-
-	// sf at 2002 - Data Stream Modification Plugin handling
-	m_pDSMPlugin = new CDSMPlugin();
-
-	m_fDSMPluginEnabled = false;
-	strcpy(m_szDSMPlugin, "");
-
-	m_fMSLogonRequired = false;
-
-	m_fXRichCursor = false;
-
-	// sf at 2003 - Autoreconnect
-	m_fAutoReconnect = false;
-	m_fIdReconnect = false;
-	m_AutoReconnectPort = 0;
-	strcpy(m_szAutoReconnectAdr, "");
-	strcpy(m_szAutoReconnectId, "");
-
-	// sf at 2005 - No FT User Impersonnation
-	m_fFTUserImpersonation = true;
-	m_fCaptureAlphaBlending = false;
-	m_fBlackAlphaBlending = false;
-
-	m_impersonationtoken=NULL; //byteboon
-
-	m_xdmcpConn=NULL;
-
-	m_impersonationtoken=NULL; // Modif Jeremy C. 
-
-	m_fRunningFromExternalService = true;
-	m_fAutoRestart = false;
-    m_ftTimeout = FT_RECV_TIMEOUT;
-    m_keepAliveInterval = KEEPALIVE_INTERVAL;
-
-	// adzm 2010-08
-	m_socketKeepAliveTimeout = SOCKET_KEEPALIVE_TIMEOUT;
-
-	
-	//adzm 2010-05-12 - dsmplugin config
-	m_szDSMPluginConfig[0] = '\0';
-	OS_Shutdown=false;
-}
-
-vncServer::~vncServer()
-{
-	vnclog.Print(LL_STATE, VNCLOG("shutting down server object1\n"));
-
-	// We don't want to retry when we are shutting down...
-	m_fAutoReconnect = FALSE;
-	m_fIdReconnect = FALSE;
-
-	// if we are in the middle of retrying our autoreconnect - kill the timer
-	if ( m_retry_timeout > 0 )
-	{
-		KillTimer( NULL, m_retry_timeout );
-		m_retry_timeout = 0;
-	}
-
-	// If there is a socket_conn object then delete it
-	if (m_socketConn != NULL)
-	{
-		delete m_socketConn;
-		m_socketConn = NULL;
-	}
-
-	if (m_httpConn != NULL)
-	{
-		delete m_httpConn;
-		m_httpConn = NULL;
-	}
-
-	// Modif Jeremy C. 
-	if(m_impersonationtoken) 
-		CloseHandle(m_impersonationtoken);
-
-	// Remove any active clients!
-	KillAuthClients();
-	KillUnauthClients();
-
-	// Wait for all the clients to die
-	WaitUntilAuthEmpty();
-	WaitUntilUnauthEmpty();
-
-	// Don't free the desktop until no KillClient is likely to free it
-	{	omni_mutex_lock l(m_desktopLock);
-
-		if (m_desktop != NULL)
-		{
-			delete m_desktop;
-			m_desktop = NULL;
-		}
-	}
-	while (g_Desktop_running)
-	{
-		Sleep(100);
-		vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown\n"));
-	}
-
-	// Don't free the authhosts string until no more connections are possible
-	if (m_auth_hosts != 0)
-	{
-		free(m_auth_hosts);
-		m_auth_hosts = 0;
-	}
-
-	if (m_name != NULL)
-	{
-		free(m_name);
-		m_name = NULL;
-	}
-
-	if (m_clientquitsig != NULL)
-	{
-		delete m_clientquitsig;
-		m_clientquitsig = NULL;
-	}
-
-	// Modif sf at 2002 - DSMPlugin handling
-	if (m_pDSMPlugin != NULL)
-	{
-		delete(m_pDSMPlugin);
-		m_pDSMPlugin=NULL;
-		vnclog.Print(LL_SOCKINFO, VNCLOG("~server m_pDSMPlugin = NULL \n"));
-	}
-
-	// Free the host blacklist
-	while (m_blacklist) {
-		vncServer::BlacklistEntry *current = m_blacklist;
-		m_blacklist=m_blacklist->_next;
-
-		free (current->_machineName);
-		delete current;
-	}
-	//We need to give the client thread to give some time to close
-	// bad hack
-	//Sleep(500);
-	//sometimes crash, vnclog seems already removed
-	//	vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)\n"));
-	g_Server_running=false;
-}
-
-void
-vncServer::ShutdownServer()
-{
-	vnclog.Print(LL_STATE, VNCLOG("shutting down server object2\n"));
-
-	// We don't want to retry when we are shutting down...
-	m_fAutoReconnect = FALSE;
-	m_fIdReconnect = FALSE;
-
-	// if we are in the middle of retrying our autoreconnect - kill the timer
-	if ( m_retry_timeout > 0 )
-	{
-		KillTimer( NULL, m_retry_timeout );
-		m_retry_timeout = 0;
-	}
-
-	// If there is a socket_conn object then delete it
-	if (m_socketConn != NULL)
-	{
-		delete m_socketConn;
-		m_socketConn = NULL;
-	}
-
-	if (m_httpConn != NULL)
-	{
-		delete m_httpConn;
-		m_httpConn = NULL;
-	}
-
-	// Modif Jeremy C. 
-	if(m_impersonationtoken) 
-		CloseHandle(m_impersonationtoken);
-
-	// Remove any active clients!
-	KillAuthClients();
-	KillUnauthClients();
-
-	// Wait for all the clients to die
-	WaitUntilAuthEmpty();
-	WaitUntilUnauthEmpty();
-
-	// Don't free the desktop until no KillClient is likely to free it
-	{	omni_mutex_lock l(m_desktopLock);
-
-		if (m_desktop != NULL)
-		{
-			delete m_desktop;
-			m_desktop = NULL;
-		}
-	}
-	while (g_Desktop_running)
-	{
-		Sleep(100);
-		vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown\n"));
-	}
-
-	// Don't free the authhosts string until no more connections are possible
-	if (m_auth_hosts != 0)
-	{
-		free(m_auth_hosts);
-		m_auth_hosts = 0;
-	}
-
-	if (m_name != NULL)
-	{
-		free(m_name);
-		m_name = NULL;
-	}
-
-	if (m_clientquitsig != NULL)
-	{
-		delete m_clientquitsig;
-		m_clientquitsig = NULL;
-	}
-
-	// Modif sf at 2002 - DSMPlugin handling
-	if (m_pDSMPlugin != NULL)
-	{
-		delete(m_pDSMPlugin);
-		m_pDSMPlugin=NULL;
-		vnclog.Print(LL_SOCKINFO, VNCLOG("ShutdownServer m_pDSMPlugin = NULL \n"));
-	}
-
-	// Free the host blacklist
-	while (m_blacklist) {
-		vncServer::BlacklistEntry *current = m_blacklist;
-		m_blacklist=m_blacklist->_next;
-
-		free (current->_machineName);
-		delete current;
-	}
-	//We need to give the client thread to give some time to close
-	// bad hack
-	//Sleep(500);
-	//sometimes crash, vnclog seems already removed
-//	vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)\n"));
-	g_Server_running=false;
-}
-
-// Client handling functions
-vncClientId vncServer::AddClient(VSocket *socket, BOOL auth, BOOL shared)
-{
-	return AddClient(socket, auth, shared, /*FALSE,*/ 0, /*TRUE, TRUE,*/NULL); 
-}
-
-vncClientId vncServer::AddClient(VSocket *socket, BOOL auth, BOOL shared, rfbProtocolVersionMsg *protocolMsg)
-{
-	return AddClient(socket, auth, shared, /*FALSE,*/ 0, /*TRUE, TRUE,*/protocolMsg); 
-}
-
-// adzm 2009-07-05 - repeater IDs
-vncClientId vncServer::AddClient(VSocket *socket,
-					 BOOL auth,
-					 BOOL shared,
-					 int capability,
-					 /*BOOL keysenabled, BOOL ptrenabled,*/
-					 rfbProtocolVersionMsg *protocolMsg)
-{
-	return AddClient(socket, auth, shared, /*FALSE,*/ 0, /*TRUE, TRUE,*/protocolMsg, NULL, NULL, 0);
-}
-
-// adzm 2009-07-05 - repeater IDs
-vncClientId vncServer::AddClient(VSocket *socket,
-					 BOOL auth,
-					 BOOL shared,
-					 int capability,
-					 /*BOOL keysenabled, BOOL ptrenabled,*/
-					 rfbProtocolVersionMsg *protocolMsg,
-					 VString szRepeaterID,
-					 VString szHost,
-					 VCard port)
-{
-	vnclog.Print(LL_STATE, VNCLOG("AddClient() started\n"));
-	
-	vncClient *client;
-
-	omni_mutex_lock l(m_clientsLock);
-
-	// Try to allocate a client id...
-	vncClientId clientid = m_nextid;
-	do
-	{
-		clientid = (clientid+1) % MAX_CLIENTS;
-		if (clientid == m_nextid)
-		{
-			delete socket;
-			return -1;
-		}
-	}
-	while (m_clientmap[clientid] != NULL);
-
-	// Create a new client and add it to the relevant client list
-	client = new vncClient();
-	if (client == NULL)
-	{
-		delete socket;
-		return -1;
-	}
-
-	// Set the client's settings
-	client->SetProtocolVersion(protocolMsg);
-	client->SetCapability(capability);
-	client->EnableKeyboard(/*keysenabled &&*/ m_enable_remote_inputs);
-	client->EnablePointer(/*ptrenabled &&*/ m_enable_remote_inputs);
-    client->EnableJap(/*ptrenabled &&*/ m_enable_jap_input ? true : false);
-
-	// adzm 2009-07-05 - repeater IDs
-	if (szRepeaterID) {
-		client->SetRepeaterID(szRepeaterID);
-	}
-	// adzm 2009-08-02
-	if (szHost) {
-		client->SetHost(szHost);
-	}
-	client->SetHostPort(port);
-
-	// Start the client
-	if (!client->Init(this, socket, auth, shared, clientid))
-	{
-		// The client will delete the socket for us...
-		vnclog.Print(LL_CONNERR, VNCLOG("failed to initialise client object\n"));
-		delete client;
-		return -1;
-	}
-
-	m_clientmap[clientid] = client;
-
-	// Add the client to unauth the client list
-	m_unauthClients.push_back(clientid);
-
-	// Notify anyone interested about this event
-	DoNotify(WM_SRV_CLIENT_CONNECT, 0, 0);
-
-	vnclog.Print(LL_INTINFO, VNCLOG("AddClient() done\n"));
-
-	// adzm 2009-07-05 - Balloon
-	if (SPECIAL_SC_PROMPT) {
-		vncClientList::iterator i;
-		char szInfo[256];
-		strcpy(szInfo, "Waiting for connection... ");
-
-		for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-		{
-
-
-			vncClient* pclient = GetClient(*i);
-			if (pclient->GetRepeaterID() && (strlen(pclient->GetRepeaterID()) > 0) ) {
-				strncat_s(szInfo, 255, pclient->GetRepeaterID(), _TRUNCATE);
-			} else {
-				strncat_s(szInfo, 255, pclient->GetClientName(), _TRUNCATE);
-			}			
-			
-			// adzm 2009-07-05			
-			strncat_s(szInfo, 255, ", ", _TRUNCATE);
-		}
-
-		if (m_unauthClients.size() > 0) {
-			szInfo[strlen(szInfo) - 2] = '\0';
-			vncMenu::NotifyBalloon(szInfo, NULL);
-		}		
-	}
-
-	return clientid;
-}
-
-char *vncDeskThreadError(DWORD code)
-{
-    // create default message
-    static char msg[255];
-    _snprintf(msg, sizeof msg, "Unknown error %u", code);
-    msg[sizeof msg - 1] = 0;
-
-    switch (code)
-    {
-        case ERROR_DESKTOP_NO_PALETTE:
-            return "Unable to determine color palette";
-        case ERROR_DESKTOP_INIT_FAILED:
-            return "Unable to select input desktop";
-        case ERROR_DESKTOP_UNSUPPORTED_PIXEL_ORGANIZATION:
-            return "Incompatible graphics device driver (planar pixel format)";
-        case ERROR_DESKTOP_UNSUPPORTED_PIXEL_FORMAT:
-            return "Unsupported true color pixel format";
-        case ERROR_DESKTOP_NO_HOOKWINDOW:
-            return "Unable to create hook window";
-        case ERROR_DESKTOP_NO_ROOTDC:
-        	return "Unable to create compatible device context";
-        case ERROR_DESKTOP_NO_BITBLT:
-        	return "Unsupported graphics device driver (no BitBlt)";
-        case ERROR_DESKTOP_NO_GETDIBITS:
-        	return "Unsupported graphics device driver (no GetDIBits)";
-		case ERROR_DESKTOP_NO_COMPATBITMAP:
-			return "Unable to create compatible bitmap";
-		case ERROR_DESKTOP_NO_DISPLAYFORMAT:
-			return 	"Unable to get Display format";
-        case ERROR_DESKTOP_OUT_OF_MEMORY:
-            return "Out of memory";
-        case ERROR_DESKTOP_NO_DESKTOPTHREAD:
-            return "Unable to create desktop hook thread";
-		case ERROR_DESKTOP_NO_DIBSECTION_OR_COMPATBITMAP:
-			return "Unable to create device independent bitmap or fallback bitmap";
-        default:
-            break;
-    }
-
-    return msg;
-}
-BOOL
-vncServer::Authenticated(vncClientId clientid)
-{
-	vncClientList::iterator i;
-	BOOL authok = TRUE;
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock2\n"));
-	omni_mutex_lock l1(m_desktopLock);
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock3\n"));
-	omni_mutex_lock l2(m_clientsLock);
-
-	vncClient *client = NULL;
-
-	// Search the unauthenticated client list
-	for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-	{
-		// Is this the right client?
-		if ((*i) == clientid)
-		{
-			client = GetClient(clientid);
-			
-
-			// Yes, so remove the client and add it to the auth list
-			m_unauthClients.erase(i);
-
-			// Create the screen handler if necessary
-			if (m_desktop == NULL)
-			{
-				m_desktop = new vncDesktop();
-
-				if (m_desktop == NULL)
-				{
-					client->Kill();
-					authok = FALSE;
-					break;
-				}
-				// Preset toggle prim/sec/both
-				// change, to get it final stable, we only gonna handle single and multi monitors
-				// 1=single monitor, 2 is multi monitor
-				m_desktop->m_buffer.MultiMonitors(1);
-				if (Secondary()) m_desktop->m_buffer.MultiMonitors(2);
-
-
-                DWORD startup_status = 0;
-				if ((startup_status = m_desktop->Init(this)) != 0)
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("Desktop init failed, unlock in application mode ? \n"));
-					client->Kill();
-					authok = FALSE;
-					delete m_desktop;
-					m_desktop = NULL;
-
-					break;
-				}
-			}
-
-			// Tell the client about this new buffer
-			client->SetBuffer(&(m_desktop->m_buffer));
-
-			// Add the client to the auth list
-			m_authClients.push_back(clientid);
-
-			break;
-		}
-	}
-
-	// Notify anyone interested of this event
-	DoNotify(WM_SRV_CLIENT_AUTHENTICATED, 0, 0);
-
-	// adzm 2009-07-05 - Balloon
-	if (SPECIAL_SC_PROMPT && (client != NULL) ) {
-		char szInfo[256];
-
-		if (client->GetRepeaterID() && (strlen(client->GetRepeaterID()) > 0) ) {
-			_snprintf(szInfo, 255, "Remote user successfully connected (%s) and is currently sharing your desktop.", client->GetRepeaterID());
-		} else {
-			_snprintf(szInfo, 255, "Remote user successfully connected (%s) and is currently sharing your desktop.", client->GetClientName());
-		}
-
-		szInfo[255] = '\0';
-
-		vncMenu::NotifyBalloon(szInfo, NULL);
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("Authenticated() done\n"));
-
-	return authok;
-}
-
-void
-vncServer::KillClient(vncClientId clientid)
-{
-	vncClientList::iterator i;
-	BOOL done = FALSE;
-
-	omni_mutex_lock l(m_clientsLock);
-
-	// Find the client in one of the two lists
-	for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-	{
-		// Is this the right client?
-		if ((*i) == clientid)
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client\n"));
-
-			// Ask the client to die
-			vncClient *client = GetClient(clientid);
-			client->Kill();
-
-			done = TRUE;
-			break;
-		}
-	}
-	if (!done)
-	{
-		for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-		{
-			// Is this the right client?
-			if ((*i) == clientid)
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("killing auth client\n"));
-
-				// Yes, so kill it
-				vncClient *client = GetClient(clientid);
-				client->Kill();
-
-				done = TRUE;
-				break;
-			}
-		}
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("KillClient() done\n"));
-}
-
-//
-// sf at 2002 - Kill the client which has the passed name
-//
-void vncServer::KillClient(LPSTR szClientName)
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-	vncClient *pClient = NULL;
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		pClient = GetClient(*i);
-		if (!_stricmp(pClient->GetClientName(), szClientName))
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("Killing client named: %s\n"), szClientName);
-			pClient->Kill();
-		}
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done\n"));
-}
-
-
-//
-// sf at 2002 - Open a textchat window with the named client
-//
-void vncServer::TextChatClient(LPSTR szClientName)
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-	vncClient *pClient = NULL;
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		pClient = GetClient(*i);
-		if (!_stricmp(pClient->GetClientName(), szClientName))
-		{
-			if (!pClient->IsUltraViewer())
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("Client %s is not Ultra. Doesn't know TextChat\n"), szClientName);
-				vncTimedMsgBox::Do(
-									sz_ID_ULTRAVNC_TEXTCHAT,
-									sz_ID_ULTRAVNC_WARNING,
-									MB_ICONINFORMATION | MB_OK
-									);
-				break;
-			}
-			vnclog.Print(LL_INTINFO, VNCLOG("TextChat with client named: %s\n"), szClientName);
-#ifndef ULTRAVNC_ITALC_SUPPORT
-			pClient->GetTextChatPointer()->OrderTextChat();
-#endif
-			break;
-		}
-	}
-	vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done\n"));
-}
-
-bool vncServer::IsUltraVncViewer()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{	
-		if (GetClient(*i)->IsUltraViewer())return true;
-	}
-	return false;
-}
-
-bool vncServer::AreThereMultipleViewers()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-	int a=0;
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{	
-		a++;
-	}
-	if (a<=1) return false;
-	else return true;
-}
-
-
-void
-vncServer::KillAuthClients()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	// Tell all the authorised clients to die!
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("killing auth client\n"));
-
-		// Kill the client
-		GetClient(*i)->Kill();
-	}
-	//autoreconnect and service
-	//if (m_fRunningFromExternalService) fShutdownOrdered=true;
-	vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() done\n"));
-}
-
-//
-// sf at 2002 - Fill the passed ListBox with clients names
-//
-void vncServer::ListAuthClients(HWND hListBox)
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// adzm 2009-07-05
-		vncClient* client = GetClient(*i);
-		if (client->GetRepeaterID() && (strlen(client->GetRepeaterID()) > 0) ) {
-			char szDescription[256];
-			_snprintf(szDescription, 255, "%s - %s", client->GetRepeaterID(), client->GetClientName());
-			szDescription[255] = '\0';
-
-			SendMessage(hListBox, 
-						LB_ADDSTRING,
-						0,
-						(LPARAM) szDescription
-						);
-		} else {
-			SendMessage(hListBox, 
-						LB_ADDSTRING,
-						0,
-						(LPARAM) client->GetClientName()
-						);
-		}
-	}
-}
-
-// adzm 2009-07-05
-void vncServer::ListUnauthClients(HWND hListBox)
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-	{
-		// adzm 2009-07-05
-		vncClient* client = GetClient(*i);
-		if (client->GetRepeaterID() && (strlen(client->GetRepeaterID()) > 0) ) {
-			char szDescription[256];
-			_snprintf(szDescription, 255, "%s - %s", client->GetRepeaterID(), client->GetClientName());
-			szDescription[255] = '\0';
-
-			SendMessage(hListBox, 
-						LB_ADDSTRING,
-						0,
-						(LPARAM) szDescription
-						);
-		} else {
-			SendMessage(hListBox, 
-						LB_ADDSTRING,
-						0,
-						(LPARAM) client->GetClientName()
-						);
-		}
-	}
-}
-
-/*
-//
-// sf at 2003 - Returns the first client name (IP)
-//
-void vncServer::FirstClientName()
-{
-	omni_mutex_lock l(m_clientsLock);
-	return GetClient(*(m_authClients.begin()))->GetClientName();
-}
-*/
-
-
-//
-// sf at 2002 - test if there's a slow client connected
-// The criteria is a client that has been using a slow
-// encoding for more than 10 seconds after its connection
-//
-bool vncServer::IsThereASlowClient()
-{
-	vncClientList::iterator i;
-	bool fFound = false;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		if (GetClient(*i)->IsSlowEncoding())
-		{
-			if (timeGetTime() - GetClient(*i)->GetConnectTime() > 10000) 
-			{
-				fFound = true;
-				break;
-			}	
-			else
-				continue;
-		}
-		else
-			continue;
-	}
-	return fFound;
-}
-
-bool vncServer::IsThereAUltraEncodingClient()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		if (GetClient(*i)->IsUltraEncoding())
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-bool vncServer::IsThereFileTransBusy()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		if (GetClient(*i)->IsFileTransBusy())
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-
-void
-vncServer::KillUnauthClients()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	// Tell all the authorised clients to die!
-	for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client\n"));
-
-		// Kill the client
-		GetClient(*i)->Kill();
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("KillUnauthClients() done\n"));
-}
-
-
-UINT
-vncServer::AuthClientCount()
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	return m_authClients.size();
-}
-
-UINT
-vncServer::UnauthClientCount()
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	return m_unauthClients.size();
-}
-
-BOOL
-vncServer::UpdateWanted()
-{
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-
-	// Iterate over the authorised clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		if (GetClient(*i)->UpdateWanted())
-			return TRUE;
-	}
-	return FALSE;
-}
-
-BOOL
-vncServer::RemoteEventReceived()
-{
-	vncClientList::iterator i;
-	BOOL result = FALSE;
-	omni_mutex_lock l(m_clientsLock);
-
-	// Iterate over the authorised clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		result = result || GetClient(*i)->RemoteEventReceived();
-	}
-	return result;
-}
-
-void
-vncServer::WaitUntilAuthEmpty()
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	// Wait for all the clients to exit
-	while (!m_authClients.empty())
-	{
-		// Wait for a client to quit
-		m_clientquitsig->wait();
-	}
-}
-
-void
-vncServer::WaitUntilUnauthEmpty()
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	// Wait for all the clients to exit
-	while (!m_unauthClients.empty())
-	{
-		// Wait for a client to quit
-		m_clientquitsig->wait();
-	}
-}
-
-// Client info retrieval/setup
-vncClient*
-vncServer::GetClient(vncClientId clientid)
-{
-	if ((clientid >= 0) && (clientid < MAX_CLIENTS))
-		return m_clientmap[clientid];
-	return NULL;
-}
-
-vncClientList
-vncServer::ClientList()
-{
-	vncClientList clients;
-
-	omni_mutex_lock l(m_clientsLock);
-
-	clients = m_authClients;
-
-	return clients;
-}
-
-void
-vncServer::SetCapability(vncClientId clientid, int capability)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	vncClient *client = GetClient(clientid);
-	if (client != NULL)
-		client->SetCapability(capability);
-}
-
-void
-vncServer::SetKeyboardEnabled(vncClientId clientid, BOOL enabled)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	vncClient *client = GetClient(clientid);
-	if (client != NULL)
-		client->EnableKeyboard(enabled);
-}
-
-void
-vncServer::SetPointerEnabled(vncClientId clientid, BOOL enabled)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	vncClient *client = GetClient(clientid);
-	if (client != NULL)
-		client->EnablePointer(enabled);
-}
-
-int
-vncServer::GetCapability(vncClientId clientid)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	vncClient *client = GetClient(clientid);
-	if (client != NULL)
-		return client->GetCapability();
-	return 0;
-}
-
-const char*
-vncServer::GetClientName(vncClientId clientid)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	vncClient *client = GetClient(clientid);
-	if (client != NULL)
-		return client->GetClientName();
-	return NULL;
-}
-
-// RemoveClient should ONLY EVER be used by the client to remove itself.
-void
-vncServer::RemoveClient(vncClientId clientid)
-{
-	vncClientList::iterator i;
-	BOOL done = FALSE;
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock1\n"));
-	omni_mutex_lock l1(m_desktopLock);
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock3\n"));
-	{	omni_mutex_lock l2(m_clientsLock);
-
-		// Find the client in one of the two lists
-		for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-		{
-			// Is this the right client?
-			if ((*i) == clientid)
-			{
-				vnclog.Print(LL_INTINFO, VNCLOG("removing unauthorised client\n"));
-
-				// Yes, so remove the client and kill it
-				m_unauthClients.erase(i);
-				if ( clientid>=0 && clientid< 512) m_clientmap[clientid] = NULL;
-				done = TRUE;
-				break;
-			}
-		}
-		if (!done)
-		{
-			for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-			{
-				// Is this the right client?
-				if ((*i) == clientid)
-				{
-					vnclog.Print(LL_INTINFO, VNCLOG("removing authorised client\n"));
-
-					// Yes, so remove the client and kill it
-					m_authClients.erase(i);
-					if ( clientid>=0 && clientid< 512) m_clientmap[clientid] = NULL;
-
-					done = TRUE;
-					break;
-				}
-			}
-		}
-
-		// Signal that a client has quit
-		m_clientquitsig->signal();
-
-	} // Unlock the clientLock
-
-	// Are there any authorised clients connected?
-	if (m_authClients.empty() && (m_desktop != NULL))
-	{
-		vnclog.Print(LL_STATE, VNCLOG("deleting desktop server\n"));
-
-		// sf at 2007 - Do not lock/logoff even if required when WinVNC autorestarts (on desktop change (XP FUS / Vista))
-		if (!AutoRestartFlag() && !OS_Shutdown)
-		{
-			// Are there locksettings set?
-			if (LockSettings() == 1 || clearconsole)
-			{
-				// Yes - lock the machine on disconnect!
-				vncService::LockWorkstation();
-			} 
-			else if (LockSettings() > 1)
-			{
-				char username[UNLEN+1];
-
-				vncService::CurrentUser((char *)&username, sizeof(username));
-				if (strcmp(username, "") != 0)
-				{
-					// Yes - force a user logoff on disconnect!
-					if (!ExitWindowsEx(EWX_LOGOFF, 0))
-						vnclog.Print(LL_CONNERR, VNCLOG("client disconnect - failed to logoff user!\n"));
-				}
-			}
-		}
-
-		// Delete the screen server
-		delete m_desktop;
-		m_desktop = NULL;
-		vnclog.Print(LL_STATE, VNCLOG("desktop deleted\n"));
-	}
-
-	// Notify anyone interested of the change
-	DoNotify(WM_SRV_CLIENT_DISCONNECT, 0, 0);
-
-	vnclog.Print(LL_INTINFO, VNCLOG("RemoveClient() done\n"));
-}
-
-// NOTIFICATION HANDLING!
-
-// Connect/disconnect notification
-BOOL
-vncServer::AddNotify(HWND hwnd)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	// Add the window handle to the list
-	m_notifyList.push_front(hwnd);
-
-	return TRUE;
-}
-
-BOOL
-vncServer::RemNotify(HWND hwnd)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	// Remove the window handle from the list
-	vncNotifyList::iterator i;
-	for (i=m_notifyList.begin(); i!=m_notifyList.end(); ++i)
-	{
-		if ((*i) == hwnd)
-		{
-			// Found the handle, so remove it
-			m_notifyList.erase(i);
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
-// Send a notification message
-void
-vncServer::DoNotify(UINT message, WPARAM wparam, LPARAM lparam)
-{
-	omni_mutex_lock l(m_clientsLock);
-
-	// Send the given message to all the notification windows
-	vncNotifyList::iterator i;
-	for (i=m_notifyList.begin(); i!=m_notifyList.end(); ++i)
-	{
-		PostMessage((*i), message, wparam, lparam);
-	}
-}
-
-void
-vncServer::UpdateMouse()
-{
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this mouse update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->UpdateMouse();
-	}
-}
-
-// adzm - 2010-07 - Extended clipboard
-/*
-void
-vncServer::UpdateClipText(const char* text)
-{
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->UpdateClipText(text);
-	}
-}
-*/
-
-
-// adzm - 2010-07 - Extended clipboard
-void
-vncServer::UpdateClipTextEx(HWND hwndOwner, vncClient* excludeClient)
-{
-	ClipboardData clipboardData;
-	if (clipboardData.Load(hwndOwner)) {
-		vncClientList::iterator i;
-		
-		omni_mutex_lock l(m_clientsLock);
-
-		// Post this update to all the connected clients
-		for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-		{
-			// Post the update
-			vncClient* client = GetClient(*i);
-			if (client != excludeClient) {
-				client->UpdateClipTextEx(clipboardData);
-			}
-		}
-	}
-}
-
-void
-vncServer::UpdateCursorShape()
-{
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->UpdateCursorShape();
-	}
-}
-
-void
-vncServer::UpdatePalette(bool lock)
-{
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->UpdatePalette(lock);
-	}
-}
-
-void
-vncServer::UpdateLocalFormat(bool lock)
-{
-	vncClientList::iterator i;
-	
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->UpdateLocalFormat(lock);
-	}
-}
-
-void
-vncServer::UpdateLocalClipText(LPSTR text)
-{
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock5\n"));
-	omni_mutex_lock l(m_desktopLock);
-
-	if (m_desktop != NULL)
-		m_desktop->SetClipText(text);
-}
-
-
-// adzm - 2010-07 - Extended clipboard
-void
-vncServer::UpdateLocalClipTextEx(ExtendedClipboardDataMessage& extendedClipboardDataMessage, vncClient* sourceClient)
-{
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock5\n"));
-	{
-		omni_mutex_lock l(m_desktopLock);
-
-		if (m_desktop != NULL)
-			m_desktop->SetClipTextEx(extendedClipboardDataMessage);
-	}
-
-	// At this point we could notify other viewers and update their clipboards too, but in practice this is very confusing.
-	// Perhaps what should be done is to notify the viewers that the clipboard has changed?
-	// Worry about it later.
-	/*
-	{ 
-		omni_mutex_lock l(m_clientsLock);
-
-		// Post this update to all the connected clients
-		for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-		{
-			// Post the update
-			vncClient* client = GetClient(*i);
-			if (client != excludeClient) {
-				client->UpdateClipTextEx(clipboardData, (CARD32)clipPeek);
-			}
-		}
-	}
-	*/
-}
-
-// Name and port number handling
-void
-vncServer::SetName(const char * name)
-{
-	// Set the name of the desktop
-	if (m_name != NULL)
-	{
-		free(m_name);
-		m_name = NULL;
-	}
-	
-	m_name = _strdup(name);
-}
-
-// TightVNC 1.2.7
-void
-vncServer::SetPorts(const UINT port_rfb, const UINT port_http)
-{
-	if (m_port != port_rfb || m_port_http != port_http) {
-		// Set port numbers to use
-		m_port = port_rfb;
-		m_port_http = port_http;
-
-		// If there is already a listening socket then close and re-open it...
-		BOOL socketon = SockConnected();
-		SockConnect(FALSE);
-		if (socketon)
-			SockConnect(TRUE);
-    }
-}
-
-// RealVNC method
-/*
-void
-vncServer::SetPort(const UINT port)
-{
-    if (m_port != port)
-    {
-	/////////////////////////////////
-	// Adjust the listen socket
-
-	// Set the port number to use
-	m_port = port;
-
-	// If there is already a listening socket then close and re-open it...
-	BOOL socketon = SockConnected();
-
-	SockConnect(FALSE);
-	if (socketon)
-	    SockConnect(TRUE);
-
-    }
-}
-
-
-UINT
-vncServer::GetPort()
-{
-	return m_port;
-}
-*/
-
-void
-vncServer::SetPassword(const char *passwd)
-{
-	memcpy(m_password, passwd, MAXPWLEN);
-}
-
-void
-vncServer::GetPassword(char *passwd)
-{
-	memcpy(passwd, m_password, MAXPWLEN);
-}
-
-void //PGM
-vncServer::SetPassword2(const char *passwd2) //PGM
-{ //PGM
-	memcpy(m_password2, passwd2, MAXPWLEN); //PGM
-} //PGM
-
-void //PGM
-vncServer::GetPassword2(char *passwd2) //PGM
-{ //PGM
-	memcpy(passwd2, m_password2, MAXPWLEN); //PGM
-} //PGM
-
-// Remote input handling
-void
-vncServer::EnableRemoteInputs(BOOL enable)
-{
-	m_enable_remote_inputs = enable;
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		GetClient(*i)->EnableKeyboard(m_enable_remote_inputs);
-		GetClient(*i)->EnablePointer(m_enable_remote_inputs);
-	}
-}
-
-BOOL vncServer::RemoteInputsEnabled()
-{
-	return m_enable_remote_inputs;
-}
-
-// Local input handling
-void
-vncServer::DisableLocalInputs(BOOL disable)
-{
-	m_disable_local_inputs = disable;
-}
-
-bool vncServer::LocalInputsDisabled()
-{
-    return m_disable_local_inputs ? true : false;
-}
-
-BOOL vncServer::JapInputEnabled()
-{
-	return m_enable_jap_input;
-}
-
-void
-vncServer::EnableJapInput(BOOL enable)
-{
-	m_enable_jap_input = enable;
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-        GetClient(*i)->EnableJap(m_enable_jap_input ? true : false);
-	}
-}
-
-void
-vncServer::Clearconsole(BOOL enable)
-{
-	clearconsole=(enable != FALSE);
-}
-
-
-
-void 
-vncServer::KillSockConnect()
-{
-	if (m_socketConn != NULL)
-		delete m_socketConn;
-	m_socketConn = NULL;
-
-}
-
-// Socket connection handling
-BOOL
-vncServer::SockConnect(BOOL On)
-{
-	// Are we being asked to switch socket connects on or off?
-	vnclog.Print(LL_SOCKINFO, VNCLOG("SockConnect %d\n"), On);
-	if (On)
-	{
-		// Is there a listening socket?
-		if (m_socketConn == NULL)
-		{
-			m_socketConn = new vncSockConnect();
-			if (m_socketConn == NULL)
-				return FALSE;
-
-			// Are we to use automatic port selection?
-			if (m_autoportselect)
-			{
-				BOOL ok = FALSE;
-
-				// Yes, so cycle through the ports, looking for a free one!
-				for (int i=0; i < 99; i++)
-				{
-					m_port = DISPLAY_TO_PORT(i);
-					m_port_http = DISPLAY_TO_HPORT(i);
-
-					vnclog.Print(LL_CLIENTS, VNCLOG("trying port number %d\n"), m_port);
-
-					// Attempt to connect to the port
-					VSocket tempsock;
-					if (tempsock.Create())
-					{
-						if (!tempsock.Connect("localhost", m_port))
-						{
-							// Couldn't connect, so this port is probably usable!
-							if (m_socketConn->Init(this, m_port))
-							{
-								ok = TRUE;
-								break;
-							}
-						}
-					}
-				}
-
-				if (!ok)
-				{
-					delete m_socketConn;
-					m_socketConn = NULL;
-					return FALSE;
-				}
-			} else
-			{
-				// No autoportselect
-				if (!m_socketConn->Init(this, m_port))
-				{
-					delete m_socketConn;
-					m_socketConn = NULL;
-					return FALSE;
-				}
-			}
-
-			// Now let's start the HTTP connection stuff
-			EnableHTTPConnect(m_enableHttpConn);
-			EnableXDMCPConnect(m_enableXdmcpConn);
-			vnclog.Print(LL_SOCKINFO, VNCLOG("SockConnect  Done %d\n"), On);
-		}
-	}
-	else
-	{
-
-		// Is there a listening socket?
-		if (m_socketConn != NULL)
-		{
-
-			// *** JNW - Trying to fix up a lock-up when the listening socket closes
-			vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() fix up a lock-up \n"));
-			KillAuthClients();
-			KillUnauthClients();
-			WaitUntilAuthEmpty();
-			WaitUntilUnauthEmpty();
-
-			// Close the socket
-			delete m_socketConn;
-			m_socketConn = NULL;
-		}
-
-		// Is there an HTTP socket active?
-		EnableHTTPConnect(m_enableHttpConn);
-	}
-
-	return TRUE;
-}
-
-BOOL
-vncServer::SockConnected()
-{
-	return m_socketConn != NULL;
-}
-
-BOOL
-vncServer::EnableHTTPConnect(BOOL enable)
-{
-	m_enableHttpConn = enable;
-	if (enable && m_socketConn)
-	{
-		if (m_httpConn == NULL)
-		{
-			m_httpConn = new vncHTTPConnect;
-			if (m_httpConn != NULL)
-			{
-				// Start up the HTTP server
-				// TODO: allow applet params handling like in TightVNC 1.2.7
-				if (!m_httpConn->Init(this,
-									// PORT_TO_DISPLAY(m_port) + HTTP_PORT_OFFSET)
-									m_port_http)
-					)
-				{
-					delete m_httpConn;
-					m_httpConn = NULL;
-					return FALSE;
-				}
-			}
-		}
-	}
-	else
-	{
-		if (m_httpConn != NULL)
-		{
-			// Close the socket
-			delete m_httpConn;
-			m_httpConn = NULL;
-		}
-	}
-
-	return TRUE;
-}
-
-BOOL
-vncServer::EnableXDMCPConnect(BOOL enable)
-{
-	m_enableXdmcpConn = enable;
-	if (enable && m_socketConn)
-	{
-		if (m_xdmcpConn==NULL)
-		{
-			char szCurrentDir[MAX_PATH];
-			if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-				{
-					char* p = strrchr(szCurrentDir, '\\');
-					if (p == NULL) return 0;
-					*p = '\0';
-					strcat (szCurrentDir,"\\xdmcp\\xdmcp.exe");
-				}
-			STARTUPINFO ssi;
-			PROCESS_INFORMATION ppi;
-			ZeroMemory( &ssi, sizeof(ssi) );
-			ssi.cb = sizeof(ssi);
-			// Start the child process. 
-			if( !CreateProcess( NULL, // No module name (use command line). 
-				szCurrentDir, // Command line. 
-		       NULL,             // Process handle not inheritable. 
-		        NULL,             // Thread handle not inheritable. 
-		       FALSE,            // Set handle inheritance to FALSE. 
-		       0,                // No creation flags. 
-		       NULL,             // Use parent's environment block. 
-		       ".\\xdmcp",             // Use parent's starting directory. 
-		       &ssi,              // Pointer to STARTUPINFO structure.
-		       &ppi )             // Pointer to PROCESS_INFORMATION structure.
-		   ) 
-			{
-				m_xdmcpConn=NULL;
-				if (ppi.hThread) CloseHandle(ppi.hThread);
-			}
-			else
-			{
-				WaitForInputIdle(ppi.hProcess, 10000);
-				m_xdmcpConn=ppi.hProcess;
-			}
-			
-		}
-	}
-	else
-	{
-		if (m_xdmcpConn != NULL)
-		{
-				TerminateProcess(m_xdmcpConn,0);
-				m_xdmcpConn=NULL;
-
-		}
-	}
-
-	return TRUE;
-}
-
-BOOL
-vncServer::SetLoopbackOnly(BOOL loopbackOnly)
-{
-	if (loopbackOnly != m_loopbackOnly)
-	{
-		m_loopbackOnly = loopbackOnly;
-		BOOL socketConn = SockConnected();
-		SockConnect(FALSE);
-		SockConnect(socketConn);
-	}
-	return TRUE;
-}
-
-BOOL
-vncServer::LoopbackOnly()
-{
-	return m_loopbackOnly;
-}
-
-void
-vncServer::GetScreenInfo(int &width, int &height, int &depth)
-{
-	rfbServerInitMsg scrinfo;
-//	vnclog.Print(LL_INTINFO, VNCLOG("Lock6\n"));
-	omni_mutex_lock l(m_desktopLock);
-
-	//vnclog.Print(LL_INTINFO, VNCLOG("GetScreenInfo called\n"));
-
-	// Is a desktop object currently active?
-	// No, so create a dummy desktop and interrogate it
-	if (m_desktop == NULL)
-	{
-		HDC				hrootdc;
-		hrootdc = GetDC(NULL);
-		if (hrootdc == NULL) {
-				vnclog.Print(LL_INTERR, VNCLOG("Failed rootdc \n"));
-				scrinfo.framebufferWidth = 0;
-				scrinfo.framebufferHeight = 0;
-				scrinfo.format.bitsPerPixel = 0;
-		}
-		else
-		{
-			scrinfo.framebufferWidth = GetDeviceCaps(hrootdc, HORZRES);
-			scrinfo.framebufferHeight = GetDeviceCaps(hrootdc, VERTRES);
-			HBITMAP membitmap = CreateCompatibleBitmap(hrootdc, scrinfo.framebufferWidth, scrinfo.framebufferHeight);
-			if (membitmap == NULL) {
-				scrinfo.framebufferWidth = 0;
-				scrinfo.framebufferHeight = 0;
-				scrinfo.format.bitsPerPixel = 0;
-				}
-			else
-			{
-				struct _BMInfo {
-				BOOL			truecolour;
-				BITMAPINFO		bmi;
-				// Colormap info - comes straight after BITMAPINFO - **HACK**
-				RGBQUAD			cmap[256];
-				} m_bminfo;
-				int result;
-				HDC				hmemdc;
-				memset(&m_bminfo, 0, sizeof(m_bminfo));
-				m_bminfo.bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-				m_bminfo.bmi.bmiHeader.biBitCount = 0;
-				hmemdc = CreateCompatibleDC(hrootdc);
-				if (hmemdc == NULL) 
-					{
-						scrinfo.framebufferWidth = 0;
-						scrinfo.framebufferHeight = 0;
-						scrinfo.format.bitsPerPixel = 0;
-					}
-				else
-					{
-						result = ::GetDIBits(hmemdc, membitmap, 0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-						if (result == 0) 
-							{
-											scrinfo.framebufferWidth = 0;
-											scrinfo.framebufferHeight = 0;
-											scrinfo.format.bitsPerPixel = 0;
-							}
-						else
-							{
-								result = ::GetDIBits(hmemdc, membitmap,  0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS);
-								if (result == 0) 
-									{
-										scrinfo.framebufferWidth = 0;
-										scrinfo.framebufferHeight = 0;
-										scrinfo.format.bitsPerPixel = 0;
-									}
-								else
-									{
-										scrinfo.format.bitsPerPixel = (CARD8)(m_bminfo.bmi.bmiHeader.biBitCount);
-										if (scrinfo.format.bitsPerPixel==24) scrinfo.format.bitsPerPixel=32;
-									}
-							}//result
-					if (hmemdc != NULL) DeleteDC(hmemdc);
-					}//memdc
-				if (membitmap != NULL) DeleteObject(membitmap);
-			}//membitmap
-			if (hrootdc != NULL) ReleaseDC(NULL, hrootdc);
-		}//rootdc
-	
-		// No, so create a dummy desktop and interrogate it
-	/*	if (!desktop.Init(this))
-		{
-			scrinfo.framebufferWidth = 0;
-			scrinfo.framebufferHeight = 0;
-			scrinfo.format.bitsPerPixel = 0;
-		}
-		else
-		{
-			desktop.FillDisplayInfo(&scrinfo);
-		}*/
-	}
-	else
-	{
-		m_desktop->FillDisplayInfo(&scrinfo);
-	}
-
-	// Get the info from the scrinfo structure
-	width = scrinfo.framebufferWidth;
-	height = scrinfo.framebufferHeight;
-	depth = scrinfo.format.bitsPerPixel;
-}
-
-void
-vncServer::SetAuthHosts(const char*hostlist) {
-	omni_mutex_lock l(m_clientsLock);
-
-	if (hostlist == 0) {
-		vnclog.Print(LL_INTINFO, VNCLOG("authhosts cleared\n"));
-		m_auth_hosts = 0;
-		return;
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("authhosts set to \"%s\"\n"), hostlist);
-	if (m_auth_hosts != 0)
-		free(m_auth_hosts);
-
-	m_auth_hosts = _strdup(hostlist);
-}
-
-char*
-vncServer::AuthHosts() {
-	omni_mutex_lock l(m_clientsLock);
-
-	if (m_auth_hosts == 0)
-		return _strdup("");
-	else
-		return _strdup(m_auth_hosts);
-}
-
-inline BOOL
-MatchStringToTemplate(const char *addr, UINT addrlen,
-				      const char *filtstr, UINT filtlen) {
-	if (filtlen == 0)
-		return 1;
-	if (addrlen < filtlen)
-		return 0;
-	for (UINT x = 0; x < filtlen; x++) {
-		if (addr[x] != filtstr[x])
-			return 0;
-	}
-	if ((addrlen > filtlen) && (addr[filtlen] != '.'))
-		return 0;
-	return 1;
-}
-
-vncServer::AcceptQueryReject
-vncServer::VerifyHost(const char *hostname) {
-	omni_mutex_lock l(m_clientsLock);
-
-	// -=- Is the specified host blacklisted?
-	vncServer::BlacklistEntry	*current = m_blacklist;
-	vncServer::BlacklistEntry	*previous = 0;
-	SYSTEMTIME					systime;
-	FILETIME					ftime;
-	LARGE_INTEGER				now;
-
-	// Get the current time as a 64-bit value
-	GetSystemTime(&systime);
-	SystemTimeToFileTime(&systime, &ftime);
-	now.LowPart=ftime.dwLowDateTime;now.HighPart=ftime.dwHighDateTime;
-	now.QuadPart /= 10000000; // Convert it into seconds
-
-	while (current) {
-
-		// Has the blacklist entry timed out?
-		if ((now.QuadPart - current->_lastRefTime.QuadPart) > 0) {
-
-			// Yes.  Is it a "blocked" entry?
-			if (current->_blocked) {
-				// Yes, so unblock it & re-set the reference time
-				current->_blocked = FALSE;
-				current->_lastRefTime.QuadPart = now.QuadPart + 10;
-			} else {
-				// No, so remove it
-				if (previous)
-					previous->_next = current->_next;
-				else
-					m_blacklist = current->_next;
-				vncServer::BlacklistEntry *next = current->_next;
-				free(current->_machineName);
-				delete current;
-				current = next;
-				continue;
-			}
-
-		}
-
-		// Is this the entry we're interested in?
-		if ((_stricmp(current->_machineName, hostname) == 0) &&
-			(current->_blocked)) {
-			// Machine is blocked, so just reject it
-    		vnclog.Print(LL_CONNERR, VNCLOG("client %s rejected due to blacklist entry\n"), hostname);
-
-			return vncServer::aqrReject;
-		}
-
-		previous = current;
-		current = current->_next;
-	}
-
-	// Has a hostname been specified?
-	if (hostname == 0) {
-		vnclog.Print(LL_INTWARN, VNCLOG("verify failed - null hostname\n"));
-		return vncServer::aqrReject;
-	}
-
-	// Set the state machine into the correct mode & process the filter
-	enum vh_Mode {vh_ExpectDelimiter, vh_ExpectIncludeExclude, vh_ExpectPattern};
-	vh_Mode machineMode = vh_ExpectIncludeExclude;
-	
-	vncServer::AcceptQueryReject verifiedHost = vncServer::aqrAccept;
-
-	vncServer::AcceptQueryReject patternType = vncServer::aqrReject;
-	UINT authHostsPos = 0;
-	UINT patternStart = 0;
-	UINT hostNameLen = strlen(hostname);
-
-	// Run through the auth hosts string until we hit the end
-	if (m_auth_hosts) {
-		while (1) {
-
-			// Which mode are we in?
-			switch (machineMode) {
-
-				// ExpectIncludeExclude - we should see a + or -.
-			case vh_ExpectIncludeExclude:
-				if (m_auth_hosts[authHostsPos] == '+') {
-					patternType = vncServer::aqrAccept;
-					patternStart = authHostsPos+1;
-					machineMode = vh_ExpectPattern;
-				} else if (m_auth_hosts[authHostsPos] == '-') {	
-					patternType = vncServer::aqrReject;
-					patternStart = authHostsPos+1;
-					machineMode = vh_ExpectPattern;
-				} else if (m_auth_hosts[authHostsPos] == '?') {	
-					patternType = vncServer::aqrQuery;
-					patternStart = authHostsPos+1;
-					machineMode = vh_ExpectPattern;
-				} else if (m_auth_hosts[authHostsPos] != '\0') {
-					vnclog.Print(LL_INTWARN, VNCLOG("verify host - malformed AuthHosts string\n"));
-					machineMode = vh_ExpectDelimiter;
-				}
-				break;
-
-				// ExpectPattern - we expect to see a valid pattern
-			case vh_ExpectPattern:
-				// ExpectDelimiter - we're scanning for the next ':', skipping a pattern
-			case vh_ExpectDelimiter:
-				if ((m_auth_hosts[authHostsPos] == ':') ||
-					(m_auth_hosts[authHostsPos] == '\0')) {
-					if (machineMode == vh_ExpectPattern) {
-						if (patternStart == 0) {
-							vnclog.Print(LL_INTWARN, VNCLOG("verify host - pattern processing failed!\n"));
-						} else {
-							// Process the match
-							if (MatchStringToTemplate(hostname, hostNameLen,
-								&(m_auth_hosts[patternStart]), authHostsPos-patternStart)) {
-								// The hostname matched - apply the include/exclude rule
-								verifiedHost = patternType;
-							}
-						}
-					}
-
-					// We now expect another + or -
-					machineMode = vh_ExpectIncludeExclude;
-				}
-				break;
-			}
-
-			// Have we hit the end of the pattern string?
-			if (m_auth_hosts[authHostsPos] == '\0')
-				break;
-			authHostsPos++;
-		}
-	}
-
-    vnclog.Print(LL_INTINFO, VNCLOG("client %s verifiedHost %u prior to adjustment\n"), hostname, verifiedHost);
-
-	// Based on the server's QuerySetting, adjust the verification result
-	switch (verifiedHost) {
-	case vncServer::aqrAccept:
-		if (QuerySetting() >= 3)
-			verifiedHost = vncServer::aqrQuery;
-		break;
-	case vncServer::aqrQuery:
-		if (QuerySetting() <= 1)
-			verifiedHost = vncServer::aqrAccept;
-		else if (QuerySetting() == 4)
-			verifiedHost = vncServer::aqrReject;
-		break;
-	case vncServer::aqrReject:
-		if (QuerySetting() == 0)
-			verifiedHost = vncServer::aqrQuery;
-		break;
-	};
-
-    vnclog.Print(LL_INTINFO, VNCLOG("client %s verifiedHost %u after adjustment\n"), hostname, verifiedHost);
-	return verifiedHost;
-}
-
-void
-vncServer::AddAuthHostsBlacklist(const char *machine) {
-	omni_mutex_lock l(m_clientsLock);
-
-	// -=- Is the specified host blacklisted?
-	vncServer::BlacklistEntry	*current = m_blacklist;
-
-	// Get the current time as a 64-bit value
-	SYSTEMTIME					systime;
-	FILETIME					ftime;
-	LARGE_INTEGER				now;
-	GetSystemTime(&systime);
-	SystemTimeToFileTime(&systime, &ftime);
-	now.LowPart=ftime.dwLowDateTime;now.HighPart=ftime.dwHighDateTime;
-	now.QuadPart /= 10000000; // Convert it into seconds
-
-	while (current) {
-
-		// Is this the entry we're interested in?
-		if (_stricmp(current->_machineName, machine) == 0) {
-
-			// If the host is already blocked then ignore
-			if (current->_blocked)
-				return;
-
-			// Set the RefTime & failureCount
-			current->_lastRefTime.QuadPart = now.QuadPart + 10;
-			current->_failureCount++;
-
-			if (current->_failureCount > 50)
-				current->_blocked = TRUE;
-			return;
-		}
-
-		current = current->_next;
-	}
-
-	if( strcmp( machine, "127.0.0.1" ) == 0 )
-	{
-		return;
-	}
-
-	// Didn't find the entry
-	current = new vncServer::BlacklistEntry;
-	current->_blocked = FALSE;
-	current->_failureCount = 0;
-	current->_lastRefTime.QuadPart = now.QuadPart + 10;
-	current->_machineName = _strdup(machine);
-	current->_next = m_blacklist;
-	m_blacklist = current;
-}
-
-void
-vncServer::RemAuthHostsBlacklist(const char *machine) {
-	omni_mutex_lock l(m_clientsLock);
-
-	// -=- Is the specified host blacklisted?
-	vncServer::BlacklistEntry	*current = m_blacklist;
-	vncServer::BlacklistEntry	*previous = 0;
-
-	while (current) {
-
-		// Is this the entry we're interested in?
-		if (_stricmp(current->_machineName, machine) == 0) {
-			if (previous)
-				previous->_next = current->_next;
-			else
-				m_blacklist = current->_next;
-			vncServer::BlacklistEntry *next = current->_next;
-			free (current->_machineName);
-			delete current;
-			current = next;
-			continue;
-		}
-
-		previous = current;
-		current = current->_next;
-	}
-}
-
-// Modif sf at 2002
-void vncServer::SetSingleWindowName(const char *szName)
-{
-    memcpy(m_szWindowName, szName, 32);
-}
-
-// Modef rdv at 202
-void
-vncServer::SetNewSWSize(long w,long h,BOOL desktop)
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this screen size update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		if (!GetClient(*i)->SetNewSWSize(w,h,desktop)) {
-			vnclog.Print(LL_INTINFO, VNCLOG("Unable to set new desktop size\n"));
-			KillClient(*i);
-		}
-	}
-}
-
-void
-vncServer::SetNewSWSizeFR(long w,long h,BOOL desktop)
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this screen size update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		if (!GetClient(*i)->SetNewSWSizeFR(w,h,desktop)) {
-			vnclog.Print(LL_INTINFO, VNCLOG("Unable to set new desktop size\n"));
-			KillClient(*i);
-		}
-	}
-}
-
-void
-vncServer::SetSWOffset(int x,int y)
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this screen size update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->SetSWOffset(x,y);
-	}
-
-}
-
-void
-vncServer::InitialUpdate(bool value)
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this screen size update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->InitialUpdate(value);
-	}
-
-}
-
-void
-vncServer::SetScreenOffset(int x,int y,int type)
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	// Post this screen size update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Post the update
-		GetClient(*i)->SetScreenOffset(x,y,type);
-	}
-
-}
-
-// Modif sf at 2002 - v1.1.0 - Default Scaling
-UINT vncServer::GetDefaultScale()
-{
-	return m_nDefaultScale;
-}
-
-
-BOOL vncServer::SetDefaultScale(int nScale)
-{
-	m_nDefaultScale = nScale;
-
-	return TRUE;
-}
-
-
-BOOL vncServer::FileTransferEnabled()
-{
-	return m_fFileTransferEnabled;
-}
-
-BOOL vncServer::EnableFileTransfer(BOOL fEnable)
-{
-	m_fFileTransferEnabled = fEnable;
-
-	return TRUE;
-}
-
-BOOL vncServer::MSLogonRequired()
-{
-	return m_fMSLogonRequired;
-}
-
-BOOL vncServer::RequireMSLogon(BOOL fEnable)
-{
-	m_fMSLogonRequired = fEnable;
-
-	return TRUE;
-}
-
-BOOL vncServer::GetNewMSLogon()
-{
-	return m_fNewMSLogon;
-}
-
-BOOL vncServer::SetNewMSLogon(BOOL fEnable)
-{
-	m_fNewMSLogon = fEnable;
-
-	return TRUE;
-}
-
-//
-// sf at 2002 - v1.1.x - DSM Plugin
-//
-BOOL vncServer::IsDSMPluginEnabled()
-{
-	return m_fDSMPluginEnabled;
-}
-
-void vncServer::EnableDSMPlugin(BOOL fEnable)
-{
-	m_fDSMPluginEnabled = fEnable;
-}
-
-char* vncServer::GetDSMPluginName()
-{
-	return m_szDSMPlugin;
-}
-
-
-void vncServer::SetDSMPluginName(char* szDSMPlugin)
-{
-	strcpy_s(m_szDSMPlugin, 128,szDSMPlugin);
-	return;
-}
-
-//
-// Load if necessary and initialize the current DSMPlugin
-// This can only be done if NO client is connected (for the moment)
-//
-BOOL vncServer::SetDSMPlugin(BOOL bForceReload)
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Entry \n"));
-	if (AuthClientCount() > 0) return FALSE;
-
-	if (!IsDSMPluginEnabled()) return FALSE;
-
-	vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Enabled \n"));
-
-	// If the plugin is loaded, unload it first
-	// sf at 2003 - it has been possibly pre-configured by
-	// clicking on the plugin config button
-	if (m_pDSMPlugin->IsLoaded())
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Is Loaded \n"));
-
-		// sf at 2003 - We check if the loaded plugin is the same than
-		// the currently selected one or not
-		m_pDSMPlugin->DescribePlugin();
-		if (_stricmp(m_pDSMPlugin->GetPluginFileName(), GetDSMPluginName()) || bForceReload)
-		{
-			if (bForceReload)
-				vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - FORCE RELOADING OF THE PLUGIN \n"));
-			vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - New one - Unload the current \n"));
-			m_pDSMPlugin->SetEnabled(false);
-			m_pDSMPlugin->UnloadPlugin();
-		}
-	}
-
-	if (!m_pDSMPlugin->IsLoaded())
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin NOT loaded - Try to load it \n"));
-		if (!m_pDSMPlugin->LoadPlugin(GetDSMPluginName(), false))
-		{
-			vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ DSMPlugin cannot be loaded\n"));
-			return FALSE;
-		}
-	}
-
-	vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin successfully loaded \n"));
-
-	// Now that it is loaded, init it
-	if (m_pDSMPlugin->InitPlugin())
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Init plugin call \n"));
-		char szParams[MAXPWLEN + 64];
-		char password[MAXPWLEN];
-		GetPassword(password);
-		// Does the plugin need the VNC password to do its job ?
-		if (!_stricmp(m_pDSMPlugin->GetPluginParams(), "VNCPasswordNeeded"))
-			strcpy(szParams, vncDecryptPasswd((char *)password));
-		else
-			strcpy(szParams, "NoPassword");
-
-		// The second parameter tells the plugin the kind of program is using it
-		// (in WinVNC : "server-app" or "server-svc"
-		strcat(szParams, ",");
-		strcat(szParams, vncService::RunningAsService() ? "server-svc" : "server-app");
-
-		//::MessageBoxSecure(NULL, szParams, "SetDSMPlugin info", MB_OK);
-
-		vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - SetPluginParams call \n"));
-
-
-		//adzm 2010-05-12 - dsmplugin config
-		if (m_pDSMPlugin->SetPluginParams(NULL, szParams/*vncDecryptPasswd((char *)password)*/, GetDSMPluginConfig(), NULL))
-		{
-			m_pDSMPlugin->SetEnabled(true); // The plugin is ready to be used
-			vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Params OK\n"));
-			return TRUE;
-		}
-		else
-		{
-			m_pDSMPlugin->SetEnabled(false);
-			vnclog.Print(LL_INTINFO, VNCLOG("Unable to set DSMPlugin Params\n"));
-		}
-	}
-	else
-	{
-		m_pDSMPlugin->SetEnabled(false);
-		vnclog.Print(LL_INTINFO, VNCLOG("Unable to init DSMPlugin\n"));
-	}
-
-	/*
-	MessageBoxSecure(NULL, 
-	_T(_this->m_pDSMPlugin->DescribePlugin()),
-	_T("Plugin Description"), MB_OK | MB_ICONEXCLAMATION );
-	*/
-
-	return TRUE;
-}
-
-//adzm 2010-05-12 - dsmplugin config
-void vncServer::SetDSMPluginConfig(char* szDSMPluginConfig)
-{
-	strncpy_s(m_szDSMPluginConfig, sizeof(m_szDSMPluginConfig) - 1, szDSMPluginConfig, _TRUNCATE);
-}
-
-//
-// sgf at 2002 - for now, we disable cache rects when more than one client
-// 
-void vncServer::DisableCacheForAllClients()
-{
-	vncClientList::iterator i;
-		
-	omni_mutex_lock l(m_clientsLock);
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		GetClient(*i)->EnableCache(FALSE);
-	}
-
-}
-
-void
-vncServer::Clear_Update_Tracker() {
-	vncClientList::iterator i;
-	omni_mutex_lock l(m_clientsLock);
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		GetClient(*i)->Clear_Update_Tracker();
-
-	}
-}
-
-
-void vncServer::Driver(BOOL enable)
-{
-	sethook=true;
-	m_driver = enable;
-}
-	
-void vncServer::Hook(BOOL enable)
-{
-	sethook=true;
-	m_hook=enable;
-}
-
-void vncServer::SetHookings()
-{
-	if (sethook && m_desktop)
-	{
-		 m_desktop->SethookMechanism(Hook(),Driver());
-	}
-	sethook=false;
-}
-
-void vncServer::EnableXRichCursor(BOOL fEnable)
-{
-	m_fXRichCursor = fEnable;
-}
-
-BOOL
-vncServer::SetDisableTrayIcon(BOOL disableTrayIcon)
-{
-	if (disableTrayIcon != m_disableTrayIcon)
-	{
-		m_disableTrayIcon = disableTrayIcon;
-	}
-	return TRUE;
-}
-
-BOOL
-vncServer::GetDisableTrayIcon()
-{
-	return m_disableTrayIcon;
-}
-BOOL
-vncServer::SetAllowEditClients(BOOL AllowEditClients)
-{
-	if (AllowEditClients != m_AllowEditClients)
-	{
-		m_AllowEditClients = AllowEditClients;
-	}
-	return TRUE;
-}
-
-BOOL
-vncServer::GetAllowEditClients()
-{
-	return m_AllowEditClients;
-}
-
-BOOL
-vncServer::All_clients_initialalized() {
-	vncClientList::iterator i;
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		if (!GetClient(*i)->client_settings_passed) return false;
-
-	}
-	return true;
-}
-
-void
-vncServer::TriggerUpdate() {
-	vncClientList::iterator i;
-	// Post this update to all the connected clients
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		GetClient(*i)->TriggerUpdate();
-
-	}
-}
-
-
-bool vncServer::IsClient(vncClient* pClient)
-{
-  vncClientList::iterator i;
-  for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-    if (GetClient(*i) == pClient) return true;
-
-  return false;
-}
-void vncServer::AutoConnectRetry( )
-{
-	if ( m_fAutoReconnect && !fShutdownOrdered)
-	{
-		vnclog.Print(LL_INTINFO, VNCLOG("AutoConnectRetry(): started\n"));
-		if (m_retry_timeout == 0) m_retry_timeout = SetTimer( NULL, 0, (100), (TIMERPROC)_timerRetryHandler );
-	}
-}
-void CALLBACK vncServer::_timerRetryHandler( HWND /*hWnd*/, UINT /*uMsg*/, UINT_PTR /*idEvent*/, DWORD /*dwTime*/ )
-{
-	vncServer* pIface = (vncServer*)pThis;
-	pIface->_actualTimerRetryHandler( );
-}
-void vncServer::_actualTimerRetryHandler()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("Attempting AutoReconnect....\n"));
-	
-	KillTimer( NULL, m_retry_timeout );
-	
-	
-	if ( m_fAutoReconnect && strlen(m_szAutoReconnectAdr) > 0 && !fShutdownOrdered)
-	{
-
-		VSocket *tmpsock;
-		tmpsock = new VSocket;
-		if (tmpsock) {
-
-
-			if (G_HTTP)
-				{
-					if (tmpsock->Http_CreateConnect(m_szAutoReconnectAdr))
-					{
-						if ( strlen( m_szAutoReconnectId ) > 0 )
-						{
-						// wa at 2005 -- added support for the AutoReconnectId
-						// Set the ID for this client -- code taken from vncconndialog.cpp (ln:142)
-						tmpsock->Send(m_szAutoReconnectId,250);
-						tmpsock->SetTimeout(0);
-						
-						// adzm 2009-07-05 - repeater IDs
-						// Add the new client to this server
-						// adzm 2009-08-02
-						AddClient(tmpsock, TRUE, TRUE, 0, NULL, m_szAutoReconnectId, m_szAutoReconnectAdr, m_AutoReconnectPort);
-						m_retry_timeout = 0;
-						} else {
-						// Add the new client to this server
-						// adzm 2009-08-02
-						AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, m_szAutoReconnectAdr, m_AutoReconnectPort);
-						m_retry_timeout = 0;
-						}
-					}
-					else
-					{
-						// Connect out to the specified host on the VNCviewer listen port
-						tmpsock->Create();
-						if (tmpsock->Connect(m_szAutoReconnectAdr, m_AutoReconnectPort)) {
-							if ( strlen( m_szAutoReconnectId ) > 0 )
-							{
-								tmpsock->Send(m_szAutoReconnectId,250);
-								tmpsock->SetTimeout(0);
-								// adzm 2009-07-05 - repeater IDs
-								// Add the new client to this server
-								AddClient(tmpsock, TRUE, TRUE, 0, NULL, m_szAutoReconnectId, m_szAutoReconnectAdr, m_AutoReconnectPort);
-								m_retry_timeout = 0;
-							} else {
-								// Add the new client to this server
-								// adzm 2009-08-02
-								AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, m_szAutoReconnectAdr, m_AutoReconnectPort);
-								m_retry_timeout = 0;
-							}
-						} else {
-							delete tmpsock;
-							m_retry_timeout = SetTimer( NULL, 0, (1000*30), (TIMERPROC)_timerRetryHandler );
-						}
-					}
-
-				}
-				else
-				{
-					// Connect out to the specified host on the VNCviewer listen port
-					tmpsock->Create();
-					if (tmpsock->Connect(m_szAutoReconnectAdr, m_AutoReconnectPort)) {
-						if ( strlen( m_szAutoReconnectId ) > 0 )
-						{
-							tmpsock->Send(m_szAutoReconnectId,250);
-							tmpsock->SetTimeout(0);
-							// adzm 2009-07-05 - repeater IDs
-							// Add the new client to this server
-							AddClient(tmpsock, TRUE, TRUE, 0, NULL, m_szAutoReconnectId, m_szAutoReconnectAdr, m_AutoReconnectPort);
-							m_retry_timeout = 0;
-						} else {
-							// Add the new client to this server
-							// adzm 2009-08-02
-							AddClient(tmpsock, TRUE, TRUE, 0, NULL, NULL, m_szAutoReconnectAdr, m_AutoReconnectPort);
-							m_retry_timeout = 0;
-						}
-					} else {
-						delete tmpsock;
-						m_retry_timeout = SetTimer( NULL, 0, (1000*30), (TIMERPROC)_timerRetryHandler );
-					}
-			}
-		} //tempsocket
-	}
-	else
-	{
-		m_retry_timeout = 0;
-	}
-}
-void vncServer::NotifyClients_StateChange(CARD32 state, CARD32 value)
-{
-	omni_mutex_lock l(m_clientsLock);
-    vncClient *client = NULL;
-
-    vncClientList::iterator i;
-
-	for (i = m_unauthClients.begin(); i != m_unauthClients.end(); ++i)
-		{
-
-			// Is this the right client?
-        client = GetClient(*i);
-        if (!client)
-            continue;
-
-        client->Record_SendServerStateUpdate(state, value);
-		}
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Is this the right client?
-        client = GetClient(*i);
-        if (!client)
-            continue;
-
-        client->Record_SendServerStateUpdate(state, value);
-	}
-}
-
-void vncServer::StopReconnectAll()
-{
-	omni_mutex_lock l(m_clientsLock);
-    vncClient *client = NULL;
-
-    vncClientList::iterator i;
-
-	for (i = m_authClients.begin(); i != m_authClients.end(); ++i)
-	{
-		// Is this the right client?
-        client = GetClient(*i);
-        if (!client)
-            continue;
-
-        client->m_Autoreconnect=false;
-	}
-}
-
-void vncServer::SetFTTimeout(int msecs)
-{
-    m_ftTimeout = msecs;
-}
diff --git a/ica/win32/winvnc/winvnc/vncserver.h b/ica/win32/winvnc/winvnc/vncserver.h
deleted file mode 100644
index 3ad569d..0000000
--- a/ica/win32/winvnc/winvnc/vncserver.h
+++ /dev/null
@@ -1,614 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. All Rights Reserved.
-//  Copyright (C) 2000-2002 Const Kaplinsky. All Rights Reserved.
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncServer.h
-
-// vncServer class handles the following functions:
-// - Allowing clients to be dynamically added and removed
-// - Propagating updates from the local vncDesktop object
-//   to all the connected clients
-// - Propagating mouse movements and keyboard events from
-//   clients to the local vncDesktop
-// It also creates the vncSockConnect
-// servers, which respectively allow connections via sockets
-// and via the ORB interface
-extern bool			fShutdownOrdered;
-class vncServer;
-
-#if (!defined(_WINVNC_VNCSERVER))
-#define _WINVNC_VNCSERVER
-
-// Custom
-#include "vncsockconnect.h"
-#include "vnchttpconnect.h"
-#include "vncclient.h"
-#include "rfbRegion.h"
-#include "vncpasswd.h"
-
-// Includes
-#include "stdhdrs.h"
-#include <omnithread.h>
-#include <list>
-
-// adzm - 2010-07 - Extended clipboard
-#include "common/Clipboard.h"
-
-typedef BOOL (WINAPI *WTSREGISTERSESSIONNOTIFICATION)(HWND, DWORD);
-typedef BOOL (WINAPI *WTSUNREGISTERSESSIONNOTIFICATION)(HWND);
-#define WM_WTSSESSION_CHANGE            0x02B1
-#define WTS_CONSOLE_CONNECT                0x1
-#define WTS_CONSOLE_DISCONNECT             0x2
-#define WTS_REMOTE_CONNECT                 0x3
-#define WTS_REMOTE_DISCONNECT              0x4
-#define WTS_SESSION_LOGON                  0x5
-#define WTS_SESSION_LOGOFF                 0x6
-#define WTS_SESSION_LOCK                   0x7
-#define WTS_SESSION_UNLOCK                 0x8
-#define WTS_SESSION_REMOTE_CONTROL         0x9
-
-// Define a datatype to handle lists of windows we wish to notify
-typedef std::list<HWND> vncNotifyList;
-
-// Some important constants;
-const int MAX_CLIENTS = 128;
-
-// The vncServer class itself
-
-class vncServer
-{
-public:
-
-	HANDLE m_impersonationtoken;
-
-	// Constructor/destructor
-	vncServer();
-	~vncServer();
-
-	// Client handling functions
-	virtual vncClientId AddClient(VSocket *socket, BOOL auth, BOOL shared);
-	virtual vncClientId AddClient(VSocket *socket, BOOL auth, BOOL shared,rfbProtocolVersionMsg *protocolMsg);
-	virtual vncClientId AddClient(VSocket *socket,
-		BOOL auth, BOOL shared, int capability,
-		/*BOOL keysenabled, BOOL ptrenabled,*/rfbProtocolVersionMsg *protocolMsg);
-	
-	// adzm 2009-07-05
-	// adzm 2009-08-02
-	virtual vncClientId AddClient(VSocket *socket,
-		BOOL auth, BOOL shared, int capability,
-		/*BOOL keysenabled, BOOL ptrenabled,*/rfbProtocolVersionMsg *protocolMsg,VString szRepeaterID,VString szHost,VCard port);
-
-	virtual BOOL Authenticated(vncClientId client);
-	virtual void KillClient(vncClientId client);
-	virtual void KillClient(LPSTR szClientName); // sf at 2002
-	virtual void TextChatClient(LPSTR szClientName); // sf at 2002
-	bool IsUltraVncViewer();
-	bool AreThereMultipleViewers();
-
-	virtual UINT AuthClientCount();
-	virtual UINT UnauthClientCount();
-
-	virtual void KillAuthClients();
-	virtual void ListAuthClients(HWND hListBox);
-	virtual void WaitUntilAuthEmpty();
-
-	virtual void KillUnauthClients();
-	virtual void ListUnauthClients(HWND hListBox); // adzm 2009-07-05
-	virtual void WaitUntilUnauthEmpty();
-
-	// Are any clients ready to send updates?
-	virtual BOOL UpdateWanted();
-
-	// Has at least one client had a remote event?
-	virtual BOOL RemoteEventReceived();
-
-	// Client info retrieval/setup
-	virtual vncClient* GetClient(vncClientId clientid);
-	virtual vncClientList ClientList();
-
-	virtual void SetCapability(vncClientId client, int capability);
-	virtual void SetKeyboardEnabled(vncClientId client, BOOL enabled);
-	virtual void SetPointerEnabled(vncClientId client, BOOL enabled);
-
-	virtual int GetCapability(vncClientId client);
-	virtual const char* GetClientName(vncClientId client);
-
-	// Let a client remove itself
-	virtual void RemoveClient(vncClientId client);
-
-	// Connect/disconnect notification
-	virtual BOOL AddNotify(HWND hwnd);
-	virtual BOOL RemNotify(HWND hwnd);
-
-	// Modif sf at 2002 - Single Window
-	virtual void SingleWindow(BOOL fEnabled) { m_SingleWindow = fEnabled; };
-	virtual BOOL SingleWindow() { return m_SingleWindow; };
-	virtual void SetSingleWindowName(const char *szName);
-	virtual char *GetWindowName() { return m_szWindowName; };
-	virtual vncDesktop* GetDesktopPointer() {return m_desktop;}
-	virtual void SetNewSWSize(long w,long h,BOOL desktop);
-	virtual void SetNewSWSizeFR(long w,long h,BOOL desktop);
-	virtual void SetSWOffset(int x,int y);
-	virtual void SetScreenOffset(int x,int y,int type); //never locked
-	virtual void InitialUpdate(bool value);
-
-	virtual BOOL All_clients_initialalized();
-
-	// Lock to protect the client list from concurrency - lock when reading/updating client list
-	omni_mutex			m_clientsLock;
-
-	UINT				m_port;
-	UINT				m_port_http; // TightVNC 1.2.7
-
-	virtual void ShutdownServer();
-
-protected:
-	// Send a notification message
-	
-
-public:
-	int AutoReconnect_counter;
-	virtual void DoNotify(UINT message, WPARAM wparam, LPARAM lparam);
-	// Update handling, used by the screen server
-	virtual rfb::UpdateTracker &GetUpdateTracker() {return m_update_tracker;};
-	virtual void UpdateMouse();
-	// adzm - 2010-07 - Extended clipboard
-	//virtual void UpdateClipText(const char* text);
-	virtual void UpdateClipTextEx(HWND hwndOwner, vncClient* excludeClient = NULL);
-	virtual void UpdatePalette(bool lock);
-	virtual void UpdateLocalFormat(bool lock);
-
-	// Polling mode handling
-	virtual void PollUnderCursor(BOOL enable) {m_poll_undercursor = enable;};
-	virtual BOOL PollUnderCursor() {return m_poll_undercursor;};
-	virtual void PollForeground(BOOL enable) {m_poll_foreground = enable;};
-	virtual BOOL PollForeground() {return m_poll_foreground;};
-	virtual void PollFullScreen(BOOL enable) {m_poll_fullscreen = enable;};
-	virtual BOOL PollFullScreen() {return m_poll_fullscreen;};
-
-	virtual void Driver(BOOL enable);
-	virtual BOOL Driver() {return m_driver;};
-	virtual void Hook(BOOL enable);
-	virtual BOOL Hook() {return m_hook;};
-	virtual void Virtual(BOOL enable) {m_virtual = enable;};
-	virtual BOOL Virtual() {return m_virtual;};
-	virtual void SetHookings();
-
-	virtual void PollConsoleOnly(BOOL enable) {m_poll_consoleonly = enable;};
-	virtual BOOL PollConsoleOnly() {return m_poll_consoleonly;};
-	virtual void PollOnEventOnly(BOOL enable) {m_poll_oneventonly = enable;};
-	virtual BOOL PollOnEventOnly() {return m_poll_oneventonly;};
-	virtual void MaxCpu(LONG maxcpu) {m_MaxCpu = maxcpu;};
-	virtual LONG MaxCpu() {return m_MaxCpu;};
-
-	// Client manipulation of the clipboard
-	virtual void UpdateLocalClipText(LPSTR text);
-	// adzm - 2010-07 - Extended clipboard
-	virtual void UpdateLocalClipTextEx(ExtendedClipboardDataMessage& extendedClipboardDataMessage, vncClient* sourceClient);
-
-	// Name and port number handling
-	// TightVNC 1.2.7
-	virtual void SetName(const char * name);
-	virtual void SetPorts(const UINT port_rfb, const UINT port_http);
-	virtual UINT GetPort() { return m_port; };
-	virtual UINT GetHttpPort() { return m_port_http; };
-	// RealVNC method
-	/*
-	virtual void SetPort(const UINT port);
-	virtual UINT GetPort();
-	*/
-	virtual void KillSockConnect();
-	virtual void SetAutoPortSelect(const BOOL autoport) {
-	    if (autoport && !m_autoportselect)
-	    {
-		BOOL sockconnect = SockConnected();
-		SockConnect(FALSE);
-		m_autoportselect = autoport;
-		SockConnect(sockconnect);
-	    }
-		else
-		{
-			m_autoportselect = autoport;
-		}
-	};
-	virtual BOOL AutoPortSelect() {return m_autoportselect;};
-
-	// Password set/retrieve.  Note that these functions now handle the encrypted
-	// form, not the plaintext form.  The buffer passwed MUST be MAXPWLEN in size.
-	virtual void SetPassword(const char *passwd);
-	virtual void GetPassword(char *passwd);
-	virtual void SetPassword2(const char *passwd2); //PGM
-	virtual void GetPassword2(char *passwd2); //PGM
-
-	// Remote input handling
-	virtual void EnableRemoteInputs(BOOL enable);
-	virtual BOOL RemoteInputsEnabled();
-
-	// Local input handling
-	virtual void DisableLocalInputs(BOOL disable);
-	virtual bool LocalInputsDisabled();
-	virtual BOOL JapInputEnabled();
-	virtual void EnableJapInput(BOOL enable);
-	virtual void Clearconsole(BOOL enable);
-
-	// General connection handling
-	virtual void SetConnectPriority(UINT priority) {m_connect_pri = priority;};
-	virtual UINT ConnectPriority() {return m_connect_pri;};
-
-	// Socket connection handling
-	virtual BOOL SockConnect(BOOL on);
-	virtual BOOL SockConnected();
-	virtual BOOL SetLoopbackOnly(BOOL loopbackOnly);
-	virtual BOOL LoopbackOnly();
-
-
-	// Tray icon disposition
-	virtual BOOL SetDisableTrayIcon(BOOL disableTrayIcon);
-	virtual BOOL GetDisableTrayIcon();
-	virtual BOOL SetAllowEditClients(BOOL AllowEditClients);
-	virtual BOOL GetAllowEditClients();
-
-
-	// HTTP daemon handling
-	virtual BOOL EnableHTTPConnect(BOOL enable);
-	virtual BOOL HTTPConnectEnabled() {return m_enableHttpConn;};
-	virtual BOOL EnableXDMCPConnect(BOOL enable);
-	virtual BOOL XDMCPConnectEnabled() {return m_enableXdmcpConn;};
-
-	virtual void GetScreenInfo(int &width, int &height, int &depth);
-
-	// Allow connections if no password is set?
-	virtual void SetAuthRequired(BOOL reqd) {m_passwd_required = reqd;};
-	virtual BOOL AuthRequired() {return m_passwd_required;};
-
-	// Handling of per-client connection authorisation
-	virtual void SetAuthHosts(const char *hostlist);
-	virtual char *AuthHosts();
-	enum AcceptQueryReject {aqrAccept, aqrQuery, aqrReject};
-	virtual AcceptQueryReject VerifyHost(const char *hostname);
-
-	// Blacklisting of machines which fail connection attempts too often
-	// Such machines will fail VerifyHost for a short period
-	virtual void AddAuthHostsBlacklist(const char *machine);
-	virtual void RemAuthHostsBlacklist(const char *machine);
-
-	// Connection querying settings
-	virtual void SetQuerySetting(const UINT setting) {m_querysetting = setting;};
-	virtual UINT QuerySetting() {return m_querysetting;};
-	virtual void SetQueryAccept(const UINT setting) {m_queryaccept = setting;};
-	virtual UINT QueryAccept() {return m_queryaccept;};
-	virtual void SetQueryTimeout(const UINT setting) {m_querytimeout = setting;};
-	virtual UINT QueryTimeout() {return m_querytimeout;};
-
-	// marscha at 2006 - Is AcceptDialog required even if no user is logged on
-    virtual void SetQueryIfNoLogon(const UINT setting) {m_queryifnologon = (setting != 0);};
-	virtual BOOL QueryIfNoLogon() {return m_queryifnologon;};
-
-	// Whether or not to allow connections from the local machine
-	virtual void SetLoopbackOk(BOOL ok) {m_loopback_allowed = ok;};
-	virtual BOOL LoopbackOk() {return m_loopback_allowed;};
-
-	// Whether or not to shutdown or logoff when the last client leaves
-	virtual void SetLockSettings(int ok) {m_lock_on_exit = ok;};
-	virtual int LockSettings() {return m_lock_on_exit;};
-
-	// Timeout for automatic disconnection of idle connections
-	virtual void SetAutoIdleDisconnectTimeout(const UINT timeout) {m_idle_timeout = timeout;};
-	virtual UINT AutoIdleDisconnectTimeout() {return m_idle_timeout;};
-
-	// Removal of desktop wallpaper, etc
-	virtual void EnableRemoveWallpaper(const BOOL enable) {m_remove_wallpaper = enable;};
-	virtual BOOL RemoveWallpaperEnabled() {return m_remove_wallpaper;};
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	virtual void EnableRemoveEffects(const BOOL enable) {m_remove_effects = enable;};
-	virtual BOOL RemoveEffectsEnabled() {return m_remove_effects;};
-	virtual void EnableRemoveFontSmoothing(const BOOL enable) {m_remove_fontsmoothing = enable;};
-	virtual BOOL RemoveFontSmoothingEnabled() {return m_remove_fontsmoothing;};
-	// Removal of desktop composit desktop, etc
-	virtual void EnableRemoveAero(const BOOL enable) {m_remove_Aero = enable;};
-	virtual BOOL RemoveAeroEnabled() {return m_remove_Aero;};
-
-	// sf at 2002 - v1.1.x - Server Default Scale
-	virtual UINT GetDefaultScale();
-	virtual BOOL SetDefaultScale(int nScale);
-	virtual BOOL FileTransferEnabled();
-	virtual BOOL EnableFileTransfer(BOOL fEnable);
-	virtual BOOL BlankMonitorEnabled() {return m_fBlankMonitorEnabled;};
-	virtual void BlankMonitorEnabled(BOOL fEnable) {m_fBlankMonitorEnabled = fEnable;};
-	virtual BOOL BlankInputsOnly() {return m_fBlankInputsOnly;}; //PGM
-	virtual void BlankInputsOnly(BOOL fEnable) {m_fBlankInputsOnly = fEnable;}; //PGM
-	virtual BOOL MSLogonRequired();
-	virtual BOOL RequireMSLogon(BOOL fEnable);
-	virtual BOOL GetNewMSLogon();
-	virtual BOOL SetNewMSLogon(BOOL fEnable);
-
-	virtual BOOL Primary() {return m_PrimaryEnabled;};
-	virtual void Primary(BOOL fEnable) {m_PrimaryEnabled = fEnable;};
-	virtual BOOL Secondary() {return m_SecondaryEnabled;};
-	virtual void Secondary(BOOL fEnable) {m_SecondaryEnabled = fEnable;};
-
-	// sf at 2002 - DSM Plugin
-	virtual BOOL IsDSMPluginEnabled();
-	virtual void EnableDSMPlugin(BOOL fEnable);
-	virtual char* GetDSMPluginName();
-	virtual void SetDSMPluginName(char* szDSMPlugin);
-	virtual BOOL SetDSMPlugin(BOOL fForceReload);
-	virtual CDSMPlugin* GetDSMPluginPointer() { return m_pDSMPlugin;};
-	//adzm 2010-05-12 - dsmplugin config
-	virtual void SetDSMPluginConfig(char* szDSMPluginConfig);
-	virtual char* GetDSMPluginConfig() { return m_szDSMPluginConfig;};
-
-	// sf at 2002 - Cursor handling
-	virtual void EnableXRichCursor(BOOL fEnable);
-	virtual BOOL IsXRichCursorEnabled() {return m_fXRichCursor;}; 
-
-	// sf at 2002
-	virtual void DisableCacheForAllClients();
-	virtual bool IsThereASlowClient();
-	virtual bool IsThereAUltraEncodingClient();
-	virtual bool IsThereFileTransBusy();
-
-	// sf at 2002 - Turbo Mode
-	virtual void TurboMode(BOOL fEnabled) { m_TurboMode = fEnabled; };
-	virtual BOOL TurboMode() { return m_TurboMode; };
-
-	// sf at 2003 - AutoReconnect
-	virtual BOOL AutoReconnect()
-	{
-		if (fShutdownOrdered) return false;
-		return m_fAutoReconnect;
-	};
-	virtual BOOL IdReconnect(){return m_fIdReconnect;};
-	virtual UINT AutoReconnectPort(){return m_AutoReconnectPort;};
-	virtual char* AutoReconnectAdr(){return m_szAutoReconnectAdr;}
-	virtual char* AutoReconnectId(){return m_szAutoReconnectId;}
-	virtual void AutoReconnect(BOOL fEnabled){m_fAutoReconnect = fEnabled;};
-	virtual void IdReconnect(BOOL fEnabled){m_fIdReconnect = fEnabled;};
-	virtual void AutoReconnectPort(UINT nPort){m_AutoReconnectPort = nPort;};
-	virtual void AutoReconnectAdr(char* szAdr){strcpy_s(m_szAutoReconnectAdr,255, szAdr);}
-	virtual void AutoReconnectId(char* szId){strcpy_s(m_szAutoReconnectId,MAX_PATH, szId);}
-	virtual void AutoConnectRetry( );
-	static void CALLBACK _timerRetryHandler( HWND /*hWnd*/, UINT /*uMsg*/, UINT_PTR /*idEvent*/, DWORD /*dwTime*/ );
-	void _actualTimerRetryHandler();
-
-	// sf at 2007 - Vista / XP FUS special modes
-	virtual BOOL RunningFromExternalService(){return m_fRunningFromExternalService;};
-	virtual void RunningFromExternalService(BOOL fEnabled){m_fRunningFromExternalService = true;};
-
-	virtual void AutoRestartFlag(BOOL fOn){m_fAutoRestart = fOn;};
-	virtual BOOL AutoRestartFlag(){return m_fAutoRestart;};
-
-	// sf at 2005 - FTUserImpersonation
-	virtual BOOL FTUserImpersonation(){return m_fFTUserImpersonation;};
-	virtual void FTUserImpersonation(BOOL fEnabled){m_fFTUserImpersonation = fEnabled;};
-
-	virtual BOOL CaptureAlphaBlending(){return m_fCaptureAlphaBlending;};
-	virtual void CaptureAlphaBlending(BOOL fEnabled){m_fCaptureAlphaBlending = fEnabled;};
-	virtual BOOL BlackAlphaBlending(){return m_fBlackAlphaBlending;};
-	virtual void BlackAlphaBlending(BOOL fEnabled){m_fBlackAlphaBlending = fEnabled;};
-
-	// [v1.0.2-jp1 fix]
-//	virtual BOOL GammaGray(){return m_fGammaGray;};
-//	virtual void GammaGray(BOOL fEnabled){m_fGammaGray = fEnabled;};
-
-	virtual void Clear_Update_Tracker();
-	virtual void UpdateCursorShape();
-
-	bool IsClient(vncClient* pClient);
-
-    void EnableServerStateUpdates(bool newstate) { m_fEnableStateUpdates = newstate; }
-    bool DoServerStateUpdates() { return m_fEnableStateUpdates; }
-    void NotifyClients_StateChange(CARD32 state, CARD32 value);
-    int  GetFTTimeout() { return m_ftTimeout; }
-    int  GetKeepAliveInterval () { return m_keepAliveInterval; }
-    void SetFTTimeout(int msecs);
-    void EnableKeepAlives(bool newstate) { m_fEnableKeepAlive = newstate; }
-    bool DoKeepAlives() { return m_fEnableKeepAlive; }
-    void SetKeepAliveInterval(int secs) { 
-        m_keepAliveInterval = secs; 
-    if (m_keepAliveInterval >= (m_ftTimeout - KEEPALIVE_HEADROOM))
-        m_keepAliveInterval = m_ftTimeout  - KEEPALIVE_HEADROOM;
-    }
-
-	// adzm 2010-08
-	void SetSocketKeepAliveTimeout(int timeout)	{ m_socketKeepAliveTimeout = timeout > 0 ? timeout : 0; VSocket::SetSocketKeepAliveTimeoutDefault(m_socketKeepAliveTimeout); }
-	int GetSocketKeepAliveTimeout() { return m_socketKeepAliveTimeout; }
-
-	void TriggerUpdate();
-	UINT				m_retry_timeout;
-	bool OS_Shutdown;
-	void StopReconnectAll();
-
-protected:
-	// The vncServer UpdateTracker class
-	// Behaves like a standard UpdateTracker, but propagates update
-	// information to active clients' trackers
-
-	class ServerUpdateTracker : public rfb::UpdateTracker {
-	public:
-		ServerUpdateTracker() : m_server(0) {};
-
-		virtual void init(vncServer *server) {m_server=server;};
-
-		virtual void add_changed(const rfb::Region2D &region);
-		virtual void add_cached(const rfb::Region2D &region);
-		virtual void add_copied(const rfb::Region2D &dest, const rfb::Point &delta);
-	protected:
-		vncServer *m_server;
-	};
-
-	friend class ServerUpdateTracker;
-
-	ServerUpdateTracker	m_update_tracker;
-
-	// Internal stuffs
-protected:
-	static void*	pThis;
-
-	// Connection servers
-	vncSockConnect		*m_socketConn;
-	vncHTTPConnect		*m_httpConn;
-	HANDLE				m_xdmcpConn;
-	BOOL				m_enableHttpConn;
-	BOOL				m_enableXdmcpConn;
-
-	// The desktop handler
-	vncDesktop			*m_desktop;
-
-	// General preferences
-//	UINT				m_port;
-//	UINT				m_port_http; // TightVNC 1.2.7
-	BOOL				m_autoportselect;
-	char				m_password[MAXPWLEN];
-	char				m_password2[MAXPWLEN]; //PGM
-	BOOL				m_passwd_required;
-	BOOL				m_loopback_allowed;
-	BOOL				m_loopbackOnly;
-	char				*m_auth_hosts;
-	BOOL				m_enable_remote_inputs;
-	BOOL				m_disable_local_inputs;
-	BOOL				m_enable_jap_input;
-	int					m_lock_on_exit;
-	int					m_connect_pri;
-	UINT				m_querysetting;
-	UINT				m_queryaccept;
-	UINT				m_querytimeout;
-	BOOL				m_queryifnologon;
- 	UINT				m_idle_timeout;
-
-	BOOL				m_remove_wallpaper;
-	// adzm - 2010-07 - Disable more effects or font smoothing
-	BOOL				m_remove_effects;
-	BOOL				m_remove_fontsmoothing;
-	BOOL				m_remove_Aero;
-	BOOL				m_disableTrayIcon;
-	BOOL				m_AllowEditClients;
-
-	// Polling preferences
-	BOOL				m_poll_fullscreen;
-	BOOL				m_poll_foreground;
-	BOOL				m_poll_undercursor;
-
-	BOOL				m_poll_oneventonly;
-	LONG				m_MaxCpu;
-	BOOL				m_poll_consoleonly;
-
-	BOOL				m_driver;
-	BOOL				m_hook;
-	BOOL				m_virtual;
-	BOOL				sethook;
-
-	// Name of this desktop
-	char				*m_name;
-
-	// Blacklist structures
-	struct BlacklistEntry {
-		BlacklistEntry *_next;
-		char *_machineName;
-		LARGE_INTEGER _lastRefTime;
-		UINT _failureCount;
-		BOOL _blocked;
-	};
-	BlacklistEntry		*m_blacklist;
-	
-	// The client lists - list of clients being authorised and ones
-	// already authorised
-	vncClientList		m_unauthClients;
-	vncClientList		m_authClients;
-	vncClient			*m_clientmap[MAX_CLIENTS];
-	vncClientId			m_nextid;
-
-	// Lock to protect the client list from concurrency - lock when reading/updating client list
-//	omni_mutex			m_clientsLock;
-	// Lock to protect the desktop object from concurrency - lock when updating client list
-	omni_mutex			m_desktopLock;
-
-	// Signal set when a client removes itself
-	omni_condition		*m_clientquitsig;
-
-	// Set of windows to send notifications to
-	vncNotifyList		m_notifyList;
-
-		// Modif sf at 2002 - Single Window
-	BOOL    m_SingleWindow;
-	char    m_szWindowName[32]; // to keep the window name
-
-	// Modif sf at 2002
-	BOOL    m_TurboMode;
-
-	// Modif sf at 2002 - v1.1.x
-	// BOOL    m_fQueuingEnabled;
-	BOOL    m_fFileTransferEnabled;
-	BOOL    m_fBlankMonitorEnabled;
-	BOOL    m_fBlankInputsOnly; //PGM
-	int     m_nDefaultScale;
-
-	BOOL m_PrimaryEnabled;
-	BOOL m_SecondaryEnabled;
-
-	BOOL    m_fMSLogonRequired;
-	BOOL    m_fNewMSLogon;
-
-	// sf at 2002 - DSMPlugin
-	BOOL m_fDSMPluginEnabled;
-	char m_szDSMPlugin[128];
-	CDSMPlugin *m_pDSMPlugin;
-	//adzm 2010-05-12 - dsmplugin config
-	char m_szDSMPluginConfig[512];
-
-	// sf at 2002 - Cursor handling
-	BOOL m_fXRichCursor; 
-
-	// sf at 2003 - AutoReconnect
-	BOOL m_fAutoReconnect;
-	BOOL m_fIdReconnect;
-	UINT m_AutoReconnectPort;
-	char m_szAutoReconnectAdr[255];
-	char m_szAutoReconnectId[MAX_PATH];
-
-	// sf at 2007
-	BOOL m_fRunningFromExternalService;
-	BOOL m_fAutoRestart;
-
-	// sf at 2005 - FTUserImpersonation
-	BOOL m_fFTUserImpersonation;
-
-	// sf at 2005
-	BOOL m_fCaptureAlphaBlending;
-	BOOL m_fBlackAlphaBlending;
-	//BOOL m_fGammaGray;	// [v1.0.2-jp1 fix]
-
-	HINSTANCE   hWtsLib;
-    bool m_fEnableStateUpdates;
-    bool m_fEnableKeepAlive;
-    int m_ftTimeout;
-    int m_keepAliveInterval;
-	// adzm 2010-08
-	int m_socketKeepAliveTimeout;
-	bool clearconsole;
-};
-
-#endif
diff --git a/ica/win32/winvnc/winvnc/vncservice.cpp b/ica/win32/winvnc/winvnc/vncservice.cpp
deleted file mode 100644
index 526f3a6..0000000
--- a/ica/win32/winvnc/winvnc/vncservice.cpp
+++ /dev/null
@@ -1,953 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncService
-
-// Implementation of service-oriented functionality of WinVNC
-
-#include "stdhdrs.h"
-
-// Header
-
-#include "vncservice.h"
-
-#include <cassert>
-#include <lmcons.h>
-#include "omnithread.h"
-#include "winvnc.h"
-#include "vncmenu.h"
-#include "vnctimedmsgbox.h"
-
-#include "Localization.h" // Act : add localization on messages
-
-
-// OS-SPECIFIC ROUTINES
-
-// Create an instance of the vncService class to cause the static fields to be
-// initialised properly
-
-vncService init;
-bool G_1111=false;
-DWORD	g_platform_id;
-BOOL	g_impersonating_user = 0;
-DWORD	g_version_major;
-DWORD	g_version_minor;
-BOOL	m_fRunningFromExternalService = true;
-
-typedef DWORD (WINAPI* pWTSGetActiveConsoleSessionId)(VOID);
-typedef BOOL (WINAPI * pProcessIdToSessionId)(DWORD,DWORD*);
-#include <tlhelp32.h>
-
-pProcessIdToSessionId WTSProcessIdToSessionIdF=NULL;
-
-#ifndef SM_REMOTESESSION
-#define SM_REMOTESESSION 0X1000
-#endif
-
-extern BOOL SPECIAL_SC_EXIT;
-extern BOOL SPECIAL_SC_PROMPT;
-
-void ClearKeyState(BYTE key);
-DWORD GetCurrentSessionID()
-{
-	DWORD dwSessionId;
-	pWTSGetActiveConsoleSessionId WTSGetActiveConsoleSessionIdF=NULL;
-	WTSProcessIdToSessionIdF=NULL;
-
-	HMODULE  hlibkernel = LoadLibrary("kernel32.dll");
-	if (hlibkernel)
-	{
-	WTSGetActiveConsoleSessionIdF=(pWTSGetActiveConsoleSessionId)GetProcAddress(hlibkernel, "WTSGetActiveConsoleSessionId");
-	WTSProcessIdToSessionIdF=(pProcessIdToSessionId)GetProcAddress(hlibkernel, "ProcessIdToSessionId");
-	}
-	if (WTSGetActiveConsoleSessionIdF!=NULL)
-	   dwSessionId =WTSGetActiveConsoleSessionIdF();
-	else dwSessionId=0;
-
-	if( GetSystemMetrics( SM_REMOTESESSION))
-		if (WTSProcessIdToSessionIdF!=NULL)
-		{
-			DWORD dw		 = GetCurrentProcessId();
-			DWORD pSessionId = 0xFFFFFFFF;
-			WTSProcessIdToSessionIdF( dw, &pSessionId );
-			dwSessionId=pSessionId;
-		}
-	if (hlibkernel) FreeLibrary(hlibkernel);
-	return dwSessionId;
-}
-
-DWORD GetExplorerLogonPid()
-{
-	DWORD dwSessionId;
-	DWORD dwExplorerLogonPid=0;
-	PROCESSENTRY32 procEntry;
-//	HANDLE hProcess,hPToken;
-
-	pWTSGetActiveConsoleSessionId WTSGetActiveConsoleSessionIdF=NULL;
-	WTSProcessIdToSessionIdF=NULL;
-
-	HMODULE  hlibkernel = LoadLibrary("kernel32.dll"); 
-	if (hlibkernel)
-	{
-	WTSGetActiveConsoleSessionIdF=(pWTSGetActiveConsoleSessionId)GetProcAddress(hlibkernel, "WTSGetActiveConsoleSessionId");
-	WTSProcessIdToSessionIdF=(pProcessIdToSessionId)GetProcAddress(hlibkernel, "ProcessIdToSessionId");
-	}
-	if (WTSGetActiveConsoleSessionIdF!=NULL)
-	   dwSessionId =WTSGetActiveConsoleSessionIdF();
-	else dwSessionId=0;
-
-	if( GetSystemMetrics( SM_REMOTESESSION))
-		if (WTSProcessIdToSessionIdF!=NULL)
-		{
-			DWORD dw		 = GetCurrentProcessId();
-			DWORD pSessionId = 0xFFFFFFFF;
-			WTSProcessIdToSessionIdF( dw, &pSessionId );
-			dwSessionId=pSessionId;
-		}
-
-	
-
-    HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-    if (hSnap == INVALID_HANDLE_VALUE)
-    {
-		if (hlibkernel) FreeLibrary(hlibkernel);
-        return 0 ;
-    }
-
-    procEntry.dwSize = sizeof(PROCESSENTRY32);
-
-    if (!Process32First(hSnap, &procEntry))
-    {
-		CloseHandle(hSnap);
-		if (hlibkernel) FreeLibrary(hlibkernel);
-        return 0 ;
-    }
-
-    do
-    {
-        if (_stricmp(procEntry.szExeFile, "explorer.exe") == 0)
-        {
-          DWORD dwExplorerSessId = 0;
-		  if (WTSProcessIdToSessionIdF!=NULL)
-		  {
-			  if (WTSProcessIdToSessionIdF(procEntry.th32ProcessID, &dwExplorerSessId) 
-						&& dwExplorerSessId == dwSessionId)
-				{
-					dwExplorerLogonPid = procEntry.th32ProcessID;
-					break;
-				}
-		  }
-		  else dwExplorerLogonPid = procEntry.th32ProcessID;
-        }
-
-    } while (Process32Next(hSnap, &procEntry));
-	CloseHandle(hSnap);
-	if (hlibkernel) FreeLibrary(hlibkernel);
-	return dwExplorerLogonPid;
-}
-
-char aa[16384];
-#include <tlhelp32.h>
-bool
-GetConsoleUser(char *buffer, UINT size)
-{
-
-	HANDLE hProcess,hPToken;
-	DWORD dwExplorerLogonPid=GetExplorerLogonPid();
-	if (dwExplorerLogonPid==0) 
-	{
-		strcpy(buffer,"");
-		return 0;
-	}
-	hProcess = OpenProcess(MAXIMUM_ALLOWED,FALSE,dwExplorerLogonPid);
-
-   if(!::OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY
-                                    |TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_ADJUST_SESSIONID
-                                    |TOKEN_READ|TOKEN_WRITE,&hPToken))
-		{     
-			   strcpy(buffer,"");
-			   CloseHandle(hProcess);
-			   return 0 ;
-		}
-
-
-   // token user
-    TOKEN_USER *ptu;
-	DWORD needed;
-	ptu = (TOKEN_USER *) aa;//malloc( 16384 );
-	if (GetTokenInformation( hPToken, TokenUser, ptu, 16384, &needed ) )
-	{
-		char  DomainName[64];
-		memset(DomainName, 0, sizeof(DomainName));
-		DWORD DomainSize;
-		DomainSize =sizeof(DomainName)-1;
-		SID_NAME_USE SidType;
-		DWORD dwsize=size;
-		LookupAccountSid(NULL, ptu->User.Sid, buffer, &dwsize, DomainName, &DomainSize, &SidType);
-		//free(ptu);
-		CloseHandle(hPToken);
-		CloseHandle(hProcess);
-		return 1;
-	}
-	//free(ptu);
-	strcpy(buffer,"");
-	CloseHandle(hPToken);
-	CloseHandle(hProcess);
-	return 0;
-}
-
-
-
-vncService::vncService()
-{
-    OSVERSIONINFO osversioninfo;
-    osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo);
-
-    // Get the current OS version
-    if (!GetVersionEx(&osversioninfo))
-	    g_platform_id = 0;
-    g_platform_id = osversioninfo.dwPlatformId;
-	g_version_major = osversioninfo.dwMajorVersion;
-	g_version_minor = osversioninfo.dwMinorVersion;
-}
-
-// CurrentUser - fills a buffer with the name of the current user!
-BOOL
-GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change
-{	
-	if (vncService::RunningFromExternalService())
-	{
-//		vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Forcing g_impersonating_user \n"));
-		g_impersonating_user = TRUE;
-	}
-
-	// How to obtain the name of the current user depends upon the OS being used
-	if ((g_platform_id == VER_PLATFORM_WIN32_NT) && vncService::RunningAsService())
-	{
-		// Windows NT, service-mode
-
-		// -=- FIRSTLY - verify that a user is logged on
-
-		// Get the current Window station
-		HWINSTA station = GetProcessWindowStation();
-		if (station == NULL)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - ERROR : No window station \n"));
-			return FALSE;
-		}
-
-		// Get the current user SID size
-		DWORD usersize;
-		GetUserObjectInformation(station, UOI_USER_SID, NULL, 0, &usersize);
-		SetLastError(0);
-
-		// Check the required buffer size isn't zero
-		if (usersize == 0)
-		{
-			// No user is logged in - ensure we're not impersonating anyone
-			RevertToSelf();
-			g_impersonating_user = FALSE;
-
-			// Return "" as the name...
-			if (strlen("") >= size)
-			{
-				vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Bad buffer size \n"));
-				return FALSE;
-			}
-			strcpy(buffer, "");
-
-			vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Usersize 0\n"));
-			return TRUE;
-		}
-
-		// -=- SECONDLY - a user is logged on but if we're not impersonating
-		//     them then we can't continue!
-		if (!g_impersonating_user)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: NOT impersonating user \n"));
-			// Return "" as the name...
-			if (strlen("") >= size)
-				return FALSE;
-			strcpy(buffer, "");
-			return TRUE;
-		}
-	}
-		
-	// -=- When we reach here, we're either running under Win9x, or we're running
-	//     under NT as an application or as a service impersonating a user
-	// Either way, we should find a suitable user name.
-
-	switch (g_platform_id)
-	{
-
-	case VER_PLATFORM_WIN32_WINDOWS:
-	case VER_PLATFORM_WIN32_NT:
-		{
-			// Just call GetCurrentUser
-			DWORD length = size;
-
-//			vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - GetUserName call \n"));
-			if ( GetConsoleUser(buffer, size) == 0)
-			{
-				if (GetUserName(buffer, &length) == 0)
-				{
-					UINT error = GetLastError();
-
-					if (error == ERROR_NOT_LOGGED_ON)
-					{
-						vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: No user logged on \n"));
-						// No user logged on
-						if (strlen("") >= size)
-							return FALSE;
-						strcpy(buffer, "");
-						return TRUE;
-					}
-					else
-					{
-						// Genuine error...
-						vnclog.Print(LL_INTERR, VNCLOG("getusername error %d\n"), GetLastError());
-						return FALSE;
-					}
-				}
-			}
-		}
-		vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - UserNAme found: %s \n"), buffer);
-		return TRUE;
-	};
-
-	// OS was not recognised!
-	vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Unknown OS \n"));
-	return FALSE;
-}
-
-// RealVNC 336 change
-BOOL
-vncService::CurrentUser(char *buffer, UINT size)
-{
-  BOOL result = GetCurrentUser(buffer, size);
-  if (result && (strcmp(buffer, "") == 0) && !vncService::RunningAsService()) {
-    strncpy(buffer, "Default", size);
-  }
-  return result;
-}
-
-
-BOOL vncService::IsWSLocked()
-{
-	if (!IsWinNT()) 
-		return false;
-
-	bool bLocked = false;
-
-
-	HDESK hDesk;
-	BOOL bRes;
-	DWORD dwLen;
-	char sName[200];
-	
-	hDesk = OpenInputDesktop(0, FALSE, 0);
-
-	if (hDesk == NULL)
-	{
-		 bLocked = true;
-	}
-	else 
-	{
-		bRes = GetUserObjectInformation(hDesk, UOI_NAME, sName, sizeof(sName), &dwLen);
-
-		if (bRes)
-			sName[dwLen]='\0';
-		else
-			sName[0]='\0';
-
-
-		if (_stricmp(sName,"Default") != 0)
-			 bLocked = true; // WS is locked or screen saver active
-		else
-			 bLocked = false ;
-	}
-	if (hDesk != NULL)
-		CloseDesktop(hDesk);
-
-	return bLocked;
-}
-
-
-// IsWin95 - returns a BOOL indicating whether the current OS is Win95
-BOOL
-vncService::IsWin95()
-{
-	return (g_platform_id == VER_PLATFORM_WIN32_WINDOWS);
-}
-
-// IsWinNT - returns a bool indicating whether the current OS is WinNT
-BOOL
-vncService::IsWinNT()
-{
-	return (g_platform_id == VER_PLATFORM_WIN32_NT);
-}
-
-// Version info
-DWORD
-vncService::VersionMajor()
-{
-	return g_version_major;
-}
-
-DWORD
-vncService::VersionMinor()
-{
-	return g_version_minor;
-}
-
-//adzm 2010-02-10 - Finds the appropriate VNC window
-HWND
-FindWinVNCWindow(bool bThisProcess)
-{
-	// Locate the hidden WinVNC menu window
-
-	if (!bThisProcess) {
-		// Find any window with the MENU_CLASS_NAME window class
-		return FindWindow(MENU_CLASS_NAME, NULL);
-	} else {
-		// Find one that matches the class and is the same process		
-		HWND hwndZ = NULL;
-		HWND hwndServer = NULL;
-		while (!hwndServer) {
-			hwndServer = FindWindowEx(NULL, hwndZ, MENU_CLASS_NAME, NULL);
-
-			if (hwndServer != NULL) {
-				DWORD dwProcessId = 0;
-				//DWORD dwThreadId = GetWindowThreadProcessId(hwndServer, &dwProcessId);
-
-				if (dwProcessId == GetCurrentProcessId()) {
-					return hwndServer;
-				} else {
-					hwndZ = hwndServer;
-					hwndServer = NULL;
-				}
-			} else {
-				return NULL;
-			}
-		}
-	}
-
-	return NULL;
-}
-
-// Internal routine to find the WinVNC menu class window and
-// post a message to it!
-
-BOOL
-PostToWinVNC(UINT message, WPARAM wParam, LPARAM lParam)
-{
-	// Locate the hidden WinVNC menu window
-	// adzm 2010-02-10 - If we are in SC mode, then we know we want to only post messages to our own instance. This prevents
-	// conflicts if the user already has another copy of a WinVNC-derived application running.
-	if (SPECIAL_SC_EXIT || SPECIAL_SC_PROMPT) {
-		return PostToThisWinVNC(message, wParam, lParam);
-	}
-
-	//adzm 2010-02-10 - Finds the appropriate VNC window
-	HWND hservwnd = FindWinVNCWindow(false);
-	if (hservwnd == NULL)
-		return FALSE;
-
-	// Post the message to WinVNC
-	PostMessage(hservwnd, message, wParam, lParam);
-	return TRUE;
-}
-
-//adzm 2010-02-10 - Only posts to the same process
-BOOL 
-PostToThisWinVNC(UINT message, WPARAM wParam, LPARAM lParam)
-{
-	//adzm 2010-02-10 - Finds the appropriate VNC window for this process
-	HWND hservwnd = FindWinVNCWindow(true);
-	if (hservwnd == NULL)
-		return FALSE;
-
-	// Post the message to WinVNC
-	PostMessage(hservwnd, message, wParam, lParam);
-	return TRUE;
-}
-
-
-// Static routines only used on Windows NT to ensure we're in the right desktop
-// These routines are generally available to any thread at any time.
-
-// - SelectDesktop(HDESK)
-// Switches the current thread into a different desktop by deskto handle
-// This call takes care of all the evil memory management involved
-
-BOOL
-vncService::SelectHDESK(HDESK new_desktop)
-{
-	// Are we running on NT?
-	if (IsWinNT())
-	{
-		HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-
-		DWORD dummy;
-		char new_name[256];
-
-		if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
-			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
-			return FALSE;
-		}
-
-		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop);
-
-		// Switch the desktop
-		if(!SetThreadDesktop(new_desktop)) {
-			vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
-			return FALSE;
-		}
-
-		return TRUE;
-	}
-
-	return TRUE;
-}
-
-// - SelectDesktop(char *)
-// Switches the current thread into a different desktop, by name
-// Calling with a valid desktop name will place the thread in that desktop.
-// Calling with a NULL name will place the thread in the current input desktop.
-BOOL
-vncService::SelectDesktop(char *name, HDESK *new_desktop)
-{
-	//return false;
-	// Are we running on NT?
-	if (IsWinNT())
-	{
-		HDESK desktop;
-		vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n"));
-		if (name != NULL)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 named\n"));
-			// Attempt to open the named desktop
-			desktop = OpenDesktop(name, 0, FALSE,
-				DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-				DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-				DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-				DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
-		}
-		else
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n"));
-			// No, so open the input desktop
-			desktop = OpenInputDesktop(0, FALSE,
-				DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-				DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-				DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-				DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
-		}
-
-		// Did we succeed?
-		if (desktop == NULL) {
-				vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 \n"));
-				return FALSE;
-		}
-		else vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 OK\n"));
-
-		// Switch to the new desktop
-		if (!SelectHDESK(desktop)) {
-			// Failed to enter the new desktop, so free it!
-			if (!CloseDesktop(desktop))
-				vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop failed to close desktop\n"));
-			return FALSE;
-		}
-
-
-		if (new_desktop)
-		{
-			if (*new_desktop)
-				CloseDesktop(*new_desktop);
-			*new_desktop = desktop;
-		}
-
-		// We successfully switched desktops!
-		return TRUE;
-	}
-
-	return (name == NULL);
-}
-
-
-
-// Find the visible window station and switch to it
-// This would allow the service to be started non-interactive
-// Needs more supporting code & a redesign of the server core to
-// work, with better partitioning between server & UI components.
-
-static HWINSTA home_window_station = GetProcessWindowStation();
-
-BOOL CALLBACK WinStationEnumProc(LPTSTR name, LPARAM param) {
-	HWINSTA station = OpenWindowStation(name, FALSE, GENERIC_ALL);
-	HWINSTA oldstation = GetProcessWindowStation();
-	USEROBJECTFLAGS flags;
-	if (!GetUserObjectInformation(station, UOI_FLAGS, &flags, sizeof(flags), NULL)) {
-		return TRUE;
-	}
-	BOOL visible = flags.dwFlags & WSF_VISIBLE;
-	if (visible) {
-		if (SetProcessWindowStation(station)) {
-			if (oldstation != home_window_station) {
-				CloseWindowStation(oldstation);
-			}
-		} else {
-			CloseWindowStation(station);
-		}
-		return FALSE;
-	}
-	return TRUE;
-}
-
-// NT only function to establish whether we're on the current input desktop
-
-int
-vncService::InputDesktopSelected()
-{
-//	vnclog.Print(LL_INTERR, VNCLOG("InputDesktopSelected()\n"));
-	// Are we running on NT?
-	if (IsWinNT())
-	{
-		// Get the input and thread desktops
-		HDESK threaddesktop = GetThreadDesktop(GetCurrentThreadId());
-		HDESK inputdesktop = OpenInputDesktop(0, FALSE,
-				DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-				DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-				DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-				DESKTOP_SWITCHDESKTOP);
-
-
-		// Get the desktop names:
-		// *** I think this is horribly inefficient but I'm not sure.
-		if (inputdesktop == NULL)
-		{
-			//Running as SC we want to keep the viewer open in case UAC or screensaver jump in
-			if (!m_fRunningFromExternalService)return 2;
-			DWORD lasterror;
-			lasterror=GetLastError();
-			vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop %i I\n"),lasterror);
-			if (lasterror==170) return TRUE;
-			if (lasterror==624) return TRUE;
-			vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop II\n"));
-			return 0;
-		}
-
-		DWORD dummy;
-		char threadname[256];
-		char inputname[256];
-
-		if (!GetUserObjectInformation(threaddesktop, UOI_NAME, &threadname, 256, &dummy)) {
-			if (!CloseDesktop(inputdesktop))
-				vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n"));
-			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(threaddesktop\n"));
-			//Running as SC we want to keep the viewer open in case UAC or screensaver jump in
-			if (!m_fRunningFromExternalService)return 2;
-			return 0;
-		}
-		assert(dummy <= 256);
-		if (!GetUserObjectInformation(inputdesktop, UOI_NAME, &inputname, 256, &dummy)) {
-			if (!CloseDesktop(inputdesktop))
-				vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n"));
-			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(inputdesktop\n"));
-			//Running as SC we want to keep the viewer open in case UAC or screensaver jump in
-			if (!m_fRunningFromExternalService)return 2;
-			return 0;
-		}
-		assert(dummy <= 256);
-
-		if (!CloseDesktop(inputdesktop))
-			vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n"));
-
-		if (strcmp(threadname, inputname) != 0)
-		{
-			vnclog.Print(LL_INTERR, VNCLOG("threadname, inputname differ\n"));
-			//Running as SC we want to keep the viewer open in case UAC or screensaver jump in
-			if (!m_fRunningFromExternalService)return 2;
-		   return 0;
-		}	
-	}
-
-	return 1;
-}
-
-
-// Static routine used to fool Winlogon into thinking CtrlAltDel was pressed
-
-void *
-SimulateCtrlAltDelThreadFn(void *context)
-{
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	HDESK winlogon_desk = 0;
-	// Switch into the Winlogon desktop
-	if (!vncService::SelectDesktop("Winlogon", &winlogon_desk))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
-		vncTimedMsgBox::Do(
-									sz_ID_CADERROR,
-									sz_ID_ULTRAVNC_WARNING,
-									MB_ICONINFORMATION | MB_OK
-									);
-		return FALSE;
-	}
-
-    // 9 April 2008 jdp
-    // turn off capslock if on
-    ClearKeyState(VK_CAPITAL);
-	vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));
-
-	// Fake a hotkey event to any windows we find there.... :(
-	// Winlogon uses hotkeys to trap Ctrl-Alt-Del...
-	PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));
-
-	// Switch back to our original desktop
-	if (old_desktop != NULL)
-	{
-			vncService::SelectHDESK(old_desktop);
-		CloseDesktop(winlogon_desk);
-	}
-	return NULL;
-}
-
-// Static routine to simulate Ctrl-Alt-Del locally
-
-BOOL
-vncService::SimulateCtrlAltDel()
-{
-	vnclog.Print(LL_ALL, VNCLOG("preparing to generate ctrl-alt-del\n"));
-
-	// Are we running on NT?
-	if (IsWinNT())
-	{
-		vnclog.Print(LL_ALL, VNCLOG("spawn ctrl-alt-del thread...\n"));
-
-		// *** This is an unpleasant hack.  Oh dear.
-
-		// I simulate CtrAltDel by posting a WM_HOTKEY message to all
-		// the windows on the Winlogon desktop.
-		// This requires that the current thread is part of the Winlogon desktop.
-		// But the current thread has hooks set & a window open, so it can't
-		// switch desktops, so I instead spawn a new thread & let that do the work...
-
-		omni_thread *thread = omni_thread::create(SimulateCtrlAltDelThreadFn);
-		if (thread == NULL)
-			return FALSE;
-		thread->join(NULL);
-
-		return TRUE;
-	}
-
-	return TRUE;
-}
-
-// Static routine to lock a 2K or above workstation
-
-BOOL
-vncService::LockWorkstation()
-{
-	if (!IsWinNT()) {
-		vnclog.Print(LL_INTERR, VNCLOG("unable to lock workstation - not NT\n"));
-		return FALSE;
-	}
-
-	vnclog.Print(LL_ALL, VNCLOG("locking workstation\n"));
-
-	// Load the user32 library
-	HMODULE user32 = LoadLibrary("user32.dll");
-	if (!user32) {
-		vnclog.Print(LL_INTERR, VNCLOG("unable to load User32 DLL (%u)\n"), GetLastError());
-		return FALSE;
-	}
-
-	// Get the LockWorkstation function
-	typedef BOOL (*LWProc) ();
-	LWProc lockworkstation = (LWProc)GetProcAddress(user32, "LockWorkStation");
-	if (!lockworkstation) {
-		vnclog.Print(LL_INTERR, VNCLOG("unable to locate LockWorkStation - requires Windows 2000 or above (%u)\n"), GetLastError());
-		FreeLibrary(user32);
-		return FALSE;
-	}
-	
-	// Attempt to lock the workstation
-	BOOL result = (lockworkstation)();
-
-	if (!result) {
-		vnclog.Print(LL_INTERR, VNCLOG("call to LockWorkstation failed\n"));
-		FreeLibrary(user32);
-		return FALSE;
-	}
-
-	FreeLibrary(user32);
-	return result;
-}
-
-// Static routine to tell a locally-running instance of the server
-// to connect out to a new client
-
-BOOL
-vncService::PostAddNewClient(unsigned long ipaddress, unsigned short port)
-{
-	// Post to the WinVNC menu window
-	if (!PostToWinVNC(MENU_ADD_CLIENT_MSG, (WPARAM)port, (LPARAM)ipaddress))
-	{
-
-		//MessageBoxSecure(NULL, sz_ID_NO_EXIST_INST, szAppName, MB_ICONEXCLAMATION | MB_OK);
-
-		//Little hack, seems postmessage fail in some cases on some os.
-		//permission proble
-		//use G_var + WM_time to reconnect
-		vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient failed\n"));
-		if (port==1111 && ipaddress==1111) G_1111=true;
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-BOOL
-vncService::PostAddNewClientInit(unsigned long ipaddress, unsigned short port)
-{
-	// Post to the WinVNC menu window
-	if (!PostToWinVNC(MENU_ADD_CLIENT_MSG_INIT, (WPARAM)port, (LPARAM)ipaddress))
-	{
-
-		//MessageBoxSecure(NULL, sz_ID_NO_EXIST_INST, szAppName, MB_ICONEXCLAMATION | MB_OK);
-
-		//Little hack, seems postmessage fail in some cases on some os.
-		//permission proble
-		//use G_var + WM_time to reconnect
-		vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient failed\n"));
-		if (port==1111 && ipaddress==1111) G_1111=true;
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-//adzm 2009-06-20
-// Static routine to tell a locally-running instance of the server
-// to prompt for a new ID to connect out to the repeater
-
-BOOL
-vncService::PostAddNewRepeaterClient()
-{
-	// assumes the -repeater command line set the repeater global variable.
-
-	// Post to the WinVNC menu window (usually expected to fail at program startup)
-	if (!PostToWinVNC(MENU_ADD_CLIENT_MSG, (WPARAM)0xFFFFFFFF, (LPARAM)0xFFFFFFFF))
-	{
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-// Static routine to tell a locally-running instance of the server
-// about a reconnect
-
-BOOL
-vncService::PostAddAutoConnectClient( const char* pszId )
-{
-	ATOM aId = INVALID_ATOM;
-	if ( pszId )
-	{
-		aId = GlobalAddAtom( pszId );
-//		delete pszId;
-	}
-	return ( PostToWinVNC(MENU_AUTO_RECONNECT_MSG, 0, (LPARAM)aId) );
-}
-
-BOOL
-vncService::PostAddStopConnectClient()
-{
-	return ( PostToWinVNC(MENU_STOP_RECONNECT_MSG, 0, 0) );
-}
-
-BOOL
-vncService::PostAddStopConnectClientAll()
-{
-	PostToWinVNC(MENU_STOP_RECONNECT_MSG, 0, 0); // stop running reconnect in server class
-	return ( PostToWinVNC(MENU_STOP_ALL_RECONNECT_MSG, 0, 0) ); //disable reconnect for tunning clients
-}
-
-BOOL
-vncService::PostAddConnectClient( const char* pszId )
-{
-	ATOM aId = INVALID_ATOM;
-	if ( pszId )
-	{
-		aId = GlobalAddAtom( pszId );
-//		delete pszId;
-	}
-	return ( PostToWinVNC(MENU_REPEATER_ID_MSG, 0, (LPARAM)aId) );
-}
-
-BOOL
-vncService::RunningAsService()
-{
-	if (m_fRunningFromExternalService) return true;
-	else return false;
-}
-
-BOOL 
-vncService::RunningFromExternalService()
-{
-	return m_fRunningFromExternalService;
-}
-
-
-void 
-vncService::RunningFromExternalService(BOOL fEnabled)
-{
-	m_fRunningFromExternalService = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-extern char service_name[];
-bool
-vncService::IsInstalled()
-{
-    BOOL bResult = FALSE;
-    SC_HANDLE hSCM = ::OpenSCManager(NULL, // local machine
-                                     NULL, // ServicesActive database
-                                     SC_MANAGER_ENUMERATE_SERVICE); // full access
-    if (hSCM) {
-        SC_HANDLE hService = ::OpenService(hSCM,
-                                           service_name,
-                                           SERVICE_QUERY_CONFIG);
-        if (hService) {
-            bResult = TRUE;
-            ::CloseServiceHandle(hService);
-        }
-        ::CloseServiceHandle(hSCM);
-    }
-    return (FALSE != bResult);
-}
-
-
diff --git a/ica/win32/winvnc/winvnc/vncservice.h b/ica/win32/winvnc/winvnc/vncservice.h
deleted file mode 100644
index f41ccf2..0000000
--- a/ica/win32/winvnc/winvnc/vncservice.h
+++ /dev/null
@@ -1,122 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncService
-
-// SERVICE-MODE CODE
-
-// This class provides access to service-oriented routines, under both
-// Windows NT and Windows 95.  Some routines only operate under one
-// OS, others operate under any OS.
-
-class vncService;
-
-#if (!defined(_WINVNC_VNCSERVICE))
-#define _WINVNC_VNCSERVICE
-
-#include "stdhdrs.h"
-
-BOOL PostToWinVNC(UINT message, WPARAM wParam, LPARAM lParam);
-
-//adzm 2010-02-10 - Only posts to the same process
-BOOL PostToThisWinVNC(UINT message, WPARAM wParam, LPARAM lParam);
-
-//adzm 2010-02-10 - Finds the appropriate VNC window
-HWND FindWinVNCWindow(bool bThisProcess);
-
-
-// The NT-specific code wrapper class
-class vncService
-{
-
-public:
-	vncService();
-	// Routine to establish and return the currently logged in user name
-	static BOOL CurrentUser(char *buffer, UINT size);
-	static BOOL IsWSLocked(); // sf at 2005
-
-	// Routines to establish which OS we're running on
-	static BOOL IsWin95();
-	static BOOL IsWinNT();
-	static DWORD VersionMajor();
-	static DWORD VersionMinor();
-
-	// Routine to establish whether the current instance is running
-	// as a service or not
-	static BOOL RunningAsService();
-
-	// Routine to kill any other running copy of WinVNC
-	static BOOL KillRunningCopy();
-
-	// Routine to set the current thread into the given desktop
-	static BOOL SelectHDESK(HDESK newdesktop);
-
-	// Routine to set the current thread into the named desktop,
-	// or the input desktop if no name is given
-	static BOOL SelectDesktop(char *name, HDESK *desktop);
-
-	// Routine to switch the service process across to the currently
-	// visible Window Station and back to its home window station again
-
-	// Routine to establish whether the current thread desktop is the
-	// current user input one
-	static int InputDesktopSelected();
-
-	// Routine to fake a CtrlAltDel to winlogon when required.
-	// *** This is a nasty little hack...
-	static BOOL SimulateCtrlAltDel();
-
-	// Routine to lock the workstation.  Returns TRUE if successful.
-	// Main cause of failure will be when locking is not supported
-	static BOOL LockWorkstation();
-
-	// Routine to make the an already running copy of WinVNC bring up its
-	// About box so you can check the version!
-	static BOOL ShowAboutBox();
-
-	// Routine to make an already running copy of WinVNC form an outgoing
-	// connection to a new VNC client
-	static BOOL PostAddNewClient(unsigned long ipaddress, unsigned short port);
-	static BOOL PostAddNewClientInit(unsigned long ipaddress, unsigned short port);
-
-	//adzm 2009-06-20
-	// Static routine to tell a locally-running instance of the server
-	// to prompt for a new ID to connect out to the repeater
-	static BOOL PostAddNewRepeaterClient();
-	
-	// Routine to make an already running copy of WinVNC deal with Auto Reconnect
-	// along with an ID
-	static BOOL PostAddAutoConnectClient( const char* pszId );
-	static BOOL PostAddConnectClient( const char* pszId );
-	static BOOL PostAddStopConnectClient();
-	static BOOL PostAddStopConnectClientAll();
-
-	static BOOL RunningFromExternalService();
-	static void RunningFromExternalService(BOOL fEnabled);
-	static bool IsInstalled();
-
-};
-
-#endif
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vncsetauth.cpp b/ica/win32/winvnc/winvnc/vncsetauth.cpp
deleted file mode 100644
index aa81d5d..0000000
--- a/ica/win32/winvnc/winvnc/vncsetauth.cpp
+++ /dev/null
@@ -1,685 +0,0 @@
-//  Copyright (C) 2002 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 at uk.research.att.com for information on obtaining it.
-
-
-// vncSetAuth.cpp
-
-// Implementation of the About dialog!
-
-#include "stdhdrs.h"
-
-#include "winvnc.h"
-#include "vncsetauth.h"
-#include "vncservice.h"
-#include "common/win32_helpers.h"
-
-#define MAXSTRING 254
-
-const TCHAR REGISTRY_KEY [] = "Software\\UltraVnc";
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-extern HINSTANCE	hInstResDLL;
-
-void
-vncSetAuth::OpenRegistry()
-{
-	if (m_fUseRegistry)
-	{
-		DWORD dw;
-		if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
-			REGISTRY_KEY,
-			0,REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_READ,
-			NULL, &hkLocal, &dw) != ERROR_SUCCESS)
-			return;
-		if (RegCreateKeyEx(hkLocal,
-			"mslogon",
-			0, REG_NONE, REG_OPTION_NON_VOLATILE,
-			KEY_WRITE | KEY_READ,
-			NULL, &hkDefault, &dw) != ERROR_SUCCESS)
-			return;
-	}
-}
-
-void
-vncSetAuth::CloseRegistry()
-{
-	if (m_fUseRegistry)
-	{
-		if (hkDefault != NULL) RegCloseKey(hkDefault);
-		if (hkUser != NULL) RegCloseKey(hkUser);
-		if (hkLocal != NULL) RegCloseKey(hkLocal);
-	}
-}
-
-LONG
-vncSetAuth::LoadInt(HKEY key, LPCSTR valname, LONG defval)
-{
-	if (m_fUseRegistry)
-	{
-		LONG pref;
-		ULONG type = REG_DWORD;
-		ULONG prefsize = sizeof(pref);
-
-		if (RegQueryValueEx(key,
-			valname,
-			NULL,
-			&type,
-			(LPBYTE) &pref,
-			&prefsize) != ERROR_SUCCESS)
-			return defval;
-
-		if (type != REG_DWORD)
-			return defval;
-
-		if (prefsize != sizeof(pref))
-			return defval;
-
-		return pref;
-	}
-	else
-	{
-		return myIniFile.ReadInt("admin_auth", (char *)valname, defval);
-	}
-}
-
-TCHAR *
-vncSetAuth::LoadString(HKEY key, LPCSTR keyname)
-{
-	if (m_fUseRegistry)
-	{
-		DWORD type = REG_SZ;
-		DWORD buflen = 256*sizeof(TCHAR);
-		TCHAR *buffer = 0;
-
-		// Get the length of the string
-		if (RegQueryValueEx(key,
-			keyname,
-			NULL,
-			&type,
-			NULL,
-			&buflen) != ERROR_SUCCESS)
-			return 0;
-
-		if (type != REG_BINARY)
-			return 0;
-		buflen = 256*sizeof(TCHAR);
-		buffer = new TCHAR[buflen];
-		if (buffer == 0)
-			return 0;
-
-		// Get the string data
-		if (RegQueryValueEx(key,
-			keyname,
-			NULL,
-			&type,
-			(BYTE*)buffer,
-			&buflen) != ERROR_SUCCESS) {
-			delete [] buffer;
-			return 0;
-		}
-
-		// Verify the type
-		if (type != REG_BINARY) {
-			delete [] buffer;
-			return 0;
-		}
-
-		return (TCHAR *)buffer;
-	}
-	else
-	{
-		TCHAR *authhosts=new char[150];
-		myIniFile.ReadString("admin_auth", (char *)keyname,authhosts,150);
-		return (TCHAR *)authhosts;
-	}
-}
-
-void
-vncSetAuth::SaveInt(HKEY key, LPCSTR valname, LONG val)
-{
-	if (m_fUseRegistry)
-	{
-		RegSetValueEx(key, valname, 0, REG_DWORD, (LPBYTE) &val, sizeof(val));
-	}
-	else
-	{
-		myIniFile.WriteInt("admin_auth", (char *)valname, val);
-	}
-}
-
-void
-vncSetAuth::SaveString(HKEY key,LPCSTR valname, TCHAR *buffer)
-{
-	if (m_fUseRegistry)
-	{
-		RegSetValueEx(key, valname, 0, REG_BINARY, (LPBYTE) buffer, MAXSTRING);
-	}
-	else
-	{
-		myIniFile.WriteString("admin_auth", (char *)valname,buffer);
-	}
-}
-
-void
-vncSetAuth::savegroup1(TCHAR *value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group1", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group1", value);
-	}
-}
-TCHAR*
-vncSetAuth::Readgroup1()
-{
-	if (m_fUseRegistry)
-	{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group1");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group1");
-		return value;
-	}
-}
-
-void
-vncSetAuth::savegroup2(TCHAR *value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group2", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group2", value);
-	}
-}
-TCHAR*
-vncSetAuth::Readgroup2()
-{
-	if (m_fUseRegistry)
-		{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group2");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group2");
-		return value;
-	}
-}
-
-void
-vncSetAuth::savegroup3(TCHAR *value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveString(hkDefault, "group3", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveString(hkDefault, "group3", value);
-	}
-}
-TCHAR*
-vncSetAuth::Readgroup3()
-{
-	if (m_fUseRegistry)
-	{
-		TCHAR *value=NULL;
-		OpenRegistry();
-		if (hkDefault) value=LoadString (hkDefault, "group3");
-		CloseRegistry();
-		return value;
-	}
-	else
-	{
-		TCHAR *value=NULL;
-		value=LoadString (hkDefault, "group3");
-		return value;
-	}
-}
-
-LONG
-vncSetAuth::Readlocdom1(LONG returnvalue)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom1",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom1",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-vncSetAuth::savelocdom1(LONG value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom1", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom1", value);
-	}
-
-}
-
-LONG
-vncSetAuth::Readlocdom2(LONG returnvalue)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom2",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom2",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-vncSetAuth::savelocdom2(LONG value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom2", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom2", value);
-	}
-
-}
-
-LONG
-vncSetAuth::Readlocdom3(LONG returnvalue)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault) returnvalue=LoadInt(hkDefault, "locdom3",returnvalue);
-		CloseRegistry();
-		return returnvalue;
-	}
-	else
-	{
-		returnvalue=LoadInt(hkDefault, "locdom3",returnvalue);
-		return returnvalue;
-	}
-}
-
-void
-vncSetAuth::savelocdom3(LONG value)
-{
-	if (m_fUseRegistry)
-	{
-		OpenRegistry();
-		if (hkDefault)SaveInt(hkDefault, "locdom3", value);
-		CloseRegistry();
-	}
-	else
-	{
-		SaveInt(hkDefault, "locdom3", value);
-	}
-
-}
-
-///////////////////////////////////////////////////////////
-
-
-
-// Constructor/destructor
-vncSetAuth::vncSetAuth()
-{
-	m_fUseRegistry = ((myIniFile.ReadInt("admin", "UseRegistry", 0) == 1) ? TRUE : FALSE);
-	m_dlgvisible = FALSE;
-	hkLocal=NULL;
-	hkDefault=NULL;
-	hkUser=NULL;
-	locdom1=0;
-	locdom2=0;
-	locdom3=0;
-	group1=Readgroup1();
-	group2=Readgroup2();
-	group3=Readgroup3();
-	locdom1=Readlocdom1(locdom1);
-	locdom2=Readlocdom2(locdom2);
-	locdom3=Readlocdom3(locdom3);
-	if (group1){strcpy(pszgroup1,group1);delete [] group1;}
-	else strcpy(pszgroup1,"");
-	if (group2){strcpy(pszgroup2,group2);delete [] group2;}
-	else strcpy(pszgroup2,"");
-	if (group3){strcpy(pszgroup3,group3);delete [] group3;}
-	else strcpy(pszgroup3,"");
-}
-
-vncSetAuth::~vncSetAuth()
-{
-}
-
-// Initialisation
-BOOL
-vncSetAuth::Init(vncServer *server)
-{
-	m_server = server;
-	m_dlgvisible = FALSE;
-	hkLocal=NULL;
-	hkDefault=NULL;
-	hkUser=NULL;
-	locdom1=0;
-	locdom2=0;
-	locdom3=0;
-	group1=Readgroup1();
-	group2=Readgroup2();
-	group3=Readgroup3();
-	locdom1=Readlocdom1(locdom1);
-	locdom2=Readlocdom2(locdom2);
-	locdom3=Readlocdom3(locdom3);
-	if (group1){strcpy(pszgroup1,group1);delete group1;}
-	else strcpy(pszgroup1,"");
-	if (group2){strcpy(pszgroup2,group2);delete group2;}
-	else strcpy(pszgroup2,"");
-	if (group3){strcpy(pszgroup3,group3);delete group3;}
-	else strcpy(pszgroup3,"");
-	return TRUE;
-}
-
-// Dialog box handling functions
-void
-vncSetAuth::Show(BOOL show)
-{
-	if (show)
-	{
-		if (!m_dlgvisible)
-		{
-			// [v1.0.2-jp1 fix] Load resouce from dll
-			//DialogBoxParam(hAppInstance,
-			DialogBoxParam(hInstResDLL,
-				MAKEINTRESOURCE(IDD_MSLOGON), 
-				NULL,
-				(DLGPROC) DialogProc,
-				(LONG_PTR) this);
-		}
-	}
-}
-
-BOOL CALLBACK
-vncSetAuth::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!
-    vncSetAuth *_this = helper::SafeGetWindowUserData<vncSetAuth>(hwnd);
-
-	switch (uMsg)
-	{
-
-	case WM_INITDIALOG:
-		{
-			// Retrieve the Dialog box parameter and use it as a pointer
-			// to the calling vncProperties object
-            helper::SafeSetWindowUserData(hwnd, lParam);
-
-			_this = (vncSetAuth *) lParam;
-			SetDlgItemText(hwnd, IDC_GROUP1, _this->pszgroup1);
-			SetDlgItemText(hwnd, IDC_GROUP2, _this->pszgroup2);
-			SetDlgItemText(hwnd, IDC_GROUP3, _this->pszgroup3);
-			if (_this->locdom1==1 || _this->locdom1==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1L);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1L);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			if (_this->locdom1==2 || _this->locdom1==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1D);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1D);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			if (_this->locdom2==1 || _this->locdom2==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2L);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2L);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			if (_this->locdom2==2 || _this->locdom2==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2D);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2D);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			if (_this->locdom3==1 || _this->locdom3==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3L);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3L);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			if (_this->locdom3==2 || _this->locdom3==3)
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3D);
-				SendMessage(hG1l,BM_SETCHECK,true,0);
-			}
-			else
-			{
-				HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3D);
-				SendMessage(hG1l,BM_SETCHECK,false,0);
-			}
-			//already handled by vncproperties
-			//if we get at thgis place
-			//IDC_MSLOGON_CHECKD was checked
-			/*HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD);
-            SendMessage(hMSLogon, BM_SETCHECK, _this->m_server->MSLogonRequired(), 0);
-			if (SendMessage(hMSLogon, BM_GETCHECK,0, 0) == BST_CHECKED)
-				{
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), true);
-				}
-			else
-				{
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), FALSE);
-				}*/
-
-
-
-			// Show the dialog
-			SetForegroundWindow(hwnd);
-
-			_this->m_dlgvisible = TRUE;
-
-			return TRUE;
-		}
-
-	case WM_COMMAND:
-		switch (LOWORD(wParam))
-		{
-
-		case IDCANCEL:
-			EndDialog(hwnd, TRUE);
-				_this->m_dlgvisible = FALSE;
-				return TRUE;
-		case IDOK:
-			{
-				_this->locdom1=0;
-				_this->locdom2=0;
-				_this->locdom3=0;
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG1L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom1=_this->locdom1+1;
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG1D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom1=_this->locdom1+2;
-
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG2L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom2=_this->locdom2+1;
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG2D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom2=_this->locdom2+2;
-
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG3L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom3=_this->locdom3+1;
-				if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG3D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom3=_this->locdom3+2;
-
-				GetDlgItemText(hwnd, IDC_GROUP1, (LPSTR) _this->pszgroup1, 240);
-				GetDlgItemText(hwnd, IDC_GROUP2, (LPSTR) _this->pszgroup2, 240);
-				GetDlgItemText(hwnd, IDC_GROUP3, (LPSTR) _this->pszgroup3, 240);
-
-				bool use_uac=false;
-				if (!_this->myIniFile.IsWritable() || vncService::RunningAsService() )
-				{
-					// We can't write to the ini file , Vista in service mode
-					if (!Copy_to_Temp(_this->m_Tempfile))
-					{
-						// temp is not writable, we need to close else
-						// ini get overwritten by default
-						EndDialog(hwnd, TRUE);
-						_this->m_dlgvisible = FALSE;
-						return TRUE;
-					}
-					_this->myIniFile.IniFileSetTemp(_this->m_Tempfile);
-					use_uac=true;
-				}
-	
-				_this->savegroup1(_this->pszgroup1);
-				_this->savegroup2(_this->pszgroup2);
-				_this->savegroup3(_this->pszgroup3);
-				_this->savelocdom1(_this->locdom1);
-				_this->savelocdom2(_this->locdom2);
-				_this->savelocdom3(_this->locdom3);
-				if (use_uac==true)
-				{
-				_this->myIniFile.copy_to_secure();
-				_this->myIniFile.IniFileSetSecure();
-				}
-
-				EndDialog(hwnd, TRUE);
-				_this->m_dlgvisible = FALSE;
-				return TRUE;
-			}
-		// rdv not needed, already handled by vncproperties
-		// 
-		/*case IDC_MSLOGON_CHECKD:
-			{
-				HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD);
-				_this->m_server->RequireMSLogon(SendMessage(hMSLogon, BM_GETCHECK, 0, 0) == BST_CHECKED);
-				if (SendMessage(hMSLogon, BM_GETCHECK,0, 0) == BST_CHECKED)
-					{
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), true);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), true);
-						
-					}
-				else
-					{
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), FALSE);
-					EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), FALSE);
-					}
-			}*/
-		}
-
-		break;
-
-	case WM_DESTROY:
-		EndDialog(hwnd, FALSE);
-		_this->m_dlgvisible = FALSE;
-		return TRUE;
-	}
-	return 0;
-}
diff --git a/ica/win32/winvnc/winvnc/vncsetauth.h b/ica/win32/winvnc/winvnc/vncsetauth.h
deleted file mode 100644
index 952924a..0000000
--- a/ica/win32/winvnc/winvnc/vncsetauth.h
+++ /dev/null
@@ -1,98 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncSetAuth
-
-// Object implementing the About dialog for WinVNC.
-#include "inifile.h"
-class vncSetAuth;
-
-#if (!defined(_WINVNC_VNCSETAUTH))
-#define _WINVNC_VNCSETAUTH
-
-// Includes
-#include "stdhdrs.h"
-#include "vncserver.h"
-
-// The vncSetAuth class itself
-class vncSetAuth
-{
-public:
-	// Constructor/destructor
-	vncSetAuth();
-	~vncSetAuth();
-
-	// Initialisation
-	BOOL Init(vncServer *server);
-
-	// The dialog box window proc
-	static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-	// General
-	void Show(BOOL show);
-	void SetTemp(char *TempFile){strcpy_s(m_Tempfile,MAXPATH,TempFile);};
-	char m_Tempfile[MAXPATH];
-
-	// Implementation
-	BOOL m_dlgvisible;
-
-	void OpenRegistry();
-	void CloseRegistry();
-	LONG LoadInt(HKEY key, LPCSTR valname, LONG defval);
-	TCHAR * LoadString(HKEY key, LPCSTR keyname);
-	void SaveInt(HKEY key, LPCSTR valname, LONG val);
-	void SaveString(HKEY key,LPCSTR valname, TCHAR *buffer);
-	void savegroup1(TCHAR *value);
-	TCHAR* Readgroup1();
-	void savegroup2(TCHAR *value);
-	TCHAR* Readgroup2();
-	void savegroup3(TCHAR *value);
-	TCHAR* Readgroup3();
-	LONG Readlocdom1(LONG returnvalue);
-	void savelocdom1(LONG value);
-	LONG Readlocdom2(LONG returnvalue);
-	void savelocdom2(LONG value);
-	LONG Readlocdom3(LONG returnvalue);
-	void savelocdom3(LONG value);
-
-	HKEY hkLocal;
-	HKEY hkDefault;
-	HKEY hkUser;
-
-	char *group1;
-	char *group2;
-	char *group3;
-	long locdom1;
-	long locdom2;
-	long locdom3;
-	char pszgroup1[256];
-	char pszgroup2[256];
-	char pszgroup3[256];
-
-	vncServer *			m_server;
-	BOOL m_fUseRegistry;
-	IniFile myIniFile;
-};
-
-#endif // _WINVNC_VNCPROPERTIES
diff --git a/ica/win32/winvnc/winvnc/vncsockconnect.cpp b/ica/win32/winvnc/winvnc/vncsockconnect.cpp
deleted file mode 100644
index a0220a0..0000000
--- a/ica/win32/winvnc/winvnc/vncsockconnect.cpp
+++ /dev/null
@@ -1,227 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncSockConnect.cpp
-
-// Implementation of the listening socket class
-
-#include "stdhdrs.h"
-#include "vsocket.h"
-#include "vncsockconnect.h"
-#include "vncserver.h"
-#include <omnithread.h>
-
-#ifdef HTTP_SAMEPORT
-// Added for HTTP-via-RFB
-VBool maybeHandleHTTPRequest(VSocket* sock,vncServer* svr);
-#endif
-
-// The function for the spawned thread to run
-class vncSockConnectThread : public omni_thread
-{
-public:
-	// Init routine
-	virtual BOOL Init(VSocket *socket, vncServer *server);
-
-	// Code to be executed by the thread
-	virtual void *run_undetached(void * arg);
-
-	// Fields used internally
-	BOOL		m_shutdown;
-protected:
-	VSocket		*m_socket;
-	vncServer	*m_server;
-};
-
-// Method implementations
-BOOL vncSockConnectThread::Init(VSocket *socket, vncServer *server)
-{
-	// Save the server pointer
-	m_server = server;
-
-	// Save the socket pointer
-	m_socket = socket;
-
-	// Start the thread
-	m_shutdown = FALSE;
-	start_undetached();
-
-	return TRUE;
-}
-
-// Code to be executed by the thread
-void *vncSockConnectThread::run_undetached(void * arg)
-{
-	vnclog.Print(LL_STATE, VNCLOG("started socket connection thread\n"));
-
-	// Go into a loop, listening for connections on the given socket
-	while (!m_shutdown)
-	{
-		// Accept an incoming connection
-		VSocket *new_socket = m_socket->Accept();
-		if (new_socket == NULL)
-			break;
-		else
-		{
-#ifdef HTTP_SAMEPORT
-		if (maybeHandleHTTPRequest(new_socket,m_server)) {
- 			// HTTP request has been handled and new_socket closed. The client will
- 			// now reconnect to the RFB port and we will carry on.
- 			vnclog.Print(LL_CLIENTS,VNCLOG("Woo hoo! Served Java applet via RFB!"));
- 			continue;
- 		}
-#endif
-			vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s\n"), new_socket->GetPeerName());
-			if ((!m_shutdown && !fShutdownOrdered)) m_server->AddClient(new_socket, FALSE, FALSE,NULL);
-		}
-
-		if (m_shutdown) 
-		{
-			delete new_socket;
-			break;
-		}
-
-		// sf at 2007 - The following had be done to avoid to spawn a new client object/thread
-		// when the connection was not from a vncviewer or had bad RFB protocole version
-		// but it might be the cause of the v1.0.2 WinVNC connection unavailability/crash problems
-		// due to thread conflict at socket level (between this thread and vncClient thread)
-		/*
-		if (m_server->GetDSMPluginPointer()->IsEnabled())
-		{
-		m_server->AddClient(new_socket, FALSE, FALSE,NULL);
-		}
-		else
-		{
-		///////////////Eliminate polling and non vncviewers ////////////////
-		///////////////Unfindable memeory leak ?////////////////////////////
-		////////////////////////////////////////////////////////////////////
-#ifdef HTTP_SAMEPORT
-		if (maybeHandleHTTPRequest(new_socket,m_server)) {
- 			// HTTP request has been handled and new_socket closed. The client will
- 			// now reconnect to the RFB port and we will carry on.
- 			vnclog.Print(LL_CLIENTS,VNCLOG("Woo hoo! Served Java applet via RFB!"));
- 			continue;
- 		}
-#endif
-		rfbProtocolVersionMsg protocolMsg;
-		sprintf((char *)protocolMsg,
-		rfbProtocolVersionFormat,
-		rfbProtocolMajorVersion,
-		rfbProtocolMinorVersion + (m_server->MSLogonRequired() ? 0 : 2)); // 4: mslogon+FT,
-																		 // 6: VNClogon+FT
-		// Send the protocol message
-		if (new_socket->SendExact((char *)&protocolMsg, sz_rfbProtocolVersionMsg))
-			{
-				// Now, get the client's protocol version
-				rfbProtocolVersionMsg protocol_ver;
-				protocol_ver[12] = 0;
-				if (new_socket->ReadExact((char *)&protocol_ver, sz_rfbProtocolVersionMsg))
-				{
-					///////////////////////////////////////////////////////////////////
-					///////////////////////////////////////////////////////////////////
-					//We need at least a RFB start in the message
-					if (strncmp(protocol_ver,"RFB",3)==NULL)
-					{
-						vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s\n"), new_socket->GetPeerName());
-						// Successful accept - start the client unauthenticated
-						m_server->AddClient(new_socket, FALSE, FALSE,&protocol_ver);
-					}
-					else
-					{
-						delete new_socket;
-					}
-				}
-				else delete new_socket;
-			}
-		else delete new_socket;
-		}
-		*/
-	}
-	//if (new_socket != null)
-	//	delete new_socket;
-
-	vnclog.Print(LL_STATE, VNCLOG("quitting socket connection thread\n"));
-
-	return NULL;
-}
-
-// The vncSockConnect class implementation
-
-vncSockConnect::vncSockConnect()
-{
-	m_thread = NULL;
-}
-
-vncSockConnect::~vncSockConnect()
-{
-    m_socket.Shutdown();
-	m_socket.Close();
-
-    // Join with our lovely thread
-    if (m_thread != NULL)
-    {
-	// *** This is a hack to force the listen thread out of the accept call,
-	// because Winsock accept semantics are broken
-	((vncSockConnectThread *)m_thread)->m_shutdown = TRUE;
-
-	VSocket socket;
-	socket.Create();
-	socket.Bind(0);
-	socket.Connect("localhost", m_port);
-	socket.Close();
-
-	void *returnval;
-	m_thread->join(&returnval);
-	m_thread = NULL;
-
-	m_socket.Close();
-    }
-}
-
-BOOL vncSockConnect::Init(vncServer *server, UINT port)
-{
-	// Save the port id
-	m_port = port;
-
-	// Create the listening socket
-	if (!m_socket.Create())
-		return FALSE;
-
-	// Bind it
-	if (!m_socket.Bind(m_port, server->LoopbackOnly()))
-		return FALSE;
-
-	// Set it to listen
-	if (!m_socket.Listen())
-		return FALSE;
-
-	// Create the new thread
-	m_thread = new vncSockConnectThread;
-	if (m_thread == NULL)
-		return FALSE;
-
-	// And start it running
-	return ((vncSockConnectThread *)m_thread)->Init(&m_socket, server);
-}
-
diff --git a/ica/win32/winvnc/winvnc/vncsockconnect.h b/ica/win32/winvnc/winvnc/vncsockconnect.h
deleted file mode 100644
index 902d1c5..0000000
--- a/ica/win32/winvnc/winvnc/vncsockconnect.h
+++ /dev/null
@@ -1,68 +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 at uk.research.att.com for information on obtaining it.
-
-
-// vncSockConnect.h
-
-// The vncSockConnect class creates a listening socket and binds
-// it to the specified port.  It then creates a listen thread which
-// goes into a loop, listening on the socket.
-// When the vncSockConnect object is destroyed, all resources are
-// freed automatically, including the listen thread.
-
-class vncSockConnect;
-
-#if (!defined(_WINVNC_VNCSOCKCONNECT))
-#define _WINVNC_VNCSOCKCONNECT
-
-// Includes
-#include "stdhdrs.h"
-#include "vsocket.h"
-#include <omnithread.h>
-
-class vncServer;
-
-// The vncSockConnect class itself
-class vncSockConnect
-{
-public:
-	// Constructor/destructor
-	vncSockConnect();
-	virtual ~vncSockConnect();
-
-	// Init
-	virtual VBool Init(vncServer *server, UINT port);
-
-	// Implementation
-protected:
-	// The listening socket
-	VSocket m_socket;
-
-	// The port to listen on
-	UINT m_port;
-
-	// The in-coming accept thread
-	omni_thread *m_thread;
-};
-
-#endif // _WINVNC_VNCSOCKCONNECT
diff --git a/ica/win32/winvnc/winvnc/vnctimedmsgbox.cpp b/ica/win32/winvnc/winvnc/vnctimedmsgbox.cpp
deleted file mode 100644
index 169f6a8..0000000
--- a/ica/win32/winvnc/winvnc/vnctimedmsgbox.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-//  Copyright (C) 2002 Ultr at VNC Team Members. 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 at uk.research.att.com for information on obtaining it.
-
-// vncTimedMsgBox
-
-// vncTimedMsgBox::Do spawns an omni-thread to draw the message
-// box and wait a few seconds before returning, leaving the message-box displayed
-// until WinVNC quits.
-
-#include "stdhdrs.h"
-#include "omnithread.h"
-
-#include "vnctimedmsgbox.h"
-
-// The message-box delay
-const UINT TIMED_MSGBOX_DELAY = 1000;
-
-// The vncTimedMsgBoxThread class
-
-class vncTimedMsgBoxThread : public omni_thread
-{
-public:
-	vncTimedMsgBoxThread(const char *caption, const char *title, UINT type)
-	{
-		m_type = type;
-		m_caption = _strdup(caption);
-		m_title = _strdup(title);
-	};
-	virtual ~vncTimedMsgBoxThread()
-	{
-		if (m_caption != NULL)
-			free(m_caption);
-		if (m_title != NULL)
-			free(m_title);
-	};
-	virtual void run(void *)
-	{
-		// Create the desired dialog box
-		if (m_caption == NULL)
-			return;
-		MessageBoxSecure(NULL, m_caption, m_title, m_type | MB_OK|MB_SETFOREGROUND|MB_SERVICE_NOTIFICATION);
-	};
-	char *m_caption;
-	char *m_title;
-	UINT m_type;
-};
-
-// The main vncTimedMsgBox class
-
-void
-vncTimedMsgBox::Do(const char *caption, const char *title, UINT type)
-{
-	// Create the thread object
-	vncTimedMsgBoxThread *thread = new vncTimedMsgBoxThread(caption, title, type);
-	if (thread == NULL)
-		return;
-
-	// Start the thread object
-	thread->start();
-
-	// And wait a few seconds
-	Sleep(TIMED_MSGBOX_DELAY);
-}
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/vnctimedmsgbox.h b/ica/win32/winvnc/winvnc/vnctimedmsgbox.h
deleted file mode 100644
index aae642a..0000000
--- a/ica/win32/winvnc/winvnc/vnctimedmsgbox.h
+++ /dev/null
@@ -1,42 +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 at uk.research.att.com for information on obtaining it.
-
-// vncTimedMsgBox
-
-// Static class used to generate message boxes which allow the program's
-// execution to continue after a set delay (4 seconds at present)
-
-class vncTimedMsgBox;
-
-#if(!defined(_WINVNC_VNCTIMEDMSGBOX))
-#define _WINVNC_VNCTIMEDMSGBOX
-
-class vncTimedMsgBox
-{
-public:
-	// Bring up a message box, wait for two seconds, then return
-	static void Do(const char *caption, const char *title, UINT type);
-};
-
-#endif
-
diff --git a/ica/win32/winvnc/winvnc/vsocket.cpp b/ica/win32/winvnc/winvnc/vsocket.cpp
deleted file mode 100644
index 818ac4f..0000000
--- a/ica/win32/winvnc/winvnc/vsocket.cpp
+++ /dev/null
@@ -1,1144 +0,0 @@
-//  Copyright (C) 2002 RealVNC Ltd. All Rights Reserved.
-//  Copyright (C) 2001 HorizonLive.com, Inc. 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 at uk.research.att.com for information on obtaining it.
-
-
-// VSocket.cpp
-
-// The VSocket class provides a platform-independent socket abstraction
-// with the simple functionality required for an RFB server.
-
-class VSocket;
-
-////////////////////////////////////////////////////////
-// System includes
-
-#include "stdhdrs.h"
-#ifdef _VC80
-#include <iostream>
-#else
-#include <iostream>
-#endif
-
-#include <stdio.h>
-#ifdef __WIN32__
-#include <io.h>
-#include <winsock2.h>
-#include <in6addr.h>
-#include <mstcpip.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#endif
-#include <sys/types.h>
-
-////////////////////////////////////////////////////////
-// Custom includes
-
-#include <assert.h>
-#include "vtypes.h"
-extern unsigned int G_SENDBUFFER;
-////////////////////////////////////////////////////////
-// *** Lovely hacks to make Win32 work.  Hurrah!
-
-#ifdef __WIN32__
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#endif
-#endif
-
-////////////////////////////////////////////////////////
-// Socket implementation
-
-#include "vsocket.h"
-
-// The socket timeout value (currently 5 seconds, for no reason...)
-// *** THIS IS NOT CURRENTLY USED ANYWHERE
-const VInt rfbMaxClientWait = 5000;
-
-////////////////////////////
-// Socket implementation initialisation
-static WORD winsockVersion = 0;
-bool sendall(SOCKET RemoteSocket,char *buff,unsigned int bufflen,int dummy);
-
-VSocketSystem::VSocketSystem()
-{
-  // Initialise the socket subsystem
-  // This is only provided for compatibility with Windows.
-
-#ifdef __WIN32__
-  // Initialise WinPoxySockets on Win32
-  WORD wVersionRequested;
-  WSADATA wsaData;
-	
-  wVersionRequested = MAKEWORD(2, 0);
-  if (WSAStartup(wVersionRequested, &wsaData) != 0)
-  {
-    m_status = VFalse;
-	return;
-  }
-
-  winsockVersion = wsaData.wVersion;
- 
-#else
-  // Disable the nasty read/write failure signals on UNIX
-  signal(SIGPIPE, SIG_IGN);
-#endif
-
-  // If successful, or if not required, then continue!
-  m_status = VTrue;
-}
-
-VSocketSystem::~VSocketSystem()
-{
-	if (m_status)
-	{
-		WSACleanup();
-	}
-}
-
-////////////////////////////
-
-
-// adzm 2010-08
-int VSocket::m_defaultSocketKeepAliveTimeout = 10000;
-
-VSocket::VSocket()
-{
-	// Clear out the internal socket fields
-	sock = -1;
-	vnclog.Print(LL_SOCKINFO, VNCLOG("VSocket() m_pDSMPlugin = NULL \n"));
-	m_pDSMPlugin = NULL;
-	//adzm 2009-06-20
-	m_pPluginInterface = NULL;
-	//adzm 2010-05-10
-	m_pIntegratedPluginInterface = NULL;
-	m_fUsePlugin = false;
-	
-	m_pNetRectBuf = NULL;
-	m_nNetRectBufSize = 0;
-	m_fWriteToNetRectBuf = false;
-	m_nNetRectBufOffset = 0;
-	queuebuffersize=0;
-	memset( queuebuffer, 0, sizeof( queuebuffer ) );
-
-	//adzm 2010-08-01
-	m_LastSentTick = 0;
-
-	//adzm 2010-09
-	m_fPluginStreamingIn = false;
-	m_fPluginStreamingOut = false;
-}
-
-////////////////////////////
-
-VSocket::~VSocket()
-{
-  // Close the socket
-  Close();
-
-  if (m_pNetRectBuf != NULL)
- 	delete [] m_pNetRectBuf;
-
-}
-
-////////////////////////////
-#include "httpconnect.h"
-VBool VSocket::Http_CreateConnect(const VString address)
-{
-	httpconnect http_class;
-	sock=http_class.Get_https_socket("443",address);
-	if (sock==0) return false;
-	else return true;
-}
-
-VBool
-VSocket::Create()
-{
-  const int one = 1;
-
-  // Check that the old socket was closed
-  if (sock >= 0)
-    Close();
-
-  // Create the socket
-  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-    {
-      return VFalse;
-    }
-
-  // Set the socket options:
-//#ifndef WIN32
-  // sf at 2006 - Trying to fix the neverending authentication bug
-  /*
-  // Usefull for NT4 ?
-  if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof(one)))
-    {
-      return VFalse;
-    }
-  */
-  // sf at 2006 - Trying to fix the neverending authentication bug
-  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)))
-  {
-      return VFalse;
-  }
-  //#endif
-
-  // adzm 2010-08
-  SetDefaultSocketOptions();
-
-  return VTrue;
-}
-
-////////////////////////////
-
-VBool
-VSocket::Close()
-{
-  if (sock >= 0)
-    {
-	  vnclog.Print(LL_SOCKINFO, VNCLOG("closing socket\n"));
-
-	  shutdown(sock, SD_BOTH);
-#ifdef __WIN32__
-	  closesocket(sock);
-#else
-	  close(sock);
-#endif
-      sock = -1;
-    }
-
-  //adzm 2009-06-20
-  if (m_pPluginInterface) {
-    delete m_pPluginInterface;
-	m_pPluginInterface=NULL;
-	//adzm 2010-05-10
-	m_pIntegratedPluginInterface=NULL;
-  }
-  return VTrue;
-}
-
-////////////////////////////
-
-VBool
-VSocket::Shutdown()
-{
-  if (sock >= 0)
-    {
-	  vnclog.Print(LL_SOCKINFO, VNCLOG("shutdown socket\n"));
-
-	  shutdown(sock, SD_BOTH);
-//	  sock = -1;
-    }
-  return VTrue;
-}
-
-////////////////////////////
-
-VBool
-VSocket::Bind(const VCard port, const VBool localOnly)
-{
-  struct sockaddr_in addr;
-
-  // Check that the socket is open!
-  if (sock < 0)
-    return VFalse;
-
-  // Set up the address to bind the socket to
-  addr.sin_family = AF_INET;
-  addr.sin_port = htons(port);
-  if (localOnly)
-	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-  else
-	addr.sin_addr.s_addr = htonl(INADDR_ANY);
-
-  // And do the binding
-  if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
-      return VFalse;
-
-  return VTrue;
-}
-
-////////////////////////////
-
-VBool
-VSocket::Connect(const VString address, const VCard port)
-{
-  // Check the socket
-  if (sock < 0)
-    return VFalse;
-
-  // Create an address structure and clear it
-  struct sockaddr_in addr;
-  memset(&addr, 0, sizeof(addr));
-
-  // Fill in the address if possible
-  addr.sin_family = AF_INET;
-  addr.sin_addr.s_addr = inet_addr(address);
-
-  // Was the string a valid IP address?
-  if ((int) addr.sin_addr.s_addr == -1)
-    {
-      // No, so get the actual IP address of the host name specified
-      struct hostent *pHost=NULL;
-      pHost = gethostbyname(address);
-      if (pHost != NULL)
-	  {
-		  if (pHost->h_addr == NULL)
-			  return VFalse;
-		  addr.sin_addr.s_addr = ((struct in_addr *)pHost->h_addr)->s_addr;
-	  }
-	  else
-	    return VFalse;
-    }
-
-  // Set the port number in the correct format
-  addr.sin_port = htons(port);
-
-  // Actually connect the socket
-  if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0)
-    return VFalse;
-
-  // sf at 2006 - Trying to fix the neverending authentication bug
-  // Put the socket into non-blocking mode
-/*
-#ifdef __WIN32__
-  u_long arg = 1;
-  if (ioctlsocket(sock, FIONBIO, &arg) != 0)
-	return VFalse;
-#else
-  if (fcntl(sock, F_SETFL, O_NDELAY) != 0)
-	return VFalse;
-#endif
-*/
-  
-  // adzm 2010-08
-  SetDefaultSocketOptions();
-
-  return VTrue;
-}
-
-////////////////////////////
-
-VBool
-VSocket::Listen()
-{
-  // Check socket
-  if (sock < 0)
-    return VFalse;
-
-	// Set it to listen
-  if (listen(sock, 5) < 0)
-    return VFalse;
-
-  return VTrue;
-}
-
-////////////////////////////
-
-VSocket *
-VSocket::Accept()
-{
-  int new_socket_id;
-  VSocket * new_socket;
-
-  // Check this socket
-  if (sock < 0)
-    return NULL;
-
-  int optVal;
-  int optLen = sizeof(int);
-  getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optVal, &optLen); 
-  optVal=32000;
-  setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&optVal, optLen); 
-
-  // Accept an incoming connection
-  if ((new_socket_id = accept(sock, NULL, 0)) < 0)
-    return NULL;
-
-  // Create a new VSocket and return it
-  new_socket = new VSocket;
-  if (new_socket != NULL)
-  {
-      new_socket->sock = new_socket_id;
-  }
-  else
-  {
-	  shutdown(new_socket_id, SD_BOTH);
-	  closesocket(new_socket_id);
-	  return NULL;
-  }
-  
-  // adzm 2010-08
-  new_socket->SetDefaultSocketOptions();
-
-  // Put the socket into non-blocking mode
-  return new_socket;
-}
-
-////////////////////////////
-////////////////////////////
-
-VString
-VSocket::GetPeerName()
-{
-	struct sockaddr_in	sockinfo;
-	struct in_addr		address;
-	int					sockinfosize = sizeof(sockinfo);
-	VString				name;
-
-	// Get the peer address for the client socket
-	getpeername(sock, (struct sockaddr *)&sockinfo, &sockinfosize);
-	memcpy(&address, &sockinfo.sin_addr, sizeof(address));
-
-	name = inet_ntoa(address);
-	if (name == NULL)
-		return "<unavailable>";
-	else
-		return name;
-}
-
-////////////////////////////
-
-VString
-VSocket::GetSockName()
-{
-	struct sockaddr_in	sockinfo;
-	struct in_addr		address;
-	int					sockinfosize = sizeof(sockinfo);
-	VString				name;
-
-	// Get the peer address for the client socket
-	getsockname(sock, (struct sockaddr *)&sockinfo, &sockinfosize);
-	memcpy(&address, &sockinfo.sin_addr, sizeof(address));
-
-	name = inet_ntoa(address);
-	if (name == NULL)
-		return "<unavailable>";
-	else
-		return name;
-}
-
-// 25 January 2008 jdp
-bool VSocket::GetPeerAddress(char *address, int size)
-{
-    struct sockaddr_in addr;
-    int addrsize = sizeof(sockaddr_in);
-
-    if (sock < 0)
-        return false;
-
-    if (getpeername(sock, (struct sockaddr *) &addr, &addrsize) != 0)
-        return false;
-
-    _snprintf(address, size, "%s:%d",
-              inet_ntoa(addr.sin_addr),
-              ntohs(addr.sin_port));
-
-    return true;
-}
-////////////////////////////
-
-VCard32
-VSocket::Resolve(const VString address)
-{
-  VCard32 addr;
-
-  // Try converting the address as IP
-  addr = inet_addr(address);
-
-  // Was it a valid IP address?
-  if (addr == 0xffffffff)
-    {
-      // No, so get the actual IP address of the host name specified
-      struct hostent *pHost;
-      pHost = gethostbyname(address);
-      if (pHost != NULL)
-	  {
-		  if (pHost->h_addr == NULL)
-			  return 0;
-		  addr = ((struct in_addr *)pHost->h_addr)->s_addr;
-	  }
-	  else
-		  return 0;
-    }
-
-  // Return the resolved IP address as an integer
-  return addr;
-}
-
-////////////////////////////
-
-// adzm 2010-08
-VBool
-VSocket::SetDefaultSocketOptions()
-{
-	VBool result = VTrue;
-
-	const int one = 1;
-
-	if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&one, sizeof(one)))
-	{
-		result = VFalse;
-	}
-
-	int defaultSocketKeepAliveTimeout = m_defaultSocketKeepAliveTimeout;
-	if (defaultSocketKeepAliveTimeout > 0) {
-		if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (const char *)&one, sizeof(one))) {
-			result = VFalse;
-		} else {
-			DWORD bytes_returned = 0;
-			tcp_keepalive keepalive_requested;
-			tcp_keepalive keepalive_returned;
-			ZeroMemory(&keepalive_requested, sizeof(keepalive_requested));
-			ZeroMemory(&keepalive_returned, sizeof(keepalive_returned));
-
-			keepalive_requested.onoff = 1;
-			keepalive_requested.keepalivetime = defaultSocketKeepAliveTimeout;
-			keepalive_requested.keepaliveinterval = 1000;
-			// 10 probes always used by default in Vista+; not changeable. 
-
-			if (0 != WSAIoctl(sock, SIO_KEEPALIVE_VALS, 
-					&keepalive_requested, sizeof(keepalive_requested), 
-					&keepalive_returned, sizeof(keepalive_returned), 
-					&bytes_returned, NULL, NULL))
-			{
-				result = VFalse;
-			}
-		}
-	}
-
-	assert(result);
-
-	return result;
-}
-
-////////////////////////////
-
-VBool
-VSocket::SetTimeout(VCard32 msecs)
-{
-	if (LOBYTE(winsockVersion) < 2)
-		return VFalse;
-	int timeout=msecs;
-	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)) == SOCKET_ERROR)
-	{
-		return VFalse;
-	}
-	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof(timeout)) == SOCKET_ERROR)
-	{
-		return VFalse;
-	}
-	return VTrue;
-}
-
-VBool VSocket::SetSendTimeout(VCard32 msecs)
-{
-#if 1
-    return SetTimeout (msecs);
-#else
-	if (LOBYTE(winsockVersion) < 2)
-		return VFalse;
-	int timeout=msecs;
-
-	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof(timeout)) == SOCKET_ERROR)
-	{
-		return VFalse;
-	}
-
-	return VTrue;
-#endif
-}
-
-VBool VSocket::SetRecvTimeout(VCard32 msecs)
-{
-#if 1
-    return SetTimeout (msecs);
-#else
-	if (LOBYTE(winsockVersion) < 2)
-		return VFalse;
-	int timeout=msecs;
-	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)) == SOCKET_ERROR)
-	{
-		return VFalse;
-	}
-	return VTrue;
-#endif
-}
-
-////////////////////////////
-VInt
-VSocket::Send(const char *buff, const VCard bufflen)
-{
-	//adzm 2010-08-01
-	m_LastSentTick = GetTickCount();
-
-	unsigned int newsize=queuebuffersize+bufflen;
-	char *buff2;
-	buff2=(char*)buff;
-	unsigned int bufflen2=bufflen;
-
-	// adzm 2010-09 - flush as soon as we have a full buffer, not if we have exceeded it.
-	if (newsize >= G_SENDBUFFER)
-	{
-		    memcpy(queuebuffer+queuebuffersize,buff2,G_SENDBUFFER-queuebuffersize);
-			if (!sendall(sock,queuebuffer,G_SENDBUFFER,0)) return FALSE;
-//			vnclog.Print(LL_SOCKERR, VNCLOG("SEND  %i\n") ,G_SENDBUFFER);
-			buff2+=(G_SENDBUFFER-queuebuffersize);
-			bufflen2-=(G_SENDBUFFER-queuebuffersize);
-			queuebuffersize=0;
-			// adzm 2010-09 - flush as soon as we have a full buffer, not if we have exceeded it.
-			while (bufflen2 >= G_SENDBUFFER)
-			{
-				if (!sendall(sock,buff2,G_SENDBUFFER,0)) return false;
-//				vnclog.Print(LL_SOCKERR, VNCLOG("SEND 1 %i\n") ,G_SENDBUFFER);
-				buff2+=G_SENDBUFFER;
-				bufflen2-=G_SENDBUFFER;
-			}
-	}
-	memcpy(queuebuffer+queuebuffersize,buff2,bufflen2);
-	queuebuffersize+=bufflen2;
-	if (queuebuffersize > 0) {
-		if (!sendall(sock,queuebuffer,queuebuffersize,0)) 
-			return false;
-	}
-//	vnclog.Print(LL_SOCKERR, VNCLOG("SEND 2 %i\n") ,queuebuffersize);
-	queuebuffersize=0;
-	return bufflen;
-}
-////////////////////////////
-VInt
-VSocket::SendQueued(const char *buff, const VCard bufflen)
-{
-	unsigned int newsize=queuebuffersize+bufflen;
-	char *buff2;
-	buff2=(char*)buff;
-	unsigned int bufflen2=bufflen;
-	
-	// adzm 2010-09 - flush as soon as we have a full buffer, not if we have exceeded it.
-	if (newsize >= G_SENDBUFFER)
-	{	
-			//adzm 2010-08-01
-			m_LastSentTick = GetTickCount();
-
-		    memcpy(queuebuffer+queuebuffersize,buff2,G_SENDBUFFER-queuebuffersize);
-			if (!sendall(sock,queuebuffer,G_SENDBUFFER,0)) return FALSE;
-		//	vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q  %i\n") ,G_SENDBUFFER);
-			buff2+=(G_SENDBUFFER-queuebuffersize);
-			bufflen2-=(G_SENDBUFFER-queuebuffersize);
-			queuebuffersize=0;			
-
-			// adzm 2010-09 - flush as soon as we have a full buffer, not if we have exceeded it.
-			while (bufflen2 >= G_SENDBUFFER)
-			{
-				if (!sendall(sock,buff2,G_SENDBUFFER,0)) return false;				
-				//adzm 2010-08-01
-				m_LastSentTick = GetTickCount();
-			//	vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q  %i\n") ,G_SENDBUFFER);
-				buff2+=G_SENDBUFFER;
-				bufflen2-=G_SENDBUFFER;
-			}
-	}
-	memcpy(queuebuffer+queuebuffersize,buff2,bufflen2);
-	queuebuffersize+=bufflen2;
-	return bufflen;
-}
-/////////////////////////////
-
-// sf at 2002 - DSMPlugin
-VBool
-VSocket::SendExact(const char *buff, const VCard bufflen, unsigned char msgType)
-{
-	if (sock==-1) return VFalse;
-	//vnclog.Print(LL_SOCKERR, VNCLOG("SendExactMsg %i\n") ,bufflen);
-	// adzm 2010-09
-	if (!IsPluginStreamingOut() && m_fUsePlugin && m_pDSMPlugin->IsEnabled())
-	{
-		// Send the transformed message type first
-		char t = (char)msgType;
-		SendExact(&t, 1);
-		// Then we send the transformed rfb message content
-		SendExact(buff, bufflen);
-	}
-	else
-		SendExact(buff, bufflen);
-
-	return VTrue;
-}
-
-
-//adzm 2010-09 - minimize packets. SendExact flushes the queue.
-VBool 
-VSocket::SendExactQueue(const char *buff, const VCard bufflen, unsigned char msgType)
-{
-	if (sock==-1) return VFalse;
-	//vnclog.Print(LL_SOCKERR, VNCLOG("SendExactMsg %i\n") ,bufflen);
-	// adzm 2010-09
-	if (!IsPluginStreamingOut() && m_fUsePlugin && m_pDSMPlugin->IsEnabled())
-	{
-		// Send the transformed message type first
-		char t = (char)msgType;
-		SendExactQueue(&t, 1);
-		// Then we send the transformed rfb message content
-		SendExactQueue(buff, bufflen);
-	}
-	else
-		SendExactQueue(buff, bufflen);
-
-	return VTrue;
-}
-
-//////////////////////////////////////////
-VBool
-VSocket::SendExact(const char *buff, const VCard bufflen)
-{	
-	if (sock==-1) return VFalse;
-	//adzm 2010-09
-	if (bufflen <=0) {
-		return VTrue;
-	}
-//	vnclog.Print(LL_SOCKERR, VNCLOG("SendExact %i\n") ,bufflen);
-	// sf at 2002 - DSMPlugin
-	VCard nBufflen = bufflen;
-	char* pBuffer = NULL;
-	if (m_fUsePlugin && m_pDSMPlugin->IsEnabled())
-	{
-		// omni_mutex_lock l(m_TransMutex);
-
-		// If required to store data into memory
-		if (m_fWriteToNetRectBuf)
-		{
-			memcpy((char*)(m_pNetRectBuf + m_nNetRectBufOffset), buff, bufflen);
-			m_nNetRectBufOffset += bufflen;
-			return VTrue;
-		}
-		else // Tell the plugin to transform data
-		{
-			int nTransDataLen = 0;
-			//adzm 2009-06-20
-			pBuffer = (char*)(TransformBuffer((BYTE*)buff, bufflen, &nTransDataLen));
-			if (pBuffer == NULL || (bufflen > 0 && nTransDataLen == 0))
-			{
-				// throw WarningException("SendExact: DSMPlugin-TransformBuffer Error.");
-			}
-			nBufflen = nTransDataLen;
-		}
-		
-	}
-	else
-		pBuffer = (char*) buff;
-	
-	VInt result=Send(pBuffer, nBufflen);
-  return result == (VInt)nBufflen;
-}
-///////////////////////////////////////
-VBool
-VSocket::SendExactQueue(const char *buff, const VCard bufflen)
-{
-	if (sock==-1) return VFalse;
-	//adzm 2010-09
-	if (bufflen <=0) {
-		return VTrue;
-	}
-//	vnclog.Print(LL_SOCKERR, VNCLOG("SendExactQueue %i %i\n") ,bufflen,queuebuffersize);
-//	vnclog.Print(LL_SOCKERR, VNCLOG("socket size %i\n") ,bufflen);
-	// sf at 2002 - DSMPlugin
-	VCard nBufflen = bufflen;
-	char* pBuffer = NULL;
-	if (m_fUsePlugin && m_pDSMPlugin->IsEnabled())
-	{
-		// omni_mutex_lock l(m_TransMutex);
-
-		// If required to store data into memory
-		if (m_fWriteToNetRectBuf)
-		{
-			memcpy((char*)(m_pNetRectBuf + m_nNetRectBufOffset), buff, bufflen);
-			m_nNetRectBufOffset += bufflen;
-			return VTrue;
-		}
-		else // Tell the plugin to transform data
-		{
-			int nTransDataLen = 0;
-			//adzm 2009-06-20
-			pBuffer = (char*)(TransformBuffer((BYTE*)buff, bufflen, &nTransDataLen));
-			if (pBuffer == NULL || (bufflen > 0 && nTransDataLen == 0))
-			{
-				// throw WarningException("SendExact: DSMPlugin-TransformBuffer Error.");
-			}
-			nBufflen = nTransDataLen;
-		}
-		
-	}
-	else
-		pBuffer = (char*) buff;
-	
-	VInt result=SendQueued(pBuffer, nBufflen);
-  return result == (VInt)nBufflen;
-}
-///////////////////////////////
-VBool
-VSocket::ClearQueue()
-{
-	if (sock==-1) return VFalse;
-	if (queuebuffersize!=0)
-  {
-	//adzm 2010-08-01
-	m_LastSentTick = GetTickCount();
-	//adzm 2010-09 - return a bool in ClearQueue
-	if (!sendall(sock,queuebuffer,queuebuffersize,0)) 
-		return VFalse;
-	queuebuffersize=0;
-  }
-  return VTrue;
-}
-////////////////////////////
-
-VInt
-VSocket::Read(char *buff, const VCard bufflen)
-{
-	if (sock==-1) return sock;
-    int s = recv(sock, buff, bufflen, 0);
-#if defined(_DEBUG)
-    if (s == SOCKET_ERROR)
-    {
-        OutputDebugString("recv: SOCKET_ERROR");
-    }
-
-    if (s == 0)
-    {
-        OutputDebugString("recv: connection closed");
-    }
-#endif
-  return s;
-}
-
-////////////////////////////
-
-VBool
-VSocket::ReadExact(char *buff, const VCard bufflen)
-{	
-	if (sock==-1) return VFalse;
-	//adzm 2010-09
-	if (bufflen <=0) {
-		return VTrue;
-	}
-	int n;
-	VCard currlen = bufflen;
-    
-	// sf at 2002 - DSM Plugin
-	if (m_fUsePlugin && m_pDSMPlugin->IsEnabled())
-	{
-		//omni_mutex_lock l(m_pDSMPlugin->m_RestMutex); 
-		//adzm 2009-06-20 - don't lock if we are using the new interface
-		omni_mutex_conditional_lock l(m_pDSMPlugin->m_RestMutex, m_pPluginInterface ? false : true);
-
-		// Get the DSMPlugin destination buffer where to put transformed incoming data
-		// The number of bytes to read calculated from bufflen is given back in nTransDataLen
-		int nTransDataLen = 0;
-		//adzm 2009-06-20
-		BYTE* pTransBuffer = RestoreBufferStep1(NULL, bufflen, &nTransDataLen);
-		if (pTransBuffer == NULL)
-		{
-			// m_pDSMPlugin->RestoreBufferUnlock();
-			// throw WarningException("WriteExact: DSMPlugin-RestoreBuffer Alloc Error.");
-			vnclog.Print(LL_SOCKERR, VNCLOG("WriteExact: DSMPlugin-RestoreBuffer Alloc Error\n"));
-			return VFalse;
-		}
-		
-		// Read bytes directly into Plugin Dest Rest. buffer
-		int nTransDataLenSave = nTransDataLen;
-		while (nTransDataLen > 0)
-		{
-			// Try to read some data in
-			n = Read((char*)pTransBuffer, nTransDataLen);
-			if (n > 0)
-			{
-				// Adjust the buffer position and size
-				pTransBuffer += n;
-				nTransDataLen -= n;
-			} else if (n == 0) {
-				//m_pDSMPlugin->RestoreBufferUnlock();
-				vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read1\n"));
-				return VFalse;
-			} else {
-				if (WSAGetLastError() != WSAEWOULDBLOCK)
-				{
-					//m_pDSMPlugin->RestoreBufferUnlock();
-					vnclog.Print(LL_SOCKERR, VNCLOG("socket error 1: %d\n"), WSAGetLastError());
-					return VFalse;
-				}
-			}
-		}
-		
-		// Ask plugin to restore data from rest. buffer into inbuf
-		int nRestDataLen = 0;
-		nTransDataLen = nTransDataLenSave;
-		//adzm 2009-06-20
-		RestoreBufferStep2((BYTE*)buff, nTransDataLen, &nRestDataLen);
-
-		// Check if we actually get the real original data length
-		if ((VCard)nRestDataLen != bufflen)
-		{
-			// throw WarningException("WriteExact: DSMPlugin-RestoreBuffer Error.");
-		}
-	}
-	else // Non-Transformed
-	{
-		while (currlen > 0)
-		{
-			// Try to read some data in
-			n = Read(buff, currlen);
-			
-			if (n > 0)
-			{
-				// Adjust the buffer position and size
-				buff += n;
-				currlen -= n;
-			} else if (n == 0) {
-				vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read2\n"));
-				
-				return VFalse;
-			} else {
-				if (WSAGetLastError() != WSAEWOULDBLOCK)
-				{
-					//int aa=WSAGetLastError();
-					//vnclog.Print(LL_SOCKERR, VNCLOG("socket error 2: %d\n"), aa);
-					return VFalse;
-				}
-			}
-		}
-	}
-
-return VTrue;
-}
-
-
-//
-// sf at 2002 - DSMPlugin
-// 
-
-//adzm 2009-06-20
-void VSocket::SetDSMPluginPointer(CDSMPlugin* pDSMPlugin)
-{
-	m_pDSMPlugin = pDSMPlugin;
-
-	if (m_pPluginInterface) {
-		delete m_pPluginInterface;
-		m_pPluginInterface = NULL;
-		//adzm 2010-05-10
-		m_pIntegratedPluginInterface = NULL;
-	}
-
-	if (m_pDSMPlugin && m_pDSMPlugin->SupportsMultithreaded()) {
-		//adzm 2010-05-10
-		if (m_pDSMPlugin->SupportsIntegrated()) {
-			m_pIntegratedPluginInterface = m_pDSMPlugin->CreateIntegratedPluginInterface();
-			m_pPluginInterface = m_pIntegratedPluginInterface;
-		} else {
-			m_pIntegratedPluginInterface = NULL;
-			m_pPluginInterface = m_pDSMPlugin->CreatePluginInterface();
-		}
-	} else {
-		m_pPluginInterface = NULL;
-		m_pIntegratedPluginInterface = NULL;
-	}
-}
-
-//adzm 2010-05-12 - dsmplugin config
-void VSocket::SetDSMPluginConfig(char* szDSMPluginConfig)
-{
-	if (m_pIntegratedPluginInterface) {
-		m_pIntegratedPluginInterface->SetServerOptions(szDSMPluginConfig);
-	}
-}
-
-//
-// Tell the plugin to do its transformation on the source data buffer
-// Return: pointer on the new transformed buffer (allocated by the plugin)
-// nTransformedDataLen is the number of bytes contained in the transformed buffer
-//adzm 2009-06-20
-BYTE* VSocket::TransformBuffer(BYTE* pDataBuffer, int nDataLen, int* pnTransformedDataLen)
-{
-	if (m_pPluginInterface) {
-		return m_pPluginInterface->TransformBuffer(pDataBuffer, nDataLen, pnTransformedDataLen);
-	} else {
-		return m_pDSMPlugin->TransformBuffer(pDataBuffer, nDataLen, pnTransformedDataLen);
-	}
-}
-
-
-// - If pRestoredDataBuffer = NULL, the plugin check its local buffer and return the pointer
-// - Otherwise, restore data contained in its rest. buffer and put the result in pRestoredDataBuffer
-//   pnRestoredDataLen is the number bytes put in pRestoredDataBuffers
-//adzm 2009-06-20
-BYTE* VSocket::RestoreBufferStep1(BYTE* pRestoredDataBuffer, int nDataLen, int* pnRestoredDataLen)
-{	
-	if (m_pPluginInterface) {
-		return m_pPluginInterface->RestoreBuffer(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	} else {
-		return m_pDSMPlugin->RestoreBufferStep1(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	}
-}
-
-//adzm 2009-06-20
-BYTE* VSocket::RestoreBufferStep2(BYTE* pRestoredDataBuffer, int nDataLen, int* pnRestoredDataLen)
-{	
-	if (m_pPluginInterface) {
-		return m_pPluginInterface->RestoreBuffer(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	} else {
-		return m_pDSMPlugin->RestoreBufferStep2(pRestoredDataBuffer, nDataLen, pnRestoredDataLen);
-	}
-}
-
-//
-// Ensures that the temporary "alignement" buffer in large enough 
-//
-void VSocket::CheckNetRectBufferSize(int nBufSize)
-{
-    omni_mutex_lock l(m_CheckMutex); 
-
-	if (m_nNetRectBufSize > nBufSize) return;
-
-	BYTE *newbuf = new BYTE[nBufSize + 256];
-	if (newbuf == NULL) 
-	{
-		// throw ErrorException("Insufficient memory to allocate network crypt buffer.");
-	}
-
-	if (m_pNetRectBuf != NULL)
-	{
-		// memcpy(newbuf, m_pNetRectBuf, m_nNetRectBufSize);
-		delete [] m_pNetRectBuf;
-	}
-
-	m_pNetRectBuf = newbuf;
-	m_nNetRectBufSize = nBufSize + 256;
-	// vnclog.Print(4, _T("crypt bufsize expanded to %d\n"), m_netbufsize);
-}
-
-
-// sf at 2002 - DSMPlugin
-// Necessary for HTTP server (we'll see later if we can do something more intelligent...
-
-VBool
-VSocket::SendExactHTTP(const char *buff, const VCard bufflen)
-{
-  return Send(buff, bufflen) == (VInt)bufflen;
-}
-
-
-////////////////////////////
-
-VBool
-VSocket::ReadExactHTTP(char *buff, const VCard bufflen)
-{
-	int n;
-	VCard currlen = bufflen;
-    
-	while (currlen > 0)
-	{
-		// Try to read some data in
-		n = Read(buff, currlen);
-
-		if (n > 0)
-		{
-			// Adjust the buffer position and size
-			buff += n;
-			currlen -= n;
-		} else if (n == 0) {
-			vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read3\n"));
-
-			return VFalse;
-		} else {
-			if (WSAGetLastError() != WSAEWOULDBLOCK)
-			{
-				vnclog.Print(LL_SOCKERR, VNCLOG("HTTP socket error: %d\n"), WSAGetLastError());
-				return VFalse;
-			}
-		}
-    }
-
-	return VTrue;
-}
-#ifdef HTTP_SAMEPORT
-VBool
-VSocket::ReadSelect(VCard to)
- {
- 	fd_set fds;
- 	FD_ZERO(&fds);
- 	FD_SET((unsigned long)sock,&fds);
-	struct timeval tv;
- 	tv.tv_sec = to/1000;
- 	tv.tv_usec = (to % 1000)*1000;
- 	int rc = select(sock+1,&fds,0,0,&tv);
- 	if (rc>0) return true;
- 	return false;
- }
-#endif
-
-extern bool			fShutdownOrdered;
-bool
-sendall(SOCKET RemoteSocket,char *buff,unsigned int bufflen,int dummy)
-{
-int val =0;
-	unsigned int totsend=0;
-	while (totsend <bufflen)
-	  {
-		struct fd_set write_fds;
-		struct timeval tm;
-		int count;
-		int aa=0;
-		do {
-			FD_ZERO(&write_fds);
-			FD_SET(RemoteSocket, &write_fds);
-			tm.tv_sec = 1;
-			tm.tv_usec = 0;
-			count = select(RemoteSocket+ 1, NULL, &write_fds, NULL, &tm);
-			aa++;
-		} while (count == 0&& !fShutdownOrdered && aa<20);
-		if (aa>=20) return 0;
-		if (fShutdownOrdered) return 0;
-		if (count < 0 || count > 1) return 0;
-		if (FD_ISSET(RemoteSocket, &write_fds)) 
-		{
-			val=send(RemoteSocket, buff+totsend, bufflen-totsend, 0);
-		}
-		if (val==0) 
-			return false;
-		if (val==SOCKET_ERROR) 
-			return false;
-		totsend+=val;
-	  }
-	return 1;
-}
-
-
-
diff --git a/ica/win32/winvnc/winvnc/vsocket.h b/ica/win32/winvnc/winvnc/vsocket.h
deleted file mode 100644
index d38601c..0000000
--- a/ica/win32/winvnc/winvnc/vsocket.h
+++ /dev/null
@@ -1,224 +0,0 @@
-//  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
-//  Copyright (C) 2001 HorizonLive.com, Inc. 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 at uk.research.att.com for information on obtaining it.
-
-
-// VSocket.h
-
-// RFB V3.0
-
-// The VSocket class provides simple socket functionality,
-// independent of platform.  Hurrah.
-
-class VSocket;
-
-#if (!defined(_ATT_VSOCKET_DEFINED))
-#define _ATT_VSOCKET_DEFINED
-
-#include "vtypes.h"
-#include <DSMPlugin/DSMPlugin.h>
-
-////////////////////////////
-// Socket implementation
-
-// Create one or more VSocketSystem objects per application
-class VSocketSystem
-{
-public:
-	VSocketSystem();
-	~VSocketSystem();
-	VBool Initialised() {return m_status;};
-private:
-	VBool m_status;
-};
-
-// The main socket class
-class VSocket
-{
-public:
-  // Constructor/Destructor
-  VSocket();
-  virtual ~VSocket();
-
-  ////////////////////////////
-  // Socket implementation
-
-  // Create
-  //        Create a socket and attach it to this VSocket object
-  VBool Create();
-
-  // Shutdown
-  //        Shutdown the currently attached socket
-  VBool Shutdown();
-
-  // Close
-  //        Close the currently attached socket
-  VBool Close();
-
-  // Bind
-  //        Bind the attached socket to the specified port
-  //		If localOnly is VTrue then the socket is bound only
-  //        to the loopback adapter.
-  VBool Bind(const VCard port, const VBool localOnly=VFalse);
-
-  // Connect
-  //        Make a stream socket connection to the specified port
-  //        on the named machine.
-  VBool Connect(const VString address, const VCard port);
-
-  // Listen
-  //        Set the attached socket to listen for connections
-  VBool Listen();
-
-  // Accept
-  //        If the attached socket is set to listen then this
-  //        call blocks waiting for an incoming connection, then
-  //        returns a new socket object for the new connection
-  VSocket *Accept();
-
-  // GetPeerName
-  //        If the socket is connected then this returns the name
-  //        of the machine to which it is connected.
-  //        This string MUST be copied before the next socket call...
-  VString GetPeerName();
-
-  // GetSockName
-  //		If the socket exists then the name of the local machine
-  //		is returned.  This string MUST be copied before the next
-  //		socket call!
-  VString GetSockName();
-
-  // Resolve
-  //        Uses the Winsock API to resolve the supplied DNS name to
-  //        an IP address and returns it as an Int32
-  static VCard32 Resolve(const VString name);
-
-  // SetTimeout
-  //        Sets the socket timeout on reads and writes.
-  VBool SetTimeout(VCard32 msecs);
-  VBool SetSendTimeout(VCard32 msecs);
-  VBool SetRecvTimeout(VCard32 msecs);
-  
-  // adzm 2010-08
-  VBool SetDefaultSocketOptions();
-
-  // adzm 2010-08
-  static void SetSocketKeepAliveTimeoutDefault(int timeout) { m_defaultSocketKeepAliveTimeout = timeout; }
-
-  bool GetPeerAddress(char *address, int size);
-
-  VBool Http_CreateConnect(const VString address);
-  SOCKET GetChannel() const { return (SOCKET) sock; }
-  // I/O routines
-#ifdef HTTP_SAMEPORT
-  // Check to see if the socket becomes readable within <to> msec.
-  // Added to support HTTP-via-RFB.
-  VBool ReadSelect(VCard to);
-#endif
-
-  // Send and Read return the number of bytes sent or recieved.
-  VInt Send(const char *buff, const VCard bufflen);
-  VInt SendQueued(const char *buff, const VCard bufflen);
-  VInt Read(char *buff, const VCard bufflen);
-
-  // SendExact and ReadExact attempt to send and recieve exactly
-  // the specified number of bytes.
-  VBool SendExact(const char *buff, const VCard bufflen);
-  VBool SendExact(const char *buff, const VCard bufflen, unsigned char msgType); // sf at 2002 - DSMPlugin
-  VBool SendExactQueue(const char *buff, const VCard bufflen);
-  //adzm 2010-09 - minimize packets. SendExact flushes the queue.
-  VBool SendExactQueue(const char *buff, const VCard bufflen, unsigned char msgType);
-  VBool ReadExact(char *buff, const VCard bufflen);
-  VBool ClearQueue();
-
-  // sf at 2002 - DSMPlugin
-  //adzm 2009-06-20
-  void SetDSMPluginPointer(CDSMPlugin* pDSMPlugin);
-  void EnableUsePlugin(bool fEnable) { m_fUsePlugin = fEnable;};
-  bool IsUsePluginEnabled(void) { return m_fUsePlugin;};
-  //adzm 2010-05-12 - dsmplugin config
-  void SetDSMPluginConfig(char* szDSMPluginConfig);
-  // adzm 2010-09
-  void SetPluginStreamingIn() { m_fPluginStreamingIn = true; }
-  void SetPluginStreamingOut() { m_fPluginStreamingOut = true; }
-  bool IsPluginStreamingIn(void) { return m_fPluginStreamingIn; }
-  bool IsPluginStreamingOut(void) { return m_fPluginStreamingOut; }
-
-  void SetWriteToNetRectBuffer(bool fEnable) {m_fWriteToNetRectBuf = fEnable;}; 
-  bool GetWriteToNetRectBuffer(void) {return m_fWriteToNetRectBuf;};
-  int  GetNetRectBufOffset(void) {return m_nNetRectBufOffset;};
-  void SetNetRectBufOffset(int nValue) {m_nNetRectBufOffset = nValue;};
-  BYTE* GetNetRectBuf(void) {return m_pNetRectBuf;};
-  void CheckNetRectBufferSize(int nBufSize);
-  VBool SendExactHTTP(const char *buff, const VCard bufflen);
-  VBool ReadExactHTTP(char *buff, const VCard bufflen);
-
-  //adzm 2010-05-10
-  IIntegratedPlugin* GetIntegratedPlugin() { return m_pIntegratedPluginInterface; };
-
-  //adzm 2010-08-01
-  DWORD GetLastSentTick() { return m_LastSentTick; };
-  IIntegratedPlugin* m_pIntegratedPluginInterface;
-
-
-  ////////////////////////////
-  // Internal structures
-protected:
-  // The internal socket id
-  int sock;	      
-
-  //adzm 2010-08-01
-  DWORD m_LastSentTick;
-
-  CDSMPlugin* m_pDSMPlugin; // sf at 2002 - DSMPlugin
-  //adzm 2009-06-20
-  IPlugin* m_pPluginInterface;
-  //adzm 2010-05-10
-  //IIntegratedPlugin* m_pIntegratedPluginInterface;
-  bool m_fUsePlugin;
-  bool m_fPluginStreamingIn; //adzm 2010-09
-  bool m_fPluginStreamingOut; //adzm 2010-09
-  omni_mutex m_TransMutex;
-  omni_mutex m_RestMutex;
-  omni_mutex m_CheckMutex;
-
-  //adzm 2009-06-20
-  BYTE* TransformBuffer(BYTE* pDataBuffer, int nDataLen, int* nTransformedDataLen);
-  BYTE* RestoreBufferStep1(BYTE* pDataBuffer, int nDataLen, int* nRestoredDataLen);
-  BYTE* RestoreBufferStep2(BYTE* pDataBuffer, int nDataLen, int* nRestoredDataLen);
-
-  // All this should be private with accessors -> later
-  BYTE* m_pNetRectBuf;
-  bool m_fWriteToNetRectBuf;
-  int m_nNetRectBufOffset;
-  int m_nNetRectBufSize;
-
-  char queuebuffer[9000];
-  DWORD queuebuffersize;
-
-  // adzm 2010-08
-  static int m_defaultSocketKeepAliveTimeout;
-
-};
-
-#endif // _ATT_VSOCKET_DEFINED
diff --git a/ica/win32/winvnc/winvnc/vtypes.h b/ica/win32/winvnc/winvnc/vtypes.h
deleted file mode 100644
index 52616cf..0000000
--- a/ica/win32/winvnc/winvnc/vtypes.h
+++ /dev/null
@@ -1,87 +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 at uk.research.att.com for information on obtaining it.
-
-// VTypes.h
-
-// RFB V3.0
-
-// Datatypes used by the VGui system
-
-#if (!defined(_ATT_VTYPES_DEFINED))
-#define _ATT_VTYPES_DEFINED
-
-////////////////////////////
-// Numeric data types
-
-////////////////////////////
-// Fixed size (derived from rfb.h)
-
-typedef unsigned int VCard32;
-typedef unsigned short VCard16;
-typedef unsigned char VCard8;
-typedef int VInt32;
-typedef short VInt16;
-typedef char VInt8;
-
-////////////////////////////
-// Variable size
-//		These will always be at least as big as the largest
-//		fixed-size data-type
-
-typedef VCard32 VCard;
-typedef VInt32 VInt;
-
-////////////////////////////
-// Useful functions on integers
-
-static inline VInt Max(VInt x, VInt y) {if (x>y) return x; else return y;}
-static inline VInt Min(VInt x, VInt y) {if (x<y) return x; else return y;}
-
-////////////////////////////
-// Boolean
-
-typedef int VBool;
-const VBool VTrue = -1;
-const VBool VFalse = 0;
-
-////////////////////////////
-// Others
-
-typedef char VChar;
-#if (!defined(NULL))
-#define NULL 0
-#endif
-
-////////////////////////////
-// Compound data types
-
-// #include "rfbgui/VPoint.h"
-// #include "rfbgui/VRect.h"
-typedef VChar * VString;
-
-#endif // _ATT_VTYPES_DEFINED
-
-
-
-
-
diff --git a/ica/win32/winvnc/winvnc/winvnc.cpp b/ica/win32/winvnc/winvnc/winvnc.cpp
deleted file mode 100644
index c7a124b..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.cpp
+++ /dev/null
@@ -1,1132 +0,0 @@
-//  Copyright (C) 2007 Ultr at VNC Team Members. 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 at uk.research.att.com for information on obtaining it.
-
-// WinVNC.cpp
-
-// 24/11/97		WEZ
-
-// WinMain and main WndProc for the new version of WinVNC
-
-////////////////////////////
-// System headers
-#include "stdhdrs.h"
-
-#include "mmsystem.h"
-
-////////////////////////////
-// Custom headers
-#include "vsocket.h"
-#include "winvnc.h"
-
-#include "vncserver.h"
-#include "vncmenu.h"
-#include "vncinsthandler.h"
-#include "vncservice.h"
-///unload driver
-#include "vncOSVersion.h"
-#include "videodriver.h"
-
-#ifdef IPP
-void InitIpp();
-#endif
-
-#define LOCALIZATION_MESSAGES   // ACT: full declaration instead on extern ones
-#include "Localization.h" // Act : add localization on messages
-
-
-
-// Application instance and name
-HINSTANCE	hAppInstance = NULL;
-const char	*szAppName = "ITALCVNC";
-DWORD		mainthreadId = 0;
-BOOL		fRunningFromExternalService=false;
-
-//adzm 2009-06-20
-char* g_szRepeaterHost = NULL;
-
-// sf at 2007 - New shutdown order handling stuff (with uvnc_service)
-bool			fShutdownOrdered = false;
-static HANDLE		hShutdownEvent = NULL;
-HANDLE		hShutdownEventcad = NULL;
-MMRESULT			mmRes;
-
-void WRITETOLOG(char *szText, int size, DWORD *byteswritten, void *);
-
-
-//// Handle Old PostAdd message
-bool PostAddAutoConnectClient_bool=false;
-bool PostAddNewClient_bool=false;
-bool PostAddAutoConnectClient_bool_null=false;
-
-bool PostAddConnectClient_bool=false;
-bool PostAddConnectClient_bool_null=false;
-
-//adzm 2009-06-20
-bool PostAddNewRepeaterClient_bool=false;
-
-char pszId_char[20];
-VCard32 address_vcard;
-int port_int;
-
-int start_service(char *cmd);
-int install_service(void);
-int uninstall_service(void);
-extern char service_name[];
-
-void Real_stop_service();
-void Set_stop_service_as_admin();
-void Real_start_service();
-void Set_start_service_as_admin();
-void Real_settings(char *mycommand);
-void Set_settings_as_admin(char *mycommand);
-void Set_uninstall_service_as_admin();
-void Set_install_service_as_admin();
-void winvncSecurityEditorHelper_as_admin();
-bool GetServiceName(TCHAR *pszAppPath, TCHAR *pszServiceName);
-void Open_homepage();
-void Open_forum();
-
-// [v1.0.2-jp1 fix] Load resouce from dll
-HINSTANCE	hInstResDLL;
-BOOL SPECIAL_SC_EXIT=false;
-BOOL SPECIAL_SC_PROMPT=false;
-BOOL G_HTTP;
-BOOL multi=false;
-
-void Enable_softwareCAD_elevated();
-void Enable_softwareCAD();
-void Reboot_in_safemode_elevated();
-void Reboot_in_safemode();
-void delete_softwareCAD_elevated();
-void delete_softwareCAD();
-void Reboot_with_force_reboot_elevated();
-void Reboot_with_force_reboot();
-
-//HACK to use name in autoreconnect from service with dyn dns
-char dnsname[255];
-
-// winvnc.exe will also be used for helper exe
-// This allow us to minimize the number of seperate exe
-bool
-Myinit(HINSTANCE hInstance)
-{
-	SetOSVersion();
-	setbuf(stderr, 0);
-
-	// [v1.0.2-jp1 fix] Load resouce from dll
-
-	hInstResDLL = NULL;
-
-	 //limit the vnclang.dll searchpath to avoid
-	char szCurrentDir[MAX_PATH];
-	char szCurrentDir_vnclangdll[MAX_PATH];
-	if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-	{
-		char* p = strrchr(szCurrentDir, '\\');
-		*p = '\0';
-	}
-	strcpy (szCurrentDir_vnclangdll,szCurrentDir);
-	strcat (szCurrentDir_vnclangdll,"\\");
-	strcat (szCurrentDir_vnclangdll,"vnclang_server.dll");
-
-	hInstResDLL = LoadLibrary(szCurrentDir_vnclangdll);
-
-	if (hInstResDLL == NULL)
-	{
-		hInstResDLL = hInstance;
-	}
-//	RegisterLinkLabel(hInstResDLL);
-
-    //Load all messages from ressource file
-    Load_Localization(hInstResDLL) ;
-	vnclog.SetFile();
-//	vnclog.SetMode(2);
-//	vnclog.SetLevel(10);
-
-#ifdef _DEBUG
-	{
-		// Get current flag
-		int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
-
-		// Turn on leak-checking bit
-		tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
-
-		// Set flag to the new value
-		_CrtSetDbgFlag( tmpFlag );
-	}
-#endif
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	// Save the application instance and main thread id
-	hAppInstance = hInstance;
-	mainthreadId = GetCurrentThreadId();
-
-
-	// Initialise the VSocket system
-	VSocketSystem socksys;
-	if (!socksys.Initialised())
-	{
-		MessageBoxSecure(NULL, sz_ID_FAILED_INIT, szAppName, MB_OK);
-		return 0;
-	}
-#endif
-	return 1;
-}
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-//#define CRASHRPT
-#ifdef CRASHRPT
-#include "C:/DATA/crash/crashrpt/include/crashrpt.h"
-#pragma comment(lib, "C:/DATA/crash/crashrpt/lib/crashrpt")
-#endif
-
-// WinMain parses the command line and either calls the main App
-// routine or, under NT, the main service routine.
-int WINAPI WinMainVNC(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
-{
-	// make vnc last service to stop
-	SetProcessShutdownParameters(0x100,false);
-	// handle dpi on aero
-	HMODULE hUser32 = LoadLibrary(_T("user32.dll"));
-	typedef BOOL (*SetProcessDPIAwareFunc)();
-	SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)GetProcAddress(hUser32, "SetProcessDPIAware");
-	if (setDPIAware) setDPIAware();
-	FreeLibrary(hUser32);
-
-#ifdef IPP
-	InitIpp();
-#endif
-#ifdef CRASHRPT
-	Install(NULL, _T("ultravnc at skynet.be"), _T(""));
-#endif
-	bool Injected_autoreconnect=false;
-	SPECIAL_SC_EXIT=false;
-	SPECIAL_SC_PROMPT=false;
-	SetOSVersion();
-	setbuf(stderr, 0);
-
-	// [v1.0.2-jp1 fix] Load resouce from dll
-	hInstResDLL = NULL;
-
-	 //limit the vnclang.dll searchpath to avoid
-	char szCurrentDir[MAX_PATH];
-	char szCurrentDir_vnclangdll[MAX_PATH];
-	if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH))
-	{
-		char* p = strrchr(szCurrentDir, '\\');
-		*p = '\0';
-	}
-	strcpy (szCurrentDir_vnclangdll,szCurrentDir);
-	strcat (szCurrentDir_vnclangdll,"\\");
-	strcat (szCurrentDir_vnclangdll,"vnclang_server.dll");
-
-	hInstResDLL = LoadLibrary(szCurrentDir_vnclangdll);
-
-	if (hInstResDLL == NULL)
-	{
-		hInstResDLL = hInstance;
-	}
-//	RegisterLinkLabel(hInstResDLL);
-
-    //Load all messages from ressource file
-    Load_Localization(hInstResDLL) ;
-
-	char WORKDIR[MAX_PATH];
-	if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
-		{
-		char* p = strrchr(WORKDIR, '\\');
-		if (p == NULL) return 0;
-		*p = '\0';
-		}
-    char progname[MAX_PATH];
-    strncpy(progname, WORKDIR, sizeof progname);
-    progname[MAX_PATH - 1] = 0;
-	//strcat(WORKDIR,"\\");
-	//strcat(WORKDIR,"WinVNC.log");
-
-	vnclog.SetFile();
-//	vnclog.SetMode(2);
-//	vnclog.SetLevel(10);
-
-#ifdef _DEBUG
-	{
-		// Get current flag
-		int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
-
-		// Turn on leak-checking bit
-		tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
-
-		// Set flag to the new value
-		_CrtSetDbgFlag( tmpFlag );
-	}
-#endif
-
-	// Save the application instance and main thread id
-	hAppInstance = hInstance;
-	mainthreadId = GetCurrentThreadId();
-
-
-	// Initialise the VSocket system
-	VSocketSystem socksys;
-	if (!socksys.Initialised())
-	{
-		MessageBoxSecure(NULL, sz_ID_FAILED_INIT, szAppName, MB_OK);
-		return 0;
-	}
-    // look up the current service name in the registry.
-    GetServiceName(progname, service_name);
-
-	// Make the command-line lowercase and parse it
-	size_t i;
-	for (i = 0; i < strlen(szCmdLine); i++)
-	{
-		szCmdLine[i] = tolower(szCmdLine[i]);
-	} 
-	BOOL argfound = FALSE;
-	for (i = 0; i < strlen(szCmdLine); i++)
-	{
-		if (szCmdLine[i] <= ' ')
-			continue;
-		argfound = TRUE;
-
-		if (strncmp(&szCmdLine[i], winvncSettingshelper, strlen(winvncSettingshelper)) == 0)
-		{
-			Sleep(3000);
-			char mycommand[MAX_PATH];
-			i+=strlen(winvncSettingshelper);
-			strcpy( mycommand, &(szCmdLine[i+1]));
-			Set_settings_as_admin(mycommand);
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncStopserviceHelper, strlen(winvncStopserviceHelper)) == 0)
-		{
-			Sleep(3000);
-			Set_stop_service_as_admin();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncKill, strlen(winvncKill)) == 0)
-		{
-			static HANDLE		hShutdownEventTmp;
-			hShutdownEventTmp = OpenEvent(EVENT_ALL_ACCESS, FALSE, "Global\\SessionEventUltra");
-			SetEvent(hShutdownEventTmp);
-			CloseHandle(hShutdownEventTmp);
-
-			//adzm 2010-02-10 - Finds the appropriate VNC window for any process. Sends this message to all of them!
-			HWND hservwnd = NULL;
-			do {
-				if (hservwnd!=NULL)
-				{
-					PostMessage(hservwnd, WM_COMMAND, 40002, 0);
-					PostMessage(hservwnd, WM_CLOSE, 0, 0);
-				}
-				hservwnd = FindWinVNCWindow(false);
-			} while (hservwnd!=NULL);
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncopenhomepage, strlen(winvncopenhomepage)) == 0)
-		{
-			Open_homepage();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncopenforum, strlen(winvncopenforum)) == 0)
-		{
-			Open_forum();
-			return 0;
-		}
-
-
-		if (strncmp(&szCmdLine[i], winvncStartserviceHelper, strlen(winvncStartserviceHelper)) == 0)
-		{
-			Sleep(3000);
-			Set_start_service_as_admin();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncInstallServiceHelper, strlen(winvncInstallServiceHelper)) == 0)
-			{
-				//Sleeps are realy needed, else runas fails...
-				Sleep(3000);
-				Set_install_service_as_admin();
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncUnInstallServiceHelper, strlen(winvncUnInstallServiceHelper)) == 0)
-			{
-				Sleep(3000);
-				Set_uninstall_service_as_admin();
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncSoftwarecadHelper, strlen(winvncSoftwarecadHelper)) == 0)
-			{
-				Sleep(3000);
-				Enable_softwareCAD_elevated();
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncdelSoftwarecadHelper, strlen(winvncdelSoftwarecadHelper)) == 0)
-			{
-				Sleep(3000);
-				delete_softwareCAD_elevated();
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncRebootSafeHelper, strlen(winvncRebootSafeHelper)) == 0)
-			{
-				Sleep(3000);
-				Reboot_in_safemode_elevated();
-				return 0;
-			}
-
-		if (strncmp(&szCmdLine[i], winvncRebootForceHelper, strlen(winvncRebootForceHelper)) == 0)
-			{
-				Sleep(3000);
-				Reboot_with_force_reboot_elevated();
-				return 0;
-			}
-
-		if (strncmp(&szCmdLine[i], winvncSecurityEditorHelper, strlen(winvncSecurityEditorHelper)) == 0)
-			{
-				Sleep(3000);
-				winvncSecurityEditorHelper_as_admin();
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncSecurityEditor, strlen(winvncSecurityEditor)) == 0)
-			{
-			    typedef void (*vncEditSecurityFn) (HWND hwnd, HINSTANCE hInstance);
-				vncEditSecurityFn vncEditSecurity = 0;
-				char szCurrentDir[MAX_PATH];
-					if (GetModuleFileName(NULL, szCurrentDir, MAX_PATH)) {
-						char* p = strrchr(szCurrentDir, '\\');
-						*p = '\0';
-						strcat (szCurrentDir,"\\authSSP.dll");
-					}
-					HMODULE hModule = LoadLibrary(szCurrentDir);
-					if (hModule) {
-						vncEditSecurity = (vncEditSecurityFn) GetProcAddress(hModule, "vncEditSecurity");
-						/*HRESULT hr = */CoInitialize(NULL);
-						vncEditSecurity(NULL, hAppInstance);
-						CoUninitialize();
-						FreeLibrary(hModule);
-					}
-				return 0;
-			}
-
-		if (strncmp(&szCmdLine[i], winvncSettings, strlen(winvncSettings)) == 0)
-		{
-			char mycommand[MAX_PATH];
-			i+=strlen(winvncSettings);
-			strcpy( mycommand, &(szCmdLine[i+1]));
-			Real_settings(mycommand);
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncSoftwarecad, strlen(winvncSoftwarecad)) == 0)
-		{
-			Enable_softwareCAD();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncdelSoftwarecad, strlen(winvncdelSoftwarecad)) == 0)
-		{
-			delete_softwareCAD();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncRebootSafe, strlen(winvncRebootSafe)) == 0)
-		{
-			Reboot_in_safemode();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncRebootForce, strlen(winvncRebootForce)) == 0)
-		{
-			Reboot_with_force_reboot();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncStopservice, strlen(winvncStopservice)) == 0)
-		{
-			Real_stop_service();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncStartservice, strlen(winvncStartservice)) == 0)
-		{
-			Real_start_service();
-			return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncInstallService, strlen(winvncInstallService)) == 0)
-			{
-                // rest of command line service name, if provided.
-                char *pServiceName = &szCmdLine[i];
-                // skip over command switch, find next whitepace
-                while (*pServiceName && !isspace(*(unsigned char*)pServiceName))
-                    ++pServiceName;
-
-                // skip past whitespace to service name
-                while (*pServiceName && isspace(*(unsigned char*)pServiceName))
-                    ++pServiceName;
-
-                // strip off any quotes
-                if (*pServiceName && *pServiceName == '\"')
-                    ++pServiceName;
-
-                if (*pServiceName)
-                {
-                    // look for trailing quote, if found, terminate the string there.
-                    char *pQuote = pServiceName;
-                    pQuote = strrchr(pServiceName, '\"');
-                    if (pQuote)
-                        *pQuote = 0;
-                }
-                // if a service name is supplied, and it differs except in case from
-                // the default, use the supplied service name instead
-                if (*pServiceName && (_strcmpi(pServiceName, service_name) != 0))
-                {
-                    strncpy(service_name, pServiceName, 256);
-                    service_name[255] = 0;
-                }
-				install_service();
-				Sleep(2000);
-				char command[MAX_PATH + 32]; // 29 January 2008 jdp
-                _snprintf(command, sizeof command, "net start \"%s\"", service_name);
-				WinExec(command,SW_HIDE);
-				return 0;
-			}
-		if (strncmp(&szCmdLine[i], winvncUnInstallService, strlen(winvncUnInstallService)) == 0)
-			{
-				char command[MAX_PATH + 32]; // 29 January 2008 jdp 
-                // rest of command line service name, if provided.
-                char *pServiceName = &szCmdLine[i];
-                // skip over command switch, find next whitepace
-                while (*pServiceName && !isspace(*(unsigned char*)pServiceName))
-                    ++pServiceName;
-
-                // skip past whitespace to service name
-                while (*pServiceName && isspace(*(unsigned char*)pServiceName))
-                    ++pServiceName;
-
-                // strip off any quotes
-                if (*pServiceName && *pServiceName == '\"')
-                    ++pServiceName;
-
-                if (*pServiceName)
-                {
-                    // look for trailing quote, if found, terminate the string there.
-                    char *pQuote = pServiceName;
-                    pQuote = strrchr(pServiceName, '\"');
-                    if (pQuote)
-                        *pQuote = 0;
-                }
-
-                if (*pServiceName && (_strcmpi(pServiceName, service_name) != 0))
-                {
-                    strncpy(service_name, pServiceName, 256);
-                    service_name[255] = 0;
-                }
-                _snprintf(command, sizeof command, "net stop \"%s\"", service_name);
-				WinExec(command,SW_HIDE);
-				uninstall_service();
-				return 0;
-			}
-
-
-
-		if (strncmp(&szCmdLine[i], winvncRunService, strlen(winvncRunService)) == 0)
-		{
-			//Run as service
-			if (!Myinit(hInstance)) return 0;
-			fRunningFromExternalService = true;
-			vncService::RunningFromExternalService(true); 
-			return WinVNCAppMain();
-		}
-
-		if (strncmp(&szCmdLine[i], winvncStartService, strlen(winvncStartService)) == 0)
-		{
-		start_service(szCmdLine);
-		return 0;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncRunAsUserApp, strlen(winvncRunAsUserApp)) == 0)
-		{
-			// WinVNC is being run as a user-level program
-			if (!Myinit(hInstance)) return 0;
-			return WinVNCAppMain();
-		}
-
-		if (strncmp(&szCmdLine[i], winvncSCexit, strlen(winvncSCexit)) == 0)
-		{
-			SPECIAL_SC_EXIT=true;
-			i+=strlen(winvncSCexit);
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncSCprompt, strlen(winvncSCprompt)) == 0)
-		{
-			SPECIAL_SC_PROMPT=true;
-			i+=strlen(winvncSCprompt);
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncmulti, strlen(winvncmulti)) == 0)
-		{
-			multi=true;
-			i+=strlen(winvncmulti);
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvnchttp, strlen(winvnchttp)) == 0)
-		{
-			G_HTTP=true;
-			i+=strlen(winvnchttp);
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncStopReconnect, strlen(winvncStopReconnect)) == 0)
-		{
-			i+=strlen(winvncStopReconnect);
-			vncService::PostAddStopConnectClientAll();
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncAutoReconnect, strlen(winvncAutoReconnect)) == 0)
-		{
-			// Note that this "autoreconnect" param MUST be BEFORE the "connect" one
-			// on the command line !
-			// wa at 2005 -- added support for the AutoReconnectId
-			i+=strlen(winvncAutoReconnect);
-			Injected_autoreconnect=true;
-			int start, end;
-			char* pszId = NULL;
-			start = i;
-			// skip any spaces and grab the parameter
-			while (szCmdLine[start] <= ' ' && szCmdLine[start] != 0) start++;
-			
-			if ( strncmp( &szCmdLine[start], winvncAutoReconnectId, strlen(winvncAutoReconnectId) ) == 0 )
-			{
-				end = start;
-				while (szCmdLine[end] > ' ') end++;
-				
-				pszId = new char[ end - start + 1 ];
-				if (pszId != 0) 
-				{
-					strncpy( pszId, &(szCmdLine[start]), end - start );
-					pszId[ end - start ] = 0;
-					pszId = _strupr( pszId );
-				}
-//multiple spaces between autoreconnect and id 
-				i = end;
-			}// end of condition we found the ID: parameter
-			
-			// NOTE:  id must be NULL or the ID:???? (pointer will get deleted when message is processed)
-			// We can not contact a runnning service, permissions, so we must store the settings
-			// and process until the vncmenu has been started
-
-			if (!vncService::PostAddAutoConnectClient( pszId ))
-			{
-				PostAddAutoConnectClient_bool=true;
-				if (pszId==NULL)
-				{
-					PostAddAutoConnectClient_bool_null=true;
-					PostAddAutoConnectClient_bool=false;
-				}
-				else
-				{
-					strcpy(pszId_char,pszId);
-					//memory leak fix
-					delete [] pszId;
-				}
-			}
-			continue;
-		}
-
-			
-		if ( strncmp( &szCmdLine[i], winvncReconnectId, strlen(winvncReconnectId) ) == 0 )
-			{
-				i+=strlen("-");
-				int start, end;
-				char* pszId = NULL;
-				start = i;
-				end = start;
-				while (szCmdLine[end] > ' ') end++;
-
-				pszId = new char[ end - start + 1 ];
-				if (pszId != 0) 
-				{
-					strncpy( pszId, &(szCmdLine[start]), end - start );
-					pszId[ end - start ] = 0;
-					pszId = _strupr( pszId );
-				}
-				i = end;
-			if (!vncService::PostAddConnectClient( pszId ))
-			{
-				PostAddConnectClient_bool=true;
-				if (pszId==NULL)
-				{
-					PostAddConnectClient_bool_null=true;
-					PostAddConnectClient_bool=false;
-				}
-				else
-				{
-					strcpy(pszId_char,pszId);
-					//memory leak fix
-					delete [] pszId;
-				}
-				}
-			continue;
-		}
-
-		if (strncmp(&szCmdLine[i], winvncConnect, strlen(winvncConnect)) == 0)
-		{
-			if (!Injected_autoreconnect)
-			{
-				vncService::PostAddStopConnectClient();
-			}
-			// Add a new client to an existing copy of winvnc
-			i+=strlen(winvncConnect);
-
-			// First, we have to parse the command line to get the filename to use
-			int start, end;
-			start=i;
-			while (szCmdLine[start] <= ' ' && szCmdLine[start] != 0) start++;
-			end = start;
-			while (szCmdLine[end] > ' ') end++;
-
-			// Was there a hostname (and optionally a port number) given?
-			if (end-start > 0)
-			{
-				char *name = new char[end-start+1];
-				if (name != 0) {
-					strncpy(name, &(szCmdLine[start]), end-start);
-					name[end-start] = 0;
-
-					int port = INCOMING_PORT_OFFSET;
-					char *portp = strchr(name, ':');
-					if (portp) {
-						*portp++ = '\0';
-						if (*portp == ':') {
-							port = atoi(++portp);	// Port number after "::"
-						} else {
-							port = atoi(portp);	// Display number after ":"
-						}
-					}
-					vnclog.Print(LL_STATE, VNCLOG("test... %s %d\n"),name,port);
-					strcpy(dnsname,name);
-					VCard32 address = VSocket::Resolve(name);
-					delete [] name;
-					if (address != 0) {
-						// Post the IP address to the server
-						// We can not contact a runnning service, permissions, so we must store the settings
-						// and process until the vncmenu has been started
-						vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient III \n"));
-						if (!vncService::PostAddNewClientInit(address, port))
-						{
-						PostAddNewClient_bool=true;
-						port_int=port;
-						address_vcard=address;
-						}
-					}
-					else
-					{
-						//ask for host,port
-						PostAddNewClient_bool=true;
-						port_int=0;
-						address_vcard=0;
-						Sleep(2000);
-						Beep(200,1000);
-						return 0;
-					}
-				}
-				i=end;
-				continue;
-			}
-			else 
-			{
-				// Tell the server to show the Add New Client dialog
-				// We can not contact a runnning service, permissions, so we must store the settings
-				// and process until the vncmenu has been started
-				vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient IIII\n"));
-				if (!vncService::PostAddNewClient(0, 0))
-				{
-				PostAddNewClient_bool=true;
-				port_int=0;
-				address_vcard=0;
-				}
-			}
-			continue;
-		}
-
-		//adzm 2009-06-20
-		if (strncmp(&szCmdLine[i], winvncRepeater, strlen(winvncRepeater)) == 0)
-		{
-			// set the default repeater host
-			i+=strlen(winvncRepeater);
-
-			// First, we have to parse the command line to get the host to use
-			int start, end;
-			start=i;
-			while (szCmdLine[start] <= ' ' && szCmdLine[start] != 0) start++;
-			end = start;
-			while (szCmdLine[end] > ' ') end++;
-
-			// Was there a hostname (and optionally a port number) given?
-			if (end-start > 0)
-			{
-				if (g_szRepeaterHost) {
-					delete[] g_szRepeaterHost;
-					g_szRepeaterHost = NULL;
-				}
-				g_szRepeaterHost = new char[end-start+1];
-				if (g_szRepeaterHost != 0) {
-					strncpy(g_szRepeaterHost, &(szCmdLine[start]), end-start);
-					g_szRepeaterHost[end-start] = 0;
-					
-					// We can not contact a runnning service, permissions, so we must store the settings
-					// and process until the vncmenu has been started
-					vnclog.Print(LL_INTERR, VNCLOG("PostAddNewRepeaterClient I\n"));
-					if (!vncService::PostAddNewRepeaterClient())
-					{
-						PostAddNewRepeaterClient_bool=true;
-						port_int=0;
-						address_vcard=0;
-					}
-				}
-				i=end;
-				continue;
-			}
-			else 
-			{
-				/*
-				// Tell the server to show the Add New Client dialog
-				// We can not contact a runnning service, permissions, so we must store the settings
-				// and process until the vncmenu has been started
-				vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient IIII\n"));
-				if (!vncService::PostAddNewClient(0, 0))
-				{
-				PostAddNewClient_bool=true;
-				port_int=0;
-				address_vcard=0;
-				}
-				*/
-			}
-			continue;
-		}
-
-		// Either the user gave the -help option or there is something odd on the cmd-line!
-
-		// Show the usage dialog
-		MessageBoxSecure(NULL, winvncUsageText, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
-		break;
-	};
-
-	// If no arguments were given then just run
-	if (!argfound)
-	{
-		if (!Myinit(hInstance)) return 0;
-		return WinVNCAppMain();
-	}
-
-	return 0;
-}
-#endif
-
-
-// rdv&sf at 2007 - New TrayIcon impuDEsktop/impersonation thread stuff
-
-DWORD WINAPI imp_desktop_thread(LPVOID lpParam)
-{
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	vncServer *server = (vncServer *)lpParam;
-#endif
-	HDESK desktop;
-	//vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n"));
-	//vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n"));
-	desktop = OpenInputDesktop(0, FALSE,
-								DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
-								DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
-								DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
-								DESKTOP_SWITCHDESKTOP | GENERIC_WRITE
-								);
-
-	if (desktop == NULL)
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n"));
-	else 
-		vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n"));
-
-	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
-	DWORD dummy;
-
-	char new_name[256];
-
-	if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
-	}
-
-	vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop);
-
-	if (!SetThreadDesktop(desktop))
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
-	}
-
-//	ImpersonateCurrentUser_();
-
-	char m_username[UNLEN+1];
-	HWINSTA station = GetProcessWindowStation();
-	if (station != NULL)
-	{
-		DWORD usersize;
-		GetUserObjectInformation(station, UOI_USER_SID, NULL, 0, &usersize);
-		SetLastError(0);
-		if (usersize != 0)
-		{
-			DWORD length = sizeof(m_username);
-			if (GetUserName(m_username, &length) == 0)
-			{
-				UINT error = GetLastError();
-				if (error != ERROR_NOT_LOGGED_ON)
-				{
-					vnclog.Print(LL_INTERR, VNCLOG("getusername error %d\n"), GetLastError());
-					SetThreadDesktop(old_desktop);
-                	CloseDesktop(desktop);
-					Sleep(500);
-					return FALSE;
-				}
-			}
-		}
-	}
-    vnclog.Print(LL_INTERR, VNCLOG("Username %s \n"),m_username);
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	// Create tray icon and menu
-	vncMenu *menu = new vncMenu(server);
-	if (menu == NULL)
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("failed to create tray menu\n"));
-		PostQuitMessage(0);
-	}
-#endif
-
-	// This is a good spot to handle the old PostAdd messages
-	if (PostAddAutoConnectClient_bool)
-		vncService::PostAddAutoConnectClient( pszId_char );
-	if (PostAddAutoConnectClient_bool_null)
-		vncService::PostAddAutoConnectClient( NULL );
-
-	if (PostAddConnectClient_bool)
-		vncService::PostAddConnectClient( pszId_char );
-	if (PostAddConnectClient_bool_null)
-		vncService::PostAddConnectClient( NULL );
-
-
-	if (PostAddNewClient_bool)
-	{
-		PostAddNewClient_bool=false;
-		vnclog.Print(LL_INTERR, VNCLOG("PostAddNewClient IIIII\n"));
-		vncService::PostAddNewClient(address_vcard, port_int);
-	}
-	//adzm 2009-06-20
-	if (PostAddNewRepeaterClient_bool)
-	{
-		PostAddNewRepeaterClient_bool=false;
-		vnclog.Print(LL_INTERR, VNCLOG("PostAddNewRepeaterClient II\n"));
-		vncService::PostAddNewRepeaterClient();
-	}
-	bool Runonce=false;
-	MSG msg;
-	while (GetMessage(&msg,0,0,0) != 0)
-	{
-		TranslateMessage(&msg);
-		DispatchMessage(&msg);
-		if (fShutdownOrdered && !Runonce)
-		{
-			Runonce=true;
-#ifndef ULTRAVNC_ITALC_SUPPORT
-			menu->Shutdown(true);
-#endif
-		}
-	}
-
-#ifndef ULTRAVNC_ITALC_SUPPORT
-	// sf at 2007 - Close all (vncMenu,tray icon, connections...)
-
-	if (menu != NULL)
-		delete menu;
-#endif
-
-	//vnclog.Print(LL_INTERR, VNCLOG("GetMessage stop \n"));
-	SetThreadDesktop(old_desktop);
-	CloseDesktop(desktop);
-//	RevertToSelf();
-	return 0;
-
-}
-
-
-// sf at 2007 - For now we use a mmtimer to test the shutdown event periodically
-// Maybe there's a less rude method...
-void CALLBACK fpTimer(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
-	if (hShutdownEvent)
-	{
-		// vnclog.Print(LL_INTERR, VNCLOG("****************** SDTimer tic\n"));
-		DWORD result=WaitForSingleObject(hShutdownEvent, 0);
-		if (WAIT_OBJECT_0==result)
-		{
-			ResetEvent(hShutdownEvent);
-			fShutdownOrdered = true;
-			vnclog.Print(LL_INTERR, VNCLOG("****************** WaitForSingleObject - Shutdown server\n"));
-		}
-	}
-}
-
-void InitSDTimer()
-{
-	if (mmRes != (MMRESULT)-1) return;
-	vnclog.Print(LL_INTINFO, VNCLOG("****************** Init SDTimer\n"));
-	mmRes = timeSetEvent( 2000, 0, (LPTIMECALLBACK)fpTimer, 0, TIME_PERIODIC );
-}
-
-
-void KillSDTimer()
-{
-	vnclog.Print(LL_INTINFO, VNCLOG("****************** Kill SDTimer\n"));
-	timeKillEvent(mmRes);
-	mmRes = -1;
-}
-
-
-
-// This is the main routine for WinVNC when running as an application
-// (under Windows 95 or Windows NT)
-// Under NT, WinVNC can also run as a service.  The WinVNCServerMain routine,
-// defined in the vncService header, is used instead when running as a service.
-
-
-int WinVNCAppMain()
-{
-	SetOSVersion();
-	vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - WinVNCAPPMain\n"));
-#ifdef CRASH_ENABLED
-	LPVOID lpvState = Install(NULL,  "rudi.de.vos at skynet.be", "UltraVnc");
-#endif
-
-	// Set this process to be the last application to be shut down.
-	// Check for previous instances of WinVNC!
-	vncInstHandler *instancehan=new vncInstHandler;
-	if (!multi) // this allow to overwrite the multiple instance check
-	{
-		if (!instancehan->Init())
-		{	
-    		vnclog.Print(LL_ERROR, VNCLOG("%s -- exiting\n"), sz_ID_ANOTHER_INST);
-			// We don't allow multiple instances!
-			/*if (!fRunningFromExternalService)
-				MessageBoxSecure(NULL, sz_ID_ANOTHER_INST, szAppName, MB_OK);*/
-			Sleep( 5000 );
-			return 0;
-		}
-	}
-
-	// Initialise the VSocket system
-	VSocketSystem socksys;
-	if (!socksys.Initialised())
-	{
-		MessageBoxSecure(NULL, sz_ID_FAILED_INIT, szAppName, MB_OK);
-		return 0;
-	}
-
-	//vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Previous instance checked - Trying to create server\n"));
-	// CREATE SERVER
-	vncServer server;
-
-	// Set the name and port number
-	server.SetName(szAppName);
-	server.SockConnect( TRUE );
-	vnclog.Print(LL_STATE, VNCLOG("server created ok\n"));
-	///uninstall driver before cont
-	
-	// sf at 2007 - Set Application0 special mode
-	server.RunningFromExternalService(fRunningFromExternalService);
-
-	// Create tray icon and menu
-	vncMenu *menu = new vncMenu(&server);
-	if (menu == NULL)
-	{
-		vnclog.Print(LL_INTERR, VNCLOG("failed to create tray menu\n"));
-		PostQuitMessage(0);
-	}
-
-
-	// sf at 2007 - New impersonation thread stuff for tray icon & menu
-	// Subscribe to shutdown event
-	hShutdownEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "Global\\SessionEventUltra");
-	hShutdownEventcad = OpenEvent(EVENT_MODIFY_STATE, FALSE, "Global\\SessionEventUltraCad");
-	if (hShutdownEvent) ResetEvent(hShutdownEvent);
-	vnclog.Print(LL_STATE, VNCLOG("***************** SDEvent created \n"));
-	// Create the timer that looks periodicaly for shutdown event
-	mmRes = -1;
-	InitSDTimer();
-
-	while ( !fShutdownOrdered)
-	{
-#ifdef ULTRAVNC_ITALC_SUPPORT
-		DWORD result = WaitForSingleObject( hShutdownEvent, INFINITE );
-		if( WAIT_OBJECT_0 == result )
-		{
-			fShutdownOrdered = true;
-			server.KillAuthClients();
-		}
-#else
-		//vnclog.Print(LL_STATE, VNCLOG("################## Creating Imp Thread : %d \n"), nn);
-		HANDLE threadHandle;
-		DWORD dwTId;
-		threadHandle = CreateThread(NULL, 0, imp_desktop_thread, &server, 0, &dwTId);
-
-		if (threadHandle)  
-		{
-			WaitForSingleObject( threadHandle, INFINITE );
-			CloseHandle(threadHandle);
-		}
-		vnclog.Print(LL_STATE, VNCLOG("################## Closing Imp Thread\n"));
-#endif
-	}
-
-	KillSDTimer();
-	if (instancehan!=NULL)
-		delete instancehan;
-
-	if (hShutdownEvent)CloseHandle(hShutdownEvent);
-	if (hShutdownEventcad)CloseHandle(hShutdownEventcad);
-	vnclog.Print(LL_STATE, VNCLOG("################## SHUTING DOWN SERVER ####################\n"));
-
-	//adzm 2009-06-20
-	if (g_szRepeaterHost) {
-		delete[] g_szRepeaterHost;
-		g_szRepeaterHost = NULL;
-	}
-	return 1;
-};
diff --git a/ica/win32/winvnc/winvnc/winvnc.dsp b/ica/win32/winvnc/winvnc/winvnc.dsp
deleted file mode 100644
index d44377c..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.dsp
+++ /dev/null
@@ -1,791 +0,0 @@
-# Microsoft Developer Studio Project File - Name="winvnc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=winvnc - Win32 Release
-!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 "winvnc.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 "winvnc.mak" CFG="winvnc - Win32 Release"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "winvnc - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "winvnc - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "winvnc - 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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\omnithread" /I ".." /I "..\.." /D "NDEBUG" /D "__x86__" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x501 /D "XMD_H" /D "_WINSTATIC" /YX /FD /D /O3 /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 /i "..\.." /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 /subsystem:windows /machine:I386
-# ADD LINK32 wsock32.lib winmm.lib kernel32.lib user32.lib gdi32.lib shell32.lib advapi32.lib ole32.lib version.lib comctl32.lib userenv.lib wtsapi32.lib vfw32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib"
-# SUBTRACT LINK32 /pdb:none /nodefaultlib
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PreLink_Cmds=cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp
-# End Special Build Tool
-
-!ELSEIF  "$(CFG)" == "winvnc - 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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\omnithread" /I ".." /I "..\.." /D "_DEBUG" /D "__x86__" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x501 /D "XMD_H" /D "_WINSTATIC" /Fr /YX /FD /D /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 /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ws2_32.lib winmm.lib kernel32.lib user32.lib gdi32.lib shell32.lib advapi32.lib ole32.lib version.lib userenv.lib WtsApi32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib"
-# SUBTRACT LINK32 /profile
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PreLink_Cmds=cl /nologo /MTd /Fo..\Debug\ /Fd..\Debug\ /c buildtime.cpp
-# End Special Build Tool
-
-!ENDIF 
-
-# Begin Target
-
-# Name "winvnc - Win32 Release"
-# Name "winvnc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\black_layered.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\buildtime.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\d3des.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\rfb\dh.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\DSMPlugin\DSMPlugin.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\helpers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\HideDesktop.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\inifile.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IPC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IPC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\lzo\minilzo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\read_write_ini.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRegion.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRegion_X11.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbUpdateTracker.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\security.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\service.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\service_motor.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\stdhdrs.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\tableinitcmtemplate.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\tableinittctemplate.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\tabletranstemplate.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\TextChat.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\translate.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\videodriver.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\videodrivercheck.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vistahook.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncabout.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncacceptdialog.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncauth.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncbuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncclient.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncconndialog.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnccorbaconnect.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncdesktop.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncDesktopSW.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncdesktopthread.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodecorre.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodehext.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencoderCursor.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencoderre.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeTight.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeUltra.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeZlib.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeZlibHex.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodezrle.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnchttpconnect.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncinsthandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnckeymap.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncListDlg.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnclog.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncmenu.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncMultiMonitor.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncntlm.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncOSVersion.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncproperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncpropertiesPoll.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncserver.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncservice.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncsetauth.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncsk.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncsockconnect.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnctimedmsgbox.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vsocket.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\win32_helpers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\winvnc.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\winvnc.rc
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ZipUnZip32\ZipUnzip32.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\d3des.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\rfb\dh.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\DSMPlugin\DSMPlugin.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\inifile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\keysymdef.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\lzo\lzoconf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\lzo\lzodefs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\lzo\minilzo.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\MultiMon.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbMisc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\rfb\rfbproto.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRegion.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRegion_win32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbRegion_X11.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\rfbUpdateTracker.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\stdhdrs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TextChat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\translate.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\videodriver.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnc.hh
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncabout.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncacceptdialog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncauth.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncbuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncclient.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncconndialog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnccorbaconnect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncdesktop.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncdesktopthread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodecorre.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodehext.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodemgr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencoderre.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeTight.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeUltra.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeZlib.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncEncodeZlibHex.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncencodezrle.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnchttpconnect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncinsthandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnckeymap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncListDlg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnclog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncmenu.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncpasswd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncproperties.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncpropertiesPoll.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncpropPath.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncserver.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncservice.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncsetauth.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vncsockconnect.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnctimedmsgbox.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vsocket.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\vtypes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\win32_helpers.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\winvnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ZipUnZip32\ZipUnZip32.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"
-# Begin Source File
-
-SOURCE=.\res\background.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\background2.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\clipboardframe.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\descipher.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\Finger.cur
-# End Source File
-# Begin Source File
-
-SOURCE=.\HideDesktop.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\ico00001.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\icon1.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\icon2.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\optionsframe.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\rfbproto.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vdacc.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=".\res\vnc-1.bmp"
-# End Source File
-# Begin Source File
-
-SOURCE=".\res\vnc-1.ico"
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vnc.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\vnc.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vnc64.BMP
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vnccanvas.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vncviewer.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\vncviewer.jar
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\winvnc.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\world3a.ico
-# End Source File
-# Begin Source File
-
-SOURCE=".\res\ww-grn-sq2.ico"
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\res\AuthPanel.class
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\BUILDING.txt
-# End Source File
-# Begin Source File
-
-SOURCE=..\building.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\ButtonPanel.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\DH.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\DH.class
-# End Source File
-# Begin Source File
-
-SOURCE=".\res\ftpframe$strcomp.class"
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\FTPFrame.class
-# 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
-# Begin Source File
-
-SOURCE=.\res\RecordingFrame.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\res\SessionRecorder.class
-# End Source File
-# Begin Source File
-
-SOURCE=.\winvnc.exe.manifest
-# End Source File
-# End Target
-# End Project
diff --git a/ica/win32/winvnc/winvnc/winvnc.exe.manifest b/ica/win32/winvnc/winvnc/winvnc.exe.manifest
deleted file mode 100644
index 1267450..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.exe.manifest
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-<assemblyIdentity
-   version="1.0.0.20"
-   processorArchitecture="X86"
-   name="UltraVNC..exe"
-   type="win32"
-/>
-<description>UltraVNC</description>
-<dependency>
-   <dependentAssembly>
-     <assemblyIdentity
-       type="win32"
-       name="Microsoft.Windows.Common-Controls"
-       version="6.0.0.0"
-       processorArchitecture="X86"
-       publicKeyToken="6595b64144ccf1df"
-       language="*"
-     />
-   </dependentAssembly>
-</dependency>
-<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-<security>
-<requestedPrivileges>
-<requestedExecutionLevel 
-level="asInvoker"
-uiAccess="false"/> 
-</requestedPrivileges>
-</security>
-</trustInfo> 
-</assembly>
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/winvnc.exe.x64.manifest b/ica/win32/winvnc/winvnc/winvnc.exe.x64.manifest
deleted file mode 100644
index bd98755..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.exe.x64.manifest
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
-    <security>
-      <requestedPrivileges>
-        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
-      </requestedPrivileges>
-    </security>
-  </trustInfo>
-  <dependency>
-    <dependentAssembly>
-      <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*' />
-    </dependentAssembly>
-  </dependency>
-</assembly>
diff --git a/ica/win32/winvnc/winvnc/winvnc.exe.x86.manifest b/ica/win32/winvnc/winvnc/winvnc.exe.x86.manifest
deleted file mode 100644
index 1267450..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.exe.x86.manifest
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-<assemblyIdentity
-   version="1.0.0.20"
-   processorArchitecture="X86"
-   name="UltraVNC..exe"
-   type="win32"
-/>
-<description>UltraVNC</description>
-<dependency>
-   <dependentAssembly>
-     <assemblyIdentity
-       type="win32"
-       name="Microsoft.Windows.Common-Controls"
-       version="6.0.0.0"
-       processorArchitecture="X86"
-       publicKeyToken="6595b64144ccf1df"
-       language="*"
-     />
-   </dependentAssembly>
-</dependency>
-<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-<security>
-<requestedPrivileges>
-<requestedExecutionLevel 
-level="asInvoker"
-uiAccess="false"/> 
-</requestedPrivileges>
-</security>
-</trustInfo> 
-</assembly>
\ No newline at end of file
diff --git a/ica/win32/winvnc/winvnc/winvnc.h b/ica/win32/winvnc/winvnc/winvnc.h
deleted file mode 100644
index 5a1511f..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.h
+++ /dev/null
@@ -1,104 +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 at uk.research.att.com for information on obtaining it.
-
-
-// WinVNC header file
-
-#include "stdhdrs.h"
-#include "resource.h"
-
-// Application specific messages
-
-// Message used for system tray notifications
-#define WM_TRAYNOTIFY				WM_APP+1
-
-// Messages used for the server object to notify windows of things
-#define WM_SRV_CLIENT_CONNECT		WM_APP+2
-#define WM_SRV_CLIENT_AUTHENTICATED	WM_APP+3
-#define WM_SRV_CLIENT_DISCONNECT	WM_APP+4
-
-#define WM_MOUSESHAPE				WM_APP+6
-#define WM_HOOKCHANGE				WM_APP+7
-#define WM_SHUTDOWN					WM_APP+8
-
-
-// Export the application details
-extern HINSTANCE	hAppInstance;
-extern const char	*szAppName;
-extern DWORD		mainthreadId;
-
-// Main VNC server routine
-
-extern int WinVNCAppMain();
-
-// Standard command-line flag definitions
-const char winvncRunService[]		= "-service_run";
-const char winvncStartService[]		= "-service";
-const char winvncRunAsUserApp[]		= "-run";
-const char winvncConnect[]		= "-connect";
-const char winvncAutoReconnect[]	= "-autoreconnect";
-const char winvncStopReconnect[]	= "-stopreconnect";
-const char winvncAutoReconnectId[]	= "id:";
-const char winvncReconnectId[]	= "-id:";
-const char winvncSCexit[]	= "-sc_exit";
-const char winvncSCprompt[]	= "-sc_prompt";
-const char winvncmulti[]	= "-multi";
-const char winvnchttp[]	= "-httpproxy";
-
-//adzm 2009-06-20
-// for use with -sc
-const char winvncRepeater[]	= "-repeater"; // set default repeater host
-extern char* g_szRepeaterHost;
-
-const char winvncSettingshelper[]		= "-settingshelper";
-const char winvncSettings[]				= "-settings";
-const char winvncStopserviceHelper[]	= "-stopservicehelper";
-const char winvncStopservice[]			= "-stopservice";
-const char winvncStartserviceHelper[]	= "-startservicehelper";
-const char winvncStartservice[]			= "-startservice";
-
-const char winvncInstallService[]		= "-install";
-const char winvncUnInstallService[]		= "-uninstall";
-const char winvncInstallServiceHelper[]		= "-installhelper";
-const char winvncUnInstallServiceHelper[]	= "-uninstallhelper";
-
-const char winvncSoftwarecad[]		= "-softwarecad";
-const char winvncSoftwarecadHelper[]		= "-softwarecadhelper";
-
-const char winvncRebootSafe[]		= "-rebootsafemode";
-const char winvncRebootSafeHelper[]	= "-rebootsafemodehelper";
-
-const char winvncRebootForce[]		= "-rebootforce";
-const char winvncRebootForceHelper[]	= "-rebootforcehelper";
-
-const char winvncdelSoftwarecad[]		= "-delsoftwarecad";
-const char winvncdelSoftwarecadHelper[]		= "-delsoftwarecadhelper";
-
-const char winvncSecurityEditorHelper[]		= "-securityeditorhelper";
-const char winvncSecurityEditor[]			= "-securityeditor";
-const char winvncKill[]						= "-kill";
-const char winvncopenhomepage[]				= "-openhomepage";
-const char winvncopenforum[]				= "-openforum";
-
-// Usage string
-const char winvncUsageText[]		= "winvnc [-sc_prompt] [-sc_exit] [-id:????] [-stopreconnect][-autoreconnect[ ID:????]] [-connect host[:display]] [-connect host[::port]] [-repeater host[:port]] [-run]\n";
diff --git a/ica/win32/winvnc/winvnc/winvnc.rc b/ica/win32/winvnc/winvnc/winvnc.rc
deleted file mode 100644
index 33b1ea7..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.rc
+++ /dev/null
@@ -1,708 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Cursor
-//
-
-IDC_FINGER              CURSOR                  "res\\Finger.cur"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVACLASS
-//
-
-IDR_FTPFRAME_CLASS      JAVACLASS               "res\\FTPFrame.class"
-IDR_AUTHPANEL_CLASS     JAVACLASS               "res\\AuthPanel.class"
-IDR_CLIPBOARDFRAME_CLASS JAVACLASS               "res\\clipboardFrame.class"
-IDR_OPTIONSFRAME_CLASS  JAVACLASS               "res\\optionsFrame.class"
-IDR_RFBPROTO_CLASS      JAVACLASS               "res\\rfbProto.class"
-IDR_VNCCANVAS_CLASS     JAVACLASS               "res\\vncCanvas.class"
-IDR_VNCVIEWER_CLASS     JAVACLASS               "res\\vncviewer.class"
-IDR_BUTTONPANEL_CLASS   JAVACLASS               "res\\ButtonPanel.class"
-IDR_DESCIPHER_CLASS     JAVACLASS               "res\\DesCipher.class"
-IDR_RECFRAME_CLASS      JAVACLASS               "res\\RecordingFrame.class"
-IDR_SESSIONREC_CLASS    JAVACLASS               "res\\SessionRecorder.class"
-IDR_DH_CLASS            JAVACLASS               "res\\dh.class"
-IDR_FTPFRAMESTRCOMP_CLASS JAVACLASS               "res\\ftpframe$strcomp.class"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_TEXTCHAT_DLG DIALOGEX 0, 0, 308, 177
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_THICKFRAME
-CAPTION " Chat - Ultr at VNC"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    EDITTEXT        IDC_INPUTAREA_EDIT,4,135,255,39,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE
-    PUSHBUTTON      "Send",IDC_SEND_B,264,135,39,16,BS_MULTILINE
-    PUSHBUTTON      "Minimize",IDC_HIDE_B,264,153,39,11
-    PUSHBUTTON      "Close",IDCANCEL,264,164,39,11
-    CONTROL         "",IDC_CHATAREA_EDIT,"RICHEDIT",TCS_HOTTRACK | TCS_RAGGEDRIGHT | TCS_FOCUSONBUTTONDOWN | TCS_MULTISELECT | WS_VSCROLL | WS_TABSTOP,4,4,300,122,WS_EX_STATICEDGE
-    PUSHBUTTON      "",IDOK,303,0,6,6,NOT WS_VISIBLE
-    LTEXT           "",IDC_STATIC_SPLIT,5,127,298,8,SS_NOTIFY
-END
-
-IDD_LIST_DLG DIALOGEX 0, 0, 288, 123
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_TOOLWINDOW
-CAPTION " List of Clients - UltraVNC"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "Close",IDOK,118,94,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,118,78,50,14,NOT WS_VISIBLE
-    LTEXT           " Currently Connected Clients :",IDC_STATIC,5,4,105,8
-    LISTBOX         IDC_VIEWERS_LISTBOX,7,16,103,93,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
-    PUSHBUTTON      "Kill Client",IDC_KILL_B,118,17,50,14
-    PUSHBUTTON      "Chat with ���Client",IDC_TEXTCHAT_B,118,35,50,22,BS_MULTILINE
-    LTEXT           "Pending Clients:",IDC_STATIC,173,4,105,8
-    LISTBOX         IDC_PENDING_LISTBOX,175,16,103,93,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
-END
-
-IDD_ABOUT DIALOGEX 0, 0, 282, 158
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION " About WinVNC"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,8,135,54,16
-    CONTROL         139,IDC_VNCLOGO,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_SUNKEN,7,5,53,46,WS_EX_TRANSPARENT
-    LTEXT           "UltraVNC Win32 Server 1.0.9.6.1",IDC_VERSION,73,5,195,11
-    LTEXT           "Copyright � 2002-2009 UltraVNC Team\nCopyright � 2001-2002 Sam - eSVNC \nCopyright � 1999-2002 Rudi D. V. - VdaccVNC \nCopyright � 2001 Harakan Software - PalmVNC\nCopyright � 1999-2002 Const. Kaplinsky - TightVNC \n",IDC_NAME,74,27,202,41
-    LTEXT           "For more Information and Links please visit: \nhttp://www.uvnc.com",IDC_WWW,74,135,141,19
-    LTEXT           "Build:",IDC_BUILDTEXT,74,16,20,10
-    LTEXT           "BuildTime",IDC_BUILDTIME,97,16,92,10
-    LTEXT           "Copyright � 2002 RealVNC Ltd. - RealVNC\nCopyright � 1999-2002 Tridia Corporation - TridiaVNC \nCopyright � 1994-2001 AT&&T Laboratories Cambridge/Olivetti Research Ltd. - VNC",IDC_STATIC,74,67,203,32
-    LTEXT           "Copyright � 1990-2002 Info-ZIP\nCopyright � 1996-2002 Markus Franz Xaver Johannes Oberhumer - Mini LZO library",IDC_STATIC,74,99,200,27
-END
-
-IDD_OUTGOING_CONN DIALOGEX 0, 0, 223, 102
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Initiate Connection"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
-    CTEXT           "",IDC_CAPTION_STATIC,7,6,209,20,NOT WS_VISIBLE
-    LTEXT           "Host Name:",IDC_HOSTNAME_STATIC,90,9,58,8,SS_CENTERIMAGE
-    EDITTEXT        IDC_HOSTNAME_EDIT,90,22,121,14,ES_AUTOHSCROLL
-    LTEXT           "Connection #",IDC_CONNECTION_NUMBER_STATIC,90,43,58,8
-    EDITTEXT        IDC_IDCODE,90,56,121,14,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "OK",IDOK,90,78,46,14
-    PUSHBUTTON      "Cancel",IDCANCEL,165,78,46,14
-END
-
-IDD_ACCEPT_CONN DIALOGEX 0, 0, 186, 95
-STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-EXSTYLE WS_EX_TOPMOST
-CAPTION "Accept WinVNC Connection?"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
-    DEFPUSHBUTTON   "&Accept",IDACCEPT,7,74,53,14
-    PUSHBUTTON      "&Reject",IDREJECT,130,74,49,14
-    CTEXT           "WinVNC has received an incoming connection from",IDC_STATIC_TEXT1,7,7,172,17,SS_CENTERIMAGE
-    CTEXT           "<unknown host>",IDC_ACCEPT_IP,7,30,172,16,SS_CENTERIMAGE
-    CTEXT           "Do you wish to Accept or Reject the connection?",IDC_STATIC_TEXT,7,50,172,15,SS_CENTERIMAGE
-    CTEXT           "AutoReject:",IDC_ACCEPT_TIMEOUT,60,74,70,14,SS_CENTERIMAGE
-END
-
-IDD_PROPERTIES DIALOGEX 0, 0, 224, 191
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION " Ultr at VNC Server Property Page"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
-    GROUPBOX        "Server Screen Updates Handling",IDC_UPDATE_BORDER,6,2,214,118
-    CONTROL         "Poll Full Screen ( Ultra Fast )",IDC_POLL_FULLSCREEN,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,13,112,13
-    CONTROL         "Poll Foreground Window",IDC_POLL_FOREGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,28,95,9
-    CONTROL         "Poll Window Under Cursor",IDC_POLL_UNDER_CURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,37,95,16
-    CONTROL         "Poll Console Windows Only",IDC_CONSOLE_ONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,117,26,99,15
-    CONTROL         "Poll On Event Only",IDC_ONEVENT_ONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,117,39,78,12
-    CONTROL         "System HookDll",IDC_HOOK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,56,66,10
-    CONTROL         "Video Hook Driver",IDC_DRIVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,68,74,10
-    CONTROL         "Low Accuracy ( Turbo Speed )",IDC_TURBOMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,81,112,10
-    PUSHBUTTON      "Check the Video Hook Driver",IDC_CHECKDRIVER,92,67,121,11
-    GROUPBOX        "Single Window Sharing",IDC_STATIC,5,124,214,47,BS_LEFT
-    CONTROL         "Share only the Server Window Named :",IDC_SINGLE_WINDOW,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,137,188,10
-    EDITTEXT        IDC_NAME_APPLI,14,151,195,13,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "&OK",IDOK,82,174,44,14
-    PUSHBUTTON      "&Apply",IDC_APPLY,131,174,43,14
-    PUSHBUTTON      "&Cancel",IDCANCEL,178,174,41,14
-    EDITTEXT        IDC_MAXCPU,54,99,40,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Max Cpu :",IDC_STATIC,14,102,34,8
-END
-
-IDD_PROPERTIES1 DIALOGEX 0, 0, 390, 297
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION " UltraVNC Server Property Page"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
-    GROUPBOX        "Incoming Connections",IDC_CONNECT_BORDER,5,3,132,116,BS_LEFT
-    CONTROL         "Accept Socket Connections",IDC_CONNECT_SOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,15,112,11
-    LTEXT           "Display Number or Ports to use:",IDC_DISPLAY_NO_LABEL,11,28,102,9,SS_CENTERIMAGE
-    CONTROL         "Display",IDC_SPECDISPLAY,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,41,35,10
-    EDITTEXT        IDC_DISPLAYNO,66,41,29,12,ES_AUTOHSCROLL | ES_NUMBER
-    CONTROL         "Auto",IDC_AUTO_DISPLAY_NO,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,102,39,35,13
-    CONTROL         "Ports",IDC_SPECPORT,"Button",BS_AUTORADIOBUTTON,11,54,30,10
-    CONTROL         "Auto",IDC_PORTNO_AUTO,"Button",BS_AUTORADIOBUTTON,101,54,31,9
-    RTEXT           "Main:",IDC_STATIC,45,55,18,8
-    EDITTEXT        IDC_PORTRFB,66,53,29,12,ES_AUTOHSCROLL
-    RTEXT           "Http:",IDC_STATIC,36,67,27,8
-    EDITTEXT        IDC_PORTHTTP,66,65,29,12,ES_AUTOHSCROLL
-    CONTROL         "Enable JavaViewer (Http Connect)",IDC_CONNECT_HTTP,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,80,122,10
-    CONTROL         "Allow Loopback Connections",IDC_ALLOWLOOPBACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,91,105,10
-    CONTROL         "LoopbackOnly",IDC_LOOPBACKONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,102,59,10
-    GROUPBOX        "When Last Client Disconnects",IDC_LOCKSETTINGS,142,3,104,52,BS_LEFT
-    CONTROL         "Do Nothing",IDC_LOCKSETTING_NOTHING,"Button",BS_AUTORADIOBUTTON | WS_GROUP,146,15,80,12
-    CONTROL         "Lock Workstation (W2K)",IDC_LOCKSETTING_LOCK,"Button",BS_AUTORADIOBUTTON,146,26,96,13
-    CONTROL         "Logoff Workstation",IDC_LOCKSETTING_LOGOFF,"Button",BS_AUTORADIOBUTTON,146,39,80,11
-    GROUPBOX        "Keyboard && Mouse",IDC_STATIC,142,59,103,60,BS_LEFT
-    CONTROL         "Disable Viewers inputs",IDC_DISABLE_INPUTS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,150,70,92,11
-    CONTROL         "Disable Local inputs",IDC_DISABLE_LOCAL_INPUTS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,150,82,83,12
-    CONTROL         "Alternate keyboard method",IDC_JAP_INPUTS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,150,95,89,18
-    GROUPBOX        "Query on incoming connection",IDC_STATIC,250,3,136,53,BS_LEFT
-    CONTROL         "Display Query Window",IDQUERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,257,15,86,10
-    LTEXT           "Timeout:",IDC_STATIC,275,29,28,8
-    EDITTEXT        IDQUERYTIMEOUT,308,27,19,12,ES_AUTOHSCROLL
-    LTEXT           "seconds",IDC_STATIC,330,29,29,8
-    LTEXT           "Default action:",IDC_STATIC,257,43,47,8
-    CONTROL         "Refuse",IDC_DREFUSE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,307,43,39,10
-    CONTROL         "Accept",IDC_DACCEPT,"Button",BS_AUTORADIOBUTTON,346,43,37,10
-    GROUPBOX        "Multi viewer connections",IDC_STATIC,250,59,136,60,BS_LEFT
-    CONTROL         "Disconnect all existing connections",IDC_MV1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,255,71,127,10
-    CONTROL         "Keep existing connections",IDC_MV2,"Button",BS_AUTORADIOBUTTON,255,81,104,10
-    CONTROL         "Refuse the new connection",IDC_MV3,"Button",BS_AUTORADIOBUTTON,255,92,103,9
-    CONTROL         "Refuse all new connection ",IDC_MV4,"Button",BS_AUTORADIOBUTTON,255,103,102,10
-    GROUPBOX        "Authentication",IDC_STATIC,6,122,210,88,BS_LEFT
-    LTEXT           "VNC Password:",IDC_PASSWORD_LABEL,33,136,50,11,SS_CENTERIMAGE
-    EDITTEXT        IDC_PASSWORD,85,135,74,13,ES_PASSWORD | ES_AUTOHSCROLL
-    LTEXT           "View-Only Password:",IDC_PASSWORD_LABEL2,14,150,69,11,SS_CENTERIMAGE
-    EDITTEXT        IDC_PASSWORD2,85,150,74,13,ES_PASSWORD | ES_AUTOHSCROLL
-    CONTROL         "Require MS Logon  (User/Pass./Domain)",IDC_MSLOGON_CHECKD,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,164,146,10
-    CONTROL         "New MS Logon (supports multiple domains)",IDC_NEW_MSLOGON,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,175,153,11
-    PUSHBUTTON      "Configure MS Logon Groups",IDC_MSLOGON,13,190,195,12
-    GROUPBOX        "Misc.",IDC_STATIC,221,122,165,116,BS_LEFT
-    CONTROL         "Remove Aero (Vista)",IDC_REMOVE_Aero,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,130,81,10
-    CONTROL         "Remove Wallpaper for Viewers",IDC_REMOVE_WALLPAPER,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,140,134,10
-    CONTROL         "Enable Blank Monitor on Viewer Request",IDC_BLANK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,151,144,10
-    CONTROL         "Disable Only Inputs on Blanking Request",IDC_BLANK2,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,161,142,10
-    CONTROL         "Enable Alpha-Blending Monitor Blanking",IDC_ALPHABLACK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,172,142,10
-    CONTROL         "Capture Alpha-Blending",IDC_ALPHA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,183,99,10
-    CONTROL         "DisableTrayIcon",IDC_DISABLETRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,194,67,10
-    CONTROL         "Disable clients options in tray icon menu",IDC_ALLOWEDITCLIENTS,
-                    "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,228,205,141,10
-    CONTROL         "Forbid the user to close down WinVNC",IDC_ALLOWSHUTDOWN,
-                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,228,216,135,10
-    LTEXT           "Default Server Screen Scale:",IDC_STATIC,237,225,92,8
-    LTEXT           "1 / ",IDC_STATIC,348,225,12,8
-    EDITTEXT        IDC_SCALE,363,222,12,12,ES_AUTOHSCROLL
-    GROUPBOX        "File Transfer",IDC_STATIC,6,213,210,25
-    CONTROL         "Enable",IDC_FILETRANSFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,224,38,10
-    CONTROL         "User impersonation (for Service only)",IDC_FTUSERIMPERSONATION_CHECK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,224,133,10
-    GROUPBOX        "DSM Plugin",IDC_STATIC,5,241,211,32,BS_LEFT
-    CONTROL         "Use :",IDC_PLUGIN_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,255,31,10
-    COMBOBOX        IDC_PLUGINS_COMBO,45,253,129,86,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "Config.",IDC_PLUGIN_BUTTON,179,253,29,12
-    GROUPBOX        "Logging",IDC_STATIC,221,241,165,51
-    CONTROL         "Log debug infos to the WinVNC.log file",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,251,139,10
-    CONTROL         "Log to video",IDC_VIDEO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,262,58,10
-    PUSHBUTTON      "Clear avi encoder",IDC_CLEAR,297,262,75,9
-    LTEXT           "Path:",IDC_STATIC,229,276,18,8
-    EDITTEXT        IDC_EDIT_PATH,250,274,132,14,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "&OK",IDOK,32,279,43,14
-    PUSHBUTTON      "&Apply",IDC_APPLY,81,279,43,14
-    PUSHBUTTON      "&Cancel",IDCANCEL,129,279,44,14
-    RTEXT           "N�",IDC_STATIC,53,42,9,8
-END
-
-IDD_ABOUT1 DIALOGEX 0, 0, 286, 222
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION " Info"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,210,204,54,16
-    CONTROL         153,IDC_VNCLOGO,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_SUNKEN,7,5,269,199,WS_EX_TRANSPARENT
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
-    IDD_TEXTCHAT_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 5
-        RIGHTMARGIN, 303
-        TOPMARGIN, 5
-        BOTTOMMARGIN, 172
-    END
-
-    IDD_LIST_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 281
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 116
-    END
-
-    IDD_ABOUT, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 275
-        VERTGUIDE, 80
-        VERTGUIDE, 90
-        VERTGUIDE, 100
-        VERTGUIDE, 120
-        TOPMARGIN, 5
-        HORZGUIDE, 9
-        HORZGUIDE, 20
-        HORZGUIDE, 30
-        HORZGUIDE, 40
-        HORZGUIDE, 50
-        HORZGUIDE, 60
-        HORZGUIDE, 70
-        HORZGUIDE, 80
-        HORZGUIDE, 90
-        HORZGUIDE, 100
-    END
-
-    IDD_OUTGOING_CONN, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 216
-        VERTGUIDE, 50
-        VERTGUIDE, 55
-        VERTGUIDE, 185
-        VERTGUIDE, 190
-        TOPMARGIN, 6
-        BOTTOMMARGIN, 95
-        HORZGUIDE, 20
-        HORZGUIDE, 49
-    END
-
-    IDD_ACCEPT_CONN, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 179
-        VERTGUIDE, 60
-        VERTGUIDE, 130
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 88
-        HORZGUIDE, 24
-        HORZGUIDE, 30
-        HORZGUIDE, 46
-        HORZGUIDE, 50
-        HORZGUIDE, 65
-        HORZGUIDE, 74
-    END
-
-    IDD_PROPERTIES, DIALOG
-    BEGIN
-        VERTGUIDE, 14
-        BOTTOMMARGIN, 172
-    END
-
-    IDD_PROPERTIES1, DIALOG
-    BEGIN
-        VERTGUIDE, 150
-        VERTGUIDE, 257
-        BOTTOMMARGIN, 280
-        HORZGUIDE, 270
-    END
-
-    IDD_ABOUT1, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 282
-        VERTGUIDE, 80
-        VERTGUIDE, 90
-        VERTGUIDE, 100
-        VERTGUIDE, 120
-        TOPMARGIN, 5
-        BOTTOMMARGIN, 158
-        HORZGUIDE, 9
-        HORZGUIDE, 20
-        HORZGUIDE, 30
-        HORZGUIDE, 40
-        HORZGUIDE, 50
-        HORZGUIDE, 60
-        HORZGUIDE, 70
-        HORZGUIDE, 80
-        HORZGUIDE, 90
-        HORZGUIDE, 100
-    END
-END
-#endif    // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,9,6
- PRODUCTVERSION 1,0,9,6
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x2dL
-#else
- FILEFLAGS 0x2cL
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "000004b0"
-        BEGIN
-            VALUE "Comments", "UltraVNC - Remote Control for all"
-            VALUE "CompanyName", "UltraVNC"
-            VALUE "FileDescription", "VNC server for win32"
-            VALUE "FileVersion", "1.0.9.6.1"
-            VALUE "InternalName", "WinVNC"
-            VALUE "LegalCopyright", "Copyright � 2010 UltraVNC"
-            VALUE "LegalTrademarks", "VNC"
-            VALUE "OriginalFilename", "WinVNC.exe"
-            VALUE "PrivateBuild", "1.0.9.6.1"
-            VALUE "ProductName", "UltraVNC"
-            VALUE "ProductVersion", "1.0.9.6.1"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x0, 1200
-    END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_TRAYMENU MENU
-BEGIN
-    POPUP "tray"
-    BEGIN
-        MENUITEM "&Properties",                 ID_PROPERTIES
-        MENUITEM "&Admin Properties",           ID_ADMIN_PROPERTIES
-        MENUITEM SEPARATOR
-        MENUITEM "&About WinVNC",               ID_ABOUT
-        POPUP "Visit our site"
-        BEGIN
-            MENUITEM "Homepage",                    ID_VISITUSONLINE_HOMEPAGE
-            MENUITEM "Forum",                       ID_VISITUSONLINE_FORUM
-        END
-        MENUITEM SEPARATOR
-        MENUITEM "Add &New Client",             ID_OUTGOING_CONN
-        MENUITEM "&Kill All Clients",           ID_KILLCLIENTS
-        MENUITEM SEPARATOR
-        MENUITEM "&List All Clients",           ID_LISTCLIENTS
-        MENUITEM SEPARATOR
-        MENUITEM "Install Service",             ID_RUNASSERVICE
-        MENUITEM "Uninstall Service",           ID_UNINSTALL_SERVICE
-        MENUITEM "Stop Service",                ID_CLOSE_SERVICE
-        MENUITEM "Start Service (must be installed first)", ID_START_SERVICE
-        MENUITEM "Fix1 SoftwareCad",            ID_SOFTWARECAD
-        MENUITEM "Fix2 SoftwareCad",            ID_DELSOFTWARECAD
-        MENUITEM "Reboot in safemode",          ID_REBOOTSAFEMODE
-        MENUITEM "Force Reboot (unsafe)",       ID_REBOOT_FORCE
-        MENUITEM SEPARATOR
-        MENUITEM "&Close VNC Connections",      ID_CLOSE
-    END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVAARCHIVE
-//
-
-IDR_VNCVIEWER_JAR       JAVAARCHIVE             "res\\vncviewer.jar"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE
-BEGIN
-    IDI_WINVNC              "WinVNC"
-    IDS_WARNING             "WARNING: By default, this session do not use any encryption whatsoever. Please do not use it to send sensitive data unless you are sure your connection is secure.\n\n"
-END
-
-STRINGTABLE
-BEGIN
-    ID_FAILED_INIT          "Failed to initialise the socket system"
-    ID_WINVNC_USAGE         "WinVNC Usage"
-    ID_ANOTHER_INST         "Another instance of WinVNC is already running"
-    ID_NO_EXIST_INST        "No existing instance of WinVNC could be contacted"
-    ID_UNABLE_INST          "Unable to install WinVNC service"
-    ID_SCM_NOT_HERE         "The SCM could not be contacted - the WinVNC service was not installed"
-    ID_SERV_NOT_REG         "The WinVNC service could not be registered"
-    ID_SERV_FAIL_ST         "The WinVNC service failed to start"
-END
-
-STRINGTABLE
-BEGIN
-    ID_SERV_CT_MISS         "The Service Control Manager could not be contacted - the WinVNC service was not registered"
-    ID_SERV_OLD_REG         "The WinVNC service is already registered"
-    ID_SERVHELP_UNAB        "WARNING:Unable to install the ServiceHelper hook\nGlobal user-specific registry settings will not be loaded"
-    ID_SERV_CT_UNREG        "The Service Control Manager could not be contacted - the WinVNC service was not unregistered"
-    ID_SERV_NOT_UNRG        "The WinVNC service could not be unregistered"
-    ID_SERV_NCONTACT        "The WinVNC service could not be contacted"
-    ID_SERVHELP_NREM        "WARNING:The ServiceHelper hook entry could not be removed from the registry"
-    ID_SERV_NOT_STOP        "The WinVNC service could not be stopped"
-    ID_SERV_MK_UNREG        "The WinVNC service is already marked to be unregistered"
-    ID_SERV_NT_FOUND        "The WinVNC service could not be found"
-    ID_WINVNC_ERROR         "WinVNC Error"
-    ID_WINVNC_WARNIN        "WinVNC Warning"
-    ID_PLUGIN_LOADIN        "Plugin Loading"
-    ID_NO_PASSWD_NO_OVERRIDE_ERR 
-                            "No password has been set & this machine has been preconfigured to prevent users from setting their own.\nYou must contact a System Administrator to configure WinVNC properly."
-    ID_NO_PASSWD_NO_OVERRIDE_WARN 
-                            "WARNING : This machine has been preconfigured to allow un-authenticated\nconnections to be accepted and to prevent users from enabling authentication."
-    ID_NO_PASSWD_NO_LOGON_WARN 
-                            "WARNING : This machine has no default password set.  WinVNC will present the Default Properties dialog now to allow one to be entered."
-END
-
-STRINGTABLE
-BEGIN
-    ID_NO_OVERRIDE_ERR      "This machine has been preconfigured with WinVNC settings, which cannot be overridden by individual users.  The preconfigured settings may be modified only by a System Administrator."
-    ID_NO_CURRENT_USER_ERR  "The WinVNC settings for the current user are unavailable at present."
-    ID_CANNOT_EDIT_DEFAULT_PREFS 
-                            "You do not have sufficient priviliges to edit the default local WinVNC settings."
-    ID_NO_PASSWORD_WARN     "WARNING : Running WinVNC without setting a password is a dangerous security risk!\nUntil you set a password, WinVNC will not accept incoming connections."
-    ID_PLUGIN_NOT_LOAD      "The Plugin cannot be loaded.\n\rPlease check its integrity."
-    ID_MB1                  "MB1"
-    ID_WVNC                 "WVNC"
-    ID_AUTHAD_NOT_FO        "You selected ms-logon, but the authad.dll\nwas not found.Check you installation"
-    ID_WARNING              "WARNING"
-    ID_AUTH_NOT_FO          "You selected ms-logon, but the auth.dll\nwas not found.Check you installation"
-    ID_DESKTOP_BITBLT_ROOT  "vncDesktop : root device doesn't support BitBlt\nWinVNC cannot be used with this graphic device driver"
-    ID_DESKTOP_BITBLT_MEM   "vncDesktop : memory device doesn't support GetDIBits\nWinVNC cannot be used with this graphics device driver"
-    ID_DESKTOP_PLANAR_NOTC  "vncDesktop : current display is PLANAR, not CHUNKY!\nWinVNC cannot be used with this graphics device driver"
-    ID_FAILED_CONNECT_LISTING_VIEW "Failed to connect to listening VNC viewer"
-    ID_OUTGOING_CONNECTION  "Outgoing Connection"
-    ID_UNABLE_PROC_MSLOGON  "Unable to process MS logon"
-END
-
-STRINGTABLE
-BEGIN
-    ID_RICHED32_UNLOAD      "Unable to load the Rich Edit (RICHED32.DLL) control!"
-    ID_RICHED32_DLL_LD      "Rich Edit Dll Loading"
-    ID_SERV_SUCCESS_INST    "The WinVNC service was successfully installed\nThe service will start now and will automatically\nbe run the next time this machine is reset"
-    ID_SERV_SUCCESS_REG     "The WinVNC service was successfully registered\nThe service may be started from the Control Panel, and will\nautomatically be run the next time this machine is reset"
-    ID_SERV_SUCCESS_UNREG   "The WinVNC service has been unregistered"
-    ID_ULTRAVNC_TEXTCHAT    "The selected client is not an Ultr at VNC Viewer !\nIt presumably does not support TextChat\n"
-    ID_ULTRAVNC_WARNING     "Ultr at VNC Warning"
-    ID_NO_PLUGIN_DETECT     "No Plugin detected..."
-    ID_CHAT_WITH_S_ULTRAVNC " Chat with <%s> - Ultr at VNC"
-    ID_CURRENT_USER_PROP    "WinVNC: Current User Properties"
-    ID_DEFAULT_SYST_PROP    "WinVNC: Default Local System Properties"
-    ID_AUTOREJECT_U         "AutoReject:%u"
-    ID_AUTOACCEPT_U         "AutoAccept:%u"
-    ID_CADERROR             "Ctrl-alt-del require service, no permission"
-    ID_CADERRORFILE         "The file cad.exe was not found in the same folder as winvnc"
-    ID_CADPERMISSION        "Permission denied on cad.exe, Ultravnc must be installed in ""program files"" else special cad permission is refused."
-END
-
-#endif    // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United Kingdom) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
-#pragma code_page(1252)
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE 
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
-
-3 TEXTINCLUDE 
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-#endif    // English (United Kingdom) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Dutch (Belgium) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLB)
-LANGUAGE LANG_DUTCH, SUBLANG_DUTCH_BELGIAN
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVACLASS
-//
-
-IDR_JAVACLASS1          JAVACLASS               "res\\mslogon\\AuthPanel.class"
-IDR_JAVACLASS2          JAVACLASS               "res\\mslogon\\ButtonPanel.class"
-IDR_JAVACLASS3          JAVACLASS               "res\\mslogon\\ClipboardFrame.class"
-IDR_JAVACLASS4          JAVACLASS               "res\\mslogon\\DesCipher.class"
-IDR_JAVACLASS5          JAVACLASS               "res\\mslogon\\DH.class"
-IDR_JAVACLASS6          JAVACLASS               "res\\mslogon\\FTPFrame$StrComp.class"
-IDR_JAVACLASS7          JAVACLASS               "res\\mslogon\\FTPFrame.class"
-IDR_JAVACLASS8          JAVACLASS               "res\\mslogon\\OptionsFrame.class"
-IDR_JAVACLASS9          JAVACLASS               "res\\mslogon\\RecordingFrame.class"
-IDR_JAVACLASS10         JAVACLASS               "res\\mslogon\\RfbProto.class"
-IDR_JAVACLASS11         JAVACLASS               "res\\mslogon\\SessionRecorder.class"
-IDR_JAVACLASS12         JAVACLASS               "res\\mslogon\\VncCanvas.class"
-IDR_JAVACLASS13         JAVACLASS               "res\\mslogon\\VncViewer.class"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_MSLOGON DIALOGEX 0, 0, 186, 166
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "MS logon setup"
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
-    GROUPBOX        "",IDC_STATIC,5,0,178,74
-    LTEXT           "Group",IDC_STATIC,23,8,20,8
-    LTEXT           "Local",IDC_STATIC,127,8,18,8
-    LTEXT           "Domain",IDC_STATIC,153,8,25,8
-    EDITTEXT        IDC_GROUP1,21,19,93,13,ES_AUTOHSCROLL
-    CONTROL         "",IDC_CHECKG1L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,20,13,10
-    CONTROL         "",IDC_CHECKG1D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,22,16,8
-    EDITTEXT        IDC_GROUP2,21,36,93,13,ES_AUTOHSCROLL
-    CONTROL         "",IDC_CHECKG2L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,38,16,8
-    CONTROL         "",IDC_CHECKG2D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,38,16,8
-    EDITTEXT        IDC_GROUP3,21,53,93,13,ES_AUTOHSCROLL
-    CONTROL         "",IDC_CHECKG3L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,56,16,8
-    CONTROL         "",IDC_CHECKG3D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,56,16,8
-    GROUPBOX        "Rules",IDC_STATIC,5,77,178,68
-    LTEXT           "Group 1, 2 = Full Access       Group 3 = Read Only",IDC_STATIC,16,88,162,8
-    LTEXT           "Must be run as a Service on NT4, W2K\nCan be run as a Service or Application on XP, W2003\nLocal admins have always access.\nFor NT4 and W2K in Application mode you need to add the Local Admin Group.",IDC_STATIC,8,100,174,41
-    DEFPUSHBUTTON   "OK",IDOK,77,148,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,132,148,50,14
-    LTEXT           "1",IDC_STATIC,11,22,8,8
-    LTEXT           "2",IDC_STATIC,11,38,8,8
-    LTEXT           "3",IDC_STATIC,11,56,8,8
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
-    IDD_MSLOGON, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 182
-        VERTGUIDE, 17
-        VERTGUIDE, 110
-        VERTGUIDE, 123
-        VERTGUIDE, 149
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 162
-        HORZGUIDE, 46
-        HORZGUIDE, 66
-        HORZGUIDE, 88
-        HORZGUIDE, 105
-        HORZGUIDE, 164
-    END
-END
-#endif    // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVAARCHIVE
-//
-
-IDR_JAVAARCHIVE1        JAVAARCHIVE             "res\\mslogon\\VncViewer.jar"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_WINVNC              ICON                    "res\\world3a.ico"
-IDI_FLASH               ICON                    "res\\icon2.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_LOGO64              BITMAP                  "res\\vnc-1.bmp"
-#endif    // Dutch (Belgium) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/winvnc/winvnc/winvnc.vcproj b/ica/win32/winvnc/winvnc/winvnc.vcproj
deleted file mode 100644
index 4ca7482..0000000
--- a/ica/win32/winvnc/winvnc/winvnc.vcproj
+++ /dev/null
@@ -1,4444 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9,00"
-	Name="winvnc"
-	ProjectGUID="{C05AE605-1250-4F58-911B-EC99AE2C25AF}"
-	RootNamespace="winvnc"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\..\Debug"
-			IntermediateDirectory=".\..\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\..\Debug/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="_DEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_CRT_SECURE_NO_WARNINGS;_VC80;_WIN32_IE=0x0600"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\..\Debug/winvnc.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				BrowseInformation="1"
-				BrowseInformationFile=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MTd /Fo..\Debug\ /Fd..\Debug\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Debug/winvnc.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/winvnc.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				FixedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\Debug/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="_DEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_CRT_SECURE_NO_WARNINGS;_VC80;_X64"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\..\Debug/winvnc.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				BrowseInformation="1"
-				BrowseInformationFile=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MTd /Fo..\Debug\ /Fd..\Debug\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Debug/winvnc.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/winvnc.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\..\Release"
-			IntermediateDirectory=".\..\Release"
-			ConfigurationType="1"
-			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/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				EnableFiberSafeOptimizations="true"
-				WholeProgramOptimization="true"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;_WIN32_IE=0x0600"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				StructMemberAlignment="5"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/LTCG"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Release/winvnc_32.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				GenerateManifest="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="0"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="1"
-			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="3"
-				TypeLibraryName=".\..\Release/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;_X64"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Release/winvnc_64.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="IPP|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			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/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="3"
-				InlineFunctionExpansion="2"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				EnableFiberSafeOptimizations="true"
-				WholeProgramOptimization="true"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;IPP"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/LTCG"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib ippjemerged.lib ippiemerged.lib ippsemerged.lib ippjmerged.lib ippimerged.lib ippsmerged.lib ippcorel.lib ippdcemerged.lib ippdcmerged.lib ippcpmerged.lib ippcpemerged.lib"
-				OutputFile=".\..\Release/winvnc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				GenerateManifest="true"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="IPP|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="1"
-			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="3"
-				TypeLibraryName=".\..\Release/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;_X64"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Release/winvnc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<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=".\benchmark.cpp"
-				>
-			</File>
-			<File
-				RelativePath="black_layered.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="buildtime.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\common\Clipboard.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\CpuUsage.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\CpuUsage.h"
-				>
-			</File>
-			<File
-				RelativePath="d3des.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\rfb\dh.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\DSMPlugin\DSMPlugin.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\Dtwinver.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Dtwinver.h"
-				>
-			</File>
-			<File
-				RelativePath=".\getinfo.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\helpers.cpp"
-				>
-			</File>
-			<File
-				RelativePath="HideDesktop.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\httpconnect.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\httpconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="inifile.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\initipp.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\IPC.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\lzo\minilzo.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\read_write_ini.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\rfbRegion_win32.cpp"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_X11.cxx"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="rfbUpdateTracker.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="security.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\service.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\service_motor.cpp"
-				>
-			</File>
-			<File
-				RelativePath="stdhdrs.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tableinitcmtemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tableinittctemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tabletranstemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="TextChat.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="translate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="videodriver.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="videodrivercheck.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\vistahook.cpp"
-				>
-			</File>
-			<File
-				RelativePath="vncabout.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncacceptdialog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncauth.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncbuffer.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncclient.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncconndialog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncdesktop.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\vncdesktopsink.cpp"
-				>
-			</File>
-			<File
-				RelativePath="vncDesktopSW.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncdesktopthread.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodecorre.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodehext.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoder.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoderCursor.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoderre.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeTight.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeUltra.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\vncEncodeUltra2.cpp"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeZlib.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeZlibHex.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodezrle.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnchttpconnect.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncinsthandler.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnckeymap.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncListDlg.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnclog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncmenu.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncMultiMonitor.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncntlm.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncOSVersion.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncproperties.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncpropertiesPoll.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncserver.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncservice.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncsetauth.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncsockconnect.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnctimedmsgbox.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vsocket.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\common\win32_helpers.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\common\win32_helpers.h"
-				>
-			</File>
-			<File
-				RelativePath="winvnc.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="winvnc.rc"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="IPP|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\ZipUnZip32\ZipUnzip32.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ZipUnZip32\ZipUnZip32.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="..\..\common\Clipboard.h"
-				>
-			</File>
-			<File
-				RelativePath="d3des.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\rfb\dh.h"
-				>
-			</File>
-			<File
-				RelativePath=".\dpi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\DSMPlugin\DSMPlugin.h"
-				>
-			</File>
-			<File
-				RelativePath="HideDesktop.h"
-				>
-			</File>
-			<File
-				RelativePath="inifile.h"
-				>
-			</File>
-			<File
-				RelativePath=".\IPC.h"
-				>
-			</File>
-			<File
-				RelativePath="keysymdef.h"
-				>
-			</File>
-			<File
-				RelativePath=".\LinkLabel.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\common\md5.h"
-				>
-			</File>
-			<File
-				RelativePath="MultiMon.h"
-				>
-			</File>
-			<File
-				RelativePath="resource.h"
-				>
-			</File>
-			<File
-				RelativePath="rfb.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbMisc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\rfb\rfbproto.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRect.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_win32.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_X11.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbUpdateTracker.h"
-				>
-			</File>
-			<File
-				RelativePath="stdhdrs.h"
-				>
-			</File>
-			<File
-				RelativePath="TextChat.h"
-				>
-			</File>
-			<File
-				RelativePath="translate.h"
-				>
-			</File>
-			<File
-				RelativePath="videodriver.h"
-				>
-			</File>
-			<File
-				RelativePath="vnc.hh"
-				>
-			</File>
-			<File
-				RelativePath="vncabout.h"
-				>
-			</File>
-			<File
-				RelativePath="vncacceptdialog.h"
-				>
-			</File>
-			<File
-				RelativePath="vncauth.h"
-				>
-			</File>
-			<File
-				RelativePath="vncbuffer.h"
-				>
-			</File>
-			<File
-				RelativePath="vncclient.h"
-				>
-			</File>
-			<File
-				RelativePath="vncconndialog.h"
-				>
-			</File>
-			<File
-				RelativePath="vnccorbaconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vncdesktop.h"
-				>
-			</File>
-			<File
-				RelativePath="vncdesktopthread.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodecorre.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodehext.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodemgr.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencoder.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencoderre.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeTight.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeUltra.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeZlib.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeZlibHex.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodezrle.h"
-				>
-			</File>
-			<File
-				RelativePath="vnchttpconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vncinsthandler.h"
-				>
-			</File>
-			<File
-				RelativePath="vnckeymap.h"
-				>
-			</File>
-			<File
-				RelativePath="vncListDlg.h"
-				>
-			</File>
-			<File
-				RelativePath="vnclog.h"
-				>
-			</File>
-			<File
-				RelativePath="vncmenu.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpasswd.h"
-				>
-			</File>
-			<File
-				RelativePath="vncproperties.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpropertiesPoll.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpropPath.h"
-				>
-			</File>
-			<File
-				RelativePath="vncserver.h"
-				>
-			</File>
-			<File
-				RelativePath="vncservice.h"
-				>
-			</File>
-			<File
-				RelativePath="vncsetauth.h"
-				>
-			</File>
-			<File
-				RelativePath="vncsockconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vnctimedmsgbox.h"
-				>
-			</File>
-			<File
-				RelativePath="vsocket.h"
-				>
-			</File>
-			<File
-				RelativePath="vtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="winvnc.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-			<File
-				RelativePath="res\background.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\background2.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\clipboardframe.class"
-				>
-			</File>
-			<File
-				RelativePath="res\descipher.class"
-				>
-			</File>
-			<File
-				RelativePath=".\res\Finger.cur"
-				>
-			</File>
-			<File
-				RelativePath="res\ico00001.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\icon1.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\icon2.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\optionsframe.class"
-				>
-			</File>
-			<File
-				RelativePath="res\rfbproto.class"
-				>
-			</File>
-			<File
-				RelativePath=".\res\runas.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vdacc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc-1.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc-1.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="vnc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc64.BMP"
-				>
-			</File>
-			<File
-				RelativePath="res\vnccanvas.class"
-				>
-			</File>
-			<File
-				RelativePath="res\vncviewer.class"
-				>
-			</File>
-			<File
-				RelativePath="res\vncviewer.jar"
-				>
-			</File>
-			<File
-				RelativePath="res\winvnc.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\world3a.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\ww-grn-sq2.ico"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath="res\AuthPanel.class"
-			>
-		</File>
-		<File
-			RelativePath="..\building.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\..\BUILDING.txt"
-			>
-		</File>
-		<File
-			RelativePath="res\ButtonPanel.class"
-			>
-		</File>
-		<File
-			RelativePath="res\DH.class"
-			>
-		</File>
-		<File
-			RelativePath=".\res\ding_dong.wav"
-			>
-		</File>
-		<File
-			RelativePath=".\res\ftpframe$strcomp.class"
-			>
-		</File>
-		<File
-			RelativePath="res\FTPFrame.class"
-			>
-		</File>
-		<File
-			RelativePath="..\history.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\..\LICENCE.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\README_BINARY.txt"
-			>
-		</File>
-		<File
-			RelativePath="res\RecordingFrame.class"
-			>
-		</File>
-		<File
-			RelativePath="res\SessionRecorder.class"
-			>
-		</File>
-		<File
-			RelativePath=".\VTune\winvnc.vpj"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/ica/win32/winvnc/winvnc/winvncVS2005.vcproj b/ica/win32/winvnc/winvnc/winvncVS2005.vcproj
deleted file mode 100644
index d34fbf5..0000000
--- a/ica/win32/winvnc/winvnc/winvncVS2005.vcproj
+++ /dev/null
@@ -1,3213 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8,00"
-	Name="winvnc"
-	ProjectGUID="{C05AE605-1250-4F58-911B-EC99AE2C25AF}"
-	RootNamespace="winvnc"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\..\Debug"
-			IntermediateDirectory=".\..\Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\..\Debug/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="_DEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_CRT_SECURE_NO_WARNINGS;_VC80;_WIN32_IE=0x0500"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\..\Debug/winvnc.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				BrowseInformation="1"
-				BrowseInformationFile=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MTd /Fo..\Debug\ /Fd..\Debug\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib userenv.lib wtsapi32.lib"
-				OutputFile=".\..\Debug/winvnc.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateManifest="false"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/winvnc.pdb"
-				SubSystem="2"
-				TargetMachine="1"
-				FixedBaseAddress="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\..\Release"
-			IntermediateDirectory=".\..\Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.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/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;AVILOG"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Release/winvnc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				GenerateManifest="false"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\Debug/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="_DEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_CRT_SECURE_NO_WARNINGS;_VC80"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\..\Debug/winvnc.pch"
-				AssemblerListingLocation=".\..\Debug/"
-				ObjectFile=".\..\Debug/"
-				ProgramDataBaseFileName=".\..\Debug/"
-				BrowseInformation="1"
-				BrowseInformationFile=".\..\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MTd /Fo..\Debug\ /Fd..\Debug\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib userenv.lib wtsapi32.lib"
-				OutputFile=".\..\Debug/winvnc.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\..\Debug/winvnc.pdb"
-				SubSystem="2"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Debug/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.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="3"
-				TypeLibraryName=".\..\Release/winvnc.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\omnithread,..,..\.."
-				PreprocessorDefinitions="NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS;_X64"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\..\Release/winvnc.pch"
-				AssemblerListingLocation=".\..\Release/"
-				ObjectFile=".\..\Release/"
-				ProgramDataBaseFileName=".\..\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-				CommandLine="cl /nologo /MT /Fo..\Release\ /Fd..\Release\ /c buildtime.cpp"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib winmm.lib version.lib comctl32.lib wtsapi32.lib userenv.lib"
-				OutputFile=".\..\Release/winvnc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ProgramDatabaseFile=".\..\Release/winvnc.pdb"
-				SubSystem="2"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\..\Release/winvnc.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<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="black_layered.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="buildtime.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\CpuUsage.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\CpuUsage.h"
-				>
-			</File>
-			<File
-				RelativePath="d3des.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\rfb\dh.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\DSMPlugin\DSMPlugin.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\Dtwinver.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Dtwinver.h"
-				>
-			</File>
-			<File
-				RelativePath=".\getinfo.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\helpers.cpp"
-				>
-			</File>
-			<File
-				RelativePath="HideDesktop.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="inifile.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\IPC.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\lzo\minilzo.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\read_write_ini.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\rfbRegion_win32.cpp"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_X11.cxx"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="rfbUpdateTracker.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="security.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\service.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\service_motor.cpp"
-				>
-			</File>
-			<File
-				RelativePath="stdhdrs.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tableinitcmtemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tableinittctemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tabletranstemplate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="TextChat.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="translate.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="videodriver.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="videodrivercheck.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\vistahook.cpp"
-				>
-			</File>
-			<File
-				RelativePath="vncabout.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncacceptdialog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncauth.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncbuffer.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncclient.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncconndialog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncdesktop.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\vncdesktopsink.cpp"
-				>
-			</File>
-			<File
-				RelativePath="vncDesktopSW.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncdesktopthread.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodecorre.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodehext.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoder.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoderCursor.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencoderre.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeTight.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeUltra.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeZlib.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncEncodeZlibHex.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncencodezrle.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnchttpconnect.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncinsthandler.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnckeymap.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncListDlg.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnclog.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncmenu.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncMultiMonitor.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncntlm.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncOSVersion.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncproperties.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncpropertiesPoll.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncserver.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncservice.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncsetauth.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vncsockconnect.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vnctimedmsgbox.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="vsocket.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\common\win32_helpers.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\common\win32_helpers.h"
-				>
-			</File>
-			<File
-				RelativePath="winvnc.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="winvnc.rc"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\ZipUnZip32\ZipUnzip32.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="d3des.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\rfb\dh.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\DSMPlugin\DSMPlugin.h"
-				>
-			</File>
-			<File
-				RelativePath="inifile.h"
-				>
-			</File>
-			<File
-				RelativePath=".\IPC.h"
-				>
-			</File>
-			<File
-				RelativePath="keysymdef.h"
-				>
-			</File>
-			<File
-				RelativePath=".\LinkLabel.h"
-				>
-			</File>
-			<File
-				RelativePath="MultiMon.h"
-				>
-			</File>
-			<File
-				RelativePath="resource.h"
-				>
-			</File>
-			<File
-				RelativePath="rfb.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbMisc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\rfb\rfbproto.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRect.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_win32.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbRegion_X11.h"
-				>
-			</File>
-			<File
-				RelativePath="rfbUpdateTracker.h"
-				>
-			</File>
-			<File
-				RelativePath="stdhdrs.h"
-				>
-			</File>
-			<File
-				RelativePath="TextChat.h"
-				>
-			</File>
-			<File
-				RelativePath="translate.h"
-				>
-			</File>
-			<File
-				RelativePath="videodriver.h"
-				>
-			</File>
-			<File
-				RelativePath="vnc.hh"
-				>
-			</File>
-			<File
-				RelativePath="vncabout.h"
-				>
-			</File>
-			<File
-				RelativePath="vncacceptdialog.h"
-				>
-			</File>
-			<File
-				RelativePath="vncauth.h"
-				>
-			</File>
-			<File
-				RelativePath="vncbuffer.h"
-				>
-			</File>
-			<File
-				RelativePath="vncclient.h"
-				>
-			</File>
-			<File
-				RelativePath="vncconndialog.h"
-				>
-			</File>
-			<File
-				RelativePath="vnccorbaconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vncdesktop.h"
-				>
-			</File>
-			<File
-				RelativePath="vncdesktopthread.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodecorre.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodehext.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodemgr.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencoder.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencoderre.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeTight.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeUltra.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeZlib.h"
-				>
-			</File>
-			<File
-				RelativePath="vncEncodeZlibHex.h"
-				>
-			</File>
-			<File
-				RelativePath="vncencodezrle.h"
-				>
-			</File>
-			<File
-				RelativePath="vnchttpconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vncinsthandler.h"
-				>
-			</File>
-			<File
-				RelativePath="vnckeymap.h"
-				>
-			</File>
-			<File
-				RelativePath="vncListDlg.h"
-				>
-			</File>
-			<File
-				RelativePath="vnclog.h"
-				>
-			</File>
-			<File
-				RelativePath="vncmenu.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpasswd.h"
-				>
-			</File>
-			<File
-				RelativePath="vncproperties.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpropertiesPoll.h"
-				>
-			</File>
-			<File
-				RelativePath="vncpropPath.h"
-				>
-			</File>
-			<File
-				RelativePath="vncserver.h"
-				>
-			</File>
-			<File
-				RelativePath="vncservice.h"
-				>
-			</File>
-			<File
-				RelativePath="vncsetauth.h"
-				>
-			</File>
-			<File
-				RelativePath="vncsockconnect.h"
-				>
-			</File>
-			<File
-				RelativePath="vnctimedmsgbox.h"
-				>
-			</File>
-			<File
-				RelativePath="vsocket.h"
-				>
-			</File>
-			<File
-				RelativePath="vtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="winvnc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\ZipUnZip32\ZipUnZip32.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-			<File
-				RelativePath="res\background.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\background2.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\clipboardframe.class"
-				>
-			</File>
-			<File
-				RelativePath="res\descipher.class"
-				>
-			</File>
-			<File
-				RelativePath=".\res\Finger.cur"
-				>
-			</File>
-			<File
-				RelativePath="HideDesktop.h"
-				>
-			</File>
-			<File
-				RelativePath="res\ico00001.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\icon1.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\icon2.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\optionsframe.class"
-				>
-			</File>
-			<File
-				RelativePath="res\rfbproto.class"
-				>
-			</File>
-			<File
-				RelativePath=".\res\sec.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\vdacc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc-1.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc-1.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="vnc.bmp"
-				>
-			</File>
-			<File
-				RelativePath="res\vnc64.BMP"
-				>
-			</File>
-			<File
-				RelativePath="res\vnccanvas.class"
-				>
-			</File>
-			<File
-				RelativePath="res\vncviewer.class"
-				>
-			</File>
-			<File
-				RelativePath="res\vncviewer.jar"
-				>
-			</File>
-			<File
-				RelativePath="res\winvnc.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\world3a.ico"
-				>
-			</File>
-			<File
-				RelativePath="res\ww-grn-sq2.ico"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath="res\AuthPanel.class"
-			>
-		</File>
-		<File
-			RelativePath="..\building.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\..\BUILDING.txt"
-			>
-		</File>
-		<File
-			RelativePath="res\ButtonPanel.class"
-			>
-		</File>
-		<File
-			RelativePath="res\DH.class"
-			>
-		</File>
-		<File
-			RelativePath=".\res\ftpframe$strcomp.class"
-			>
-		</File>
-		<File
-			RelativePath="res\FTPFrame.class"
-			>
-		</File>
-		<File
-			RelativePath="..\history.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\..\LICENCE.txt"
-			>
-		</File>
-		<File
-			RelativePath="..\README_BINARY.txt"
-			>
-		</File>
-		<File
-			RelativePath="res\RecordingFrame.class"
-			>
-		</File>
-		<File
-			RelativePath="res\SessionRecorder.class"
-			>
-		</File>
-		<File
-			RelativePath="winvnc.exe.manifest"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/ica/win32/winvnc/winvnc/winvnc_fr.rc b/ica/win32/winvnc/winvnc/winvnc_fr.rc
deleted file mode 100644
index e4535bc..0000000
--- a/ica/win32/winvnc/winvnc/winvnc_fr.rc
+++ /dev/null
@@ -1,686 +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
-
-/////////////////////////////////////////////////////////////////////////////
-// French (France) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
-#ifdef _WIN32
-LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_TEXTCHAT_DLG DIALOGEX 0, 0, 307, 175
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION
-CAPTION " Chat - Ultr at VNC"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    EDITTEXT        IDC_INPUTAREA_EDIT,4,138,255,34,ES_MULTILINE | 
-                    ES_AUTOVSCROLL | ES_WANTRETURN | NOT WS_BORDER | 
-                    WS_VSCROLL,WS_EX_STATICEDGE
-    PUSHBUTTON      "Fermer",IDCANCEL,264,160,39,11
-    PUSHBUTTON      "",IDOK,301,0,6,6,NOT WS_VISIBLE
-    CONTROL         "",IDC_CHATAREA_EDIT,"RICHEDIT",ES_MULTILINE | 
-                    ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | 
-                    WS_VSCROLL | WS_TABSTOP,4,5,300,130,WS_EX_STATICEDGE
-    PUSHBUTTON      "Envoyer",IDC_SEND_B,264,138,39,19,BS_MULTILINE
-    LTEXT           "",IDC_STATIC_SPLIT,5,127,298,8,SS_NOTIFY
-END
-
-IDD_LIST_DLG DIALOGEX 0, 0, 164, 116
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION | 
-    WS_SYSMENU
-EXSTYLE WS_EX_TOOLWINDOW
-CAPTION " Liste des Clients - Ultr at VNC"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "Fermer",IDOK,106,94,50,14
-    PUSHBUTTON      "Annuler",IDCANCEL,106,78,50,14,NOT WS_VISIBLE
-    LTEXT           "Clients connect�s :",IDC_STATIC,5,4,105,8
-    LISTBOX         IDC_VIEWERS_LISTBOX,7,16,91,93,LBS_NOINTEGRALHEIGHT | 
-                    WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
-    PUSHBUTTON      "Tuer ce Client",IDC_KILL_B,106,17,50,14
-    PUSHBUTTON      "t'Chat avec ��ce�Client",IDC_TEXTCHAT_B,106,35,50,22,
-                    BS_MULTILINE
-END
-
-IDD_ABOUT DIALOGEX 0, 0, 282, 156
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION " A propos de WinVNC"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,8,132,54,16
-    CONTROL         139,IDC_VNCLOGO,"Static",SS_BITMAP | SS_CENTERIMAGE | 
-                    SS_SUNKEN,7,5,53,46,WS_EX_TRANSPARENT
-    LTEXT           "Ultr at VNC Win32 Serveur v1.0.0 RC 12",IDC_VERSION,73,5,
-                    195,9
-    LTEXT           "Copyright � 2002-2003 Ultr at VNC Team\nCopyright � 2001-2002 Sam - eSVNC \nCopyright � 1999-2002 Rudi D. V. - VdaccVNC \nCopyright � 2001 Harakan Software - PalmVNC\nCopyright � 1999-2002 Const. Kaplinsky - TightVNC \n",
-                    IDC_NAME,74,27,202,41
-    LTEXT           "Pour plus d'informations et liens, merci de visiter: \nhttp://ultravnc.sf.net",
-                    IDC_WWW,73,129,182,19
-    LTEXT           "Compilation:",IDC_BUILDTEXT,74,16,38,10
-    LTEXT           "BuildTime",IDC_BUILDTIME,120,16,92,10
-    LTEXT           "Copyright � 2002 RealVNC Ltd. - RealVNC\nCopyright � 1999-2002 Tridia Corporation - TridiaVNC \nCopyright � 1994-2001 AT&&T Laboratories Cambridge/Olivetti Research Ltd. - VNC",
-                    IDC_STATIC,74,67,203,32
-    LTEXT           "Copyright � 1990-2002 Info-ZIP\nCopyright � 1996-2002 Markus Franz Xaver Johannes Oberhumer - Mini LZO library",
-                    IDC_STATIC,74,99,200,26
-END
-
-IDD_OUTGOING_CONN DIALOG DISCARDABLE  0, 0, 243, 47
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | 
-    WS_SYSMENU
-CAPTION "Connexion sortante (Ajout Nouveau Viewer Client)"
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,190,6,46,14
-    PUSHBUTTON      "Annuler",IDCANCEL,190,25,46,15
-    EDITTEXT        IDC_HOSTNAME_EDIT,58,6,126,14,ES_AUTOHSCROLL
-    RTEXT           "Viewer VNC :",IDC_HOSTNAME_STATIC,7,6,47,14,
-                    SS_CENTERIMAGE
-    CTEXT           "(La cible doit avoir un VNCViewer en mode '�coute')",
-                    IDC_NOTE_STATIC,7,25,178,15,SS_CENTERIMAGE
-END
-
-IDD_ACCEPT_CONN DIALOG DISCARDABLE  0, 0, 186, 95
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "Accepter la connexion WinVNC?"
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "&Accepter",IDACCEPT,7,74,53,14
-    PUSHBUTTON      "&Rejeter",IDREJECT,130,74,49,14
-    CTEXT           "WinVNC re�oit une connexion entrante depuis",
-                    IDC_STATIC_TEXT1,7,7,172,17,SS_CENTERIMAGE
-    CTEXT           "<unknown host>",IDC_ACCEPT_IP,7,30,172,16,
-                    SS_CENTERIMAGE
-    CTEXT           "Souhaitez-vous Accepter ou Rejeter cette connexion?",
-                    IDC_STATIC_TEXT,7,50,172,15,SS_CENTERIMAGE
-    CTEXT           "AutoRejeter:",IDC_ACCEPT_TIMEOUT,60,74,70,14,
-                    SS_CENTERIMAGE
-END
-
-IDD_PROPERTIES DIALOG DISCARDABLE  0, 0, 365, 263
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | 
-    WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Propri�t�s du Serveur Ultr at VNC"
-FONT 8, "MS Sans Serif"
-BEGIN
-    PUSHBUTTON      "&Annuler",IDCANCEL,319,244,41,14
-    DEFPUSHBUTTON   "&OK",IDOK,194,244,44,14
-    GROUPBOX        "Connexions entrantes",IDC_CONNECT_BORDER,5,5,165,122
-    CONTROL         "Accepter les connexions Socket",IDC_CONNECT_SOCK,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,12,13,123,13
-    CONTROL         "Activer CORBA",IDC_CONNECT_CORBA,"Button",
-                    BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,99,180,66,
-                    10
-    EDITTEXT        IDC_DISPLAYNO,71,55,29,12,ES_AUTOHSCROLL | ES_NUMBER
-    EDITTEXT        IDC_PASSWORD,86,26,70,13,ES_PASSWORD | ES_AUTOHSCROLL
-    GROUPBOX        "D�tection des Modifications de l'�cran du Serveur",
-                    IDC_UPDATE_BORDER,176,60,184,87
-    CONTROL         "Tout l'�cran ( Rapide )",IDC_POLL_FULLSCREEN,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,185,70,93,13
-    CONTROL         "Fen�tres Consoles Uniquement",IDC_CONSOLE_ONLY,"Button",
-                    BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,70,71,18
-    CONTROL         "Fen�tre au premier plan ---|",IDC_POLL_FOREGROUND,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,84,108,9
-    CONTROL         "Fen�tre sous le curseur",IDC_POLL_UNDER_CURSOR,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,185,93,96,16
-    CONTROL         "Sur �venements re�us par Fen�tre",IDC_ONEVENT_ONLY,
-                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,
-                    88,69,21
-    CONTROL         "D�sactiver le clavier et le pointeur distants",
-                    IDC_DISABLE_INPUTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    185,14,153,15
-    PUSHBUTTON      "&Enregistrer",IDC_APPLY,259,244,43,14
-    CONTROL         "D�sactiver le clavier et le pointeur localement",
-                    IDC_DISABLE_LOCAL_INPUTS,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,185,27,162,13
-    GROUPBOX        "Param�tres de connexion",IDC_CONNSETTINGS_BORDER,176,5,
-                    184,51
-    CONTROL         "Supprimer le papier peint du Bureau",
-                    IDC_REMOVE_WALLPAPER,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,185,42,145,10
-    LTEXT           "Mot de passe:",IDC_PASSWORD_LABEL,27,27,55,11,
-                    SS_CENTERIMAGE
-    CONTROL         "Activer le visualiseur Java (en http)",IDC_CONNECT_HTTP,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,98,152,8
-    GROUPBOX        "Quand le dernier client se d�connecte",IDC_LOCKSETTINGS,
-                    5,129,165,51
-    CONTROL         "Ne rien faire",IDC_LOCKSETTING_NOTHING,"Button",
-                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,141,80,12
-    CONTROL         "Fermer la session",IDC_LOCKSETTING_LOGOFF,"Button",
-                    BS_AUTORADIOBUTTON | WS_TABSTOP,12,166,80,11
-    CONTROL         "V�rrouiller la session (Win2000)",IDC_LOCKSETTING_LOCK,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,153,120,13
-    LTEXT           "Numero d'affichage ou Port � utiliser:",
-                    IDC_DISPLAY_NO_LABEL,11,44,120,9,SS_CENTERIMAGE
-    CONTROL         "Auto",IDC_AUTO_DISPLAY_NO,"Button",BS_AUTOCHECKBOX | 
-                    NOT WS_VISIBLE | WS_TABSTOP,138,12,32,13
-    CONTROL         "Partager",IDC_SINGLE_WINDOW,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,185,196,40,10
-    EDITTEXT        IDC_NAME_APPLI,231,195,119,13,ES_AUTOHSCROLL
-    GROUPBOX        "Partager seulement la fen�tre nomm�e :",IDC_STATIC,176,
-                    185,185,26,BS_LEFT
-    GROUPBOX        "Divers",IDC_STATIC,5,183,165,76
-    CONTROL         "Autoriser le Transfert de Fichiers",IDC_FILETRANSFER,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,208,118,10
-    LTEXT           "Echelle par d�faut de l'�cran:",IDC_STATIC,24,245,96,8
-    LTEXT           "1 / ",IDC_STATIC,121,245,12,8
-    EDITTEXT        IDC_SCALE,134,243,12,12,ES_AUTOHSCROLL
-    GROUPBOX        "Plugin DSM (pour modifier le flux de donn�es)",
-                    IDC_STATIC,176,151,185,30
-    CONTROL         "Utiliser",IDC_PLUGIN_CHECK,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,185,165,34,10
-    COMBOBOX        IDC_PLUGINS_COMBO,221,163,102,86,CBS_DROPDOWN | CBS_SORT | 
-                    WS_VSCROLL | WS_TABSTOP
-    PUSHBUTTON      "Config",IDC_PLUGIN_BUTTON,326,163,27,12
-    CONTROL         "Auto",IDC_PORTNO_AUTO,"Button",BS_AUTORADIOBUTTON,134,
-                    45,31,10
-    CONTROL         "Affichage",IDC_SPECDISPLAY,"Button",BS_AUTORADIOBUTTON,
-                    12,57,44,10
-    CONTROL         "Ports",IDC_SPECPORT,"Button",BS_AUTORADIOBUTTON,12,70,
-                    30,10
-    EDITTEXT        IDC_PORTRFB,71,68,29,12,ES_AUTOHSCROLL
-    EDITTEXT        IDC_PORTHTTP,126,68,31,12,ES_AUTOHSCROLL
-    RTEXT           "N�",IDC_STATIC,57,57,9,8
-    RTEXT           "Main:",IDC_STATIC,47,70,18,8
-    RTEXT           "Http:",IDC_STATIC,105,70,17,8
-    CONTROL         "Uiliser le Driver Video de d�tection bas niveau",
-                    IDC_DRIVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,122,
-                    162,10
-    CONTROL         "Utiliser la Dll de d�tection syst�me (Hookdll)",
-                    IDC_HOOK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,111,
-                    158,10
-    CONTROL         "Activer Xdmcp (Connexion  X11)",IDC_CONNECT_XDMCP,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,109,119,10
-    CONTROL         "Autoriser l'�cran vide ",IDC_BLANK,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,11,196,146,10
-    CONTROL         "Faible pr�cision ( en g�n�ral plus rapide)",
-                    IDC_TURBOMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,
-                    134,158,10
-    CONTROL         "Enregistrer plus d'infos dans WinVNC.log",IDC_LOG,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,220,144,10
-    CONTROL         "Autoriser les connexions Loopback",IDC_ALLOWLOOPBACK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,232,132,10
-    GROUPBOX        "Demande de permission pour connection entrante",
-                    IDC_STATIC,175,214,186,26
-    CONTROL         "Afficher la demande",IDQUERY,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,185,226,78,10
-    LTEXT           "Expiration:",IDC_STATIC,280,226,34,8
-    EDITTEXT        IDQUERYTIMEOUT,317,224,27,12,ES_AUTOHSCROLL
-    LTEXT           "s",IDC_STATIC,347,225,8,8
-    LTEXT           "Login MS Obligatoire (User/Pass)",IDC_STATIC,36,86,114,
-                    8
-    PUSHBUTTON      "MS",IDC_MSLOGON,12,85,15,9
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
-BEGIN
-    IDD_TEXTCHAT_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 5
-        RIGHTMARGIN, 302
-        TOPMARGIN, 5
-        BOTTOMMARGIN, 170
-    END
-
-    IDD_LIST_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 157
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 109
-    END
-
-    IDD_ABOUT, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 275
-        VERTGUIDE, 80
-        VERTGUIDE, 90
-        VERTGUIDE, 100
-        VERTGUIDE, 120
-        TOPMARGIN, 5
-        BOTTOMMARGIN, 148
-        HORZGUIDE, 9
-        HORZGUIDE, 20
-        HORZGUIDE, 30
-        HORZGUIDE, 40
-        HORZGUIDE, 50
-        HORZGUIDE, 60
-        HORZGUIDE, 70
-        HORZGUIDE, 80
-        HORZGUIDE, 90
-        HORZGUIDE, 100
-    END
-
-    IDD_OUTGOING_CONN, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 236
-        VERTGUIDE, 50
-        VERTGUIDE, 55
-        VERTGUIDE, 185
-        VERTGUIDE, 190
-        TOPMARGIN, 6
-        BOTTOMMARGIN, 40
-        HORZGUIDE, 20
-        HORZGUIDE, 25
-    END
-
-    IDD_ACCEPT_CONN, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 179
-        VERTGUIDE, 60
-        VERTGUIDE, 130
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 88
-        HORZGUIDE, 24
-        HORZGUIDE, 30
-        HORZGUIDE, 46
-        HORZGUIDE, 50
-        HORZGUIDE, 65
-        HORZGUIDE, 74
-    END
-
-    IDD_PROPERTIES, DIALOG
-    BEGIN
-        LEFTMARGIN, 5
-        RIGHTMARGIN, 360
-        VERTGUIDE, 10
-        VERTGUIDE, 12
-        VERTGUIDE, 20
-        VERTGUIDE, 70
-        VERTGUIDE, 75
-        VERTGUIDE, 85
-        VERTGUIDE, 90
-        VERTGUIDE, 95
-        VERTGUIDE, 115
-        VERTGUIDE, 120
-        VERTGUIDE, 150
-        VERTGUIDE, 155
-        VERTGUIDE, 160
-        VERTGUIDE, 165
-        VERTGUIDE, 170
-        VERTGUIDE, 176
-        VERTGUIDE, 220
-        VERTGUIDE, 225
-        VERTGUIDE, 270
-        VERTGUIDE, 275
-        VERTGUIDE, 280
-        VERTGUIDE, 330
-        TOPMARGIN, 5
-        BOTTOMMARGIN, 256
-        HORZGUIDE, 15
-        HORZGUIDE, 20
-        HORZGUIDE, 25
-        HORZGUIDE, 30
-        HORZGUIDE, 40
-        HORZGUIDE, 45
-        HORZGUIDE, 50
-        HORZGUIDE, 55
-        HORZGUIDE, 60
-        HORZGUIDE, 65
-        HORZGUIDE, 70
-        HORZGUIDE, 75
-        HORZGUIDE, 85
-        HORZGUIDE, 88
-        HORZGUIDE, 94
-        HORZGUIDE, 98
-        HORZGUIDE, 109
-        HORZGUIDE, 114
-        HORZGUIDE, 120
-        HORZGUIDE, 125
-        HORZGUIDE, 134
-        HORZGUIDE, 140
-        HORZGUIDE, 144
-        HORZGUIDE, 149
-        HORZGUIDE, 155
-        HORZGUIDE, 163
-        HORZGUIDE, 165
-        HORZGUIDE, 241
-    END
-END
-#endif    // APSTUDIO_INVOKED
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,12
- PRODUCTVERSION 1,0,0,12
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040c04e4"
-        BEGIN
-            VALUE "Comments", "\0"
-            VALUE "CompanyName", "UltraVNC\0"
-            VALUE "FileDescription", "VNC serveur pour Win32\0"
-            VALUE "FileVersion", "1, 0, 0, 12\0"
-            VALUE "InternalName", "WinVNC\0"
-            VALUE "LegalCopyright", "Copyright UltraVNC\0"
-            VALUE "LegalTrademarks", "VNC\0"
-            VALUE "OriginalFilename", "WinVNC.exe\0"
-            VALUE "PrivateBuild", "\0"
-            VALUE "ProductName", "Ultravnc\0"
-            VALUE "ProductVersion", "1, 0, 0, 12\0"
-            VALUE "SpecialBuild", "\0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x40c, 1252
-    END
-END
-
-#endif    // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_WINVNC              ICON    DISCARDABLE     "res\\winvnc.ico"
-IDI_FLASH               ICON    DISCARDABLE     "res\\icon1.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDR_TRAYMENU MENU DISCARDABLE 
-BEGIN
-    POPUP "tray"
-    BEGIN
-        MENUITEM "&Propri�t�s",                 ID_PROPERTIES
-        MENUITEM SEPARATOR
-        MENUITEM "Aide en ligne",               ID_ONLINEHELP
-        MENUITEM "Page d'accueil",              ID_HOME
-        MENUITEM SEPARATOR
-        MENUITEM "Ajouter un &Nouveau client",  ID_OUTGOING_CONN
-        MENUITEM "&D�connecter tous les clients", ID_KILLCLIENTS
-        MENUITEM SEPARATOR
-        MENUITEM "&Lister tous les clients",    ID_LISTCLIENTS
-        MENUITEM SEPARATOR
-        MENUITEM "&A propos de WinVNC",         ID_ABOUT
-        MENUITEM SEPARATOR
-        MENUITEM "&Fermer WinVNC",              ID_CLOSE
-    END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVAARCHIVE
-//
-
-IDR_VNCVIEWER_JAR       JAVAARCHIVE DISCARDABLE "res\\vncviewer.jar"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// JAVACLASS
-//
-
-IDR_AUTHPANEL_CLASS     JAVACLASS DISCARDABLE   "res\\AuthPanel.class"
-IDR_CLIPBOARDFRAME_CLASS JAVACLASS DISCARDABLE   "res\\clipboardFrame.class"
-IDR_OPTIONSFRAME_CLASS  JAVACLASS DISCARDABLE   "res\\optionsFrame.class"
-IDR_RFBPROTO_CLASS      JAVACLASS DISCARDABLE   "res\\rfbProto.class"
-IDR_VNCCANVAS_CLASS     JAVACLASS DISCARDABLE   "res\\vncCanvas.class"
-IDR_VNCVIEWER_CLASS     JAVACLASS DISCARDABLE   "res\\vncviewer.class"
-IDR_BUTTONPANEL_CLASS   JAVACLASS DISCARDABLE   "res\\ButtonPanel.class"
-IDR_DESCIPHER_CLASS     JAVACLASS DISCARDABLE   "res\\DesCipher.class"
-IDR_RECFRAME_CLASS      JAVACLASS DISCARDABLE   "res\\RecordingFrame.class"
-IDR_SESSIONREC_CLASS    JAVACLASS DISCARDABLE   "res\\SessionRecorder.class"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_LOGO64              BITMAP  DISCARDABLE     "RES\\vnc64.BMP"
-
-#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
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    IDI_WINVNC              "WinVNC"
-    IDS_WARNING             "ALERTE: Par d�faut, cette session n'utilise pas de cryptage. Ne l'utilisez pas pour envoyer des donn�es sensibles sans vous assurer que votre connexion est s�curis�e.\n\n"
-END
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    ID_FAILED_INIT          "Echec d'initialisation du syst�me de socket"
-    ID_WINVNC_USAGE         "Usage de WinVNC"
-    ID_ANOTHER_INST         "Une autre instance de WinVNC est d�j� lanc�e"
-    ID_NO_EXIST_INST        "Aucune instance de WinVNC ne peut �tre contact�e"
-    ID_UNABLE_INST          "Impossible d'installer le service WinVNC"
-    ID_SCM_NOT_HERE         "Le SCM ne peut �tre contact� - le service WinVNC n'a pas �t� install�"
-    ID_SERV_NOT_REG         "Le service WinVNC ne peut pas �tre enregistr�"
-    ID_SERV_FAIL_ST         "Le service WinVNC �choue au d�marrage"
-END
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    ID_SERV_CT_MISS         "Le ""Service Control Manager"" ne peut �tre contact� - le service WinVNC n'a pas �t� enregistr�"
-    ID_SERV_OLD_REG         "Le service WinVNC est d�j� enregistr�"
-    ID_SERVHELP_UNAB        "ATTENTION:impossible d'installer l'ic�ne d'aide au service\nLes param�tres globaux sp�cifique utilisateur ne seront pas charg�"
-    ID_SERV_CT_UNREG        "Le ""Service Control Manager"" ne peut �tre contact� - le service WinVNC n'a pas �t� d�senregistr�"
-    ID_SERV_NOT_UNRG        "Le service WinVNC ne peut pas �tre d�senregistr�"
-    ID_SERV_NCONTACT        "Le service WinVNC ne peut pas �tre contact�"
-    ID_SERVHELP_NREM        "ATTENTION: l'entr�e ""ServiceHelper"" de la base de registre ne peut �tre supprim�"
-    ID_SERV_NOT_STOP        "Le service WinVNC ne peut pas �tre arr�t�"
-    ID_SERV_MK_UNREG        "Le service WinVNC est d�j� marqu� pour �tre d�senregistr�"
-    ID_SERV_NT_FOUND        "Le service WinVNC est introuvable"
-    ID_WINVNC_ERROR         "Erreur WinVNC"
-    ID_WINVNC_WARNIN        "Alerte WinVNC"
-    ID_PLUGIN_LOADIN        "Chargement du Plugin"
-    ID_NO_PASSWD_NO_OVERRIDE_ERR 
-                            "Aucun mot de passe n'a �t� precis� & cette machine a �t� pr�configur�e pour interdire aux utilisateurs de d�finir le leur.\nVous devez contacter un Administrateur pour configurer WinVNC correctement."
-    ID_NO_PASSWD_NO_OVERRIDE_WARN 
-                            "ATTENTION : Cette machine a �t� pr�configur�e pour permettre d'accepter\ndes connexions non authentifi�es et pour interdire aux utilisateurs d'activer l'authentification."
-    ID_NO_PASSWD_NO_LOGON_WARN 
-                            "ATTENTION : Cette machine n'a pas de mot de passe d�fini par d�faut. WinVNC va ouvrir la fen�tre de propri�t�s pour permettre d'en saisir un. "
-END
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    ID_NO_OVERRIDE_ERR      "Cette machine a �t� pr�configur�e avec des propri�t�s qui ne peuvent �tre r��crites. Ces param�tres pr�configur�s ne peuvent �tre modifi�s que par un Administrateur Syst�me."
-    ID_NO_CURRENT_USER_ERR  "Les param�tres WinVNC pour cet utilisateur ne sont pas valides actuellement."
-    ID_CANNOT_EDIT_DEFAULT_PREFS 
-                            "Vous n'avez pas de droits suffisants pour �diter les param�tres par d�fauts de WinVNC."
-    ID_NO_PASSWORD_WARN     "ATTENTION : Lancer WinVNC sans d�finir un mot de passe est un trou de s�curit� dangereux!\nTant qu'un mot de passe n'est pas d�fini, WinVNC n'acceptera pas de connexion."
-    ID_PLUGIN_NOT_LOAD      "Le plugin ne peut �tre charg�.\n\rSVP, v�rifier son int�grit�."
-    ID_MB1                  "MB1"
-    ID_WVNC                 "WVNC"
-    ID_AUTHAD_NOT_FO        "Vous avez s�lectionn� ms-logon, mais la dll\nauthad.dll n'a pas �t� trouv�e.V�rifiez votre installation"
-    ID_WARNING              "ATTENTION"
-    ID_AUTH_NOT_FO          "Vous avez s�lectionn� ms-logon, mais la dll\nauth.dll n'a pas �t� trouv�e.V�rifiez votre installation"
-    ID_DESKTOP_BITBLT_ROOT  "Bureau VNC : le driver ne supporte pas ""BitBlt""\nWinVNC ne peut pas utiliser ce driver vid�o."
-    ID_DESKTOP_BITBLT_MEM   "Bureau VNC : la m�moire ne supporte pas ""GetDIBits""\nWinVNC ne peut pas utiliser ce driver vid�o."
-    ID_DESKTOP_PLANAR_NOTC  "Bureau VNC : l'affichage courant est ""PLANAR"", et pas ""CHUNKY""!\nWinVNC ne peut pas utiliser ce driver vid�o."
-    ID_FAILED_CONNECT_LISTING_VIEW 
-                            "Echec de connexion au visualiseur en mode �coute"
-    ID_OUTGOING_CONNECTION  "Connexion sortante"
-    ID_UNABLE_PROC_MSLOGON  "Impossible d'utiliser MS Logon"
-END
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    ID_RICHED32_UNLOAD      "Impossible de charger le contr�le RichEdit (RICHED32.DLL)!"
-    ID_RICHED32_DLL_LD      "Chargement de la Dll RichEdit"
-    ID_SERV_SUCCESS_INST    "Le service WinVNC a �t� install� avec succ�s\nLe service va �tre lanc� maintenant et sera automatiquement\nlanc� au d�marrage de la machine"
-    ID_SERV_SUCCESS_REG     "Le service WinVNC a �t� enregistr� avec succ�s\nLe service peut �tre lanc� depuis le panneau de configuration, et\n sera automatiquement lanc� qu'au d�marrage de la machine"
-    ID_SERV_SUCCESS_UNREG   "Le service WinVNC a �t� d�senregistr�"
-    ID_ULTRAVNC_TEXTCHAT    "Le client s�lectionn� n'est pas un visualiseur Ultr at VNC !\n Il ne supporte peut �tre pas le t'Chat\n"
-    ID_ULTRAVNC_WARNING     "Alerte Ultr at VNC"
-    ID_NO_PLUGIN_DETECT     "Pas de Plugin d�tect�..."
-    ID_CHAT_WITH_S_ULTRAVNC " Chat avec <%s> - Ultr at VNC"
-    ID_CURRENT_USER_PROP    "WinVNC: Propri�t�s de l'utilisateur courant"
-    ID_DEFAULT_SYST_PROP    "WinVNC: Propri�t�s par d�faut du syst�me"
-    ID_AUTOREJECT_U         "Auto Rejet:%u"
-END
-
-#endif    // French (France) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Dutch (Belgium) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLB)
-#ifdef _WIN32
-LANGUAGE LANG_DUTCH, SUBLANG_DUTCH_BELGIAN
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_MSLOGON DIALOG DISCARDABLE  0, 0, 186, 135
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "MS logon setup"
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,17,114,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,110,114,50,14
-    CONTROL         "Login MS Obligatoire (User/Pass)",IDC_MSLOGON_CHECKD,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,7,121,10
-    EDITTEXT        IDC_GROUP1,17,35,93,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_GROUP2,17,56,93,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_GROUP3,17,77,93,14,ES_AUTOHSCROLL
-    CONTROL         "",IDC_CHECKG1L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    123,36,13,10
-    CONTROL         "",IDC_CHECKG2L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    123,58,16,8
-    CONTROL         "",IDC_CHECKG3L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    123,80,16,8
-    CONTROL         "",IDC_CHECKG1D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    149,38,16,8
-    CONTROL         "",IDC_CHECKG2D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    149,58,16,8
-    CONTROL         "",IDC_CHECKG3D,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    149,80,16,8
-    LTEXT           "Local",IDC_STATIC,123,24,18,8
-    LTEXT           "Domain",IDC_STATIC,149,24,25,8
-    LTEXT           "Group",IDC_STATIC,47,24,20,8
-    LTEXT           "1",IDC_STATIC,7,38,8,8
-    LTEXT           "2",IDC_STATIC,7,58,8,8
-    LTEXT           "3",IDC_STATIC,7,80,8,8
-    LTEXT           "Group 1 2= Full Access    Group 3=ReadOnly",IDC_STATIC,
-                    17,97,162,8
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
-BEGIN
-    IDD_MSLOGON, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 179
-        VERTGUIDE, 17
-        VERTGUIDE, 110
-        VERTGUIDE, 123
-        VERTGUIDE, 149
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 128
-        HORZGUIDE, 46
-        HORZGUIDE, 66
-        HORZGUIDE, 88
-        HORZGUIDE, 105
-        HORZGUIDE, 114
-    END
-END
-#endif    // APSTUDIO_INVOKED
-
-#endif    // Dutch (Belgium) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
-
diff --git a/ica/win32/winvnc/winvnc/winvnc_vs90_Release_Win32.lnt b/ica/win32/winvnc/winvnc/winvnc_vs90_Release_Win32.lnt
deleted file mode 100644
index 3bd6324..0000000
--- a/ica/win32/winvnc/winvnc/winvnc_vs90_Release_Win32.lnt
+++ /dev/null
@@ -1,80 +0,0 @@
-
-// Generated by Visual Lint 1.5.8.77 from file: D:\UltraVNC-src\UltraVNC Project Root\UltraVNC\winvnc\winvnc\winvnc.vcproj
-// -dConfiguration=Release|Win32
-//
--D_MBCS                         // CharacterSet = "2"
--DNDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS
-                                // PreprocessorDefinitions = "NDEBUG;__x86__;__WIN32__;WIN32;_WINDOWS;_WIN32_WINNT=0x501;XMD_H;_WINSTATIC;_VC80;_CRT_SECURE_NO_WARNINGS"
--D_NATIVE_WCHAR_T_DEFINED       // TreatWChar_tAsBuiltInType = "TRUE"
--D_MT                           // RuntimeLibrary = "0"
-
-                                // AdditionalIncludeDirectories = "..\omnithread,..,..\.."
--i"..\omnithread"               // 
--i".."                          // 
--i"..\.."                       // 
-
-black_layered.cpp               // RelativePath = "black_layered.cpp"
-buildtime.cpp                   // RelativePath = "buildtime.cpp"
-d3des.c                         // RelativePath = "d3des.c"
-..\..\rfb\dh.cpp                // RelativePath = "..\..\rfb\dh.cpp"
-..\..\DSMPlugin\DSMPlugin.cpp   // RelativePath = "..\..\DSMPlugin\DSMPlugin.cpp"
-helpers.cpp                     // RelativePath = "helpers.cpp"
-HideDesktop.cpp                 // RelativePath = "HideDesktop.cpp"
-inifile.cpp                     // RelativePath = "inifile.cpp"
-IPC.cpp                         // RelativePath = "IPC.cpp"
-LinkLabel.cpp                   // RelativePath = "LinkLabel.cpp"
-..\..\lzo\minilzo.c             // RelativePath = "..\..\lzo\minilzo.c"
-read_write_ini.cpp              // RelativePath = "read_write_ini.cpp"
-rfbRegion_X11.cxx               // RelativePath = "rfbRegion_X11.cxx"
-rfbUpdateTracker.cpp            // RelativePath = "rfbUpdateTracker.cpp"
-security.cpp                    // RelativePath = "security.cpp"
-service.cpp                     // RelativePath = "service.cpp"
-service_motor.cpp               // RelativePath = "service_motor.cpp"
-stdhdrs.cpp                     // RelativePath = "stdhdrs.cpp"
-tableinitcmtemplate.cpp         // RelativePath = "tableinitcmtemplate.cpp"
-tableinittctemplate.cpp         // RelativePath = "tableinittctemplate.cpp"
-tabletranstemplate.cpp          // RelativePath = "tabletranstemplate.cpp"
-TextChat.cpp                    // RelativePath = "TextChat.cpp"
-translate.cpp                   // RelativePath = "translate.cpp"
-videodriver.cpp                 // RelativePath = "videodriver.cpp"
-videodrivercheck.cpp            // RelativePath = "videodrivercheck.cpp"
-vistahook.cpp                   // RelativePath = "vistahook.cpp"
-vncabout.cpp                    // RelativePath = "vncabout.cpp"
-vncacceptdialog.cpp             // RelativePath = "vncacceptdialog.cpp"
-vncauth.c                       // RelativePath = "vncauth.c"
-vncbuffer.cpp                   // RelativePath = "vncbuffer.cpp"
-vncclient.cpp                   // RelativePath = "vncclient.cpp"
-vncconndialog.cpp               // RelativePath = "vncconndialog.cpp"
-vncdesktop.cpp                  // RelativePath = "vncdesktop.cpp"
-vncDesktopSW.cpp                // RelativePath = "vncDesktopSW.cpp"
-vncdesktopthread.cpp            // RelativePath = "vncdesktopthread.cpp"
-vncencodecorre.cpp              // RelativePath = "vncencodecorre.cpp"
-vncencodehext.cpp               // RelativePath = "vncencodehext.cpp"
-vncencoder.cpp                  // RelativePath = "vncencoder.cpp"
-vncencoderCursor.cpp            // RelativePath = "vncencoderCursor.cpp"
-vncencoderre.cpp                // RelativePath = "vncencoderre.cpp"
-vncEncodeTight.cpp              // RelativePath = "vncEncodeTight.cpp"
-vncEncodeUltra.cpp              // RelativePath = "vncEncodeUltra.cpp"
-vncEncodeZlib.cpp               // RelativePath = "vncEncodeZlib.cpp"
-vncEncodeZlibHex.cpp            // RelativePath = "vncEncodeZlibHex.cpp"
-vncencodezrle.cpp               // RelativePath = "vncencodezrle.cpp"
-vnchttpconnect.cpp              // RelativePath = "vnchttpconnect.cpp"
-vncinsthandler.cpp              // RelativePath = "vncinsthandler.cpp"
-vnckeymap.cpp                   // RelativePath = "vnckeymap.cpp"
-vncListDlg.cpp                  // RelativePath = "vncListDlg.cpp"
-vnclog.cpp                      // RelativePath = "vnclog.cpp"
-vncmenu.cpp                     // RelativePath = "vncmenu.cpp"
-vncMultiMonitor.cpp             // RelativePath = "vncMultiMonitor.cpp"
-vncntlm.cpp                     // RelativePath = "vncntlm.cpp"
-vncOSVersion.cpp                // RelativePath = "vncOSVersion.cpp"
-vncproperties.cpp               // RelativePath = "vncproperties.cpp"
-vncpropertiesPoll.cpp           // RelativePath = "vncpropertiesPoll.cpp"
-vncserver.cpp                   // RelativePath = "vncserver.cpp"
-vncservice.cpp                  // RelativePath = "vncservice.cpp"
-vncsetauth.cpp                  // RelativePath = "vncsetauth.cpp"
-vncsockconnect.cpp              // RelativePath = "vncsockconnect.cpp"
-vnctimedmsgbox.cpp              // RelativePath = "vnctimedmsgbox.cpp"
-vsocket.cpp                     // RelativePath = "vsocket.cpp"
-winvnc.cpp                      // RelativePath = "winvnc.cpp"
-..\..\ZipUnZip32\ZipUnzip32.cpp
-                                // RelativePath = "..\..\ZipUnZip32\ZipUnzip32.cpp"
diff --git a/ica/win32/winvnc/winvncvs2005.sln b/ica/win32/winvnc/winvncvs2005.sln
deleted file mode 100644
index 01647f9..0000000
--- a/ica/win32/winvnc/winvncvs2005.sln
+++ /dev/null
@@ -1,681 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSLogonACL", "ms-logon\MSLogonACL\MSLogonACLvs2005.vcproj", "{F4E39BD7-C841-4F21-B40C-293D7E017EA1}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Xregion", "..\Xregion\Xregionvs2005.vcproj", "{74900370-5ED2-4A5E-99A8-37EFE1D27552}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "authSSP", "ms-logon\authSSP\authSSPvs2005.vcproj", "{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "authadmin", "ms-logon\authadmin\authadminvs2005.vcproj", "{334467FD-E35E-4C3D-9410-69B2171C2BB2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldapauth", "ms-logon\ldapauth\ldapauthvs2005.vcproj", "{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldapauth9x", "ms-logon\ldapauth9x\ldapauth9xvs2005.vcproj", "{CAA83204-EBF8-4369-B152-011EA957784C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldapauthnt4", "ms-logon\ldapauthNT4\ldapauthnt4vs2005.vcproj", "{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "..\libjpeg\libjpegvs2005.vcproj", "{181769CB-5295-452F-A421-FE1F9ED2022A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logging", "ms-logon\logging\loggingvs2005.vcproj", "{D50AEB07-5F5E-4401-9B50-C1660E693833}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logmessages", "logger\logmessagesvs2005.vcproj", "{E543B602-5529-4B23-8D2A-3709857F5066}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "omnithread", "omnithread\omnithreadvs2005.vcproj", "{E52B9956-FE67-47F7-BC4F-67CC5A64B708}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdr", "..\rdr\rdrvs2005.vcproj", "{F5244002-0FFF-4F19-A941-FCCE1861F132}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testauth", "ms-logon\testauth\testauthvs2005.vcproj", "{C05BE60B-FBDF-430F-B041-5089262E8FB5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnchooks", "vnchooks\vnchooksvs2005.vcproj", "{1D18E045-6B72-43F4-ACBD-3E679A3DE349}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winvnc", "winvnc\winvncvs2005.vcproj", "{C05AE605-1250-4F58-911B-EC99AE2C25AF}"
-	ProjectSection(ProjectDependencies) = postProject
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048} = {4CF0DF92-7F53-446C-8223-8DE4F6B40048}
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27} = {85445BB7-B95B-4DE1-BA52-7311AA700A27}
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683} = {CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769} = {DDA225E9-1A32-4065-8BAD-4BDDFBF81769}
-		{181769CB-5295-452F-A421-FE1F9ED2022A} = {181769CB-5295-452F-A421-FE1F9ED2022A}
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552} = {74900370-5ED2-4A5E-99A8-37EFE1D27552}
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708} = {E52B9956-FE67-47F7-BC4F-67CC5A64B708}
-		{F5244002-0FFF-4F19-A941-FCCE1861F132} = {F5244002-0FFF-4F19-A941-FCCE1861F132}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "workgrpdomnt4", "ms-logon\workgrpdomnt4\workgrpdomnt4vs2005.vcproj", "{8D7757CB-5125-4633-AFB1-4B30ED24955F}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\zlib\zlibvs2005.vcproj", "{85445BB7-B95B-4DE1-BA52-7311AA700A27}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avilog", "..\avilog\avilog\avilog_VS2005.vcproj", "{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unz32lib", "..\zipunzip_src\unzip\windll\vc6\lib\unz32lib_VS2005.vcproj", "{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip32", "..\zipunzip_src\zip20\windll\visualc\lib\zip32_VS2005.vcproj", "{4CF0DF92-7F53-446C-8223-8DE4F6B40048}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		ASM Debug|Win32 = ASM Debug|Win32
-		ASM Debug|x64 = ASM Debug|x64
-		ASM Release|Win32 = ASM Release|Win32
-		ASM Release|x64 = ASM Release|x64
-		Debug|Win32 = Debug|Win32
-		Debug|x64 = Debug|x64
-		Http|Win32 = Http|Win32
-		Http|x64 = Http|x64
-		Profile|Win32 = Profile|Win32
-		Profile|x64 = Profile|x64
-		Release CORBA DEBUG|Win32 = Release CORBA DEBUG|Win32
-		Release CORBA DEBUG|x64 = Release CORBA DEBUG|x64
-		Release CORBA|Win32 = Release CORBA|Win32
-		Release CORBA|x64 = Release CORBA|x64
-		Release|Win32 = Release|Win32
-		Release|x64 = Release|x64
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Debug|x64.Build.0 = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Release|Win32.Build.0 = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Release|x64.ActiveCfg = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.ASM Release|x64.Build.0 = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Debug|Win32.Build.0 = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Debug|x64.ActiveCfg = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Debug|x64.Build.0 = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Http|Win32.ActiveCfg = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Http|Win32.Build.0 = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Http|x64.ActiveCfg = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Http|x64.Build.0 = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Profile|Win32.ActiveCfg = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Profile|Win32.Build.0 = Debug|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Profile|x64.ActiveCfg = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Profile|x64.Build.0 = Debug|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA|Win32.Build.0 = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA|x64.ActiveCfg = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release CORBA|x64.Build.0 = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release|Win32.ActiveCfg = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release|Win32.Build.0 = Release|Win32
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release|x64.ActiveCfg = Release|x64
-		{F4E39BD7-C841-4F21-B40C-293D7E017EA1}.Release|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Debug|x64.Build.0 = Debug|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Release|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Release|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.ASM Release|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Debug|Win32.ActiveCfg = Debug|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Debug|Win32.Build.0 = Debug|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Debug|x64.ActiveCfg = Debug|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Debug|x64.Build.0 = Debug|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Http|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Http|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Http|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Http|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Profile|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Profile|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Profile|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Profile|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release CORBA|x64.Build.0 = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release|Win32.ActiveCfg = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release|Win32.Build.0 = Release|Win32
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release|x64.ActiveCfg = Release|x64
-		{74900370-5ED2-4A5E-99A8-37EFE1D27552}.Release|x64.Build.0 = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Debug|x64.Build.0 = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Release|Win32.Build.0 = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Release|x64.ActiveCfg = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.ASM Release|x64.Build.0 = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Debug|Win32.ActiveCfg = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Debug|Win32.Build.0 = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Debug|x64.ActiveCfg = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Debug|x64.Build.0 = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Http|Win32.ActiveCfg = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Http|Win32.Build.0 = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Http|x64.ActiveCfg = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Http|x64.Build.0 = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Profile|Win32.ActiveCfg = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Profile|Win32.Build.0 = Debug|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Profile|x64.ActiveCfg = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Profile|x64.Build.0 = Debug|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA|Win32.Build.0 = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA|x64.ActiveCfg = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release CORBA|x64.Build.0 = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release|Win32.ActiveCfg = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release|Win32.Build.0 = Release|Win32
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release|x64.ActiveCfg = Release|x64
-		{2F5FBC3F-4CCD-4C26-9719-C9166D8B0C7D}.Release|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Debug|x64.Build.0 = Debug|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Release|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Release|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.ASM Release|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Debug|Win32.ActiveCfg = Debug|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Debug|Win32.Build.0 = Debug|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Debug|x64.ActiveCfg = Debug|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Debug|x64.Build.0 = Debug|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Http|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Http|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Http|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Http|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Profile|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Profile|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Profile|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Profile|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release CORBA|x64.Build.0 = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release|Win32.ActiveCfg = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release|Win32.Build.0 = Release|Win32
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release|x64.ActiveCfg = Release|x64
-		{334467FD-E35E-4C3D-9410-69B2171C2BB2}.Release|x64.Build.0 = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Debug|x64.Build.0 = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Release|Win32.Build.0 = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Release|x64.ActiveCfg = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.ASM Release|x64.Build.0 = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Debug|Win32.ActiveCfg = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Debug|Win32.Build.0 = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Debug|x64.ActiveCfg = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Debug|x64.Build.0 = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Http|Win32.ActiveCfg = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Http|Win32.Build.0 = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Http|x64.ActiveCfg = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Http|x64.Build.0 = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Profile|Win32.ActiveCfg = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Profile|Win32.Build.0 = Debug|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Profile|x64.ActiveCfg = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Profile|x64.Build.0 = Debug|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA|Win32.Build.0 = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA|x64.ActiveCfg = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release CORBA|x64.Build.0 = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release|Win32.ActiveCfg = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release|Win32.Build.0 = Release|Win32
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release|x64.ActiveCfg = Release|x64
-		{BC78A3C8-2280-42AB-BB6F-14FB674E2A0C}.Release|x64.Build.0 = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Debug|x64.Build.0 = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Release|Win32.Build.0 = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Release|x64.ActiveCfg = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.ASM Release|x64.Build.0 = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Debug|Win32.Build.0 = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Debug|x64.ActiveCfg = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Debug|x64.Build.0 = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Http|Win32.ActiveCfg = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Http|Win32.Build.0 = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Http|x64.ActiveCfg = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Http|x64.Build.0 = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Profile|Win32.ActiveCfg = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Profile|Win32.Build.0 = Debug|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Profile|x64.ActiveCfg = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Profile|x64.Build.0 = Debug|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA|Win32.Build.0 = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA|x64.ActiveCfg = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release CORBA|x64.Build.0 = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release|Win32.ActiveCfg = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release|Win32.Build.0 = Release|Win32
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release|x64.ActiveCfg = Release|x64
-		{CAA83204-EBF8-4369-B152-011EA957784C}.Release|x64.Build.0 = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Debug|x64.Build.0 = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Release|Win32.Build.0 = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Release|x64.ActiveCfg = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.ASM Release|x64.Build.0 = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Debug|Win32.Build.0 = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Debug|x64.ActiveCfg = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Debug|x64.Build.0 = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Http|Win32.ActiveCfg = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Http|Win32.Build.0 = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Http|x64.ActiveCfg = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Http|x64.Build.0 = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Profile|Win32.ActiveCfg = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Profile|Win32.Build.0 = Debug|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Profile|x64.ActiveCfg = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Profile|x64.Build.0 = Debug|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA|Win32.Build.0 = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA|x64.ActiveCfg = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release CORBA|x64.Build.0 = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release|Win32.ActiveCfg = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release|Win32.Build.0 = Release|Win32
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release|x64.ActiveCfg = Release|x64
-		{31AC9E7D-64B7-4301-ADE2-5EFF15AA6BDE}.Release|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Debug|x64.Build.0 = Debug|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Release|Win32.Build.0 = Release|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Release|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.ASM Release|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Debug|Win32.Build.0 = Debug|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Debug|x64.ActiveCfg = Debug|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Debug|x64.Build.0 = Debug|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Http|Win32.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Http|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Http|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Profile|Win32.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Profile|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Profile|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA DEBUG|Win32.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA|Win32.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release CORBA|x64.Build.0 = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release|Win32.ActiveCfg = Release|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release|Win32.Build.0 = Release|Win32
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release|x64.ActiveCfg = Release|x64
-		{181769CB-5295-452F-A421-FE1F9ED2022A}.Release|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Debug|x64.Build.0 = Debug|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Release|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Release|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.ASM Release|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Debug|Win32.Build.0 = Debug|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Debug|x64.ActiveCfg = Debug|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Debug|x64.Build.0 = Debug|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Http|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Http|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Http|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Http|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Profile|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Profile|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Profile|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Profile|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release CORBA|x64.Build.0 = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release|Win32.ActiveCfg = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release|Win32.Build.0 = Release|Win32
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release|x64.ActiveCfg = Release|x64
-		{D50AEB07-5F5E-4401-9B50-C1660E693833}.Release|x64.Build.0 = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Debug|x64.Build.0 = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Release|Win32.Build.0 = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Release|x64.ActiveCfg = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.ASM Release|x64.Build.0 = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Debug|Win32.Build.0 = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Debug|x64.ActiveCfg = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Debug|x64.Build.0 = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Http|Win32.ActiveCfg = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Http|Win32.Build.0 = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Http|x64.ActiveCfg = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Http|x64.Build.0 = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Profile|Win32.ActiveCfg = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Profile|Win32.Build.0 = Debug|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Profile|x64.ActiveCfg = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Profile|x64.Build.0 = Debug|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA|Win32.Build.0 = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA|x64.ActiveCfg = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release CORBA|x64.Build.0 = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release|Win32.ActiveCfg = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release|Win32.Build.0 = Release|Win32
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release|x64.ActiveCfg = Release|x64
-		{E543B602-5529-4B23-8D2A-3709857F5066}.Release|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Debug|x64.Build.0 = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.ASM Release|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|Win32.Build.0 = Debug|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|x64.ActiveCfg = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Debug|x64.Build.0 = Debug|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Http|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Profile|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Profile|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Profile|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Profile|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release CORBA|x64.Build.0 = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|Win32.ActiveCfg = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|Win32.Build.0 = Release|Win32
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|x64.ActiveCfg = Release|x64
-		{E52B9956-FE67-47F7-BC4F-67CC5A64B708}.Release|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Debug|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|Win32.Build.0 = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.ASM Release|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|Win32.Build.0 = Debug|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Debug|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|Win32.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Http|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Profile|Win32.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Profile|x64.ActiveCfg = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Profile|x64.Build.0 = Debug|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA DEBUG|Win32.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA|Win32.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release CORBA|x64.Build.0 = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|Win32.ActiveCfg = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|Win32.Build.0 = Release|Win32
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|x64.ActiveCfg = Release|x64
-		{F5244002-0FFF-4F19-A941-FCCE1861F132}.Release|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Debug|x64.Build.0 = Debug|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Release|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Release|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.ASM Release|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Debug|Win32.Build.0 = Debug|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Debug|x64.ActiveCfg = Debug|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Debug|x64.Build.0 = Debug|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Http|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Http|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Http|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Http|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Profile|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Profile|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Profile|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Profile|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release CORBA|x64.Build.0 = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release|Win32.ActiveCfg = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release|Win32.Build.0 = Release|Win32
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release|x64.ActiveCfg = Release|x64
-		{C05BE60B-FBDF-430F-B041-5089262E8FB5}.Release|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Debug|x64.Build.0 = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.ASM Release|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|Win32.Build.0 = Debug|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|x64.ActiveCfg = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Debug|x64.Build.0 = Debug|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Http|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Profile|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Profile|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Profile|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Profile|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release CORBA|x64.Build.0 = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|Win32.ActiveCfg = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|Win32.Build.0 = Release|Win32
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|x64.ActiveCfg = Release|x64
-		{1D18E045-6B72-43F4-ACBD-3E679A3DE349}.Release|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Debug|x64.Build.0 = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.ASM Release|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|Win32.Build.0 = Debug|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|x64.ActiveCfg = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Debug|x64.Build.0 = Debug|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Http|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Profile|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Profile|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Profile|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Profile|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release CORBA|x64.Build.0 = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|Win32.ActiveCfg = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|Win32.Build.0 = Release|Win32
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|x64.ActiveCfg = Release|x64
-		{C05AE605-1250-4F58-911B-EC99AE2C25AF}.Release|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Debug|x64.Build.0 = Debug|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Release|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Release|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.ASM Release|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Debug|Win32.Build.0 = Debug|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Debug|x64.ActiveCfg = Debug|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Debug|x64.Build.0 = Debug|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Http|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Http|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Http|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Http|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Profile|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Profile|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Profile|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Profile|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release CORBA|x64.Build.0 = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release|Win32.ActiveCfg = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release|Win32.Build.0 = Release|Win32
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release|x64.ActiveCfg = Release|x64
-		{8D7757CB-5125-4633-AFB1-4B30ED24955F}.Release|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Debug|x64.ActiveCfg = Debug|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Debug|x64.Build.0 = Debug|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Release|Win32.Build.0 = Release|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Release|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.ASM Release|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Debug|Win32.ActiveCfg = Debug|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Debug|Win32.Build.0 = Debug|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Debug|x64.ActiveCfg = Debug|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Debug|x64.Build.0 = Debug|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Http|Win32.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Http|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Http|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Profile|Win32.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Profile|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Profile|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA DEBUG|Win32.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA DEBUG|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA DEBUG|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA|Win32.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release CORBA|x64.Build.0 = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release|Win32.ActiveCfg = Release|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release|Win32.Build.0 = Release|Win32
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release|x64.ActiveCfg = Release|x64
-		{85445BB7-B95B-4DE1-BA52-7311AA700A27}.Release|x64.Build.0 = Release|x64
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Debug|x64.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.ASM Release|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|Win32.Build.0 = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Debug|x64.ActiveCfg = Debug|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Http|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Profile|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Profile|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Profile|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA DEBUG|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release CORBA|x64.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|Win32.ActiveCfg = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|Win32.Build.0 = Release|Win32
-		{CD0D6EC9-D652-4D1B-B23B-18E1AC3AA683}.Release|x64.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Debug|Win32.ActiveCfg = ASM Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Debug|Win32.Build.0 = ASM Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Debug|x64.ActiveCfg = ASM Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Release|Win32.ActiveCfg = ASM Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Release|Win32.Build.0 = ASM Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.ASM Release|x64.ActiveCfg = ASM Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Debug|Win32.ActiveCfg = Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Debug|Win32.Build.0 = Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Debug|x64.ActiveCfg = Debug|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Http|Win32.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Http|Win32.Build.0 = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Http|x64.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Profile|Win32.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Profile|Win32.Build.0 = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Profile|x64.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA DEBUG|x64.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA|Win32.Build.0 = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release CORBA|x64.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release|Win32.ActiveCfg = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release|Win32.Build.0 = Release|Win32
-		{DDA225E9-1A32-4065-8BAD-4BDDFBF81769}.Release|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Debug|Win32.ActiveCfg = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Debug|Win32.Build.0 = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Debug|x64.ActiveCfg = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Release|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Release|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.ASM Release|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Debug|Win32.ActiveCfg = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Debug|Win32.Build.0 = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Debug|x64.ActiveCfg = Debug|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Http|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Http|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Http|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Profile|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Profile|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Profile|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA DEBUG|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA DEBUG|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA DEBUG|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release CORBA|x64.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release|Win32.ActiveCfg = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release|Win32.Build.0 = Release|Win32
-		{4CF0DF92-7F53-446C-8223-8DE4F6B40048}.Release|x64.ActiveCfg = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
diff --git a/ica/win32/winvnc/zlib/zlib.h b/ica/win32/winvnc/zlib/zlib.h
deleted file mode 100644
index 4470a1f..0000000
--- a/ica/win32/winvnc/zlib/zlib.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <zlib.h>
diff --git a/ica/x11/common/sha1.c b/ica/x11/common/sha1.c
deleted file mode 100644
index 988b188..0000000
--- a/ica/x11/common/sha1.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * Copyright (C) The Internet Society (2001).  All Rights Reserved.
- *
- * This document and translations of it may be copied and furnished to
- * others, and derivative works that comment on or otherwise explain it
- * or assist in its implementation may be prepared, copied, published
- * and distributed, in whole or in part, without restriction of any
- * kind, provided that the above copyright notice and this paragraph are
- * included on all such copies and derivative works.  However, this
- * document itself may not be modified in any way, such as by removing
- * the copyright notice or references to the Internet Society or other
- * Internet organizations, except as needed for the purpose of
- * developing Internet standards in which case the procedures for
- * copyrights defined in the Internet Standards process must be
- * followed, or as required to translate it into languages other than
- * English.
- *
- * The limited permissions granted above are perpetual and will not be
- * revoked by the Internet Society or its successors or assigns.
- *
- * This document and the information contained herein is provided on an
- * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *  sha1.c
- *
- *  Description:
- *      This file implements the Secure Hashing Algorithm 1 as
- *      defined in FIPS PUB 180-1 published April 17, 1995.
- *
- *      The SHA-1, produces a 160-bit message digest for a given
- *      data stream.  It should take about 2**n steps to find a
- *      message with the same digest as a given message and
- *      2**(n/2) to find any two messages with the same digest,
- *      when n is the digest size in bits.  Therefore, this
- *      algorithm can serve as a means of providing a
- *      "fingerprint" for a message.
- *
- *  Portability Issues:
- *      SHA-1 is defined in terms of 32-bit "words".  This code
- *      uses <stdint.h> (included via "sha1.h" to define 32 and 8
- *      bit unsigned integer types.  If your C compiler does not
- *      support 32 bit unsigned integers, this code is not
- *      appropriate.
- *
- *  Caveats:
- *      SHA-1 is designed to work with messages less than 2^64 bits
- *      long.  Although SHA-1 allows a message digest to be generated
- *      for messages of any number of bits less than 2^64, this
- *      implementation only works with messages with a length that is
- *      a multiple of the size of an 8-bit character.
- *
- */
-
-#include "sha1.h"
-
-/*
- *  Define the SHA1 circular left shift macro
- */
-#define SHA1CircularShift(bits,word) \
-                (((word) << (bits)) | ((word) >> (32-(bits))))
-
-/* Local Function Prototyptes */
-void SHA1PadMessage(SHA1Context *);
-void SHA1ProcessMessageBlock(SHA1Context *);
-
-/*
- *  SHA1Reset
- *
- *  Description:
- *      This function will initialize the SHA1Context in preparation
- *      for computing a new SHA1 message digest.
- *
- *  Parameters:
- *      context: [in/out]
- *          The context to reset.
- *
- *  Returns:
- *      sha Error Code.
- *
- */
-int SHA1Reset(SHA1Context *context)
-{
-    if (!context)
-    {
-        return shaNull;
-    }
-
-    context->Length_Low             = 0;
-    context->Length_High            = 0;
-    context->Message_Block_Index    = 0;
-
-    context->Intermediate_Hash[0]   = 0x67452301;
-    context->Intermediate_Hash[1]   = 0xEFCDAB89;
-    context->Intermediate_Hash[2]   = 0x98BADCFE;
-    context->Intermediate_Hash[3]   = 0x10325476;
-    context->Intermediate_Hash[4]   = 0xC3D2E1F0;
-
-    context->Computed   = 0;
-    context->Corrupted  = 0;
-    return shaSuccess;
-}
-
-/*
- *  SHA1Result
- *
- *  Description:
- *      This function will return the 160-bit message digest into the
- *      Message_Digest array  provided by the caller.
- *      NOTE: The first octet of hash is stored in the 0th element,
- *            the last octet of hash in the 19th element.
- *
- *  Parameters:
- *      context: [in/out]
- *          The context to use to calculate the SHA-1 hash.
- *      Message_Digest: [out]
- *          Where the digest is returned.
- *
- *  Returns:
- *      sha Error Code.
- *
- */
-int SHA1Result( SHA1Context *context,
-                uint8_t Message_Digest[SHA1HashSize])
-{
-    int i;
-
-    if (!context || !Message_Digest)
-    {
-        return shaNull;
-    }
-
-    if (context->Corrupted)
-    {
-        return context->Corrupted;
-    }
-
-    if (!context->Computed)
-    {
-        SHA1PadMessage(context);
-        for(i=0; i<64; ++i)
-        {
-            /* message may be sensitive, clear it out */
-            context->Message_Block[i] = 0;
-        }
-        context->Length_Low = 0;    /* and clear length */
-        context->Length_High = 0;
-        context->Computed = 1;
-    }
-
-    for(i = 0; i < SHA1HashSize; ++i)
-    {
-        Message_Digest[i] = context->Intermediate_Hash[i>>2]
-                            >> 8 * ( 3 - ( i & 0x03 ) );
-    }
-
-    return shaSuccess;
-}
-
-/*
- *  SHA1Input
- *
- *  Description:
- *      This function accepts an array of octets as the next portion
- *      of the message.
- *
- *  Parameters:
- *      context: [in/out]
- *          The SHA context to update
- *      message_array: [in]
- *          An array of characters representing the next portion of
- *          the message.
- *      length: [in]
- *          The length of the message in message_array
- *
- *  Returns:
- *      sha Error Code.
- *
- */
-int SHA1Input(    SHA1Context    *context,
-                  const uint8_t  *message_array,
-                  unsigned       length)
-{
-    if (!length)
-    {
-        return shaSuccess;
-    }
-
-    if (!context || !message_array)
-    {
-        return shaNull;
-    }
-
-    if (context->Computed)
-    {
-        context->Corrupted = shaStateError;
-        return shaStateError;
-    }
-
-    if (context->Corrupted)
-    {
-         return context->Corrupted;
-    }
-    while(length-- && !context->Corrupted)
-    {
-    context->Message_Block[context->Message_Block_Index++] =
-                    (*message_array & 0xFF);
-
-    context->Length_Low += 8;
-    if (context->Length_Low == 0)
-    {
-        context->Length_High++;
-        if (context->Length_High == 0)
-        {
-            /* Message is too long */
-            context->Corrupted = 1;
-        }
-    }
-
-    if (context->Message_Block_Index == 64)
-    {
-        SHA1ProcessMessageBlock(context);
-    }
-
-    message_array++;
-    }
-
-    return shaSuccess;
-}
-
-/*
- *  SHA1ProcessMessageBlock
- *
- *  Description:
- *      This function will process the next 512 bits of the message
- *      stored in the Message_Block array.
- *
- *  Parameters:
- *      None.
- *
- *  Returns:
- *      Nothing.
- *
- *  Comments:
- *      Many of the variable names in this code, especially the
- *      single character names, were used because those were the
- *      names used in the publication.
- *
- *
- */
-void SHA1ProcessMessageBlock(SHA1Context *context)
-{
-    const uint32_t K[] =    {       /* Constants defined in SHA-1   */
-                            0x5A827999,
-                            0x6ED9EBA1,
-                            0x8F1BBCDC,
-                            0xCA62C1D6
-                            };
-    int           t;                 /* Loop counter                */
-    uint32_t      temp;              /* Temporary word value        */
-    uint32_t      W[80];             /* Word sequence               */
-    uint32_t      A, B, C, D, E;     /* Word buffers                */
-
-    /*
-     *  Initialize the first 16 words in the array W
-     */
-    for(t = 0; t < 16; t++)
-    {
-        W[t] = context->Message_Block[t * 4] << 24;
-        W[t] |= context->Message_Block[t * 4 + 1] << 16;
-        W[t] |= context->Message_Block[t * 4 + 2] << 8;
-        W[t] |= context->Message_Block[t * 4 + 3];
-    }
-
-    for(t = 16; t < 80; t++)
-    {
-       W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
-    }
-
-    A = context->Intermediate_Hash[0];
-    B = context->Intermediate_Hash[1];
-    C = context->Intermediate_Hash[2];
-    D = context->Intermediate_Hash[3];
-    E = context->Intermediate_Hash[4];
-
-    for(t = 0; t < 20; t++)
-    {
-        temp =  SHA1CircularShift(5,A) +
-                ((B & C) | ((~B) & D)) + E + W[t] + K[0];
-        E = D;
-        D = C;
-        C = SHA1CircularShift(30,B);
-        B = A;
-        A = temp;
-    }
-
-    for(t = 20; t < 40; t++)
-    {
-        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
-        E = D;
-        D = C;
-        C = SHA1CircularShift(30,B);
-        B = A;
-        A = temp;
-    }
-
-    for(t = 40; t < 60; t++)
-    {
-        temp = SHA1CircularShift(5,A) +
-               ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
-        E = D;
-        D = C;
-        C = SHA1CircularShift(30,B);
-        B = A;
-        A = temp;
-    }
-
-    for(t = 60; t < 80; t++)
-    {
-        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
-        E = D;
-        D = C;
-        C = SHA1CircularShift(30,B);
-        B = A;
-        A = temp;
-    }
-
-    context->Intermediate_Hash[0] += A;
-    context->Intermediate_Hash[1] += B;
-    context->Intermediate_Hash[2] += C;
-    context->Intermediate_Hash[3] += D;
-    context->Intermediate_Hash[4] += E;
-
-    context->Message_Block_Index = 0;
-}
-
-
-/*
- *  SHA1PadMessage
- *
- *  Description:
- *      According to the standard, the message must be padded to an even
- *      512 bits.  The first padding bit must be a '1'.  The last 64
- *      bits represent the length of the original message.  All bits in
- *      between should be 0.  This function will pad the message
- *      according to those rules by filling the Message_Block array
- *      accordingly.  It will also call the ProcessMessageBlock function
- *      provided appropriately.  When it returns, it can be assumed that
- *      the message digest has been computed.
- *
- *  Parameters:
- *      context: [in/out]
- *          The context to pad
- *      ProcessMessageBlock: [in]
- *          The appropriate SHA*ProcessMessageBlock function
- *  Returns:
- *      Nothing.
- *
- */
-
-void SHA1PadMessage(SHA1Context *context)
-{
-    /*
-     *  Check to see if the current message block is too small to hold
-     *  the initial padding bits and length.  If so, we will pad the
-     *  block, process it, and then continue padding into a second
-     *  block.
-     */
-    if (context->Message_Block_Index > 55)
-    {
-        context->Message_Block[context->Message_Block_Index++] = 0x80;
-        while(context->Message_Block_Index < 64)
-        {
-            context->Message_Block[context->Message_Block_Index++] = 0;
-        }
-
-        SHA1ProcessMessageBlock(context);
-
-        while(context->Message_Block_Index < 56)
-        {
-            context->Message_Block[context->Message_Block_Index++] = 0;
-        }
-    }
-    else
-    {
-        context->Message_Block[context->Message_Block_Index++] = 0x80;
-        while(context->Message_Block_Index < 56)
-        {
-            context->Message_Block[context->Message_Block_Index++] = 0;
-        }
-    }
-
-    /*
-     *  Store the message length as the last 8 octets
-     */
-    context->Message_Block[56] = context->Length_High >> 24;
-    context->Message_Block[57] = context->Length_High >> 16;
-    context->Message_Block[58] = context->Length_High >> 8;
-    context->Message_Block[59] = context->Length_High;
-    context->Message_Block[60] = context->Length_Low >> 24;
-    context->Message_Block[61] = context->Length_Low >> 16;
-    context->Message_Block[62] = context->Length_Low >> 8;
-    context->Message_Block[63] = context->Length_Low;
-
-    SHA1ProcessMessageBlock(context);
-}
diff --git a/ica/x11/common/sha1.h b/ica/x11/common/sha1.h
deleted file mode 100644
index 1d49b1b..0000000
--- a/ica/x11/common/sha1.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) The Internet Society (2001).  All Rights Reserved.
- *
- * This document and translations of it may be copied and furnished to
- * others, and derivative works that comment on or otherwise explain it
- * or assist in its implementation may be prepared, copied, published
- * and distributed, in whole or in part, without restriction of any
- * kind, provided that the above copyright notice and this paragraph are
- * included on all such copies and derivative works.  However, this
- * document itself may not be modified in any way, such as by removing
- * the copyright notice or references to the Internet Society or other
- * Internet organizations, except as needed for the purpose of
- * developing Internet standards in which case the procedures for
- * copyrights defined in the Internet Standards process must be
- * followed, or as required to translate it into languages other than
- * English.
- *
- * The limited permissions granted above are perpetual and will not be
- * revoked by the Internet Society or its successors or assigns.
- *
- * This document and the information contained herein is provided on an
- * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- *  sha1.h
- *
- *  Description:
- *      This is the header file for code which implements the Secure
- *      Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
- *      April 17, 1995.
- *
- *      Many of the variable names in this code, especially the
- *      single character names, were used because those were the names
- *      used in the publication.
- *
- *      Please read the file sha1.c for more information.
- *
- */
-
-
-#ifndef _SHA1_H_
-#define _SHA1_H_
-
-#include <stdint.h>
-/*
- * If you do not have the ISO standard stdint.h header file, then you
- * must typdef the following:
- *    name              meaning
- *  uint32_t         unsigned 32 bit integer
- *  uint8_t          unsigned 8 bit integer (i.e., unsigned char)
- *  int_least16_t    integer of >= 16 bits
- *
- */
-
-#ifndef _SHA_enum_
-#define _SHA_enum_
-enum
-{
-    shaSuccess = 0,
-    shaNull,            /* Null pointer parameter */
-    shaInputTooLong,    /* input data too long */
-    shaStateError       /* called Input after Result */
-};
-#endif
-#define SHA1HashSize 20
-
-/*
- *  This structure will hold context information for the SHA-1
- *  hashing operation
- */
-typedef struct SHA1Context
-{
-    uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest  */
-
-    uint32_t Length_Low;            /* Message length in bits      */
-    uint32_t Length_High;           /* Message length in bits      */
-
-                               /* Index into message block array   */
-    int_least16_t Message_Block_Index;
-    uint8_t Message_Block[64];      /* 512-bit message blocks      */
-
-    int Computed;               /* Is the digest computed?         */
-    int Corrupted;             /* Is the message digest corrupted? */
-} SHA1Context;
-
-/*
- *  Function Prototypes
- */
-int SHA1Reset(  SHA1Context *);
-int SHA1Input(  SHA1Context *,
-                const uint8_t *,
-                unsigned int);
-int SHA1Result( SHA1Context *,
-                uint8_t Message_Digest[SHA1HashSize]);
-
-#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/italc.git



More information about the debian-edu-commits mailing list