Skip to content

Commit

Permalink
[Improvement] Add windows part
Browse files Browse the repository at this point in the history
  • Loading branch information
alphaonex86 committed Jun 15, 2019
1 parent 3163d6c commit 5839703
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/CopyEngine/Ultracopier-Spec/TransferThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ bool TransferThread::entryInfoList(const std::string &path,std::vector<dirent_uc
{
dirent_uc tempValue;
tempValue.isFolder=fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
strcpy(tempValue.d_name,fdFile.cFileName);
tempValue.d_name=fdFile.cFileName;
tempValue.size=(fdFile.nFileSizeHigh*(MAXDWORD+1))+fdFile.nFileSizeLow;
list.push_back(tempValue);
}
Expand Down
25 changes: 25 additions & 0 deletions plugins/CopyEngine/Ultracopier-Spec/async/TransferThreadAsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifdef Q_OS_WIN32
#include <accctrl.h>
#include <aclapi.h>
#include <winbase.h>
#endif

#include "../../../../cpp11addition.h"
Expand Down Expand Up @@ -197,13 +198,37 @@ void TransferThreadAsync::postOperation()
doFilePostOperation();
}

#ifdef Q_OS_WIN32
DWORD TransferThreadAsync::LpprogressRoutine(
LARGE_INTEGER TotalFileSize,
LARGE_INTEGER TotalBytesTransferred,
LARGE_INTEGER StreamSize,
LARGE_INTEGER StreamBytesTransferred,
DWORD dwStreamNumber,
DWORD dwCallbackReason,
HANDLE hSourceFile,
HANDLE hDestinationFile,
LPVOID lpData
)
{
transferProgression=TotalBytesTransferred.QuadPart;
return PROGRESS_CONTINUE;
}
#endif

void TransferThreadAsync::ifCanStartTransfer()
{
if(transfer_stat!=TransferStat_WaitForTheTransfer /*wait preoperation*/ || !canStartTransfer/*wait start call*/)
return;
transfer_stat=TransferStat_Transfer;
emit pushStat(transfer_stat,transferId);
#ifdef Q_OS_WIN32
if(CopyFileExA(source.c_str(),destination.c_str(),&TransferThreadAsync::LpprogressRoutine,NULL,stopIt,
COPY_FILE_ALLOW_DECRYPTED_DESTINATION | 0x00000800/*COPY_FILE_COPY_SYMLINK*/ | 0x00001000/*COPY_FILE_NO_BUFFERING*/
)!=0)
#else
if(copy(source.c_str(),destination.c_str())<0)
#endif
{
if(stopIt)
{
Expand Down
11 changes: 11 additions & 0 deletions plugins/CopyEngine/Ultracopier-Spec/async/TransferThreadAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ public slots:
bool remainSourceOpen() const;
bool remainDestinationOpen() const;
void resetExtraVariable();
#ifdef Q_OS_WIN32
DWORD LpprogressRoutine( LARGE_INTEGER TotalFileSize,
LARGE_INTEGER TotalBytesTransferred,
LARGE_INTEGER StreamSize,
LARGE_INTEGER StreamBytesTransferred,
DWORD dwStreamNumber,
DWORD dwCallbackReason,
HANDLE hSourceFile,
HANDLE hDestinationFile,
LPVOID lpData);
#endif
void ifCanStartTransfer();
};

Expand Down
Empty file modified plugins/CopyEngine/Ultracopier-Spec/ports.h
100644 → 100755
Empty file.

0 comments on commit 5839703

Please sign in to comment.