Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
5.3 KiB

  1. // --------------------------------------------------------------------------------
  2. // Utility.h
  3. // --------------------------------------------------------------------------------
  4. #ifndef __UTILITY_H
  5. #define __UTILITY_H
  6. // --------------------------------------------------------------------------------
  7. // Depends
  8. // --------------------------------------------------------------------------------
  9. #include <shared.h>
  10. // --------------------------------------------------------------------------------
  11. // DWORDALIGN
  12. // --------------------------------------------------------------------------------
  13. #define DWORDALIGN(_cb) ((_cb % 4 != 0) ? (_cb += (4 - (_cb % 4))) : _cb)
  14. // --------------------------------------------------------------------------------
  15. // DIRTYPE
  16. // --------------------------------------------------------------------------------
  17. typedef enum tagDIRTYPE {
  18. DIR_IS_ROOT,
  19. DIR_IS_LOCAL,
  20. DIR_IS_NEWS,
  21. DIR_IS_IMAP
  22. } DIRTYPE;
  23. // --------------------------------------------------------------------------------
  24. // ACCOUNTINFO
  25. // --------------------------------------------------------------------------------
  26. typedef struct tagACCOUNTINFO *LPACCOUNTINFO;
  27. typedef struct tagACCOUNTINFO {
  28. CHAR szAcctId[CCHMAX_ACCOUNT_NAME];
  29. CHAR szAcctName[CCHMAX_ACCOUNT_NAME];
  30. CHAR szDirectory[MAX_PATH];
  31. CHAR szDataDir[MAX_PATH];
  32. CHAR szServer[CCHMAX_SERVER_NAME];
  33. DWORD dwServer;
  34. } ACCOUNTINFO;
  35. // --------------------------------------------------------------------------------
  36. // ACCOUNTTABLE
  37. // --------------------------------------------------------------------------------
  38. typedef struct tagACCOUNTTABLE {
  39. DWORD cAccounts;
  40. LPACCOUNTINFO prgAccount;
  41. } ACCOUNTTABLE, *LPACCOUNTTABLE;
  42. // --------------------------------------------------------------------------------
  43. // FILETYPE
  44. // --------------------------------------------------------------------------------
  45. typedef enum tagFILETYPE {
  46. FILE_IS_LOCAL_MESSAGES,
  47. FILE_IS_NEWS_MESSAGES,
  48. FILE_IS_IMAP_MESSAGES,
  49. FILE_IS_POP3UIDL,
  50. FILE_IS_LOCAL_FOLDERS,
  51. FILE_IS_IMAP_FOLDERS,
  52. FILE_IS_NEWS_SUBLIST,
  53. FILE_IS_NEWS_GRPLIST
  54. } FILETYPE;
  55. // --------------------------------------------------------------------------------
  56. // ENUMFILEINFO
  57. // --------------------------------------------------------------------------------
  58. typedef struct tagENUMFILEINFO {
  59. LPSTR pszExt;
  60. LPSTR pszFoldFile;
  61. LPSTR pszUidlFile;
  62. LPSTR pszSubList;
  63. LPSTR pszGrpList;
  64. BOOL fFindV1News;
  65. } ENUMFILEINFO, *LPENUMFILEINFO;
  66. // --------------------------------------------------------------------------------
  67. // FILEINFO
  68. // --------------------------------------------------------------------------------
  69. typedef struct tagFILEINFO *LPFILEINFO;
  70. typedef struct tagFILEINFO {
  71. CHAR szFilePath[MAX_PATH + MAX_PATH];
  72. CHAR szDstFile[MAX_PATH + MAX_PATH];
  73. CHAR szAcctId[CCHMAX_ACCOUNT_NAME];
  74. CHAR szFolder[255];
  75. DWORD fMigrate;
  76. HRESULT hrMigrate;
  77. DWORD dwLastError;
  78. DWORD cbFile;
  79. DWORD cRecords;
  80. DWORD cProgInc;
  81. DWORD cProgCur;
  82. DWORD cProgMax;
  83. FILETYPE tyFile;
  84. DWORD dwServer;
  85. DWORD idFolder;
  86. BOOL fInStore;
  87. DWORD cUnread;
  88. DWORD cMessages;
  89. LPFILEINFO pNext;
  90. } FILEINFO;
  91. // --------------------------------------------------------------------------------
  92. // PROGRESSINFO
  93. // --------------------------------------------------------------------------------
  94. typedef struct tagPROGRESSINFO {
  95. HWND hwndProgress;
  96. DWORD cCurrent;
  97. DWORD cMax;
  98. DWORD cPercent;
  99. } PROGRESSINFO, *LPPROGRESSINFO;
  100. // --------------------------------------------------------------------------------
  101. // Prototypes
  102. // --------------------------------------------------------------------------------
  103. HRESULT EnumerateStoreFiles(LPCSTR pszPath, DIRTYPE tyDir, LPCSTR pszSubDir, LPENUMFILEINFO pEnumInfo, LPFILEINFO *ppHead);
  104. HRESULT FreeFileList(LPFILEINFO *ppHead);
  105. INT_PTR CALLBACK MigrageDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  106. void IncrementProgress(LPPROGRESSINFO pProgress, LPFILEINFO pInfo);
  107. HRESULT WriteMigrationLogFile(HRESULT hrMigrate, DWORD dwLastError, LPCSTR pszStoreRoot, LPCSTR pszMigrate, LPCSTR pszCmdLine, LPFILEINFO pHeadFile);
  108. HRESULT BlobReadData(LPBYTE lpbBlob, ULONG cbBlob, ULONG *pib, LPBYTE lpbData, ULONG cbData);
  109. HRESULT GetAvailableDiskSpace(LPCSTR pszFilePath, DWORDLONG *pdwlFree);
  110. void ReplaceExtension(LPCSTR pszFilePath, LPCSTR pszExtNew, LPSTR pszFilePathNew, int cchFilePathNew);
  111. HRESULT MyWriteFile(HANDLE hFile, DWORD faAddress, LPVOID pData, DWORD cbData);
  112. void SetProgressFile(LPPROGRESSINFO pProgress, LPFILEINFO pInfo);
  113. UINT MigrateMessageBox(LPCSTR pszMsg, UINT uType);
  114. void InitializeCounters(LPMEMORYFILE pFile, LPFILEINFO pInfo, LPDWORD pcMax, LPDWORD pcbNeeded, BOOL fInflate);
  115. HRESULT BuildAccountTable(HKEY hkeyBase, LPCSTR pszRegRoot, LPCSTR pszStoreRoot, LPACCOUNTTABLE pAcctTbl);
  116. #endif // __UTILITY_H