MSDN documentation states that for files larger than 4 gigabytes,there is the CFileFind::GetLength64() function that returns the size as 64Bit number.But the function just return a wrong 32Bit number. Damn Microsoft!
Solution: write a derived class(CMyFtpFileFind) from CFtpFileFind,and implementing the GetLength64() member function correctly. Replace this derived class with CFtpFileFind.
Reference: http://www.codeproject.com/KB/bugs/getlength64bug.asp.aspx?print=true
Solution: write a derived class(CMyFtpFileFind) from CFtpFileFind,and implementing the GetLength64() member function correctly. Replace this derived class with CFtpFileFind.
Reference: http://www.codeproject.com/KB/bugs/getlength64bug.asp.aspx?print=true
Last version: https://gist.github.com/978421
Source code as following text:
class CMyFtpFileFind : public CFtpFileFind
{
public:
CMyFtpFileFind(CFtpConnection* pConnection, DWORD dwContext = 1) : CFtpFileFind(pConnection, dwContext)
{
}
virtual ~CMyFtpFileFind() { }
__int64 GetLength64() const
{
ASSERT(m_hContext != NULL);
ASSERT_VALID(this);
unsigned __int64 uRet = 0;
if (m_pFoundInfo != NULL)
{
unsigned __int64 uFileSizeLow = ((LPWIN32_FIND_DATA) m_pFoundInfo)->nFileSizeLow;
unsigned __int64 uFileSizeHigh = ((LPWIN32_FIND_DATA) m_pFoundInfo)->nFileSizeHigh;
uRet = uFileSizeLow + (uFileSizeHigh << 32);
}
return uRet;
}
}; // CMyFtpFileFind