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/vncviewer/FTBrowseDlg.cxx b/vncviewer/FTBrowseDlg.cxx
index 7c88ff6..1b6dfb6 100644
--- a/vncviewer/FTBrowseDlg.cxx
+++ b/vncviewer/FTBrowseDlg.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
@@ -68,9 +70,7 @@
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 @@
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 @@
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));
}
}
diff --git a/vncviewer/FTBrowseDlg.h b/vncviewer/FTBrowseDlg.h
index 1a5e663..5c9ba35 100644
--- a/vncviewer/FTBrowseDlg.h
+++ b/vncviewer/FTBrowseDlg.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
@@ -49,6 +51,8 @@
void addItems(FileInfo *pFI);
char *getPath();
+ void deleteChildItems();
+
private:
HWND m_hwndDlg;
HWND m_hwndTree;
diff --git a/vncviewer/FTDialog.cxx b/vncviewer/FTDialog.cxx
index b4c669d..409d3b1 100644
--- a/vncviewer/FTDialog.cxx
+++ b/vncviewer/FTDialog.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
@@ -376,7 +378,6 @@
showRemoteLVItems();
}
}
-
delete m_pBrowseDlg;
m_pBrowseDlg = NULL;
}
@@ -514,6 +515,8 @@
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 @@
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;
diff --git a/vncviewer/FTDialog.h b/vncviewer/FTDialog.h
index 36cb669..a4b5546 100644
--- a/vncviewer/FTDialog.h
+++ b/vncviewer/FTDialog.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/vncviewer/FTListView.cxx b/vncviewer/FTListView.cxx
index ab43cbd..8f41abf 100644
--- a/vncviewer/FTListView.cxx
+++ b/vncviewer/FTListView.cxx
@@ -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
diff --git a/vncviewer/FTProgress.cxx b/vncviewer/FTProgress.cxx
index e43132f..e6cc952 100644
--- a/vncviewer/FTProgress.cxx
+++ b/vncviewer/FTProgress.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
@@ -132,13 +134,18 @@
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
diff --git a/vncviewer/FTProgress.h b/vncviewer/FTProgress.h
index c36c079..caad779 100644
--- a/vncviewer/FTProgress.h
+++ b/vncviewer/FTProgress.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/vncviewer/FileTransfer.cxx b/vncviewer/FileTransfer.cxx
index 01aae56..46d4799 100644
--- a/vncviewer/FileTransfer.cxx
+++ b/vncviewer/FileTransfer.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
@@ -32,6 +34,7 @@
m_bInitialized = false;
m_bResized = false;
m_bCancel = false;
+ m_bOverwriteAll = false;
m_pFTDialog = new FTDialog(GetModuleHandle(0), this);
@@ -67,8 +70,8 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
m_queueFileListRqst.add(pPath, 0, 0, dest);
- m_pWriter->writeFileListRqst(strlen(pPath), pPath, bDirOnly);
+ writeFileListRqst(strlen(pPath), pPath, bDirOnly);
}
int
@@ -698,3 +707,99 @@
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/vncviewer/FileTransfer.h b/vncviewer/FileTransfer.h
index f62c2f9..1bfded2 100644
--- a/vncviewer/FileTransfer.h
+++ b/vncviewer/FileTransfer.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
@@ -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 @@
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 @@
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;
};
diff --git a/vncviewer/vncviewer.dsp b/vncviewer/vncviewer.dsp
index 071b3e4..4620dc0 100644
--- a/vncviewer/vncviewer.dsp
+++ b/vncviewer/vncviewer.dsp
@@ -166,14 +166,6 @@
# End Source File
# Begin Source File
-SOURCE=.\FTMsgReader.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTMsgWriter.cxx
-# End Source File
-# Begin Source File
-
SOURCE=.\FTProgress.cxx
# End Source File
# Begin Source File
@@ -242,14 +234,6 @@
# End Source File
# Begin Source File
-SOURCE=.\FTMsgReader.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\FTMsgWriter.h
-# End Source File
-# Begin Source File
-
SOURCE=.\FTProgress.h
# End Source File
# Begin Source File