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.

96 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1994-7 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This file contains debugging macros for the binl server.
  7. Author:
  8. Colin Watson (colinw) 14-Apr-1997
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #if DBG==1
  14. // Leak detection
  15. //
  16. #define INITIALIZE_TRACE_MEMORY InitializeCriticalSection( &g_TraceMemoryCS );\
  17. g_TraceMemoryTable = NULL;
  18. #define UNINITIALIZE_TRACE_MEMORY DebugMemoryCheck( );\
  19. DeleteCriticalSection( &g_TraceMemoryCS );
  20. extern CRITICAL_SECTION g_TraceMemoryCS;
  21. typedef struct _MEMORYBLOCK {
  22. HGLOBAL hglobal;
  23. DWORD dwBytes;
  24. UINT uFlags;
  25. LPCSTR pszComment;
  26. struct _MEMORYBLOCK *pNext;
  27. } MEMORYBLOCK, *LPMEMORYBLOCK;
  28. extern LPMEMORYBLOCK g_TraceMemoryTable;
  29. HGLOBAL
  30. DebugAlloc(
  31. UINT uFlags,
  32. DWORD dwBytes,
  33. LPCSTR pszComment );
  34. void
  35. DebugMemoryDelete(
  36. HGLOBAL hglobal );
  37. HGLOBAL
  38. DebugMemoryAdd(
  39. HGLOBAL hglobal,
  40. DWORD dwBytes,
  41. LPCSTR pszComment );
  42. HGLOBAL
  43. DebugFree(
  44. HGLOBAL hglobal );
  45. void
  46. DebugMemoryCheck( );
  47. HGLOBAL
  48. TCReAlloc(
  49. HGLOBAL mem,
  50. DWORD size,
  51. LPCSTR comment
  52. );
  53. #define TCAllocate(x,s) DebugAlloc(GMEM_ZEROINIT, x, s)
  54. #define TCFree(x) DebugFree(x)
  55. #define TCDebugPrint(x) DbgPrint x
  56. #else // not DBG
  57. #define INITIALIZE_TRACE_MEMORY
  58. #define UNINITIALIZE_TRACE_MEMORY
  59. #define TCDebugPrint(x)
  60. #define TCAllocate(x,s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, x)
  61. #define TCFree(x) HeapFree(GetProcessHeap(),0,x)
  62. #define TCReAlloc(x, y , z) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, x,y)
  63. #endif // not DBG