summaryrefslogtreecommitdiffstats
path: root/rfb_win32
diff options
context:
space:
mode:
authorDennis Syrovatsky <dennis@tightvnc.com>2005-11-28 07:10:27 +0000
committerDennis Syrovatsky <dennis@tightvnc.com>2005-11-28 07:10:27 +0000
commitc4ed9b72cb742d3da82190de1af1f3f513c372d7 (patch)
treeb846c8c43a8a38350c3199dce9c66e0806dc19a9 /rfb_win32
parent6806fec02fab3424845185968487a9c332cac0f3 (diff)
downloadtigervnc-c4ed9b72cb742d3da82190de1af1f3f513c372d7.tar.gz
tigervnc-c4ed9b72cb742d3da82190de1af1f3f513c372d7.zip
Added getDirSize() method to the FolderManager class.
Added checkTransferQueue() method to the File Transfer class. Code improvements. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@419 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb_win32')
-rw-r--r--rfb_win32/FolderManager.cxx36
-rw-r--r--rfb_win32/FolderManager.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/rfb_win32/FolderManager.cxx b/rfb_win32/FolderManager.cxx
index 5e079d75..7eec8f93 100644
--- a/rfb_win32/FolderManager.cxx
+++ b/rfb_win32/FolderManager.cxx
@@ -211,3 +211,39 @@ FolderManager::getFiletime(unsigned int time70, FILETIME *pftime)
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;
+} \ No newline at end of file
diff --git a/rfb_win32/FolderManager.h b/rfb_win32/FolderManager.h
index ea2a716d..c7c086b2 100644
--- a/rfb_win32/FolderManager.h
+++ b/rfb_win32/FolderManager.h
@@ -49,6 +49,8 @@ namespace rfb {
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);
};