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.3 KiB

  1. /***********************************************************************
  2. *
  3. * At Work Fax: Debug Trace Stuff
  4. *
  5. *
  6. * Copyright 1994 Microsoft Corporation. All Rights Reserved.
  7. *
  8. *
  9. ***********************************************************************/
  10. #ifndef awDebug_h_include
  11. #define awDebug_h_include
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifdef DEBUG
  16. // prototypes
  17. void _DebugCheckHeap(void);
  18. VOID FAR CDECL DebugPrintf(LPSTR lpszFmt, ...);
  19. VOID FAR CDECL DebugErrorPrintf(LPSTR lpszFmt, ...);
  20. // macros
  21. #define AwTraceEntry( f ) DebugPrintf("ENTER->"#f"\n")
  22. #define AwDebugTrace( x ) DebugPrintf x
  23. #define AwDebugError( x ) DebugErrorPrintf x
  24. // MAPI Debug traces
  25. #define AwDebugTraceSc(f,sc) \
  26. DebugErrorPrintf(#f " returns 0x%08lX %s\n", sc, SzDecodeScode(sc))
  27. #define AwDebugTraceResult(f,hr) \
  28. DebugErrorPrintf(#f " returns 0x%08lX %s\n", GetScode(hr), \
  29. SzDecodeScode(GetScode(hr)))
  30. #define AwDebugTraceArg(f,s) \
  31. DebugPrintf(#f ": bad parameter: " s "\n")
  32. #define AwDebugTraceLine() \
  33. (DebugPrintf("File %s, Line %i \n",__FILE__,__LINE__))
  34. #define AwDebugCheckHeap() _DebugCheckHeap()
  35. #else
  36. #define AwTraceEntry( f )
  37. #define AwDebugTrace(x)
  38. #define AwDebugError(x)
  39. #define AwDebugTraceResult(f,hr)
  40. #define AwDebugTraceSc(f,sc)
  41. #define AwDebugTraceLine()
  42. #define AwDebugTraceArg(x,y)
  43. #define AwDebugCheckHeap()
  44. #endif
  45. /***********************************************************************
  46. *
  47. * Memory tracking functions and defines
  48. *
  49. ***********************************************************************/
  50. // memory tracking macros
  51. #define FREE_ALL_LEAKS 0x00000001
  52. #define DUMP_LEAKED_MEMORY 0x00000002
  53. #ifdef MEM_TRACKING
  54. #define INIT_MEMORY_TRACKING InitMemoryTracking
  55. #define STOP_MEMORY_TRACKING UnInitMemoryTracking
  56. #define REGISTER_ALLOC RegisterMemoryAlloc
  57. #define REGISTER_FREE UnRegisterMemoryAlloc
  58. #else
  59. #define INIT_MEMORY_TRACKING
  60. #define STOP_MEMORY_TRACKING
  61. #define REGISTER_ALLOC
  62. #define REGISTER_FREE
  63. #endif // MEM_TRACKING
  64. // memory tracking functions prototypes
  65. BOOL InitMemoryTracking(LPTSTR lpszProcessName);
  66. BOOL UnInitMemoryTracking(ULONG);
  67. BOOL RegisterMemoryAlloc(LPVOID lpMem, ULONG cBytes);
  68. BOOL UnRegisterMemoryAlloc(LPVOID lpMem);
  69. #ifdef __cplusplus
  70. } // extern "C"
  71. #endif
  72. #endif // awDebug_h_include