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.

140 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. valid.h
  5. Abstract:
  6. Contains validation macros and function prototypes for service
  7. controller parameters.
  8. Author:
  9. Dan Lafferty (danl) 29-Mar-1992
  10. Environment:
  11. User Mode - Win32
  12. Revision History:
  13. 29-Mar-1992 danl
  14. Created
  15. 10-Apr-1992 JohnRo
  16. Added START_TYPE_INVALID().
  17. Changed SERVICE_TYPE_INVALID() into SERVICE_TYPE_MASK_INVALID() and
  18. added a stricter SERVICE_TYPE_INVALID() which checks for one type.
  19. Made other macros less likely to be evaluated wrong.
  20. --*/
  21. #ifndef VALID_H
  22. #define VALID_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. //
  27. // INCLUDES
  28. //
  29. //
  30. // DEFINITIONS
  31. //
  32. #define MAX_SERVICE_NAME_LENGTH 256
  33. //
  34. // MACROS
  35. //
  36. #define CONTROLS_ACCEPTED_INVALID(cA) \
  37. (((cA) & ~(SERVICE_ACCEPT_STOP | \
  38. SERVICE_ACCEPT_PAUSE_CONTINUE | \
  39. SERVICE_ACCEPT_SHUTDOWN | \
  40. SERVICE_ACCEPT_PARAMCHANGE | \
  41. SERVICE_ACCEPT_HARDWAREPROFILECHANGE | \
  42. SERVICE_ACCEPT_NETBINDCHANGE | \
  43. SERVICE_ACCEPT_POWEREVENT | \
  44. SERVICE_ACCEPT_SESSIONCHANGE)) !=0)
  45. // Note that this macro does not allow SERVICE_NO_CHANGE.
  46. #define ERROR_CONTROL_INVALID( eC ) \
  47. ( \
  48. ( (eC) != SERVICE_ERROR_NORMAL ) && \
  49. ( (eC) != SERVICE_ERROR_SEVERE ) && \
  50. ( (eC) != SERVICE_ERROR_IGNORE ) && \
  51. ( (eC) != SERVICE_ERROR_CRITICAL ) \
  52. )
  53. #define SERVICE_STATUS_TYPE_INVALID(sT) \
  54. ( \
  55. ( ((sT) & (~SERVICE_INTERACTIVE_PROCESS)) != SERVICE_WIN32_OWN_PROCESS ) && \
  56. ( ((sT) & (~SERVICE_INTERACTIVE_PROCESS)) != SERVICE_WIN32_SHARE_PROCESS ) && \
  57. ( ((sT) & (~SERVICE_INTERACTIVE_PROCESS)) != SERVICE_WIN32 ) && \
  58. ( (sT) != SERVICE_DRIVER ) \
  59. )
  60. // Note that this macro does not allow SERVICE_NO_CHANGE.
  61. #define SERVICE_TYPE_INVALID(sT) \
  62. ( \
  63. ( ((sT) & (~SERVICE_INTERACTIVE_PROCESS)) != SERVICE_WIN32_OWN_PROCESS ) && \
  64. ( ((sT) & (~SERVICE_INTERACTIVE_PROCESS)) != SERVICE_WIN32_SHARE_PROCESS ) && \
  65. ( (sT) != SERVICE_KERNEL_DRIVER ) && \
  66. ( (sT) != SERVICE_FILE_SYSTEM_DRIVER ) \
  67. )
  68. // Note that this macro does not allow SERVICE_NO_CHANGE.
  69. #define SERVICE_TYPE_MASK_INVALID(sT) \
  70. ((((sT) & SERVICE_TYPE_ALL) == 0 ) || \
  71. (((sT) & ~SERVICE_TYPE_ALL) != 0 ))
  72. #define ENUM_STATE_MASK_INVALID(sS) \
  73. ((((sS) & SERVICE_STATE_ALL) == 0 ) || \
  74. (((sS) & ~SERVICE_STATE_ALL) != 0 ))
  75. // Note that this macro does not allow SERVICE_NO_CHANGE.
  76. #define START_TYPE_INVALID(sT) \
  77. ( \
  78. ( (sT) != SERVICE_BOOT_START ) && \
  79. ( (sT) != SERVICE_SYSTEM_START ) && \
  80. ( (sT) != SERVICE_AUTO_START ) && \
  81. ( (sT) != SERVICE_DEMAND_START ) && \
  82. ( (sT) != SERVICE_DISABLED ) \
  83. )
  84. // Note that this macro does not allow SERVICE_NO_CHANGE.
  85. #define ACTION_TYPE_INVALID(aT) \
  86. ( \
  87. ( (aT) != SC_ACTION_NONE ) && \
  88. ( (aT) != SC_ACTION_RESTART ) && \
  89. ( (aT) != SC_ACTION_REBOOT ) && \
  90. ( (aT) != SC_ACTION_RUN_COMMAND ) \
  91. )
  92. //
  93. // FUNCTION PROTOTYPES
  94. //
  95. BOOL
  96. ScCurrentStateInvalid(
  97. DWORD dwCurrentState
  98. );
  99. DWORD
  100. ScValidateMultiSZ(
  101. LPCWSTR lpStrings,
  102. DWORD cbStrings
  103. );
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif // VALID_H