stdafx.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //---------------------------------------------------------------------------
  2. #ifndef StdAfxH
  3. #define StdAfxH
  4. //---------------------------------------------------------------------------
  5. #define _int64 __int64
  6. #define CStringA CString
  7. //---------------------------------------------------------------------------
  8. #define MPEXT
  9. #define MPEXT_NO_ZLIB
  10. #define MPEXT_NO_GSS
  11. #define MPEXT_NO_SSL
  12. #define MPEXT_NO_SFTP
  13. #define MPEXT_NO_IDENT
  14. #define MPEXT_NO_CACHE
  15. #define MPEXT_NO_SPEED_LIM_RULES
  16. #define _AFX_NOFORCE_LIBS
  17. //---------------------------------------------------------------------------
  18. #define GetOption(OPTION) GetInstanceOption(this->m_pApiLogParent, OPTION)
  19. #define GetOptionVal(OPTION) GetInstanceOptionVal(this->m_pApiLogParent, OPTION)
  20. //---------------------------------------------------------------------------
  21. #include <afx.h>
  22. #include "wtypes.h"
  23. #include <afxmt.h>
  24. //STL includes
  25. #include <list>
  26. #include <map>
  27. #include <vector>
  28. #include <deque>
  29. #include <set>
  30. #include <algorithm>
  31. //---------------------------------------------------------------------------
  32. class CFileFix;
  33. #define CFile CFileFix
  34. //---------------------------------------------------------------------------
  35. #include "MFC64bitFix.h"
  36. #include <ApiLog.h>
  37. #include <FileZillaApi.h>
  38. #include <FileZillaOpt.h>
  39. #include <Options.h>
  40. #include <Crypt.h>
  41. #include <TextsFileZilla.h>
  42. #include <structures.h>
  43. //---------------------------------------------------------------------------
  44. #include <oleauto.h>
  45. #include <afxdisp.h>
  46. #include <afxconv.h>
  47. //---------------------------------------------------------------------------
  48. #define _strlwr strlwr
  49. #define USEDPARAM(p) ((p) == (p))
  50. //---------------------------------------------------------------------------
  51. const int FILEEXISTS_ASK = -1;
  52. const int FILEEXISTS_OVERWRITE = 0;
  53. const int FILEEXISTS_OVERWRITEIFNEWER = 1;
  54. const int FILEEXISTS_RESUME = 2;
  55. const int FILEEXISTS_RENAME = 3;
  56. const int FILEEXISTS_SKIP = 4;
  57. const int FILEEXISTS_RESUME_ASKONFAIL = 5; // Used by queue for automatic resuming. If APPE failes, ask what to do instead.
  58. //---------------------------------------------------------------------------
  59. class t_ffam_statusmessage
  60. {
  61. public:
  62. CString status;
  63. int type;
  64. BOOL post;
  65. };
  66. //---------------------------------------------------------------------------
  67. typedef struct
  68. {
  69. __int64 bytes;
  70. #ifdef MPEXT
  71. __int64 transfersize;
  72. #endif
  73. int percent;
  74. int timeelapsed;
  75. int timeleft;
  76. int transferrate;
  77. BOOL bFileTransfer;
  78. } t_ffam_transferstatus;
  79. //---------------------------------------------------------------------------
  80. #undef CFile
  81. //---------------------------------------------------------------------------
  82. class CFileFix : public CFile
  83. {
  84. public:
  85. // MFC CFile::Read does not include file name into error message
  86. UINT Read(void * lpBuf, UINT nCount)
  87. {
  88. ASSERT_VALID(this);
  89. ASSERT(m_hFile != (UINT)hFileNull);
  90. if (nCount == 0)
  91. {
  92. return 0; // avoid Win32 "null-read"
  93. }
  94. ASSERT(lpBuf != NULL);
  95. ASSERT(AfxIsValidAddress(lpBuf, nCount));
  96. DWORD dwRead;
  97. if (!::ReadFile((HANDLE)m_hFile, lpBuf, nCount, &dwRead, NULL))
  98. {
  99. // The only change from MFC CFile::Read is m_strFileName
  100. CFileException::ThrowOsError((LONG)::GetLastError(), m_strFileName);
  101. }
  102. return (UINT)dwRead;
  103. }
  104. // MFC allocates CObject (ancestor of CFile) with new, but deallocates with free,
  105. // what codeguard dislikes, this is fix, not sure if it is necessary for
  106. // release version, but probably causes no harm
  107. void PASCAL operator delete(void* p)
  108. {
  109. delete p;
  110. }
  111. };
  112. //---------------------------------------------------------------------------
  113. #define CFile CFileFix
  114. //---------------------------------------------------------------------------
  115. #endif