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.

106 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1989-2001 Microsoft Corporation
  3. Module Name:
  4. ppmacros.h
  5. Abstract:
  6. This header defines various generic macros for use by user mode Plug and
  7. Play system components.
  8. Author:
  9. Jim Cavalaris (jamesca) 03/01/2001
  10. Environment:
  11. User-mode only.
  12. Revision History:
  13. 01-March-2001 jamesca
  14. Creation and initial implementation.
  15. --*/
  16. #ifndef _PPMACROS_H_
  17. #define _PPMACROS_H_
  18. //
  19. // Debug output is filtered at two levels: A global level and a component
  20. // specific level.
  21. //
  22. // Each debug output request specifies a component id and a filter level
  23. // or mask. These variables are used to access the debug print filter
  24. // database maintained by the system. The component id selects a 32-bit
  25. // mask value and the level either specified a bit within that mask or is
  26. // the mask value itself.
  27. //
  28. // If any of the bits specified by the level or mask are set in either the
  29. // component mask or the global mask, then the debug output is permitted.
  30. // Otherwise, the debug output is filtered and not printed.
  31. //
  32. // The component mask for filtering the debug output of this component is
  33. // Kd_PNPMGR_Mask and may be set via the registry or the kernel debugger.
  34. //
  35. // The global mask for filtering the debug output of all components is
  36. // Kd_WIN2000_Mask and may be set via the registry or the kernel debugger.
  37. //
  38. // The registry key for setting the mask value for this component is:
  39. //
  40. // HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\
  41. // Session Manager\Debug Print Filter\PNPMGR
  42. //
  43. // The key "Debug Print Filter" may have to be created in order to create
  44. // the component key.
  45. //
  46. // The following levels are used to filter debug output.
  47. //
  48. #define DBGF_ERRORS (0x00000001 | DPFLTR_MASK)
  49. #define DBGF_WARNINGS (0x00000002 | DPFLTR_MASK)
  50. #define DBGF_EVENT (0x00000010 | DPFLTR_MASK)
  51. #define DBGF_REGISTRY (0x00000020 | DPFLTR_MASK)
  52. #define DBGF_INSTALL (0x00000040 | DPFLTR_MASK)
  53. //
  54. // ASSERT macros
  55. //
  56. #ifdef MYASSERT
  57. #undef MYASSERT
  58. #endif
  59. #if ASSERTS_ON
  60. #define MYASSERT(x) if(!(x)) { AssertFail(__FILE__,__LINE__,#x); }
  61. #else
  62. #define MYASSERT(x)
  63. #endif
  64. //
  65. // macros for setting and testing flags
  66. //
  67. #define SET_FLAG(Status, Flag) ((Status) |= (Flag))
  68. #define CLEAR_FLAG(Status, Flag) ((Status) &= ~(Flag))
  69. #define INVALID_FLAGS(ulFlags, ulAllowed) ((ulFlags) & ~(ulAllowed))
  70. #define TEST_FLAGS(t,ulMask, ulBit) (((t)&(ulMask)) == (ulBit))
  71. #define IS_FLAG_SET(t,ulMask) TEST_FLAGS(t,ulMask,ulMask)
  72. #define IS_FLAG_CLEAR(t,ulMask) TEST_FLAGS(t,ulMask,0)
  73. //
  74. // other useful macros
  75. //
  76. #define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
  77. #define SIZECHARS(x) (sizeof((x))/sizeof(TCHAR))
  78. #endif // _PPMACROS_H_