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.

93 lines
2.2 KiB

  1. // Common header file for the Nntp administration objects.
  2. //
  3. // Dependencies:
  4. //
  5. //
  6. // Should put these files in the stdafx.h
  7. //
  8. #include "iadm.h"
  9. #include "nntpadm.h"
  10. #include "resource.h"
  11. // Constants:
  12. #define HELP_FILE_NAME _T("nntpadm.hlp")
  13. // Exception creation:
  14. #define NntpCreateException(nDescriptionId) \
  15. CreateException ( \
  16. _Module.GetResourceInstance(), \
  17. THIS_FILE_IID, \
  18. HELP_FILE_NAME, \
  19. THIS_FILE_HELP_CONTEXT, \
  20. THIS_FILE_PROG_ID, \
  21. (nDescriptionId) \
  22. )
  23. #define NntpCreateExceptionFromHresult(hr) \
  24. CreateExceptionFromHresult ( \
  25. _Module.GetResourceInstance(), \
  26. THIS_FILE_IID, \
  27. HELP_FILE_NAME, \
  28. THIS_FILE_HELP_CONTEXT, \
  29. THIS_FILE_PROG_ID, \
  30. (hr) \
  31. )
  32. #define NntpCreateExceptionFromWin32Error(error) \
  33. CreateExceptionFromWin32Error ( \
  34. _Module.GetResourceInstance(), \
  35. THIS_FILE_IID, \
  36. HELP_FILE_NAME, \
  37. THIS_FILE_HELP_CONTEXT, \
  38. THIS_FILE_PROG_ID, \
  39. (error) \
  40. )
  41. // Property validation:
  42. #define VALIDATE_STRING(string, maxlen) \
  43. if ( !PV_MaxChars ( (string), (maxlen) ) ) { \
  44. return NntpCreateException ( IDS_NNTPEXCEPTION_STRING_TOO_LONG ); \
  45. }
  46. #define VALIDATE_DWORD(dw, dwMin, dwMax) \
  47. if ( !PV_MinMax ( (DWORD) (dw), (DWORD) (dwMin), (DWORD) (dwMax) ) ) { \
  48. return NntpCreateException ( IDS_NNTPEXCEPTION_PROPERTY_OUT_OF_RANGE ); \
  49. }
  50. #define VALIDATE_LONG(l, lMin, lMax) \
  51. if ( !PV_MinMax ( (l), (lMin), (lMax) ) ) { \
  52. return NntpCreateException ( IDS_NNTPEXCEPTION_PROPERTY_OUT_OF_RANGE ); \
  53. }
  54. #define CHECK_FOR_SET_CURSOR(fEnumerated,fSetCursor) \
  55. { \
  56. if ( !fEnumerated ) { \
  57. return NntpCreateException ( IDS_NNTPEXCEPTION_DIDNT_ENUMERATE ); \
  58. } \
  59. \
  60. if ( !fSetCursor ) { \
  61. return NntpCreateException ( IDS_NNTPEXCEPTION_DIDNT_SET_CURSOR ); \
  62. } \
  63. }
  64. // Metabase paths:
  65. inline void GetMDInstancePath ( LPWSTR wszInstancePath, DWORD dwServiceInstance )
  66. {
  67. wsprintf ( wszInstancePath, _T("%s%d/"), NNTP_MD_ROOT_PATH, dwServiceInstance );
  68. }
  69. //
  70. // Constants:
  71. //
  72. #define MAX_SLEEP_INST 30000
  73. #define SLEEP_INTERVAL 500
  74. #define MD_SERVICE_NAME _T("NntpSvc")