Source code of Windows XP (NT5)
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.

128 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name :
  4. ims.h
  5. Abstract:
  6. Common header for Internet Mail System components.
  7. Author:
  8. Richard Kamicar (rkamicar) 31-Dec-1995
  9. Project:
  10. IMS
  11. Revision History:
  12. --*/
  13. #ifndef _IMS_H_
  14. #define _IMS_H_
  15. #define I64_LI(cli) (*((__int64*)&cli))
  16. #define LI_I64(i) (*((LARGE_INTEGER*)&i))
  17. #define INT64_FROM_LARGE_INTEGER(cli) I64_LI(cli)
  18. #define LARGE_INTEGER_FROM_INT64(i) LI_I64(i)
  19. #define I64_FT(ft) (*((__int64*)&ft))
  20. #define FT_I64(i) (*((FILETIME*)&i))
  21. #define INT64_FROM_FILETIME(ft) I64_FT(ft)
  22. #define FILETIME_FROM_INT64(i) FT_I64(i)
  23. //
  24. // These can be overridden by registry values.
  25. //
  26. #define IMS_MAX_ERRORS 10
  27. #define IMS_MAX_USER_NAME_LEN 64
  28. #define IMS_MAX_DOMAIN_NAME_LEN 256
  29. #define IMS_MAX_PATH_LEN 64
  30. #define IMS_MAX_MSG_SIZE 42 * 1024
  31. #define IMS_MAX_FILE_NAME_LEN 40
  32. #define IMS_ACCESS_LOCKFILE TEXT("pop3lock.lck")
  33. #define IMS_ACCESS_LOCKFILE_NAME IMS_ACCESS_LOCKFILE
  34. #define IMS_DOMAIN_KEY TEXT("DomainName")
  35. #define IMS_EXTENSION TEXT("eml")
  36. #define ENV_EXTENSION TEXT("env")
  37. static const int TABLE_SIZE = 241;
  38. /*++
  39. This function canonicalizes the path, taking into account the current
  40. user's current directory value.
  41. Arguments:
  42. pszDest string that will on return contain the complete
  43. canonicalized path. This buffer will be of size
  44. specified in *lpdwSize.
  45. lpdwSize Contains the size of the buffer pszDest on entry.
  46. On return contains the number of bytes written
  47. into the buffer or number of bytes required.
  48. pszSearchPath pointer to string containing the path to be converted.
  49. IF NULL, use the current directory only
  50. Returns:
  51. Win32 Error Code - NO_ERROR on success
  52. MuraliK 24-Apr-1995 Created.
  53. --*/
  54. BOOL
  55. ResolveVirtualRoot(
  56. OUT CHAR * pszDest,
  57. IN OUT LPDWORD lpdwSize,
  58. IN OUT CHAR * pszSearchPath,
  59. OUT HANDLE * phToken = NULL
  60. );
  61. //Published hash algorithm used in the UNIX ELF
  62. //format for object files
  63. inline unsigned long ElfHash (const unsigned char * UserName)
  64. {
  65. unsigned long HashValue = 0, g;
  66. while (*UserName)
  67. {
  68. HashValue = (HashValue << 4) + *UserName++;
  69. if( g = HashValue & 0xF0000000)
  70. HashValue ^= g >> 24;
  71. HashValue &= ~g;
  72. }
  73. return HashValue;
  74. }
  75. inline DWORD HashUser (const unsigned char * UserName)
  76. {
  77. DWORD HashValue = ElfHash (UserName);
  78. HashValue %= TABLE_SIZE;
  79. return HashValue;
  80. }
  81. inline VOID
  82. MakeInboxPath(
  83. LPTSTR pszInboxPath, // UNICODE | ASCII
  84. LPCTSTR pszMailRoot, // UNICODE | ASCII
  85. LPCSTR paszUserName // ASCII
  86. )
  87. {
  88. wsprintf(pszInboxPath, "%s\\%u\\%hs",
  89. pszMailRoot,
  90. HashUser((const unsigned char *)paszUserName),
  91. paszUserName);
  92. }
  93. #endif