The CFTMsgReader and the CFTMsgWriter classes was moved to rfb workspace.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@531 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/CFTMsgReader.cxx b/rfb/CFTMsgReader.cxx
new file mode 100644
index 0000000..66adbf5
--- /dev/null
+++ b/rfb/CFTMsgReader.cxx
@@ -0,0 +1,162 @@
+/* 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.

+ *

+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/

+ *

+ */

+

+// -=- 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/rfb/CFTMsgReader.h b/rfb/CFTMsgReader.h
new file mode 100644
index 0000000..b0e2c7a
--- /dev/null
+++ b/rfb/CFTMsgReader.h
@@ -0,0 +1,56 @@
+/* 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.

+ *

+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/

+ *

+ */

+

+// -=- 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/rfb/CFTMsgWriter.cxx b/rfb/CFTMsgWriter.cxx
new file mode 100644
index 0000000..278cf80
--- /dev/null
+++ b/rfb/CFTMsgWriter.cxx
@@ -0,0 +1,182 @@
+/* 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.

+ *

+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/

+ *

+ */

+

+// -=- 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/rfb/CFTMsgWriter.h b/rfb/CFTMsgWriter.h
new file mode 100644
index 0000000..c49c2aa
--- /dev/null
+++ b/rfb/CFTMsgWriter.h
@@ -0,0 +1,67 @@
+/* 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.

+ *

+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/

+ *

+ */

+

+// -=- 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/rfb/DirManager.h b/rfb/DirManager.h
index d59ffde..c820f64 100644
--- a/rfb/DirManager.h
+++ b/rfb/DirManager.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileInfo.cxx b/rfb/FileInfo.cxx
index 34074f7..e97e0ad 100644
--- a/rfb/FileInfo.cxx
+++ b/rfb/FileInfo.cxx
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileInfo.h b/rfb/FileInfo.h
index 4dccc95..270eeee 100644
--- a/rfb/FileInfo.h
+++ b/rfb/FileInfo.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileManager.cxx b/rfb/FileManager.cxx
index c0403a7..be1d2a8 100644
--- a/rfb/FileManager.cxx
+++ b/rfb/FileManager.cxx
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileManager.h b/rfb/FileManager.h
index a673f4d..f4e8596 100644
--- a/rfb/FileManager.h
+++ b/rfb/FileManager.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileReader.cxx b/rfb/FileReader.cxx
index 063b742..a8cd272 100644
--- a/rfb/FileReader.cxx
+++ b/rfb/FileReader.cxx
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileReader.h b/rfb/FileReader.h
index 12cdfa1..0c985d8 100644
--- a/rfb/FileReader.h
+++ b/rfb/FileReader.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileWriter.cxx b/rfb/FileWriter.cxx
index 9c06c37..2bed576 100644
--- a/rfb/FileWriter.cxx
+++ b/rfb/FileWriter.cxx
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/FileWriter.h b/rfb/FileWriter.h
index e522ae1..73094a7 100644
--- a/rfb/FileWriter.h
+++ b/rfb/FileWriter.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/SFTMsgReader.cxx b/rfb/SFTMsgReader.cxx
index 3d9aeb2..2a5d283 100644
--- a/rfb/SFTMsgReader.cxx
+++ b/rfb/SFTMsgReader.cxx
@@ -106,10 +106,40 @@
   return readU8U16StringMsg(pNameSize, pName);
 }
     
-bool readFileRenameRqst(unsigned int *pOldNameSize, unsigned int *pNewNameSize,
-                        char *pOldName, char *pNewName)
+bool 
+SFTMsgReader::readFileRenameRqst(unsigned int *pOldNameSize, 
+                                 unsigned int *pNewNameSize,
+                                 char *pOldName, char *pNewName)
 {
-  return false;
+  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
diff --git a/rfb/SFTMsgWriter.cxx b/rfb/SFTMsgWriter.cxx
index 4edfc46..dfd0ad5 100644
--- a/rfb/SFTMsgWriter.cxx
+++ b/rfb/SFTMsgWriter.cxx
@@ -60,9 +60,13 @@
       unsigned int len = strlen(pName);
 
       memcpy((void *)&pFilenames[pos], pName, len + 1);
-      pos += len + 2;
+      pos += (len + 1);
 
-      m_pOS->writeU32(pFileInfo->getSizeAt(i));
+      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));
     }
 
diff --git a/rfb/TransferQueue.cxx b/rfb/TransferQueue.cxx
index 58b9273..0180752 100644
--- a/rfb/TransferQueue.cxx
+++ b/rfb/TransferQueue.cxx
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/TransferQueue.h b/rfb/TransferQueue.h
index 02a043d..ba748e0 100644
--- a/rfb/TransferQueue.h
+++ b/rfb/TransferQueue.h
@@ -1,4 +1,6 @@
 /* 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
diff --git a/rfb/fttypes.h b/rfb/fttypes.h
index 1e9f601..9cfbb29 100644
--- a/rfb/fttypes.h
+++ b/rfb/fttypes.h
@@ -32,6 +32,8 @@
 
 #define FT_MAX_SENDING_SIZE 8192
 
+#define FT_NET_ATTR_DIR ((unsigned int)-1)
+
 #define FT_ATTR_UNKNOWN			    0x00000000
 #define FT_ATTR_FILE			    0x00000001
 #define FT_ATTR_DIR 			    0x00000002
diff --git a/rfb/rfb.dsp b/rfb/rfb.dsp
index 4e18c7b..bac1e00 100644
--- a/rfb/rfb.dsp
+++ b/rfb/rfb.dsp
@@ -118,6 +118,14 @@
 # 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

@@ -364,6 +372,14 @@
 # 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