]> source.dussan.org Git - tigervnc.git/commitdiff
The CFTMsgReader and the CFTMsgWriter classes was moved to rfb workspace.
authorDennis Syrovatsky <dennis@tightvnc.com>
Mon, 17 Apr 2006 08:56:48 +0000 (08:56 +0000)
committerDennis Syrovatsky <dennis@tightvnc.com>
Mon, 17 Apr 2006 08:56:48 +0000 (08:56 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@531 3789f03b-4d11-0410-bbf8-ca57d06f2519

31 files changed:
rfb/CFTMsgReader.cxx [new file with mode: 0644]
rfb/CFTMsgReader.h [new file with mode: 0644]
rfb/CFTMsgWriter.cxx [new file with mode: 0644]
rfb/CFTMsgWriter.h [new file with mode: 0644]
rfb/DirManager.h
rfb/FileInfo.cxx
rfb/FileInfo.h
rfb/FileManager.cxx
rfb/FileManager.h
rfb/FileReader.cxx
rfb/FileReader.h
rfb/FileWriter.cxx
rfb/FileWriter.h
rfb/SFTMsgReader.cxx
rfb/SFTMsgWriter.cxx
rfb/TransferQueue.cxx
rfb/TransferQueue.h
rfb/fttypes.h
rfb/rfb.dsp
rfb_win32/FolderManager.cxx
rfb_win32/FolderManager.h
vncviewer/FTBrowseDlg.cxx
vncviewer/FTBrowseDlg.h
vncviewer/FTDialog.cxx
vncviewer/FTDialog.h
vncviewer/FTListView.cxx
vncviewer/FTProgress.cxx
vncviewer/FTProgress.h
vncviewer/FileTransfer.cxx
vncviewer/FileTransfer.h
vncviewer/vncviewer.dsp

diff --git a/rfb/CFTMsgReader.cxx b/rfb/CFTMsgReader.cxx
new file mode 100644 (file)
index 0000000..66adbf5
--- /dev/null
@@ -0,0 +1,162 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.\r
+ *\r
+ * Developed by Dennis Syrovatsky.\r
+ *    \r
+ * This is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * This software is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this software; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,\r
+ * USA.\r
+ *\r
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/\r
+ *\r
+ */\r
+\r
+// -=- CFTMsgReader.cxx\r
+\r
+#include <rfb/CFTMsgReader.h>\r
+\r
+using namespace rfb;\r
+\r
+CFTMsgReader::CFTMsgReader(rdr::InStream *pIS)\r
+{\r
+  m_pInStream = pIS;\r
+}\r
+\r
+CFTMsgReader::~CFTMsgReader()\r
+{\r
+\r
+}\r
+\r
+int \r
+CFTMsgReader::readFileListData(FileInfo *pFileInfo)\r
+{\r
+  unsigned char flags = m_pInStream->readU8();\r
+  int numFiles = m_pInStream->readU16();\r
+  int dataSize = m_pInStream->readU16();\r
+  int compressedSize = m_pInStream->readU16();\r
+  \r
+  if (flags & 0x80) {\r
+    return -1;\r
+  } else {\r
+    if (numFiles > 0) {\r
+      char *pFilenames = new char[compressedSize];\r
+      SIZEDATAINFO *pSDI = new SIZEDATAINFO[numFiles];\r
+      for (int i = 0; i < numFiles; i++) {\r
+        pSDI[i].size = m_pInStream->readU32();\r
+        pSDI[i].data = m_pInStream->readU32();\r
+      }\r
+      m_pInStream->readBytes((void *)pFilenames, compressedSize);\r
+      createFileInfo(numFiles, pFileInfo, pSDI, pFilenames);\r
+      delete [] pSDI;\r
+      delete [] pFilenames;\r
+    }\r
+  }\r
+  return numFiles;\r
+}\r
+\r
+void * \r
+CFTMsgReader::readFileDownloadData(unsigned int *pSize, unsigned int *pModTime)\r
+{\r
+  unsigned char compressLevel = m_pInStream->readU8();\r
+  int realSize = m_pInStream->readU16();\r
+  int compressedSize = m_pInStream->readU16();\r
+\r
+  if ((realSize == 0) && (compressedSize == 0)) {\r
+    *pSize = 0;\r
+    *pModTime = m_pInStream->readU32();\r
+    return NULL;\r
+  } else {\r
+    char *pFile = new char [compressedSize];\r
+    if (pFile == NULL) {\r
+      m_pInStream->skip(compressedSize);\r
+      *pModTime = 0;\r
+      return NULL;\r
+    } else {\r
+      m_pInStream->readBytes(pFile, compressedSize);\r
+      *pSize = compressedSize;\r
+      return pFile;\r
+    }\r
+  }\r
+}\r
+\r
+char * \r
+CFTMsgReader::readFileUploadCancel(unsigned int *pReasonSize)\r
+{\r
+  m_pInStream->skip(1);\r
+  return readReasonMsg(pReasonSize);\r
+}\r
+\r
+char * \r
+CFTMsgReader::readFileDownloadFailed(unsigned int *pReasonSize)\r
+{\r
+  m_pInStream->skip(1);\r
+  return readReasonMsg(pReasonSize);\r
+}\r
+\r
+int \r
+CFTMsgReader::readFileDirSizeData(unsigned short *pDirSizeLow16, \r
+                                 unsigned int *pDirSizeHigh32)\r
+{\r
+  m_pInStream->skip(1);\r
+  *pDirSizeLow16 = m_pInStream->readU16();\r
+  *pDirSizeHigh32 = m_pInStream->readU32();\r
+  return 1;\r
+}\r
+\r
+char * \r
+CFTMsgReader::readFileLastRqstFailed(int *pTypeOfRequest, unsigned int *pReasonSize)\r
+{\r
+  *pTypeOfRequest = m_pInStream->readU8();\r
+  return readReasonMsg(pReasonSize);\r
+}\r
+\r
+bool \r
+CFTMsgReader::createFileInfo(unsigned int numFiles, FileInfo *fi, \r
+                             SIZEDATAINFO *pSDInfo, char *pFilenames)\r
+{\r
+  int pos = 0;\r
+  int size = 0;\r
+  for (unsigned int i = 0; i < numFiles; i++) {\r
+    size = pSDInfo[i].size;\r
+    if (size == FT_NET_ATTR_DIR) {\r
+      fi->add((pFilenames + pos), size, pSDInfo[i].data, FT_ATTR_DIR);\r
+    } else {\r
+      fi->add((pFilenames + pos), size, pSDInfo[i].data, FT_ATTR_FILE);\r
+    }\r
+    pos += strlen(pFilenames + pos) + 1;\r
+  }\r
+  return true;\r
+}\r
+\r
+char * \r
+CFTMsgReader::readReasonMsg(unsigned int *pReasonSize)\r
+{\r
+  int reasonLen = m_pInStream->readU16();\r
+  int _reasonLen = reasonLen + 1;\r
+  char *pReason;\r
+  if (reasonLen == 0) {\r
+    *pReasonSize = 0;\r
+    return NULL;\r
+  } else {\r
+    pReason = new char [_reasonLen];\r
+    if (pReason == NULL) {\r
+      m_pInStream->skip(reasonLen);\r
+      *pReasonSize = 0;\r
+      return NULL;\r
+    }\r
+    m_pInStream->readBytes(pReason, reasonLen);\r
+    memset(((char *)pReason+reasonLen), '\0', 1);\r
+    return pReason;\r
+  }\r
+}\r
+\r
diff --git a/rfb/CFTMsgReader.h b/rfb/CFTMsgReader.h
new file mode 100644 (file)
index 0000000..b0e2c7a
--- /dev/null
@@ -0,0 +1,56 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.\r
+ *\r
+ * Developed by Dennis Syrovatsky.\r
+ *    \r
+ * This is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * This software is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this software; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,\r
+ * USA.\r
+ *\r
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/\r
+ *\r
+ */\r
+\r
+// -=- CFTMsgReader.h\r
+\r
+#ifndef __RFB_CFTMSGREADER_H__\r
+#define __RFB_CFTMSGREADER_H__\r
+\r
+#include <rdr/InStream.h>\r
+#include <rfb/FileInfo.h>\r
+\r
+namespace rfb {\r
+  class CFTMsgReader\r
+  {\r
+  public:\r
+    CFTMsgReader(rdr::InStream *pIS);\r
+    ~CFTMsgReader();\r
+    \r
+    int readFileListData(FileInfo *pFileInfo);\r
+    int readFileDirSizeData(unsigned short *pDirSizeLow16, unsigned int *pDirSizeHigh32);\r
+    \r
+    char *readFileUploadCancel(unsigned int *pReasonSize);\r
+    char *readFileDownloadFailed(unsigned int *pReasonSize);\r
+    char *readFileLastRqstFailed(int *pTypeOfRequest, unsigned int *pReasonSize);\r
+    void *readFileDownloadData(unsigned int *pSize, unsigned int *pModTime);\r
+    \r
+  private:\r
+    rdr::InStream *m_pInStream;\r
+    \r
+    bool createFileInfo(unsigned int numFiles, FileInfo *fi, \r
+                        SIZEDATAINFO *pSDInfo, char *pFilenames);\r
+    char *readReasonMsg(unsigned int *pReasonSize);\r
+  };\r
+}\r
+\r
+#endif // __RFB_CFTMSGREADER_H__\r
diff --git a/rfb/CFTMsgWriter.cxx b/rfb/CFTMsgWriter.cxx
new file mode 100644 (file)
index 0000000..278cf80
--- /dev/null
@@ -0,0 +1,182 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.\r
+ *\r
+ * Developed by Dennis Syrovatsky.\r
+ *    \r
+ * This is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * This software is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this software; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,\r
+ * USA.\r
+ *\r
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/\r
+ *\r
+ */\r
+\r
+// -=- CFTMsgWriter.cxx\r
+\r
+#include <rfb/CFTMsgWriter.h>\r
+\r
+using namespace rfb;\r
+\r
+CFTMsgWriter::CFTMsgWriter(rdr::OutStream *pOS)\r
+{\r
+  m_pOutStream = pOS;\r
+}\r
+\r
+CFTMsgWriter::~CFTMsgWriter()\r
+{\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileListRqst(unsigned short dirnameLen, char *pDirName, \r
+                                bool bDirOnly)\r
+{\r
+  if (dirnameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  unsigned char flags = 0;\r
+  if (bDirOnly) flags = 0x10;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileListRequest);\r
+  m_pOutStream->writeU8(flags);\r
+  m_pOutStream->writeU16(dirnameLen);\r
+  m_pOutStream->writeBytes((void *)pDirName, dirnameLen);\r
+  m_pOutStream->flush();\r
+\r
+  return true;\r
+}\r
+\r
+\r
+bool \r
+CFTMsgWriter::writeFileDownloadCancel(unsigned short reasonLen, char *pReason)\r
+{\r
+  m_pOutStream->writeU8(msgTypeFileDownloadCancel);\r
+  return writeU8U16StringMsg(reasonLen, pReason);\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, \r
+                                    unsigned int position)\r
+{\r
+  if (filenameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileDownloadRequest);\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(filenameLen);\r
+  m_pOutStream->writeU32(position);\r
+  m_pOutStream->writeBytes(pFilename, filenameLen);\r
+  m_pOutStream->flush();\r
+\r
+  return true;\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileUploadData(unsigned short dataSize, char *pData)\r
+{\r
+  m_pOutStream->writeU8(msgTypeFileUploadData);\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(dataSize);\r
+  m_pOutStream->writeU16(dataSize);\r
+  m_pOutStream->writeBytes(pData, dataSize);\r
+  m_pOutStream->flush();\r
+\r
+  return true;\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileUploadData(unsigned int modTime)\r
+{\r
+  m_pOutStream->writeU8(msgTypeFileUploadData);\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(0);\r
+  m_pOutStream->writeU16(0);\r
+  m_pOutStream->writeU32(modTime);\r
+  m_pOutStream->flush();\r
+\r
+  return true;\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileUploadFailed(unsigned short reasonLen, char *pReason)\r
+{\r
+  m_pOutStream->writeU8(msgTypeFileUploadFailed);\r
+  return writeU8U16StringMsg(reasonLen, pReason);\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileUploadRqst(unsigned short filenameLen, char *pFilename, \r
+                                  unsigned int position)\r
+{\r
+  if (filenameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileUploadRequest);\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(filenameLen);\r
+  m_pOutStream->writeU32(position);\r
+  m_pOutStream->writeBytes((void *)pFilename, filenameLen);\r
+  m_pOutStream->flush();\r
+\r
+  return true;\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName)\r
+{\r
+  if (dirNameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileCreateDirRequest);\r
+  return writeU8U16StringMsg(dirNameLen, pDirName);\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName)\r
+{\r
+  if (dirNameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileDirSizeRequest);\r
+  return writeU8U16StringMsg(dirNameLen, pDirName);\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,\r
+                                  char *pOldName, char *pNewName)\r
+{\r
+  if ((oldNameLen >= FT_FILENAME_SIZE) || (newNameLen >= FT_FILENAME_SIZE)) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileRenameRequest);\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(oldNameLen);\r
+  m_pOutStream->writeU16(newNameLen);\r
+  m_pOutStream->writeBytes(pOldName, oldNameLen);\r
+  m_pOutStream->writeBytes(pNewName, newNameLen);\r
+  m_pOutStream->flush();\r
+  \r
+  return true;\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeFileDeleteRqst(unsigned short nameLen, char *pName)\r
+{\r
+  if (nameLen >= FT_FILENAME_SIZE) return false;\r
+\r
+  m_pOutStream->writeU8(msgTypeFileDeleteRequest);\r
+  return writeU8U16StringMsg(nameLen, pName);\r
+}\r
+\r
+bool \r
+CFTMsgWriter::writeU8U16StringMsg(unsigned short strLength, char *pString)\r
+{\r
+  m_pOutStream->writeU8(0);\r
+  m_pOutStream->writeU16(strLength);\r
+  m_pOutStream->writeBytes(pString, strLength);\r
+  m_pOutStream->flush();\r
+  return true;\r
+}\r
diff --git a/rfb/CFTMsgWriter.h b/rfb/CFTMsgWriter.h
new file mode 100644 (file)
index 0000000..c49c2aa
--- /dev/null
@@ -0,0 +1,67 @@
+/* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.\r
+ *\r
+ * Developed by Dennis Syrovatsky.\r
+ *    \r
+ * This is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * This software is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this software; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,\r
+ * USA.\r
+ *\r
+ * TightVNC distribution homepage on the Web: http://www.tightvnc.com/\r
+ *\r
+ */\r
+\r
+// -=- CFTMsgWriter.h\r
+\r
+#ifndef __RFB_CFTMSGWRITER_H__\r
+#define __RFB_CFTMSGWRITER_H__\r
+\r
+#include <rdr/types.h>\r
+#include <rdr/OutStream.h>\r
+#include <rfb/msgTypes.h>\r
+#include <rfb/fttypes.h>\r
+\r
+namespace rfb {\r
+  class CFTMsgWriter\r
+  {\r
+  public:\r
+    CFTMsgWriter(rdr::OutStream *pOS);\r
+    ~CFTMsgWriter();\r
+    \r
+    bool writeFileListRqst(unsigned short dirnameLen, char *pDirName, bool bDirOnly);\r
+    \r
+    bool writeFileDownloadCancel(unsigned short reasonLen, char *pReason);\r
+    bool writeFileDownloadRqst(unsigned short filenameLen, char *pFilename, \r
+                               unsigned int position);\r
+    \r
+    bool writeFileUploadData(unsigned short dataSize, char *pData);\r
+    bool writeFileUploadData(unsigned int modTime);\r
+    bool writeFileUploadFailed(unsigned short reasonLen, char *pReason);\r
+    bool writeFileUploadRqst(unsigned short filenameLen, char *pFilename, \r
+                             unsigned int position);\r
+    \r
+    bool writeFileCreateDirRqst(unsigned short dirNameLen, char *pDirName);\r
+    bool writeFileDirSizeRqst(unsigned short dirNameLen, char *pDirName);\r
+    \r
+    bool writeFileRenameRqst(unsigned short oldNameLen, unsigned short newNameLen,\r
+                             char *pOldName, char *pNewName);\r
+    bool writeFileDeleteRqst(unsigned short nameLen, char *pName);\r
+    \r
+  private:\r
+    rdr::OutStream *m_pOutStream;\r
+    \r
+    bool writeU8U16StringMsg(unsigned short strLength, char *pString);\r
+  };\r
+}\r
+\r
+#endif // __RFB_CFTMSGWRITER_H__\r
index d59ffde526dd10b74997bb15773c002565683092..c820f64899288ff50aff9345af98c9061025db57 100644 (file)
@@ -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
index 34074f7dac0c31d44ee183fdc3c4f1e76a8d0a22..e97e0adbe4bb4070c9ac3b9f65bfe5f84ea745b9 100644 (file)
@@ -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
index 4dccc955efb80e0db440e6608e272b8bca38cf83..270eeee93c5a0e7a31dbc644c288c6a506d28441 100644 (file)
@@ -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
index c0403a7826709e5ca4172ad35de268719f604c80..be1d2a81028253c4129f4e0b57a48f85276ba677 100644 (file)
@@ -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
index a673f4d7624e65016b6337ec73805eee1e995802..f4e8596e296552bfdc4889dd6494e9ee1bea231e 100644 (file)
@@ -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
index 063b742e3d5e076458f8851ca27fea4aafee4eab..a8cd2724225cd5815d4d62eada26fb63d8e004c1 100644 (file)
@@ -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
index 12cdfa12dc7b63ca518f6ad6b7d82230e0ff8131..0c985d824fbdff41e195ee9a7ce0a331b0e8b3c8 100644 (file)
@@ -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
index 9c06c378d7db70be62891dbee68d7e187d52b305..2bed5765ea82a422b6346690b7735a75b2d3bc4c 100644 (file)
@@ -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
index e522ae1318843de8fd255c1039b06b1a020dd042..73094a7eefa2afa5246f771461f961774111bf80 100644 (file)
@@ -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
index 3d9aeb2ba1715dc4b418175f23ae9a94d4ff9863..2a5d283e8e6eaecd8c372104832d72a1843514d1 100644 (file)
@@ -106,10 +106,40 @@ SFTMsgReader::readFileDeleteRqst(unsigned int *pNameSize, char *pName)
   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
index 4edfc46792c6c3a3e2df0d0274fd5e9aac151e8a..dfd0ad5949a78204345507631e1441e52a1ff98c 100644 (file)
@@ -60,9 +60,13 @@ SFTMsgWriter::writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo)
       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));
     }
 
index 58b92734940f4e0a7ef3dc2c96380cd8c24fbe7e..01807524835445f6955e9961a2438555c5ebaf1f 100644 (file)
@@ -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
index 02a043df4aa8b0baa50d14f488d6edec6c24fe89..ba748e0e68a3c19cf394a2bf1c60f32bd2af090b 100644 (file)
@@ -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
index 1e9f601af2ebdcd3fd6043037f1dfa6784111254..9cfbb29da45115ff05366370121aaa26f9643b75 100644 (file)
@@ -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
index 4e18c7bccd6d533a7937a5deefe9d4abc10c8f02..bac1e00650456df8f33f6c9d58af3d637ecb2d7d 100644 (file)
@@ -118,6 +118,14 @@ SOURCE=.\CConnection.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\CFTMsgReader.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\CFTMsgWriter.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\CMsgHandler.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -364,6 +372,14 @@ SOURCE=.\CConnection.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\CFTMsgReader.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\CFTMsgWriter.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\CMsgHandler.h\r
 # End Source File\r
 # Begin Source File\r
index e5544a46498c2b63a3d40b33ff0f95e3532e127b..a2fa08d3e74a50459959dd3bff66f5ebd6853822 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
  * 
- * Developed by Dennis Syrovatsky
+ * 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
index 97a6538db6e9f6f26501eeddf63489a1e1b84a73..24923dd6e40768e5e6d7239798e2ea392db03a5b 100644 (file)
@@ -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
index 7c88ff6a90327623217033bd8dfda4c013ff7783..1b6dfb67ae3eceba3a61df10c0033dcb3654406d 100644 (file)
@@ -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
@@ -68,9 +70,7 @@ FTBrowseDlg::addItems(FileInfo *pFI)
   TVITEM tvi;
   TVINSERTSTRUCT tvins;
 
-  while (TreeView_GetChild(m_hwndTree, m_hParentItem) != NULL) {
-    TreeView_DeleteItem(m_hwndTree, TreeView_GetChild(m_hwndTree, m_hParentItem));
-  }
+  if (pFI->getNumEntries() <= 0) return;
 
   for (unsigned int i = 0; i < pFI->getNumEntries(); i++)
   {
@@ -132,6 +132,14 @@ FTBrowseDlg::getPath()
   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)
 {
@@ -166,11 +174,13 @@ FTBrowseDlg::FTBrowseDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
       case TVN_SELCHANGED:
         SetDlgItemText(hwnd, IDC_FTBROWSEPATH, _this->getTVPath(((NMTREEVIEW *) lParam)->itemNew.hItem));
         return FALSE;
-      case TVN_ITEMEXPANDING:
+//      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));
           }
         }
index 1a5e66362063f4e0e0b2209ce4b3f9e317cd385d..5c9ba35770adf2820949c9e7ab9322bbd9a3b404 100644 (file)
@@ -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
@@ -49,6 +51,8 @@ namespace rfb {
       void addItems(FileInfo *pFI);
       char *getPath();
 
+      void deleteChildItems();
+
     private:
       HWND m_hwndDlg;
       HWND m_hwndTree;
index b4c669d3b44fa2fc4c20f4e6820e3f6170392887..409d3b17ff372fa805e4c012c7dddcc7d7e77714 100644 (file)
@@ -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
@@ -376,7 +378,6 @@ FTDialog::onEndBrowseDlg(bool bResult)
       showRemoteLVItems();
     }
   }
-
   delete m_pBrowseDlg;
   m_pBrowseDlg = NULL;
 }
@@ -514,6 +515,8 @@ FTDialog::onUpload()
     
     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;
@@ -549,6 +552,8 @@ FTDialog::onDownload()
     
     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;
index 36cb669f6884cccc7e30cadec622a90a5508f025..a4b55461220bbdad49e8793275e23050d950cd31 100644 (file)
@@ -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
index ab43cbd56a184d760631b91bffc76a79cca3385a..8f41abf6a7dde1ff2cfc55f7761b28b76b01679d 100644 (file)
@@ -1,23 +1,25 @@
 /* Copyright (C) 2005 TightVNC Team.  All Rights Reserved.
-*    
-* This is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-* 
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-* 
-* You should have received a copy of the GNU General Public License
-* along with this software; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
-* USA.
-*
-* TightVNC distribution homepage on the Web: http://www.tightvnc.com/
-*
-*/
+ *
+ * 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/
+ *
+ */
 
 // -=- FTListView.cxx
 
index e43132f498bf57a1d6f059de31e8b8285b86b9c5..e6cc952ffe81fbf23cb9c304eac4b844705d9b9c 100644 (file)
@@ -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
@@ -132,13 +134,18 @@ FTProgress::destroyProgressBarObjects()
 void
 FTProgress::setProgressText()
 {
-       char buf[16];
-
-    int percent = m_pSingleProgress->getCurrentPercent();
-       sprintf(buf, "%d%%", percent);
-       SetWindowText(m_hwndSinglePercent, buf);
-
-    percent = m_pGeneralProgress->getCurrentPercent();
-       sprintf(buf, "%d%%", percent);
-       SetWindowText(m_hwndGeneralPercent, buf);
+  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);
 }
\ No newline at end of file
index c36c079182cbec276f521409156e3dbf5a04a0a1..caad779875f5d6231397a55f63e1c9ddc2789683 100644 (file)
@@ -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
index 01aae568f906ea2228fd422df3cc6105b767ad6c..46d4799adfd6310bfad4ceabf1c44d70e46d28a6 100644 (file)
@@ -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
@@ -32,6 +34,7 @@ FileTransfer::FileTransfer()
   m_bInitialized = false;
   m_bResized = false;
   m_bCancel = false;
+  m_bOverwriteAll = false;
 
   m_pFTDialog = new FTDialog(GetModuleHandle(0), this);
 
@@ -67,8 +70,8 @@ FileTransfer::initialize(rdr::InStream *pIS, rdr::OutStream *pOS)
 {
   if (m_bInitialized) return false;
 
-  m_pReader = new FTMsgReader(pIS);
-  m_pWriter = new FTMsgWriter(pOS);
+  m_pReader = new CFTMsgReader(pIS);
+  m_pWriter = new CFTMsgWriter(pOS);
 
   freeQueues();
 
@@ -144,12 +147,12 @@ FileTransfer::checkDeleteQueue()
       m_pFTDialog->postCheckDeleteQueueMsg();
     } else {
       if (m_DeleteQueue.getFlagsAt(0) & FT_ATTR_DELETE_REMOTE) {
-        m_pWriter->writeFileDeleteRqst(strlen(m_DeleteQueue.getFullLocPathAt(0)), 
-                                       m_DeleteQueue.getFullLocPathAt(0));
+        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);
-        m_pWriter->writeFileListRqst(strlen(pPath), pPath, false);
+        writeFileListRqst(strlen(pPath), pPath, false);
       }
     }
   } else {
@@ -191,7 +194,7 @@ FileTransfer::resizeSending()
             m_bResized = true;
             char *pPath = m_TransferQueue.getFullRemPathAt(i);
             m_dirSizeRqstNum = i;
-            m_pWriter->writeFileDirSizeRqst(strlen(pPath), pPath);
+            writeFileDirSizeRqst(strlen(pPath), pPath);
             return false;
           } else {
             if (flags & FT_ATTR_COPY_UPLOAD) {
@@ -248,12 +251,12 @@ FileTransfer::checkTransferQueue()
       if (flag0 & FT_ATTR_DIR) {
         char *pFullPath = m_TransferQueue.getFullRemPathAt(0);
         if (m_bFTDlgShown) m_pFTDialog->setStatusText("Creating Remote Folder. %s", pFullPath);
-        m_pWriter->writeFileCreateDirRqst(strlen(pFullPath), 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);
-        m_pWriter->writeFileListRqst(strlen(pPath), pPath, false);
+        writeFileListRqst(strlen(pPath), pPath, false);
         return;
       }
     } else {
@@ -280,7 +283,7 @@ FileTransfer::checkTransferQueue()
             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);
-            m_pWriter->writeFileListRqst(strlen(pRemPath), pRemPath, 0);
+            writeFileListRqst(strlen(pRemPath), pRemPath, 0);
             return;
           }
         }
@@ -304,8 +307,8 @@ FileTransfer::uploadFile()
         m_pFTDialog->m_pProgress->clearAndInitSingle(m_TransferQueue.getSizeAt(0), 0);
       }
 
-      m_pWriter->writeFileUploadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
-                                     m_TransferQueue.getFullRemPathAt(0), 0);
+      writeFileUploadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
+                          m_TransferQueue.getFullRemPathAt(0), 0);
       uploadFilePortion();
     }
   }
@@ -323,8 +326,8 @@ FileTransfer::downloadFile()
                                    m_TransferQueue.getFullLocPathAt(0));
         m_pFTDialog->m_pProgress->clearAndInitSingle(m_TransferQueue.getSizeAt(0), 0);
       }
-      m_pWriter->writeFileDownloadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
-                                       m_TransferQueue.getFullRemPathAt(0), 0);
+      writeFileDownloadRqst(strlen(m_TransferQueue.getFullRemPathAt(0)),
+                            m_TransferQueue.getFullRemPathAt(0), 0);
       return true;
     } else return false;
   }
@@ -378,9 +381,9 @@ 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);
-  m_pWriter->writeFileCreateDirRqst(strlen(fullPath), fullPath);
+  writeFileCreateDirRqst(strlen(fullPath), fullPath);
   m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_MAIN);
-  m_pWriter->writeFileListRqst(strlen(pPath), pPath, false);
+  writeFileListRqst(strlen(pPath), pPath, false);
 }
 
 void 
@@ -392,10 +395,10 @@ FileTransfer::renameRemote(char *pPath, char *pOldName, char *pNewName)
   sprintf(fullOldName, "%s\\%s", pPath, pOldName);
   sprintf(fullNewName, "%s\\%s", pPath, pNewName);
 
-  m_pWriter->writeFileRenameRqst(strlen(fullOldName), strlen(fullNewName),
-                                 fullOldName, fullNewName);
+  writeFileRenameRqst(strlen(fullOldName), strlen(fullNewName),
+                      fullOldName, fullNewName);
   m_queueFileListRqst.add(pPath, 0, 0, FT_FLR_DEST_MAIN);
-  m_pWriter->writeFileListRqst(strlen(pPath), pPath, false);
+  writeFileListRqst(strlen(pPath), pPath, false);
 }
 
 bool 
@@ -540,7 +543,13 @@ bool
 FileTransfer::procFileDirSizeDataMsg()
 {
   DWORD64 dw64DirSize = 0;
-  m_pReader->readFileDirSizeData(&dw64DirSize);
+  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();
@@ -650,7 +659,7 @@ FileTransfer::requestFileList(char *pPath, int dest, bool bDirOnly)
 {
   m_queueFileListRqst.add(pPath, 0, 0, dest);
 
-  m_pWriter->writeFileListRqst(strlen(pPath), pPath, bDirOnly);
+  writeFileListRqst(strlen(pPath), pPath, bDirOnly);
 }
 
 int
@@ -698,3 +707,99 @@ FileTransfer::freeQueues()
   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);
+}
index f62c2f96736f9699ae8a46c73741a8589e360d5b..1bfded2c6b02cb456db08f6d0cc5dc90c514fce7 100644 (file)
@@ -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
@@ -31,9 +33,9 @@
 #include <rfb/FileReader.h>
 #include <rfb/FileWriter.h>
 #include <rfb/TransferQueue.h>
+#include <rfb/CFTMsgReader.h>
+#include <rfb/CFTMsgWriter.h>
 #include <vncviewer/FTDialog.h>
-#include <vncviewer/FTMsgReader.h>
-#include <vncviewer/FTMsgWriter.h>
 
 namespace rfb {
   namespace win32 {
@@ -74,11 +76,12 @@ namespace rfb {
       bool m_bInitialized;
       bool m_bResized;
       bool m_bTransferSuccess;
+      bool m_bOverwriteAll;
 
       FTDialog *m_pFTDialog;
 
-      FTMsgReader *m_pReader;
-      FTMsgWriter *m_pWriter;
+      rfb::CFTMsgReader *m_pReader;
+      rfb::CFTMsgWriter *m_pWriter;
 
       FileReader m_fileReader;
       FileWriter m_fileWriter;
@@ -111,6 +114,19 @@ namespace rfb {
       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;
     };
index 071b3e408914bfe28098bb477bf91b38043c0b55..4620dc0bc3f130f0b43636d5d041be79b44d63a6 100644 (file)
@@ -166,14 +166,6 @@ SOURCE=.\FTListView.cxx
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\FTMsgReader.cxx\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\FTMsgWriter.cxx\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\FTProgress.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -242,14 +234,6 @@ SOURCE=.\FTListView.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\FTMsgReader.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\FTMsgWriter.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\FTProgress.h\r
 # End Source File\r
 # Begin Source File\r