diff --git a/common/rfb/CFTMsgReader.cxx b/common/rfb/CFTMsgReader.cxx
deleted file mode 100644
index 1ecedde..0000000
--- a/common/rfb/CFTMsgReader.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- CFTMsgReader.cxx
-
-#include <rfb/CFTMsgReader.h>
-
-using namespace rfb;
-
-CFTMsgReader::CFTMsgReader(rdr::InStream *pIS)
-{
-  m_pInStream = pIS;
-}
-
-CFTMsgReader::~CFTMsgReader()
-{
-
-}
-
-int 
-CFTMsgReader::readFileListData(FileInfo *pFileInfo)
-{
-  unsigned char flags = m_pInStream->readU8();
-  int numFiles = m_pInStream->readU16();
-  int dataSize = m_pInStream->readU16();
-  int compressedSize = m_pInStream->readU16();
-  
-  if (flags & 0x80) {
-    return -1;
-  } else {
-    if (numFiles > 0) {
-      char *pFilenames = new char[compressedSize];
-      SIZEDATAINFO *pSDI = new SIZEDATAINFO[numFiles];
-      for (int i = 0; i < numFiles; i++) {
-        pSDI[i].size = m_pInStream->readU32();
-        pSDI[i].data = m_pInStream->readU32();
-      }
-      m_pInStream->readBytes((void *)pFilenames, compressedSize);
-      createFileInfo(numFiles, pFileInfo, pSDI, pFilenames);
-      delete [] pSDI;
-      delete [] pFilenames;
-    }
-  }
-  return numFiles;
-}
-
-void * 
-CFTMsgReader::readFileDownloadData(unsigned int *pSize, unsigned int *pModTime)
-{
-  unsigned char compressLevel = m_pInStream->readU8();
-  int realSize = m_pInStream->readU16();
-  int compressedSize = m_pInStream->readU16();
-
-  if ((realSize == 0) && (compressedSize == 0)) {
-    *pSize = 0;
-    *pModTime = m_pInStream->readU32();
-    return NULL;
-  } else {
-    char *pFile = new char [compressedSize];
-    if (pFile == NULL) {
-      m_pInStream->skip(compressedSize);
-      *pModTime = 0;
-      return NULL;
-    } else {
-      m_pInStream->readBytes(pFile, compressedSize);
-      *pSize = compressedSize;
-      return pFile;
-    }
-  }
-}
-
-char * 
-CFTMsgReader::readFileUploadCancel(unsigned int *pReasonSize)
-{
-  m_pInStream->skip(1);
-  return readReasonMsg(pReasonSize);
-}
-
-char * 
-CFTMsgReader::readFileDownloadFailed(unsigned int *pReasonSize)
-{
-  m_pInStream->skip(1);
-  return readReasonMsg(pReasonSize);
-}
-
-int 
-CFTMsgReader::readFileDirSizeData(unsigned short *pDirSizeLow16, 
-                                 unsigned int *pDirSizeHigh32)
-{
-  m_pInStream->skip(1);
-  *pDirSizeLow16 = m_pInStream->readU16();
-  *pDirSizeHigh32 = m_pInStream->readU32();
-  return 1;
-}
-
-char * 
-CFTMsgReader::readFileLastRqstFailed(int *pTypeOfRequest, unsigned int *pReasonSize)
-{
-  *pTypeOfRequest = m_pInStream->readU8();
-  return readReasonMsg(pReasonSize);
-}
-
-bool 
-CFTMsgReader::createFileInfo(unsigned int numFiles, FileInfo *fi, 
-                             SIZEDATAINFO *pSDInfo, char *pFilenames)
-{
-  int pos = 0;
-  int size = 0;
-  for (unsigned int i = 0; i < numFiles; i++) {
-    size = pSDInfo[i].size;
-    if (size == FT_NET_ATTR_DIR) {
-      fi->add((pFilenames + pos), size, pSDInfo[i].data, FT_ATTR_DIR);
-    } else {
-      fi->add((pFilenames + pos), size, pSDInfo[i].data, FT_ATTR_FILE);
-    }
-    pos += strlen(pFilenames + pos) + 1;
-  }
-  return true;
-}
-
-char * 
-CFTMsgReader::readReasonMsg(unsigned int *pReasonSize)
-{
-  int reasonLen = m_pInStream->readU16();
-  int _reasonLen = reasonLen + 1;
-  char *pReason;
-  if (reasonLen == 0) {
-    *pReasonSize = 0;
-    return NULL;
-  } else {
-    pReason = new char [_reasonLen];
-    if (pReason == NULL) {
-      m_pInStream->skip(reasonLen);
-      *pReasonSize = 0;
-      return NULL;
-    }
-    m_pInStream->readBytes(pReason, reasonLen);
-    memset(((char *)pReason+reasonLen), '\0', 1);
-    return pReason;
-  }
-}
-
diff --git a/common/rfb/CFTMsgReader.h b/common/rfb/CFTMsgReader.h
deleted file mode 100644
index eab824d..0000000
--- a/common/rfb/CFTMsgReader.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- CFTMsgReader.h
-
-#ifndef __RFB_CFTMSGREADER_H__
-#define __RFB_CFTMSGREADER_H__
-
-#include <rdr/InStream.h>
-#include <rfb/FileInfo.h>
-
-namespace rfb {
-  class CFTMsgReader
-  {
-  public:
-    CFTMsgReader(rdr::InStream *pIS);
-    ~CFTMsgReader();
-    
-    int readFileListData(FileInfo *pFileInfo);
-    int readFileDirSizeData(unsigned short *pDirSizeLow16, unsigned int *pDirSizeHigh32);
-    
-    char *readFileUploadCancel(unsigned int *pReasonSize);
-    char *readFileDownloadFailed(unsigned int *pReasonSize);
-    char *readFileLastRqstFailed(int *pTypeOfRequest, unsigned int *pReasonSize);
-    void *readFileDownloadData(unsigned int *pSize, unsigned int *pModTime);
-    
-  private:
-    rdr::InStream *m_pInStream;
-    
-    bool createFileInfo(unsigned int numFiles, FileInfo *fi, 
-                        SIZEDATAINFO *pSDInfo, char *pFilenames);
-    char *readReasonMsg(unsigned int *pReasonSize);
-  };
-}
-
-#endif // __RFB_CFTMSGREADER_H__
diff --git a/common/rfb/CFTMsgWriter.cxx b/common/rfb/CFTMsgWriter.cxx
deleted file mode 100644
index 6925484..0000000
--- a/common/rfb/CFTMsgWriter.cxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- CFTMsgWriter.cxx
-
-#include <rfb/CFTMsgWriter.h>
-
-using namespace rfb;
-
-CFTMsgWriter::CFTMsgWriter(rdr::OutStream *pOS)
-{
-  m_pOutStream = pOS;
-}
-
-CFTMsgWriter::~CFTMsgWriter()
-{
-}
-
-bool 
-CFTMsgWriter::writeFileListRqst(unsigned short dirnameLen, char *pDirName, 
-                                bool bDirOnly)
-{
-  if (dirnameLen >= FT_FILENAME_SIZE) return false;
-
-  unsigned char flags = 0;
-  if (bDirOnly) flags = 0x10;
-
-  m_pOutStream->writeU8(msgTypeFileListRequest);
-  m_pOutStream->writeU8(flags);
-  m_pOutStream->writeU16(dirnameLen);
-  m_pOutStream->writeBytes((void *)pDirName, dirnameLen);
-  m_pOutStream->flush();
-
-  return true;
-}
-
-
-bool 
-CFTMsgWriter::writeFileDownloadCancel(unsigned short reasonLen, char *pReason)
-{
-  m_pOutStream->writeU8(msgTypeFileDownloadCancel);
-  return writeU8U16StringMsg(reasonLen, pReason);
-}
-
-bool 
-CFTMsgWriter::writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, 
-                                    unsigned int position)
-{
-  if (filenameLen >= FT_FILENAME_SIZE) return false;
-
-  m_pOutStream->writeU8(msgTypeFileDownloadRequest);
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(filenameLen);
-  m_pOutStream->writeU32(position);
-  m_pOutStream->writeBytes(pFilename, filenameLen);
-  m_pOutStream->flush();
-
-  return true;
-}
-
-bool 
-CFTMsgWriter::writeFileUploadData(unsigned short dataSize, char *pData)
-{
-  m_pOutStream->writeU8(msgTypeFileUploadData);
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(dataSize);
-  m_pOutStream->writeU16(dataSize);
-  m_pOutStream->writeBytes(pData, dataSize);
-  m_pOutStream->flush();
-
-  return true;
-}
-
-bool 
-CFTMsgWriter::writeFileUploadData(unsigned int modTime)
-{
-  m_pOutStream->writeU8(msgTypeFileUploadData);
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(0);
-  m_pOutStream->writeU16(0);
-  m_pOutStream->writeU32(modTime);
-  m_pOutStream->flush();
-
-  return true;
-}
-
-bool 
-CFTMsgWriter::writeFileUploadFailed(unsigned short reasonLen, char *pReason)
-{
-  m_pOutStream->writeU8(msgTypeFileUploadFailed);
-  return writeU8U16StringMsg(reasonLen, pReason);
-}
-
-bool 
-CFTMsgWriter::writeFileUploadRqst(unsigned short filenameLen, char *pFilename, 
-                                  unsigned int position)
-{
-  if (filenameLen >= FT_FILENAME_SIZE) return false;
-
-  m_pOutStream->writeU8(msgTypeFileUploadRequest);
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(filenameLen);
-  m_pOutStream->writeU32(position);
-  m_pOutStream->writeBytes((void *)pFilename, filenameLen);
-  m_pOutStream->flush();
-
-  return true;
-}
-
-bool 
-CFTMsgWriter::writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName)
-{
-  if (dirNameLen >= FT_FILENAME_SIZE) return false;
-
-  m_pOutStream->writeU8(msgTypeFileCreateDirRequest);
-  return writeU8U16StringMsg(dirNameLen, pDirName);
-}
-
-bool 
-CFTMsgWriter::writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName)
-{
-  if (dirNameLen >= FT_FILENAME_SIZE) return false;
-
-  m_pOutStream->writeU8(msgTypeFileDirSizeRequest);
-  return writeU8U16StringMsg(dirNameLen, pDirName);
-}
-
-bool 
-CFTMsgWriter::writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,
-                                  char *pOldName, char *pNewName)
-{
-  if ((oldNameLen >= FT_FILENAME_SIZE) || (newNameLen >= FT_FILENAME_SIZE)) return false;
-
-  m_pOutStream->writeU8(msgTypeFileRenameRequest);
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(oldNameLen);
-  m_pOutStream->writeU16(newNameLen);
-  m_pOutStream->writeBytes(pOldName, oldNameLen);
-  m_pOutStream->writeBytes(pNewName, newNameLen);
-  m_pOutStream->flush();
-  
-  return true;
-}
-
-bool 
-CFTMsgWriter::writeFileDeleteRqst(unsigned short nameLen, char *pName)
-{
-  if (nameLen >= FT_FILENAME_SIZE) return false;
-
-  m_pOutStream->writeU8(msgTypeFileDeleteRequest);
-  return writeU8U16StringMsg(nameLen, pName);
-}
-
-bool 
-CFTMsgWriter::writeU8U16StringMsg(unsigned short strLength, char *pString)
-{
-  m_pOutStream->writeU8(0);
-  m_pOutStream->writeU16(strLength);
-  m_pOutStream->writeBytes(pString, strLength);
-  m_pOutStream->flush();
-  return true;
-}
diff --git a/common/rfb/CFTMsgWriter.h b/common/rfb/CFTMsgWriter.h
deleted file mode 100644
index 4c06693..0000000
--- a/common/rfb/CFTMsgWriter.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- CFTMsgWriter.h
-
-#ifndef __RFB_CFTMSGWRITER_H__
-#define __RFB_CFTMSGWRITER_H__
-
-#include <rdr/types.h>
-#include <rdr/OutStream.h>
-#include <rfb/msgTypes.h>
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class CFTMsgWriter
-  {
-  public:
-    CFTMsgWriter(rdr::OutStream *pOS);
-    ~CFTMsgWriter();
-    
-    bool writeFileListRqst(unsigned short dirnameLen, char *pDirName, bool bDirOnly);
-    
-    bool writeFileDownloadCancel(unsigned short reasonLen, char *pReason);
-    bool writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, 
-                               unsigned int position);
-    
-    bool writeFileUploadData(unsigned short dataSize, char *pData);
-    bool writeFileUploadData(unsigned int modTime);
-    bool writeFileUploadFailed(unsigned short reasonLen, char *pReason);
-    bool writeFileUploadRqst(unsigned short filenameLen, char *pFilename, 
-                             unsigned int position);
-    
-    bool writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName);
-    bool writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName);
-    
-    bool writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,
-                             char *pOldName, char *pNewName);
-    bool writeFileDeleteRqst(unsigned short nameLen, char *pName);
-    
-  private:
-    rdr::OutStream *m_pOutStream;
-    
-    bool writeU8U16StringMsg(unsigned short strLength, char *pString);
-  };
-}
-
-#endif // __RFB_CFTMSGWRITER_H__
diff --git a/common/rfb/CMsgReaderV3.cxx b/common/rfb/CMsgReaderV3.cxx
index b2ba113..2b5196f 100644
--- a/common/rfb/CMsgReaderV3.cxx
+++ b/common/rfb/CMsgReaderV3.cxx
@@ -59,14 +59,6 @@
     case msgTypeBell:                readBell(); break;
     case msgTypeServerCutText:       readServerCutText(); break;
 
-    case msgTypeFileListData:
-    case msgTypeFileDownloadData:
-    case msgTypeFileUploadCancel:
-    case msgTypeFileDownloadFailed:
-    case msgTypeFileDirSizeData:
-    case msgTypeFileLastRequestFailed:
-      handler->processFTMsg(type); break;
-
     default:
       fprintf(stderr, "unknown message type %d\n", type);
       throw Exception("unknown message type");
diff --git a/common/rfb/DirManager.h b/common/rfb/DirManager.h
deleted file mode 100644
index e0d5736..0000000
--- a/common/rfb/DirManager.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- DirManager.cxx
-
-#ifndef __RFB_DIRMANAGER_H__
-#define __RFB_DIRMANAGER_H__
-
-#include <rfb/FileInfo.h>
-
-namespace rfb {
-  class DirManager {
-  public:
-    virtual ~DirManager() {};
-    virtual bool createDir(char *pFullPath) = 0;
-    virtual bool renameIt(char *pOldName, char *pNewName) = 0;
-    virtual bool deleteIt(char *pFullPath) = 0;
-
-    virtual bool getDirInfo(char *pPath, FileInfo *pFileInfo, unsigned int dirOnly) = 0;
-  };
-}
-
-#endif // __RFB_DIRMANAGER_H__
diff --git a/common/rfb/FileInfo.cxx b/common/rfb/FileInfo.cxx
deleted file mode 100644
index f2e0291..0000000
--- a/common/rfb/FileInfo.cxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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 <rfb/FileInfo.h>
-#include <rfb/util.h>
-
-#ifdef _WIN32
-#define strcasecmp _stricmp
-#endif
-
-using namespace rfb;
-
-// FIXME: Under Unix, file names are case-sensitive.
-
-int 
-CompareFileInfo(const void *F, const void *S)
-{
-  FILEINFO *pF = (FILEINFO *) F;
-  FILEINFO *pS = (FILEINFO *) S;
-  if (pF->info.flags == pS->info.flags) {
-    return strcasecmp(pF->name, pS->name);
-  } else {
-	if (pF->info.flags == FT_ATTR_DIR) return -1;
-	if (pS->info.flags == FT_ATTR_DIR)
-      return 1;
-	else
-      return strcasecmp(pF->name, pS->name);
-  }
-  
-  return 0;
-}
-
-FileInfo::FileInfo()
-{
-  m_numEntries = 0;
-  m_pEntries = NULL;
-}
-
-FileInfo::~FileInfo()
-{
-  free();
-}
-
-void 
-FileInfo::add(FileInfo *pFI)
-{
-  m_numEntries = pFI->getNumEntries();
-  FILEINFO *pTemporary = new FILEINFO[m_numEntries];
-  memcpy(pTemporary, pFI->getNameAt(0), m_numEntries * sizeof(FILEINFO));
-  
-  m_pEntries = pTemporary;
-  pTemporary = NULL;
-}
-
-void 
-FileInfo::add(FILEINFO *pFIStruct)
-{
-  add(pFIStruct->name, pFIStruct->info.size, pFIStruct->info.data, pFIStruct->info.flags);
-}
-
-void 
-FileInfo::add(char *pName, unsigned int size, unsigned int data, unsigned int flags)
-{
-  FILEINFO *pTemporary = new FILEINFO[m_numEntries + 1];
-  if (m_numEntries != 0) 
-    memcpy(pTemporary, m_pEntries, m_numEntries * sizeof(FILEINFO));
-  strcpy(pTemporary[m_numEntries].name, pName);
-  pTemporary[m_numEntries].info.size = size;
-  pTemporary[m_numEntries].info.data = data;
-  pTemporary[m_numEntries].info.flags = flags;
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  m_pEntries = pTemporary;
-  pTemporary = NULL;
-  m_numEntries++;
-}
-
-char *
-FileInfo::getNameAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].name;
-  }
-  return NULL;
-}
-
-bool 
-FileInfo::setNameAt(unsigned int number, char *pName)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    strcpy(m_pEntries[number].name, pName);
-    return true;
-  }
-  return false;
-}
-
-unsigned int
-FileInfo::getSizeAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].info.size;
-  }
-  return 0;
-}
-
-unsigned int
-FileInfo::getDataAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].info.data;
-  }
-  return 0;
-}
-
-unsigned int
-FileInfo::getFlagsAt(unsigned int number)
-{
-	if ((number >= 0) && (number < m_numEntries)) {
-		return m_pEntries[number].info.flags;
-	}
-	return 0;
-}
-
-FILEINFO * 
-FileInfo::getFullDataAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return &m_pEntries[number];
-  }
-  return NULL;
-}
-	
-bool 
-FileInfo::setSizeAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.size = value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-FileInfo::setDataAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.data = value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-FileInfo::setFlagsAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.flags = value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-FileInfo::deleteAt(unsigned int number)
-{
-  if ((number >= m_numEntries) || (number < 0)) return false;
-  
-  FILEINFO *pTemporary = new FILEINFO[m_numEntries - 1];
-  
-  if (number == 0) {
-    memcpy(pTemporary, &m_pEntries[1], (m_numEntries - 1) * sizeof(FILEINFO));
-  } else {
-    memcpy(pTemporary, m_pEntries, number * sizeof(FILEINFO));
-    if (number != (m_numEntries - 1)) 
-      memcpy(&pTemporary[number], &m_pEntries[number + 1], (m_numEntries - number - 1) * sizeof(FILEINFO));
-  }
-  
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  m_pEntries = pTemporary;
-  pTemporary = NULL;
-  m_numEntries--;
-  return true;
-}
-
-unsigned int 
-FileInfo::getNumEntries()
-{
-  return m_numEntries;
-}
-
-void 
-FileInfo::sort()
-{
-  qsort(m_pEntries, m_numEntries, sizeof(FILEINFO), CompareFileInfo);
-}
-
-void 
-FileInfo::free()
-{
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  m_numEntries = 0;
-}
-
-unsigned int
-FileInfo::getFilenamesSize()
-{
-  if (getNumEntries() == 0) return 0;
-
-  unsigned int filenamesSize = 0;
-
-  for (unsigned int i = 0; i < getNumEntries(); i++) {
-    filenamesSize += strlen(getNameAt(i));
-  }
-
-  return filenamesSize;
-}
diff --git a/common/rfb/FileInfo.h b/common/rfb/FileInfo.h
deleted file mode 100644
index f51bd16..0000000
--- a/common/rfb/FileInfo.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileInfo.
-
-#ifndef __RFB_FILEINFO_H__
-#define __RFB_FILEINFO_H__
-
-#include <stdlib.h>
-
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class FileInfo  
-  {
-  public:
-    void add(FileInfo *pFI);
-    void add(FILEINFO *pFIStruct);
-    void add(char *pName, unsigned int size, unsigned int data, unsigned int flags);
-    
-    char *getNameAt(unsigned int number);
-    
-    bool setNameAt(unsigned int number, char *pName);
-    
-    unsigned int getSizeAt(unsigned int number);
-    unsigned int getDataAt(unsigned int number);
-    unsigned int getFlagsAt(unsigned int number);
-    
-    FILEINFO *getFullDataAt(unsigned int number);
-    
-    bool setSizeAt(unsigned int number, unsigned int value);
-    bool setDataAt(unsigned int number, unsigned int value);
-    bool setFlagsAt(unsigned int number, unsigned int value);
-    
-    bool deleteAt(unsigned int number);
-    
-    unsigned int getNumEntries();
-
-    unsigned int getFilenamesSize();
-    
-    void sort();
-    void free();
-    
-    FileInfo();
-    ~FileInfo();
-    
-  private:
-    FILEINFO *m_pEntries;
-    unsigned int m_numEntries;
-
-  };
-}
-
-#endif // __RFB_FILEINFO_H__
diff --git a/common/rfb/FileManager.cxx b/common/rfb/FileManager.cxx
deleted file mode 100644
index 89601d1..0000000
--- a/common/rfb/FileManager.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileManager.cxx
-
-#include <rfb/FileManager.h>
-
-using namespace rfb;
-
-FileManager::FileManager()
-{
-  m_pFile = NULL;
-}
-
-FileManager::~FileManager()
-{
-  close();
-}
-
-bool 
-FileManager::create(char *pFilename)
-{
-  if (m_pFile != NULL) return false;
-  
-  strcpy(m_szFilename, pFilename);
-
-  m_pFile = fopen(m_szFilename, m_szMode);
-
-  if (m_pFile == NULL) {
-    return false;
-  } else {
-    return true;
-  }
-}
-
-bool 
-FileManager::close()
-{
-  if (m_pFile == NULL) return false;
-  
-  int result = fclose(m_pFile);
-  
-  if (result != 0) {
-    return false;
-  } else {
-    m_pFile = NULL;
-    return true;
-  }
-}
-
-bool 
-FileManager::isCreated()
-{
-  if (m_pFile != NULL) return true; else return false;
-}
-
-char *
-FileManager::getFilename()
-{
-  return m_szFilename;
-}
diff --git a/common/rfb/FileManager.h b/common/rfb/FileManager.h
deleted file mode 100644
index f6cbc03..0000000
--- a/common/rfb/FileManager.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileManager.
-
-#ifndef __RFB_FILEMANAGER_H__
-#define __RFB_FILEMANAGER_H__
-
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class FileManager {
-  public:
-    FileManager();
-    ~FileManager();
-    
-    bool create(char *pFilename);
-    bool close();
-    
-    bool isCreated();
-
-    char *getFilename();
-
-  protected:
-    FILE *m_pFile;
-    char m_szMode[4];
-    char m_szFilename[FT_FILENAME_SIZE];
-  };
-}
-#endif // __RFB_FILEMANAGER_H__
diff --git a/common/rfb/FileReader.cxx b/common/rfb/FileReader.cxx
deleted file mode 100644
index f31f9cf..0000000
--- a/common/rfb/FileReader.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileReader.cxx
-
-#include <rfb/FileReader.h>
-
-using namespace rfb;
-
-FileReader::FileReader()
-{
-  strcpy(m_szMode, "rb");
-}
-
-bool 
-FileReader::read(void *pBuf, unsigned int count, unsigned int *pBytesRead)
-{
-  if (!isCreated()) return false;
-
-  *pBytesRead = fread(pBuf, 1, count, m_pFile);
-  
-  if (ferror(m_pFile)) return false;
- 
-  return true;
-}
-
-unsigned int 
-FileReader::getTime()
-{
-  return 0;
-}
diff --git a/common/rfb/FileReader.h b/common/rfb/FileReader.h
deleted file mode 100644
index e3f91c8..0000000
--- a/common/rfb/FileReader.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileReader.h
-
-#ifndef __RFB_FILEREADER_H__
-#define __RFB_FILEREADER_H__
-
-#include <rfb/FileManager.h>
-
-namespace rfb {
-  class FileReader : public FileManager {
-  public:
-    FileReader();
-
-    bool read(void *pBuf, unsigned int count, unsigned int *pBytesRead);
-
-    unsigned int getTime();
-  };
-}
-#endif // __RFB_FILEREADER_H__
diff --git a/common/rfb/FileWriter.cxx b/common/rfb/FileWriter.cxx
deleted file mode 100644
index 0649a98..0000000
--- a/common/rfb/FileWriter.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileWriter.cxx
-
-#include <rfb/FileWriter.h>
-
-using namespace rfb;
-
-FileWriter::FileWriter()
-{
-  strcpy(m_szMode, "wb");
-}
-
-bool 
-FileWriter::write(const void *pBuf, unsigned int count, unsigned int *pBytesWritten)
-{
-  if (!isCreated()) return false;
-
-  unsigned int bytesWritten = fwrite(pBuf, 1, count, m_pFile);
-
-  if (ferror(m_pFile)) return false;
-
-  *pBytesWritten = bytesWritten;
-  return true;
-}
-
-bool 
-FileWriter::setTime(unsigned int modTime)
-{
-  return false;
-}
diff --git a/common/rfb/FileWriter.h b/common/rfb/FileWriter.h
deleted file mode 100644
index 7a0573b..0000000
--- a/common/rfb/FileWriter.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileWriter.h
-
-#ifndef __RFB_FILEWRITER_H__
-#define __RFB_FILEWRITER_H__
-
-#include <rfb/FileManager.h>
-
-namespace rfb {
-  class FileWriter : public FileManager {
-  public:
-    FileWriter();
-
-    bool write(const void *pBuf, unsigned int count, unsigned int *pBytesWritten);
-    bool setTime(unsigned int modTime);
-  };
-}
-
-#endif // __RFB_FILEWRITER_H__
diff --git a/common/rfb/Makefile.am b/common/rfb/Makefile.am
index 8087d61..c194aaf 100644
--- a/common/rfb/Makefile.am
+++ b/common/rfb/Makefile.am
@@ -1,12 +1,11 @@
 noinst_LTLIBRARIES = librfb.la
 
-HDRS = Blacklist.h CapsContainer.h CapsList.h CConnection.h CFTMsgReader.h \
-	CFTMsgWriter.h CMsgHandler.h CMsgReader.h CMsgReaderV3.h CMsgWriter.h \
+HDRS = Blacklist.h CapsContainer.h CapsList.h CConnection.h \
+	CMsgHandler.h CMsgReader.h CMsgReaderV3.h CMsgWriter.h \
 	CMsgWriterV3.h ColourCube.h ColourMap.h ComparingUpdateTracker.h \
 	Configuration.h ConnParams.h CSecurity.h CSecurityNone.h \
-	CSecurityVncAuth.h Cursor.h Decoder.h DirManager.h d3des.h Encoder.h \
-	encodings.h Exception.h FileInfo.h FileManager.h FileReader.h \
-	FileWriter.h fttypes.h hextileConstants.h hextileDecode.h \
+	CSecurityVncAuth.h Cursor.h Decoder.h d3des.h Encoder.h \
+	encodings.h Exception.h fttypes.h hextileConstants.h hextileDecode.h \
 	HextileDecoder.h hextileEncodeBetter.h hextileEncode.h \
 	HextileEncoder.h Hostname.h HTTPServer.h ImageGetter.h InputHandler.h \
 	KeyRemapper.h keysymdef.h \
@@ -14,34 +13,31 @@
 	msgTypes.h Password.h PixelBuffer.h PixelFormat.h PixelFormat.inl Pixel.h \
 	RawDecoder.h RawEncoder.h Rect.h Region.h rreDecode.h RREDecoder.h \
 	rreEncode.h RREEncoder.h ScaledPixelBuffer.h ScaleFilters.h \
-	SConnection.h SDesktop.h secTypes.h ServerCore.h SFileTransfer.h \
-	SFileTransferManager.h SFTMsgReader.h SFTMsgWriter.h SMsgHandler.h \
+	SConnection.h SDesktop.h secTypes.h ServerCore.h SMsgHandler.h \
 	SMsgReader.h SMsgReaderV3.h SMsgWriter.h SMsgWriterV3.h \
 	SSecurityFactoryStandard.h SSecurity.h SSecurityNone.h \
 	SSecurityVncAuth.h Threading.h tightDecode.h TightDecoder.h \
-	tightEncode.h TightEncoder.h TightPalette.h Timer.h TransferQueue.h \
+	tightEncode.h TightEncoder.h TightPalette.h Timer.h \
 	TransImageGetter.h transInitTempl.h transTempl.h TrueColourMap.h \
 	UpdateTracker.h UserPasswdGetter.h util.h VNCSConnectionST.h \
 	VNCServer.h VNCServerST.h zrleDecode.h ZRLEDecoder.h zrleEncode.h \
 	ZRLEEncoder.h
 
-librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CFTMsgReader.cxx CFTMsgWriter.cxx CMsgHandler.cxx \
+librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CMsgHandler.cxx \
 	CMsgReader.cxx CMsgReaderV3.cxx CMsgWriter.cxx CMsgWriterV3.cxx \
 	CSecurityVncAuth.cxx CapsContainer.cxx CapsList.cxx \
 	ComparingUpdateTracker.cxx Configuration.cxx ConnParams.cxx \
-	Cursor.cxx Decoder.cxx d3des.c Encoder.cxx FileInfo.cxx \
-	FileManager.cxx FileReader.cxx FileWriter.cxx \
+	Cursor.cxx Decoder.cxx d3des.c Encoder.cxx \
 	HTTPServer.cxx HextileDecoder.cxx HextileEncoder.cxx \
 	KeyRemapper.cxx LogWriter.cxx Logger.cxx Logger_file.cxx \
 	Logger_stdio.cxx Password.cxx PixelBuffer.cxx PixelFormat.cxx \
 	RREEncoder.cxx RREDecoder.cxx RawDecoder.cxx RawEncoder.cxx \
-	Region.cxx SConnection.cxx SFTMsgReader.cxx SFTMsgWriter.cxx \
-	SFileTransfer.cxx SFileTransferManager.cxx SMsgHandler.cxx \
+	Region.cxx SConnection.cxx SMsgHandler.cxx \
 	SMsgReader.cxx SMsgReaderV3.cxx SMsgWriter.cxx SMsgWriterV3.cxx \
 	ServerCore.cxx SSecurityFactoryStandard.cxx SSecurityVncAuth.cxx \
 	ScaledPixelBuffer.cxx ScaleFilters.cxx Timer.cxx TightDecoder.cxx \
 	TightEncoder.cxx TightPalette.cxx TransImageGetter.cxx \
-	TransferQueue.cxx UpdateTracker.cxx VNCSConnectionST.cxx \
+	UpdateTracker.cxx VNCSConnectionST.cxx \
 	VNCServerST.cxx ZRLEEncoder.cxx ZRLEDecoder.cxx encodings.cxx \
 	secTypes.cxx util.cxx
 
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 9c6ffe3..084fcd3 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -429,36 +429,12 @@
 
   CapsList scaps;
 
-  // File transfer:
-  /* FIXME: File transfers are not finished yet: 
-  scaps.addTightExt(msgTypeFileListData,            "FTS_LSDT");
-  scaps.addTightExt(msgTypeFileDownloadData,        "FTS_DNDT");
-  scaps.addTightExt(msgTypeFileUploadCancel,        "FTS_UPCN");
-  scaps.addTightExt(msgTypeFileDownloadFailed,      "FTS_DNFL");
-  scaps.addTightExt(msgTypeFileDirSizeData,         "FTS_DSDT");
-  scaps.addTightExt(msgTypeFileLastRequestFailed,   "FTS_RQFL");
-  */
-
   //
   // Advertise support for non-standard client-to-server messages
   //
 
   CapsList ccaps;
 
-  // File transfer:
-  /* FIXME: File transfers are not finished yet: 
-  ccaps.addTightExt(msgTypeFileListRequest,         "FTC_LSRQ");
-  ccaps.addTightExt(msgTypeFileDownloadRequest,     "FTC_DNRQ");
-  ccaps.addTightExt(msgTypeFileUploadRequest,       "FTC_UPRQ");
-  ccaps.addTightExt(msgTypeFileUploadRequest,       "FTC_UPDT");
-  ccaps.addTightExt(msgTypeFileDownloadCancel,      "FTC_DNCN");
-  ccaps.addTightExt(msgTypeFileUploadFailed,        "FTC_UPFL");
-  ccaps.addTightExt(msgTypeFileCreateDirRequest,    "FTC_FCDR");
-  ccaps.addTightExt(msgTypeFileDirSizeRequest,      "FTC_DSRQ");
-  ccaps.addTightExt(msgTypeFileRenameRequest,       "FTC_RNRQ");
-  ccaps.addTightExt(msgTypeFileDeleteRequest,       "FTC_RMRQ");
-  */
-
   //
   // Advertise all supported encoding types (except raw encoding).
   //
diff --git a/common/rfb/SFTMsgReader.cxx b/common/rfb/SFTMsgReader.cxx
deleted file mode 100644
index cd79215..0000000
--- a/common/rfb/SFTMsgReader.cxx
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFTMsgReader.cxx
-
-#include <rfb/SFTMsgReader.h>
-
-using namespace rfb;
-
-SFTMsgReader::SFTMsgReader(rdr::InStream *pIS)
-{
-  m_pIS = pIS;
-}
-
-SFTMsgReader::~SFTMsgReader()
-{
-}
-    
-bool 
-SFTMsgReader::readFileListRqst(unsigned int *pDirNameSize, char *pDirName, 
-                               unsigned int *pFlags)
-{
-  *pFlags = m_pIS->readU8();
-  unsigned int dirNameSize = m_pIS->readU16();
-
-  if (dirNameSize >= FT_FILENAME_SIZE) {
-    m_pIS->skip(dirNameSize);
-    return false;
-  } else {
-    m_pIS->readBytes(pDirName, dirNameSize);
-    *pDirNameSize = dirNameSize;
-    pDirName[dirNameSize] = '\0';
-    return true;
-  }
-}
-    
-bool 
-SFTMsgReader::readFileDownloadRqst(unsigned int *pFilenameSize, char *pFilename, 
-                                   unsigned int *pPosition)
-{
-  unsigned char compressedLevel = 0;
-  return readU8U16U32StringMsg(&compressedLevel, pFilenameSize, pPosition, pFilename);
-}
-
-bool 
-SFTMsgReader::readFileUploadRqst(unsigned int *pFilenameSize, char *pFilename, 
-                                 unsigned int *pPosition)
-{
-  unsigned char compressedLevel = 0;
-  return readU8U16U32StringMsg(&compressedLevel, pFilenameSize, pPosition, pFilename);
-}
-    
-char *
-SFTMsgReader::readFileUploadData(unsigned int *pDataSize, unsigned int *pModTime)
-{
-  /*
-   * Compressed level is not used now so we have to skip one byte
-   *
-   * unsigned char compressedLevel = m_pIS->readU8();
-   */
-  (void) m_pIS->readU8();
-  unsigned int realSize = m_pIS->readU16();
-  unsigned int compressedSize = m_pIS->readU16();
-
-  if ((realSize == 0) && (compressedSize == 0)) {
-    *pDataSize = 0;
-    *pModTime = m_pIS->readU32();
-    return NULL;
-  } else {
-    char *pData = new char [compressedSize];
-    m_pIS->readBytes(pData, compressedSize);
-    *pDataSize = compressedSize;
-    *pModTime = 0;
-    return pData;
-  }
-}
-    
-bool 
-SFTMsgReader::readFileCreateDirRqst(unsigned int *pDirNameSize, char *pDirName)
-{
-  return readU8U16StringMsg(pDirNameSize, pDirName);
-}
-
-bool 
-SFTMsgReader::readFileDirSizeRqst(unsigned int *pDirNameSize, char *pDirName)
-{
-  return readU8U16StringMsg(pDirNameSize, pDirName);
-}
-
-bool 
-SFTMsgReader::readFileDeleteRqst(unsigned int *pNameSize, char *pName)
-{
-  return readU8U16StringMsg(pNameSize, pName);
-}
-    
-bool 
-SFTMsgReader::readFileRenameRqst(unsigned int *pOldNameSize, 
-                                 unsigned int *pNewNameSize,
-                                 char *pOldName, char *pNewName)
-{
-  m_pIS->skip(1);
-
-  unsigned int oldNameSize = m_pIS->readU16();
-  unsigned int newNameSize = m_pIS->readU16();
-
-  if ((oldNameSize >= *pOldNameSize) || (newNameSize >= *pNewNameSize)) {
-    m_pIS->skip(oldNameSize);
-    m_pIS->skip(newNameSize);
-    return false;
-  }
-
-  if (oldNameSize != 0) {
-    m_pIS->readBytes(pOldName, oldNameSize);
-    pOldName[oldNameSize] = '\0';
-    *pOldNameSize = oldNameSize;
-  } else {
-    *pOldNameSize = 0;
-    pOldName[0] = '\0';
-  }
-
-  if (newNameSize != 0) {
-    m_pIS->readBytes(pNewName, newNameSize);
-    pNewName[newNameSize] = '\0';
-  } else {
-    *pNewNameSize = 0;
-    pNewName[0] = '\0';
-  }
-
-  return true;
-}
-
-bool
-SFTMsgReader::readFileDownloadCancel(unsigned int *pReasonSize, char *pReason)
-{
-  return readU8U16StringMsg(pReasonSize, pReason);
-}
-
-bool
-SFTMsgReader::readFileUploadFailed(unsigned int *pReasonSize, char *pReason)
-{
-  return readU8U16StringMsg(pReasonSize, pReason);
-}
-
-bool 
-SFTMsgReader::readU8U16StringMsg(unsigned int *pReasonSize, char *pReason)
-{
-  m_pIS->skip(1);
-  unsigned int reasonSize = m_pIS->readU16();
-
-  if (reasonSize >= FT_FILENAME_SIZE) {
-    m_pIS->skip(reasonSize);
-    return false;
-  } else {
-    if (reasonSize == 0) {
-      pReason[0] = '\0';
-    } else {
-      m_pIS->readBytes(pReason, reasonSize);
-      pReason[reasonSize] = '\0';
-    }
-      *pReasonSize = reasonSize;
-    return true;
-  }
-}
-
-bool 
-SFTMsgReader::readU8U16U32StringMsg(unsigned char *pU8, unsigned int *pU16, 
-                                    unsigned int *pU32, char *pString)
-{
-  *pU8 = m_pIS->readU8();
-  unsigned int strSize = m_pIS->readU16();
-  *pU32 = m_pIS->readU32();
-
-  if (strSize >= FT_FILENAME_SIZE) {
-    m_pIS->skip(strSize);
-    return false;
-  } else {
-    *pU16 = strSize;
-    if (strSize == 0) {
-      pString[0] = '\0';
-    } else {
-      m_pIS->readBytes(pString, strSize);
-      pString[strSize] = '\0';
-    }
-    return true;
-  }
-}
diff --git a/common/rfb/SFTMsgReader.h b/common/rfb/SFTMsgReader.h
deleted file mode 100644
index 173253b..0000000
--- a/common/rfb/SFTMsgReader.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFTMsgReader.h
-
-#ifndef __RFB_SFTMSGREADER_H__
-#define __RFB_SFTMSGREADER_H__
-
-#include <rdr/InStream.h>
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class SFTMsgReader
-  {
-  public:
-    SFTMsgReader(rdr::InStream *pIS);
-    ~SFTMsgReader();
-    
-    bool readFileListRqst(unsigned int *pDirNameSize, char *pDirName, 
-                          unsigned int *pFlags);
-    
-    
-    bool readFileDownloadRqst(unsigned int *pFilenameSize, char *pFilename, 
-                              unsigned int *pPosition);
-
-    bool readFileUploadRqst(unsigned int *pFilenameSize, char *pFilename, 
-                            unsigned int *pPosition);
-    
-    char *readFileUploadData(unsigned int *pDataSize, unsigned int *pModTime);
-
-    
-    bool readFileCreateDirRqst(unsigned int *pDirNameSize, char *pDirName);
-    bool readFileDirSizeRqst(unsigned int *pDirNameSize, char *pDirName);
-    bool readFileDeleteRqst(unsigned int *pNameSize, char *pName);
-    
-    bool readFileRenameRqst(unsigned int *pOldNameSize, unsigned int *pNewNameSize,
-                            char *pOldName, char *pNewName);
-
-    bool readFileDownloadCancel(unsigned int *pReasonSize, char *pReason);
-    bool readFileUploadFailed(unsigned int *pReasonSize, char *pReason);
-
-  private:
-    rdr::InStream *m_pIS;
-
-    bool readU8U16StringMsg(unsigned int *pReasonSize, char *pReason);
-    bool readU8U16U32StringMsg(unsigned char *pU8, unsigned int *pU16, 
-                               unsigned int *pU32, char *pString);
-  };
-}
-
-#endif // __RFB_SFTMSGREADER_H__
diff --git a/common/rfb/SFTMsgWriter.cxx b/common/rfb/SFTMsgWriter.cxx
deleted file mode 100644
index 3a44b99..0000000
--- a/common/rfb/SFTMsgWriter.cxx
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFTMsgWriter.cxx
-
-#include <rfb/SFTMsgWriter.h>
-
-using namespace rfb;
-
-SFTMsgWriter::SFTMsgWriter(rdr::OutStream *pOS)
-{
-  m_pOS = pOS;
-}
-
-SFTMsgWriter::~SFTMsgWriter()
-{
-}
-    
-bool 
-SFTMsgWriter::writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo)
-{
-  unsigned int numFiles = pFileInfo->getNumEntries();
-
-  m_pOS->writeU8(msgTypeFileListData);
-  m_pOS->writeU8(flags);
-  m_pOS->writeU16(numFiles);
-  
-  if (numFiles == 0) {
-    m_pOS->writeU16(0);
-    m_pOS->writeU16(0);
-  } else {
-    unsigned int filenamesSize = pFileInfo->getFilenamesSize() + numFiles;
-
-    m_pOS->writeU16(filenamesSize);
-    m_pOS->writeU16(filenamesSize);
-
-    char *pFilenames = new char [filenamesSize];
-    unsigned int pos = 0;
-
-    for (unsigned int i = 0; i < numFiles; i++) {
-      char *pName = pFileInfo->getNameAt(i);
-      unsigned int len = strlen(pName);
-
-      memcpy((void *)&pFilenames[pos], pName, len + 1);
-      pos += (len + 1);
-
-      if (pFileInfo->getFlagsAt(i) & FT_ATTR_DIR) {
-        m_pOS->writeU32(FT_NET_ATTR_DIR);
-      } else {
-        m_pOS->writeU32(pFileInfo->getSizeAt(i));
-      }
-      m_pOS->writeU32(pFileInfo->getDataAt(i));
-    }
-
-    m_pOS->writeBytes(pFilenames, filenamesSize);
-
-    delete [] pFilenames;
-  }
-
-  m_pOS->flush();
-
-  return true;
-}
-
-bool 
-SFTMsgWriter::writeFileDownloadData(unsigned int dataSize, void *pData)
-{
-  m_pOS->writeU8(msgTypeFileDownloadData);
-  m_pOS->writeU8(0);
-  m_pOS->writeU16(dataSize);
-  m_pOS->writeU16(dataSize);
-  m_pOS->writeBytes(pData, dataSize);
-  m_pOS->flush();
-  return true;
-}
-
-bool 
-SFTMsgWriter::writeFileDownloadData(unsigned int modTime)
-{
-  m_pOS->writeU8(msgTypeFileDownloadData);
-  m_pOS->writeU8(0);
-  m_pOS->writeU16(0);
-  m_pOS->writeU16(0);
-  m_pOS->writeU32(modTime);
-  m_pOS->flush();
-  return true;
-}
-
-bool
-SFTMsgWriter::writeFileUploadCancel(unsigned int reasonLen, char *pReason)
-{
-  m_pOS->writeU8(msgTypeFileUploadCancel);
-  return writeU8U16StringMsg(0, reasonLen, pReason);
-}
-
-bool 
-SFTMsgWriter::writeFileDownloadFailed(unsigned int reasonLen, char *pReason)
-{
-  m_pOS->writeU8(msgTypeFileDownloadFailed);
-  return writeU8U16StringMsg(0, reasonLen, pReason);
-}
-
-bool 
-SFTMsgWriter::writeFileDirSizeData(unsigned int dirSizeLow, 
-                                   unsigned short dirSizeHigh)
-{
-  m_pOS->writeU8(msgTypeFileDirSizeData);
-  m_pOS->writeU8(0);
-  m_pOS->writeU16(dirSizeHigh);
-  m_pOS->writeU32(dirSizeLow);
-  m_pOS->flush();
-  return true;
-}
-
-bool 
-SFTMsgWriter::writeFileLastRqstFailed(unsigned char lastRequest, 
-                                      unsigned short reasonLen,
-                                      char *pReason)
-{
-  m_pOS->writeU8(msgTypeFileLastRequestFailed);
-  return writeU8U16StringMsg(lastRequest, reasonLen, pReason);
-}
-
-bool
-SFTMsgWriter::writeU8U16StringMsg(unsigned char p1, unsigned short p2, char *pP3)
-{
-  m_pOS->writeU8(p1);
-  m_pOS->writeU16(p2);
-  m_pOS->writeBytes(pP3, p2);
-  m_pOS->flush();
-  return true;
-}
diff --git a/common/rfb/SFTMsgWriter.h b/common/rfb/SFTMsgWriter.h
deleted file mode 100644
index 39cbbde..0000000
--- a/common/rfb/SFTMsgWriter.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFTMsgWriter.h
-
-#ifndef __RFB_SFTMSGWRITER_H__
-#define __RFB_SFTMSGWRITER_H__
-
-#include <rdr/OutStream.h>
-#include <rfb/FileInfo.h>
-#include <rfb/msgTypes.h>
-
-namespace rfb {
-  class SFTMsgWriter
-  {
-  public:
-    SFTMsgWriter(rdr::OutStream *pOS);
-    ~SFTMsgWriter();
-    
-    bool writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo);
-    bool writeFileDownloadData(unsigned int dataSize, void *pData);
-    bool writeFileDownloadData(unsigned int modTime);
-    bool writeFileUploadCancel(unsigned int reasonLen, char *pReason);
-    bool writeFileDownloadFailed(unsigned int reasonLen, char *pReason);
-    bool writeFileDirSizeData(unsigned int dirSizeLow, unsigned short dirSizeHigh);
-    bool writeFileLastRqstFailed(unsigned char lastRequest, unsigned short reasonLen, 
-                                 char *pReason);
-
-  private:
-    rdr::OutStream *m_pOS;
-
-    bool writeU8U16StringMsg(unsigned char p1, unsigned short p2, char *pP3);
-  };
-}
-
-#endif // __RFB_SFTMSGWRITER_H__
diff --git a/common/rfb/SFileTransfer.cxx b/common/rfb/SFileTransfer.cxx
deleted file mode 100644
index a5b4372..0000000
--- a/common/rfb/SFileTransfer.cxx
+++ /dev/null
@@ -1,335 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *    
- * Developed by Dennis Syrovatsky
- *
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransfer.cxx
-
-#include <rfb/msgTypes.h>
-#include <rfb/SFileTransfer.h>
-
-using namespace rfb;
-
-SFileTransfer::SFileTransfer(network::Socket *sock) : 
-  m_bUploadStarted(false), m_bDownloadStarted(false),
-  m_reader(&sock->inStream()), m_writer(&sock->outStream()), m_pSocket(sock)
-{
-}
-
-SFileTransfer::~SFileTransfer()
-{
-}
-
-bool
-SFileTransfer::processMessages(int type)
-{
-  switch(type)
-  {
-    case msgTypeFileListRequest:
-      return processFileListRequest();
-    case msgTypeFileDownloadRequest:
-      return processFileDownloadRequest();
-    case msgTypeFileUploadRequest:
-      return processFileUploadRequest();
-    case msgTypeFileUploadData:
-      return processFileUploadData();
-    case msgTypeFileDownloadCancel:
-      return processFileDownloadCancel();
-    case msgTypeFileUploadFailed:
-      return processFileUploadFailed();
-    case msgTypeFileCreateDirRequest:
-      return processFileCreateDirRequest();
-    case msgTypeFileDirSizeRequest:
-      return processFileDirSizeRequest();
-    case msgTypeFileRenameRequest:
-      return processFileRenameRequest();
-    case msgTypeFileDeleteRequest:
-      return processFileDeleteRequest();
-    default:
-      return false;
-  }
-}
-
-bool 
-SFileTransfer::processFileListRequest()
-{
-  char szDirName[FT_FILENAME_SIZE] = {0};
-  unsigned int dirNameSize = FT_FILENAME_SIZE;
-  unsigned int flags = 0;
-
-  if (!m_reader.readFileListRqst(&dirNameSize, szDirName, &flags)) return false;
-
-  if (!convertPathFromNet(szDirName)) return false;
-
-  bool bDirOnly = false;
-  if (flags & 0x10) bDirOnly = true;
-
-  FileInfo fi;
-  if (!makeFileList(szDirName, &fi, bDirOnly)) {
-    flags = (flags | 0x80);  
-  }
-  return m_writer.writeFileListData((unsigned char)flags, &fi);
-}
-
-bool 
-SFileTransfer::processFileDownloadRequest()
-{
-  char szName[FT_FILENAME_SIZE] = {0};
-  unsigned int nameSize = FT_FILENAME_SIZE;
-  unsigned int position = 0;
-
-  if (!m_reader.readFileDownloadRqst(&nameSize, szName, &position)) return false;
-
-  if (!convertPathFromNet(szName)) return false;
-
-  if (m_bDownloadStarted) {
-    char reason[] = "The download is already started";
-    m_writer.writeFileLastRqstFailed(msgTypeFileDownloadRequest, strlen(reason), reason);
-    return false;
-  }
-
-  if (!m_fileReader.create(szName)) return false;
-
-  m_bDownloadStarted = true;
-
-  sendFileDownloadPortion();
-
-  return true;
-}
-
-bool
-SFileTransfer::sendFileDownloadPortion()
-{
-  char buffer[FT_MAX_SENDING_SIZE];
-  unsigned int bytesRead = 0;
-
-  if (m_fileReader.read((void *)buffer, FT_MAX_SENDING_SIZE, &bytesRead)) {
-    if (bytesRead == 0) {
-      m_writer.writeFileDownloadData(m_fileReader.getTime());
-      m_fileReader.close();
-      m_bDownloadStarted = false;
-      return true;
-    } else {
-      m_writer.writeFileDownloadData(bytesRead, buffer);
-      return initDownloadCallback();
-    }
-  } else {
-    char reason[] = "Error while reading from file";
-    m_writer.writeFileDownloadFailed(strlen(reason), reason);
-    m_fileReader.close();
-    m_bDownloadStarted = false;
-    return true;
-  }
-}
-
-bool 
-SFileTransfer::processFileUploadRequest()
-{
-  char szName[FT_FILENAME_SIZE] = {0};
-  unsigned int nameSize = FT_FILENAME_SIZE;
-  unsigned int position = 0;
-
-  if (!m_reader.readFileUploadRqst(&nameSize, szName, &position)) return false;
-
-  if (!convertPathFromNet(szName)) return false;
-
-  if (m_bUploadStarted) {
-    char reason[] = "The upload is already started";
-    m_writer.writeFileLastRqstFailed(msgTypeFileUploadRequest, strlen(reason), reason);
-    return false;
-  }
-
-  if (!m_fileWriter.create(szName)) {
-    char reason[] = "Can't create local file";
-    m_writer.writeFileLastRqstFailed(msgTypeFileUploadRequest, strlen(reason), reason);
-    return true;
-  }
-
-  m_bUploadStarted = true;
-
-  return true;
-}
-
-bool 
-SFileTransfer::processFileUploadData()
-{
-  unsigned int dataSize = 0;
-  unsigned int modTime = 0;
-
-  char *pUploadData = m_reader.readFileUploadData(&dataSize, &modTime);
-
-  if (!m_bUploadStarted) {
-      char reason[] = "Upload is impossible";
-      m_writer.writeFileUploadCancel(strlen(reason), reason);
-  } else {
-    if (pUploadData == NULL) {
-      if (modTime == 0) {
-        char reason[] = "Upload failed";
-        m_writer.writeFileUploadCancel(strlen(reason), reason);
-      } else {
-        m_fileWriter.setTime(modTime);
-      }
-      m_fileWriter.close();
-      m_bUploadStarted = false;
-    } else {
-      unsigned int dataWritten = 0;
-      m_fileWriter.write(pUploadData, dataSize, &dataWritten);
-      if (dataWritten != dataSize) {
-        char reason[] = "Upload failed";
-        m_writer.writeFileUploadCancel(strlen(reason), reason);
-        m_fileWriter.close();
-        m_bUploadStarted = false;
-      }
-    }
-  }
-  delete [] pUploadData;
-  return true;
-}
-
-bool 
-SFileTransfer::processFileDownloadCancel()
-{
-  char szReason[FT_FILENAME_SIZE] = {0};
-  unsigned int reasonSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileDownloadCancel(&reasonSize, szReason)) return false;
-
-  m_fileReader.close();
-  m_bDownloadStarted = false;
-  return true;
-}
-
-bool 
-SFileTransfer::processFileUploadFailed()
-{
-  char szReason[FT_FILENAME_SIZE] = {0};
-  unsigned int reasonSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileUploadFailed(&reasonSize, szReason)) return false;
-
-  deleteIt(m_fileWriter.getFilename());
-  m_fileWriter.close();
-  m_bUploadStarted = false;
-  return true;
-}
-
-bool 
-SFileTransfer::processFileCreateDirRequest()
-{
-  char szName[FT_FILENAME_SIZE] = {0};
-  unsigned int nameSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileCreateDirRqst(&nameSize, szName)) return false;
-
-  if (!convertPathFromNet(szName)) return false;
-
-  return createDir(szName);
-}
-
-bool 
-SFileTransfer::processFileDirSizeRequest()
-{
-  char szName[FT_FILENAME_SIZE] = {0};
-  unsigned int nameSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileDirSizeRqst(&nameSize, szName)) return false;
-
-  if (!convertPathFromNet(szName)) return false;
-
-  unsigned short highSize16 = 0;
-  unsigned int lowSize32 = 0;
-
-  if (!getDirSize(szName, &highSize16, &lowSize32)) return false;
-
-  return m_writer.writeFileDirSizeData(lowSize32, highSize16);
-}
-
-bool 
-SFileTransfer::processFileRenameRequest()
-{
-  char szOldName[FT_FILENAME_SIZE] = {0};
-  char szNewName[FT_FILENAME_SIZE] = {0};
-
-  unsigned int oldNameSize = FT_FILENAME_SIZE;
-  unsigned int newNameSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileRenameRqst(&oldNameSize, &newNameSize, szOldName, szNewName)) return false;
-
-  if ((!convertPathFromNet(szOldName)) || (!convertPathFromNet(szNewName))) return false;
-
-  return renameIt(szOldName, szNewName);
-}
-
-bool 
-SFileTransfer::processFileDeleteRequest()
-{
-  char szName[FT_FILENAME_SIZE] = {0};
-  unsigned int nameSize = FT_FILENAME_SIZE;
-
-  if (!m_reader.readFileDeleteRqst(&nameSize, szName)) return false;
-
-  if (!convertPathFromNet(szName)) return false;
-
-  return deleteIt(szName);
-}
-
-bool 
-SFileTransfer::convertPathFromNet(char *pszPath)
-{
-  return true;
-}
-
-bool 
-SFileTransfer::makeFileList(char *pszPath, FileInfo *pFI, bool bDirOnly)
-{
-  return false;
-}
-
-bool 
-SFileTransfer::deleteIt(char *pszPath)
-{
-  return false;
-}
-
-bool 
-SFileTransfer::renameIt(char *pszOldPath, char *pszNewPath)
-{
-  return false;
-}
-
-bool 
-SFileTransfer::createDir(char *pszPath)
-{
-  return false;
-}
-
-bool 
-SFileTransfer::getDirSize(char *pszName, unsigned short *pHighSize16, 
-                          unsigned int *pLowSize32)
-{
-  return false;
-}
-
-bool
-SFileTransfer::initDownloadCallback()
-{
-  return false;
-}
diff --git a/common/rfb/SFileTransfer.h b/common/rfb/SFileTransfer.h
deleted file mode 100644
index ecf6493..0000000
--- a/common/rfb/SFileTransfer.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransfer.h
-
-#ifndef __RFB_SFILETRANSFER_H__
-#define __RFB_SFILETRANSFER_H__
-
-#include <network/Socket.h>
-#include <rfb/SFTMsgReader.h>
-#include <rfb/SFTMsgWriter.h>
-#include <rfb/FileWriter.h>
-#include <rfb/FileReader.h>
-#include <rfb/FileInfo.h>
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class SFileTransfer
-  {
-  public:
-    SFileTransfer(network::Socket *sock);
-    virtual ~SFileTransfer();
-
-    bool processMessages(int type);
-    bool sendFileDownloadPortion();
-
-  protected:
-    bool processFileListRequest();
-    bool processFileDownloadRequest();
-    bool processFileUploadRequest();
-    bool processFileUploadData();
-    bool processFileDownloadCancel();
-    bool processFileUploadFailed();
-    bool processFileCreateDirRequest();
-    bool processFileDirSizeRequest();
-    bool processFileRenameRequest();
-    bool processFileDeleteRequest();
-
-    virtual bool initDownloadCallback();
-    virtual bool makeFileList(char *pszPath, FileInfo *pFI, bool bDirOnly);
-    virtual bool convertPathFromNet(char *pszPath);
-
-    virtual bool deleteIt(char *pszPath);
-    virtual bool renameIt(char *pszOldPath, char *pszNewPath);
-    virtual bool createDir(char *pszPath);
-
-    virtual bool getDirSize(char *pszName, unsigned short *pHighSize16, unsigned int *pLowSize32);
-
-    bool m_bUploadStarted;
-    bool m_bDownloadStarted;
-    
-  private:
-    SFTMsgReader m_reader;
-    SFTMsgWriter m_writer;
-
-    FileWriter m_fileWriter;
-    FileReader m_fileReader;
-
-    network::Socket *m_pSocket;
-  };
-}
-
-#endif // __RFB_SFILETRANSFER_H__
diff --git a/common/rfb/SFileTransferManager.cxx b/common/rfb/SFileTransferManager.cxx
deleted file mode 100644
index fda9812..0000000
--- a/common/rfb/SFileTransferManager.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferManager.cxx
-
-#include <rfb/SFileTransferManager.h>
-
-using namespace rfb;
-
-SFileTransferManager::SFileTransferManager()
-{
-
-}
-
-SFileTransferManager::~SFileTransferManager()
-{
-  destroy();
-}
-
-void
-SFileTransferManager::destroyObject(SFileTransfer *pFT)
-{
-  if (pFT == NULL) return;
-
-  m_lstFTObjects.remove(pFT);
-
-  delete pFT;
-}
-
-void
-SFileTransferManager::destroy()
-{
-  while(!m_lstFTObjects.empty())
-    delete m_lstFTObjects.front();
-}
diff --git a/common/rfb/SFileTransferManager.h b/common/rfb/SFileTransferManager.h
deleted file mode 100644
index 1ee8c17..0000000
--- a/common/rfb/SFileTransferManager.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferManager.h
-
-#ifndef __RFB_SFILETRANSFERMANAGER_H__
-#define __RFB_SFILETRANSFERMANAGER_H__
-
-#include <list>
-
-#include <rfb/SFileTransfer.h>
-#include <network/Socket.h>
-
-namespace rfb {
-  class SFileTransferManager
-  {
-  public:
-    SFileTransferManager();
-    virtual ~SFileTransferManager();
-
-    virtual SFileTransfer *createObject(network::Socket *sock) = 0;
-    void destroyObject(SFileTransfer *pFT);
-
-  protected:
-    std::list<SFileTransfer*> m_lstFTObjects;
-
-    void destroy();
-  };
-}
-
-#endif // __RFB_SFILETRANSFERMANAGER_H__
diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h
index cf3377d..50a2dc4 100644
--- a/common/rfb/SMsgHandler.h
+++ b/common/rfb/SMsgHandler.h
@@ -56,8 +56,6 @@
     // specially for this purpose.
     virtual void supportsLocalCursor();
 
-    virtual bool processFTMsg(int type) = 0;
-
     ConnParams cp;
   };
 }
diff --git a/common/rfb/SMsgReaderV3.cxx b/common/rfb/SMsgReaderV3.cxx
index 165b23e..8e870cd 100644
--- a/common/rfb/SMsgReaderV3.cxx
+++ b/common/rfb/SMsgReaderV3.cxx
@@ -52,17 +52,6 @@
   case msgTypePointerEvent:             readPointerEvent(); break;
   case msgTypeClientCutText:            readClientCutText(); break;
 
-  case msgTypeFileListRequest:
-  case msgTypeFileDownloadRequest:
-  case msgTypeFileUploadRequest:
-  case msgTypeFileUploadData:
-  case msgTypeFileDownloadCancel:
-  case msgTypeFileUploadFailed:
-  case msgTypeFileCreateDirRequest:
-  case msgTypeFileDirSizeRequest:
-  case msgTypeFileRenameRequest:
-  case msgTypeFileDeleteRequest:        handler->processFTMsg(msgType); break;
-
   default:
     fprintf(stderr, "unknown message type %d\n", msgType);
     throw Exception("unknown message type");
diff --git a/common/rfb/TransferQueue.cxx b/common/rfb/TransferQueue.cxx
deleted file mode 100644
index 2b58362..0000000
--- a/common/rfb/TransferQueue.cxx
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- TransferQueue.
-
-#include <rfb/TransferQueue.h>
-
-using namespace rfb;
-
-TransferQueue::TransferQueue()
-{
-	 m_numEntries = 0;
-     m_pEntries = NULL;
-}
-
-TransferQueue::~TransferQueue()
-{
-  free();
-}
-
-void
-TransferQueue::add(TransferQueue *pTQ)
-{
-  for (unsigned int i = 0; i < pTQ->getNumEntries(); i++) {
-    add(pTQ->getLocPathAt(i), pTQ->getRemPathAt(i),	pTQ->getLocNameAt(i), 
-      pTQ->getRemNameAt(i), pTQ->getSizeAt(i), pTQ->getDataAt(i), pTQ->getFlagsAt(i));
-  }
-}
-
-void
-TransferQueue::add(char *pLocPath, char *pRemPath, FileInfo *pFI, unsigned int flags)
-{
-  char locPath[FT_FILENAME_SIZE];
-  char remPath[FT_FILENAME_SIZE];
-  strcpy(locPath, pLocPath);
-  strcpy(remPath, pRemPath);
-  
-  for (unsigned int i = 0; i < pFI->getNumEntries(); i++) {
-    add(locPath, remPath, pFI->getNameAt(i), pFI->getNameAt(i), 
-      pFI->getSizeAt(i), pFI->getDataAt(i), (pFI->getFlagsAt(i) | flags));
-  }
-}
-
-void 
-TransferQueue::add(char *pLocPath, char *pRemPath, char *pLocName, char *pRemName, 
-                   unsigned int size, unsigned int data, unsigned int flags)
-{
-  FILEINFOEX *pTemporary = new FILEINFOEX[m_numEntries + 1];
-  if (m_numEntries != 0) 
-    memcpy(pTemporary, m_pEntries, m_numEntries * sizeof(FILEINFOEX));
-  
-  strcpy(pTemporary[m_numEntries].locPath, pLocPath);
-  strcpy(pTemporary[m_numEntries].locName, pLocName);
-  strcpy(pTemporary[m_numEntries].remPath, pRemPath);
-  strcpy(pTemporary[m_numEntries].remName, pRemName);
-  
-  pTemporary[m_numEntries].info.size = size;
-  pTemporary[m_numEntries].info.data = data;
-  pTemporary[m_numEntries].info.flags = flags;
-  
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  
-  m_pEntries = pTemporary;
-  pTemporary = NULL;
-  m_numEntries++;
-}
-
-char *
-TransferQueue::getLocPathAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].locPath;
-  }
-  return NULL;
-}
-
-char *
-TransferQueue::getLocNameAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].locName;
-  }
-  return NULL;
-}
-
-char *
-TransferQueue::getRemPathAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].remPath;
-  }
-  return NULL;
-}
-
-char *
-TransferQueue::getRemNameAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].remName;
-  }
-  return NULL;
-}
-
-char *
-TransferQueue::getFullLocPathAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    sprintf(m_szFullLocPath, "%s\\%s", getLocPathAt(number), getLocNameAt(number));
-    return m_szFullLocPath;
-  }
-  return NULL;
-}
-
-char *
-TransferQueue::getFullRemPathAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    sprintf(m_szFullRemPath, "%s\\%s", getRemPathAt(number), getRemNameAt(number));
-    return m_szFullRemPath;
-  }
-  return NULL;
-}
-
-SIZEDATAFLAGSINFO * 
-TransferQueue::getSizeDataFlagsAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return &m_pEntries[number].info;
-  }
-  return NULL;
-}
-
-bool 
-TransferQueue::setLocPathAt(unsigned int number, char *pName)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    strcpy(m_pEntries[number].locPath, pName);
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setLocNameAt(unsigned int number, char *pName)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    strcpy(m_pEntries[number].locName, pName);
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setRemPathAt(unsigned int number, char *pName)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    strcpy(m_pEntries[number].remPath, pName);
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setRemNameAt(unsigned int number, char *pName)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    strcpy(m_pEntries[number].remName, pName);
-    return true;
-  }
-  return false;
-}
-
-unsigned int
-TransferQueue::getSizeAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].info.size;
-  }
-  return 0;
-}
-
-unsigned int
-TransferQueue::getDataAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].info.data;
-  }
-  return 0;
-}
-
-unsigned int 
-TransferQueue::getFlagsAt(unsigned int number)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    return m_pEntries[number].info.flags;
-  }
-  return 0;
-}
-
-bool 
-TransferQueue::setSizeAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.size = value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setDataAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.data = value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setFlagsAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.flags = m_pEntries[number].info.flags | value;
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::clearFlagAt(unsigned int number, unsigned int value)
-{
-  if ((number >= 0) && (number < m_numEntries)) {
-    m_pEntries[number].info.flags = (m_pEntries[number].info.flags & (value ^ 0xFFFFFFFF));
-    return true;
-  }
-  return false;
-}
-
-bool 
-TransferQueue::setFlagToAll(unsigned int flag)
-{
-  for (unsigned int i = 0; i < m_numEntries; i++) {
-    setFlagsAt(i, flag);
-  }
-  return true;
-}
-
-bool 
-TransferQueue::deleteAt(unsigned int number)
-{
-  if ((number >= m_numEntries) || (number < 0)) return false;
-  
-  FILEINFOEX *pTemporary = new FILEINFOEX[m_numEntries - 1];
-  
-  if (number == 0) {
-    memcpy(pTemporary, &m_pEntries[1], (m_numEntries - 1) * sizeof(FILEINFOEX));
-  } else {
-    memcpy(pTemporary, m_pEntries, number * sizeof(FILEINFOEX));
-    if (number != (m_numEntries - 1)) 
-      memcpy(&pTemporary[number], &m_pEntries[number + 1], (m_numEntries - number - 1) * sizeof(FILEINFOEX));
-  }
-  
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  m_pEntries = pTemporary;
-  pTemporary = NULL;
-  m_numEntries--;
-  return true;
-}
-
-unsigned int 
-TransferQueue::getNumEntries()
-{
-  return m_numEntries;
-}
-
-void 
-TransferQueue::free()
-{
-  if (m_pEntries != NULL) {
-    delete [] m_pEntries;
-    m_pEntries = NULL;
-  }
-  m_numEntries = 0;
-}
diff --git a/common/rfb/TransferQueue.h b/common/rfb/TransferQueue.h
deleted file mode 100644
index 8a31bbc..0000000
--- a/common/rfb/TransferQueue.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- TransferQueue.
-
-#ifndef __RFB_TRANSFERQUEUE_H__
-#define __RFB_TRANSFERQUEUE_H__
-
-#include <stdlib.h>
-
-#include <rfb/FileInfo.h>
-#include <rfb/fttypes.h>
-
-namespace rfb {
-  class TransferQueue  
-  {
-  public:
-    TransferQueue();
-    ~TransferQueue();
-
-    void add(TransferQueue *pTQ);
-    void add(char *pLocPath, char*pRemPath, FileInfo *pFI, unsigned int flags);
-    void add(char *pLocPath, char *pRemPath, char *pLocName, char *pRemName,
-      unsigned int size, unsigned int data, unsigned int flags);
-    
-    char *getLocPathAt(unsigned int number);
-    char *getLocNameAt(unsigned int number);
-    char *getRemPathAt(unsigned int number);
-    char *getRemNameAt(unsigned int number);
-    
-    char *getFullLocPathAt(unsigned int number);
-    char *getFullRemPathAt(unsigned int number);
-    
-    bool setLocPathAt(unsigned int number, char *pName);
-    bool setLocNameAt(unsigned int number, char *pName);
-    bool setRemPathAt(unsigned int number, char *pName);
-    bool setRemNameAt(unsigned int number, char *pName);
-    
-    unsigned int getSizeAt(unsigned int number);
-    unsigned int getDataAt(unsigned int number);
-    unsigned int getFlagsAt(unsigned int number);
-    
-    SIZEDATAFLAGSINFO * getSizeDataFlagsAt(unsigned int number);
-    
-    
-    bool setSizeAt(unsigned int number, unsigned int value);
-    bool setDataAt(unsigned int number, unsigned int value);
-    bool setFlagsAt(unsigned int number, unsigned int value);
-    bool clearFlagAt(unsigned int number, unsigned int value);
-    bool setFlagToAll(unsigned int flag);
-    
-    bool deleteAt(unsigned int number);
-    
-    unsigned int getNumEntries();
-    
-    void free();
-    
-  private:
-    FILEINFOEX *m_pEntries;
-    unsigned int m_numEntries;
-    
-    char m_szFullLocPath[FT_FILENAME_SIZE];
-    char m_szFullRemPath[FT_FILENAME_SIZE];
-  };
-}
-
-#endif // __RFB_TRANSFERQUEUE_H__
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 8e23474..e021aa6 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -36,7 +36,7 @@
     updates(false), image_getter(server->useEconomicTranslate),
     drawRenderedCursor(false), removeRenderedCursor(false),
     pointerEventTime(0), accessRights(AccessDefault),
-    startTime(time(0)), m_pFileTransfer(0)
+    startTime(time(0))
 {
   setStreams(&sock->inStream(), &sock->outStream());
   peerEndpoint.buf = sock->getPeerEndpoint();
@@ -46,14 +46,6 @@
   setSocketTimeouts();
   lastEventTime = time(0);
 
-  // Add this client to the VNCServerST
-  if (server->m_pFTManager != NULL) {
-    SFileTransfer *pFT = server->m_pFTManager->createObject(sock);
-    if (pFT != NULL) {
-      m_pFileTransfer = pFT;
-    }
-  }
-
   server->clients.push_front(this);
 }
 
@@ -72,9 +64,6 @@
   if (server->pointerClient == this)
     server->pointerClient = 0;
 
-  if (m_pFileTransfer) 
-    server->m_pFTManager->destroyObject(m_pFileTransfer);
-
   // Remove this client from the server
   server->clients.remove(this);
 
@@ -747,10 +736,3 @@
   return 4;
 }
 
-bool VNCSConnectionST::processFTMsg(int type)
-{
-  if (m_pFileTransfer != NULL) 
-    return m_pFileTransfer->processMessages(type);
-  else 
-    return false;
-}
diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h
index d17bf6b..2121150 100644
--- a/common/rfb/VNCSConnectionST.h
+++ b/common/rfb/VNCSConnectionST.h
@@ -31,7 +31,6 @@
 #include <rfb/SMsgWriter.h>
 #include <rfb/TransImageGetter.h>
 #include <rfb/VNCServerST.h>
-#include <rfb/SFileTransfer.h>
 
 namespace rfb {
   class VNCSConnectionST : public SConnection,
@@ -110,8 +109,6 @@
     void setStatus(int status);
     int getStatus();
 
-    bool processFTMsg(int type);
-
   private:
     // SConnection callbacks
 
@@ -170,8 +167,6 @@
 
     CharArray closeReason;
     time_t startTime;
-
-    SFileTransfer *m_pFileTransfer;
   };
 }
 #endif
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index 8f160e8..5da6e71 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -47,6 +47,8 @@
 // otherwise blacklisted connections might be "forgotten".
 
 
+#include <stdlib.h>
+
 #include <rfb/ServerCore.h>
 #include <rfb/VNCServerST.h>
 #include <rfb/VNCSConnectionST.h>
@@ -72,7 +74,7 @@
 VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_,
                          SSecurityFactory* sf)
   : blHosts(&blacklist), desktop(desktop_), desktopStarted(false), pb(0),
-    m_pFTManager(0), name(strDup(name_)), pointerClient(0), comparer(0),
+    name(strDup(name_)), pointerClient(0), comparer(0),
     renderedCursorInvalid(false),
     securityFactory(sf ? sf : &defaultSecurityFactory),
     queryConnectionHandler(0), keyRemapper(&KeyRemapper::defInstance),
diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h
index 7503bd3..4035f93 100644
--- a/common/rfb/VNCServerST.h
+++ b/common/rfb/VNCServerST.h
@@ -33,7 +33,6 @@
 #include <rfb/Cursor.h>
 #include <network/Socket.h>
 #include <rfb/ListConnInfo.h>
-#include <rfb/SFileTransferManager.h>
 
 namespace rfb {
 
@@ -189,8 +188,6 @@
     bool getDisable() { return disableclients;};
     void setDisable(bool disable) { disableclients = disable;};
 
-    void setFTManager(rfb::SFileTransferManager *pFTManager) { m_pFTManager = pFTManager; };
-
   protected:
 
     friend class VNCSConnectionST;
@@ -205,8 +202,6 @@
     bool desktopStarted;
     PixelBuffer* pb;
 
-    SFileTransferManager *m_pFTManager;
-
     CharArray name;
 
     std::list<VNCSConnectionST*> clients;
diff --git a/common/rfb/msgTypes.h b/common/rfb/msgTypes.h
index ec26adc..2b24f3c 100644
--- a/common/rfb/msgTypes.h
+++ b/common/rfb/msgTypes.h
@@ -26,13 +26,6 @@
   const int msgTypeBell = 2;
   const int msgTypeServerCutText = 3;
 
-  const int msgTypeFileListData = 130;
-  const int msgTypeFileDownloadData = 131;
-  const int msgTypeFileUploadCancel = 132;
-  const int msgTypeFileDownloadFailed = 133;
-  const int msgTypeFileDirSizeData = 134;
-  const int msgTypeFileLastRequestFailed = 135;
-
   const int msgTypeEndOfContinuousUpdates = 150;
 
   // client to server
@@ -45,17 +38,6 @@
   const int msgTypePointerEvent = 5;
   const int msgTypeClientCutText = 6;
 
-  const int msgTypeFileListRequest = 130;
-  const int msgTypeFileDownloadRequest = 131;
-  const int msgTypeFileUploadRequest = 132;
-  const int msgTypeFileUploadData = 133;
-  const int msgTypeFileDownloadCancel = 134;
-  const int msgTypeFileUploadFailed = 135;
-  const int msgTypeFileCreateDirRequest = 136;
-  const int msgTypeFileDirSizeRequest = 137;
-  const int	msgTypeFileRenameRequest = 138;
-  const int msgTypeFileDeleteRequest = 139;
-
   const int msgTypeEnableContinuousUpdates = 150;
 }
 #endif
diff --git a/common/rfb/rfb.dsp b/common/rfb/rfb.dsp
index d5bbf57..edbec72 100644
--- a/common/rfb/rfb.dsp
+++ b/common/rfb/rfb.dsp
@@ -126,14 +126,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\CFTMsgReader.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\CFTMsgWriter.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\CMsgHandler.cxx
 # End Source File
 # Begin Source File
@@ -191,22 +183,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FileInfo.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileManager.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileReader.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileWriter.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\HextileDecoder.cxx
 # End Source File
 # Begin Source File
@@ -291,22 +267,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\SFileTransfer.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFileTransferManager.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFTMsgReader.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFTMsgWriter.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\SMsgHandler.cxx
 # End Source File
 # Begin Source File
@@ -349,10 +309,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\TransferQueue.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\TransImageGetter.cxx
 # End Source File
 # Begin Source File
@@ -401,14 +357,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\CFTMsgReader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\CFTMsgWriter.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\CMsgHandler.h
 # End Source File
 # Begin Source File
@@ -473,10 +421,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\DirManager.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\Encoder.h
 # End Source File
 # Begin Source File
@@ -489,22 +433,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FileInfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileManager.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileReader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FileWriter.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\hextileConstants.h
 # End Source File
 # Begin Source File
@@ -657,22 +585,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\SFileTransfer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFileTransferManager.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFTMsgReader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFTMsgWriter.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\SMsgHandler.h
 # End Source File
 # Begin Source File
@@ -733,10 +645,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\TransferQueue.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\TransImageGetter.h
 # End Source File
 # Begin Source File
diff --git a/win/rfb_win32/FolderManager.cxx b/win/rfb_win32/FolderManager.cxx
deleted file mode 100644
index f6b94eb..0000000
--- a/win/rfb_win32/FolderManager.cxx
+++ /dev/null
@@ -1,277 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- * 
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FolderManager.cxx
-
-#include <rfb_win32/FolderManager.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-FolderManager::FolderManager()
-{
-
-}
-
-FolderManager::~FolderManager()
-{
-
-}
-      
-bool 
-FolderManager::createDir(char *pFullPath)
-{
-  if (CreateDirectory(pFullPath, NULL) == 0) return false;
-
-  return true;
-}
-
-bool
-FolderManager::renameIt(char *pPath, char *pOldName, char *pNewName)
-{
-  char fullOldName[FT_FILENAME_SIZE];
-  char fullNewName[FT_FILENAME_SIZE];
-
-  sprintf(fullOldName, "%s\\%s", pPath, pOldName);
-  sprintf(fullNewName, "%s\\%s", pPath, pNewName);
-
-  return renameIt(fullOldName, fullNewName);
-}
-
-bool 
-FolderManager::renameIt(char *pOldName, char *pNewName)
-{
-  if (MoveFile(pOldName, pNewName)) return true;
-
-  return false;
-}
-
-bool 
-FolderManager::deleteIt(char *pFullPath)
-{
-  FileInfo fileInfo;
-
-  FILEINFO FIStruct;
-  if (!getInfo(pFullPath, &FIStruct)) return false;
-
-  fileInfo.add(&FIStruct);
-
-  return deleteIt(&fileInfo);
-}
-
-bool
-FolderManager::deleteIt(char *pPrefix, FileInfo *pFI)
-{
-  char buf[FT_FILENAME_SIZE];
-  for (unsigned int i = 0; i < pFI->getNumEntries(); i++) {
-    sprintf(buf, "%s\\%s", pPrefix, pFI->getNameAt(i));
-    pFI->setNameAt(i,buf);
-  }
-  return deleteIt(pFI);
-}
-
-bool
-FolderManager::deleteIt(FileInfo *pFI)
-{
-  unsigned int num = pFI->getNumEntries();
-  unsigned int last = num - 1;
-
-  while (num > 0) {
-    if (pFI->getFlagsAt(last) & FT_ATTR_DIR) {
-      if (RemoveDirectory(pFI->getNameAt(last)) == 0) {
-        if (GetLastError() == ERROR_DIR_NOT_EMPTY) {
-          if (!getFolderInfoWithPrefix(pFI->getNameAt(last), pFI)) {
-            pFI->free();
-            return false;
-          }
-        }
-      } else {
-        pFI->deleteAt(last);
-      }
-    } else {
-      if (DeleteFile(pFI->getNameAt(last)) == 0) {
-        pFI->free();
-        return false;
-      } else {
-        pFI->deleteAt(last);
-      }
-    }
-    num = pFI->getNumEntries();
-    last = num - 1;
-  }
-
-  return true;
-}
-
-bool 
-FolderManager::getFolderInfoWithPrefix(char *pPrefix, FileInfo *pFileInfo)
-{
-  char prefix[FT_FILENAME_SIZE];
-  strcpy(prefix, pPrefix);
-
-  FileInfo tmpFileInfo;
-  if (!getDirInfo(prefix, &tmpFileInfo, 0)) {
-    tmpFileInfo.free();
-    return false;
-  } else {
-    char buf[FT_FILENAME_SIZE];
-    for (unsigned int i = 0; i < tmpFileInfo.getNumEntries(); i++) {
-      sprintf(buf, "%s\\%s", prefix, tmpFileInfo.getNameAt(i));
-      pFileInfo->add(buf, tmpFileInfo.getSizeAt(i), tmpFileInfo.getDataAt(i), tmpFileInfo.getFlagsAt(i));
-    }
-  }
-  tmpFileInfo.free();
-  return true;
-}
-    
-bool 
-FolderManager::getDirInfo(char *pPath, FileInfo *pFileInfo, unsigned int dirOnly)
-{
-  if (strlen(pPath) == 0) return getDrivesInfo(pFileInfo);
-  
-  char path[FT_FILENAME_SIZE];
-  sprintf(path, "%s\\*", pPath);
-  
-  WIN32_FIND_DATA FindFileData;
-  SetErrorMode(SEM_FAILCRITICALERRORS);
-  HANDLE handle = FindFirstFile(path, &FindFileData);
-  SetErrorMode(0);
-  
-  if (handle != INVALID_HANDLE_VALUE) {
-    do {
-      if (strcmp(FindFileData.cFileName, ".") != 0 &&
-        strcmp(FindFileData.cFileName, "..") != 0) {
-        unsigned int lastWriteTime = getTime70(FindFileData.ftLastWriteTime);
-        if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {	
-          pFileInfo->add(FindFileData.cFileName, 0, lastWriteTime, FT_ATTR_DIR);
-        } else {
-          if (!dirOnly)
-            pFileInfo->add(FindFileData.cFileName, FindFileData.nFileSizeLow, lastWriteTime, FT_ATTR_FILE);
-        }
-      }
-      
-    } while (FindNextFile(handle, &FindFileData));
-  } else {
-    return false;
-  }
-  FindClose(handle);
-  return true;
-}
-
-bool 
-FolderManager::getDrivesInfo(FileInfo *pFileInfo)
-{
-  TCHAR szDrivesList[256];
-  if (GetLogicalDriveStrings(255, szDrivesList) == 0)
-    return false;
-  
-  int i = 0;
-  while (szDrivesList[i] != '\0') {
-    char *drive = strdup(&szDrivesList[i]);
-    char *backslash = strrchr(drive, '\\');
-    if (backslash != NULL)
-      *backslash = '\0';
-    pFileInfo->add(drive, 0, 0, FT_ATTR_DIR);
-    free(drive);
-    i += strcspn(&szDrivesList[i], "\0") + 1;
-  }
-  return true;
-}
-
-bool
-FolderManager::getInfo(char *pFullPath, FILEINFO *pFIStruct)
-{
-  WIN32_FIND_DATA FindFileData;
-  SetErrorMode(SEM_FAILCRITICALERRORS);
-  HANDLE hFile = FindFirstFile(pFullPath, &FindFileData);
-  SetErrorMode(0);
-  if (hFile != INVALID_HANDLE_VALUE) {
-    FindClose(hFile);
-    strcpy(pFIStruct->name, pFullPath);
-    pFIStruct->info.data = getTime70(FindFileData.ftLastWriteTime);
-    if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {	
-      pFIStruct->info.size = 0;
-      pFIStruct->info.flags = FT_ATTR_DIR;
-      return true;
-    } else {
-      pFIStruct->info.size = FindFileData.nFileSizeLow;
-      pFIStruct->info.flags = FT_ATTR_FILE;
-      return true;
-    }
-  }
-  return false;
-}
-
-unsigned int 
-FolderManager::getTime70(FILETIME ftime)
-{
-  LARGE_INTEGER uli;
-  uli.LowPart = ftime.dwLowDateTime;
-  uli.HighPart = ftime.dwHighDateTime;
-  uli.QuadPart = (uli.QuadPart - 116444736000000000LL) / 10000000;
-  return uli.LowPart;
-}
-
-void 
-FolderManager::getFiletime(unsigned int time70, FILETIME *pftime)
-{
-  LONGLONG ll = Int32x32To64(time70, 10000000) + 116444736000000000LL;
-  pftime->dwLowDateTime = (DWORD) ll;
-  pftime->dwHighDateTime = (DWORD) (ll >> 32);
-}
-
-bool
-FolderManager::getDirSize(char *pFullPath, DWORD64 *dirSize)
-{
-  char fullPath[FT_FILENAME_SIZE];
-  FileInfo fi;
-  fi.add(pFullPath, 0, 0, FT_ATTR_DIR);
-  DWORD64 dirFileSize64 = 0;
-  do {
-    sprintf(fullPath, "%s\\*", fi.getNameAt(0));
-    WIN32_FIND_DATA FindFileData;
-    SetErrorMode(SEM_FAILCRITICALERRORS);
-    HANDLE hFile = FindFirstFile(fullPath, &FindFileData);
-    SetErrorMode(0);
-    
-    if (hFile != INVALID_HANDLE_VALUE) {
-      do {
-        if (strcmp(FindFileData.cFileName, ".") != 0 &&
-          strcmp(FindFileData.cFileName, "..") != 0) {
-          char buff[MAX_PATH];
-          if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {	
-            sprintf(buff, "%s\\%s", fi.getNameAt(0), FindFileData.cFileName);
-            fi.add(buff, 0, 0, FT_ATTR_DIR);
-          } else {
-            dirFileSize64 += FindFileData.nFileSizeLow;
-          }
-        }
-      } while (FindNextFile(hFile, &FindFileData));
-      FindClose(hFile);
-    }
-    fi.deleteAt(0);
-  } while (fi.getNumEntries() > 0);
-  
-  *dirSize = dirFileSize64;
-  return true;
-}
diff --git a/win/rfb_win32/FolderManager.h b/win/rfb_win32/FolderManager.h
deleted file mode 100644
index 9ce757f..0000000
--- a/win/rfb_win32/FolderManager.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FolderManager.h
-
-#ifndef __RFB_WIN32_FOLDERMANAGER_H__
-#define __RFB_WIN32_FOLDERMANAGER_H__
-
-#include <windows.h>
-
-#include <rfb/FileInfo.h>
-#include <rfb/DirManager.h>
-
-namespace rfb {
-  namespace win32{
-    class FolderManager : public DirManager {
-    public:
-      FolderManager();
-      ~FolderManager();
-      
-      bool createDir(char *pFullPath);
-
-      bool renameIt(char *pOldName, char *pNewName);
-      bool renameIt(char *pPath, char *pOldName, char *pNewName);
-      
-      bool deleteIt(char *pPrefix, FileInfo *pFI);
-      bool deleteIt(char *pFullPath);
-      bool deleteIt(FileInfo *pFI);
-
-      bool getInfo(char *pFullPath, FILEINFO *pFIStruct);
-      
-      bool getDirInfo(char *pPath, FileInfo *pFileInfo, unsigned int dirOnly);
-      bool getDrivesInfo(FileInfo *pFI);
-
-      unsigned int getTime70(FILETIME ftime);
-      void getFiletime(unsigned int time70, FILETIME *pftime);
-
-      bool getDirSize(char *pFullPath, DWORD64 *dirSize);
-
-    private:
-      bool getFolderInfoWithPrefix(char *pPrefix, FileInfo *pFileInfo);
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FOLDERMANAGER_H__
diff --git a/win/rfb_win32/Makefile.am b/win/rfb_win32/Makefile.am
index 9ba8e4b..e1e9c7c 100644
--- a/win/rfb_win32/Makefile.am
+++ b/win/rfb_win32/Makefile.am
@@ -16,7 +16,6 @@
   DIBSectionBuffer.h \
   DynamicFn.h \
   EventManager.h \
-  FolderManager.h \
   Handle.h \
   IconInfo.h \
   IntervalTimer.h \
@@ -41,8 +40,6 @@
   SDisplay.h \
   Security.h \
   Service.h \
-  SFileTransferManagerWin32.h \
-  SFileTransferWin32.h \
   SInput.h \
   SocketManager.h \
   TCharArray.h \
@@ -73,7 +70,6 @@
   DIBSectionBuffer.cxx \
   DynamicFn.cxx \
   EventManager.cxx \
-  FolderManager.cxx \
   LaunchProcess.cxx \
   ListViewControl.cxx \
   LowLevelKeyEvents.cxx \
@@ -89,8 +85,6 @@
   SDisplay.cxx \
   Security.cxx \
   Service.cxx \
-  SFileTransferManagerWin32.cxx \
-  SFileTransferWin32.cxx \
   SInput.cxx \
   SocketManager.cxx \
   TCharArray.cxx \
diff --git a/win/rfb_win32/SFileTransferManagerWin32.cxx b/win/rfb_win32/SFileTransferManagerWin32.cxx
deleted file mode 100644
index 048e3aa..0000000
--- a/win/rfb_win32/SFileTransferManagerWin32.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferManagerWin32.cxx
-
-#include <rfb_win32/SFileTransferManagerWin32.h>
-
-using namespace rfb;
-using namespace win32;
-
-SFileTransferManagerWin32::SFileTransferManagerWin32()
-{
-
-}
-
-SFileTransferManagerWin32::~SFileTransferManagerWin32()
-{
-
-}
-
-SFileTransfer *
-SFileTransferManagerWin32::createObject(network::Socket *sock)
-{
-  rfb::SFileTransfer *pFT = 0;
-  rfb::win32::SFileTransferWin32 *pFTWin32 = 0;
-
-  pFTWin32 = new SFileTransferWin32(sock);
-  if (pFTWin32 == NULL) return NULL;
-
-  pFT = (SFileTransfer *) pFTWin32;
-
-  m_lstFTObjects.push_front(pFT);
-
-  return pFT;
-}
-
-void 
-SFileTransferManagerWin32::processDownloadMsg(MSG msg)
-{
-  SFileTransfer *pFT = (SFileTransfer *)msg.lParam;
-
-  if (pFT != NULL) {
-    std::list<SFileTransfer*>::iterator i;
-    for (i=m_lstFTObjects.begin(); i!=m_lstFTObjects.end(); i++) {
-      if ((*i) == pFT) {
-        (*i)->sendFileDownloadPortion();
-        return;
-      }
-    }
-  }
-}
diff --git a/win/rfb_win32/SFileTransferManagerWin32.h b/win/rfb_win32/SFileTransferManagerWin32.h
deleted file mode 100644
index c12e3df..0000000
--- a/win/rfb_win32/SFileTransferManagerWin32.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferManagerWin32.h
-
-#ifndef __RFB_WIN32_SFILETRANSFERMANAGERWIN32_H__
-#define __RFB_WIN32_SFILETRANSFERMANAGERWIN32_H__
-
-#include <rfb/SFileTransfer.h>
-#include <rfb/SFileTransferManager.h>
-#include <rfb_win32/SFileTransferWin32.h>
-
-namespace rfb {
-  namespace win32 {
-    class SFileTransferManagerWin32 : public rfb::SFileTransferManager
-    {
-    public:
-      SFileTransferManagerWin32();
-      virtual ~SFileTransferManagerWin32();
-
-      void processDownloadMsg(MSG msg);
-
-      virtual SFileTransfer *createObject(network::Socket *sock);
-    };
-  };
-}
-
-#endif // __RFB_WIN32_SFILETRANSFERMANAGERWIN32_H__
diff --git a/win/rfb_win32/SFileTransferWin32.cxx b/win/rfb_win32/SFileTransferWin32.cxx
deleted file mode 100644
index ad77bd0..0000000
--- a/win/rfb_win32/SFileTransferWin32.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferWin32.cxx
-
-#include <rfb/msgTypes.h>
-#include <rfb_win32/FolderManager.h>
-#include <rfb_win32/SFileTransferWin32.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-SFileTransferWin32::SFileTransferWin32(network::Socket *sock) : SFileTransfer(sock)
-{
-}
-
-SFileTransferWin32::~SFileTransferWin32()
-{
-}
-
-bool 
-SFileTransferWin32::initDownloadCallback()
-{
-  PostThreadMessage(GetCurrentThreadId(), VNCM_FT_DOWNLOAD, (WPARAM) 0, (LPARAM) this);
-  return true;
-}
-
-bool 
-SFileTransferWin32::processDownloadCallback()
-{
-  return sendFileDownloadPortion();
-}
-
-bool 
-SFileTransferWin32::convertPathFromNet(char *pszPath)
-{
-  int len = strlen(pszPath);
-  if (pszPath[0] == '/') {
-    if (len == 1) { 
-      pszPath[0] = '\0'; 
-      return true; 
-    }
-  } else {
-    return false;
-  }
-
-  for(int i = 0; i < (len - 1); i++) {
-    if(pszPath[i+1] == '/') pszPath[i+1] = '\\';
-    pszPath[i] = pszPath[i+1];
-  }
-
-  pszPath[len-1] = '\0';
-  return true;
-}
-
-bool 
-SFileTransferWin32::makeFileList(char *pszPath, FileInfo *pFI, bool bDirOnly)
-{
-  FolderManager fm;
-  if (fm.getDirInfo(pszPath, pFI, bDirOnly)) 
-    return true; 
-  else 
-    return false;
-}
-
-bool 
-SFileTransferWin32::deleteIt(char *pszPath)
-{
-  FolderManager fm;
-
-  return fm.deleteIt(pszPath);
-}
-
-bool 
-SFileTransferWin32::renameIt(char *pszOldPath, char *pszNewPath)
-{
-  FolderManager fm;
-
-  return fm.renameIt(pszOldPath, pszNewPath);
-}
-
-bool 
-SFileTransferWin32::createDir(char *pszPath)
-{
-  FolderManager fm;
-
-  return fm.createDir(pszPath);
-}
-
-bool 
-SFileTransferWin32::getDirSize(char *pszName, unsigned short *pHighSize16, 
-                               unsigned int *pLowSize32)
-{
-  FolderManager fm;
-  DWORD64 dw64DirSize = 0;
-
-  if (!fm.getDirSize(pszName, &dw64DirSize)) return false;
-
-  if (dw64DirSize & 0xFFFF000000000000LL) return false;
-
-  *pHighSize16 = (unsigned short)((dw64DirSize >> 32) & 0xFFFF);
-  *pLowSize32 = (unsigned int)(dw64DirSize & 0xFFFFFFFF);
-
-  return true;
-}
diff --git a/win/rfb_win32/SFileTransferWin32.h b/win/rfb_win32/SFileTransferWin32.h
deleted file mode 100644
index 49cdf5f..0000000
--- a/win/rfb_win32/SFileTransferWin32.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2006 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- SFileTransferWin32.h
-
-#ifndef __RFB_SFILETRANSFERWIN32_H__
-#define __RFB_SFILETRANSFERWIN32_H__
-
-#include <windows.h>
-
-#include <rfb/SFileTransfer.h>
-
-const UINT VNCM_FT_DOWNLOAD = WM_USER + 2;
-
-namespace rfb {
-  namespace win32 {
-    class SFileTransferWin32 : public rfb::SFileTransfer
-    {
-    public:
-      SFileTransferWin32(network::Socket *sock);
-      virtual ~SFileTransferWin32();
-
-      bool processDownloadCallback();
-      virtual bool initDownloadCallback();
-
-      virtual bool convertPathFromNet(char *pszPath);
-      virtual bool makeFileList(char *pszPath, FileInfo *pFI, bool bDirOnly);
-  
-      virtual bool deleteIt(char *pszPath);
-      virtual bool renameIt(char *pszOldPath, char *pszNewPath);
-      virtual bool createDir(char *pszPath);
-
-      virtual bool getDirSize(char *pszName, unsigned short *pHighSize16, unsigned int *pLowSize32);
-
-    };
-  };
-}
-
-#endif // __RFB_SFILETRANSFERWIN32_H__
diff --git a/win/rfb_win32/rfb_win32.dsp b/win/rfb_win32/rfb_win32.dsp
index acfb5aa..e484343 100644
--- a/win/rfb_win32/rfb_win32.dsp
+++ b/win/rfb_win32/rfb_win32.dsp
@@ -158,10 +158,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FolderManager.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\LaunchProcess.cxx
 # End Source File
 # Begin Source File
@@ -222,14 +218,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\SFileTransferManagerWin32.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFileTransferWin32.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\SInput.cxx
 # End Source File
 # Begin Source File
@@ -346,10 +334,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FolderManager.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\Handle.h
 # End Source File
 # Begin Source File
@@ -446,14 +430,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\SFileTransferManagerWin32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SFileTransferWin32.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\SInput.h
 # End Source File
 # Begin Source File
diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx
index 874db09..41b3aa3 100644
--- a/win/vncviewer/CConn.cxx
+++ b/win/vncviewer/CConn.cxx
@@ -51,7 +51,6 @@
 const int IDM_REQUEST_REFRESH = ID_REQUEST_REFRESH;
 const int IDM_CTRL_KEY = ID_CTRL_KEY;
 const int IDM_ALT_KEY = ID_ALT_KEY;
-const int IDM_FILE_TRANSFER = ID_FILE_TRANSFER;
 const int IDM_CONN_SAVE_AS = ID_CONN_SAVE_AS;
 const int IDM_ZOOM_IN = ID_ZOOM_IN;
 const int IDM_ZOOM_OUT = ID_ZOOM_OUT;
@@ -108,8 +107,6 @@
   reverseConnection = reverse;
   initialiseProtocol();
 
-  m_fileTransfer.initialize(&s->inStream(), &s->outStream());
-
   return true;
 }
 
@@ -281,9 +278,6 @@
   case IDM_ABOUT:
     AboutDialog::instance.showDialog();
     return true;
-  case IDM_FILE_TRANSFER:
-    m_fileTransfer.show(window->getHandle());
-    return true;
   case IDM_CONN_SAVE_AS:
     return true;
   };
@@ -770,6 +764,3 @@
   if (password) options.setPassword(*password);
 }
 
-bool CConn::processFTMsg(int type) {
-  return m_fileTransfer.processFTMsg(type);
-}
diff --git a/win/vncviewer/CConn.h b/win/vncviewer/CConn.h
index d294f9e..5dacb1e 100644
--- a/win/vncviewer/CConn.h
+++ b/win/vncviewer/CConn.h
@@ -33,7 +33,6 @@
 #include <vncviewer/OptionsDialog.h>
 #include <vncviewer/CConnOptions.h>
 #include <vncviewer/DesktopWindow.h>
-#include <vncviewer/FileTransfer.h>
 #include <list>
 
 
@@ -81,8 +80,6 @@
       // Global user-config registry key
       static RegKey userConfigKey;
 
-      bool processFTMsg(int type);
-
     protected:
       // InputHandler interface (via DesktopWindow::Callback)
       void keyEvent(rdr::U32 key, bool down);
@@ -152,8 +149,6 @@
       std::list<Rect> debugRects;
       CharArray closeReason_;
       bool isClosed_;
-
-      FileTransfer m_fileTransfer;
     };
 
   };
diff --git a/win/vncviewer/FTBrowseDlg.cxx b/win/vncviewer/FTBrowseDlg.cxx
deleted file mode 100644
index 761e03b..0000000
--- a/win/vncviewer/FTBrowseDlg.cxx
+++ /dev/null
@@ -1,196 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTBrpwseDlg.cxx
-
-#include <vncviewer/FTBrowseDlg.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-FTBrowseDlg::FTBrowseDlg(FTDialog *pFTDlg)
-{
-  m_pFTDlg = pFTDlg;
-  m_hwndDlg = NULL;
-  m_hwndTree = NULL;
-  m_hParentItem = NULL;
-}
-
-FTBrowseDlg::~FTBrowseDlg()
-{
-  destroy();
-}
-
-bool
-FTBrowseDlg::create()
-{
-  m_hwndDlg = CreateDialogParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_FTBROWSE), 
-                                m_pFTDlg->getWndHandle(), (DLGPROC) FTBrowseDlgProc, 
-                                (LONG) this);
-
-  if (m_hwndDlg == NULL) return false;
-
-  m_hwndTree = GetDlgItem(m_hwndDlg, IDC_FTBROWSETREE);
-
-  ShowWindow(m_hwndDlg, SW_SHOW);
-  UpdateWindow(m_hwndDlg);
-
-  return true;
-}
-
-void
-FTBrowseDlg::destroy()
-{
-  EndDialog(m_hwndDlg, 0);
-}
-
-void
-FTBrowseDlg::addItems(FileInfo *pFI)
-{
-  TVITEM tvi;
-  TVINSERTSTRUCT tvins;
-
-  if (pFI->getNumEntries() <= 0) return;
-
-  for (unsigned int i = 0; i < pFI->getNumEntries(); i++)
-  {
-    tvi.mask = TVIF_TEXT;
-    tvi.pszText = pFI->getNameAt(i);;
-    tvins.hParent = m_hParentItem;
-    tvins.item = tvi;
-    tvins.hParent = TreeView_InsertItem(m_hwndTree, &tvins);
-    TreeView_InsertItem(m_hwndTree, &tvins);
-  }
-}
-
-char *
-FTBrowseDlg::getTVPath(HTREEITEM hTItem)
-{
-  char path[FT_FILENAME_SIZE];
-  char szText[FT_FILENAME_SIZE];
-
-  TVITEM tvi;
-  path[0] = '\0';
-
-  do {
-    tvi.mask = TVIF_TEXT | TVIF_HANDLE;
-    tvi.hItem = hTItem;
-    tvi.pszText = szText;
-    tvi.cchTextMax = FT_FILENAME_SIZE;
-    TreeView_GetItem(m_hwndTree, &tvi);
-    sprintf(path, "%s\\%s", path, tvi.pszText);
-    hTItem = TreeView_GetParent(m_hwndTree, hTItem);
-  } while(hTItem != NULL);
-
-  return pathInvert(path);
-}
-
-char *
-FTBrowseDlg::pathInvert(char *pPath)
-{
-  int len = strlen(pPath);
-  m_szPath[0] = '\0';
-  char *pos = NULL;
-  
-  while ((pos = strrchr(pPath, '\\')) != NULL) {
-    if (strlen(m_szPath) == 0) {
-      strcpy(m_szPath, (pos + 1));
-    } else {
-      sprintf(m_szPath, "%s\\%s", m_szPath, (pos + 1));
-    }
-    *pos = '\0';
-  }
-
-  m_szPath[len] = '\0';
-  return m_szPath;
-}
-
-char *
-FTBrowseDlg::getPath()
-{
-  GetDlgItemText(m_hwndDlg, IDC_FTBROWSEPATH, m_szPath, FT_FILENAME_SIZE);
-  return m_szPath;
-}
-
-void
-FTBrowseDlg::deleteChildItems()
-{
-  while (TreeView_GetChild(m_hwndTree, m_hParentItem) != NULL) {
-    TreeView_DeleteItem(m_hwndTree, TreeView_GetChild(m_hwndTree, m_hParentItem));
-  }
-}
-
-BOOL CALLBACK 
-FTBrowseDlg::FTBrowseDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-  FTBrowseDlg *_this = (FTBrowseDlg *) GetWindowLong(hwnd, GWL_USERDATA);
-  switch (uMsg)
-  {
-  case WM_INITDIALOG:
-    {
-      SetWindowLong(hwnd, GWL_USERDATA, lParam);
-      return FALSE;
-    }
-    break;
-  case WM_COMMAND:
-    {
-      switch (LOWORD(wParam))
-      {
-      case IDOK:
-        _this->m_pFTDlg->onEndBrowseDlg(true);
-        return FALSE;
-      case IDCANCEL:
-        _this->m_pFTDlg->onEndBrowseDlg(false);
-        return FALSE;
-      }
-    }
-    break;
-  case WM_NOTIFY:
-    switch (LOWORD(wParam))
-    {
-    case IDC_FTBROWSETREE:
-      switch (((LPNMHDR) lParam)->code)
-      {
-      case TVN_SELCHANGED:
-        SetDlgItemText(hwnd, IDC_FTBROWSEPATH, _this->getTVPath(((NMTREEVIEW *) lParam)->itemNew.hItem));
-        return FALSE;
-//      case TVN_ITEMEXPANDING:
-      case TVN_ITEMEXPANDED:
-        {
-          NMTREEVIEW *nmCode = (NMTREEVIEW *) lParam;
-          if (nmCode->action == 2) {
-            _this->m_hParentItem = nmCode->itemNew.hItem;
-            _this->deleteChildItems();
-            _this->m_pFTDlg->getBrowseItems(_this->getTVPath(_this->m_hParentItem));
-          }
-        }
-        return FALSE;
-      }
-    break;
-    case WM_CLOSE:
-      _this->m_pFTDlg->onEndBrowseDlg(false);
-      return FALSE;
-    }
-  }
-    return 0;
-}
diff --git a/win/vncviewer/FTBrowseDlg.h b/win/vncviewer/FTBrowseDlg.h
deleted file mode 100644
index b50b1a7..0000000
--- a/win/vncviewer/FTBrowseDlg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTBrowseDlg.h
-
-#ifndef __RFB_WIN32_FTBROWSEDLG_H__
-#define __RFB_WIN32_FTBROWSEDLG_H__
-
-#include <windows.h>
-#include <commctrl.h>
-
-#include <rfb/FileInfo.h>
-#include <vncviewer/FTDialog.h>
-#include <vncviewer/resource.h>
-
-namespace rfb {
-  namespace win32 {
-    class FTDialog;
-
-    class FTBrowseDlg
-    {
-    public:
-      FTBrowseDlg(FTDialog *pFTDlg);
-      ~FTBrowseDlg();
-
-      static BOOL CALLBACK FTBrowseDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-      bool create();
-      void destroy();
-
-      void addItems(FileInfo *pFI);
-      char *getPath();
-
-      void deleteChildItems();
-
-    private:
-      HWND m_hwndDlg;
-      HWND m_hwndTree;
-      FTDialog *m_pFTDlg;
-      HTREEITEM m_hParentItem;
-
-      char m_szPath[FT_FILENAME_SIZE];
-
-      char *pathInvert(char *pPath);
-      char *getTVPath(HTREEITEM hTItem);
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FTBROWSEDLG_H__
diff --git a/win/vncviewer/FTDialog.cxx b/win/vncviewer/FTDialog.cxx
deleted file mode 100644
index bf819a3..0000000
--- a/win/vncviewer/FTDialog.cxx
+++ /dev/null
@@ -1,1162 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTDialog.cxx
-
-#include <vncviewer/FTDialog.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-const char FTDialog::szCheckDeleteQueueText[]    = "TigerVNC.Viewer.CheckDeleteQueue.Msg";
-const char FTDialog::szCheckTransferQueueText[]  = "TigerVNC.Viewer.CheckTransferQueue.Msg";
-const char FTDialog::szUploadFilePortionText[]   = "TigerVNC.Viewer.UploadFilePortion.Msg";
-
-FTDialog::FTDialog(HINSTANCE hInst, FileTransfer *pFT)
-{
-  m_pFileTransfer = pFT;
-  m_hInstance = hInst;
-
-  m_bDlgShown = false;
-  m_bLocalBrowsing = true;
-  m_bCloseDlgAfterCancel = false;
-
-  m_pLocalLV = NULL;
-  m_pRemoteLV = NULL;
-  m_pProgress = NULL;
-  m_pCancelingDlg = NULL;
-  m_pCreateFolderDlg = NULL;
-  m_pRenameDlg = NULL;
-  m_pBrowseDlg = NULL;
-
-  m_hwndFTDialog = NULL;
-  m_hwndLocalPath = NULL;
-  m_hwndRemotePath = NULL;
-
-  m_FTMenuSource = 0;
-  m_dwNumStatusStrings = 0;
-
-  m_szLocalPath[0] = '\0';
-  m_szRemotePath[0] = '\0';
-  m_szLocalPathTmp[0] = '\0';
-  m_szRemotePathTmp[0] = '\0';
-  m_szCreateFolderName[0] = '\0';
-}
-
-FTDialog::~FTDialog()
-{
-  destroyFTDialog();
-}
-
-bool
-FTDialog::createFTDialog(HWND hwndParent)
-{
-  if (m_hwndFTDialog != NULL) {
-    ShowWindow(m_hwndFTDialog, SW_SHOW);
-    m_bDlgShown = true;
-    showLocalLVItems();
-    showRemoteLVItems();
-    return true;
-  }
-
-  if (!initFTWndMsgs()) return false;
-
-  m_hwndFTDialog = CreateDialogParam(m_hInstance, 
-                                     MAKEINTRESOURCE(IDD_FILETRANSFER_DLG),
-                                     hwndParent, 
-                                     (DLGPROC) FTDialogProc,
-                                     (LONG) this);
-  
-  if (m_hwndFTDialog == NULL) return false;
-
-  HWND hwndLocalList = GetDlgItem(m_hwndFTDialog, IDC_FTLOCALLIST);
-  HWND hwndRemoteList = GetDlgItem(m_hwndFTDialog, IDC_FTREMOTELIST);
-
-  if ((hwndLocalList == NULL) || (hwndRemoteList == NULL)) {
-    destroyFTDialog();
-    return false;
-  }
-
-  m_pLocalLV = new FTListView(hwndLocalList);
-  m_pRemoteLV = new FTListView(hwndRemoteList);
-  
-  m_pProgress = new FTProgress(m_hwndFTDialog);
-  
-  if ((m_pLocalLV == NULL) || (m_pRemoteLV == NULL) || (m_pProgress == NULL)) {
-    destroyFTDialog();
-    return false;
-  }
-
-  initFTDialog();
-  
-  ShowWindow(m_hwndFTDialog, SW_SHOW);
-  UpdateWindow(m_hwndFTDialog);
-  m_bDlgShown = true;
-  return true;
-}
-
-bool
-FTDialog::initFTDialog()
-{
-  m_pLocalLV->initialize(m_hInstance);
-  m_pRemoteLV->initialize(m_hInstance);
-
-  m_hwndLocalPath = GetDlgItem(m_hwndFTDialog, IDC_FTLOCALPATH);
-  m_hwndRemotePath = GetDlgItem(m_hwndFTDialog, IDC_FTREMOTEPATH);
-
-  setIcon(IDC_FTLOCALUP, IDI_FTUP);
-  setIcon(IDC_FTREMOTEUP, IDI_FTUP);
-  setIcon(IDC_FTLOCALRELOAD, IDI_FTRELOAD);
-  setIcon(IDC_FTREMOTERELOAD, IDI_FTRELOAD);
-
-  showLocalLVItems();
-  showRemoteLVItems();
-
-  return true;
-}
-
-bool
-FTDialog::initFTWndMsgs()
-{
-  m_msgCheckDeleteQueue    = RegisterWindowMessage(szCheckDeleteQueueText);
-  m_msgCheckTransferQueue  = RegisterWindowMessage(szCheckTransferQueueText);
-  m_msgUploadFilePortion   = RegisterWindowMessage(szUploadFilePortionText);
-
-  if ((m_msgCheckDeleteQueue) && 
-      (m_msgCheckTransferQueue) && 
-      (m_msgUploadFilePortion)) return true;
-
-  return false;
-}
-
-bool
-FTDialog::closeFTDialog()
-{
-  ShowWindow(m_hwndFTDialog, SW_HIDE);
-  m_bDlgShown = false;
-  return true;
-}
-
-void
-FTDialog::destroyFTDialog()
-{
-  if (m_pLocalLV != NULL) {
-    delete m_pLocalLV;
-    m_pLocalLV = NULL;
-  }
-
-  if (m_pRemoteLV != NULL) {
-    delete m_pRemoteLV;
-    m_pRemoteLV = NULL;
-  }
-
-  if (m_pProgress != NULL) {
-    delete m_pProgress;
-    m_pProgress = NULL;
-  }
-
-  if(m_pCancelingDlg != NULL) {
-    delete m_pCancelingDlg;
-    m_pCancelingDlg = NULL;
-  }
-
-  if (m_pCreateFolderDlg != NULL) {
-    delete m_pCreateFolderDlg;
-    m_pCreateFolderDlg = NULL;
-  }
-
-  if(m_pRenameDlg != NULL) {
-    delete m_pRenameDlg;
-    m_pRenameDlg = NULL;
-  }
-
-  if (DestroyWindow(m_hwndFTDialog)) m_hwndFTDialog = NULL;
-}
-
-BOOL CALLBACK 
-FTDialog::FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-  FTDialog *_this = (FTDialog *) GetWindowLong(hwnd, GWL_USERDATA);
-
-  switch (uMsg)
-  {
-  case WM_INITDIALOG:
-    _this = (FTDialog*)lParam;
-    SetWindowLong(hwnd, GWL_USERDATA, (LONG) lParam);
-    SetForegroundWindow(hwnd);
-    return TRUE;
-  case WM_COMMAND:
-    {
-      switch (LOWORD(wParam))
-      {
-      case IDC_FTLOCALPATH:
-        switch (HIWORD (wParam))
-        {
-        case CBN_SETFOCUS:
-          _this->setButtonsState();
-          return FALSE;
-        }
-        break;
-      case IDC_FTREMOTEPATH:
-        switch (HIWORD (wParam))
-        {
-        case CBN_SETFOCUS:
-          _this->setButtonsState();
-          return FALSE;
-        }
-        break;
-      case IDC_FTCLOSE:
-        _this->onClose();
-        return FALSE;
-      case IDC_FTLOCALBROWSE:
-        _this->onLocalBrowse();
-        return FALSE;
-      case IDC_FTREMOTEBROWSE:
-        _this->onRemoteBrowse();
-        return FALSE;
-      case IDC_FTLOCALUP:
-        _this->setButtonsState();
-        _this->onLocalOneUpFolder();
-        return FALSE;
-      case IDC_FTREMOTEUP:
-        _this->setButtonsState();
-        _this->onRemoteOneUpFolder();
-        return FALSE;
-      case IDC_FTLOCALRELOAD:
-        _this->setButtonsState();
-        _this->onLocalReload();
-        return FALSE;
-      case IDC_FTREMOTERELOAD:
-       _this->setButtonsState();
-       _this->onRemoteReload();
-        return FALSE;
-      case IDC_FTUPLOAD:
-        _this->onUpload();
-        return FALSE;
-      case IDC_FTDOWNLOAD:
-        _this->onDownload();
-        return FALSE;
-      case IDC_FTCANCEL:
-        _this->onFTCancel();
-        return FALSE;
-      case IDM_FTCOPY:
-      case IDM_FTRENAME:
-      case IDM_FTDELETE:
-      case IDM_FTCANCEL:
-      case IDM_FTCREATEFOLDER:
-        _this->onFTMenuCommand(LOWORD(wParam));
-        return FALSE;
-      }
-    }
-    break;
-    
-  case WM_NOTIFY:
-    switch (LOWORD(wParam))
-    {
-    case IDC_FTLOCALLIST:
-      switch (((LPNMHDR) lParam)->code)
-      {
-      case NM_CLICK:
-      case NM_SETFOCUS:
-      case LVN_ITEMCHANGED:
-        _this->setButtonsState();
-        return FALSE;
-      case LVN_GETDISPINFO:
-        _this->m_pLocalLV->onGetDispInfo((NMLVDISPINFO *) lParam);
-        return FALSE;
-      case LVN_ITEMACTIVATE:
-        _this->onLocalItemActivate((LPNMITEMACTIVATE) lParam);
-        return FALSE;
-      case NM_RCLICK:
-        _this->onLocalRButton();
-        return FALSE;
-      }
-      break;
-    case IDC_FTREMOTELIST:
-      switch (((LPNMHDR) lParam)->code)
-      {
-      case NM_CLICK:
-      case NM_SETFOCUS:
-      case LVN_ITEMCHANGED:
-        _this->setButtonsState();
-      case LVN_GETDISPINFO:
-        _this->m_pRemoteLV->onGetDispInfo((NMLVDISPINFO *) lParam);
-        return FALSE;
-      case LVN_ITEMACTIVATE:
-        _this->onRemoteItemActivate((LPNMITEMACTIVATE) lParam);
-        return FALSE;
-      case NM_RCLICK:
-        _this->onRemoteRButton();
-        return FALSE;
-      }
-      break;
-    }
-    break;
-    case WM_CLOSE:
-      _this->onClose();
-      return FALSE;
-  }
-
-  if (_this != NULL) {
-    if (uMsg == _this->m_msgCheckTransferQueue)
-      _this->m_pFileTransfer->checkTransferQueue();
-
-    if (uMsg == _this->m_msgUploadFilePortion)
-      _this->m_pFileTransfer->uploadFilePortion();
-    
-    if (uMsg == _this->m_msgCheckDeleteQueue)
-      _this->m_pFileTransfer->checkDeleteQueue();
-  }
-
-  return FALSE;
-}
-
-void
-FTDialog::onClose()
-{
-  if (m_pFileTransfer->isTransferEnable()) {
-    m_bCloseDlgAfterCancel = true;
-    onFTCancel();
-  } else {
-    closeFTDialog();
-  }  
-}
-
-void 
-FTDialog::onLocalItemActivate(LPNMITEMACTIVATE lpnmia)
-{
-  if (strlen(m_szLocalPath) == 0) {
-   strcpy(m_szLocalPathTmp, m_pLocalLV->getActivateItemName(lpnmia)); 
-  } else {
-    sprintf(m_szLocalPathTmp, "%s\\%s", m_szLocalPath, m_pLocalLV->getActivateItemName(lpnmia));
-  }
-  showLocalLVItems();
-}
-
-void 
-FTDialog::onRemoteItemActivate(LPNMITEMACTIVATE lpnmia)
-{
-  if (strlen(m_szRemotePath) == 0) {
-   strcpy(m_szRemotePathTmp, m_pRemoteLV->getActivateItemName(lpnmia)); 
-  } else {
-    sprintf(m_szRemotePathTmp, "%s\\%s", m_szRemotePath, m_pRemoteLV->getActivateItemName(lpnmia));
-  }
-  showRemoteLVItems();
-}
-
-void 
-FTDialog::onEndBrowseDlg(bool bResult)
-{
-  if (m_pBrowseDlg == NULL) return;
-
-  if (bResult) {
-    if (m_bLocalBrowsing) {
-      strcpy(m_szLocalPathTmp, m_pBrowseDlg->getPath());
-      showLocalLVItems();
-    } else {
-      strcpy(m_szRemotePathTmp, m_pBrowseDlg->getPath());
-      showRemoteLVItems();
-    }
-  }
-  delete m_pBrowseDlg;
-  m_pBrowseDlg = NULL;
-}
-
-void 
-FTDialog::onLocalBrowse()
-{
-  if (m_pBrowseDlg != NULL) return;
-  
-  m_bLocalBrowsing = true;
-
-  m_pBrowseDlg = new FTBrowseDlg(this);
-  m_pBrowseDlg->create();
-
-  getBrowseItems("");
-}
-
-void 
-FTDialog::onRemoteBrowse()
-{
-  if (m_pBrowseDlg != NULL) return;
-  
-  m_bLocalBrowsing = false;
-
-  m_pBrowseDlg = new FTBrowseDlg(this);
-  if (m_pBrowseDlg->create()) {
-    m_pFileTransfer->requestFileList("", FT_FLR_DEST_BROWSE, true);
-  } else {
-    delete m_pBrowseDlg;
-    m_pBrowseDlg = NULL;
-  }
-}
-
-void 
-FTDialog::onLocalReload()
-{
-  strcpy(m_szLocalPathTmp, m_szLocalPath);
-  showLocalLVItems();
-}
-
-void 
-FTDialog::onRemoteReload()
-{
-  strcpy(m_szRemotePathTmp, m_szRemotePath);
-  showRemoteLVItems();
-}
-
-void
-FTDialog::showLocalLVItems()
-{
-  FolderManager fm;
-  FileInfo fileInfo;
-  if (fm.getDirInfo(m_szLocalPathTmp, &fileInfo, 0)) {
-    fileInfo.sort();
-    m_pLocalLV->deleteAllItems();
-    m_pLocalLV->addItems(&fileInfo);
-    strcpy(m_szLocalPath, m_szLocalPathTmp);
-    SetWindowText(m_hwndLocalPath, m_szLocalPath);
-  }
-}
-
-void
-FTDialog::showRemoteLVItems()
-{
-  m_pFileTransfer->requestFileList(m_szRemotePathTmp, FT_FLR_DEST_MAIN, false);
-}
-
-void 
-FTDialog::addRemoteLVItems(FileInfo *pFI)
-{
-  pFI->sort();
-  m_pRemoteLV->deleteAllItems();
-  m_pRemoteLV->addItems(pFI);
-  strcpy(m_szRemotePath, m_szRemotePathTmp);
-  SetWindowText(m_hwndRemotePath, m_szRemotePath);
-  UpdateWindow(m_hwndFTDialog);
-}
-
-void 
-FTDialog::onLocalOneUpFolder()
-{
-  strcpy(m_szLocalPathTmp, m_szLocalPath);
-  makeOneUpFolder(m_szLocalPathTmp);
-  showLocalLVItems();
-}
-
-void 
-FTDialog::onRemoteOneUpFolder()
-{
-  strcpy(m_szRemotePathTmp, m_szRemotePath);
-  makeOneUpFolder(m_szRemotePathTmp);
-  showRemoteLVItems();
-}
-
-void 
-FTDialog::reqFolderUnavailable()
-{
-  strcpy(m_szRemotePathTmp, m_szRemotePath);
-  SetWindowText(m_hwndRemotePath, m_szRemotePath);
-  UpdateWindow(m_hwndFTDialog);
-}
-
-int
-FTDialog::makeOneUpFolder(char *pPath)
-{
-  if (strcmp(pPath, "") == 0) return strlen(pPath);
-  for (int i=(strlen(pPath)-2); i>=0; i--) {
-    if (pPath[i] == '\\') {
-      pPath[i] = '\0';
-      break;
-    }
-    if (i == 0) pPath[0] = '\0';
-  }
-  return strlen(pPath);
-}
-
-void 
-FTDialog::onUpload()
-{
-  FileInfo fi;
-  char prefix[FT_FILENAME_SIZE];
-  prefix[0] = '\0';
-
-  if (m_pFileTransfer->isTransferEnable())
-    strcpy(prefix, "File Transfer is active.\nDo you want to add selected file(s)/folder(s) to transfer queue?\n\n");
-  
-  int numSel = m_pLocalLV->getSelectedItems(&fi);
-  if (numSel > 0) {
-    char *pBuf = new char [(numSel + 4) * (MAX_PATH + 3) + strlen(prefix) + 1];
-    sprintf(pBuf, "%sFrom: Local Computer %s\\\n\n", prefix, m_szLocalPath);
-    
-    for (unsigned int i = 0; i < fi.getNumEntries(); i++)
-      sprintf(pBuf, "%s%s, ", pBuf, fi.getNameAt(i));
-    
-    sprintf(pBuf, "%s\n\nTo: Remote Computer %s\\", pBuf, m_szRemotePath);
-    
-    if (strlen(pBuf) > 2048) 
-      sprintf(pBuf, "%sFrom: Local Computer %s\\\n\nTo: Remote Computer %s\\\n\nTotal %d file(s)/folder(s)",
-        prefix, m_szLocalPath, m_szRemotePath, numSel);
-    
-    if (MessageBox(m_hwndFTDialog, pBuf, "Copy Selected Files and Folders", MB_OKCANCEL) == IDOK)
-      m_pFileTransfer->addTransferQueue(m_szLocalPath, m_szRemotePath, &fi, FT_ATTR_COPY_UPLOAD);
-
-    setButtonsState();
-    
-    delete [] pBuf;
-    return;
-  }
-  
-  setButtonsState();
-  setStatusText("File Transfer Impossible. No file(s) selected for transfer");
-}
-
-void 
-FTDialog::onDownload()
-{
-  FileInfo fi;
-  char prefix[FT_FILENAME_SIZE];
-  prefix[0] = '\0';
-
-  if (m_pFileTransfer->isTransferEnable())
-    strcpy(prefix, "File Transfer is active.\nDo you want to add selected file(s)/folder(s) to transfer queue?\n\n");
-  
-  int numSel = m_pRemoteLV->getSelectedItems(&fi);
-  if (numSel > 0) {
-    char *pBuf = new char [(numSel + 4) * (MAX_PATH + 3) + strlen(prefix) + 1];
-    sprintf(pBuf, "%sFrom: Remote Computer %s\\\n\n", prefix, m_szRemotePath);
-    
-    for (unsigned int i = 0; i < fi.getNumEntries(); i++)
-      sprintf(pBuf, "%s%s, ", pBuf, fi.getNameAt(i));
-    
-    sprintf(pBuf, "%s\n\nTo: Local Computer %s\\", pBuf, m_szLocalPath);
-    
-    if (strlen(pBuf) > 2048) 
-      sprintf(pBuf, "%sFrom: Remote Computer %s\\\n\nTo: Local Computer %s\\\n\nTotal %d file(s)/folder(s)",
-        prefix, m_szRemotePath, m_szLocalPath, numSel);
-    
-    if (MessageBox(m_hwndFTDialog, pBuf, "Copy Selected Files and Folders", MB_OKCANCEL) == IDOK)
-      m_pFileTransfer->addTransferQueue(m_szLocalPath, m_szRemotePath, &fi, FT_ATTR_COPY_DOWNLOAD);
-
-    setButtonsState();
-    
-    delete [] pBuf;
-    return;
-  }
-  
-  setButtonsState();
-  setStatusText("File Transfer Impossible. No file(s) selected for transfer");
-}
-
-void 
-FTDialog::onLocalRename()
-{
-  if (m_pRenameDlg != NULL) return;
-
-  FileInfo fi;
-  if (m_pLocalLV->getSelectedItems(&fi) == 1) {
-    unsigned int flags = fi.getFlagsAt(0);
-    m_pRenameDlg = new FTDialog::RenameDlg(this);
-    if (m_pRenameDlg != NULL) {
-      if (flags & FT_ATTR_DIR) {
-        m_pRenameDlg->create(fi.getNameAt(0), true);
-      } else {
-        m_pRenameDlg->create(fi.getNameAt(0), false);
-      }
-      if (strlen(m_pRenameDlg->getFolderName()) > 0) {
-        FolderManager fm;
-        fm.renameIt(m_szLocalPath, fi.getNameAt(0), m_pRenameDlg->getFolderName());
-        showLocalLVItems();
-      }
-      delete m_pRenameDlg;
-      m_pRenameDlg = NULL;
-    }
-  }
-  setButtonsState();
-}
-
-void 
-FTDialog::onRemoteRename()
-{
-  if (m_pRenameDlg != NULL) return;
-
-  FileInfo fi;
-  if (m_pRemoteLV->getSelectedItems(&fi) == 1) {
-    unsigned int flags = fi.getFlagsAt(0);
-    m_pRenameDlg = new FTDialog::RenameDlg(this);
-    if (m_pRenameDlg != NULL) {
-      if (flags & FT_ATTR_DIR) {
-        m_pRenameDlg->create(fi.getNameAt(0), true);
-      } else {
-        m_pRenameDlg->create(fi.getNameAt(0), false);
-      }
-      if (strlen(m_pRenameDlg->getFolderName()) > 0) {
-        m_pFileTransfer->renameRemote(m_szRemotePath, fi.getNameAt(0), m_pRenameDlg->getFolderName());
-      }
-      delete m_pRenameDlg;
-      m_pRenameDlg = NULL;
-    }
-  }
-  setButtonsState();
-}
-
-void 
-FTDialog::onLocalDelete()
-{
-  FileInfo fi;
-  if (m_pLocalLV->getSelectedItems(&fi) > 0) {
-    m_pFileTransfer->addDeleteQueue(m_szLocalPath, &fi, FT_ATTR_DELETE_LOCAL);
-  }
-  setButtonsState();
-}
-
-void 
-FTDialog::onRemoteDelete()
-{
-  FileInfo fi;
-  if (m_pRemoteLV->getSelectedItems(&fi) > 0) {
-    m_pFileTransfer->addDeleteQueue(m_szRemotePath, &fi, FT_ATTR_DELETE_REMOTE);
-  }
-  setButtonsState();
-}
-
-bool
-FTDialog::getCreateFolderName()
-{
-  if (m_pCreateFolderDlg != NULL) return false;
-
-  bool bResult = false;
-
-  m_pCreateFolderDlg = new FTDialog::CreateFolderDlg(this);
-  m_pCreateFolderDlg->create();
-  if (strlen(m_pCreateFolderDlg->getFolderName()) != 0) {
-    strcpy(m_szCreateFolderName, m_pCreateFolderDlg->getFolderName());
-    bResult = true;
-  } else {
-    m_szCreateFolderName[0] = '\0';
-    bResult = false;
-  }
-  delete m_pCreateFolderDlg;
-  m_pCreateFolderDlg = NULL;
-
-  return bResult;
-}
-
-void 
-FTDialog::onLocalCreateFolder()
-{
-  if (getCreateFolderName()) {
-    char path[FT_FILENAME_SIZE];
-    sprintf(path, "%s\\%s", m_szLocalPath, m_szCreateFolderName);
-    setStatusText("Creating Local Folder: %s", path);
-    FolderManager fm;
-    if (fm.createDir(path)) showLocalLVItems();
-  }
-}
-
-void 
-FTDialog::onRemoteCreateFolder()
-{
-  if (getCreateFolderName()) {
-    m_pFileTransfer->createRemoteFolder(m_szRemotePath, m_szCreateFolderName);
-  }
-}
-
-void 
-FTDialog::onFTCancel()
-{
-  if (m_pCancelingDlg != NULL) return;
-
-  m_pCancelingDlg = new CancelingDlg(this);
-
-  m_pCancelingDlg->create();
-}
-
-void 
-FTDialog::cancelTransfer(bool bResult)
-{
-  if (m_pCancelingDlg != NULL) {
-    delete m_pCancelingDlg;
-    m_pCancelingDlg = NULL;
-  }
-
-  setButtonsState();
-
-  if ((m_bCloseDlgAfterCancel) && (bResult)) {
-    m_bCloseDlgAfterCancel = false;
-    closeFTDialog();
-  }
-
-  m_pFileTransfer->m_bCancel = bResult;
-}
-
-void 
-FTDialog::afterCancelTransfer()
-{
-  if (m_pCancelingDlg != NULL) {
-    delete m_pCancelingDlg;
-    m_pCancelingDlg = NULL;
-  }
-}
-
-void
-FTDialog::onFTMenuCommand(int command)
-{
-  switch (command) 
-  {
-  case IDM_FTCOPY:
-    {
-      switch (m_FTMenuSource)
-      {
-        case IDC_FTLOCALLIST:  onUpload();   break;
-        case IDC_FTREMOTELIST: onDownload(); break;
-        default: break;
-      }
-    }
-    break;
-  case IDM_FTRENAME:
-    {
-      switch (m_FTMenuSource)
-      {
-        case IDC_FTLOCALLIST:  onLocalRename();  break;
-        case IDC_FTREMOTELIST: onRemoteRename(); break;
-        default: break;
-      }
-    }
-    break;
-  case IDM_FTDELETE:
-    {
-      switch (m_FTMenuSource)
-      {
-        case IDC_FTLOCALLIST:  onLocalDelete();  break;
-        case IDC_FTREMOTELIST: onRemoteDelete(); break;
-        default: break;
-      }
-    }
-    break;
-  case IDM_FTCANCEL: onFTCancel(); break;
-  case IDM_FTCREATEFOLDER:
-    {
-      switch (m_FTMenuSource)
-      {
-        case IDC_FTLOCALLIST:  onLocalCreateFolder();  break;
-        case IDC_FTREMOTELIST: onRemoteCreateFolder(); break;
-        default: break;
-      }
-    }
-    break;
-  default:
-    break;
-  }
-}
-
-void 
-FTDialog::onLocalRButton()
-{
-  refreshBtnState();
-  m_FTMenuSource = IDC_FTLOCALLIST;
-  showFTMenu(m_BtnState.uploadBtn, m_BtnState.createLocalFldBtn, 
-             m_BtnState.renameLocalBtn, m_BtnState.deleteLocalBtn, 
-             m_BtnState.cancelBtn);
-}
-
-void 
-FTDialog::onRemoteRButton()
-{
-  refreshBtnState();
-  m_FTMenuSource = IDC_FTREMOTELIST;
-  showFTMenu(m_BtnState.downloadBtn, m_BtnState.createRemoteFldBtn, 
-             m_BtnState.renameRemoteBtn, m_BtnState.deleteRemoteBtn, 
-             m_BtnState.cancelBtn);
-}
-
-void
-FTDialog::showFTMenu(bool copyBtnState, bool createFldBtnState, bool renameBtnState, 
-                     bool deleteBtnState, bool cancelBtnState)
-{
-  HMENU hMenu = LoadMenu(m_hInstance, MAKEINTRESOURCE(IDR_FTMENU));
-  HMENU hFTMenu = GetSubMenu(hMenu, 0);
-
-  SetMenuDefaultItem(hFTMenu, IDM_FTCOPY, FALSE);
-
-  SetForegroundWindow(m_hwndFTDialog);
-
-  if (copyBtnState) {
-    EnableMenuItem(hMenu, IDM_FTCOPY, MF_ENABLED);
-  } else {
-    EnableMenuItem(hMenu, IDM_FTCOPY, MF_DISABLED | MF_GRAYED);
-  }
-  if (createFldBtnState) {
-    EnableMenuItem(hMenu, IDM_FTCREATEFOLDER, MF_ENABLED);
-  } else {
-    EnableMenuItem(hMenu, IDM_FTCREATEFOLDER, MF_DISABLED | MF_GRAYED);
-  }
-  if (renameBtnState) {
-    EnableMenuItem(hMenu, IDM_FTRENAME, MF_ENABLED);
-  } else {
-    EnableMenuItem(hMenu, IDM_FTRENAME, MF_DISABLED | MF_GRAYED);
-  }
-  if (deleteBtnState) {
-    EnableMenuItem(hMenu, IDM_FTDELETE, MF_ENABLED);
-  } else {
-    EnableMenuItem(hMenu, IDM_FTDELETE, MF_DISABLED | MF_GRAYED);
-  }
-  if (cancelBtnState) {
-    EnableMenuItem(hMenu, IDM_FTCANCEL, MF_ENABLED);
-  } else {
-    EnableMenuItem(hMenu, IDM_FTCANCEL, MF_DISABLED | MF_GRAYED);
-  }
-  DrawMenuBar(m_hwndFTDialog);
-
-  POINT cursorPosition;
-  GetCursorPos(&cursorPosition);
-  TrackPopupMenu(hFTMenu, 0, cursorPosition.x, cursorPosition.y, 0, m_hwndFTDialog, 0);
-  DestroyMenu(hFTMenu);
-}
-
-void
-FTDialog::setIcon(int dest, int idIcon)
-{
-  HANDLE hIcon = LoadImage(m_hInstance, MAKEINTRESOURCE(idIcon), IMAGE_ICON, 16, 16, LR_SHARED);
-  SendMessage(GetDlgItem(m_hwndFTDialog, dest), BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) hIcon);
-  DestroyIcon((HICON) hIcon);
-}
-
-void
-FTDialog::refreshBtnState()
-{
-  if (!m_bDlgShown) return;
-  
-  int locPathLen = strlen(m_szLocalPath);
-  int remPathLen = strlen(m_szRemotePath);
-  
-  if (GetFocus() == m_pLocalLV->getWndHandle()) {
-    m_BtnState.downloadBtn = false;
-    if (strlen(m_szLocalPath) != 0) {
-      m_BtnState.createLocalFldBtn = true;
-      int nCount = ListView_GetSelectedCount(m_pLocalLV->getWndHandle());
-      if (nCount <= 0) {
-        m_BtnState.uploadBtn = false;
-        m_BtnState.deleteLocalBtn = false;
-        m_BtnState.renameLocalBtn = false;
-      } else {
-        m_BtnState.deleteLocalBtn = true;
-        if (remPathLen == 0) {
-          m_BtnState.uploadBtn = false;
-        } else {
-          m_BtnState.uploadBtn = true;
-        }
-        if (nCount == 1) {
-          m_BtnState.renameLocalBtn = true;
-        } else {
-          m_BtnState.renameLocalBtn = false;
-        }
-      }
-    } else {
-      m_BtnState.uploadBtn = false;
-      m_BtnState.createLocalFldBtn = false;
-      m_BtnState.deleteLocalBtn = false;
-      m_BtnState.renameLocalBtn = false;
-      m_BtnState.downloadBtn = false;
-    }
-  } else {
-    if (GetFocus() == m_pRemoteLV->getWndHandle()) {
-      m_BtnState.uploadBtn = false;
-      if (strlen(m_szRemotePath) != 0) {
-        m_BtnState.createRemoteFldBtn = true;
-        int nCount = ListView_GetSelectedCount(m_pRemoteLV->getWndHandle());
-        if (nCount <= 0) {
-          m_BtnState.downloadBtn = false;
-          m_BtnState.deleteRemoteBtn = false;
-          m_BtnState.renameRemoteBtn = false;
-        } else {
-          m_BtnState.deleteRemoteBtn = true;
-          if (locPathLen == 0) {
-            m_BtnState.downloadBtn = false;
-          } else {
-            m_BtnState.downloadBtn = true;
-          }
-          if (nCount == 1) {
-            m_BtnState.renameRemoteBtn = true;
-          } else {
-            m_BtnState.renameRemoteBtn = false;
-          }
-        }
-      } else {
-        m_BtnState.downloadBtn = false;
-        m_BtnState.createRemoteFldBtn = false;
-        m_BtnState.deleteRemoteBtn = false;
-        m_BtnState.renameRemoteBtn = false;
-        m_BtnState.uploadBtn = false;
-      }
-    } else {
-    }
-  }
-  if (m_pFileTransfer->isTransferEnable()) 
-    m_BtnState.cancelBtn = true;
-  else
-    m_BtnState.cancelBtn = false;
-}
-
-void
-FTDialog::setButtonsState()
-{
-  refreshBtnState();
-
-  switch (m_BtnState.uploadBtn)
-  {
-  case false: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTUPLOAD), FALSE); break;
-  case true: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTUPLOAD), TRUE); break;
-  }
-
-  switch (m_BtnState.downloadBtn)
-  {
-  case false: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTDOWNLOAD), FALSE); break;
-  case true: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTDOWNLOAD), TRUE); break;
-  }
-
-  switch (m_BtnState.cancelBtn)
-  {
-  case false: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTCANCEL), FALSE); break;
-  case true: EnableWindow(GetDlgItem(m_hwndFTDialog, IDC_FTCANCEL), TRUE); break;
-  }
-
-  UpdateWindow(m_hwndFTDialog);
-}
-
-void 
-FTDialog::setStatusText(LPCSTR format,...)
-{
-  char text[1024];
-  va_list args;
-  va_start(args, format);
-  int nSize = _vsnprintf(text, sizeof(text), format, args);
-
-  HWND hStatusBox = GetDlgItem(m_hwndFTDialog, IDC_FTSTATUS);
-
-  LRESULT lRes = SendMessage(hStatusBox, (UINT) CB_INSERTSTRING, (WPARAM) 0, (LPARAM) text);
-  if ((lRes != CB_ERR) && (lRes != CB_ERRSPACE)) {
-    lRes = SendMessage(hStatusBox, (UINT) CB_SETCURSEL, (WPARAM) lRes, (LPARAM) 0);
-  }
-  
-  m_dwNumStatusStrings++;
-  if (m_dwNumStatusStrings > FT_MAX_STATUS_STRINGS) {
-    int numItems = SendMessage(hStatusBox, (UINT) CB_GETCOUNT, (WPARAM) 0, (LPARAM) 0); 
-    if (numItems != CB_ERR) {
-      m_dwNumStatusStrings--;
-      SendMessage(hStatusBox, (UINT) CB_DELETESTRING, (WPARAM) numItems - 1, (LPARAM) 0); 
-    }
-  }
-}
-
-void 
-FTDialog::getBrowseItems(char *pPath)
-{
-  if (m_bLocalBrowsing) {
-    FileInfo fi;
-    FolderManager fm;
-    fm.getDirInfo(pPath, &fi, 1);
-    if (m_pBrowseDlg != NULL) m_pBrowseDlg->addItems(&fi);
-  } else {
-    m_pFileTransfer->requestFileList(pPath, FT_FLR_DEST_BROWSE, true);
-  }
-}
-
-void 
-FTDialog::addBrowseItems(FileInfo *pFI)
-{
-  if (m_pBrowseDlg == NULL) return;
-
-  m_pBrowseDlg->addItems(pFI);
-}
-
-void 
-FTDialog::processDlgMsgs()
-{
-  MSG msg;
-  while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != 0) {
-    TranslateMessage(&msg);
-    DispatchMessage(&msg);
-  }
-}
-
-void 
-FTDialog::postCheckTransferQueueMsg()
-{
-  PostMessage(m_hwndFTDialog, m_msgCheckTransferQueue, 0, 0);
-}
-
-void 
-FTDialog::postUploadFilePortionMsg()
-{
-  PostMessage(m_hwndFTDialog, m_msgUploadFilePortion, 0, 0);
-}
-
-void 
-FTDialog::postCheckDeleteQueueMsg()
-{
-  PostMessage(m_hwndFTDialog, m_msgCheckDeleteQueue, 0, 0);
-}
-
-FTDialog::CancelingDlg::CancelingDlg(FTDialog *pFTDlg)
-{
-  m_pFTDlg = pFTDlg;
-  m_hwndDlg = NULL;
-}
-
-FTDialog::CancelingDlg::~CancelingDlg()
-{
-  destroy();
-}
-
-bool 
-FTDialog::CancelingDlg::create()
-{
-  if (m_hwndDlg != NULL) return false;
-
-  m_hwndDlg = CreateDialogParam(GetModuleHandle(0), 
-                                MAKEINTRESOURCE(IDD_FTCANCELING),
-                                NULL, 
-                                (DLGPROC) cancelingDlgProc,
-                                (LONG) this);
-
-  if (m_hwndDlg == NULL) return false;
-
-  ShowWindow(m_hwndDlg, SW_SHOW);
-  DrawIcon(GetDC(m_hwndDlg), 15, 22, LoadIcon(NULL, IDI_QUESTION));
-  UpdateWindow(m_hwndDlg);
-
-  return true;
-}
-
-bool 
-FTDialog::CancelingDlg::destroy()
-{
-  if (m_hwndDlg == NULL) return true;
-
-  if (DestroyWindow(m_hwndDlg)) {
-    m_hwndDlg = NULL;
-    return true;
-  } else {
-    return false;
-  }
-}
-
-bool
-FTDialog::CancelingDlg::close(bool bResult)
-{
-  if (m_hwndDlg == NULL) return true;
-
-  destroy();
-
-  m_pFTDlg->cancelTransfer(bResult);
-
-  return false;
-}
-
-BOOL CALLBACK 
-FTDialog::CancelingDlg::cancelingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-  FTDialog::CancelingDlg *_this = (FTDialog::CancelingDlg *) GetWindowLong(hwnd, GWL_USERDATA);
-  switch (uMsg)
-  {
-  case WM_INITDIALOG:
-      SetWindowLong(hwnd, GWL_USERDATA, (LONG) lParam);
-      SetForegroundWindow(hwnd);
-    return TRUE;
-
-  case WM_COMMAND:
-    switch (LOWORD(wParam))
-    {
-    case IDOK:
-      _this->close(true);
-      return TRUE;
-    case IDCANCEL:
-      _this->close(false);
-      return TRUE;
-    }
-    break;
-    case WM_CLOSE:
-      _this->close(false);
-      return TRUE;
-  }
-  return FALSE;
-}
-
-FTDialog::CreateFolderDlg::CreateFolderDlg(FTDialog *pFTDlg) : Dialog(GetModuleHandle(0))
-{
-  m_pFTDlg = pFTDlg;
-  m_szFolderName[0] = '\0';
-}
-
-FTDialog::CreateFolderDlg::~CreateFolderDlg()
-{
-
-}
-
-bool
-FTDialog::CreateFolderDlg::create()
-{
-  return showDialog(MAKEINTRESOURCE(IDD_FTCREATEFOLDER), m_pFTDlg->getWndHandle());
-}
-
-bool 
-FTDialog::CreateFolderDlg::onOk()
-{
-  strcpy(m_szFolderName, getItemString(IDC_FTFOLDERNAME));
-  return true;
-}
-
-FTDialog::RenameDlg::RenameDlg(FTDialog *pFTDlg) : CreateFolderDlg(pFTDlg)
-{
-  m_bFolder = false;
-}
-
-FTDialog::RenameDlg::~RenameDlg()
-{
-}
-
-bool 
-FTDialog::RenameDlg::create(char *pFilename, bool bFolder)
-{
-  m_bFolder = bFolder;
-  strcpy(m_szFilename, pFilename);
-  return showDialog(MAKEINTRESOURCE(IDD_FTCREATEFOLDER), m_pFTDlg->getWndHandle());
-}
-
-void
-FTDialog::RenameDlg::initDialog()
-{
-  char buf[2*FT_FILENAME_SIZE];
-  if (m_bFolder) {
-    SetWindowText(handle, "Rename Folder");
-    sprintf(buf, "Rename Folder '%s'", m_szFilename);
-  } else {
-    SetWindowText(handle, "Rename File");
-    sprintf(buf, "Rename File '%s'", m_szFilename);
-  }
-
-  setItemString(IDC_FTTEXT, buf);
-  setItemString(IDC_FTFOLDERNAME, m_szFilename);
-  SendDlgItemMessage(handle, IDC_FTFOLDERNAME, EM_SETSEL, (WPARAM) 0, (LPARAM) -1);
-}
diff --git a/win/vncviewer/FTDialog.h b/win/vncviewer/FTDialog.h
deleted file mode 100644
index 883ccd9..0000000
--- a/win/vncviewer/FTDialog.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTDialog.h
-
-#ifndef __RFB_WIN32_FTDIALOG_H__
-#define __RFB_WIN32_FTDIALOG_H__
-
-#include <windows.h>
-#include <commctrl.h>
-
-#include <rfb/FileInfo.h>
-#include <rfb_win32/Dialog.h>
-#include <vncviewer/FileTransfer.h>
-#include <vncviewer/FTListView.h>
-#include <vncviewer/FTProgress.h>
-#include <vncviewer/FTBrowseDlg.h>
-#include <vncviewer/resource.h>
-
-namespace rfb {
-  namespace win32 {
-    class FileTransfer;
-    class FTBrowseDlg;
-
-    class FTDialog
-    {
-    public:
-      FTDialog(HINSTANCE hInst, FileTransfer *pFT);
-      ~FTDialog();
-      
-      bool createFTDialog(HWND hwndParent);
-      bool closeFTDialog();
-      void destroyFTDialog();
-
-      void processDlgMsgs();
-
-      void cancelTransfer(bool bResult);
-      void afterCancelTransfer();
-      
-      static BOOL CALLBACK FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-      
-      void addRemoteLVItems(FileInfo *pFI);
-      void reqFolderUnavailable();
-
-      void onEndBrowseDlg(bool bResult);
-      void getBrowseItems(char *pPath);
-      void addBrowseItems(FileInfo *pFI);
-
-      void setStatusText(LPCSTR format,...);
-
-      HWND getWndHandle() { return m_hwndFTDialog; }
-
-      void postCheckDeleteQueueMsg();
-      void postCheckTransferQueueMsg();
-      void postUploadFilePortionMsg();
-      void postDownloadFilePortionMsg();
-
-      char *getLocalPath() { return m_szLocalPath; }
-      char *getRemotePath() { return m_szRemotePath; }
-
-      FTProgress *m_pProgress;
-      FileTransfer *m_pFileTransfer;
-      
-    private:
-      HWND m_hwndFTDialog;
-      HWND m_hwndLocalPath;
-      HWND m_hwndRemotePath;
-      HINSTANCE m_hInstance;
-      
-      void showLocalLVItems();
-      void showRemoteLVItems();
-
-      void onClose();
-
-      void onLocalItemActivate(LPNMITEMACTIVATE lpnmia);
-      void onRemoteItemActivate(LPNMITEMACTIVATE lpnmia);
-
-      void onLocalBrowse();
-      void onRemoteBrowse();
-
-      void onLocalReload();
-      void onRemoteReload();
-
-      void onLocalRButton();
-      void onRemoteRButton();
-
-      bool getCreateFolderName();
-      void onLocalCreateFolder();
-      void onRemoteCreateFolder();
-
-      void showFTMenu(bool copyBtnState, bool createFldBtnState, 
-                      bool renameBtnState, bool deleteBtnState, 
-                      bool cancelBtnState);
-      void onFTMenuCommand(int command);
-
-      void onUpload();
-      void onDownload();
-
-      void onLocalRename();
-      void onRemoteRename();
-
-      void onLocalDelete();
-      void onRemoteDelete();
-
-      void onFTCancel();
-
-      void setIcon(int dest, int idIcon);
-      bool initFTDialog();
-      bool initFTWndMsgs();
-      
-      void onLocalOneUpFolder();
-      void onRemoteOneUpFolder();
-      int makeOneUpFolder(char *pPath);
-
-      void refreshBtnState();
-      void setButtonsState();
-      
-      bool m_bDlgShown;
-      bool m_bLocalBrowsing;
-      bool m_bCloseDlgAfterCancel;
-
-      UINT m_msgCheckDeleteQueue;
-      UINT m_msgCheckTransferQueue;
-      UINT m_msgUploadFilePortion;
-      UINT m_msgDownloadFilePortion;
-
-      DWORD m_dwNumStatusStrings;
-
-      FTListView *m_pLocalLV;
-      FTListView *m_pRemoteLV;
-
-      FTBrowseDlg *m_pBrowseDlg;
-
-      int m_FTMenuSource;
-
-      char m_szLocalPath[FT_FILENAME_SIZE];
-      char m_szRemotePath[FT_FILENAME_SIZE];
-      char m_szLocalPathTmp[FT_FILENAME_SIZE];
-      char m_szRemotePathTmp[FT_FILENAME_SIZE];
-      char m_szCreateFolderName[FT_FILENAME_SIZE];
-
-      static const char szCheckDeleteQueueText[];
-      static const char szCheckTransferQueueText[];
-      static const char szUploadFilePortionText[];
-
-      typedef struct tagFTBUTTONSSTATE
-      {
-        bool uploadBtn;
-        bool downloadBtn;
-        bool createLocalFldBtn;
-        bool createRemoteFldBtn;
-        bool renameLocalBtn;
-        bool renameRemoteBtn;
-        bool deleteLocalBtn;
-        bool deleteRemoteBtn;
-        bool cancelBtn;
-      } FTBUTTONSSTATE;
-
-      FTBUTTONSSTATE m_BtnState;
-
-    public:
-      class CancelingDlg
-      {
-      public:
-        CancelingDlg(FTDialog *pFTDlg);
-        ~CancelingDlg();
-
-        static BOOL CALLBACK cancelingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-        bool create();
-        bool destroy();
-
-      private:
-        FTDialog *m_pFTDlg;
-        HWND m_hwndDlg;
-
-        bool close(bool bResult);
-      };
-
-    private:
-        CancelingDlg *m_pCancelingDlg;
-
-    public:
-      class CreateFolderDlg : public Dialog
-      {
-      public:
-        CreateFolderDlg(FTDialog *pFTDlg);
-        ~CreateFolderDlg();
-
-        bool onOk();
-        bool create();
-        char *getFolderName() { return m_szFolderName; }
-
-      protected:
-        FTDialog *m_pFTDlg;
-        char m_szFolderName[FT_FILENAME_SIZE];
-      };
-
-      private:
-        CreateFolderDlg *m_pCreateFolderDlg;
-
-    public:
-      class RenameDlg : public CreateFolderDlg
-      {
-      public:
-        RenameDlg(FTDialog *pFTDlg);
-        ~RenameDlg();
-
-        bool create(char *pFilename, bool bFolder);
-        void initDialog();
-
-      private:
-        bool m_bFolder;
-        char m_szFilename[FT_FILENAME_SIZE];
-      };
-
-    private:
-        RenameDlg *m_pRenameDlg;
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FTDIALOG_H__
diff --git a/win/vncviewer/FTListView.cxx b/win/vncviewer/FTListView.cxx
deleted file mode 100644
index b2b472b..0000000
--- a/win/vncviewer/FTListView.cxx
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTListView.cxx
-
-#include <vncviewer/FTListView.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-FTListView::FTListView(HWND hListView)
-{
-  m_bInitialized = false;
-  m_hListView = hListView;
-  m_fileInfo.free();
-}
-
-FTListView::~FTListView()
-{
-  m_fileInfo.free();
-}
-
-
-bool 
-FTListView::initialize(HINSTANCE hInst)
-{
-  if (m_bInitialized) return false;
-
-  initImageList(hInst);
-  
-  RECT Rect;
-  GetClientRect(m_hListView, &Rect);
-  Rect.right -= GetSystemMetrics(SM_CXHSCROLL);
-  int xwidth0 = (int) (0.35 * Rect.right);
-  int xwidth1 = (int) (0.22 * Rect.right);
-  int xwidth2 = (int) (0.43 * Rect.right);
-  
-  addColumn("Name", 0, xwidth0, LVCFMT_LEFT);
-  addColumn("Size", 1, xwidth1, LVCFMT_RIGHT);
-  addColumn("Data", 2, xwidth2, LVCFMT_LEFT);
-
-  ListView_SetExtendedListViewStyleEx(m_hListView, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
- 
-  return true;
-}
-
-void 
-FTListView::onGetDispInfo(NMLVDISPINFO *pDI)
-{
-  if (m_fileInfo.getFlagsAt(pDI->item.iItem) & FT_ATTR_DIR) {
-    pDI->item.iImage = 0;
-  } else {
-    pDI->item.iImage = 1;
-  }
-  
-  switch (pDI->item.iSubItem)
-  {
-  case 0:
-    pDI->item.pszText = m_fileInfo.getNameAt(pDI->item.iItem);
-    break;
-  case 1:
-    {
-      unsigned int flags = m_fileInfo.getFlagsAt(pDI->item.iItem);
-      switch(flags & 0x000000FF)
-      {
-      case FT_ATTR_FILE:
-        {
-          char buf[32];
-          unsigned int size = m_fileInfo.getSizeAt(pDI->item.iItem);
-          sprintf(buf, "%u", size);
-          pDI->item.pszText = buf;
-        }
-        break;
-      case FT_ATTR_DIR:
-        pDI->item.pszText = "";
-        break;
-      default:
-        pDI->item.pszText = "Unspecified";
-      }
-    }
-    break;
-  case 2:
-    {
-      unsigned int data = m_fileInfo.getDataAt(pDI->item.iItem);
-      if (data == 0) {
-        pDI->item.pszText = "Unspecified";
-      } else {
-        FILETIME ft;
-        FolderManager fm;
-        fm.getFiletime(data, &ft);
-        
-        SYSTEMTIME st;
-        FileTimeToSystemTime(&ft, &st);
-        
-        char pDateTimeStr[1024];
-        char timeFmt[128];
-        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, timeFmt, 128);
-        char dateFmt[128];
-        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, dateFmt, 128);
-        
-        char timeStr[128];
-        GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, timeFmt, timeStr, 128);
-        char dateStr[128];
-        GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, dateFmt, dateStr, 128);
-        
-        sprintf(pDateTimeStr, "%s %s", dateStr, timeStr);
-        pDI->item.pszText = pDateTimeStr;
-      }
-    }
-    break;
-  default:
-    break;
-  }
-}
-
-void 
-FTListView::addItems(FileInfo *pFI)
-{
-  m_fileInfo.add(pFI);
-  LVITEM LVItem;
-  LVItem.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; 
-  LVItem.state = 0; 
-  LVItem.stateMask = 0; 
-  for (unsigned int i = 0; i < m_fileInfo.getNumEntries(); i++) {
-    LVItem.iItem = i;
-    LVItem.iSubItem = 0;
-    LVItem.iImage = I_IMAGECALLBACK;
-    LVItem.pszText = LPSTR_TEXTCALLBACK;
-    ListView_InsertItem(m_hListView, &LVItem);
-  }
-}
-
-void 
-FTListView::deleteAllItems()
-{
-  ListView_DeleteAllItems(m_hListView);
-  m_fileInfo.free();
-}
-
-char *
-FTListView::getActivateItemName(LPNMITEMACTIVATE lpnmia)
-{
-  return m_fileInfo.getNameAt(lpnmia->iItem);
-}
-
-int 
-FTListView::getSelectedItems(FileInfo *pFI)
-{
-  int selCount = ListView_GetSelectedCount(m_hListView);
-  int selItem = ListView_GetSelectionMark(m_hListView);
-  if ((selCount < 1) || (selItem < 0)) return -1;
-  
-  selItem = -1;
-  selItem = ListView_GetNextItem(m_hListView, selItem, LVNI_SELECTED);
-  do {
-    pFI->add(m_fileInfo.getFullDataAt(selItem));
-    selItem = ListView_GetNextItem(m_hListView, selItem, LVNI_SELECTED);
-  } while (selItem >= 0);
-  
-  return selCount;
-}
-
-void
-FTListView::initImageList(HINSTANCE hInst)
-{
-  m_hImageList = ImageList_Create(16, 16, ILC_MASK, 2, 2); 
-  
-  HICON hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_FTDIR)); 
-  ImageList_AddIcon(m_hImageList, hiconItem);  
-  DestroyIcon(hiconItem); 
-  
-  hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_FTFILE)); 
-  ImageList_AddIcon(m_hImageList, hiconItem); 
-  DestroyIcon(hiconItem); 
-  
-  ListView_SetImageList(m_hListView, m_hImageList, LVSIL_SMALL); 
-}
-
-void 
-FTListView::addColumn(char *iText, int iOrder, int xWidth, int alignFmt)
-{
-	LVCOLUMN lvc; 
-	lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
-	lvc.fmt = alignFmt;
-	lvc.iSubItem = iOrder;
-	lvc.pszText = iText;	
-	lvc.cchTextMax = 32;
-	lvc.cx = xWidth;
-	lvc.iOrder = iOrder;
-	ListView_InsertColumn(m_hListView, iOrder, &lvc);
-}
diff --git a/win/vncviewer/FTListView.h b/win/vncviewer/FTListView.h
deleted file mode 100644
index 9bd3c2a..0000000
--- a/win/vncviewer/FTListView.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTListView.h
-
-#ifndef __RFB_WIN32_FTLISTVIEW_H__
-#define __RFB_WIN32_FTLISTVIEW_H__
-
-#include <windows.h>
-#include <commctrl.h>
-
-#include <rfb/FileInfo.h>
-#include <rfb_win32/FolderManager.h>
-#include <vncviewer/resource.h>
-
-namespace rfb {
-  namespace win32{
-    class FTListView
-    {
-    public:
-      FTListView(HWND hListView);
-      ~FTListView();
-
-      bool initialize(HINSTANCE hInst);
-      
-      void onGetDispInfo(NMLVDISPINFO *di);
-      void addItems(FileInfo *pFI);
-      void deleteAllItems();
-      
-      char *getActivateItemName(LPNMITEMACTIVATE lpnmia);
-      int getSelectedItems(FileInfo *pFI);
-      
-      HWND getWndHandle() { return m_hListView; };
-      
-    private:
-      HWND m_hListView;
-      FileInfo m_fileInfo;
-      HIMAGELIST m_hImageList;
-
-      bool m_bInitialized;
-
-      void addColumn(char *iText, int iOrder, int xWidth, int alignFmt);
-      void initImageList(HINSTANCE hInst);
-      
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FTLISTVIEW_H__
diff --git a/win/vncviewer/FTProgress.cxx b/win/vncviewer/FTProgress.cxx
deleted file mode 100644
index 04f0186..0000000
--- a/win/vncviewer/FTProgress.cxx
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTProgress.cxx
-
-#include <vncviewer/FTProgress.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-FTProgress::FTProgress(HWND hwndParent)
-{
-  m_bInitialized = false;
-  m_hwndParent = hwndParent;
-
-  m_pSingleProgress = NULL;
-  m_pGeneralProgress = NULL;
-
-  m_hwndSinglePercent = GetDlgItem(m_hwndParent, IDC_FTSINGLEPERCENT);
-  m_hwndGeneralPercent = GetDlgItem(m_hwndParent, IDC_FTGENERALPERCENT);
-
-  m_bInitialized = createProgressBarObjects();
-}
-
-FTProgress::~FTProgress()
-{
-  destroyProgressBarObjects();
-}
-
-void
-FTProgress::increase(DWORD value)
-{
-  if (!m_bInitialized) return;
-
-  m_pSingleProgress->increase(value);
-  m_pGeneralProgress->increase(value);
-
-  setProgressText();
-}
-
-void
-FTProgress::clearAndInitGeneral(DWORD64 dw64MaxValue, DWORD64 dw64Position)
-{
-  if (!m_bInitialized) return;
-
-  m_pGeneralProgress->clear();
-  m_pGeneralProgress->init(dw64MaxValue, dw64Position);
-
-  setProgressText();
-}
-
-void
-FTProgress::clearAndInitSingle(DWORD dwMaxValue, DWORD dwPosition)
-{
-  if (!m_bInitialized) return;
-
-  m_pSingleProgress->clear();
-  m_pSingleProgress->init(dwMaxValue, dwPosition);
-
-  setProgressText();
-}
-
-void
-FTProgress::clearAll()
-{
-  if (!m_bInitialized) return;
-
-  m_pSingleProgress->clear();
-  m_pGeneralProgress->clear();
-
-  setProgressText();
-}
-
-bool 
-FTProgress::createProgressBarObjects()
-{
-  if ((m_pSingleProgress != NULL) || (m_pGeneralProgress != NULL)) {
-    return false;
-  } else {
-    HWND hwndSingleProgr = GetDlgItem(m_hwndParent, IDC_FTSINGLEPROGRESS);
-    HWND hwndGeneralProgr = GetDlgItem(m_hwndParent, IDC_FTGENERALPROGRESS);
-    
-    m_pSingleProgress = new ProgressControl(hwndSingleProgr);
-    if (m_pSingleProgress == NULL) return false;
-    
-    m_pGeneralProgress = new ProgressControl(hwndGeneralProgr);
-    if (m_pGeneralProgress == NULL) {
-      delete m_pSingleProgress;
-      m_pSingleProgress = NULL;
-      return false;
-    }
-  }
-  return true;
-}
-
-bool 
-FTProgress::destroyProgressBarObjects()
-{
-  clearAll();
-
-  if (m_pSingleProgress != NULL) {
-    delete m_pSingleProgress;
-    m_pSingleProgress = NULL;
-  }
-
-  if (m_pGeneralProgress != NULL) {
-    delete m_pGeneralProgress;
-    m_pGeneralProgress = NULL;
-  }
-
-  return true;
-}
-
-void
-FTProgress::setProgressText()
-{
-  char buf[16] = {0};
-  char buf2[16] = {0};
-  
-  int percent = m_pSingleProgress->getCurrentPercent();
-  sprintf(buf, "%d%%", percent);
-  GetWindowText(m_hwndSinglePercent, buf2, 16);
-  if (strcmp(buf, buf2) != 0)
-    SetWindowText(m_hwndSinglePercent, buf);
-  
-  percent = m_pGeneralProgress->getCurrentPercent();
-  sprintf(buf, "%d%%", percent);
-  GetWindowText(m_hwndGeneralPercent, buf2, 16);
-  if (strcmp(buf, buf2) != 0)
-    SetWindowText(m_hwndGeneralPercent, buf);
-}
diff --git a/win/vncviewer/FTProgress.h b/win/vncviewer/FTProgress.h
deleted file mode 100644
index b51f19a..0000000
--- a/win/vncviewer/FTProgress.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FTProgress.h
-
-#ifndef __RFB_WIN32_FTPROGRESS_H__
-#define __RFB_WIN32_FTPROGRESS_H__
-
-#include <windows.h>
-#include <commctrl.h>
-#include <stdio.h>
-
-#include <rfb_win32/ProgressControl.h>
-#include <vncviewer/resource.h>
-
-namespace rfb {
-  namespace win32 {
-    class FTProgress
-    {
-    public:
-      FTProgress(HWND hwndParent);
-      ~FTProgress();
-      
-      void increase(DWORD value);
-      void clearAndInitGeneral(DWORD64 dw64MaxValue, DWORD64 dw64Position);
-      void clearAndInitSingle(DWORD dwMaxValue, DWORD dwPosition);
-      void clearAll();
-
-    private:
-      ProgressControl *m_pSingleProgress;
-      ProgressControl *m_pGeneralProgress;
-
-      HWND m_hwndParent;
-      HWND m_hwndSinglePercent;
-      HWND m_hwndGeneralPercent;
-
-      bool m_bInitialized;
-
-      void setProgressText();
-      bool createProgressBarObjects();
-      bool destroyProgressBarObjects();
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FTPROGRESS_H__
diff --git a/win/vncviewer/FileTransfer.cxx b/win/vncviewer/FileTransfer.cxx
deleted file mode 100644
index 44c527b..0000000
--- a/win/vncviewer/FileTransfer.cxx
+++ /dev/null
@@ -1,803 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky.
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileTransfer.cxx
-
-#include <vncviewer/FileTransfer.h>
-
-using namespace rfb;
-using namespace rfb::win32;
-
-FileTransfer::FileTransfer()
-{
-  m_bFTDlgShown = false;
-  m_bInitialized = false;
-  m_bResized = false;
-  m_bCancel = false;
-  m_bOverwriteAll = false;
-
-  m_pFTDialog = new FTDialog(GetModuleHandle(0), this);
-
-  m_pReader = NULL;
-  m_pWriter = NULL;
-
-  m_dw64SizeSending = 0;
-  m_dirSizeRqstNum = 0;
-}
-
-FileTransfer::~FileTransfer()
-{
-  if (m_pFTDialog != NULL) {
-    delete m_pFTDialog;
-    m_pFTDialog = NULL;
-  }
-  
-  if (m_pReader != NULL) {
-    delete m_pReader;
-    m_pReader = NULL;
-  }
-
-  if (m_pWriter != NULL) {
-    delete m_pWriter;
-    m_pWriter = NULL;
-  }
-
-  freeQueues();
-}
-
-bool 
-FileTransfer::initialize(rdr::InStream *pIS, rdr::OutStream *pOS)
-{
-  if (m_bInitialized) return false;
-
-  m_pReader = new CFTMsgReader(pIS);
-  m_pWriter = new CFTMsgWriter(pOS);
-
-  freeQueues();
-
-  m_bInitialized = true;
-  return true;
-}
-
-bool 
-FileTransfer::show(HWND hwndParent)
-{
-  if (!m_bInitialized) return false;
-
-  m_bFTDlgShown = m_pFTDialog->createFTDialog(hwndParent);
-
-  return m_bFTDlgShown;
-}
-
-bool
-FileTransfer::processFTMsg(int type)
-{
-  if (!m_bInitialized) return false;
-
-  switch (type)
-  {
-  case msgTypeFileListData:
-    return procFileListDataMsg();
-  case msgTypeFileDownloadData:
-    return procFileDownloadDataMsg();
-  case msgTypeFileUploadCancel:
-    return procFileUploadCancelMsg();
-  case msgTypeFileDownloadFailed:
-    return procFileDownloadFailedMsg();
-  case msgTypeFileDirSizeData:
-    return procFileDirSizeDataMsg();
-  case msgTypeFileLastRequestFailed:
-    return procFileLastRqstFailedMsg();
-  default:
-    return false;
-  }
-}
-
-bool 
-FileTransfer::isTransferEnable()
-{
-  if (m_TransferQueue.getNumEntries() > 0) return true; else return false;
-}
-
-void 
-FileTransfer::addDeleteQueue(char *pPathPrefix, FileInfo *pFI, unsigned int flags)
-{
-  if ((m_bFTDlgShown) && (m_DeleteQueue.getNumEntries() > 0)) 
-    m_pFTDialog->setStatusText("Starting Delete Operation");
-
-  m_DeleteQueue.add(pPathPrefix, pPathPrefix, pFI, flags);
-
-  checkDeleteQueue();
-}
-
-void
-FileTransfer::checkDeleteQueue()
-{
-  if (m_DeleteQueue.getNumEntries() > 0) {
-    if (m_bFTDlgShown) 
-      m_pFTDialog->setStatusText("Delete Operation Executing: %s", m_DeleteQueue.getFullLocPathAt(0));
-    if (m_DeleteQueue.getFlagsAt(0) & FT_ATTR_DELETE_LOCAL) {
-      FolderManager fm;
-      if (!fm.deleteIt(m_DeleteQueue.getFullLocPathAt(0))) {
-        if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Failed");
-      } else {
-        if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Completed");
-      }
-      m_DeleteQueue.deleteAt(0);
-      m_pFTDialog->postCheckDeleteQueueMsg();
-    } else {
-      if (m_DeleteQueue.getFlagsAt(0) & FT_ATTR_DELETE_REMOTE) {
-        writeFileDeleteRqst(strlen(m_DeleteQueue.getFullLocPathAt(0)), 
-                            m_DeleteQueue.getFullLocPathAt(0));
-
-        char *pPath = m_DeleteQueue.getLocPathAt(0);
-        m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_DELETE);
-        writeFileListRqst(strlen(pPath), pPath, false);
-      }
-    }
-  } else {
-    if (m_bFTDlgShown) {
-      m_pFTDialog->setStatusText("Delete Operation Completed Successfully");
-      PostMessage(m_pFTDialog->getWndHandle(), WM_COMMAND, MAKEWPARAM(IDC_FTLOCALRELOAD, 0), 0);
-      PostMessage(m_pFTDialog->getWndHandle(), WM_COMMAND, MAKEWPARAM(IDC_FTREMOTERELOAD, 0), 0);
-    }
-  }
-}
-
-void 
-FileTransfer::addTransferQueue(char *pLocalPath, char *pRemotePath, 
-                               FileInfo *pFI, unsigned int flags)
-{
-  if (!isTransferEnable()) {
-    if (m_bFTDlgShown) m_pFTDialog->setStatusText("Starting Copy Operation");
-    m_bTransferSuccess = true;
-  }
-  
-  m_TransferQueue.add(pLocalPath, pRemotePath, pFI, (flags | FT_ATTR_RESIZE_NEEDED));
-
-  checkTransferQueue();
-}
-
-bool
-FileTransfer::resizeSending()
-{
-  for (unsigned int i = 0; i < m_TransferQueue.getNumEntries(); i++) {
-    unsigned int flags = m_TransferQueue.getFlagsAt(i);
-    if (flags & FT_ATTR_RESIZE_NEEDED) {
-      if (flags & FT_ATTR_FILE) {
-        m_bResized = true;
-        m_dw64SizeSending += m_TransferQueue.getSizeAt(i);
-        m_TransferQueue.clearFlagAt(i, FT_ATTR_RESIZE_NEEDED);
-      } else {
-        if (flags & FT_ATTR_DIR) {
-          if (flags & FT_ATTR_COPY_DOWNLOAD) {
-            m_bResized = true;
-            char *pPath = m_TransferQueue.getFullRemPathAt(i);
-            m_dirSizeRqstNum = i;
-            writeFileDirSizeRqst(strlen(pPath), pPath);
-            return false;
-          } else {
-            if (flags & FT_ATTR_COPY_UPLOAD) {
-              FolderManager fm;
-              DWORD64 dw64Size;
-              m_bResized = true;
-              fm.getDirSize(m_TransferQueue.getFullLocPathAt(i), &dw64Size);
-              m_dw64SizeSending += dw64Size;
-              m_TransferQueue.clearFlagAt(i, FT_ATTR_RESIZE_NEEDED);
-            }
-          } // if (flags & FT_ATTR_COPY_DOWNLOAD)
-        } // if (flags & FT_ATTR_FOLDER)
-      } // if (flags & FT_ATTR_FILE)
-    } // if (flags & FT_ATTR_NEEDED_RESIZE)
-  } // for (unsigned int i = 0; i < m_TransferQueue.getNumEntries(); i++)
-
-  if ((m_bFTDlgShown) && (m_bResized)) {
-    m_pFTDialog->m_pProgress->clearAndInitGeneral(m_dw64SizeSending, 0);
-    m_bResized = false;
-  }
-
-  return true;
-}
-
-void
-FileTransfer::checkTransferQueue()
-{
-  if (!isTransferEnable()) {
-    if (m_bFTDlgShown) {
-      m_pFTDialog->m_pProgress->clearAll();
-      m_dw64SizeSending = 0;
-      m_bResized = false;
-
-      if (m_bTransferSuccess) 
-        m_pFTDialog->setStatusText("File Transfer Operation Completed Successfully");
-      else 
-        m_pFTDialog->setStatusText("File Transfer Operation Completed");
-
-      m_pFTDialog->afterCancelTransfer();
-      PostMessage(m_pFTDialog->getWndHandle(), WM_COMMAND, MAKEWPARAM(IDC_FTLOCALRELOAD, 0), 0);
-      PostMessage(m_pFTDialog->getWndHandle(), WM_COMMAND, MAKEWPARAM(IDC_FTREMOTERELOAD, 0), 0);
-      return;
-    }
-  } else {
-    if (!resizeSending()) return;
-
-    unsigned int flag0 = m_TransferQueue.getFlagsAt(0);
-   
-    if (flag0 & FT_ATTR_COPY_UPLOAD) {
-      if (flag0 & FT_ATTR_FILE) {
-        uploadFile();
-        return;
-      }
-      if (flag0 & FT_ATTR_DIR) {
-        char *pFullPath = m_TransferQueue.getFullRemPathAt(0);
-        if (m_bFTDlgShown) m_pFTDialog->setStatusText("Creating Remote Folder. %s", pFullPath);
-        writeFileCreateDirRqst(strlen(pFullPath), pFullPath);
-
-        char *pPath = m_TransferQueue.getRemPathAt(0);
-        m_TransferQueue.setFlagsAt(0, (flag0 | FT_ATTR_FLR_UPLOAD_CHECK));
-        m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_UPLOAD);
-        writeFileListRqst(strlen(pPath), pPath, false);
-        return;
-      }
-    } else {
-      if (flag0 & FT_ATTR_COPY_DOWNLOAD) {
-        if (flag0 & FT_ATTR_FILE) {
-          downloadFile();
-          return;
-        }
-        if (flag0 & FT_ATTR_DIR) {
-          FolderManager fm;
-          char *pLocPath = m_TransferQueue.getFullLocPathAt(0);
-          if (m_bFTDlgShown) m_pFTDialog->setStatusText("Creating Local Folder. %s", pLocPath);
-          
-          if (!fm.createDir(pLocPath)) {
-            if (m_bFTDlgShown) m_pFTDialog->setStatusText("Creating Local Folder Failed.");
-            m_bTransferSuccess = false;
-            m_TransferQueue.deleteAt(0);
-            m_pFTDialog->postCheckTransferQueueMsg();
-            return;
-          } else {
-            if ((m_bFTDlgShown) && (strcmp(m_TransferQueue.getLocPathAt(0), m_pFTDialog->getLocalPath()) == 0))
-              PostMessage(m_pFTDialog->getWndHandle(), WM_COMMAND, MAKEWPARAM(IDC_FTLOCALRELOAD, 0), 0);
-
-            m_TransferQueue.setFlagsAt(0, (m_TransferQueue.getFlagsAt(0) | FT_ATTR_FLR_DOWNLOAD_ADD));
-            char *pRemPath = m_TransferQueue.getFullRemPathAt(0);
-            m_queueFileListRqst.add(pRemPath, 0, 0, FT_FLR_DEST_DOWNLOAD);
-            writeFileListRqst(strlen(pRemPath), pRemPath, 0);
-            return;
-          }
-        }
-      }
-    }
-    m_bTransferSuccess = false;
-    if (m_bFTDlgShown) m_pFTDialog->setStatusText("File Transfer Operation Failed. Unknown data in the transfer queue");
-  } // if (!isTransferEnable())
-}
-
-bool
-FileTransfer::uploadFile()
-{
-  if (m_TransferQueue.getFlagsAt(0) & FT_ATTR_FILE) {
-    if (m_fileReader.create(m_TransferQueue.getFullLocPathAt(0))) {
-      
-      if (m_bFTDlgShown) {
-        m_pFTDialog->setStatusText("Upload Started: %s to %s", 
-                                   m_TransferQueue.getFullLocPathAt(0), 
-                                   m_TransferQueue.getFullRemPathAt(0));
-        m_pFTDialog->m_pProgress->clearAndInitSingle(m_TransferQueue.getSizeAt(0), 0);
-      }
-
-      writeFileUploadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
-                          m_TransferQueue.getFullRemPathAt(0), 0);
-      uploadFilePortion();
-    }
-  }
-  return false;
-}
-
-bool
-FileTransfer::downloadFile()
-{
-  if (m_TransferQueue.getFlagsAt(0) & FT_ATTR_FILE) {
-    if (m_fileWriter.create(m_TransferQueue.getFullLocPathAt(0))) {
-      if (m_bFTDlgShown) {
-        m_pFTDialog->setStatusText("Download Started: %s to %s", 
-                                   m_TransferQueue.getFullRemPathAt(0), 
-                                   m_TransferQueue.getFullLocPathAt(0));
-        m_pFTDialog->m_pProgress->clearAndInitSingle(m_TransferQueue.getSizeAt(0), 0);
-      }
-      writeFileDownloadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
-                            m_TransferQueue.getFullRemPathAt(0), 0);
-      return true;
-    } else return false;
-  }
-  return false;
-}
-
-void
-FileTransfer::uploadFilePortion()
-{
-  if (checkCancelOperations()) {
-    char reason[] = "The user cancel transfer";
-    m_pWriter->writeFileUploadFailed(strlen(reason), reason);
-  }
-
-  if (m_fileReader.isCreated()) {
-    char buf[FT_MAX_SENDING_SIZE];
-    unsigned int bytesRead = 0;
-    if (m_fileReader.read((void *)buf, FT_MAX_SENDING_SIZE, &bytesRead)) {
-      if (bytesRead == 0) {
-        m_pWriter->writeFileUploadData(m_TransferQueue.getDataAt(0));
-        m_fileReader.close();
-        if (m_bFTDlgShown) {
-          m_pFTDialog->m_pProgress->clearAndInitSingle(0, 0);
-          m_pFTDialog->setStatusText("Upload Completed");
-        }
-        m_TransferQueue.deleteAt(0);
-        m_pFTDialog->postCheckTransferQueueMsg();
-      } else {
-        if (m_bFTDlgShown) m_pFTDialog->m_pProgress->increase(bytesRead);
-        m_pWriter->writeFileUploadData(bytesRead, (char *)buf);
-        m_pFTDialog->postUploadFilePortionMsg();
-      }
-    } else {
-      m_fileReader.close();
-      m_bTransferSuccess = false;
-      char reason[] = "Error While Reading File";
-      m_pWriter->writeFileUploadFailed(strlen(reason), reason);
-      if (m_bFTDlgShown) {
-          m_pFTDialog->m_pProgress->clearAndInitSingle(0, 0);
-          m_pFTDialog->setStatusText("Upload Failed");
-      }
-      m_TransferQueue.deleteAt(0);
-      m_pFTDialog->postCheckTransferQueueMsg();
-    }
-  }
-}
-
-void 
-FileTransfer::createRemoteFolder(char *pPath, char *pName)
-{
-  char fullPath[FT_FILENAME_SIZE];
-  sprintf(fullPath, "%s\\%s", pPath, pName);
-  m_pFTDialog->setStatusText("Creating Remote Folder: %s", fullPath);
-  writeFileCreateDirRqst(strlen(fullPath), fullPath);
-  requestFileList(pPath, FT_FLR_DEST_MAIN, false);
-}
-
-void 
-FileTransfer::renameRemote(char *pPath, char *pOldName, char *pNewName)
-{
-  char fullOldName[FT_FILENAME_SIZE];
-  char fullNewName[FT_FILENAME_SIZE];
-
-  sprintf(fullOldName, "%s\\%s", pPath, pOldName);
-  sprintf(fullNewName, "%s\\%s", pPath, pNewName);
-
-  writeFileRenameRqst(strlen(fullOldName), strlen(fullNewName),
-                      fullOldName, fullNewName);
-  requestFileList(pPath, FT_FLR_DEST_MAIN, false);
-}
-
-bool 
-FileTransfer::procFileListDataMsg()
-{
-  FileInfo fileInfo;
-  int res = m_pReader->readFileListData(&fileInfo);
-
-  bool bResult = false;
-  switch (m_queueFileListRqst.getFlagsAt(0))
-  {
-  case FT_FLR_DEST_MAIN:
-    if (!m_bFTDlgShown) break;
-    
-    if (res < 0) {
-      m_pFTDialog->reqFolderUnavailable();
-      bResult = true;
-    } else {
-      bResult = procFLRMain(&fileInfo);
-    }
-    break;
-  case FT_FLR_DEST_BROWSE:
-    bResult = procFLRBrowse(&fileInfo);
-    break;
-  case FT_FLR_DEST_UPLOAD:
-    bResult = procFLRUpload(&fileInfo);
-    break;
-  case FT_FLR_DEST_DOWNLOAD:
-    bResult = procFLRDownload(&fileInfo);
-    break;
-  case FT_FLR_DEST_DELETE:
-    bResult = procFLRDelete(&fileInfo);
-    break;
-  case FT_FLR_DEST_RENAME:
-    bResult = procFLRRename(&fileInfo);
-    break;
-  }
-  m_queueFileListRqst.deleteAt(0);
-  return bResult;
-}
-
-bool 
-FileTransfer::procFileDownloadDataMsg()
-{
-  unsigned int bufSize = 0;
-  unsigned int modTime = 0;
-
-  void *pFile = m_pReader->readFileDownloadData(&bufSize, &modTime);
-
-  if (checkCancelOperations()) {
-    char reason[] = "The user cancel transfer";
-    m_pWriter->writeFileDownloadCancel(strlen(reason), reason);
-  }
-
-  if ((!m_fileWriter.isCreated()) || (!isTransferEnable())) {
-    m_bTransferSuccess = false;
-    if (pFile != NULL) delete [] pFile;
-    return false;
-  }
-
-  if (bufSize > 0) {
-    unsigned int bytesWritten = 0;
-    m_fileWriter.write(pFile, bufSize, &bytesWritten);
-    delete [] pFile;
-    if (bytesWritten != bufSize) {
-      m_bTransferSuccess = false;
-      char reason[] = "Error File Writting to File";
-      m_pWriter->writeFileDownloadCancel(strlen(reason), reason);
-      if (m_bFTDlgShown) {
-        m_pFTDialog->setStatusText("Download Failed");
-        m_pFTDialog->m_pProgress->clearAndInitSingle(0, 0);
-      }
-      m_TransferQueue.deleteAt(0);
-      m_pFTDialog->postCheckTransferQueueMsg();
-      return false;
-    } else {
-      if (m_bFTDlgShown) {
-        m_pFTDialog->m_pProgress->increase(bufSize);
-      }
-    }
-    return true;
-  } else {
-    if (modTime != 0) {
-      m_fileWriter.setTime(modTime);
-      m_fileWriter.close();
-      if (m_bFTDlgShown) {
-        m_pFTDialog->setStatusText("Download Completed");
-        m_pFTDialog->m_pProgress->clearAndInitSingle(0, 0);
-      }
-      m_TransferQueue.deleteAt(0);
-      m_pFTDialog->postCheckTransferQueueMsg();
-      return true;
-    } else {
-      m_fileWriter.close();
-      m_bTransferSuccess = false;
-      char reason[] = "Error File Writting";
-      if (m_bFTDlgShown) {
-        m_pFTDialog->setStatusText("Download Failed");
-        m_pFTDialog->m_pProgress->clearAndInitSingle(0, 0);
-      }
-      m_pWriter->writeFileDownloadCancel(strlen(reason), reason);
-      m_TransferQueue.deleteAt(0);
-      m_pFTDialog->postCheckTransferQueueMsg();
-    }
-  }
-  return false;
-}
-
-bool 
-FileTransfer::procFileUploadCancelMsg()
-{
-  unsigned int reasonSize = 0;
-  char *pReason = m_pReader->readFileUploadCancel(&reasonSize);
-
-  if (m_bFTDlgShown) {
-    m_pFTDialog->setStatusText("Upload Canceled by Remote Computer : %s", pReason);
-  }
-  endUndoneOperation();
-  m_pFTDialog->postCheckTransferQueueMsg();
-
-  delete [] pReason;
-  return true;
-}
-
-bool 
-FileTransfer::procFileDownloadFailedMsg()
-{
-  unsigned int reasonSize = 0;
-  char *pReason = m_pReader->readFileDownloadFailed(&reasonSize);
-
-  if (m_bFTDlgShown) {
-    m_pFTDialog->setStatusText("Download Failed by Remote Computer : %s", pReason);
-  }
-  endUndoneOperation();
-  m_pFTDialog->postCheckTransferQueueMsg();
-
-  delete [] pReason;
-  return true;
-}
-
-bool 
-FileTransfer::procFileDirSizeDataMsg()
-{
-  DWORD64 dw64DirSize = 0;
-  unsigned short dirSizeLow16 = 0;
-  unsigned int dirSizeHigh32 = 0;
-  m_pReader->readFileDirSizeData(&dirSizeLow16, &dirSizeHigh32);
-
-  dw64DirSize = dirSizeLow16;
-  dw64DirSize = (dw64DirSize << 32) + dirSizeHigh32;
-  
-  m_dw64SizeSending += dw64DirSize;
-  m_TransferQueue.clearFlagAt(m_dirSizeRqstNum, FT_ATTR_RESIZE_NEEDED);
-  checkTransferQueue();
-  return true;
-}
-
-bool 
-FileTransfer::procFileLastRqstFailedMsg()
-{
-  unsigned int reasonSize = 0;
-  int requestType;
-  char *pReason = m_pReader->readFileLastRqstFailed(&requestType, &reasonSize);
-  delete [] pReason;
-  return true;
-}
-
-bool 
-FileTransfer::procFLRMain(FileInfo *pFI)
-{
-  if (m_bFTDlgShown) m_pFTDialog->addRemoteLVItems(pFI);
-  return true;
-}
-
-bool 
-FileTransfer::procFLRBrowse(FileInfo *pFI)
-{
-  m_pFTDialog->addBrowseItems(pFI);
-  return false;
-}
-
-bool 
-FileTransfer::procFLRUpload(FileInfo *pFI)
-{
-  unsigned int flags = m_TransferQueue.getFlagsAt(0);
-  if (flags & FT_ATTR_FLR_UPLOAD_CHECK) {
-    int num = isExistName(pFI, m_TransferQueue.getRemNameAt(0));
-    if (num >= 0) { 
-      if ((m_bFTDlgShown) && (strcmp(m_TransferQueue.getRemPathAt(0), m_pFTDialog->getRemotePath()) == 0)) {
-        m_pFTDialog->addRemoteLVItems(pFI);
-      }
-    } else {
-      if (flags & FT_ATTR_DIR) {
-        m_TransferQueue.deleteAt(0);
-        m_bTransferSuccess = false;
-        if (m_bFTDlgShown) m_pFTDialog->setStatusText("Create Remote Folder Failed.");
-      }
-    }
-  }
-  FolderManager fm;
-  FileInfo fi;
-  flags = m_TransferQueue.getFlagsAt(0);
-  if (flags & FT_ATTR_FILE) {
-    uploadFile();
-    return true;
-  } else {
-    if (fm.getDirInfo(m_TransferQueue.getFullLocPathAt(0), &fi, 0)) {
-      m_TransferQueue.add(m_TransferQueue.getFullLocPathAt(0),
-        m_TransferQueue.getFullRemPathAt(0),
-        &fi, FT_ATTR_COPY_UPLOAD);
-    }
-  }
-  m_TransferQueue.deleteAt(0);
-  m_pFTDialog->postCheckTransferQueueMsg();
-  return true;
-}
-
-bool 
-FileTransfer::procFLRDownload(FileInfo *pFI)
-{
-  unsigned int flags = m_TransferQueue.getFlagsAt(0);
-  
-  if ((flags & FT_ATTR_DIR) && (flags & FT_ATTR_FLR_DOWNLOAD_ADD)) {
-    m_TransferQueue.add(m_TransferQueue.getFullLocPathAt(0), 
-                        m_TransferQueue.getFullRemPathAt(0), 
-                        pFI, FT_ATTR_COPY_DOWNLOAD);
-    m_TransferQueue.deleteAt(0);
-    m_pFTDialog->postCheckTransferQueueMsg();
-    return true;
-  } else {
-    m_bTransferSuccess = false;
-    if (m_bFTDlgShown) m_pFTDialog->setStatusText("File Transfer Operation Failed: Unknown data from server.");
-  }
-  return false;
-}
-
-bool 
-FileTransfer::procFLRDelete(FileInfo *pFI)
-{
-  if (isExistName(pFI, m_DeleteQueue.getLocNameAt(0)) >= 0) {
-    if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Failed.");
-  } else {
-    if (m_bFTDlgShown) m_pFTDialog->setStatusText("Delete Operation Completed.");
-  }
-  m_DeleteQueue.deleteAt(0);
-  checkDeleteQueue();
-  return true;
-}
-
-bool 
-FileTransfer::procFLRRename(FileInfo *pFI)
-{
-  return false;
-}
-
-void 
-FileTransfer::requestFileList(char *pPath, int dest, bool bDirOnly)
-{
-  m_queueFileListRqst.add(pPath, 0, 0, dest);
-
-  writeFileListRqst(strlen(pPath), pPath, bDirOnly);
-}
-
-int
-FileTransfer::isExistName(FileInfo *pFI, char *pName)
-{
-  for (unsigned int i = 0; i < pFI->getNumEntries(); i++) {
-    if (strcmp(pFI->getNameAt(i), pName) == 0) {
-      return i;
-    }
-  }
-  return -1;
-}
-
-bool
-FileTransfer::checkCancelOperations()
-{
-  if (m_bFTDlgShown) m_pFTDialog->processDlgMsgs();
-  if (m_bCancel) {
-    endUndoneOperation();
-    if (m_bFTDlgShown) {
-      m_pFTDialog->setStatusText("All Operations Canceled");
-    }
-    return true;
-  } else {
-    return false;
-  }
-}
-
-void 
-FileTransfer::endUndoneOperation()
-{
-  m_bCancel = false;
-  m_bTransferSuccess = false;
-  m_fileReader.close();
-  m_fileWriter.close();
-  freeQueues();
-  m_dw64SizeSending = 0;
-  m_pFTDialog->m_pProgress->clearAll();
-}
-
-void
-FileTransfer::freeQueues()
-{
-  m_TransferQueue.free();
-  m_DeleteQueue.free();
-  m_queueFileListRqst.free();
-}
-
-int
-FileTransfer::convertToUnixPath(char *path)
-{
-  int len = strlen(path);
-  if (len >= FT_FILENAME_SIZE) return -1;
-  if (len == 0) {strcpy(path, "/"); return 1;}
-  for (int i = (len - 1); i >= 0; i--) {
-    if (path[i] == '\\') path[i] = '/';
-    path[i+1] = path[i];
-  }
-  path[len + 1] = '\0';
-  path[0] = '/';
-  return strlen(path);
-}
-
-bool 
-FileTransfer::writeFileListRqst(unsigned short dirnameLen, char *pDirName, bool bDirOnly)
-{
-  char dirName[FT_FILENAME_SIZE];
-  strcpy(dirName, pDirName);
-  int len = convertToUnixPath(dirName);
-  if (len <= 0) return false;
-
-  return m_pWriter->writeFileListRqst(len, dirName, bDirOnly);
-}
-
-bool 
-FileTransfer::writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, 
-                                    unsigned int position)
-{
-  char filename[FT_FILENAME_SIZE];
-  strcpy(filename, pFilename);
-  unsigned short len = (unsigned short) convertToUnixPath(filename);
-  if (len <= 0) return false;
-
-  return m_pWriter->writeFileDownloadRqst(len, filename, position);
-}
-
-bool 
-FileTransfer::writeFileUploadRqst(unsigned short filenameLen, char *pFilename, 
-                                  unsigned int position)
-{
-  char filename[FT_FILENAME_SIZE];
-  strcpy(filename, pFilename);
-  unsigned short len = (unsigned short) convertToUnixPath(filename);
-  if (len <= 0) return false;
-
-  return m_pWriter->writeFileUploadRqst(len, filename, position);
-}
-
-bool 
-FileTransfer::writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName)
-{
-  char path[FT_FILENAME_SIZE];
-  strcpy(path, pDirName);
-  int nameLen = convertToUnixPath(path);
-
-  return m_pWriter->writeFileCreateDirRqst(nameLen, path);
-}
-
-bool 
-FileTransfer::writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName)
-{
-  char path[FT_FILENAME_SIZE];
-  strcpy(path, pDirName);
-  int nameLen = convertToUnixPath(path);
-
-  return m_pWriter->writeFileDirSizeRqst(nameLen, path);
-}
-
-bool 
-FileTransfer::writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,
-                                  char *pOldName, char *pNewName)
-{
-  char oldName[FT_FILENAME_SIZE];
-  char newName[FT_FILENAME_SIZE];
-
-  strcpy(oldName, pOldName);
-  strcpy(newName, pNewName);
-
-  int _oldNameLen = convertToUnixPath(oldName);
-  int _newNameLen = convertToUnixPath(newName);
-
-  return m_pWriter->writeFileRenameRqst(_oldNameLen, _newNameLen, oldName, newName);
-}
-
-bool 
-FileTransfer::writeFileDeleteRqst(unsigned short nameLen, char *pName)
-{
-  char path[FT_FILENAME_SIZE];
-  strcpy(path, pName);
-  int _nameLen = convertToUnixPath(path);
-
-  return m_pWriter->writeFileDeleteRqst(_nameLen, path);
-}
diff --git a/win/vncviewer/FileTransfer.h b/win/vncviewer/FileTransfer.h
deleted file mode 100644
index 67e3901..0000000
--- a/win/vncviewer/FileTransfer.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
- *
- * Developed by Dennis Syrovatsky
- *    
- * 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.
- *
- * 
- *
- */
-
-// -=- FileTransfer.h
-
-#ifndef __RFB_WIN32_FILETRANSFER_H__
-#define __RFB_WIN32_FILETRANSFER_H__
-
-#include <rdr/InStream.h>
-#include <rdr/OutStream.h>
-#include <rfb/msgTypes.h>
-#include <rfb/FileInfo.h>
-#include <rfb/FileReader.h>
-#include <rfb/FileWriter.h>
-#include <rfb/TransferQueue.h>
-#include <rfb/CFTMsgReader.h>
-#include <rfb/CFTMsgWriter.h>
-#include <vncviewer/FTDialog.h>
-
-namespace rfb {
-  namespace win32 {
-    class FTDialog;
-
-    class FileTransfer
-    {
-    public:
-      FileTransfer();
-      ~FileTransfer();
-
-      bool initialize(rdr::InStream *pIS, rdr::OutStream *pOS);
-      bool processFTMsg(int type);
-      bool show(HWND hwndParent);
-
-      void requestFileList(char *pPath, int dest, bool bDirOnly);
-
-      void addTransferQueue(char *pLocalPath, char *pRemotePath, 
-                            FileInfo *pFI, unsigned int flags);
-      void addDeleteQueue(char *pPathPrefix, FileInfo *pFI, 
-                          unsigned int flags);
-
-      bool isTransferEnable();
-
-      void checkTransferQueue();
-      void checkDeleteQueue();
-      bool checkCancelOperations();
-
-      void uploadFilePortion();
-
-      void createRemoteFolder(char *pPath, char *pName);
-      void renameRemote(char *pPath, char *pOldName, char *pNewName);
-
-      bool m_bCancel;
-
-    private:
-      bool m_bFTDlgShown;
-      bool m_bInitialized;
-      bool m_bResized;
-      bool m_bTransferSuccess;
-      bool m_bOverwriteAll;
-
-      FTDialog *m_pFTDialog;
-
-      rfb::CFTMsgReader *m_pReader;
-      rfb::CFTMsgWriter *m_pWriter;
-
-      FileReader m_fileReader;
-      FileWriter m_fileWriter;
-
-      FileInfo m_queueFileListRqst;
-
-      TransferQueue m_TransferQueue;
-      TransferQueue m_DeleteQueue;
-
-      bool resizeSending();
-      bool uploadFile();
-      bool downloadFile();
-
-      int  isExistName(FileInfo *pFI, char *pName);
-      void freeQueues();
-
-      void endUndoneOperation();
-      
-      bool procFileListDataMsg();
-      bool procFileDownloadDataMsg();
-      bool procFileUploadCancelMsg();
-      bool procFileDownloadFailedMsg();
-      bool procFileDirSizeDataMsg();
-      bool procFileLastRqstFailedMsg();
-      
-      bool procFLRMain(FileInfo *pFI);
-      bool procFLRBrowse(FileInfo *pFI);
-      bool procFLRUpload(FileInfo *pFI);
-      bool procFLRDownload(FileInfo *pFI);
-      bool procFLRDelete(FileInfo *pFI);
-      bool procFLRRename(FileInfo *pFI);
-
-      int convertToUnixPath(char *path);
-
-      bool writeFileListRqst(unsigned short dirnameLen, char *pDirName, bool bDirOnly);
-      bool writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, 
-                                 unsigned int position);
-      bool writeFileUploadRqst(unsigned short filenameLen, char *pFilename, 
-                               unsigned int position);
-      bool writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName);
-      bool writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName);
-      bool writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,
-                               char *pOldName, char *pNewName);
-      bool writeFileDeleteRqst(unsigned short nameLen, char *pName);
-
-      DWORD64 m_dw64SizeSending;
-      unsigned int m_dirSizeRqstNum;
-    };
-  }
-}
-
-#endif // __RFB_WIN32_FILETRANSFER_H__
diff --git a/win/vncviewer/Makefile.am b/win/vncviewer/Makefile.am
index 2e85f13..448729f 100644
--- a/win/vncviewer/Makefile.am
+++ b/win/vncviewer/Makefile.am
@@ -7,11 +7,6 @@
   ConnectingDialog.h \
   ConnectionDialog.h \
   DesktopWindow.h \
-  FileTransfer.h \
-  FTBrowseDlg.h \
-  FTDialog.h \
-  FTListView.h \
-  FTProgress.h \
   InfoDialog.h \
   ListenServer.h \
   ListenTrayIcon.h \
@@ -29,11 +24,6 @@
   ConnectingDialog.cxx \
   ConnectionDialog.cxx \
   DesktopWindow.cxx \
-  FileTransfer.cxx \
-  FTBrowseDlg.cxx \
-  FTDialog.cxx \
-  FTListView.cxx \
-  FTProgress.cxx \
   InfoDialog.cxx \
   OptionsDialog.cxx \
   UserPasswdDialog.cxx \
diff --git a/win/vncviewer/ViewerToolBar.cxx b/win/vncviewer/ViewerToolBar.cxx
index 66a50c3..38e84c4 100644
--- a/win/vncviewer/ViewerToolBar.cxx
+++ b/win/vncviewer/ViewerToolBar.cxx
@@ -44,7 +44,6 @@
   addButton(10, ID_CTRL_KEY);
   addButton(11, ID_ALT_KEY);
   addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
-  addButton(12, ID_FILE_TRANSFER);
   addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
   addButton(13, ID_NEW_CONNECTION);
   addButton(14, ID_CONN_SAVE_AS);
@@ -87,9 +86,6 @@
       case ID_ALT_KEY:
         TTStr->lpszText = "Send Alt key press/release";
         break;
-      case ID_FILE_TRANSFER:
-        TTStr->lpszText = "Transfer files...";
-        break;
       case ID_NEW_CONNECTION:
         TTStr->lpszText = "New connection...";
         break;
diff --git a/win/vncviewer/ftdir.ico b/win/vncviewer/ftdir.ico
deleted file mode 100644
index 7a7f741..0000000
--- a/win/vncviewer/ftdir.ico
+++ /dev/null
Binary files differ
diff --git a/win/vncviewer/ftfile.ico b/win/vncviewer/ftfile.ico
deleted file mode 100644
index a8084b8..0000000
--- a/win/vncviewer/ftfile.ico
+++ /dev/null
Binary files differ
diff --git a/win/vncviewer/ftreload.ico b/win/vncviewer/ftreload.ico
deleted file mode 100644
index 34383e9..0000000
--- a/win/vncviewer/ftreload.ico
+++ /dev/null
Binary files differ
diff --git a/win/vncviewer/ftup.ico b/win/vncviewer/ftup.ico
deleted file mode 100644
index fc215ad..0000000
--- a/win/vncviewer/ftup.ico
+++ /dev/null
Binary files differ
diff --git a/win/vncviewer/resource.h b/win/vncviewer/resource.h
index 5bc4bdc..3f4a921 100644
--- a/win/vncviewer/resource.h
+++ b/win/vncviewer/resource.h
@@ -17,17 +17,7 @@
 #define IDD_CONNECTION_INFO             113
 #define IDD_DEFAULTS                    116
 #define IDB_BITMAP                      120
-#define IDD_FILETRANSFER_DLG            121
 #define IDB_TOOLBAR                     122
-#define IDD_FTCONFIRM_DLG               124
-#define IDI_FTUP                        125
-#define IDI_FTDIR                       126
-#define IDI_FTFILE                      127
-#define IDI_FTRELOAD                    128
-#define IDR_FTMENU                      130
-#define IDD_FTCANCELING                 131
-#define IDD_FTCREATEFOLDER              132
-#define IDD_FTBROWSE                    133
 #define IDC_PASSWORD                    1000
 #define IDC_CONNECTING_TEXT             1001
 #define IDC_SERVER_EDIT                 1002
@@ -82,42 +72,15 @@
 #define IDC_AUTO_RECONNECT              1056
 #define IDC_DISABLE_WINKEYS             1057
 #define IDC_QUALITYLEVEL                1058
-#define IDC_FTLOCALUP                   1058
 #define IDC_SEND_SYSKEYS                1059
-#define IDC_FTLOCALBROWSE               1059
-#define IDC_FTREMOTERELOAD              1060
-#define IDC_FTREMOTEUP                  1061
-#define IDC_FTREMOTEBROWSE              1062
-#define IDC_FTPROGRESS                  1063
-#define IDC_FTGENERALPROGRESS           1063
 #define IDC_PROGRESS                    1064
-#define IDC_FTSINGLEPROGRESS            1064
-#define IDC_FTSTATUS                    1065
-#define IDC_FTCURRENTPROCENT            1066
-#define IDC_FTSINGLEPERCENT             1066
-#define IDC_FTTOTALPROCENT              1067
-#define IDC_FTGENERALPERCENT            1067
-#define IDC_FTUPLOAD                    1072
-#define IDC_FTCANCEL                    1073
-#define IDC_FTDOWNLOAD                  1074
-#define IDC_FTCLOSE                     1075
-#define IDC_FTLOCALLABEL                1076
-#define IDC_FTREMOTELABEL               1077
-#define IDC_FTDIRNAME                   1078
 #define IDC_CONFIRM_YESTOALL            1079
 #define IDC_CONFIRM_TEXT                1080
 #define IDC_EDIT2                       1082
-#define IDC_FTFOLDERNAME                1083
-#define IDC_FTTEXT                      1084
-#define IDC_FTBROWSEPATH                1085
-#define IDC_FTBROWSETREE                1086
 #define IDC_TYPE                        1088
 #define IDC_ENCODING_TIGHT              1089
-#define IDC_FTLOCALPATH                 1090
 #define IDC_CUSTOM_COMPRESSLEVEL        1091
-#define IDC_FTREMOTEPATH                1092
 #define IDC_COMPRESSLEVEL               1093
-#define IDC_FTREMOTELIST                1094
 #define IDC_ALLOW_JPEG                  1095
 #define IDC_FTLOCALRELOAD               1096
 #define IDC_STATIC_SCALE                1097
@@ -137,16 +100,10 @@
 #define ID_SEND_MENU_KEY                40013
 #define ID_SEND_CTLESC                  40014
 #define ID_CONN_SAVE_AS                 40015
-#define ID_FILE_TRANSFER                40016
 #define ID_ZOOM_IN                      40017
 #define ID_ZOOM_OUT                     40018
 #define ID_ACTUAL_SIZE                  40019
 #define ID_AUTO_SIZE                    40020
-#define IDM_FTCOPY                      40022
-#define IDM_FTRENAME                    40023
-#define IDM_FTDELETE                    40024
-#define IDM_FTCANCEL                    40025
-#define IDM_FTCREATEFOLDER              40026
 #define IDM_SHOW_TOOLBAR                40027
 
 // Next default values for new objects
diff --git a/win/vncviewer/vncviewer.dsp b/win/vncviewer/vncviewer.dsp
index e245cd6..044a05a 100644
--- a/win/vncviewer/vncviewer.dsp
+++ b/win/vncviewer/vncviewer.dsp
@@ -158,26 +158,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FileTransfer.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTBrowseDlg.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTDialog.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTListView.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTProgress.cxx
-# End Source File
-# Begin Source File
-
 SOURCE=.\InfoDialog.cxx
 # End Source File
 # Begin Source File
@@ -230,26 +210,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\FileTransfer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTBrowseDlg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTDialog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTListView.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTProgress.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\InfoDialog.h
 # End Source File
 # Begin Source File
diff --git a/win/vncviewer/vncviewer.rc b/win/vncviewer/vncviewer.rc
index 91d0567..7e2f630 100644
--- a/win/vncviewer/vncviewer.rc
+++ b/win/vncviewer/vncviewer.rc
@@ -55,10 +55,6 @@
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
 IDI_ICON                ICON    DISCARDABLE     "vncviewer.ico"
-IDI_FTDIR               ICON    DISCARDABLE     "ftdir.ico"
-IDI_FTFILE              ICON    DISCARDABLE     "ftfile.ico"
-IDI_FTRELOAD            ICON    DISCARDABLE     "ftreload.ico"
-IDI_FTUP                ICON    DISCARDABLE     "ftup.ico"
 
 #ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
@@ -309,99 +305,6 @@
     GROUPBOX        "Defaults",IDC_STATIC,113,7,97,53
 END
 
-IDD_FILETRANSFER_DLG DIALOGEX 0, 0, 530, 282
-STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | 
-    WS_SYSMENU
-EXSTYLE WS_EX_CONTEXTHELP | WS_EX_CONTROLPARENT
-CAPTION "TigerVNC File Transfers"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    CONTROL         "List1",IDC_FTLOCALLIST,"SysListView32",LVS_REPORT | 
-                    LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | 
-                    WS_TABSTOP,7,40,200,196
-    CONTROL         "List2",IDC_FTREMOTELIST,"SysListView32",LVS_REPORT | 
-                    LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | 
-                    WS_TABSTOP,323,40,200,196
-    PUSHBUTTON      "Upload Files and Folders",IDC_FTUPLOAD,218,66,94,12,
-                    WS_DISABLED
-    PUSHBUTTON      "Download Files and Folders",IDC_FTDOWNLOAD,218,85,94,12,
-                    WS_DISABLED
-    PUSHBUTTON      "Cancel File Transfer",IDC_FTCANCEL,218,167,94,12,
-                    WS_DISABLED
-    PUSHBUTTON      "Close",IDC_FTCLOSE,218,217,94,12
-    EDITTEXT        IDC_FTLOCALPATH,7,20,155,12,ES_AUTOHSCROLL | NOT 
-                    WS_TABSTOP
-    CTEXT           "Local Computer",IDC_FTLOCALLABEL,7,7,200,10
-    PUSHBUTTON      "...",IDC_FTLOCALBROWSE,165,20,14,12,NOT WS_TABSTOP
-    PUSHBUTTON      "",IDC_FTLOCALUP,179,20,14,12,BS_ICON | NOT WS_TABSTOP
-    PUSHBUTTON      "",IDC_FTLOCALRELOAD,193,20,14,12,BS_ICON | NOT 
-                    WS_TABSTOP
-    CONTROL         "Progress1",IDC_FTGENERALPROGRESS,"msctls_progress32",
-                    WS_BORDER,55,244,128,10
-    LTEXT           "File Transfer",IDC_STATIC,7,245,40,8
-    COMBOBOX        IDC_FTSTATUS,7,263,516,65,CBS_DROPDOWNLIST | 
-                    CBS_NOINTEGRALHEIGHT | WS_VSCROLL
-    CONTROL         "Progress1",IDC_FTSINGLEPROGRESS,"msctls_progress32",
-                    WS_BORDER,370,244,128,10
-    EDITTEXT        IDC_FTREMOTEPATH,323,20,155,12,ES_AUTOHSCROLL | NOT 
-                    WS_TABSTOP
-    PUSHBUTTON      "...",IDC_FTREMOTEBROWSE,481,20,14,12,NOT WS_TABSTOP
-    PUSHBUTTON      "",IDC_FTREMOTEUP,495,20,14,12,BS_ICON | NOT WS_TABSTOP
-    PUSHBUTTON      "",IDC_FTREMOTERELOAD,509,20,14,12,BS_ICON | NOT 
-                    WS_TABSTOP
-    CTEXT           "TigerVNC Server",IDC_FTREMOTELABEL,323,7,200,10
-    LTEXT           "Current File",IDC_STATIC,323,245,36,8
-    CTEXT           "0%",IDC_FTGENERALPERCENT,189,245,18,8
-    CTEXT           "0%",IDC_FTSINGLEPERCENT,505,245,18,8
-END
-
-IDD_FTBROWSE DIALOGEX 0, 0, 183, 196
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Browse Folders"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,38,175,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,95,175,50,14
-    EDITTEXT        IDC_FTBROWSEPATH,7,7,169,12,ES_AUTOHSCROLL | ES_READONLY | 
-                    NOT WS_TABSTOP
-    CONTROL         "Tree1",IDC_FTBROWSETREE,"SysTreeView32",TVS_HASBUTTONS | 
-                    TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | 
-                    TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,25,169,143
-END
-
-IDD_FTCANCELING DIALOG DISCARDABLE  0, 0, 193, 63
-STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Canceling Active File Transfer"
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "Yes",IDOK,40,42,50,14
-    PUSHBUTTON      "No",IDCANCEL,102,42,50,14
-    LTEXT           "FileTransfer is active.\nAre you sure you want to cancel transfer?",
-                    IDC_STATIC,42,14,133,19
-END
-
-IDD_FTCONFIRM_DLG DIALOG DISCARDABLE  0, 0, 188, 143
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-FONT 8, "MS Sans Serif"
-BEGIN
-    DEFPUSHBUTTON   "Yes",IDOK,69,122,50,14,WS_GROUP
-    PUSHBUTTON      "No",IDCANCEL,131,122,50,14
-    PUSHBUTTON      "Yes to All",IDC_CONFIRM_YESTOALL,7,122,50,14
-    LTEXT           "Static",IDC_CONFIRM_TEXT,7,7,174,107
-END
-
-IDD_FTCREATEFOLDER DIALOG DISCARDABLE  0, 0, 193, 63
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Create a New Folder"
-FONT 8, "MS Sans Serif"
-BEGIN
-    EDITTEXT        IDC_FTFOLDERNAME,7,19,179,14,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "OK",IDOK,80,42,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,136,42,50,14
-    LTEXT           "New folder name:",IDC_FTTEXT,7,7,179,8
-END
-
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -579,54 +482,6 @@
         HORZGUIDE, 60
         HORZGUIDE, 75
     END
-
-    IDD_FILETRANSFER_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 523
-        VERTGUIDE, 207
-        VERTGUIDE, 265
-        VERTGUIDE, 323
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 275
-        HORZGUIDE, 12
-        HORZGUIDE, 26
-        HORZGUIDE, 40
-        HORZGUIDE, 47
-        HORZGUIDE, 249
-    END
-
-    IDD_FTBROWSE, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 176
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 189
-    END
-
-    IDD_FTCANCELING, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 186
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 56
-    END
-
-    IDD_FTCONFIRM_DLG, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 181
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 136
-    END
-
-    IDD_FTCREATEFOLDER, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 186
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 56
-    END
 END
 #endif    // APSTUDIO_INVOKED
 
@@ -669,20 +524,6 @@
     END
 END
 
-IDR_FTMENU MENU DISCARDABLE 
-BEGIN
-    POPUP "File Transfer"
-    BEGIN
-        MENUITEM "Copy Files and Folders",      IDM_FTCOPY
-        MENUITEM SEPARATOR
-        MENUITEM "Create a Folder",             IDM_FTCREATEFOLDER
-        MENUITEM "Rename File or Folder",       IDM_FTRENAME
-        MENUITEM "Delete Files and Folders",    IDM_FTDELETE
-        MENUITEM SEPARATOR
-        MENUITEM "Cancel File Transfer",        IDM_FTCANCEL
-    END
-END
-
 
 /////////////////////////////////////////////////////////////////////////////
 //
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index 6412aae..9e8fa88 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -27,7 +27,6 @@
 #include <rfb/SSecurityFactoryStandard.h>
 #include <rfb/Hostname.h>
 #include <rfb/LogWriter.h>
-#include <rfb_win32/SFileTransferWin32.h>
 
 using namespace rfb;
 using namespace win32;
@@ -39,9 +38,6 @@
 
 const TCHAR* winvnc::VNCServerWin32::RegConfigPath = _T("Software\\TigerVNC\\WinVNC4");
 
-// FIXME: Move into an .h file?
-extern const UINT VNCM_FT_DOWNLOAD;
-
 
 static IntParameter http_port("HTTPPortNumber",
   "TCP/IP port on which the server will serve the Java applet VNC Viewer ", 5800);
@@ -75,8 +71,6 @@
 
   // Register the queued command event to be handled
   sockMgr.addEvent(commandEvent, this);
-
-  vncServer.setFTManager((rfb::SFileTransferManager *)&m_FTManager);
 }
 
 VNCServerWin32::~VNCServerWin32() {
@@ -183,8 +177,6 @@
         throw rdr::SystemException("getMessage", GetLastError());
       if (!isServiceProcess() && (result == 0))
         break;
-      if (msg.message == VNCM_FT_DOWNLOAD)
-        m_FTManager.processDownloadMsg(msg);
       TranslateMessage(&msg);
       DispatchMessage(&msg);
     }
diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h
index 579a6a0..f05f2c7 100644
--- a/win/winvnc/VNCServerWin32.h
+++ b/win/winvnc/VNCServerWin32.h
@@ -26,7 +26,6 @@
 #include <rfb_win32/SDisplay.h>
 #include <rfb_win32/SocketManager.h>
 #include <rfb_win32/TCharArray.h>
-#include <rfb_win32/SFileTransferManagerWin32.h>
 #include <winvnc/QueryConnectDialog.h>
 #include <winvnc/JavaViewer.h>
 #include <winvnc/ManagedListener.h>
@@ -122,7 +121,6 @@
     //rfb::SSecurityFactoryStandard securityFactory;
 
     QueryConnectDialog* queryConnectDialog;
-    rfb::win32::SFileTransferManagerWin32 m_FTManager;
   };
 
 };
