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.

92 lines
2.4 KiB

  1. // Common header file for the Smtp administration objects.
  2. // Dependencies: please include stdafx.h" first
  3. //
  4. #include "resource.h"
  5. // Constants:
  6. #define HELP_FILE_NAME _T("smtpadm.hlp")
  7. // Exception creation:
  8. #define SmtpCreateException(nDescriptionId) \
  9. CreateException ( \
  10. _Module.GetResourceInstance(), \
  11. THIS_FILE_IID, \
  12. HELP_FILE_NAME, \
  13. THIS_FILE_HELP_CONTEXT, \
  14. THIS_FILE_PROG_ID, \
  15. (nDescriptionId) \
  16. )
  17. #define SmtpCreateExceptionFromHresult(hr) \
  18. CreateExceptionFromHresult ( \
  19. _Module.GetResourceInstance(), \
  20. THIS_FILE_IID, \
  21. HELP_FILE_NAME, \
  22. THIS_FILE_HELP_CONTEXT, \
  23. THIS_FILE_PROG_ID, \
  24. (hr) \
  25. )
  26. #define SmtpCreateExceptionFromWin32Error(error) \
  27. CreateExceptionFromWin32Error ( \
  28. _Module.GetResourceInstance(), \
  29. THIS_FILE_IID, \
  30. HELP_FILE_NAME, \
  31. THIS_FILE_HELP_CONTEXT, \
  32. THIS_FILE_PROG_ID, \
  33. (error) \
  34. )
  35. // Property validation:
  36. #define VALIDATE_STRING(string, maxlen) \
  37. if ( !PV_MaxChars ( (string), (maxlen) ) ) { \
  38. return SmtpCreateException ( IDS_SMTPEXCEPTION_STRING_TOO_LONG ); \
  39. }
  40. #define VALIDATE_DWORD(dw, dwMin, dwMax) \
  41. if ( !PV_MinMax ( (DWORD) (dw), (DWORD) (dwMin), (DWORD) (dwMax) ) ) { \
  42. return SmtpCreateException ( IDS_SMTPEXCEPTION_PROPERTY_OUT_OF_RANGE ); \
  43. }
  44. #define VALIDATE_LONG(l, lMin, lMax) \
  45. if ( !PV_MinMax ( (l), (lMin), (lMax) ) ) { \
  46. return SmtpCreateException ( IDS_SMTPEXCEPTION_PROPERTY_OUT_OF_RANGE ); \
  47. }
  48. #define CHECK_FOR_SET_CURSOR(fEnumerated,fSetCursor) \
  49. { \
  50. if ( !fEnumerated ) { \
  51. return SmtpCreateException ( IDS_SMTPEXCEPTION_DIDNT_ENUMERATE ); \
  52. } \
  53. \
  54. if ( !fSetCursor ) { \
  55. return SmtpCreateException ( IDS_SMTPEXCEPTION_DIDNT_SET_CURSOR ); \
  56. } \
  57. }
  58. // Metabase paths:
  59. inline void GetMDInstancePath ( TCHAR * szInstancePath, DWORD dwServiceInstance )
  60. {
  61. wsprintf ( szInstancePath, SMTP_MD_ROOT_PATH _T("%d/"), dwServiceInstance );
  62. }
  63. inline void GetMDParamPath ( TCHAR * szParamPath, DWORD dwServiceInstance )
  64. {
  65. wsprintf ( szParamPath, SMTP_MD_ROOT_PATH _T("%d/"), dwServiceInstance );
  66. }
  67. inline void GetMDRootPath ( TCHAR * szRootPath, DWORD dwServiceInstance )
  68. {
  69. wsprintf ( szRootPath, SMTP_MD_ROOT_PATH _T("%d/Root/"), dwServiceInstance );
  70. }
  71. inline void GetMDVDirPath ( TCHAR * szVDirPath, DWORD dwServiceInstance, TCHAR * szName )
  72. {
  73. wsprintf ( szVDirPath, SMTP_MD_ROOT_PATH _T("%d/Root/%s"), dwServiceInstance, szName );
  74. }