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.

92 lines
1.6 KiB

  1. /*
  2. * debbase.h - Base debug macros and their retail translations.
  3. */
  4. // BUGBUG: this should be fixed/beef up
  5. /* Macros
  6. *********/
  7. /* debug assertion macro */
  8. /*
  9. * ASSERT() may only be used as a statement, not as an expression.
  10. *
  11. * E.g.,
  12. *
  13. * ASSERT(pszRest);
  14. */
  15. #ifdef DEBUG
  16. #define ASSERT(exp) \
  17. if (exp) \
  18. ; \
  19. else \
  20. ERROR_OUT(("assertion failed '%s'", (LPCWSTR)#exp))
  21. #else
  22. #define ASSERT(exp)
  23. #endif /* DEBUG */
  24. /* debug evaluation macro */
  25. /*
  26. * EVAL() may only be used as a logical expression.
  27. *
  28. * E.g.,
  29. *
  30. * if (EVAL(exp))
  31. * bResult = TRUE;
  32. */
  33. /*#ifdef DEBUG
  34. #define EVAL(exp) \
  35. ((exp) || \
  36. (ERROR_OUT(("evaluation failed '%s'", (LPCWSTR)#exp)), 0))
  37. #else
  38. */
  39. #define EVAL(exp) \
  40. ((exp) != 0)
  41. /*#endif*/ /* DEBUG */
  42. /* handle validation macros */
  43. extern BOOL IsValidHWND(HWND);
  44. #ifdef DEBUG
  45. extern BOOL IsValidHANDLE(HANDLE);
  46. extern BOOL IsValidHEVENT(HANDLE);
  47. extern BOOL IsValidHFILE(HANDLE);
  48. extern BOOL IsValidHGLOBAL(HGLOBAL);
  49. extern BOOL IsValidHMENU(HMENU);
  50. extern BOOL IsValidHICON(HICON);
  51. extern BOOL IsValidHINSTANCE(HINSTANCE);
  52. extern BOOL IsValidHKEY(HKEY);
  53. extern BOOL IsValidHMODULE(HMODULE);
  54. extern BOOL IsValidHPROCESS(HANDLE);
  55. extern BOOL IsValidHTEMPLATEFILE(HANDLE);
  56. #endif
  57. #ifdef DEBUG
  58. #define IS_VALID_HANDLE(hnd, type) \
  59. (IsValidH##type(hnd) ? \
  60. TRUE : \
  61. (ERROR_OUT(("invalid H" #type " - %#08lx", (hnd))), FALSE))
  62. #else
  63. #define IS_VALID_HANDLE(hnd, type) \
  64. (IsValidH##type(hnd))
  65. #endif